shuvcode 2.0.21-shuv.1 → 2.0.23-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.
@@ -219,6 +219,7 @@ export declare function make(options: ClientOptions): {
219
219
  refresh: (input: import("./index.js").WorktreeRefreshInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
220
220
  };
221
221
  vcs: {
222
+ init: (input?: import("./index.js").VcsInitInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
222
223
  get: (input?: import("./index.js").VcsGetInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").VcsGetOutput>;
223
224
  base: (input?: import("./index.js").VcsBaseInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").VcsBaseOutput>;
224
225
  status: (input?: import("./index.js").VcsStatusInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").VcsStatusOutput>;
@@ -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, 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";
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, VcsInitInput, 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;
@@ -226,6 +226,7 @@ export declare function make(options: ClientOptions): {
226
226
  refresh: (input: WorktreeRefreshInput, requestOptions?: RequestOptions) => Promise<void>;
227
227
  };
228
228
  vcs: {
229
+ init: (input?: VcsInitInput, requestOptions?: RequestOptions) => Promise<void>;
229
230
  get: (input?: VcsGetInput, requestOptions?: RequestOptions) => Promise<VcsGetOutput>;
230
231
  base: (input?: VcsBaseInput, requestOptions?: RequestOptions) => Promise<VcsBaseOutput>;
231
232
  status: (input?: VcsStatusInput, requestOptions?: RequestOptions) => Promise<VcsStatusOutput>;
@@ -154,7 +154,7 @@ export function make(options) {
154
154
  path: `/api/location`,
155
155
  query: { location: input?.["location"] },
156
156
  successStatus: 200,
157
- declaredStatuses: [400, 401],
157
+ declaredStatuses: [400, 401, 404],
158
158
  empty: false,
159
159
  }, requestOptions),
160
160
  reload: (requestOptions) => request({
@@ -171,7 +171,7 @@ export function make(options) {
171
171
  path: `/api/agent`,
172
172
  query: { location: input?.["location"] },
173
173
  successStatus: 200,
174
- declaredStatuses: [400, 401],
174
+ declaredStatuses: [400, 401, 404],
175
175
  empty: false,
176
176
  }, requestOptions),
177
177
  get: (input, requestOptions) => request({
@@ -189,7 +189,7 @@ export function make(options) {
189
189
  path: `/api/plugin`,
190
190
  query: { location: input?.["location"] },
191
191
  successStatus: 200,
192
- declaredStatuses: [400, 401],
192
+ declaredStatuses: [400, 401, 404],
193
193
  empty: false,
194
194
  }, requestOptions),
195
195
  check: (input, requestOptions) => request({
@@ -198,7 +198,7 @@ export function make(options) {
198
198
  query: { location: input?.["location"] },
199
199
  body: { target: input?.["target"] },
200
200
  successStatus: 200,
201
- declaredStatuses: [400, 401],
201
+ declaredStatuses: [400, 401, 404],
202
202
  empty: false,
203
203
  }, requestOptions),
204
204
  update: (input, requestOptions) => request({
@@ -207,7 +207,7 @@ export function make(options) {
207
207
  query: { location: input["location"] },
208
208
  body: { targets: input["targets"] },
209
209
  successStatus: 204,
210
- declaredStatuses: [400, 401, 503],
210
+ declaredStatuses: [400, 401, 404, 503],
211
211
  empty: true,
212
212
  }, requestOptions),
213
213
  },
@@ -248,6 +248,7 @@ export function make(options) {
248
248
  path: `/api/session`,
249
249
  body: {
250
250
  id: input?.["id"],
251
+ parentID: input?.["parentID"],
251
252
  title: input?.["title"],
252
253
  agent: input?.["agent"],
253
254
  model: input?.["model"],
@@ -256,7 +257,7 @@ export function make(options) {
256
257
  permissions: input?.["permissions"],
257
258
  },
258
259
  successStatus: 200,
259
- declaredStatuses: [400, 401],
260
+ declaredStatuses: [400, 401, 404],
260
261
  empty: false,
261
262
  }, requestOptions).then((value) => value.data),
262
263
  import: (input, requestOptions) => request({
@@ -616,7 +617,7 @@ export function make(options) {
616
617
  path: `/api/model`,
617
618
  query: { location: input?.["location"] },
618
619
  successStatus: 200,
619
- declaredStatuses: [400, 401, 503],
620
+ declaredStatuses: [400, 401, 404, 503],
620
621
  empty: false,
621
622
  }, requestOptions),
622
623
  default: (input, requestOptions) => request({
@@ -624,7 +625,7 @@ export function make(options) {
624
625
  path: `/api/model/default`,
625
626
  query: { location: input?.["location"] },
626
627
  successStatus: 200,
627
- declaredStatuses: [400, 401, 503],
628
+ declaredStatuses: [400, 401, 404, 503],
628
629
  empty: false,
629
630
  }, requestOptions),
630
631
  },
@@ -634,7 +635,7 @@ export function make(options) {
634
635
  path: `/api/experimental/generate`,
635
636
  body: { prompt: input["prompt"], model: input["model"] },
636
637
  successStatus: 200,
637
- declaredStatuses: [400, 401, 503],
638
+ declaredStatuses: [400, 401, 404, 503],
638
639
  empty: false,
639
640
  }, requestOptions).then((value) => value.data),
640
641
  },
@@ -644,7 +645,7 @@ export function make(options) {
644
645
  path: `/api/provider`,
645
646
  query: { location: input?.["location"] },
646
647
  successStatus: 200,
647
- declaredStatuses: [400, 401, 503],
648
+ declaredStatuses: [400, 401, 404, 503],
648
649
  empty: false,
649
650
  }, requestOptions),
650
651
  get: (input, requestOptions) => request({
@@ -662,7 +663,7 @@ export function make(options) {
662
663
  path: `/api/integration`,
663
664
  query: { location: input?.["location"] },
664
665
  successStatus: 200,
665
- declaredStatuses: [400, 401],
666
+ declaredStatuses: [400, 401, 404],
666
667
  empty: false,
667
668
  }, requestOptions),
668
669
  get: (input, requestOptions) => request({
@@ -680,7 +681,7 @@ export function make(options) {
680
681
  query: { location: input["location"] },
681
682
  body: { url: input["url"] },
682
683
  successStatus: 204,
683
- declaredStatuses: [400, 401],
684
+ declaredStatuses: [400, 401, 404],
684
685
  empty: true,
685
686
  }, requestOptions),
686
687
  },
@@ -702,7 +703,7 @@ export function make(options) {
702
703
  query: { location: input["location"] },
703
704
  body: { methodID: input["methodID"], answer: input["answer"], label: input["label"] },
704
705
  successStatus: 200,
705
- declaredStatuses: [400, 401],
706
+ declaredStatuses: [400, 401, 404],
706
707
  empty: false,
707
708
  }, requestOptions),
708
709
  status: (input, requestOptions) => request({
@@ -727,7 +728,7 @@ export function make(options) {
727
728
  path: `/api/integration/${encodeURIComponent(input.integrationID)}/connect/oauth/${encodeURIComponent(input.attemptID)}`,
728
729
  query: { location: input["location"] },
729
730
  successStatus: 204,
730
- declaredStatuses: [400, 401],
731
+ declaredStatuses: [400, 401, 404],
731
732
  empty: true,
732
733
  }, requestOptions),
733
734
  },
@@ -754,7 +755,7 @@ export function make(options) {
754
755
  path: `/api/integration/${encodeURIComponent(input.integrationID)}/connect/command/${encodeURIComponent(input.attemptID)}`,
755
756
  query: { location: input["location"] },
756
757
  successStatus: 204,
757
- declaredStatuses: [400, 401],
758
+ declaredStatuses: [400, 401, 404],
758
759
  empty: true,
759
760
  }, requestOptions),
760
761
  },
@@ -765,7 +766,7 @@ export function make(options) {
765
766
  path: `/api/mcp`,
766
767
  query: { location: input?.["location"] },
767
768
  successStatus: 200,
768
- declaredStatuses: [400, 401],
769
+ declaredStatuses: [400, 401, 404],
769
770
  empty: false,
770
771
  }, requestOptions),
771
772
  add: (input, requestOptions) => request({
@@ -774,7 +775,7 @@ export function make(options) {
774
775
  query: { location: input["location"] },
775
776
  body: { config: input["config"] },
776
777
  successStatus: 204,
777
- declaredStatuses: [400, 401],
778
+ declaredStatuses: [400, 401, 404],
778
779
  empty: true,
779
780
  }, requestOptions),
780
781
  remove: (input, requestOptions) => request({
@@ -807,7 +808,7 @@ export function make(options) {
807
808
  path: `/api/mcp/resource`,
808
809
  query: { location: input?.["location"] },
809
810
  successStatus: 200,
810
- declaredStatuses: [400, 401],
811
+ declaredStatuses: [400, 401, 404],
811
812
  empty: false,
812
813
  }, requestOptions),
813
814
  },
@@ -852,7 +853,7 @@ export function make(options) {
852
853
  }, requestOptions),
853
854
  },
854
855
  project: {
855
- list: (requestOptions) => request({ method: "GET", path: `/api/project`, successStatus: 200, declaredStatuses: [400, 401], empty: false }, requestOptions),
856
+ list: (requestOptions) => request({ method: "GET", path: `/api/project`, successStatus: 200, declaredStatuses: [400, 401, 404], empty: false }, requestOptions),
856
857
  update: (input, requestOptions) => request({
857
858
  method: "PATCH",
858
859
  path: `/api/project/${encodeURIComponent(input.projectID)}`,
@@ -873,7 +874,7 @@ export function make(options) {
873
874
  path: `/api/form`,
874
875
  query: { location: input?.["location"] },
875
876
  successStatus: 200,
876
- declaredStatuses: [400, 401],
877
+ declaredStatuses: [400, 401, 404],
877
878
  empty: false,
878
879
  }, requestOptions),
879
880
  },
@@ -884,7 +885,7 @@ export function make(options) {
884
885
  path: `/api/permission/request`,
885
886
  query: { location: input?.["location"] },
886
887
  successStatus: 200,
887
- declaredStatuses: [400, 401],
888
+ declaredStatuses: [400, 401, 404],
888
889
  empty: false,
889
890
  }, requestOptions),
890
891
  },
@@ -894,14 +895,14 @@ export function make(options) {
894
895
  path: `/api/permission/saved`,
895
896
  query: { projectID: input?.["projectID"] },
896
897
  successStatus: 200,
897
- declaredStatuses: [400, 401],
898
+ declaredStatuses: [400, 401, 404],
898
899
  empty: false,
899
900
  }, requestOptions).then((value) => value.data),
900
901
  remove: (input, requestOptions) => request({
901
902
  method: "DELETE",
902
903
  path: `/api/permission/saved/${encodeURIComponent(input.id)}`,
903
904
  successStatus: 204,
904
- declaredStatuses: [400, 401],
905
+ declaredStatuses: [400, 401, 404],
905
906
  empty: true,
906
907
  }, requestOptions),
907
908
  },
