@opencode/client 2.0.24 → 2.0.25

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.
Files changed (64) hide show
  1. package/dist/chunks/{pty-handoff-71wkqa80.js → service-probe-1thtawyv.js} +1 -1
  2. package/dist/chunks/{pty-handoff-1y4a697q.js → service-probe-1y4a697q.js} +1 -1
  3. package/dist/chunks/{pty-handoff-ank0d71z.js → service-probe-2ny4vxct.js} +19 -2
  4. package/dist/chunks/{pty-handoff-w1w809zr.js → service-probe-65kht65h.js} +5 -5
  5. package/dist/chunks/{pty-handoff-qzsnm4q8.js → service-probe-9h52wrcy.js} +28 -19
  6. package/dist/chunks/{pty-handoff-frbwqjmf.js → service-probe-frbwqjmf.js} +1 -1
  7. package/dist/chunks/{pty-handoff-js54wxgp.js → service-probe-nwcpakzx.js} +2 -2
  8. package/dist/chunks/{pty-handoff-t1xa31vm.js → service-probe-t1xa31vm.js} +1 -1
  9. package/dist/chunks/{pty-handoff-src6by76.js → service-probe-trz7kcxd.js} +14 -1
  10. package/dist/chunks/{pty-handoff-5yf5aaev.js → service-probe-vnspkrex.js} +16 -11
  11. package/dist/chunks/{pty-handoff-7f0py9js.js → service-probe-y2etg5bs.js} +2 -2
  12. package/dist/chunks/{pty-handoff-myyn5x39.js → service-probe-y99g37y2.js} +17 -17
  13. package/dist/chunks/service-probe-z1hcmzxa.js +30 -0
  14. package/dist/contract.js +1 -1
  15. package/dist/effect/api/api.d.ts +12 -0
  16. package/dist/effect/client.d.ts +1 -0
  17. package/dist/effect/client.js +12 -12
  18. package/dist/effect/generated/client-error.js +3 -3
  19. package/dist/effect/generated/client.d.ts +2 -1
  20. package/dist/effect/generated/client.js +5 -5
  21. package/dist/effect/generated/index.js +8 -8
  22. package/dist/effect/index.js +12 -12
  23. package/dist/effect/rpc.js +4 -4
  24. package/dist/effect/service.d.ts +16 -2
  25. package/dist/effect/service.js +18 -23
  26. package/dist/promise/client.d.ts +1 -0
  27. package/dist/promise/client.js +11 -11
  28. package/dist/promise/generated/client-error.js +3 -3
  29. package/dist/promise/generated/client.d.ts +2 -1
  30. package/dist/promise/generated/client.js +4 -4
  31. package/dist/promise/generated/index.js +10 -10
  32. package/dist/promise/generated/types.d.ts +81 -4
  33. package/dist/promise/generated/types.js +1 -1
  34. package/dist/promise/index.js +13 -13
  35. package/dist/promise/rpc.js +2 -2
  36. package/dist/promise/service.js +13 -18
  37. package/dist/pty-handoff.js +1 -1
  38. package/dist/rpc-runtime.js +1 -1
  39. package/dist/service-contender.js +1 -1
  40. package/dist/service-probe.d.ts +18 -1
  41. package/dist/service-probe.js +5 -2
  42. package/dist/service-timing.js +1 -1
  43. package/dist/service-version.js +1 -1
  44. package/dist/service.js +1 -1
  45. package/dist/shared-events.js +1 -1
  46. package/dist/solid/connection.js +1 -1
  47. package/dist/solid/data.d.ts +7 -0
  48. package/dist/solid/data.js +9 -9
  49. package/dist/solid/index.js +11 -11
  50. package/dist/solid/pty.js +1 -1
  51. package/package.json +5 -6
  52. package/dist/chunks/pty-handoff-cqfz2qxq.js +0 -30
  53. /package/dist/chunks/{pty-handoff-6mptkzbc.js → service-probe-6mptkzbc.js} +0 -0
  54. /package/dist/chunks/{pty-handoff-9rqn6x4v.js → service-probe-9rqn6x4v.js} +0 -0
  55. /package/dist/chunks/{pty-handoff-gne7h7mq.js → service-probe-gne7h7mq.js} +0 -0
  56. /package/dist/chunks/{pty-handoff-m2eywc8w.js → service-probe-m2eywc8w.js} +0 -0
  57. /package/dist/chunks/{pty-handoff-qav6mfdz.js → service-probe-qav6mfdz.js} +0 -0
  58. /package/dist/chunks/{pty-handoff-sxt88q69.js → service-probe-sxt88q69.js} +0 -0
  59. /package/dist/chunks/{pty-handoff-ve4aws36.js → service-probe-ve4aws36.js} +0 -0
  60. /package/dist/chunks/{pty-handoff-vmytr4q8.js → service-probe-vmytr4q8.js} +0 -0
  61. /package/dist/chunks/{pty-handoff-vt9jbch8.js → service-probe-vt9jbch8.js} +0 -0
  62. /package/dist/chunks/{pty-handoff-vyas3vgt.js → service-probe-vyas3vgt.js} +0 -0
  63. /package/dist/chunks/{pty-handoff-xgnj2w4v.js → service-probe-xgnj2w4v.js} +0 -0
  64. /package/dist/chunks/{pty-handoff-ydhz1zrh.js → service-probe-ydhz1zrh.js} +0 -0
