shuvcode 2.2.5-shuv.1 → 2.2.5-shuv.2
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/client/client.d.ts +3 -0
- package/client/generated/client.d.ts +4 -1
- package/client/generated/client.js +15 -0
- package/client/generated/types.d.ts +55 -3
- package/client/index.js +2 -2
- package/client/media.d.ts +3 -0
- package/package.json +13 -13
package/client/client.d.ts
CHANGED
|
@@ -106,6 +106,9 @@ export declare function make(options: ClientOptions): {
|
|
|
106
106
|
delete: (input: import("./index.js").ExperimentalArtifactsDeleteInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
107
107
|
view: (input: import("./index.js").ExperimentalArtifactsViewInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").ExperimentalArtifactsViewOutput>;
|
|
108
108
|
};
|
|
109
|
+
job: {
|
|
110
|
+
list: (input?: import("./index.js").ExperimentalJobListInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").JobInfo[]>;
|
|
111
|
+
};
|
|
109
112
|
migration: {
|
|
110
113
|
v1: {
|
|
111
114
|
status: (requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").ExperimentalMigrationV1StatusOutput>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ServerConnectInput, LocationGetInput, AgentListInput, AgentListOutput, AgentGetInput, AgentGetOutput, PluginListInput, PluginListOutput, PluginGuiInput, PluginGuiOutput, PluginCheckInput, PluginCheckOutput, PluginUpdateInput, SessionListInput, SessionCreateInput, SessionGetInput, SessionRemoveInput, SessionForkInput, SessionSwitchAgentInput, SessionSwitchModelInput, SessionUpdateInput, SessionMoveInput, SessionPromptInput, SessionCommandInput, SessionSyntheticInput, SessionShellInput, SessionCompactInput, SessionRevertStageInput, SessionRevertClearInput, SessionRevertCommitInput, SessionContextInput, SessionDiffInput, SessionInboxListInput, SessionInboxCancelInput, SessionInboxUpdateInput, SessionGenerateInput, SessionInterruptInput, SessionBackgroundInput, SessionMessageGetInput, SessionFormListInput, SessionFormCreateInput, SessionFormGetInput, SessionFormReplyInput, SessionFormCancelInput, SessionEnvironmentInput, SessionViewInput, ExperimentalSessionStatsInput, ExperimentalSessionImportInput, ExperimentalSessionExportInput, ExperimentalSessionSkillInput, ExperimentalSessionWaitInput, ExperimentalSessionInstructionsEntryListInput, ExperimentalSessionInstructionsEntryPutInput, ExperimentalSessionInstructionsEntryRemoveInput, ExperimentalSessionLogInput, ExperimentalSessionLogOutput, MessageListInput, ModelListInput, ModelListOutput, ModelDefaultInput, ModelDefaultOutput, ExperimentalGenerateTextInput, ExperimentalGenerateImageInput, ExperimentalGenerateDecisionsInput, ExperimentalVoiceSessionInput, ProviderListInput, ProviderListOutput, ProviderGetInput, ProviderGetOutput, IntegrationListInput, IntegrationListOutput, IntegrationGetInput, IntegrationGetOutput, IntegrationConnectKeyInput, IntegrationConnectExternalInput, IntegrationOauthConnectInput, IntegrationOauthConnectOutput, IntegrationOauthStatusInput, IntegrationOauthStatusOutput, IntegrationOauthCompleteInput, IntegrationOauthCancelInput, IntegrationCommandConnectInput, IntegrationCommandConnectOutput, IntegrationCommandStatusInput, IntegrationCommandStatusOutput, IntegrationCommandCancelInput, ExperimentalIntegrationWellknownAddInput, McpListInput, McpListOutput, McpResourceCatalogInput, McpResourceCatalogOutput, ExperimentalMcpAddInput, ExperimentalMcpRemoveInput, ExperimentalMcpConnectInput, ExperimentalMcpDisconnectInput, ExperimentalMcpClientTokenInput, ExperimentalMcpClientTokenOutput, CredentialCreateInput, CredentialUpdateInput, CredentialActivateInput, CredentialRemoveInput, ProjectListInput, ProjectListOutput, ProjectUpdateInput, FormListInput, FormListOutput, PermissionRequestListInput, PermissionRequestListOutput, PermissionSavedListInput, PermissionSavedUpdateInput, PermissionSavedRemoveInput, PermissionCreateInput, PermissionListInput, PermissionGetInput, PermissionReplyInput, FileReadInput, FileReadOutput, FileListInput, FileListOutput, FileFindInput, FileFindOutput, ExperimentalFileWriteInput, ExperimentalFileWriteOutput, ExperimentalFileWatchInput, ExperimentalFileUnwatchInput, CommandListInput, CommandListOutput, SkillListInput, SkillListOutput, RpcCallInput, EventSubscribeInput, EventSubscribeOutput, PtyListInput, PtyListOutput, PtyCreateInput, PtyCreateOutput, PtyGetInput, PtyGetOutput, PtyUpdateInput, PtyUpdateOutput, PtyRemoveInput, PtyConnectTokenInput, PtyConnectTokenOutput, ExperimentalPersistentPtyReadInput, ExperimentalPersistentPtyListInput, ExperimentalPersistentPtyCreateInput, ExperimentalPersistentPtyHandoffOutput, ExperimentalPersistentPtyGetInput, ExperimentalPersistentPtyUpdateInput, ExperimentalPersistentPtySnapshotInput, ExperimentalPersistentPtyRemoveInput, ExperimentalPersistentPtyConnectTokenInput, ExperimentalMediaGetInput, ExperimentalMediaGetOutput, ExperimentalScheduleCreateInput, ExperimentalScheduleListInput, ExperimentalScheduleGetInput, ExperimentalSchedulePauseInput, ExperimentalScheduleResumeInput, ExperimentalScheduleDeleteInput, ExperimentalArtifactsProvidersInput, ExperimentalArtifactsProvidersOutput, ExperimentalArtifactsListInput, ExperimentalArtifactsListOutput, ExperimentalArtifactsCreateInput, ExperimentalArtifactsCreateOutput, ExperimentalArtifactsGetInput, ExperimentalArtifactsGetOutput, ExperimentalArtifactsUpdateInput, ExperimentalArtifactsUpdateOutput, ExperimentalArtifactsDeleteInput, ExperimentalArtifactsViewInput, ExperimentalArtifactsViewOutput, ShellListInput, ShellListOutput, ShellCreateInput, ShellCreateOutput, ShellGetInput, ShellGetOutput, ShellOutputInput, ShellOutputOutput, ShellRemoveInput, ReferenceListInput, ReferenceListOutput, WorktreeListInput, WorktreeCreateInput, WorktreeRemoveInput, WorktreeRefreshInput, VcsInitInput, VcsGetInput, VcsGetOutput, VcsBaseInput, VcsBaseOutput, VcsStatusInput, VcsStatusOutput, VcsBranchListInput, VcsBranchListOutput, VcsDiffInput, VcsDiffOutput, DebugHeapDumpInput, DebugHeapDumpOutput, DebugLocationListOutput, DebugLocationEvictInput, ExperimentalMigrationV1StatusOutput, WebsearchProvidersInput, WebsearchProvidersOutput, WebsearchQueryInput, WebsearchQueryOutput, ExperimentalUsageLimitsInput, ExperimentalUsageLimitsOutput, ConfigGetInput, ConfigGetOutput, ConfigShellsOutput, ExperimentalConfigUpdateInput } from "./types.js";
|
|
1
|
+
import type { ServerConnectInput, LocationGetInput, AgentListInput, AgentListOutput, AgentGetInput, AgentGetOutput, PluginListInput, PluginListOutput, PluginGuiInput, PluginGuiOutput, PluginCheckInput, PluginCheckOutput, PluginUpdateInput, SessionListInput, SessionCreateInput, SessionGetInput, SessionRemoveInput, SessionForkInput, SessionSwitchAgentInput, SessionSwitchModelInput, SessionUpdateInput, SessionMoveInput, SessionPromptInput, SessionCommandInput, SessionSyntheticInput, SessionShellInput, SessionCompactInput, SessionRevertStageInput, SessionRevertClearInput, SessionRevertCommitInput, SessionContextInput, SessionDiffInput, SessionInboxListInput, SessionInboxCancelInput, SessionInboxUpdateInput, SessionGenerateInput, SessionInterruptInput, SessionBackgroundInput, SessionMessageGetInput, SessionFormListInput, SessionFormCreateInput, SessionFormGetInput, SessionFormReplyInput, SessionFormCancelInput, SessionEnvironmentInput, SessionViewInput, ExperimentalSessionStatsInput, ExperimentalSessionImportInput, ExperimentalSessionExportInput, ExperimentalSessionSkillInput, ExperimentalSessionWaitInput, ExperimentalSessionInstructionsEntryListInput, ExperimentalSessionInstructionsEntryPutInput, ExperimentalSessionInstructionsEntryRemoveInput, ExperimentalSessionLogInput, ExperimentalSessionLogOutput, MessageListInput, ModelListInput, ModelListOutput, ModelDefaultInput, ModelDefaultOutput, ExperimentalGenerateTextInput, ExperimentalGenerateImageInput, ExperimentalGenerateDecisionsInput, ExperimentalVoiceSessionInput, ProviderListInput, ProviderListOutput, ProviderGetInput, ProviderGetOutput, IntegrationListInput, IntegrationListOutput, IntegrationGetInput, IntegrationGetOutput, IntegrationConnectKeyInput, IntegrationConnectExternalInput, IntegrationOauthConnectInput, IntegrationOauthConnectOutput, IntegrationOauthStatusInput, IntegrationOauthStatusOutput, IntegrationOauthCompleteInput, IntegrationOauthCancelInput, IntegrationCommandConnectInput, IntegrationCommandConnectOutput, IntegrationCommandStatusInput, IntegrationCommandStatusOutput, IntegrationCommandCancelInput, ExperimentalIntegrationWellknownAddInput, McpListInput, McpListOutput, McpResourceCatalogInput, McpResourceCatalogOutput, ExperimentalMcpAddInput, ExperimentalMcpRemoveInput, ExperimentalMcpConnectInput, ExperimentalMcpDisconnectInput, ExperimentalMcpClientTokenInput, ExperimentalMcpClientTokenOutput, CredentialCreateInput, CredentialUpdateInput, CredentialActivateInput, CredentialRemoveInput, ProjectListInput, ProjectListOutput, ProjectUpdateInput, FormListInput, FormListOutput, PermissionRequestListInput, PermissionRequestListOutput, PermissionSavedListInput, PermissionSavedUpdateInput, PermissionSavedRemoveInput, PermissionCreateInput, PermissionListInput, PermissionGetInput, PermissionReplyInput, FileReadInput, FileReadOutput, FileListInput, FileListOutput, FileFindInput, FileFindOutput, ExperimentalFileWriteInput, ExperimentalFileWriteOutput, ExperimentalFileWatchInput, ExperimentalFileUnwatchInput, CommandListInput, CommandListOutput, SkillListInput, SkillListOutput, RpcCallInput, EventSubscribeInput, EventSubscribeOutput, PtyListInput, PtyListOutput, PtyCreateInput, PtyCreateOutput, PtyGetInput, PtyGetOutput, PtyUpdateInput, PtyUpdateOutput, PtyRemoveInput, PtyConnectTokenInput, PtyConnectTokenOutput, ExperimentalPersistentPtyReadInput, ExperimentalPersistentPtyListInput, ExperimentalPersistentPtyCreateInput, ExperimentalPersistentPtyHandoffOutput, ExperimentalPersistentPtyGetInput, ExperimentalPersistentPtyUpdateInput, ExperimentalPersistentPtySnapshotInput, ExperimentalPersistentPtyRemoveInput, ExperimentalPersistentPtyConnectTokenInput, ExperimentalMediaGetInput, ExperimentalMediaGetOutput, ExperimentalScheduleCreateInput, ExperimentalScheduleListInput, ExperimentalScheduleGetInput, ExperimentalSchedulePauseInput, ExperimentalScheduleResumeInput, ExperimentalScheduleDeleteInput, ExperimentalArtifactsProvidersInput, ExperimentalArtifactsProvidersOutput, ExperimentalArtifactsListInput, ExperimentalArtifactsListOutput, ExperimentalArtifactsCreateInput, ExperimentalArtifactsCreateOutput, ExperimentalArtifactsGetInput, ExperimentalArtifactsGetOutput, ExperimentalArtifactsUpdateInput, ExperimentalArtifactsUpdateOutput, ExperimentalArtifactsDeleteInput, ExperimentalArtifactsViewInput, ExperimentalArtifactsViewOutput, ExperimentalJobListInput, ShellListInput, ShellListOutput, ShellCreateInput, ShellCreateOutput, ShellGetInput, ShellGetOutput, ShellOutputInput, ShellOutputOutput, ShellRemoveInput, ReferenceListInput, ReferenceListOutput, WorktreeListInput, WorktreeCreateInput, WorktreeRemoveInput, WorktreeRefreshInput, VcsInitInput, VcsGetInput, VcsGetOutput, VcsBaseInput, VcsBaseOutput, VcsStatusInput, VcsStatusOutput, VcsBranchListInput, VcsBranchListOutput, VcsDiffInput, VcsDiffOutput, DebugHeapDumpInput, DebugHeapDumpOutput, DebugLocationListOutput, DebugLocationEvictInput, ExperimentalMigrationV1StatusOutput, WebsearchProvidersInput, WebsearchProvidersOutput, WebsearchQueryInput, WebsearchQueryOutput, ExperimentalUsageLimitsInput, ExperimentalUsageLimitsOutput, ConfigGetInput, ConfigGetOutput, ConfigShellsOutput, ExperimentalConfigUpdateInput } from "./types.js";
|
|
2
2
|
export interface ClientOptions {
|
|
3
3
|
readonly baseUrl: string;
|
|
4
4
|
readonly fetch?: typeof globalThis.fetch;
|
|
@@ -113,6 +113,9 @@ export declare function make(options: ClientOptions): {
|
|
|
113
113
|
delete: (input: ExperimentalArtifactsDeleteInput, requestOptions?: RequestOptions) => Promise<void>;
|
|
114
114
|
view: (input: ExperimentalArtifactsViewInput, requestOptions?: RequestOptions) => Promise<ExperimentalArtifactsViewOutput>;
|
|
115
115
|
};
|
|
116
|
+
job: {
|
|
117
|
+
list: (input?: ExperimentalJobListInput, requestOptions?: RequestOptions) => Promise<import("./types.js").JobInfo[]>;
|
|
118
|
+
};
|
|
116
119
|
migration: {
|
|
117
120
|
v1: {
|
|
118
121
|
status: (requestOptions?: RequestOptions) => Promise<ExperimentalMigrationV1StatusOutput>;
|
|
@@ -976,6 +976,21 @@ export function make(options) {
|
|
|
976
976
|
binary: true,
|
|
977
977
|
}, requestOptions),
|
|
978
978
|
},
|
|
979
|
+
job: {
|
|
980
|
+
list: (input, requestOptions) => request({
|
|
981
|
+
method: "GET",
|
|
982
|
+
path: `/api/experimental/job`,
|
|
983
|
+
query: {
|
|
984
|
+
sessionID: input?.["sessionID"],
|
|
985
|
+
kind: input?.["kind"],
|
|
986
|
+
status: input?.["status"],
|
|
987
|
+
descendants: input?.["descendants"],
|
|
988
|
+
},
|
|
989
|
+
successStatus: 200,
|
|
990
|
+
declaredStatuses: [400, 401, 404],
|
|
991
|
+
empty: false,
|
|
992
|
+
}, requestOptions).then((value) => value.data),
|
|
993
|
+
},
|
|
979
994
|
migration: {
|
|
980
995
|
v1: {
|
|
981
996
|
status: (requestOptions) => request({
|
|
@@ -30,6 +30,10 @@ export type ProviderCompaction = {
|
|
|
30
30
|
type: "native";
|
|
31
31
|
};
|
|
32
32
|
export type ProviderCacheTTL = `${number}${"ms" | "s" | "m" | "h" | "d"}`;
|
|
33
|
+
export type ProviderCacheWarming = boolean | {
|
|
34
|
+
interval?: "auto" | (string & {});
|
|
35
|
+
duration?: string;
|
|
36
|
+
};
|
|
33
37
|
export type ProviderTransport = "http" | "websocket";
|
|
34
38
|
export type ProviderEncoding = "zstd" | "gzip" | "none";
|
|
35
39
|
export type AgentColor = string;
|
|
@@ -501,6 +505,11 @@ export type ArtifactTime = {
|
|
|
501
505
|
created: number;
|
|
502
506
|
updated: number;
|
|
503
507
|
};
|
|
508
|
+
export type JobStatus = "running" | "completed" | "error" | "cancelled";
|
|
509
|
+
export type JobTime = {
|
|
510
|
+
started: number;
|
|
511
|
+
completed?: number;
|
|
512
|
+
};
|
|
504
513
|
export type ReferenceGitSource = {
|
|
505
514
|
type: "git";
|
|
506
515
|
repository: string;
|
|
@@ -589,6 +598,7 @@ export type ModelRef = {
|
|
|
589
598
|
};
|
|
590
599
|
export type ProviderCache = {
|
|
591
600
|
ttl?: ProviderCacheTTL;
|
|
601
|
+
warming?: ProviderCacheWarming;
|
|
592
602
|
};
|
|
593
603
|
export type ModelVariantSettings = {
|
|
594
604
|
compaction?: ProviderCompaction;
|
|
@@ -1058,6 +1068,7 @@ export type IntegrationAttempt = {
|
|
|
1058
1068
|
url: string;
|
|
1059
1069
|
instructions: string;
|
|
1060
1070
|
mode: "auto" | "code";
|
|
1071
|
+
paste?: true;
|
|
1061
1072
|
time: {
|
|
1062
1073
|
created: number;
|
|
1063
1074
|
expires: number;
|
|
@@ -1253,6 +1264,37 @@ export type ArtifactInfo = {
|
|
|
1253
1264
|
url: string;
|
|
1254
1265
|
time: ArtifactTime;
|
|
1255
1266
|
};
|
|
1267
|
+
export type JobShell = {
|
|
1268
|
+
kind: "shell";
|
|
1269
|
+
id: string;
|
|
1270
|
+
sessionID: SessionID;
|
|
1271
|
+
status: JobStatus;
|
|
1272
|
+
title?: string;
|
|
1273
|
+
time: JobTime;
|
|
1274
|
+
shellID: string;
|
|
1275
|
+
command: string;
|
|
1276
|
+
};
|
|
1277
|
+
export type JobSubagent = {
|
|
1278
|
+
kind: "subagent";
|
|
1279
|
+
id: string;
|
|
1280
|
+
sessionID: SessionID;
|
|
1281
|
+
status: JobStatus;
|
|
1282
|
+
title?: string;
|
|
1283
|
+
time: JobTime;
|
|
1284
|
+
childSessionID: SessionID;
|
|
1285
|
+
agent: string;
|
|
1286
|
+
description: string;
|
|
1287
|
+
};
|
|
1288
|
+
export type JobImage = {
|
|
1289
|
+
kind: "image";
|
|
1290
|
+
id: string;
|
|
1291
|
+
sessionID: SessionID;
|
|
1292
|
+
status: JobStatus;
|
|
1293
|
+
title?: string;
|
|
1294
|
+
time: JobTime;
|
|
1295
|
+
path: string;
|
|
1296
|
+
model: string;
|
|
1297
|
+
};
|
|
1256
1298
|
export type VcsInfo = {
|
|
1257
1299
|
provider?: string;
|
|
1258
1300
|
branch: VcsBranch;
|
|
@@ -3071,6 +3113,7 @@ export type ArtifactContent = {
|
|
|
3071
3113
|
[x: string]: string;
|
|
3072
3114
|
};
|
|
3073
3115
|
};
|
|
3116
|
+
export type JobInfo = JobShell | JobSubagent | JobImage;
|
|
3074
3117
|
export type SessionInboxMove = {
|
|
3075
3118
|
id: SessionMessageID;
|
|
3076
3119
|
sessionID: SessionID;
|
|
@@ -3257,7 +3300,7 @@ export type ConfigEntry = {
|
|
|
3257
3300
|
timezone?: string;
|
|
3258
3301
|
permissions?: PermissionRuleset;
|
|
3259
3302
|
policies?: Array<{
|
|
3260
|
-
action: "provider.use" | "tool.use" | "integration.connect" | "integration.use" | "mcp.use" | "skill.use" | "plugin.use";
|
|
3303
|
+
action: "provider.use" | "tool.use" | "integration.connect" | "integration.use" | "mcp.use" | "skill.use" | "plugin.use" | "websearch.use";
|
|
3261
3304
|
resource: string;
|
|
3262
3305
|
effect: "allow" | "deny";
|
|
3263
3306
|
}>;
|
|
@@ -3421,7 +3464,7 @@ export type ConfigEntry = {
|
|
|
3421
3464
|
worktree?: ConfigWorktree;
|
|
3422
3465
|
warming?: boolean | {
|
|
3423
3466
|
prompt?: string;
|
|
3424
|
-
interval?: string;
|
|
3467
|
+
interval?: "auto" | (string & {});
|
|
3425
3468
|
duration?: string;
|
|
3426
3469
|
};
|
|
3427
3470
|
providers?: {
|
|
@@ -3516,7 +3559,7 @@ export type ConfigEntry = {
|
|
|
3516
3559
|
jev?: boolean;
|
|
3517
3560
|
location_idle_timeout?: string | false;
|
|
3518
3561
|
policies?: Array<{
|
|
3519
|
-
action: "provider.use" | "tool.use" | "integration.connect" | "integration.use" | "mcp.use" | "skill.use" | "plugin.use";
|
|
3562
|
+
action: "provider.use" | "tool.use" | "integration.connect" | "integration.use" | "mcp.use" | "skill.use" | "plugin.use" | "websearch.use";
|
|
3520
3563
|
resource: string;
|
|
3521
3564
|
effect: "allow" | "deny";
|
|
3522
3565
|
}>;
|
|
@@ -5649,6 +5692,15 @@ export type ExperimentalArtifactsViewInput = {
|
|
|
5649
5692
|
readonly path: string;
|
|
5650
5693
|
};
|
|
5651
5694
|
export type ExperimentalArtifactsViewOutput = globalThis.Uint8Array;
|
|
5695
|
+
export type ExperimentalJobListInput = {
|
|
5696
|
+
readonly sessionID?: string | undefined;
|
|
5697
|
+
readonly kind?: ("shell" | "subagent" | "image") | undefined;
|
|
5698
|
+
readonly status?: ("running" | "completed" | "error" | "cancelled") | undefined;
|
|
5699
|
+
readonly descendants?: boolean | undefined;
|
|
5700
|
+
};
|
|
5701
|
+
export type ExperimentalJobListOutput = {
|
|
5702
|
+
data: Array<JobInfo>;
|
|
5703
|
+
}["data"];
|
|
5652
5704
|
export type ShellListInput = {
|
|
5653
5705
|
readonly location?: {
|
|
5654
5706
|
readonly directory?: string | undefined;
|
package/client/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var k=Object.defineProperty;var L=(n)=>n;function F(n,a){this[n]=L.bind(null,a)}var T=(n,a)=>{for(var i in a)k(n,i,{get:a[i],enumerable:!0,configurable:!0,set:F.bind(a,i)})};var h={};T(h,{OpenCode:()=>h,make:()=>_});class m extends Error{reason;name="ClientError";constructor(n,a){let i=a?.detail??(a?.cause instanceof Error?a.cause.message:void 0);super(i?`${n}: ${i}`:n,a);this.reason=n}}var
|
|
1
|
+
var k=Object.defineProperty;var L=(n)=>n;function F(n,a){this[n]=L.bind(null,a)}var T=(n,a)=>{for(var i in a)k(n,i,{get:a[i],enumerable:!0,configurable:!0,set:F.bind(a,i)})};var h={};T(h,{OpenCode:()=>h,make:()=>_});class m extends Error{reason;name="ClientError";constructor(n,a){let i=a?.detail??(a?.cause instanceof Error?a.cause.message:void 0);super(i?`${n}: ${i}`:n,a);this.reason=n}}var w=16777216;function U(n){let a=n.fetch??globalThis.fetch,i=(e,t)=>{let r=new URL(n.baseUrl);if(!r.pathname.endsWith("/"))r.pathname+="/";let I=new URL(e.path.slice(1),r);for(let[d,u]of Object.entries(e.query??{}))E(I.searchParams,d,u);let x=new Headers(n.headers);for(let[d,u]of Object.entries(e.headers??{}))if(u!==void 0&&u!==null)x.set(d,String(u));for(let[d,u]of new Headers(t?.headers))x.set(d,u);if(e.body!==void 0&&!x.has("content-type"))x.set("content-type",e.binaryBody?"application/octet-stream":"application/json");return{url:I,init:{method:e.method,signal:t?.signal,headers:x,body:e.body===void 0?void 0:e.binaryBody?e.body:JSON.stringify(e.body)}}},y=async(e,t)=>{try{let r=i(e,t);return await a(r.url,r.init)}catch(r){throw new m("Transport",{cause:r})}},c=async(e,t)=>{if(t.declaredStatuses.includes(e.status))throw G(await R(e));try{await e.body?.cancel()}catch{}throw new m("UnexpectedStatus",{cause:{status:e.status},detail:String(e.status)})},o=async(e,t)=>{let r=await y(e,t);if(r.status!==e.successStatus)return c(r,e);if(e.binary)return new Uint8Array(await r.arrayBuffer());if(e.empty){try{await r.body?.cancel()}catch{}return}return await R(r)},l=(e,t)=>({async*[Symbol.asyncIterator](){let r=await y(e,t);if(r.status!==e.successStatus)await c(r,e);if(!O(r,"text/event-stream")){try{await r.body?.cancel()}catch{}throw new m("UnsupportedContentType",{detail:r.headers.get("content-type")})}if(r.body===null)throw new m("MalformedResponse");let I=r.body.getReader(),x=new TextDecoder,d="";try{while(!0){let u;try{u=await I.read()}catch(p){throw new m("Transport",{cause:p})}if(!u.done)t?.onActivity?.();if(d+=x.decode(u.value,{stream:!u.done}),d.length>w)throw new m("SseEventTooLarge");let f=!u.done&&d.endsWith("\r");if(f)d=d.slice(0,-1);if(d=d.replaceAll(`\r
|
|
2
2
|
`,`
|
|
3
3
|
`).replaceAll("\r",`
|
|
4
4
|
`),f)d+="\r";if(u.done&&d!=="")d+=`
|
|
@@ -9,4 +9,4 @@ var k=Object.defineProperty;var L=(n)=>n;function F(n,a){this[n]=L.bind(null,a)}
|
|
|
9
9
|
`).flatMap((S)=>S.startsWith("data:")?[S.slice(5).trimStart()]:[]).join(`
|
|
10
10
|
`);if(g!=="")try{yield JSON.parse(g)}catch(S){throw new m("MalformedResponse",{cause:S})}b=d.indexOf(`
|
|
11
11
|
|
|
12
|
-
`)}if(u.done)return}}finally{try{await I.cancel()}catch{}I.releaseLock()}}}),s={server:{info:(e)=>o({method:"GET",path:"/api/info",successStatus:200,declaredStatuses:[400,401],empty:!1},e),pair:(e)=>o({method:"POST",path:"/api/pair",successStatus:200,declaredStatuses:[400,401],empty:!1},e),connect:(e,t)=>o({method:"GET",path:`/auth/connect/${encodeURIComponent(e.code)}`,successStatus:200,declaredStatuses:[400,401],empty:!1},t)},location:{get:(e,t)=>o({method:"GET",path:"/api/location",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),reload:(e)=>o({method:"POST",path:"/api/location/reload",successStatus:204,declaredStatuses:[400,401,503],empty:!0},e)},agent:{list:(e,t)=>o({method:"GET",path:"/api/agent",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t),get:(e,t)=>o({method:"GET",path:`/api/agent/${encodeURIComponent(e.agentID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},plugin:{list:(e,t)=>o({method:"GET",path:"/api/plugin",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),gui:(e,t)=>o({method:"GET",path:"/api/plugin/gui",query:{location:e.location,id:e.id},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),check:(e,t)=>o({method:"POST",path:"/api/plugin/check",query:{location:e?.location},body:{target:e?.target},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),update:(e,t)=>o({method:"POST",path:"/api/plugin/update",query:{location:e.location},body:{targets:e.targets},successStatus:204,declaredStatuses:[400,401,404,503],empty:!0},t)},session:{list:(e,t)=>o({method:"GET",path:"/api/session",query:{limit:e?.limit,order:e?.order,search:e?.search,parentID:e?.parentID,archived:e?.archived,directory:e?.directory,project:e?.project,subpath:e?.subpath,cursor:e?.cursor},successStatus:200,declaredStatuses:[400,401],empty:!1},t),create:(e,t)=>o({method:"POST",path:"/api/session",body:{id:e?.id,parentID:e?.parentID,title:e?.title,agent:e?.agent,model:e?.model,location:e?.location,metadata:e?.metadata,permissions:e?.permissions},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then((r)=>r.data),active:(e)=>o({method:"GET",path:"/api/session/active",successStatus:200,declaredStatuses:[400,401],empty:!1},e).then((t)=>t.data),get:(e,t)=>o({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then((r)=>r.data),remove:(e,t)=>o({method:"DELETE",path:`/api/session/${encodeURIComponent(e.sessionID)}`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),fork:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/fork`,body:{before:e.before},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then((r)=>r.data),switchAgent:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/agent`,body:{agent:e.agent},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),switchModel:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/model`,body:{model:e.model},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),update:(e,t)=>o({method:"PATCH",path:`/api/session/${encodeURIComponent(e.sessionID)}`,body:{title:e.title,metadata:e.metadata,permissions:e.permissions,archived:e.archived},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),move:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/move`,body:{directory:e.directory,delivery:e.delivery},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),prompt:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/prompt`,body:{id:e.id,text:e.text,files:e.files,agents:e.agents,skills:e.skills,metadata:e.metadata,delivery:e.delivery,resume:e.resume},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},t).then((r)=>r.data),command:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/command`,body:{name:e.name,text:e.text,files:e.files,agents:e.agents,skills:e.skills,delivery:e.delivery},successStatus:204,declaredStatuses:[400,401,404,500],empty:!0},t),synthetic:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/synthetic`,body:{id:e.id,text:e.text,description:e.description,metadata:e.metadata,delivery:e.delivery,resume:e.resume},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},t).then((r)=>r.data),shell:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/shell`,body:{id:e.id,command:e.command},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),compact:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/compact`,body:{id:e.id,delivery:e.delivery},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},t).then((r)=>r.data),revert:{stage:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/revert/stage`,body:{messageID:e.messageID,files:e.files},successStatus:200,declaredStatuses:[400,401,404,409,500],empty:!1},t).then((r)=>r.data),clear:(e,t)=>o({method:"DELETE",path:`/api/session/${encodeURIComponent(e.sessionID)}/revert`,successStatus:204,declaredStatuses:[400,401,404,409,500],empty:!0},t),commit:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/revert/commit`,successStatus:204,declaredStatuses:[400,401,404,409],empty:!0},t)},context:(e,t)=>o({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/context`,successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},t).then((r)=>r.data),diff:(e,t)=>o({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/diff`,query:{from:e.from,to:e.to,context:e.context},successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},t).then((r)=>r.data),inbox:{list:(e,t)=>o({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/inbox`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then((r)=>r.data),cancel:(e,t)=>o({method:"DELETE",path:`/api/session/${encodeURIComponent(e.sessionID)}/inbox/${encodeURIComponent(e.inboxID)}`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),update:(e,t)=>o({method:"PATCH",path:`/api/session/${encodeURIComponent(e.sessionID)}/inbox/${encodeURIComponent(e.inboxID)}`,body:{delivery:e.delivery},successStatus:204,declaredStatuses:[400,401,404,409],empty:!0},t)},generate:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/generate`,body:{prompt:e.prompt},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t).then((r)=>r.data),interrupt:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/interrupt`,query:{resume:e.resume},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),background:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/background`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),message:{get:(e,t)=>o({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/message/${encodeURIComponent(e.messageID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then((r)=>r.data)},form:{list:(e,t)=>o({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/form`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then((r)=>r.data),create:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/form`,body:{id:e.id,title:e.title,metadata:e.metadata,fields:e.fields},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},t).then((r)=>r.data),get:(e,t)=>o({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/form/${encodeURIComponent(e.formID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then((r)=>r.data),reply:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/form/${encodeURIComponent(e.formID)}/reply`,body:{answer:e.answer},successStatus:204,declaredStatuses:[400,401,404,409],empty:!0},t),cancel:(e,t)=>o({method:"DELETE",path:`/api/session/${encodeURIComponent(e.sessionID)}/form/${encodeURIComponent(e.formID)}`,query:{message:e.message},successStatus:204,declaredStatuses:[400,401,404,409],empty:!0},t)},environment:(e,t)=>o({method:"PUT",path:`/api/session/${encodeURIComponent(e.sessionID)}/environment`,body:{variables:e.variables},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),view:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/view`,body:{idle:e.idle},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)},experimental:{session:{stats:(e,t)=>o({method:"GET",path:"/api/experimental/session/stats",query:{from:e?.from,to:e?.to,project:e?.project,timezone:e?.timezone,tools:e?.tools},successStatus:200,declaredStatuses:[400,401],empty:!1},t).then((r)=>r.data),import:(e,t)=>o({method:"POST",path:"/api/experimental/session/import",body:{info:e.info,messages:e.messages,location:e.location},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},t).then((r)=>r.data),export:(e,t)=>o({method:"GET",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/export`,query:{sanitize:e.sanitize},successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},t).then((r)=>r.data),skill:(e,t)=>o({method:"POST",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/skill`,body:{id:e.id,resume:e.resume},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),wait:(e,t)=>o({method:"POST",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/wait`,successStatus:204,declaredStatuses:[400,401,404,503],empty:!0},t),instructions:{entry:{list:(e,t)=>o({method:"GET",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/instructions/entries`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then((r)=>r.data),put:(e,t)=>o({method:"PUT",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/instructions/entries/${encodeURIComponent(e.key)}`,body:{value:e.value},successStatus:204,declaredStatuses:[400,401,404,413],empty:!0},t),remove:(e,t)=>o({method:"DELETE",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/instructions/entries/${encodeURIComponent(e.key)}`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)}},log:(e,t)=>l({method:"GET",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/log`,query:{after:e.after,follow:e.follow},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},generate:{text:(e,t)=>o({method:"POST",path:"/api/experimental/generate/text",body:{prompt:e.prompt,model:e.model},successStatus:200,declaredStatuses:[400,401,404,422,502,503],empty:!1},t).then((r)=>r.data),image:(e,t)=>o({method:"POST",path:"/api/experimental/generate/image",body:{model:e.model,prompt:e.prompt,images:e.images,n:e.n,aspect:e.aspect,resolution:e.resolution},successStatus:200,declaredStatuses:[400,401,404,422,502,503],empty:!1},t).then((r)=>r.data),decisions:(e,t)=>o({method:"POST",path:"/api/experimental/generate/decisions",body:{model:e.model,input:e.input,questions:e.questions},successStatus:200,declaredStatuses:[400,401,404,422,502,503],empty:!1},t).then((r)=>r.data)},voice:{models:(e)=>o({method:"GET",path:"/api/experimental/voice/models",successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},e).then((t)=>t.data),session:(e,t)=>o({method:"POST",path:"/api/experimental/voice/session",body:{model:e.model,session:e.session,transport:e.transport},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t).then((r)=>r.data)},integration:{wellknown:{add:(e,t)=>o({method:"POST",path:"/api/experimental/integration/wellknown",query:{location:e.location},body:{url:e.url},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)}},mcp:{add:(e,t)=>o({method:"PUT",path:`/api/experimental/mcp/${encodeURIComponent(e.server)}`,query:{location:e.location},body:{config:e.config},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),remove:(e,t)=>o({method:"DELETE",path:`/api/experimental/mcp/${encodeURIComponent(e.server)}`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),connect:(e,t)=>o({method:"POST",path:`/api/experimental/mcp/${encodeURIComponent(e.server)}/connect`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),disconnect:(e,t)=>o({method:"POST",path:`/api/experimental/mcp/${encodeURIComponent(e.server)}/disconnect`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),client:{token:(e,t)=>o({method:"POST",path:"/api/experimental/client-mcp/token",query:{location:e.location,name:e.name},headers:{"x-opencode-ticket":e["x-opencode-ticket"]},successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},t)}},file:{write:(e,t)=>o({method:"POST",path:"/api/experimental/fs/write",query:{location:e.location,path:e.path},body:e.payload,successStatus:200,declaredStatuses:[400,401,404],empty:!1,binaryBody:!0},t),watch:(e,t)=>o({method:"POST",path:"/api/experimental/fs/watch",query:{location:e.location},body:{path:e.path},successStatus:204,declaredStatuses:[400,401,404,503],empty:!0},t),unwatch:(e,t)=>o({method:"DELETE",path:"/api/experimental/fs/watch",query:{location:e.location},body:{path:e.path},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)},persistentPty:{read:(e,t)=>o({method:"GET",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/terminal/read`,query:{lines:e.lines},successStatus:200,declaredStatuses:[400,401,503],empty:!1},t).then((r)=>r.data),list:(e,t)=>o({method:"GET",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/terminal`,successStatus:200,declaredStatuses:[400,401,503],empty:!1},t).then((r)=>r.data),create:(e,t)=>o({method:"POST",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/terminal`,body:{command:e.command,args:e.args,cwd:e.cwd,title:e.title,env:e.env,size:e.size},successStatus:200,declaredStatuses:[400,401,503],empty:!1},t).then((r)=>r.data),shutdown:(e)=>o({method:"POST",path:"/api/experimental/persistent-pty/shutdown",successStatus:204,declaredStatuses:[400,401,503],empty:!0},e),handoff:(e)=>o({method:"POST",path:"/api/experimental/persistent-pty/handoff",successStatus:200,declaredStatuses:[400,401,503],empty:!1},e),get:(e,t)=>o({method:"GET",path:`/api/experimental/persistent-pty/${encodeURIComponent(e.ptyID)}`,successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t).then((r)=>r.data),update:(e,t)=>o({method:"PUT",path:`/api/experimental/persistent-pty/${encodeURIComponent(e.ptyID)}`,body:{attachmentID:e.attachmentID,size:e.size,title:e.title},successStatus:200,declaredStatuses:[400,401,404,501,503],empty:!1},t).then((r)=>r.data),snapshot:(e,t)=>o({method:"GET",path:`/api/experimental/persistent-pty/${encodeURIComponent(e.ptyID)}/snapshot`,successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t).then((r)=>r.data),remove:(e,t)=>o({method:"DELETE",path:`/api/experimental/persistent-pty/${encodeURIComponent(e.ptyID)}`,successStatus:204,declaredStatuses:[400,401,404,503],empty:!0},t),connectToken:(e,t)=>o({method:"POST",path:`/api/experimental/persistent-pty/${encodeURIComponent(e.ptyID)}/connect-token`,headers:{"x-opencode-ticket":e["x-opencode-ticket"]},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1},t).then((r)=>r.data)},media:{get:(e,t)=>o({method:"GET",path:`/api/experimental/media/${encodeURIComponent(e.hash)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1,binary:!0},t)},schedule:{create:(e,t)=>o({method:"POST",path:"/api/experimental/schedule",body:{sessionID:e.sessionID,name:e.name,when:e.when,if:e.if,until:e.until,ends:e.ends,prompt:e.prompt},successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},t).then((r)=>r.data),list:(e,t)=>o({method:"GET",path:"/api/experimental/schedule",query:{sessionID:e.sessionID},successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},t).then((r)=>r.data),get:(e,t)=>o({method:"GET",path:`/api/experimental/schedule/${encodeURIComponent(e.scheduleID)}`,successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},t).then((r)=>r.data),pause:(e,t)=>o({method:"POST",path:`/api/experimental/schedule/${encodeURIComponent(e.scheduleID)}/pause`,successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},t).then((r)=>r.data),resume:(e,t)=>o({method:"POST",path:`/api/experimental/schedule/${encodeURIComponent(e.scheduleID)}/resume`,successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},t).then((r)=>r.data),delete:(e,t)=>o({method:"DELETE",path:`/api/experimental/schedule/${encodeURIComponent(e.scheduleID)}`,successStatus:204,declaredStatuses:[400,401,403,404],empty:!0},t)},artifacts:{providers:(e,t)=>o({method:"GET",path:"/api/experimental/artifacts/providers",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1},t),list:(e,t)=>o({method:"GET",path:"/api/experimental/artifacts",query:{location:e?.location,sessionID:e?.sessionID,provider:e?.provider},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1},t),create:(e,t)=>o({method:"POST",path:"/api/experimental/artifacts",query:{location:e.location},body:{title:e.title,files:e.files,entry:e.entry,provider:e.provider,sessionID:e.sessionID},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1},t),get:(e,t)=>o({method:"GET",path:`/api/experimental/artifacts/${encodeURIComponent(e.artifactID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1},t),update:(e,t)=>o({method:"PATCH",path:`/api/experimental/artifacts/${encodeURIComponent(e.artifactID)}`,query:{location:e.location},body:{title:e.title,files:e.files,entry:e.entry,sessionID:e.sessionID},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1},t),delete:(e,t)=>o({method:"DELETE",path:`/api/experimental/artifacts/${encodeURIComponent(e.artifactID)}`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,403,404,503],empty:!0},t),view:(e,t)=>o({method:"GET",path:`/api/experimental/artifacts/${encodeURIComponent(e.artifactID)}/view/${v(e.path)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1,binary:!0},t)},migration:{v1:{status:(e)=>o({method:"GET",path:"/api/experimental/migration/v1",successStatus:200,declaredStatuses:[400,401],empty:!1},e)}},usage:{limits:(e,t)=>o({method:"GET",path:"/api/experimental/usage/limits",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t)},config:{update:(e,t)=>o({method:"PATCH",path:"/api/experimental/config",body:{shell:e.shell},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)}},message:{list:(e,t)=>o({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/message`,query:{limit:e.limit,order:e.order,cursor:e.cursor,type:e.type},successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},t)},model:{list:(e,t)=>o({method:"GET",path:"/api/model",query:{location:e?.location,types:e?.types},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t),default:(e,t)=>o({method:"GET",path:"/api/model/default",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t)},provider:{list:(e,t)=>o({method:"GET",path:"/api/provider",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t),get:(e,t)=>o({method:"GET",path:`/api/provider/${encodeURIComponent(e.providerID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t)},integration:{list:(e,t)=>o({method:"GET",path:"/api/integration",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),get:(e,t)=>o({method:"GET",path:`/api/integration/${encodeURIComponent(e.integrationID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),connect:{key:(e,t)=>o({method:"POST",path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/key`,query:{location:e.location},body:{key:e.key,answer:e.answer,label:e.label},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),external:(e,t)=>o({method:"POST",path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/external`,query:{location:e.location},body:{methodID:e.methodID,answer:e.answer,label:e.label},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)},oauth:{connect:(e,t)=>o({method:"POST",path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/oauth`,query:{location:e.location},body:{methodID:e.methodID,answer:e.answer,label:e.label},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),status:(e,t)=>o({method:"GET",path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/oauth/${encodeURIComponent(e.attemptID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),complete:(e,t)=>o({method:"POST",path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/oauth/${encodeURIComponent(e.attemptID)}/complete`,query:{location:e.location},body:{code:e.code},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),cancel:(e,t)=>o({method:"DELETE",path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/oauth/${encodeURIComponent(e.attemptID)}`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)},command:{connect:(e,t)=>o({method:"POST",path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/command`,query:{location:e.location},body:{methodID:e.methodID,label:e.label},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),status:(e,t)=>o({method:"GET",path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/command/${encodeURIComponent(e.attemptID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),cancel:(e,t)=>o({method:"DELETE",path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/command/${encodeURIComponent(e.attemptID)}`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)}},mcp:{list:(e,t)=>o({method:"GET",path:"/api/mcp",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),resource:{catalog:(e,t)=>o({method:"GET",path:"/api/mcp/resource",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)}},credential:{list:(e)=>o({method:"GET",path:"/api/credential",successStatus:200,declaredStatuses:[400,401],empty:!1},e).then((t)=>t.data),create:(e,t)=>o({method:"POST",path:"/api/credential",body:{id:e.id,integrationID:e.integrationID,label:e.label,value:e.value,activate:e.activate},successStatus:200,declaredStatuses:[400,401,409],empty:!1},t).then((r)=>r.data),update:(e,t)=>o({method:"PATCH",path:`/api/credential/${encodeURIComponent(e.credentialID)}`,body:{label:e.label},successStatus:204,declaredStatuses:[400,401],empty:!0},t),activate:(e,t)=>o({method:"POST",path:`/api/credential/${encodeURIComponent(e.credentialID)}/activate`,successStatus:204,declaredStatuses:[400,401],empty:!0},t),remove:(e,t)=>o({method:"DELETE",path:`/api/credential/${encodeURIComponent(e.credentialID)}`,successStatus:204,declaredStatuses:[400,401],empty:!0},t)},project:{list:(e,t)=>o({method:"GET",path:"/api/project",query:{archived:e?.archived},successStatus:200,declaredStatuses:[400,401],empty:!1},t),update:(e,t)=>o({method:"PATCH",path:`/api/project/${encodeURIComponent(e.projectID)}`,body:{canonical:e.canonical,name:e.name,icon:e.icon,commands:e.commands},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},form:{list:(e,t)=>o({method:"GET",path:"/api/form",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},permission:{request:{list:(e,t)=>o({method:"GET",path:"/api/permission/request",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},saved:{list:(e,t)=>o({method:"GET",path:"/api/permission/saved",query:{projectID:e?.projectID},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then((r)=>r.data),update:(e,t)=>o({method:"PATCH",path:`/api/permission/saved/${encodeURIComponent(e.id)}`,body:{action:e.action,resource:e.resource},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},t).then((r)=>r.data),remove:(e,t)=>o({method:"DELETE",path:`/api/permission/saved/${encodeURIComponent(e.id)}`,successStatus:204,declaredStatuses:[400,401],empty:!0},t)},create:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/permission`,body:{id:e.id,action:e.action,resources:e.resources,save:e.save,metadata:e.metadata,source:e.source,agent:e.agent},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then((r)=>r.data),list:(e,t)=>o({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/permission`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then((r)=>r.data),get:(e,t)=>o({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/permission/${encodeURIComponent(e.requestID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then((r)=>r.data),reply:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/permission/${encodeURIComponent(e.requestID)}/reply`,body:{decision:e.decision,message:e.message},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)},file:{read:(e,t)=>o({method:"GET",path:`/api/fs/read/${v(e.path)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1,binary:!0},t),list:(e,t)=>o({method:"GET",path:"/api/fs/list",query:{location:e?.location,path:e?.path},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),find:(e,t)=>o({method:"GET",path:"/api/fs/find",query:{location:e.location,query:e.query,type:e.type,limit:e.limit},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},command:{list:(e,t)=>o({method:"GET",path:"/api/command",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},skill:{list:(e,t)=>o({method:"GET",path:"/api/skill",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},rpc:{call:(e,t)=>o({method:"POST",path:`/api/rpc/${encodeURIComponent(e.rpcID)}/${encodeURIComponent(e.method)}`,query:{location:e.location},body:{input:e.input},successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},t)},event:{subscribe:(e,t)=>l({method:"GET",path:"/api/event",query:{types:e?.types},successStatus:200,declaredStatuses:[400,401],empty:!1},t)},pty:{list:(e,t)=>o({method:"GET",path:"/api/pty",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),create:(e,t)=>o({method:"POST",path:"/api/pty",query:{location:e?.location},body:{command:e?.command,args:e?.args,cwd:e?.cwd,title:e?.title,env:e?.env},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),get:(e,t)=>o({method:"GET",path:`/api/pty/${encodeURIComponent(e.ptyID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),update:(e,t)=>o({method:"PUT",path:`/api/pty/${encodeURIComponent(e.ptyID)}`,query:{location:e.location},body:{title:e.title,size:e.size},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),remove:(e,t)=>o({method:"DELETE",path:`/api/pty/${encodeURIComponent(e.ptyID)}`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),connect:{token:(e,t)=>o({method:"POST",path:`/api/pty/${encodeURIComponent(e.ptyID)}/connect-token`,query:{location:e.location},headers:{"x-opencode-ticket":e["x-opencode-ticket"]},successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},t)}},shell:{list:(e,t)=>o({method:"GET",path:"/api/shell",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),create:(e,t)=>o({method:"POST",path:"/api/shell",query:{location:e.location},body:{command:e.command,cwd:e.cwd,timeout:e.timeout,metadata:e.metadata},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),get:(e,t)=>o({method:"GET",path:`/api/shell/${encodeURIComponent(e.id)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),output:(e,t)=>o({method:"GET",path:`/api/shell/${encodeURIComponent(e.id)}/output`,query:{location:e.location,cursor:e.cursor,limit:e.limit},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),remove:(e,t)=>o({method:"DELETE",path:`/api/shell/${encodeURIComponent(e.id)}`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)},reference:{list:(e,t)=>o({method:"GET",path:"/api/reference",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},worktree:{list:(e,t)=>o({method:"GET",path:"/api/worktree",query:{projectID:e.projectID},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),create:(e,t)=>o({method:"POST",path:"/api/worktree",body:{projectID:e.projectID,from:e.from,branch:e.branch,directory:e.directory,name:e.name},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),remove:(e,t)=>o({method:"DELETE",path:"/api/worktree",body:{projectID:e.projectID,directory:e.directory,force:e.force},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),refresh:(e,t)=>o({method:"POST",path:"/api/worktree/refresh",body:{projectID:e.projectID},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)},vcs:{init:(e,t)=>o({method:"POST",path:"/api/vcs/init",query:{location:e?.location,provider:e?.provider},successStatus:204,declaredStatuses:[400,401,404,409,501,503],empty:!0},t),get:(e,t)=>o({method:"GET",path:"/api/vcs",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),base:(e,t)=>o({method:"GET",path:"/api/vcs/base",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t),status:(e,t)=>o({method:"GET",path:"/api/vcs/status",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),branch:{list:(e,t)=>o({method:"GET",path:"/api/vcs/branch",query:{location:e?.location,search:e?.search,limit:e?.limit},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},diff:(e,t)=>o({method:"GET",path:"/api/vcs/diff",query:{location:e.location,mode:e.mode,base:e.base,context:e.context,untracked:e.untracked},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t)},debug:{heapDump:(e,t)=>o({method:"POST",path:"/api/debug/heap-dump",query:{directory:e?.directory},successStatus:200,declaredStatuses:[400,401,500],empty:!1},t),location:{list:(e)=>o({method:"GET",path:"/api/debug/location",successStatus:200,declaredStatuses:[400,401],empty:!1},e),evict:(e,t)=>o({method:"DELETE",path:"/api/debug/location",query:{location:e?.location},successStatus:204,declaredStatuses:[400,401],empty:!0},t)}},websearch:{providers:(e,t)=>o({method:"GET",path:"/api/websearch/provider",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t),query:(e,t)=>o({method:"POST",path:"/api/websearch",query:{location:e.location},body:{query:e.query,providerID:e.providerID},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t)},config:{get:(e,t)=>o({method:"GET",path:"/api/config",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),shells:(e)=>o({method:"GET",path:"/api/config/shell",successStatus:200,declaredStatuses:[400,401,404],empty:!1},e)}};return{...s,session:{...s.session,stats:s.experimental.session.stats,import:s.experimental.session.import,export:s.experimental.session.export,skill:s.experimental.session.skill,wait:s.experimental.session.wait,instructions:{entry:{list:s.experimental.session.instructions.entry.list,put:s.experimental.session.instructions.entry.put,remove:s.experimental.session.instructions.entry.remove}},log:s.experimental.session.log},generate:{text:s.experimental.generate.text,image:s.experimental.generate.image,decisions:s.experimental.generate.decisions},voice:{models:s.experimental.voice.models,session:s.experimental.voice.session},integration:{...s.integration,wellknown:{add:s.experimental.integration.wellknown.add}},mcp:{...s.mcp,add:s.experimental.mcp.add,remove:s.experimental.mcp.remove,connect:s.experimental.mcp.connect,disconnect:s.experimental.mcp.disconnect,client:{token:s.experimental.mcp.client.token}},file:{...s.file,write:s.experimental.file.write,watch:s.experimental.file.watch,unwatch:s.experimental.file.unwatch},migration:{v1:{status:s.experimental.migration.v1.status}},usage:{limits:s.experimental.usage.limits},config:{...s.config,update:s.experimental.config.update}}}function v(n){return n.split("/").map(encodeURIComponent).join("/")}function E(n,a,i){if(i===void 0)return;if(i===null){n.append(a,"null");return}if(Array.isArray(i)){for(let y of i)E(n,a,y);return}if(typeof i==="object"){for(let[y,c]of Object.entries(i))E(n,`${a}[${y}]`,c);return}n.append(a,String(i))}async function R(n){if(!O(n,"application/json")&&!n.headers.get("content-type")?.includes("+json")){try{await n.body?.cancel()}catch{}throw new m("UnsupportedContentType",{detail:n.headers.get("content-type")})}let a;try{a=await n.text()}catch(i){throw new m("Transport",{cause:i})}if(a==="")throw new m("MalformedResponse");try{return JSON.parse(a)}catch(i){throw new m("MalformedResponse",{cause:i})}}function G(n){let a=Object.assign(Error(n.message??n.data?.message),n);if(n._tag)a.name=n._tag;return a}function O(n,a){return n.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase()===a}var K=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="InvalidRequestError",Q=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="UnauthorizedError",Y=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="LocationNotFoundError",X=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ServiceUnavailableError",Z=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="AgentNotFoundError",ee=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="PluginNotFoundError",te=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="InvalidCursorError",ne=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="SessionNotFoundError",oe=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="MessageNotFoundError",re=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ConflictError",se=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="CommandNotFoundError",ae=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="CommandExecutionError",ie=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="SessionBusyError",de=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="UnknownError",pe=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="FormNotFoundError",le=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="FormInvalidAnswerError",ue=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="FormAlreadySettledError",ce=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="SkillNotFoundError",ye=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="InstructionEntryValueTooLargeError",me=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ProviderNotFoundError",ge=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ModelNotFoundError",Ie=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="UnsupportedModelError",xe=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ProviderRequestError",Se=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="IntegrationNotFoundError",fe=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="IntegrationAttemptNotFoundError",be=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="IntegrationMethodNotFoundError",he=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="McpServerNotFoundError",Ee=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ForbiddenError",De=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ProjectNotFoundError",ve=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="PermissionSavedNotFoundError",Re=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="PermissionNotFoundError",Oe=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="FileNotFoundError",C=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="RpcError",A=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="RpcInternalError",Pe=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="PtyNotFoundError",Ce=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="PtyFeatureUnsupportedError",Ae=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ScheduleNotFoundError",Me=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ArtifactNotFoundError",qe=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ShellNotFoundError",ke=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="WorktreeError",Le=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="VcsInitNotSupportedError";function N(n){let a,i=4096;function y(o){if(o.connected=void 0,o.controller.abort(),a===o)a=void 0}async function c(o){let l,s={};try{if(o.controller.signal.aborted)return;l=n(o.controller.signal,()=>{o.subscribers.forEach((e)=>e.activity?.())})[Symbol.asyncIterator]();while(!o.controller.signal.aborted){let e=await l.next();if(e.done||o.controller.signal.aborted)break;if(e.value.type==="server.connected")o.connected=e.value;o.subscribers.forEach((t)=>t.push(e.value))}}catch(e){s={error:e}}finally{y(o);try{await l?.return?.()}catch(e){if(!("error"in s))s={error:e}}o.subscribers.forEach((e)=>e.finish(s))}}return{subscribe(o){return{[Symbol.asyncIterator](){let l=[],s=[],e=!1,t,r,I=o?.types?.length?new Set(o.types):void 0,x=(p)=>!I||p.type==="server.connected"||I.has(p.type);function d(p,g=!0){if(t=p,g)s.length=0;if(o?.signal?.removeEventListener("abort",u),r?.subscribers.delete(f)&&!r.subscribers.size)y(r);l.splice(0).forEach((S)=>{if("error"in p)S.reject(p.error);else S.resolve({done:!0,value:void 0})})}function u(){d({})}let f={activity:o?.onActivity,finish(p){d(p,!1)},push(p){if(t)return;if(!x(p))return;let g=l.shift();if(g){g.resolve({done:!1,value:p});return}if(s.length===4096){d({error:Error("Event subscriber exceeded its 4096-event capacity")});return}s.push(p)}};function b(){if(t)return;let p=!a;if(r=a??{controller:new AbortController,subscribers:new Set},a=r,r.subscribers.add(f),r.connected)f.push(r.connected);if(p)c(r)}return{next(){let p=s.shift();if(p)return Promise.resolve({done:!1,value:p});if(t){if("error"in t)return Promise.reject(t.error);return Promise.resolve({done:!0,value:void 0})}if(o?.signal?.aborted)return u(),Promise.resolve({done:!0,value:void 0});let g=Promise.withResolvers();if(l.push(g),!e)e=!0,o?.signal?.addEventListener("abort",u,{once:!0}),b();return g.promise},return(){return d({}),Promise.resolve({done:!0,value:void 0})}}}}}}}function q(n,a){return(i)=>{let y=(c,o)=>{if(!Object.hasOwn(i.events,c))throw Error(`Unknown RPC event: ${i.id}.${c}`);let l=V(i,c);return{[Symbol.asyncIterator](){let s=new AbortController,e=o?.signal?AbortSignal.any([s.signal,o.signal]):s.signal,t=async function*(){try{for await(let r of a.subscribe({signal:e})){if(e.aborted)return;if(r.type!==l)continue;yield r}}catch(r){if(!e.aborted)throw r}finally{s.abort()}}();return{next:()=>t.next(),return:()=>(s.abort(),t.return())}}}};return Object.assign(Object.fromEntries(Object.keys(i.methods).map((c)=>[c,async(o,l)=>{try{return(await n.rpc.call({rpcID:i.id,method:c,input:o,location:l?.location},{signal:l?.signal,headers:l?.headers})).output}catch(s){if(!C(s)&&!A(s))throw s;throw s.data===void 0?{type:s.type,message:s.message}:{type:s.type,message:s.message,data:s.data}}}])),{events:{subscribe:y,on:(c,o,l)=>{let s=new AbortController,e=l?.signal?AbortSignal.any([s.signal,l.signal]):s.signal,t=y(c,{signal:e});return(async()=>{for await(let r of t)await o(r)})().catch((r)=>console.error(r)),()=>s.abort()}}})}}function V(n,a){return`rpc.${n.id}.${a}`}function _(n){let a=w(n),i=N((y,c)=>a.event.subscribe(void 0,{signal:y,onActivity:c}));return{...a,rpc:Object.assign(q(a,i),a.rpc),event:i}}var j=/^media:([0-9a-f]{64})$/;function W(n){if(!n)return;return j.exec(n)?.[1]}function J(n){return{...n,message:{...n.message,list:(a,i)=>n.message.list(a,D(i))},session:{...n.session,message:{...n.session.message,get:(a,i)=>n.session.message.get(a,D(i))},inbox:{...n.session.inbox,list:(a,i)=>n.session.inbox.list(a,D(i))}}}}function D(n){if(n?.mediaRefs===!1)return n;let a=new Headers(n?.headers);return a.set("X-OpenCode-Capabilities","experimental-media-uri"),{...n,headers:a}}export{m as ClientError,h as OpenCode,Z as isAgentNotFoundError,Me as isArtifactNotFoundError,ae as isCommandExecutionError,se as isCommandNotFoundError,re as isConflictError,Oe as isFileNotFoundError,Ee as isForbiddenError,ue as isFormAlreadySettledError,le as isFormInvalidAnswerError,pe as isFormNotFoundError,ye as isInstructionEntryValueTooLargeError,fe as isIntegrationAttemptNotFoundError,be as isIntegrationMethodNotFoundError,Se as isIntegrationNotFoundError,te as isInvalidCursorError,K as isInvalidRequestError,Y as isLocationNotFoundError,he as isMcpServerNotFoundError,oe as isMessageNotFoundError,ge as isModelNotFoundError,Re as isPermissionNotFoundError,ve as isPermissionSavedNotFoundError,ee as isPluginNotFoundError,De as isProjectNotFoundError,me as isProviderNotFoundError,xe as isProviderRequestError,Ce as isPtyFeatureUnsupportedError,Pe as isPtyNotFoundError,C as isRpcError,A as isRpcInternalError,Ae as isScheduleNotFoundError,X as isServiceUnavailableError,ie as isSessionBusyError,ne as isSessionNotFoundError,qe as isShellNotFoundError,ce as isSkillNotFoundError,Q as isUnauthorizedError,de as isUnknownError,Ie as isUnsupportedModelError,Le as isVcsInitNotSupportedError,ke as isWorktreeError,W as mediaHashFromUri,J as withMediaRefs};
|
|
12
|
+
`)}if(u.done)return}}finally{try{await I.cancel()}catch{}I.releaseLock()}}}),s={server:{info:(e)=>o({method:"GET",path:"/api/info",successStatus:200,declaredStatuses:[400,401],empty:!1},e),pair:(e)=>o({method:"POST",path:"/api/pair",successStatus:200,declaredStatuses:[400,401],empty:!1},e),connect:(e,t)=>o({method:"GET",path:`/auth/connect/${encodeURIComponent(e.code)}`,successStatus:200,declaredStatuses:[400,401],empty:!1},t)},location:{get:(e,t)=>o({method:"GET",path:"/api/location",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),reload:(e)=>o({method:"POST",path:"/api/location/reload",successStatus:204,declaredStatuses:[400,401,503],empty:!0},e)},agent:{list:(e,t)=>o({method:"GET",path:"/api/agent",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t),get:(e,t)=>o({method:"GET",path:`/api/agent/${encodeURIComponent(e.agentID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},plugin:{list:(e,t)=>o({method:"GET",path:"/api/plugin",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),gui:(e,t)=>o({method:"GET",path:"/api/plugin/gui",query:{location:e.location,id:e.id},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),check:(e,t)=>o({method:"POST",path:"/api/plugin/check",query:{location:e?.location},body:{target:e?.target},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),update:(e,t)=>o({method:"POST",path:"/api/plugin/update",query:{location:e.location},body:{targets:e.targets},successStatus:204,declaredStatuses:[400,401,404,503],empty:!0},t)},session:{list:(e,t)=>o({method:"GET",path:"/api/session",query:{limit:e?.limit,order:e?.order,search:e?.search,parentID:e?.parentID,archived:e?.archived,directory:e?.directory,project:e?.project,subpath:e?.subpath,cursor:e?.cursor},successStatus:200,declaredStatuses:[400,401],empty:!1},t),create:(e,t)=>o({method:"POST",path:"/api/session",body:{id:e?.id,parentID:e?.parentID,title:e?.title,agent:e?.agent,model:e?.model,location:e?.location,metadata:e?.metadata,permissions:e?.permissions},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then((r)=>r.data),active:(e)=>o({method:"GET",path:"/api/session/active",successStatus:200,declaredStatuses:[400,401],empty:!1},e).then((t)=>t.data),get:(e,t)=>o({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then((r)=>r.data),remove:(e,t)=>o({method:"DELETE",path:`/api/session/${encodeURIComponent(e.sessionID)}`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),fork:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/fork`,body:{before:e.before},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then((r)=>r.data),switchAgent:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/agent`,body:{agent:e.agent},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),switchModel:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/model`,body:{model:e.model},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),update:(e,t)=>o({method:"PATCH",path:`/api/session/${encodeURIComponent(e.sessionID)}`,body:{title:e.title,metadata:e.metadata,permissions:e.permissions,archived:e.archived},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),move:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/move`,body:{directory:e.directory,delivery:e.delivery},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),prompt:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/prompt`,body:{id:e.id,text:e.text,files:e.files,agents:e.agents,skills:e.skills,metadata:e.metadata,delivery:e.delivery,resume:e.resume},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},t).then((r)=>r.data),command:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/command`,body:{name:e.name,text:e.text,files:e.files,agents:e.agents,skills:e.skills,delivery:e.delivery},successStatus:204,declaredStatuses:[400,401,404,500],empty:!0},t),synthetic:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/synthetic`,body:{id:e.id,text:e.text,description:e.description,metadata:e.metadata,delivery:e.delivery,resume:e.resume},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},t).then((r)=>r.data),shell:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/shell`,body:{id:e.id,command:e.command},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),compact:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/compact`,body:{id:e.id,delivery:e.delivery},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},t).then((r)=>r.data),revert:{stage:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/revert/stage`,body:{messageID:e.messageID,files:e.files},successStatus:200,declaredStatuses:[400,401,404,409,500],empty:!1},t).then((r)=>r.data),clear:(e,t)=>o({method:"DELETE",path:`/api/session/${encodeURIComponent(e.sessionID)}/revert`,successStatus:204,declaredStatuses:[400,401,404,409,500],empty:!0},t),commit:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/revert/commit`,successStatus:204,declaredStatuses:[400,401,404,409],empty:!0},t)},context:(e,t)=>o({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/context`,successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},t).then((r)=>r.data),diff:(e,t)=>o({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/diff`,query:{from:e.from,to:e.to,context:e.context},successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},t).then((r)=>r.data),inbox:{list:(e,t)=>o({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/inbox`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then((r)=>r.data),cancel:(e,t)=>o({method:"DELETE",path:`/api/session/${encodeURIComponent(e.sessionID)}/inbox/${encodeURIComponent(e.inboxID)}`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),update:(e,t)=>o({method:"PATCH",path:`/api/session/${encodeURIComponent(e.sessionID)}/inbox/${encodeURIComponent(e.inboxID)}`,body:{delivery:e.delivery},successStatus:204,declaredStatuses:[400,401,404,409],empty:!0},t)},generate:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/generate`,body:{prompt:e.prompt},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t).then((r)=>r.data),interrupt:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/interrupt`,query:{resume:e.resume},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),background:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/background`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),message:{get:(e,t)=>o({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/message/${encodeURIComponent(e.messageID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then((r)=>r.data)},form:{list:(e,t)=>o({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/form`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then((r)=>r.data),create:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/form`,body:{id:e.id,title:e.title,metadata:e.metadata,fields:e.fields},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},t).then((r)=>r.data),get:(e,t)=>o({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/form/${encodeURIComponent(e.formID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then((r)=>r.data),reply:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/form/${encodeURIComponent(e.formID)}/reply`,body:{answer:e.answer},successStatus:204,declaredStatuses:[400,401,404,409],empty:!0},t),cancel:(e,t)=>o({method:"DELETE",path:`/api/session/${encodeURIComponent(e.sessionID)}/form/${encodeURIComponent(e.formID)}`,query:{message:e.message},successStatus:204,declaredStatuses:[400,401,404,409],empty:!0},t)},environment:(e,t)=>o({method:"PUT",path:`/api/session/${encodeURIComponent(e.sessionID)}/environment`,body:{variables:e.variables},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),view:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/view`,body:{idle:e.idle},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)},experimental:{session:{stats:(e,t)=>o({method:"GET",path:"/api/experimental/session/stats",query:{from:e?.from,to:e?.to,project:e?.project,timezone:e?.timezone,tools:e?.tools},successStatus:200,declaredStatuses:[400,401],empty:!1},t).then((r)=>r.data),import:(e,t)=>o({method:"POST",path:"/api/experimental/session/import",body:{info:e.info,messages:e.messages,location:e.location},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},t).then((r)=>r.data),export:(e,t)=>o({method:"GET",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/export`,query:{sanitize:e.sanitize},successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},t).then((r)=>r.data),skill:(e,t)=>o({method:"POST",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/skill`,body:{id:e.id,resume:e.resume},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),wait:(e,t)=>o({method:"POST",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/wait`,successStatus:204,declaredStatuses:[400,401,404,503],empty:!0},t),instructions:{entry:{list:(e,t)=>o({method:"GET",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/instructions/entries`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then((r)=>r.data),put:(e,t)=>o({method:"PUT",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/instructions/entries/${encodeURIComponent(e.key)}`,body:{value:e.value},successStatus:204,declaredStatuses:[400,401,404,413],empty:!0},t),remove:(e,t)=>o({method:"DELETE",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/instructions/entries/${encodeURIComponent(e.key)}`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)}},log:(e,t)=>l({method:"GET",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/log`,query:{after:e.after,follow:e.follow},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},generate:{text:(e,t)=>o({method:"POST",path:"/api/experimental/generate/text",body:{prompt:e.prompt,model:e.model},successStatus:200,declaredStatuses:[400,401,404,422,502,503],empty:!1},t).then((r)=>r.data),image:(e,t)=>o({method:"POST",path:"/api/experimental/generate/image",body:{model:e.model,prompt:e.prompt,images:e.images,n:e.n,aspect:e.aspect,resolution:e.resolution},successStatus:200,declaredStatuses:[400,401,404,422,502,503],empty:!1},t).then((r)=>r.data),decisions:(e,t)=>o({method:"POST",path:"/api/experimental/generate/decisions",body:{model:e.model,input:e.input,questions:e.questions},successStatus:200,declaredStatuses:[400,401,404,422,502,503],empty:!1},t).then((r)=>r.data)},voice:{models:(e)=>o({method:"GET",path:"/api/experimental/voice/models",successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},e).then((t)=>t.data),session:(e,t)=>o({method:"POST",path:"/api/experimental/voice/session",body:{model:e.model,session:e.session,transport:e.transport},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t).then((r)=>r.data)},integration:{wellknown:{add:(e,t)=>o({method:"POST",path:"/api/experimental/integration/wellknown",query:{location:e.location},body:{url:e.url},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)}},mcp:{add:(e,t)=>o({method:"PUT",path:`/api/experimental/mcp/${encodeURIComponent(e.server)}`,query:{location:e.location},body:{config:e.config},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),remove:(e,t)=>o({method:"DELETE",path:`/api/experimental/mcp/${encodeURIComponent(e.server)}`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),connect:(e,t)=>o({method:"POST",path:`/api/experimental/mcp/${encodeURIComponent(e.server)}/connect`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),disconnect:(e,t)=>o({method:"POST",path:`/api/experimental/mcp/${encodeURIComponent(e.server)}/disconnect`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),client:{token:(e,t)=>o({method:"POST",path:"/api/experimental/client-mcp/token",query:{location:e.location,name:e.name},headers:{"x-opencode-ticket":e["x-opencode-ticket"]},successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},t)}},file:{write:(e,t)=>o({method:"POST",path:"/api/experimental/fs/write",query:{location:e.location,path:e.path},body:e.payload,successStatus:200,declaredStatuses:[400,401,404],empty:!1,binaryBody:!0},t),watch:(e,t)=>o({method:"POST",path:"/api/experimental/fs/watch",query:{location:e.location},body:{path:e.path},successStatus:204,declaredStatuses:[400,401,404,503],empty:!0},t),unwatch:(e,t)=>o({method:"DELETE",path:"/api/experimental/fs/watch",query:{location:e.location},body:{path:e.path},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)},persistentPty:{read:(e,t)=>o({method:"GET",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/terminal/read`,query:{lines:e.lines},successStatus:200,declaredStatuses:[400,401,503],empty:!1},t).then((r)=>r.data),list:(e,t)=>o({method:"GET",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/terminal`,successStatus:200,declaredStatuses:[400,401,503],empty:!1},t).then((r)=>r.data),create:(e,t)=>o({method:"POST",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/terminal`,body:{command:e.command,args:e.args,cwd:e.cwd,title:e.title,env:e.env,size:e.size},successStatus:200,declaredStatuses:[400,401,503],empty:!1},t).then((r)=>r.data),shutdown:(e)=>o({method:"POST",path:"/api/experimental/persistent-pty/shutdown",successStatus:204,declaredStatuses:[400,401,503],empty:!0},e),handoff:(e)=>o({method:"POST",path:"/api/experimental/persistent-pty/handoff",successStatus:200,declaredStatuses:[400,401,503],empty:!1},e),get:(e,t)=>o({method:"GET",path:`/api/experimental/persistent-pty/${encodeURIComponent(e.ptyID)}`,successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t).then((r)=>r.data),update:(e,t)=>o({method:"PUT",path:`/api/experimental/persistent-pty/${encodeURIComponent(e.ptyID)}`,body:{attachmentID:e.attachmentID,size:e.size,title:e.title},successStatus:200,declaredStatuses:[400,401,404,501,503],empty:!1},t).then((r)=>r.data),snapshot:(e,t)=>o({method:"GET",path:`/api/experimental/persistent-pty/${encodeURIComponent(e.ptyID)}/snapshot`,successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t).then((r)=>r.data),remove:(e,t)=>o({method:"DELETE",path:`/api/experimental/persistent-pty/${encodeURIComponent(e.ptyID)}`,successStatus:204,declaredStatuses:[400,401,404,503],empty:!0},t),connectToken:(e,t)=>o({method:"POST",path:`/api/experimental/persistent-pty/${encodeURIComponent(e.ptyID)}/connect-token`,headers:{"x-opencode-ticket":e["x-opencode-ticket"]},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1},t).then((r)=>r.data)},media:{get:(e,t)=>o({method:"GET",path:`/api/experimental/media/${encodeURIComponent(e.hash)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1,binary:!0},t)},schedule:{create:(e,t)=>o({method:"POST",path:"/api/experimental/schedule",body:{sessionID:e.sessionID,name:e.name,when:e.when,if:e.if,until:e.until,ends:e.ends,prompt:e.prompt},successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},t).then((r)=>r.data),list:(e,t)=>o({method:"GET",path:"/api/experimental/schedule",query:{sessionID:e.sessionID},successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},t).then((r)=>r.data),get:(e,t)=>o({method:"GET",path:`/api/experimental/schedule/${encodeURIComponent(e.scheduleID)}`,successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},t).then((r)=>r.data),pause:(e,t)=>o({method:"POST",path:`/api/experimental/schedule/${encodeURIComponent(e.scheduleID)}/pause`,successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},t).then((r)=>r.data),resume:(e,t)=>o({method:"POST",path:`/api/experimental/schedule/${encodeURIComponent(e.scheduleID)}/resume`,successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},t).then((r)=>r.data),delete:(e,t)=>o({method:"DELETE",path:`/api/experimental/schedule/${encodeURIComponent(e.scheduleID)}`,successStatus:204,declaredStatuses:[400,401,403,404],empty:!0},t)},artifacts:{providers:(e,t)=>o({method:"GET",path:"/api/experimental/artifacts/providers",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1},t),list:(e,t)=>o({method:"GET",path:"/api/experimental/artifacts",query:{location:e?.location,sessionID:e?.sessionID,provider:e?.provider},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1},t),create:(e,t)=>o({method:"POST",path:"/api/experimental/artifacts",query:{location:e.location},body:{title:e.title,files:e.files,entry:e.entry,provider:e.provider,sessionID:e.sessionID},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1},t),get:(e,t)=>o({method:"GET",path:`/api/experimental/artifacts/${encodeURIComponent(e.artifactID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1},t),update:(e,t)=>o({method:"PATCH",path:`/api/experimental/artifacts/${encodeURIComponent(e.artifactID)}`,query:{location:e.location},body:{title:e.title,files:e.files,entry:e.entry,sessionID:e.sessionID},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1},t),delete:(e,t)=>o({method:"DELETE",path:`/api/experimental/artifacts/${encodeURIComponent(e.artifactID)}`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,403,404,503],empty:!0},t),view:(e,t)=>o({method:"GET",path:`/api/experimental/artifacts/${encodeURIComponent(e.artifactID)}/view/${v(e.path)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1,binary:!0},t)},job:{list:(e,t)=>o({method:"GET",path:"/api/experimental/job",query:{sessionID:e?.sessionID,kind:e?.kind,status:e?.status,descendants:e?.descendants},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then((r)=>r.data)},migration:{v1:{status:(e)=>o({method:"GET",path:"/api/experimental/migration/v1",successStatus:200,declaredStatuses:[400,401],empty:!1},e)}},usage:{limits:(e,t)=>o({method:"GET",path:"/api/experimental/usage/limits",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t)},config:{update:(e,t)=>o({method:"PATCH",path:"/api/experimental/config",body:{shell:e.shell},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)}},message:{list:(e,t)=>o({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/message`,query:{limit:e.limit,order:e.order,cursor:e.cursor,type:e.type},successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},t)},model:{list:(e,t)=>o({method:"GET",path:"/api/model",query:{location:e?.location,types:e?.types},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t),default:(e,t)=>o({method:"GET",path:"/api/model/default",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t)},provider:{list:(e,t)=>o({method:"GET",path:"/api/provider",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t),get:(e,t)=>o({method:"GET",path:`/api/provider/${encodeURIComponent(e.providerID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t)},integration:{list:(e,t)=>o({method:"GET",path:"/api/integration",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),get:(e,t)=>o({method:"GET",path:`/api/integration/${encodeURIComponent(e.integrationID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),connect:{key:(e,t)=>o({method:"POST",path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/key`,query:{location:e.location},body:{key:e.key,answer:e.answer,label:e.label},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),external:(e,t)=>o({method:"POST",path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/external`,query:{location:e.location},body:{methodID:e.methodID,answer:e.answer,label:e.label},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)},oauth:{connect:(e,t)=>o({method:"POST",path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/oauth`,query:{location:e.location},body:{methodID:e.methodID,answer:e.answer,label:e.label},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),status:(e,t)=>o({method:"GET",path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/oauth/${encodeURIComponent(e.attemptID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),complete:(e,t)=>o({method:"POST",path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/oauth/${encodeURIComponent(e.attemptID)}/complete`,query:{location:e.location},body:{code:e.code},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),cancel:(e,t)=>o({method:"DELETE",path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/oauth/${encodeURIComponent(e.attemptID)}`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)},command:{connect:(e,t)=>o({method:"POST",path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/command`,query:{location:e.location},body:{methodID:e.methodID,label:e.label},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),status:(e,t)=>o({method:"GET",path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/command/${encodeURIComponent(e.attemptID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),cancel:(e,t)=>o({method:"DELETE",path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/command/${encodeURIComponent(e.attemptID)}`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)}},mcp:{list:(e,t)=>o({method:"GET",path:"/api/mcp",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),resource:{catalog:(e,t)=>o({method:"GET",path:"/api/mcp/resource",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)}},credential:{list:(e)=>o({method:"GET",path:"/api/credential",successStatus:200,declaredStatuses:[400,401],empty:!1},e).then((t)=>t.data),create:(e,t)=>o({method:"POST",path:"/api/credential",body:{id:e.id,integrationID:e.integrationID,label:e.label,value:e.value,activate:e.activate},successStatus:200,declaredStatuses:[400,401,409],empty:!1},t).then((r)=>r.data),update:(e,t)=>o({method:"PATCH",path:`/api/credential/${encodeURIComponent(e.credentialID)}`,body:{label:e.label},successStatus:204,declaredStatuses:[400,401],empty:!0},t),activate:(e,t)=>o({method:"POST",path:`/api/credential/${encodeURIComponent(e.credentialID)}/activate`,successStatus:204,declaredStatuses:[400,401],empty:!0},t),remove:(e,t)=>o({method:"DELETE",path:`/api/credential/${encodeURIComponent(e.credentialID)}`,successStatus:204,declaredStatuses:[400,401],empty:!0},t)},project:{list:(e,t)=>o({method:"GET",path:"/api/project",query:{archived:e?.archived},successStatus:200,declaredStatuses:[400,401],empty:!1},t),update:(e,t)=>o({method:"PATCH",path:`/api/project/${encodeURIComponent(e.projectID)}`,body:{canonical:e.canonical,name:e.name,icon:e.icon,commands:e.commands},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},form:{list:(e,t)=>o({method:"GET",path:"/api/form",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},permission:{request:{list:(e,t)=>o({method:"GET",path:"/api/permission/request",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},saved:{list:(e,t)=>o({method:"GET",path:"/api/permission/saved",query:{projectID:e?.projectID},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then((r)=>r.data),update:(e,t)=>o({method:"PATCH",path:`/api/permission/saved/${encodeURIComponent(e.id)}`,body:{action:e.action,resource:e.resource},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},t).then((r)=>r.data),remove:(e,t)=>o({method:"DELETE",path:`/api/permission/saved/${encodeURIComponent(e.id)}`,successStatus:204,declaredStatuses:[400,401],empty:!0},t)},create:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/permission`,body:{id:e.id,action:e.action,resources:e.resources,save:e.save,metadata:e.metadata,source:e.source,agent:e.agent},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then((r)=>r.data),list:(e,t)=>o({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/permission`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then((r)=>r.data),get:(e,t)=>o({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/permission/${encodeURIComponent(e.requestID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then((r)=>r.data),reply:(e,t)=>o({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/permission/${encodeURIComponent(e.requestID)}/reply`,body:{decision:e.decision,message:e.message},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)},file:{read:(e,t)=>o({method:"GET",path:`/api/fs/read/${v(e.path)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1,binary:!0},t),list:(e,t)=>o({method:"GET",path:"/api/fs/list",query:{location:e?.location,path:e?.path},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),find:(e,t)=>o({method:"GET",path:"/api/fs/find",query:{location:e.location,query:e.query,type:e.type,limit:e.limit},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},command:{list:(e,t)=>o({method:"GET",path:"/api/command",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},skill:{list:(e,t)=>o({method:"GET",path:"/api/skill",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},rpc:{call:(e,t)=>o({method:"POST",path:`/api/rpc/${encodeURIComponent(e.rpcID)}/${encodeURIComponent(e.method)}`,query:{location:e.location},body:{input:e.input},successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},t)},event:{subscribe:(e,t)=>l({method:"GET",path:"/api/event",query:{types:e?.types},successStatus:200,declaredStatuses:[400,401],empty:!1},t)},pty:{list:(e,t)=>o({method:"GET",path:"/api/pty",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),create:(e,t)=>o({method:"POST",path:"/api/pty",query:{location:e?.location},body:{command:e?.command,args:e?.args,cwd:e?.cwd,title:e?.title,env:e?.env},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),get:(e,t)=>o({method:"GET",path:`/api/pty/${encodeURIComponent(e.ptyID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),update:(e,t)=>o({method:"PUT",path:`/api/pty/${encodeURIComponent(e.ptyID)}`,query:{location:e.location},body:{title:e.title,size:e.size},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),remove:(e,t)=>o({method:"DELETE",path:`/api/pty/${encodeURIComponent(e.ptyID)}`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),connect:{token:(e,t)=>o({method:"POST",path:`/api/pty/${encodeURIComponent(e.ptyID)}/connect-token`,query:{location:e.location},headers:{"x-opencode-ticket":e["x-opencode-ticket"]},successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},t)}},shell:{list:(e,t)=>o({method:"GET",path:"/api/shell",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),create:(e,t)=>o({method:"POST",path:"/api/shell",query:{location:e.location},body:{command:e.command,cwd:e.cwd,timeout:e.timeout,metadata:e.metadata},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),get:(e,t)=>o({method:"GET",path:`/api/shell/${encodeURIComponent(e.id)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),output:(e,t)=>o({method:"GET",path:`/api/shell/${encodeURIComponent(e.id)}/output`,query:{location:e.location,cursor:e.cursor,limit:e.limit},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),remove:(e,t)=>o({method:"DELETE",path:`/api/shell/${encodeURIComponent(e.id)}`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)},reference:{list:(e,t)=>o({method:"GET",path:"/api/reference",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},worktree:{list:(e,t)=>o({method:"GET",path:"/api/worktree",query:{projectID:e.projectID},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),create:(e,t)=>o({method:"POST",path:"/api/worktree",body:{projectID:e.projectID,from:e.from,branch:e.branch,directory:e.directory,name:e.name},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),remove:(e,t)=>o({method:"DELETE",path:"/api/worktree",body:{projectID:e.projectID,directory:e.directory,force:e.force},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),refresh:(e,t)=>o({method:"POST",path:"/api/worktree/refresh",body:{projectID:e.projectID},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)},vcs:{init:(e,t)=>o({method:"POST",path:"/api/vcs/init",query:{location:e?.location,provider:e?.provider},successStatus:204,declaredStatuses:[400,401,404,409,501,503],empty:!0},t),get:(e,t)=>o({method:"GET",path:"/api/vcs",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),base:(e,t)=>o({method:"GET",path:"/api/vcs/base",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t),status:(e,t)=>o({method:"GET",path:"/api/vcs/status",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),branch:{list:(e,t)=>o({method:"GET",path:"/api/vcs/branch",query:{location:e?.location,search:e?.search,limit:e?.limit},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},diff:(e,t)=>o({method:"GET",path:"/api/vcs/diff",query:{location:e.location,mode:e.mode,base:e.base,context:e.context,untracked:e.untracked},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t)},debug:{heapDump:(e,t)=>o({method:"POST",path:"/api/debug/heap-dump",query:{directory:e?.directory},successStatus:200,declaredStatuses:[400,401,500],empty:!1},t),location:{list:(e)=>o({method:"GET",path:"/api/debug/location",successStatus:200,declaredStatuses:[400,401],empty:!1},e),evict:(e,t)=>o({method:"DELETE",path:"/api/debug/location",query:{location:e?.location},successStatus:204,declaredStatuses:[400,401],empty:!0},t)}},websearch:{providers:(e,t)=>o({method:"GET",path:"/api/websearch/provider",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t),query:(e,t)=>o({method:"POST",path:"/api/websearch",query:{location:e.location},body:{query:e.query,providerID:e.providerID},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t)},config:{get:(e,t)=>o({method:"GET",path:"/api/config",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),shells:(e)=>o({method:"GET",path:"/api/config/shell",successStatus:200,declaredStatuses:[400,401,404],empty:!1},e)}};return{...s,session:{...s.session,stats:s.experimental.session.stats,import:s.experimental.session.import,export:s.experimental.session.export,skill:s.experimental.session.skill,wait:s.experimental.session.wait,instructions:{entry:{list:s.experimental.session.instructions.entry.list,put:s.experimental.session.instructions.entry.put,remove:s.experimental.session.instructions.entry.remove}},log:s.experimental.session.log},generate:{text:s.experimental.generate.text,image:s.experimental.generate.image,decisions:s.experimental.generate.decisions},voice:{models:s.experimental.voice.models,session:s.experimental.voice.session},integration:{...s.integration,wellknown:{add:s.experimental.integration.wellknown.add}},mcp:{...s.mcp,add:s.experimental.mcp.add,remove:s.experimental.mcp.remove,connect:s.experimental.mcp.connect,disconnect:s.experimental.mcp.disconnect,client:{token:s.experimental.mcp.client.token}},file:{...s.file,write:s.experimental.file.write,watch:s.experimental.file.watch,unwatch:s.experimental.file.unwatch},migration:{v1:{status:s.experimental.migration.v1.status}},usage:{limits:s.experimental.usage.limits},config:{...s.config,update:s.experimental.config.update}}}function v(n){return n.split("/").map(encodeURIComponent).join("/")}function E(n,a,i){if(i===void 0)return;if(i===null){n.append(a,"null");return}if(Array.isArray(i)){for(let y of i)E(n,a,y);return}if(typeof i==="object"){for(let[y,c]of Object.entries(i))E(n,`${a}[${y}]`,c);return}n.append(a,String(i))}async function R(n){if(!O(n,"application/json")&&!n.headers.get("content-type")?.includes("+json")){try{await n.body?.cancel()}catch{}throw new m("UnsupportedContentType",{detail:n.headers.get("content-type")})}let a;try{a=await n.text()}catch(i){throw new m("Transport",{cause:i})}if(a==="")throw new m("MalformedResponse");try{return JSON.parse(a)}catch(i){throw new m("MalformedResponse",{cause:i})}}function G(n){let a=Object.assign(Error(n.message??n.data?.message),n);if(n._tag)a.name=n._tag;return a}function O(n,a){return n.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase()===a}var K=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="InvalidRequestError",Q=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="UnauthorizedError",Y=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="LocationNotFoundError",X=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ServiceUnavailableError",Z=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="AgentNotFoundError",ee=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="PluginNotFoundError",te=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="InvalidCursorError",ne=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="SessionNotFoundError",oe=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="MessageNotFoundError",re=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ConflictError",se=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="CommandNotFoundError",ae=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="CommandExecutionError",ie=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="SessionBusyError",de=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="UnknownError",pe=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="FormNotFoundError",le=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="FormInvalidAnswerError",ue=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="FormAlreadySettledError",ce=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="SkillNotFoundError",ye=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="InstructionEntryValueTooLargeError",me=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ProviderNotFoundError",ge=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ModelNotFoundError",Ie=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="UnsupportedModelError",xe=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ProviderRequestError",Se=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="IntegrationNotFoundError",fe=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="IntegrationAttemptNotFoundError",be=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="IntegrationMethodNotFoundError",he=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="McpServerNotFoundError",Ee=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ForbiddenError",De=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ProjectNotFoundError",ve=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="PermissionSavedNotFoundError",Re=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="PermissionNotFoundError",Oe=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="FileNotFoundError",C=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="RpcError",A=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="RpcInternalError",Pe=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="PtyNotFoundError",Ce=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="PtyFeatureUnsupportedError",Ae=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ScheduleNotFoundError",Me=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ArtifactNotFoundError",qe=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ShellNotFoundError",ke=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="WorktreeError",Le=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="VcsInitNotSupportedError";function N(n){let a,i=4096;function y(o){if(o.connected=void 0,o.controller.abort(),a===o)a=void 0}async function c(o){let l,s={};try{if(o.controller.signal.aborted)return;l=n(o.controller.signal,()=>{o.subscribers.forEach((e)=>e.activity?.())})[Symbol.asyncIterator]();while(!o.controller.signal.aborted){let e=await l.next();if(e.done||o.controller.signal.aborted)break;if(e.value.type==="server.connected")o.connected=e.value;o.subscribers.forEach((t)=>t.push(e.value))}}catch(e){s={error:e}}finally{y(o);try{await l?.return?.()}catch(e){if(!("error"in s))s={error:e}}o.subscribers.forEach((e)=>e.finish(s))}}return{subscribe(o){return{[Symbol.asyncIterator](){let l=[],s=[],e=!1,t,r,I=o?.types?.length?new Set(o.types):void 0,x=(p)=>!I||p.type==="server.connected"||I.has(p.type);function d(p,g=!0){if(t=p,g)s.length=0;if(o?.signal?.removeEventListener("abort",u),r?.subscribers.delete(f)&&!r.subscribers.size)y(r);l.splice(0).forEach((S)=>{if("error"in p)S.reject(p.error);else S.resolve({done:!0,value:void 0})})}function u(){d({})}let f={activity:o?.onActivity,finish(p){d(p,!1)},push(p){if(t)return;if(!x(p))return;let g=l.shift();if(g){g.resolve({done:!1,value:p});return}if(s.length===4096){d({error:Error("Event subscriber exceeded its 4096-event capacity")});return}s.push(p)}};function b(){if(t)return;let p=!a;if(r=a??{controller:new AbortController,subscribers:new Set},a=r,r.subscribers.add(f),r.connected)f.push(r.connected);if(p)c(r)}return{next(){let p=s.shift();if(p)return Promise.resolve({done:!1,value:p});if(t){if("error"in t)return Promise.reject(t.error);return Promise.resolve({done:!0,value:void 0})}if(o?.signal?.aborted)return u(),Promise.resolve({done:!0,value:void 0});let g=Promise.withResolvers();if(l.push(g),!e)e=!0,o?.signal?.addEventListener("abort",u,{once:!0}),b();return g.promise},return(){return d({}),Promise.resolve({done:!0,value:void 0})}}}}}}}function q(n,a){return(i)=>{let y=(c,o)=>{if(!Object.hasOwn(i.events,c))throw Error(`Unknown RPC event: ${i.id}.${c}`);let l=V(i,c);return{[Symbol.asyncIterator](){let s=new AbortController,e=o?.signal?AbortSignal.any([s.signal,o.signal]):s.signal,t=async function*(){try{for await(let r of a.subscribe({signal:e})){if(e.aborted)return;if(r.type!==l)continue;yield r}}catch(r){if(!e.aborted)throw r}finally{s.abort()}}();return{next:()=>t.next(),return:()=>(s.abort(),t.return())}}}};return Object.assign(Object.fromEntries(Object.keys(i.methods).map((c)=>[c,async(o,l)=>{try{return(await n.rpc.call({rpcID:i.id,method:c,input:o,location:l?.location},{signal:l?.signal,headers:l?.headers})).output}catch(s){if(!C(s)&&!A(s))throw s;throw s.data===void 0?{type:s.type,message:s.message}:{type:s.type,message:s.message,data:s.data}}}])),{events:{subscribe:y,on:(c,o,l)=>{let s=new AbortController,e=l?.signal?AbortSignal.any([s.signal,l.signal]):s.signal,t=y(c,{signal:e});return(async()=>{for await(let r of t)await o(r)})().catch((r)=>console.error(r)),()=>s.abort()}}})}}function V(n,a){return`rpc.${n.id}.${a}`}function _(n){let a=U(n),i=N((y,c)=>a.event.subscribe(void 0,{signal:y,onActivity:c}));return{...a,rpc:Object.assign(q(a,i),a.rpc),event:i}}var j=/^media:([0-9a-f]{64})$/;function W(n){if(!n)return;return j.exec(n)?.[1]}function J(n){return{...n,message:{...n.message,list:(a,i)=>n.message.list(a,D(i))},session:{...n.session,message:{...n.session.message,get:(a,i)=>n.session.message.get(a,D(i))},inbox:{...n.session.inbox,list:(a,i)=>n.session.inbox.list(a,D(i))}}}}function D(n){if(n?.mediaRefs===!1)return n;let a=new Headers(n?.headers);return a.set("X-OpenCode-Capabilities","experimental-media-uri"),{...n,headers:a}}export{m as ClientError,h as OpenCode,Z as isAgentNotFoundError,Me as isArtifactNotFoundError,ae as isCommandExecutionError,se as isCommandNotFoundError,re as isConflictError,Oe as isFileNotFoundError,Ee as isForbiddenError,ue as isFormAlreadySettledError,le as isFormInvalidAnswerError,pe as isFormNotFoundError,ye as isInstructionEntryValueTooLargeError,fe as isIntegrationAttemptNotFoundError,be as isIntegrationMethodNotFoundError,Se as isIntegrationNotFoundError,te as isInvalidCursorError,K as isInvalidRequestError,Y as isLocationNotFoundError,he as isMcpServerNotFoundError,oe as isMessageNotFoundError,ge as isModelNotFoundError,Re as isPermissionNotFoundError,ve as isPermissionSavedNotFoundError,ee as isPluginNotFoundError,De as isProjectNotFoundError,me as isProviderNotFoundError,xe as isProviderRequestError,Ce as isPtyFeatureUnsupportedError,Pe as isPtyNotFoundError,C as isRpcError,A as isRpcInternalError,Ae as isScheduleNotFoundError,X as isServiceUnavailableError,ie as isSessionBusyError,ne as isSessionNotFoundError,qe as isShellNotFoundError,ce as isSkillNotFoundError,Q as isUnauthorizedError,de as isUnknownError,Ie as isUnsupportedModelError,Le as isVcsInitNotSupportedError,ke as isWorktreeError,W as mediaHashFromUri,J as withMediaRefs};
|
package/client/media.d.ts
CHANGED
|
@@ -116,6 +116,9 @@ export declare function withMediaRefs(api: ReturnType<typeof make>): {
|
|
|
116
116
|
delete: (input: import("./index.js").ExperimentalArtifactsDeleteInput, requestOptions?: RequestOptions) => Promise<void>;
|
|
117
117
|
view: (input: import("./index.js").ExperimentalArtifactsViewInput, requestOptions?: RequestOptions) => Promise<import("./index.js").ExperimentalArtifactsViewOutput>;
|
|
118
118
|
};
|
|
119
|
+
job: {
|
|
120
|
+
list: (input?: import("./index.js").ExperimentalJobListInput, requestOptions?: RequestOptions) => Promise<import("./index.js").JobInfo[]>;
|
|
121
|
+
};
|
|
119
122
|
migration: {
|
|
120
123
|
v1: {
|
|
121
124
|
status: (requestOptions?: RequestOptions) => Promise<import("./index.js").ExperimentalMigrationV1StatusOutput>;
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"import": "./client/index.js"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
|
-
"version": "2.2.5-shuv.
|
|
17
|
+
"version": "2.2.5-shuv.2",
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
@@ -30,17 +30,17 @@
|
|
|
30
30
|
"x64"
|
|
31
31
|
],
|
|
32
32
|
"optionalDependencies": {
|
|
33
|
-
"shuvcode-linux-x64": "2.2.5-shuv.
|
|
34
|
-
"shuvcode-linux-arm64-musl": "2.2.5-shuv.
|
|
35
|
-
"shuvcode-windows-x64-baseline": "2.2.5-shuv.
|
|
36
|
-
"shuvcode-linux-x64-musl": "2.2.5-shuv.
|
|
37
|
-
"shuvcode-linux-x64-baseline": "2.2.5-shuv.
|
|
38
|
-
"shuvcode-windows-arm64": "2.2.5-shuv.
|
|
39
|
-
"shuvcode-linux-x64-baseline-musl": "2.2.5-shuv.
|
|
40
|
-
"shuvcode-linux-arm64": "2.2.5-shuv.
|
|
41
|
-
"shuvcode-darwin-x64-baseline": "2.2.5-shuv.
|
|
42
|
-
"shuvcode-darwin-x64": "2.2.5-shuv.
|
|
43
|
-
"shuvcode-darwin-arm64": "2.2.5-shuv.
|
|
44
|
-
"shuvcode-windows-x64": "2.2.5-shuv.
|
|
33
|
+
"shuvcode-linux-x64": "2.2.5-shuv.2",
|
|
34
|
+
"shuvcode-linux-arm64-musl": "2.2.5-shuv.2",
|
|
35
|
+
"shuvcode-windows-x64-baseline": "2.2.5-shuv.2",
|
|
36
|
+
"shuvcode-linux-x64-musl": "2.2.5-shuv.2",
|
|
37
|
+
"shuvcode-linux-x64-baseline": "2.2.5-shuv.2",
|
|
38
|
+
"shuvcode-windows-arm64": "2.2.5-shuv.2",
|
|
39
|
+
"shuvcode-linux-x64-baseline-musl": "2.2.5-shuv.2",
|
|
40
|
+
"shuvcode-linux-arm64": "2.2.5-shuv.2",
|
|
41
|
+
"shuvcode-darwin-x64-baseline": "2.2.5-shuv.2",
|
|
42
|
+
"shuvcode-darwin-x64": "2.2.5-shuv.2",
|
|
43
|
+
"shuvcode-darwin-arm64": "2.2.5-shuv.2",
|
|
44
|
+
"shuvcode-windows-x64": "2.2.5-shuv.2"
|
|
45
45
|
}
|
|
46
46
|
}
|