@@ -959,7 +960,7 @@ export function make(options) {
959
960
  path: `/api/fs/list`,
960
961
  query: { location: input?.["location"], path: input?.["path"] },
961
962
  successStatus: 200,
962
- declaredStatuses: [400, 401],
963
+ declaredStatuses: [400, 401, 404],
963
964
  empty: false,
964
965
  }, requestOptions),
965
966
  find: (input, requestOptions) => request({
@@ -967,7 +968,7 @@ export function make(options) {
967
968
  path: `/api/fs/find`,
968
969
  query: { location: input["location"], query: input["query"], type: input["type"], limit: input["limit"] },
969
970
  successStatus: 200,
970
- declaredStatuses: [400, 401],
971
+ declaredStatuses: [400, 401, 404],
971
972
  empty: false,
972
973
  }, requestOptions),
973
974
  write: (input, requestOptions) => request({
@@ -976,7 +977,7 @@ export function make(options) {
976
977
  query: { location: input["location"], path: input["path"] },
977
978
  body: input["payload"],
978
979
  successStatus: 200,
979
- declaredStatuses: [400, 401],
980
+ declaredStatuses: [400, 401, 404],
980
981
  empty: false,
981
982
  binaryBody: true,
982
983
  }, requestOptions),
@@ -987,7 +988,7 @@ export function make(options) {
987
988
  path: `/api/command`,
988
989
  query: { location: input?.["location"] },
989
990
  successStatus: 200,
990
- declaredStatuses: [400, 401],
991
+ declaredStatuses: [400, 401, 404],
991
992
  empty: false,
992
993
  }, requestOptions),
993
994
  },
