agentbox-sdk 0.1.522 → 0.1.600
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/README.md +11 -0
- package/dist/agents/index.d.ts +2 -2
- package/dist/agents/index.js +2 -2
- package/dist/{chunk-ZQUE5KT6.js → chunk-OGV5XZWI.js} +1 -1
- package/dist/{chunk-EQ5AFLAW.js → chunk-RSURGSVM.js} +124 -109
- package/dist/events/index.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/sandboxes/index.js +2 -2
- package/dist/{types-DM6zUiv1.d.ts → types-ChkpU7Lf.d.ts} +3 -0
- package/package.json +3 -1
- /package/dist/{chunk-D4LSWCFA.js → chunk-55PSWQJZ.js} +0 -0
package/README.md
CHANGED
|
@@ -746,6 +746,17 @@ each run in its own process group can set `processGroup: "inherited"`; that
|
|
|
746
746
|
supervisor is then responsible for stopping the complete group before reporting
|
|
747
747
|
that a run has stopped. This option is unavailable for cloud sandboxes.
|
|
748
748
|
|
|
749
|
+
On Windows, host CLIs start through cross-spawn without a shell: it resolves
|
|
750
|
+
`PATHEXT` and script shebangs, and escapes the arguments `cmd.exe` sees when the
|
|
751
|
+
binary is a batch shim. Windows has no process groups or signals, so stopping a
|
|
752
|
+
host CLI ends its whole process tree with `taskkill /T /F`; a supervisor using
|
|
753
|
+
`processGroup: "inherited"` there still owns everything the tree left behind
|
|
754
|
+
(for example through a Job Object).
|
|
755
|
+
|
|
756
|
+
`provider.args` passes native CLI flags for a run without touching the user's
|
|
757
|
+
configuration. Codex places them before its subcommand (`["-c", "key=value"]`);
|
|
758
|
+
Claude Code accepts `--name` and `--name=value` entries.
|
|
759
|
+
|
|
749
760
|
## Packaging
|
|
750
761
|
|
|
751
762
|
`npm pack` builds the package from maintained TypeScript source before creating
|
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, al as RawAgentEvent, b as AgentAttachRequest, B as AttachedRun, as as SetupLayout, ay as UserContent } 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, y as AgentUserAnswer, z as AgentUserQuestion, E as ClaudeCodeAgentOptions, F as ClaudeCodeHookConfig, G as ClaudeCodeHookEvent, H as ClaudeCodeHookHandler, I as ClaudeCodeHookMatcherGroup, J as ClaudeCodeHooksConfig, K as ClaudeCodeProviderOptions, L as CodexAgentOptions, M as CodexCommandHook, N as CodexHookEvent, O as CodexHookMatcherGroup, P as CodexHooksConfig, Q as CodexModelProviderConfig, R as CodexProviderOptions, S as CodexSkillEntry, T as DataContent, U as EmbeddedSkillConfig, V as FilePart, W as HarnessCommandDescriptor, X as HarnessCommandInvocation, Y as HarnessCommandSource, _ as ImagePart, $ as MAX_HARNESS_COMMANDS, a0 as MAX_HARNESS_COMMAND_ARGUMENT_HINT, a1 as MAX_HARNESS_COMMAND_DESCRIPTION, a2 as MAX_HARNESS_COMMAND_NAME, a6 as NativeParkBackgroundWork, ab as OpenCodeAgentOptions, ac as OpenCodeCommandEntry, ad as OpenCodePluginConfig, ae as OpenCodePluginEvent, af as OpenCodePluginHookConfig, ag as OpenCodeProviderOptions, ah as OpenCodeSkillEntry, ai as OpenRouterPlugin, an as RepoSkillConfig, au as TextPart, az as UserContentPart, aA as builtinHarnessCommands, aB as claudeHarnessCommands, aC as codexHarnessCommands, aD as codexSkillMention, aG as openCodeHarnessCommands, aH as parseHarnessCommandInvocation, aI as skillDirective } from '../types-
|
|
1
|
+
import { o as AgentProviderName, h as AgentOptions, t as AgentRunConfig, s as AgentRun, r as AgentResult, al as RawAgentEvent, b as AgentAttachRequest, B as AttachedRun, as as SetupLayout, ay as UserContent } from '../types-ChkpU7Lf.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, y as AgentUserAnswer, z as AgentUserQuestion, E as ClaudeCodeAgentOptions, F as ClaudeCodeHookConfig, G as ClaudeCodeHookEvent, H as ClaudeCodeHookHandler, I as ClaudeCodeHookMatcherGroup, J as ClaudeCodeHooksConfig, K as ClaudeCodeProviderOptions, L as CodexAgentOptions, M as CodexCommandHook, N as CodexHookEvent, O as CodexHookMatcherGroup, P as CodexHooksConfig, Q as CodexModelProviderConfig, R as CodexProviderOptions, S as CodexSkillEntry, T as DataContent, U as EmbeddedSkillConfig, V as FilePart, W as HarnessCommandDescriptor, X as HarnessCommandInvocation, Y as HarnessCommandSource, _ as ImagePart, $ as MAX_HARNESS_COMMANDS, a0 as MAX_HARNESS_COMMAND_ARGUMENT_HINT, a1 as MAX_HARNESS_COMMAND_DESCRIPTION, a2 as MAX_HARNESS_COMMAND_NAME, a6 as NativeParkBackgroundWork, ab as OpenCodeAgentOptions, ac as OpenCodeCommandEntry, ad as OpenCodePluginConfig, ae as OpenCodePluginEvent, af as OpenCodePluginHookConfig, ag as OpenCodeProviderOptions, ah as OpenCodeSkillEntry, ai as OpenRouterPlugin, an as RepoSkillConfig, au as TextPart, az as UserContentPart, aA as builtinHarnessCommands, aB as claudeHarnessCommands, aC as codexHarnessCommands, aD as codexSkillMention, aG as openCodeHarnessCommands, aH as parseHarnessCommandInvocation, aI as skillDirective } from '../types-ChkpU7Lf.js';
|
|
3
3
|
import { S as Sandbox } from '../Sandbox-DcKAU-E3.js';
|
|
4
4
|
export { AgentProvider } from '../enums.js';
|
|
5
5
|
import 'e2b';
|
package/dist/agents/index.js
CHANGED
|
@@ -15,12 +15,12 @@ import {
|
|
|
15
15
|
parseHarnessCommandInvocation,
|
|
16
16
|
resolveHarnessCommand,
|
|
17
17
|
skillDirective
|
|
18
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-RSURGSVM.js";
|
|
19
19
|
import "../chunk-AE2FQ6YU.js";
|
|
20
20
|
import {
|
|
21
21
|
AGENT_RESERVED_PORTS,
|
|
22
22
|
collectAllAgentReservedPorts
|
|
23
|
-
} from "../chunk-
|
|
23
|
+
} from "../chunk-55PSWQJZ.js";
|
|
24
24
|
import "../chunk-NSJM57Z4.js";
|
|
25
25
|
import {
|
|
26
26
|
AgentProvider
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
sleep,
|
|
21
21
|
time,
|
|
22
22
|
waitFor
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-55PSWQJZ.js";
|
|
24
24
|
import {
|
|
25
25
|
shellQuote
|
|
26
26
|
} from "./chunk-NSJM57Z4.js";
|
|
@@ -31,23 +31,30 @@ import {
|
|
|
31
31
|
|
|
32
32
|
// src/agents/Agent.ts
|
|
33
33
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
34
|
-
import
|
|
34
|
+
import path12 from "path";
|
|
35
35
|
|
|
36
36
|
// src/agents/providers/claude-code.ts
|
|
37
37
|
import { randomUUID } from "crypto";
|
|
38
38
|
|
|
39
39
|
// src/agents/transports/spawn.ts
|
|
40
|
-
import { spawn } from "child_process";
|
|
40
|
+
import { execFile, spawn } from "child_process";
|
|
41
|
+
import path from "path";
|
|
41
42
|
import { createInterface } from "readline";
|
|
43
|
+
import crossSpawn from "cross-spawn";
|
|
44
|
+
var windows = process.platform === "win32";
|
|
45
|
+
function killWindowsTree(pid) {
|
|
46
|
+
const taskkill = path.join(process.env.SystemRoot ?? "C:\\Windows", "System32", "taskkill.exe");
|
|
47
|
+
execFile(taskkill, ["/pid", String(pid), "/T", "/F"], { windowsHide: true }, () => void 0);
|
|
48
|
+
}
|
|
42
49
|
function spawnCommand(options) {
|
|
43
|
-
const
|
|
50
|
+
const spawnOptions = {
|
|
44
51
|
cwd: options.cwd,
|
|
45
52
|
env: options.env,
|
|
46
53
|
stdio: "pipe",
|
|
47
|
-
shell: process.platform === "win32",
|
|
48
54
|
windowsHide: true,
|
|
49
|
-
detached: options.processGroup === true &&
|
|
50
|
-
}
|
|
55
|
+
detached: options.processGroup === true && !windows
|
|
56
|
+
};
|
|
57
|
+
const child = (windows ? crossSpawn : spawn)(options.command, options.args ?? [], spawnOptions);
|
|
51
58
|
const exitPromise = new Promise((resolve, reject) => {
|
|
52
59
|
child.once("error", reject);
|
|
53
60
|
child.once("close", (code) => resolve(code ?? 0));
|
|
@@ -56,7 +63,8 @@ function spawnCommand(options) {
|
|
|
56
63
|
let killPromise;
|
|
57
64
|
const signalProcess = (signal) => {
|
|
58
65
|
try {
|
|
59
|
-
if (
|
|
66
|
+
if (windows && child.pid) killWindowsTree(child.pid);
|
|
67
|
+
else if (options.processGroup && child.pid) process.kill(-child.pid, signal);
|
|
60
68
|
else child.kill(signal);
|
|
61
69
|
} catch (error) {
|
|
62
70
|
if (error.code !== "ESRCH") throw error;
|
|
@@ -81,7 +89,7 @@ function spawnCommand(options) {
|
|
|
81
89
|
kill: (signal = "SIGTERM") => killPromise ??= (async () => {
|
|
82
90
|
signalProcess(signal);
|
|
83
91
|
if (await waitForExit(options.terminationTimeoutMs ?? 3e3)) {
|
|
84
|
-
if (options.processGroup &&
|
|
92
|
+
if (options.processGroup && !windows) signalProcess("SIGKILL");
|
|
85
93
|
return;
|
|
86
94
|
}
|
|
87
95
|
signalProcess("SIGKILL");
|
|
@@ -101,7 +109,7 @@ async function* linesFromNodeStream(stream) {
|
|
|
101
109
|
}
|
|
102
110
|
|
|
103
111
|
// src/agents/providers/claude-code.ts
|
|
104
|
-
import
|
|
112
|
+
import path9 from "path";
|
|
105
113
|
|
|
106
114
|
// src/agents/harness-commands.ts
|
|
107
115
|
var MAX_HARNESS_COMMANDS = 500;
|
|
@@ -454,7 +462,7 @@ function questionReply(provider, input, answers) {
|
|
|
454
462
|
|
|
455
463
|
// src/agents/input.ts
|
|
456
464
|
import { readFile } from "fs/promises";
|
|
457
|
-
import
|
|
465
|
+
import path2 from "path";
|
|
458
466
|
import { fileURLToPath } from "url";
|
|
459
467
|
var IMAGE_MEDIA_TYPE_BY_EXTENSION = {
|
|
460
468
|
".gif": "image/gif",
|
|
@@ -794,7 +802,7 @@ async function resolveUrlContent(url, options) {
|
|
|
794
802
|
const buffer = await readFile(filePath);
|
|
795
803
|
return {
|
|
796
804
|
mediaType: resolveMediaType(filePath, options),
|
|
797
|
-
filename: options.filename ??
|
|
805
|
+
filename: options.filename ?? path2.basename(filePath),
|
|
798
806
|
source: {
|
|
799
807
|
type: "base64",
|
|
800
808
|
data: buffer.toString("base64")
|
|
@@ -843,11 +851,11 @@ function resolveMediaType(pathname, options, parsedMediaType) {
|
|
|
843
851
|
);
|
|
844
852
|
}
|
|
845
853
|
function inferMediaType(pathname) {
|
|
846
|
-
const extension =
|
|
854
|
+
const extension = path2.extname(pathname).toLowerCase();
|
|
847
855
|
return FILE_MEDIA_TYPE_BY_EXTENSION[extension];
|
|
848
856
|
}
|
|
849
857
|
function inferFilename(pathname) {
|
|
850
|
-
const name =
|
|
858
|
+
const name = path2.basename(pathname);
|
|
851
859
|
return name && name !== "." ? name : void 0;
|
|
852
860
|
}
|
|
853
861
|
function parseStructuredUrl(value) {
|
|
@@ -890,7 +898,7 @@ function isClaudeTextLikeMediaType(mediaType) {
|
|
|
890
898
|
}
|
|
891
899
|
|
|
892
900
|
// src/agents/config/commands.ts
|
|
893
|
-
import
|
|
901
|
+
import path3 from "path";
|
|
894
902
|
function buildFrontmatter(values) {
|
|
895
903
|
const lines = Object.entries(values).filter(([, value]) => value !== void 0).map(([key, value]) => `${key}: ${JSON.stringify(value)}`);
|
|
896
904
|
return lines.length > 0 ? `---
|
|
@@ -901,7 +909,7 @@ ${lines.join("\n")}
|
|
|
901
909
|
}
|
|
902
910
|
function buildClaudeCommandArtifacts(commands, layout) {
|
|
903
911
|
return (commands ?? []).map((command) => ({
|
|
904
|
-
path:
|
|
912
|
+
path: path3.join(layout.claudeDir, "commands", `${command.name}.md`),
|
|
905
913
|
content: buildFrontmatter({
|
|
906
914
|
description: command.description
|
|
907
915
|
}) + command.template
|
|
@@ -936,7 +944,7 @@ function assertCommandsSupported(provider, commands) {
|
|
|
936
944
|
}
|
|
937
945
|
|
|
938
946
|
// src/agents/config/hooks.ts
|
|
939
|
-
import
|
|
947
|
+
import path4 from "path";
|
|
940
948
|
function hasHookEntries(hooks) {
|
|
941
949
|
if (!hooks || typeof hooks !== "object") {
|
|
942
950
|
return false;
|
|
@@ -1049,7 +1057,7 @@ function buildOpenCodePluginArtifacts(plugins, opencodeDir) {
|
|
|
1049
1057
|
}
|
|
1050
1058
|
seenFileNames.add(fileName);
|
|
1051
1059
|
return {
|
|
1052
|
-
path:
|
|
1060
|
+
path: path4.join(opencodeDir, "plugins", fileName),
|
|
1053
1061
|
content: buildOpenCodePluginSource(plugin)
|
|
1054
1062
|
};
|
|
1055
1063
|
});
|
|
@@ -1296,7 +1304,7 @@ function buildCodexConfigToml(opts = {}) {
|
|
|
1296
1304
|
// src/agents/config/setup.ts
|
|
1297
1305
|
import { mkdir, chmod, rm, writeFile } from "fs/promises";
|
|
1298
1306
|
import os from "os";
|
|
1299
|
-
import
|
|
1307
|
+
import path5 from "path";
|
|
1300
1308
|
function shortLabel(command) {
|
|
1301
1309
|
const oneLine = command.replace(/\s+/g, " ").trim();
|
|
1302
1310
|
return oneLine.length > 60 ? `${oneLine.slice(0, 60)}\u2026` : oneLine;
|
|
@@ -1304,21 +1312,21 @@ function shortLabel(command) {
|
|
|
1304
1312
|
function agentboxRoot(provider, hasSandbox = true, stateDirectory) {
|
|
1305
1313
|
if (stateDirectory !== void 0) {
|
|
1306
1314
|
if (hasSandbox) throw new Error("stateDirectory is only supported for host execution.");
|
|
1307
|
-
if (!
|
|
1308
|
-
return
|
|
1315
|
+
if (!path5.isAbsolute(stateDirectory)) throw new Error("stateDirectory must be an absolute path.");
|
|
1316
|
+
return path5.join(stateDirectory, provider);
|
|
1309
1317
|
}
|
|
1310
|
-
return hasSandbox ? `/tmp/agentbox/${provider}` :
|
|
1318
|
+
return hasSandbox ? `/tmp/agentbox/${provider}` : path5.join(os.tmpdir(), `agentbox-${provider}`);
|
|
1311
1319
|
}
|
|
1312
1320
|
function getAgentLayout(rootDir) {
|
|
1313
|
-
const xdgConfigHome =
|
|
1321
|
+
const xdgConfigHome = path5.join(rootDir, ".config");
|
|
1314
1322
|
return {
|
|
1315
1323
|
rootDir,
|
|
1316
1324
|
homeDir: rootDir,
|
|
1317
1325
|
xdgConfigHome,
|
|
1318
|
-
agentsDir:
|
|
1319
|
-
claudeDir:
|
|
1320
|
-
opencodeDir:
|
|
1321
|
-
codexDir:
|
|
1326
|
+
agentsDir: path5.join(rootDir, ".agents"),
|
|
1327
|
+
claudeDir: path5.join(rootDir, ".claude"),
|
|
1328
|
+
opencodeDir: path5.join(xdgConfigHome, "opencode"),
|
|
1329
|
+
codexDir: path5.join(rootDir, ".codex")
|
|
1322
1330
|
};
|
|
1323
1331
|
}
|
|
1324
1332
|
function buildLayoutEnv(provider, layout) {
|
|
@@ -1329,7 +1337,7 @@ function buildLayoutEnv(provider, layout) {
|
|
|
1329
1337
|
return { CODEX_HOME: layout.codexDir };
|
|
1330
1338
|
case "open-code":
|
|
1331
1339
|
return {
|
|
1332
|
-
OPENCODE_CONFIG:
|
|
1340
|
+
OPENCODE_CONFIG: path5.join(layout.opencodeDir, "agentbox.json"),
|
|
1333
1341
|
OPENCODE_CONFIG_DIR: layout.opencodeDir
|
|
1334
1342
|
};
|
|
1335
1343
|
}
|
|
@@ -1359,7 +1367,7 @@ var HostSetupTarget = class {
|
|
|
1359
1367
|
async () => {
|
|
1360
1368
|
await Promise.all(
|
|
1361
1369
|
files.map(async (entry) => {
|
|
1362
|
-
await mkdir(
|
|
1370
|
+
await mkdir(path5.dirname(entry.path), { recursive: true, mode: 448 });
|
|
1363
1371
|
const content = typeof entry.content === "string" ? entry.content : entry.content;
|
|
1364
1372
|
await writeFile(entry.path, content, { mode: entry.mode ?? 384 });
|
|
1365
1373
|
if (entry.mode && (entry.mode & 73) !== 0) {
|
|
@@ -1578,7 +1586,7 @@ async function activateRtk(target) {
|
|
|
1578
1586
|
|
|
1579
1587
|
// src/agents/config/setup-manifest.ts
|
|
1580
1588
|
import { createHash } from "crypto";
|
|
1581
|
-
import
|
|
1589
|
+
import path6 from "path";
|
|
1582
1590
|
var MANIFEST_FILENAME = "setup-manifest.json";
|
|
1583
1591
|
var TARGET_MANIFEST_FILENAME = "setup-target.json";
|
|
1584
1592
|
var INSTALL_SCRIPT_FILENAME = "install.sh";
|
|
@@ -1632,7 +1640,7 @@ async function preflightSetup(target, setupId, daemon) {
|
|
|
1632
1640
|
debugSetup,
|
|
1633
1641
|
`preflightSetup ${target.provider}`,
|
|
1634
1642
|
async () => {
|
|
1635
|
-
const setupIdFile =
|
|
1643
|
+
const setupIdFile = path6.posix.join(
|
|
1636
1644
|
target.layout.rootDir,
|
|
1637
1645
|
SETUP_ID_FILENAME
|
|
1638
1646
|
);
|
|
@@ -1660,7 +1668,7 @@ async function preflightSetup(target, setupId, daemon) {
|
|
|
1660
1668
|
}
|
|
1661
1669
|
async function markSetupComplete(target, setupId) {
|
|
1662
1670
|
await time(debugSetup, `markSetupComplete ${target.provider}`, async () => {
|
|
1663
|
-
const setupIdFile =
|
|
1671
|
+
const setupIdFile = path6.posix.join(
|
|
1664
1672
|
target.layout.rootDir,
|
|
1665
1673
|
SETUP_ID_FILENAME
|
|
1666
1674
|
);
|
|
@@ -1763,19 +1771,19 @@ async function applyDifferentialSetup(target, artifacts, installCommands) {
|
|
|
1763
1771
|
mode: artifact.executable ? 493 : 420
|
|
1764
1772
|
})),
|
|
1765
1773
|
{
|
|
1766
|
-
path:
|
|
1774
|
+
path: path6.posix.join(rootDir, TARGET_MANIFEST_FILENAME),
|
|
1767
1775
|
content: JSON.stringify(targetForSandbox),
|
|
1768
1776
|
mode: 420
|
|
1769
1777
|
},
|
|
1770
1778
|
{
|
|
1771
|
-
path:
|
|
1779
|
+
path: path6.posix.join(rootDir, INSTALL_SCRIPT_FILENAME),
|
|
1772
1780
|
content: buildInstallScript(rootDir, installCommandsByKey),
|
|
1773
1781
|
mode: 493
|
|
1774
1782
|
}
|
|
1775
1783
|
];
|
|
1776
1784
|
await target.uploadAndRun(
|
|
1777
1785
|
tarballEntries,
|
|
1778
|
-
`bash ${shellQuote(
|
|
1786
|
+
`bash ${shellQuote(path6.posix.join(rootDir, INSTALL_SCRIPT_FILENAME))}`
|
|
1779
1787
|
);
|
|
1780
1788
|
},
|
|
1781
1789
|
() => ({
|
|
@@ -1786,15 +1794,15 @@ async function applyDifferentialSetup(target, artifacts, installCommands) {
|
|
|
1786
1794
|
}
|
|
1787
1795
|
|
|
1788
1796
|
// src/agents/config/skills.ts
|
|
1789
|
-
import
|
|
1797
|
+
import path7 from "path";
|
|
1790
1798
|
function getSkillTargetDir(provider, layout, skillName) {
|
|
1791
1799
|
switch (provider) {
|
|
1792
1800
|
case AgentProvider.ClaudeCode:
|
|
1793
|
-
return
|
|
1801
|
+
return path7.join(layout.claudeDir, "skills", skillName);
|
|
1794
1802
|
case AgentProvider.OpenCode:
|
|
1795
|
-
return
|
|
1803
|
+
return path7.join(layout.opencodeDir, "skills", skillName);
|
|
1796
1804
|
case AgentProvider.Codex:
|
|
1797
|
-
return
|
|
1805
|
+
return path7.join(layout.codexDir, "skills", skillName);
|
|
1798
1806
|
}
|
|
1799
1807
|
}
|
|
1800
1808
|
function skillsCliAgentName(provider) {
|
|
@@ -1810,7 +1818,7 @@ async function prepareSkillArtifacts(provider, skills, layout) {
|
|
|
1810
1818
|
const preparedSkills = [];
|
|
1811
1819
|
for (const skill of skills ?? []) {
|
|
1812
1820
|
const targetDir = getSkillTargetDir(provider, layout, skill.name);
|
|
1813
|
-
const skillFilePath =
|
|
1821
|
+
const skillFilePath = path7.join(targetDir, "SKILL.md");
|
|
1814
1822
|
if (!("files" in skill)) {
|
|
1815
1823
|
installCommands.push(buildSkillsInstallerCommand(provider, skill));
|
|
1816
1824
|
preparedSkills.push({ name: skill.name, skillFilePath });
|
|
@@ -1818,7 +1826,7 @@ async function prepareSkillArtifacts(provider, skills, layout) {
|
|
|
1818
1826
|
}
|
|
1819
1827
|
for (const [relativePath, content] of Object.entries(skill.files)) {
|
|
1820
1828
|
artifacts.push({
|
|
1821
|
-
path:
|
|
1829
|
+
path: path7.join(targetDir, relativePath),
|
|
1822
1830
|
content,
|
|
1823
1831
|
executable: relativePath.startsWith("scripts/")
|
|
1824
1832
|
});
|
|
@@ -1833,7 +1841,7 @@ async function prepareSkillArtifacts(provider, skills, layout) {
|
|
|
1833
1841
|
}
|
|
1834
1842
|
|
|
1835
1843
|
// src/agents/config/subagents.ts
|
|
1836
|
-
import
|
|
1844
|
+
import path8 from "path";
|
|
1837
1845
|
function toToolsArray(tools) {
|
|
1838
1846
|
const filtered = tools?.map((tool) => tool.trim()).filter(Boolean);
|
|
1839
1847
|
return filtered && filtered.length > 0 ? filtered : void 0;
|
|
@@ -1863,7 +1871,7 @@ ${frontmatterLines.join("\n")}
|
|
|
1863
1871
|
${subAgent.instructions.trim()}
|
|
1864
1872
|
`;
|
|
1865
1873
|
return {
|
|
1866
|
-
path:
|
|
1874
|
+
path: path8.join(layout.claudeDir, "agents", `${subAgent.name}.md`),
|
|
1867
1875
|
content
|
|
1868
1876
|
};
|
|
1869
1877
|
});
|
|
@@ -1901,7 +1909,7 @@ function buildCodexSubagentArtifacts(subAgents, layout, defaultModel) {
|
|
|
1901
1909
|
const roleConfigRelativePath = `./agents/${subAgent.name}.toml`;
|
|
1902
1910
|
const roleConfigPromptPath = `../prompts/${subAgent.name}.md`;
|
|
1903
1911
|
artifacts.push({
|
|
1904
|
-
path:
|
|
1912
|
+
path: path8.join(layout.codexDir, "prompts", `${subAgent.name}.md`),
|
|
1905
1913
|
content: subAgent.instructions
|
|
1906
1914
|
});
|
|
1907
1915
|
const tomlLines = [
|
|
@@ -1919,7 +1927,7 @@ function buildCodexSubagentArtifacts(subAgents, layout, defaultModel) {
|
|
|
1919
1927
|
""
|
|
1920
1928
|
);
|
|
1921
1929
|
artifacts.push({
|
|
1922
|
-
path:
|
|
1930
|
+
path: path8.join(layout.codexDir, "agents", `${subAgent.name}.toml`),
|
|
1923
1931
|
content: tomlLines.join("\n")
|
|
1924
1932
|
});
|
|
1925
1933
|
agentSections.push(
|
|
@@ -2608,7 +2616,7 @@ var DAEMON_TOKEN_PATH = "/tmp/agentbox/claude-code/daemon-token";
|
|
|
2608
2616
|
var DAEMON_READY_TIMEOUT_MS = 3e4;
|
|
2609
2617
|
var DAEMON_READY_POLL_INTERVAL_MS = 250;
|
|
2610
2618
|
function claudeConfigDir(options) {
|
|
2611
|
-
return
|
|
2619
|
+
return path9.join(
|
|
2612
2620
|
agentboxRoot(
|
|
2613
2621
|
AgentProvider.ClaudeCode,
|
|
2614
2622
|
Boolean(options.sandbox),
|
|
@@ -2626,7 +2634,9 @@ function buildClaudeQueryOptions(params) {
|
|
|
2626
2634
|
for (const arg of provider?.args ?? []) {
|
|
2627
2635
|
if (typeof arg !== "string") continue;
|
|
2628
2636
|
if (arg.startsWith("--")) {
|
|
2629
|
-
|
|
2637
|
+
const separator = arg.indexOf("=");
|
|
2638
|
+
if (separator === -1) extraArgs[arg.slice(2)] = null;
|
|
2639
|
+
else extraArgs[arg.slice(2, separator)] = arg.slice(separator + 1);
|
|
2630
2640
|
}
|
|
2631
2641
|
}
|
|
2632
2642
|
if (run.systemPrompt) {
|
|
@@ -3418,7 +3428,7 @@ async function ensureClaudeCodeDaemonUncached(options, env) {
|
|
|
3418
3428
|
DAEMON_TOKEN_PATH,
|
|
3419
3429
|
true
|
|
3420
3430
|
);
|
|
3421
|
-
const daemonDir =
|
|
3431
|
+
const daemonDir = path9.posix.dirname(DAEMON_PATH);
|
|
3422
3432
|
const daemonNodeModules = `${daemonDir}/node_modules/@anthropic-ai`;
|
|
3423
3433
|
const launchCommand = [
|
|
3424
3434
|
`NPM_ROOT="$(npm root -g 2>/dev/null)"`,
|
|
@@ -3518,30 +3528,35 @@ async function fetchWithDaemonRetry(input, init) {
|
|
|
3518
3528
|
async function* parseNdjsonStream(body) {
|
|
3519
3529
|
const reader = body.getReader();
|
|
3520
3530
|
const decoder = new TextDecoder();
|
|
3521
|
-
let
|
|
3522
|
-
|
|
3523
|
-
const { done, value } = await reader.read();
|
|
3524
|
-
if (done) break;
|
|
3525
|
-
buffer += decoder.decode(value, { stream: true });
|
|
3526
|
-
let idx;
|
|
3527
|
-
while ((idx = buffer.indexOf("\n")) !== -1) {
|
|
3528
|
-
const line = buffer.slice(0, idx).trim();
|
|
3529
|
-
buffer = buffer.slice(idx + 1);
|
|
3530
|
-
if (line) {
|
|
3531
|
-
try {
|
|
3532
|
-
yield JSON.parse(line);
|
|
3533
|
-
} catch {
|
|
3534
|
-
}
|
|
3535
|
-
}
|
|
3536
|
-
}
|
|
3537
|
-
}
|
|
3538
|
-
buffer += decoder.decode();
|
|
3539
|
-
if (buffer.trim()) {
|
|
3531
|
+
let pending = [];
|
|
3532
|
+
const parse = (line) => {
|
|
3540
3533
|
try {
|
|
3541
|
-
|
|
3534
|
+
return { value: JSON.parse(line) };
|
|
3542
3535
|
} catch {
|
|
3536
|
+
return void 0;
|
|
3543
3537
|
}
|
|
3544
|
-
}
|
|
3538
|
+
};
|
|
3539
|
+
while (true) {
|
|
3540
|
+
const { done, value } = await reader.read();
|
|
3541
|
+
if (done) break;
|
|
3542
|
+
const text2 = decoder.decode(value, { stream: true });
|
|
3543
|
+
let start = 0;
|
|
3544
|
+
let idx = text2.indexOf("\n");
|
|
3545
|
+
while (idx !== -1) {
|
|
3546
|
+
pending.push(text2.slice(start, idx));
|
|
3547
|
+
const line = pending.join("").trim();
|
|
3548
|
+
pending = [];
|
|
3549
|
+
start = idx + 1;
|
|
3550
|
+
const parsed2 = line ? parse(line) : void 0;
|
|
3551
|
+
if (parsed2) yield parsed2.value;
|
|
3552
|
+
idx = text2.indexOf("\n", start);
|
|
3553
|
+
}
|
|
3554
|
+
if (start < text2.length) pending.push(text2.slice(start));
|
|
3555
|
+
}
|
|
3556
|
+
pending.push(decoder.decode());
|
|
3557
|
+
const tail = pending.join("").trim();
|
|
3558
|
+
const parsed = tail ? parse(tail) : void 0;
|
|
3559
|
+
if (parsed) yield parsed.value;
|
|
3545
3560
|
}
|
|
3546
3561
|
async function daemonBaseUrl(sandbox) {
|
|
3547
3562
|
const url = await sandbox.getPreviewLink(DAEMON_PORT);
|
|
@@ -3586,8 +3601,8 @@ var ClaudeCodeAgentAdapter = class {
|
|
|
3586
3601
|
const provider = request.provider;
|
|
3587
3602
|
const sandbox = options.sandbox;
|
|
3588
3603
|
const target = await createSetupTarget(provider, "shared-setup", options);
|
|
3589
|
-
const settingsPath =
|
|
3590
|
-
const mcpConfigPath =
|
|
3604
|
+
const settingsPath = path9.join(target.layout.claudeDir, "settings.json");
|
|
3605
|
+
const mcpConfigPath = path9.join(
|
|
3591
3606
|
target.layout.claudeDir,
|
|
3592
3607
|
"agentbox-mcp.json"
|
|
3593
3608
|
);
|
|
@@ -3611,7 +3626,7 @@ var ClaudeCodeAgentAdapter = class {
|
|
|
3611
3626
|
const artifacts = [
|
|
3612
3627
|
...!sandbox ? [
|
|
3613
3628
|
{
|
|
3614
|
-
path:
|
|
3629
|
+
path: path9.join(
|
|
3615
3630
|
target.layout.claudeDir,
|
|
3616
3631
|
".claude-plugin",
|
|
3617
3632
|
"plugin.json"
|
|
@@ -3668,8 +3683,8 @@ var ClaudeCodeAgentAdapter = class {
|
|
|
3668
3683
|
return;
|
|
3669
3684
|
}
|
|
3670
3685
|
const claudeDir = claudeConfigDir(request.options);
|
|
3671
|
-
const settingsPath =
|
|
3672
|
-
const mcpConfigPath =
|
|
3686
|
+
const settingsPath = path9.join(claudeDir, "settings.json");
|
|
3687
|
+
const mcpConfigPath = path9.join(claudeDir, "agentbox-mcp.json");
|
|
3673
3688
|
const env = {
|
|
3674
3689
|
...request.options.env ?? {},
|
|
3675
3690
|
CLAUDE_CONFIG_DIR: claudeDir,
|
|
@@ -4427,8 +4442,8 @@ async function executeNativeClaude(request, sink, wait = {}) {
|
|
|
4427
4442
|
const options = buildClaudeQueryOptions({
|
|
4428
4443
|
request,
|
|
4429
4444
|
...request.options.configuration === "native" ? {} : {
|
|
4430
|
-
settingsPath:
|
|
4431
|
-
mcpConfigPath:
|
|
4445
|
+
settingsPath: path9.join(claudeDir, "settings.json"),
|
|
4446
|
+
mcpConfigPath: path9.join(claudeDir, "agentbox-mcp.json")
|
|
4432
4447
|
},
|
|
4433
4448
|
// Auth is deliberately CLI-owned. Never copy the user's credential files
|
|
4434
4449
|
// into the generated configuration directory or a task artifact.
|
|
@@ -4625,7 +4640,7 @@ async function executeNativeClaude(request, sink, wait = {}) {
|
|
|
4625
4640
|
|
|
4626
4641
|
// src/agents/providers/codex.ts
|
|
4627
4642
|
import crypto2 from "crypto";
|
|
4628
|
-
import
|
|
4643
|
+
import path10 from "path";
|
|
4629
4644
|
|
|
4630
4645
|
// src/agents/transports/app-server.ts
|
|
4631
4646
|
import { createParser } from "eventsource-parser";
|
|
@@ -4844,7 +4859,7 @@ var JsonRpcLineClient = class {
|
|
|
4844
4859
|
|
|
4845
4860
|
// src/agents/providers/codex.ts
|
|
4846
4861
|
function codexConfigDir(options) {
|
|
4847
|
-
return
|
|
4862
|
+
return path10.join(
|
|
4848
4863
|
agentboxRoot(AgentProvider.Codex, Boolean(options.sandbox), options.stateDirectory),
|
|
4849
4864
|
".codex"
|
|
4850
4865
|
);
|
|
@@ -4853,7 +4868,7 @@ var REMOTE_CODEX_APP_SERVER_PORT = 43181;
|
|
|
4853
4868
|
var REMOTE_CODEX_APP_SERVER_ID = "shared-app-server";
|
|
4854
4869
|
var CODEX_APP_SERVER_TOKEN_FILENAME = "codex-app-server-token";
|
|
4855
4870
|
function defaultRemoteCodexTokenPath() {
|
|
4856
|
-
return
|
|
4871
|
+
return path10.posix.join(
|
|
4857
4872
|
agentboxRoot(AgentProvider.Codex, true),
|
|
4858
4873
|
CODEX_APP_SERVER_TOKEN_FILENAME
|
|
4859
4874
|
);
|
|
@@ -5084,12 +5099,15 @@ function shouldIgnoreCodexError(notification) {
|
|
|
5084
5099
|
return notification.params?.willRetry === true;
|
|
5085
5100
|
}
|
|
5086
5101
|
function buildCodexCommandArgs(binary, args, options) {
|
|
5102
|
+
return [...options?.configuration === "native" ? [] : ["-u", "XDG_CONFIG_HOME"], ...buildCodexCommand(binary, args, options)];
|
|
5103
|
+
}
|
|
5104
|
+
function buildCodexCommand(binary, args, options) {
|
|
5087
5105
|
const overrides = [];
|
|
5088
5106
|
if (options?.provider?.supportsWebsockets === false) {
|
|
5089
5107
|
overrides.push(["supports_websockets", "false"]);
|
|
5090
5108
|
}
|
|
5091
5109
|
const overrideArgs = overrides.flatMap(([k, v]) => ["-c", `${k}=${v}`]);
|
|
5092
|
-
return [...options?.
|
|
5110
|
+
return [binary, ...overrideArgs, ...options?.provider?.args ?? [], ...args];
|
|
5093
5111
|
}
|
|
5094
5112
|
function toNormalizedCodexEvents(runId, notification) {
|
|
5095
5113
|
const base = {
|
|
@@ -5312,7 +5330,7 @@ async function materializeCodexImage(options, part, index) {
|
|
|
5312
5330
|
throw new Error("Cannot attach an empty image to Codex.");
|
|
5313
5331
|
}
|
|
5314
5332
|
const root = agentboxRoot(AgentProvider.Codex, Boolean(options.sandbox), options.stateDirectory);
|
|
5315
|
-
const imagePath =
|
|
5333
|
+
const imagePath = path10.join(
|
|
5316
5334
|
root,
|
|
5317
5335
|
"inputs",
|
|
5318
5336
|
`codex-image-${index}-${crypto2.randomUUID()}${codexImageExtension(part.mediaType)}`
|
|
@@ -5331,7 +5349,7 @@ async function materializeCodexImage(options, part, index) {
|
|
|
5331
5349
|
return imagePath;
|
|
5332
5350
|
}
|
|
5333
5351
|
const fs = await import("fs/promises");
|
|
5334
|
-
await fs.mkdir(
|
|
5352
|
+
await fs.mkdir(path10.dirname(imagePath), { recursive: true });
|
|
5335
5353
|
await fs.writeFile(imagePath, data);
|
|
5336
5354
|
return imagePath;
|
|
5337
5355
|
}
|
|
@@ -5493,13 +5511,13 @@ async function setupCodex(request) {
|
|
|
5493
5511
|
const artifacts = [...subAgentArtifacts];
|
|
5494
5512
|
if (configToml) {
|
|
5495
5513
|
artifacts.push({
|
|
5496
|
-
path:
|
|
5514
|
+
path: path10.join(layoutTarget.layout.codexDir, "config.toml"),
|
|
5497
5515
|
content: configToml
|
|
5498
5516
|
});
|
|
5499
5517
|
}
|
|
5500
5518
|
if (hooksFile) {
|
|
5501
5519
|
artifacts.push({
|
|
5502
|
-
path:
|
|
5520
|
+
path: path10.join(layoutTarget.layout.codexDir, "hooks.json"),
|
|
5503
5521
|
content: JSON.stringify(hooksFile, null, 2)
|
|
5504
5522
|
});
|
|
5505
5523
|
}
|
|
@@ -5518,7 +5536,7 @@ async function setupCodex(request) {
|
|
|
5518
5536
|
...sharedTarget.env,
|
|
5519
5537
|
...options.provider?.env ?? {}
|
|
5520
5538
|
});
|
|
5521
|
-
const tokenFilePath =
|
|
5539
|
+
const tokenFilePath = path10.posix.join(
|
|
5522
5540
|
sharedTarget.layout.rootDir,
|
|
5523
5541
|
CODEX_APP_SERVER_TOKEN_FILENAME
|
|
5524
5542
|
);
|
|
@@ -5554,11 +5572,11 @@ async function setupCodex(request) {
|
|
|
5554
5572
|
);
|
|
5555
5573
|
await applyDifferentialSetup(sharedTarget, serverArtifacts, []);
|
|
5556
5574
|
const binary = options.provider?.binary ?? "codex";
|
|
5557
|
-
const pidFilePath =
|
|
5575
|
+
const pidFilePath = path10.posix.join(
|
|
5558
5576
|
sharedTarget.layout.rootDir,
|
|
5559
5577
|
"codex-app-server.pid"
|
|
5560
5578
|
);
|
|
5561
|
-
const logFilePath =
|
|
5579
|
+
const logFilePath = path10.posix.join(
|
|
5562
5580
|
sharedTarget.layout.rootDir,
|
|
5563
5581
|
"codex-app-server.log"
|
|
5564
5582
|
);
|
|
@@ -5659,7 +5677,7 @@ async function createRuntime(request, inputParts) {
|
|
|
5659
5677
|
...options.configuration === "native" ? {} : { CODEX_HOME: codexDir },
|
|
5660
5678
|
...options.provider?.env ?? {}
|
|
5661
5679
|
});
|
|
5662
|
-
const runtimeCwd = options.configuration === "native" ? options.cwd :
|
|
5680
|
+
const runtimeCwd = options.configuration === "native" ? options.cwd : path10.dirname(codexDir);
|
|
5663
5681
|
const inputItems = await buildCodexInputItems(options, inputParts);
|
|
5664
5682
|
const usesRemoteWebSocket = options.sandbox && options.sandbox.provider !== SandboxProvider.LocalDocker;
|
|
5665
5683
|
if (usesRemoteWebSocket && options.sandbox) {
|
|
@@ -5690,12 +5708,9 @@ async function createRuntime(request, inputParts) {
|
|
|
5690
5708
|
inputItems
|
|
5691
5709
|
};
|
|
5692
5710
|
}
|
|
5693
|
-
const
|
|
5694
|
-
options.provider?.binary ?? "codex",
|
|
5695
|
-
["app-server"],
|
|
5696
|
-
options
|
|
5697
|
-
);
|
|
5711
|
+
const binary = options.provider?.binary ?? "codex";
|
|
5698
5712
|
if (options.sandbox) {
|
|
5713
|
+
const codexArgs = buildCodexCommandArgs(binary, ["app-server"], options);
|
|
5699
5714
|
const handle = await options.sandbox.runAsync(["env", ...codexArgs], {
|
|
5700
5715
|
cwd: runtimeCwd,
|
|
5701
5716
|
env
|
|
@@ -5728,15 +5743,15 @@ async function createRuntime(request, inputParts) {
|
|
|
5728
5743
|
inputItems
|
|
5729
5744
|
};
|
|
5730
5745
|
}
|
|
5746
|
+
const [command, ...args] = buildCodexCommand(binary, ["app-server"], options);
|
|
5747
|
+
const hostEnv = { ...process.env, ...env };
|
|
5748
|
+
if (options.configuration !== "native") delete hostEnv.XDG_CONFIG_HOME;
|
|
5731
5749
|
const processHandle = spawnCommand({
|
|
5732
5750
|
processGroup: options.processGroup !== "inherited",
|
|
5733
|
-
command
|
|
5734
|
-
args
|
|
5751
|
+
command,
|
|
5752
|
+
args,
|
|
5735
5753
|
cwd: runtimeCwd,
|
|
5736
|
-
env:
|
|
5737
|
-
...process.env,
|
|
5738
|
-
...env
|
|
5739
|
-
}
|
|
5754
|
+
env: hostEnv
|
|
5740
5755
|
});
|
|
5741
5756
|
processHandle.child.stderr.resume();
|
|
5742
5757
|
return {
|
|
@@ -5774,7 +5789,7 @@ async function killCodexAppServer(request) {
|
|
|
5774
5789
|
REMOTE_CODEX_APP_SERVER_ID,
|
|
5775
5790
|
options
|
|
5776
5791
|
);
|
|
5777
|
-
const pidFilePath =
|
|
5792
|
+
const pidFilePath = path10.posix.join(
|
|
5778
5793
|
sharedTarget.layout.rootDir,
|
|
5779
5794
|
"codex-app-server.pid"
|
|
5780
5795
|
);
|
|
@@ -6332,14 +6347,14 @@ var CodexAgentAdapter = class {
|
|
|
6332
6347
|
// src/agents/providers/opencode.ts
|
|
6333
6348
|
import { createHash as createHash2, randomBytes, randomUUID as randomUUID2 } from "crypto";
|
|
6334
6349
|
import os2 from "os";
|
|
6335
|
-
import
|
|
6350
|
+
import path11 from "path";
|
|
6336
6351
|
var SANDBOX_OPENCODE_PORT = 4096;
|
|
6337
6352
|
var SANDBOX_OPENCODE_READY_TIMEOUT_MS = 9e4;
|
|
6338
6353
|
var LOCAL_OPENCODE_READY_TIMEOUT_MS = 2e4;
|
|
6339
6354
|
var SHARED_OPENCODE_TARGET_ID = "shared-opencode-server";
|
|
6340
6355
|
var OPENCODE_AUTH_USERNAME = "opencode";
|
|
6341
6356
|
function opencodeServerTokenPath() {
|
|
6342
|
-
return
|
|
6357
|
+
return path11.posix.join(
|
|
6343
6358
|
agentboxRoot(AgentProvider.OpenCode, true),
|
|
6344
6359
|
"opencode-auth-token"
|
|
6345
6360
|
);
|
|
@@ -6625,7 +6640,7 @@ async function ensureSandboxOpenCodeServer(request) {
|
|
|
6625
6640
|
plugins,
|
|
6626
6641
|
target.layout.opencodeDir
|
|
6627
6642
|
);
|
|
6628
|
-
const configPath =
|
|
6643
|
+
const configPath = path11.join(target.layout.opencodeDir, "agentbox.json");
|
|
6629
6644
|
const openCodeConfig = buildOpenCodeConfig(options, interactiveApproval);
|
|
6630
6645
|
const allArtifacts = [
|
|
6631
6646
|
...skillArtifacts,
|
|
@@ -6680,11 +6695,11 @@ async function ensureSandboxOpenCodeServer(request) {
|
|
|
6680
6695
|
await time(debugOpencode, "activateRtk", () => activateRtk(target));
|
|
6681
6696
|
}
|
|
6682
6697
|
const binary = options.provider?.binary ?? "opencode";
|
|
6683
|
-
const pidFilePath =
|
|
6698
|
+
const pidFilePath = path11.posix.join(
|
|
6684
6699
|
target.layout.rootDir,
|
|
6685
6700
|
"opencode-serve.pid"
|
|
6686
6701
|
);
|
|
6687
|
-
const logFilePath =
|
|
6702
|
+
const logFilePath = path11.posix.join(
|
|
6688
6703
|
target.layout.rootDir,
|
|
6689
6704
|
"opencode-serve.log"
|
|
6690
6705
|
);
|
|
@@ -6806,7 +6821,7 @@ async function startLocalOpenCodeServer(request) {
|
|
|
6806
6821
|
const originalOptions = request.options;
|
|
6807
6822
|
const options = {
|
|
6808
6823
|
...originalOptions,
|
|
6809
|
-
stateDirectory:
|
|
6824
|
+
stateDirectory: path11.join(originalOptions.stateDirectory ?? path11.join(os2.tmpdir(), "agentbox-native"), "instances", randomUUID2())
|
|
6810
6825
|
};
|
|
6811
6826
|
let generatedEnv = {};
|
|
6812
6827
|
if (options.configuration !== "native") {
|
|
@@ -6814,7 +6829,7 @@ async function startLocalOpenCodeServer(request) {
|
|
|
6814
6829
|
assertCommandsSupported(request.provider, options.commands);
|
|
6815
6830
|
const target = await createSetupTarget(request.provider, "shared-setup", options);
|
|
6816
6831
|
const { artifacts: skillArtifacts, installCommands } = await prepareSkillArtifacts(request.provider, options.skills, target.layout);
|
|
6817
|
-
const configPath =
|
|
6832
|
+
const configPath = path11.join(target.layout.opencodeDir, "agentbox.json");
|
|
6818
6833
|
const artifacts = [
|
|
6819
6834
|
...skillArtifacts,
|
|
6820
6835
|
...buildOpenCodePluginArtifacts(plugins, target.layout.opencodeDir),
|
|
@@ -6907,7 +6922,7 @@ async function killOpenCodeServer(request) {
|
|
|
6907
6922
|
SHARED_OPENCODE_TARGET_ID,
|
|
6908
6923
|
options
|
|
6909
6924
|
);
|
|
6910
|
-
const pidFilePath =
|
|
6925
|
+
const pidFilePath = path11.posix.join(
|
|
6911
6926
|
target.layout.rootDir,
|
|
6912
6927
|
"opencode-serve.pid"
|
|
6913
6928
|
);
|
|
@@ -7861,7 +7876,7 @@ function createAdapter(provider) {
|
|
|
7861
7876
|
function prepareAgentOptions(_provider, options) {
|
|
7862
7877
|
if (options.stateDirectory !== void 0) {
|
|
7863
7878
|
if (options.sandbox) throw new Error("stateDirectory is only supported for host execution.");
|
|
7864
|
-
if (!
|
|
7879
|
+
if (!path12.isAbsolute(options.stateDirectory)) throw new Error("stateDirectory must be an absolute path.");
|
|
7865
7880
|
}
|
|
7866
7881
|
if (options.sandbox && options.processGroup !== void 0) throw new Error("processGroup is only supported for host execution.");
|
|
7867
7882
|
resolveBackgroundTaskTimeoutMs(options.backgroundTaskTimeoutMs);
|
package/dist/events/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AISDKEvent, C as BackgroundTask, D as BackgroundTasksEvent, Z as HarnessCommandsEvent, a3 as MessageCompletedEvent, a4 as MessageInjectedEvent, a5 as MessageStartedEvent, a7 as NativePlanEvent, a8 as NormalizedAgentEvent, a9 as NormalizedAgentEventBase, aa as NormalizedAgentEventType, aj as PermissionRequestedEvent, ak as PermissionResolvedEvent, al as RawAgentEvent, am as ReasoningDeltaEvent, ao as RunCancelledEvent, ap as RunCompletedEvent, aq as RunErrorEvent, ar as RunStartedEvent, at as TextDeltaEvent, av as ToolCallCompletedEvent, aw as ToolCallDeltaEvent, ax as ToolCallStartedEvent, aE as createNormalizedEvent, aF as normalizeRawAgentEvent, aJ as toAISDKEvent, aK as toAISDKStream } from '../types-
|
|
1
|
+
export { A as AISDKEvent, C as BackgroundTask, D as BackgroundTasksEvent, Z as HarnessCommandsEvent, a3 as MessageCompletedEvent, a4 as MessageInjectedEvent, a5 as MessageStartedEvent, a7 as NativePlanEvent, a8 as NormalizedAgentEvent, a9 as NormalizedAgentEventBase, aa as NormalizedAgentEventType, aj as PermissionRequestedEvent, ak as PermissionResolvedEvent, al as RawAgentEvent, am as ReasoningDeltaEvent, ao as RunCancelledEvent, ap as RunCompletedEvent, aq as RunErrorEvent, ar as RunStartedEvent, at as TextDeltaEvent, av as ToolCallCompletedEvent, aw as ToolCallDeltaEvent, ax as ToolCallStartedEvent, aE as createNormalizedEvent, aF as normalizeRawAgentEvent, aJ as toAISDKEvent, aK as toAISDKStream } from '../types-ChkpU7Lf.js';
|
|
2
2
|
import { AgentProvider } from '../enums.js';
|
|
3
3
|
import '../Sandbox-DcKAU-E3.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 AgentUserAnswer, z as AgentUserQuestion, B as AttachedRun, C as BackgroundTask, D as BackgroundTasksEvent, E as ClaudeCodeAgentOptions, F as ClaudeCodeHookConfig, G as ClaudeCodeHookEvent, H as ClaudeCodeHookHandler, I as ClaudeCodeHookMatcherGroup, J as ClaudeCodeHooksConfig, K as ClaudeCodeProviderOptions, L as CodexAgentOptions, M as CodexCommandHook, N as CodexHookEvent, O as CodexHookMatcherGroup, P as CodexHooksConfig, Q as CodexModelProviderConfig, R as CodexProviderOptions, S as CodexSkillEntry, T as DataContent, U as EmbeddedSkillConfig, V as FilePart, W as HarnessCommandDescriptor, X as HarnessCommandInvocation, Y as HarnessCommandSource, Z as HarnessCommandsEvent, _ as ImagePart, $ as MAX_HARNESS_COMMANDS, a0 as MAX_HARNESS_COMMAND_ARGUMENT_HINT, a1 as MAX_HARNESS_COMMAND_DESCRIPTION, a2 as MAX_HARNESS_COMMAND_NAME, a3 as MessageCompletedEvent, a4 as MessageInjectedEvent, a5 as MessageStartedEvent, a6 as NativeParkBackgroundWork, a7 as NativePlanEvent, a8 as NormalizedAgentEvent, a9 as NormalizedAgentEventBase, aa as NormalizedAgentEventType, ab as OpenCodeAgentOptions, ac as OpenCodeCommandEntry, ad as OpenCodePluginConfig, ae as OpenCodePluginEvent, af as OpenCodePluginHookConfig, ag as OpenCodeProviderOptions, ah as OpenCodeSkillEntry, ai as OpenRouterPlugin, aj as PermissionRequestedEvent, ak as PermissionResolvedEvent, al as RawAgentEvent, am as ReasoningDeltaEvent, an as RepoSkillConfig, ao as RunCancelledEvent, ap as RunCompletedEvent, aq as RunErrorEvent, ar as RunStartedEvent, as as SetupLayout, at as TextDeltaEvent, au as TextPart, av as ToolCallCompletedEvent, aw as ToolCallDeltaEvent, ax as ToolCallStartedEvent, ay as UserContent, az as UserContentPart, aA as builtinHarnessCommands, aB as claudeHarnessCommands, aC as codexHarnessCommands, aD as codexSkillMention, aE as createNormalizedEvent, aF as normalizeRawAgentEvent, aG as openCodeHarnessCommands, aH as parseHarnessCommandInvocation, aI as skillDirective, aJ as toAISDKEvent, aK 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 AgentUserAnswer, z as AgentUserQuestion, B as AttachedRun, C as BackgroundTask, D as BackgroundTasksEvent, E as ClaudeCodeAgentOptions, F as ClaudeCodeHookConfig, G as ClaudeCodeHookEvent, H as ClaudeCodeHookHandler, I as ClaudeCodeHookMatcherGroup, J as ClaudeCodeHooksConfig, K as ClaudeCodeProviderOptions, L as CodexAgentOptions, M as CodexCommandHook, N as CodexHookEvent, O as CodexHookMatcherGroup, P as CodexHooksConfig, Q as CodexModelProviderConfig, R as CodexProviderOptions, S as CodexSkillEntry, T as DataContent, U as EmbeddedSkillConfig, V as FilePart, W as HarnessCommandDescriptor, X as HarnessCommandInvocation, Y as HarnessCommandSource, Z as HarnessCommandsEvent, _ as ImagePart, $ as MAX_HARNESS_COMMANDS, a0 as MAX_HARNESS_COMMAND_ARGUMENT_HINT, a1 as MAX_HARNESS_COMMAND_DESCRIPTION, a2 as MAX_HARNESS_COMMAND_NAME, a3 as MessageCompletedEvent, a4 as MessageInjectedEvent, a5 as MessageStartedEvent, a6 as NativeParkBackgroundWork, a7 as NativePlanEvent, a8 as NormalizedAgentEvent, a9 as NormalizedAgentEventBase, aa as NormalizedAgentEventType, ab as OpenCodeAgentOptions, ac as OpenCodeCommandEntry, ad as OpenCodePluginConfig, ae as OpenCodePluginEvent, af as OpenCodePluginHookConfig, ag as OpenCodeProviderOptions, ah as OpenCodeSkillEntry, ai as OpenRouterPlugin, aj as PermissionRequestedEvent, ak as PermissionResolvedEvent, al as RawAgentEvent, am as ReasoningDeltaEvent, an as RepoSkillConfig, ao as RunCancelledEvent, ap as RunCompletedEvent, aq as RunErrorEvent, ar as RunStartedEvent, as as SetupLayout, at as TextDeltaEvent, au as TextPart, av as ToolCallCompletedEvent, aw as ToolCallDeltaEvent, ax as ToolCallStartedEvent, ay as UserContent, az as UserContentPart, aA as builtinHarnessCommands, aB as claudeHarnessCommands, aC as codexHarnessCommands, aD as codexSkillMention, aE as createNormalizedEvent, aF as normalizeRawAgentEvent, aG as openCodeHarnessCommands, aH as parseHarnessCommandInvocation, aI as skillDirective, aJ as toAISDKEvent, aK as toAISDKStream } from './types-ChkpU7Lf.js';
|
|
2
2
|
export { AGENT_RESERVED_PORTS, Agent, HarnessCapabilities, HarnessCommand, agentboxRoot, collectAllAgentReservedPorts, getAgentLayout, harnessCapabilities, resolveHarnessCommand } 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-DcKAU-E3.js';
|
|
4
4
|
export { SandboxAdapter, buildGitCloneCommand } from './sandboxes/index.js';
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
parseHarnessCommandInvocation,
|
|
16
16
|
resolveHarnessCommand,
|
|
17
17
|
skillDirective
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-RSURGSVM.js";
|
|
19
19
|
import {
|
|
20
20
|
ProviderLogAssembler,
|
|
21
21
|
createNormalizedEvent,
|
|
@@ -27,11 +27,11 @@ import {
|
|
|
27
27
|
Sandbox,
|
|
28
28
|
SandboxAdapter,
|
|
29
29
|
buildGitCloneCommand
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-OGV5XZWI.js";
|
|
31
31
|
import {
|
|
32
32
|
AGENT_RESERVED_PORTS,
|
|
33
33
|
collectAllAgentReservedPorts
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-55PSWQJZ.js";
|
|
35
35
|
import "./chunk-NSJM57Z4.js";
|
|
36
36
|
import {
|
|
37
37
|
AgentProvider,
|
package/dist/sandboxes/index.js
CHANGED
|
@@ -665,6 +665,8 @@ interface CodexProviderOptions {
|
|
|
665
665
|
/** Network access for an explicit host workspace-write policy; defaults to false. */
|
|
666
666
|
networkAccess?: boolean;
|
|
667
667
|
binary?: string;
|
|
668
|
+
/** Global CLI arguments placed before the subcommand, e.g. `["-c", "key=value"]`. */
|
|
669
|
+
args?: string[];
|
|
668
670
|
env?: Record<string, string>;
|
|
669
671
|
brokerEndpoint?: string;
|
|
670
672
|
useBroker?: boolean;
|
|
@@ -751,6 +753,7 @@ interface ClaudeCodeProviderOptions {
|
|
|
751
753
|
/** Request fast mode explicitly; false overrides inherited fast settings. */
|
|
752
754
|
fastMode?: boolean;
|
|
753
755
|
binary?: string;
|
|
756
|
+
/** CLI flags as `--name` or `--name=value`; other entries are ignored. */
|
|
754
757
|
args?: string[];
|
|
755
758
|
hooks?: ClaudeCodeHooksConfig;
|
|
756
759
|
permissionMode?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentbox-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.600",
|
|
4
4
|
"description": "Swappable coding agents and sandbox providers for Bun and TypeScript.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
"@daytonaio/sdk": "^0.171.0",
|
|
64
64
|
"@types/debug": "^4.1.13",
|
|
65
65
|
"@vercel/sandbox": "2.0.0-beta.13",
|
|
66
|
+
"cross-spawn": "^7.0.6",
|
|
66
67
|
"debug": "^4.4.3",
|
|
67
68
|
"dockerode": "^4.0.10",
|
|
68
69
|
"e2b": "^2.19.0",
|
|
@@ -74,6 +75,7 @@
|
|
|
74
75
|
},
|
|
75
76
|
"devDependencies": {
|
|
76
77
|
"@eslint/js": "^10.0.1",
|
|
78
|
+
"@types/cross-spawn": "^6.0.6",
|
|
77
79
|
"@types/dockerode": "^3.3.42",
|
|
78
80
|
"@types/node": "^25.5.2",
|
|
79
81
|
"@types/tar-stream": "^3.1.4",
|
|
File without changes
|