@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.
- package/CHANGELOG.md +61 -0
- package/README.md +6 -4
- package/dist/core/agents/acp/account.js +111 -0
- package/dist/core/agents/acp/acp-agent.js +249 -158
- package/dist/core/agents/acp/adapter.js +103 -34
- package/dist/core/agents/acp/client.js +169 -42
- package/dist/core/agents/acp/known-agents.js +12 -5
- package/dist/core/agents/acp/mappings.js +84 -20
- package/dist/core/agents/acp/models.js +59 -0
- package/dist/core/agents/acp/profile.js +36 -0
- package/dist/core/agents/acp/prompts.js +248 -0
- package/dist/core/agents/acp/requests.js +4 -4
- package/dist/core/agents/claude-code/claude-agent.js +2 -12
- package/dist/core/agents/claude-code/login.js +4 -1
- package/dist/core/agents/claude-code/session.js +50 -18
- package/dist/core/agents/claude-code/spawn.js +0 -26
- package/dist/core/agents/claude-code/turn.js +6 -2
- package/dist/core/agents/codex-app-server/client.js +12 -13
- package/dist/core/agents/codex-app-server/login.js +4 -1
- package/dist/core/agents/gemini/failures.js +133 -0
- package/dist/core/agents/gemini/login.js +173 -0
- package/dist/core/agents/gemini/profile.js +138 -0
- package/dist/core/agents/gemini/tools.js +91 -0
- package/dist/core/agents/login.js +8 -6
- package/dist/core/agents/stderr-tail.js +5 -2
- package/dist/core/presets.js +13 -0
- package/dist/core/processes/native-processes.js +23 -1
- package/dist/core/provision/install-build.js +70 -26
- package/dist/core/provision/pins.js +5 -0
- package/dist/core/provision/provisioner.js +39 -16
- package/dist/core/provision/releases.js +39 -1
- package/dist/core/provision/tools.js +87 -28
- package/dist/operator/errors.js +2 -2
- package/dist/operator/operator.js +201 -90
- package/dist/operator/render.js +34 -28
- package/dist/operator/session-tools.js +2 -1
- package/dist/protocol/account.js +5 -1
- package/dist/protocol/auth.js +5 -1
- package/dist/protocol/config.js +4 -2
- package/dist/protocol/credentials.js +9 -1
- package/dist/protocol/harness.js +9 -1
- package/dist/protocol/part-input.js +2 -6
- package/dist/protocol/text-parts.js +10 -0
- package/dist/server/bin.js +22 -7
- package/dist/server/install.js +6 -4
- package/dist/types/core/agents/acp/account.d.ts +55 -0
- package/dist/types/core/agents/acp/account.d.ts.map +1 -0
- package/dist/types/core/agents/acp/acp-agent.d.ts +65 -36
- package/dist/types/core/agents/acp/acp-agent.d.ts.map +1 -1
- package/dist/types/core/agents/acp/adapter.d.ts +28 -3
- package/dist/types/core/agents/acp/adapter.d.ts.map +1 -1
- package/dist/types/core/agents/acp/client.d.ts +66 -4
- package/dist/types/core/agents/acp/client.d.ts.map +1 -1
- package/dist/types/core/agents/acp/known-agents.d.ts +4 -2
- package/dist/types/core/agents/acp/known-agents.d.ts.map +1 -1
- package/dist/types/core/agents/acp/mappings.d.ts +53 -7
- package/dist/types/core/agents/acp/mappings.d.ts.map +1 -1
- package/dist/types/core/agents/acp/models.d.ts +22 -0
- package/dist/types/core/agents/acp/models.d.ts.map +1 -0
- package/dist/types/core/agents/acp/profile.d.ts +97 -0
- package/dist/types/core/agents/acp/profile.d.ts.map +1 -0
- package/dist/types/core/agents/acp/prompts.d.ts +108 -0
- package/dist/types/core/agents/acp/prompts.d.ts.map +1 -0
- package/dist/types/core/agents/acp/requests.d.ts +7 -1
- package/dist/types/core/agents/acp/requests.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/claude-agent.d.ts +1 -2
- package/dist/types/core/agents/claude-code/claude-agent.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/login.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/options.d.ts +1 -1
- package/dist/types/core/agents/claude-code/options.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/session.d.ts +7 -6
- package/dist/types/core/agents/claude-code/session.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/spawn.d.ts +0 -8
- package/dist/types/core/agents/claude-code/spawn.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/turn.d.ts +3 -2
- package/dist/types/core/agents/claude-code/turn.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/client.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/login.d.ts.map +1 -1
- package/dist/types/core/agents/gemini/failures.d.ts +25 -0
- package/dist/types/core/agents/gemini/failures.d.ts.map +1 -0
- package/dist/types/core/agents/gemini/login.d.ts +28 -0
- package/dist/types/core/agents/gemini/login.d.ts.map +1 -0
- package/dist/types/core/agents/gemini/profile.d.ts +30 -0
- package/dist/types/core/agents/gemini/profile.d.ts.map +1 -0
- package/dist/types/core/agents/gemini/tools.d.ts +18 -0
- package/dist/types/core/agents/gemini/tools.d.ts.map +1 -0
- package/dist/types/core/agents/login.d.ts +15 -5
- package/dist/types/core/agents/login.d.ts.map +1 -1
- package/dist/types/core/agents/stderr-tail.d.ts +1 -1
- package/dist/types/core/agents/stderr-tail.d.ts.map +1 -1
- package/dist/types/core/presets.d.ts +2 -2
- package/dist/types/core/presets.d.ts.map +1 -1
- package/dist/types/core/processes/native-processes.d.ts +6 -0
- package/dist/types/core/processes/native-processes.d.ts.map +1 -1
- package/dist/types/core/provision/checksums.d.ts +7 -1
- package/dist/types/core/provision/checksums.d.ts.map +1 -1
- package/dist/types/core/provision/install-build.d.ts +32 -6
- package/dist/types/core/provision/install-build.d.ts.map +1 -1
- package/dist/types/core/provision/pins.d.ts +4 -0
- package/dist/types/core/provision/pins.d.ts.map +1 -1
- package/dist/types/core/provision/provisioner.d.ts +18 -7
- package/dist/types/core/provision/provisioner.d.ts.map +1 -1
- package/dist/types/core/provision/releases.d.ts +2 -1
- package/dist/types/core/provision/releases.d.ts.map +1 -1
- package/dist/types/core/provision/tools.d.ts +36 -7
- package/dist/types/core/provision/tools.d.ts.map +1 -1
- package/dist/types/operator/errors.d.ts +5 -1
- package/dist/types/operator/errors.d.ts.map +1 -1
- package/dist/types/operator/operator.d.ts.map +1 -1
- package/dist/types/operator/render.d.ts +11 -6
- package/dist/types/operator/render.d.ts.map +1 -1
- package/dist/types/operator/session-tools.d.ts.map +1 -1
- package/dist/types/operator/types.d.ts +5 -4
- package/dist/types/operator/types.d.ts.map +1 -1
- package/dist/types/protocol/account.d.ts +4 -2
- package/dist/types/protocol/account.d.ts.map +1 -1
- package/dist/types/protocol/auth.d.ts +10 -7
- package/dist/types/protocol/auth.d.ts.map +1 -1
- package/dist/types/protocol/clis.d.ts +4 -3
- package/dist/types/protocol/clis.d.ts.map +1 -1
- package/dist/types/protocol/config.d.ts +6 -2
- package/dist/types/protocol/config.d.ts.map +1 -1
- package/dist/types/protocol/conversation.d.ts +3 -3
- package/dist/types/protocol/credentials.d.ts +8 -0
- package/dist/types/protocol/credentials.d.ts.map +1 -1
- package/dist/types/protocol/execution.d.ts +1 -1
- package/dist/types/protocol/harness.d.ts +5 -2
- package/dist/types/protocol/harness.d.ts.map +1 -1
- package/dist/types/protocol/lifecycle.d.ts +8 -8
- package/dist/types/protocol/models.d.ts +3 -0
- package/dist/types/protocol/models.d.ts.map +1 -1
- package/dist/types/protocol/part-input.d.ts.map +1 -1
- package/dist/types/protocol/text-parts.d.ts +10 -0
- package/dist/types/protocol/text-parts.d.ts.map +1 -0
- package/dist/types/protocol/wire-api.d.ts +39 -29
- package/dist/types/protocol/wire-api.d.ts.map +1 -1
- package/dist/types/protocol/wire.d.ts +13 -10
- package/dist/types/protocol/wire.d.ts.map +1 -1
- package/dist/types/server/install.d.ts +2 -1
- package/dist/types/server/install.d.ts.map +1 -1
- package/docs/consuming.md +8 -1
- package/docs/deploy.md +17 -8
- package/docs/harnesses.md +173 -44
- package/package.json +1 -1
- package/src/core/agents/acp/account.ts +158 -0
- package/src/core/agents/acp/acp-agent.ts +290 -178
- package/src/core/agents/acp/adapter.ts +126 -35
- package/src/core/agents/acp/client.ts +196 -49
- package/src/core/agents/acp/known-agents.ts +14 -5
- package/src/core/agents/acp/mappings.ts +112 -21
- package/src/core/agents/acp/models.ts +72 -0
- package/src/core/agents/acp/profile.ts +133 -0
- package/src/core/agents/acp/prompts.ts +287 -0
- package/src/core/agents/acp/requests.ts +16 -9
- package/src/core/agents/claude-code/claude-agent.ts +2 -13
- package/src/core/agents/claude-code/login.ts +4 -1
- package/src/core/agents/claude-code/options.ts +1 -1
- package/src/core/agents/claude-code/session.ts +50 -16
- package/src/core/agents/claude-code/spawn.ts +0 -26
- package/src/core/agents/claude-code/turn.ts +7 -2
- package/src/core/agents/codex-app-server/client.ts +11 -18
- package/src/core/agents/codex-app-server/login.ts +4 -5
- package/src/core/agents/gemini/failures.ts +148 -0
- package/src/core/agents/gemini/login.ts +188 -0
- package/src/core/agents/gemini/profile.ts +163 -0
- package/src/core/agents/gemini/tools.ts +99 -0
- package/src/core/agents/login.ts +14 -8
- package/src/core/agents/stderr-tail.ts +5 -2
- package/src/core/presets.ts +15 -2
- package/src/core/processes/native-processes.ts +32 -1
- package/src/core/provision/checksums.ts +12 -2
- package/src/core/provision/install-build.ts +122 -55
- package/src/core/provision/pins.ts +5 -0
- package/src/core/provision/provisioner.ts +62 -27
- package/src/core/provision/releases.ts +47 -1
- package/src/core/provision/tools.ts +124 -31
- package/src/operator/errors.ts +5 -2
- package/src/operator/operator.ts +208 -91
- package/src/operator/render.ts +61 -33
- package/src/operator/session-tools.ts +2 -1
- package/src/operator/types.ts +5 -4
- package/src/protocol/account.ts +5 -2
- package/src/protocol/auth.ts +5 -1
- package/src/protocol/config.ts +4 -2
- package/src/protocol/credentials.ts +11 -2
- package/src/protocol/harness.ts +9 -1
- package/src/protocol/part-input.ts +2 -5
- package/src/protocol/text-parts.ts +10 -0
- package/src/server/bin.ts +20 -6
- package/src/server/install.ts +6 -3
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { CliNotFoundError, CliProvisionError, InvalidRequestError } from "../../utils/errors.js";
|
|
2
|
+
import { ProfiledAcpAgent } from "../acp/acp-agent.js";
|
|
3
|
+
import { createAcpTransformer } from "../acp/adapter.js";
|
|
4
|
+
import { antigravityFailures } from "./failures.js";
|
|
5
|
+
import { AntigravityCliLogin } from "./login.js";
|
|
6
|
+
import { antigravityToolRules } from "./tools.js";
|
|
7
|
+
/** The oldest Antigravity CLI the harness drives: the one its behaviour was measured on. */
|
|
8
|
+
export const ANTIGRAVITY_FLOOR = "1.5.13";
|
|
9
|
+
const CAPABILITIES = {
|
|
10
|
+
multiTurn: true,
|
|
11
|
+
sessionResume: true,
|
|
12
|
+
// Set on the live session through its `model` option.
|
|
13
|
+
modelSwitch: "in_session",
|
|
14
|
+
// Its `thought_level` option, with each model's own levels.
|
|
15
|
+
thinkingLevels: true,
|
|
16
|
+
images: true,
|
|
17
|
+
// A PDF or another binary file is taken and dropped unread: only text is offered.
|
|
18
|
+
files: ["text"],
|
|
19
|
+
mcpServers: true,
|
|
20
|
+
permissionRequests: true,
|
|
21
|
+
// The answer is an option id.
|
|
22
|
+
rejectionMessages: false,
|
|
23
|
+
// A prompt sent while one runs is input to the running turn (LLP 0016.000).
|
|
24
|
+
steering: true,
|
|
25
|
+
ignoredSettings: [
|
|
26
|
+
// A prompt runs until the agent ends it: ACP v1 has no turn limit.
|
|
27
|
+
"maxTurns",
|
|
28
|
+
// session/resume names a session, not a message in it.
|
|
29
|
+
"resumeSessionAt",
|
|
30
|
+
// It runs on the person's own Antigravity sign-in.
|
|
31
|
+
"apiKey",
|
|
32
|
+
// ACP v1 cannot ask an agent to run without its tools.
|
|
33
|
+
"disableTools",
|
|
34
|
+
],
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* A Gemini model, by its id: `gemini-<version>-…`. Antigravity also lists
|
|
38
|
+
* Claude and GPT-OSS models and its `gemini-pro-orchestrator-*` entries,
|
|
39
|
+
* which the harness does not offer.
|
|
40
|
+
*/
|
|
41
|
+
export function isGeminiModel(id) {
|
|
42
|
+
return /^gemini-\d/.test(id);
|
|
43
|
+
}
|
|
44
|
+
/** Whether `found` is at least `floor`, by its numeric parts. */
|
|
45
|
+
function atLeast(found, floor) {
|
|
46
|
+
const parts = (version) => version.split(/[.-]/).map((part) => Number.parseInt(part, 10));
|
|
47
|
+
const [have, need] = [parts(found), parts(floor)];
|
|
48
|
+
for (let i = 0; i < need.length; i++) {
|
|
49
|
+
const a = have[i] ?? 0;
|
|
50
|
+
const b = need[i] ?? 0;
|
|
51
|
+
if (Number.isNaN(a))
|
|
52
|
+
return false;
|
|
53
|
+
if (a !== b)
|
|
54
|
+
return a > b;
|
|
55
|
+
}
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
// @ref LLP 0020#11-inheritconfig-must-be-all — the folder's configuration always loads; the person's needs a home of its own
|
|
59
|
+
/** Why a turn at each level below `all` cannot run (LLP 0020, decision 11). */
|
|
60
|
+
const CANNOT_INHERIT = {
|
|
61
|
+
none: "the gemini harness cannot run at inheritConfig `none`: Antigravity always loads the folder's own rules, skills, MCP servers and hooks, and nothing turns that off",
|
|
62
|
+
project: "the gemini harness cannot run at inheritConfig `project` yet: keeping the person's own configuration out takes an Antigravity home of the session's own (`--gemini-dir`), which this harness does not take yet",
|
|
63
|
+
};
|
|
64
|
+
/** Refuse a turn at a level Antigravity cannot keep to. */
|
|
65
|
+
function admit(level) {
|
|
66
|
+
if (level === "all")
|
|
67
|
+
return;
|
|
68
|
+
throw new InvalidRequestError([{ path: "inheritConfig", message: CANNOT_INHERIT[level] }]);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Refuse an Antigravity CLI older than the floor, or one that does not say
|
|
72
|
+
* its version: a CLI found and unusable, the operator's environment as a bad
|
|
73
|
+
* override is (`CliProvisionError`, `invalid_request`), never an engine fault.
|
|
74
|
+
* The engine's own build is the pin, above the floor, so only the person's
|
|
75
|
+
* own agy (`system` mode) or an overridden one can trip it: `agy update` is
|
|
76
|
+
* theirs to run.
|
|
77
|
+
*/
|
|
78
|
+
function accept(init) {
|
|
79
|
+
const version = init.agentInfo?.version;
|
|
80
|
+
if (version && atLeast(version, ANTIGRAVITY_FLOOR))
|
|
81
|
+
return;
|
|
82
|
+
throw new CliProvisionError(`the gemini harness needs Antigravity CLI ${ANTIGRAVITY_FLOOR} or later, and found ${version ?? "one that does not say its version"}: update it with \`agy update\``, { category: "invalid_request" });
|
|
83
|
+
}
|
|
84
|
+
// @ref LLP 0020#10-the-engine-installs-and-pins-agy — Google's switch, set on every start, keeps the pinned build the one that runs
|
|
85
|
+
/**
|
|
86
|
+
* What every agy the harness starts runs with, over any environment a turn
|
|
87
|
+
* brings (`fixedEnv`; a turn's comes from the wire): no update of itself,
|
|
88
|
+
* which would replace the pinned build in the cache with Google's latest.
|
|
89
|
+
* Google documents the variable, set to `true`, in
|
|
90
|
+
* https://antigravity.google/docs/cli/troubleshooting.
|
|
91
|
+
*/
|
|
92
|
+
const NO_SELF_UPDATE = { AGY_CLI_DISABLE_AUTO_UPDATE: "true" };
|
|
93
|
+
/**
|
|
94
|
+
* The `gemini` harness's profile: Google's Antigravity CLI (`agy acp`) on the
|
|
95
|
+
* person's own Antigravity sign-in, offering Gemini models only.
|
|
96
|
+
*/
|
|
97
|
+
export function geminiProfile(options) {
|
|
98
|
+
return {
|
|
99
|
+
harness: "gemini",
|
|
100
|
+
capabilities: CAPABILITIES,
|
|
101
|
+
launch: () => options.resolveCliPath().then((command) => {
|
|
102
|
+
if (!command)
|
|
103
|
+
throw new CliNotFoundError("agy", "set $ANTIGRAVITY_CLI_PATH");
|
|
104
|
+
return { command, args: ["acp"], fixedEnv: NO_SELF_UPDATE };
|
|
105
|
+
}),
|
|
106
|
+
admit: () => admit(options.inheritConfig ?? "all"),
|
|
107
|
+
accept,
|
|
108
|
+
// It takes HTTP servers, though its `initialize` says so only for `--process-per-session`.
|
|
109
|
+
httpMcp: true,
|
|
110
|
+
// Map agy's `auto` back to `bypass_permissions` on the stream. The flag lifts its terminal sandbox.
|
|
111
|
+
modeIds: { bypass_permissions: "auto" },
|
|
112
|
+
modeArgs: { bypass_permissions: ["--dangerously-skip-permissions"] },
|
|
113
|
+
// A system prompt given again on resume is added on top: given once, at the start.
|
|
114
|
+
newSession: {
|
|
115
|
+
settings: ["systemPromptAppend"],
|
|
116
|
+
meta: ({ systemPromptAppend }) => systemPromptAppend
|
|
117
|
+
? { antigravity: { systemPrompt: { append: systemPromptAppend } } }
|
|
118
|
+
: undefined,
|
|
119
|
+
},
|
|
120
|
+
models: { offers: isGeminiModel },
|
|
121
|
+
tools: antigravityToolRules,
|
|
122
|
+
login: (account) => new AntigravityCliLogin(account),
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
// @ref LLP 0016.000#an-acp-agents-profile — one registration builds the agent and its adapter from one profile
|
|
126
|
+
/**
|
|
127
|
+
* The `gemini` harness as the registry registers it: the ACP agent on its
|
|
128
|
+
* profile, and the ACP adapter reading the same profile behind Antigravity's
|
|
129
|
+
* failure reading (`antigravityFailures`).
|
|
130
|
+
*/
|
|
131
|
+
export function geminiHarness(options) {
|
|
132
|
+
const { inheritConfig, resolveCliPath, ...shared } = options;
|
|
133
|
+
const profile = geminiProfile({ ...(inheritConfig && { inheritConfig }), resolveCliPath });
|
|
134
|
+
return [
|
|
135
|
+
new ProfiledAcpAgent(profile, shared),
|
|
136
|
+
(ctx) => antigravityFailures(createAcpTransformer(ctx, profile)),
|
|
137
|
+
];
|
|
138
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { isRecord } from "../../utils/is-record.js";
|
|
2
|
+
/** How Antigravity names an MCP tool: `mcp_<server>_<tool>`. */
|
|
3
|
+
const MCP_PREFIX = "mcp_";
|
|
4
|
+
/** A server's name as Antigravity spells it in a tool's: spaces made `_`, hyphens kept. */
|
|
5
|
+
const spelled = (server) => server.replace(/ /g, "_");
|
|
6
|
+
/**
|
|
7
|
+
* The server and tool of an MCP call, against the session's own server
|
|
8
|
+
* names, the longest that fits first: Antigravity's `_` joins both and is
|
|
9
|
+
* in either, so a name it cannot tell apart that way names neither, nor do
|
|
10
|
+
* two servers it spells the same.
|
|
11
|
+
*/
|
|
12
|
+
export function antigravityMcpTool(name, servers) {
|
|
13
|
+
if (!name.startsWith(MCP_PREFIX))
|
|
14
|
+
return undefined;
|
|
15
|
+
const rest = name.slice(MCP_PREFIX.length);
|
|
16
|
+
let known;
|
|
17
|
+
for (const server of servers) {
|
|
18
|
+
const prefix = `${spelled(server)}_`;
|
|
19
|
+
if (!rest.startsWith(prefix) || rest.length <= prefix.length)
|
|
20
|
+
continue;
|
|
21
|
+
if (!known || prefix.length > known.length)
|
|
22
|
+
known = { server, length: prefix.length };
|
|
23
|
+
else if (prefix.length === known.length)
|
|
24
|
+
known = { length: prefix.length };
|
|
25
|
+
}
|
|
26
|
+
return known?.server === undefined
|
|
27
|
+
? undefined
|
|
28
|
+
: { server: known.server, tool: rest.slice(known.length) };
|
|
29
|
+
}
|
|
30
|
+
/** What follows Antigravity's own lines about a command (when it ran, its exit code). */
|
|
31
|
+
const COMMAND_OUTPUT = "\nCommand output:\n";
|
|
32
|
+
/** Antigravity's line for a command that could not start (its folder gone): the reason. */
|
|
33
|
+
const NOT_RUN = /^Command failed to run: .*$/m;
|
|
34
|
+
/**
|
|
35
|
+
* A finished call's output, where Antigravity's `rawOutput` is
|
|
36
|
+
* `{ output, exit_code? }`: a command's is what the command printed, after
|
|
37
|
+
* Antigravity's lines about it ("No output from the command." is none), with
|
|
38
|
+
* its `exit_code`, which Antigravity sends even when it says the call
|
|
39
|
+
* `completed` with a non-zero one; a denied or failed call's is empty and has
|
|
40
|
+
* none. A command that could not run ("Command failed to run: <reason>",
|
|
41
|
+
* which Antigravity says `completed`, with no exit code) failed, its text
|
|
42
|
+
* that line. Its writes, reads and MCP calls send no text, and none is made up.
|
|
43
|
+
*/
|
|
44
|
+
function antigravityOutput(name, rawOutput) {
|
|
45
|
+
if (!isRecord(rawOutput) || typeof rawOutput.output !== "string")
|
|
46
|
+
return undefined;
|
|
47
|
+
const { output, exit_code: exitCode } = rawOutput;
|
|
48
|
+
const code = typeof exitCode === "number" ? { exitCode } : {};
|
|
49
|
+
if (name !== "run_command")
|
|
50
|
+
return { text: output, ...code };
|
|
51
|
+
const at = output.indexOf(COMMAND_OUTPUT);
|
|
52
|
+
// Antigravity's own lines only, never what the command printed.
|
|
53
|
+
const notRun = NOT_RUN.exec(at !== -1 ? output.slice(0, at) : output)?.[0];
|
|
54
|
+
if (notRun)
|
|
55
|
+
return { text: notRun, ...code, failed: true };
|
|
56
|
+
const text = at !== -1
|
|
57
|
+
? output.slice(at + COMMAND_OUTPUT.length)
|
|
58
|
+
: output.includes("\nNo output from the command.")
|
|
59
|
+
? ""
|
|
60
|
+
: output;
|
|
61
|
+
return { text, ...code };
|
|
62
|
+
}
|
|
63
|
+
/** Antigravity's one tool for a server from a configuration file, the person's or the project's. */
|
|
64
|
+
const CALL_MCP_TOOL = "call_mcp_tool";
|
|
65
|
+
/** The server and tool `call_mcp_tool` names in its input (`ServerName`, `ToolName`). */
|
|
66
|
+
function configuredMcpTool(rawInput) {
|
|
67
|
+
if (!isRecord(rawInput))
|
|
68
|
+
return undefined;
|
|
69
|
+
const { ServerName: server, ToolName: tool } = rawInput;
|
|
70
|
+
return typeof server === "string" && server && typeof tool === "string" && tool
|
|
71
|
+
? { server, tool }
|
|
72
|
+
: undefined;
|
|
73
|
+
}
|
|
74
|
+
// @ref LLP 0002#a-tool-call-says-what-it-acts-on — Antigravity's own names, read once here
|
|
75
|
+
/**
|
|
76
|
+
* What an Antigravity tool call is beyond ACP's kind: `run_command`'s
|
|
77
|
+
* `CommandLine` is its command; an MCP tool is `mcp_<server>_<tool>` for a
|
|
78
|
+
* server the engine passed, and `call_mcp_tool` with `ServerName` and
|
|
79
|
+
* `ToolName` for one from a configuration file. Its other calls say nothing
|
|
80
|
+
* more, and nothing is guessed.
|
|
81
|
+
*/
|
|
82
|
+
export const antigravityToolRules = {
|
|
83
|
+
describe: (call, servers) => {
|
|
84
|
+
const name = call.name ?? "";
|
|
85
|
+
const mcp = name === CALL_MCP_TOOL ? configuredMcpTool(call.rawInput) : antigravityMcpTool(name, servers);
|
|
86
|
+
const line = isRecord(call.rawInput) ? call.rawInput.CommandLine : undefined;
|
|
87
|
+
const command = name === "run_command" && typeof line === "string" && line ? line : undefined;
|
|
88
|
+
return { ...(mcp && { mcp }), ...(command && { command }) };
|
|
89
|
+
},
|
|
90
|
+
output: (call) => antigravityOutput(call.name ?? "", call.rawOutput),
|
|
91
|
+
};
|
|
@@ -12,18 +12,20 @@ export function loginMethod(methods, id) {
|
|
|
12
12
|
]);
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* Signing in from a terminal with the CLI's own command.
|
|
16
|
-
*
|
|
17
|
-
* (`
|
|
15
|
+
* Signing in from a terminal with the CLI's own command. A CLI with more than
|
|
16
|
+
* one store names the variable that picks it (`store.variable`) and the
|
|
17
|
+
* environment a turn would run with (`store.env`): of it, the method takes
|
|
18
|
+
* only that variable, so the login lands where turns look. A CLI with one
|
|
19
|
+
* store names none.
|
|
18
20
|
*/
|
|
19
|
-
export function terminalMethod(command,
|
|
20
|
-
const
|
|
21
|
+
export function terminalMethod(command, store) {
|
|
22
|
+
const value = store?.env[store.variable];
|
|
21
23
|
return {
|
|
22
24
|
id: "terminal",
|
|
23
25
|
kind: "terminal",
|
|
24
26
|
label: [basename(command[0] ?? ""), ...command.slice(1)].join(" "),
|
|
25
27
|
command,
|
|
26
|
-
...(store && { env: { [
|
|
28
|
+
...(store && value && { env: { [store.variable]: value } }),
|
|
27
29
|
};
|
|
28
30
|
}
|
|
29
31
|
/** How long a CLI's own auth command may take. */
|
|
@@ -27,7 +27,10 @@ export class StderrTail {
|
|
|
27
27
|
}
|
|
28
28
|
/** The last `max` characters, redacted before the cut. */
|
|
29
29
|
get text() {
|
|
30
|
-
|
|
30
|
+
// A cut through a surrogate pair drops its remaining half.
|
|
31
|
+
return redactSecrets(this.tail)
|
|
32
|
+
.slice(-this.max)
|
|
33
|
+
.replace(/^[\uDC00-\uDFFF]/, "");
|
|
31
34
|
}
|
|
32
35
|
}
|
|
33
36
|
/** What a secret's place reads once it is taken out. */
|
|
@@ -61,7 +64,7 @@ const SECRETS = [
|
|
|
61
64
|
* `text` with every secret it holds replaced by `[REDACTED]`, and everything
|
|
62
65
|
* else as it was. For whatever of a CLI's own output becomes part of an
|
|
63
66
|
* error: the Claude SDK redacts the stderr it quotes, and this engine's exit
|
|
64
|
-
* errors
|
|
67
|
+
* errors use that same redacted tail on every harness.
|
|
65
68
|
*/
|
|
66
69
|
export function redactSecrets(text) {
|
|
67
70
|
let redacted = text;
|
package/dist/core/presets.js
CHANGED
|
@@ -5,6 +5,7 @@ import { createClaudeCodeTransformer } from "./agents/claude-code/adapter.js";
|
|
|
5
5
|
import { ClaudeCodeAgent } from "./agents/claude-code/claude-agent.js";
|
|
6
6
|
import { createCodexAppServerTransformer } from "./agents/codex-app-server/adapter.js";
|
|
7
7
|
import { CodexAppServerAgent, } from "./agents/codex-app-server/codex-agent.js";
|
|
8
|
+
import { geminiHarness } from "./agents/gemini/profile.js";
|
|
8
9
|
import { AgentRegistry } from "./agents/registry.js";
|
|
9
10
|
import { createScriptedTransformer } from "./agents/scripted/adapter.js";
|
|
10
11
|
import { ScriptedAgent } from "./agents/scripted/scripted-agent.js";
|
|
@@ -45,6 +46,18 @@ const HARNESSES = {
|
|
|
45
46
|
}),
|
|
46
47
|
createCodexAppServerTransformer,
|
|
47
48
|
],
|
|
49
|
+
gemini: (opts, cliPath, processes) => {
|
|
50
|
+
const { idleTimeoutMs, cancelConfirmMs, cancelGraceMs, hostTools, inheritConfig } = opts;
|
|
51
|
+
return geminiHarness({
|
|
52
|
+
...(inheritConfig && { inheritConfig }),
|
|
53
|
+
resolveCliPath: cliPath("agy"),
|
|
54
|
+
idleTimeoutMs,
|
|
55
|
+
cancelConfirmMs,
|
|
56
|
+
cancelGraceMs,
|
|
57
|
+
hostTools,
|
|
58
|
+
processes,
|
|
59
|
+
});
|
|
60
|
+
},
|
|
48
61
|
acp: (opts, _cliPath, processes) => {
|
|
49
62
|
if (!opts.acp) {
|
|
50
63
|
throw new Error("the acp harness requires CreateRegistryOptions.acp (resolveLaunch)");
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { spawn as nodeSpawn } from "node:child_process";
|
|
2
2
|
import { StderrTail } from "../agents/stderr-tail.js";
|
|
3
|
-
import { onAbort } from "../utils/deadline.js";
|
|
3
|
+
import { onAbort, withTimeout } from "../utils/deadline.js";
|
|
4
|
+
import { AgentExitedError } from "../utils/errors.js";
|
|
4
5
|
import { bootId, startToken, verifyRecord } from "./identity.js";
|
|
5
6
|
import { lifeline } from "./lifeline.js";
|
|
6
7
|
import { POSIX, aliveTargets, readProcessTable, signalTargets, treeTargets, } from "./process-table.js";
|
|
@@ -10,6 +11,8 @@ export const DEFAULT_GRACE_MS = 3_000;
|
|
|
10
11
|
const STDERR_TAIL_MAX = 2048;
|
|
11
12
|
/** How long an exit waits for its stdout's and stderr's last words, as the Claude SDK's own spawner waits for stderr. */
|
|
12
13
|
const OUTPUT_CLOSE_WAIT_MS = 200;
|
|
14
|
+
/** A broken transport may precede the exit that explains it. */
|
|
15
|
+
const EXIT_REASON_WAIT_MS = 1_000;
|
|
13
16
|
const POLL_MS = 50;
|
|
14
17
|
/** How long a SIGKILLed tree may take to be gone before it counts as not stopped. */
|
|
15
18
|
const KILL_WAIT_MS = 1_000;
|
|
@@ -73,6 +76,25 @@ export class NativeProcess {
|
|
|
73
76
|
get stderrTail() {
|
|
74
77
|
return this.tail.text;
|
|
75
78
|
}
|
|
79
|
+
/** The stderr a failure can show, including when the process printed nothing. */
|
|
80
|
+
get stderrSummary() {
|
|
81
|
+
const tail = this.stderrTail.trim().replace(/\s+/g, " ");
|
|
82
|
+
return tail ? `Last stderr: ${tail}` : "It printed nothing on stderr.";
|
|
83
|
+
}
|
|
84
|
+
/** Once the transport is lost, give the process a moment to exit and drain its output. */
|
|
85
|
+
async exitAfterDisconnect() {
|
|
86
|
+
return (await withTimeout(this.exited, EXIT_REASON_WAIT_MS))?.value;
|
|
87
|
+
}
|
|
88
|
+
// @ref LLP 0016.000#when-a-process-exits-before-answering — one exit sentence for every harness
|
|
89
|
+
exitError(name, { code, signal }, requests) {
|
|
90
|
+
const status = signal
|
|
91
|
+
? `on ${signal}`
|
|
92
|
+
: code !== null
|
|
93
|
+
? `with code ${code}`
|
|
94
|
+
: "without an exit status";
|
|
95
|
+
const pending = [...new Set(requests)].join(", ");
|
|
96
|
+
return new AgentExitedError(`${name} exited unexpectedly ${status}${pending ? ` before answering ${pending}` : ""}. ${this.stderrSummary}`);
|
|
97
|
+
}
|
|
76
98
|
/**
|
|
77
99
|
* Stop it and everything under it: SIGTERM to its group and its tool
|
|
78
100
|
* sessions, SIGKILL to what is left after the grace. Whether all of it is
|
|
@@ -27,8 +27,56 @@ export async function openToAll(path) {
|
|
|
27
27
|
else if (info.isFile())
|
|
28
28
|
await chmod(path, info.mode & 0o100 ? 0o755 : 0o644);
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
/** `name` is `<package>@<version>` (`<tool>@<version>` for a file). */
|
|
31
|
+
export function noBinary(name) {
|
|
32
|
+
return new CliProvisionError(`downloaded ${name} has no binary`);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Where an npm build's tarball is and what it must match, asked before a
|
|
36
|
+
* byte of it is fetched: the registry's metadata, refused when it names
|
|
37
|
+
* another tarball than the table pins.
|
|
38
|
+
*/
|
|
39
|
+
async function locateTarball(job, { pkg, expected }) {
|
|
40
|
+
const dist = await fetchDist(job.registry, pkg.name, pkg.registryVersion, job.fetch, job.timeouts);
|
|
41
|
+
if (expected.source === "release" && dist.integrity !== expected.integrity) {
|
|
42
|
+
throw new CliProvisionError(`${withoutSecrets(job.registry)} serves another ${pkg.name}@${pkg.registryVersion} than this release pins ` +
|
|
43
|
+
`(${dist.integrity.slice(0, 24)}…, pinned ${expected.integrity.slice(0, 24)}…)`,
|
|
44
|
+
// A digest's digits are no status code: classified by what it is, not its words.
|
|
45
|
+
{ category: "internal" });
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
url: dist.tarball,
|
|
49
|
+
integrity: expected.source === "release" ? expected.integrity : dist.integrity,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/** The tarball, extracted into the staging folder. */
|
|
53
|
+
async function extracted(job, download, staging) {
|
|
54
|
+
const dir = join(staging, "x");
|
|
55
|
+
await mkdir(dir, { mode: 0o700 });
|
|
56
|
+
await job.extract(download, dir);
|
|
57
|
+
return dir;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The download, unpacked into the folder that becomes the install: an npm
|
|
61
|
+
* tarball's payload, or a folder holding only the file's executable under
|
|
62
|
+
* its installed name (the tarball's `member`, or the file itself; a member
|
|
63
|
+
* that is not a regular file is no binary).
|
|
64
|
+
*/
|
|
65
|
+
async function unpack(job, download, staging) {
|
|
66
|
+
const { plan } = job;
|
|
67
|
+
if (plan.kind === "npm")
|
|
68
|
+
return plan.payload(await extracted(job, download, staging));
|
|
69
|
+
let executable = download;
|
|
70
|
+
if (plan.member) {
|
|
71
|
+
const member = binaryIn(await extracted(job, download, staging), [plan.member]);
|
|
72
|
+
if (!member)
|
|
73
|
+
throw noBinary(plan.name);
|
|
74
|
+
executable = member;
|
|
75
|
+
}
|
|
76
|
+
const dir = join(staging, "build");
|
|
77
|
+
await mkdir(dir, { mode: 0o700 });
|
|
78
|
+
await rename(executable, join(dir, plan.binary));
|
|
79
|
+
return dir;
|
|
32
80
|
}
|
|
33
81
|
/**
|
|
34
82
|
* Download a build, check it against what it must match, unpack it in a
|
|
@@ -37,21 +85,19 @@ export function noBinary(pkg) {
|
|
|
37
85
|
* one that loses adopts the winner's tree. Answers the bytes downloaded.
|
|
38
86
|
*/
|
|
39
87
|
export async function installBuild(job) {
|
|
40
|
-
const {
|
|
41
|
-
const
|
|
88
|
+
const { plan, binaries, root, dir } = job;
|
|
89
|
+
const { name } = plan;
|
|
90
|
+
const stem = plan.kind === "npm"
|
|
91
|
+
? `${plan.pkg.name.replace("/", "-")}-${plan.pkg.registryVersion}`
|
|
92
|
+
: plan.name.replace("@", "-");
|
|
93
|
+
const staging = join(root, ".tmp", `${stem}-${process.pid}-${randomBytes(4).toString("hex")}`);
|
|
42
94
|
try {
|
|
43
95
|
managedDirectory(root, dirname(staging), true);
|
|
44
96
|
await mkdir(staging, { mode: 0o700 });
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
throw new CliProvisionError(`${withoutSecrets(job.registry)} serves another ${pkg.name}@${pkg.registryVersion} than this release pins ` +
|
|
48
|
-
`(${dist.integrity.slice(0, 24)}…, pinned ${expected.integrity.slice(0, 24)}…)`,
|
|
49
|
-
// A digest's digits are no status code: classified by what it is, not its words.
|
|
50
|
-
{ category: "internal" });
|
|
51
|
-
}
|
|
52
|
-
const tgz = join(staging, "package.tgz");
|
|
97
|
+
const { url, integrity } = plan.kind === "npm" ? await locateTarball(job, plan) : plan;
|
|
98
|
+
const download = join(staging, plan.kind === "npm" ? "package.tgz" : "download");
|
|
53
99
|
let reportedAt = 0;
|
|
54
|
-
const bytes = await downloadWithIntegrity(
|
|
100
|
+
const bytes = await downloadWithIntegrity(url, download, integrity, job.fetch, {
|
|
55
101
|
timeouts: job.timeouts,
|
|
56
102
|
onBytes: (receivedBytes, totalBytes) => {
|
|
57
103
|
const now = Date.now();
|
|
@@ -62,18 +108,16 @@ export async function installBuild(job) {
|
|
|
62
108
|
},
|
|
63
109
|
});
|
|
64
110
|
job.onProgress("verifying", bytes, bytes);
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
await job.extract(tgz, extracted);
|
|
68
|
-
const payload = await spec.payload(extracted);
|
|
69
|
-
const binary = binaryIn(payload, spec.binaries);
|
|
111
|
+
const payload = await unpack(job, download, staging);
|
|
112
|
+
const binary = binaryIn(payload, binaries);
|
|
70
113
|
if (!binary)
|
|
71
|
-
throw noBinary(
|
|
72
|
-
const
|
|
73
|
-
|
|
114
|
+
throw noBinary(name);
|
|
115
|
+
const expected = plan.kind === "npm" ? plan.expected : undefined;
|
|
116
|
+
const sha256 = expected?.source === "registry" ? undefined : expected?.sha256;
|
|
117
|
+
if (expected && sha256) {
|
|
74
118
|
const actual = await sha256Of(binary);
|
|
75
119
|
if (actual !== sha256) {
|
|
76
|
-
throw new CliProvisionError(`${
|
|
120
|
+
throw new CliProvisionError(`${name}'s binary is not the build ${expected.source === "local" ? expected.vouchedBy : "this release pins"} names (sha256 ${actual}, expected ${sha256})`, { category: "internal" });
|
|
77
121
|
}
|
|
78
122
|
}
|
|
79
123
|
await chmod(binary, 0o755);
|
|
@@ -85,12 +129,12 @@ export async function installBuild(job) {
|
|
|
85
129
|
catch (error) {
|
|
86
130
|
// Lost the race with another process installing the same build: the
|
|
87
131
|
// directory is version-keyed, so its tree is what we would have written.
|
|
88
|
-
if (trustedBinaryIn(root, dir,
|
|
132
|
+
if (trustedBinaryIn(root, dir, binaries))
|
|
89
133
|
return bytes;
|
|
90
|
-
throw new CliProvisionError(`${dir} is there but holds no ${
|
|
134
|
+
throw new CliProvisionError(`${dir} is there but holds no ${binaries[0]}: remove it, and it installs again`, { cause: error });
|
|
91
135
|
}
|
|
92
|
-
if (!trustedBinaryIn(root, dir,
|
|
93
|
-
throw noBinary(
|
|
136
|
+
if (!trustedBinaryIn(root, dir, binaries))
|
|
137
|
+
throw noBinary(name);
|
|
94
138
|
return bytes;
|
|
95
139
|
}
|
|
96
140
|
finally {
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
* governs downloads (compiled binaries, bare sandboxes, `pinned` mode); in
|
|
14
14
|
* `auto` an installed `@openai/codex` package (a lockfile's) runs instead,
|
|
15
15
|
* and a `codex` on PATH only in `system` mode.
|
|
16
|
+
* - `agy` is the version of Google's Antigravity CLI the gemini harness
|
|
17
|
+
* downloads. Google's update manifest names only its latest build, so a
|
|
18
|
+
* refresh records the version it names: a bump moves to that one, and
|
|
19
|
+
* only forward. The person's own install runs only in `system` mode.
|
|
16
20
|
*
|
|
17
21
|
* A bump is `bun run bump -- <tool>`: it writes what changed upstream, moves
|
|
18
22
|
* the pin, and runs both refreshes, `releases:refresh` (each platform's build
|
|
@@ -23,4 +27,5 @@
|
|
|
23
27
|
export const DEFAULT_PINS = {
|
|
24
28
|
claude: "0.3.327",
|
|
25
29
|
codex: "0.169.1",
|
|
30
|
+
agy: "1.5.14",
|
|
26
31
|
};
|
|
@@ -9,7 +9,7 @@ import { expectedBuild } from "./checksums.js";
|
|
|
9
9
|
import { extractTarGz } from "./extract.js";
|
|
10
10
|
import { installBuild, noBinary } from "./install-build.js";
|
|
11
11
|
import { DEFAULT_DOWNLOAD_TIMEOUTS, DEFAULT_NPM_REGISTRY, withoutSecrets, } from "./npm.js";
|
|
12
|
-
import { detectPlatform } from "./platform.js";
|
|
12
|
+
import { detectPlatform, platformName } from "./platform.js";
|
|
13
13
|
import { CLI_RELEASES } from "./releases.js";
|
|
14
14
|
import { CLI_TOOLS, CLI_TOOL_SPECS, binaryIn } from "./tools.js";
|
|
15
15
|
function failureOf(error) {
|
|
@@ -25,10 +25,11 @@ function messageOf(error) {
|
|
|
25
25
|
return error instanceof Error ? error.message : String(error);
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
* Resolves the native CLIs the harnesses spawn (`
|
|
29
|
-
* managed modes — downloads the pinned builds from
|
|
30
|
-
*
|
|
31
|
-
*
|
|
28
|
+
* Resolves the native CLIs the harnesses spawn (`CLI_TOOLS`) and — in
|
|
29
|
+
* managed modes — downloads the pinned builds from where each comes from
|
|
30
|
+
* (the npm registry, or the address the release table names) into a local
|
|
31
|
+
* cache, checked against this release's table of them (`releases.ts`) and
|
|
32
|
+
* installed atomically (`install-build.ts`), so concurrent processes
|
|
32
33
|
* converge on one copy. What differs per tool is its `CLI_TOOL_SPECS` entry.
|
|
33
34
|
*
|
|
34
35
|
* One instance per runtime; `resolve` is memoized per tool (a failure clears
|
|
@@ -263,8 +264,31 @@ export class CliProvisioner {
|
|
|
263
264
|
this.say(note);
|
|
264
265
|
version = spec.defaultVersion();
|
|
265
266
|
}
|
|
266
|
-
const pkg = spec.package(this.platform, version);
|
|
267
|
-
|
|
267
|
+
const pkg = spec.source.kind === "npm" ? spec.source.package(this.platform, version) : undefined;
|
|
268
|
+
const suffix = pkg?.suffix ?? platformName(this.platform);
|
|
269
|
+
const name = pkg ? `${pkg.name}@${pkg.registryVersion}` : `${tool}@${version}`;
|
|
270
|
+
return { version, suffix, entry: `${version}-${suffix}`, pkg, name };
|
|
271
|
+
}
|
|
272
|
+
// @ref LLP 0010#source-kinds — the one place a build's pin is checked: a `url` build the table does not hold is refused
|
|
273
|
+
/**
|
|
274
|
+
* What installing `build` takes, resolved before anything is fetched: an
|
|
275
|
+
* npm build's package and what it must match (said once when that is not
|
|
276
|
+
* this release's table), or the file the table names for a `url` source.
|
|
277
|
+
*/
|
|
278
|
+
plan(tool, build) {
|
|
279
|
+
const { source, localBuild } = CLI_TOOL_SPECS[tool];
|
|
280
|
+
const { version, suffix, name } = build;
|
|
281
|
+
const expected = expectedBuild(tool, version, suffix, this.releases, localBuild);
|
|
282
|
+
if (source.kind === "npm") {
|
|
283
|
+
if (expected.source !== "release")
|
|
284
|
+
this.say(`${tool} ${version} (${suffix}) is not pinned by this agent-server release: checked against ${expected.source === "local" ? expected.vouchedBy : "the registry's checksum only"}`);
|
|
285
|
+
const pkg = build.pkg ?? source.package(this.platform, version);
|
|
286
|
+
return { kind: "npm", name, pkg, expected, payload: source.payload };
|
|
287
|
+
}
|
|
288
|
+
if (expected.source !== "release" || !expected.url)
|
|
289
|
+
throw new CliProvisionError(`${tool} ${version} (${suffix}) is not a build this agent-server release pins, and only a pinned build of ${tool} downloads: pin the release's version, or name a binary with its override`, { category: "invalid_request" });
|
|
290
|
+
const { url, integrity } = expected;
|
|
291
|
+
return { kind: "file", name, url, integrity, ...source.executable(this.platform) };
|
|
268
292
|
}
|
|
269
293
|
/** Pin trusted aliases to their physical location and recheck on every use. */
|
|
270
294
|
ensureTrustedCacheRoot() {
|
|
@@ -282,7 +306,7 @@ export class CliProvisioner {
|
|
|
282
306
|
await this.download(tool, build, root, dir);
|
|
283
307
|
path = trustedBinaryIn(root, dir, spec.binaries);
|
|
284
308
|
if (!path)
|
|
285
|
-
throw noBinary(build.
|
|
309
|
+
throw noBinary(build.name);
|
|
286
310
|
}
|
|
287
311
|
await this.used(tool, build.entry, true);
|
|
288
312
|
// The cache grew: what no process used for a while goes. Best effort.
|
|
@@ -293,7 +317,7 @@ export class CliProvisioner {
|
|
|
293
317
|
/** Download and install one build, reporting its progress to the observers and the log. */
|
|
294
318
|
async download(tool, build, root, dir) {
|
|
295
319
|
const spec = CLI_TOOL_SPECS[tool];
|
|
296
|
-
const { version
|
|
320
|
+
const { version } = build;
|
|
297
321
|
let progress = { tool, version, phase: "downloading", receivedBytes: 0 };
|
|
298
322
|
const report = (next) => {
|
|
299
323
|
progress = { ...progress, ...next };
|
|
@@ -310,14 +334,13 @@ export class CliProvisioner {
|
|
|
310
334
|
const startedAt = Date.now();
|
|
311
335
|
try {
|
|
312
336
|
report({});
|
|
313
|
-
const
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
this.log(`downloading ${tool} ${version} (${
|
|
337
|
+
const plan = this.plan(tool, build);
|
|
338
|
+
// A file is where the table says; an npm build, the registry's.
|
|
339
|
+
const from = plan.kind === "file" ? new URL(plan.url).origin : withoutSecrets(this.registry);
|
|
340
|
+
this.log(`downloading ${tool} ${version} (${build.suffix}) from ${from}…`);
|
|
317
341
|
const bytes = await installBuild({
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
expected,
|
|
342
|
+
plan,
|
|
343
|
+
binaries: spec.binaries,
|
|
321
344
|
root,
|
|
322
345
|
dir,
|
|
323
346
|
registry: this.registry,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The pinned CLIs' builds, by platform: each npm tarball's integrity, and for
|
|
3
3
|
* Claude the binary's sha256 from Anthropic's signed release manifest (its
|
|
4
|
-
* signature verified when this file was generated)
|
|
4
|
+
* signature verified when this file was generated); for agy each build's
|
|
5
|
+
* address and the sha512 Google's unsigned update manifest named for it.
|
|
5
6
|
*/
|
|
6
7
|
export const CLI_RELEASES = {
|
|
7
8
|
claude: {
|
|
@@ -65,4 +66,41 @@ export const CLI_RELEASES = {
|
|
|
65
66
|
},
|
|
66
67
|
},
|
|
67
68
|
},
|
|
69
|
+
agy: {
|
|
70
|
+
version: "1.5.14",
|
|
71
|
+
builds: {
|
|
72
|
+
"darwin-arm64": {
|
|
73
|
+
integrity: "sha512-JoMP1Gv7kgDQc88+cb+UtwdVJVe0OA7AGv1umfOisDDmVCLasYZ/dzGAeGkt78hZp1R9F+xLCx6TafE8nDyupg==",
|
|
74
|
+
url: "https://storage.googleapis.com/antigravity-public/antigravity-cli/1.5.14-5302690847260672/darwin-arm/cli_mac_arm64.tar.gz",
|
|
75
|
+
},
|
|
76
|
+
"darwin-x64": {
|
|
77
|
+
integrity: "sha512-G2ofxtvka6bZ0EBdG2CVGJ816/xMPDPOsf0bbQyf1wK1KsELZLi1Ku0NjXGuAsXfPP/V4+PTdUnC2v/M4qhTxw==",
|
|
78
|
+
url: "https://storage.googleapis.com/antigravity-public/antigravity-cli/1.5.14-5302690847260672/darwin-x64/cli_mac_x64.tar.gz",
|
|
79
|
+
},
|
|
80
|
+
"linux-arm64": {
|
|
81
|
+
integrity: "sha512-ybKbukdfY6GoAWGuk7pysiHHpYbZhR5NAGFUZwS6tm1rJ2CyXXFtGRck/HVk8yRkVu4VHiiqN69I281yvcbEYw==",
|
|
82
|
+
url: "https://storage.googleapis.com/antigravity-public/antigravity-cli/1.5.14-5302690847260672/linux-arm/cli_linux_arm64.tar.gz",
|
|
83
|
+
},
|
|
84
|
+
"linux-x64": {
|
|
85
|
+
integrity: "sha512-gzEdPzVFZ2EtwWwa4uqbUD1vaDOqThONOaoinaPzu5mw5NfMoLzkeWsAYNalHYET63RJ7V3A55AL8hcQfqW/+Q==",
|
|
86
|
+
url: "https://storage.googleapis.com/antigravity-public/antigravity-cli/1.5.14-5302690847260672/linux-x64/cli_linux_x64.tar.gz",
|
|
87
|
+
},
|
|
88
|
+
"linux-arm64-musl": {
|
|
89
|
+
integrity: "sha512-9uNfw9qyzUn9Qpbd7ghBucxMcCC2xqrqZFLFs0UrCtjWZFHJCY5Bitay9uq8yBzfExBe0EOQMkixHW+ySucJqw==",
|
|
90
|
+
url: "https://storage.googleapis.com/antigravity-public/antigravity-cli/1.5.14-5302690847260672/linux-arm-musl/cli_linux_arm64_musl.tar.gz",
|
|
91
|
+
},
|
|
92
|
+
"linux-x64-musl": {
|
|
93
|
+
integrity: "sha512-HaJJInJ8W06ENp0IQ1ddfW8YChlG4txCiRca0ePKkllOaHck0ZAqfYPkB/mPCo07fD6XbwNoD9gNvtLS2gDA7Q==",
|
|
94
|
+
url: "https://storage.googleapis.com/antigravity-public/antigravity-cli/1.5.14-5302690847260672/linux-x64-musl/cli_linux_x64_musl.tar.gz",
|
|
95
|
+
},
|
|
96
|
+
"win32-arm64": {
|
|
97
|
+
integrity: "sha512-ss5UYs8YRbJcBcplG1vZNzX9gH+Oe0DGHQ6ZRF3xp2uX7iTIkNX1ugRT+EjKF0901JKtGQGi3cul16m0OZ3f7w==",
|
|
98
|
+
url: "https://storage.googleapis.com/antigravity-public/antigravity-cli/1.5.14-5302690847260672/windows-arm/cli_windows_arm64.exe",
|
|
99
|
+
},
|
|
100
|
+
"win32-x64": {
|
|
101
|
+
integrity: "sha512-eFVIsjJC7JESdZu0tSXZSj1NLpho5c7bnqNOXOAduwCr9d5mxB2PSQPopDeURfaFSD+Zns6Rhnv72dSBJ2DYNQ==",
|
|
102
|
+
url: "https://storage.googleapis.com/antigravity-public/antigravity-cli/1.5.14-5302690847260672/windows-x64/cli_windows_x64.exe",
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
68
106
|
};
|