@zvada/agent-server 0.3.27 → 0.3.30

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 (190) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +6 -4
  3. package/dist/core/agents/acp/account.js +111 -0
  4. package/dist/core/agents/acp/acp-agent.js +249 -158
  5. package/dist/core/agents/acp/adapter.js +103 -34
  6. package/dist/core/agents/acp/client.js +169 -42
  7. package/dist/core/agents/acp/known-agents.js +12 -5
  8. package/dist/core/agents/acp/mappings.js +84 -20
  9. package/dist/core/agents/acp/models.js +59 -0
  10. package/dist/core/agents/acp/profile.js +36 -0
  11. package/dist/core/agents/acp/prompts.js +248 -0
  12. package/dist/core/agents/acp/requests.js +4 -4
  13. package/dist/core/agents/claude-code/claude-agent.js +2 -12
  14. package/dist/core/agents/claude-code/login.js +4 -1
  15. package/dist/core/agents/claude-code/session.js +50 -18
  16. package/dist/core/agents/claude-code/spawn.js +0 -26
  17. package/dist/core/agents/claude-code/turn.js +6 -2
  18. package/dist/core/agents/codex-app-server/client.js +12 -13
  19. package/dist/core/agents/codex-app-server/login.js +4 -1
  20. package/dist/core/agents/gemini/failures.js +133 -0
  21. package/dist/core/agents/gemini/login.js +173 -0
  22. package/dist/core/agents/gemini/profile.js +138 -0
  23. package/dist/core/agents/gemini/tools.js +91 -0
  24. package/dist/core/agents/login.js +8 -6
  25. package/dist/core/agents/stderr-tail.js +5 -2
  26. package/dist/core/presets.js +13 -0
  27. package/dist/core/processes/native-processes.js +23 -1
  28. package/dist/core/provision/install-build.js +70 -26
  29. package/dist/core/provision/pins.js +5 -0
  30. package/dist/core/provision/provisioner.js +39 -16
  31. package/dist/core/provision/releases.js +39 -1
  32. package/dist/core/provision/tools.js +87 -28
  33. package/dist/operator/errors.js +2 -2
  34. package/dist/operator/operator.js +201 -90
  35. package/dist/operator/render.js +34 -28
  36. package/dist/operator/session-tools.js +2 -1
  37. package/dist/protocol/account.js +5 -1
  38. package/dist/protocol/auth.js +5 -1
  39. package/dist/protocol/config.js +4 -2
  40. package/dist/protocol/credentials.js +9 -1
  41. package/dist/protocol/harness.js +9 -1
  42. package/dist/protocol/part-input.js +2 -6
  43. package/dist/protocol/text-parts.js +10 -0
  44. package/dist/server/bin.js +22 -7
  45. package/dist/server/install.js +6 -4
  46. package/dist/types/core/agents/acp/account.d.ts +55 -0
  47. package/dist/types/core/agents/acp/account.d.ts.map +1 -0
  48. package/dist/types/core/agents/acp/acp-agent.d.ts +65 -36
  49. package/dist/types/core/agents/acp/acp-agent.d.ts.map +1 -1
  50. package/dist/types/core/agents/acp/adapter.d.ts +28 -3
  51. package/dist/types/core/agents/acp/adapter.d.ts.map +1 -1
  52. package/dist/types/core/agents/acp/client.d.ts +66 -4
  53. package/dist/types/core/agents/acp/client.d.ts.map +1 -1
  54. package/dist/types/core/agents/acp/known-agents.d.ts +4 -2
  55. package/dist/types/core/agents/acp/known-agents.d.ts.map +1 -1
  56. package/dist/types/core/agents/acp/mappings.d.ts +53 -7
  57. package/dist/types/core/agents/acp/mappings.d.ts.map +1 -1
  58. package/dist/types/core/agents/acp/models.d.ts +22 -0
  59. package/dist/types/core/agents/acp/models.d.ts.map +1 -0
  60. package/dist/types/core/agents/acp/profile.d.ts +97 -0
  61. package/dist/types/core/agents/acp/profile.d.ts.map +1 -0
  62. package/dist/types/core/agents/acp/prompts.d.ts +108 -0
  63. package/dist/types/core/agents/acp/prompts.d.ts.map +1 -0
  64. package/dist/types/core/agents/acp/requests.d.ts +7 -1
  65. package/dist/types/core/agents/acp/requests.d.ts.map +1 -1
  66. package/dist/types/core/agents/claude-code/claude-agent.d.ts +1 -2
  67. package/dist/types/core/agents/claude-code/claude-agent.d.ts.map +1 -1
  68. package/dist/types/core/agents/claude-code/login.d.ts.map +1 -1
  69. package/dist/types/core/agents/claude-code/options.d.ts +1 -1
  70. package/dist/types/core/agents/claude-code/options.d.ts.map +1 -1
  71. package/dist/types/core/agents/claude-code/session.d.ts +7 -6
  72. package/dist/types/core/agents/claude-code/session.d.ts.map +1 -1
  73. package/dist/types/core/agents/claude-code/spawn.d.ts +0 -8
  74. package/dist/types/core/agents/claude-code/spawn.d.ts.map +1 -1
  75. package/dist/types/core/agents/claude-code/turn.d.ts +3 -2
  76. package/dist/types/core/agents/claude-code/turn.d.ts.map +1 -1
  77. package/dist/types/core/agents/codex-app-server/client.d.ts.map +1 -1
  78. package/dist/types/core/agents/codex-app-server/login.d.ts.map +1 -1
  79. package/dist/types/core/agents/gemini/failures.d.ts +25 -0
  80. package/dist/types/core/agents/gemini/failures.d.ts.map +1 -0
  81. package/dist/types/core/agents/gemini/login.d.ts +28 -0
  82. package/dist/types/core/agents/gemini/login.d.ts.map +1 -0
  83. package/dist/types/core/agents/gemini/profile.d.ts +30 -0
  84. package/dist/types/core/agents/gemini/profile.d.ts.map +1 -0
  85. package/dist/types/core/agents/gemini/tools.d.ts +18 -0
  86. package/dist/types/core/agents/gemini/tools.d.ts.map +1 -0
  87. package/dist/types/core/agents/login.d.ts +15 -5
  88. package/dist/types/core/agents/login.d.ts.map +1 -1
  89. package/dist/types/core/agents/stderr-tail.d.ts +1 -1
  90. package/dist/types/core/agents/stderr-tail.d.ts.map +1 -1
  91. package/dist/types/core/presets.d.ts +2 -2
  92. package/dist/types/core/presets.d.ts.map +1 -1
  93. package/dist/types/core/processes/native-processes.d.ts +6 -0
  94. package/dist/types/core/processes/native-processes.d.ts.map +1 -1
  95. package/dist/types/core/provision/checksums.d.ts +7 -1
  96. package/dist/types/core/provision/checksums.d.ts.map +1 -1
  97. package/dist/types/core/provision/install-build.d.ts +32 -6
  98. package/dist/types/core/provision/install-build.d.ts.map +1 -1
  99. package/dist/types/core/provision/pins.d.ts +4 -0
  100. package/dist/types/core/provision/pins.d.ts.map +1 -1
  101. package/dist/types/core/provision/provisioner.d.ts +18 -7
  102. package/dist/types/core/provision/provisioner.d.ts.map +1 -1
  103. package/dist/types/core/provision/releases.d.ts +2 -1
  104. package/dist/types/core/provision/releases.d.ts.map +1 -1
  105. package/dist/types/core/provision/tools.d.ts +36 -7
  106. package/dist/types/core/provision/tools.d.ts.map +1 -1
  107. package/dist/types/operator/errors.d.ts +5 -1
  108. package/dist/types/operator/errors.d.ts.map +1 -1
  109. package/dist/types/operator/operator.d.ts.map +1 -1
  110. package/dist/types/operator/render.d.ts +11 -6
  111. package/dist/types/operator/render.d.ts.map +1 -1
  112. package/dist/types/operator/session-tools.d.ts.map +1 -1
  113. package/dist/types/operator/types.d.ts +5 -4
  114. package/dist/types/operator/types.d.ts.map +1 -1
  115. package/dist/types/protocol/account.d.ts +4 -2
  116. package/dist/types/protocol/account.d.ts.map +1 -1
  117. package/dist/types/protocol/auth.d.ts +10 -7
  118. package/dist/types/protocol/auth.d.ts.map +1 -1
  119. package/dist/types/protocol/clis.d.ts +4 -3
  120. package/dist/types/protocol/clis.d.ts.map +1 -1
  121. package/dist/types/protocol/config.d.ts +6 -2
  122. package/dist/types/protocol/config.d.ts.map +1 -1
  123. package/dist/types/protocol/conversation.d.ts +3 -3
  124. package/dist/types/protocol/credentials.d.ts +8 -0
  125. package/dist/types/protocol/credentials.d.ts.map +1 -1
  126. package/dist/types/protocol/execution.d.ts +1 -1
  127. package/dist/types/protocol/harness.d.ts +5 -2
  128. package/dist/types/protocol/harness.d.ts.map +1 -1
  129. package/dist/types/protocol/lifecycle.d.ts +8 -8
  130. package/dist/types/protocol/models.d.ts +3 -0
  131. package/dist/types/protocol/models.d.ts.map +1 -1
  132. package/dist/types/protocol/part-input.d.ts.map +1 -1
  133. package/dist/types/protocol/text-parts.d.ts +10 -0
  134. package/dist/types/protocol/text-parts.d.ts.map +1 -0
  135. package/dist/types/protocol/wire-api.d.ts +39 -29
  136. package/dist/types/protocol/wire-api.d.ts.map +1 -1
  137. package/dist/types/protocol/wire.d.ts +13 -10
  138. package/dist/types/protocol/wire.d.ts.map +1 -1
  139. package/dist/types/server/install.d.ts +2 -1
  140. package/dist/types/server/install.d.ts.map +1 -1
  141. package/docs/consuming.md +8 -1
  142. package/docs/deploy.md +17 -8
  143. package/docs/harnesses.md +173 -44
  144. package/package.json +1 -1
  145. package/src/core/agents/acp/account.ts +158 -0
  146. package/src/core/agents/acp/acp-agent.ts +290 -178
  147. package/src/core/agents/acp/adapter.ts +126 -35
  148. package/src/core/agents/acp/client.ts +196 -49
  149. package/src/core/agents/acp/known-agents.ts +14 -5
  150. package/src/core/agents/acp/mappings.ts +112 -21
  151. package/src/core/agents/acp/models.ts +72 -0
  152. package/src/core/agents/acp/profile.ts +133 -0
  153. package/src/core/agents/acp/prompts.ts +287 -0
  154. package/src/core/agents/acp/requests.ts +16 -9
  155. package/src/core/agents/claude-code/claude-agent.ts +2 -13
  156. package/src/core/agents/claude-code/login.ts +4 -1
  157. package/src/core/agents/claude-code/options.ts +1 -1
  158. package/src/core/agents/claude-code/session.ts +50 -16
  159. package/src/core/agents/claude-code/spawn.ts +0 -26
  160. package/src/core/agents/claude-code/turn.ts +7 -2
  161. package/src/core/agents/codex-app-server/client.ts +11 -18
  162. package/src/core/agents/codex-app-server/login.ts +4 -5
  163. package/src/core/agents/gemini/failures.ts +148 -0
  164. package/src/core/agents/gemini/login.ts +188 -0
  165. package/src/core/agents/gemini/profile.ts +163 -0
  166. package/src/core/agents/gemini/tools.ts +99 -0
  167. package/src/core/agents/login.ts +14 -8
  168. package/src/core/agents/stderr-tail.ts +5 -2
  169. package/src/core/presets.ts +15 -2
  170. package/src/core/processes/native-processes.ts +32 -1
  171. package/src/core/provision/checksums.ts +12 -2
  172. package/src/core/provision/install-build.ts +122 -55
  173. package/src/core/provision/pins.ts +5 -0
  174. package/src/core/provision/provisioner.ts +62 -27
  175. package/src/core/provision/releases.ts +47 -1
  176. package/src/core/provision/tools.ts +124 -31
  177. package/src/operator/errors.ts +5 -2
  178. package/src/operator/operator.ts +208 -91
  179. package/src/operator/render.ts +61 -33
  180. package/src/operator/session-tools.ts +2 -1
  181. package/src/operator/types.ts +5 -4
  182. package/src/protocol/account.ts +5 -2
  183. package/src/protocol/auth.ts +5 -1
  184. package/src/protocol/config.ts +4 -2
  185. package/src/protocol/credentials.ts +11 -2
  186. package/src/protocol/harness.ts +9 -1
  187. package/src/protocol/part-input.ts +2 -5
  188. package/src/protocol/text-parts.ts +10 -0
  189. package/src/server/bin.ts +20 -6
  190. package/src/server/install.ts +6 -3
