@opencode-ai/sdk 0.6.6 → 0.6.7

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, 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, 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";
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
@@ -45,6 +45,20 @@ declare class Config extends _HeyApiClient {
45
45
  */
46
46
  providers<ThrowOnError extends boolean = false>(options?: Options<ConfigProvidersData, ThrowOnError>): import("./client/types.gen.js").RequestResult<ConfigProvidersResponses, unknown, ThrowOnError, "fields">;
47
47
  }
48
+ declare class Tool extends _HeyApiClient {
49
+ /**
50
+ * Register a new HTTP callback tool
51
+ */
52
+ register<ThrowOnError extends boolean = false>(options?: Options<ToolRegisterData, ThrowOnError>): import("./client/types.gen.js").RequestResult<ToolRegisterResponses, ToolRegisterErrors, ThrowOnError, "fields">;
53
+ /**
54
+ * List all tool IDs (including built-in and dynamically registered)
55
+ */
56
+ ids<ThrowOnError extends boolean = false>(options?: Options<ToolIdsData, ThrowOnError>): import("./client/types.gen.js").RequestResult<ToolIdsResponses, ToolIdsErrors, ThrowOnError, "fields">;
57
+ /**
58
+ * List tools with JSON schema parameters for a provider/model
59
+ */
60
+ list<ThrowOnError extends boolean = false>(options: Options<ToolListData, ThrowOnError>): import("./client/types.gen.js").RequestResult<ToolListResponses, ToolListErrors, ThrowOnError, "fields">;
61
+ }
48
62
  declare class Path extends _HeyApiClient {
49
63
  /**
50
64
  * Get the current path
@@ -221,6 +235,7 @@ export declare class OpencodeClient extends _HeyApiClient {
221
235
  project: Project;
222
236
  event: Event;
223
237
  config: Config;
238
+ tool: Tool;
224
239
  path: Path;
225
240
  session: Session;
226
241
  command: Command;
@@ -59,6 +59,39 @@ class Config extends _HeyApiClient {
59
59
  });
60
60
  }
61
61
  }
62
+ class Tool extends _HeyApiClient {
63
+ /**
64
+ * Register a new HTTP callback tool
65
+ */
66
+ register(options) {
67
+ return (options?.client ?? this._client).post({
68
+ url: "/experimental/tool/register",
69
+ ...options,
70
+ headers: {
71
+ "Content-Type": "application/json",
72
+ ...options?.headers,
73
+ },
74
+ });
75
+ }
76
+ /**
77
+ * List all tool IDs (including built-in and dynamically registered)
78
+ */
79
+ ids(options) {
80
+ return (options?.client ?? this._client).get({
81
+ url: "/experimental/tool/ids",
82
+ ...options,
83
+ });
84
+ }
85
+ /**
86
+ * List tools with JSON schema parameters for a provider/model
87
+ */
88
+ list(options) {
89
+ return (options.client ?? this._client).get({
90
+ url: "/experimental/tool",
91
+ ...options,
92
+ });
93
+ }
94
+ }
62
95
  class Path extends _HeyApiClient {
63
96
  /**
64
97
  * Get the current path
@@ -486,6 +519,7 @@ export class OpencodeClient extends _HeyApiClient {
486
519
  project = new Project({ client: this._client });
487
520
  event = new Event({ client: this._client });
488
521
  config = new Config({ client: this._client });
522
+ tool = new Tool({ client: this._client });
489
523
  path = new Path({ client: this._client });
490
524
  session = new Session({ client: this._client });
491
525
  command = new Command({ client: this._client });
@@ -551,6 +551,7 @@ export type Config = {
551
551
  context: number;
552
552
  output: number;
553
553
  };
554
+ experimental?: boolean;
554
555
  options?: {
555
556
  [key: string]: unknown;
556
557
  };
@@ -896,6 +897,7 @@ export type Model = {
896
897
  context: number;
897
898
  output: number;
898
899
  };
900
+ experimental?: boolean;
899
901
  options: {
900
902
  [key: string]: unknown;
901
903
  };
@@ -941,17 +943,44 @@ export type McpRemoteConfig = {
941
943
  };
942
944
  };
943
945
  export type LayoutConfig = "auto" | "stretch";
946
+ export type _Error = {
947
+ data: {
948
+ [key: string]: unknown;
949
+ };
950
+ };
951
+ export type HttpToolRegistration = {
952
+ id: string;
953
+ description: string;
954
+ parameters: {
955
+ type: "object";
956
+ properties: {
957
+ [key: string]: HttpParamSpec;
958
+ };
959
+ };
960
+ callbackUrl: string;
961
+ headers?: {
962
+ [key: string]: string;
963
+ };
964
+ };
965
+ export type HttpParamSpec = {
966
+ type: "string" | "number" | "boolean" | "array";
967
+ description?: string;
968
+ optional?: boolean;
969
+ items?: "string" | "number" | "boolean";
970
+ };
971
+ export type ToolIds = Array<string>;
972
+ export type ToolList = Array<ToolListItem>;
973
+ export type ToolListItem = {
974
+ id: string;
975
+ description: string;
976
+ parameters?: unknown;
977
+ };
944
978
  export type Path = {
945
979
  state: string;
946
980
  config: string;
947
981
  worktree: string;
948
982
  directory: string;
949
983
  };
950
- export type _Error = {
951
- data: {
952
- [key: string]: unknown;
953
- };
954
- };
955
984
  export type TextPartInput = {
956
985
  id?: string;
957
986
  type: "text";
@@ -1134,6 +1163,74 @@ export type ConfigGetResponses = {
1134
1163
  200: Config;
1135
1164
  };
1136
1165
  export type ConfigGetResponse = ConfigGetResponses[keyof ConfigGetResponses];
1166
+ export type ToolRegisterData = {
1167
+ body?: HttpToolRegistration;
1168
+ path?: never;
1169
+ query?: {
1170
+ directory?: string;
1171
+ };
1172
+ url: "/experimental/tool/register";
1173
+ };
1174
+ export type ToolRegisterErrors = {
1175
+ /**
1176
+ * Bad request
1177
+ */
1178
+ 400: _Error;
1179
+ };
1180
+ export type ToolRegisterError = ToolRegisterErrors[keyof ToolRegisterErrors];
1181
+ export type ToolRegisterResponses = {
1182
+ /**
1183
+ * Tool registered successfully
1184
+ */
1185
+ 200: boolean;
1186
+ };
1187
+ export type ToolRegisterResponse = ToolRegisterResponses[keyof ToolRegisterResponses];
1188
+ export type ToolIdsData = {
1189
+ body?: never;
1190
+ path?: never;
1191
+ query?: {
1192
+ directory?: string;
1193
+ };
1194
+ url: "/experimental/tool/ids";
1195
+ };
1196
+ export type ToolIdsErrors = {
1197
+ /**
1198
+ * Bad request
1199
+ */
1200
+ 400: _Error;
1201
+ };
1202
+ export type ToolIdsError = ToolIdsErrors[keyof ToolIdsErrors];
1203
+ export type ToolIdsResponses = {
1204
+ /**
1205
+ * Tool IDs
1206
+ */
1207
+ 200: ToolIds;
1208
+ };
1209
+ export type ToolIdsResponse = ToolIdsResponses[keyof ToolIdsResponses];
1210
+ export type ToolListData = {
1211
+ body?: never;
1212
+ path?: never;
1213
+ query: {
1214
+ directory?: string;
1215
+ provider: string;
1216
+ model: string;
1217
+ };
1218
+ url: "/experimental/tool";
1219
+ };
1220
+ export type ToolListErrors = {
1221
+ /**
1222
+ * Bad request
1223
+ */
1224
+ 400: _Error;
1225
+ };
1226
+ export type ToolListError = ToolListErrors[keyof ToolListErrors];
1227
+ export type ToolListResponses = {
1228
+ /**
1229
+ * Tools
1230
+ */
1231
+ 200: ToolList;
1232
+ };
1233
+ export type ToolListResponse = ToolListResponses[keyof ToolListResponses];
1137
1234
  export type PathGetData = {
1138
1235
  body?: never;
1139
1236
  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.6.6",
4
+ "version": "0.6.7",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "typecheck": "tsc --noEmit"