@opencode-ai/sdk 0.8.0 → 0.9.0

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,5 +1,5 @@
1
1
  import type { Options as ClientOptions, TDataShape, Client } from "./client/index.js";
2
- import type { ProjectListData, ProjectListResponses, ProjectCurrentData, ProjectCurrentResponses, EventSubscribeData, EventSubscribeResponses, ConfigGetData, ConfigGetResponses, ToolRegisterData, ToolRegisterResponses, ToolRegisterErrors, ToolIdsData, ToolIdsResponses, ToolIdsErrors, ToolListData, ToolListResponses, ToolListErrors, PathGetData, PathGetResponses, SessionListData, SessionListResponses, SessionCreateData, SessionCreateResponses, SessionCreateErrors, SessionDeleteData, SessionDeleteResponses, SessionGetData, SessionGetResponses, SessionUpdateData, SessionUpdateResponses, SessionChildrenData, SessionChildrenResponses, SessionInitData, SessionInitResponses, SessionAbortData, SessionAbortResponses, SessionUnshareData, SessionUnshareResponses, SessionShareData, SessionShareResponses, SessionSummarizeData, SessionSummarizeResponses, SessionMessagesData, SessionMessagesResponses, SessionPromptData, SessionPromptResponses, SessionMessageData, SessionMessageResponses, SessionCommandData, SessionCommandResponses, SessionShellData, SessionShellResponses, SessionRevertData, SessionRevertResponses, SessionUnrevertData, SessionUnrevertResponses, PostSessionByIdPermissionsByPermissionIdData, PostSessionByIdPermissionsByPermissionIdResponses, CommandListData, CommandListResponses, ConfigProvidersData, ConfigProvidersResponses, FindTextData, FindTextResponses, FindFilesData, FindFilesResponses, FindSymbolsData, FindSymbolsResponses, FileListData, FileListResponses, FileReadData, FileReadResponses, FileStatusData, FileStatusResponses, AppLogData, AppLogResponses, AppAgentsData, AppAgentsResponses, TuiAppendPromptData, TuiAppendPromptResponses, TuiOpenHelpData, TuiOpenHelpResponses, TuiOpenSessionsData, TuiOpenSessionsResponses, TuiOpenThemesData, TuiOpenThemesResponses, TuiOpenModelsData, TuiOpenModelsResponses, TuiSubmitPromptData, TuiSubmitPromptResponses, TuiClearPromptData, TuiClearPromptResponses, TuiExecuteCommandData, TuiExecuteCommandResponses, TuiShowToastData, TuiShowToastResponses, AuthSetData, AuthSetResponses, AuthSetErrors } from "./types.gen.js";
2
+ import type { ProjectListData, ProjectListResponses, ProjectCurrentData, ProjectCurrentResponses, EventSubscribeData, EventSubscribeResponses, ConfigGetData, ConfigGetResponses, ToolRegisterData, ToolRegisterResponses, ToolRegisterErrors, ToolIdsData, ToolIdsResponses, ToolIdsErrors, ToolListData, ToolListResponses, ToolListErrors, PathGetData, PathGetResponses, SessionListData, SessionListResponses, SessionCreateData, SessionCreateResponses, SessionCreateErrors, SessionDeleteData, SessionDeleteResponses, SessionGetData, SessionGetResponses, SessionUpdateData, SessionUpdateResponses, SessionChildrenData, SessionChildrenResponses, SessionInitData, SessionInitResponses, SessionAbortData, SessionAbortResponses, SessionUnshareData, SessionUnshareResponses, SessionShareData, SessionShareResponses, SessionSummarizeData, SessionSummarizeResponses, SessionMessagesData, SessionMessagesResponses, SessionPromptData, SessionPromptResponses, SessionMessageData, SessionMessageResponses, SessionCommandData, SessionCommandResponses, SessionShellData, SessionShellResponses, SessionRevertData, SessionRevertResponses, SessionUnrevertData, SessionUnrevertResponses, PostSessionIdPermissionsPermissionIdData, PostSessionIdPermissionsPermissionIdResponses, CommandListData, CommandListResponses, ConfigProvidersData, ConfigProvidersResponses, FindTextData, FindTextResponses, FindFilesData, FindFilesResponses, FindSymbolsData, FindSymbolsResponses, FileListData, FileListResponses, FileReadData, FileReadResponses, FileStatusData, FileStatusResponses, AppLogData, AppLogResponses, AppAgentsData, AppAgentsResponses, TuiAppendPromptData, TuiAppendPromptResponses, TuiOpenHelpData, TuiOpenHelpResponses, TuiOpenSessionsData, TuiOpenSessionsResponses, TuiOpenThemesData, TuiOpenThemesResponses, TuiOpenModelsData, TuiOpenModelsResponses, TuiSubmitPromptData, TuiSubmitPromptResponses, TuiClearPromptData, TuiClearPromptResponses, TuiExecuteCommandData, TuiExecuteCommandResponses, TuiShowToastData, TuiShowToastResponses, AuthSetData, AuthSetResponses, AuthSetErrors } from "./types.gen.js";
3
3
  export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
4
4
  /**
5
5
  * You can provide a client instance returned by `createClient()` instead of
@@ -231,7 +231,7 @@ export declare class OpencodeClient extends _HeyApiClient {
231
231
  /**
232
232
  * Respond to a permission request
233
233
  */
