@moondeck/station 1.0.12 → 1.0.14
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/images/standard/Dockerfile +32 -0
- package/images/standard/README.md +7 -7
- package/lib/agent-cli-issue-attachments.ts +117 -0
- package/lib/agent-cli-issue-comments.ts +103 -0
- package/lib/agent-cli-issues.ts +445 -0
- package/lib/agent-cli.ts +153 -45
- package/lib/agents/agy-pin.ts +36 -0
- package/lib/agents/agy-scrub.ts +11 -0
- package/lib/agents/claude.ts +5 -2
- package/lib/agents/codex.ts +5 -0
- package/lib/agents/factory.ts +1 -0
- package/lib/agents/gemini-credentials.ts +61 -0
- package/lib/agents/gemini-stream.fixture.json +439 -0
- package/lib/agents/gemini.ts +836 -0
- package/lib/agents/transport.ts +5 -2
- package/lib/credential-cleanup-inventory.ts +19 -1
- package/lib/credential-consumers/engines.ts +70 -9
- package/lib/engine-accounts.ts +3 -0
- package/lib/engine-login.ts +162 -7
- package/lib/engine-spawn-env.ts +63 -0
- package/lib/issue-markdown.generated.ts +658 -0
- package/lib/orchestrator.ts +68 -25
- package/lib/standard-image-pin.ts +2 -1
- package/lib/standard-image.ts +9 -1
- package/lib/task-credential-cleanup.ts +3 -1
- package/package.json +1 -1
- package/scripts/agent/task-up.sh +36 -0
- package/scripts/agent/uai-env-exec.sh +89 -1
- package/src/cloud-credentials.ts +6 -0
- package/src/engine-account-paths.ts +2 -0
- package/src/engine-usage.ts +1 -0
- package/src/index.ts +4 -1
- package/src/main.ts +7 -1
- package/src/protocol.ts +7 -4
- package/src/task-env-names.ts +70 -0
package/lib/agent-cli.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { ISSUE_MARKDOWN_SOURCE } from "./issue-markdown.generated";
|
|
2
|
+
import { ISSUE_ATTACHMENTS_CLI_SOURCE } from "./agent-cli-issue-attachments";
|
|
3
|
+
import { ISSUE_COMMENTS_CLI_SOURCE } from "./agent-cli-issue-comments";
|
|
4
|
+
import { ISSUE_CLI_SOURCE } from "./agent-cli-issues";
|
|
1
5
|
import { effectiveAppUrl } from "./cloud-endpoint";
|
|
2
6
|
import { TASK_PROJECT_ADD_WAIT_MS } from "../src/protocol";
|
|
3
7
|
import { validateShareablePath, ENGINE_ACCOUNT_PATH_RULES } from "../src/workspace-path-policy";
|
|
@@ -32,7 +36,7 @@ import {
|
|
|
32
36
|
import { signTaskToken } from "./task-token";
|
|
33
37
|
import { assertSafeHostTaskId } from "./task-identity";
|
|
34
38
|
import type { RosterAgent } from "./agents/types";
|
|
35
|
-
import type
|
|
39
|
+
import { isEnvironmentTransportProvider, type TaskEnvironmentAgentSessionSurface, type TaskEnvironmentHandle } from "./task-environment/types";
|
|
36
40
|
import { makeContainedDirectoriesSync, writeContainedFile } from "./task-environment/workspace-files";
|
|
37
41
|
import { STATION_AGENT_CLI } from "../src/station-identity";
|
|
38
42
|
import { isProxiableDomain } from "./secrets-proxy/hostname";
|
|
@@ -74,14 +78,23 @@ export const AGENT_RUNTIME_AUTHORITY_ENV = RUNTIME_AUTHORITY_ENV;
|
|
|
74
78
|
/**
|
|
75
79
|
* One rollout-aware argv policy for every agent CLI. The wrapper is installed
|
|
76
80
|
* only in PR2+ environments; legacy baked tasks must launch exactly as before.
|
|
81
|
+
*
|
|
82
|
+
* `unsetOnBaked` (engine-spawn-env.ts, restore-only names): a baked Docker or
|
|
83
|
+
* Apple container carries project env as container env, which an exec env
|
|
84
|
+
* can set but never remove, so those names are removed by `env -u` in front
|
|
85
|
+
* of the CLI. A loader task's wrapper already restores them, and a machine's
|
|
86
|
+
* project floor never carries them, so neither gets the prefix.
|
|
77
87
|
*/
|
|
78
88
|
export function agentCliArgv(
|
|
79
89
|
environment: Pick<TaskEnvironmentAgentSessionSurface, "descriptor">,
|
|
80
90
|
argv: readonly [string, ...string[]],
|
|
91
|
+
unsetOnBaked: readonly string[] = [],
|
|
81
92
|
): [string, ...string[]] {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
93
|
+
if (environment.descriptor.envMode === "loader") return [PROJECT_ENV_EXEC_PATH, ...argv];
|
|
94
|
+
if (unsetOnBaked.length > 0 && !isEnvironmentTransportProvider(environment.descriptor.locator.provider)) {
|
|
95
|
+
return ["/usr/bin/env", ...unsetOnBaked.flatMap((name) => ["-u", name]), ...argv];
|
|
96
|
+
}
|
|
97
|
+
return [...argv];
|
|
85
98
|
}
|
|
86
99
|
|
|
87
100
|
// The task's cli secret lives HOST-PRIVATE (never the container), so it survives
|
|
@@ -338,21 +351,72 @@ function todoRef(args) {
|
|
|
338
351
|
}
|
|
339
352
|
function todoText(args) { return args.join(" ").trim(); }
|
|
340
353
|
|
|
341
|
-
async function api(method, path, body) {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
354
|
+
async function api(method, path, body, context) {
|
|
355
|
+
let res, text;
|
|
356
|
+
try {
|
|
357
|
+
res = await fetch(API_URL + path, {
|
|
358
|
+
method,
|
|
359
|
+
...(context?.commentRequestId ? { signal: AbortSignal.timeout(15000) } : {}),
|
|
360
|
+
headers: { authorization: "Bearer " + TOKEN, "content-type": context?.raw ? "application/octet-stream" : "application/json" },
|
|
361
|
+
body: context?.raw ? body : body ? JSON.stringify(body) : undefined,
|
|
362
|
+
});
|
|
363
|
+
text = await res.text();
|
|
364
|
+
} catch (error) {
|
|
365
|
+
if (context?.commentRequestId) {
|
|
366
|
+
if ((context.transportRetries || 0) < 2) {
|
|
367
|
+
context.transportRetries = (context.transportRetries || 0) + 1;
|
|
368
|
+
console.error("Comment response lost; retrying the identical request with clientRequestId " + context.commentRequestId + " (" + context.transportRetries + "/2).");
|
|
369
|
+
await new Promise(resolve => setTimeout(resolve, 250 * context.transportRetries));
|
|
370
|
+
return api(method, path, body, context);
|
|
371
|
+
}
|
|
372
|
+
console.error("Comment outcome is unknown. clientRequestId " + context.commentRequestId + ". Inspect issue comments --json before posting again; a new invocation uses a new key.");
|
|
373
|
+
}
|
|
374
|
+
if (context?.commentAction && !context.commentRequestId)
|
|
375
|
+
console.error("Comment update outcome is unknown; inspect issue comments --json before retrying with its current comment revision. No automatic retry.");
|
|
376
|
+
if (context?.uploadedPath) console.error("Uploaded file remains at " + context.uploadedPath + "; inspect Issue attachments before retrying. No file was deleted.");
|
|
377
|
+
if (context?.uploadPath) console.error("Upload outcome is uncertain at " + context.uploadPath + "; inspect Files before retrying. No attachment request was sent.");
|
|
378
|
+
throw error;
|
|
379
|
+
}
|
|
348
380
|
let json; try { json = JSON.parse(text); } catch { json = text; }
|
|
349
381
|
if (!res.ok) {
|
|
350
382
|
const msg = (json && json.error && json.error.message) || text || res.statusText;
|
|
351
383
|
console.error("moondeck: " + res.status + " " + msg);
|
|
384
|
+
if (path.startsWith("/api/agent/issues") && json?.error?.code === "ISSUE_ACTIVE_TASKS") {
|
|
385
|
+
console.error("No changes saved. To mark Done despite active linked Tasks, repeat issue update with --override-active-tasks after confirming that intent.");
|
|
386
|
+
}
|
|
387
|
+
if (path.startsWith("/api/agent/issues") && json?.error?.code === "ISSUE_REVISION_CONFLICT") {
|
|
388
|
+
console.error("The Issue changed since revision " + body.expectedRevision + ". No changes saved. Run issue show to inspect the latest revision before repeating your update.");
|
|
389
|
+
}
|
|
390
|
+
if (path.startsWith("/api/agent/issues")) issueErrorHint(json?.error?.code, res.status, context, res.headers.get("retry-after"), json?.error?.details);
|
|
391
|
+
if (context?.uploadPath) console.error("Files upload refused: " + (json?.error?.code || res.status) + ". No attachment request was sent.");
|
|
392
|
+
if (context?.uploadPath && json?.error?.code === "FILE_EXISTS") console.error("Existing file preserved. Agent uploads only create new files; choose a new Files path. No attachment was added.");
|
|
393
|
+
if (context?.uploadPath && res.status === 403) console.error("Upload requires files.write within the human owner's Files permissions; a human must grant missing access.");
|
|
394
|
+
if (context?.attachmentAction && res.status === 403)
|
|
395
|
+
console.error("Attachments need issues.read" + (["attachments", "get"].includes(context.attachmentAction) ? "" : " + issues.write") + " and readable Files: files.read for org/, files.me.read or files.read for me/. A human must grant missing access; owner, runtime and plan limits still apply.");
|
|
396
|
+
if ((context?.attachmentAction || context?.uploadPath) && res.status === 429) {
|
|
397
|
+
const delay = res.headers.get("retry-after") || json?.error?.details?.retryAfterSeconds;
|
|
398
|
+
console.error("Attachment request rate or capacity limit reached; " + (delay ? "wait " + delay + " s" : "wait before retrying") + ". No automatic retry. Rerun issue attachments or issue show before retrying a mutation with --expected-revision.");
|
|
399
|
+
}
|
|
400
|
+
if (context?.attachmentAction && json?.error?.code === "ISSUE_ATTACHMENT_LIMIT")
|
|
401
|
+
console.error("An Issue supports at most 100 attachment references. No references added; unlink unused references with issue detach (files are retained), then rerun issue show before retrying with --expected-revision.");
|
|
402
|
+
if (context?.attachmentAction && json?.error?.code === "ISSUE_FILES_UNAVAILABLE")
|
|
403
|
+
console.error("Selected Files could not be checked; no references added. Wait, rerun issue show, then retry with --expected-revision. No automatic retry.");
|
|
404
|
+
if (context?.uploadedPath) console.error("Uploaded file remains at " + context.uploadedPath + "; inspect Issue attachments before retrying. No file was deleted.");
|
|
352
405
|
process.exit(1);
|
|
353
406
|
}
|
|
354
407
|
return json;
|
|
355
408
|
}
|
|
409
|
+
let issueMarkdown;
|
|
410
|
+
function issueMarkdownParser() {
|
|
411
|
+
// Only evaluate trusted, generated bundle bytes when a command needs them.
|
|
412
|
+
return issueMarkdown ||= new Function(${JSON.stringify(ISSUE_MARKDOWN_SOURCE + "\nreturn IssueMarkdown;")})();
|
|
413
|
+
}
|
|
414
|
+
function parseIssueChecklist(markdown) { return issueMarkdownParser().parseIssueChecklist(markdown); }
|
|
415
|
+
function issueChecklistProgress(markdown) { return issueMarkdownParser().issueChecklistProgress(markdown); }
|
|
416
|
+
function hashIssueChecklistText(text) { return issueMarkdownParser().hashIssueChecklistText(text); }
|
|
417
|
+
${ISSUE_CLI_SOURCE}
|
|
418
|
+
${ISSUE_COMMENTS_CLI_SOURCE}
|
|
419
|
+
${ISSUE_ATTACHMENTS_CLI_SOURCE}
|
|
356
420
|
function out(v) { console.log(typeof v === "string" ? v : JSON.stringify(v, null, 2)); }
|
|
357
421
|
const NL = String.fromCharCode(10);
|
|
358
422
|
function flagValue(v) { return typeof v === "string" && v !== "true" && v.length > 0; }
|
|
@@ -383,7 +447,7 @@ function opLine(op) {
|
|
|
383
447
|
if (op.state === "ready" || op.state === "ready_with_warning") {
|
|
384
448
|
return "added " + op.slug + " at " + op.path + (op.warning ? " (warning: " + op.warning + ")" : "");
|
|
385
449
|
}
|
|
386
|
-
return "adding " + op.slug + " (" + op.state + ")" + (op.warning ? " (warning: " + op.warning + ")" : "") + "; check again with: moondeck task
|
|
450
|
+
return "adding " + op.slug + " (" + op.state + ")" + (op.warning ? " (warning: " + op.warning + ")" : "") + "; check again with: moondeck task repo status " + op.operationId;
|
|
387
451
|
}
|
|
388
452
|
function opProgress(op) {
|
|
389
453
|
const attempts = Number.isInteger(op.attempts) ? "; attempts: " + op.attempts : "";
|
|
@@ -809,6 +873,7 @@ const { flags, rest: pos } = parseFlags(rest);
|
|
|
809
873
|
const validateShareablePath = ${validateShareablePath.toString()};
|
|
810
874
|
const assertShareablePath = (path) => validateShareablePath(path, ${JSON.stringify(ENGINE_ACCOUNT_PATH_RULES)});
|
|
811
875
|
async function main() {
|
|
876
|
+
if (group === "issue") return issueCommand(action, rest);
|
|
812
877
|
if (group === "support") {
|
|
813
878
|
if (action !== "submit" || !flags.category || !flags.message || Object.keys(flags).some(k => !["category", "message", "subject", "file"].includes(k))) {
|
|
814
879
|
console.error('moondeck: support submit --category bug|question|feature|account|other --message "details" [--subject "subject"] [--file path]…'); process.exit(1);
|
|
@@ -1135,7 +1200,8 @@ async function main() {
|
|
|
1135
1200
|
}
|
|
1136
1201
|
const key = group + " " + (action || "");
|
|
1137
1202
|
switch (key) {
|
|
1138
|
-
case "projects list":
|
|
1203
|
+
case "projects list": // Silent compatibility alias.
|
|
1204
|
+
case "repos list": out((await api("GET", "/api/agent/projects")).projects); break;
|
|
1139
1205
|
case "people list": out(await api("GET", "/api/agent/people")); break;
|
|
1140
1206
|
case "task list": out((await api("GET", "/api/agent/tasks")).tasks); break;
|
|
1141
1207
|
case "memory search": {
|
|
@@ -1165,7 +1231,7 @@ async function main() {
|
|
|
1165
1231
|
out((await api("POST", "/api/agent/memory", {
|
|
1166
1232
|
text,
|
|
1167
1233
|
author: flags.as || null,
|
|
1168
|
-
projectId: flags.project || null,
|
|
1234
|
+
projectId: flags.repo || flags.project || null,
|
|
1169
1235
|
tags: flags.tags ? String(flags.tags).split(",").map((s) => s.trim()).filter(Boolean) : [],
|
|
1170
1236
|
})).memory);
|
|
1171
1237
|
break;
|
|
@@ -1196,10 +1262,11 @@ async function main() {
|
|
|
1196
1262
|
if (flags.start && (!flags["request-id"] || flags["request-id"] === "true")) {
|
|
1197
1263
|
console.error("moondeck: --start requires --request-id <logical-run-id>; reuse it after a timeout"); process.exit(1);
|
|
1198
1264
|
}
|
|
1265
|
+
const repoList = flags.repos ?? flags.projects;
|
|
1199
1266
|
const created = (await api("POST", "/api/agent/tasks", {
|
|
1200
1267
|
name: flags.name,
|
|
1201
1268
|
prompt,
|
|
1202
|
-
projects:
|
|
1269
|
+
projects: repoList ? String(repoList).split(",").map((s) => s.trim()).filter(Boolean) : [],
|
|
1203
1270
|
agents: flags.agents ? String(flags.agents).split(",").map((s) => s.trim()).filter(Boolean) : [],
|
|
1204
1271
|
parent: flags.parent || null,
|
|
1205
1272
|
start: flags.start === "true",
|
|
@@ -1352,47 +1419,53 @@ async function main() {
|
|
|
1352
1419
|
if (!r.enabled && r.public) console.error("moondeck: it's public but off — it serves nothing until: moondeck preview enable " + r.name);
|
|
1353
1420
|
break;
|
|
1354
1421
|
}
|
|
1355
|
-
case "project list":
|
|
1422
|
+
case "project list": // Silent compatibility alias.
|
|
1423
|
+
case "repo list": {
|
|
1356
1424
|
const projects = (await api("GET", "/api/agent/projects")).projects || [];
|
|
1357
1425
|
out(projects.length ? projects.map((p) => p.id + " " + p.slug + " " + p.name).join(NL) : "no repositories");
|
|
1358
1426
|
break;
|
|
1359
1427
|
}
|
|
1360
|
-
case "project show":
|
|
1361
|
-
|
|
1428
|
+
case "project show": // Silent compatibility alias.
|
|
1429
|
+
case "repo show": {
|
|
1430
|
+
if (!pos[0]) { console.error("moondeck: repo show <id|slug>"); process.exit(1); }
|
|
1362
1431
|
out((await api("GET", "/api/agent/projects/" + encodeURIComponent(pos[0]))).project);
|
|
1363
1432
|
break;
|
|
1364
1433
|
}
|
|
1365
|
-
case "project create":
|
|
1434
|
+
case "project create": // Silent compatibility alias.
|
|
1435
|
+
case "repo create": {
|
|
1366
1436
|
const attach = rest.includes("--attach");
|
|
1367
1437
|
const name = flags.name || pos.join(" ");
|
|
1368
|
-
if (!name || !flags.repo || flags.repo === "true") { console.error("moondeck:
|
|
1438
|
+
if (!name || !flags.repo || flags.repo === "true") { console.error("moondeck: repo create --name <n> --repo <git-url> [--slug <s>] [--prompt <p> | --prompt-file <f>] [--previews-file <f>] [--tool-versions-file <f>] [--attach]"); process.exit(1); }
|
|
1369
1439
|
const body = { name, repoUrl: flags.repo, ...projectSetupFields(flags) };
|
|
1370
1440
|
const p = (await api("POST", "/api/agent/projects", body)).project;
|
|
1371
|
-
out("created
|
|
1441
|
+
out("created repository " + p.slug + " (" + p.id + ")");
|
|
1372
1442
|
if (attach) await addProjectToTask(p.id, true);
|
|
1373
1443
|
break;
|
|
1374
1444
|
}
|
|
1375
|
-
case "project update":
|
|
1376
|
-
|
|
1445
|
+
case "project update": // Silent compatibility alias.
|
|
1446
|
+
case "repo update": {
|
|
1447
|
+
if (!pos[0]) { console.error("moondeck: repo update <id|slug> [--name <n>] [--slug <s>] [--repo <url>] [--prompt <p> | --prompt-file <f>] [--previews-file <f>] [--tool-versions-file <f>]"); process.exit(1); }
|
|
1377
1448
|
const body = { ...(flagValue(flags.name) ? { name: flags.name } : {}), ...(flagValue(flags.repo) ? { repoUrl: flags.repo } : {}), ...projectSetupFields(flags) };
|
|
1378
|
-
if (Object.keys(body).length === 0) { console.error("moondeck:
|
|
1449
|
+
if (Object.keys(body).length === 0) { console.error("moondeck: repo update needs at least one field"); process.exit(1); }
|
|
1379
1450
|
const r = await api("PATCH", "/api/agent/projects/" + encodeURIComponent(pos[0]), body);
|
|
1380
1451
|
const proposed = r.proposed || [];
|
|
1381
1452
|
out("updated " + r.project.slug + " (applies to the next task)");
|
|
1382
1453
|
for (const pr of proposed) out("proposed " + pr.field + " (proposal " + pr.id + "): it changes what later tasks clone or read, so a member must approve it in the repository's Settings.");
|
|
1383
1454
|
break;
|
|
1384
1455
|
}
|
|
1385
|
-
case "project propose-extra":
|
|
1386
|
-
|
|
1456
|
+
case "project propose-extra": // Silent compatibility alias.
|
|
1457
|
+
case "repo propose-extra": {
|
|
1458
|
+
if (!pos[0] || !flagValue(flags["extra-file"])) { console.error("moondeck: repo propose-extra <id|slug> --extra-file <file>"); process.exit(1); }
|
|
1387
1459
|
const r = await api("POST", "/api/agent/projects/" + encodeURIComponent(pos[0]) + "/extra-proposals", { extra: readFlagFile(flags["extra-file"]) });
|
|
1388
1460
|
out("proposed Dockerfile additions (proposal " + r.proposal.id + "). They run as root at image build, so a member must approve them in the repository's Settings before any task uses them.");
|
|
1389
1461
|
break;
|
|
1390
1462
|
}
|
|
1391
|
-
case "project env":
|
|
1463
|
+
case "project env": // Silent compatibility alias.
|
|
1464
|
+
case "repo env": {
|
|
1392
1465
|
const sub = pos[0], project = pos[1], name = pos[2];
|
|
1393
1466
|
const base = "/api/agent/projects/" + encodeURIComponent(project || "") + "/env";
|
|
1394
1467
|
if (!project || (["add", "remove", "propose-proxy"].includes(sub) && !name)) {
|
|
1395
|
-
console.error("moondeck:
|
|
1468
|
+
console.error("moondeck: repo env list|observed <id> | add <id> NAME --label <l> [--secret] | remove <id> NAME | propose-proxy <id> NAME --domain <d>[,<d>…] [--placeholder-prefix <p> --placeholder-length <n>]");
|
|
1396
1469
|
process.exit(1);
|
|
1397
1470
|
}
|
|
1398
1471
|
if (sub === "list") {
|
|
@@ -1408,7 +1481,7 @@ async function main() {
|
|
|
1408
1481
|
const r = await api("DELETE", base + "/keys", { key: name });
|
|
1409
1482
|
out("removed the declaration of " + r.key + ". No value was touched.");
|
|
1410
1483
|
} else if (sub === "propose-proxy") {
|
|
1411
|
-
if (!flagValue(flags.domain)) { console.error("moondeck:
|
|
1484
|
+
if (!flagValue(flags.domain)) { console.error("moondeck: repo env propose-proxy <id> NAME --domain <d>[,<d>…]"); process.exit(1); }
|
|
1412
1485
|
const prefix = flags["placeholder-prefix"], length = flags["placeholder-length"];
|
|
1413
1486
|
if ((prefix === undefined) !== (length === undefined)) { console.error("moondeck: --placeholder-prefix and --placeholder-length go together"); process.exit(1); }
|
|
1414
1487
|
const placeholder = prefix === undefined ? null : { prefix: prefix === "true" ? "" : prefix, totalLength: Number(length) };
|
|
@@ -1416,12 +1489,13 @@ async function main() {
|
|
|
1416
1489
|
const r = await api("POST", base + "/proxy-proposals", { key: name, domains, placeholder });
|
|
1417
1490
|
out("proposed sending " + name + " only to " + r.proposal.domains.join(", ") + " (proposal " + r.proposal.id + "). A member must confirm it in the repository's Settings before the proxy uses it.");
|
|
1418
1491
|
} else {
|
|
1419
|
-
console.error("moondeck:
|
|
1492
|
+
console.error("moondeck: repo env commands are list, add, remove, propose-proxy and observed");
|
|
1420
1493
|
process.exit(1);
|
|
1421
1494
|
}
|
|
1422
1495
|
break;
|
|
1423
1496
|
}
|
|
1424
|
-
case "task project":
|
|
1497
|
+
case "task project": // Silent compatibility alias.
|
|
1498
|
+
case "task repo": {
|
|
1425
1499
|
const words = rest.filter((word) => word !== "--no-wait");
|
|
1426
1500
|
const sub = words[0];
|
|
1427
1501
|
if (sub === "add" && words.length === 2 && !words[1].startsWith("--")) {
|
|
@@ -1434,7 +1508,7 @@ async function main() {
|
|
|
1434
1508
|
if (op.state === "failed") process.exit(1);
|
|
1435
1509
|
break;
|
|
1436
1510
|
}
|
|
1437
|
-
console.error("moondeck: task
|
|
1511
|
+
console.error("moondeck: task repo add <repoId|slug> [--no-wait] | task repo status <operationId>");
|
|
1438
1512
|
process.exit(1);
|
|
1439
1513
|
}
|
|
1440
1514
|
case "task rename": {
|
|
@@ -1496,12 +1570,46 @@ async function main() {
|
|
|
1496
1570
|
" Never paste secrets into chat. A person supplies them through the private dialog.",
|
|
1497
1571
|
' moondeck support submit --category bug --message "details" [--subject "subject"] [--file path]…',
|
|
1498
1572
|
" moondeck artifacts",
|
|
1499
|
-
" moondeck
|
|
1573
|
+
" moondeck issue list [--status NAME] [--assignee me|HANDLE|unassigned] [--project KEY] [--priority P] [--label NAME]... [--archived only|include] [--deadline overdue|next7|none] [--viewer-date YYYY-MM-DD] [--sort deadline] [-q TEXT] [--exclude-tree-of KEY|ID] [--no-sub-issues] [--limit 1..100] [--cursor C] [--json]",
|
|
1574
|
+
" Deadline filters/overdue use the machine local day (containers default to UTC); pass --viewer-date for a human local day. overdue/next7 exclude done/canceled; next7 is today..today+6. Sort: ascending, undated last.",
|
|
1575
|
+
" If the day rolls over between pages (ISSUE_CURSOR_INVALID), restart from page 1 without --cursor.",
|
|
1576
|
+
" moondeck issue show KEY-N [--viewer-date YYYY-MM-DD] [--json] Override the local day for overdue markers.",
|
|
1577
|
+
" moondeck issue comment KEY-N (--body TEXT | --body-file PATH|-) [--mention NAME]... [--json]",
|
|
1578
|
+
" moondeck issue comment edit KEY-N COMMENT_ID (--body TEXT | --body-file PATH|-) [--mention NAME]... [--clear-mentions] [--expected-revision N] [--json]",
|
|
1579
|
+
" moondeck issue comment delete KEY-N COMMENT_ID [--expected-revision N] [--json]",
|
|
1580
|
+
" Comment writes need issues.read + issues.write. Only the same owner, Task and agent may edit/delete.",
|
|
1581
|
+
" moondeck issue comments KEY-N [--limit 1..100] [--before-seq N] [--json] Read recent comments.",
|
|
1582
|
+
" moondeck issue archive KEY-N [--include-sub-issues] [--expected-revision N] [--json]",
|
|
1583
|
+
" moondeck issue restore KEY-N [--expected-revision N] [--json] Restore this Issue; keep its status.",
|
|
1584
|
+
" moondeck issue labels [--json] List the existing workspace label catalog (issues.read).",
|
|
1585
|
+
" Repeat --label NAME on list (any-of filtering) or create (add existing labels).",
|
|
1586
|
+
" show includes checklist progress, parent and direct children with visible running Tasks (up to 50 pages); warns on incomplete paging; child progress excludes canceled children.",
|
|
1587
|
+
" moondeck issue current [--limit 1..5] [--cursor C] [--json]",
|
|
1588
|
+
" moondeck issue create --title T [--description D] [--project KEY] [--status S] [--assignee A] [--priority P] [--parent KEY-N] [--label NAME]... [--deadline YYYY-MM-DD] [--json]",
|
|
1589
|
+
" moondeck issue update KEY-N [--status S] [--assignee +HANDLE|-HANDLE] [--priority P] [--title T] [--label NAME]... [--remove-label NAME]... [--labels NAME]... [--clear-labels] [--description TEXT|- | --description-file PATH | --clear-description] [--parent KEY-N|--no-parent] [--deadline YYYY-MM-DD|--clear-deadline] [--expected-revision N] [--override-active-tasks] [--json]",
|
|
1590
|
+
" Description: Markdown, at most 100,000 UTF-16 code units; file/stdin preserve whitespace. Empty input requires --clear-description; nonempty input cannot be combined with it.",
|
|
1591
|
+
" Labels: repeat --label NAME to add and --remove-label NAME to remove; repeat --labels NAME to replace the set; --clear-labels clears it. Commas are literal name characters. Replacement/clear cannot mix with add/remove. At most 50 labels.",
|
|
1592
|
+
" Label-only add/remove prints Unchanged (JSON changed:false) and skips PATCH when the fetched set and expected revision already match; other field changes and stale revision fences still reach the server.",
|
|
1593
|
+
" Label names match the workspace catalog case-insensitively; unknown names fail and are never created. Labels share the field update's revision fence; conflicts never retry automatically.",
|
|
1594
|
+
" moondeck issue checklist KEY-N [--json]",
|
|
1595
|
+
" moondeck issue check|uncheck KEY-N INDEX [--expected-revision N] [--json]",
|
|
1596
|
+
" INDEX is zero-based; checks use a fresh read and text hash. Conflicts show the current item and never retry.",
|
|
1597
|
+
" moondeck issue activity KEY-N [--limit 1..100] [--cursor C] [--json]",
|
|
1598
|
+
" moondeck issue attachments KEY-N [--json]",
|
|
1599
|
+
" moondeck issue attachment get KEY-N ATTACHMENT_ID [-o PATH] [--json]",
|
|
1600
|
+
" moondeck issue attach KEY-N org/PATH|me/PATH... [--expected-revision N] [--json]",
|
|
1601
|
+
" moondeck issue attach KEY-N --upload LOCAL_PATH [--expected-revision N] [--json]",
|
|
1602
|
+
" Upload: up to 200 MiB, unique filename under org/Issues/<canonical KEY>/. Requires files.write and files.read.",
|
|
1603
|
+
" moondeck issue detach KEY-N ATTACHMENT_ID [--expected-revision N] [--json]",
|
|
1604
|
+
" Attachments are Files references. Detach never deletes the file; failed attachment admission retains an upload.",
|
|
1605
|
+
" moondeck issue link|unlink KEY-N [--task ID] [--json]",
|
|
1606
|
+
" moondeck repos list",
|
|
1607
|
+
" Repository permissions: projects.read (view repositories), projects.write (manage repositories).",
|
|
1500
1608
|
" moondeck files ls [org|me[/prefix]] (one folder: names, sizes, mtimes, etags; defaults to org)",
|
|
1501
1609
|
" moondeck files get <org|me>/<path> [<dest>] (download; default /workspace/files/<org|me>/<path>; -r is a folder, capped at 500 files / 1 GB)",
|
|
1502
1610
|
" moondeck people list",
|
|
1503
1611
|
" moondeck task list",
|
|
1504
|
-
" moondeck task create --name <n> --prompt <text|-> [--
|
|
1612
|
+
" moondeck task create --name <n> --prompt <text|-> [--repos id,id] [--agents handle,handle] [--astronaut engine/model/effort] [--start --request-id <logical-run-id>]",
|
|
1505
1613
|
" moondeck task watch <childId> [--after <cursor>] [--limit N]",
|
|
1506
1614
|
" moondeck task usage <childId>",
|
|
1507
1615
|
' moondeck task send <childId> "text"',
|
|
@@ -1512,7 +1620,7 @@ async function main() {
|
|
|
1512
1620
|
' moondeck task label add <name> [<name>…] (label this running task; one argument per label, quote "a, b" to keep it whole; missing labels are created)',
|
|
1513
1621
|
" moondeck task label remove <name> [<name>…]",
|
|
1514
1622
|
" moondeck memory search <query> [--as handle] [--limit N|all]",
|
|
1515
|
-
" moondeck memory save <text> [--
|
|
1623
|
+
" moondeck memory save <text> [--repo id] [--tags a,b]",
|
|
1516
1624
|
" moondeck memory delete <id>",
|
|
1517
1625
|
" moondeck todo list",
|
|
1518
1626
|
" moondeck todo add <text>",
|
|
@@ -1529,16 +1637,16 @@ async function main() {
|
|
|
1529
1637
|
" Portless >= 0.16 (no sudo for ports >= 80), outside self: portless proxy start --lan or PORTLESS_LAN=1 (mDNS); use printed *.local Host and proxy port 443/80, or explicit -p 1355. Check for LAN mode disabled; update the image/install avahi-utils and resolve the reported LAN issue, then restart.",
|
|
1530
1638
|
" moondeck preview enable|disable <name> (turn it on; prints its URL)",
|
|
1531
1639
|
" moondeck preview public|private <name> (public: a link anyone can open)",
|
|
1532
|
-
" moondeck
|
|
1533
|
-
" moondeck
|
|
1534
|
-
" moondeck
|
|
1535
|
-
" moondeck
|
|
1536
|
-
" moondeck
|
|
1537
|
-
" moondeck
|
|
1538
|
-
" moondeck
|
|
1539
|
-
" moondeck
|
|
1540
|
-
" moondeck task
|
|
1541
|
-
" moondeck task
|
|
1640
|
+
" moondeck repo list | show <id|slug>",
|
|
1641
|
+
" moondeck repo create --name <n> --repo <git-url> [--slug <s>] [--prompt <p> | --prompt-file <f>] [--previews-file <f>] [--tool-versions-file <f>] [--attach] (--attach: also add it to this task)",
|
|
1642
|
+
" moondeck repo update <id|slug> [--name <n>] [--slug <s>] [--repo <url>] [--prompt <p> | --prompt-file <f>] [--previews-file <f>] [--tool-versions-file <f>] (applies to the next task; --repo and the brief are proposals unless you created the repository in this task)",
|
|
1643
|
+
" moondeck repo propose-extra <id|slug> --extra-file <f> (Dockerfile additions; a member approves them)",
|
|
1644
|
+
" moondeck repo env list|observed <id|slug>",
|
|
1645
|
+
" moondeck repo env add <id|slug> NAME [--label <l>] [--secret] (declares a key; values are a member's)",
|
|
1646
|
+
" moondeck repo env remove <id|slug> NAME (drops a declaration with no value; never deletes a value; when the workspace allows it)",
|
|
1647
|
+
" moondeck repo env propose-proxy <id|slug> NAME --domain <d>[,<d>…] [--placeholder-prefix <p> --placeholder-length <n>] (a member confirms)",
|
|
1648
|
+
" moondeck task repo add <repoId|slug> [--no-wait] (clone a repository into this running task; waits until ready)",
|
|
1649
|
+
" moondeck task repo status <operationId>",
|
|
1542
1650
|
" moondeck task search <query> (your own past tasks)",
|
|
1543
1651
|
" moondeck task history (list your past tasks)",
|
|
1544
1652
|
" moondeck task read <taskId> (full chat of a past task you were on)",
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The qualified Antigravity CLI build (ADR-178). The standard image's
|
|
3
|
+
* INSTALL_GEMINI layer pins the same build by these values
|
|
4
|
+
* (images/standard/Dockerfile, UAI_AGY_*); task-runtime-pins.test.ts keeps the
|
|
5
|
+
* two in step. Values come from Google's per-platform manifest
|
|
6
|
+
* (antigravity-cli-auto-updater…/manifests/linux_{amd64,arm64}.json).
|
|
7
|
+
*/
|
|
8
|
+
export const AGY_CLI_VERSION = "1.5.16";
|
|
9
|
+
export const AGY_CLI_BUILD = "1.5.16-5250855658717184";
|
|
10
|
+
export const AGY_SHA512 = {
|
|
11
|
+
x64: "3dee9f26e298156db673f6ce2a0f5dfed5b30006e04ceb9809c68070e7b717587b33a3da0f8bc2eda45af81a50bc8b14c82b28ae5832bcfe3e7fd49397117b31",
|
|
12
|
+
arm64: "23c193151499a4986fd5fa0d8132665cc8ffbad6cc0b3ff4fd53a2cb68abb76b149a992b836d53063443cd89add335f14d8134fb02abdcecbf6e1eaef6c53d33",
|
|
13
|
+
} as const;
|
|
14
|
+
|
|
15
|
+
/** POSIX sh that leaves the agy path in `$a`: the image's binary, else the
|
|
16
|
+
* pinned build downloaded into `$HOME/.agy-bin`, checksum-verified. Exits
|
|
17
|
+
* 127 when neither is possible. */
|
|
18
|
+
export function agyResolveShell(): string {
|
|
19
|
+
const base = `https://storage.googleapis.com/antigravity-public/antigravity-cli/${AGY_CLI_BUILD}`;
|
|
20
|
+
return [
|
|
21
|
+
'a="$(command -v agy 2>/dev/null || true)"',
|
|
22
|
+
'[ -n "$a" ] || [ ! -x "$HOME/.local/bin/agy" ] || a="$HOME/.local/bin/agy"',
|
|
23
|
+
'if [ -z "$a" ]; then',
|
|
24
|
+
' case "$(uname -m)" in',
|
|
25
|
+
` x86_64|amd64) d=linux-x64; p=cli_linux_x64; s=${AGY_SHA512.x64} ;;`,
|
|
26
|
+
` aarch64|arm64) d=linux-arm; p=cli_linux_arm64; s=${AGY_SHA512.arm64} ;;`,
|
|
27
|
+
' *) echo "unsupported Antigravity CLI architecture" >&2; exit 127 ;;',
|
|
28
|
+
' esac',
|
|
29
|
+
' b="$HOME/.agy-bin"; mkdir -p "$b" &&',
|
|
30
|
+
` curl -fsSL -o "$b/agy.tar.gz" "${base}/$d/$p.tar.gz" &&`,
|
|
31
|
+
' echo "$s $b/agy.tar.gz" | sha512sum -c - >/dev/null &&',
|
|
32
|
+
' tar -xzf "$b/agy.tar.gz" -C "$b" antigravity && rm -f "$b/agy.tar.gz" && a="$b/antigravity"',
|
|
33
|
+
'fi',
|
|
34
|
+
'[ -n "$a" ] && [ -x "$a" ] || { echo "Antigravity CLI is not available in the login image" >&2; exit 127; }',
|
|
35
|
+
].join("\n");
|
|
36
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { stripVTControlCharacters } from "node:util";
|
|
2
|
+
|
|
3
|
+
/** Remove OAuth URLs (and any other URL carrying OAuth parameters) so a login
|
|
4
|
+
* prompt or an echoed callback can never reach chat or logs that leave the
|
|
5
|
+
* host. Shared by the gemini turn path and the sign-in box's failure
|
|
6
|
+
* evidence; free of heavy imports on purpose. */
|
|
7
|
+
export function scrubAgyDiagnostics(text: string): string {
|
|
8
|
+
return stripVTControlCharacters(text)
|
|
9
|
+
.replace(/https?:\/\/accounts\.google\.com\S*/gi, "<sign-in URL removed>")
|
|
10
|
+
.replace(/https?:\/\/\S*(?:code_challenge|client_id|access_token|refresh_token|[?&]code)=\S*/gi, "<URL removed>");
|
|
11
|
+
}
|
package/lib/agents/claude.ts
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
import { requireContainerRuntimeOperational } from "../runtime-guard";
|
|
23
23
|
import type { TaskEnvironmentAgentSessionSurface } from "../task-environment/types";
|
|
24
24
|
import { newId } from "../ulid";
|
|
25
|
+
import { CLAUDE_SPAWN_BLANKS } from "../engine-spawn-env";
|
|
25
26
|
import { createAgentTransport, type LineTransport } from "./transport";
|
|
26
27
|
import { rateLimitErrorUsage, resetSecondsToEpochMs } from "./rate-limit";
|
|
27
28
|
import { register } from "./registry";
|
|
@@ -634,10 +635,12 @@ export class ClaudeSession implements AgentSession {
|
|
|
634
635
|
cli: "claude",
|
|
635
636
|
cliArgs,
|
|
636
637
|
passEnv: ["CLAUDE_CODE_OAUTH_TOKEN", "ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN"],
|
|
638
|
+
// App-shared names Claude routes by are blanked first (a connection's
|
|
639
|
+
// agentEnv may still set them; engine-spawn-env.ts).
|
|
637
640
|
explicitEnv:
|
|
638
641
|
args.executionProfile === "communicator"
|
|
639
|
-
? { ...(args.agentEnv ?? {}), ...CLAUDE_COMMUNICATOR_ENV }
|
|
640
|
-
: (args.agentEnv ?? {}),
|
|
642
|
+
? { ...CLAUDE_SPAWN_BLANKS, ...(args.agentEnv ?? {}), ...CLAUDE_COMMUNICATOR_ENV }
|
|
643
|
+
: { ...CLAUDE_SPAWN_BLANKS, ...(args.agentEnv ?? {}) },
|
|
641
644
|
allowAttach: args.executionProfile !== "communicator",
|
|
642
645
|
attachCompatibilityKey: args.attachCompatibilityKey,
|
|
643
646
|
kind: "claude",
|
package/lib/agents/codex.ts
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
32
|
import { connectionFailureReason, tomlString } from "../custom-connection-launch";
|
|
33
|
+
import { CODEX_UNSET_ONLY_NAMES } from "../engine-spawn-env";
|
|
33
34
|
import { connectionFailureDetail } from "../custom-connection-runtime";
|
|
34
35
|
import { existsSync } from "node:fs";
|
|
35
36
|
import { homedir } from "node:os";
|
|
@@ -729,6 +730,10 @@ export class CodexSession implements AgentSession {
|
|
|
729
730
|
cliArgs: codexArgs,
|
|
730
731
|
passEnv: [],
|
|
731
732
|
explicitEnv: args.agentEnv ?? {},
|
|
733
|
+
// Codex refuses an empty workload-identity name, so on a baked
|
|
734
|
+
// container a project's value is removed instead of blanked; one the
|
|
735
|
+
// agent's own env sets (a connection) passes through.
|
|
736
|
+
unsetEnv: CODEX_UNSET_ONLY_NAMES.filter((name) => !Object.hasOwn(args.agentEnv ?? {}, name)),
|
|
732
737
|
allowAttach: false,
|
|
733
738
|
attachCompatibilityKey: args.attachCompatibilityKey,
|
|
734
739
|
kind: "codex",
|
package/lib/agents/factory.ts
CHANGED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The seam through which the gemini engine (Antigravity CLI, `agy`) learns
|
|
3
|
+
* about its credential. Deliberately tiny and free of heavy imports, so
|
|
4
|
+
* standard-image.ts and engine-login.ts can use it without the adapter.
|
|
5
|
+
*
|
|
6
|
+
* ADR-178 (owner, 2026-11-24): gemini accounts live in the cloud vault. A
|
|
7
|
+
* subscription account's lease carries agy's whole token file, which the
|
|
8
|
+
* credential consumer writes to `containerTokenPath` in the task (mode 600,
|
|
9
|
+
* credential-consumers/engines.ts); agy alone renews it. An API-key account
|
|
10
|
+
* is an env-token account (GEMINI_API_KEY). `hostSignedIn` only says whether
|
|
11
|
+
* the operator ran agy on this host, which pre-installs agy in a locally
|
|
12
|
+
* built image; it never makes the engine runnable.
|
|
13
|
+
*
|
|
14
|
+
* Guardrail: nothing here ever OPENS the token file. Existence checks only.
|
|
15
|
+
*/
|
|
16
|
+
import { existsSync } from "node:fs";
|
|
17
|
+
import { homedir } from "node:os";
|
|
18
|
+
import { join } from "node:path";
|
|
19
|
+
|
|
20
|
+
/** agy's file token store, relative to $HOME. Verified on agy 1.5.16: with no
|
|
21
|
+
* D-Bus (or `AGY_CLI_FORCE_FILE_TOKEN_STORAGE=1`) this single file is the
|
|
22
|
+
* whole sign-in; a fresh HOME holding only it runs turns. */
|
|
23
|
+
export const AGY_TOKEN_RELATIVE_PATH = ".gemini/antigravity-cli/antigravity-oauth-token";
|
|
24
|
+
|
|
25
|
+
/** The same file relative to agy's "gemini dir" (`--gemini_dir`, default
|
|
26
|
+
* `~/.gemini`): what the launcher checks in a spawn's own dir. */
|
|
27
|
+
export const AGY_DIR_TOKEN_PATH = "antigravity-cli/antigravity-oauth-token";
|
|
28
|
+
|
|
29
|
+
/** The command a person runs (in a terminal on the machine) to sign in. */
|
|
30
|
+
export const AGY_LOGIN_COMMAND = "AGY_CLI_FORCE_FILE_TOKEN_STORAGE=1 agy acp --login";
|
|
31
|
+
|
|
32
|
+
export interface GeminiCredentialSource {
|
|
33
|
+
/** Host side: does this runner have a Gemini (Antigravity) sign-in to offer?
|
|
34
|
+
* Drives engine advertisement and the optional image install. */
|
|
35
|
+
hostSignedIn(): boolean;
|
|
36
|
+
/** In-container token path relative to the spawn's gemini dir, checked
|
|
37
|
+
* (existence only) by the adapter's preflight before agy starts. */
|
|
38
|
+
readonly containerTokenPath: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function ownerHome(): string {
|
|
42
|
+
return process.env.UAI_OWNER_HOME?.trim() || homedir();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** The default source: the task file path agy reads, and whether the
|
|
46
|
+
* operator signed agy in on this host (image pre-install only). */
|
|
47
|
+
export const hostResidentCredentialSource: GeminiCredentialSource = {
|
|
48
|
+
hostSignedIn: () => existsSync(join(ownerHome(), AGY_TOKEN_RELATIVE_PATH)),
|
|
49
|
+
containerTokenPath: AGY_DIR_TOKEN_PATH,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
let active: GeminiCredentialSource = hostResidentCredentialSource;
|
|
53
|
+
|
|
54
|
+
export function geminiCredentialSource(): GeminiCredentialSource {
|
|
55
|
+
return active;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Install a different source (the chosen ADR-154 option, or a test double). */
|
|
59
|
+
export function setGeminiCredentialSource(source: GeminiCredentialSource): void {
|
|
60
|
+
active = source;
|
|
61
|
+
}
|