@@ -1,15 +1,15 @@
1
1
  import {
2
- ClientError3
3
- } from "../chunks/pty-handoff-7f0py9js.js";
4
- import"../chunks/pty-handoff-vmytr4q8.js";
5
- import"../chunks/pty-handoff-5yf5aaev.js";
6
- import"../chunks/pty-handoff-6mptkzbc.js";
7
- import"../chunks/pty-handoff-frbwqjmf.js";
8
- import"../chunks/pty-handoff-t1xa31vm.js";
9
- import"../chunks/pty-handoff-w1w809zr.js";
2
+ ClientError2
3
+ } from "../chunks/service-probe-y2etg5bs.js";
4
+ import"../chunks/service-probe-vmytr4q8.js";
5
+ import"../chunks/service-probe-vnspkrex.js";
6
+ import"../chunks/service-probe-6mptkzbc.js";
7
+ import"../chunks/service-probe-frbwqjmf.js";
8
+ import"../chunks/service-probe-t1xa31vm.js";
9
+ import"../chunks/service-probe-65kht65h.js";
10
10
  import {
11
- exports_client3
12
- } from "../chunks/pty-handoff-myyn5x39.js";
11
+ exports_client
12
+ } from "../chunks/service-probe-y99g37y2.js";
13
13
 
14
14
  // src/effect/index.ts
15
15
  import { Agent } from "@opencode/schema/agent";