@@ -997,7 +998,7 @@ export function make(options) {
997
998
  path: `/api/skill`,
998
999
  query: { location: input?.["location"] },
999
1000
  successStatus: 200,
1000
- declaredStatuses: [400, 401],
1001
+ declaredStatuses: [400, 401, 404],
1001
1002
  empty: false,
1002
1003
  }, requestOptions),
1003
1004
  },
@@ -1008,7 +1009,7 @@ export function make(options) {
1008
1009
  query: { location: input["location"] },
1009
1010
  body: { input: input["input"] },
1010
1011
  successStatus: 200,
1011
- declaredStatuses: [400, 401, 500],
1012
+ declaredStatuses: [400, 401, 404, 500],
1012
1013
  empty: false,
1013
1014
  }, requestOptions),
1014
1015
  },
@@ -1021,7 +1022,7 @@ export function make(options) {
1021
1022
  path: `/api/pty`,
1022
1023
  query: { location: input?.["location"] },
1023
1024
  successStatus: 200,
1024
- declaredStatuses: [400, 401],
1025
+ declaredStatuses: [400, 401, 404],
1025
1026
  empty: false,
1026
1027
  }, requestOptions),
1027
1028
  create: (input, requestOptions) => request({
@@ -1036,7 +1037,7 @@ export function make(options) {
1036
1037
  env: input?.["env"],
1037
1038
  },
1038
1039
  successStatus: 200,
1039
- declaredStatuses: [400, 401],
1040
+ declaredStatuses: [400, 401, 404],
1040
1041
  empty: false,
1041
1042
  }, requestOptions),
1042
1043
  get: (input, requestOptions) => request({
@@ -1167,7 +1168,7 @@ export function make(options) {
1167
1168
  path: `/api/shell`,
1168
1169
  query: { location: input?.["location"] },
1169
1170
  successStatus: 200,
1170
- declaredStatuses: [400, 401],
1171
+ declaredStatuses: [400, 401, 404],
1171
1172
  empty: false,
1172
1173
  }, requestOptions),
1173
1174
  create: (input, requestOptions) => request({
@@ -1181,7 +1182,7 @@ export function make(options) {
1181
1182
  metadata: input["metadata"],
1182
1183
  },
1183
1184
  successStatus: 200,
1184
- declaredStatuses: [400, 401],
1185
+ declaredStatuses: [400, 401, 404],
1185
1186
  empty: false,
1186
1187
  }, requestOptions),
1187
1188
  get: (input, requestOptions) => request({
@@ -1205,7 +1206,7 @@ export function make(options) {
1205
1206
  path: `/api/shell/${encodeURIComponent(input.id)}`,
1206
1207
  query: { location: input["location"] },
1207
1208
  successStatus: 204,
1208
- declaredStatuses: [400, 401],
1209
+ declaredStatuses: [400, 401, 404],
1209
1210
  empty: true,
1210
1211
  }, requestOptions),
1211
1212
  },
@@ -1215,7 +1216,7 @@ export function make(options) {
1215
1216
  path: `/api/reference`,
1216
1217
  query: { location: input?.["location"] },
1217
1218
  successStatus: 200,
1218
- declaredStatuses: [400, 401],
1219
+ declaredStatuses: [400, 401, 404],
1219
1220
  empty: false,
1220
1221
  }, requestOptions),
1221
1222
  },
@@ -1260,12 +1261,20 @@ export function make(options) {
1260
1261
  }, requestOptions),
1261
1262
  },
1262
1263
  vcs: {
1264
+ init: (input, requestOptions) => request({
1265
+ method: "POST",
1266
+ path: `/api/vcs/init`,
1267
+ query: { location: input?.["location"], provider: input?.["provider"] },
1268
+ successStatus: 204,
1269
+ declaredStatuses: [400, 401, 404, 409, 501, 503],
1270
+ empty: true,
1271
+ }, requestOptions),
1263
1272
  get: (input, requestOptions) => request({
1264
1273
  method: "GET",
1265
1274
  path: `/api/vcs`,
1266
1275
  query: { location: input?.["location"] },
1267
1276
  successStatus: 200,
1268
- declaredStatuses: [400, 401],
1277
+ declaredStatuses: [400, 401, 404],
1269
1278
  empty: false,
1270
1279
  }, requestOptions),
1271
1280
  base: (input, requestOptions) => request({
@@ -1273,7 +1282,7 @@ export function make(options) {
1273
1282
  path: `/api/vcs/base`,
1274
1283
  query: { location: input?.["location"] },
1275
1284
  successStatus: 200,
1276
- declaredStatuses: [400, 401, 503],
1285
+ declaredStatuses: [400, 401, 404, 503],
1277
1286
  empty: false,
1278
1287
  }, requestOptions),
1279
1288
  status: (input, requestOptions) => request({
@@ -1281,7 +1290,7 @@ export function make(options) {
1281
1290
  path: `/api/vcs/status`,
1282
1291
  query: { location: input?.["location"] },
1283
1292
  successStatus: 200,
1284
- declaredStatuses: [400, 401],
1293
+ declaredStatuses: [400, 401, 404],
1285
1294
  empty: false,
1286
1295
  }, requestOptions),
1287
1296
  branch: {
@@ -1290,7 +1299,7 @@ export function make(options) {
1290
1299
  path: `/api/vcs/branch`,
1291
1300
  query: { location: input?.["location"], search: input?.["search"], limit: input?.["limit"] },
1292
1301
  successStatus: 200,
1293
- declaredStatuses: [400, 401],
1302
+ declaredStatuses: [400, 401, 404],
1294
1303
  empty: false,
1295
1304
  }, requestOptions),
1296
1305
  },
@@ -1299,7 +1308,7 @@ export function make(options) {
1299
1308
  path: `/api/vcs/diff`,
1300
1309
  query: { location: input["location"], mode: input["mode"], base: input["base"], context: input["context"] },
1301
1310
  successStatus: 200,
1302
- declaredStatuses: [400, 401, 503],
1311
+ declaredStatuses: [400, 401, 404, 503],
1303
1312
  empty: false,
1304
1313
  }, requestOptions),
1305
1314
  },
