From 7116af864d64275ecbc41ea64fed5e9b90ef53ba Mon Sep 17 00:00:00 2001 From: Leo Agent Date: Fri, 20 Mar 2026 12:09:35 +0700 Subject: [PATCH] feat(types): add SessionRecord and TelegramPlatformData types Entire-Checkpoint: 36c1062c2553 --- src/core/types.ts | 127 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 88 insertions(+), 39 deletions(-) diff --git a/src/core/types.ts b/src/core/types.ts index 1417c9c..15df618 100644 --- a/src/core/types.ts +++ b/src/core/types.ts @@ -1,65 +1,114 @@ export interface IncomingMessage { - channelId: string - threadId: string - userId: string - text: string + channelId: string; + threadId: string; + userId: string; + text: string; } export interface OutgoingMessage { - type: 'text' | 'thought' | 'tool_call' | 'tool_update' | 'plan' | 'usage' | 'session_end' | 'error' - text: string - metadata?: Record + type: + | "text" + | "thought" + | "tool_call" + | "tool_update" + | "plan" + | "usage" + | "session_end" + | "error"; + text: string; + metadata?: Record; } export interface PermissionRequest { - id: string - description: string - options: PermissionOption[] + id: string; + description: string; + options: PermissionOption[]; } export interface PermissionOption { - id: string - label: string - isAllow: boolean + id: string; + label: string; + isAllow: boolean; } export interface NotificationMessage { - sessionId: string - sessionName?: string - type: 'completed' | 'error' | 'permission' | 'input_required' - summary: string - deepLink?: string + sessionId: string; + sessionName?: string; + type: "completed" | "error" | "permission" | "input_required"; + summary: string; + deepLink?: string; } export interface AgentCommand { - name: string - description: string - input?: unknown + name: string; + description: string; + input?: unknown; } export type AgentEvent = - | { type: 'text'; content: string } - | { type: 'thought'; content: string } - | { type: 'tool_call'; id: string; name: string; kind?: string; status: string; content?: unknown; locations?: unknown } - | { type: 'tool_update'; id: string; status: string; content?: unknown; locations?: unknown } - | { type: 'plan'; entries: PlanEntry[] } - | { type: 'usage'; tokensUsed?: number; contextSize?: number; cost?: { amount: number; currency: string } } - | { type: 'commands_update'; commands: AgentCommand[] } - | { type: 'session_end'; reason: string } - | { type: 'error'; message: string } + | { type: "text"; content: string } + | { type: "thought"; content: string } + | { + type: "tool_call"; + id: string; + name: string; + kind?: string; + status: string; + content?: unknown; + locations?: unknown; + } + | { + type: "tool_update"; + id: string; + status: string; + content?: unknown; + locations?: unknown; + } + | { type: "plan"; entries: PlanEntry[] } + | { + type: "usage"; + tokensUsed?: number; + contextSize?: number; + cost?: { amount: number; currency: string }; + } + | { type: "commands_update"; commands: AgentCommand[] } + | { type: "session_end"; reason: string } + | { type: "error"; message: string }; export interface PlanEntry { - content: string - status: 'pending' | 'in_progress' | 'completed' - priority: 'high' | 'medium' | 'low' + content: string; + status: "pending" | "in_progress" | "completed"; + priority: "high" | "medium" | "low"; } export interface AgentDefinition { - name: string - command: string - args: string[] - workingDirectory?: string - env?: Record + name: string; + command: string; + args: string[]; + workingDirectory?: string; + env?: Record; } -export type SessionStatus = 'initializing' | 'active' | 'cancelled' | 'finished' | 'error' +export type SessionStatus = + | "initializing" + | "active" + | "cancelled" + | "finished" + | "error"; + +export interface SessionRecord

> { + sessionId: string; + agentSessionId: string; + agentName: string; + workingDir: string; + channelId: string; + status: SessionStatus; + createdAt: string; + lastActiveAt: string; + name?: string; + platform: P; +} + +export interface TelegramPlatformData { + topicId: number; +}