@@ -43,7 +43,7 @@ import { PromptInput } from "@opencode/schema/prompt-input";
43
43
  export {
44
44
  AbsolutePath,
45
45
  Agent,
46
- ClientError3 as ClientError,
46
+ ClientError2 as ClientError,
47
47
  Command,
48
48
  Config,
49
49
  Credential,
@@ -54,7 +54,7 @@ export {
54
54
  Integration,
55
55
  Location,
56
56
  Model,
57
- exports_client3 as OpenCode,
57
+ exports_client as OpenCode,
58
58
  Permission,
59
59
  PermissionSaved,
60
60
  Project,
@@ -1,11 +1,11 @@
1
1
  import {
2
- make6,
2
+ make3,
3
3
  aborted2,
4
4
  exports_rpc
5
- } from "../chunks/pty-handoff-w1w809zr.js";
6
- import"../chunks/pty-handoff-t1xa31vm.js";
5
+ } from "../chunks/service-probe-65kht65h.js";
6
+ import"../chunks/service-probe-t1xa31vm.js";
7
7
  export {
8
8
  exports_rpc as RpcClientRuntime,
9
9
  aborted2 as aborted,
10
- make6 as make
10
+ make3 as make
11
11
  };
@@ -29,7 +29,14 @@ export declare const incumbent: (options: DiscoverOptions & {
29
29
  state: "failed" | "ready" | "waiting";
30
30
  } | undefined, never, FileSystem.FileSystem>;
31
31
  /** Ensure a healthy, compatible local service is running. */
32
- export declare const ensure: (options?: EnsureOptions | undefined) => Effect.Effect<import("./service.js").Endpoint, Error, FileSystem.FileSystem>;
32
+ export declare const ensure: (options?: EnsureOptions | undefined) => Effect.Effect<{
33
+ url: string;
34
+ auth: {
35
+ type: "basic";
36
+ username: string;
37
+ password: string;
38
+ } | undefined;
39
+ }, Error, FileSystem.FileSystem>;
33
40
  /** Stop the registered local service. */
34
41
  export declare const stop: (options?: StopOptions | undefined) => Effect.Effect<void, Error, FileSystem.FileSystem>;
35
42
  /** Schema for the local service registration file. */
@@ -63,7 +70,14 @@ export declare const Service: {
63
70
  };
64
71
  state: "failed" | "ready" | "waiting";
65
72
  } | undefined, never, FileSystem.FileSystem>;
66
- ensure: (options?: EnsureOptions | undefined) => Effect.Effect<import("./service.js").Endpoint, Error, FileSystem.FileSystem>;
73
+ ensure: (options?: EnsureOptions | undefined) => Effect.Effect<{
74
+ url: string;
75
+ auth: {
76
+ type: "basic";
77
+ username: string;
78
+ password: string;
79
+ } | undefined;
80
+ }, Error, FileSystem.FileSystem>;
67
81
  stop: (options?: StopOptions | undefined) => Effect.Effect<void, Error, FileSystem.FileSystem>;
68
82
  headers: typeof headers;
69
83
  Info: Schema.Struct<{
@@ -1,27 +1,28 @@
1
1
  import {
2
2
  spawnServiceContender2,
3
3
  contenderPool2
4
- } from "../chunks/pty-handoff-ve4aws36.js";
4
+ } from "../chunks/service-probe-ve4aws36.js";
5
5
  import {
6
6
  defaultEnsureTiming2,
7
7
  ensureTiming2
8
- } from "../chunks/pty-handoff-xgnj2w4v.js";
8
+ } from "../chunks/service-probe-xgnj2w4v.js";
9
9
  import {
10
10
  matchesVersion2
11
- } from "../chunks/pty-handoff-sxt88q69.js";
11
+ } from "../chunks/service-probe-sxt88q69.js";
12
12
  import {
13
13
  prepare2,
14
14
  environment2,
15
15
  complete2,
16
16
  clear2
17
- } from "../chunks/pty-handoff-71wkqa80.js";
17
+ } from "../chunks/service-probe-1thtawyv.js";
18
18
  import {
19
+ decide2,
19
20
  fallback2,
20
21
  same2,
21
22
  probeResult2,
22
23
  headers2
23
- } from "../chunks/pty-handoff-ank0d71z.js";
24
- import"../chunks/pty-handoff-qav6mfdz.js";
24
+ } from "../chunks/service-probe-2ny4vxct.js";
25
+ import"../chunks/service-probe-qav6mfdz.js";
25
26
 
26
27
  // src/effect/service.ts
27
28
  import { Effect, FileSystem, Option, Schedule, Schema } from "effect";