@@ -1339,7 +1348,7 @@ export function make(options) {
1339
1348
  path: `/api/websearch/provider`,
1340
1349
  query: { location: input?.["location"] },
1341
1350
  successStatus: 200,
1342
- declaredStatuses: [400, 401, 503],
1351
+ declaredStatuses: [400, 401, 404, 503],
1343
1352
  empty: false,
1344
1353
  }, requestOptions),
1345
1354
  query: (input, requestOptions) => request({
@@ -1348,7 +1357,7 @@ export function make(options) {
1348
1357
  query: { location: input["location"] },
1349
1358
  body: { query: input["query"], providerID: input["providerID"] },
1350
1359
  successStatus: 200,
1351
- declaredStatuses: [400, 401, 503],
1360
+ declaredStatuses: [400, 401, 404, 503],
1352
1361
  empty: false,
1353
1362
  }, requestOptions),
1354
1363
  },
@@ -1358,16 +1367,22 @@ export function make(options) {
1358
1367
  path: `/api/config`,
1359
1368
  query: { location: input?.["location"] },
1360
1369
  successStatus: 200,
1361
- declaredStatuses: [400, 401],
1370
+ declaredStatuses: [400, 401, 404],
1371
+ empty: false,
1372
+ }, requestOptions),
1373
+ shells: (requestOptions) => request({
1374
+ method: "GET",
1375
+ path: `/api/config/shell`,
1376
+ successStatus: 200,
1377
+ declaredStatuses: [400, 401, 404],
1362
1378
  empty: false,
1363
1379
  }, requestOptions),
1364
- shells: (requestOptions) => request({ method: "GET", path: `/api/config/shell`, successStatus: 200, declaredStatuses: [400, 401], empty: false }, requestOptions),
1365
1380
  update: (input, requestOptions) => request({
1366
1381
  method: "PATCH",
1367
1382
  path: `/api/experimental/config`,
1368
1383
  body: { shell: input["shell"] },
1369
1384
  successStatus: 204,
1370
- declaredStatuses: [400, 401],
1385
+ declaredStatuses: [400, 401, 404],
1371
1386
  empty: true,
1372
1387
  }, requestOptions),
1373
1388
  },
@@ -8,6 +8,9 @@ export type ServerInfo = {
8
8
  paths: {
9
9
  tmp: string;
10
10
  };
11
+ capabilities?: {
12
+ persistentPty?: boolean | undefined;
13
+ } | undefined;
11
14
  };
