@opencode-ai/sdk 0.3.132 → 0.4.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";
2
- import type { EventSubscribeData, EventSubscribeResponses, AppGetData, AppGetResponses, AppInitData, AppInitResponses, ConfigGetData, ConfigGetResponses, SessionListData, SessionListResponses, SessionCreateData, SessionCreateResponses, SessionCreateErrors, SessionDeleteData, SessionDeleteResponses, SessionInitData, SessionInitResponses, SessionAbortData, SessionAbortResponses, SessionUnshareData, SessionUnshareResponses, SessionShareData, SessionShareResponses, SessionSummarizeData, SessionSummarizeResponses, SessionMessagesData, SessionMessagesResponses, SessionChatData, SessionChatResponses, SessionMessageData, SessionMessageResponses, SessionRevertData, SessionRevertResponses, SessionUnrevertData, SessionUnrevertResponses, PostSessionByIdPermissionsByPermissionIdData, PostSessionByIdPermissionsByPermissionIdResponses, ConfigProvidersData, ConfigProvidersResponses, FindTextData, FindTextResponses, FindFilesData, FindFilesResponses, FindSymbolsData, FindSymbolsResponses, FileReadData, FileReadResponses, FileStatusData, FileStatusResponses, AppLogData, AppLogResponses, AppModesData, AppModesResponses, TuiAppendPromptData, TuiAppendPromptResponses, TuiOpenHelpData, TuiOpenHelpResponses, TuiOpenSessionsData, TuiOpenSessionsResponses, TuiOpenThemesData, TuiOpenThemesResponses, TuiOpenModelsData, TuiOpenModelsResponses, TuiSubmitPromptData, TuiSubmitPromptResponses, TuiClearPromptData, TuiClearPromptResponses, TuiExecuteCommandData, TuiExecuteCommandResponses } from "./types.gen";
2
+ import type { EventSubscribeData, EventSubscribeResponses, AppGetData, AppGetResponses, AppInitData, AppInitResponses, ConfigGetData, ConfigGetResponses, SessionListData, SessionListResponses, SessionCreateData, SessionCreateResponses, SessionCreateErrors, SessionDeleteData, SessionDeleteResponses, SessionGetData, SessionGetResponses, SessionInitData, SessionInitResponses, SessionAbortData, SessionAbortResponses, SessionUnshareData, SessionUnshareResponses, SessionShareData, SessionShareResponses, SessionSummarizeData, SessionSummarizeResponses, SessionMessagesData, SessionMessagesResponses, SessionChatData, SessionChatResponses, SessionMessageData, SessionMessageResponses, SessionRevertData, SessionRevertResponses, SessionUnrevertData, SessionUnrevertResponses, PostSessionByIdPermissionsByPermissionIdData, PostSessionByIdPermissionsByPermissionIdResponses, ConfigProvidersData, ConfigProvidersResponses, FindTextData, FindTextResponses, FindFilesData, FindFilesResponses, FindSymbolsData, FindSymbolsResponses, FileReadData, FileReadResponses, FileStatusData, FileStatusResponses, AppLogData, AppLogResponses, AppAgentsData, AppAgentsResponses, TuiAppendPromptData, TuiAppendPromptResponses, TuiOpenHelpData, TuiOpenHelpResponses, TuiOpenSessionsData, TuiOpenSessionsResponses, TuiOpenThemesData, TuiOpenThemesResponses, TuiOpenModelsData, TuiOpenModelsResponses, TuiSubmitPromptData, TuiSubmitPromptResponses, TuiClearPromptData, TuiClearPromptResponses, TuiExecuteCommandData, TuiExecuteCommandResponses } from "./types.gen";
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
@@ -39,9 +39,9 @@ declare class App extends _HeyApiClient {
39
39
  */
40
40
  log<ThrowOnError extends boolean = false>(options?: Options<AppLogData, ThrowOnError>): import("./client").RequestResult<AppLogResponses, unknown, ThrowOnError, "fields">;
41
41
  /**
42
- * List all modes
42
+ * List all agents
43
43
  */
44
- modes<ThrowOnError extends boolean = false>(options?: Options<AppModesData, ThrowOnError>): import("./client").RequestResult<AppModesResponses, unknown, ThrowOnError, "fields">;
44
+ agents<ThrowOnError extends boolean = false>(options?: Options<AppAgentsData, ThrowOnError>): import("./client").RequestResult<AppAgentsResponses, unknown, ThrowOnError, "fields">;
45
45
  }
