@centralu/win32-x64 0.1.0-beta.81 → 0.1.0-beta.83
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/Centralu/centralu.exe
CHANGED
|
Binary file
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"commit": "
|
|
2
|
+
"commit": "747872f",
|
|
3
3
|
"protocolVersion": 1,
|
|
4
4
|
"hostProof": 1,
|
|
5
5
|
"tokenOnStdin": 1,
|
|
6
6
|
"verifiers": 1,
|
|
7
7
|
"keyPairing": 1,
|
|
8
|
-
"builtAt": "2026-11-
|
|
8
|
+
"builtAt": "2026-11-27T19:57:40.604Z",
|
|
9
9
|
"runtime": "system-node",
|
|
10
10
|
"platform": "win32",
|
|
11
11
|
"arch": "x64"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "centralu",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.83",
|
|
4
4
|
"description": "Run, watch and steer Claude Code, Codex and other coding agents from one window",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ijun17",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"win32"
|
|
39
39
|
],
|
|
40
40
|
"optionalDependencies": {
|
|
41
|
-
"@centralu/darwin-arm64": "0.1.0-beta.
|
|
42
|
-
"@centralu/linux-arm64": "0.1.0-beta.
|
|
43
|
-
"@centralu/linux-x64": "0.1.0-beta.
|
|
44
|
-
"@centralu/win32-x64": "0.1.0-beta.
|
|
41
|
+
"@centralu/darwin-arm64": "0.1.0-beta.83",
|
|
42
|
+
"@centralu/linux-arm64": "0.1.0-beta.83",
|
|
43
|
+
"@centralu/linux-x64": "0.1.0-beta.83",
|
|
44
|
+
"@centralu/win32-x64": "0.1.0-beta.83"
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -43046,7 +43046,7 @@ import { dirname as dirname27, join as join57 } from "node:path";
|
|
|
43046
43046
|
import { mkdirSync as mkdirSync21, readFileSync as readFileSync28, writeSync as writeSync4 } from "node:fs";
|
|
43047
43047
|
|
|
43048
43048
|
// packages/protocol/src/version.generated.ts
|
|
43049
|
-
var APP_VERSION = "0.1.0-beta.
|
|
43049
|
+
var APP_VERSION = "0.1.0-beta.83";
|
|
43050
43050
|
|
|
43051
43051
|
// packages/protocol/src/brand.ts
|
|
43052
43052
|
var APP_NAME = "Centralu";
|
|
@@ -58907,7 +58907,9 @@ var UsageWindow = external_exports.object({
|
|
|
58907
58907
|
/** ISO; null if unknown */
|
|
58908
58908
|
resetsAt: external_exports.string().nullable().default(null),
|
|
58909
58909
|
/** If this window applies to one specific model only, that model's name */
|
|
58910
|
-
scope: external_exports.string().nullable().default(null)
|
|
58910
|
+
scope: external_exports.string().nullable().default(null),
|
|
58911
|
+
/** When a tool reports multiple scoped windows of the same cadence, the adapter marks its representative window here */
|
|
58912
|
+
primary: external_exports.boolean().optional()
|
|
58911
58913
|
});
|
|
58912
58914
|
var UsageSnapshot = external_exports.object({
|
|
58913
58915
|
plan: external_exports.string().nullable().default(null),
|
|
@@ -60897,6 +60899,8 @@ var hostParams = {
|
|
|
60897
60899
|
* --window` and cannot write to a host it did not start. `cancelled`: the announced end was called off
|
|
60898
60900
|
*/
|
|
60899
60901
|
"host.systemEnding": external_exports.object({ cancelled: external_exports.boolean().optional() }),
|
|
60902
|
+
/** Local dev:live tab pairing code for human message attribution on this socket only */
|
|
60903
|
+
"host.trustDevTab": external_exports.object({ code: external_exports.string().regex(/^[A-Z0-9]{3}-[A-Z0-9]{3}$/) }),
|
|
60900
60904
|
/**
|
|
60901
60905
|
* docs/plans/remote-hub.md §12.7: sent at every connect and when its switch changes. This host calls that hub back only
|
|
60902
60906
|
* on the connection the offer came in on, and shows it "not reachable" once that is gone.
|
|
@@ -60980,6 +60984,7 @@ var hostResults = {
|
|
|
60980
60984
|
]),
|
|
60981
60985
|
"host.handover": external_exports.object({ ok: external_exports.literal(true) }),
|
|
60982
60986
|
"host.systemEnding": external_exports.object({ ok: external_exports.literal(true) }),
|
|
60987
|
+
"host.trustDevTab": external_exports.object({ ok: external_exports.literal(true) }),
|
|
60983
60988
|
// `mail`: this host takes `host.mail`, so the hub's task for a child here says to mail
|
|
60984
60989
|
// `apps`: this host answers `host.apps` and `host.appCall`
|
|
60985
60990
|
// `tasks`: this host takes the hub's tasks as mail and reports them back (`host.mail` with `task`)
|
|
@@ -61187,6 +61192,11 @@ var MessageImage = external_exports.discriminatedUnion("ok", [
|
|
|
61187
61192
|
file: external_exports.string().optional()
|
|
61188
61193
|
})
|
|
61189
61194
|
]);
|
|
61195
|
+
var MessageFileRefusal = external_exports.enum(["not_mentioned", "not_found", "unreadable"]);
|
|
61196
|
+
var MessageFile = external_exports.discriminatedUnion("ok", [
|
|
61197
|
+
external_exports.object({ ok: external_exports.literal(true), file: external_exports.string() }),
|
|
61198
|
+
external_exports.object({ ok: external_exports.literal(false), reason: MessageFileRefusal, message: external_exports.string() })
|
|
61199
|
+
]);
|
|
61190
61200
|
var FsResolvePurpose = external_exports.enum(["trash", "reveal", "open", "project"]);
|
|
61191
61201
|
|
|
61192
61202
|
// packages/protocol/src/commands/projects.ts
|
|
@@ -61689,6 +61699,8 @@ var sessionsParams = {
|
|
|
61689
61699
|
* `path` as the reply wrote it; the host resolves `~`, a path relative to the session's folder and a `file://` URL.
|
|
61690
61700
|
*/
|
|
61691
61701
|
"messages.image": external_exports.object({ sessionId: SessionId, path: external_exports.string().min(1).max(4096) }),
|
|
61702
|
+
/** Resolves a local file or folder link a reply named for native reveal; refuses unmentioned or off-machine paths */
|
|
61703
|
+
"messages.resolveFile": external_exports.object({ sessionId: SessionId, path: external_exports.string().min(1).max(4096) }),
|
|
61692
61704
|
"messages.search": external_exports.object({ query: external_exports.string(), limit: external_exports.number().optional() }),
|
|
61693
61705
|
"sessions.reorder": external_exports.object({ projectId: ProjectId, orderedIds: external_exports.array(external_exports.string()) }),
|
|
61694
61706
|
"sessions.list": external_exports.object({}),
|
|
@@ -61881,6 +61893,7 @@ var sessionsResults = {
|
|
|
61881
61893
|
"agents.sleepPolicy": SleepPolicy,
|
|
61882
61894
|
"agents.setSleepPolicy": SleepPolicy,
|
|
61883
61895
|
"messages.image": MessageImage,
|
|
61896
|
+
"messages.resolveFile": MessageFile,
|
|
61884
61897
|
"messages.search": external_exports.array(external_exports.object({ sessionId: external_exports.string(), seq: external_exports.number(), snippet: external_exports.string() })),
|
|
61885
61898
|
"sessions.reorder": external_exports.array(SessionInfo),
|
|
61886
61899
|
"sessions.list": external_exports.array(SessionInfo),
|
|
@@ -62427,7 +62440,9 @@ var HelloServer = external_exports.object({
|
|
|
62427
62440
|
* The turns this host continues because an update cut them (`host.stop { forUpdate }`), `at` on this host's clock.
|
|
62428
62441
|
* Empty: it continues such turns; absent: it predates that
|
|
62429
62442
|
*/
|
|
62430
|
-
updateContinued: external_exports.array(external_exports.object({ sessionId: external_exports.string(), at: external_exports.number() })).optional().catch(void 0)
|
|
62443
|
+
updateContinued: external_exports.array(external_exports.object({ sessionId: external_exports.string(), at: external_exports.number() })).optional().catch(void 0),
|
|
62444
|
+
/** Sent when the socket authenticated with the limited credential (`'limited'`); absent on full connections and older hosts */
|
|
62445
|
+
rights: external_exports.enum(["full", "limited"]).optional().catch(void 0)
|
|
62431
62446
|
});
|
|
62432
62447
|
var RpcRequest = external_exports.object({
|
|
62433
62448
|
kind: external_exports.literal("rpc"),
|
|
@@ -62730,7 +62745,9 @@ var LONG_CALLS = /* @__PURE__ */ new Set([
|
|
|
62730
62745
|
var GIT_WRITE_BUDGET_MS = GIT_WRITE_TIMEOUT_MS + 6e4;
|
|
62731
62746
|
var GIT_WRITE_CALLS = /* @__PURE__ */ new Set(["git.stage", "git.commit", "git.checkout", "git.push"]);
|
|
62732
62747
|
var APP_CALL_BUDGET_MS = APP_CAPABILITY_QUESTION_MS + APP_CALL_TIMEOUT_MS;
|
|
62748
|
+
var HOST_REQUEST_BUDGET_MS = 15 * 6e4 + 6e4;
|
|
62733
62749
|
function callBudgetMs(method) {
|
|
62750
|
+
if (method === "host.trustDevTab") return HOST_REQUEST_BUDGET_MS;
|
|
62734
62751
|
if (method === "apps.invoke") return APP_CALL_BUDGET_MS;
|
|
62735
62752
|
if (GIT_WRITE_CALLS.has(method)) return GIT_WRITE_BUDGET_MS;
|
|
62736
62753
|
return LONG_CALLS.has(method) ? LONG_CALL_BUDGET_MS : DEFAULT_CALL_BUDGET_MS;
|
|
@@ -63225,10 +63242,10 @@ function samePath(a, b2, family2, cwd) {
|
|
|
63225
63242
|
return pathKey(a, family2, cwd) === pathKey(b2, family2, cwd);
|
|
63226
63243
|
}
|
|
63227
63244
|
function isInside(root3, candidate, family2, cwd) {
|
|
63228
|
-
const
|
|
63245
|
+
const sep14 = pathRules(family2).sep;
|
|
63229
63246
|
const r = pathKey(root3, family2, cwd);
|
|
63230
63247
|
const c = pathKey(candidate, family2, cwd);
|
|
63231
|
-
return c === r || c.startsWith(r.endsWith(
|
|
63248
|
+
return c === r || c.startsWith(r.endsWith(sep14) ? r : r + sep14);
|
|
63232
63249
|
}
|
|
63233
63250
|
function expandHome(path2, home, family2) {
|
|
63234
63251
|
if (path2 === "~") return home;
|
|
@@ -65881,6 +65898,7 @@ var METHOD_RIGHTS = {
|
|
|
65881
65898
|
"agents.account": "everyday",
|
|
65882
65899
|
"usage.history": "everyday",
|
|
65883
65900
|
"messages.image": "everyday",
|
|
65901
|
+
"messages.resolveFile": "everyday",
|
|
65884
65902
|
"messages.search": "everyday",
|
|
65885
65903
|
"messages.load": "everyday",
|
|
65886
65904
|
"messages.subagent": "everyday",
|
|
@@ -66092,6 +66110,11 @@ var METHOD_RIGHTS = {
|
|
|
66092
66110
|
* plant a false end that relabels a real crash as the system's (#1397)
|
|
66093
66111
|
*/
|
|
66094
66112
|
"host.systemEnding": "window",
|
|
66113
|
+
/**
|
|
66114
|
+
* A local `dev:live` browser tab asking the person (via a card with a pairing code and origin) to attribute
|
|
66115
|
+
* messages on that single open WebSocket as human rather than script. Never grants full/window rights.
|
|
66116
|
+
*/
|
|
66117
|
+
"host.trustDevTab": "asks",
|
|
66095
66118
|
"host.hubOffer": "link",
|
|
66096
66119
|
// From a hub that offered on the same connection only (rpc.ts), as `host.hubOffer` (#2067 item 2)
|
|
66097
66120
|
"host.mail": "link",
|
|
@@ -66723,6 +66746,12 @@ function drainToolResult(e) {
|
|
|
66723
66746
|
}
|
|
66724
66747
|
|
|
66725
66748
|
// packages/agent-host/src/transport/server.ts
|
|
66749
|
+
var DEV_TAB_ORIGINS = /* @__PURE__ */ new Set([
|
|
66750
|
+
"http://127.0.0.1:5173",
|
|
66751
|
+
"http://127.0.0.1:5174",
|
|
66752
|
+
"http://localhost:5173",
|
|
66753
|
+
"http://localhost:5174"
|
|
66754
|
+
]);
|
|
66726
66755
|
var DEFAULT_ALLOWED_ORIGINS = [
|
|
66727
66756
|
"http://127.0.0.1:5173",
|
|
66728
66757
|
"http://127.0.0.1:5174",
|
|
@@ -67005,9 +67034,12 @@ var HostServer = class _HostServer {
|
|
|
67005
67034
|
setTimeout(() => ws2.terminate(), this.limits.closeGraceMs).unref();
|
|
67006
67035
|
}
|
|
67007
67036
|
onConnection(ws2, req) {
|
|
67037
|
+
const origin = typeof req.headers.origin === "string" ? req.headers.origin : null;
|
|
67008
67038
|
let authed = false;
|
|
67009
67039
|
let bridgeOf2 = null;
|
|
67010
67040
|
let limited = false;
|
|
67041
|
+
let trustedDev = false;
|
|
67042
|
+
let trustingDev = false;
|
|
67011
67043
|
let session2;
|
|
67012
67044
|
let label = null;
|
|
67013
67045
|
const leaving = new AbortController();
|
|
@@ -67139,7 +67171,7 @@ var HostServer = class _HostServer {
|
|
|
67139
67171
|
this.showing.add(ws2);
|
|
67140
67172
|
this.opts.onShowing?.(this.showing.size);
|
|
67141
67173
|
}
|
|
67142
|
-
this.greet(ws2, frame.data.afterSeq ?? 0, frame.data.streamEpoch);
|
|
67174
|
+
this.greet(ws2, frame.data.afterSeq ?? 0, frame.data.streamEpoch, limited);
|
|
67143
67175
|
return;
|
|
67144
67176
|
}
|
|
67145
67177
|
if (!authed) {
|
|
@@ -67162,10 +67194,93 @@ var HostServer = class _HostServer {
|
|
|
67162
67194
|
if (refusal2 !== null) return this.sendError(ws2, id3, { code: "internal", message: refusal2, retryable: false });
|
|
67163
67195
|
}
|
|
67164
67196
|
if (limited) {
|
|
67197
|
+
if (method === "host.trustDevTab") {
|
|
67198
|
+
const who = `client=${client} label=${JSON.stringify(label)} origin=${JSON.stringify(origin)}`;
|
|
67199
|
+
if (this.opts.servedBy === "serve" || this.opts.fullCredentials !== void 0) {
|
|
67200
|
+
console.error(`[agent-host] refused "host.trustDevTab" (${who}): serve host`);
|
|
67201
|
+
return this.sendError(ws2, id3, {
|
|
67202
|
+
code: "internal",
|
|
67203
|
+
message: "host.trustDevTab is only available on a local desktop host, not a centralu serve host",
|
|
67204
|
+
retryable: false,
|
|
67205
|
+
data: { refused: "rights", rights: "asks" }
|
|
67206
|
+
});
|
|
67207
|
+
}
|
|
67208
|
+
if (session2 !== void 0) {
|
|
67209
|
+
console.error(`[agent-host] refused "host.trustDevTab" (${who}): session credential`);
|
|
67210
|
+
return this.sendError(ws2, id3, {
|
|
67211
|
+
code: "internal",
|
|
67212
|
+
message: "A session credential cannot ask to trust a dev browser tab",
|
|
67213
|
+
retryable: false,
|
|
67214
|
+
data: { refused: "rights", rights: "asks" }
|
|
67215
|
+
});
|
|
67216
|
+
}
|
|
67217
|
+
if (origin === null || !DEV_TAB_ORIGINS.has(origin)) {
|
|
67218
|
+
console.error(`[agent-host] refused "host.trustDevTab" (${who}): non-dev origin`);
|
|
67219
|
+
return this.sendError(ws2, id3, {
|
|
67220
|
+
code: "internal",
|
|
67221
|
+
message: "host.trustDevTab is only allowed from a local dev browser origin (127.0.0.1 or localhost on port 5173 or 5174)",
|
|
67222
|
+
retryable: false,
|
|
67223
|
+
data: { refused: "rights", rights: "asks" }
|
|
67224
|
+
});
|
|
67225
|
+
}
|
|
67226
|
+
const parsed = RpcMethods["host.trustDevTab"].params.safeParse(params);
|
|
67227
|
+
if (!parsed.success) {
|
|
67228
|
+
console.error(`[agent-host] refused "host.trustDevTab" (${who}): invalid params`);
|
|
67229
|
+
return this.sendError(ws2, id3, {
|
|
67230
|
+
code: "internal",
|
|
67231
|
+
message: `host.trustDevTab was not done: ${parsed.error.issues[0]?.message ?? "invalid parameters"}.`,
|
|
67232
|
+
retryable: false,
|
|
67233
|
+
data: { refused: "not_done" }
|
|
67234
|
+
});
|
|
67235
|
+
}
|
|
67236
|
+
if (trustedDev) {
|
|
67237
|
+
this.sendTo(ws2, JSON.stringify({ kind: "res", id: id3, ok: true, result: { ok: true } }));
|
|
67238
|
+
return;
|
|
67239
|
+
}
|
|
67240
|
+
if (trustingDev) {
|
|
67241
|
+
console.error(`[agent-host] refused "host.trustDevTab" (${who}): already waiting`);
|
|
67242
|
+
return this.sendError(ws2, id3, {
|
|
67243
|
+
code: "internal",
|
|
67244
|
+
message: "A trust request for this dev browser tab is already waiting in the Centralu window",
|
|
67245
|
+
retryable: false,
|
|
67246
|
+
data: { refused: "not_done" }
|
|
67247
|
+
});
|
|
67248
|
+
}
|
|
67249
|
+
if (!this.opts.onAsk) {
|
|
67250
|
+
console.error(`[agent-host] refused "host.trustDevTab" (${who}): no host-request handler`);
|
|
67251
|
+
const refusal3 = limitedRefusal(method, params, this.opts.rightsHost ?? null);
|
|
67252
|
+
return this.sendError(ws2, id3, {
|
|
67253
|
+
code: "internal",
|
|
67254
|
+
message: refusal3?.message ?? "host.trustDevTab requires the Centralu window",
|
|
67255
|
+
retryable: false,
|
|
67256
|
+
data: { refused: "rights", rights: refusal3?.rights ?? "asks" }
|
|
67257
|
+
});
|
|
67258
|
+
}
|
|
67259
|
+
trustingDev = true;
|
|
67260
|
+
try {
|
|
67261
|
+
const result = await this.opts.onAsk(method, parsed.data, { client: label, origin }, leaving.signal);
|
|
67262
|
+
if (!leaving.signal.aborted) {
|
|
67263
|
+
trustedDev = true;
|
|
67264
|
+
console.error(`[agent-host] trusted dev tab for human message attribution (${who})`);
|
|
67265
|
+
}
|
|
67266
|
+
this.sendTo(ws2, JSON.stringify({ kind: "res", id: id3, ok: true, result }));
|
|
67267
|
+
} catch (err) {
|
|
67268
|
+
const data = err !== null && typeof err === "object" && "data" in err ? err.data : void 0;
|
|
67269
|
+
this.sendError(ws2, id3, { code: "internal", message: errorMessage(err), retryable: err instanceof DrainCut, ...data !== void 0 ? { data } : {} });
|
|
67270
|
+
} finally {
|
|
67271
|
+
trustingDev = false;
|
|
67272
|
+
}
|
|
67273
|
+
return;
|
|
67274
|
+
}
|
|
67165
67275
|
const refusal2 = limitedRefusal(method, params, this.opts.rightsHost ?? null);
|
|
67166
67276
|
if (refusal2?.rights === "asks" && this.opts.onAsk) {
|
|
67167
67277
|
try {
|
|
67168
|
-
const result = await this.opts.onAsk(
|
|
67278
|
+
const result = await this.opts.onAsk(
|
|
67279
|
+
method,
|
|
67280
|
+
params,
|
|
67281
|
+
{ client: label, ...session2 ? { session: session2 } : {}, ...trustedDev ? { trustedDev: true } : {} },
|
|
67282
|
+
leaving.signal
|
|
67283
|
+
);
|
|
67169
67284
|
this.sendTo(ws2, JSON.stringify({ kind: "res", id: id3, ok: true, result }));
|
|
67170
67285
|
} catch (err) {
|
|
67171
67286
|
const data = err !== null && typeof err === "object" && "data" in err ? err.data : void 0;
|
|
@@ -67180,7 +67295,15 @@ var HostServer = class _HostServer {
|
|
|
67180
67295
|
}
|
|
67181
67296
|
try {
|
|
67182
67297
|
const covered = limited && conditionalRight(method);
|
|
67183
|
-
const run2 = () => this.opts.onRpc(method, params, {
|
|
67298
|
+
const run2 = () => this.opts.onRpc(method, params, {
|
|
67299
|
+
client,
|
|
67300
|
+
rights: limited ? "limited" : "full",
|
|
67301
|
+
label,
|
|
67302
|
+
...covered ? { covered: true } : {},
|
|
67303
|
+
...session2 ? { session: session2 } : {},
|
|
67304
|
+
...trustedDev ? { trustedDev: true } : {},
|
|
67305
|
+
...this.showing.has(ws2) ? { window: true } : {}
|
|
67306
|
+
});
|
|
67184
67307
|
const result = await (this.opts.drain ? this.opts.drain.track(`rpc ${method}`, run2) : run2());
|
|
67185
67308
|
this.sendTo(ws2, JSON.stringify({ kind: "res", id: id3, ok: true, result }));
|
|
67186
67309
|
} catch (err) {
|
|
@@ -67300,7 +67423,7 @@ var HostServer = class _HostServer {
|
|
|
67300
67423
|
this.calls.delete(ws2);
|
|
67301
67424
|
for (const call2 of [...pending.values()]) call2.reject(rpcError(why2, "internal", { retryable: false }));
|
|
67302
67425
|
}
|
|
67303
|
-
helloOk(resyncRequired) {
|
|
67426
|
+
helloOk(resyncRequired, limited = false) {
|
|
67304
67427
|
return JSON.stringify({
|
|
67305
67428
|
kind: "hello_ok",
|
|
67306
67429
|
protocolVersion: PROTOCOL_VERSION,
|
|
@@ -67311,7 +67434,8 @@ var HostServer = class _HostServer {
|
|
|
67311
67434
|
...elevatedField(this.opts.elevated?.()),
|
|
67312
67435
|
...this.opts.logon?.() ? { logon: this.opts.logon() } : {},
|
|
67313
67436
|
...this.opts.handover?.() ? { handover: this.opts.handover() } : {},
|
|
67314
|
-
...this.opts.updateContinued ? { updateContinued: this.opts.updateContinued() } : {}
|
|
67437
|
+
...this.opts.updateContinued ? { updateContinued: this.opts.updateContinued() } : {},
|
|
67438
|
+
...limited ? { rights: "limited" } : {}
|
|
67315
67439
|
});
|
|
67316
67440
|
}
|
|
67317
67441
|
/**
|
|
@@ -67321,17 +67445,17 @@ var HostServer = class _HostServer {
|
|
|
67321
67445
|
* cursor where it was, and the next reconnect would ask for the same oversized window, a loop that never converges (the
|
|
67322
67446
|
* livelock of #91; measured: a 2,000 x 50 kB history replayed to a stalled peer left 99.6 MB buffered)
|
|
67323
67447
|
*/
|
|
67324
|
-
greet(ws2, afterSeq, streamEpoch) {
|
|
67448
|
+
greet(ws2, afterSeq, streamEpoch, limited) {
|
|
67325
67449
|
const window2 = this.log.since(afterSeq, streamEpoch);
|
|
67326
67450
|
const hub = this.hubLinks.has(ws2);
|
|
67327
67451
|
const frames = window2.events.filter((e) => hub || e.event.type !== "host_credential_used").map((e) => JSON.stringify({ kind: "event", seq: e.seq, event: e.event }));
|
|
67328
|
-
let bytes2 = ws2.bufferedAmount + wireBytes(this.helloOk(window2.resyncRequired));
|
|
67452
|
+
let bytes2 = ws2.bufferedAmount + wireBytes(this.helloOk(window2.resyncRequired, limited));
|
|
67329
67453
|
for (const f of frames) bytes2 += wireBytes(f);
|
|
67330
67454
|
if (bytes2 > this.limits.replayBudgetBytes) {
|
|
67331
|
-
this.sendTo(ws2, this.helloOk(true));
|
|
67455
|
+
this.sendTo(ws2, this.helloOk(true, limited));
|
|
67332
67456
|
return;
|
|
67333
67457
|
}
|
|
67334
|
-
this.sendTo(ws2, this.helloOk(window2.resyncRequired));
|
|
67458
|
+
this.sendTo(ws2, this.helloOk(window2.resyncRequired, limited));
|
|
67335
67459
|
for (const f of frames) this.sendTo(ws2, f);
|
|
67336
67460
|
}
|
|
67337
67461
|
sendError(ws2, id3, error51) {
|
|
@@ -127471,7 +127595,8 @@ var AcpWire = class {
|
|
|
127471
127595
|
const version2 = init.agentInfo?.version ?? await this.deps.version();
|
|
127472
127596
|
if (version2) this.emit({ type: "agent_version", sessionId: this.sessionId, version: version2 });
|
|
127473
127597
|
this.canClose = init.agentCapabilities?.sessionCapabilities?.close !== void 0;
|
|
127474
|
-
const
|
|
127598
|
+
const meta3 = this.deps.shape?.sessionMeta?.(this.opts);
|
|
127599
|
+
const base2 = { cwd: this.opts.cwd, mcpServers: this.mcpServers(), ...meta3 ? { _meta: meta3 } : {} };
|
|
127475
127600
|
if (resume) {
|
|
127476
127601
|
const caps = init.agentCapabilities;
|
|
127477
127602
|
const method = caps?.loadSession ? "session/load" : caps?.sessionCapabilities?.resume !== void 0 ? "session/resume" : null;
|
|
@@ -128186,7 +128311,32 @@ var InstallFailure = class extends Error {
|
|
|
128186
128311
|
};
|
|
128187
128312
|
|
|
128188
128313
|
// packages/agent-host/src/adapters/antigravity/release.ts
|
|
128314
|
+
var AGY_PLATFORM_KEYS = ["darwin-aarch64", "darwin-x86_64", "linux-x86_64", "linux-aarch64", "windows-x86_64", "windows-aarch64"];
|
|
128189
128315
|
var BASE2 = "https://dl.google.com/agy-extensions/releases";
|
|
128316
|
+
var ALLOWED_ARCHIVE_ORIGIN = "https://dl.google.com";
|
|
128317
|
+
var ALLOWED_ARCHIVE_PREFIX = "/agy-extensions/releases/";
|
|
128318
|
+
var STRICT_SEMVER = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
|
|
128319
|
+
var SHA256_HEX = /^[0-9a-f]{64}$/i;
|
|
128320
|
+
var PLAIN_FILENAME = /^[\w.-]+$/;
|
|
128321
|
+
function isValidAgyVersion(version2) {
|
|
128322
|
+
return STRICT_SEMVER.test(version2) && !version2.includes("..");
|
|
128323
|
+
}
|
|
128324
|
+
function isAllowedAgyArchiveUrl(url2) {
|
|
128325
|
+
try {
|
|
128326
|
+
const parsed = new URL(url2);
|
|
128327
|
+
return parsed.origin === ALLOWED_ARCHIVE_ORIGIN && parsed.pathname.startsWith(ALLOWED_ARCHIVE_PREFIX) && !parsed.pathname.includes("..");
|
|
128328
|
+
} catch {
|
|
128329
|
+
return false;
|
|
128330
|
+
}
|
|
128331
|
+
}
|
|
128332
|
+
function normalizeSha256(sha256) {
|
|
128333
|
+
return SHA256_HEX.test(sha256) ? sha256.toLowerCase() : null;
|
|
128334
|
+
}
|
|
128335
|
+
function sanitizeAgyCommand(cmd) {
|
|
128336
|
+
const clean = cmd.replace(/^\.\//, "");
|
|
128337
|
+
if (clean === "." || clean === ".." || !PLAIN_FILENAME.test(clean)) return null;
|
|
128338
|
+
return clean;
|
|
128339
|
+
}
|
|
128190
128340
|
var posix4 = (url2, sha256, args = []) => ({
|
|
128191
128341
|
url: url2,
|
|
128192
128342
|
sha256,
|
|
@@ -128201,7 +128351,7 @@ var windows2 = (url2, sha256) => ({
|
|
|
128201
128351
|
args: [],
|
|
128202
128352
|
files: ["agy_acp_server.exe", "localharness_external.exe"]
|
|
128203
128353
|
});
|
|
128204
|
-
var
|
|
128354
|
+
var AGY_1_4_3_RELEASE = {
|
|
128205
128355
|
version: "1.4.3",
|
|
128206
128356
|
oauthClient: "1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com",
|
|
128207
128357
|
archives: {
|
|
@@ -128213,6 +128363,86 @@ var AGY_RELEASE = {
|
|
|
128213
128363
|
"windows-aarch64": windows2(`${BASE2}/windows/agy-acp-server-1.4.3-windows-arm64.zip`, "fcd46431ad33d3b510ce0b98fe7b43d095bd8b3f1c363ee2d57faa7ee981c7bb")
|
|
128214
128364
|
}
|
|
128215
128365
|
};
|
|
128366
|
+
var AGY_RELEASE = {
|
|
128367
|
+
version: "1.5.2",
|
|
128368
|
+
oauthClient: "1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com",
|
|
128369
|
+
archives: {
|
|
128370
|
+
"darwin-aarch64": posix4(`${BASE2}/macos/agy-acp-server-1.5.2-darwin-arm64.zip`, "123a16d5c40a8ac99e20f01a62b68dd860fd96b1c528dfb8eaa37ca8733d4845"),
|
|
128371
|
+
"darwin-x86_64": posix4(`${BASE2}/macos/agy-acp-server-1.5.2-darwin-x86_64.zip`, "92addb5580577b5356d35484d72d1a113d9c5312ad766bcb304983aa8e3fbb06"),
|
|
128372
|
+
"linux-x86_64": posix4(`${BASE2}/linux/agy-acp-server-1.5.2-linux-x86_64.zip`, "99dd8612450805011619d7b8447ce374c289e00549d8557f36790e1dd6256852", ["--uid="]),
|
|
128373
|
+
"linux-aarch64": posix4(`${BASE2}/linux/agy-acp-server-1.5.2-linux-arm64.zip`, "e729e05ef54ef0763e48900032466b47fa7c9939cde257f93ba49410ab577acb", ["--uid="]),
|
|
128374
|
+
"windows-x86_64": windows2(`${BASE2}/windows/agy-acp-server-1.5.2-windows-x86_64.zip`, "5cbadd4f4df698572473d8890fc26ec2dc1724501f06e3a963941daec2bd21d6"),
|
|
128375
|
+
"windows-aarch64": windows2(`${BASE2}/windows/agy-acp-server-1.5.2-windows-arm64.zip`, "8a4b2ea8df2ffefae33309348752e9119d21a6d36090c0eb48631c2e8f5781ab")
|
|
128376
|
+
}
|
|
128377
|
+
};
|
|
128378
|
+
var KNOWN_AGY_RELEASES = {
|
|
128379
|
+
"1.4.3": AGY_1_4_3_RELEASE,
|
|
128380
|
+
"1.5.2": AGY_RELEASE
|
|
128381
|
+
};
|
|
128382
|
+
var ACP_REGISTRY_URL = "https://cdn.agentclientprotocol.com/registry/v1/latest/registry.json";
|
|
128383
|
+
var acpBinaryEntrySchema = external_exports.object({
|
|
128384
|
+
archive: external_exports.string(),
|
|
128385
|
+
sha256: external_exports.string(),
|
|
128386
|
+
cmd: external_exports.string().optional(),
|
|
128387
|
+
args: external_exports.array(external_exports.string()).optional()
|
|
128388
|
+
});
|
|
128389
|
+
var acpRegistrySchema = external_exports.object({
|
|
128390
|
+
agents: external_exports.array(
|
|
128391
|
+
external_exports.object({
|
|
128392
|
+
id: external_exports.string(),
|
|
128393
|
+
version: external_exports.string().optional(),
|
|
128394
|
+
distribution: external_exports.object({
|
|
128395
|
+
binary: external_exports.record(external_exports.string(), acpBinaryEntrySchema).optional()
|
|
128396
|
+
}).optional()
|
|
128397
|
+
})
|
|
128398
|
+
)
|
|
128399
|
+
});
|
|
128400
|
+
function parseAgyReleaseFromRegistry(json2) {
|
|
128401
|
+
const parsed = acpRegistrySchema.safeParse(json2);
|
|
128402
|
+
if (!parsed.success) return null;
|
|
128403
|
+
const entry = parsed.data.agents.find((a) => a.id === "antigravity-acp");
|
|
128404
|
+
if (!entry?.version || !isValidAgyVersion(entry.version) || !entry.distribution?.binary) return null;
|
|
128405
|
+
const binary = entry.distribution.binary;
|
|
128406
|
+
const archives = {};
|
|
128407
|
+
for (const key2 of AGY_PLATFORM_KEYS) {
|
|
128408
|
+
const b2 = binary[key2];
|
|
128409
|
+
if (!b2) continue;
|
|
128410
|
+
if (!isAllowedAgyArchiveUrl(b2.archive)) return null;
|
|
128411
|
+
const sha256 = normalizeSha256(b2.sha256);
|
|
128412
|
+
if (!sha256) return null;
|
|
128413
|
+
const isWin = key2.startsWith("windows-");
|
|
128414
|
+
const cmd = b2.cmd !== void 0 ? sanitizeAgyCommand(b2.cmd) : isWin ? "agy_acp_server.exe" : "agy_acp_server.par";
|
|
128415
|
+
if (!cmd) return null;
|
|
128416
|
+
const harness = isWin ? "localharness_external.exe" : "localharness_external";
|
|
128417
|
+
archives[key2] = {
|
|
128418
|
+
url: b2.archive,
|
|
128419
|
+
sha256,
|
|
128420
|
+
command: cmd,
|
|
128421
|
+
args: b2.args ?? [],
|
|
128422
|
+
files: [cmd, harness]
|
|
128423
|
+
};
|
|
128424
|
+
}
|
|
128425
|
+
if (Object.keys(archives).length === 0) return null;
|
|
128426
|
+
return {
|
|
128427
|
+
version: entry.version,
|
|
128428
|
+
oauthClient: AGY_RELEASE.oauthClient,
|
|
128429
|
+
archives
|
|
128430
|
+
};
|
|
128431
|
+
}
|
|
128432
|
+
async function fetchLatestAgyRelease(registryUrl = ACP_REGISTRY_URL, timeoutMs = 1e4) {
|
|
128433
|
+
const ctrl = new AbortController();
|
|
128434
|
+
const timer = setTimeout(() => ctrl.abort(), timeoutMs);
|
|
128435
|
+
try {
|
|
128436
|
+
const res = await fetch(registryUrl, { signal: ctrl.signal });
|
|
128437
|
+
if (!res.ok) return null;
|
|
128438
|
+
const json2 = await res.json();
|
|
128439
|
+
return parseAgyReleaseFromRegistry(json2);
|
|
128440
|
+
} catch {
|
|
128441
|
+
return null;
|
|
128442
|
+
} finally {
|
|
128443
|
+
clearTimeout(timer);
|
|
128444
|
+
}
|
|
128445
|
+
}
|
|
128216
128446
|
var AGY_INSTALL_SPACE_BYTES = 700 * 1024 * 1024;
|
|
128217
128447
|
|
|
128218
128448
|
// packages/agent-host/src/adapters/antigravity/agent-files.ts
|
|
@@ -128243,6 +128473,10 @@ function agyHome(dataDir, version2) {
|
|
|
128243
128473
|
const root3 = join34(dataDir, "tools", "antigravity");
|
|
128244
128474
|
return { root: root3, versionDir: join34(root3, version2), geminiHome: join34(root3, "gemini-home") };
|
|
128245
128475
|
}
|
|
128476
|
+
function agyHomeWithVersion(home, version2) {
|
|
128477
|
+
if (!isValidAgyVersion(version2)) throw new Error(`Invalid Antigravity version: ${version2}`);
|
|
128478
|
+
return { root: home.root, versionDir: join34(home.root, version2), geminiHome: home.geminiHome };
|
|
128479
|
+
}
|
|
128246
128480
|
function agyProgram(home, archive) {
|
|
128247
128481
|
return join34(home.versionDir, archive.command);
|
|
128248
128482
|
}
|
|
@@ -128256,6 +128490,58 @@ function isInstalled(home, archive) {
|
|
|
128256
128490
|
return false;
|
|
128257
128491
|
}
|
|
128258
128492
|
}
|
|
128493
|
+
function readInstalledArchive(home) {
|
|
128494
|
+
try {
|
|
128495
|
+
const marker = asObj(JSON.parse(readFileSync13(join34(home.versionDir, INSTALL_MARKER), "utf8")));
|
|
128496
|
+
if (typeof marker.url !== "string" || !isAllowedAgyArchiveUrl(marker.url)) return null;
|
|
128497
|
+
if (typeof marker.sha256 !== "string") return null;
|
|
128498
|
+
const sha256 = normalizeSha256(marker.sha256);
|
|
128499
|
+
if (!sha256) return null;
|
|
128500
|
+
if (typeof marker.command !== "string") return null;
|
|
128501
|
+
const command = sanitizeAgyCommand(marker.command);
|
|
128502
|
+
if (!command) return null;
|
|
128503
|
+
if (!Array.isArray(marker.args) || !marker.args.every((a) => typeof a === "string")) return null;
|
|
128504
|
+
if (!Array.isArray(marker.files) || marker.files.length === 0) return null;
|
|
128505
|
+
const files2 = [];
|
|
128506
|
+
for (const f of marker.files) {
|
|
128507
|
+
if (typeof f !== "string") return null;
|
|
128508
|
+
const clean = sanitizeAgyCommand(f);
|
|
128509
|
+
if (!clean || clean !== f) return null;
|
|
128510
|
+
files2.push(clean);
|
|
128511
|
+
}
|
|
128512
|
+
if (!files2.includes(command)) return null;
|
|
128513
|
+
if (!files2.every((f) => existsSync18(join34(home.versionDir, f)))) return null;
|
|
128514
|
+
return { url: marker.url, sha256, command, args: marker.args, files: files2 };
|
|
128515
|
+
} catch {
|
|
128516
|
+
return null;
|
|
128517
|
+
}
|
|
128518
|
+
}
|
|
128519
|
+
function findInstalledAgyVersions(rootDir) {
|
|
128520
|
+
try {
|
|
128521
|
+
const entries = readdirSync11(rootDir, { withFileTypes: true });
|
|
128522
|
+
const versions = [];
|
|
128523
|
+
for (const ent2 of entries) {
|
|
128524
|
+
if (!ent2.isDirectory() || !isValidAgyVersion(ent2.name)) continue;
|
|
128525
|
+
const markerPath = join34(rootDir, ent2.name, INSTALL_MARKER);
|
|
128526
|
+
if (existsSync18(markerPath)) {
|
|
128527
|
+
versions.push(ent2.name);
|
|
128528
|
+
}
|
|
128529
|
+
}
|
|
128530
|
+
return versions.sort((a, b2) => isNewerVersion(a, b2) ? -1 : isNewerVersion(b2, a) ? 1 : 0);
|
|
128531
|
+
} catch {
|
|
128532
|
+
return [];
|
|
128533
|
+
}
|
|
128534
|
+
}
|
|
128535
|
+
function findInstalledAgy(baseHome, knownReleases, platformKey) {
|
|
128536
|
+
for (const version2 of findInstalledAgyVersions(baseHome.root)) {
|
|
128537
|
+
const home = agyHomeWithVersion(baseHome, version2);
|
|
128538
|
+
const fromMarker = readInstalledArchive(home);
|
|
128539
|
+
if (fromMarker) return { version: version2, home, archive: fromMarker };
|
|
128540
|
+
const known = platformKey ? knownReleases[version2]?.archives[platformKey] ?? null : null;
|
|
128541
|
+
if (known && isInstalled(home, known)) return { version: version2, home, archive: known };
|
|
128542
|
+
}
|
|
128543
|
+
return null;
|
|
128544
|
+
}
|
|
128259
128545
|
function hasSignIn(home) {
|
|
128260
128546
|
const dir = join34(home.geminiHome, "antigravity-acp");
|
|
128261
128547
|
try {
|
|
@@ -128327,8 +128613,11 @@ async function installAgy(home, archive, version2, opts) {
|
|
|
128327
128613
|
const pkg = join34(work, "pkg");
|
|
128328
128614
|
await unpack(zip, archive, pkg, signal, opts.platform ?? HOST_PLATFORM);
|
|
128329
128615
|
await realOs().files.promises.rm(zip, { force: true });
|
|
128330
|
-
await writeFile5(
|
|
128331
|
-
|
|
128616
|
+
await writeFile5(
|
|
128617
|
+
join34(pkg, INSTALL_MARKER),
|
|
128618
|
+
`${JSON.stringify({ version: version2, sha256: archive.sha256, url: archive.url, command: archive.command, args: archive.args, files: archive.files })}
|
|
128619
|
+
`
|
|
128620
|
+
);
|
|
128332
128621
|
cancelled(signal);
|
|
128333
128622
|
if (isInstalled(home, archive)) return;
|
|
128334
128623
|
await realOs().files.promises.rm(home.versionDir, { recursive: true, force: true });
|
|
@@ -128339,7 +128628,7 @@ async function installAgy(home, archive, version2, opts) {
|
|
|
128339
128628
|
await realOs().files.promises.rm(work, { recursive: true, force: true }).catch(() => {
|
|
128340
128629
|
});
|
|
128341
128630
|
}
|
|
128342
|
-
await removeOtherVersions(home);
|
|
128631
|
+
if (opts.pruneOldVersions !== false) await removeOtherVersions(home);
|
|
128343
128632
|
}
|
|
128344
128633
|
async function download(io2, url2, to, signal, onProgress) {
|
|
128345
128634
|
const body = await io2.download(url2, signal);
|
|
@@ -128443,6 +128732,7 @@ function asFailure(err, signal) {
|
|
|
128443
128732
|
async function removeLeftovers(home) {
|
|
128444
128733
|
await removeStale(home.root, ".install-");
|
|
128445
128734
|
await removeStale(home.root, ".sign-in-");
|
|
128735
|
+
if (existsSync18(join34(home.versionDir, INSTALL_MARKER))) await removeOtherVersions(home);
|
|
128446
128736
|
}
|
|
128447
128737
|
async function removeStale(root3, prefix) {
|
|
128448
128738
|
const names = await readdir8(root3).catch(() => []);
|
|
@@ -128520,20 +128810,20 @@ function notOwnFolder(facts, uid) {
|
|
|
128520
128810
|
}
|
|
128521
128811
|
async function browserFolder(home, platform = HOST_PLATFORM, places = {}, session2) {
|
|
128522
128812
|
const node = places.node ?? process.execPath;
|
|
128523
|
-
const
|
|
128524
|
-
const nodeBad = platform === "win32" ? unusableIn(node,
|
|
128813
|
+
const sep14 = platform === "win32" ? ";" : ":";
|
|
128814
|
+
const nodeBad = platform === "win32" ? unusableIn(node, sep14) : "";
|
|
128525
128815
|
if (nodeBad) return noHelper(`the Node program Centralu runs on is at ${node}, and Antigravity cannot be given a path with ${nodeBad} in it. Install Centralu (or that Node) in a folder whose path has none.`);
|
|
128526
128816
|
await mkdir5(home.root, { recursive: true });
|
|
128527
128817
|
await removeStale(home.root, ".sign-in-");
|
|
128528
128818
|
let dir = resolve13(await mkdtemp3(join34(home.root, `.sign-in-${ownerTag()}-`)));
|
|
128529
|
-
const dataBad = unusableIn(dir,
|
|
128819
|
+
const dataBad = unusableIn(dir, sep14);
|
|
128530
128820
|
if (dataBad) {
|
|
128531
128821
|
await realOs().files.promises.rm(dir, { recursive: true, force: true }).catch(() => {
|
|
128532
128822
|
});
|
|
128533
128823
|
const spare = resolve13(places.spare ?? spareFolder(platform));
|
|
128534
128824
|
const data = `Centralu's data folder is at ${home.root}, and Antigravity cannot be given a path with ${dataBad} in it`;
|
|
128535
128825
|
const move = "Move the data folder to a path without them.";
|
|
128536
|
-
const spareBad = unusableIn(join34(spare, ".sign-in-x"),
|
|
128826
|
+
const spareBad = unusableIn(join34(spare, ".sign-in-x"), sep14);
|
|
128537
128827
|
if (spareBad) return noHelper(`${data}; nor ${spareBad} in ${spare}, the folder Centralu tries instead. ${move}`);
|
|
128538
128828
|
try {
|
|
128539
128829
|
await mkdir5(spare, { recursive: true, mode: 448 });
|
|
@@ -128571,7 +128861,7 @@ exit 0
|
|
|
128571
128861
|
if (browser === "") {
|
|
128572
128862
|
await realOs().files.promises.rm(dir, { recursive: true, force: true }).catch(() => {
|
|
128573
128863
|
});
|
|
128574
|
-
return noHelper(`the helper's folder ${dir} has a path Antigravity cannot be given (it holds ${unusableIn(dir,
|
|
128864
|
+
return noHelper(`the helper's folder ${dir} has a path Antigravity cannot be given (it holds ${unusableIn(dir, sep14)}).`);
|
|
128575
128865
|
}
|
|
128576
128866
|
if (temp) {
|
|
128577
128867
|
try {
|
|
@@ -128875,12 +129165,19 @@ function scrubbed(text3) {
|
|
|
128875
129165
|
var AgySetup = class {
|
|
128876
129166
|
constructor(deps) {
|
|
128877
129167
|
this.deps = deps;
|
|
128878
|
-
this.
|
|
129168
|
+
this.currentHome = deps.home;
|
|
129169
|
+
this.currentArchive = deps.archive;
|
|
129170
|
+
this.currentVersion = deps.version;
|
|
129171
|
+
this.tidied = removeLeftovers(this.currentHome).catch(() => {
|
|
128879
129172
|
});
|
|
128880
129173
|
}
|
|
128881
129174
|
deps;
|
|
129175
|
+
currentHome;
|
|
129176
|
+
currentArchive;
|
|
129177
|
+
currentVersion;
|
|
128882
129178
|
installing = null;
|
|
128883
129179
|
signingIn = null;
|
|
129180
|
+
checking = null;
|
|
128884
129181
|
progress = null;
|
|
128885
129182
|
failure = void 0;
|
|
128886
129183
|
plan = void 0;
|
|
@@ -128889,23 +129186,84 @@ var AgySetup = class {
|
|
|
128889
129186
|
listeners = createListeners((e) => console.error(`[Antigravity] a setup listener failed: ${errorMessage(e)}`));
|
|
128890
129187
|
/** What an earlier host left of an install or a sign-in, removed as this host starts; every install and sign-in waits for it */
|
|
128891
129188
|
tidied;
|
|
129189
|
+
get version() {
|
|
129190
|
+
return this.currentVersion;
|
|
129191
|
+
}
|
|
129192
|
+
get archive() {
|
|
129193
|
+
return this.currentArchive;
|
|
129194
|
+
}
|
|
129195
|
+
get home() {
|
|
129196
|
+
return this.currentHome;
|
|
129197
|
+
}
|
|
129198
|
+
/**
|
|
129199
|
+
* Checks for a newer Antigravity ACP version in the registry. Runs only when Antigravity is already installed
|
|
129200
|
+
* and no manual install or sign-in is in flight. Concurrent calls share the same in-flight check.
|
|
129201
|
+
*/
|
|
129202
|
+
checkUpdate() {
|
|
129203
|
+
if (this.deps.autoUpdate === false || !this.deps.platformKey) return Promise.resolve(false);
|
|
129204
|
+
if (!this.installed() || this.installing || this.signingIn) return Promise.resolve(false);
|
|
129205
|
+
if (this.checking) return this.checking;
|
|
129206
|
+
const run2 = this.runCheckUpdate().finally(() => {
|
|
129207
|
+
if (this.checking === run2) this.checking = null;
|
|
129208
|
+
});
|
|
129209
|
+
this.checking = run2;
|
|
129210
|
+
return run2;
|
|
129211
|
+
}
|
|
129212
|
+
async runCheckUpdate() {
|
|
129213
|
+
const platformKey = this.deps.platformKey;
|
|
129214
|
+
if (!platformKey) return false;
|
|
129215
|
+
try {
|
|
129216
|
+
await this.tidied;
|
|
129217
|
+
if (!this.installed() || this.installing || this.signingIn) return false;
|
|
129218
|
+
const fetchRelease = this.deps.fetchRelease ?? fetchLatestAgyRelease;
|
|
129219
|
+
const release = await fetchRelease() ?? AGY_RELEASE;
|
|
129220
|
+
const newArchive = release?.archives[platformKey];
|
|
129221
|
+
if (!release || !newArchive) return false;
|
|
129222
|
+
const newVersion = release.version;
|
|
129223
|
+
if (!isNewerVersion(newVersion, this.currentVersion)) return false;
|
|
129224
|
+
const newHome = agyHomeWithVersion(this.currentHome, newVersion);
|
|
129225
|
+
if (!isInstalled(newHome, newArchive)) {
|
|
129226
|
+
if (this.installing || this.signingIn) return false;
|
|
129227
|
+
const run2 = this.deps.runInstall ?? ((signal, onProgress) => installAgy(newHome, newArchive, newVersion, {
|
|
129228
|
+
signal,
|
|
129229
|
+
onProgress,
|
|
129230
|
+
pruneOldVersions: false,
|
|
129231
|
+
...this.deps.installIo ? { io: this.deps.installIo } : {}
|
|
129232
|
+
}));
|
|
129233
|
+
const abort = new AbortController();
|
|
129234
|
+
await run2(abort.signal, () => {
|
|
129235
|
+
});
|
|
129236
|
+
}
|
|
129237
|
+
if (!this.installing && !this.signingIn && isInstalled(newHome, newArchive)) {
|
|
129238
|
+
this.currentVersion = newVersion;
|
|
129239
|
+
this.currentArchive = newArchive;
|
|
129240
|
+
this.currentHome = newHome;
|
|
129241
|
+
this.deps.onVersionUpdated?.({ version: newVersion, archive: newArchive, home: newHome });
|
|
129242
|
+
this.changed();
|
|
129243
|
+
return true;
|
|
129244
|
+
}
|
|
129245
|
+
} catch (e) {
|
|
129246
|
+
console.error(`[Antigravity] auto-update check failed: ${errorMessage(e)}`);
|
|
129247
|
+
}
|
|
129248
|
+
return false;
|
|
129249
|
+
}
|
|
128892
129250
|
/** Resolves once the leftovers of an earlier host are gone (for tests and the host's start) */
|
|
128893
129251
|
whenTidy() {
|
|
128894
129252
|
return this.tidied;
|
|
128895
129253
|
}
|
|
128896
129254
|
installed() {
|
|
128897
|
-
return this.
|
|
129255
|
+
return this.currentArchive !== null && isInstalled(this.currentHome, this.currentArchive);
|
|
128898
129256
|
}
|
|
128899
129257
|
appFound() {
|
|
128900
129258
|
return this.deps.appFound?.() ?? false;
|
|
128901
129259
|
}
|
|
128902
129260
|
signedIn() {
|
|
128903
|
-
return this.installed() && !this.signedOutSeen && hasSignIn(this.
|
|
129261
|
+
return this.installed() && !this.signedOutSeen && hasSignIn(this.currentHome);
|
|
128904
129262
|
}
|
|
128905
129263
|
current() {
|
|
128906
129264
|
const base2 = { install: "centralu", signIn: "centralu" };
|
|
128907
129265
|
const failure4 = this.failure ? { failure: this.failure } : {};
|
|
128908
|
-
if (this.
|
|
129266
|
+
if (this.currentArchive === null) {
|
|
128909
129267
|
return { ...base2, state: "not_installed", failure: { reason: "unsupported_platform", message: "Google ships no Antigravity agent for this system" } };
|
|
128910
129268
|
}
|
|
128911
129269
|
if (this.installing) return { ...base2, state: "installing", ...this.progress ? { progress: this.progress } : {} };
|
|
@@ -128921,12 +129279,14 @@ var AgySetup = class {
|
|
|
128921
129279
|
this.listeners.emit(this.current());
|
|
128922
129280
|
}
|
|
128923
129281
|
install() {
|
|
128924
|
-
const
|
|
129282
|
+
const home = this.currentHome;
|
|
129283
|
+
const archive = this.currentArchive;
|
|
129284
|
+
const version2 = this.currentVersion;
|
|
128925
129285
|
if (this.installing || !archive || this.installed()) return this.current();
|
|
128926
129286
|
const abort = new AbortController();
|
|
128927
129287
|
this.failure = void 0;
|
|
128928
129288
|
this.progress = { received: 0, total: null };
|
|
128929
|
-
const run2 = this.deps.runInstall ?? ((signal, onProgress) => installAgy(
|
|
129289
|
+
const run2 = this.deps.runInstall ?? ((signal, onProgress) => installAgy(home, archive, version2, { signal, onProgress, ...this.deps.installIo ? { io: this.deps.installIo } : {} }));
|
|
128930
129290
|
const done2 = this.tidied.then(
|
|
128931
129291
|
() => run2(abort.signal, (p) => {
|
|
128932
129292
|
this.progress = p;
|
|
@@ -128958,16 +129318,17 @@ var AgySetup = class {
|
|
|
128958
129318
|
return this.current();
|
|
128959
129319
|
}
|
|
128960
129320
|
signIn() {
|
|
128961
|
-
const
|
|
129321
|
+
const home = this.currentHome;
|
|
129322
|
+
const archive = this.currentArchive;
|
|
128962
129323
|
if (this.signingIn || !archive || !this.installed()) return this.current();
|
|
128963
129324
|
const abort = new AbortController();
|
|
128964
129325
|
this.failure = void 0;
|
|
128965
|
-
const run2 = this.deps.runSignIn ?? ((signal) => runSignIn(
|
|
129326
|
+
const run2 = this.deps.runSignIn ?? ((signal) => runSignIn(home, archive, signal, this.deps.signIn ?? {}));
|
|
128966
129327
|
const done2 = this.tidied.then(() => run2(abort.signal)).then(
|
|
128967
129328
|
(result) => {
|
|
128968
129329
|
this.signedOutSeen = false;
|
|
128969
129330
|
this.plan = result.plan ?? void 0;
|
|
128970
|
-
if (!hasSignIn(
|
|
129331
|
+
if (!hasSignIn(home)) this.failure = { reason: "failed", message: "Antigravity answered the sign-in but kept no account" };
|
|
128971
129332
|
},
|
|
128972
129333
|
(err) => {
|
|
128973
129334
|
this.failure = failureOf(err, "sign-in");
|
|
@@ -129085,14 +129446,6 @@ var AGY_SURFACE = {
|
|
|
129085
129446
|
offeredWhenMeasured: true,
|
|
129086
129447
|
note: `Only "Log in with Google" (oauth-personal) is offered, through Centralu's own sign-in. The others wait for a screen that takes their settings.`
|
|
129087
129448
|
})),
|
|
129088
|
-
{
|
|
129089
|
-
kind: "capability",
|
|
129090
|
-
name: "_meta.antigravity.systemPrompt.append",
|
|
129091
|
-
treatment: "blocked",
|
|
129092
|
-
measured: `${SPIKE}: offered at initialize, not tried`,
|
|
129093
|
-
offeredWhenMeasured: true,
|
|
129094
|
-
note: "Centralu's role text is not passed yet (roleText: false), so Antigravity is not the Assistant, a coordinator or an app's agent."
|
|
129095
|
-
},
|
|
129096
129449
|
{
|
|
129097
129450
|
kind: "capability",
|
|
129098
129451
|
name: "auth.logout",
|
|
@@ -129110,7 +129463,7 @@ var READ_TIMEOUT_MS = 12e3;
|
|
|
129110
129463
|
var AgyQuota = external_exports.array(
|
|
129111
129464
|
external_exports.object({
|
|
129112
129465
|
name: external_exports.string().min(1),
|
|
129113
|
-
buckets: external_exports.array(external_exports.object({ label: external_exports.string().min(1), remaining: external_exports.number().min(0).max(100), resetsAt: external_exports.iso.datetime() })).min(1)
|
|
129466
|
+
buckets: external_exports.array(external_exports.object({ label: external_exports.string().min(1), remaining: external_exports.number().min(0).max(100), resetsAt: external_exports.iso.datetime().nullable() })).min(1)
|
|
129114
129467
|
})
|
|
129115
129468
|
).min(1);
|
|
129116
129469
|
async function readAgyUsage(home, archive, signedOut, deps = {}) {
|
|
@@ -129185,8 +129538,8 @@ async function readAgyUsage(home, archive, signedOut, deps = {}) {
|
|
|
129185
129538
|
}
|
|
129186
129539
|
}
|
|
129187
129540
|
var GROUP = /^- \*\*(.+)\*\*$/;
|
|
129188
|
-
var NOTE =
|
|
129189
|
-
var BUCKET = /^- \*\*(.+):\*\* (\d+(?:\.\d+)?)% remaining \(resets (.+)\)
|
|
129541
|
+
var NOTE = /^\*?\(.*\)\*?$/;
|
|
129542
|
+
var BUCKET = /^- \*\*(.+):\*\* (\d+(?:\.\d+)?)% remaining(?: \(resets (.+)\))?$/;
|
|
129190
129543
|
var RESET = /^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{1,2}), (\d{4}), (\d{2}):(\d{2}) UTC$/;
|
|
129191
129544
|
var MONTHS2 = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
129192
129545
|
function unread2(what) {
|
|
@@ -129207,30 +129560,42 @@ function readAgyQuota(markdown2) {
|
|
|
129207
129560
|
const group2 = groups.at(-1);
|
|
129208
129561
|
if (!group2) throw unread2("a limit before any group");
|
|
129209
129562
|
const resetStr = bucket[3];
|
|
129210
|
-
|
|
129211
|
-
if (
|
|
129212
|
-
|
|
129563
|
+
let resetsAt = null;
|
|
129564
|
+
if (resetStr) {
|
|
129565
|
+
const reset = RESET.exec(resetStr);
|
|
129566
|
+
if (!reset) throw unread2("a reset time");
|
|
129567
|
+
const [, month, day4, year, hour, minute] = reset;
|
|
129568
|
+
if (!month || !day4 || !year || !hour || !minute) throw unread2("a reset time");
|
|
129569
|
+
const at2 = new Date(Date.UTC(Number(year), MONTHS2.indexOf(month), Number(day4), Number(hour), Number(minute)));
|
|
129570
|
+
resetsAt = at2.toISOString();
|
|
129571
|
+
}
|
|
129213
129572
|
const label = bucket[1];
|
|
129214
129573
|
const remainingStr = bucket[2];
|
|
129215
|
-
if (!
|
|
129216
|
-
|
|
129217
|
-
group2.buckets.push({ label, remaining: Number(remainingStr), resetsAt: at2.toISOString() });
|
|
129574
|
+
if (!label || !remainingStr) throw unread2("a bucket label or value");
|
|
129575
|
+
group2.buckets.push({ label, remaining: Number(remainingStr), resetsAt });
|
|
129218
129576
|
continue;
|
|
129219
129577
|
}
|
|
129220
129578
|
const group = GROUP.exec(line);
|
|
129221
|
-
if (
|
|
129222
|
-
|
|
129579
|
+
if (group && group[1]) {
|
|
129580
|
+
groups.push({ name: group[1], buckets: [] });
|
|
129581
|
+
continue;
|
|
129582
|
+
}
|
|
129583
|
+
throw unread2("a line of a kind it does not know");
|
|
129223
129584
|
}
|
|
129224
129585
|
const quota = AgyQuota.safeParse(groups);
|
|
129225
129586
|
if (!quota.success) throw unread2(groups.length === 0 ? "no limits" : "a group with no limits, or a value out of range");
|
|
129226
129587
|
return quota.data;
|
|
129227
129588
|
}
|
|
129228
129589
|
var slug = (s) => s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
129590
|
+
var isPrimaryGeminiGroup = (name) => /^gemini\s+models$/i.test(name.trim());
|
|
129229
129591
|
function agyUsageSnapshot(quota, plan) {
|
|
129230
|
-
const
|
|
129592
|
+
const ordered = [...quota].sort((a, b2) => (/gemini/i.test(a.name) ? 0 : 1) - (/gemini/i.test(b2.name) ? 0 : 1));
|
|
129593
|
+
const windows3 = ordered.flatMap(
|
|
129231
129594
|
(g5) => g5.buckets.map((b2) => {
|
|
129232
129595
|
const label = b2.label.replace(/\s+Limit(\s+Remaining)?$/, "");
|
|
129233
|
-
|
|
129596
|
+
const id3 = `${slug(g5.name)}:${slug(label)}`;
|
|
129597
|
+
const primary = isPrimaryGeminiGroup(g5.name) && id3.endsWith(":weekly");
|
|
129598
|
+
return { id: id3, label, percent: 100 - b2.remaining, resetsAt: b2.resetsAt, scope: g5.name, ...primary ? { primary: true } : {} };
|
|
129234
129599
|
})
|
|
129235
129600
|
);
|
|
129236
129601
|
return { plan, windows: windows3, daily: [] };
|
|
@@ -129345,15 +129710,28 @@ async function listAgyModels(home, archive, setup, signedOut, label, install) {
|
|
|
129345
129710
|
}
|
|
129346
129711
|
|
|
129347
129712
|
// packages/agent-host/src/adapters/antigravity/index.ts
|
|
129713
|
+
var AGY_SUBAGENT_TOOL = "invoke_subagent";
|
|
129714
|
+
function agySystemPrompt(opts) {
|
|
129715
|
+
const apps = (opts.apps?.current().length ?? 0) > 0;
|
|
129716
|
+
const rawTools = opts.centraluTools && opts.centraluBridge ? instructionsFor(toolProfileOf(opts), void 0, apps, AGY_SUBAGENT_TOOL) : void 0;
|
|
129717
|
+
const tools = rawTools ? `# How to use the ${CENTRALU_MCP_NAME} MCP server tools
|
|
129718
|
+
|
|
129719
|
+
${rawTools}` : void 0;
|
|
129720
|
+
const text3 = [opts.systemPromptAppend, tools].filter(Boolean).join("\n\n");
|
|
129721
|
+
return text3 || void 0;
|
|
129722
|
+
}
|
|
129348
129723
|
var CAPABILITIES = {
|
|
129349
|
-
// What the agent does or lacks beyond these fields (`
|
|
129724
|
+
// What the agent does or lacks beyond these fields (`attachments` and `keepsRepoFilesOut` stay at the ACP defaults):
|
|
129350
129725
|
// - Files of its own in the project: on Linux (measured, 1.4.3 and 1.5.0) and macOS (seen), it writes its `run_workflow`
|
|
129351
129726
|
// skill as `skills/system/run-workflow/SKILL.md` into the session's project at `session/new`; Windows 1.4.3 writes none
|
|
129352
129727
|
// (#2320, docs/plans/antigravity-acp.md §1 has the cause)
|
|
129353
|
-
// -
|
|
129354
|
-
//
|
|
129728
|
+
// - System prompt & role text: passed through `_meta.antigravity.systemPrompt.append` on session/new, session/load, and session/resume
|
|
129729
|
+
// - Not offered yet: untrusted projects (it reads the project's own instruction files, as the other ACP tools), images in the prompt
|
|
129355
129730
|
...ACP_CAPABILITIES,
|
|
129356
|
-
autoTitle: false
|
|
129731
|
+
autoTitle: false,
|
|
129732
|
+
instructionChannel: "developer",
|
|
129733
|
+
subagentTool: AGY_SUBAGENT_TOOL,
|
|
129734
|
+
roleText: true
|
|
129357
129735
|
};
|
|
129358
129736
|
var DESCRIPTOR = {
|
|
129359
129737
|
name: "antigravity",
|
|
@@ -129363,10 +129741,22 @@ var DESCRIPTOR = {
|
|
|
129363
129741
|
login: "Sign in with Google from Antigravity's line in Centralu."
|
|
129364
129742
|
};
|
|
129365
129743
|
function antigravityProfile(deps = {}) {
|
|
129744
|
+
const root3 = deps.dataDir ?? dataRoot();
|
|
129745
|
+
const baseHome = agyHome(root3, AGY_RELEASE.version);
|
|
129366
129746
|
const key2 = agyPlatformKey(deps.platform, deps.arch);
|
|
129367
|
-
const
|
|
129368
|
-
const
|
|
129369
|
-
const
|
|
129747
|
+
const existing = key2 ? findInstalledAgy(baseHome, KNOWN_AGY_RELEASES, key2) : null;
|
|
129748
|
+
const initialVersion = existing?.version ?? AGY_RELEASE.version;
|
|
129749
|
+
const initialArchive = existing?.archive ?? (key2 ? AGY_RELEASE.archives[key2] : null);
|
|
129750
|
+
const initialHome = existing?.home ?? baseHome;
|
|
129751
|
+
const setup = new AgySetup({
|
|
129752
|
+
home: initialHome,
|
|
129753
|
+
archive: initialArchive,
|
|
129754
|
+
version: initialVersion,
|
|
129755
|
+
platformKey: key2,
|
|
129756
|
+
autoUpdate: true,
|
|
129757
|
+
appFound: agyAppFinder(deps.platform),
|
|
129758
|
+
...deps
|
|
129759
|
+
});
|
|
129370
129760
|
const signedOut = () => {
|
|
129371
129761
|
setup.noteSignedOut();
|
|
129372
129762
|
return rpcError(notSignedIn(DESCRIPTOR, "centralu"), "not_logged_in");
|
|
@@ -129377,9 +129767,15 @@ function antigravityProfile(deps = {}) {
|
|
|
129377
129767
|
capabilities: CAPABILITIES,
|
|
129378
129768
|
surface: AGY_SURFACE,
|
|
129379
129769
|
agySetup: setup,
|
|
129380
|
-
home
|
|
129381
|
-
|
|
129770
|
+
get home() {
|
|
129771
|
+
return setup.home;
|
|
129772
|
+
},
|
|
129773
|
+
get archive() {
|
|
129774
|
+
return setup.archive;
|
|
129775
|
+
},
|
|
129382
129776
|
async launch(opts) {
|
|
129777
|
+
const archive = setup.archive;
|
|
129778
|
+
const home = setup.home;
|
|
129383
129779
|
if (!archive || !setup.installed()) return null;
|
|
129384
129780
|
const folder = await browserFolder(home, deps.platform, deps.helperPlaces, opts.sessionId);
|
|
129385
129781
|
if (folder.browser === "") {
|
|
@@ -129400,15 +129796,15 @@ function antigravityProfile(deps = {}) {
|
|
|
129400
129796
|
}
|
|
129401
129797
|
};
|
|
129402
129798
|
},
|
|
129403
|
-
sweepSessionFiles: (kept) => sweepSessionTemps(home, kept),
|
|
129799
|
+
sweepSessionFiles: (kept) => sweepSessionTemps(setup.home, kept),
|
|
129404
129800
|
async installedVersion() {
|
|
129405
|
-
return setup.installed() ?
|
|
129801
|
+
return setup.installed() ? setup.version : null;
|
|
129406
129802
|
},
|
|
129407
129803
|
async detect() {
|
|
129408
129804
|
const now = setup.current();
|
|
129409
129805
|
const installed = setup.installed();
|
|
129410
129806
|
const loggedIn = now.state === "ready";
|
|
129411
|
-
const detail = !archive ? "Not available on this system" : !installed ? "Not installed" : loggedIn ? `antigravity-acp ${
|
|
129807
|
+
const detail = !setup.archive ? "Not available on this system" : !installed ? "Not installed" : loggedIn ? `antigravity-acp ${setup.version}` : `antigravity-acp ${setup.version} \xB7 sign-in required`;
|
|
129412
129808
|
return { tool: DESCRIPTOR.name, installed, loggedIn, detail, setup: now };
|
|
129413
129809
|
},
|
|
129414
129810
|
centraluToolOf: agyCentraluTool,
|
|
@@ -129422,18 +129818,24 @@ function antigravityProfile(deps = {}) {
|
|
|
129422
129818
|
interruptForInput: true,
|
|
129423
129819
|
onConfigOptions: (options) => {
|
|
129424
129820
|
const models = toModelOptions(options);
|
|
129425
|
-
if (models.length > 0) void saveAgyModels(home, models).catch(() => {
|
|
129821
|
+
if (models.length > 0) void saveAgyModels(setup.home, models).catch(() => {
|
|
129426
129822
|
});
|
|
129823
|
+
},
|
|
129824
|
+
sessionMeta: (opts) => {
|
|
129825
|
+
const append = agySystemPrompt(opts);
|
|
129826
|
+
return append ? { antigravity: { systemPrompt: { append } } } : void 0;
|
|
129427
129827
|
}
|
|
129428
129828
|
},
|
|
129429
129829
|
listModels() {
|
|
129430
|
-
return listAgyModels(home, archive, setup, signedOut, DESCRIPTOR.label, DESCRIPTOR.install);
|
|
129830
|
+
return listAgyModels(setup.home, setup.archive, setup, signedOut, DESCRIPTOR.label, DESCRIPTOR.install);
|
|
129431
129831
|
},
|
|
129432
129832
|
/*
|
|
129433
129833
|
* Its weekly and five-hour limits per model group, from the agent Centralu signed in (`readAgyUsage`), one read at a
|
|
129434
129834
|
* time. No `account()`: the sign-in is this machine's Centralu's own (plan §0), so a linked machine's usage is read there
|
|
129435
129835
|
*/
|
|
129436
129836
|
listUsage() {
|
|
129837
|
+
const archive = setup.archive;
|
|
129838
|
+
const home = setup.home;
|
|
129437
129839
|
if (!archive || !setup.installed()) return Promise.reject(toolNotInstalled(DESCRIPTOR.label, DESCRIPTOR.install));
|
|
129438
129840
|
if (setup.current().state !== "ready") return Promise.reject(signedOut());
|
|
129439
129841
|
reading ??= readAgyUsage(home, archive, signedOut, { platform: deps.platform, helperPlaces: deps.helperPlaces, ...deps.usage }).then((quota) => agyUsageSnapshot(quota, setup.current().plan?.name ?? null)).catch((err) => {
|
|
@@ -132598,7 +133000,7 @@ var IDENT = /^[A-Za-z_$][\w$]*$/;
|
|
|
132598
133000
|
function stripComments(text3) {
|
|
132599
133001
|
return text3.replace(/\/\*[\s\S]*?\*\//g, "").replace(/^\s*\/\/.*$/gm, "");
|
|
132600
133002
|
}
|
|
132601
|
-
function splitTop(text3,
|
|
133003
|
+
function splitTop(text3, sep14) {
|
|
132602
133004
|
const parts = [];
|
|
132603
133005
|
let depth = 0;
|
|
132604
133006
|
let quote = "";
|
|
@@ -132613,7 +133015,7 @@ function splitTop(text3, sep13) {
|
|
|
132613
133015
|
if (c === "'" || c === '"' || c === "`") quote = c;
|
|
132614
133016
|
else if ("{[(<".includes(c)) depth++;
|
|
132615
133017
|
else if ("}])>".includes(c) && !(c === ">" && text3[i - 1] === "=")) depth--;
|
|
132616
|
-
else if (c ===
|
|
133018
|
+
else if (c === sep14 && depth === 0) {
|
|
132617
133019
|
parts.push(text3.slice(start3, i));
|
|
132618
133020
|
start3 = i + 1;
|
|
132619
133021
|
}
|
|
@@ -145915,6 +146317,9 @@ var HostCards = class {
|
|
|
145915
146317
|
}
|
|
145916
146318
|
};
|
|
145917
146319
|
|
|
146320
|
+
// packages/agent-host/src/sessions/session-record.ts
|
|
146321
|
+
import { sep as sep12 } from "node:path";
|
|
146322
|
+
|
|
145918
146323
|
// packages/agent-host/src/dev-services/message-image.ts
|
|
145919
146324
|
import { constants as constants8 } from "node:fs";
|
|
145920
146325
|
import { open as open5, realpath as realpath11 } from "node:fs/promises";
|
|
@@ -145932,12 +146337,23 @@ function sniffImage2(b2) {
|
|
|
145932
146337
|
return null;
|
|
145933
146338
|
}
|
|
145934
146339
|
function writtenForms(written) {
|
|
145935
|
-
|
|
146340
|
+
const forms = /* @__PURE__ */ new Set([written]);
|
|
145936
146341
|
try {
|
|
145937
|
-
|
|
146342
|
+
forms.add(encodeURI(written));
|
|
145938
146343
|
} catch {
|
|
145939
146344
|
}
|
|
145940
|
-
|
|
146345
|
+
if (/^file:/i.test(written)) {
|
|
146346
|
+
try {
|
|
146347
|
+
forms.add(decodeURI(written));
|
|
146348
|
+
} catch {
|
|
146349
|
+
}
|
|
146350
|
+
}
|
|
146351
|
+
for (const form of [...forms]) {
|
|
146352
|
+
if (form.includes("(") || form.includes(")")) {
|
|
146353
|
+
forms.add(form.replace(/\(/g, "%28").replace(/\)/g, "%29"));
|
|
146354
|
+
}
|
|
146355
|
+
}
|
|
146356
|
+
return [...forms];
|
|
145941
146357
|
}
|
|
145942
146358
|
var BEFORE = /[\s(<"'`]/;
|
|
145943
146359
|
var AFTER2 = /[\s)>"'`]/;
|
|
@@ -146015,6 +146431,44 @@ async function readMessageImage(abs, max = IMAGE_PREVIEW_MAX_BYTES) {
|
|
|
146015
146431
|
await handle2.close();
|
|
146016
146432
|
}
|
|
146017
146433
|
}
|
|
146434
|
+
function stripFileLocation(written) {
|
|
146435
|
+
if (/^file:/i.test(written)) {
|
|
146436
|
+
const hashAt = written.indexOf("#");
|
|
146437
|
+
const base2 = hashAt >= 0 ? written.slice(0, hashAt) : written;
|
|
146438
|
+
const stripped2 = base2.replace(/:\d+(?::\d+)?$/, "");
|
|
146439
|
+
if (!stripped2 || stripped2 === base2 || /^file:\/\/(?:\/|localhost\/)[A-Za-z]:?$/i.test(stripped2)) return null;
|
|
146440
|
+
return stripped2;
|
|
146441
|
+
}
|
|
146442
|
+
if (/^[A-Za-z]:\d+(?::\d+)?$/.test(written)) return null;
|
|
146443
|
+
const stripped = written.replace(/(?:#L\d+(?:C\d+)?(?:-L?\d+(?:C\d+)?)?|:\d+(?::\d+)?)$/i, "");
|
|
146444
|
+
if (!stripped || stripped === written || /^[A-Za-z]:$/.test(stripped) || stripped === "~") return null;
|
|
146445
|
+
return stripped;
|
|
146446
|
+
}
|
|
146447
|
+
async function resolveMessageFile(abs) {
|
|
146448
|
+
const windows3 = sep11 === "\\";
|
|
146449
|
+
if (windows3) {
|
|
146450
|
+
const walk2 = await walkLinks(abs);
|
|
146451
|
+
if (!walk2.ok && walk2.reason === "elsewhere") {
|
|
146452
|
+
return { ok: false, reason: "not_found", message: `${abs} leads to ${walk2.why}, which is not on this machine` };
|
|
146453
|
+
}
|
|
146454
|
+
if (!walk2.ok) return { ok: false, reason: "unreadable", message: `Centralu cannot check where ${abs} leads: ${walk2.why}` };
|
|
146455
|
+
}
|
|
146456
|
+
let file2;
|
|
146457
|
+
try {
|
|
146458
|
+
file2 = await realpath11(abs);
|
|
146459
|
+
} catch (e) {
|
|
146460
|
+
const code2 = errnoCode(e);
|
|
146461
|
+
if (code2 === "EACCES" || code2 === "EPERM") return { ok: false, reason: "unreadable", message: `Centralu may not inspect ${abs}` };
|
|
146462
|
+
return { ok: false, reason: "not_found", message: `There is no file or folder at ${abs}` };
|
|
146463
|
+
}
|
|
146464
|
+
if (windows3 && !DRIVE_PATH.test(file2)) {
|
|
146465
|
+
return { ok: false, reason: "not_found", message: `${abs} leads to ${file2}, which is not on this machine` };
|
|
146466
|
+
}
|
|
146467
|
+
if (file2 === "/" || /^[A-Za-z]:[\\/]?$/.test(file2)) {
|
|
146468
|
+
return { ok: false, reason: "unreadable", message: `${file2} is a root folder and cannot be revealed` };
|
|
146469
|
+
}
|
|
146470
|
+
return { ok: true, file: file2 };
|
|
146471
|
+
}
|
|
146018
146472
|
|
|
146019
146473
|
// packages/agent-host/src/dev-services/attachments.ts
|
|
146020
146474
|
import { lstat as lstat12, mkdir as mkdir8, readdir as readdir14, writeFile as writeFile6 } from "node:fs/promises";
|
|
@@ -146294,9 +146748,34 @@ var SessionRecord = class {
|
|
|
146294
146748
|
if (!this.repliesName(sessionId, written)) {
|
|
146295
146749
|
return { ok: false, reason: "not_mentioned", message: "No reply in this session names this path, so it is not read" };
|
|
146296
146750
|
}
|
|
146297
|
-
const
|
|
146751
|
+
const cwd = this.host.cwdFor(m);
|
|
146752
|
+
const abs = resolveWrittenPath(written, cwd);
|
|
146753
|
+
if (abs === null) return { ok: false, reason: "not_found", message: `${written} is not a path on this machine` };
|
|
146754
|
+
const first = await readMessageImage(abs);
|
|
146755
|
+
if (first.ok || !shouldRetryWithoutLocation(written, first.reason)) return first;
|
|
146756
|
+
const stripped = stripFileLocation(written);
|
|
146757
|
+
if (!stripped) return first;
|
|
146758
|
+
const fallbackAbs = resolveWrittenPath(stripped, cwd);
|
|
146759
|
+
return fallbackAbs === null ? first : readMessageImage(fallbackAbs);
|
|
146760
|
+
}
|
|
146761
|
+
/**
|
|
146762
|
+
* Resolves a local file or folder one of this session's replies linked (`messages.resolveFile`).
|
|
146763
|
+
* Checks `repliesName` before touching disk so unmentioned paths learn nothing about existence.
|
|
146764
|
+
*/
|
|
146765
|
+
async messageFile(sessionId, written) {
|
|
146766
|
+
const m = this.host.sessionOf(sessionId);
|
|
146767
|
+
if (!this.repliesName(sessionId, written)) {
|
|
146768
|
+
return { ok: false, reason: "not_mentioned", message: "No reply in this session names this path, so it is not opened" };
|
|
146769
|
+
}
|
|
146770
|
+
const cwd = this.host.cwdFor(m);
|
|
146771
|
+
const abs = resolveWrittenPath(written, cwd);
|
|
146298
146772
|
if (abs === null) return { ok: false, reason: "not_found", message: `${written} is not a path on this machine` };
|
|
146299
|
-
|
|
146773
|
+
const first = await resolveMessageFile(abs);
|
|
146774
|
+
if (first.ok || !shouldRetryWithoutLocation(written, first.reason)) return first;
|
|
146775
|
+
const stripped = stripFileLocation(written);
|
|
146776
|
+
if (!stripped) return first;
|
|
146777
|
+
const fallbackAbs = resolveWrittenPath(stripped, cwd);
|
|
146778
|
+
return fallbackAbs === null ? first : resolveMessageFile(fallbackAbs);
|
|
146300
146779
|
}
|
|
146301
146780
|
repliesName(sessionId, written) {
|
|
146302
146781
|
const open6 = this.streams.get(sessionId);
|
|
@@ -146346,6 +146825,10 @@ var SessionRecord = class {
|
|
|
146346
146825
|
);
|
|
146347
146826
|
}
|
|
146348
146827
|
};
|
|
146828
|
+
function shouldRetryWithoutLocation(written, reason) {
|
|
146829
|
+
if (reason === "not_found") return true;
|
|
146830
|
+
return sep12 === "\\" && reason === "unreadable" && /:\d+(?::\d+)?(?:#.*)?$/.test(written);
|
|
146831
|
+
}
|
|
146349
146832
|
|
|
146350
146833
|
// packages/agent-host/src/sessions/tool-queries.ts
|
|
146351
146834
|
var MODEL_LIST_READ_MS = 6e4;
|
|
@@ -154683,7 +155166,7 @@ function createRpcHandler(mgr2, adapters2, { settleDeletedProjects, deleteOutloo
|
|
|
154683
155166
|
if (!r.ok) throw rpcError(r.error ?? "unknown skill");
|
|
154684
155167
|
return { ok: true };
|
|
154685
155168
|
};
|
|
154686
|
-
const scriptAuthor = (_call, ctx) => ctx?.rights === "limited" ? { credential: scriptLabel(ctx.label) } : void 0;
|
|
155169
|
+
const scriptAuthor = (_call, ctx) => ctx?.rights === "limited" && !ctx.trustedDev ? { credential: scriptLabel(ctx.label) } : void 0;
|
|
154687
155170
|
const builderDeps = (call2, ctx) => {
|
|
154688
155171
|
const fromScript = scriptAuthor(call2, ctx);
|
|
154689
155172
|
return { apps: requireExternalApps(), views: views2, builderOf: (ref) => mgr2.appSessions.builderOf(ref), send: (id3, t, a) => mgr2.inputs.send(id3, t, a, void 0, false, fromScript), byScript: fromScript !== void 0 };
|
|
@@ -155078,6 +155561,9 @@ function createRpcHandler(mgr2, adapters2, { settleDeletedProjects, deleteOutloo
|
|
|
155078
155561
|
"messages.image": async ({ sessionId, path: path2 }) => {
|
|
155079
155562
|
return mgr2.record.messageImage(sessionId, path2);
|
|
155080
155563
|
},
|
|
155564
|
+
"messages.resolveFile": async ({ sessionId, path: path2 }) => {
|
|
155565
|
+
return mgr2.record.messageFile(sessionId, path2);
|
|
155566
|
+
},
|
|
155081
155567
|
"messages.subagent": async ({ sessionId, parentCallId, afterSeq, limit }) => {
|
|
155082
155568
|
return mgr2.record.loadSubagentMessages(sessionId, parentCallId, afterSeq, limit);
|
|
155083
155569
|
},
|
|
@@ -155321,7 +155807,8 @@ function createRpcHandler(mgr2, adapters2, { settleDeletedProjects, deleteOutloo
|
|
|
155321
155807
|
return {};
|
|
155322
155808
|
},
|
|
155323
155809
|
"host.handover": async ({ handover: h }) => ack(handover2?.(h)),
|
|
155324
|
-
"host.systemEnding": async ({ cancelled: cancelled2 }) => ack(systemEnding2?.(cancelled2 === true))
|
|
155810
|
+
"host.systemEnding": async ({ cancelled: cancelled2 }) => ack(systemEnding2?.(cancelled2 === true)),
|
|
155811
|
+
"host.trustDevTab": async (_p2) => ({ ok: true })
|
|
155325
155812
|
};
|
|
155326
155813
|
const routes = { ...raw, ...handlers };
|
|
155327
155814
|
return async (method, params, ctx) => {
|
|
@@ -157083,6 +157570,8 @@ var HostRequests = class {
|
|
|
157083
157570
|
if (early) throw unanswered(method, early);
|
|
157084
157571
|
const p = fields3(params);
|
|
157085
157572
|
switch (method) {
|
|
157573
|
+
case "host.trustDevTab":
|
|
157574
|
+
return this.trustDevTab(params, from, signal);
|
|
157086
157575
|
case "trash.purge":
|
|
157087
157576
|
return this.viaTrash(method, from, signal, { action: "delete", sessionId: str5(p.sessionId), what: "session" }, () => ({ ok: true }));
|
|
157088
157577
|
case "trash.purgeSubagentSteps":
|
|
@@ -157093,6 +157582,21 @@ var HostRequests = class {
|
|
|
157093
157582
|
return this.generic(method, params, from, signal);
|
|
157094
157583
|
}
|
|
157095
157584
|
}
|
|
157585
|
+
/**
|
|
157586
|
+
* A local `dev:live` browser tab asking to attribute messages on its single open WebSocket as typed by the person
|
|
157587
|
+
* rather than as a script. The card displays the reported `Origin` header and the tab's 6-char pairing code — the code
|
|
157588
|
+
* match in the desktop window is the security boundary (local processes can spoof `Origin`). Never grants full/window rights.
|
|
157589
|
+
*/
|
|
157590
|
+
async trustDevTab(params, from, signal) {
|
|
157591
|
+
const runs = asItRuns("host.trustDevTab", params);
|
|
157592
|
+
if (!runs.ok) throw refused("not_done", `host.trustDevTab was not done: ${runs.why}.`);
|
|
157593
|
+
if (!from.origin) throw refused("not_done", "host.trustDevTab was not done: no dev browser origin was provided.");
|
|
157594
|
+
const code2 = str5(fields3(runs.params).code);
|
|
157595
|
+
const question = `Trust the dev browser tab at ${plainQuoted(from.origin, 120)} (code ${code2}) to send messages as you? Messages from this open tab (including to linked machines) will be recorded as typed by you rather than as a script until the tab reloads or disconnects. It stays on the limited credential: approvals, deletions, mail, and security settings still require the Centralu desktop window. Allow only if you clicked Trust this tab and see the same code there.`;
|
|
157596
|
+
const answer = await this.card("host.trustDevTab", question, from, signal);
|
|
157597
|
+
if (answer.decision !== "allow") throw unanswered("host.trustDevTab", answer.outcome);
|
|
157598
|
+
return { ok: true };
|
|
157599
|
+
}
|
|
157096
157600
|
/**
|
|
157097
157601
|
* Any other method's card (host-request-targets.ts): the call as its schema parses it is what the card shows and what runs,
|
|
157098
157602
|
* with what it acts on by name and what it loses. After Allow the names are read again, and a call whose target changed
|
|
@@ -157114,7 +157618,7 @@ var HostRequests = class {
|
|
|
157114
157618
|
if (!now.ok || now.text !== targets.text) {
|
|
157115
157619
|
throw refused("not_done", `${method} was not done: what its card named changed while it stood (${now.ok ? `now ${now.text}` : now.why}).`);
|
|
157116
157620
|
}
|
|
157117
|
-
return this.deps.rpc(method, runs.params, { client: -1, rights: "limited", label: from.client });
|
|
157621
|
+
return this.deps.rpc(method, runs.params, { client: -1, rights: "limited", label: from.client, ...from.trustedDev ? { trustedDev: true } : {} });
|
|
157118
157622
|
}
|
|
157119
157623
|
/** The requests waiting, oldest first */
|
|
157120
157624
|
list() {
|
|
@@ -159214,7 +159718,7 @@ function probeTarget(target, opts = {}) {
|
|
|
159214
159718
|
// packages/agent-host/src/links/ssh-config.ts
|
|
159215
159719
|
import { readdirSync as readdirSync18, readFileSync as readFileSync27, statSync as statSync18 } from "node:fs";
|
|
159216
159720
|
import { homedir as homedir17 } from "node:os";
|
|
159217
|
-
import { isAbsolute as isAbsolute10, join as join56, normalize, parse as parse5, sep as
|
|
159721
|
+
import { isAbsolute as isAbsolute10, join as join56, normalize, parse as parse5, sep as sep13 } from "node:path";
|
|
159218
159722
|
var MAX_DEPTH = 16;
|
|
159219
159723
|
function splitConfigLine(raw) {
|
|
159220
159724
|
const m = /^\s*([^\s=#]+)\s*(?:=\s*)?([\s\S]*)$/.exec(raw);
|
|
@@ -159275,7 +159779,7 @@ function expandGlob(path2) {
|
|
|
159275
159779
|
const norm = normalize(path2);
|
|
159276
159780
|
const root3 = parse5(norm).root;
|
|
159277
159781
|
let found = [root3 || "."];
|
|
159278
|
-
for (const seg of norm.slice(root3.length).split(
|
|
159782
|
+
for (const seg of norm.slice(root3.length).split(sep13)) {
|
|
159279
159783
|
if (seg === "") continue;
|
|
159280
159784
|
const next = [];
|
|
159281
159785
|
for (const base2 of found) {
|
|
@@ -159306,7 +159810,7 @@ function expandGlob(path2) {
|
|
|
159306
159810
|
});
|
|
159307
159811
|
}
|
|
159308
159812
|
function tildePath(path2, home) {
|
|
159309
|
-
return path2 === home ? "~" : path2.startsWith(home +
|
|
159813
|
+
return path2 === home ? "~" : path2.startsWith(home + sep13) ? `~${path2.slice(home.length)}` : path2;
|
|
159310
159814
|
}
|
|
159311
159815
|
function readSshConfig(opts) {
|
|
159312
159816
|
const hosts = [];
|
|
@@ -162783,6 +163287,16 @@ var ROUTES = {
|
|
|
162783
163287
|
const { file: _file2, ...rest } = r;
|
|
162784
163288
|
return rest;
|
|
162785
163289
|
}),
|
|
163290
|
+
// A file on a linked machine cannot be revealed in this computer's file manager — refuse locally without forwarding
|
|
163291
|
+
"messages.resolveFile": {
|
|
163292
|
+
kind: "noRemote",
|
|
163293
|
+
key: "sessionId",
|
|
163294
|
+
refuse: () => ({
|
|
163295
|
+
ok: false,
|
|
163296
|
+
reason: "not_found",
|
|
163297
|
+
message: "This file is on another machine and cannot be revealed here"
|
|
163298
|
+
})
|
|
163299
|
+
},
|
|
162786
163300
|
"trash.read": session(messages),
|
|
162787
163301
|
"trash.restore": session(fields4({ session: sessionInfo, project: projectInfo })),
|
|
162788
163302
|
"trash.purge": session(),
|
|
@@ -163003,6 +163517,8 @@ var ROUTES = {
|
|
|
163003
163517
|
"host.handover": HUB,
|
|
163004
163518
|
// The window of this machine telling its own host the system is ending (#1970); never through a link
|
|
163005
163519
|
"host.systemEnding": HUB,
|
|
163520
|
+
// A local dev:live browser tab asking its own host for human message attribution; never through a link
|
|
163521
|
+
"host.trustDevTab": HUB,
|
|
163006
163522
|
"machines.acceptVersions": HUB,
|
|
163007
163523
|
"machines.install": HUB,
|
|
163008
163524
|
"machines.update": HUB,
|
|
@@ -163103,7 +163619,10 @@ var Router = class {
|
|
|
163103
163619
|
case "view":
|
|
163104
163620
|
return this.byView(method, params, route, ctx);
|
|
163105
163621
|
case "noRemote": {
|
|
163106
|
-
if (this.owner(isObj(params) ? params[route.key] : void 0))
|
|
163622
|
+
if (this.owner(isObj(params) ? params[route.key] : void 0)) {
|
|
163623
|
+
if (route.refuse) return route.refuse();
|
|
163624
|
+
throw new NotOnRemoteError(method);
|
|
163625
|
+
}
|
|
163107
163626
|
return this.opts.local(method, params, ctx);
|
|
163108
163627
|
}
|
|
163109
163628
|
case "machine":
|
|
@@ -163124,7 +163643,7 @@ var Router = class {
|
|
|
163124
163643
|
return typeof id3 === "string" ? findMachine(this.opts.machines(), id3) : null;
|
|
163125
163644
|
}
|
|
163126
163645
|
async forward(m, method, params, ctx) {
|
|
163127
|
-
if (ctx?.rights === "limited" && SCRIPT_TEXT.has(method)) {
|
|
163646
|
+
if (ctx?.rights === "limited" && !ctx.trustedDev && SCRIPT_TEXT.has(method)) {
|
|
163128
163647
|
throw rpcError(`A script's message is not sent to ${m.name}: Centralu there would store it as the person's. Run the script on ${m.name} instead.`);
|
|
163129
163648
|
}
|
|
163130
163649
|
if (!m.reachable && ctx === void 0) await m.reachForCall?.();
|
|
@@ -164309,7 +164828,7 @@ var handedToken = launch.tokenOnStdin ? await readHandedToken(process.stdin).cat
|
|
|
164309
164828
|
console.error(`[agent-host] the launcher did not hand over the token: ${e.message}`);
|
|
164310
164829
|
process.exit(1);
|
|
164311
164830
|
}) : launch.token;
|
|
164312
|
-
var BUILD = true ? "
|
|
164831
|
+
var BUILD = true ? "747872f" : "dev";
|
|
164313
164832
|
var { values } = parseArgs({
|
|
164314
164833
|
options: {
|
|
164315
164834
|
port: { type: "string", default: "5175" },
|
|
@@ -164546,7 +165065,10 @@ var agentVersions = new AgentVersionService({
|
|
|
164546
165065
|
readAutoApply: autoApplyAgentVersions.read,
|
|
164547
165066
|
writeAutoApply: autoApplyAgentVersions.write
|
|
164548
165067
|
});
|
|
164549
|
-
for (const a of adapters.values())
|
|
165068
|
+
for (const a of adapters.values()) {
|
|
165069
|
+
a.setup?.onChange((setup) => events.push({ type: "tool_setup", tool: a.tool, setup }));
|
|
165070
|
+
void a.setup?.checkUpdate?.();
|
|
165071
|
+
}
|
|
164550
165072
|
versionsRef.current = agentVersions;
|
|
164551
165073
|
mgr.useVersionHint((tool) => agentVersions.installedNow(tool));
|
|
164552
165074
|
var SLEEP_AFTER_KEY = "agents.sleepAfterMinutes";
|