summaryrefslogtreecommitdiffhomepage
path: root/packages/sdk/js/src
diff options
context:
space:
mode:
authorKit Langton <[email protected]>2026-04-04 19:05:45 -0400
committerGitHub <[email protected]>2026-04-04 19:05:45 -0400
commit6ea108a03b36dcb532f3a0c9fddf38b098fb2bad (patch)
treed1bb3b7e90a39adebdf998deb2d47af5ec9654d4 /packages/sdk/js/src
parent280eb16e7704791b031481bc5415fbecfdec0319 (diff)
downloadopencode-6ea108a03b36dcb532f3a0c9fddf38b098fb2bad.tar.gz
opencode-6ea108a03b36dcb532f3a0c9fddf38b098fb2bad.zip
feat(tui): show console-managed providers (#20956)
Diffstat (limited to 'packages/sdk/js/src')
-rw-r--r--packages/sdk/js/src/v2/gen/sdk.gen.ts151
-rw-r--r--packages/sdk/js/src/v2/gen/types.gen.ts74
2 files changed, 204 insertions, 21 deletions
diff --git a/packages/sdk/js/src/v2/gen/sdk.gen.ts b/packages/sdk/js/src/v2/gen/sdk.gen.ts
index 3a780e234..b2e37db59 100644
--- a/packages/sdk/js/src/v2/gen/sdk.gen.ts
+++ b/packages/sdk/js/src/v2/gen/sdk.gen.ts
@@ -24,6 +24,9 @@ import type {
EventTuiPromptAppend,
EventTuiSessionSelect,
EventTuiToastShow,
+ ExperimentalConsoleGetResponses,
+ ExperimentalConsoleListOrgsResponses,
+ ExperimentalConsoleSwitchOrgResponses,
ExperimentalResourceListResponses,
ExperimentalSessionListResponses,
ExperimentalWorkspaceCreateErrors,
@@ -981,13 +984,13 @@ export class Config2 extends HeyApiClient {
}
}
-export class Tool extends HeyApiClient {
+export class Console extends HeyApiClient {
/**
- * List tool IDs
+ * Get active Console provider metadata
*
- * Get a list of all available tool IDs, including both built-in tools and dynamically registered tools.
+ * Get the active Console org name and the set of provider IDs managed by that Console org.
*/
- public ids<ThrowOnError extends boolean = false>(
+ public get<ThrowOnError extends boolean = false>(
parameters?: {
directory?: string
workspace?: string
@@ -1005,24 +1008,22 @@ export class Tool extends HeyApiClient {
},
],
)
- return (options?.client ?? this.client).get<ToolIdsResponses, ToolIdsErrors, ThrowOnError>({
- url: "/experimental/tool/ids",
+ return (options?.client ?? this.client).get<ExperimentalConsoleGetResponses, unknown, ThrowOnError>({
+ url: "/experimental/console",
...options,
...params,
})
}
/**
- * List tools
+ * List switchable Console orgs
*
- * Get a list of available tools with their JSON schema parameters for a specific provider and model combination.
+ * Get the available Console orgs across logged-in accounts, including the current active org.
*/
- public list<ThrowOnError extends boolean = false>(
- parameters: {
+ public listOrgs<ThrowOnError extends boolean = false>(
+ parameters?: {
directory?: string
workspace?: string
- provider: string
- model: string
},
options?: Options<never, ThrowOnError>,
) {
@@ -1033,18 +1034,55 @@ export class Tool extends HeyApiClient {
args: [
{ in: "query", key: "directory" },
{ in: "query", key: "workspace" },
- { in: "query", key: "provider" },
- { in: "query", key: "model" },
],
},
],
)
- return (options?.client ?? this.client).get<ToolListResponses, ToolListErrors, ThrowOnError>({
- url: "/experimental/tool",
+ return (options?.client ?? this.client).get<ExperimentalConsoleListOrgsResponses, unknown, ThrowOnError>({
+ url: "/experimental/console/orgs",
...options,
...params,
})
}
+
+ /**
+ * Switch active Console org
+ *
+ * Persist a new active Console account/org selection for the current local OpenCode state.
+ */
+ public switchOrg<ThrowOnError extends boolean = false>(
+ parameters?: {
+ directory?: string
+ workspace?: string
+ accountID?: string
+ orgID?: string
+ },
+ options?: Options<never, ThrowOnError>,
+ ) {
+ const params = buildClientParams(
+ [parameters],
+ [
+ {
+ args: [
+ { in: "query", key: "directory" },
+ { in: "query", key: "workspace" },
+ { in: "body", key: "accountID" },
+ { in: "body", key: "orgID" },
+ ],
+ },
+ ],
+ )
+ return (options?.client ?? this.client).post<ExperimentalConsoleSwitchOrgResponses, unknown, ThrowOnError>({
+ url: "/experimental/console/switch",
+ ...options,
+ ...params,
+ headers: {
+ "Content-Type": "application/json",
+ ...options?.headers,
+ ...params.headers,
+ },
+ })
+ }
}
export class Workspace extends HeyApiClient {
@@ -1239,6 +1277,11 @@ export class Resource extends HeyApiClient {
}
export class Experimental extends HeyApiClient {
+ private _console?: Console
+ get console(): Console {
+ return (this._console ??= new Console({ client: this.client }))
+ }
+
private _workspace?: Workspace
get workspace(): Workspace {
return (this._workspace ??= new Workspace({ client: this.client }))
@@ -1255,6 +1298,72 @@ export class Experimental extends HeyApiClient {
}
}
+export class Tool extends HeyApiClient {
+ /**
+ * List tool IDs
+ *
+ * Get a list of all available tool IDs, including both built-in tools and dynamically registered tools.
+ */
+ public ids<ThrowOnError extends boolean = false>(
+ parameters?: {
+ directory?: string
+ workspace?: string
+ },
+ options?: Options<never, ThrowOnError>,
+ ) {
+ const params = buildClientParams(
+ [parameters],
+ [
+ {
+ args: [
+ { in: "query", key: "directory" },
+ { in: "query", key: "workspace" },
+ ],
+ },
+ ],
+ )
+ return (options?.client ?? this.client).get<ToolIdsResponses, ToolIdsErrors, ThrowOnError>({
+ url: "/experimental/tool/ids",
+ ...options,
+ ...params,
+ })
+ }
+
+ /**
+ * List tools
+ *
+ * Get a list of available tools with their JSON schema parameters for a specific provider and model combination.
+ */
+ public list<ThrowOnError extends boolean = false>(
+ parameters: {
+ directory?: string
+ workspace?: string
+ provider: string
+ model: string
+ },
+ options?: Options<never, ThrowOnError>,
+ ) {
+ const params = buildClientParams(
+ [parameters],
+ [
+ {
+ args: [
+ { in: "query", key: "directory" },
+ { in: "query", key: "workspace" },
+ { in: "query", key: "provider" },
+ { in: "query", key: "model" },
+ ],
+ },
+ ],
+ )
+ return (options?.client ?? this.client).get<ToolListResponses, ToolListErrors, ThrowOnError>({
+ url: "/experimental/tool",
+ ...options,
+ ...params,
+ })
+ }
+}
+
export class Worktree extends HeyApiClient {
/**
* Remove worktree
@@ -4017,16 +4126,16 @@ export class OpencodeClient extends HeyApiClient {
return (this._config ??= new Config2({ client: this.client }))
}
- private _tool?: Tool
- get tool(): Tool {
- return (this._tool ??= new Tool({ client: this.client }))
- }
-
private _experimental?: Experimental
get experimental(): Experimental {
return (this._experimental ??= new Experimental({ client: this.client }))
}
+ private _tool?: Tool
+ get tool(): Tool {
+ return (this._tool ??= new Tool({ client: this.client }))
+ }
+
private _worktree?: Worktree
get worktree(): Worktree {
return (this._worktree ??= new Worktree({ client: this.client }))
diff --git a/packages/sdk/js/src/v2/gen/types.gen.ts b/packages/sdk/js/src/v2/gen/types.gen.ts
index d517abf2c..4c348573f 100644
--- a/packages/sdk/js/src/v2/gen/types.gen.ts
+++ b/packages/sdk/js/src/v2/gen/types.gen.ts
@@ -2653,6 +2653,80 @@ export type ConfigProvidersResponses = {
export type ConfigProvidersResponse = ConfigProvidersResponses[keyof ConfigProvidersResponses]
+export type ExperimentalConsoleGetData = {
+ body?: never
+ path?: never
+ query?: {
+ directory?: string
+ workspace?: string
+ }
+ url: "/experimental/console"
+}
+
+export type ExperimentalConsoleGetResponses = {
+ /**
+ * Active Console provider metadata
+ */
+ 200: {
+ consoleManagedProviders: Array<string>
+ activeOrgName?: string
+ }
+}
+
+export type ExperimentalConsoleGetResponse = ExperimentalConsoleGetResponses[keyof ExperimentalConsoleGetResponses]
+
+export type ExperimentalConsoleListOrgsData = {
+ body?: never
+ path?: never
+ query?: {
+ directory?: string
+ workspace?: string
+ }
+ url: "/experimental/console/orgs"
+}
+
+export type ExperimentalConsoleListOrgsResponses = {
+ /**
+ * Switchable Console orgs
+ */
+ 200: {
+ orgs: Array<{
+ accountID: string
+ accountEmail: string
+ accountUrl: string
+ orgID: string
+ orgName: string
+ active: boolean
+ }>
+ }
+}
+
+export type ExperimentalConsoleListOrgsResponse =
+ ExperimentalConsoleListOrgsResponses[keyof ExperimentalConsoleListOrgsResponses]
+
+export type ExperimentalConsoleSwitchOrgData = {
+ body?: {
+ accountID: string
+ orgID: string
+ }
+ path?: never
+ query?: {
+ directory?: string
+ workspace?: string
+ }
+ url: "/experimental/console/switch"
+}
+
+export type ExperimentalConsoleSwitchOrgResponses = {
+ /**
+ * Switch success
+ */
+ 200: boolean
+}
+
+export type ExperimentalConsoleSwitchOrgResponse =
+ ExperimentalConsoleSwitchOrgResponses[keyof ExperimentalConsoleSwitchOrgResponses]
+
export type ToolIdsData = {
body?: never
path?: never