@opencode-ai/sdk 1.0.64 → 1.0.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,517 +1,411 @@
1
- export type Project = {
1
+ export type EventInstallationUpdated = {
2
+ type: "installation.updated";
3
+ properties: {
4
+ version: string;
5
+ };
6
+ };
7
+ export type EventLspClientDiagnostics = {
8
+ type: "lsp.client.diagnostics";
9
+ properties: {
10
+ serverID: string;
11
+ path: string;
12
+ };
13
+ };
14
+ export type EventLspUpdated = {
15
+ type: "lsp.updated";
16
+ properties: {
17
+ [key: string]: unknown;
18
+ };
19
+ };
20
+ export type FileDiff = {
21
+ file: string;
22
+ before: string;
23
+ after: string;
24
+ additions: number;
25
+ deletions: number;
26
+ };
27
+ export type UserMessage = {
2
28
  id: string;
3
- worktree: string;
4
- vcs?: "git";
29
+ sessionID: string;
30
+ role: "user";
5
31
  time: {
6
32
  created: number;
7
- initialized?: number;
33
+ };
34
+ summary?: {
35
+ title?: string;
36
+ body?: string;
37
+ diffs: Array<FileDiff>;
8
38
  };
9
39
  };
10
- /**
11
- * Custom keybind configurations
12
- */
13
- export type KeybindsConfig = {
14
- /**
15
- * Leader key for keybind combinations
16
- */
17
- leader?: string;
18
- /**
19
- * Exit the application
20
- */
21
- app_exit?: string;
22
- /**
23
- * Open external editor
24
- */
25
- editor_open?: string;
26
- /**
27
- * List available themes
28
- */
29
- theme_list?: string;
30
- /**
31
- * Toggle sidebar
32
- */
33
- sidebar_toggle?: string;
34
- /**
35
- * View status
36
- */
37
- status_view?: string;
38
- /**
39
- * Export session to editor
40
- */
41
- session_export?: string;
42
- /**
43
- * Create a new session
44
- */
45
- session_new?: string;
46
- /**
47
- * List all sessions
48
- */
49
- session_list?: string;
50
- /**
51
- * Show session timeline
52
- */
53
- session_timeline?: string;
54
- /**
55
- * Share current session
56
- */
57
- session_share?: string;
58
- /**
59
- * Unshare current session
60
- */
61
- session_unshare?: string;
62
- /**
63
- * Interrupt current session
64
- */
65
- session_interrupt?: string;
66
- /**
67
- * Compact the session
68
- */
69
- session_compact?: string;
70
- /**
71
- * Scroll messages up by one page
72
- */
73
- messages_page_up?: string;
74
- /**
75
- * Scroll messages down by one page
76
- */
77
- messages_page_down?: string;
78
- /**
79
- * Scroll messages up by half page
80
- */
81
- messages_half_page_up?: string;
82
- /**
83
- * Scroll messages down by half page
84
- */
85
- messages_half_page_down?: string;
86
- /**
87
- * Navigate to first message
88
- */
89
- messages_first?: string;
90
- /**
91
- * Navigate to last message
92
- */
93
- messages_last?: string;
94
- /**
95
- * Copy message
96
- */
97
- messages_copy?: string;
98
- /**
99
- * Undo message
100
- */
101
- messages_undo?: string;
102
- /**
103
- * Redo message
104
- */
105
- messages_redo?: string;
106
- /**
107
- * Toggle code block concealment in messages
108
- */
109
- messages_toggle_conceal?: string;
110
- /**
111
- * List available models
112
- */
113
- model_list?: string;
114
- /**
115
- * Next recently used model
116
- */
117
- model_cycle_recent?: string;
118
- /**
119
- * Previous recently used model
120
- */
121
- model_cycle_recent_reverse?: string;
122
- /**
123
- * List available commands
124
- */
125
- command_list?: string;
126
- /**
127
- * List agents
128
- */
129
- agent_list?: string;
130
- /**
131
- * Next agent
132
- */
133
- agent_cycle?: string;
134
- /**
135
- * Previous agent
136
- */
137
- agent_cycle_reverse?: string;
138
- /**
139
- * Clear input field
140
- */
141
- input_clear?: string;
142
- /**
143
- * Forward delete
144
- */
145
- input_forward_delete?: string;
146
- /**
147
- * Paste from clipboard
148
- */
149
- input_paste?: string;
150
- /**
151
- * Submit input
152
- */
153
- input_submit?: string;
154
- /**
155
- * Insert newline in input
156
- */
157
- input_newline?: string;
158
- /**
159
- * Previous history item
160
- */
161
- history_previous?: string;
162
- /**
163
- * Next history item
164
- */
165
- history_next?: string;
166
- /**
167
- * Next child session
168
- */
169
- session_child_cycle?: string;
170
- /**
171
- * Previous child session
172
- */
173
- session_child_cycle_reverse?: string;
40
+ export type ProviderAuthError = {
41
+ name: "ProviderAuthError";
42
+ data: {
43
+ providerID: string;
44
+ message: string;
45
+ };
174
46
  };
175
- export type AgentConfig = {
176
- model?: string;
177
- temperature?: number;
178
- top_p?: number;
179
- prompt?: string;
180
- tools?: {
181
- [key: string]: boolean;
47
+ export type UnknownError = {
48
+ name: "UnknownError";
49
+ data: {
50
+ message: string;
182
51
  };
183
- disable?: boolean;
184
- /**
185
- * Description of when to use the agent
186
- */
187
- description?: string;
188
- mode?: "subagent" | "primary" | "all";
189
- /**
190
- * Hex color code for the agent (e.g., #FF5733)
191
- */
192
- color?: string;
193
- permission?: {
194
- edit?: "ask" | "allow" | "deny";
195
- bash?: ("ask" | "allow" | "deny") | {
196
- [key: string]: "ask" | "allow" | "deny";
197
- };
198
- webfetch?: "ask" | "allow" | "deny";
199
- doom_loop?: "ask" | "allow" | "deny";
200
- external_directory?: "ask" | "allow" | "deny";
52
+ };
53
+ export type MessageOutputLengthError = {
54
+ name: "MessageOutputLengthError";
55
+ data: {
56
+ [key: string]: unknown;
201
57
  };
202
- [key: string]: unknown | string | number | {
203
- [key: string]: boolean;
204
- } | boolean | ("subagent" | "primary" | "all") | {
205
- edit?: "ask" | "allow" | "deny";
206
- bash?: ("ask" | "allow" | "deny") | {
207
- [key: string]: "ask" | "allow" | "deny";
58
+ };
59
+ export type MessageAbortedError = {
60
+ name: "MessageAbortedError";
61
+ data: {
62
+ message: string;
63
+ };
64
+ };
65
+ export type ApiError = {
66
+ name: "APIError";
67
+ data: {
68
+ message: string;
69
+ statusCode?: number;
70
+ isRetryable: boolean;
71
+ responseHeaders?: {
72
+ [key: string]: string;
208
73
  };
209
- webfetch?: "ask" | "allow" | "deny";
210
- doom_loop?: "ask" | "allow" | "deny";
211
- external_directory?: "ask" | "allow" | "deny";
212
- } | undefined;
74
+ responseBody?: string;
75
+ };
213
76
  };
214
- export type McpLocalConfig = {
215
- /**
216
- * Type of MCP server connection
217
- */
218
- type: "local";
219
- /**
220
- * Command and arguments to run the MCP server
221
- */
222
- command: Array<string>;
223
- /**
224
- * Environment variables to set when running the MCP server
225
- */
226
- environment?: {
227
- [key: string]: string;
77
+ export type AssistantMessage = {
78
+ id: string;
79
+ sessionID: string;
80
+ role: "assistant";
81
+ time: {
82
+ created: number;
83
+ completed?: number;
84
+ };
85
+ error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError;
86
+ parentID: string;
87
+ modelID: string;
88
+ providerID: string;
89
+ mode: string;
90
+ path: {
91
+ cwd: string;
92
+ root: string;
93
+ };
94
+ summary?: boolean;
95
+ cost: number;
96
+ tokens: {
97
+ input: number;
98
+ output: number;
99
+ reasoning: number;
100
+ cache: {
101
+ read: number;
102
+ write: number;
103
+ };
228
104
  };
229
- /**
230
- * Enable or disable the MCP server on startup
231
- */
232
- enabled?: boolean;
233
- /**
234
- * Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds) if not specified.
235
- */
236
- timeout?: number;
237
105
  };
238
- export type McpRemoteConfig = {
239
- /**
240
- * Type of MCP server connection
241
- */
242
- type: "remote";
243
- /**
244
- * URL of the remote MCP server
245
- */
246
- url: string;
247
- /**
248
- * Enable or disable the MCP server on startup
249
- */
250
- enabled?: boolean;
251
- /**
252
- * Headers to send with the request
253
- */
254
- headers?: {
255
- [key: string]: string;
106
+ export type Message = UserMessage | AssistantMessage;
107
+ export type EventMessageUpdated = {
108
+ type: "message.updated";
109
+ properties: {
110
+ info: Message;
256
111
  };
257
- /**
258
- * Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds) if not specified.
259
- */
260
- timeout?: number;
261
112
  };
262
- /**
263
- * @deprecated Always uses stretch layout.
264
- */
265
- export type LayoutConfig = "auto" | "stretch";
266
- export type Config = {
267
- /**
268
- * JSON schema reference for configuration validation
269
- */
270
- $schema?: string;
271
- /**
272
- * Theme name to use for the interface
273
- */
274
- theme?: string;
275
- keybinds?: KeybindsConfig;
276
- /**
277
- * TUI specific settings
278
- */
279
- tui?: {
280
- /**
281
- * TUI scroll speed
282
- */
283
- scroll_speed?: number;
284
- /**
285
- * Scroll acceleration settings
286
- */
287
- scroll_acceleration?: {
288
- /**
289
- * Enable scroll acceleration
290
- */
291
- enabled: boolean;
292
- };
113
+ export type EventMessageRemoved = {
114
+ type: "message.removed";
115
+ properties: {
116
+ sessionID: string;
117
+ messageID: string;
293
118
  };
294
- /**
295
- * Command configuration, see https://opencode.ai/docs/commands
296
- */
297
- command?: {
298
- [key: string]: {
299
- template: string;
300
- description?: string;
301
- agent?: string;
302
- model?: string;
303
- subtask?: boolean;
304
- };
119
+ };
120
+ export type TextPart = {
121
+ id: string;
122
+ sessionID: string;
123
+ messageID: string;
124
+ type: "text";
125
+ text: string;
126
+ synthetic?: boolean;
127
+ time?: {
128
+ start: number;
129
+ end?: number;
305
130
  };
306
- watcher?: {
307
- ignore?: Array<string>;
131
+ metadata?: {
132
+ [key: string]: unknown;
308
133
  };
309
- plugin?: Array<string>;
310
- snapshot?: boolean;
311
- /**
312
- * Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing
313
- */
314
- share?: "manual" | "auto" | "disabled";
315
- /**
316
- * @deprecated Use 'share' field instead. Share newly created sessions automatically
317
- */
318
- autoshare?: boolean;
319
- /**
320
- * Automatically update to the latest version
321
- */
322
- autoupdate?: boolean;
323
- /**
324
- * Disable providers that are loaded automatically
325
- */
326
- disabled_providers?: Array<string>;
327
- /**
328
- * Model to use in the format of provider/model, eg anthropic/claude-2
329
- */
330
- model?: string;
331
- /**
332
- * Small model to use for tasks like title generation in the format of provider/model
333
- */
334
- small_model?: string;
335
- /**
336
- * Custom username to display in conversations instead of system username
337
- */
338
- username?: string;
339
- /**
340
- * @deprecated Use `agent` field instead.
341
- */
342
- mode?: {
343
- build?: AgentConfig;
344
- plan?: AgentConfig;
345
- [key: string]: AgentConfig | undefined;
134
+ };
135
+ export type ReasoningPart = {
136
+ id: string;
137
+ sessionID: string;
138
+ messageID: string;
139
+ type: "reasoning";
140
+ text: string;
141
+ metadata?: {
142
+ [key: string]: unknown;
346
143
  };
347
- /**
348
- * Agent configuration, see https://opencode.ai/docs/agent
349
- */
350
- agent?: {
351
- plan?: AgentConfig;
352
- build?: AgentConfig;
353
- general?: AgentConfig;
354
- [key: string]: AgentConfig | undefined;
144
+ time: {
145
+ start: number;
146
+ end?: number;
355
147
  };
356
- /**
357
- * Custom provider configurations and model overrides
358
- */
359
- provider?: {
360
- [key: string]: {
361
- api?: string;
362
- name?: string;
363
- env?: Array<string>;
364
- id?: string;
365
- npm?: string;
366
- models?: {
367
- [key: string]: {
368
- id?: string;
369
- name?: string;
370
- release_date?: string;
371
- attachment?: boolean;
372
- reasoning?: boolean;
373
- temperature?: boolean;
374
- tool_call?: boolean;
375
- cost?: {
376
- input: number;
377
- output: number;
378
- cache_read?: number;
379
- cache_write?: number;
380
- };
381
- limit?: {
382
- context: number;
383
- output: number;
384
- };
385
- modalities?: {
386
- input: Array<"text" | "audio" | "image" | "video" | "pdf">;
387
- output: Array<"text" | "audio" | "image" | "video" | "pdf">;
388
- };
389
- experimental?: boolean;
390
- status?: "alpha" | "beta" | "deprecated";
391
- options?: {
392
- [key: string]: unknown;
393
- };
394
- headers?: {
395
- [key: string]: string;
396
- };
397
- provider?: {
398
- npm: string;
399
- };
400
- };
401
- };
402
- options?: {
403
- apiKey?: string;
404
- baseURL?: string;
405
- /**
406
- * GitHub Enterprise URL for copilot authentication
407
- */
408
- enterpriseUrl?: string;
409
- /**
410
- * Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout.
411
- */
412
- timeout?: number | false;
413
- [key: string]: unknown | string | (number | false) | undefined;
414
- };
415
- };
148
+ };
149
+ export type FilePartSourceText = {
150
+ value: string;
151
+ start: number;
152
+ end: number;
153
+ };
154
+ export type FileSource = {
155
+ text: FilePartSourceText;
156
+ type: "file";
157
+ path: string;
158
+ };
159
+ export type Range = {
160
+ start: {
161
+ line: number;
162
+ character: number;
163
+ };
164
+ end: {
165
+ line: number;
166
+ character: number;
167
+ };
168
+ };
169
+ export type SymbolSource = {
170
+ text: FilePartSourceText;
171
+ type: "symbol";
172
+ path: string;
173
+ range: Range;
174
+ name: string;
175
+ kind: number;
176
+ };
177
+ export type FilePartSource = FileSource | SymbolSource;
178
+ export type FilePart = {
179
+ id: string;
180
+ sessionID: string;
181
+ messageID: string;
182
+ type: "file";
183
+ mime: string;
184
+ filename?: string;
185
+ url: string;
186
+ source?: FilePartSource;
187
+ };
188
+ export type ToolStatePending = {
189
+ status: "pending";
190
+ input: {
191
+ [key: string]: unknown;
416
192
  };
417
- /**
418
- * MCP (Model Context Protocol) server configurations
419
- */
420
- mcp?: {
421
- [key: string]: McpLocalConfig | McpRemoteConfig;
193
+ raw: string;
194
+ };
195
+ export type ToolStateRunning = {
196
+ status: "running";
197
+ input: {
198
+ [key: string]: unknown;
422
199
  };
423
- formatter?: {
424
- [key: string]: {
425
- disabled?: boolean;
426
- command?: Array<string>;
427
- environment?: {
428
- [key: string]: string;
429
- };
430
- extensions?: Array<string>;
431
- };
200
+ title?: string;
201
+ metadata?: {
202
+ [key: string]: unknown;
432
203
  };
433
- lsp?: {
434
- [key: string]: {
435
- disabled: true;
436
- } | {
437
- command: Array<string>;
438
- extensions?: Array<string>;
439
- disabled?: boolean;
440
- env?: {
441
- [key: string]: string;
442
- };
443
- initialization?: {
444
- [key: string]: unknown;
445
- };
446
- };
204
+ time: {
205
+ start: number;
447
206
  };
448
- /**
449
- * Additional instruction files or patterns to include
450
- */
451
- instructions?: Array<string>;
452
- layout?: LayoutConfig;
453
- permission?: {
454
- edit?: "ask" | "allow" | "deny";
455
- bash?: ("ask" | "allow" | "deny") | {
456
- [key: string]: "ask" | "allow" | "deny";
457
- };
458
- webfetch?: "ask" | "allow" | "deny";
459
- doom_loop?: "ask" | "allow" | "deny";
460
- external_directory?: "ask" | "allow" | "deny";
207
+ };
208
+ export type ToolStateCompleted = {
209
+ status: "completed";
210
+ input: {
211
+ [key: string]: unknown;
461
212
  };
462
- tools?: {
463
- [key: string]: boolean;
213
+ output: string;
214
+ title: string;
215
+ metadata: {
216
+ [key: string]: unknown;
464
217
  };
465
- experimental?: {
466
- hook?: {
467
- file_edited?: {
468
- [key: string]: Array<{
469
- command: Array<string>;
470
- environment?: {
471
- [key: string]: string;
472
- };
473
- }>;
474
- };
475
- session_completed?: Array<{
476
- command: Array<string>;
477
- environment?: {
478
- [key: string]: string;
479
- };
480
- }>;
218
+ time: {
219
+ start: number;
220
+ end: number;
221
+ compacted?: number;
222
+ };
223
+ attachments?: Array<FilePart>;
224
+ };
225
+ export type ToolStateError = {
226
+ status: "error";
227
+ input: {
228
+ [key: string]: unknown;
229
+ };
230
+ error: string;
231
+ metadata?: {
232
+ [key: string]: unknown;
233
+ };
234
+ time: {
235
+ start: number;
236
+ end: number;
237
+ };
238
+ };
239
+ export type ToolState = ToolStatePending | ToolStateRunning | ToolStateCompleted | ToolStateError;
240
+ export type ToolPart = {
241
+ id: string;
242
+ sessionID: string;
243
+ messageID: string;
244
+ type: "tool";
245
+ callID: string;
246
+ tool: string;
247
+ state: ToolState;
248
+ metadata?: {
249
+ [key: string]: unknown;
250
+ };
251
+ };
252
+ export type StepStartPart = {
253
+ id: string;
254
+ sessionID: string;
255
+ messageID: string;
256
+ type: "step-start";
257
+ snapshot?: string;
258
+ };
259
+ export type StepFinishPart = {
260
+ id: string;
261
+ sessionID: string;
262
+ messageID: string;
263
+ type: "step-finish";
264
+ reason: string;
265
+ snapshot?: string;
266
+ cost: number;
267
+ tokens: {
268
+ input: number;
269
+ output: number;
270
+ reasoning: number;
271
+ cache: {
272
+ read: number;
273
+ write: number;
481
274
  };
482
- /**
483
- * Number of retries for chat completions on failure
484
- */
485
- chatMaxRetries?: number;
486
- disable_paste_summary?: boolean;
487
275
  };
488
276
  };
489
- export type BadRequestError = {
490
- data: unknown | null;
491
- errors: Array<{
277
+ export type SnapshotPart = {
278
+ id: string;
279
+ sessionID: string;
280
+ messageID: string;
281
+ type: "snapshot";
282
+ snapshot: string;
283
+ };
284
+ export type PatchPart = {
285
+ id: string;
286
+ sessionID: string;
287
+ messageID: string;
288
+ type: "patch";
289
+ hash: string;
290
+ files: Array<string>;
291
+ };
292
+ export type AgentPart = {
293
+ id: string;
294
+ sessionID: string;
295
+ messageID: string;
296
+ type: "agent";
297
+ name: string;
298
+ source?: {
299
+ value: string;
300
+ start: number;
301
+ end: number;
302
+ };
303
+ };
304
+ export type RetryPart = {
305
+ id: string;
306
+ sessionID: string;
307
+ messageID: string;
308
+ type: "retry";
309
+ attempt: number;
310
+ error: ApiError;
311
+ time: {
312
+ created: number;
313
+ };
314
+ };
315
+ export type Part = TextPart | ReasoningPart | FilePart | ToolPart | StepStartPart | StepFinishPart | SnapshotPart | PatchPart | AgentPart | RetryPart;
316
+ export type EventMessagePartUpdated = {
317
+ type: "message.part.updated";
318
+ properties: {
319
+ part: Part;
320
+ delta?: string;
321
+ };
322
+ };
323
+ export type EventMessagePartRemoved = {
324
+ type: "message.part.removed";
325
+ properties: {
326
+ sessionID: string;
327
+ messageID: string;
328
+ partID: string;
329
+ };
330
+ };
331
+ export type EventSessionCompacted = {
332
+ type: "session.compacted";
333
+ properties: {
334
+ sessionID: string;
335
+ };
336
+ };
337
+ export type Permission = {
338
+ id: string;
339
+ type: string;
340
+ pattern?: string | Array<string>;
341
+ sessionID: string;
342
+ messageID: string;
343
+ callID?: string;
344
+ title: string;
345
+ metadata: {
492
346
  [key: string]: unknown;
493
- }>;
494
- success: false;
347
+ };
348
+ time: {
349
+ created: number;
350
+ };
495
351
  };
496
- export type ToolIds = Array<string>;
497
- export type ToolListItem = {
352
+ export type EventPermissionUpdated = {
353
+ type: "permission.updated";
354
+ properties: Permission;
355
+ };
356
+ export type EventPermissionReplied = {
357
+ type: "permission.replied";
358
+ properties: {
359
+ sessionID: string;
360
+ permissionID: string;
361
+ response: string;
362
+ };
363
+ };
364
+ export type EventFileEdited = {
365
+ type: "file.edited";
366
+ properties: {
367
+ file: string;
368
+ };
369
+ };
370
+ export type Todo = {
371
+ /**
372
+ * Brief description of the task
373
+ */
374
+ content: string;
375
+ /**
376
+ * Current status of the task: pending, in_progress, completed, cancelled
377
+ */
378
+ status: string;
379
+ /**
380
+ * Priority level of the task: high, medium, low
381
+ */
382
+ priority: string;
383
+ /**
384
+ * Unique identifier for the todo item
385
+ */
498
386
  id: string;
499
- description: string;
500
- parameters: unknown;
501
387
  };
502
- export type ToolList = Array<ToolListItem>;
503
- export type Path = {
504
- state: string;
505
- config: string;
506
- worktree: string;
507
- directory: string;
388
+ export type EventTodoUpdated = {
389
+ type: "todo.updated";
390
+ properties: {
391
+ sessionID: string;
392
+ todos: Array<Todo>;
393
+ };
508
394
  };
509
- export type FileDiff = {
510
- file: string;
511
- before: string;
512
- after: string;
513
- additions: number;
514
- deletions: number;
395
+ export type EventCommandExecuted = {
396
+ type: "command.executed";
397
+ properties: {
398
+ name: string;
399
+ sessionID: string;
400
+ arguments: string;
401
+ messageID: string;
402
+ };
403
+ };
404
+ export type EventSessionIdle = {
405
+ type: "session.idle";
406
+ properties: {
407
+ sessionID: string;
408
+ };
515
409
  };
516
410
  export type Session = {
517
411
  id: string;
@@ -541,306 +435,604 @@ export type Session = {
541
435
  diff?: string;
542
436
  };
543
437
  };
544
- export type NotFoundError = {
545
- name: "NotFoundError";
546
- data: {
438
+ export type EventSessionCreated = {
439
+ type: "session.created";
440
+ properties: {
441
+ info: Session;
442
+ };
443
+ };
444
+ export type EventSessionUpdated = {
445
+ type: "session.updated";
446
+ properties: {
447
+ info: Session;
448
+ };
449
+ };
450
+ export type EventSessionDeleted = {
451
+ type: "session.deleted";
452
+ properties: {
453
+ info: Session;
454
+ };
455
+ };
456
+ export type EventSessionDiff = {
457
+ type: "session.diff";
458
+ properties: {
459
+ sessionID: string;
460
+ diff: Array<FileDiff>;
461
+ };
462
+ };
463
+ export type EventSessionError = {
464
+ type: "session.error";
465
+ properties: {
466
+ sessionID?: string;
467
+ error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError;
468
+ };
469
+ };
470
+ export type EventTuiPromptAppend = {
471
+ type: "tui.prompt.append";
472
+ properties: {
473
+ text: string;
474
+ };
475
+ };
476
+ export type EventTuiCommandExecute = {
477
+ type: "tui.command.execute";
478
+ properties: {
479
+ command: ("session.list" | "session.new" | "session.share" | "session.interrupt" | "session.compact" | "session.page.up" | "session.page.down" | "session.half.page.up" | "session.half.page.down" | "session.first" | "session.last" | "prompt.clear" | "prompt.submit" | "agent.cycle") | string;
480
+ };
481
+ };
482
+ export type EventTuiToastShow = {
483
+ type: "tui.toast.show";
484
+ properties: {
485
+ title?: string;
547
486
  message: string;
487
+ variant: "info" | "success" | "warning" | "error";
488
+ /**
489
+ * Duration in milliseconds
490
+ */
491
+ duration?: number;
548
492
  };
549
493
  };
550
- export type Todo = {
494
+ export type EventServerConnected = {
495
+ type: "server.connected";
496
+ properties: {
497
+ [key: string]: unknown;
498
+ };
499
+ };
500
+ export type EventFileWatcherUpdated = {
501
+ type: "file.watcher.updated";
502
+ properties: {
503
+ file: string;
504
+ event: "add" | "change" | "unlink";
505
+ };
506
+ };
507
+ export type Event = EventInstallationUpdated | EventLspClientDiagnostics | EventLspUpdated | EventMessageUpdated | EventMessageRemoved | EventMessagePartUpdated | EventMessagePartRemoved | EventSessionCompacted | EventPermissionUpdated | EventPermissionReplied | EventFileEdited | EventTodoUpdated | EventCommandExecuted | EventSessionIdle | EventSessionCreated | EventSessionUpdated | EventSessionDeleted | EventSessionDiff | EventSessionError | EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow | EventServerConnected | EventFileWatcherUpdated;
508
+ export type GlobalEvent = {
509
+ directory: string;
510
+ payload: Event;
511
+ };
512
+ export type Project = {
513
+ id: string;
514
+ worktree: string;
515
+ vcs?: "git";
516
+ time: {
517
+ created: number;
518
+ initialized?: number;
519
+ };
520
+ };
521
+ /**
522
+ * Custom keybind configurations
523
+ */
524
+ export type KeybindsConfig = {
525
+ /**
526
+ * Leader key for keybind combinations
527
+ */
528
+ leader?: string;
529
+ /**
530
+ * Exit the application
531
+ */
532
+ app_exit?: string;
533
+ /**
534
+ * Open external editor
535
+ */
536
+ editor_open?: string;
537
+ /**
538
+ * List available themes
539
+ */
540
+ theme_list?: string;
541
+ /**
542
+ * Toggle sidebar
543
+ */
544
+ sidebar_toggle?: string;
545
+ /**
546
+ * View status
547
+ */
548
+ status_view?: string;
549
+ /**
550
+ * Export session to editor
551
+ */
552
+ session_export?: string;
553
+ /**
554
+ * Create a new session
555
+ */
556
+ session_new?: string;
557
+ /**
558
+ * List all sessions
559
+ */
560
+ session_list?: string;
561
+ /**
562
+ * Show session timeline
563
+ */
564
+ session_timeline?: string;
565
+ /**
566
+ * Share current session
567
+ */
568
+ session_share?: string;
569
+ /**
570
+ * Unshare current session
571
+ */
572
+ session_unshare?: string;
573
+ /**
574
+ * Interrupt current session
575
+ */
576
+ session_interrupt?: string;
577
+ /**
578
+ * Compact the session
579
+ */
580
+ session_compact?: string;
581
+ /**
582
+ * Scroll messages up by one page
583
+ */
584
+ messages_page_up?: string;
585
+ /**
586
+ * Scroll messages down by one page
587
+ */
588
+ messages_page_down?: string;
589
+ /**
590
+ * Scroll messages up by half page
591
+ */
592
+ messages_half_page_up?: string;
593
+ /**
594
+ * Scroll messages down by half page
595
+ */
596
+ messages_half_page_down?: string;
597
+ /**
598
+ * Navigate to first message
599
+ */
600
+ messages_first?: string;
601
+ /**
602
+ * Navigate to last message
603
+ */
604
+ messages_last?: string;
605
+ /**
606
+ * Copy message
607
+ */
608
+ messages_copy?: string;
609
+ /**
610
+ * Undo message
611
+ */
612
+ messages_undo?: string;
613
+ /**
614
+ * Redo message
615
+ */
616
+ messages_redo?: string;
617
+ /**
618
+ * Toggle code block concealment in messages
619
+ */
620
+ messages_toggle_conceal?: string;
621
+ /**
622
+ * List available models
623
+ */
624
+ model_list?: string;
625
+ /**
626
+ * Next recently used model
627
+ */
628
+ model_cycle_recent?: string;
629
+ /**
630
+ * Previous recently used model
631
+ */
632
+ model_cycle_recent_reverse?: string;
633
+ /**
634
+ * List available commands
635
+ */
636
+ command_list?: string;
637
+ /**
638
+ * List agents
639
+ */
640
+ agent_list?: string;
641
+ /**
642
+ * Next agent
643
+ */
644
+ agent_cycle?: string;
645
+ /**
646
+ * Previous agent
647
+ */
648
+ agent_cycle_reverse?: string;
649
+ /**
650
+ * Clear input field
651
+ */
652
+ input_clear?: string;
653
+ /**
654
+ * Forward delete
655
+ */
656
+ input_forward_delete?: string;
657
+ /**
658
+ * Paste from clipboard
659
+ */
660
+ input_paste?: string;
551
661
  /**
552
- * Brief description of the task
662
+ * Submit input
553
663
  */
554
- content: string;
664
+ input_submit?: string;
555
665
  /**
556
- * Current status of the task: pending, in_progress, completed, cancelled
666
+ * Insert newline in input
557
667
  */
558
- status: string;
668
+ input_newline?: string;
559
669
  /**
560
- * Priority level of the task: high, medium, low
670
+ * Previous history item
561
671
  */
562
- priority: string;
672
+ history_previous?: string;
563
673
  /**
564
- * Unique identifier for the todo item
674
+ * Next history item
565
675
  */
566
- id: string;
567
- };
568
- export type UserMessage = {
569
- id: string;
570
- sessionID: string;
571
- role: "user";
572
- time: {
573
- created: number;
574
- };
575
- summary?: {
576
- title?: string;
577
- body?: string;
578
- diffs: Array<FileDiff>;
579
- };
580
- };
581
- export type ProviderAuthError = {
582
- name: "ProviderAuthError";
583
- data: {
584
- providerID: string;
585
- message: string;
586
- };
587
- };
588
- export type UnknownError = {
589
- name: "UnknownError";
590
- data: {
591
- message: string;
592
- };
593
- };
594
- export type MessageOutputLengthError = {
595
- name: "MessageOutputLengthError";
596
- data: {
597
- [key: string]: unknown;
598
- };
676
+ history_next?: string;
677
+ /**
678
+ * Next child session
679
+ */
680
+ session_child_cycle?: string;
681
+ /**
682
+ * Previous child session
683
+ */
684
+ session_child_cycle_reverse?: string;
599
685
  };
600
- export type MessageAbortedError = {
601
- name: "MessageAbortedError";
602
- data: {
603
- message: string;
686
+ export type AgentConfig = {
687
+ model?: string;
688
+ temperature?: number;
689
+ top_p?: number;
690
+ prompt?: string;
691
+ tools?: {
692
+ [key: string]: boolean;
604
693
  };
605
- };
606
- export type ApiError = {
607
- name: "APIError";
608
- data: {
609
- message: string;
610
- statusCode?: number;
611
- isRetryable: boolean;
612
- responseHeaders?: {
613
- [key: string]: string;
694
+ disable?: boolean;
695
+ /**
696
+ * Description of when to use the agent
697
+ */
698
+ description?: string;
699
+ mode?: "subagent" | "primary" | "all";
700
+ /**
701
+ * Hex color code for the agent (e.g., #FF5733)
702
+ */
703
+ color?: string;
704
+ permission?: {
705
+ edit?: "ask" | "allow" | "deny";
706
+ bash?: ("ask" | "allow" | "deny") | {
707
+ [key: string]: "ask" | "allow" | "deny";
614
708
  };
615
- responseBody?: string;
616
- };
617
- };
618
- export type AssistantMessage = {
619
- id: string;
620
- sessionID: string;
621
- role: "assistant";
622
- time: {
623
- created: number;
624
- completed?: number;
625
- };
626
- error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError;
627
- parentID: string;
628
- modelID: string;
629
- providerID: string;
630
- mode: string;
631
- path: {
632
- cwd: string;
633
- root: string;
709
+ webfetch?: "ask" | "allow" | "deny";
710
+ doom_loop?: "ask" | "allow" | "deny";
711
+ external_directory?: "ask" | "allow" | "deny";
634
712
  };
635
- summary?: boolean;
636
- cost: number;
637
- tokens: {
638
- input: number;
639
- output: number;
640
- reasoning: number;
641
- cache: {
642
- read: number;
643
- write: number;
713
+ [key: string]: unknown | string | number | {
714
+ [key: string]: boolean;
715
+ } | boolean | ("subagent" | "primary" | "all") | {
716
+ edit?: "ask" | "allow" | "deny";
717
+ bash?: ("ask" | "allow" | "deny") | {
718
+ [key: string]: "ask" | "allow" | "deny";
644
719
  };
645
- };
646
- };
647
- export type Message = UserMessage | AssistantMessage;
648
- export type TextPart = {
649
- id: string;
650
- sessionID: string;
651
- messageID: string;
652
- type: "text";
653
- text: string;
654
- synthetic?: boolean;
655
- time?: {
656
- start: number;
657
- end?: number;
658
- };
659
- metadata?: {
660
- [key: string]: unknown;
661
- };
662
- };
663
- export type ReasoningPart = {
664
- id: string;
665
- sessionID: string;
666
- messageID: string;
667
- type: "reasoning";
668
- text: string;
669
- metadata?: {
670
- [key: string]: unknown;
671
- };
672
- time: {
673
- start: number;
674
- end?: number;
675
- };
676
- };
677
- export type FilePartSourceText = {
678
- value: string;
679
- start: number;
680
- end: number;
681
- };
682
- export type FileSource = {
683
- text: FilePartSourceText;
684
- type: "file";
685
- path: string;
720
+ webfetch?: "ask" | "allow" | "deny";
721
+ doom_loop?: "ask" | "allow" | "deny";
722
+ external_directory?: "ask" | "allow" | "deny";
723
+ } | undefined;
686
724
  };
687
- export type Range = {
688
- start: {
689
- line: number;
690
- character: number;
691
- };
692
- end: {
693
- line: number;
694
- character: number;
725
+ export type McpLocalConfig = {
726
+ /**
727
+ * Type of MCP server connection
728
+ */
729
+ type: "local";
730
+ /**
731
+ * Command and arguments to run the MCP server
732
+ */
733
+ command: Array<string>;
734
+ /**
735
+ * Environment variables to set when running the MCP server
736
+ */
737
+ environment?: {
738
+ [key: string]: string;
695
739
  };
740
+ /**
741
+ * Enable or disable the MCP server on startup
742
+ */
743
+ enabled?: boolean;
744
+ /**
745
+ * Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds) if not specified.
746
+ */
747
+ timeout?: number;
696
748
  };
697
- export type SymbolSource = {
698
- text: FilePartSourceText;
699
- type: "symbol";
700
- path: string;
701
- range: Range;
702
- name: string;
703
- kind: number;
704
- };
705
- export type FilePartSource = FileSource | SymbolSource;
706
- export type FilePart = {
707
- id: string;
708
- sessionID: string;
709
- messageID: string;
710
- type: "file";
711
- mime: string;
712
- filename?: string;
749
+ export type McpRemoteConfig = {
750
+ /**
751
+ * Type of MCP server connection
752
+ */
753
+ type: "remote";
754
+ /**
755
+ * URL of the remote MCP server
756
+ */
713
757
  url: string;
714
- source?: FilePartSource;
758
+ /**
759
+ * Enable or disable the MCP server on startup
760
+ */
761
+ enabled?: boolean;
762
+ /**
763
+ * Headers to send with the request
764
+ */
765
+ headers?: {
766
+ [key: string]: string;
767
+ };
768
+ /**
769
+ * Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds) if not specified.
770
+ */
771
+ timeout?: number;
715
772
  };
716
- export type ToolStatePending = {
717
- status: "pending";
718
- input: {
719
- [key: string]: unknown;
773
+ /**
774
+ * @deprecated Always uses stretch layout.
775
+ */
776
+ export type LayoutConfig = "auto" | "stretch";
777
+ export type Config = {
778
+ /**
779
+ * JSON schema reference for configuration validation
780
+ */
781
+ $schema?: string;
782
+ /**
783
+ * Theme name to use for the interface
784
+ */
785
+ theme?: string;
786
+ keybinds?: KeybindsConfig;
787
+ /**
788
+ * TUI specific settings
789
+ */
790
+ tui?: {
791
+ /**
792
+ * TUI scroll speed
793
+ */
794
+ scroll_speed?: number;
795
+ /**
796
+ * Scroll acceleration settings
797
+ */
798
+ scroll_acceleration?: {
799
+ /**
800
+ * Enable scroll acceleration
801
+ */
802
+ enabled: boolean;
803
+ };
720
804
  };
721
- raw: string;
722
- };
723
- export type ToolStateRunning = {
724
- status: "running";
725
- input: {
726
- [key: string]: unknown;
805
+ /**
806
+ * Command configuration, see https://opencode.ai/docs/commands
807
+ */
808
+ command?: {
809
+ [key: string]: {
810
+ template: string;
811
+ description?: string;
812
+ agent?: string;
813
+ model?: string;
814
+ subtask?: boolean;
815
+ };
727
816
  };
728
- title?: string;
729
- metadata?: {
730
- [key: string]: unknown;
817
+ watcher?: {
818
+ ignore?: Array<string>;
731
819
  };
732
- time: {
733
- start: number;
820
+ plugin?: Array<string>;
821
+ snapshot?: boolean;
822
+ /**
823
+ * Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing
824
+ */
825
+ share?: "manual" | "auto" | "disabled";
826
+ /**
827
+ * @deprecated Use 'share' field instead. Share newly created sessions automatically
828
+ */
829
+ autoshare?: boolean;
830
+ /**
831
+ * Automatically update to the latest version
832
+ */
833
+ autoupdate?: boolean;
834
+ /**
835
+ * Disable providers that are loaded automatically
836
+ */
837
+ disabled_providers?: Array<string>;
838
+ /**
839
+ * Model to use in the format of provider/model, eg anthropic/claude-2
840
+ */
841
+ model?: string;
842
+ /**
843
+ * Small model to use for tasks like title generation in the format of provider/model
844
+ */
845
+ small_model?: string;
846
+ /**
847
+ * Custom username to display in conversations instead of system username
848
+ */
849
+ username?: string;
850
+ /**
851
+ * @deprecated Use `agent` field instead.
852
+ */
853
+ mode?: {
854
+ build?: AgentConfig;
855
+ plan?: AgentConfig;
856
+ [key: string]: AgentConfig | undefined;
734
857
  };
735
- };
736
- export type ToolStateCompleted = {
737
- status: "completed";
738
- input: {
739
- [key: string]: unknown;
858
+ /**
859
+ * Agent configuration, see https://opencode.ai/docs/agent
860
+ */
861
+ agent?: {
862
+ plan?: AgentConfig;
863
+ build?: AgentConfig;
864
+ general?: AgentConfig;
865
+ [key: string]: AgentConfig | undefined;
740
866
  };
741
- output: string;
742
- title: string;
743
- metadata: {
744
- [key: string]: unknown;
867
+ /**
868
+ * Custom provider configurations and model overrides
869
+ */
870
+ provider?: {
871
+ [key: string]: {
872
+ api?: string;
873
+ name?: string;
874
+ env?: Array<string>;
875
+ id?: string;
876
+ npm?: string;
877
+ models?: {
878
+ [key: string]: {
879
+ id?: string;
880
+ name?: string;
881
+ release_date?: string;
882
+ attachment?: boolean;
883
+ reasoning?: boolean;
884
+ temperature?: boolean;
885
+ tool_call?: boolean;
886
+ cost?: {
887
+ input: number;
888
+ output: number;
889
+ cache_read?: number;
890
+ cache_write?: number;
891
+ context_over_200k?: {
892
+ input: number;
893
+ output: number;
894
+ cache_read?: number;
895
+ cache_write?: number;
896
+ };
897
+ };
898
+ limit?: {
899
+ context: number;
900
+ output: number;
901
+ };
902
+ modalities?: {
903
+ input: Array<"text" | "audio" | "image" | "video" | "pdf">;
904
+ output: Array<"text" | "audio" | "image" | "video" | "pdf">;
905
+ };
906
+ experimental?: boolean;
907
+ status?: "alpha" | "beta" | "deprecated";
908
+ options?: {
909
+ [key: string]: unknown;
910
+ };
911
+ headers?: {
912
+ [key: string]: string;
913
+ };
914
+ provider?: {
915
+ npm: string;
916
+ };
917
+ };
918
+ };
919
+ options?: {
920
+ apiKey?: string;
921
+ baseURL?: string;
922
+ /**
923
+ * GitHub Enterprise URL for copilot authentication
924
+ */
925
+ enterpriseUrl?: string;
926
+ /**
927
+ * Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout.
928
+ */
929
+ timeout?: number | false;
930
+ [key: string]: unknown | string | (number | false) | undefined;
931
+ };
932
+ };
745
933
  };
746
- time: {
747
- start: number;
748
- end: number;
749
- compacted?: number;
934
+ /**
935
+ * MCP (Model Context Protocol) server configurations
936
+ */
937
+ mcp?: {
938
+ [key: string]: McpLocalConfig | McpRemoteConfig;
750
939
  };
751
- attachments?: Array<FilePart>;
752
- };
753
- export type ToolStateError = {
754
- status: "error";
755
- input: {
756
- [key: string]: unknown;
940
+ formatter?: {
941
+ [key: string]: {
942
+ disabled?: boolean;
943
+ command?: Array<string>;
944
+ environment?: {
945
+ [key: string]: string;
946
+ };
947
+ extensions?: Array<string>;
948
+ };
757
949
  };
758
- error: string;
759
- metadata?: {
760
- [key: string]: unknown;
950
+ lsp?: {
951
+ [key: string]: {
952
+ disabled: true;
953
+ } | {
954
+ command: Array<string>;
955
+ extensions?: Array<string>;
956
+ disabled?: boolean;
957
+ env?: {
958
+ [key: string]: string;
959
+ };
960
+ initialization?: {
961
+ [key: string]: unknown;
962
+ };
963
+ };
761
964
  };
762
- time: {
763
- start: number;
764
- end: number;
965
+ /**
966
+ * Additional instruction files or patterns to include
967
+ */
968
+ instructions?: Array<string>;
969
+ layout?: LayoutConfig;
970
+ permission?: {
971
+ edit?: "ask" | "allow" | "deny";
972
+ bash?: ("ask" | "allow" | "deny") | {
973
+ [key: string]: "ask" | "allow" | "deny";
974
+ };
975
+ webfetch?: "ask" | "allow" | "deny";
976
+ doom_loop?: "ask" | "allow" | "deny";
977
+ external_directory?: "ask" | "allow" | "deny";
765
978
  };
766
- };
767
- export type ToolState = ToolStatePending | ToolStateRunning | ToolStateCompleted | ToolStateError;
768
- export type ToolPart = {
769
- id: string;
770
- sessionID: string;
771
- messageID: string;
772
- type: "tool";
773
- callID: string;
774
- tool: string;
775
- state: ToolState;
776
- metadata?: {
777
- [key: string]: unknown;
979
+ tools?: {
980
+ [key: string]: boolean;
778
981
  };
779
- };
780
- export type StepStartPart = {
781
- id: string;
782
- sessionID: string;
783
- messageID: string;
784
- type: "step-start";
785
- snapshot?: string;
786
- };
787
- export type StepFinishPart = {
788
- id: string;
789
- sessionID: string;
790
- messageID: string;
791
- type: "step-finish";
792
- reason: string;
793
- snapshot?: string;
794
- cost: number;
795
- tokens: {
796
- input: number;
797
- output: number;
798
- reasoning: number;
799
- cache: {
800
- read: number;
801
- write: number;
982
+ experimental?: {
983
+ hook?: {
984
+ file_edited?: {
985
+ [key: string]: Array<{
986
+ command: Array<string>;
987
+ environment?: {
988
+ [key: string]: string;
989
+ };
990
+ }>;
991
+ };
992
+ session_completed?: Array<{
993
+ command: Array<string>;
994
+ environment?: {
995
+ [key: string]: string;
996
+ };
997
+ }>;
802
998
  };
999
+ /**
1000
+ * Number of retries for chat completions on failure
1001
+ */
1002
+ chatMaxRetries?: number;
1003
+ disable_paste_summary?: boolean;
1004
+ /**
1005
+ * Enable the batch tool
1006
+ */
1007
+ batch_tool?: boolean;
803
1008
  };
804
1009
  };
805
- export type SnapshotPart = {
806
- id: string;
807
- sessionID: string;
808
- messageID: string;
809
- type: "snapshot";
810
- snapshot: string;
1010
+ export type BadRequestError = {
1011
+ data: unknown | null;
1012
+ errors: Array<{
1013
+ [key: string]: unknown;
1014
+ }>;
1015
+ success: false;
811
1016
  };
812
- export type PatchPart = {
1017
+ export type ToolIds = Array<string>;
1018
+ export type ToolListItem = {
813
1019
  id: string;
814
- sessionID: string;
815
- messageID: string;
816
- type: "patch";
817
- hash: string;
818
- files: Array<string>;
1020
+ description: string;
1021
+ parameters: unknown;
819
1022
  };
820
- export type AgentPart = {
821
- id: string;
822
- sessionID: string;
823
- messageID: string;
824
- type: "agent";
825
- name: string;
826
- source?: {
827
- value: string;
828
- start: number;
829
- end: number;
830
- };
1023
+ export type ToolList = Array<ToolListItem>;
1024
+ export type Path = {
1025
+ state: string;
1026
+ config: string;
1027
+ worktree: string;
1028
+ directory: string;
831
1029
  };
832
- export type RetryPart = {
833
- id: string;
834
- sessionID: string;
835
- messageID: string;
836
- type: "retry";
837
- attempt: number;
838
- error: ApiError;
839
- time: {
840
- created: number;
1030
+ export type NotFoundError = {
1031
+ name: "NotFoundError";
1032
+ data: {
1033
+ message: string;
841
1034
  };
842
1035
  };
843
- export type Part = TextPart | ReasoningPart | FilePart | ToolPart | StepStartPart | StepFinishPart | SnapshotPart | PatchPart | AgentPart | RetryPart;
844
1036
  export type TextPartInput = {
845
1037
  id?: string;
846
1038
  type: "text";
@@ -893,6 +1085,12 @@ export type Model = {
893
1085
  output: number;
894
1086
  cache_read?: number;
895
1087
  cache_write?: number;
1088
+ context_over_200k?: {
1089
+ input: number;
1090
+ output: number;
1091
+ cache_read?: number;
1092
+ cache_write?: number;
1093
+ };
896
1094
  };
897
1095
  limit: {
898
1096
  context: number;
@@ -1017,30 +1215,6 @@ export type FormatterStatus = {
1017
1215
  extensions: Array<string>;
1018
1216
  enabled: boolean;
1019
1217
  };
1020
- export type EventTuiPromptAppend = {
1021
- type: "tui.prompt.append";
1022
- properties: {
1023
- text: string;
1024
- };
1025
- };
1026
- export type EventTuiCommandExecute = {
1027
- type: "tui.command.execute";
1028
- properties: {
1029
- command: ("session.list" | "session.new" | "session.share" | "session.interrupt" | "session.compact" | "session.page.up" | "session.page.down" | "session.half.page.up" | "session.half.page.down" | "session.first" | "session.last" | "prompt.clear" | "prompt.submit" | "agent.cycle") | string;
1030
- };
1031
- };
1032
- export type EventTuiToastShow = {
1033
- type: "tui.toast.show";
1034
- properties: {
1035
- title?: string;
1036
- message: string;
1037
- variant: "info" | "success" | "warning" | "error";
1038
- /**
1039
- * Duration in milliseconds
1040
- */
1041
- duration?: number;
1042
- };
1043
- };
1044
1218
  export type OAuth = {
1045
1219
  type: "oauth";
1046
1220
  refresh: string;
@@ -1058,160 +1232,19 @@ export type WellKnownAuth = {
1058
1232
  token: string;
1059
1233
  };
1060
1234
  export type Auth = OAuth | ApiAuth | WellKnownAuth;
1061
- export type EventInstallationUpdated = {
1062
- type: "installation.updated";
1063
- properties: {
1064
- version: string;
1065
- };
1066
- };
1067
- export type EventLspClientDiagnostics = {
1068
- type: "lsp.client.diagnostics";
1069
- properties: {
1070
- serverID: string;
1071
- path: string;
1072
- };
1073
- };
1074
- export type EventLspUpdated = {
1075
- type: "lsp.updated";
1076
- properties: {
1077
- [key: string]: unknown;
1078
- };
1079
- };
1080
- export type EventMessageUpdated = {
1081
- type: "message.updated";
1082
- properties: {
1083
- info: Message;
1084
- };
1085
- };
1086
- export type EventMessageRemoved = {
1087
- type: "message.removed";
1088
- properties: {
1089
- sessionID: string;
1090
- messageID: string;
1091
- };
1092
- };
1093
- export type EventMessagePartUpdated = {
1094
- type: "message.part.updated";
1095
- properties: {
1096
- part: Part;
1097
- delta?: string;
1098
- };
1099
- };
1100
- export type EventMessagePartRemoved = {
1101
- type: "message.part.removed";
1102
- properties: {
1103
- sessionID: string;
1104
- messageID: string;
1105
- partID: string;
1106
- };
1107
- };
1108
- export type EventSessionCompacted = {
1109
- type: "session.compacted";
1110
- properties: {
1111
- sessionID: string;
1112
- };
1113
- };
1114
- export type Permission = {
1115
- id: string;
1116
- type: string;
1117
- pattern?: string | Array<string>;
1118
- sessionID: string;
1119
- messageID: string;
1120
- callID?: string;
1121
- title: string;
1122
- metadata: {
1123
- [key: string]: unknown;
1124
- };
1125
- time: {
1126
- created: number;
1127
- };
1128
- };
1129
- export type EventPermissionUpdated = {
1130
- type: "permission.updated";
1131
- properties: Permission;
1132
- };
1133
- export type EventPermissionReplied = {
1134
- type: "permission.replied";
1135
- properties: {
1136
- sessionID: string;
1137
- permissionID: string;
1138
- response: string;
1139
- };
1140
- };
1141
- export type EventFileEdited = {
1142
- type: "file.edited";
1143
- properties: {
1144
- file: string;
1145
- };
1146
- };
1147
- export type EventTodoUpdated = {
1148
- type: "todo.updated";
1149
- properties: {
1150
- sessionID: string;
1151
- todos: Array<Todo>;
1152
- };
1153
- };
1154
- export type EventCommandExecuted = {
1155
- type: "command.executed";
1156
- properties: {
1157
- name: string;
1158
- sessionID: string;
1159
- arguments: string;
1160
- messageID: string;
1161
- };
1162
- };
1163
- export type EventSessionIdle = {
1164
- type: "session.idle";
1165
- properties: {
1166
- sessionID: string;
1167
- };
1168
- };
1169
- export type EventSessionCreated = {
1170
- type: "session.created";
1171
- properties: {
1172
- info: Session;
1173
- };
1174
- };
1175
- export type EventSessionUpdated = {
1176
- type: "session.updated";
1177
- properties: {
1178
- info: Session;
1179
- };
1180
- };
1181
- export type EventSessionDeleted = {
1182
- type: "session.deleted";
1183
- properties: {
1184
- info: Session;
1185
- };
1186
- };
1187
- export type EventSessionDiff = {
1188
- type: "session.diff";
1189
- properties: {
1190
- sessionID: string;
1191
- diff: Array<FileDiff>;
1192
- };
1193
- };
1194
- export type EventSessionError = {
1195
- type: "session.error";
1196
- properties: {
1197
- sessionID?: string;
1198
- error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError;
1199
- };
1200
- };
1201
- export type EventServerConnected = {
1202
- type: "server.connected";
1203
- properties: {
1204
- [key: string]: unknown;
1205
- };
1235
+ export type GlobalEventData = {
1236
+ body?: never;
1237
+ path?: never;
1238
+ query?: never;
1239
+ url: "/global/event";
1206
1240
  };
1207
- export type EventFileWatcherUpdated = {
1208
- type: "file.watcher.updated";
1209
- properties: {
1210
- file: string;
1211
- event: "add" | "change" | "unlink";
1212
- };
1241
+ export type GlobalEventResponses = {
1242
+ /**
1243
+ * Event stream
1244
+ */
1245
+ 200: GlobalEvent;
1213
1246
  };
1214
- export type Event = EventInstallationUpdated | EventLspClientDiagnostics | EventLspUpdated | EventMessageUpdated | EventMessageRemoved | EventMessagePartUpdated | EventMessagePartRemoved | EventSessionCompacted | EventPermissionUpdated | EventPermissionReplied | EventFileEdited | EventTodoUpdated | EventCommandExecuted | EventSessionIdle | EventSessionCreated | EventSessionUpdated | EventSessionDeleted | EventSessionDiff | EventSessionError | EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow | EventServerConnected | EventFileWatcherUpdated;
1247
+ export type GlobalEventResponse = GlobalEventResponses[keyof GlobalEventResponses];
1215
1248
  export type ProjectListData = {
1216
1249
  body?: never;
1217
1250
  path?: never;