@@ -91,26 +92,20 @@ var ensure = Effect.fn("service.ensure")(function* (options = {}) {
91
92
  timeouts = undefined;
92
93
  if (service2 !== undefined) {
93
94
  pool.serviceAnswered();
94
- const versionMatches = matchesVersion2(service2.version, options);
95
- const compatible = service2.compatible && versionMatches;
96
- if (!service2.compatible && versionMatches)
97
- return yield* Effect.fail(new Error("Background service uses an incompatible health protocol. Update this client or explicitly restart the service."));
98
- if (compatible && service2.state === "ready") {
95
+ const decision = decide2(service2, options);
96
+ if (decision._tag === "fail")
97
+ return yield* Effect.fail(decision.error);
98
+ if (decision._tag === "reuse") {
99
99
  yield* Effect.tryPromise(() => complete2(options.file ?? fallback2(), service2.info));
100
100
  return Option.some(service2);
101
101
  }
102
- if (compatible && service2.state === "failed")
103
- return yield* Effect.fail(new Error("Background service failed to start"));
104
- if (compatible)
105
- return Option.none();
106
- yield* announce("version-mismatch", service2.version);
107
- if (service2.state !== "ready")
108
- yield* Effect.logWarning("Background service is not ready; replacement cannot preserve persistent terminals");
109
- yield* stop({
110
- file: options.file,
111
- pty: service2.state === "ready" ? "handoff" : "clear"
112
- }).pipe(Effect.ignore);
113
- pool.evict(service2.info.pid);
102
+ if (decision._tag === "replace") {
103
+ yield* announce("version-mismatch", service2.version);
104
+ if (service2.state !== "ready")
105
+ yield* Effect.logWarning("Background service is not ready; replacement cannot preserve persistent terminals");
106
+ yield* stop({ file: options.file, pty: decision.pty }).pipe(Effect.ignore);
107
+ pool.evict(service2.info.pid);
108
+ }
114
109
  return Option.none();
115
110
  }
116
111
  const failed = pool.reap();
@@ -113,6 +113,7 @@ export declare function make(options: ClientOptions): {
113
113
  };
114
114
  connect: {
115
115
  key: (input: import("./index.js").IntegrationConnectKeyInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
116
+ external: (input: import("./index.js").IntegrationConnectExternalInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
116
117
  };
117
118
  oauth: {
118
119
  connect: (input: import("./index.js").IntegrationOauthConnectInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").IntegrationOauthConnectOutput>;
@@ -1,14 +1,14 @@
1
1
  import {
2
- make2,
3
- exports_client
4
- } from "../chunks/pty-handoff-cqfz2qxq.js";
5
- import"../chunks/pty-handoff-vyas3vgt.js";
6
- import"../chunks/pty-handoff-qzsnm4q8.js";
7
- import"../chunks/pty-handoff-js54wxgp.js";
8
- import"../chunks/pty-handoff-1y4a697q.js";
9
- import"../chunks/pty-handoff-vt9jbch8.js";
10
- import"../chunks/pty-handoff-frbwqjmf.js";
2
+ make5,
3
+ exports_client3
4
+ } from "../chunks/service-probe-z1hcmzxa.js";
5
+ import"../chunks/service-probe-vyas3vgt.js";
6
+ import"../chunks/service-probe-1y4a697q.js";
7
+ import"../chunks/service-probe-vt9jbch8.js";
8
+ import"../chunks/service-probe-9h52wrcy.js";
9
+ import"../chunks/service-probe-nwcpakzx.js";
10
+ import"../chunks/service-probe-frbwqjmf.js";
11
11
  export {
12
- exports_client as OpenCode,
13
- make2 as make
12
+ exports_client3 as OpenCode,
13
+ make5 as make
14
14
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
- ClientError2
3
- } from "../../chunks/pty-handoff-js54wxgp.js";
2
+ ClientError3
3
+ } from "../../chunks/service-probe-nwcpakzx.js";
4
4
  export {
5
- ClientError2 as ClientError
5
+ ClientError3 as ClientError
6
6
  };
@@ -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, 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";
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, IntegrationConnectExternalInput, 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;
@@ -114,6 +114,7 @@ export declare function make(options: ClientOptions): {
114
114
  };
115
115
  connect: {
116
116
  key: (input: IntegrationConnectKeyInput, requestOptions?: RequestOptions) => Promise<void>;
117
+ external: (input: IntegrationConnectExternalInput, requestOptions?: RequestOptions) => Promise<void>;
117
118
  };
118
119
  oauth: {
119
120
  connect: (input: IntegrationOauthConnectInput, requestOptions?: RequestOptions) => Promise<IntegrationOauthConnectOutput>;
@@ -1,7 +1,7 @@
1
1
  import {
2
- make3
3
- } from "../../chunks/pty-handoff-qzsnm4q8.js";
4
- import"../../chunks/pty-handoff-js54wxgp.js";
2
+ make6
3
+ } from "../../chunks/service-probe-9h52wrcy.js";
4
+ import"../../chunks/service-probe-nwcpakzx.js";
5
5
  export {
6
- make3 as make
6
+ make6 as make
7
7
  };
@@ -1,10 +1,4 @@
1
- import"../../chunks/pty-handoff-vyas3vgt.js";
2
- import {
3
- exports_client2
4
- } from "../../chunks/pty-handoff-qzsnm4q8.js";
5
- import {
6
- ClientError2
7
- } from "../../chunks/pty-handoff-js54wxgp.js";
1
+ import"../../chunks/service-probe-vyas3vgt.js";
8
2
  import {
9
3
  isInvalidRequestError2,
10
4
  isUnauthorizedError2,
@@ -39,10 +33,16 @@ import {
39
33
  isShellNotFoundError2,
40
34
  isWorktreeError2,
41
35
  isVcsInitNotSupportedError2
42
- } from "../../chunks/pty-handoff-vt9jbch8.js";
36
+ } from "../../chunks/service-probe-vt9jbch8.js";
37
+ import {
38
+ exports_client4
39
+ } from "../../chunks/service-probe-9h52wrcy.js";
40
+ import {
41
+ ClientError3
42
+ } from "../../chunks/service-probe-nwcpakzx.js";
43
43
  export {
44
- ClientError2 as ClientError,
45
- exports_client2 as OpenCode,
44
+ ClientError3 as ClientError,
45
+ exports_client4 as OpenCode,
46
46
  isAgentNotFoundError2 as isAgentNotFoundError,
47
47
  isCommandExecutionError2 as isCommandExecutionError,
48
48
  isCommandNotFoundError2 as isCommandNotFoundError,
@@ -496,6 +496,13 @@ export type CredentialOAuth = {
496
496
  [x: string]: JsonValue;
497
497
  };
498
498
  };
499
+ export type CredentialExternal = {
500
+ type: "external";
501
+ methodID: string;
502
+ metadata?: {
503
+ [x: string]: JsonValue;
504
+ };
505
+ };
499
506
  export type ProjectVcs = string;
500
507
  export type ProjectIcon = {
501
508
  url?: string;
@@ -2207,6 +2214,8 @@ export type ModelCompatibility = {
2207
2214
  requireFinishReason?: boolean;
2208
2215
  requireAssistantAfterTool?: boolean;
2209
2216
  supportsPromptCacheKey?: boolean;
2217
+ supportsThinkingBlockBinding?: boolean;
2218
+ supportsEffortUpdates?: boolean;
2210
2219
  };
2211
2220
  export type ModelCost = {
2212
2221
  tier?: {
@@ -2224,7 +2233,7 @@ export type ConnectionCredentialInfo = {
2224
2233
  type: "credential";
2225
2234
  id: string;
2226
2235
  label: string;
2227
- method: "key" | "oauth";
2236
+ method: "key" | "oauth" | "external";
2228
2237
  status?: ConnectionStatus;
2229
2238
  };
2230
2239
  export type ConnectionEnvInfo = {
@@ -3136,7 +3145,7 @@ export type ConfigEntry = {
3136
3145
  portable_shell_scanner?: boolean;
3137
3146
  subagent_depth?: number;
3138
3147
  policies?: Array<{
3139
- action: "provider.use" | "permission";
3148
+ action: "provider.use" | "tool.use" | "integration.use";
3140
3149
  resource: string;
3141
3150
  effect: "allow" | "deny";
3142
3151
  }>;
@@ -3203,7 +3212,7 @@ export type SessionMessageAssistantTool1 = {
3203
3212
  };
3204
3213
  };
3205
3214
  export type FormFields = [FormField, ...Array<FormField>];
3206
- export type CredentialValue = CredentialOAuth | CredentialKey;
3215
+ export type CredentialValue = CredentialOAuth | CredentialKey | CredentialExternal;
3207
3216
  export type FormFields2 = [FormField1, ...Array<FormField1>];
3208
3217
  export type SessionsResponse = {
3209
3218
  data: Array<SessionInfo>;
@@ -3286,6 +3295,12 @@ export type IntegrationKeyMethod = {
3286
3295
  label?: string;
3287
3296
  form?: FormFields;
3288
3297
  };
3298
+ export type IntegrationExternalMethod = {
3299
+ id: string;
3300
+ type: "external";
3301
+ label: string;
3302
+ form?: FormFields;
3303
+ };
3289
3304
  export type CredentialEntry = {
3290
3305
  id: string;
3291
3306
  integrationID: string;
@@ -3320,7 +3335,7 @@ export type SessionMessageContentUpdated = {
3320
3335
  content: Array<SessionMessageAssistantContentEncoded>;
3321
3336
  };
3322
3337
  };
3323
- export type IntegrationMethod = IntegrationOAuthMethod | IntegrationCommandMethod | IntegrationKeyMethod | IntegrationEnvMethod;
3338
+ export type IntegrationMethod = IntegrationOAuthMethod | IntegrationCommandMethod | IntegrationKeyMethod | IntegrationExternalMethod | IntegrationEnvMethod;
3324
3339
  export type FormCreated = {
3325
3340
  id: string;
3326
3341
  created: number;
@@ -7322,6 +7337,38 @@ export type IntegrationConnectKeyInput = {
7322
7337
  }["label"];
7323
7338
  };
7324
7339
  export type IntegrationConnectKeyOutput = void;
7340
+ export type IntegrationConnectExternalInput = {
7341
+ readonly integrationID: {
7342
+ readonly integrationID: string;
7343
+ }["integrationID"];
7344
+ readonly location?: {
7345
+ readonly location?: {
7346
+ readonly directory?: string | undefined;
7347
+ } | undefined;
7348
+ }["location"];
7349
+ readonly methodID: {
7350
+ readonly methodID: string;
7351
+ readonly answer?: {
7352
+ readonly [x: string]: string | number | boolean | ReadonlyArray<string>;
7353
+ } | undefined;
7354
+ readonly label?: string | undefined;
7355
+ }["methodID"];
7356
+ readonly answer?: {
7357
+ readonly methodID: string;
7358
+ readonly answer?: {
7359
+ readonly [x: string]: string | number | boolean | ReadonlyArray<string>;
7360
+ } | undefined;
7361
+ readonly label?: string | undefined;
7362
+ }["answer"];
7363
+ readonly label?: {
7364
+ readonly methodID: string;
7365
+ readonly answer?: {
7366
+ readonly [x: string]: string | number | boolean | ReadonlyArray<string>;
7367
+ } | undefined;
7368
+ readonly label?: string | undefined;
7369
+ }["label"];
7370
+ };
7371
+ export type IntegrationConnectExternalOutput = void;
7325
7372
  export type IntegrationOauthConnectInput = {
7326
7373
  readonly integrationID: {
7327
7374
  readonly integrationID: string;
@@ -7600,6 +7647,12 @@ export type CredentialCreateInput = {
7600
7647
  readonly configuration?: {
7601
7648
  readonly [x: string]: string | number | "Infinity" | "-Infinity" | "NaN" | boolean | ReadonlyArray<string>;
7602
7649
  };
7650
+ } | {
7651
+ readonly type: "external";
7652
+ readonly methodID: string;
7653
+ readonly metadata?: {
7654
+ readonly [x: string]: JsonValue;
7655
+ };
7603
7656
  };
7604
7657
  readonly activate?: boolean;
7605
7658
  }["id"];
@@ -7625,6 +7678,12 @@ export type CredentialCreateInput = {
7625
7678
  readonly configuration?: {
7626
7679
  readonly [x: string]: string | number | "Infinity" | "-Infinity" | "NaN" | boolean | ReadonlyArray<string>;
7627
7680
  };
7681
+ } | {
7682
+ readonly type: "external";
7683
+ readonly methodID: string;
7684
+ readonly metadata?: {
7685
+ readonly [x: string]: JsonValue;
7686
+ };
7628
7687
  };
7629
7688
  readonly activate?: boolean;
7630
7689
  }["integrationID"];
@@ -7650,6 +7709,12 @@ export type CredentialCreateInput = {
7650
7709
  readonly configuration?: {
7651
7710
  readonly [x: string]: string | number | "Infinity" | "-Infinity" | "NaN" | boolean | ReadonlyArray<string>;
7652
7711
  };
7712
+ } | {
7713
+ readonly type: "external";
7714
+ readonly methodID: string;
7715
+ readonly metadata?: {
7716
+ readonly [x: string]: JsonValue;
7717
+ };
7653
7718
  };
7654
7719
  readonly activate?: boolean;
7655
7720
  }["label"];
@@ -7675,6 +7740,12 @@ export type CredentialCreateInput = {
7675
7740
  readonly configuration?: {
7676
7741
  readonly [x: string]: string | number | "Infinity" | "-Infinity" | "NaN" | boolean | ReadonlyArray<string>;
7677
7742
  };
7743
+ } | {
7744
+ readonly type: "external";
7745
+ readonly methodID: string;
7746
+ readonly metadata?: {
7747
+ readonly [x: string]: JsonValue;
7748
+ };
7678
7749
  };
7679
7750
  readonly activate?: boolean;
7680
7751
  }["value"];
@@ -7700,6 +7771,12 @@ export type CredentialCreateInput = {
7700
7771
  readonly configuration?: {
7701
7772
  readonly [x: string]: string | number | "Infinity" | "-Infinity" | "NaN" | boolean | ReadonlyArray<string>;
7702
7773
  };
7774
+ } | {
7775
+ readonly type: "external";
7776
+ readonly methodID: string;
7777
+ readonly metadata?: {
7778
+ readonly [x: string]: JsonValue;
7779
+ };
7703
7780
  };
7704
7781
  readonly activate?: boolean;
7705
7782
  }["activate"];
@@ -32,7 +32,7 @@ import {
32
32
  isShellNotFoundError2,
33
33
  isWorktreeError2,
34
34
  isVcsInitNotSupportedError2
35
- } from "../../chunks/pty-handoff-vt9jbch8.js";
35
+ } from "../../chunks/service-probe-vt9jbch8.js";
36
36
  export {
37
37
  isAgentNotFoundError2 as isAgentNotFoundError,
38
38
  isCommandExecutionError2 as isCommandExecutionError,
@@ -1,13 +1,9 @@
1
- import"../chunks/pty-handoff-m2eywc8w.js";
1
+ import"../chunks/service-probe-m2eywc8w.js";
2
2
  import {
3
- exports_client
4
- } from "../chunks/pty-handoff-cqfz2qxq.js";
5
- import"../chunks/pty-handoff-vyas3vgt.js";
6
- import"../chunks/pty-handoff-qzsnm4q8.js";
7
- import {
8
- ClientError2
9
- } from "../chunks/pty-handoff-js54wxgp.js";
10
- import"../chunks/pty-handoff-1y4a697q.js";
3
+ exports_client3
4
+ } from "../chunks/service-probe-z1hcmzxa.js";
5
+ import"../chunks/service-probe-vyas3vgt.js";
6
+ import"../chunks/service-probe-1y4a697q.js";
11
7
  import {
12
8
  isInvalidRequestError2,
13
9
  isUnauthorizedError2,
@@ -42,11 +38,15 @@ import {
42
38
  isShellNotFoundError2,
43
39
  isWorktreeError2,
44
40
  isVcsInitNotSupportedError2
45
- } from "../chunks/pty-handoff-vt9jbch8.js";
46
- import"../chunks/pty-handoff-frbwqjmf.js";
41
+ } from "../chunks/service-probe-vt9jbch8.js";
42
+ import"../chunks/service-probe-9h52wrcy.js";
43
+ import {
44
+ ClientError3
45
+ } from "../chunks/service-probe-nwcpakzx.js";
46
+ import"../chunks/service-probe-frbwqjmf.js";
47
47
  export {
48
- ClientError2 as ClientError,
49
- exports_client as OpenCode,
48
+ ClientError3 as ClientError,
49
+ exports_client3 as OpenCode,
50
50
  isAgentNotFoundError2 as isAgentNotFoundError,
51
51
  isCommandExecutionError2 as isCommandExecutionError,
52
52
  isCommandNotFoundError2 as isCommandNotFoundError,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  makeRpc2
3
- } from "../chunks/pty-handoff-1y4a697q.js";
4
- import"../chunks/pty-handoff-vt9jbch8.js";
3
+ } from "../chunks/service-probe-1y4a697q.js";
4
+ import"../chunks/service-probe-vt9jbch8.js";
5
5
  export {
6
6
  makeRpc2 as makeRpc
7
7
  };
@@ -1,27 +1,28 @@
1
1
  import {
2
2
  spawnServiceContender2,
3
3
  contenderPool2
4
- } from "../chunks/pty-handoff-ve4aws36.js";
4
+ } from "../chunks/service-probe-ve4aws36.js";
5
5
  import {
6
6
  defaultEnsureTiming2,
7
7
  ensureTiming2
8
- } from "../chunks/pty-handoff-xgnj2w4v.js";
8
+ } from "../chunks/service-probe-xgnj2w4v.js";
9
9
  import {
10
10
  matchesVersion2
11
- } from "../chunks/pty-handoff-sxt88q69.js";
11
+ } from "../chunks/service-probe-sxt88q69.js";
12
12
  import {
13
13
  prepare2,
14
14
  environment2,
15
15
  complete2,
16
16
  clear2
17
- } from "../chunks/pty-handoff-71wkqa80.js";
17
+ } from "../chunks/service-probe-1thtawyv.js";
18
18
  import {
19
+ decide2,
19
20
  fallback2,
20
21
  same2,
21
22
  probeResult2,
22
23
  headers2
23
- } from "../chunks/pty-handoff-ank0d71z.js";
24
- import"../chunks/pty-handoff-qav6mfdz.js";
24
+ } from "../chunks/service-probe-2ny4vxct.js";
25
+ import"../chunks/service-probe-qav6mfdz.js";
25
26
 
