shuvcode 2.1.4-shuv.1 → 2.2.2-shuv.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/api.d.ts +4 -0
- package/client/client.d.ts +209 -133
- package/client/client.js +1 -1
- package/client/generated/client.d.ts +245 -134
- package/client/generated/client.js +556 -321
- package/client/generated/types.d.ts +1703 -3822
- package/client/generated/types.js +11 -6
- package/client/index.d.ts +1 -0
- package/client/index.js +7 -7
- package/client/service.d.ts +2 -2
- package/client/service.js +1 -1
- package/package.json +13 -13
|
@@ -3,23 +3,27 @@ export const isUnauthorizedError = (value) => typeof value === "object" && value
|
|
|
3
3
|
export const isLocationNotFoundError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "LocationNotFoundError";
|
|
4
4
|
export const isServiceUnavailableError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "ServiceUnavailableError";
|
|
5
5
|
export const isAgentNotFoundError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "AgentNotFoundError";
|
|
6
|
+
export const isPluginNotFoundError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "PluginNotFoundError";
|
|
6
7
|
export const isInvalidCursorError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "InvalidCursorError";
|
|
7
8
|
export const isSessionNotFoundError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "SessionNotFoundError";
|
|
8
|
-
export const isConflictError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "ConflictError";
|
|
9
|
-
export const isUnknownError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "UnknownError";
|
|
10
9
|
export const isMessageNotFoundError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "MessageNotFoundError";
|
|
10
|
+
export const isConflictError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "ConflictError";
|
|
11
11
|
export const isCommandNotFoundError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "CommandNotFoundError";
|
|
12
12
|
export const isCommandExecutionError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "CommandExecutionError";
|
|
13
|
-
export const isSkillNotFoundError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "SkillNotFoundError";
|
|
14
13
|
export const isSessionBusyError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "SessionBusyError";
|
|
14
|
+
export const isUnknownError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "UnknownError";
|
|
15
|
+
export const isFormNotFoundError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "FormNotFoundError";
|
|
16
|
+
export const isFormInvalidAnswerError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "FormInvalidAnswerError";
|
|
17
|
+
export const isFormAlreadySettledError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "FormAlreadySettledError";
|
|
18
|
+
export const isSkillNotFoundError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "SkillNotFoundError";
|
|
15
19
|
export const isInstructionEntryValueTooLargeError = (value) => typeof value === "object" &&
|
|
16
20
|
value !== null &&
|
|
17
21
|
"_tag" in value &&
|
|
18
22
|
value["_tag"] === "InstructionEntryValueTooLargeError";
|
|
19
|
-
export const isFormNotFoundError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "FormNotFoundError";
|
|
20
|
-
export const isFormInvalidAnswerError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "FormInvalidAnswerError";
|
|
21
|
-
export const isFormAlreadySettledError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "FormAlreadySettledError";
|
|
22
23
|
export const isProviderNotFoundError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "ProviderNotFoundError";
|
|
24
|
+
export const isModelNotFoundError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "ModelNotFoundError";
|
|
25
|
+
export const isUnsupportedModelError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "UnsupportedModelError";
|
|
26
|
+
export const isProviderRequestError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "ProviderRequestError";
|
|
23
27
|
export const isIntegrationNotFoundError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "IntegrationNotFoundError";
|
|
24
28
|
export const isIntegrationAttemptNotFoundError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "IntegrationAttemptNotFoundError";
|
|
25
29
|
export const isIntegrationMethodNotFoundError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "IntegrationMethodNotFoundError";
|
|
@@ -32,6 +36,7 @@ export const isFileNotFoundError = (value) => typeof value === "object" && value
|
|
|
32
36
|
export const isRpcError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "RpcError";
|
|
33
37
|
export const isRpcInternalError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "RpcInternalError";
|
|
34
38
|
export const isPtyNotFoundError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "PtyNotFoundError";
|
|
39
|
+
export const isScheduleNotFoundError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "ScheduleNotFoundError";
|
|
35
40
|
export const isShellNotFoundError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "ShellNotFoundError";
|
|
36
41
|
export const isWorktreeError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "WorktreeError";
|
|
37
42
|
export const isVcsInitNotSupportedError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "VcsInitNotSupportedError";
|
package/client/index.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ export * from "./generated/index.js";
|
|
|
3
3
|
export { OpenCode } from "./client.js";
|
|
4
4
|
export type { AgentApi, CommandApi, ConfigApi, EventApi, IntegrationApi, ModelApi, PluginApi, ProviderApi, ReferenceApi, RpcApi, RpcCallOptions, RpcClient, RpcEventPayload, WebSearchApi, SessionApi, SkillApi, } from "./api.js";
|
|
5
5
|
export type { EventSubscribeOutput as OpenCodeEvent } from "./generated/types.js";
|
|
6
|
+
export type { MediaFileAttachment as PromptMediaFileAttachment, Attachment as PromptAttachment, } from "@opencode/schema/prompt";
|
|
6
7
|
export type OpenCodeClient = ReturnType<typeof OpenCode.make>;
|
package/client/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var q=Object.defineProperty;var
|
|
1
|
+
var q=Object.defineProperty;var A=(n)=>n;function k(n,a){this[n]=A.bind(null,a)}var L=(n,a)=>{for(var i in a)q(n,i,{get:a[i],enumerable:!0,configurable:!0,set:k.bind(a,i)})};var h={};L(h,{OpenCode:()=>h,make:()=>V});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 F=16777216;function T(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 S=new Headers(n.headers);for(let[d,u]of Object.entries(e.headers??{}))if(u!==void 0&&u!==null)S.set(d,String(u));for(let[d,u]of new Headers(t?.headers))S.set(d,u);if(e.body!==void 0&&!S.has("content-type"))S.set("content-type",e.binaryBody?"application/octet-stream":"application/json");return{url:I,init:{method:e.method,signal:t?.signal,headers:S,body:e.body===void 0?void 0:e.binaryBody?e.body:JSON.stringify(e.body)}}},c=async(e,t)=>{try{let r=i(e,t);return await a(r.url,r.init)}catch(r){throw new m("Transport",{cause:r})}},y=async(e,t)=>{if(t.declaredStatuses.includes(e.status))throw U(await D(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 c(e,t);if(r.status!==e.successStatus)return y(r,e);if(e.binary)return new Uint8Array(await r.arrayBuffer());if(e.empty){try{await r.body?.cancel()}catch{}return}return await D(r)},l=(e,t)=>({async*[Symbol.asyncIterator](){let r=await c(e,t);if(r.status!==e.successStatus)await y(r,e);if(!v(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(),S=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+=S.decode(u.value,{stream:!u.done}),d.length>F)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
|
-
`),f)d+="\r";if(
|
|
4
|
+
`),f)d+="\r";if(u.done&&d!=="")d+=`
|
|
5
5
|
|
|
6
|
-
`;let
|
|
6
|
+
`;let b=d.indexOf(`
|
|
7
7
|
|
|
8
|
-
`);while(
|
|
9
|
-
`).flatMap((
|
|
10
|
-
`);if(
|
|
8
|
+
`);while(b>=0){let p=d.slice(0,b);d=d.slice(b+2);let g=p.split(`
|
|
9
|
+
`).flatMap((x)=>x.startsWith("data:")?[x.slice(5).trimStart()]:[]).join(`
|
|
10
|
+
`);if(g!=="")try{yield JSON.parse(g)}catch(x){throw new m("MalformedResponse",{cause:x})}b=d.indexOf(`
|
|
11
11
|
|
|
12
|
-
`)}if(y.done)return}}finally{try{await i.cancel()}catch{}i.releaseLock()}}});return{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],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),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),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),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),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),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),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),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),wait:(e,t)=>o({method:"POST",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/wait`,successStatus:204,declaredStatuses:[400,401,404,503],empty:!0},t),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)},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)}},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),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),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)},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},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)},generate:{text:(e,t)=>o({method:"POST",path:"/api/experimental/generate",body:{prompt:e.prompt,model:e.model},successStatus:200,declaredStatuses:[400,401,404,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),instructions:(e,t)=>o({method:"POST",path:`/api/experimental/voice/session/${encodeURIComponent(e.sessionID)}/instructions`,body:{instructions:e.instructions},successStatus:204,declaredStatuses:[400,401,404,503],empty:!0},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),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)},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),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),resource:{catalog:(e,t)=>o({method:"GET",path:"/api/mcp/resource",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},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)}},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,404],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,404],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/${F(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),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)},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)=>l({method:"GET",path:"/api/event",successStatus:200,declaredStatuses:[400,401],empty:!1},e)},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)}},experimental:{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},successStatus:200,declaredStatuses:[400,401,404,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)}},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},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)}},migration:{v1:{status:(e)=>o({method:"GET",path:"/api/experimental/migration/v1",successStatus:200,declaredStatuses:[400,401],empty:!1},e)}},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),update:(e,t)=>o({method:"PATCH",path:"/api/experimental/config",body:{shell:e.shell},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)}}}function F(n){return n.split("/").map(encodeURIComponent).join("/")}function h(n,a,s){if(s===void 0)return;if(s===null){n.append(a,"null");return}if(Array.isArray(s)){for(let c of s)h(n,a,c);return}if(typeof s==="object"){for(let[c,p]of Object.entries(s))h(n,`${a}[${c}]`,p);return}n.append(a,String(s))}async function D(n){if(!v(n,"application/json")&&!n.headers.get("content-type")?.includes("+json")){try{await n.body?.cancel()}catch{}throw new g("UnsupportedContentType",{detail:n.headers.get("content-type")})}let a;try{a=await n.text()}catch(s){throw new g("Transport",{cause:s})}if(a==="")throw new g("MalformedResponse");try{return JSON.parse(a)}catch(s){throw new g("MalformedResponse",{cause:s})}}function T(n){let a=Object.assign(Error(n.message??n.data?.message),n);if(n._tag)a.name=n._tag;return a}function v(n,a){return n.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase()===a}var J=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="InvalidRequestError",W=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="UnauthorizedError",B=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="LocationNotFoundError",z=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ServiceUnavailableError",H=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="AgentNotFoundError",K=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="InvalidCursorError",Q=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="SessionNotFoundError",X=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ConflictError",Y=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="UnknownError",Z=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="MessageNotFoundError",ee=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="CommandNotFoundError",te=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="CommandExecutionError",ne=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="SkillNotFoundError",oe=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="SessionBusyError",re=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="InstructionEntryValueTooLargeError",ae=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="FormNotFoundError",se=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="FormInvalidAnswerError",ie=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="FormAlreadySettledError",de=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ProviderNotFoundError",le=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="IntegrationNotFoundError",ye=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="IntegrationAttemptNotFoundError",ue=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="IntegrationMethodNotFoundError",pe=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="McpServerNotFoundError",ce=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ForbiddenError",ge=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ProjectNotFoundError",me=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="PermissionSavedNotFoundError",Ie=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="PermissionNotFoundError",be=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="FileNotFoundError",O=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="RpcError",P=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="RpcInternalError",fe=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="PtyNotFoundError",Se=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ShellNotFoundError",xe=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="WorktreeError",he=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="VcsInitNotSupportedError";function N(n){let a,s=4096;function c(o){if(o.connected=void 0,o.controller.abort(),a===o)a=void 0}async function p(o){let l,e={};try{if(o.controller.signal.aborted)return;l=n(o.controller.signal,()=>{o.subscribers.forEach((t)=>t.activity?.())})[Symbol.asyncIterator]();while(!o.controller.signal.aborted){let t=await l.next();if(t.done||o.controller.signal.aborted)break;if(t.value.type==="server.connected")o.connected=t.value;o.subscribers.forEach((r)=>r.push(t.value))}}catch(t){e={error:t}}finally{c(o);try{await l?.return?.()}catch(t){if(!("error"in e))e={error:t}}o.subscribers.forEach((t)=>t.finish(e))}}return{subscribe(o){return{[Symbol.asyncIterator](){let l=[],e=[],t=!1,r,i;function m(u,I=!0){if(r=u,I)e.length=0;if(o?.signal?.removeEventListener("abort",d),i?.subscribers.delete(y)&&!i.subscribers.size)c(i);l.splice(0).forEach((b)=>{if("error"in u)b.reject(u.error);else b.resolve({done:!0,value:void 0})})}function d(){m({})}let y={activity:o?.onActivity,finish(u){m(u,!1)},push(u){if(r)return;let I=l.shift();if(I){I.resolve({done:!1,value:u});return}if(e.length===4096){m({error:Error("Event subscriber exceeded its 4096-event capacity")});return}e.push(u)}};function f(){if(r)return;let u=!a;if(i=a??{controller:new AbortController,subscribers:new Set},a=i,i.subscribers.add(y),i.connected)y.push(i.connected);if(u)p(i)}return{next(){let u=e.shift();if(u)return Promise.resolve({done:!1,value:u});if(r){if("error"in r)return Promise.reject(r.error);return Promise.resolve({done:!0,value:void 0})}if(o?.signal?.aborted)return d(),Promise.resolve({done:!0,value:void 0});let I=Promise.withResolvers();if(l.push(I),!t)t=!0,o?.signal?.addEventListener("abort",d,{once:!0}),f();return I.promise},return(){return m({}),Promise.resolve({done:!0,value:void 0})}}}}}}}function C(n,a){return(s)=>{let c=(p,o)=>{if(!Object.hasOwn(s.events,p))throw Error(`Unknown RPC event: ${s.id}.${p}`);let l=U(s,p);return{[Symbol.asyncIterator](){let e=new AbortController,t=o?.signal?AbortSignal.any([e.signal,o.signal]):e.signal,r=async function*(){try{for await(let i of a.subscribe({signal:t})){if(t.aborted)return;if(i.type!==l)continue;yield i}}catch(i){if(!t.aborted)throw i}finally{e.abort()}}();return{next:()=>r.next(),return:()=>(e.abort(),r.return())}}}};return Object.assign(Object.fromEntries(Object.keys(s.methods).map((p)=>[p,async(o,l)=>{try{return(await n.rpc.call({rpcID:s.id,method:p,input:o,location:l?.location},{signal:l?.signal,headers:l?.headers})).output}catch(e){if(!O(e)&&!P(e))throw e;throw e.data===void 0?{type:e.type,message:e.message}:{type:e.type,message:e.message,data:e.data}}}])),{events:{subscribe:c,on:(p,o,l)=>{let e=new AbortController,t=l?.signal?AbortSignal.any([e.signal,l.signal]):e.signal,r=c(p,{signal:t});return(async()=>{for await(let i of r)await o(i)})().catch((i)=>console.error(i)),()=>e.abort()}}})}}function U(n,a){return`rpc.${n.id}.${a}`}function V(n){let a=L(n),s=N((c,p)=>a.event.subscribe({signal:c,onActivity:p}));return{...a,rpc:Object.assign(C(a,s),a.rpc),event:s}}export{g as ClientError,x as OpenCode,H as isAgentNotFoundError,te as isCommandExecutionError,ee as isCommandNotFoundError,X as isConflictError,be as isFileNotFoundError,ce as isForbiddenError,ie as isFormAlreadySettledError,se as isFormInvalidAnswerError,ae as isFormNotFoundError,re as isInstructionEntryValueTooLargeError,ye as isIntegrationAttemptNotFoundError,ue as isIntegrationMethodNotFoundError,le as isIntegrationNotFoundError,K as isInvalidCursorError,J as isInvalidRequestError,B as isLocationNotFoundError,pe as isMcpServerNotFoundError,Z as isMessageNotFoundError,Ie as isPermissionNotFoundError,me as isPermissionSavedNotFoundError,ge as isProjectNotFoundError,de as isProviderNotFoundError,fe as isPtyNotFoundError,O as isRpcError,P as isRpcInternalError,z as isServiceUnavailableError,oe as isSessionBusyError,Q as isSessionNotFoundError,Se as isShellNotFoundError,ne as isSkillNotFoundError,W as isUnauthorizedError,Y as isUnknownError,he as isVcsInitNotSupportedError,xe as isWorktreeError};
|
|
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},successStatus:200,declaredStatuses:[400,401,404,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)},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/${w(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 w(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 c of i)E(n,a,c);return}if(typeof i==="object"){for(let[c,y]of Object.entries(i))E(n,`${a}[${c}]`,y);return}n.append(a,String(i))}async function D(n){if(!v(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 U(n){let a=Object.assign(Error(n.message??n.data?.message),n);if(n._tag)a.name=n._tag;return a}function v(n,a){return n.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase()===a}var J=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="InvalidRequestError",B=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="UnauthorizedError",z=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="LocationNotFoundError",H=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ServiceUnavailableError",K=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="AgentNotFoundError",Q=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="PluginNotFoundError",X=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="InvalidCursorError",Y=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="SessionNotFoundError",Z=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="MessageNotFoundError",ee=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ConflictError",te=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="CommandNotFoundError",ne=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="CommandExecutionError",oe=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="SessionBusyError",re=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="UnknownError",se=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="FormNotFoundError",ae=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="FormInvalidAnswerError",ie=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="FormAlreadySettledError",de=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="SkillNotFoundError",pe=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="InstructionEntryValueTooLargeError",le=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ProviderNotFoundError",ue=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ModelNotFoundError",ye=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="UnsupportedModelError",ce=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ProviderRequestError",me=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="IntegrationNotFoundError",ge=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="IntegrationAttemptNotFoundError",Ie=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="IntegrationMethodNotFoundError",Se=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="McpServerNotFoundError",xe=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ForbiddenError",fe=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ProjectNotFoundError",be=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="PermissionSavedNotFoundError",he=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="PermissionNotFoundError",Ee=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="FileNotFoundError",O=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="RpcError",P=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="RpcInternalError",De=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="PtyNotFoundError",ve=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ScheduleNotFoundError",Re=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="ShellNotFoundError",Oe=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="WorktreeError",Pe=(n)=>typeof n==="object"&&n!==null&&("_tag"in n)&&n._tag==="VcsInitNotSupportedError";function G(n){let a,i=4096;function c(o){if(o.connected=void 0,o.controller.abort(),a===o)a=void 0}async function y(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{c(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,S=(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)c(r);l.splice(0).forEach((x)=>{if("error"in p)x.reject(p.error);else x.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(!S(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)y(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 M(n,a){return(i)=>{let c=(y,o)=>{if(!Object.hasOwn(i.events,y))throw Error(`Unknown RPC event: ${i.id}.${y}`);let l=N(i,y);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((y)=>[y,async(o,l)=>{try{return(await n.rpc.call({rpcID:i.id,method:y,input:o,location:l?.location},{signal:l?.signal,headers:l?.headers})).output}catch(s){if(!O(s)&&!P(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:c,on:(y,o,l)=>{let s=new AbortController,e=l?.signal?AbortSignal.any([s.signal,l.signal]):s.signal,t=c(y,{signal:e});return(async()=>{for await(let r of t)await o(r)})().catch((r)=>console.error(r)),()=>s.abort()}}})}}function N(n,a){return`rpc.${n.id}.${a}`}function V(n){let a=T(n),i=G((c,y)=>a.event.subscribe(void 0,{signal:c,onActivity:y}));return{...a,rpc:Object.assign(M(a,i),a.rpc),event:i}}export{m as ClientError,h as OpenCode,K as isAgentNotFoundError,ne as isCommandExecutionError,te as isCommandNotFoundError,ee as isConflictError,Ee as isFileNotFoundError,xe as isForbiddenError,ie as isFormAlreadySettledError,ae as isFormInvalidAnswerError,se as isFormNotFoundError,pe as isInstructionEntryValueTooLargeError,ge as isIntegrationAttemptNotFoundError,Ie as isIntegrationMethodNotFoundError,me as isIntegrationNotFoundError,X as isInvalidCursorError,J as isInvalidRequestError,z as isLocationNotFoundError,Se as isMcpServerNotFoundError,Z as isMessageNotFoundError,ue as isModelNotFoundError,he as isPermissionNotFoundError,be as isPermissionSavedNotFoundError,Q as isPluginNotFoundError,fe as isProjectNotFoundError,le as isProviderNotFoundError,ce as isProviderRequestError,De as isPtyNotFoundError,O as isRpcError,P as isRpcInternalError,ve as isScheduleNotFoundError,H as isServiceUnavailableError,oe as isSessionBusyError,Y as isSessionNotFoundError,Re as isShellNotFoundError,de as isSkillNotFoundError,B as isUnauthorizedError,re as isUnknownError,ye as isUnsupportedModelError,Pe as isVcsInitNotSupportedError,Oe as isWorktreeError};
|
package/client/service.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DiscoverOptions, Endpoint, EnsureOptions, StopOptions } from "../service.js";
|
|
2
|
-
import { headers } from "../service-probe.js";
|
|
2
|
+
import { fallback, headers } from "../service-probe.js";
|
|
3
3
|
export * from "../service.js";
|
|
4
|
-
export { headers };
|
|
4
|
+
export { fallback, headers };
|
|
5
5
|
/** Discover a healthy, compatible local service without starting one. */
|
|
6
6
|
export declare function discover(options?: DiscoverOptions): Promise<{
|
|
7
7
|
url: string;
|
package/client/service.js
CHANGED
|
@@ -5,7 +5,7 @@ import { matchesVersion } from "../service-version.js";
|
|
|
5
5
|
import { PtyHandoff } from "../pty-handoff.js";
|
|
6
6
|
import { decide, fallback, headers, probeResult, same } from "../service-probe.js";
|
|
7
7
|
export * from "../service.js";
|
|
8
|
-
export { headers };
|
|
8
|
+
export { fallback, headers };
|
|
9
9
|
// Find, start, and stop the local opencode background service.
|
|
10
10
|
//
|
|
11
11
|
// The registration file is the complete discovery contract. This module is
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"import": "./client/index.js"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
|
-
"version": "2.
|
|
17
|
+
"version": "2.2.2-shuv.1",
|
|
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-
|
|
34
|
-
"shuvcode-linux-arm64-musl": "2.
|
|
35
|
-
"shuvcode-
|
|
36
|
-
"shuvcode-
|
|
37
|
-
"shuvcode-linux-x64-
|
|
38
|
-
"shuvcode-
|
|
39
|
-
"shuvcode-linux-x64-baseline": "2.
|
|
40
|
-
"shuvcode-
|
|
41
|
-
"shuvcode-
|
|
42
|
-
"shuvcode-darwin-x64
|
|
43
|
-
"shuvcode-
|
|
44
|
-
"shuvcode-
|
|
33
|
+
"shuvcode-linux-x64": "2.2.2-shuv.1",
|
|
34
|
+
"shuvcode-linux-arm64-musl": "2.2.2-shuv.1",
|
|
35
|
+
"shuvcode-windows-x64-baseline": "2.2.2-shuv.1",
|
|
36
|
+
"shuvcode-linux-x64-musl": "2.2.2-shuv.1",
|
|
37
|
+
"shuvcode-linux-x64-baseline": "2.2.2-shuv.1",
|
|
38
|
+
"shuvcode-windows-arm64": "2.2.2-shuv.1",
|
|
39
|
+
"shuvcode-linux-x64-baseline-musl": "2.2.2-shuv.1",
|
|
40
|
+
"shuvcode-linux-arm64": "2.2.2-shuv.1",
|
|
41
|
+
"shuvcode-darwin-x64-baseline": "2.2.2-shuv.1",
|
|
42
|
+
"shuvcode-darwin-x64": "2.2.2-shuv.1",
|
|
43
|
+
"shuvcode-darwin-arm64": "2.2.2-shuv.1",
|
|
44
|
+
"shuvcode-windows-x64": "2.2.2-shuv.1"
|
|
45
45
|
}
|
|
46
46
|
}
|