234
- postSessionByIdPermissionsByPermissionId<ThrowOnError extends boolean = false>(options: Options<PostSessionByIdPermissionsByPermissionIdData, ThrowOnError>): import("./client/types.gen.js").RequestResult<PostSessionByIdPermissionsByPermissionIdResponses, unknown, ThrowOnError, "fields">;
234
+ postSessionIdPermissionsPermissionId<ThrowOnError extends boolean = false>(options: Options<PostSessionIdPermissionsPermissionIdData, ThrowOnError>): import("./client/types.gen.js").RequestResult<PostSessionIdPermissionsPermissionIdResponses, unknown, ThrowOnError, "fields">;
235
235
  project: Project;
236
236
  event: Event;
237
237
  config: Config;
@@ -506,7 +506,7 @@ export class OpencodeClient extends _HeyApiClient {
506
506
  /**
507
507
  * Respond to a permission request
508
508
  */
509
- postSessionByIdPermissionsByPermissionId(options) {
509
+ postSessionIdPermissionsPermissionId(options) {
510
510
  return (options.client ?? this._client).post({
511
511
  url: "/session/{id}/permissions/{permissionID}",
512
512
  ...options,
@@ -7,37 +7,6 @@ export type Project = {
7
7
  initialized?: number;
8
8
  };
9
9
  };
10
- export type Event = ({
11
- type: "installation.updated";
12
- } & EventInstallationUpdated) | ({
13
- type: "lsp.client.diagnostics";
14
- } & EventLspClientDiagnostics) | ({
15
- type: "message.updated";
16
- } & EventMessageUpdated) | ({
17
- type: "message.removed";
18
- } & EventMessageRemoved) | ({
19
- type: "message.part.updated";
20
- } & EventMessagePartUpdated) | ({
21
- type: "message.part.removed";
22
- } & EventMessagePartRemoved) | ({
23
- type: "session.compacted";
24
- } & EventSessionCompacted) | ({
25
- type: "permission.updated";
26
- } & EventPermissionUpdated) | ({
27
- type: "permission.replied";
28
- } & EventPermissionReplied) | ({
29
- type: "file.edited";
30
- } & EventFileEdited) | ({
31
- type: "session.idle";
32
- } & EventSessionIdle) | ({
33
- type: "session.updated";
34
- } & EventSessionUpdated) | ({
35
- type: "session.deleted";
36
- } & EventSessionDeleted) | ({
37
- type: "session.error";
38
- } & EventSessionError) | ({
39
- type: "server.connected";
40
- } & EventServerConnected);
41
10
  export type EventInstallationUpdated = {
42
11
  type: "installation.updated";
43
12
  properties: {
@@ -51,17 +20,6 @@ export type EventLspClientDiagnostics = {
51
20
  path: string;
52
21
  };
53
22
  };
54
- export type EventMessageUpdated = {
55
- type: "message.updated";
56
- properties: {
57
- info: Message;
58
- };
59
- };
60
- export type Message = ({
61
- role: "user";
62
- } & UserMessage) | ({
63
- role: "assistant";
64
- } & AssistantMessage);
65
23
  export type UserMessage = {
66
24
  id: string;
67
25
  sessionID: string;
@@ -70,6 +28,31 @@ export type UserMessage = {
70
28
  created: number;
71
29
  };
72
30
  };
31
+ export type ProviderAuthError = {
32
+ name: "ProviderAuthError";
33
+ data: {
34
+ providerID: string;
35
+ message: string;
36
+ };
37
+ };
38
+ export type UnknownError = {
39
+ name: "UnknownError";
40
+ data: {
41
+ message: string;
42
+ };
43
+ };
44
+ export type MessageOutputLengthError = {
45
+ name: "MessageOutputLengthError";
46
+ data: {
47
+ [key: string]: unknown;
48
+ };
49
+ };
50
+ export type MessageAbortedError = {
51
+ name: "MessageAbortedError";
52
+ data: {
53
+ message: string;
54
+ };
55
+ };
73
56
  export type AssistantMessage = {
74
57
  id: string;
75
58
  sessionID: string;
@@ -78,15 +61,7 @@ export type AssistantMessage = {
78
61
  created: number;
79
62
  completed?: number;
80
63
  };
81
- error?: ({
82
- name: "ProviderAuthError";
83
- } & ProviderAuthError) | ({
84
- name: "UnknownError";
85
- } & UnknownError) | ({
86
- name: "MessageOutputLengthError";
87
- } & MessageOutputLengthError) | ({
88
- name: "MessageAbortedError";
89
- } & MessageAbortedError);
64
+ error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError;
90
65
  system: Array<string>;
91
66
  modelID: string;
92
67
  providerID: string;
@@ -107,29 +82,11 @@ export type AssistantMessage = {
107
82
  };
108
83
  };
109
84
  };
110
- export type ProviderAuthError = {
111
- name: "ProviderAuthError";
112
- data: {
113
- providerID: string;
114
- message: string;
115
- };
116
- };
117
- export type UnknownError = {
118
- name: "UnknownError";
119
- data: {
120
- message: string;
121
- };
122
- };
123
- export type MessageOutputLengthError = {
124
- name: "MessageOutputLengthError";
125
- data: {
126
- [key: string]: unknown;
127
- };
128
- };
129
- export type MessageAbortedError = {
130
- name: "MessageAbortedError";
131
- data: {
132
- [key: string]: unknown;
85
+ export type Message = UserMessage | AssistantMessage;
86
+ export type EventMessageUpdated = {
87
+ type: "message.updated";
88
+ properties: {
89
+ info: Message;
133
90
  };
134
91
  };
135
92
  export type EventMessageRemoved = {
@@ -139,31 +96,6 @@ export type EventMessageRemoved = {
139
96
  messageID: string;
140
97
  };
141
98
  };
142
- export type EventMessagePartUpdated = {
143
- type: "message.part.updated";
144
- properties: {
145
- part: Part;
146
- };
147
- };
148
- export type Part = ({
149
- type: "text";
150
- } & TextPart) | ({
151
- type: "reasoning";
152
- } & ReasoningPart) | ({
153
- type: "file";
154
- } & FilePart) | ({
155
- type: "tool";
156
- } & ToolPart) | ({
157
- type: "step-start";
158
- } & StepStartPart) | ({
159
- type: "step-finish";
160
- } & StepFinishPart) | ({
161
- type: "snapshot";
162
- } & SnapshotPart) | ({
163
- type: "patch";
164
- } & PatchPart) | ({
165
- type: "agent";
166
- } & AgentPart);
167
99
  export type TextPart = {
168
100
  id: string;
169
101
  sessionID: string;
@@ -190,38 +122,15 @@ export type ReasoningPart = {
190
122
  end?: number;
191
123
  };
192
124
  };
193
- export type FilePart = {
194
- id: string;
195
- sessionID: string;
196
- messageID: string;
197
- type: "file";
198
- mime: string;
199
- filename?: string;
200
- url: string;
201
- source?: FilePartSource;
202
- };
203
- export type FilePartSource = ({
204
- type: "file";
205
- } & FileSource) | ({
206
- type: "symbol";
207
- } & SymbolSource);
208
- export type FileSource = {
209
- text: FilePartSourceText;
210
- type: "file";
211
- path: string;
212
- };
213
125
  export type FilePartSourceText = {
214
126
  value: string;
215
127
  start: number;
216
128
  end: number;
217
129
  };
218
- export type SymbolSource = {
130
+ export type FileSource = {
219
131
  text: FilePartSourceText;
220
- type: "symbol";
132
+ type: "file";
221
133
  path: string;
222
- range: Range;
223
- name: string;
224
- kind: number;
225
134
  };
226
135
  export type Range = {
227
136
  start: {
@@ -233,30 +142,31 @@ export type Range = {
233
142
  character: number;
234
143
  };
235
144
  };
236
- export type ToolPart = {
145
+ export type SymbolSource = {
146
+ text: FilePartSourceText;
147
+ type: "symbol";
148
+ path: string;
149
+ range: Range;
150
+ name: string;
151
+ kind: number;
152
+ };
153
+ export type FilePartSource = FileSource | SymbolSource;
154
+ export type FilePart = {
237
155
  id: string;
238
156
  sessionID: string;
239
157
  messageID: string;
240
- type: "tool";
241
- callID: string;
242
- tool: string;
243
- state: ToolState;
158
+ type: "file";
159
+ mime: string;
160
+ filename?: string;
161
+ url: string;
162
+ source?: FilePartSource;
244
163
  };
245
- export type ToolState = ({
246
- status: "pending";
247
- } & ToolStatePending) | ({
248
- status: "running";
249
- } & ToolStateRunning) | ({
250
- status: "completed";
251
- } & ToolStateCompleted) | ({
252
- status: "error";
253
- } & ToolStateError);
254
164
  export type ToolStatePending = {
255
165
  status: "pending";
256
166
  };
257
167
  export type ToolStateRunning = {
258
168
  status: "running";
259
- input?: unknown;
169
+ input: unknown;
260
170
  title?: string;
261
171
  metadata?: {
262
172
  [key: string]: unknown;
@@ -295,6 +205,16 @@ export type ToolStateError = {
295
205
  end: number;
296
206
  };
297
207
  };
208
+ export type ToolState = ToolStatePending | ToolStateRunning | ToolStateCompleted | ToolStateError;
209
+ export type ToolPart = {
210
+ id: string;
211
+ sessionID: string;
212
+ messageID: string;
213
+ type: "tool";
214
+ callID: string;
215
+ tool: string;
216
+ state: ToolState;
217
+ };
298
218
  export type StepStartPart = {
299
219
  id: string;
300
220
  sessionID: string;
@@ -344,6 +264,13 @@ export type AgentPart = {
344
264
  end: number;
345
265
  };
346
266
  };
267
+ export type Part = TextPart | ReasoningPart | FilePart | ToolPart | StepStartPart | StepFinishPart | SnapshotPart | PatchPart | AgentPart;
268
+ export type EventMessagePartUpdated = {
269
+ type: "message.part.updated";
270
+ properties: {
271
+ part: Part;
272
+ };
273
+ };
347
274
  export type EventMessagePartRemoved = {
348
275
  type: "message.part.removed";
349
276
  properties: {
@@ -358,14 +285,10 @@ export type EventSessionCompacted = {
358
285
  sessionID: string;
359
286
  };
360
287
  };
361
- export type EventPermissionUpdated = {
362
- type: "permission.updated";
363
- properties: Permission;
364
- };
365
288
  export type Permission = {
366
289
  id: string;
367
290
  type: string;
368
- pattern?: string;
291
+ pattern?: string | Array<string>;
369
292
  sessionID: string;
370
293
  messageID: string;
371
294
  callID?: string;
@@ -377,6 +300,10 @@ export type Permission = {
377
300
  created: number;
378
301
  };
379
302
  };
303
+ export type EventPermissionUpdated = {
304
+ type: "permission.updated";
305
+ properties: Permission;
306
+ };
380
307
  export type EventPermissionReplied = {
381
308
  type: "permission.replied";
382
309
  properties: {
@@ -397,12 +324,6 @@ export type EventSessionIdle = {
397
324
  sessionID: string;
398
325
  };
399
326
  };
400
- export type EventSessionUpdated = {
401
- type: "session.updated";
402
- properties: {
403
- info: Session;
404
- };
405
- };
406
327
  export type Session = {
407
328
  id: string;
408
329
  projectID: string;
@@ -425,6 +346,12 @@ export type Session = {
425
346
  diff?: string;
426
347
  };
427
348
  };
349
+ export type EventSessionUpdated = {
350
+ type: "session.updated";
351
+ properties: {
352
+ info: Session;
353
+ };
354
+ };
428
355
  export type EventSessionDeleted = {
429
356
  type: "session.deleted";
430
357
  properties: {
@@ -435,15 +362,7 @@ export type EventSessionError = {
435
362
  type: "session.error";
436
363
  properties: {
437
364
  sessionID?: string;
438
- error?: ({
439
- name: "ProviderAuthError";
440
- } & ProviderAuthError) | ({
441
- name: "UnknownError";
442
- } & UnknownError) | ({
443
- name: "MessageOutputLengthError";
444
- } & MessageOutputLengthError) | ({
445
- name: "MessageAbortedError";
446
- } & MessageAbortedError);
365
+ error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError;
447
366
  };
448
367
  };
449
368
  export type EventServerConnected = {
@@ -452,406 +371,207 @@ export type EventServerConnected = {
452
371
  [key: string]: unknown;
453
372
  };
454
373
  };
455
- export type Config = {
374
+ export type Event = EventInstallationUpdated | EventLspClientDiagnostics | EventMessageUpdated | EventMessageRemoved | EventMessagePartUpdated | EventMessagePartRemoved | EventSessionCompacted | EventPermissionUpdated | EventPermissionReplied | EventFileEdited | EventSessionIdle | EventSessionUpdated | EventSessionDeleted | EventSessionError | EventServerConnected;
375
+ /**
376
+ * Custom keybind configurations
377
+ */
378
+ export type KeybindsConfig = {
456
379
  /**
457
- * JSON schema reference for configuration validation
380
+ * Leader key for keybind combinations
458
381
  */
459
- $schema?: string;
382
+ leader?: string;
460
383
  /**
461
- * Theme name to use for the interface
384
+ * Show help dialog
462
385
  */
463
- theme?: string;
386
+ app_help?: string;
464
387
  /**
465
- * Custom keybind configurations
388
+ * Exit the application
466
389
  */
467
- keybinds?: KeybindsConfig;
390
+ app_exit?: string;
468
391
  /**
469
- * TUI specific settings
392
+ * Open external editor
470
393
  */
471
- tui?: {
472
- /**
473
- * TUI scroll speed
474
- */
475
- scroll_speed: number;
476
- };
394
+ editor_open?: string;
477
395
  /**
478
- * Command configuration, see https://opencode.ai/docs/commands
396
+ * List available themes
479
397
  */
480
- command?: {
481
- [key: string]: {
482
- template: string;
483
- description?: string;
484
- agent?: string;
485
- model?: string;
486
- subtask?: boolean;
487
- };
488
- };
489
- plugin?: Array<string>;
490
- snapshot?: boolean;
398
+ theme_list?: string;
491
399
  /**
492
- * Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing
400
+ * Create/update AGENTS.md
493
401
  */
494
- share?: "manual" | "auto" | "disabled";
402
+ project_init?: string;
495
403
  /**
496
- * @deprecated Use 'share' field instead. Share newly created sessions automatically
404
+ * Toggle tool details
497
405
  */
498
- autoshare?: boolean;
406
+ tool_details?: string;
499
407
  /**
500
- * Automatically update to the latest version
408
+ * Toggle thinking blocks
501
409
  */
502
- autoupdate?: boolean;
410
+ thinking_blocks?: string;
503
411
  /**
504
- * Disable providers that are loaded automatically
412
+ * Export session to editor
505
413
  */
506
- disabled_providers?: Array<string>;
414
+ session_export?: string;
507
415
  /**
508
- * Model to use in the format of provider/model, eg anthropic/claude-2
416
+ * Create a new session
509
417
  */
510
- model?: string;
418
+ session_new?: string;
511
419
  /**
512
- * Small model to use for tasks like title generation in the format of provider/model
420
+ * List all sessions
513
421
  */
514
- small_model?: string;
422
+ session_list?: string;
515
423
  /**
516
- * Custom username to display in conversations instead of system username
424
+ * Show session timeline
517
425
  */
518
- username?: string;
426
+ session_timeline?: string;
519
427
  /**
520
- * @deprecated Use `agent` field instead.
428
+ * Share current session
521
429
  */
522
- mode?: {
523
- build?: AgentConfig;
524
- plan?: AgentConfig;
525
- [key: string]: AgentConfig | undefined;
526
- };
430
+ session_share?: string;
527
431
  /**
528
- * Agent configuration, see https://opencode.ai/docs/agent
432
+ * Unshare current session
529
433
  */
530
- agent?: {
531
- plan?: AgentConfig;
532
- build?: AgentConfig;
533
- general?: AgentConfig;
534
- [key: string]: AgentConfig | undefined;
535
- };
434
+ session_unshare?: string;
536
435
  /**
537
- * Custom provider configurations and model overrides
436
+ * Interrupt current session
538
437
  */
539
- provider?: {
540
- [key: string]: {
541
- api?: string;
542
- name?: string;
543
- env?: Array<string>;
544
- id?: string;
545
- npm?: string;
546
- models?: {
547
- [key: string]: {
548
- id?: string;
549
- name?: string;
550
- release_date?: string;
551
- attachment?: boolean;
552
- reasoning?: boolean;
553
- temperature?: boolean;
554
- tool_call?: boolean;
555
- cost?: {
556
- input: number;
557
- output: number;
558
- cache_read?: number;
559
- cache_write?: number;
560
- };
561
- limit?: {
562
- context: number;
563
- output: number;
564
- };
565
- experimental?: boolean;
566
- options?: {
567
- [key: string]: unknown;
568
- };
569
- provider?: {
570
- npm: string;
571
- };
572
- };
573
- };
574
- options?: {
575
- apiKey?: string;
576
- baseURL?: string;
577
- /**
578
- * Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout.
579
- */
580
- timeout?: number | false;
581
- [key: string]: unknown | string | (number | false) | undefined;
582
- };
583
- };
584
- };
585
- /**
586
- * MCP (Model Context Protocol) server configurations
587
- */
588
- mcp?: {
589
- [key: string]: ({
590
- type: "local";
591
- } & McpLocalConfig) | ({
592
- type: "remote";
593
- } & McpRemoteConfig);
594
- };
595
- formatter?: {
596
- [key: string]: {
597
- disabled?: boolean;
598
- command?: Array<string>;
599
- environment?: {
600
- [key: string]: string;
601
- };
602
- extensions?: Array<string>;
603
- };
604
- };
605
- lsp?: {
606
- [key: string]: {
607
- disabled: true;
608
- } | {
609
- command: Array<string>;
610
- extensions?: Array<string>;
611
- disabled?: boolean;
612
- env?: {
613
- [key: string]: string;
614
- };
615
- initialization?: {
616
- [key: string]: unknown;
617
- };
618
- };
619
- };
620
- /**
621
- * Additional instruction files or patterns to include
622
- */
623
- instructions?: Array<string>;
624
- /**
625
- * @deprecated Always uses stretch layout.
626
- */
627
- layout?: LayoutConfig;
628
- permission?: {
629
- edit?: "ask" | "allow" | "deny";
630
- bash?: ("ask" | "allow" | "deny") | {
631
- [key: string]: "ask" | "allow" | "deny";
632
- };
633
- webfetch?: "ask" | "allow" | "deny";
634
- };
635
- tools?: {
636
- [key: string]: boolean;
637
- };
638
- experimental?: {
639
- hook?: {
640
- file_edited?: {
641
- [key: string]: Array<{
642
- command: Array<string>;
643
- environment?: {
644
- [key: string]: string;
645
- };
646
- }>;
647
- };
648
- session_completed?: Array<{
649
- command: Array<string>;
650
- environment?: {
651
- [key: string]: string;
652
- };
653
- }>;
654
- };
655
- disable_paste_summary?: boolean;
656
- };
657
- };
658
- export type KeybindsConfig = {
659
- /**
660
- * Leader key for keybind combinations
661
- */
662
- leader: string;
663
- /**
664
- * Show help dialog
665
- */
666
- app_help: string;
667
- /**
668
- * Exit the application
669
- */
670
- app_exit: string;
671
- /**
672
- * Open external editor
673
- */
674
- editor_open: string;
675
- /**
676
- * List available themes
677
- */
678
- theme_list: string;
679
- /**
680
- * Create/update AGENTS.md
681
- */
682
- project_init: string;
683
- /**
684
- * Toggle tool details
685
- */
686
- tool_details: string;
687
- /**
688
- * Toggle thinking blocks
689
- */
690
- thinking_blocks: string;
691
- /**
692
- * Export session to editor
693
- */
694
- session_export: string;
695
- /**
696
- * Create a new session
697
- */
698
- session_new: string;
699
- /**
700
- * List all sessions
701
- */
702
- session_list: string;
703
- /**
704
- * Show session timeline
705
- */
706
- session_timeline: string;
707
- /**
708
- * Share current session
709
- */
710
- session_share: string;
711
- /**
712
- * Unshare current session
713
- */
714
- session_unshare: string;
715
- /**
716
- * Interrupt current session
717
- */
718
- session_interrupt: string;
438
+ session_interrupt?: string;
719
439
  /**
720
440
  * Compact the session
721
441
  */
722
- session_compact: string;
442
+ session_compact?: string;
723
443
  /**
724
444
  * Cycle to next child session
725
445
  */
726
- session_child_cycle: string;
446
+ session_child_cycle?: string;
727
447
  /**
728
448
  * Cycle to previous child session
729
449
  */
730
- session_child_cycle_reverse: string;
450
+ session_child_cycle_reverse?: string;
731
451
  /**
732
452
  * Scroll messages up by one page
733
453
  */
734
- messages_page_up: string;
454
+ messages_page_up?: string;
735
455
  /**
736
456
  * Scroll messages down by one page
737
457
  */
738
- messages_page_down: string;
458
+ messages_page_down?: string;
739
459
  /**
740
460
  * Scroll messages up by half page
741
461
  */
742
- messages_half_page_up: string;
462
+ messages_half_page_up?: string;
743
463
  /**
744
464
  * Scroll messages down by half page
745
465
  */
746
- messages_half_page_down: string;
466
+ messages_half_page_down?: string;
747
467
  /**
748
468
  * Navigate to first message
749
469
  */
750
- messages_first: string;
470
+ messages_first?: string;
751
471
  /**
752
472
  * Navigate to last message
753
473
  */
754
- messages_last: string;
474
+ messages_last?: string;
755
475
  /**
756
476
  * Copy message
757
477
  */
758
- messages_copy: string;
478
+ messages_copy?: string;
759
479
  /**
760
480
  * Undo message
761
481
  */
762
- messages_undo: string;
482
+ messages_undo?: string;
763
483
  /**
764
484
  * Redo message
765
485
  */
766
- messages_redo: string;
486
+ messages_redo?: string;
767
487
  /**
768
488
  * List available models
769
489
  */
770
- model_list: string;
490
+ model_list?: string;
771
491
  /**
772
492
  * Next recent model
773
493
  */
774
- model_cycle_recent: string;
494
+ model_cycle_recent?: string;
775
495
  /**
776
496
  * Previous recent model
777
497
  */
778
- model_cycle_recent_reverse: string;
498
+ model_cycle_recent_reverse?: string;
779
499
  /**
780
500
  * List agents
781
501
  */
782
- agent_list: string;
502
+ agent_list?: string;
783
503
  /**
784
504
  * Next agent
785
505
  */
786
- agent_cycle: string;
506
+ agent_cycle?: string;
787
507
  /**
788
508
  * Previous agent
789
509
  */
790
- agent_cycle_reverse: string;
510
+ agent_cycle_reverse?: string;
791
511
  /**
792
512
  * Clear input field
793
513
  */
794
- input_clear: string;
514
+ input_clear?: string;
795
515
  /**
796
516
  * Paste from clipboard
797
517
  */
798
- input_paste: string;
518
+ input_paste?: string;
799
519
  /**
800
520
  * Submit input
801
521
  */
802
- input_submit: string;
522
+ input_submit?: string;
803
523
  /**
804
524
  * Insert newline in input
805
525
  */
806
- input_newline: string;
526
+ input_newline?: string;
807
527
  /**
808
528
  * @deprecated use agent_cycle. Next mode
809
529
  */
810
- switch_mode: string;
530
+ switch_mode?: string;
811
531
  /**
812
532
  * @deprecated use agent_cycle_reverse. Previous mode
813
533
  */
814
- switch_mode_reverse: string;
534
+ switch_mode_reverse?: string;
815
535
  /**
816
536
  * @deprecated use agent_cycle. Next agent
817
537
  */
818
- switch_agent: string;
538
+ switch_agent?: string;
819
539
  /**
820
540
  * @deprecated use agent_cycle_reverse. Previous agent
821
541
  */
822
- switch_agent_reverse: string;
542
+ switch_agent_reverse?: string;
823
543
  /**
824
544
  * @deprecated Currently not available. List files
825
545
  */
826
- file_list: string;
546
+ file_list?: string;
827
547
  /**
828
548
  * @deprecated Close file
829
549
  */
830
- file_close: string;
550
+ file_close?: string;
831
551
  /**
832
552
  * @deprecated Search file
833
553
  */
834
- file_search: string;
554
+ file_search?: string;
835
555
  /**
836
556
  * @deprecated Split/unified diff
837
557
  */
838
- file_diff_toggle: string;
558
+ file_diff_toggle?: string;
839
559
  /**
840
560
  * @deprecated Navigate to previous message
841
561
  */
842
- messages_previous: string;
562
+ messages_previous?: string;
843
563
  /**
844
564
  * @deprecated Navigate to next message
845
565
  */
846
- messages_next: string;
566
+ messages_next?: string;
847
567
  /**
848
568
  * @deprecated Toggle layout
849
569
  */
850
- messages_layout_toggle: string;
570
+ messages_layout_toggle?: string;
851
571
  /**
852
572
  * @deprecated use messages_undo. Revert message
853
573
  */
854
- messages_revert: string;
574
+ messages_revert?: string;
855
575
  };
856
576
  export type AgentConfig = {
857
577
  model?: string;
@@ -884,42 +604,6 @@ export type AgentConfig = {
884
604
  webfetch?: "ask" | "allow" | "deny";
885
605
  } | undefined;
886
606
  };
887
- export type Provider = {
888
- api?: string;
889
- name: string;
890
- env: Array<string>;
891
- id: string;
892
- npm?: string;
893
- models: {
894
- [key: string]: Model;
895
- };
896
- };
897
- export type Model = {
898
- id: string;
899
- name: string;
900
- release_date: string;
901
- attachment: boolean;
902
- reasoning: boolean;
903
- temperature: boolean;
904
- tool_call: boolean;
905
- cost: {
906
- input: number;
907
- output: number;
908
- cache_read?: number;
909
- cache_write?: number;
910
- };
911
- limit: {
912
- context: number;
913
- output: number;
914
- };
915
- experimental?: boolean;
916
- options: {
917
- [key: string]: unknown;
918
- };
919
- provider?: {
920
- npm: string;
921
- };
922
- };
923
607
  export type McpLocalConfig = {
924
608
  /**
925
609
  * Type of MCP server connection
@@ -960,12 +644,214 @@ export type McpRemoteConfig = {
960
644
  [key: string]: string;
961
645
  };
962
646
  };
647
+ /**
648
+ * @deprecated Always uses stretch layout.
649
+ */
963
650
  export type LayoutConfig = "auto" | "stretch";
651
+ export type Config = {
652
+ /**
653
+ * JSON schema reference for configuration validation
654
+ */
655
+ $schema?: string;
656
+ /**
657
+ * Theme name to use for the interface
658
+ */
659
+ theme?: string;
660
+ keybinds?: KeybindsConfig;
661
+ /**
662
+ * TUI specific settings
663
+ */
664
+ tui?: {
665
+ /**
666
+ * TUI scroll speed
667
+ */
668
+ scroll_speed?: number;
669
+ };
670
+ /**
671
+ * Command configuration, see https://opencode.ai/docs/commands
672
+ */
673
+ command?: {
674
+ [key: string]: {
675
+ template: string;
676
+ description?: string;
677
+ agent?: string;
678
+ model?: string;
679
+ subtask?: boolean;
680
+ };
681
+ };
682
+ plugin?: Array<string>;
683
+ snapshot?: boolean;
684
+ /**
685
+ * Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing
686
+ */
687
+ share?: "manual" | "auto" | "disabled";
688
+ /**
689
+ * @deprecated Use 'share' field instead. Share newly created sessions automatically
690
+ */
691
+ autoshare?: boolean;
692
+ /**
693
+ * Automatically update to the latest version
694
+ */
695
+ autoupdate?: boolean;
696
+ /**
697
+ * Disable providers that are loaded automatically
698
+ */
699
+ disabled_providers?: Array<string>;
700
+ /**
701
+ * Model to use in the format of provider/model, eg anthropic/claude-2
702
+ */
703
+ model?: string;
704
+ /**
705
+ * Small model to use for tasks like title generation in the format of provider/model
706
+ */
707
+ small_model?: string;
708
+ /**
709
+ * Custom username to display in conversations instead of system username
710
+ */
711
+ username?: string;
712
+ /**
713
+ * @deprecated Use `agent` field instead.
714
+ */
715
+ mode?: {
716
+ build?: AgentConfig;
717
+ plan?: AgentConfig;
718
+ [key: string]: AgentConfig | undefined;
719
+ };
720
+ /**
721
+ * Agent configuration, see https://opencode.ai/docs/agent
722
+ */
723
+ agent?: {
724
+ plan?: AgentConfig;
725
+ build?: AgentConfig;
726
+ general?: AgentConfig;
727
+ [key: string]: AgentConfig | undefined;
728
+ };
729
+ /**
730
+ * Custom provider configurations and model overrides
731
+ */
732
+ provider?: {
733
+ [key: string]: {
734
+ api?: string;
735
+ name?: string;
736
+ env?: Array<string>;
737
+ id?: string;
738
+ npm?: string;
739
+ models?: {
740
+ [key: string]: {
741
+ id?: string;
742
+ name?: string;
743
+ release_date?: string;
744
+ attachment?: boolean;
745
+ reasoning?: boolean;
746
+ temperature?: boolean;
747
+ tool_call?: boolean;
748
+ cost?: {
749
+ input: number;
750
+ output: number;
751
+ cache_read?: number;
752
+ cache_write?: number;
753
+ };
754
+ limit?: {
755
+ context: number;
756
+ output: number;
757
+ };
758
+ experimental?: boolean;
759
+ options?: {
760
+ [key: string]: unknown;
761
+ };
762
+ provider?: {
763
+ npm: string;
764
+ };
765
+ };
766
+ };
767
+ options?: {
768
+ apiKey?: string;
769
+ baseURL?: string;
770
+ /**
771
+ * Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout.
772
+ */
773
+ timeout?: number | false;
774
+ [key: string]: unknown | string | (number | false) | undefined;
775
+ };
776
+ };
777
+ };
778
+ /**
779
+ * MCP (Model Context Protocol) server configurations
780
+ */
781
+ mcp?: {
782
+ [key: string]: McpLocalConfig | McpRemoteConfig;
783
+ };
784
+ formatter?: {
785
+ [key: string]: {
786
+ disabled?: boolean;
787
+ command?: Array<string>;
788
+ environment?: {
789
+ [key: string]: string;
790
+ };
791
+ extensions?: Array<string>;
792
+ };
793
+ };
794
+ lsp?: {
795
+ [key: string]: {
796
+ disabled: true;
797
+ } | {
798
+ command: Array<string>;
799
+ extensions?: Array<string>;
800
+ disabled?: boolean;
801
+ env?: {
802
+ [key: string]: string;
803
+ };
804
+ initialization?: {
805
+ [key: string]: unknown;
806
+ };
807
+ };
808
+ };
809
+ /**
810
+ * Additional instruction files or patterns to include
811
+ */
812
+ instructions?: Array<string>;
813
+ layout?: LayoutConfig;
814
+ permission?: {
815
+ edit?: "ask" | "allow" | "deny";
816
+ bash?: ("ask" | "allow" | "deny") | {
817
+ [key: string]: "ask" | "allow" | "deny";
818
+ };
819
+ webfetch?: "ask" | "allow" | "deny";
820
+ };
821
+ tools?: {
822
+ [key: string]: boolean;
823
+ };
824
+ experimental?: {
825
+ hook?: {
826
+ file_edited?: {
827
+ [key: string]: Array<{
828
+ command: Array<string>;
829
+ environment?: {
830
+ [key: string]: string;
831
+ };
832
+ }>;
833
+ };
834
+ session_completed?: Array<{
835
+ command: Array<string>;
836
+ environment?: {
837
+ [key: string]: string;
838
+ };
839
+ }>;
840
+ };
841
+ disable_paste_summary?: boolean;
842
+ };
843
+ };
964
844
  export type _Error = {
965
845
  data: {
966
846
  [key: string]: unknown;
967
847
  };
968
848
  };
849
+ export type HttpParamSpec = {
850
+ type: "string" | "number" | "boolean" | "array";
851
+ description?: string;
852
+ optional?: boolean;
853
+ items?: "string" | "number" | "boolean";
854
+ };
969
855
  export type HttpToolRegistration = {
970
856
  id: string;
971
857
  description: string;
@@ -980,19 +866,13 @@ export type HttpToolRegistration = {
980
866
  [key: string]: string;
981
867
  };
982
868
  };
983
- export type HttpParamSpec = {
984
- type: "string" | "number" | "boolean" | "array";
985
- description?: string;
986
- optional?: boolean;
987
- items?: "string" | "number" | "boolean";
988
- };
989
869
  export type ToolIds = Array<string>;
990
- export type ToolList = Array<ToolListItem>;
991
870
  export type ToolListItem = {
992
871
  id: string;
993
872
  description: string;
994
- parameters?: unknown;
873
+ parameters: unknown;
995
874
  };
875
+ export type ToolList = Array<ToolListItem>;
996
876
  export type Path = {
997
877
  state: string;
998
878
  config: string;
@@ -1035,6 +915,42 @@ export type Command = {
1035
915
  template: string;
1036
916
  subtask?: boolean;
1037
917
  };
918
+ export type Model = {
919
+ id: string;
920
+ name: string;
921
+ release_date: string;
922
+ attachment: boolean;
923
+ reasoning: boolean;
924
+ temperature: boolean;
925
+ tool_call: boolean;
926
+ cost: {
927
+ input: number;
928
+ output: number;
929
+ cache_read?: number;
930
+ cache_write?: number;
931
+ };
932
+ limit: {
933
+ context: number;
934
+ output: number;
935
+ };
936
+ experimental?: boolean;
937
+ options: {
938
+ [key: string]: unknown;
939
+ };
940
+ provider?: {
941
+ npm: string;
942
+ };
943
+ };
944
+ export type Provider = {
945
+ api?: string;
946
+ name: string;
947
+ env: Array<string>;
948
+ id: string;
949
+ npm?: string;
950
+ models: {
951
+ [key: string]: Model;
952
+ };
953
+ };
1038
954
  export type Symbol = {
1039
955
  name: string;
1040
956
  kind: number;
@@ -1100,13 +1016,6 @@ export type Agent = {
1100
1016
  [key: string]: unknown;
1101
1017
  };
1102
1018
  };
1103
- export type Auth = ({
1104
- type: "oauth";
1105
- } & OAuth) | ({
1106
- type: "api";
1107
- } & ApiAuth) | ({
1108
- type: "wellknown";
1109
- } & WellKnownAuth);
1110
1019
  export type OAuth = {
1111
1020
  type: "oauth";
1112
1021
  refresh: string;
@@ -1122,6 +1031,7 @@ export type WellKnownAuth = {
1122
1031
  key: string;
1123
1032
  token: string;
1124
1033
  };
1034
+ export type Auth = OAuth | ApiAuth | WellKnownAuth;
1125
1035
  export type ProjectListData = {
1126
1036
  body?: never;
1127
1037
  path?: never;
@@ -1508,13 +1418,7 @@ export type SessionPromptData = {
1508
1418
  tools?: {
1509
1419
  [key: string]: boolean;
1510
1420
  };
1511
- parts: Array<({
1512
- type: "text";
1513
- } & TextPartInput) | ({
1514
- type: "file";
1515
- } & FilePartInput) | ({
1516
- type: "agent";
1517
- } & AgentPartInput)>;
1421
+ parts: Array<TextPartInput | FilePartInput | AgentPartInput>;
1518
1422
  };
1519
1423
  path: {
1520
1424
  /**
@@ -1653,7 +1557,7 @@ export type SessionUnrevertResponses = {
1653
1557
  200: Session;
1654
1558
  };
1655
1559
  export type SessionUnrevertResponse = SessionUnrevertResponses[keyof SessionUnrevertResponses];
1656
- export type PostSessionByIdPermissionsByPermissionIdData = {
1560
+ export type PostSessionIdPermissionsPermissionIdData = {
1657
1561
  body?: {
1658
1562
  response: "once" | "always" | "reject";
1659
1563
  };
@@ -1666,13 +1570,13 @@ export type PostSessionByIdPermissionsByPermissionIdData = {
1666
1570
  };
1667
1571
  url: "/session/{id}/permissions/{permissionID}";
1668
1572
  };
1669
- export type PostSessionByIdPermissionsByPermissionIdResponses = {
1573
+ export type PostSessionIdPermissionsPermissionIdResponses = {
1670
1574
  /**
1671
1575
  * Permission processed successfully
1672
1576
  */
1673
1577
  200: boolean;
1674
1578
  };
1675
- export type PostSessionByIdPermissionsByPermissionIdResponse = PostSessionByIdPermissionsByPermissionIdResponses[keyof PostSessionByIdPermissionsByPermissionIdResponses];
1579
+ export type PostSessionIdPermissionsPermissionIdResponse = PostSessionIdPermissionsPermissionIdResponses[keyof PostSessionIdPermissionsPermissionIdResponses];
1676
1580
  export type CommandListData = {
1677
1581
  body?: never;
1678
1582
  path?: never;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode-ai/sdk",
4
- "version": "0.8.0",
4
+ "version": "0.9.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "typecheck": "tsc --noEmit"