26
27
  // src/promise/service.ts
27
28
  import { readFile, rm } from "node:fs/promises";
@@ -81,24 +82,18 @@ async function ensure(options = {}) {
81
82
  if (registration.service !== undefined) {
82
83
  pool.serviceAnswered();
83
84
  const service2 = registration.service;
84
- const versionMatches = matchesVersion2(service2.version, options);
85
- const compatible = service2.compatible && versionMatches;
86
- if (!service2.compatible && versionMatches)
87
- throw new Error("Background service uses an incompatible health protocol. Update this client or explicitly restart the service.");
88
- if (compatible && service2.state === "ready") {
85
+ const decision = decide2(service2, options);
86
+ if (decision._tag === "fail")
87
+ throw decision.error;
88
+ if (decision._tag === "reuse") {
89
89
  await complete2(options.file ?? fallback2(), service2.info);
90
90
  return service2.endpoint;
91
91
  }
92
- if (compatible && service2.state === "failed")
93
- throw new Error("Background service failed to start");
94
- if (!compatible) {
92
+ if (decision._tag === "replace") {
95
93
  announce("version-mismatch", service2.version);
96
94
  if (service2.state !== "ready")
97
95
  console.warn("Background service is not ready; replacement cannot preserve persistent terminals");
98
- await stop({
99
- file: options.file,
100
- pty: service2.state === "ready" ? "handoff" : "clear"
101
- }).catch(() => {
96
+ await stop({ file: options.file, pty: decision.pty }).catch(() => {
102
97
  return;
103
98
  });
104
99
  pool.evict(service2.info.pid);
@@ -4,7 +4,7 @@ import {
4
4
  complete2,
5
5
  clear2,
6
6
  exports_pty_handoff
7
- } from "./chunks/pty-handoff-71wkqa80.js";
7
+ } from "./chunks/service-probe-1thtawyv.js";
8
8
  export {
9
9
  exports_pty_handoff as PtyHandoff,
10
10
  clear2 as clear,
@@ -4,7 +4,7 @@ import {
4
4
  event2,
5
5
  eventType2,
6
6
  exports_rpc_runtime
7
- } from "./chunks/pty-handoff-t1xa31vm.js";
7
+ } from "./chunks/service-probe-t1xa31vm.js";
8
8
  export {
9
9
  exports_rpc_runtime as RpcRuntime,
10
10
  event2 as event,
@@ -2,7 +2,7 @@ import {
2
2
  spawnServiceContender2,
3
3
  contenderPool2,
4
4
  contenderFinished2
5
- } from "./chunks/pty-handoff-ve4aws36.js";
5
+ } from "./chunks/service-probe-ve4aws36.js";
6
6
  export {
7
7
  contenderFinished2 as contenderFinished,
8
8
  contenderPool2 as contenderPool,
@@ -1,4 +1,4 @@
1
- import type { Endpoint, Info } from "./service.js";
1
+ import type { DiscoverOptions, Endpoint, Info } from "./service.js";
2
2
  export type LocalService = {
3
3
  readonly info: Info;
4
4
  readonly endpoint: Endpoint;
@@ -6,6 +6,23 @@ export type LocalService = {
6
6
  readonly state: "ready" | "waiting" | "failed";
7
7
  readonly compatible: boolean;
8
8
  };
9
+ /**
10
+ * What `ensure()` does with a registered service that answered: return it, keep polling while
11
+ * it starts, replace it because its version does not meet the requirement, or fail.
12
+ */
13
+ export declare function decide(service: LocalService, options: DiscoverOptions): {
14
+ _tag: "fail";
15
+ error: Error;
16
+ } | {
17
+ readonly _tag: "replace";
18
+ readonly pty: "clear" | "handoff";
19
+ } | {
20
+ readonly _tag: "reuse";
21
+ readonly pty?: undefined;
22
+ } | {
23
+ readonly _tag: "wait";
24
+ readonly pty?: undefined;
25
+ };
9
26
  /** The default registration file. */
10
27
  export declare function fallback(): string;
11
28
  /** Whether two registrations describe the same service instance. */