@@ -8,6 +8,7 @@ import {
8
8
  } from "node:fs";
9
9
  import { readdir } from "node:fs/promises";
10
10
  import { createRequire } from "node:module";
11
+ import { homedir } from "node:os";
11
12
  import { dirname, join, resolve } from "node:path";
12
13
  import { pathToFileURL } from "node:url";
13
14
  import type { AgentHarness } from "../../protocol/index.ts";
@@ -22,12 +23,13 @@ import {
22
23
  } from "./platform.ts";
23
24
 
24
25
  /**
25
- * The managed CLIs. Each native harness maps onto exactly one of these; the
26
+ * The managed CLIs. Each native harness maps onto exactly one of these, and
27
+ * so does `gemini`, a profile on the ACP agent that runs Google's `agy`; the
26
28
  * `acp` harness maps onto none (its agent binaries are arbitrary third-party
27
29
  * commands the operator supplies, not something we pin or download), nor does
28
30
  * `scripted`, which runs no process.
29
31
  */
30
- export const CLI_TOOLS = ["claude", "codex"] as const;
32
+ export const CLI_TOOLS = ["claude", "codex", "agy"] as const;
31
33
  export type CliTool = (typeof CLI_TOOLS)[number];
32
34
 
33
35
  /**
@@ -38,6 +40,7 @@ export type CliTool = (typeof CLI_TOOLS)[number];
38
40
  const TOOL_FOR_HARNESS: Record<AgentHarness, CliTool | undefined> = {
39
41
  "claude-code": "claude",
40
42
  "codex-app-server": "codex",
43
+ gemini: "agy",
41
44
  acp: undefined,
42
45
  scripted: undefined,
43
46
  };
@@ -46,7 +49,7 @@ export function toolForHarness(harness: AgentHarness): CliTool | undefined {
46
49
  return TOOL_FOR_HARNESS[harness];
47
50
  }
48
51
 
49
- /** What to download for one tool on one platform. */
52
+ /** What to download from npm for one tool on one platform. */
50
53
  export interface ToolPackage {
51
54
  name: string;
52
55
  /** Exact version string the registry knows (codex encodes the platform here). */
@@ -55,6 +58,35 @@ export interface ToolPackage {
55
58
  suffix: string;
56
59
  }
57
60
 
61
+ /** A tool published as npm packages: the registry's metadata names each tarball and its integrity. */
62
+ export interface NpmSource {
63
+ readonly kind: "npm";
64
+ /** The registry package carrying this platform's build of `version`. */
65
+ package(platform: PlatformInfo, version: string): ToolPackage;
66
+ /** The directory of an extracted tarball that becomes the install. */
67
+ payload(extractedRoot: string): Promise<string>;
68
+ }
69
+
70
+ // @ref LLP 0010#source-kinds — a `url` build is the table's: nothing at run time can vouch for another
71
+ /**
72
+ * A tool published as files at addresses its vendor names: only this
73
+ * release's table says where each build is and what it must match
74
+ * (`CliBuild.url`), so a version the table does not hold is not downloaded.
75
+ * Its cache folders are named by the platform (`platformName`).
76
+ */
77
+ export interface UrlSource {
78
+ readonly kind: "url";
79
+ /**
80
+ * This platform's executable: its name in the install (one of
81
+ * `binaries`), and its name in the gzipped tarball the download is; no
82
+ * `member`, the download is the executable itself.
83
+ */
84
+ executable(platform: PlatformInfo): { readonly binary: string; readonly member?: string };
85
+ }
86
+
87
+ /** Where a tool's builds come from. */
88
+ export type CliSource = NpmSource | UrlSource;
89
+
58
90
  /** Where a host install is looked for. */
59
91
  export interface HostMachine {
60
92
  platform: PlatformInfo;
@@ -68,14 +100,16 @@ export interface HostMachine {
68
100
 
69
101
  /** What the provisioner knows of one managed CLI. */
70
102
  export interface CliToolSpec {
103
+ /** What people call it: `install` says it (`Codex CLI 0.169.1`). */
104
+ readonly title: string;
71
105
  /** The variable an operator points at the binary to run instead (never the wire's). */
72
106
  readonly overrideEnv: string;
73
107
  /** Where the binary sits in an installed tree; the first regular file wins. */
74
108
  readonly binaries: readonly string[];
75
109
  /** The platforms the vendor publishes a build for, as the cache names them. */
76
110
  readonly platforms: readonly string[];
77
- /** The registry package carrying this platform's build of `version`. */
78
- package(platform: PlatformInfo, version: string): ToolPackage;
111
+ /** Where its builds come from, and how one becomes the install. */
112
+ readonly source: CliSource;
79
113
  /** The version to download when no pin is set. */
80
114
  defaultVersion(): string;
81
115
  /** Why the default may not be the build that runs, when this machine cannot tell (said once). */
@@ -88,8 +122,6 @@ export interface CliToolSpec {
88
122
  * SDK's manifest names its own CLI's sha256.
89
123
  */
90
124
  localBuild?(suffix: string, version: string): LocalBuild | undefined;
91
- /** The directory of an extracted tarball that becomes the install. */
92
- payload(extractedRoot: string): Promise<string>;
93
125
  /**
94
126
  * What `system` mode fails with when the host has none; absent, the
95
127
  * harness's own resolution speaks (the Claude SDK finds its sibling
@@ -228,6 +260,7 @@ const CODEX_BINARIES = [join("bin", "codex"), join("bin", "codex.exe")];
228
260
  */
229
261
  export const CLI_TOOL_SPECS: Record<CliTool, CliToolSpec> = {
230
262
  claude: {
263
+ title: "Claude Code",
231
264
  overrideEnv: "CLAUDE_CLI_PATH",
232
265
  binaries: ["claude", "claude.exe"],
233
266
  platforms: [
@@ -240,10 +273,22 @@ export const CLI_TOOL_SPECS: Record<CliTool, CliToolSpec> = {
240
273
  "win32-arm64",
241
274
  "win32-x64",
242
275
  ],
243
- // The platform packages carry the native CLI matched to the SDK JS.
244
- package: (platform, version) => {
245
- const suffix = claudePackageSuffix(platform);
246
- return { name: `@anthropic-ai/claude-agent-sdk-${suffix}`, registryVersion: version, suffix };
276
+ source: {
277
+ kind: "npm",
278
+ // The platform packages carry the native CLI matched to the SDK JS.
279
+ package: (platform, version) => {
280
+ const suffix = claudePackageSuffix(platform);
281
+ return {
282
+ name: `@anthropic-ai/claude-agent-sdk-${suffix}`,
283
+ registryVersion: version,
284
+ suffix,
285
+ };
286
+ },
287
+ payload: async (extractedRoot) => {
288
+ const dir = join(extractedRoot, "package");
289
+ if (existsSync(dir)) return dir;
290
+ throw new CliProvisionError("claude tarball has no package/ directory");
291
+ },
247
292
  },
248
293
  // The on-disk SDK's version (the pair that actually runs) over the
249
294
  // release default, which only decides inside compiled binaries. Even
@@ -277,11 +322,6 @@ export const CLI_TOOL_SPECS: Record<CliTool, CliToolSpec> = {
277
322
  const path = join(platformDir, claudeManifestBuild(sdk.dir, suffix)?.binary ?? "claude");
278
323
  return existsSync(path) ? { path, version: sdk.version } : undefined;
279
324
  },
280
- payload: async (extractedRoot) => {
281
- const dir = join(extractedRoot, "package");
282
- if (existsSync(dir)) return dir;
283
- throw new CliProvisionError("claude tarball has no package/ directory");
284
- },
285
325
  // The SDK on disk names its own CLI's checksum, for a version this
286
326
  // release did not pin (a consumer's lockfile moved the SDK).
287
327
  localBuild: (suffix, version) => {
@@ -292,6 +332,7 @@ export const CLI_TOOL_SPECS: Record<CliTool, CliToolSpec> = {
292
332
  },
293
333
  },
294
334
  codex: {
335
+ title: "Codex CLI",
295
336
  overrideEnv: "CODEX_CLI_PATH",
296
337
  binaries: CODEX_BINARIES,
297
338
  // Its linux builds are static, so there is no musl variant.
@@ -303,10 +344,24 @@ export const CLI_TOOL_SPECS: Record<CliTool, CliToolSpec> = {
303
344
  "win32-arm64",
304
345
  "win32-x64",
305
346
  ],
306
- // Codex publishes its platform builds as version suffixes of one package.
307
- package: (platform, version) => {
308
- const suffix = codexPackageSuffix(platform);
309
- return { name: "@openai/codex", registryVersion: `${version}-${suffix}`, suffix };
347
+ source: {
348
+ kind: "npm",
349
+ // Codex publishes its platform builds as version suffixes of one package.
350
+ package: (platform, version) => {
351
+ const suffix = codexPackageSuffix(platform);
352
+ return { name: "@openai/codex", registryVersion: `${version}-${suffix}`, suffix };
353
+ },
354
+ // Codex vendors per-target trees: package/vendor/<rust-triple>/bin/codex.
355
+ // Install the whole tree — the CLI expects its vendored rg/zsh siblings.
356
+ payload: async (extractedRoot) => {
357
+ const vendor = join(extractedRoot, "package", "vendor");
358
+ const entries = existsSync(vendor) ? await readdir(vendor) : [];
359
+ for (const entry of entries) {
360
+ const dir = join(vendor, entry);
361
+ if (binaryIn(dir, CODEX_BINARIES)) return dir;
362
+ }
363
+ throw new CliProvisionError("codex tarball has no vendor/<target>/bin/codex");
364
+ },
310
365
  },
311
366
  defaultVersion: () => DEFAULT_PINS.codex,
312
367
  // @ref LLP 0001#d18--the-engine-installs-the-clis-it-runs-pinned-builds-checked-before-a-turn — a lockfile's build, or in `system` the operator's PATH
@@ -333,17 +388,6 @@ export const CLI_TOOL_SPECS: Record<CliTool, CliToolSpec> = {
333
388
  const path = searchPath ? findOnPath("codex", env, platform.platform) : undefined;
334
389
  return path ? { path } : undefined;
335
390
  },
336
- // Codex vendors per-target trees: package/vendor/<rust-triple>/bin/codex.
337
- // Install the whole tree — the CLI expects its vendored rg/zsh siblings.
338
- payload: async (extractedRoot) => {
339
- const vendor = join(extractedRoot, "package", "vendor");
340
- const entries = existsSync(vendor) ? await readdir(vendor) : [];
341
- for (const entry of entries) {
342
- const dir = join(vendor, entry);
343
- if (binaryIn(dir, CODEX_BINARIES)) return dir;
344
- }
345
- throw new CliProvisionError("codex tarball has no vendor/<target>/bin/codex");
346
- },
347
391
  // A bare spawn would just ENOENT.
348
392
  notOnHost: () =>
349
393
  new CliNotFoundError(
@@ -351,4 +395,53 @@ export const CLI_TOOL_SPECS: Record<CliTool, CliToolSpec> = {
351
395
  'install it, set $CODEX_CLI_PATH, or use provision mode "auto"',
352
396
  ),
353
397
  },
398
+ // Google's Antigravity CLI, for the gemini harness.
399
+ agy: {
400
+ title: "Antigravity CLI",
401
+ overrideEnv: "ANTIGRAVITY_CLI_PATH",
402
+ binaries: ["agy", "agy.exe"],
403
+ platforms: [
404
+ "darwin-arm64",
405
+ "darwin-x64",
406
+ "linux-arm64",
407
+ "linux-x64",
408
+ "linux-arm64-musl",
409
+ "linux-x64-musl",
410
+ "win32-arm64",
411
+ "win32-x64",
412
+ ],
413
+ // Google publishes no package: each build is a file its update manifest
414
+ // names, with a sha512 and no signature, recorded at refresh
415
+ // (`scripts/refresh-cli-releases.ts`). The tarball's one member is
416
+ // `antigravity`, which its installer puts in place as `agy`; Windows'
417
+ // build is the executable itself.
418
+ source: {
419
+ kind: "url",
420
+ executable: ({ platform }) =>
421
+ platform === "win32" ? { binary: "agy.exe" } : { binary: "agy", member: "antigravity" },
422
+ },
423
+ defaultVersion: () => DEFAULT_PINS.agy,
424
+ // @ref LLP 0010#source-kinds — the person's own agy updates itself: only `system` runs it
425
+ // Where Google's installers put it (`install.sh`: ~/.local/bin/agy;
426
+ // `install.ps1` and `install.cmd`: %LOCALAPPDATA%\agy\bin\agy.exe),
427
+ // then PATH, in `system` mode only: nobody chose that build for this
428
+ // engine, and it updates itself.
429
+ hostInstall: ({ platform, env, searchPath }) => {
430
+ if (!searchPath) return undefined;
431
+ const windows = platform.platform === "win32";
432
+ const local = windows ? env.LOCALAPPDATA : (env.HOME ?? homedir());
433
+ const installed =
434
+ local &&
435
+ binaryIn(windows ? join(local, "agy", "bin") : join(local, ".local", "bin"), [
436
+ windows ? "agy.exe" : "agy",
437
+ ]);
438
+ const path = installed || findOnPath("agy", env, platform.platform);
439
+ return path ? { path } : undefined;
440
+ },
441
+ notOnHost: () =>
442
+ new CliNotFoundError(
443
+ "agy",
444
+ 'install Google\'s Antigravity CLI (https://antigravity.google/docs/getting-started), set $ANTIGRAVITY_CLI_PATH, or use provision mode "auto"',
445
+ ),
446
+ },
354
447
  };
@@ -200,12 +200,15 @@ export const refuse = {
200
200
  `This computer cannot take another session now. Nothing was started.${retryAfter ? ` Try again in ${retryAfter}s.` : ""}`,
201
201
  { detail, retryAfter },
202
202
  ),
203
- staleCursor: (hint: Hint, ref: string) =>
203
+ staleCursor: (hint: Hint, ref: string, selection?: { after: string } | { last: number }) =>
204
204
  new OperatorError(
205
205
  "stale_cursor",
206
206
  `That cursor no longer points into ${q(ref)}. Nothing was read.`,
207
207
  {
208
- next: hint("read_session", { session: ref }),
208
+ next: hint(
209
+ "read_session",
210
+ selection ? { session: ref, ...selection, full: true } : { session: ref },
211
+ ),
209
212
  },
210
213
  ),
211
214
  unsupported: (detail?: string) =>