@aiden-ade/sandbox-agent 0.1.68 → 0.1.69
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/dist/index.cjs +150 -13
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -22087,7 +22087,7 @@ function describeError(error2) {
|
|
|
22087
22087
|
}
|
|
22088
22088
|
|
|
22089
22089
|
// src/version.ts
|
|
22090
|
-
var AGENT_VERSION = "0.1.
|
|
22090
|
+
var AGENT_VERSION = "0.1.69";
|
|
22091
22091
|
|
|
22092
22092
|
// src/daemon-worktree.ts
|
|
22093
22093
|
var import_node_child_process3 = require("child_process");
|
|
@@ -23508,16 +23508,128 @@ async function collectClaudeLimits() {
|
|
|
23508
23508
|
].filter((window2) => Boolean(window2));
|
|
23509
23509
|
})().catch(() => []), 4e3, []);
|
|
23510
23510
|
}
|
|
23511
|
+
function antigravityWindowMinutes(window2) {
|
|
23512
|
+
if (window2 === "5h")
|
|
23513
|
+
return 5 * 60;
|
|
23514
|
+
if (window2 === "weekly")
|
|
23515
|
+
return 7 * 24 * 60;
|
|
23516
|
+
return null;
|
|
23517
|
+
}
|
|
23518
|
+
function antigravityGroupLabel(groupName) {
|
|
23519
|
+
if (typeof groupName !== "string" || !groupName.trim())
|
|
23520
|
+
return "Antigravity";
|
|
23521
|
+
return groupName.replace(/\s*models?$/i, "").trim() || groupName.trim();
|
|
23522
|
+
}
|
|
23523
|
+
function antigravityWindow(groupLabel, raw) {
|
|
23524
|
+
if (!raw)
|
|
23525
|
+
return null;
|
|
23526
|
+
const remainingFraction = numericValue(raw.remaining_fraction);
|
|
23527
|
+
if (remainingFraction === null)
|
|
23528
|
+
return null;
|
|
23529
|
+
const windowMinutes = antigravityWindowMinutes(raw.window);
|
|
23530
|
+
const resetAt = typeof raw.reset_time === "string" && raw.reset_time.trim() ? raw.reset_time : null;
|
|
23531
|
+
const windowShortLabel = limitLabel(windowMinutes, typeof raw.name === "string" && raw.name.trim() ? raw.name.trim() : "Limit");
|
|
23532
|
+
const remaining = Math.max(0, Math.min(100, remainingFraction * 100));
|
|
23533
|
+
return {
|
|
23534
|
+
label: windowShortLabel,
|
|
23535
|
+
group: groupLabel,
|
|
23536
|
+
remaining,
|
|
23537
|
+
limit: 100,
|
|
23538
|
+
usedPercent: Math.max(0, Math.min(100, 100 - remaining)),
|
|
23539
|
+
...windowMinutes !== null ? { windowMinutes } : {},
|
|
23540
|
+
...resetAt ? { resetAt } : {},
|
|
23541
|
+
source: "antigravity-cli-json"
|
|
23542
|
+
};
|
|
23543
|
+
}
|
|
23544
|
+
function runOneShotCli(command, args, env, timeoutMs) {
|
|
23545
|
+
return new Promise((resolve14) => {
|
|
23546
|
+
const child = (0, import_node_child_process4.spawn)(command, args, { env, stdio: ["ignore", "pipe", "ignore"] });
|
|
23547
|
+
let stdout = "";
|
|
23548
|
+
let settled = false;
|
|
23549
|
+
const settle = (value2) => {
|
|
23550
|
+
if (settled)
|
|
23551
|
+
return;
|
|
23552
|
+
settled = true;
|
|
23553
|
+
clearTimeout(timer);
|
|
23554
|
+
resolve14(value2);
|
|
23555
|
+
};
|
|
23556
|
+
const timer = setTimeout(() => {
|
|
23557
|
+
if (!child.killed)
|
|
23558
|
+
child.kill();
|
|
23559
|
+
settle(null);
|
|
23560
|
+
}, timeoutMs);
|
|
23561
|
+
child.stdout.on("data", (chunk) => {
|
|
23562
|
+
stdout += chunk.toString("utf8");
|
|
23563
|
+
});
|
|
23564
|
+
child.on("error", () => settle(null));
|
|
23565
|
+
child.on("close", () => settle(stdout));
|
|
23566
|
+
});
|
|
23567
|
+
}
|
|
23568
|
+
async function collectAntigravityLimits(env) {
|
|
23569
|
+
const runtimeEnv = augmentCliPath2(env);
|
|
23570
|
+
const agyCommand = resolveExecutable("agy", runtimeEnv, "ALAN_ANTIGRAVITY_PATH");
|
|
23571
|
+
if (!agyCommand)
|
|
23572
|
+
return [];
|
|
23573
|
+
const stdout = await runOneShotCli(agyCommand, ["-p", "/usage", "--output-format", "json"], runtimeEnv, 15e3);
|
|
23574
|
+
if (stdout === null)
|
|
23575
|
+
return [];
|
|
23576
|
+
try {
|
|
23577
|
+
const parsed = JSON.parse(stdout);
|
|
23578
|
+
const groups = parsed.command?.data?.groups;
|
|
23579
|
+
if (!Array.isArray(groups))
|
|
23580
|
+
return [];
|
|
23581
|
+
return groups.flatMap((group) => {
|
|
23582
|
+
const groupLabel = antigravityGroupLabel(group.name);
|
|
23583
|
+
const buckets = Array.isArray(group.buckets) ? group.buckets : [];
|
|
23584
|
+
return buckets.map((bucket) => antigravityWindow(groupLabel, bucket)).filter((window2) => Boolean(window2));
|
|
23585
|
+
});
|
|
23586
|
+
} catch {
|
|
23587
|
+
return [];
|
|
23588
|
+
}
|
|
23589
|
+
}
|
|
23590
|
+
var OPENCODE_TOTAL_COST_PATTERN = /Total Cost\s+\$([\d,]+\.\d{2})/;
|
|
23591
|
+
function parseOpenCodeTotalCost(stdout) {
|
|
23592
|
+
const match = OPENCODE_TOTAL_COST_PATTERN.exec(stdout);
|
|
23593
|
+
if (!match)
|
|
23594
|
+
return null;
|
|
23595
|
+
return {
|
|
23596
|
+
label: "Spend",
|
|
23597
|
+
summary: `$${match[1]} all-time`,
|
|
23598
|
+
source: "opencode-cli-stats"
|
|
23599
|
+
};
|
|
23600
|
+
}
|
|
23601
|
+
async function collectOpenCodeLimits(env) {
|
|
23602
|
+
const runtimeEnv = augmentCliPath2(env);
|
|
23603
|
+
const opencodeCommand = resolveExecutable("opencode", runtimeEnv, "ALAN_OPENCODE_PATH");
|
|
23604
|
+
if (!opencodeCommand)
|
|
23605
|
+
return [];
|
|
23606
|
+
const stdout = await runOneShotCli(opencodeCommand, ["stats"], runtimeEnv, 4e3);
|
|
23607
|
+
if (stdout === null)
|
|
23608
|
+
return [];
|
|
23609
|
+
const window2 = parseOpenCodeTotalCost(stdout);
|
|
23610
|
+
return window2 ? [window2] : [];
|
|
23611
|
+
}
|
|
23511
23612
|
async function collectLocalAgentProviderLimits(env = process.env) {
|
|
23512
23613
|
if (cachedLimits && Object.keys(cachedLimits.value).length > 0 && Date.now() - cachedLimits.collectedAt < CACHE_TTL_MS) {
|
|
23513
23614
|
return cachedLimits.value;
|
|
23514
23615
|
}
|
|
23515
|
-
const [codex, claude] = await Promise.all([
|
|
23616
|
+
const [codex, claude, antigravity, opencode] = await Promise.all([
|
|
23617
|
+
collectCodexLimits(env),
|
|
23618
|
+
collectClaudeLimits(),
|
|
23619
|
+
collectAntigravityLimits(env),
|
|
23620
|
+
collectOpenCodeLimits(env)
|
|
23621
|
+
]);
|
|
23516
23622
|
const limits = {};
|
|
23517
23623
|
if (codex.length > 0)
|
|
23518
23624
|
limits.codex_app_server = codex;
|
|
23519
23625
|
if (claude.length > 0)
|
|
23520
23626
|
limits.claude_cli = claude;
|
|
23627
|
+
if (antigravity.length > 0)
|
|
23628
|
+
limits.antigravity_cli = antigravity;
|
|
23629
|
+
if (opencode.length > 0) {
|
|
23630
|
+
limits.opencode_cli = opencode;
|
|
23631
|
+
limits.opencode_serve = opencode;
|
|
23632
|
+
}
|
|
23521
23633
|
if (Object.keys(limits).length > 0) {
|
|
23522
23634
|
cachedLimits = { value: limits, collectedAt: Date.now() };
|
|
23523
23635
|
} else {
|
|
@@ -32313,12 +32425,30 @@ function extractText(parsed) {
|
|
|
32313
32425
|
return "";
|
|
32314
32426
|
}
|
|
32315
32427
|
function extractToolInput(parsed) {
|
|
32316
|
-
|
|
32428
|
+
const rawInput = parsed.parameters ?? parsed.input ?? parsed.args ?? parsed.arguments ?? {};
|
|
32429
|
+
if (typeof rawInput === "object" && rawInput !== null && !Array.isArray(rawInput) && ("Arguments" in rawInput || "arguments" in rawInput)) {
|
|
32430
|
+
const record2 = rawInput;
|
|
32431
|
+
const nested = record2.Arguments ?? record2.arguments;
|
|
32432
|
+
if (typeof nested === "object" && nested !== null) {
|
|
32433
|
+
return nested;
|
|
32434
|
+
}
|
|
32435
|
+
}
|
|
32436
|
+
return rawInput;
|
|
32317
32437
|
}
|
|
32318
32438
|
function extractToolName(parsed) {
|
|
32319
32439
|
for (const key of ["tool_name", "toolName", "name"]) {
|
|
32320
32440
|
const value2 = parsed[key];
|
|
32321
|
-
if (typeof value2 === "string" && value2.trim())
|
|
32441
|
+
if (typeof value2 === "string" && value2.trim()) {
|
|
32442
|
+
const trimmed = value2.trim();
|
|
32443
|
+
if (trimmed === "call_mcp_tool" || trimmed === "callMcpTool") {
|
|
32444
|
+
const input = parsed.parameters ?? parsed.input ?? parsed.args ?? parsed.arguments ?? {};
|
|
32445
|
+
const server2 = typeof input.ServerName === "string" ? input.ServerName.trim() : typeof input.serverName === "string" ? input.serverName.trim() : "";
|
|
32446
|
+
const tool = typeof input.ToolName === "string" ? input.ToolName.trim() : typeof input.toolName === "string" ? input.toolName.trim() : "";
|
|
32447
|
+
if (server2 && tool) return `mcp__${server2}__${tool}`;
|
|
32448
|
+
if (tool) return tool;
|
|
32449
|
+
}
|
|
32450
|
+
return trimmed;
|
|
32451
|
+
}
|
|
32322
32452
|
}
|
|
32323
32453
|
const server = typeof parsed.server === "string" ? parsed.server.trim() : "";
|
|
32324
32454
|
const method = typeof parsed.method === "string" ? parsed.method.trim() : "";
|
|
@@ -32427,17 +32557,14 @@ function syncAntigravitySubagentTranscript(transcriptPath, parentToolUseId, pres
|
|
|
32427
32557
|
const toolCalls = Array.isArray(entry.tool_calls) ? entry.tool_calls : [];
|
|
32428
32558
|
toolCalls.forEach((rawToolCall, toolIndex) => {
|
|
32429
32559
|
const toolCall = asRecord(rawToolCall);
|
|
32430
|
-
|
|
32560
|
+
if (!toolCall) return;
|
|
32561
|
+
const toolName = extractToolName(toolCall);
|
|
32431
32562
|
if (!toolName) return;
|
|
32563
|
+
const toolInput = extractToolInput(toolCall);
|
|
32432
32564
|
const toolId = antigravityTranscriptToolId(parentToolUseId, lineIndex, toolIndex);
|
|
32433
32565
|
pendingToolIds.push(toolId);
|
|
32434
32566
|
emittedEventCount += 1;
|
|
32435
|
-
void presenter.onToolUse(
|
|
32436
|
-
toolName,
|
|
32437
|
-
toolCall?.args ?? toolCall?.parameters ?? {},
|
|
32438
|
-
toolId,
|
|
32439
|
-
parentToolUseId
|
|
32440
|
-
);
|
|
32567
|
+
void presenter.onToolUse(toolName, toolInput, toolId, parentToolUseId);
|
|
32441
32568
|
});
|
|
32442
32569
|
const content = stringField2(entry, "content");
|
|
32443
32570
|
if (content && isAntigravityToolResultEntry(entry)) {
|
|
@@ -35042,7 +35169,7 @@ function handleCopilotStructuredEvent(parsed, context, state) {
|
|
|
35042
35169
|
case "tool.execution_complete": {
|
|
35043
35170
|
const toolId = typeof data.toolCallId === "string" ? data.toolCallId : `copilot-tool-${Date.now()}`;
|
|
35044
35171
|
const result = typeof data.result === "object" && data.result !== null ? data.result : {};
|
|
35045
|
-
const content = typeof result.content === "string" ? result.content : typeof result.detailedContent === "string" ? result.detailedContent : typeof data.error === "string" ? data.error : "";
|
|
35172
|
+
const content = result.codeContext !== void 0 || result.structuredContent !== void 0 || result.content !== void 0 && Array.isArray(result.content) ? JSON.stringify(result, null, 2) : typeof result.content === "string" ? result.content : typeof result.detailedContent === "string" ? result.detailedContent : typeof data.error === "string" ? data.error : "";
|
|
35046
35173
|
const success2 = typeof data.success === "boolean" ? data.success : true;
|
|
35047
35174
|
const trackedLauncher = state.activeBackgroundTaskIds?.has(toolId) === true;
|
|
35048
35175
|
const linkedBackground = state.backgroundTaskIdsByToolId?.has(toolId) === true;
|
|
@@ -35253,6 +35380,9 @@ function buildCursorToolResultText(result) {
|
|
|
35253
35380
|
const resultRecord = result;
|
|
35254
35381
|
const success2 = typeof resultRecord.success === "object" && resultRecord.success !== null ? resultRecord.success : null;
|
|
35255
35382
|
if (success2) {
|
|
35383
|
+
if (success2.codeContext !== void 0 || success2.structuredContent !== void 0 || success2.content !== void 0 && Array.isArray(success2.content)) {
|
|
35384
|
+
return JSON.stringify(success2, null, 2);
|
|
35385
|
+
}
|
|
35256
35386
|
if (typeof success2.content === "string" && success2.content.trim().length > 0)
|
|
35257
35387
|
return success2.content;
|
|
35258
35388
|
if (typeof success2.output === "string" && success2.output.trim().length > 0)
|
|
@@ -64782,9 +64912,16 @@ function projectSkillFrontmatter(admitted) {
|
|
|
64782
64912
|
}
|
|
64783
64913
|
return trimmed;
|
|
64784
64914
|
};
|
|
64915
|
+
const optionalToolList = (key, max) => {
|
|
64916
|
+
const value2 = raw[key];
|
|
64917
|
+
if (Array.isArray(value2) && value2.every((entry) => typeof entry === "string")) {
|
|
64918
|
+
raw[key] = value2.join(", ");
|
|
64919
|
+
}
|
|
64920
|
+
return optionalText(key, max);
|
|
64921
|
+
};
|
|
64785
64922
|
const license = optionalText("license", 1024);
|
|
64786
64923
|
const compatibility = optionalText("compatibility", 500);
|
|
64787
|
-
const allowedTools =
|
|
64924
|
+
const allowedTools = optionalToolList("allowed-tools", 1024);
|
|
64788
64925
|
const metadata = {};
|
|
64789
64926
|
const rawMetadata = raw.metadata;
|
|
64790
64927
|
if (rawMetadata !== void 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiden-ade/sandbox-agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.69",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Alan agent runtime — cloud sandbox and local daemon (alan-agent CLI)",
|
|
6
6
|
"bin": {
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"tsup": "^8.5.1",
|
|
26
26
|
"tsx": "^4.19.0",
|
|
27
27
|
"typescript": "~5.9.3",
|
|
28
|
-
"@alan-ai/
|
|
29
|
-
"@alan-ai/
|
|
28
|
+
"@alan-ai/agent-core": "0.1.0",
|
|
29
|
+
"@alan-ai/shared": "0.1.0"
|
|
30
30
|
},
|
|
31
31
|
"deprecated": "Use @alan-ai-hq/agent-manager instead.",
|
|
32
32
|
"scripts": {
|