@opencode-ai/sdk 1.0.134 → 1.0.138
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.
- package/dist/client.d.ts +1 -1
- package/dist/client.js +7 -6
- package/dist/gen/sdk.gen.d.ts +32 -7
- package/dist/gen/sdk.gen.js +74 -15
- package/dist/gen/types.gen.d.ts +184 -1
- package/dist/v2/client.d.ts +7 -0
- package/dist/v2/client.js +25 -0
- package/dist/v2/gen/client/client.gen.d.ts +2 -0
- package/dist/v2/gen/client/client.gen.js +225 -0
- package/dist/v2/gen/client/index.d.ts +8 -0
- package/dist/v2/gen/client/index.js +6 -0
- package/dist/v2/gen/client/types.gen.d.ts +117 -0
- package/dist/v2/gen/client/types.gen.js +2 -0
- package/dist/v2/gen/client/utils.gen.d.ts +33 -0
- package/dist/v2/gen/client/utils.gen.js +226 -0
- package/dist/v2/gen/client.gen.d.ts +12 -0
- package/dist/v2/gen/client.gen.js +3 -0
- package/dist/v2/gen/core/auth.gen.d.ts +18 -0
- package/dist/v2/gen/core/auth.gen.js +14 -0
- package/dist/v2/gen/core/bodySerializer.gen.d.ts +25 -0
- package/dist/v2/gen/core/bodySerializer.gen.js +57 -0
- package/dist/v2/gen/core/params.gen.d.ts +43 -0
- package/dist/v2/gen/core/params.gen.js +102 -0
- package/dist/v2/gen/core/pathSerializer.gen.d.ts +33 -0
- package/dist/v2/gen/core/pathSerializer.gen.js +106 -0
- package/dist/v2/gen/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/v2/gen/core/queryKeySerializer.gen.js +93 -0
- package/dist/v2/gen/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/v2/gen/core/serverSentEvents.gen.js +131 -0
- package/dist/v2/gen/core/types.gen.d.ts +78 -0
- package/dist/v2/gen/core/types.gen.js +2 -0
- package/dist/v2/gen/core/utils.gen.d.ts +19 -0
- package/dist/v2/gen/core/utils.gen.js +87 -0
- package/dist/v2/gen/sdk.gen.d.ts +850 -0
- package/dist/v2/gen/sdk.gen.js +1626 -0
- package/dist/v2/gen/types.gen.d.ts +3357 -0
- package/dist/v2/gen/types.gen.js +2 -0
- package/dist/v2/index.d.ts +10 -0
- package/dist/v2/index.js +16 -0
- package/dist/v2/server.d.ts +23 -0
- package/dist/v2/server.js +91 -0
- package/package.json +15 -3
package/dist/client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from "./gen/types.gen.js";
|
|
2
|
-
export { type Config as OpencodeClientConfig, OpencodeClient };
|
|
3
2
|
import { type Config } from "./gen/client/types.gen.js";
|
|
4
3
|
import { OpencodeClient } from "./gen/sdk.gen.js";
|
|
4
|
+
export { type Config as OpencodeClientConfig, OpencodeClient };
|
|
5
5
|
export declare function createOpencodeClient(config?: Config & {
|
|
6
6
|
directory?: string;
|
|
7
7
|
}): OpencodeClient;
|
package/dist/client.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
export * from "./gen/types.gen.js";
|
|
2
|
-
export { OpencodeClient };
|
|
3
2
|
import { createClient } from "./gen/client/client.gen.js";
|
|
4
3
|
import { OpencodeClient } from "./gen/sdk.gen.js";
|
|
4
|
+
export { OpencodeClient };
|
|
5
5
|
export function createOpencodeClient(config) {
|
|
6
6
|
if (!config?.fetch) {
|
|
7
|
+
const customFetch = (req) => {
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
req.timeout = false;
|
|
10
|
+
return fetch(req);
|
|
11
|
+
};
|
|
7
12
|
config = {
|
|
8
13
|
...config,
|
|
9
|
-
fetch:
|
|
10
|
-
// @ts-ignore
|
|
11
|
-
req.timeout = false;
|
|
12
|
-
return fetch(req);
|
|
13
|
-
},
|
|
14
|
+
fetch: customFetch,
|
|
14
15
|
};
|
|
15
16
|
}
|
|
16
17
|
if (config?.directory) {
|
package/dist/gen/sdk.gen.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Options as ClientOptions, TDataShape, Client } from "./client/index.js";
|
|
2
|
-
import type { GlobalEventData, GlobalEventResponses, ProjectListData, ProjectListResponses, ProjectCurrentData, ProjectCurrentResponses, PtyListData, PtyListResponses, PtyCreateData, PtyCreateResponses, PtyCreateErrors, PtyRemoveData, PtyRemoveResponses, PtyRemoveErrors, PtyGetData, PtyGetResponses, PtyGetErrors, PtyUpdateData, PtyUpdateResponses, PtyUpdateErrors, PtyConnectData, PtyConnectResponses, PtyConnectErrors, ConfigGetData, ConfigGetResponses, ConfigUpdateData, ConfigUpdateResponses, ConfigUpdateErrors, ToolIdsData, ToolIdsResponses, ToolIdsErrors, ToolListData, ToolListResponses, ToolListErrors, InstanceDisposeData, InstanceDisposeResponses, PathGetData, PathGetResponses, VcsGetData, VcsGetResponses, SessionListData, SessionListResponses, SessionCreateData, SessionCreateResponses, SessionCreateErrors, SessionStatusData, SessionStatusResponses, SessionStatusErrors, SessionDeleteData, SessionDeleteResponses, SessionDeleteErrors, SessionGetData, SessionGetResponses, SessionGetErrors, SessionUpdateData, SessionUpdateResponses, SessionUpdateErrors, SessionChildrenData, SessionChildrenResponses, SessionChildrenErrors, SessionTodoData, SessionTodoResponses, SessionTodoErrors, SessionInitData, SessionInitResponses, SessionInitErrors, SessionForkData, SessionForkResponses, SessionAbortData, SessionAbortResponses, SessionAbortErrors, SessionUnshareData, SessionUnshareResponses, SessionUnshareErrors, SessionShareData, SessionShareResponses, SessionShareErrors, SessionDiffData, SessionDiffResponses, SessionDiffErrors, SessionSummarizeData, SessionSummarizeResponses, SessionSummarizeErrors, SessionMessagesData, SessionMessagesResponses, SessionMessagesErrors, SessionPromptData, SessionPromptResponses, SessionPromptErrors, SessionMessageData, SessionMessageResponses, SessionMessageErrors, SessionPromptAsyncData, SessionPromptAsyncResponses, SessionPromptAsyncErrors, SessionCommandData, SessionCommandResponses, SessionCommandErrors, SessionShellData, SessionShellResponses, SessionShellErrors, SessionRevertData, SessionRevertResponses, SessionRevertErrors, SessionUnrevertData, SessionUnrevertResponses, SessionUnrevertErrors, PostSessionIdPermissionsPermissionIdData, PostSessionIdPermissionsPermissionIdResponses, PostSessionIdPermissionsPermissionIdErrors, CommandListData, CommandListResponses, ConfigProvidersData, ConfigProvidersResponses, ProviderListData, ProviderListResponses, ProviderAuthData, ProviderAuthResponses, ProviderOauthAuthorizeData, ProviderOauthAuthorizeResponses, ProviderOauthAuthorizeErrors, ProviderOauthCallbackData, ProviderOauthCallbackResponses, ProviderOauthCallbackErrors, FindTextData, FindTextResponses, FindFilesData, FindFilesResponses, FindSymbolsData, FindSymbolsResponses, FileListData, FileListResponses, FileReadData, FileReadResponses, FileStatusData, FileStatusResponses, AppLogData, AppLogResponses, AppLogErrors, AppAgentsData, AppAgentsResponses, McpStatusData, McpStatusResponses, McpAddData, McpAddResponses, McpAddErrors, LspStatusData, LspStatusResponses, FormatterStatusData, FormatterStatusResponses, TuiAppendPromptData, TuiAppendPromptResponses, TuiAppendPromptErrors, TuiOpenHelpData, TuiOpenHelpResponses, TuiOpenSessionsData, TuiOpenSessionsResponses, TuiOpenThemesData, TuiOpenThemesResponses, TuiOpenModelsData, TuiOpenModelsResponses, TuiSubmitPromptData, TuiSubmitPromptResponses, TuiClearPromptData, TuiClearPromptResponses, TuiExecuteCommandData, TuiExecuteCommandResponses, TuiExecuteCommandErrors, TuiShowToastData, TuiShowToastResponses, TuiPublishData, TuiPublishResponses, TuiPublishErrors, TuiControlNextData, TuiControlNextResponses, TuiControlResponseData, TuiControlResponseResponses, AuthSetData, AuthSetResponses, AuthSetErrors, EventSubscribeData, EventSubscribeResponses } from "./types.gen.js";
|
|
2
|
+
import type { GlobalEventData, GlobalEventResponses, ProjectListData, ProjectListResponses, ProjectCurrentData, ProjectCurrentResponses, PtyListData, PtyListResponses, PtyCreateData, PtyCreateResponses, PtyCreateErrors, PtyRemoveData, PtyRemoveResponses, PtyRemoveErrors, PtyGetData, PtyGetResponses, PtyGetErrors, PtyUpdateData, PtyUpdateResponses, PtyUpdateErrors, PtyConnectData, PtyConnectResponses, PtyConnectErrors, ConfigGetData, ConfigGetResponses, ConfigUpdateData, ConfigUpdateResponses, ConfigUpdateErrors, ToolIdsData, ToolIdsResponses, ToolIdsErrors, ToolListData, ToolListResponses, ToolListErrors, InstanceDisposeData, InstanceDisposeResponses, PathGetData, PathGetResponses, VcsGetData, VcsGetResponses, SessionListData, SessionListResponses, SessionCreateData, SessionCreateResponses, SessionCreateErrors, SessionStatusData, SessionStatusResponses, SessionStatusErrors, SessionDeleteData, SessionDeleteResponses, SessionDeleteErrors, SessionGetData, SessionGetResponses, SessionGetErrors, SessionUpdateData, SessionUpdateResponses, SessionUpdateErrors, SessionChildrenData, SessionChildrenResponses, SessionChildrenErrors, SessionTodoData, SessionTodoResponses, SessionTodoErrors, SessionInitData, SessionInitResponses, SessionInitErrors, SessionForkData, SessionForkResponses, SessionAbortData, SessionAbortResponses, SessionAbortErrors, SessionUnshareData, SessionUnshareResponses, SessionUnshareErrors, SessionShareData, SessionShareResponses, SessionShareErrors, SessionDiffData, SessionDiffResponses, SessionDiffErrors, SessionSummarizeData, SessionSummarizeResponses, SessionSummarizeErrors, SessionMessagesData, SessionMessagesResponses, SessionMessagesErrors, SessionPromptData, SessionPromptResponses, SessionPromptErrors, SessionMessageData, SessionMessageResponses, SessionMessageErrors, SessionPromptAsyncData, SessionPromptAsyncResponses, SessionPromptAsyncErrors, SessionCommandData, SessionCommandResponses, SessionCommandErrors, SessionShellData, SessionShellResponses, SessionShellErrors, SessionRevertData, SessionRevertResponses, SessionRevertErrors, SessionUnrevertData, SessionUnrevertResponses, SessionUnrevertErrors, PostSessionIdPermissionsPermissionIdData, PostSessionIdPermissionsPermissionIdResponses, PostSessionIdPermissionsPermissionIdErrors, CommandListData, CommandListResponses, ConfigProvidersData, ConfigProvidersResponses, ProviderListData, ProviderListResponses, ProviderAuthData, ProviderAuthResponses, ProviderOauthAuthorizeData, ProviderOauthAuthorizeResponses, ProviderOauthAuthorizeErrors, ProviderOauthCallbackData, ProviderOauthCallbackResponses, ProviderOauthCallbackErrors, FindTextData, FindTextResponses, FindFilesData, FindFilesResponses, FindSymbolsData, FindSymbolsResponses, FileListData, FileListResponses, FileReadData, FileReadResponses, FileStatusData, FileStatusResponses, AppLogData, AppLogResponses, AppLogErrors, AppAgentsData, AppAgentsResponses, McpStatusData, McpStatusResponses, McpAddData, McpAddResponses, McpAddErrors, McpAuthRemoveData, McpAuthRemoveResponses, McpAuthRemoveErrors, McpAuthStartData, McpAuthStartResponses, McpAuthStartErrors, McpAuthCallbackData, McpAuthCallbackResponses, McpAuthCallbackErrors, McpAuthAuthenticateData, McpAuthAuthenticateResponses, McpAuthAuthenticateErrors, McpConnectData, McpConnectResponses, McpDisconnectData, McpDisconnectResponses, LspStatusData, LspStatusResponses, FormatterStatusData, FormatterStatusResponses, TuiAppendPromptData, TuiAppendPromptResponses, TuiAppendPromptErrors, TuiOpenHelpData, TuiOpenHelpResponses, TuiOpenSessionsData, TuiOpenSessionsResponses, TuiOpenThemesData, TuiOpenThemesResponses, TuiOpenModelsData, TuiOpenModelsResponses, TuiSubmitPromptData, TuiSubmitPromptResponses, TuiClearPromptData, TuiClearPromptResponses, TuiExecuteCommandData, TuiExecuteCommandResponses, TuiExecuteCommandErrors, TuiShowToastData, TuiShowToastResponses, TuiPublishData, TuiPublishResponses, TuiPublishErrors, TuiControlNextData, TuiControlNextResponses, TuiControlResponseData, TuiControlResponseResponses, AuthSetData, AuthSetResponses, AuthSetErrors, EventSubscribeData, EventSubscribeResponses } 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
|
|
@@ -262,6 +262,28 @@ declare class App extends _HeyApiClient {
|
|
|
262
262
|
*/
|
|
263
263
|
agents<ThrowOnError extends boolean = false>(options?: Options<AppAgentsData, ThrowOnError>): import("./client/types.gen.js").RequestResult<AppAgentsResponses, unknown, ThrowOnError, "fields">;
|
|
264
264
|
}
|
|
265
|
+
declare class Auth extends _HeyApiClient {
|
|
266
|
+
/**
|
|
267
|
+
* Remove OAuth credentials for an MCP server
|
|
268
|
+
*/
|
|
269
|
+
remove<ThrowOnError extends boolean = false>(options: Options<McpAuthRemoveData, ThrowOnError>): import("./client/types.gen.js").RequestResult<McpAuthRemoveResponses, McpAuthRemoveErrors, ThrowOnError, "fields">;
|
|
270
|
+
/**
|
|
271
|
+
* Start OAuth authentication flow for an MCP server
|
|
272
|
+
*/
|
|
273
|
+
start<ThrowOnError extends boolean = false>(options: Options<McpAuthStartData, ThrowOnError>): import("./client/types.gen.js").RequestResult<McpAuthStartResponses, McpAuthStartErrors, ThrowOnError, "fields">;
|
|
274
|
+
/**
|
|
275
|
+
* Complete OAuth authentication with authorization code
|
|
276
|
+
*/
|
|
277
|
+
callback<ThrowOnError extends boolean = false>(options: Options<McpAuthCallbackData, ThrowOnError>): import("./client/types.gen.js").RequestResult<McpAuthCallbackResponses, McpAuthCallbackErrors, ThrowOnError, "fields">;
|
|
278
|
+
/**
|
|
279
|
+
* Start OAuth flow and wait for callback (opens browser)
|
|
280
|
+
*/
|
|
281
|
+
authenticate<ThrowOnError extends boolean = false>(options: Options<McpAuthAuthenticateData, ThrowOnError>): import("./client/types.gen.js").RequestResult<McpAuthAuthenticateResponses, McpAuthAuthenticateErrors, ThrowOnError, "fields">;
|
|
282
|
+
/**
|
|
283
|
+
* Set authentication credentials
|
|
284
|
+
*/
|
|
285
|
+
set<ThrowOnError extends boolean = false>(options: Options<AuthSetData, ThrowOnError>): import("./client/types.gen.js").RequestResult<AuthSetResponses, AuthSetErrors, ThrowOnError, "fields">;
|
|
286
|
+
}
|
|
265
287
|
declare class Mcp extends _HeyApiClient {
|
|
266
288
|
/**
|
|
267
289
|
* Get MCP server status
|
|
@@ -271,6 +293,15 @@ declare class Mcp extends _HeyApiClient {
|
|
|
271
293
|
* Add MCP server dynamically
|
|
272
294
|
*/
|
|
273
295
|
add<ThrowOnError extends boolean = false>(options?: Options<McpAddData, ThrowOnError>): import("./client/types.gen.js").RequestResult<McpAddResponses, McpAddErrors, ThrowOnError, "fields">;
|
|
296
|
+
/**
|
|
297
|
+
* Connect an MCP server
|
|
298
|
+
*/
|
|
299
|
+
connect<ThrowOnError extends boolean = false>(options: Options<McpConnectData, ThrowOnError>): import("./client/types.gen.js").RequestResult<McpConnectResponses, unknown, ThrowOnError, "fields">;
|
|
300
|
+
/**
|
|
301
|
+
* Disconnect an MCP server
|
|
302
|
+
*/
|
|
303
|
+
disconnect<ThrowOnError extends boolean = false>(options: Options<McpDisconnectData, ThrowOnError>): import("./client/types.gen.js").RequestResult<McpDisconnectResponses, unknown, ThrowOnError, "fields">;
|
|
304
|
+
auth: Auth;
|
|
274
305
|
}
|
|
275
306
|
declare class Lsp extends _HeyApiClient {
|
|
276
307
|
/**
|
|
@@ -337,12 +368,6 @@ declare class Tui extends _HeyApiClient {
|
|
|
337
368
|
publish<ThrowOnError extends boolean = false>(options?: Options<TuiPublishData, ThrowOnError>): import("./client/types.gen.js").RequestResult<TuiPublishResponses, TuiPublishErrors, ThrowOnError, "fields">;
|
|
338
369
|
control: Control;
|
|
339
370
|
}
|
|
340
|
-
declare class Auth extends _HeyApiClient {
|
|
341
|
-
/**
|
|
342
|
-
* Set authentication credentials
|
|
343
|
-
*/
|
|
344
|
-
set<ThrowOnError extends boolean = false>(options: Options<AuthSetData, ThrowOnError>): import("./client/types.gen.js").RequestResult<AuthSetResponses, AuthSetErrors, ThrowOnError, "fields">;
|
|
345
|
-
}
|
|
346
371
|
declare class Event extends _HeyApiClient {
|
|
347
372
|
/**
|
|
348
373
|
* Get events
|
package/dist/gen/sdk.gen.js
CHANGED
|
@@ -580,6 +580,61 @@ class App extends _HeyApiClient {
|
|
|
580
580
|
});
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
|
+
class Auth extends _HeyApiClient {
|
|
584
|
+
/**
|
|
585
|
+
* Remove OAuth credentials for an MCP server
|
|
586
|
+
*/
|
|
587
|
+
remove(options) {
|
|
588
|
+
return (options.client ?? this._client).delete({
|
|
589
|
+
url: "/mcp/{name}/auth",
|
|
590
|
+
...options,
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Start OAuth authentication flow for an MCP server
|
|
595
|
+
*/
|
|
596
|
+
start(options) {
|
|
597
|
+
return (options.client ?? this._client).post({
|
|
598
|
+
url: "/mcp/{name}/auth",
|
|
599
|
+
...options,
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* Complete OAuth authentication with authorization code
|
|
604
|
+
*/
|
|
605
|
+
callback(options) {
|
|
606
|
+
return (options.client ?? this._client).post({
|
|
607
|
+
url: "/mcp/{name}/auth/callback",
|
|
608
|
+
...options,
|
|
609
|
+
headers: {
|
|
610
|
+
"Content-Type": "application/json",
|
|
611
|
+
...options.headers,
|
|
612
|
+
},
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Start OAuth flow and wait for callback (opens browser)
|
|
617
|
+
*/
|
|
618
|
+
authenticate(options) {
|
|
619
|
+
return (options.client ?? this._client).post({
|
|
620
|
+
url: "/mcp/{name}/auth/authenticate",
|
|
621
|
+
...options,
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Set authentication credentials
|
|
626
|
+
*/
|
|
627
|
+
set(options) {
|
|
628
|
+
return (options.client ?? this._client).put({
|
|
629
|
+
url: "/auth/{id}",
|
|
630
|
+
...options,
|
|
631
|
+
headers: {
|
|
632
|
+
"Content-Type": "application/json",
|
|
633
|
+
...options.headers,
|
|
634
|
+
},
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
}
|
|
583
638
|
class Mcp extends _HeyApiClient {
|
|
584
639
|
/**
|
|
585
640
|
* Get MCP server status
|
|
@@ -603,6 +658,25 @@ class Mcp extends _HeyApiClient {
|
|
|
603
658
|
},
|
|
604
659
|
});
|
|
605
660
|
}
|
|
661
|
+
/**
|
|
662
|
+
* Connect an MCP server
|
|
663
|
+
*/
|
|
664
|
+
connect(options) {
|
|
665
|
+
return (options.client ?? this._client).post({
|
|
666
|
+
url: "/mcp/{name}/connect",
|
|
667
|
+
...options,
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* Disconnect an MCP server
|
|
672
|
+
*/
|
|
673
|
+
disconnect(options) {
|
|
674
|
+
return (options.client ?? this._client).post({
|
|
675
|
+
url: "/mcp/{name}/disconnect",
|
|
676
|
+
...options,
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
auth = new Auth({ client: this._client });
|
|
606
680
|
}
|
|
607
681
|
class Lsp extends _HeyApiClient {
|
|
608
682
|
/**
|
|
@@ -759,21 +833,6 @@ class Tui extends _HeyApiClient {
|
|
|
759
833
|
}
|
|
760
834
|
control = new Control({ client: this._client });
|
|
761
835
|
}
|
|
762
|
-
class Auth extends _HeyApiClient {
|
|
763
|
-
/**
|
|
764
|
-
* Set authentication credentials
|
|
765
|
-
*/
|
|
766
|
-
set(options) {
|
|
767
|
-
return (options.client ?? this._client).put({
|
|
768
|
-
url: "/auth/{id}",
|
|
769
|
-
...options,
|
|
770
|
-
headers: {
|
|
771
|
-
"Content-Type": "application/json",
|
|
772
|
-
...options.headers,
|
|
773
|
-
},
|
|
774
|
-
});
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
836
|
class Event extends _HeyApiClient {
|
|
778
837
|
/**
|
|
779
838
|
* Get events
|
package/dist/gen/types.gen.d.ts
CHANGED
|
@@ -651,6 +651,10 @@ export type KeybindsConfig = {
|
|
|
651
651
|
* Toggle sidebar
|
|
652
652
|
*/
|
|
653
653
|
sidebar_toggle?: string;
|
|
654
|
+
/**
|
|
655
|
+
* Toggle session scrollbar
|
|
656
|
+
*/
|
|
657
|
+
scrollbar_toggle?: string;
|
|
654
658
|
/**
|
|
655
659
|
* Toggle username visibility
|
|
656
660
|
*/
|
|
@@ -943,6 +947,20 @@ export type McpLocalConfig = {
|
|
|
943
947
|
*/
|
|
944
948
|
timeout?: number;
|
|
945
949
|
};
|
|
950
|
+
export type McpOAuthConfig = {
|
|
951
|
+
/**
|
|
952
|
+
* OAuth client ID. If not provided, dynamic client registration (RFC 7591) will be attempted.
|
|
953
|
+
*/
|
|
954
|
+
clientId?: string;
|
|
955
|
+
/**
|
|
956
|
+
* OAuth client secret (if required by the authorization server)
|
|
957
|
+
*/
|
|
958
|
+
clientSecret?: string;
|
|
959
|
+
/**
|
|
960
|
+
* OAuth scopes to request during authorization
|
|
961
|
+
*/
|
|
962
|
+
scope?: string;
|
|
963
|
+
};
|
|
946
964
|
export type McpRemoteConfig = {
|
|
947
965
|
/**
|
|
948
966
|
* Type of MCP server connection
|
|
@@ -962,6 +980,10 @@ export type McpRemoteConfig = {
|
|
|
962
980
|
headers?: {
|
|
963
981
|
[key: string]: string;
|
|
964
982
|
};
|
|
983
|
+
/**
|
|
984
|
+
* OAuth authentication configuration for the MCP server. Set to false to disable OAuth auto-detection.
|
|
985
|
+
*/
|
|
986
|
+
oauth?: McpOAuthConfig | false;
|
|
965
987
|
/**
|
|
966
988
|
* Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds) if not specified.
|
|
967
989
|
*/
|
|
@@ -1390,7 +1412,14 @@ export type McpStatusFailed = {
|
|
|
1390
1412
|
status: "failed";
|
|
1391
1413
|
error: string;
|
|
1392
1414
|
};
|
|
1393
|
-
export type
|
|
1415
|
+
export type McpStatusNeedsAuth = {
|
|
1416
|
+
status: "needs_auth";
|
|
1417
|
+
};
|
|
1418
|
+
export type McpStatusNeedsClientRegistration = {
|
|
1419
|
+
status: "needs_client_registration";
|
|
1420
|
+
error: string;
|
|
1421
|
+
};
|
|
1422
|
+
export type McpStatus = McpStatusConnected | McpStatusDisabled | McpStatusFailed | McpStatusNeedsAuth | McpStatusNeedsClientRegistration;
|
|
1394
1423
|
export type LspStatus = {
|
|
1395
1424
|
id: string;
|
|
1396
1425
|
name: string;
|
|
@@ -2883,6 +2912,160 @@ export type McpAddResponses = {
|
|
|
2883
2912
|
};
|
|
2884
2913
|
};
|
|
2885
2914
|
export type McpAddResponse = McpAddResponses[keyof McpAddResponses];
|
|
2915
|
+
export type McpAuthRemoveData = {
|
|
2916
|
+
body?: never;
|
|
2917
|
+
path: {
|
|
2918
|
+
name: string;
|
|
2919
|
+
};
|
|
2920
|
+
query?: {
|
|
2921
|
+
directory?: string;
|
|
2922
|
+
};
|
|
2923
|
+
url: "/mcp/{name}/auth";
|
|
2924
|
+
};
|
|
2925
|
+
export type McpAuthRemoveErrors = {
|
|
2926
|
+
/**
|
|
2927
|
+
* Not found
|
|
2928
|
+
*/
|
|
2929
|
+
404: NotFoundError;
|
|
2930
|
+
};
|
|
2931
|
+
export type McpAuthRemoveError = McpAuthRemoveErrors[keyof McpAuthRemoveErrors];
|
|
2932
|
+
export type McpAuthRemoveResponses = {
|
|
2933
|
+
/**
|
|
2934
|
+
* OAuth credentials removed
|
|
2935
|
+
*/
|
|
2936
|
+
200: {
|
|
2937
|
+
success: true;
|
|
2938
|
+
};
|
|
2939
|
+
};
|
|
2940
|
+
export type McpAuthRemoveResponse = McpAuthRemoveResponses[keyof McpAuthRemoveResponses];
|
|
2941
|
+
export type McpAuthStartData = {
|
|
2942
|
+
body?: never;
|
|
2943
|
+
path: {
|
|
2944
|
+
name: string;
|
|
2945
|
+
};
|
|
2946
|
+
query?: {
|
|
2947
|
+
directory?: string;
|
|
2948
|
+
};
|
|
2949
|
+
url: "/mcp/{name}/auth";
|
|
2950
|
+
};
|
|
2951
|
+
export type McpAuthStartErrors = {
|
|
2952
|
+
/**
|
|
2953
|
+
* Bad request
|
|
2954
|
+
*/
|
|
2955
|
+
400: BadRequestError;
|
|
2956
|
+
/**
|
|
2957
|
+
* Not found
|
|
2958
|
+
*/
|
|
2959
|
+
404: NotFoundError;
|
|
2960
|
+
};
|
|
2961
|
+
export type McpAuthStartError = McpAuthStartErrors[keyof McpAuthStartErrors];
|
|
2962
|
+
export type McpAuthStartResponses = {
|
|
2963
|
+
/**
|
|
2964
|
+
* OAuth flow started
|
|
2965
|
+
*/
|
|
2966
|
+
200: {
|
|
2967
|
+
/**
|
|
2968
|
+
* URL to open in browser for authorization
|
|
2969
|
+
*/
|
|
2970
|
+
authorizationUrl: string;
|
|
2971
|
+
};
|
|
2972
|
+
};
|
|
2973
|
+
export type McpAuthStartResponse = McpAuthStartResponses[keyof McpAuthStartResponses];
|
|
2974
|
+
export type McpAuthCallbackData = {
|
|
2975
|
+
body?: {
|
|
2976
|
+
/**
|
|
2977
|
+
* Authorization code from OAuth callback
|
|
2978
|
+
*/
|
|
2979
|
+
code: string;
|
|
2980
|
+
};
|
|
2981
|
+
path: {
|
|
2982
|
+
name: string;
|
|
2983
|
+
};
|
|
2984
|
+
query?: {
|
|
2985
|
+
directory?: string;
|
|
2986
|
+
};
|
|
2987
|
+
url: "/mcp/{name}/auth/callback";
|
|
2988
|
+
};
|
|
2989
|
+
export type McpAuthCallbackErrors = {
|
|
2990
|
+
/**
|
|
2991
|
+
* Bad request
|
|
2992
|
+
*/
|
|
2993
|
+
400: BadRequestError;
|
|
2994
|
+
/**
|
|
2995
|
+
* Not found
|
|
2996
|
+
*/
|
|
2997
|
+
404: NotFoundError;
|
|
2998
|
+
};
|
|
2999
|
+
export type McpAuthCallbackError = McpAuthCallbackErrors[keyof McpAuthCallbackErrors];
|
|
3000
|
+
export type McpAuthCallbackResponses = {
|
|
3001
|
+
/**
|
|
3002
|
+
* OAuth authentication completed
|
|
3003
|
+
*/
|
|
3004
|
+
200: McpStatus;
|
|
3005
|
+
};
|
|
3006
|
+
export type McpAuthCallbackResponse = McpAuthCallbackResponses[keyof McpAuthCallbackResponses];
|
|
3007
|
+
export type McpAuthAuthenticateData = {
|
|
3008
|
+
body?: never;
|
|
3009
|
+
path: {
|
|
3010
|
+
name: string;
|
|
3011
|
+
};
|
|
3012
|
+
query?: {
|
|
3013
|
+
directory?: string;
|
|
3014
|
+
};
|
|
3015
|
+
url: "/mcp/{name}/auth/authenticate";
|
|
3016
|
+
};
|
|
3017
|
+
export type McpAuthAuthenticateErrors = {
|
|
3018
|
+
/**
|
|
3019
|
+
* Bad request
|
|
3020
|
+
*/
|
|
3021
|
+
400: BadRequestError;
|
|
3022
|
+
/**
|
|
3023
|
+
* Not found
|
|
3024
|
+
*/
|
|
3025
|
+
404: NotFoundError;
|
|
3026
|
+
};
|
|
3027
|
+
export type McpAuthAuthenticateError = McpAuthAuthenticateErrors[keyof McpAuthAuthenticateErrors];
|
|
3028
|
+
export type McpAuthAuthenticateResponses = {
|
|
3029
|
+
/**
|
|
3030
|
+
* OAuth authentication completed
|
|
3031
|
+
*/
|
|
3032
|
+
200: McpStatus;
|
|
3033
|
+
};
|
|
3034
|
+
export type McpAuthAuthenticateResponse = McpAuthAuthenticateResponses[keyof McpAuthAuthenticateResponses];
|
|
3035
|
+
export type McpConnectData = {
|
|
3036
|
+
body?: never;
|
|
3037
|
+
path: {
|
|
3038
|
+
name: string;
|
|
3039
|
+
};
|
|
3040
|
+
query?: {
|
|
3041
|
+
directory?: string;
|
|
3042
|
+
};
|
|
3043
|
+
url: "/mcp/{name}/connect";
|
|
3044
|
+
};
|
|
3045
|
+
export type McpConnectResponses = {
|
|
3046
|
+
/**
|
|
3047
|
+
* MCP server connected successfully
|
|
3048
|
+
*/
|
|
3049
|
+
200: boolean;
|
|
3050
|
+
};
|
|
3051
|
+
export type McpConnectResponse = McpConnectResponses[keyof McpConnectResponses];
|
|
3052
|
+
export type McpDisconnectData = {
|
|
3053
|
+
body?: never;
|
|
3054
|
+
path: {
|
|
3055
|
+
name: string;
|
|
3056
|
+
};
|
|
3057
|
+
query?: {
|
|
3058
|
+
directory?: string;
|
|
3059
|
+
};
|
|
3060
|
+
url: "/mcp/{name}/disconnect";
|
|
3061
|
+
};
|
|
3062
|
+
export type McpDisconnectResponses = {
|
|
3063
|
+
/**
|
|
3064
|
+
* MCP server disconnected successfully
|
|
3065
|
+
*/
|
|
3066
|
+
200: boolean;
|
|
3067
|
+
};
|
|
3068
|
+
export type McpDisconnectResponse = McpDisconnectResponses[keyof McpDisconnectResponses];
|
|
2886
3069
|
export type LspStatusData = {
|
|
2887
3070
|
body?: never;
|
|
2888
3071
|
path?: never;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./gen/types.gen.js";
|
|
2
|
+
import { type Config } from "./gen/client/types.gen.js";
|
|
3
|
+
import { OpencodeClient } from "./gen/sdk.gen.js";
|
|
4
|
+
export { type Config as OpencodeClientConfig, OpencodeClient };
|
|
5
|
+
export declare function createOpencodeClient(config?: Config & {
|
|
6
|
+
directory?: string;
|
|
7
|
+
}): OpencodeClient;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export * from "./gen/types.gen.js";
|
|
2
|
+
import { createClient } from "./gen/client/client.gen.js";
|
|
3
|
+
import { OpencodeClient } from "./gen/sdk.gen.js";
|
|
4
|
+
export { OpencodeClient };
|
|
5
|
+
export function createOpencodeClient(config) {
|
|
6
|
+
if (!config?.fetch) {
|
|
7
|
+
const customFetch = (req) => {
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
req.timeout = false;
|
|
10
|
+
return fetch(req);
|
|
11
|
+
};
|
|
12
|
+
config = {
|
|
13
|
+
...config,
|
|
14
|
+
fetch: customFetch,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
if (config?.directory) {
|
|
18
|
+
config.headers = {
|
|
19
|
+
...config.headers,
|
|
20
|
+
"x-opencode-directory": config.directory,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const client = createClient(config);
|
|
24
|
+
return new OpencodeClient({ client });
|
|
25
|
+
}
|