46
46
  declare class Config extends _HeyApiClient {
47
47
  /**
@@ -66,6 +66,10 @@ declare class Session extends _HeyApiClient {
66
66
  * Delete a session and all its data
67
67
  */
68
68
  delete<ThrowOnError extends boolean = false>(options: Options<SessionDeleteData, ThrowOnError>): import("./client").RequestResult<SessionDeleteResponses, unknown, ThrowOnError, "fields">;
69
+ /**
70
+ * Get session
71
+ */
72
+ get<ThrowOnError extends boolean = false>(options: Options<SessionGetData, ThrowOnError>): import("./client").RequestResult<SessionGetResponses, unknown, ThrowOnError, "fields">;
69
73
  /**
70
74
  * Analyze the app and create an AGENTS.md file
71
75
  */
@@ -161,7 +165,7 @@ declare class Tui extends _HeyApiClient {
161
165
  */
162
166
  clearPrompt<ThrowOnError extends boolean = false>(options?: Options<TuiClearPromptData, ThrowOnError>): import("./client").RequestResult<TuiClearPromptResponses, unknown, ThrowOnError, "fields">;
163
167
  /**
164
- * Execute a TUI command (e.g. switch_mode)
168
+ * Execute a TUI command (e.g. switch_agent)
165
169
  */
166
170
  executeCommand<ThrowOnError extends boolean = false>(options?: Options<TuiExecuteCommandData, ThrowOnError>): import("./client").RequestResult<TuiExecuteCommandResponses, unknown, ThrowOnError, "fields">;
167
171
  }
@@ -52,11 +52,11 @@ class App extends _HeyApiClient {
52
52
  });
53
53
  }
54
54
  /**
55
- * List all modes
55
+ * List all agents
56
56
  */
57
- modes(options) {
57
+ agents(options) {
58
58
  return (options?.client ?? this._client).get({
59
- url: "/mode",
59
+ url: "/agent",
60
60
  ...options,
61
61
  });
62
62
  }
@@ -109,6 +109,15 @@ class Session extends _HeyApiClient {
109
109
  ...options,
110
110
  });
111
111
  }
112
+ /**
113
+ * Get session
114
+ */
115
+ get(options) {
116
+ return (options.client ?? this._client).get({
117
+ url: "/session/{id}",
118
+ ...options,
119
+ });
120
+ }
112
121
  /**
113
122
  * Analyze the app and create an AGENTS.md file
114
123
  */
@@ -334,7 +343,7 @@ class Tui extends _HeyApiClient {
334
343
  });
335
344
  }
336
345
  /**
337
- * Execute a TUI command (e.g. switch_mode)
346
+ * Execute a TUI command (e.g. switch_agent)
338
347
  */
