agentbox-sdk 0.1.305 → 0.1.307
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/agents/index.d.ts +2 -2
- package/dist/agents/index.js +1 -1
- package/dist/{chunk-KRSY52XS.js → chunk-7GOUX3OB.js} +130 -24
- package/dist/events/index.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{types-DiZSjZma.d.ts → types-CZdyLzA4.d.ts} +13 -0
- package/package.json +1 -1
package/dist/agents/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as AgentProviderName, h as AgentOptions, t as AgentRunConfig, s as AgentRun, r as AgentResult, a2 as RawAgentEvent, b as AgentAttachRequest, y as AttachedRun } from '../types-
|
|
2
|
-
export { a as AgentApprovalMode, c as AgentCommandConfig, d as AgentCostData, e as AgentExecutionRequest, f as AgentLocalMcpConfig, g as AgentMcpConfig, i as AgentOptionsBase, j as AgentOptionsMap, k as AgentPermissionDecision, l as AgentPermissionKind, m as AgentPermissionResponse, n as AgentProviderAdapter, p as AgentReasoningEffort, q as AgentRemoteMcpConfig, u as AgentRunSink, v as AgentSetupRequest, w as AgentSkillConfig, x as AgentSubAgentConfig, C as ClaudeCodeAgentOptions, z as ClaudeCodeHookConfig, B as ClaudeCodeHookEvent, D as ClaudeCodeHookHandler, E as ClaudeCodeHookMatcherGroup, F as ClaudeCodeHooksConfig, G as ClaudeCodeProviderOptions, H as CodexAgentOptions, I as CodexCommandHook, J as CodexHookEvent, K as CodexHookMatcherGroup, L as CodexHooksConfig, M as CodexProviderOptions, N as DataContent, O as EmbeddedSkillConfig, P as FilePart, Q as ImagePart, X as OpenCodeAgentOptions, Y as OpenCodePluginConfig, Z as OpenCodePluginEvent, _ as OpenCodePluginHookConfig, $ as OpenCodeProviderOptions, a4 as RepoSkillConfig, aa as TextPart, ae as UserContent, af as UserContentPart } from '../types-
|
|
1
|
+
import { o as AgentProviderName, h as AgentOptions, t as AgentRunConfig, s as AgentRun, r as AgentResult, a2 as RawAgentEvent, b as AgentAttachRequest, y as AttachedRun } from '../types-CZdyLzA4.js';
|
|
2
|
+
export { a as AgentApprovalMode, c as AgentCommandConfig, d as AgentCostData, e as AgentExecutionRequest, f as AgentLocalMcpConfig, g as AgentMcpConfig, i as AgentOptionsBase, j as AgentOptionsMap, k as AgentPermissionDecision, l as AgentPermissionKind, m as AgentPermissionResponse, n as AgentProviderAdapter, p as AgentReasoningEffort, q as AgentRemoteMcpConfig, u as AgentRunSink, v as AgentSetupRequest, w as AgentSkillConfig, x as AgentSubAgentConfig, C as ClaudeCodeAgentOptions, z as ClaudeCodeHookConfig, B as ClaudeCodeHookEvent, D as ClaudeCodeHookHandler, E as ClaudeCodeHookMatcherGroup, F as ClaudeCodeHooksConfig, G as ClaudeCodeProviderOptions, H as CodexAgentOptions, I as CodexCommandHook, J as CodexHookEvent, K as CodexHookMatcherGroup, L as CodexHooksConfig, M as CodexProviderOptions, N as DataContent, O as EmbeddedSkillConfig, P as FilePart, Q as ImagePart, X as OpenCodeAgentOptions, Y as OpenCodePluginConfig, Z as OpenCodePluginEvent, _ as OpenCodePluginHookConfig, $ as OpenCodeProviderOptions, a4 as RepoSkillConfig, aa as TextPart, ae as UserContent, af as UserContentPart } from '../types-CZdyLzA4.js';
|
|
3
3
|
import { S as Sandbox } from '../Sandbox-K6VNqKeo.js';
|
|
4
4
|
export { AgentProvider } from '../enums.js';
|
|
5
5
|
import 'e2b';
|
package/dist/agents/index.js
CHANGED
|
@@ -1129,6 +1129,32 @@ async function createSetupTarget(provider, setupId, options) {
|
|
|
1129
1129
|
});
|
|
1130
1130
|
}
|
|
1131
1131
|
|
|
1132
|
+
// src/agents/config/rtk.ts
|
|
1133
|
+
var RTK_INIT_ARGS_BY_PROVIDER = {
|
|
1134
|
+
[AgentProvider.ClaudeCode]: "--auto-patch",
|
|
1135
|
+
[AgentProvider.Codex]: "--codex",
|
|
1136
|
+
[AgentProvider.OpenCode]: "--opencode --auto-patch"
|
|
1137
|
+
};
|
|
1138
|
+
function rtkRedirectEnv(target) {
|
|
1139
|
+
const layout = target.layout;
|
|
1140
|
+
const common = { RTK_TELEMETRY_DISABLED: "1" };
|
|
1141
|
+
switch (target.provider) {
|
|
1142
|
+
case AgentProvider.ClaudeCode:
|
|
1143
|
+
return { ...common, RTK_CLAUDE_DIR: layout.claudeDir };
|
|
1144
|
+
case AgentProvider.Codex:
|
|
1145
|
+
return { ...common, CODEX_HOME: layout.codexDir };
|
|
1146
|
+
case AgentProvider.OpenCode:
|
|
1147
|
+
return { ...common, HOME: layout.rootDir };
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
async function activateRtk(target) {
|
|
1151
|
+
const args = RTK_INIT_ARGS_BY_PROVIDER[target.provider];
|
|
1152
|
+
const env = rtkRedirectEnv(target);
|
|
1153
|
+
const dirsToEnsure = [target.layout.claudeDir, target.layout.codexDir].map((d) => `'${d}'`).join(" ");
|
|
1154
|
+
const cmd = `mkdir -p ${dirsToEnsure} && rtk init -g ${args}`.trim();
|
|
1155
|
+
await target.runCommand(cmd, env);
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1132
1158
|
// src/agents/config/setup-manifest.ts
|
|
1133
1159
|
import { createHash } from "crypto";
|
|
1134
1160
|
import path5 from "path";
|
|
@@ -1500,11 +1526,17 @@ function mergeUsage(target, source) {
|
|
|
1500
1526
|
);
|
|
1501
1527
|
addIfNumber(target, "cache_read_input_tokens", source.cached_input_tokens);
|
|
1502
1528
|
addIfNumber(target, "cache_read_input_tokens", source.cachedInputTokens);
|
|
1529
|
+
addIfNumber(target, "cache_read_input_tokens", source.cacheReadInputTokens);
|
|
1503
1530
|
addIfNumber(
|
|
1504
1531
|
target,
|
|
1505
1532
|
"cache_creation_input_tokens",
|
|
1506
1533
|
source.cache_creation_input_tokens
|
|
1507
1534
|
);
|
|
1535
|
+
addIfNumber(
|
|
1536
|
+
target,
|
|
1537
|
+
"cache_creation_input_tokens",
|
|
1538
|
+
source.cacheCreationInputTokens
|
|
1539
|
+
);
|
|
1508
1540
|
addIfNumber(target, "cache_creation_input_tokens", source.cacheWrite);
|
|
1509
1541
|
const cache = asRecord(source.cache);
|
|
1510
1542
|
if (cache) {
|
|
@@ -1541,6 +1573,8 @@ function extractClaudeCostData(events) {
|
|
|
1541
1573
|
for (const value of Object.values(modelUsage)) {
|
|
1542
1574
|
mergeUsage(usage, asRecord(value));
|
|
1543
1575
|
}
|
|
1576
|
+
} else {
|
|
1577
|
+
mergeUsage(usage, asRecord(event.usage));
|
|
1544
1578
|
}
|
|
1545
1579
|
return compactCostData({
|
|
1546
1580
|
...totalCost !== void 0 ? { total_cost_usd: totalCost } : {},
|
|
@@ -1595,7 +1629,7 @@ function extractOpenCodeCostData(events) {
|
|
|
1595
1629
|
}
|
|
1596
1630
|
|
|
1597
1631
|
// src/agents/providers/claude-code.ts
|
|
1598
|
-
var DAEMON_PROTOCOL_VERSION = "
|
|
1632
|
+
var DAEMON_PROTOCOL_VERSION = "2";
|
|
1599
1633
|
var DAEMON_PORT = 43180;
|
|
1600
1634
|
var DAEMON_PATH = "/tmp/agentbox/claude-code/daemon.mjs";
|
|
1601
1635
|
var DAEMON_LOG_PATH = "/tmp/agentbox/claude-code/daemon.log";
|
|
@@ -1688,7 +1722,7 @@ function createClaudeCodeDaemonScript() {
|
|
|
1688
1722
|
return `import http from "node:http";
|
|
1689
1723
|
import { execSync } from "node:child_process";
|
|
1690
1724
|
import { existsSync } from "node:fs";
|
|
1691
|
-
import { query } from "@anthropic-ai/claude-agent-sdk";
|
|
1725
|
+
import { query, getSessionInfo } from "@anthropic-ai/claude-agent-sdk";
|
|
1692
1726
|
|
|
1693
1727
|
const VERSION = ${version};
|
|
1694
1728
|
const port = Number(process.argv[2] ?? "${DAEMON_PORT}");
|
|
@@ -1787,6 +1821,16 @@ async function handleStart(req, res, runId) {
|
|
|
1787
1821
|
"x-daemon-version": VERSION,
|
|
1788
1822
|
});
|
|
1789
1823
|
|
|
1824
|
+
// Heartbeat: write a blank NDJSON line every 15s so HTTPS proxies
|
|
1825
|
+
// (Modal/Daytona tunnels, intermediate LBs) don't idle-kill the
|
|
1826
|
+
// stream during long blocking tool calls (e.g. TaskOutput block:true).
|
|
1827
|
+
// The host's parseNdjsonStream skips empty lines, so this is a no-op
|
|
1828
|
+
// for consumers but keeps the underlying TCP stream warm.
|
|
1829
|
+
const heartbeat = setInterval(() => {
|
|
1830
|
+
if (!res.writableEnded) res.write("\\n");
|
|
1831
|
+
}, 15000);
|
|
1832
|
+
if (typeof heartbeat.unref === "function") heartbeat.unref();
|
|
1833
|
+
|
|
1790
1834
|
const opts = { ...(options || {}) };
|
|
1791
1835
|
const autoApprove = !!opts.autoApproveTools;
|
|
1792
1836
|
delete opts.autoApproveTools;
|
|
@@ -1794,6 +1838,36 @@ async function handleStart(req, res, runId) {
|
|
|
1794
1838
|
opts.pathToClaudeCodeExecutable,
|
|
1795
1839
|
);
|
|
1796
1840
|
|
|
1841
|
+
// Resume-if-exists gate. \`claude --resume <id>\` errors hard with "No
|
|
1842
|
+
// conversation found with session ID" when the local session jsonl is
|
|
1843
|
+
// missing \u2014 most often because a prior post-task snapshot failed and the
|
|
1844
|
+
// sandbox state we resumed from doesn't have it. Probe the session
|
|
1845
|
+
// store; if the id isn't there, drop \`resume\` (and its companions) and
|
|
1846
|
+
// reuse the same UUID via \`sessionId\` so the host's pre-minted session
|
|
1847
|
+
// id stays consistent with what claude-agent-sdk actually emits.
|
|
1848
|
+
if (opts.resume) {
|
|
1849
|
+
let sessionExists = false;
|
|
1850
|
+
try {
|
|
1851
|
+
const info = await getSessionInfo(opts.resume, opts.cwd ? { dir: opts.cwd } : undefined);
|
|
1852
|
+
sessionExists = info !== undefined;
|
|
1853
|
+
} catch {
|
|
1854
|
+
sessionExists = false;
|
|
1855
|
+
}
|
|
1856
|
+
if (!sessionExists) {
|
|
1857
|
+
const orphanedId = opts.resume;
|
|
1858
|
+
delete opts.resume;
|
|
1859
|
+
delete opts.resumeSessionAt;
|
|
1860
|
+
delete opts.forkSession;
|
|
1861
|
+
opts.sessionId = orphanedId;
|
|
1862
|
+
res.write(
|
|
1863
|
+
JSON.stringify({
|
|
1864
|
+
_notice: "resume_session_missing",
|
|
1865
|
+
sessionId: orphanedId,
|
|
1866
|
+
}) + "\\n",
|
|
1867
|
+
);
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1797
1871
|
let queryHandle;
|
|
1798
1872
|
try {
|
|
1799
1873
|
queryHandle = query({
|
|
@@ -1804,6 +1878,7 @@ async function handleStart(req, res, runId) {
|
|
|
1804
1878
|
},
|
|
1805
1879
|
});
|
|
1806
1880
|
} catch (e) {
|
|
1881
|
+
clearInterval(heartbeat);
|
|
1807
1882
|
res.write(JSON.stringify({ _error: String(e?.message ?? e) }) + "\\n");
|
|
1808
1883
|
res.end();
|
|
1809
1884
|
return;
|
|
@@ -1813,6 +1888,7 @@ async function handleStart(req, res, runId) {
|
|
|
1813
1888
|
|
|
1814
1889
|
// Client disconnected (e.g. host process killed) \u2192 tear down.
|
|
1815
1890
|
req.on("close", () => {
|
|
1891
|
+
clearInterval(heartbeat);
|
|
1816
1892
|
if (!liveRuns.has(runId)) return;
|
|
1817
1893
|
liveRuns.delete(runId);
|
|
1818
1894
|
promptStream.end();
|
|
@@ -1827,6 +1903,7 @@ async function handleStart(req, res, runId) {
|
|
|
1827
1903
|
} catch (e) {
|
|
1828
1904
|
res.write(JSON.stringify({ _error: String(e?.message ?? e) }) + "\\n");
|
|
1829
1905
|
} finally {
|
|
1906
|
+
clearInterval(heartbeat);
|
|
1830
1907
|
liveRuns.delete(runId);
|
|
1831
1908
|
promptStream.end();
|
|
1832
1909
|
res.end();
|
|
@@ -2085,6 +2162,7 @@ var ClaudeCodeAgentAdapter = class {
|
|
|
2085
2162
|
{ path: settingsPath, content: JSON.stringify(hookSettings, null, 2) },
|
|
2086
2163
|
{ path: mcpConfigPath, content: mcpConfigJson }
|
|
2087
2164
|
];
|
|
2165
|
+
const enableRtk = options.enableRtk === true;
|
|
2088
2166
|
const daemonInfo = {
|
|
2089
2167
|
port: DAEMON_PORT,
|
|
2090
2168
|
healthPath: "/__version",
|
|
@@ -2093,7 +2171,8 @@ var ClaudeCodeAgentAdapter = class {
|
|
|
2093
2171
|
const setupId = computeSetupId({
|
|
2094
2172
|
artifacts,
|
|
2095
2173
|
installCommands,
|
|
2096
|
-
daemon: daemonInfo
|
|
2174
|
+
daemon: daemonInfo,
|
|
2175
|
+
extras: [`enableRtk:${enableRtk}`]
|
|
2097
2176
|
});
|
|
2098
2177
|
if (await preflightSetup(target, setupId, daemonInfo)) {
|
|
2099
2178
|
debugClaude("claude-code setup() preflight hit \u2014 skipping");
|
|
@@ -2108,6 +2187,9 @@ var ClaudeCodeAgentAdapter = class {
|
|
|
2108
2187
|
),
|
|
2109
2188
|
ensureClaudeCodeDaemon(options, env)
|
|
2110
2189
|
]);
|
|
2190
|
+
if (enableRtk) {
|
|
2191
|
+
await time(debugClaude, "activateRtk", () => activateRtk(target));
|
|
2192
|
+
}
|
|
2111
2193
|
await markSetupComplete(target, setupId);
|
|
2112
2194
|
});
|
|
2113
2195
|
}
|
|
@@ -2243,10 +2325,24 @@ var ClaudeCodeAgentAdapter = class {
|
|
|
2243
2325
|
const rawPayloads = [];
|
|
2244
2326
|
try {
|
|
2245
2327
|
for await (const item of parseNdjsonStream(response.body)) {
|
|
2246
|
-
if (item && typeof item === "object"
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2328
|
+
if (item && typeof item === "object") {
|
|
2329
|
+
const ctrl = item;
|
|
2330
|
+
if ("_error" in ctrl) {
|
|
2331
|
+
throw new Error(
|
|
2332
|
+
String(item._error ?? "daemon error")
|
|
2333
|
+
);
|
|
2334
|
+
}
|
|
2335
|
+
if ("_notice" in ctrl) {
|
|
2336
|
+
debugClaude("daemon notice: %o", ctrl);
|
|
2337
|
+
sink.emitRaw(
|
|
2338
|
+
toRawEvent(
|
|
2339
|
+
request.runId,
|
|
2340
|
+
ctrl,
|
|
2341
|
+
`daemon.${String(ctrl._notice ?? "notice")}`
|
|
2342
|
+
)
|
|
2343
|
+
);
|
|
2344
|
+
continue;
|
|
2345
|
+
}
|
|
2250
2346
|
}
|
|
2251
2347
|
const message = item;
|
|
2252
2348
|
rawPayloads.push(message);
|
|
@@ -2357,7 +2453,11 @@ var ClaudeCodeAgentAdapter = class {
|
|
|
2357
2453
|
Date.now() - executeStartedAt,
|
|
2358
2454
|
lastTerminalReason
|
|
2359
2455
|
);
|
|
2360
|
-
sink.fail(
|
|
2456
|
+
sink.fail(
|
|
2457
|
+
new Error(
|
|
2458
|
+
finalText || `claude-code run failed (terminal_reason: ${lastTerminalReason})`
|
|
2459
|
+
)
|
|
2460
|
+
);
|
|
2361
2461
|
} else {
|
|
2362
2462
|
debugClaude(
|
|
2363
2463
|
"\u2605 run.completed (%dms since execute start) chars=%d",
|
|
@@ -3089,6 +3189,7 @@ async function setupCodex(request) {
|
|
|
3089
3189
|
});
|
|
3090
3190
|
const { artifacts: serverArtifacts } = buildArtifactsFor(sharedTarget);
|
|
3091
3191
|
const { artifacts: skillArtifacts2, installCommands: installCommands2 } = await prepareSkillArtifacts(provider, options.skills, target2.layout);
|
|
3192
|
+
const enableRtk2 = options.enableRtk === true;
|
|
3092
3193
|
const daemonInfo = {
|
|
3093
3194
|
port: REMOTE_CODEX_APP_SERVER_PORT,
|
|
3094
3195
|
healthPath: "/readyz"
|
|
@@ -3096,7 +3197,8 @@ async function setupCodex(request) {
|
|
|
3096
3197
|
const setupId2 = computeSetupId({
|
|
3097
3198
|
artifacts: [...serverArtifacts, ...skillArtifacts2],
|
|
3098
3199
|
installCommands: installCommands2,
|
|
3099
|
-
daemon: daemonInfo
|
|
3200
|
+
daemon: daemonInfo,
|
|
3201
|
+
extras: [`enableRtk:${enableRtk2}`]
|
|
3100
3202
|
});
|
|
3101
3203
|
if (await preflightSetup(sharedTarget, setupId2, daemonInfo)) {
|
|
3102
3204
|
debugCodex("codex remote setup() preflight hit \u2014 skipping");
|
|
@@ -3159,6 +3261,9 @@ async function setupCodex(request) {
|
|
|
3159
3261
|
await target2.cleanup().catch(() => void 0);
|
|
3160
3262
|
throw error;
|
|
3161
3263
|
}
|
|
3264
|
+
if (enableRtk2) {
|
|
3265
|
+
await time(debugCodex, "activateRtk", () => activateRtk(sharedTarget));
|
|
3266
|
+
}
|
|
3162
3267
|
await markSetupComplete(sharedTarget, setupId2);
|
|
3163
3268
|
return;
|
|
3164
3269
|
}
|
|
@@ -3166,9 +3271,11 @@ async function setupCodex(request) {
|
|
|
3166
3271
|
const { artifacts: skillArtifacts, installCommands } = await prepareSkillArtifacts(provider, options.skills, target.layout);
|
|
3167
3272
|
const { artifacts: configArtifacts } = buildArtifactsFor(target);
|
|
3168
3273
|
const allArtifacts = [...skillArtifacts, ...configArtifacts];
|
|
3274
|
+
const enableRtk = options.enableRtk === true;
|
|
3169
3275
|
const setupId = computeSetupId({
|
|
3170
3276
|
artifacts: allArtifacts,
|
|
3171
|
-
installCommands
|
|
3277
|
+
installCommands,
|
|
3278
|
+
extras: [`enableRtk:${enableRtk}`]
|
|
3172
3279
|
});
|
|
3173
3280
|
if (await preflightSetup(target, setupId)) {
|
|
3174
3281
|
debugCodex("codex local setup() preflight hit \u2014 skipping");
|
|
@@ -3181,6 +3288,9 @@ async function setupCodex(request) {
|
|
|
3181
3288
|
throw error;
|
|
3182
3289
|
}
|
|
3183
3290
|
await applyDifferentialSetup(target, allArtifacts, installCommands);
|
|
3291
|
+
if (enableRtk) {
|
|
3292
|
+
await time(debugCodex, "activateRtk", () => activateRtk(target));
|
|
3293
|
+
}
|
|
3184
3294
|
await markSetupComplete(target, setupId);
|
|
3185
3295
|
}
|
|
3186
3296
|
async function createRuntime(request, inputParts) {
|
|
@@ -3785,10 +3895,7 @@ async function ensureSandboxOpenCodeServer(request) {
|
|
|
3785
3895
|
target.layout.opencodeDir
|
|
3786
3896
|
);
|
|
3787
3897
|
const configPath = path10.join(target.layout.opencodeDir, "agentbox.json");
|
|
3788
|
-
const openCodeConfig = buildOpenCodeConfig(
|
|
3789
|
-
options,
|
|
3790
|
-
interactiveApproval
|
|
3791
|
-
);
|
|
3898
|
+
const openCodeConfig = buildOpenCodeConfig(options, interactiveApproval);
|
|
3792
3899
|
const allArtifacts = [
|
|
3793
3900
|
...skillArtifacts,
|
|
3794
3901
|
...pluginArtifacts,
|
|
@@ -3797,11 +3904,13 @@ async function ensureSandboxOpenCodeServer(request) {
|
|
|
3797
3904
|
content: JSON.stringify(openCodeConfig, null, 2)
|
|
3798
3905
|
}
|
|
3799
3906
|
];
|
|
3907
|
+
const enableRtk = options.enableRtk === true;
|
|
3800
3908
|
const daemonInfo = { port, healthPath: "/global/health" };
|
|
3801
3909
|
const setupId = computeSetupId({
|
|
3802
3910
|
artifacts: allArtifacts,
|
|
3803
3911
|
installCommands,
|
|
3804
|
-
daemon: daemonInfo
|
|
3912
|
+
daemon: daemonInfo,
|
|
3913
|
+
extras: [`enableRtk:${enableRtk}`]
|
|
3805
3914
|
});
|
|
3806
3915
|
if (await preflightSetup(target, setupId, daemonInfo)) {
|
|
3807
3916
|
debugOpencode("opencode setup() preflight hit \u2014 skipping");
|
|
@@ -3813,6 +3922,9 @@ async function ensureSandboxOpenCodeServer(request) {
|
|
|
3813
3922
|
OPENCODE_DISABLE_DEFAULT_PLUGINS: "true"
|
|
3814
3923
|
};
|
|
3815
3924
|
await applyDifferentialSetup(target, allArtifacts, installCommands);
|
|
3925
|
+
if (enableRtk) {
|
|
3926
|
+
await time(debugOpencode, "activateRtk", () => activateRtk(target));
|
|
3927
|
+
}
|
|
3816
3928
|
const binary = options.provider?.binary ?? "opencode";
|
|
3817
3929
|
const pidFilePath = path10.posix.join(
|
|
3818
3930
|
target.layout.rootDir,
|
|
@@ -4347,9 +4459,7 @@ var OpenCodeAgentAdapter = class {
|
|
|
4347
4459
|
if (response.ok || response.status === 204) {
|
|
4348
4460
|
return;
|
|
4349
4461
|
}
|
|
4350
|
-
lastError = new Error(
|
|
4351
|
-
`POST ${url} returned ${response.status}`
|
|
4352
|
-
);
|
|
4462
|
+
lastError = new Error(`POST ${url} returned ${response.status}`);
|
|
4353
4463
|
} catch (error) {
|
|
4354
4464
|
lastError = error;
|
|
4355
4465
|
}
|
|
@@ -4459,14 +4569,10 @@ var OpenCodeAgentAdapter = class {
|
|
|
4459
4569
|
});
|
|
4460
4570
|
} else if (sseSilent) {
|
|
4461
4571
|
sink.fail(
|
|
4462
|
-
new Error(
|
|
4463
|
-
"opencode SSE went silent before the session reached idle"
|
|
4464
|
-
)
|
|
4572
|
+
new Error("opencode SSE went silent before the session reached idle")
|
|
4465
4573
|
);
|
|
4466
4574
|
} else {
|
|
4467
|
-
sink.fail(
|
|
4468
|
-
new Error("opencode run ended without a terminal signal")
|
|
4469
|
-
);
|
|
4575
|
+
sink.fail(new Error("opencode run ended without a terminal signal"));
|
|
4470
4576
|
}
|
|
4471
4577
|
} finally {
|
|
4472
4578
|
sseAbort.abort();
|
package/dist/events/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AISDKEvent, R as MessageCompletedEvent, S as MessageInjectedEvent, T as MessageStartedEvent, U as NormalizedAgentEvent, V as NormalizedAgentEventBase, W as NormalizedAgentEventType, a0 as PermissionRequestedEvent, a1 as PermissionResolvedEvent, a2 as RawAgentEvent, a3 as ReasoningDeltaEvent, a5 as RunCancelledEvent, a6 as RunCompletedEvent, a7 as RunErrorEvent, a8 as RunStartedEvent, a9 as TextDeltaEvent, ab as ToolCallCompletedEvent, ac as ToolCallDeltaEvent, ad as ToolCallStartedEvent, ag as createNormalizedEvent, ah as normalizeRawAgentEvent, ai as toAISDKEvent, aj as toAISDKStream } from '../types-
|
|
1
|
+
export { A as AISDKEvent, R as MessageCompletedEvent, S as MessageInjectedEvent, T as MessageStartedEvent, U as NormalizedAgentEvent, V as NormalizedAgentEventBase, W as NormalizedAgentEventType, a0 as PermissionRequestedEvent, a1 as PermissionResolvedEvent, a2 as RawAgentEvent, a3 as ReasoningDeltaEvent, a5 as RunCancelledEvent, a6 as RunCompletedEvent, a7 as RunErrorEvent, a8 as RunStartedEvent, a9 as TextDeltaEvent, ab as ToolCallCompletedEvent, ac as ToolCallDeltaEvent, ad as ToolCallStartedEvent, ag as createNormalizedEvent, ah as normalizeRawAgentEvent, ai as toAISDKEvent, aj as toAISDKStream } from '../types-CZdyLzA4.js';
|
|
2
2
|
import { AgentProvider } from '../enums.js';
|
|
3
3
|
import '../Sandbox-K6VNqKeo.js';
|
|
4
4
|
import 'e2b';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AISDKEvent, a as AgentApprovalMode, b as AgentAttachRequest, c as AgentCommandConfig, d as AgentCostData, e as AgentExecutionRequest, f as AgentLocalMcpConfig, g as AgentMcpConfig, h as AgentOptions, i as AgentOptionsBase, j as AgentOptionsMap, k as AgentPermissionDecision, l as AgentPermissionKind, m as AgentPermissionResponse, n as AgentProviderAdapter, o as AgentProviderName, p as AgentReasoningEffort, q as AgentRemoteMcpConfig, r as AgentResult, s as AgentRun, t as AgentRunConfig, u as AgentRunSink, v as AgentSetupRequest, w as AgentSkillConfig, x as AgentSubAgentConfig, y as AttachedRun, C as ClaudeCodeAgentOptions, z as ClaudeCodeHookConfig, B as ClaudeCodeHookEvent, D as ClaudeCodeHookHandler, E as ClaudeCodeHookMatcherGroup, F as ClaudeCodeHooksConfig, G as ClaudeCodeProviderOptions, H as CodexAgentOptions, I as CodexCommandHook, J as CodexHookEvent, K as CodexHookMatcherGroup, L as CodexHooksConfig, M as CodexProviderOptions, N as DataContent, O as EmbeddedSkillConfig, P as FilePart, Q as ImagePart, R as MessageCompletedEvent, S as MessageInjectedEvent, T as MessageStartedEvent, U as NormalizedAgentEvent, V as NormalizedAgentEventBase, W as NormalizedAgentEventType, X as OpenCodeAgentOptions, Y as OpenCodePluginConfig, Z as OpenCodePluginEvent, _ as OpenCodePluginHookConfig, $ as OpenCodeProviderOptions, a0 as PermissionRequestedEvent, a1 as PermissionResolvedEvent, a2 as RawAgentEvent, a3 as ReasoningDeltaEvent, a4 as RepoSkillConfig, a5 as RunCancelledEvent, a6 as RunCompletedEvent, a7 as RunErrorEvent, a8 as RunStartedEvent, a9 as TextDeltaEvent, aa as TextPart, ab as ToolCallCompletedEvent, ac as ToolCallDeltaEvent, ad as ToolCallStartedEvent, ae as UserContent, af as UserContentPart, ag as createNormalizedEvent, ah as normalizeRawAgentEvent, ai as toAISDKEvent, aj as toAISDKStream } from './types-
|
|
1
|
+
export { A as AISDKEvent, a as AgentApprovalMode, b as AgentAttachRequest, c as AgentCommandConfig, d as AgentCostData, e as AgentExecutionRequest, f as AgentLocalMcpConfig, g as AgentMcpConfig, h as AgentOptions, i as AgentOptionsBase, j as AgentOptionsMap, k as AgentPermissionDecision, l as AgentPermissionKind, m as AgentPermissionResponse, n as AgentProviderAdapter, o as AgentProviderName, p as AgentReasoningEffort, q as AgentRemoteMcpConfig, r as AgentResult, s as AgentRun, t as AgentRunConfig, u as AgentRunSink, v as AgentSetupRequest, w as AgentSkillConfig, x as AgentSubAgentConfig, y as AttachedRun, C as ClaudeCodeAgentOptions, z as ClaudeCodeHookConfig, B as ClaudeCodeHookEvent, D as ClaudeCodeHookHandler, E as ClaudeCodeHookMatcherGroup, F as ClaudeCodeHooksConfig, G as ClaudeCodeProviderOptions, H as CodexAgentOptions, I as CodexCommandHook, J as CodexHookEvent, K as CodexHookMatcherGroup, L as CodexHooksConfig, M as CodexProviderOptions, N as DataContent, O as EmbeddedSkillConfig, P as FilePart, Q as ImagePart, R as MessageCompletedEvent, S as MessageInjectedEvent, T as MessageStartedEvent, U as NormalizedAgentEvent, V as NormalizedAgentEventBase, W as NormalizedAgentEventType, X as OpenCodeAgentOptions, Y as OpenCodePluginConfig, Z as OpenCodePluginEvent, _ as OpenCodePluginHookConfig, $ as OpenCodeProviderOptions, a0 as PermissionRequestedEvent, a1 as PermissionResolvedEvent, a2 as RawAgentEvent, a3 as ReasoningDeltaEvent, a4 as RepoSkillConfig, a5 as RunCancelledEvent, a6 as RunCompletedEvent, a7 as RunErrorEvent, a8 as RunStartedEvent, a9 as TextDeltaEvent, aa as TextPart, ab as ToolCallCompletedEvent, ac as ToolCallDeltaEvent, ad as ToolCallStartedEvent, ae as UserContent, af as UserContentPart, ag as createNormalizedEvent, ah as normalizeRawAgentEvent, ai as toAISDKEvent, aj as toAISDKStream } from './types-CZdyLzA4.js';
|
|
2
2
|
export { AGENT_RESERVED_PORTS, Agent, collectAllAgentReservedPorts } from './agents/index.js';
|
|
3
3
|
export { A as AsyncCommandHandle, C as CommandEvent, a as CommandOptions, b as CommandResult, D as DaytonaProviderOptions, c as DaytonaSandboxOptions, E as E2bProviderOptions, d as E2bSandboxOptions, G as GitCloneOptions, L as LocalDockerProviderOptions, e as LocalDockerSandboxOptions, M as ModalProviderOptions, f as ModalSandboxOptions, S as Sandbox, g as SandboxDescriptor, h as SandboxListOptions, i as SandboxOptions, j as SandboxOptionsBase, k as SandboxOptionsMap, l as SandboxProviderName, m as SandboxRaw, n as SandboxRawMap, o as SandboxResourceSpec, T as TarballEntry, V as VercelGitSource, p as VercelProviderOptions, q as VercelSandboxOptions } from './Sandbox-K6VNqKeo.js';
|
|
4
4
|
export { SandboxAdapter, buildGitCloneCommand } from './sandboxes/index.js';
|
package/dist/index.js
CHANGED
|
@@ -345,6 +345,19 @@ interface AgentOptionsBase {
|
|
|
345
345
|
sandbox?: Sandbox;
|
|
346
346
|
cwd?: string;
|
|
347
347
|
env?: Record<string, string>;
|
|
348
|
+
/**
|
|
349
|
+
* When `true`, wire RTK (rust-token-killer, https://github.com/rtk-ai/rtk)
|
|
350
|
+
* into the agent so its bash commands flow through `rtk rewrite` to trim
|
|
351
|
+
* output and save tokens. The `rtk` binary must be installed on PATH
|
|
352
|
+
* inside the sandbox (or on the host, for non-sandbox runs).
|
|
353
|
+
*
|
|
354
|
+
* Activation happens during {@link Agent.setup}: agentbox shells out to
|
|
355
|
+
* `rtk init -g [...]` with environment variables that redirect RTK's
|
|
356
|
+
* writes into the agentbox-managed config layout (so the hook persists
|
|
357
|
+
* past the agent CLI's own settings rewrites). Idempotent — `rtk init`
|
|
358
|
+
* is a no-op when already active. Toggle invalidates the setup cache.
|
|
359
|
+
*/
|
|
360
|
+
enableRtk?: boolean;
|
|
348
361
|
approvalMode?: AgentApprovalMode;
|
|
349
362
|
mcps?: AgentMcpConfig[];
|
|
350
363
|
skills?: AgentSkillConfig[];
|