@opencode-ai/sdk 0.3.133 → 0.4.1

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, SessionGetData, SessionGetResponses, 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
  /**
@@ -62,14 +62,14 @@ declare class Session extends _HeyApiClient {
62
62
  * Create a new session
63
63
  */
64
64
  create<ThrowOnError extends boolean = false>(options?: Options<SessionCreateData, ThrowOnError>): import("./client").RequestResult<SessionCreateResponses, SessionCreateErrors, ThrowOnError, "fields">;
65
- /**
66
- * Get session
67
- */
68
- get<ThrowOnError extends boolean = false>(options: Options<SessionGetData, ThrowOnError>): import("./client").RequestResult<SessionGetResponses, unknown, ThrowOnError, "fields">;
69
65
  /**
70
66
  * Delete a session and all its data
71
67
  */
72
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">;
73
73
  /**
74
74
  * Analyze the app and create an AGENTS.md file
75
75
  */
@@ -165,7 +165,7 @@ declare class Tui extends _HeyApiClient {
165
165
  */
166
166
  clearPrompt<ThrowOnError extends boolean = false>(options?: Options<TuiClearPromptData, ThrowOnError>): import("./client").RequestResult<TuiClearPromptResponses, unknown, ThrowOnError, "fields">;
167
167
  /**
168
- * Execute a TUI command (e.g. switch_mode)
168
+ * Execute a TUI command (e.g. switch_agent)
169
169
  */
170
170
  executeCommand<ThrowOnError extends boolean = false>(options?: Options<TuiExecuteCommandData, ThrowOnError>): import("./client").RequestResult<TuiExecuteCommandResponses, unknown, ThrowOnError, "fields">;
171
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
  }
@@ -101,19 +101,19 @@ class Session extends _HeyApiClient {
101
101
  });
102
102
  }
103
103
  /**
104
- * Get session
104
+ * Delete a session and all its data
105
105
  */
106
- get(options) {
107
- return (options.client ?? this._client).get({
108
- url: "/session/{sessionID}",
106
+ delete(options) {
107
+ return (options.client ?? this._client).delete({
108
+ url: "/session/{id}",
109
109
  ...options,
110
110
  });
111
111
  }
112
112
  /**
113
- * Delete a session and all its data
113
+ * Get session
114
114
  */
115
- delete(options) {
116
- return (options.client ?? this._client).delete({
115
+ get(options) {
116
+ return (options.client ?? this._client).get({
117
117
  url: "/session/{id}",
118
118
  ...options,
119
119
  });
@@ -343,7 +343,7 @@ class Tui extends _HeyApiClient {
343
343
  });
344
344
  }
345
345
  /**
346
- * Execute a TUI command (e.g. switch_mode)
346
+ * Execute a TUI command (e.g. switch_agent)
347
347
  */
348
348
  executeCommand(options) {
349
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: {
@@ -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;
@@ -974,22 +1012,22 @@ export type SessionCreateResponses = {
974
1012
  200: Session;
975
1013
  };
976
1014
  export type SessionCreateResponse = SessionCreateResponses[keyof SessionCreateResponses];
977
- export type SessionGetData = {
1015
+ export type SessionDeleteData = {
978
1016
  body?: never;
979
1017
  path: {
980
- sessionID: string;
1018
+ id: string;
981
1019
  };
982
1020
  query?: never;
983
- url: "/session/{sessionID}";
1021
+ url: "/session/{id}";
984
1022
  };
985
- export type SessionGetResponses = {
1023
+ export type SessionDeleteResponses = {
986
1024
  /**
987
- * Get session
1025
+ * Successfully deleted session
988
1026
  */
989
- 200: Session;
1027
+ 200: boolean;
990
1028
  };
991
- export type SessionGetResponse = SessionGetResponses[keyof SessionGetResponses];
992
- export type SessionDeleteData = {
1029
+ export type SessionDeleteResponse = SessionDeleteResponses[keyof SessionDeleteResponses];
1030
+ export type SessionGetData = {
993
1031
  body?: never;
994
1032
  path: {
995
1033
  id: string;
@@ -997,13 +1035,13 @@ export type SessionDeleteData = {
997
1035
  query?: never;
998
1036
  url: "/session/{id}";
999
1037
  };
1000
- export type SessionDeleteResponses = {
1038
+ export type SessionGetResponses = {
1001
1039
  /**
1002
- * Successfully deleted session
1040
+ * Get session
1003
1041
  */
1004
- 200: boolean;
1042
+ 200: Session;
1005
1043
  };
1006
- export type SessionDeleteResponse = SessionDeleteResponses[keyof SessionDeleteResponses];
1044
+ export type SessionGetResponse = SessionGetResponses[keyof SessionGetResponses];
1007
1045
  export type SessionInitData = {
1008
1046
  body?: {
1009
1047
  messageID: string;
@@ -1118,7 +1156,7 @@ export type SessionChatData = {
1118
1156
  messageID?: string;
1119
1157
  providerID: string;
1120
1158
  modelID: string;
1121
- mode?: string;
1159
+ agent?: string;
1122
1160
  system?: string;
1123
1161
  tools?: {
1124
1162
  [key: string]: boolean;
@@ -1127,7 +1165,9 @@ export type SessionChatData = {
1127
1165
  type: "text";
1128
1166
  } & TextPartInput) | ({
1129
1167
  type: "file";
1130
- } & FilePartInput)>;
1168
+ } & FilePartInput) | ({
1169
+ type: "agent";
1170
+ } & AgentPartInput)>;
1131
1171
  };
1132
1172
  path: {
1133
1173
  /**
@@ -1363,19 +1403,19 @@ export type AppLogResponses = {
1363
1403
  200: boolean;
1364
1404
  };
1365
1405
  export type AppLogResponse = AppLogResponses[keyof AppLogResponses];
1366
- export type AppModesData = {
1406
+ export type AppAgentsData = {
1367
1407
  body?: never;
1368
1408
  path?: never;
1369
1409
  query?: never;
1370
- url: "/mode";
1410
+ url: "/agent";
1371
1411
  };
1372
- export type AppModesResponses = {
1412
+ export type AppAgentsResponses = {
1373
1413
  /**
1374
- * List of modes
1414
+ * List of agents
1375
1415
  */
1376
- 200: Array<Mode>;
1416
+ 200: Array<Agent>;
1377
1417
  };
1378
- export type AppModesResponse = AppModesResponses[keyof AppModesResponses];
1418
+ export type AppAgentsResponse = AppAgentsResponses[keyof AppAgentsResponses];
1379
1419
  export type TuiAppendPromptData = {
1380
1420
  body?: {
1381
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.133",
4
+ "version": "0.4.1",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "typecheck": "tsc --noEmit"