12
15
  export type PairingCode = {
13
16
  code: string;
@@ -693,6 +696,11 @@ export type McpProtocol = "legacy" | "auto" | "2026-07-28";
693
696
  export type ConfigWorktree = {
694
697
  directory: string;
695
698
  };
699
+ export type ConfigModelCapabilities = {
700
+ tools?: boolean;
701
+ input?: Array<string>;
702
+ output?: Array<string>;
703
+ };
696
704
  export type ConfigShellOption = {
697
705
  path: string;
698
706
  name: string;
@@ -754,7 +762,8 @@ export type ConfigModelSettings = {
754
762
  };
755
763
  export type ProviderSettings = {
756
764
  timeout?: number | false;
757
- chunkTimeout?: number;
765
+ headerTimeout?: number | false;
766
+ chunkTimeout?: number | false;
758
767
  compaction?: ProviderCompaction;
759
768
  transport?: ProviderTransport;
760
769
  } & {
@@ -762,7 +771,8 @@ export type ProviderSettings = {
762
771
  };
763
772
  export type ConfigProviderSettings = {
764
773
  timeout?: number | false;
765
- chunkTimeout?: number;
774
+ headerTimeout?: number | false;
775
+ chunkTimeout?: number | false;
766
776
  compaction?: ProviderCompaction;
767
777
  transport?: ProviderTransport;
768
778
  } & {
@@ -1591,6 +1601,19 @@ export type ReferenceUpdated = {
1591
1601
  location?: LocationRef;
1592
1602
  data: {};
1593
1603
  };
1604
+ export type PermissionCancelled = {
1605
+ id: string;
1606
+ created: number;
1607
+ metadata?: {
1608
+ [x: string]: any;
1609
+ };
1610
+ type: "permission.cancelled";
1611
+ location?: LocationRef;
1612
+ data: {
1613
+ sessionID: string;
1614
+ requestID: string;
1615
+ };
1616
+ };
1594
1617
  export type PluginUpdated = {
1595
1618
  id: string;
1596
1619
  created: number;
@@ -3078,7 +3101,7 @@ export type ConfigEntry = {
3078
3101
  body?: {
3079
3102
  [x: string]: JsonValue;
3080
3103
  };
3081
- capabilities?: ModelCapabilities;
3104
+ capabilities?: ConfigModelCapabilities;
3082
3105
  variants?: Array<{
3083
3106
  id: string;
3084
3107
  settings?: ConfigModelSettings;
@@ -3125,6 +3148,7 @@ export type ConfigEntry = {
3125
3148
  experimental?: {
3126
3149
  portable_shell_scanner?: boolean;
3127
3150
  subagent_depth?: number;
3151
+ jev?: boolean;
3128
3152
  policies?: Array<{
3129
3153
  action: "provider.use" | "permission";
3130
3154
  resource: string;
@@ -3344,7 +3368,7 @@ export type IntegrationInfo = {
3344
3368
  methods: Array<IntegrationMethod>;
3345
3369
  connections: Array<ConnectionInfo>;
3346
3370
  };
3347
- export type V2Event = LocationShutdown | ModelsDevRefreshed | CredentialUpdated | CredentialSwitched | IntegrationUpdated | ProviderUpdated | ModelUpdated | AgentUpdated | SessionCreated | SessionAgentSelected | SessionModelSelected | SessionMoved | SessionRenamed | SessionMetadataUpdated | SessionPermissions | SessionViewed | SessionUsageUpdated | SessionDeleted | SessionForked | SessionInboxDelivered | SessionInboxEnqueued | SessionInboxCancelled | SessionInboxDeliveryChanged | SessionExecutionStarted | SessionExecutionSucceeded | SessionExecutionFailed | SessionExecutionInterrupted | SessionInstructionsUpdated | SessionSynthetic | SessionSkillActivated | SessionShellStarted | SessionShellEnded | SessionStepStarted | SessionStepStreamed | SessionStepEnded | SessionStepFailed | SessionTextStarted | SessionTextDelta | SessionTextEnded | SessionReasoningStarted | SessionReasoningDelta | SessionReasoningEnded | SessionToolInputStarted | SessionToolInputDelta | SessionToolInputEnded | SessionToolCalled | SessionToolProgress | SessionToolSuccess | SessionToolFailed | SessionRetryScheduled | SessionCompactionStarted | SessionCompactionDelta | SessionCompactionEnded | SessionCompactionFailed | SessionRevertStaged | SessionRevertCleared | SessionRevertCommitted | FilesystemChanged | ReferenceUpdated | PermissionAsked | PermissionReplied | PluginUpdated | ProjectUpdated | WorktreeUpdated | WorktreeResolved | CommandUpdated | ConfigUpdated | SkillUpdated | PtyCreated | PtyUpdated | PtyExited | PtyDeleted | PersistentPtyAdded | PersistentPtyRemoved | ShellCreated | ShellExited | ShellDeleted | FormCreated | FormReplied | FormCancelled | WebsearchUpdated | SessionStatusUpdated | SessionIdle | TuiPromptAppend | TuiCommandExecute | TuiToastShow | TuiSessionSelect | InstallationUpdated | InstallationUpdateAvailable | VcsBranchUpdated | McpStatusChanged | McpResourcesChanged | V2EventRpc | V2EventServerConnected;
3371
+ export type V2Event = LocationShutdown | ModelsDevRefreshed | CredentialUpdated | CredentialSwitched | IntegrationUpdated | ProviderUpdated | ModelUpdated | AgentUpdated | SessionCreated | SessionAgentSelected | SessionModelSelected | SessionMoved | SessionRenamed | SessionMetadataUpdated | SessionPermissions | SessionViewed | SessionUsageUpdated | SessionDeleted | SessionForked | SessionInboxDelivered | SessionInboxEnqueued | SessionInboxCancelled | SessionInboxDeliveryChanged | SessionExecutionStarted | SessionExecutionSucceeded | SessionExecutionFailed | SessionExecutionInterrupted | SessionInstructionsUpdated | SessionSynthetic | SessionSkillActivated | SessionShellStarted | SessionShellEnded | SessionStepStarted | SessionStepStreamed | SessionStepEnded | SessionStepFailed | SessionTextStarted | SessionTextDelta | SessionTextEnded | SessionReasoningStarted | SessionReasoningDelta | SessionReasoningEnded | SessionToolInputStarted | SessionToolInputDelta | SessionToolInputEnded | SessionToolCalled | SessionToolProgress | SessionToolSuccess | SessionToolFailed | SessionRetryScheduled | SessionCompactionStarted | SessionCompactionDelta | SessionCompactionEnded | SessionCompactionFailed | SessionRevertStaged | SessionRevertCleared | SessionRevertCommitted | FilesystemChanged | ReferenceUpdated | PermissionAsked | PermissionReplied | PermissionCancelled | PluginUpdated | ProjectUpdated | WorktreeUpdated | WorktreeResolved | CommandUpdated | ConfigUpdated | SkillUpdated | PtyCreated | PtyUpdated | PtyExited | PtyDeleted | PersistentPtyAdded | PersistentPtyRemoved | ShellCreated | ShellExited | ShellDeleted | FormCreated | FormReplied | FormCancelled | WebsearchUpdated | SessionStatusUpdated | SessionIdle | TuiPromptAppend | TuiCommandExecute | TuiToastShow | TuiSessionSelect | InstallationUpdated | InstallationUpdateAvailable | VcsBranchUpdated | McpStatusChanged | McpResourcesChanged | V2EventRpc | V2EventServerConnected;
3348
3372
  export type SessionLogItem = SessionEventDurable | EventLogSynced;
3349
3373
  export type InvalidRequestError = {
3350
3374
  readonly _tag: "InvalidRequestError";
@@ -3358,6 +3382,14 @@ export type UnauthorizedError = {
3358
3382
  readonly message: string;
3359
3383
  };
3360
3384
  export declare const isUnauthorizedError: (value: unknown) => value is UnauthorizedError;
3385
+ export type LocationNotFoundError = {
3386
+ readonly _tag: "LocationNotFoundError";
3387
+ readonly location: {
3388
+ readonly directory: string;
3389
+ };
3390
+ readonly message: string;
3391
+ };
3392
+ export declare const isLocationNotFoundError: (value: unknown) => value is LocationNotFoundError;
3361
3393
  export type ServiceUnavailableError = {
3362
3394
  readonly _tag: "ServiceUnavailableError";
3363
3395
  readonly message: string;
@@ -3531,6 +3563,7 @@ export type ShellNotFoundError = {
3531
3563
  };
3532
3564
  export declare const isShellNotFoundError: (value: unknown) => value is ShellNotFoundError;
3533
3565
  export type WorktreeError = {
3566
+ readonly _tag: "WorktreeError";
3534
3567
  readonly name: "WorktreeError";
3535
3568
  readonly data: {
3536
3569
  readonly message: string;
@@ -3538,6 +3571,12 @@ export type WorktreeError = {
3538
3571
  };
3539
3572
  };
3540
3573
  export declare const isWorktreeError: (value: unknown) => value is WorktreeError;
3574
+ export type VcsInitNotSupportedError = {
3575
+ readonly _tag: "VcsInitNotSupportedError";
3576
+ readonly providerID: string;
3577
+ readonly message: string;
3578
+ };
3579
+ export declare const isVcsInitNotSupportedError: (value: unknown) => value is VcsInitNotSupportedError;
3541
3580
  export type ServerInfoOutput = ServerInfo;
3542
3581
  export type ServerPairOutput = PairingCode;
3543
3582
  export type ServerConnectInput = {
@@ -3742,6 +3781,7 @@ export type SessionStatsOutput = {
3742
3781
  export type SessionCreateInput = {
3743
3782
  readonly id?: {
3744
3783
  readonly id?: string | null;
3784
+ readonly parentID?: string | null;
3745
3785
  readonly title?: string | null;
3746
3786
  readonly agent?: string | null;
3747
3787
  readonly model?: {
@@ -3761,8 +3801,31 @@ export type SessionCreateInput = {
3761
3801
  readonly effect: "allow" | "deny" | "ask";
3762
3802
  }> | null;
3763
3803
  }["id"];
3804
+ readonly parentID?: {
3805
+ readonly id?: string | null;
3806
+ readonly parentID?: string | null;
3807
+ readonly title?: string | null;
3808
+ readonly agent?: string | null;
3809
+ readonly model?: {
3810
+ readonly id: string;
3811
+ readonly providerID: string;
3812
+ readonly variant?: string;
3813
+ } | null;
3814
+ readonly location?: {
3815
+ readonly directory: string;
3816
+ } | null;
3817
+ readonly metadata?: {
3818
+ readonly [x: string]: JsonValue;
3819
+ } | null;
3820
+ readonly permissions?: ReadonlyArray<{
3821
+ readonly action: string;
3822
+ readonly resource: string;
3823
+ readonly effect: "allow" | "deny" | "ask";
3824
+ }> | null;
3825
+ }["parentID"];
3764
3826
  readonly title?: {
3765
3827
  readonly id?: string | null;
3828
+ readonly parentID?: string | null;
3766
3829
  readonly title?: string | null;
3767
3830
  readonly agent?: string | null;
3768
3831
  readonly model?: {
@@ -3784,6 +3847,7 @@ export type SessionCreateInput = {
3784
3847
  }["title"];
3785
3848
  readonly agent?: {
3786
3849
  readonly id?: string | null;
3850
+ readonly parentID?: string | null;
3787
3851
  readonly title?: string | null;
3788
3852
  readonly agent?: string | null;
3789
3853
  readonly model?: {
@@ -3805,6 +3869,7 @@ export type SessionCreateInput = {
3805
3869
  }["agent"];
3806
3870
  readonly model?: {
3807
3871
  readonly id?: string | null;
3872
+ readonly parentID?: string | null;
3808
3873
  readonly title?: string | null;
3809
3874
  readonly agent?: string | null;
3810
3875
  readonly model?: {
@@ -3826,6 +3891,7 @@ export type SessionCreateInput = {
3826
3891
  }["model"];
3827
3892
  readonly location?: {
3828
3893
  readonly id?: string | null;
3894
+ readonly parentID?: string | null;
3829
3895
  readonly title?: string | null;
3830
3896
  readonly agent?: string | null;
3831
3897
  readonly model?: {
@@ -3847,6 +3913,7 @@ export type SessionCreateInput = {
3847
3913
  }["location"];
3848
3914
  readonly metadata?: {
3849
3915
  readonly id?: string | null;
3916
+ readonly parentID?: string | null;
3850
3917
  readonly title?: string | null;
3851
3918
  readonly agent?: string | null;
3852
3919
  readonly model?: {
@@ -3868,6 +3935,7 @@ export type SessionCreateInput = {
3868
3935
  }["metadata"];
3869
3936
  readonly permissions?: {
3870
3937
  readonly id?: string | null;
3938
+ readonly parentID?: string | null;
3871
3939
  readonly title?: string | null;
3872
3940
  readonly agent?: string | null;
3873
3941
  readonly model?: {
@@ -8541,6 +8609,21 @@ export type WorktreeRefreshInput = {
8541
8609
  }["projectID"];
8542
8610
  };
8543
8611
  export type WorktreeRefreshOutput = void;
8612
+ export type VcsInitInput = {
8613
+ readonly location?: {
8614
+ readonly location?: {
8615
+ readonly directory?: string | undefined;
8616
+ } | undefined;
8617
+ readonly provider?: string | undefined;
8618
+ }["location"];
8619
+ readonly provider?: {
8620
+ readonly location?: {
8621
+ readonly directory?: string | undefined;
8622
+ } | undefined;
8623
+ readonly provider?: string | undefined;
8624
+ }["provider"];
8625
+ };
8626
+ export type VcsInitOutput = void;
8544
8627
  export type VcsGetInput = {
8545
8628
  readonly location?: {
8546
8629
  readonly location?: {
@@ -1,5 +1,6 @@
1
1
  export const isInvalidRequestError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "InvalidRequestError";
2
2
  export const isUnauthorizedError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "UnauthorizedError";
3
+ export const isLocationNotFoundError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "LocationNotFoundError";
3
4
  export const isServiceUnavailableError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "ServiceUnavailableError";
4
5
  export const isAgentNotFoundError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "AgentNotFoundError";
5
6
  export const isInvalidCursorError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "InvalidCursorError";
@@ -31,4 +32,5 @@ export const isRpcInternalError = (value) => typeof value === "object" && value
31
32
  export const isPtyNotFoundError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "PtyNotFoundError";
32
33
  export const isForbiddenError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "ForbiddenError";
33
34
  export const isShellNotFoundError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "ShellNotFoundError";
34
- export const isWorktreeError = (value) => typeof value === "object" && value !== null && "name" in value && value["name"] === "WorktreeError";
35
+ export const isWorktreeError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "WorktreeError";
36
+ export const isVcsInitNotSupportedError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "VcsInitNotSupportedError";
package/client/index.js CHANGED
@@ -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)}`,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};
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,404],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,404],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,404],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,404],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,404,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,parentID:e?.parentID,title:e?.title,agent:e?.agent,model:e?.model,location:e?.location,metadata:e?.metadata,permissions:e?.permissions},successStatus:200,declaredStatuses:[400,401,404],empty:!1},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,404,503],empty:!1},n),default:(e,n)=>r({method:"GET",path:"/api/model/default",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404,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,404,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,404,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,404],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,404],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,404],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,404],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,404],empty:!0},n)}},mcp:{list:(e,n)=>r({method:"GET",path:"/api/mcp",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],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,404],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,404],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,404],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,404],empty:!1},n)},permission:{request:{list:(e,n)=>r({method:"GET",path:"/api/permission/request",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},n)},saved:{list:(e,n)=>r({method:"GET",path:"/api/permission/saved",query:{projectID:e?.projectID},successStatus:200,declaredStatuses:[400,401,404],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,404],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,404],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,404],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,404],empty:!1,binaryBody:!0},n)},command:{list:(e,n)=>r({method:"GET",path:"/api/command",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},n)},skill:{list:(e,n)=>r({method:"GET",path:"/api/skill",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],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,404,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,404],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,404],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,404],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,404],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,404],empty:!0},n)},reference:{list:(e,n)=>r({method:"GET",path:"/api/reference",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],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:{init:(e,n)=>r({method:"POST",path:"/api/vcs/init",query:{location:e?.location,provider:e?.provider},successStatus:204,declaredStatuses:[400,401,404,409,501,503],empty:!0},n),get:(e,n)=>r({method:"GET",path:"/api/vcs",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},n),base:(e,n)=>r({method:"GET",path:"/api/vcs/base",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},n),status:(e,n)=>r({method:"GET",path:"/api/vcs/status",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],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,404],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,404,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,404,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,404,503],empty:!1},n)},config:{get:(e,n)=>r({method:"GET",path:"/api/config",query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},n),shells:(e)=>r({method:"GET",path:"/api/config/shell",successStatus:200,declaredStatuses:[400,401,404],empty:!1},e),update:(e,n)=>r({method:"PATCH",path:"/api/experimental/config",body:{shell:e.shell},successStatus:204,declaredStatuses:[400,401,404],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==="LocationNotFoundError",B=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="ServiceUnavailableError",K=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="AgentNotFoundError",H=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="InvalidCursorError",Q=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="SessionNotFoundError",X=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="ConflictError",Y=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="UnknownError",Z=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="MessageNotFoundError",ee=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="CommandNotFoundError",ne=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="CommandExecutionError",te=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="SkillNotFoundError",re=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="SessionBusyError",oe=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="InstructionEntryValueTooLargeError",ae=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="FormNotFoundError",se=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="FormInvalidAnswerError",ie=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="FormAlreadySettledError",de=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="ProviderNotFoundError",le=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="IntegrationNotFoundError",ye=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="IntegrationAttemptNotFoundError",ue=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="IntegrationMethodNotFoundError",pe=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="McpServerNotFoundError",ge=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="ProjectNotFoundError",ce=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="PermissionNotFoundError",me=(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",Ie=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="PtyNotFoundError",be=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="ForbiddenError",fe=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="ShellNotFoundError",xe=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="WorktreeError",Se=(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&t._tag==="VcsInitNotSupportedError";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,K as isAgentNotFoundError,ne as isCommandExecutionError,ee as isCommandNotFoundError,X as isConflictError,me as isFileNotFoundError,be as isForbiddenError,ie as isFormAlreadySettledError,se as isFormInvalidAnswerError,ae as isFormNotFoundError,oe as isInstructionEntryValueTooLargeError,ye as isIntegrationAttemptNotFoundError,ue as isIntegrationMethodNotFoundError,le as isIntegrationNotFoundError,H as isInvalidCursorError,_ as isInvalidRequestError,z as isLocationNotFoundError,pe as isMcpServerNotFoundError,Z as isMessageNotFoundError,ce as isPermissionNotFoundError,ge as isProjectNotFoundError,de as isProviderNotFoundError,Ie as isPtyNotFoundError,O as isRpcError,P as isRpcInternalError,B as isServiceUnavailableError,re as isSessionBusyError,Q as isSessionNotFoundError,fe as isShellNotFoundError,te as isSkillNotFoundError,W as isUnauthorizedError,Y as isUnknownError,Se as isVcsInitNotSupportedError,xe as isWorktreeError};
package/client/service.js CHANGED
@@ -31,6 +31,7 @@ export async function ensure(options = {}) {
31
31
  let announced = false;
32
32
  let lastSpawn = 0;
33
33
  let spawnDelay = timing.spawnDelay;
34
+ let failure;
34
35
  const announce = (reason, previousVersion) => {
35
36
  if (announced)
36
37
  return;
@@ -51,7 +52,7 @@ export async function ensure(options = {}) {
51
52
  try {
52
53
  while (true) {
53
54
  if (Date.now() >= deadline)
54
- throw new Error("Timed out waiting for the background service to start");
55
+ throw failure ?? new Error("Timed out waiting for the background service to start");
55
56
  const registration = await registered(options.file, timing.requestTimeout);
56
57
  if (registration.timedOut && registration.info !== undefined) {
57
58
  timeouts = {
@@ -63,6 +64,13 @@ export async function ensure(options = {}) {
63
64
  console.warn("Background service is unresponsive; recovery cannot preserve persistent terminals");
64
65
  await PtyHandoff.clear(options.file ?? fallback());
65
66
  await terminate(registration.info, options, timing);
67
+ for (const item of contenders) {
68
+ if (item.child.pid === registration.info.pid || contenderFinished(item)) {
69
+ item.release();
70
+ contenders.delete(item);
71
+ }
72
+ }
73
+ failure = undefined;
66
74
  timeouts = undefined;
67
75
  lastSpawn = Date.now() - spawnDelay;
68
76
  }
@@ -72,7 +80,10 @@ export async function ensure(options = {}) {
72
80
  if (registration.service !== undefined) {
73
81
  spawnDelay = timing.spawnDelay;
74
82
  const service = registration.service;
75
- const compatible = service.compatible && matchesVersion(service.version, options);
83
+ const versionMatches = matchesVersion(service.version, options);
84
+ const compatible = service.compatible && versionMatches;
85
+ if (!service.compatible && versionMatches)
86
+ throw new Error("Background service uses an incompatible health protocol. Update this client or explicitly restart the service.");
76
87
  if (compatible && service.state === "ready") {
77
88
  await PtyHandoff.complete(options.file ?? fallback(), service.info);
78
89
  return service.endpoint;
@@ -87,6 +98,13 @@ export async function ensure(options = {}) {
87
98
  file: options.file,
88
99
  pty: service.state === "ready" ? "handoff" : "clear",
89
100
  }).catch(() => undefined);
101
+ for (const item of contenders) {
102
+ if (item.child.pid === service.info.pid || contenderFinished(item)) {
103
+ item.release();
104
+ contenders.delete(item);
105
+ }
106
+ }
107
+ failure = undefined;
90
108
  lastSpawn = 0;
91
109
  }
92
110
  }
@@ -94,15 +112,16 @@ export async function ensure(options = {}) {
94
112
  if (lastSpawn === 0 && registration.info !== undefined)
95
113
  lastSpawn = Date.now();
96
114
  const finished = [...contenders].filter(contenderFinished);
97
- const failure = finished.map(contenderFailure).find((error) => error !== undefined);
115
+ failure ??= finished.map(contenderFailure).find((error) => error !== undefined);
98
116
  if (finished.some((item) => item.child.exitCode === 0)) {
99
117
  spawnDelay = Math.min(spawnDelay * 2, timing.maxSpawnDelay);
100
118
  }
101
119
  finished.forEach((item) => contenders.delete(item));
102
120
  if (failure !== undefined && contenders.size === 0)
103
121
  throw failure;
104
- // Keep one candidate plus one lock probe so a pre-lock stall cannot block recovery.
105
- if (contenders.size < 2 && Date.now() - lastSpawn >= spawnDelay) {
122
+ // Keep one candidate plus one lock probe for pre-lock stalls. After a failure, let the
123
+ // survivors finish without recruiting replacements that could hide the error indefinitely.
124
+ if (failure === undefined && contenders.size < 2 && Date.now() - lastSpawn >= spawnDelay) {
106
125
  announce("missing");
107
126
  contenders.add(await spawnContender());
108
127
  lastSpawn = Date.now();
@@ -118,12 +137,12 @@ export async function ensure(options = {}) {
118
137
  /** Stop the registered local service. */
119
138
  export async function stop(options = {}) {
120
139
  const info = await read(options.file);
121
- if (options.pty === "handoff" && info !== undefined)
122
- await PtyHandoff.prepare(options.file ?? fallback(), info, defaultEnsureTiming.requestTimeout);
123
- else
124
- await PtyHandoff.clear(options.file ?? fallback());
140
+ // Terminal handoff is best-effort; it must never keep the old service running.
141
+ await (options.pty === "handoff" && info !== undefined
142
+ ? PtyHandoff.prepare(options.file ?? fallback(), info, defaultEnsureTiming.requestTimeout)
143
+ : PtyHandoff.clear(options.file ?? fallback())).catch((cause) => console.warn("Failed to prepare persistent terminals for replacement", cause));
125
144
  if (info !== undefined)
126
- await terminate(info, options, defaultEnsureTiming);
145
+ await terminate(info, options, ensureTiming(options));
127
146
  }
128
147
  function fallback() {
129
148
  return join(process.env["XDG_STATE_HOME"] ?? join(homedir(), ".local", "state"), "shuvcode", "service.json");
@@ -164,8 +183,8 @@ async function probeResult(info, timeout = defaultEnsureTiming.requestTimeout) {
164
183
  if ("cause" in result)
165
184
  return { service: undefined, timedOut: signal.aborted };
166
185
  const response = result.value.response;
167
- // The previous V2 service exposes /api/status instead. Its authenticated 404 is enough
168
- // to recognize the registered daemon as incompatible and route it through replacement.
186
+ // A missing health endpoint identifies protocol incompatibility, not an older
187
+ // version. Only an unmet version requirement lets ensure replace this owner.
169
188
  if (response.status === 404)
170
189
  return {
171
190
  service: {
@@ -243,10 +262,9 @@ async function terminate(info, options, timing) {
243
262
  if (current === undefined || !same(current, info))
244
263
  return;
245
264
  signal(info.pid, "SIGTERM");
265
+ // The registration can disappear or change hands before this process exits. Only the PID we
266
+ // signalled can tell us whether it has stopped, so escalate based on that process.
246
267
  if (!(await waitUntilStopped(info.pid, timing))) {
247
- const latest = await read(options.file);
248
- if (latest === undefined || !same(latest, info))
249
- return;
250
268
  signal(info.pid, "SIGKILL");
251
269
  if (!(await waitUntilStopped(info.pid, timing)))
252
270
  throw new Error(`Server process ${info.pid} is still running`);
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "import": "./client/index.js"
15
15
  }
16
16
  },
17
- "version": "2.0.21-shuv.1",
17
+ "version": "2.0.23-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.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"
33
+ "shuvcode-windows-x64": "2.0.23-shuv.1",
34
+ "shuvcode-linux-arm64-musl": "2.0.23-shuv.1",
35
+ "shuvcode-linux-x64-baseline-musl": "2.0.23-shuv.1",
36
+ "shuvcode-darwin-arm64": "2.0.23-shuv.1",
37
+ "shuvcode-linux-x64-musl": "2.0.23-shuv.1",
38
+ "shuvcode-darwin-x64": "2.0.23-shuv.1",
39
+ "shuvcode-linux-x64-baseline": "2.0.23-shuv.1",
40
+ "shuvcode-windows-arm64": "2.0.23-shuv.1",
41
+ "shuvcode-linux-arm64": "2.0.23-shuv.1",
42
+ "shuvcode-darwin-x64-baseline": "2.0.23-shuv.1",
43
+ "shuvcode-windows-x64-baseline": "2.0.23-shuv.1",
44
+ "shuvcode-linux-x64": "2.0.23-shuv.1"
45
45
  }
46
46
  }