339
348
  executeCommand(options) {
340
349
  return (options?.client ?? this._client).post({
@@ -154,7 +154,9 @@ export type Part = ({
154
154
  type: "snapshot";
155
155
  } & SnapshotPart) | ({
156
156
  type: "patch";
157
- } & PatchPart);
157
+ } & PatchPart) | ({
158
+ type: "agent";
159
+ } & AgentPart);
158
160
  export type TextPart = {
159
161
  id: string;
160
162
  sessionID: string;
@@ -305,6 +307,18 @@ export type PatchPart = {
305
307
  hash: string;
306
308
  files: Array<string>;
307
309
  };
310
+ export type AgentPart = {
311
+ id: string;
312
+ sessionID: string;
313
+ messageID: string;
314
+ type: string;
315
+ name: string;
316
+ source?: {
317
+ value: string;
318
+ start: number;
319
+ end: number;
320
+ };
321
+ };
308
322
  export type EventMessagePartRemoved = {
309
323
  type: string;
310
324
  properties: {
@@ -471,7 +485,7 @@ export type Config = {
471
485
  */
472
486
  model?: string;
473
487
  /**
474
- * Small model to use for tasks like summarization and title generation in the format of provider/model
488
+ * Small model to use for tasks like title generation in the format of provider/model
475
489
  */
476
490
  small_model?: string;
477
491
  /**
@@ -479,17 +493,19 @@ export type Config = {
479
493
  */
480
494
  username?: string;
481
495
  /**
482
- * Modes configuration, see https://opencode.ai/docs/modes
496
+ * @deprecated Use `agent` field instead.
483
497
  */
484
498
  mode?: {
485
- build?: ModeConfig;
486
- plan?: ModeConfig;
487
- [key: string]: ModeConfig | undefined;
499
+ build?: AgentConfig;
500
+ plan?: AgentConfig;
501
+ [key: string]: AgentConfig | undefined;
488
502
  };
489
503
  /**
490
- * Modes configuration, see https://opencode.ai/docs/modes
504
+ * Agent configuration, see https://opencode.ai/docs/agent
491
505
  */
492
506
  agent?: {
507
+ plan?: AgentConfig;
508
+ build?: AgentConfig;
493
509
  general?: AgentConfig;
494
510
  [key: string]: AgentConfig | undefined;
495
511
  };
@@ -609,13 +625,21 @@ export type KeybindsConfig = {
609
625
  */
610
626
  app_help: string;
611
627
  /**
612
- * Next mode
628
+ * @deprecated use switch_agent. Next mode
613
629
  */
614
630
  switch_mode: string;
615
631
  /**
616
- * Previous Mode
632
+ * @deprecated use switch_agent_reverse. Previous mode
617
633
  */
618
634
  switch_mode_reverse: string;
635
+ /**
636
+ * Next agent
637
+ */
638
+ switch_agent: string;
639
+ /**
640
+ * Previous agent
641
+ */
642
+ switch_agent_reverse: string;
619
643
  /**
620
644
  * Open external editor
621
645
  */
@@ -753,7 +777,7 @@ export type KeybindsConfig = {
753
777
  */
754
778
  app_exit: string;
755
779
  };
756
- export type ModeConfig = {
780
+ export type AgentConfig = {
757
781
  model?: string;
758
782
  temperature?: number;
759
783
  top_p?: number;
@@ -762,9 +786,11 @@ export type ModeConfig = {
762
786
  [key: string]: boolean;
763
787
  };
764
788
  disable?: boolean;
765
- };
766
- export type AgentConfig = ModeConfig & {
767
- description: string;
789
+ /**
790
+ * Description of when to use the agent
791
+ */
792
+ description?: string;
793
+ mode?: string;
768
794
  };
769
795
  export type Provider = {
770
796
  api?: string;
@@ -862,6 +888,16 @@ export type FilePartInput = {
862
888
  url: string;
863
889
  source?: FilePartSource;
864
890
  };
891
+ export type AgentPartInput = {
892
+ id?: string;
893
+ type: string;
894
+ name: string;
895
+ source?: {
896
+ value: string;
897
+ start: number;
898
+ end: number;
899
+ };
900
+ };
865
901
  export type Symbol = {
866
902
  name: string;
867
903
  kind: number;
@@ -876,10 +912,12 @@ export type File = {
876
912
  removed: number;
877
913
  status: "added" | "deleted" | "modified";
878
914
  };
879
- export type Mode = {
915
+ export type Agent = {
880
916
  name: string;
881
- temperature?: number;
917
+ description?: string;
918
+ mode: string;
882
919
  topP?: number;
920
+ temperature?: number;
883
921
  model?: {
884
922
  modelID: string;
885
923
  providerID: string;
@@ -989,6 +1027,21 @@ export type SessionDeleteResponses = {
989
1027
  200: boolean;
990
1028
  };
991
1029
  export type SessionDeleteResponse = SessionDeleteResponses[keyof SessionDeleteResponses];
1030
+ export type SessionGetData = {
1031
+ body?: never;
1032
+ path: {
1033
+ id: string;
1034
+ };
1035
+ query?: never;
1036
+ url: "/session/{id}";
1037
+ };
1038
+ export type SessionGetResponses = {
1039
+ /**
1040
+ * Get session
1041
+ */
1042
+ 200: Session;
1043
+ };
1044
+ export type SessionGetResponse = SessionGetResponses[keyof SessionGetResponses];
992
1045
  export type SessionInitData = {
993
1046
  body?: {
994
1047
  messageID: string;
@@ -1103,7 +1156,7 @@ export type SessionChatData = {
1103
1156
  messageID?: string;
1104
1157
  providerID: string;
1105
1158
  modelID: string;
1106
- mode?: string;
1159
+ agent?: string;
1107
1160
  system?: string;
1108
1161
  tools?: {
1109
1162
  [key: string]: boolean;
@@ -1112,7 +1165,9 @@ export type SessionChatData = {
1112
1165
  type: "text";
1113
1166
  } & TextPartInput) | ({
1114
1167
  type: "file";
1115
- } & FilePartInput)>;
1168
+ } & FilePartInput) | ({
1169
+ type: "agent";
1170
+ } & AgentPartInput)>;
1116
1171
  };
1117
1172
  path: {
1118
1173
  /**
@@ -1348,19 +1403,19 @@ export type AppLogResponses = {
1348
1403
  200: boolean;
1349
1404
  };
1350
1405
  export type AppLogResponse = AppLogResponses[keyof AppLogResponses];
1351
- export type AppModesData = {
1406
+ export type AppAgentsData = {
1352
1407
  body?: never;
1353
1408
  path?: never;
1354
1409
  query?: never;
1355
- url: "/mode";
1410
+ url: "/agent";
1356
1411
  };
1357
- export type AppModesResponses = {
1412
+ export type AppAgentsResponses = {
1358
1413
  /**
1359
- * List of modes
1414
+ * List of agents
1360
1415
  */
1361
- 200: Array<Mode>;
1416
+ 200: Array<Agent>;
1362
1417
  };
1363
- export type AppModesResponse = AppModesResponses[keyof AppModesResponses];
1418
+ export type AppAgentsResponse = AppAgentsResponses[keyof AppAgentsResponses];
1364
1419
  export type TuiAppendPromptData = {
1365
1420
  body?: {
1366
1421
  text: string;
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.3.132",
4
+ "version": "0.4.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "typecheck": "tsc --noEmit"