From b0017bf1b96ef14fc1ecf91c0b9c4b18e2dfea71 Mon Sep 17 00:00:00 2001 From: James Long Date: Wed, 25 Mar 2026 10:47:40 -0400 Subject: feat(core): initial implementation of syncing (#17814) --- packages/sdk/js/src/v2/gen/sdk.gen.ts | 20 + packages/sdk/js/src/v2/gen/types.gen.ts | 1401 +++++++++++++++++-------------- 2 files changed, 782 insertions(+), 639 deletions(-) (limited to 'packages/sdk/js/src') diff --git a/packages/sdk/js/src/v2/gen/sdk.gen.ts b/packages/sdk/js/src/v2/gen/sdk.gen.ts index 7a4f4e40c..410906844 100644 --- a/packages/sdk/js/src/v2/gen/sdk.gen.ts +++ b/packages/sdk/js/src/v2/gen/sdk.gen.ts @@ -46,6 +46,7 @@ import type { GlobalDisposeResponses, GlobalEventResponses, GlobalHealthResponses, + GlobalSyncEventSubscribeResponses, GlobalUpgradeErrors, GlobalUpgradeResponses, InstanceDisposeResponses, @@ -230,6 +231,20 @@ class HeyApiRegistry { } } +export class SyncEvent extends HeyApiClient { + /** + * Subscribe to global sync events + * + * Get global sync events + */ + public subscribe(options?: Options) { + return (options?.client ?? this.client).sse.get({ + url: "/global/sync-event", + ...options, + }) + } +} + export class Config extends HeyApiClient { /** * Get global configuration @@ -329,6 +344,11 @@ export class Global extends HeyApiClient { }) } + private _syncEvent?: SyncEvent + get syncEvent(): SyncEvent { + return (this._syncEvent ??= new SyncEvent({ client: this.client })) + } + private _config?: Config get config(): Config { return (this._config ??= new Config({ client: this.client })) diff --git a/packages/sdk/js/src/v2/gen/types.gen.ts b/packages/sdk/js/src/v2/gen/types.gen.ts index 86a0c7e42..43ce02921 100644 --- a/packages/sdk/js/src/v2/gen/types.gen.ts +++ b/packages/sdk/js/src/v2/gen/types.gen.ts @@ -83,715 +83,816 @@ export type EventLspUpdated = { } } -export type EventFileEdited = { - type: "file.edited" +export type EventMessagePartDelta = { + type: "message.part.delta" properties: { - file: string + sessionID: string + messageID: string + partID: string + field: string + delta: string } } -export type OutputFormatText = { - type: "text" -} - -export type JsonSchema = { - [key: string]: unknown -} - -export type OutputFormatJsonSchema = { - type: "json_schema" - schema: JsonSchema - retryCount?: number -} - -export type OutputFormat = OutputFormatText | OutputFormatJsonSchema - -export type FileDiff = { - file: string - before: string - after: string - additions: number - deletions: number - status?: "added" | "deleted" | "modified" -} - -export type UserMessage = { +export type PermissionRequest = { id: string sessionID: string - role: "user" - time: { - created: number - } - format?: OutputFormat - summary?: { - title?: string - body?: string - diffs: Array - } - agent: string - model: { - providerID: string - modelID: string + permission: string + patterns: Array + metadata: { + [key: string]: unknown } - system?: string - tools?: { - [key: string]: boolean + always: Array + tool?: { + messageID: string + callID: string } - variant?: string } -export type ProviderAuthError = { - name: "ProviderAuthError" - data: { - providerID: string - message: string - } +export type EventPermissionAsked = { + type: "permission.asked" + properties: PermissionRequest } -export type UnknownError = { - name: "UnknownError" - data: { - message: string +export type EventPermissionReplied = { + type: "permission.replied" + properties: { + sessionID: string + requestID: string + reply: "once" | "always" | "reject" } } -export type MessageOutputLengthError = { - name: "MessageOutputLengthError" - data: { - [key: string]: unknown - } -} +export type SessionStatus = + | { + type: "idle" + } + | { + type: "retry" + attempt: number + message: string + next: number + } + | { + type: "busy" + } -export type MessageAbortedError = { - name: "MessageAbortedError" - data: { - message: string +export type EventSessionStatus = { + type: "session.status" + properties: { + sessionID: string + status: SessionStatus } } -export type StructuredOutputError = { - name: "StructuredOutputError" - data: { - message: string - retries: number +export type EventSessionIdle = { + type: "session.idle" + properties: { + sessionID: string } } -export type ContextOverflowError = { - name: "ContextOverflowError" - data: { - message: string - responseBody?: string - } +export type QuestionOption = { + /** + * Display text (1-5 words, concise) + */ + label: string + /** + * Explanation of choice + */ + description: string } -export type ApiError = { - name: "APIError" - data: { - message: string - statusCode?: number - isRetryable: boolean - responseHeaders?: { - [key: string]: string - } - responseBody?: string - metadata?: { - [key: string]: string - } - } +export type QuestionInfo = { + /** + * Complete question + */ + question: string + /** + * Very short label (max 30 chars) + */ + header: string + /** + * Available choices + */ + options: Array + /** + * Allow selecting multiple choices + */ + multiple?: boolean + /** + * Allow typing a custom answer (default: true) + */ + custom?: boolean } -export type AssistantMessage = { +export type QuestionRequest = { id: string sessionID: string - role: "assistant" - time: { - created: number - completed?: number - } - error?: - | ProviderAuthError - | UnknownError - | MessageOutputLengthError - | MessageAbortedError - | StructuredOutputError - | ContextOverflowError - | ApiError - parentID: string - modelID: string - providerID: string - mode: string - agent: string - path: { - cwd: string - root: string - } - summary?: boolean - cost: number - tokens: { - total?: number - input: number - output: number - reasoning: number - cache: { - read: number - write: number - } + /** + * Questions to ask + */ + questions: Array + tool?: { + messageID: string + callID: string } - structured?: unknown - variant?: string - finish?: string } -export type Message = UserMessage | AssistantMessage +export type EventQuestionAsked = { + type: "question.asked" + properties: QuestionRequest +} -export type EventMessageUpdated = { - type: "message.updated" +export type QuestionAnswer = Array + +export type EventQuestionReplied = { + type: "question.replied" properties: { - info: Message + sessionID: string + requestID: string + answers: Array } } -export type EventMessageRemoved = { - type: "message.removed" +export type EventQuestionRejected = { + type: "question.rejected" properties: { sessionID: string - messageID: string + requestID: string } } -export type TextPart = { - id: string - sessionID: string - messageID: string - type: "text" - text: string - synthetic?: boolean - ignored?: boolean - time?: { - start: number - end?: number - } - metadata?: { - [key: string]: unknown +export type EventSessionCompacted = { + type: "session.compacted" + properties: { + sessionID: string } } -export type SubtaskPart = { - id: string - sessionID: string - messageID: string - type: "subtask" - prompt: string - description: string - agent: string - model?: { - providerID: string - modelID: string +export type EventFileEdited = { + type: "file.edited" + properties: { + file: string } - command?: string } -export type ReasoningPart = { - id: string - sessionID: string - messageID: string - type: "reasoning" - text: string - metadata?: { - [key: string]: unknown - } - time: { - start: number - end?: number +export type EventFileWatcherUpdated = { + type: "file.watcher.updated" + properties: { + file: string + event: "add" | "change" | "unlink" } } -export type FilePartSourceText = { - value: string - start: number - end: number +export type Todo = { + /** + * Brief description of the task + */ + content: string + /** + * Current status of the task: pending, in_progress, completed, cancelled + */ + status: string + /** + * Priority level of the task: high, medium, low + */ + priority: string } -export type FileSource = { - text: FilePartSourceText - type: "file" - path: string +export type EventTodoUpdated = { + type: "todo.updated" + properties: { + sessionID: string + todos: Array + } } -export type Range = { - start: { - line: number - character: number - } - end: { - line: number - character: number +export type EventTuiPromptAppend = { + type: "tui.prompt.append" + properties: { + text: string } } -export type SymbolSource = { - text: FilePartSourceText - type: "symbol" - path: string - range: Range - name: string - kind: number +export type EventTuiCommandExecute = { + type: "tui.command.execute" + properties: { + command: + | "session.list" + | "session.new" + | "session.share" + | "session.interrupt" + | "session.compact" + | "session.page.up" + | "session.page.down" + | "session.line.up" + | "session.line.down" + | "session.half.page.up" + | "session.half.page.down" + | "session.first" + | "session.last" + | "prompt.clear" + | "prompt.submit" + | "agent.cycle" + | string + } } -export type ResourceSource = { - text: FilePartSourceText - type: "resource" - clientName: string - uri: string +export type EventTuiToastShow = { + type: "tui.toast.show" + properties: { + title?: string + message: string + variant: "info" | "success" | "warning" | "error" + /** + * Duration in milliseconds + */ + duration?: number + } } -export type FilePartSource = FileSource | SymbolSource | ResourceSource - -export type FilePart = { - id: string - sessionID: string - messageID: string - type: "file" - mime: string - filename?: string - url: string - source?: FilePartSource +export type EventTuiSessionSelect = { + type: "tui.session.select" + properties: { + /** + * Session ID to navigate to + */ + sessionID: string + } } -export type ToolStatePending = { - status: "pending" - input: { - [key: string]: unknown +export type EventMcpToolsChanged = { + type: "mcp.tools.changed" + properties: { + server: string } - raw: string } -export type ToolStateRunning = { - status: "running" - input: { - [key: string]: unknown - } - title?: string - metadata?: { - [key: string]: unknown - } - time: { - start: number +export type EventMcpBrowserOpenFailed = { + type: "mcp.browser.open.failed" + properties: { + mcpName: string + url: string } } -export type ToolStateCompleted = { - status: "completed" - input: { - [key: string]: unknown +export type EventCommandExecuted = { + type: "command.executed" + properties: { + name: string + sessionID: string + arguments: string + messageID: string } - output: string - title: string - metadata: { - [key: string]: unknown +} + +export type FileDiff = { + file: string + before: string + after: string + additions: number + deletions: number + status?: "added" | "deleted" | "modified" +} + +export type EventSessionDiff = { + type: "session.diff" + properties: { + sessionID: string + diff: Array } - time: { - start: number - end: number - compacted?: number +} + +export type ProviderAuthError = { + name: "ProviderAuthError" + data: { + providerID: string + message: string } - attachments?: Array } -export type ToolStateError = { - status: "error" - input: { - [key: string]: unknown +export type UnknownError = { + name: "UnknownError" + data: { + message: string } - error: string - metadata?: { +} + +export type MessageOutputLengthError = { + name: "MessageOutputLengthError" + data: { [key: string]: unknown } - time: { - start: number - end: number - } } -export type ToolState = ToolStatePending | ToolStateRunning | ToolStateCompleted | ToolStateError +export type MessageAbortedError = { + name: "MessageAbortedError" + data: { + message: string + } +} -export type ToolPart = { - id: string - sessionID: string - messageID: string - type: "tool" - callID: string - tool: string - state: ToolState - metadata?: { - [key: string]: unknown +export type StructuredOutputError = { + name: "StructuredOutputError" + data: { + message: string + retries: number } } -export type StepStartPart = { - id: string - sessionID: string - messageID: string - type: "step-start" - snapshot?: string +export type ContextOverflowError = { + name: "ContextOverflowError" + data: { + message: string + responseBody?: string + } } -export type StepFinishPart = { - id: string - sessionID: string - messageID: string - type: "step-finish" - reason: string - snapshot?: string - cost: number - tokens: { - total?: number - input: number - output: number - reasoning: number - cache: { - read: number - write: number +export type ApiError = { + name: "APIError" + data: { + message: string + statusCode?: number + isRetryable: boolean + responseHeaders?: { + [key: string]: string + } + responseBody?: string + metadata?: { + [key: string]: string } } } -export type SnapshotPart = { - id: string - sessionID: string - messageID: string - type: "snapshot" - snapshot: string +export type EventSessionError = { + type: "session.error" + properties: { + sessionID?: string + error?: + | ProviderAuthError + | UnknownError + | MessageOutputLengthError + | MessageAbortedError + | StructuredOutputError + | ContextOverflowError + | ApiError + } } -export type PatchPart = { - id: string - sessionID: string - messageID: string - type: "patch" - hash: string - files: Array +export type EventVcsBranchUpdated = { + type: "vcs.branch.updated" + properties: { + branch?: string + } } -export type AgentPart = { - id: string - sessionID: string - messageID: string - type: "agent" - name: string - source?: { - value: string - start: number - end: number +export type EventWorkspaceReady = { + type: "workspace.ready" + properties: { + name: string } } -export type RetryPart = { - id: string - sessionID: string - messageID: string - type: "retry" - attempt: number - error: ApiError - time: { - created: number +export type EventWorkspaceFailed = { + type: "workspace.failed" + properties: { + message: string } } -export type CompactionPart = { +export type Pty = { id: string - sessionID: string - messageID: string - type: "compaction" - auto: boolean - overflow?: boolean + title: string + command: string + args: Array + cwd: string + status: "running" | "exited" + pid: number } -export type Part = - | TextPart - | SubtaskPart - | ReasoningPart - | FilePart - | ToolPart - | StepStartPart - | StepFinishPart - | SnapshotPart - | PatchPart - | AgentPart - | RetryPart - | CompactionPart - -export type EventMessagePartUpdated = { - type: "message.part.updated" +export type EventPtyCreated = { + type: "pty.created" properties: { - part: Part + info: Pty } } -export type EventMessagePartDelta = { - type: "message.part.delta" +export type EventPtyUpdated = { + type: "pty.updated" properties: { - sessionID: string - messageID: string - partID: string - field: string - delta: string + info: Pty } } -export type EventMessagePartRemoved = { - type: "message.part.removed" +export type EventPtyExited = { + type: "pty.exited" properties: { - sessionID: string - messageID: string - partID: string + id: string + exitCode: number } } -export type PermissionRequest = { - id: string - sessionID: string - permission: string - patterns: Array - metadata: { - [key: string]: unknown - } - always: Array - tool?: { - messageID: string - callID: string +export type EventPtyDeleted = { + type: "pty.deleted" + properties: { + id: string } } -export type EventPermissionAsked = { - type: "permission.asked" - properties: PermissionRequest -} - -export type EventPermissionReplied = { - type: "permission.replied" +export type EventWorktreeReady = { + type: "worktree.ready" properties: { - sessionID: string - requestID: string - reply: "once" | "always" | "reject" + name: string + branch: string } } -export type SessionStatus = - | { - type: "idle" - } - | { - type: "retry" - attempt: number - message: string - next: number - } - | { - type: "busy" - } - -export type EventSessionStatus = { - type: "session.status" +export type EventWorktreeFailed = { + type: "worktree.failed" properties: { - sessionID: string - status: SessionStatus + message: string } } -export type EventSessionIdle = { - type: "session.idle" - properties: { - sessionID: string - } +export type OutputFormatText = { + type: "text" } -export type QuestionOption = { - /** - * Display text (1-5 words, concise) - */ - label: string - /** - * Explanation of choice - */ - description: string +export type JsonSchema = { + [key: string]: unknown } -export type QuestionInfo = { - /** - * Complete question - */ - question: string - /** - * Very short label (max 30 chars) - */ - header: string - /** - * Available choices - */ - options: Array - /** - * Allow selecting multiple choices - */ - multiple?: boolean - /** - * Allow typing a custom answer (default: true) - */ - custom?: boolean +export type OutputFormatJsonSchema = { + type: "json_schema" + schema: JsonSchema + retryCount?: number } -export type QuestionRequest = { +export type OutputFormat = OutputFormatText | OutputFormatJsonSchema + +export type UserMessage = { id: string sessionID: string - /** - * Questions to ask - */ - questions: Array - tool?: { - messageID: string - callID: string + role: "user" + time: { + created: number } -} - -export type EventQuestionAsked = { - type: "question.asked" - properties: QuestionRequest -} - -export type QuestionAnswer = Array - -export type EventQuestionReplied = { - type: "question.replied" - properties: { - sessionID: string - requestID: string - answers: Array + format?: OutputFormat + summary?: { + title?: string + body?: string + diffs: Array + } + agent: string + model: { + providerID: string + modelID: string + } + system?: string + tools?: { + [key: string]: boolean } + variant?: string } -export type EventQuestionRejected = { - type: "question.rejected" +export type AssistantMessage = { + id: string + sessionID: string + role: "assistant" + time: { + created: number + completed?: number + } + error?: + | ProviderAuthError + | UnknownError + | MessageOutputLengthError + | MessageAbortedError + | StructuredOutputError + | ContextOverflowError + | ApiError + parentID: string + modelID: string + providerID: string + mode: string + agent: string + path: { + cwd: string + root: string + } + summary?: boolean + cost: number + tokens: { + total?: number + input: number + output: number + reasoning: number + cache: { + read: number + write: number + } + } + structured?: unknown + variant?: string + finish?: string +} + +export type Message = UserMessage | AssistantMessage + +export type EventMessageUpdated = { + type: "message.updated" properties: { sessionID: string - requestID: string + info: Message } } -export type EventSessionCompacted = { - type: "session.compacted" +export type EventMessageRemoved = { + type: "message.removed" properties: { sessionID: string + messageID: string } } -export type EventFileWatcherUpdated = { - type: "file.watcher.updated" - properties: { - file: string - event: "add" | "change" | "unlink" +export type TextPart = { + id: string + sessionID: string + messageID: string + type: "text" + text: string + synthetic?: boolean + ignored?: boolean + time?: { + start: number + end?: number + } + metadata?: { + [key: string]: unknown } } -export type Todo = { - /** - * Brief description of the task - */ - content: string - /** - * Current status of the task: pending, in_progress, completed, cancelled - */ - status: string - /** - * Priority level of the task: high, medium, low - */ - priority: string +export type SubtaskPart = { + id: string + sessionID: string + messageID: string + type: "subtask" + prompt: string + description: string + agent: string + model?: { + providerID: string + modelID: string + } + command?: string } -export type EventTodoUpdated = { - type: "todo.updated" - properties: { - sessionID: string - todos: Array +export type ReasoningPart = { + id: string + sessionID: string + messageID: string + type: "reasoning" + text: string + metadata?: { + [key: string]: unknown + } + time: { + start: number + end?: number } } -export type EventTuiPromptAppend = { - type: "tui.prompt.append" - properties: { - text: string +export type FilePartSourceText = { + value: string + start: number + end: number +} + +export type FileSource = { + text: FilePartSourceText + type: "file" + path: string +} + +export type Range = { + start: { + line: number + character: number + } + end: { + line: number + character: number } } -export type EventTuiCommandExecute = { - type: "tui.command.execute" - properties: { - command: - | "session.list" - | "session.new" - | "session.share" - | "session.interrupt" - | "session.compact" - | "session.page.up" - | "session.page.down" - | "session.line.up" - | "session.line.down" - | "session.half.page.up" - | "session.half.page.down" - | "session.first" - | "session.last" - | "prompt.clear" - | "prompt.submit" - | "agent.cycle" - | string +export type SymbolSource = { + text: FilePartSourceText + type: "symbol" + path: string + range: Range + name: string + kind: number +} + +export type ResourceSource = { + text: FilePartSourceText + type: "resource" + clientName: string + uri: string +} + +export type FilePartSource = FileSource | SymbolSource | ResourceSource + +export type FilePart = { + id: string + sessionID: string + messageID: string + type: "file" + mime: string + filename?: string + url: string + source?: FilePartSource +} + +export type ToolStatePending = { + status: "pending" + input: { + [key: string]: unknown + } + raw: string +} + +export type ToolStateRunning = { + status: "running" + input: { + [key: string]: unknown + } + title?: string + metadata?: { + [key: string]: unknown + } + time: { + start: number + } +} + +export type ToolStateCompleted = { + status: "completed" + input: { + [key: string]: unknown + } + output: string + title: string + metadata: { + [key: string]: unknown } + time: { + start: number + end: number + compacted?: number + } + attachments?: Array +} + +export type ToolStateError = { + status: "error" + input: { + [key: string]: unknown + } + error: string + metadata?: { + [key: string]: unknown + } + time: { + start: number + end: number + } +} + +export type ToolState = ToolStatePending | ToolStateRunning | ToolStateCompleted | ToolStateError + +export type ToolPart = { + id: string + sessionID: string + messageID: string + type: "tool" + callID: string + tool: string + state: ToolState + metadata?: { + [key: string]: unknown + } +} + +export type StepStartPart = { + id: string + sessionID: string + messageID: string + type: "step-start" + snapshot?: string +} + +export type StepFinishPart = { + id: string + sessionID: string + messageID: string + type: "step-finish" + reason: string + snapshot?: string + cost: number + tokens: { + total?: number + input: number + output: number + reasoning: number + cache: { + read: number + write: number + } + } +} + +export type SnapshotPart = { + id: string + sessionID: string + messageID: string + type: "snapshot" + snapshot: string +} + +export type PatchPart = { + id: string + sessionID: string + messageID: string + type: "patch" + hash: string + files: Array } -export type EventTuiToastShow = { - type: "tui.toast.show" - properties: { - title?: string - message: string - variant: "info" | "success" | "warning" | "error" - /** - * Duration in milliseconds - */ - duration?: number +export type AgentPart = { + id: string + sessionID: string + messageID: string + type: "agent" + name: string + source?: { + value: string + start: number + end: number } } -export type EventTuiSessionSelect = { - type: "tui.session.select" - properties: { - /** - * Session ID to navigate to - */ - sessionID: string +export type RetryPart = { + id: string + sessionID: string + messageID: string + type: "retry" + attempt: number + error: ApiError + time: { + created: number } } -export type EventMcpToolsChanged = { - type: "mcp.tools.changed" - properties: { - server: string - } +export type CompactionPart = { + id: string + sessionID: string + messageID: string + type: "compaction" + auto: boolean + overflow?: boolean } -export type EventMcpBrowserOpenFailed = { - type: "mcp.browser.open.failed" +export type Part = + | TextPart + | SubtaskPart + | ReasoningPart + | FilePart + | ToolPart + | StepStartPart + | StepFinishPart + | SnapshotPart + | PatchPart + | AgentPart + | RetryPart + | CompactionPart + +export type EventMessagePartUpdated = { + type: "message.part.updated" properties: { - mcpName: string - url: string + sessionID: string + part: Part + time: number } } -export type EventCommandExecuted = { - type: "command.executed" +export type EventMessagePartRemoved = { + type: "message.part.removed" properties: { - name: string sessionID: string - arguments: string messageID: string + partID: string } } @@ -841,6 +942,7 @@ export type Session = { export type EventSessionCreated = { type: "session.created" properties: { + sessionID: string info: Session } } @@ -848,112 +950,16 @@ export type EventSessionCreated = { export type EventSessionUpdated = { type: "session.updated" properties: { + sessionID: string info: Session } } export type EventSessionDeleted = { type: "session.deleted" - properties: { - info: Session - } -} - -export type EventSessionDiff = { - type: "session.diff" properties: { sessionID: string - diff: Array - } -} - -export type EventSessionError = { - type: "session.error" - properties: { - sessionID?: string - error?: - | ProviderAuthError - | UnknownError - | MessageOutputLengthError - | MessageAbortedError - | StructuredOutputError - | ContextOverflowError - | ApiError - } -} - -export type EventVcsBranchUpdated = { - type: "vcs.branch.updated" - properties: { - branch?: string - } -} - -export type EventWorkspaceReady = { - type: "workspace.ready" - properties: { - name: string - } -} - -export type EventWorkspaceFailed = { - type: "workspace.failed" - properties: { - message: string - } -} - -export type Pty = { - id: string - title: string - command: string - args: Array - cwd: string - status: "running" | "exited" - pid: number -} - -export type EventPtyCreated = { - type: "pty.created" - properties: { - info: Pty - } -} - -export type EventPtyUpdated = { - type: "pty.updated" - properties: { - info: Pty - } -} - -export type EventPtyExited = { - type: "pty.exited" - properties: { - id: string - exitCode: number - } -} - -export type EventPtyDeleted = { - type: "pty.deleted" - properties: { - id: string - } -} - -export type EventWorktreeReady = { - type: "worktree.ready" - properties: { - name: string - branch: string - } -} - -export type EventWorktreeFailed = { - type: "worktree.failed" - properties: { - message: string + info: Session } } @@ -966,12 +972,7 @@ export type Event = | EventGlobalDisposed | EventLspClientDiagnostics | EventLspUpdated - | EventFileEdited - | EventMessageUpdated - | EventMessageRemoved - | EventMessagePartUpdated | EventMessagePartDelta - | EventMessagePartRemoved | EventPermissionAsked | EventPermissionReplied | EventSessionStatus @@ -980,6 +981,7 @@ export type Event = | EventQuestionReplied | EventQuestionRejected | EventSessionCompacted + | EventFileEdited | EventFileWatcherUpdated | EventTodoUpdated | EventTuiPromptAppend @@ -989,9 +991,6 @@ export type Event = | EventMcpToolsChanged | EventMcpBrowserOpenFailed | EventCommandExecuted - | EventSessionCreated - | EventSessionUpdated - | EventSessionDeleted | EventSessionDiff | EventSessionError | EventVcsBranchUpdated @@ -1003,12 +1002,119 @@ export type Event = | EventPtyDeleted | EventWorktreeReady | EventWorktreeFailed + | EventMessageUpdated + | EventMessageRemoved + | EventMessagePartUpdated + | EventMessagePartRemoved + | EventSessionCreated + | EventSessionUpdated + | EventSessionDeleted export type GlobalEvent = { directory: string payload: Event } +export type SyncEventMessageUpdated = { + type: "message.updated.1" + aggregate: "sessionID" + data: { + sessionID: string + info: Message + } +} + +export type SyncEventMessageRemoved = { + type: "message.removed.1" + aggregate: "sessionID" + data: { + sessionID: string + messageID: string + } +} + +export type SyncEventMessagePartUpdated = { + type: "message.part.updated.1" + aggregate: "sessionID" + data: { + sessionID: string + part: Part + time: number + } +} + +export type SyncEventMessagePartRemoved = { + type: "message.part.removed.1" + aggregate: "sessionID" + data: { + sessionID: string + messageID: string + partID: string + } +} + +export type SyncEventSessionCreated = { + type: "session.created.1" + aggregate: "sessionID" + data: { + sessionID: string + info: Session + } +} + +export type SyncEventSessionUpdated = { + type: "session.updated.1" + aggregate: "sessionID" + data: { + sessionID: string + info: { + id?: string + slug?: string + projectID?: string + workspaceID?: string + directory?: string + parentID?: string + summary?: { + additions: number + deletions: number + files: number + diffs?: Array + } + share?: { + url?: string + } + title?: string + version?: string + time?: { + created?: number + updated?: number + compacting?: number + archived?: number + } + permission?: PermissionRuleset + revert?: { + messageID: string + partID?: string + snapshot?: string + diff?: string + } + } + } +} + +export type SyncEventSessionDeleted = { + type: "session.deleted.1" + aggregate: "sessionID" + data: { + sessionID: string + info: Session + } +} + +export type SyncEvent = { + payload: SyncEvent +} + /** * Log level */ @@ -1973,6 +2079,23 @@ export type GlobalEventResponses = { export type GlobalEventResponse = GlobalEventResponses[keyof GlobalEventResponses] +export type GlobalSyncEventSubscribeData = { + body?: never + path?: never + query?: never + url: "/global/sync-event" +} + +export type GlobalSyncEventSubscribeResponses = { + /** + * Event stream + */ + 200: SyncEvent +} + +export type GlobalSyncEventSubscribeResponse = + GlobalSyncEventSubscribeResponses[keyof GlobalSyncEventSubscribeResponses] + export type GlobalConfigGetData = { body?: never path?: never -- cgit v1.2.3