shuvcode 2.0.18-shuv.1 → 2.0.21-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/client.d.ts +2 -0
- package/client/generated/client.d.ts +3 -1
- package/client/generated/client.js +16 -0
- package/client/generated/types.d.ts +221 -12
- package/client/index.js +2 -2
- package/package.json +13 -13
package/client/client.d.ts
CHANGED
|
@@ -137,6 +137,8 @@ export declare function make(options: ClientOptions): {
|
|
|
137
137
|
};
|
|
138
138
|
};
|
|
139
139
|
credential: {
|
|
140
|
+
list: (requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").CredentialEntry[]>;
|
|
141
|
+
create: (input: import("./index.js").CredentialCreateInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").CredentialEntry>;
|
|
140
142
|
update: (input: import("./index.js").CredentialUpdateInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
141
143
|
activate: (input: import("./index.js").CredentialActivateInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
142
144
|
remove: (input: import("./index.js").CredentialRemoveInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ServerConnectInput, LocationGetInput, AgentListInput, AgentListOutput, AgentGetInput, AgentGetOutput, PluginListInput, PluginListOutput, PluginCheckInput, PluginCheckOutput, PluginUpdateInput, SessionListInput, SessionStatsInput, SessionCreateInput, SessionImportInput, SessionExportInput, SessionGetInput, SessionRemoveInput, SessionForkInput, SessionSwitchAgentInput, SessionSwitchModelInput, SessionUpdateInput, SessionMoveInput, SessionPromptInput, SessionCommandInput, SessionSkillInput, SessionSyntheticInput, SessionShellInput, SessionCompactInput, SessionWaitInput, SessionRevertStageInput, SessionRevertClearInput, SessionRevertCommitInput, SessionContextInput, SessionDiffInput, SessionInboxListInput, SessionInboxCancelInput, SessionInboxUpdateInput, SessionInstructionsEntryListInput, SessionInstructionsEntryPutInput, SessionInstructionsEntryRemoveInput, SessionGenerateInput, SessionLogInput, SessionLogOutput, SessionInterruptInput, SessionBackgroundInput, SessionMessageGetInput, SessionFormListInput, SessionFormCreateInput, SessionFormGetInput, SessionFormReplyInput, SessionFormCancelInput, SessionEnvironmentInput, SessionViewInput, MessageListInput, ModelListInput, ModelListOutput, ModelDefaultInput, ModelDefaultOutput, GenerateTextInput, ProviderListInput, ProviderListOutput, ProviderGetInput, ProviderGetOutput, IntegrationListInput, IntegrationListOutput, IntegrationGetInput, IntegrationGetOutput, IntegrationWellknownAddInput, IntegrationConnectKeyInput, IntegrationOauthConnectInput, IntegrationOauthConnectOutput, IntegrationOauthStatusInput, IntegrationOauthStatusOutput, IntegrationOauthCompleteInput, IntegrationOauthCancelInput, IntegrationCommandConnectInput, IntegrationCommandConnectOutput, IntegrationCommandStatusInput, IntegrationCommandStatusOutput, IntegrationCommandCancelInput, McpListInput, McpListOutput, McpAddInput, McpRemoveInput, McpConnectInput, McpDisconnectInput, McpResourceCatalogInput, McpResourceCatalogOutput, CredentialUpdateInput, CredentialActivateInput, CredentialRemoveInput, ProjectListOutput, ProjectUpdateInput, FormListInput, FormListOutput, PermissionRequestListInput, PermissionRequestListOutput, PermissionSavedListInput, PermissionSavedRemoveInput, PermissionCreateInput, PermissionListInput, PermissionGetInput, PermissionReplyInput, FileReadInput, FileReadOutput, FileListInput, FileListOutput, FileFindInput, FileFindOutput, FileWriteInput, FileWriteOutput, CommandListInput, CommandListOutput, SkillListInput, SkillListOutput, RpcCallInput, EventSubscribeOutput, PtyListInput, PtyListOutput, PtyCreateInput, PtyCreateOutput, PtyGetInput, PtyGetOutput, PtyUpdateInput, PtyUpdateOutput, PtyRemoveInput, PtyConnectTokenInput, PtyConnectTokenOutput, ExperimentalPersistentPtyReadInput, ExperimentalPersistentPtyListInput, ExperimentalPersistentPtyCreateInput, ExperimentalPersistentPtyHandoffOutput, ExperimentalPersistentPtyGetInput, ExperimentalPersistentPtyUpdateInput, ExperimentalPersistentPtySnapshotInput, ExperimentalPersistentPtyRemoveInput, ExperimentalPersistentPtyConnectTokenInput, ShellListInput, ShellListOutput, ShellCreateInput, ShellCreateOutput, ShellGetInput, ShellGetOutput, ShellOutputInput, ShellOutputOutput, ShellRemoveInput, ReferenceListInput, ReferenceListOutput, WorktreeListInput, WorktreeCreateInput, WorktreeRemoveInput, WorktreeRefreshInput, VcsGetInput, VcsGetOutput, VcsBaseInput, VcsBaseOutput, VcsStatusInput, VcsStatusOutput, VcsBranchListInput, VcsBranchListOutput, VcsDiffInput, VcsDiffOutput, DebugLocationListOutput, DebugLocationEvictInput, MigrationV1StatusOutput, WebsearchProvidersInput, WebsearchProvidersOutput, WebsearchQueryInput, WebsearchQueryOutput, ConfigGetInput, ConfigGetOutput, ConfigShellsOutput, ConfigUpdateInput } from "./types.js";
|
|
1
|
+
import type { ServerConnectInput, LocationGetInput, AgentListInput, AgentListOutput, AgentGetInput, AgentGetOutput, PluginListInput, PluginListOutput, PluginCheckInput, PluginCheckOutput, PluginUpdateInput, SessionListInput, SessionStatsInput, SessionCreateInput, SessionImportInput, SessionExportInput, SessionGetInput, SessionRemoveInput, SessionForkInput, SessionSwitchAgentInput, SessionSwitchModelInput, SessionUpdateInput, SessionMoveInput, SessionPromptInput, SessionCommandInput, SessionSkillInput, SessionSyntheticInput, SessionShellInput, SessionCompactInput, SessionWaitInput, SessionRevertStageInput, SessionRevertClearInput, SessionRevertCommitInput, SessionContextInput, SessionDiffInput, SessionInboxListInput, SessionInboxCancelInput, SessionInboxUpdateInput, SessionInstructionsEntryListInput, SessionInstructionsEntryPutInput, SessionInstructionsEntryRemoveInput, SessionGenerateInput, SessionLogInput, SessionLogOutput, SessionInterruptInput, SessionBackgroundInput, SessionMessageGetInput, SessionFormListInput, SessionFormCreateInput, SessionFormGetInput, SessionFormReplyInput, SessionFormCancelInput, SessionEnvironmentInput, SessionViewInput, MessageListInput, ModelListInput, ModelListOutput, ModelDefaultInput, ModelDefaultOutput, GenerateTextInput, ProviderListInput, ProviderListOutput, ProviderGetInput, ProviderGetOutput, IntegrationListInput, IntegrationListOutput, IntegrationGetInput, IntegrationGetOutput, IntegrationWellknownAddInput, IntegrationConnectKeyInput, IntegrationOauthConnectInput, IntegrationOauthConnectOutput, IntegrationOauthStatusInput, IntegrationOauthStatusOutput, IntegrationOauthCompleteInput, IntegrationOauthCancelInput, IntegrationCommandConnectInput, IntegrationCommandConnectOutput, IntegrationCommandStatusInput, IntegrationCommandStatusOutput, IntegrationCommandCancelInput, McpListInput, McpListOutput, McpAddInput, McpRemoveInput, McpConnectInput, McpDisconnectInput, McpResourceCatalogInput, McpResourceCatalogOutput, CredentialCreateInput, CredentialUpdateInput, CredentialActivateInput, CredentialRemoveInput, ProjectListOutput, ProjectUpdateInput, FormListInput, FormListOutput, PermissionRequestListInput, PermissionRequestListOutput, PermissionSavedListInput, PermissionSavedRemoveInput, PermissionCreateInput, PermissionListInput, PermissionGetInput, PermissionReplyInput, FileReadInput, FileReadOutput, FileListInput, FileListOutput, FileFindInput, FileFindOutput, FileWriteInput, FileWriteOutput, CommandListInput, CommandListOutput, SkillListInput, SkillListOutput, RpcCallInput, EventSubscribeOutput, PtyListInput, PtyListOutput, PtyCreateInput, PtyCreateOutput, PtyGetInput, PtyGetOutput, PtyUpdateInput, PtyUpdateOutput, PtyRemoveInput, PtyConnectTokenInput, PtyConnectTokenOutput, ExperimentalPersistentPtyReadInput, ExperimentalPersistentPtyListInput, ExperimentalPersistentPtyCreateInput, ExperimentalPersistentPtyHandoffOutput, ExperimentalPersistentPtyGetInput, ExperimentalPersistentPtyUpdateInput, ExperimentalPersistentPtySnapshotInput, ExperimentalPersistentPtyRemoveInput, ExperimentalPersistentPtyConnectTokenInput, ShellListInput, ShellListOutput, ShellCreateInput, ShellCreateOutput, ShellGetInput, ShellGetOutput, ShellOutputInput, ShellOutputOutput, ShellRemoveInput, ReferenceListInput, ReferenceListOutput, WorktreeListInput, WorktreeCreateInput, WorktreeRemoveInput, WorktreeRefreshInput, VcsGetInput, VcsGetOutput, VcsBaseInput, VcsBaseOutput, VcsStatusInput, VcsStatusOutput, VcsBranchListInput, VcsBranchListOutput, VcsDiffInput, VcsDiffOutput, DebugLocationListOutput, DebugLocationEvictInput, MigrationV1StatusOutput, WebsearchProvidersInput, WebsearchProvidersOutput, WebsearchQueryInput, WebsearchQueryOutput, ConfigGetInput, ConfigGetOutput, ConfigShellsOutput, ConfigUpdateInput } from "./types.js";
|
|
2
2
|
export interface ClientOptions {
|
|
3
3
|
readonly baseUrl: string;
|
|
4
4
|
readonly fetch?: typeof globalThis.fetch;
|
|
@@ -138,6 +138,8 @@ export declare function make(options: ClientOptions): {
|
|
|
138
138
|
};
|
|
139
139
|
};
|
|
140
140
|
credential: {
|
|
141
|
+
list: (requestOptions?: RequestOptions) => Promise<import("./types.js").CredentialEntry[]>;
|
|
142
|
+
create: (input: CredentialCreateInput, requestOptions?: RequestOptions) => Promise<import("./types.js").CredentialEntry>;
|
|
141
143
|
update: (input: CredentialUpdateInput, requestOptions?: RequestOptions) => Promise<void>;
|
|
142
144
|
activate: (input: CredentialActivateInput, requestOptions?: RequestOptions) => Promise<void>;
|
|
143
145
|
remove: (input: CredentialRemoveInput, requestOptions?: RequestOptions) => Promise<void>;
|
|
@@ -577,6 +577,7 @@ export function make(options) {
|
|
|
577
577
|
cancel: (input, requestOptions) => request({
|
|
578
578
|
method: "DELETE",
|
|
579
579
|
path: `/api/session/${encodeURIComponent(input.sessionID)}/form/${encodeURIComponent(input.formID)}`,
|
|
580
|
+
query: { message: input["message"] },
|
|
580
581
|
successStatus: 204,
|
|
581
582
|
declaredStatuses: [400, 401, 404, 409],
|
|
582
583
|
empty: true,
|
|
@@ -812,6 +813,21 @@ export function make(options) {
|
|
|
812
813
|
},
|
|
813
814
|
},
|
|
814
815
|
credential: {
|
|
816
|
+
list: (requestOptions) => request({ method: "GET", path: `/api/credential`, successStatus: 200, declaredStatuses: [400, 401], empty: false }, requestOptions).then((value) => value.data),
|
|
817
|
+
create: (input, requestOptions) => request({
|
|
818
|
+
method: "POST",
|
|
819
|
+
path: `/api/credential`,
|
|
820
|
+
body: {
|
|
821
|
+
id: input["id"],
|
|
822
|
+
integrationID: input["integrationID"],
|
|
823
|
+
label: input["label"],
|
|
824
|
+
value: input["value"],
|
|
825
|
+
activate: input["activate"],
|
|
826
|
+
},
|
|
827
|
+
successStatus: 200,
|
|
828
|
+
declaredStatuses: [400, 401, 409],
|
|
829
|
+
empty: false,
|
|
830
|
+
}, requestOptions).then((value) => value.data),
|
|
815
831
|
update: (input, requestOptions) => request({
|
|
816
832
|
method: "PATCH",
|
|
817
833
|
path: `/api/credential/${encodeURIComponent(input.credentialID)}`,
|
|
@@ -223,6 +223,9 @@ export type SessionStructuredError = {
|
|
|
223
223
|
type: string;
|
|
224
224
|
message: string;
|
|
225
225
|
status?: number;
|
|
226
|
+
response?: {
|
|
227
|
+
body: string;
|
|
228
|
+
};
|
|
226
229
|
};
|
|
227
230
|
export type SessionMessageCompactionRunning = {
|
|
228
231
|
type: "compaction";
|
|
@@ -374,15 +377,10 @@ export type IntegrationEnvMethod = {
|
|
|
374
377
|
type: "env";
|
|
375
378
|
names: Array<string>;
|
|
376
379
|
};
|
|
377
|
-
export type
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
method: "key" | "oauth";
|
|
382
|
-
};
|
|
383
|
-
export type ConnectionEnvInfo = {
|
|
384
|
-
type: "env";
|
|
385
|
-
name: string;
|
|
380
|
+
export type ConnectionStatus = {
|
|
381
|
+
status: "needs_auth";
|
|
382
|
+
message: string;
|
|
383
|
+
url?: string;
|
|
386
384
|
};
|
|
387
385
|
export type IntegrationAttempt = {
|
|
388
386
|
attemptID: string;
|
|
@@ -485,6 +483,16 @@ export type McpResourceTemplate = {
|
|
|
485
483
|
description?: string;
|
|
486
484
|
mimeType?: string;
|
|
487
485
|
};
|
|
486
|
+
export type CredentialOAuth = {
|
|
487
|
+
type: "oauth";
|
|
488
|
+
methodID: string;
|
|
489
|
+
refresh: string;
|
|
490
|
+
access: string;
|
|
491
|
+
expires: number;
|
|
492
|
+
metadata?: {
|
|
493
|
+
[x: string]: JsonValue;
|
|
494
|
+
};
|
|
495
|
+
};
|
|
488
496
|
export type ProjectVcs = string;
|
|
489
497
|
export type ProjectIcon = {
|
|
490
498
|
url?: string;
|
|
@@ -2202,7 +2210,18 @@ export type ModelCost = {
|
|
|
2202
2210
|
write: MoneyUSDPerMillionTokens;
|
|
2203
2211
|
};
|
|
2204
2212
|
};
|
|
2205
|
-
export type
|
|
2213
|
+
export type ConnectionCredentialInfo = {
|
|
2214
|
+
type: "credential";
|
|
2215
|
+
id: string;
|
|
2216
|
+
label: string;
|
|
2217
|
+
method: "key" | "oauth";
|
|
2218
|
+
status?: ConnectionStatus;
|
|
2219
|
+
};
|
|
2220
|
+
export type ConnectionEnvInfo = {
|
|
2221
|
+
type: "env";
|
|
2222
|
+
name: string;
|
|
2223
|
+
status?: ConnectionStatus;
|
|
2224
|
+
};
|
|
2206
2225
|
export type McpServer = {
|
|
2207
2226
|
name: string;
|
|
2208
2227
|
status: McpStatusConnected | McpStatusPending | McpStatusDisabled | McpStatusFailed | McpStatusNeedsAuth;
|
|
@@ -2399,7 +2418,7 @@ export type FormMultiselectField1 = {
|
|
|
2399
2418
|
custom?: boolean;
|
|
2400
2419
|
default?: Array<string>;
|
|
2401
2420
|
};
|
|
2402
|
-
export type
|
|
2421
|
+
export type FormAnswer2 = {
|
|
2403
2422
|
[x: string]: FormValue1;
|
|
2404
2423
|
};
|
|
2405
2424
|
export type SessionStatusUpdated = {
|
|
@@ -2701,7 +2720,17 @@ export type FormState = {
|
|
|
2701
2720
|
answer: FormAnswer;
|
|
2702
2721
|
} | {
|
|
2703
2722
|
status: "cancelled";
|
|
2723
|
+
message?: string;
|
|
2724
|
+
};
|
|
2725
|
+
export type CredentialKey = {
|
|
2726
|
+
type: "key";
|
|
2727
|
+
key: string;
|
|
2728
|
+
metadata?: {
|
|
2729
|
+
[x: string]: JsonValue;
|
|
2730
|
+
};
|
|
2731
|
+
configuration?: FormAnswer;
|
|
2704
2732
|
};
|
|
2733
|
+
export type ConnectionInfo = ConnectionCredentialInfo | ConnectionEnvInfo;
|
|
2705
2734
|
export type FormField1 = FormStringField1 | FormNumberField1 | FormIntegerField1 | FormBooleanField1 | FormMultiselectField1 | FormExternalField;
|
|
2706
2735
|
export type FormReplied = {
|
|
2707
2736
|
id: string;
|
|
@@ -2714,7 +2743,7 @@ export type FormReplied = {
|
|
|
2714
2743
|
data: {
|
|
2715
2744
|
id: string;
|
|
2716
2745
|
sessionID: string;
|
|
2717
|
-
answer:
|
|
2746
|
+
answer: FormAnswer2;
|
|
2718
2747
|
};
|
|
2719
2748
|
};
|
|
2720
2749
|
export type ReferenceInfo = {
|
|
@@ -3164,6 +3193,7 @@ export type SessionMessageAssistantTool1 = {
|
|
|
3164
3193
|
};
|
|
3165
3194
|
};
|
|
3166
3195
|
export type FormFields = [FormField, ...Array<FormField>];
|
|
3196
|
+
export type CredentialValue = CredentialOAuth | CredentialKey;
|
|
3167
3197
|
export type FormFields2 = [FormField1, ...Array<FormField1>];
|
|
3168
3198
|
export type SessionsResponse = {
|
|
3169
3199
|
data: Array<SessionInfo>;
|
|
@@ -3246,6 +3276,13 @@ export type IntegrationKeyMethod = {
|
|
|
3246
3276
|
label?: string;
|
|
3247
3277
|
form?: FormFields;
|
|
3248
3278
|
};
|
|
3279
|
+
export type CredentialEntry = {
|
|
3280
|
+
id: string;
|
|
3281
|
+
integrationID: string;
|
|
3282
|
+
label: string;
|
|
3283
|
+
active: boolean;
|
|
3284
|
+
value: CredentialValue;
|
|
3285
|
+
};
|
|
3249
3286
|
export type FormInfo1 = {
|
|
3250
3287
|
id: string;
|
|
3251
3288
|
sessionID: string;
|
|
@@ -4162,6 +4199,9 @@ export type SessionImportInput = {
|
|
|
4162
4199
|
readonly type: string;
|
|
4163
4200
|
readonly message: string;
|
|
4164
4201
|
readonly status?: number;
|
|
4202
|
+
readonly response?: {
|
|
4203
|
+
readonly body: string;
|
|
4204
|
+
};
|
|
4165
4205
|
};
|
|
4166
4206
|
readonly content?: readonly [
|
|
4167
4207
|
({
|
|
@@ -4217,6 +4257,9 @@ export type SessionImportInput = {
|
|
|
4217
4257
|
readonly type: string;
|
|
4218
4258
|
readonly message: string;
|
|
4219
4259
|
readonly status?: number;
|
|
4260
|
+
readonly response?: {
|
|
4261
|
+
readonly body: string;
|
|
4262
|
+
};
|
|
4220
4263
|
};
|
|
4221
4264
|
readonly retry?: {
|
|
4222
4265
|
readonly attempt: number;
|
|
@@ -4225,6 +4268,9 @@ export type SessionImportInput = {
|
|
|
4225
4268
|
readonly type: string;
|
|
4226
4269
|
readonly message: string;
|
|
4227
4270
|
readonly status?: number;
|
|
4271
|
+
readonly response?: {
|
|
4272
|
+
readonly body: string;
|
|
4273
|
+
};
|
|
4228
4274
|
};
|
|
4229
4275
|
};
|
|
4230
4276
|
} | ({
|
|
@@ -4298,6 +4344,9 @@ export type SessionImportInput = {
|
|
|
4298
4344
|
readonly type: string;
|
|
4299
4345
|
readonly message: string;
|
|
4300
4346
|
readonly status?: number;
|
|
4347
|
+
readonly response?: {
|
|
4348
|
+
readonly body: string;
|
|
4349
|
+
};
|
|
4301
4350
|
};
|
|
4302
4351
|
readonly cost?: number;
|
|
4303
4352
|
readonly tokens?: {
|
|
@@ -4631,6 +4680,9 @@ export type SessionImportInput = {
|
|
|
4631
4680
|
readonly type: string;
|
|
4632
4681
|
readonly message: string;
|
|
4633
4682
|
readonly status?: number;
|
|
4683
|
+
readonly response?: {
|
|
4684
|
+
readonly body: string;
|
|
4685
|
+
};
|
|
4634
4686
|
};
|
|
4635
4687
|
readonly content?: readonly [
|
|
4636
4688
|
({
|
|
@@ -4686,6 +4738,9 @@ export type SessionImportInput = {
|
|
|
4686
4738
|
readonly type: string;
|
|
4687
4739
|
readonly message: string;
|
|
4688
4740
|
readonly status?: number;
|
|
4741
|
+
readonly response?: {
|
|
4742
|
+
readonly body: string;
|
|
4743
|
+
};
|
|
4689
4744
|
};
|
|
4690
4745
|
readonly retry?: {
|
|
4691
4746
|
readonly attempt: number;
|
|
@@ -4694,6 +4749,9 @@ export type SessionImportInput = {
|
|
|
4694
4749
|
readonly type: string;
|
|
4695
4750
|
readonly message: string;
|
|
4696
4751
|
readonly status?: number;
|
|
4752
|
+
readonly response?: {
|
|
4753
|
+
readonly body: string;
|
|
4754
|
+
};
|
|
4697
4755
|
};
|
|
4698
4756
|
};
|
|
4699
4757
|
} | ({
|
|
@@ -4767,6 +4825,9 @@ export type SessionImportInput = {
|
|
|
4767
4825
|
readonly type: string;
|
|
4768
4826
|
readonly message: string;
|
|
4769
4827
|
readonly status?: number;
|
|
4828
|
+
readonly response?: {
|
|
4829
|
+
readonly body: string;
|
|
4830
|
+
};
|
|
4770
4831
|
};
|
|
4771
4832
|
readonly cost?: number;
|
|
4772
4833
|
readonly tokens?: {
|
|
@@ -5100,6 +5161,9 @@ export type SessionImportInput = {
|
|
|
5100
5161
|
readonly type: string;
|
|
5101
5162
|
readonly message: string;
|
|
5102
5163
|
readonly status?: number;
|
|
5164
|
+
readonly response?: {
|
|
5165
|
+
readonly body: string;
|
|
5166
|
+
};
|
|
5103
5167
|
};
|
|
5104
5168
|
readonly content?: readonly [
|
|
5105
5169
|
({
|
|
@@ -5155,6 +5219,9 @@ export type SessionImportInput = {
|
|
|
5155
5219
|
readonly type: string;
|
|
5156
5220
|
readonly message: string;
|
|
5157
5221
|
readonly status?: number;
|
|
5222
|
+
readonly response?: {
|
|
5223
|
+
readonly body: string;
|
|
5224
|
+
};
|
|
5158
5225
|
};
|
|
5159
5226
|
readonly retry?: {
|
|
5160
5227
|
readonly attempt: number;
|
|
@@ -5163,6 +5230,9 @@ export type SessionImportInput = {
|
|
|
5163
5230
|
readonly type: string;
|
|
5164
5231
|
readonly message: string;
|
|
5165
5232
|
readonly status?: number;
|
|
5233
|
+
readonly response?: {
|
|
5234
|
+
readonly body: string;
|
|
5235
|
+
};
|
|
5166
5236
|
};
|
|
5167
5237
|
};
|
|
5168
5238
|
} | ({
|
|
@@ -5236,6 +5306,9 @@ export type SessionImportInput = {
|
|
|
5236
5306
|
readonly type: string;
|
|
5237
5307
|
readonly message: string;
|
|
5238
5308
|
readonly status?: number;
|
|
5309
|
+
readonly response?: {
|
|
5310
|
+
readonly body: string;
|
|
5311
|
+
};
|
|
5239
5312
|
};
|
|
5240
5313
|
readonly cost?: number;
|
|
5241
5314
|
readonly tokens?: {
|
|
@@ -7006,6 +7079,9 @@ export type SessionFormCancelInput = {
|
|
|
7006
7079
|
readonly sessionID: string;
|
|
7007
7080
|
readonly formID: string;
|
|
7008
7081
|
}["formID"];
|
|
7082
|
+
readonly message?: {
|
|
7083
|
+
readonly message?: string | undefined;
|
|
7084
|
+
}["message"];
|
|
7009
7085
|
};
|
|
7010
7086
|
export type SessionFormCancelOutput = void;
|
|
7011
7087
|
export type SessionEnvironmentInput = {
|
|
@@ -7444,6 +7520,139 @@ export type McpResourceCatalogOutput = {
|
|
|
7444
7520
|
location: LocationPublicRef;
|
|
7445
7521
|
data: McpResourceCatalog;
|
|
7446
7522
|
};
|
|
7523
|
+
export type CredentialListOutput = {
|
|
7524
|
+
data: Array<CredentialEntry>;
|
|
7525
|
+
}["data"];
|
|
7526
|
+
export type CredentialCreateInput = {
|
|
7527
|
+
readonly id?: {
|
|
7528
|
+
readonly id?: string;
|
|
7529
|
+
readonly integrationID: string;
|
|
7530
|
+
readonly label?: string;
|
|
7531
|
+
readonly value: {
|
|
7532
|
+
readonly type: "oauth";
|
|
7533
|
+
readonly methodID: string;
|
|
7534
|
+
readonly refresh: string;
|
|
7535
|
+
readonly access: string;
|
|
7536
|
+
readonly expires: number;
|
|
7537
|
+
readonly metadata?: {
|
|
7538
|
+
readonly [x: string]: JsonValue;
|
|
7539
|
+
};
|
|
7540
|
+
} | {
|
|
7541
|
+
readonly type: "key";
|
|
7542
|
+
readonly key: string;
|
|
7543
|
+
readonly metadata?: {
|
|
7544
|
+
readonly [x: string]: JsonValue;
|
|
7545
|
+
};
|
|
7546
|
+
readonly configuration?: {
|
|
7547
|
+
readonly [x: string]: string | number | "Infinity" | "-Infinity" | "NaN" | boolean | ReadonlyArray<string>;
|
|
7548
|
+
};
|
|
7549
|
+
};
|
|
7550
|
+
readonly activate?: boolean;
|
|
7551
|
+
}["id"];
|
|
7552
|
+
readonly integrationID: {
|
|
7553
|
+
readonly id?: string;
|
|
7554
|
+
readonly integrationID: string;
|
|
7555
|
+
readonly label?: string;
|
|
7556
|
+
readonly value: {
|
|
7557
|
+
readonly type: "oauth";
|
|
7558
|
+
readonly methodID: string;
|
|
7559
|
+
readonly refresh: string;
|
|
7560
|
+
readonly access: string;
|
|
7561
|
+
readonly expires: number;
|
|
7562
|
+
readonly metadata?: {
|
|
7563
|
+
readonly [x: string]: JsonValue;
|
|
7564
|
+
};
|
|
7565
|
+
} | {
|
|
7566
|
+
readonly type: "key";
|
|
7567
|
+
readonly key: string;
|
|
7568
|
+
readonly metadata?: {
|
|
7569
|
+
readonly [x: string]: JsonValue;
|
|
7570
|
+
};
|
|
7571
|
+
readonly configuration?: {
|
|
7572
|
+
readonly [x: string]: string | number | "Infinity" | "-Infinity" | "NaN" | boolean | ReadonlyArray<string>;
|
|
7573
|
+
};
|
|
7574
|
+
};
|
|
7575
|
+
readonly activate?: boolean;
|
|
7576
|
+
}["integrationID"];
|
|
7577
|
+
readonly label?: {
|
|
7578
|
+
readonly id?: string;
|
|
7579
|
+
readonly integrationID: string;
|
|
7580
|
+
readonly label?: string;
|
|
7581
|
+
readonly value: {
|
|
7582
|
+
readonly type: "oauth";
|
|
7583
|
+
readonly methodID: string;
|
|
7584
|
+
readonly refresh: string;
|
|
7585
|
+
readonly access: string;
|
|
7586
|
+
readonly expires: number;
|
|
7587
|
+
readonly metadata?: {
|
|
7588
|
+
readonly [x: string]: JsonValue;
|
|
7589
|
+
};
|
|
7590
|
+
} | {
|
|
7591
|
+
readonly type: "key";
|
|
7592
|
+
readonly key: string;
|
|
7593
|
+
readonly metadata?: {
|
|
7594
|
+
readonly [x: string]: JsonValue;
|
|
7595
|
+
};
|
|
7596
|
+
readonly configuration?: {
|
|
7597
|
+
readonly [x: string]: string | number | "Infinity" | "-Infinity" | "NaN" | boolean | ReadonlyArray<string>;
|
|
7598
|
+
};
|
|
7599
|
+
};
|
|
7600
|
+
readonly activate?: boolean;
|
|
7601
|
+
}["label"];
|
|
7602
|
+
readonly value: {
|
|
7603
|
+
readonly id?: string;
|
|
7604
|
+
readonly integrationID: string;
|
|
7605
|
+
readonly label?: string;
|
|
7606
|
+
readonly value: {
|
|
7607
|
+
readonly type: "oauth";
|
|
7608
|
+
readonly methodID: string;
|
|
7609
|
+
readonly refresh: string;
|
|
7610
|
+
readonly access: string;
|
|
7611
|
+
readonly expires: number;
|
|
7612
|
+
readonly metadata?: {
|
|
7613
|
+
readonly [x: string]: JsonValue;
|
|
7614
|
+
};
|
|
7615
|
+
} | {
|
|
7616
|
+
readonly type: "key";
|
|
7617
|
+
readonly key: string;
|
|
7618
|
+
readonly metadata?: {
|
|
7619
|
+
readonly [x: string]: JsonValue;
|
|
7620
|
+
};
|
|
7621
|
+
readonly configuration?: {
|
|
7622
|
+
readonly [x: string]: string | number | "Infinity" | "-Infinity" | "NaN" | boolean | ReadonlyArray<string>;
|
|
7623
|
+
};
|
|
7624
|
+
};
|
|
7625
|
+
readonly activate?: boolean;
|
|
7626
|
+
}["value"];
|
|
7627
|
+
readonly activate?: {
|
|
7628
|
+
readonly id?: string;
|
|
7629
|
+
readonly integrationID: string;
|
|
7630
|
+
readonly label?: string;
|
|
7631
|
+
readonly value: {
|
|
7632
|
+
readonly type: "oauth";
|
|
7633
|
+
readonly methodID: string;
|
|
7634
|
+
readonly refresh: string;
|
|
7635
|
+
readonly access: string;
|
|
7636
|
+
readonly expires: number;
|
|
7637
|
+
readonly metadata?: {
|
|
7638
|
+
readonly [x: string]: JsonValue;
|
|
7639
|
+
};
|
|
7640
|
+
} | {
|
|
7641
|
+
readonly type: "key";
|
|
7642
|
+
readonly key: string;
|
|
7643
|
+
readonly metadata?: {
|
|
7644
|
+
readonly [x: string]: JsonValue;
|
|
7645
|
+
};
|
|
7646
|
+
readonly configuration?: {
|
|
7647
|
+
readonly [x: string]: string | number | "Infinity" | "-Infinity" | "NaN" | boolean | ReadonlyArray<string>;
|
|
7648
|
+
};
|
|
7649
|
+
};
|
|
7650
|
+
readonly activate?: boolean;
|
|
7651
|
+
}["activate"];
|
|
7652
|
+
};
|
|
7653
|
+
export type CredentialCreateOutput = {
|
|
7654
|
+
data: CredentialEntry;
|
|
7655
|
+
}["data"];
|
|
7447
7656
|
export type CredentialUpdateInput = {
|
|
7448
7657
|
readonly credentialID: {
|
|
7449
7658
|
readonly credentialID: string;
|
package/client/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var A=Object.defineProperty;var E=(t)=>t;function q(t,a){this[t]=E.bind(null,a)}var w=(t,a)=>{for(var s in a)A(t,s,{get:a[s],enumerable:!0,configurable:!0,set:q.bind(a,s)})};class c extends Error{reason;name="ClientError";constructor(t,a){let s=a?.detail??(a?.cause instanceof Error?a.cause.message:void 0);super(s?`${t}: ${s}`:t,a);this.reason=t}}var L=16777216;function F(t){let a=t.fetch??globalThis.fetch,s=(e,n)=>{let o=new URL(t.baseUrl);if(!o.pathname.endsWith("/"))o.pathname+="/";let i=new URL(e.path.slice(1),o);for(let[d,y]of Object.entries(e.query??{}))h(i.searchParams,d,y);let m=new Headers(t.headers);for(let[d,y]of Object.entries(e.headers??{}))if(y!==void 0&&y!==null)m.set(d,String(y));for(let[d,y]of new Headers(n?.headers))m.set(d,y);if(e.body!==void 0&&!m.has("content-type"))m.set("content-type",e.binaryBody?"application/octet-stream":"application/json");return{url:i,init:{method:e.method,signal:n?.signal,headers:m,body:e.body===void 0?void 0:e.binaryBody?e.body:JSON.stringify(e.body)}}},g=async(e,n)=>{try{let o=s(e,n);return await a(o.url,o.init)}catch(o){throw new c("Transport",{cause:o})}},p=async(e,n)=>{if(n.declaredStatuses.includes(e.status))throw
|
|
1
|
+
var A=Object.defineProperty;var E=(t)=>t;function q(t,a){this[t]=E.bind(null,a)}var w=(t,a)=>{for(var s in a)A(t,s,{get:a[s],enumerable:!0,configurable:!0,set:q.bind(a,s)})};class c extends Error{reason;name="ClientError";constructor(t,a){let s=a?.detail??(a?.cause instanceof Error?a.cause.message:void 0);super(s?`${t}: ${s}`:t,a);this.reason=t}}var L=16777216;function F(t){let a=t.fetch??globalThis.fetch,s=(e,n)=>{let o=new URL(t.baseUrl);if(!o.pathname.endsWith("/"))o.pathname+="/";let i=new URL(e.path.slice(1),o);for(let[d,y]of Object.entries(e.query??{}))h(i.searchParams,d,y);let m=new Headers(t.headers);for(let[d,y]of Object.entries(e.headers??{}))if(y!==void 0&&y!==null)m.set(d,String(y));for(let[d,y]of new Headers(n?.headers))m.set(d,y);if(e.body!==void 0&&!m.has("content-type"))m.set("content-type",e.binaryBody?"application/octet-stream":"application/json");return{url:i,init:{method:e.method,signal:n?.signal,headers:m,body:e.body===void 0?void 0:e.binaryBody?e.body:JSON.stringify(e.body)}}},g=async(e,n)=>{try{let o=s(e,n);return await a(o.url,o.init)}catch(o){throw new c("Transport",{cause:o})}},p=async(e,n)=>{if(n.declaredStatuses.includes(e.status))throw N(await R(e));try{await e.body?.cancel()}catch{}throw new c("UnexpectedStatus",{cause:{status:e.status},detail:String(e.status)})},r=async(e,n)=>{let o=await g(e,n);if(o.status!==e.successStatus)return p(o,e);if(e.binary)return new Uint8Array(await o.arrayBuffer());if(e.empty){try{await o.body?.cancel()}catch{}return}return await R(o)},l=(e,n)=>({async*[Symbol.asyncIterator](){let o=await g(e,n);if(o.status!==e.successStatus)await p(o,e);if(!D(o,"text/event-stream")){try{await o.body?.cancel()}catch{}throw new c("UnsupportedContentType",{detail:o.headers.get("content-type")})}if(o.body===null)throw new c("MalformedResponse");let i=o.body.getReader(),m=new TextDecoder,d="";try{while(!0){let y;try{y=await i.read()}catch(I){throw new c("Transport",{cause:I})}if(!y.done)n?.onActivity?.();if(d+=m.decode(y.value,{stream:!y.done}),d.length>L)throw new c("SseEventTooLarge");let f=!y.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(y.done&&d!=="")d+=`
|
|
@@ -9,4 +9,4 @@ var A=Object.defineProperty;var E=(t)=>t;function q(t,a){this[t]=E.bind(null,a)}
|
|
|
9
9
|
`).flatMap((x)=>x.startsWith("data:")?[x.slice(5).trimStart()]:[]).join(`
|
|
10
10
|
`);if(b!=="")try{yield JSON.parse(b)}catch(x){throw new c("MalformedResponse",{cause:x})}u=d.indexOf(`
|
|
11
11
|
|
|
12
|
-
`)}if(y.done)return}}finally{try{await i.cancel()}catch{}i.releaseLock()}}});return{server:{info:(e)=>r({method:"GET",path:"/api/info",successStatus:200,declaredStatuses:[400,401],empty:!1},e),pair:(e)=>r({method:"POST",path:"/api/pair",successStatus:200,declaredStatuses:[400,401],empty:!1},e),connect:(e,n)=>r({method:"GET",path:`/auth/connect/${encodeURIComponent(e.code)}`,successStatus:200,declaredStatuses:[400,401],empty:!1},n)},location:{get:(e,n)=>r({method:"GET",path:"/api/location",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n),reload:(e)=>r({method:"POST",path:"/api/location/reload",successStatus:204,declaredStatuses:[400,401,503],empty:!0},e)},agent:{list:(e,n)=>r({method:"GET",path:"/api/agent",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n),get:(e,n)=>r({method:"GET",path:`/api/agent/${encodeURIComponent(e.agentID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},n)},plugin:{list:(e,n)=>r({method:"GET",path:"/api/plugin",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n),check:(e,n)=>r({method:"POST",path:"/api/plugin/check",query:{location:e?.location},body:{target:e?.target},successStatus:200,declaredStatuses:[400,401],empty:!1},n),update:(e,n)=>r({method:"POST",path:"/api/plugin/update",query:{location:e.location},body:{targets:e.targets},successStatus:204,declaredStatuses:[400,401,503],empty:!0},n)},session:{list:(e,n)=>r({method:"GET",path:"/api/session",query:{limit:e?.limit,order:e?.order,search:e?.search,parentID:e?.parentID,directory:e?.directory,project:e?.project,subpath:e?.subpath,cursor:e?.cursor},successStatus:200,declaredStatuses:[400,401],empty:!1},n),stats:(e,n)=>r({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},n).then((o)=>o.data),create:(e,n)=>r({method:"POST",path:"/api/session",body:{id:e?.id,title:e?.title,agent:e?.agent,model:e?.model,location:e?.location,metadata:e?.metadata,permissions:e?.permissions},successStatus:200,declaredStatuses:[400,401],empty:!1},n).then((o)=>o.data),import:(e,n)=>r({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},n).then((o)=>o.data),export:(e,n)=>r({method:"GET",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/export`,query:{sanitize:e.sanitize},successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},n).then((o)=>o.data),active:(e)=>r({method:"GET",path:"/api/session/active",successStatus:200,declaredStatuses:[400,401],empty:!1},e).then((n)=>n.data),get:(e,n)=>r({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},n).then((o)=>o.data),remove:(e,n)=>r({method:"DELETE",path:`/api/session/${encodeURIComponent(e.sessionID)}`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),fork:(e,n)=>r({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/fork`,body:{before:e.before},successStatus:200,declaredStatuses:[400,401,404],empty:!1},n).then((o)=>o.data),switchAgent:(e,n)=>r({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/agent`,body:{agent:e.agent},successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),switchModel:(e,n)=>r({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/model`,body:{model:e.model},successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),update:(e,n)=>r({method:"PATCH",path:`/api/session/${encodeURIComponent(e.sessionID)}`,body:{title:e.title,metadata:e.metadata,permissions:e.permissions},successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),move:(e,n)=>r({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/move`,body:{directory:e.directory,delivery:e.delivery},successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),prompt:(e,n)=>r({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},n).then((o)=>o.data),command:(e,n)=>r({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},n),skill:(e,n)=>r({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},n),synthetic:(e,n)=>r({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},n).then((o)=>o.data),shell:(e,n)=>r({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/shell`,body:{id:e.id,command:e.command},successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),compact:(e,n)=>r({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},n).then((o)=>o.data),wait:(e,n)=>r({method:"POST",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/wait`,successStatus:204,declaredStatuses:[400,401,404,503],empty:!0},n),revert:{stage:(e,n)=>r({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},n).then((o)=>o.data),clear:(e,n)=>r({method:"DELETE",path:`/api/session/${encodeURIComponent(e.sessionID)}/revert`,successStatus:204,declaredStatuses:[400,401,404,409,500],empty:!0},n),commit:(e,n)=>r({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/revert/commit`,successStatus:204,declaredStatuses:[400,401,404,409],empty:!0},n)},context:(e,n)=>r({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/context`,successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},n).then((o)=>o.data),diff:(e,n)=>r({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},n).then((o)=>o.data),inbox:{list:(e,n)=>r({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/inbox`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},n).then((o)=>o.data),cancel:(e,n)=>r({method:"DELETE",path:`/api/session/${encodeURIComponent(e.sessionID)}/inbox/${encodeURIComponent(e.inboxID)}`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),update:(e,n)=>r({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},n)},instructions:{entry:{list:(e,n)=>r({method:"GET",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/instructions/entries`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},n).then((o)=>o.data),put:(e,n)=>r({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},n),remove:(e,n)=>r({method:"DELETE",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/instructions/entries/${encodeURIComponent(e.key)}`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},n)}},generate:(e,n)=>r({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/generate`,body:{prompt:e.prompt},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},n).then((o)=>o.data),log:(e,n)=>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},n),interrupt:(e,n)=>r({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/interrupt`,query:{resume:e.resume},successStatus:200,declaredStatuses:[400,401,404],empty:!1},n),background:(e,n)=>r({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/background`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),message:{get:(e,n)=>r({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/message/${encodeURIComponent(e.messageID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},n).then((o)=>o.data)},form:{list:(e,n)=>r({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/form`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},n).then((o)=>o.data),create:(e,n)=>r({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},n).then((o)=>o.data),get:(e,n)=>r({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/form/${encodeURIComponent(e.formID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},n).then((o)=>o.data),reply:(e,n)=>r({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},n),cancel:(e,n)=>r({method:"DELETE",path:`/api/session/${encodeURIComponent(e.sessionID)}/form/${encodeURIComponent(e.formID)}`,successStatus:204,declaredStatuses:[400,401,404,409],empty:!0},n)},environment:(e,n)=>r({method:"PUT",path:`/api/session/${encodeURIComponent(e.sessionID)}/environment`,body:{variables:e.variables},successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),view:(e,n)=>r({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/view`,body:{idle:e.idle},successStatus:204,declaredStatuses:[400,401,404],empty:!0},n)},message:{list:(e,n)=>r({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},n)},model:{list:(e,n)=>r({method:"GET",path:"/api/model",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,503],empty:!1},n),default:(e,n)=>r({method:"GET",path:"/api/model/default",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,503],empty:!1},n)},generate:{text:(e,n)=>r({method:"POST",path:"/api/experimental/generate",body:{prompt:e.prompt,model:e.model},successStatus:200,declaredStatuses:[400,401,503],empty:!1},n).then((o)=>o.data)},provider:{list:(e,n)=>r({method:"GET",path:"/api/provider",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,503],empty:!1},n),get:(e,n)=>r({method:"GET",path:`/api/provider/${encodeURIComponent(e.providerID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},n)},integration:{list:(e,n)=>r({method:"GET",path:"/api/integration",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n),get:(e,n)=>r({method:"GET",path:`/api/integration/${encodeURIComponent(e.integrationID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},n),wellknown:{add:(e,n)=>r({method:"POST",path:"/api/experimental/integration/wellknown",query:{location:e.location},body:{url:e.url},successStatus:204,declaredStatuses:[400,401],empty:!0},n)},connect:{key:(e,n)=>r({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},n)},oauth:{connect:(e,n)=>r({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],empty:!1},n),status:(e,n)=>r({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},n),complete:(e,n)=>r({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},n),cancel:(e,n)=>r({method:"DELETE",path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/oauth/${encodeURIComponent(e.attemptID)}`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401],empty:!0},n)},command:{connect:(e,n)=>r({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},n),status:(e,n)=>r({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},n),cancel:(e,n)=>r({method:"DELETE",path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/command/${encodeURIComponent(e.attemptID)}`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401],empty:!0},n)}},mcp:{list:(e,n)=>r({method:"GET",path:"/api/mcp",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n),add:(e,n)=>r({method:"PUT",path:`/api/experimental/mcp/${encodeURIComponent(e.server)}`,query:{location:e.location},body:{config:e.config},successStatus:204,declaredStatuses:[400,401],empty:!0},n),remove:(e,n)=>r({method:"DELETE",path:`/api/experimental/mcp/${encodeURIComponent(e.server)}`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),connect:(e,n)=>r({method:"POST",path:`/api/experimental/mcp/${encodeURIComponent(e.server)}/connect`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),disconnect:(e,n)=>r({method:"POST",path:`/api/experimental/mcp/${encodeURIComponent(e.server)}/disconnect`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),resource:{catalog:(e,n)=>r({method:"GET",path:"/api/mcp/resource",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n)}},credential:{update:(e,n)=>r({method:"PATCH",path:`/api/credential/${encodeURIComponent(e.credentialID)}`,body:{label:e.label},successStatus:204,declaredStatuses:[400,401],empty:!0},n),activate:(e,n)=>r({method:"POST",path:`/api/credential/${encodeURIComponent(e.credentialID)}/activate`,successStatus:204,declaredStatuses:[400,401],empty:!0},n),remove:(e,n)=>r({method:"DELETE",path:`/api/credential/${encodeURIComponent(e.credentialID)}`,successStatus:204,declaredStatuses:[400,401],empty:!0},n)},project:{list:(e)=>r({method:"GET",path:"/api/project",successStatus:200,declaredStatuses:[400,401],empty:!1},e),update:(e,n)=>r({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},n)},form:{list:(e,n)=>r({method:"GET",path:"/api/form",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n)},permission:{request:{list:(e,n)=>r({method:"GET",path:"/api/permission/request",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n)},saved:{list:(e,n)=>r({method:"GET",path:"/api/permission/saved",query:{projectID:e?.projectID},successStatus:200,declaredStatuses:[400,401],empty:!1},n).then((o)=>o.data),remove:(e,n)=>r({method:"DELETE",path:`/api/permission/saved/${encodeURIComponent(e.id)}`,successStatus:204,declaredStatuses:[400,401],empty:!0},n)},create:(e,n)=>r({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},n).then((o)=>o.data),list:(e,n)=>r({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/permission`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},n).then((o)=>o.data),get:(e,n)=>r({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/permission/${encodeURIComponent(e.requestID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},n).then((o)=>o.data),reply:(e,n)=>r({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},n)},file:{read:(e,n)=>r({method:"GET",path:`/api/fs/read/${M(e.path)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1,binary:!0},n),list:(e,n)=>r({method:"GET",path:"/api/fs/list",query:{location:e?.location,path:e?.path},successStatus:200,declaredStatuses:[400,401],empty:!1},n),find:(e,n)=>r({method:"GET",path:"/api/fs/find",query:{location:e.location,query:e.query,type:e.type,limit:e.limit},successStatus:200,declaredStatuses:[400,401],empty:!1},n),write:(e,n)=>r({method:"POST",path:"/api/experimental/fs/write",query:{location:e.location,path:e.path},body:e.payload,successStatus:200,declaredStatuses:[400,401],empty:!1,binaryBody:!0},n)},command:{list:(e,n)=>r({method:"GET",path:"/api/command",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n)},skill:{list:(e,n)=>r({method:"GET",path:"/api/skill",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n)},rpc:{call:(e,n)=>r({method:"POST",path:`/api/rpc/${encodeURIComponent(e.rpcID)}/${encodeURIComponent(e.method)}`,query:{location:e.location},body:{input:e.input},successStatus:200,declaredStatuses:[400,401,500],empty:!1},n)},event:{subscribe:(e)=>l({method:"GET",path:"/api/event",successStatus:200,declaredStatuses:[400,401],empty:!1},e)},pty:{list:(e,n)=>r({method:"GET",path:"/api/pty",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n),create:(e,n)=>r({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],empty:!1},n),get:(e,n)=>r({method:"GET",path:`/api/pty/${encodeURIComponent(e.ptyID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},n),update:(e,n)=>r({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},n),remove:(e,n)=>r({method:"DELETE",path:`/api/pty/${encodeURIComponent(e.ptyID)}`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),connect:{token:(e,n)=>r({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},n)}},experimental:{persistentPty:{read:(e,n)=>r({method:"GET",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/terminal/read`,query:{lines:e.lines},successStatus:200,declaredStatuses:[400,401,503],empty:!1},n).then((o)=>o.data),list:(e,n)=>r({method:"GET",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/terminal`,successStatus:200,declaredStatuses:[400,401,503],empty:!1},n).then((o)=>o.data),create:(e,n)=>r({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},n).then((o)=>o.data),shutdown:(e)=>r({method:"POST",path:"/api/experimental/persistent-pty/shutdown",successStatus:204,declaredStatuses:[400,401,503],empty:!0},e),handoff:(e)=>r({method:"POST",path:"/api/experimental/persistent-pty/handoff",successStatus:200,declaredStatuses:[400,401,503],empty:!1},e),get:(e,n)=>r({method:"GET",path:`/api/experimental/persistent-pty/${encodeURIComponent(e.ptyID)}`,successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},n).then((o)=>o.data),update:(e,n)=>r({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},n).then((o)=>o.data),snapshot:(e,n)=>r({method:"GET",path:`/api/experimental/persistent-pty/${encodeURIComponent(e.ptyID)}/snapshot`,successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},n).then((o)=>o.data),remove:(e,n)=>r({method:"DELETE",path:`/api/experimental/persistent-pty/${encodeURIComponent(e.ptyID)}`,successStatus:204,declaredStatuses:[400,401,404,503],empty:!0},n),connectToken:(e,n)=>r({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},n).then((o)=>o.data)}},shell:{list:(e,n)=>r({method:"GET",path:"/api/shell",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n),create:(e,n)=>r({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],empty:!1},n),get:(e,n)=>r({method:"GET",path:`/api/shell/${encodeURIComponent(e.id)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},n),output:(e,n)=>r({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},n),remove:(e,n)=>r({method:"DELETE",path:`/api/shell/${encodeURIComponent(e.id)}`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401],empty:!0},n)},reference:{list:(e,n)=>r({method:"GET",path:"/api/reference",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n)},worktree:{list:(e,n)=>r({method:"GET",path:"/api/worktree",query:{projectID:e.projectID},successStatus:200,declaredStatuses:[400,401,404],empty:!1},n),create:(e,n)=>r({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},n),remove:(e,n)=>r({method:"DELETE",path:"/api/worktree",body:{projectID:e.projectID,directory:e.directory,force:e.force},successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),refresh:(e,n)=>r({method:"POST",path:"/api/worktree/refresh",body:{projectID:e.projectID},successStatus:204,declaredStatuses:[400,401,404],empty:!0},n)},vcs:{get:(e,n)=>r({method:"GET",path:"/api/vcs",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n),base:(e,n)=>r({method:"GET",path:"/api/vcs/base",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,503],empty:!1},n),status:(e,n)=>r({method:"GET",path:"/api/vcs/status",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n),branch:{list:(e,n)=>r({method:"GET",path:"/api/vcs/branch",query:{location:e?.location,search:e?.search,limit:e?.limit},successStatus:200,declaredStatuses:[400,401],empty:!1},n)},diff:(e,n)=>r({method:"GET",path:"/api/vcs/diff",query:{location:e.location,mode:e.mode,base:e.base,context:e.context},successStatus:200,declaredStatuses:[400,401,503],empty:!1},n)},debug:{location:{list:(e)=>r({method:"GET",path:"/api/debug/location",successStatus:200,declaredStatuses:[400,401],empty:!1},e),evict:(e,n)=>r({method:"DELETE",path:"/api/debug/location",query:{location:e?.location},successStatus:204,declaredStatuses:[400,401],empty:!0},n)}},migration:{v1:{status:(e)=>r({method:"GET",path:"/api/experimental/migration/v1",successStatus:200,declaredStatuses:[400,401],empty:!1},e)}},websearch:{providers:(e,n)=>r({method:"GET",path:"/api/websearch/provider",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,503],empty:!1},n),query:(e,n)=>r({method:"POST",path:"/api/websearch",query:{location:e.location},body:{query:e.query,providerID:e.providerID},successStatus:200,declaredStatuses:[400,401,503],empty:!1},n)},config:{get:(e,n)=>r({method:"GET",path:"/api/config",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n),shells:(e)=>r({method:"GET",path:"/api/config/shell",successStatus:200,declaredStatuses:[400,401],empty:!1},e),update:(e,n)=>r({method:"PATCH",path:"/api/experimental/config",body:{shell:e.shell},successStatus:204,declaredStatuses:[400,401],empty:!0},n)}}}function M(t){return t.split("/").map(encodeURIComponent).join("/")}function h(t,a,s){if(s===void 0)return;if(s===null){t.append(a,"null");return}if(Array.isArray(s)){for(let g of s)h(t,a,g);return}if(typeof s==="object"){for(let[g,p]of Object.entries(s))h(t,`${a}[${g}]`,p);return}t.append(a,String(s))}async function R(t){if(!D(t,"application/json")&&!t.headers.get("content-type")?.includes("+json")){try{await t.body?.cancel()}catch{}throw new c("UnsupportedContentType",{detail:t.headers.get("content-type")})}let a;try{a=await t.text()}catch(s){throw new c("Transport",{cause:s})}if(a==="")throw new c("MalformedResponse");try{return JSON.parse(a)}catch(s){throw new c("MalformedResponse",{cause:s})}}function T(t){let a=Object.assign(Error(t.message??t.data?.message),t);if(t._tag)a.name=t._tag;return a}function D(t,a){return t.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase()===a}var _=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="InvalidRequestError",W=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="UnauthorizedError",z=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="ServiceUnavailableError",B=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="AgentNotFoundError",K=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="InvalidCursorError",H=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="SessionNotFoundError",Q=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="ConflictError",X=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="UnknownError",Y=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="MessageNotFoundError",Z=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="CommandNotFoundError",ee=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="CommandExecutionError",ne=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="SkillNotFoundError",te=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="SessionBusyError",re=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="InstructionEntryValueTooLargeError",oe=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="FormNotFoundError",ae=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="FormInvalidAnswerError",se=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="FormAlreadySettledError",ie=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="ProviderNotFoundError",de=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="IntegrationNotFoundError",le=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="IntegrationAttemptNotFoundError",ye=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="IntegrationMethodNotFoundError",ue=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="McpServerNotFoundError",pe=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="ProjectNotFoundError",ge=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="PermissionNotFoundError",ce=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="FileNotFoundError",O=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="RpcError",P=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="RpcInternalError",me=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="PtyNotFoundError",Ie=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="ForbiddenError",be=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="ShellNotFoundError",fe=(t)=>typeof t==="object"&&t!==null&&("name"in t)&&t.name==="WorktreeError";var S={};w(S,{OpenCode:()=>S,make:()=>V});function N(t){let a,s=4096;function g(r){if(r.connected=void 0,r.controller.abort(),a===r)a=void 0}async function p(r){let l,e={};try{if(r.controller.signal.aborted)return;l=t(r.controller.signal,()=>{r.subscribers.forEach((n)=>n.activity?.())})[Symbol.asyncIterator]();while(!r.controller.signal.aborted){let n=await l.next();if(n.done||r.controller.signal.aborted)break;if(n.value.type==="server.connected")r.connected=n.value;r.subscribers.forEach((o)=>o.push(n.value))}}catch(n){e={error:n}}finally{g(r);try{await l?.return?.()}catch(n){if(!("error"in e))e={error:n}}r.subscribers.forEach((n)=>n.finish(e))}}return{subscribe(r){return{[Symbol.asyncIterator](){let l=[],e=[],n=!1,o,i;function m(u,I=!0){if(o=u,I)e.length=0;if(r?.signal?.removeEventListener("abort",d),i?.subscribers.delete(y)&&!i.subscribers.size)g(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:r?.onActivity,finish(u){m(u,!1)},push(u){if(o)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(o)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(o){if("error"in o)return Promise.reject(o.error);return Promise.resolve({done:!0,value:void 0})}if(r?.signal?.aborted)return d(),Promise.resolve({done:!0,value:void 0});let I=Promise.withResolvers();if(l.push(I),!n)n=!0,r?.signal?.addEventListener("abort",d,{once:!0}),f();return I.promise},return(){return m({}),Promise.resolve({done:!0,value:void 0})}}}}}}}function k(t,a){return(s)=>{let g=(p,r)=>{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,n=r?.signal?AbortSignal.any([e.signal,r.signal]):e.signal,o=async function*(){try{for await(let i of a.subscribe({signal:n})){if(n.aborted)return;if(i.type!==l)continue;yield i}}catch(i){if(!n.aborted)throw i}finally{e.abort()}}();return{next:()=>o.next(),return:()=>(e.abort(),o.return())}}}};return Object.assign(Object.fromEntries(Object.keys(s.methods).map((p)=>[p,async(r,l)=>{try{return(await t.rpc.call({rpcID:s.id,method:p,input:r,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:g,on:(p,r,l)=>{let e=new AbortController,n=l?.signal?AbortSignal.any([e.signal,l.signal]):e.signal,o=g(p,{signal:n});return(async()=>{for await(let i of o)await r(i)})().catch((i)=>console.error(i)),()=>e.abort()}}})}}function U(t,a){return`rpc.${t.id}.${a}`}function V(t){let a=F(t),s=N((g,p)=>a.event.subscribe({signal:g,onActivity:p}));return{...a,rpc:Object.assign(k(a,s),a.rpc),event:s}}export{c as ClientError,S as OpenCode,B as isAgentNotFoundError,ee as isCommandExecutionError,Z as isCommandNotFoundError,Q as isConflictError,ce as isFileNotFoundError,Ie as isForbiddenError,se as isFormAlreadySettledError,ae as isFormInvalidAnswerError,oe as isFormNotFoundError,re as isInstructionEntryValueTooLargeError,le as isIntegrationAttemptNotFoundError,ye as isIntegrationMethodNotFoundError,de as isIntegrationNotFoundError,K as isInvalidCursorError,_ as isInvalidRequestError,ue as isMcpServerNotFoundError,Y as isMessageNotFoundError,ge as isPermissionNotFoundError,pe as isProjectNotFoundError,ie as isProviderNotFoundError,me as isPtyNotFoundError,O as isRpcError,P as isRpcInternalError,z as isServiceUnavailableError,te as isSessionBusyError,H as isSessionNotFoundError,be as isShellNotFoundError,ne as isSkillNotFoundError,W as isUnauthorizedError,X as isUnknownError,fe as isWorktreeError};
|
|
12
|
+
`)}if(y.done)return}}finally{try{await i.cancel()}catch{}i.releaseLock()}}});return{server:{info:(e)=>r({method:"GET",path:"/api/info",successStatus:200,declaredStatuses:[400,401],empty:!1},e),pair:(e)=>r({method:"POST",path:"/api/pair",successStatus:200,declaredStatuses:[400,401],empty:!1},e),connect:(e,n)=>r({method:"GET",path:`/auth/connect/${encodeURIComponent(e.code)}`,successStatus:200,declaredStatuses:[400,401],empty:!1},n)},location:{get:(e,n)=>r({method:"GET",path:"/api/location",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n),reload:(e)=>r({method:"POST",path:"/api/location/reload",successStatus:204,declaredStatuses:[400,401,503],empty:!0},e)},agent:{list:(e,n)=>r({method:"GET",path:"/api/agent",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n),get:(e,n)=>r({method:"GET",path:`/api/agent/${encodeURIComponent(e.agentID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},n)},plugin:{list:(e,n)=>r({method:"GET",path:"/api/plugin",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n),check:(e,n)=>r({method:"POST",path:"/api/plugin/check",query:{location:e?.location},body:{target:e?.target},successStatus:200,declaredStatuses:[400,401],empty:!1},n),update:(e,n)=>r({method:"POST",path:"/api/plugin/update",query:{location:e.location},body:{targets:e.targets},successStatus:204,declaredStatuses:[400,401,503],empty:!0},n)},session:{list:(e,n)=>r({method:"GET",path:"/api/session",query:{limit:e?.limit,order:e?.order,search:e?.search,parentID:e?.parentID,directory:e?.directory,project:e?.project,subpath:e?.subpath,cursor:e?.cursor},successStatus:200,declaredStatuses:[400,401],empty:!1},n),stats:(e,n)=>r({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},n).then((o)=>o.data),create:(e,n)=>r({method:"POST",path:"/api/session",body:{id:e?.id,title:e?.title,agent:e?.agent,model:e?.model,location:e?.location,metadata:e?.metadata,permissions:e?.permissions},successStatus:200,declaredStatuses:[400,401],empty:!1},n).then((o)=>o.data),import:(e,n)=>r({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},n).then((o)=>o.data),export:(e,n)=>r({method:"GET",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/export`,query:{sanitize:e.sanitize},successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},n).then((o)=>o.data),active:(e)=>r({method:"GET",path:"/api/session/active",successStatus:200,declaredStatuses:[400,401],empty:!1},e).then((n)=>n.data),get:(e,n)=>r({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},n).then((o)=>o.data),remove:(e,n)=>r({method:"DELETE",path:`/api/session/${encodeURIComponent(e.sessionID)}`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),fork:(e,n)=>r({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/fork`,body:{before:e.before},successStatus:200,declaredStatuses:[400,401,404],empty:!1},n).then((o)=>o.data),switchAgent:(e,n)=>r({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/agent`,body:{agent:e.agent},successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),switchModel:(e,n)=>r({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/model`,body:{model:e.model},successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),update:(e,n)=>r({method:"PATCH",path:`/api/session/${encodeURIComponent(e.sessionID)}`,body:{title:e.title,metadata:e.metadata,permissions:e.permissions},successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),move:(e,n)=>r({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/move`,body:{directory:e.directory,delivery:e.delivery},successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),prompt:(e,n)=>r({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},n).then((o)=>o.data),command:(e,n)=>r({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},n),skill:(e,n)=>r({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},n),synthetic:(e,n)=>r({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},n).then((o)=>o.data),shell:(e,n)=>r({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/shell`,body:{id:e.id,command:e.command},successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),compact:(e,n)=>r({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},n).then((o)=>o.data),wait:(e,n)=>r({method:"POST",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/wait`,successStatus:204,declaredStatuses:[400,401,404,503],empty:!0},n),revert:{stage:(e,n)=>r({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},n).then((o)=>o.data),clear:(e,n)=>r({method:"DELETE",path:`/api/session/${encodeURIComponent(e.sessionID)}/revert`,successStatus:204,declaredStatuses:[400,401,404,409,500],empty:!0},n),commit:(e,n)=>r({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/revert/commit`,successStatus:204,declaredStatuses:[400,401,404,409],empty:!0},n)},context:(e,n)=>r({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/context`,successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},n).then((o)=>o.data),diff:(e,n)=>r({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},n).then((o)=>o.data),inbox:{list:(e,n)=>r({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/inbox`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},n).then((o)=>o.data),cancel:(e,n)=>r({method:"DELETE",path:`/api/session/${encodeURIComponent(e.sessionID)}/inbox/${encodeURIComponent(e.inboxID)}`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),update:(e,n)=>r({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},n)},instructions:{entry:{list:(e,n)=>r({method:"GET",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/instructions/entries`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},n).then((o)=>o.data),put:(e,n)=>r({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},n),remove:(e,n)=>r({method:"DELETE",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/instructions/entries/${encodeURIComponent(e.key)}`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},n)}},generate:(e,n)=>r({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/generate`,body:{prompt:e.prompt},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},n).then((o)=>o.data),log:(e,n)=>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},n),interrupt:(e,n)=>r({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/interrupt`,query:{resume:e.resume},successStatus:200,declaredStatuses:[400,401,404],empty:!1},n),background:(e,n)=>r({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/background`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),message:{get:(e,n)=>r({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/message/${encodeURIComponent(e.messageID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},n).then((o)=>o.data)},form:{list:(e,n)=>r({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/form`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},n).then((o)=>o.data),create:(e,n)=>r({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},n).then((o)=>o.data),get:(e,n)=>r({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/form/${encodeURIComponent(e.formID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},n).then((o)=>o.data),reply:(e,n)=>r({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},n),cancel:(e,n)=>r({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},n)},environment:(e,n)=>r({method:"PUT",path:`/api/session/${encodeURIComponent(e.sessionID)}/environment`,body:{variables:e.variables},successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),view:(e,n)=>r({method:"POST",path:`/api/session/${encodeURIComponent(e.sessionID)}/view`,body:{idle:e.idle},successStatus:204,declaredStatuses:[400,401,404],empty:!0},n)},message:{list:(e,n)=>r({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},n)},model:{list:(e,n)=>r({method:"GET",path:"/api/model",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,503],empty:!1},n),default:(e,n)=>r({method:"GET",path:"/api/model/default",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,503],empty:!1},n)},generate:{text:(e,n)=>r({method:"POST",path:"/api/experimental/generate",body:{prompt:e.prompt,model:e.model},successStatus:200,declaredStatuses:[400,401,503],empty:!1},n).then((o)=>o.data)},provider:{list:(e,n)=>r({method:"GET",path:"/api/provider",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,503],empty:!1},n),get:(e,n)=>r({method:"GET",path:`/api/provider/${encodeURIComponent(e.providerID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},n)},integration:{list:(e,n)=>r({method:"GET",path:"/api/integration",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n),get:(e,n)=>r({method:"GET",path:`/api/integration/${encodeURIComponent(e.integrationID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},n),wellknown:{add:(e,n)=>r({method:"POST",path:"/api/experimental/integration/wellknown",query:{location:e.location},body:{url:e.url},successStatus:204,declaredStatuses:[400,401],empty:!0},n)},connect:{key:(e,n)=>r({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},n)},oauth:{connect:(e,n)=>r({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],empty:!1},n),status:(e,n)=>r({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},n),complete:(e,n)=>r({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},n),cancel:(e,n)=>r({method:"DELETE",path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/oauth/${encodeURIComponent(e.attemptID)}`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401],empty:!0},n)},command:{connect:(e,n)=>r({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},n),status:(e,n)=>r({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},n),cancel:(e,n)=>r({method:"DELETE",path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/command/${encodeURIComponent(e.attemptID)}`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401],empty:!0},n)}},mcp:{list:(e,n)=>r({method:"GET",path:"/api/mcp",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n),add:(e,n)=>r({method:"PUT",path:`/api/experimental/mcp/${encodeURIComponent(e.server)}`,query:{location:e.location},body:{config:e.config},successStatus:204,declaredStatuses:[400,401],empty:!0},n),remove:(e,n)=>r({method:"DELETE",path:`/api/experimental/mcp/${encodeURIComponent(e.server)}`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),connect:(e,n)=>r({method:"POST",path:`/api/experimental/mcp/${encodeURIComponent(e.server)}/connect`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),disconnect:(e,n)=>r({method:"POST",path:`/api/experimental/mcp/${encodeURIComponent(e.server)}/disconnect`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),resource:{catalog:(e,n)=>r({method:"GET",path:"/api/mcp/resource",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n)}},credential:{list:(e)=>r({method:"GET",path:"/api/credential",successStatus:200,declaredStatuses:[400,401],empty:!1},e).then((n)=>n.data),create:(e,n)=>r({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},n).then((o)=>o.data),update:(e,n)=>r({method:"PATCH",path:`/api/credential/${encodeURIComponent(e.credentialID)}`,body:{label:e.label},successStatus:204,declaredStatuses:[400,401],empty:!0},n),activate:(e,n)=>r({method:"POST",path:`/api/credential/${encodeURIComponent(e.credentialID)}/activate`,successStatus:204,declaredStatuses:[400,401],empty:!0},n),remove:(e,n)=>r({method:"DELETE",path:`/api/credential/${encodeURIComponent(e.credentialID)}`,successStatus:204,declaredStatuses:[400,401],empty:!0},n)},project:{list:(e)=>r({method:"GET",path:"/api/project",successStatus:200,declaredStatuses:[400,401],empty:!1},e),update:(e,n)=>r({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},n)},form:{list:(e,n)=>r({method:"GET",path:"/api/form",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n)},permission:{request:{list:(e,n)=>r({method:"GET",path:"/api/permission/request",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n)},saved:{list:(e,n)=>r({method:"GET",path:"/api/permission/saved",query:{projectID:e?.projectID},successStatus:200,declaredStatuses:[400,401],empty:!1},n).then((o)=>o.data),remove:(e,n)=>r({method:"DELETE",path:`/api/permission/saved/${encodeURIComponent(e.id)}`,successStatus:204,declaredStatuses:[400,401],empty:!0},n)},create:(e,n)=>r({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},n).then((o)=>o.data),list:(e,n)=>r({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/permission`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},n).then((o)=>o.data),get:(e,n)=>r({method:"GET",path:`/api/session/${encodeURIComponent(e.sessionID)}/permission/${encodeURIComponent(e.requestID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},n).then((o)=>o.data),reply:(e,n)=>r({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},n)},file:{read:(e,n)=>r({method:"GET",path:`/api/fs/read/${M(e.path)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1,binary:!0},n),list:(e,n)=>r({method:"GET",path:"/api/fs/list",query:{location:e?.location,path:e?.path},successStatus:200,declaredStatuses:[400,401],empty:!1},n),find:(e,n)=>r({method:"GET",path:"/api/fs/find",query:{location:e.location,query:e.query,type:e.type,limit:e.limit},successStatus:200,declaredStatuses:[400,401],empty:!1},n),write:(e,n)=>r({method:"POST",path:"/api/experimental/fs/write",query:{location:e.location,path:e.path},body:e.payload,successStatus:200,declaredStatuses:[400,401],empty:!1,binaryBody:!0},n)},command:{list:(e,n)=>r({method:"GET",path:"/api/command",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n)},skill:{list:(e,n)=>r({method:"GET",path:"/api/skill",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n)},rpc:{call:(e,n)=>r({method:"POST",path:`/api/rpc/${encodeURIComponent(e.rpcID)}/${encodeURIComponent(e.method)}`,query:{location:e.location},body:{input:e.input},successStatus:200,declaredStatuses:[400,401,500],empty:!1},n)},event:{subscribe:(e)=>l({method:"GET",path:"/api/event",successStatus:200,declaredStatuses:[400,401],empty:!1},e)},pty:{list:(e,n)=>r({method:"GET",path:"/api/pty",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n),create:(e,n)=>r({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],empty:!1},n),get:(e,n)=>r({method:"GET",path:`/api/pty/${encodeURIComponent(e.ptyID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},n),update:(e,n)=>r({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},n),remove:(e,n)=>r({method:"DELETE",path:`/api/pty/${encodeURIComponent(e.ptyID)}`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),connect:{token:(e,n)=>r({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},n)}},experimental:{persistentPty:{read:(e,n)=>r({method:"GET",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/terminal/read`,query:{lines:e.lines},successStatus:200,declaredStatuses:[400,401,503],empty:!1},n).then((o)=>o.data),list:(e,n)=>r({method:"GET",path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/terminal`,successStatus:200,declaredStatuses:[400,401,503],empty:!1},n).then((o)=>o.data),create:(e,n)=>r({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},n).then((o)=>o.data),shutdown:(e)=>r({method:"POST",path:"/api/experimental/persistent-pty/shutdown",successStatus:204,declaredStatuses:[400,401,503],empty:!0},e),handoff:(e)=>r({method:"POST",path:"/api/experimental/persistent-pty/handoff",successStatus:200,declaredStatuses:[400,401,503],empty:!1},e),get:(e,n)=>r({method:"GET",path:`/api/experimental/persistent-pty/${encodeURIComponent(e.ptyID)}`,successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},n).then((o)=>o.data),update:(e,n)=>r({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},n).then((o)=>o.data),snapshot:(e,n)=>r({method:"GET",path:`/api/experimental/persistent-pty/${encodeURIComponent(e.ptyID)}/snapshot`,successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},n).then((o)=>o.data),remove:(e,n)=>r({method:"DELETE",path:`/api/experimental/persistent-pty/${encodeURIComponent(e.ptyID)}`,successStatus:204,declaredStatuses:[400,401,404,503],empty:!0},n),connectToken:(e,n)=>r({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},n).then((o)=>o.data)}},shell:{list:(e,n)=>r({method:"GET",path:"/api/shell",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n),create:(e,n)=>r({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],empty:!1},n),get:(e,n)=>r({method:"GET",path:`/api/shell/${encodeURIComponent(e.id)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},n),output:(e,n)=>r({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},n),remove:(e,n)=>r({method:"DELETE",path:`/api/shell/${encodeURIComponent(e.id)}`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401],empty:!0},n)},reference:{list:(e,n)=>r({method:"GET",path:"/api/reference",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n)},worktree:{list:(e,n)=>r({method:"GET",path:"/api/worktree",query:{projectID:e.projectID},successStatus:200,declaredStatuses:[400,401,404],empty:!1},n),create:(e,n)=>r({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},n),remove:(e,n)=>r({method:"DELETE",path:"/api/worktree",body:{projectID:e.projectID,directory:e.directory,force:e.force},successStatus:204,declaredStatuses:[400,401,404],empty:!0},n),refresh:(e,n)=>r({method:"POST",path:"/api/worktree/refresh",body:{projectID:e.projectID},successStatus:204,declaredStatuses:[400,401,404],empty:!0},n)},vcs:{get:(e,n)=>r({method:"GET",path:"/api/vcs",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n),base:(e,n)=>r({method:"GET",path:"/api/vcs/base",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,503],empty:!1},n),status:(e,n)=>r({method:"GET",path:"/api/vcs/status",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n),branch:{list:(e,n)=>r({method:"GET",path:"/api/vcs/branch",query:{location:e?.location,search:e?.search,limit:e?.limit},successStatus:200,declaredStatuses:[400,401],empty:!1},n)},diff:(e,n)=>r({method:"GET",path:"/api/vcs/diff",query:{location:e.location,mode:e.mode,base:e.base,context:e.context},successStatus:200,declaredStatuses:[400,401,503],empty:!1},n)},debug:{location:{list:(e)=>r({method:"GET",path:"/api/debug/location",successStatus:200,declaredStatuses:[400,401],empty:!1},e),evict:(e,n)=>r({method:"DELETE",path:"/api/debug/location",query:{location:e?.location},successStatus:204,declaredStatuses:[400,401],empty:!0},n)}},migration:{v1:{status:(e)=>r({method:"GET",path:"/api/experimental/migration/v1",successStatus:200,declaredStatuses:[400,401],empty:!1},e)}},websearch:{providers:(e,n)=>r({method:"GET",path:"/api/websearch/provider",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,503],empty:!1},n),query:(e,n)=>r({method:"POST",path:"/api/websearch",query:{location:e.location},body:{query:e.query,providerID:e.providerID},successStatus:200,declaredStatuses:[400,401,503],empty:!1},n)},config:{get:(e,n)=>r({method:"GET",path:"/api/config",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401],empty:!1},n),shells:(e)=>r({method:"GET",path:"/api/config/shell",successStatus:200,declaredStatuses:[400,401],empty:!1},e),update:(e,n)=>r({method:"PATCH",path:"/api/experimental/config",body:{shell:e.shell},successStatus:204,declaredStatuses:[400,401],empty:!0},n)}}}function M(t){return t.split("/").map(encodeURIComponent).join("/")}function h(t,a,s){if(s===void 0)return;if(s===null){t.append(a,"null");return}if(Array.isArray(s)){for(let g of s)h(t,a,g);return}if(typeof s==="object"){for(let[g,p]of Object.entries(s))h(t,`${a}[${g}]`,p);return}t.append(a,String(s))}async function R(t){if(!D(t,"application/json")&&!t.headers.get("content-type")?.includes("+json")){try{await t.body?.cancel()}catch{}throw new c("UnsupportedContentType",{detail:t.headers.get("content-type")})}let a;try{a=await t.text()}catch(s){throw new c("Transport",{cause:s})}if(a==="")throw new c("MalformedResponse");try{return JSON.parse(a)}catch(s){throw new c("MalformedResponse",{cause:s})}}function N(t){let a=Object.assign(Error(t.message??t.data?.message),t);if(t._tag)a.name=t._tag;return a}function D(t,a){return t.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase()===a}var _=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="InvalidRequestError",W=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="UnauthorizedError",z=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="ServiceUnavailableError",B=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="AgentNotFoundError",K=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="InvalidCursorError",H=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="SessionNotFoundError",Q=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="ConflictError",X=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="UnknownError",Y=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="MessageNotFoundError",Z=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="CommandNotFoundError",ee=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="CommandExecutionError",ne=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="SkillNotFoundError",te=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="SessionBusyError",re=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="InstructionEntryValueTooLargeError",oe=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="FormNotFoundError",ae=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="FormInvalidAnswerError",se=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="FormAlreadySettledError",ie=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="ProviderNotFoundError",de=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="IntegrationNotFoundError",le=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="IntegrationAttemptNotFoundError",ye=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="IntegrationMethodNotFoundError",ue=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="McpServerNotFoundError",pe=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="ProjectNotFoundError",ge=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="PermissionNotFoundError",ce=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="FileNotFoundError",O=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="RpcError",P=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="RpcInternalError",me=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="PtyNotFoundError",Ie=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="ForbiddenError",be=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="ShellNotFoundError",fe=(t)=>typeof t==="object"&&t!==null&&("name"in t)&&t.name==="WorktreeError";var S={};w(S,{OpenCode:()=>S,make:()=>V});function T(t){let a,s=4096;function g(r){if(r.connected=void 0,r.controller.abort(),a===r)a=void 0}async function p(r){let l,e={};try{if(r.controller.signal.aborted)return;l=t(r.controller.signal,()=>{r.subscribers.forEach((n)=>n.activity?.())})[Symbol.asyncIterator]();while(!r.controller.signal.aborted){let n=await l.next();if(n.done||r.controller.signal.aborted)break;if(n.value.type==="server.connected")r.connected=n.value;r.subscribers.forEach((o)=>o.push(n.value))}}catch(n){e={error:n}}finally{g(r);try{await l?.return?.()}catch(n){if(!("error"in e))e={error:n}}r.subscribers.forEach((n)=>n.finish(e))}}return{subscribe(r){return{[Symbol.asyncIterator](){let l=[],e=[],n=!1,o,i;function m(u,I=!0){if(o=u,I)e.length=0;if(r?.signal?.removeEventListener("abort",d),i?.subscribers.delete(y)&&!i.subscribers.size)g(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:r?.onActivity,finish(u){m(u,!1)},push(u){if(o)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(o)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(o){if("error"in o)return Promise.reject(o.error);return Promise.resolve({done:!0,value:void 0})}if(r?.signal?.aborted)return d(),Promise.resolve({done:!0,value:void 0});let I=Promise.withResolvers();if(l.push(I),!n)n=!0,r?.signal?.addEventListener("abort",d,{once:!0}),f();return I.promise},return(){return m({}),Promise.resolve({done:!0,value:void 0})}}}}}}}function k(t,a){return(s)=>{let g=(p,r)=>{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,n=r?.signal?AbortSignal.any([e.signal,r.signal]):e.signal,o=async function*(){try{for await(let i of a.subscribe({signal:n})){if(n.aborted)return;if(i.type!==l)continue;yield i}}catch(i){if(!n.aborted)throw i}finally{e.abort()}}();return{next:()=>o.next(),return:()=>(e.abort(),o.return())}}}};return Object.assign(Object.fromEntries(Object.keys(s.methods).map((p)=>[p,async(r,l)=>{try{return(await t.rpc.call({rpcID:s.id,method:p,input:r,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:g,on:(p,r,l)=>{let e=new AbortController,n=l?.signal?AbortSignal.any([e.signal,l.signal]):e.signal,o=g(p,{signal:n});return(async()=>{for await(let i of o)await r(i)})().catch((i)=>console.error(i)),()=>e.abort()}}})}}function U(t,a){return`rpc.${t.id}.${a}`}function V(t){let a=F(t),s=T((g,p)=>a.event.subscribe({signal:g,onActivity:p}));return{...a,rpc:Object.assign(k(a,s),a.rpc),event:s}}export{c as ClientError,S as OpenCode,B as isAgentNotFoundError,ee as isCommandExecutionError,Z as isCommandNotFoundError,Q as isConflictError,ce as isFileNotFoundError,Ie as isForbiddenError,se as isFormAlreadySettledError,ae as isFormInvalidAnswerError,oe as isFormNotFoundError,re as isInstructionEntryValueTooLargeError,le as isIntegrationAttemptNotFoundError,ye as isIntegrationMethodNotFoundError,de as isIntegrationNotFoundError,K as isInvalidCursorError,_ as isInvalidRequestError,ue as isMcpServerNotFoundError,Y as isMessageNotFoundError,ge as isPermissionNotFoundError,pe as isProjectNotFoundError,ie as isProviderNotFoundError,me as isPtyNotFoundError,O as isRpcError,P as isRpcInternalError,z as isServiceUnavailableError,te as isSessionBusyError,H as isSessionNotFoundError,be as isShellNotFoundError,ne as isSkillNotFoundError,W as isUnauthorizedError,X as isUnknownError,fe as isWorktreeError};
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"import": "./client/index.js"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
|
-
"version": "2.0.
|
|
17
|
+
"version": "2.0.21-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-windows-x64": "2.0.
|
|
34
|
-
"shuvcode-linux-arm64-musl": "2.0.
|
|
35
|
-
"shuvcode-linux-x64-baseline-musl": "2.0.
|
|
36
|
-
"shuvcode-darwin-arm64": "2.0.
|
|
37
|
-
"shuvcode-linux-x64-musl": "2.0.
|
|
38
|
-
"shuvcode-darwin-x64": "2.0.
|
|
39
|
-
"shuvcode-linux-x64-baseline": "2.0.
|
|
40
|
-
"shuvcode-windows-arm64": "2.0.
|
|
41
|
-
"shuvcode-linux-arm64": "2.0.
|
|
42
|
-
"shuvcode-darwin-x64-baseline": "2.0.
|
|
43
|
-
"shuvcode-windows-x64-baseline": "2.0.
|
|
44
|
-
"shuvcode-linux-x64": "2.0.
|
|
33
|
+
"shuvcode-windows-x64": "2.0.21-shuv.1",
|
|
34
|
+
"shuvcode-linux-arm64-musl": "2.0.21-shuv.1",
|
|
35
|
+
"shuvcode-linux-x64-baseline-musl": "2.0.21-shuv.1",
|
|
36
|
+
"shuvcode-darwin-arm64": "2.0.21-shuv.1",
|
|
37
|
+
"shuvcode-linux-x64-musl": "2.0.21-shuv.1",
|
|
38
|
+
"shuvcode-darwin-x64": "2.0.21-shuv.1",
|
|
39
|
+
"shuvcode-linux-x64-baseline": "2.0.21-shuv.1",
|
|
40
|
+
"shuvcode-windows-arm64": "2.0.21-shuv.1",
|
|
41
|
+
"shuvcode-linux-arm64": "2.0.21-shuv.1",
|
|
42
|
+
"shuvcode-darwin-x64-baseline": "2.0.21-shuv.1",
|
|
43
|
+
"shuvcode-windows-x64-baseline": "2.0.21-shuv.1",
|
|
44
|
+
"shuvcode-linux-x64": "2.0.21-shuv.1"
|
|
45
45
|
}
|
|
46
46
|
}
|