agentbox-sdk 0.1.512 → 0.1.514
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 +25 -1
- package/dist/agents/index.d.ts +2 -2
- package/dist/agents/index.js +1 -1
- package/dist/{chunk-4DADE7TF.js → chunk-D33LRRN7.js} +87 -35
- package/dist/events/index.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{types-VT1LMbLW.d.ts → types-NhKw_6mW.d.ts} +4 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -123,12 +123,26 @@ while the harness has ended its turn and the run stays open only for those
|
|
|
123
123
|
tasks (or, with an empty set, for the wake-up the CLI queues for a task that
|
|
124
124
|
finished mid-turn) — and settles the run on the follow-up turn's result
|
|
125
125
|
instead of the first one. Once background work has been seen, a turn end
|
|
126
|
-
settles the run
|
|
126
|
+
settles the run when Claude emits `session_state_changed: idle` and the live
|
|
127
|
+
task set is empty. AgentBox enables this documented CLI event with
|
|
128
|
+
`CLAUDE_CODE_EMIT_SESSION_STATE_EVENTS=1`; there is no extra model call or
|
|
129
|
+
fixed completion delay ([upstream opt-in documentation](https://github.com/anthropics/claude-agent-sdk-typescript/blob/main/CHANGELOG.md#0283)). Older/custom CLIs that never emit session state use
|
|
130
|
+
a 15s grace as a compatibility fallback. A final
|
|
127
131
|
`background.tasks` with `tasks: []` and `waiting: false` precedes the settle.
|
|
128
132
|
`backgroundTaskTimeoutMs` bounds the total time spent waiting across the run:
|
|
129
133
|
default 30 minutes, `0` settles at the first turn end as before, `Infinity`
|
|
130
134
|
waits forever. On expiry the tasks are stopped best-effort and the run
|
|
131
135
|
completes with the last turn's text.
|
|
136
|
+
Tasks marked ambient by Claude (such as live-update watchers) do not keep the
|
|
137
|
+
run waiting. The SDK's full task snapshots take precedence over task start and
|
|
138
|
+
finish events, whose ordering relative to those snapshots is unspecified.
|
|
139
|
+
|
|
140
|
+
AgentBox does not inject a Stop-hook prompt or infer from the answer that a
|
|
141
|
+
running task is unwanted. A genuinely live polling helper keeps the run open
|
|
142
|
+
until it finishes, is stopped, or reaches the wait budget. Unlike the interactive
|
|
143
|
+
CLI, an AgentBox run owns the query lifetime: completing it closes the process.
|
|
144
|
+
Keep the streaming input open while waiting so background continuations retain
|
|
145
|
+
their hooks, permissions, and SDK MCP control channel.
|
|
132
146
|
|
|
133
147
|
Codex owns command polling (`write_stdin`), yielded code-mode waits (`wait`),
|
|
134
148
|
and subagent waits (`wait_agent`). AgentBox finishes an ordinary Codex run on
|
|
@@ -650,3 +664,13 @@ CLIs and SDK mocks; live tests remain opt-in.
|
|
|
650
664
|
MIT
|
|
651
665
|
|
|
652
666
|
For native speed selection, use `provider: { serviceTier: "fast" }` with Codex (or `"default"` for standard speed), and `provider: { fastMode: true }` with Claude Code. Omit these options to inherit harness settings. Availability and usage charges are enforced by the harness.
|
|
667
|
+
|
|
668
|
+
### Preparing local Codex before a prompt
|
|
669
|
+
|
|
670
|
+
For an interactive host, `provider: { prewarm: true }` makes `await agent.setup()`
|
|
671
|
+
start and initialize the next Codex app-server. It does not create a thread, send
|
|
672
|
+
a prompt, or run tools. The next `stream()`/`run()` consumes that prepared process
|
|
673
|
+
and stops it normally when the run ends; abort still stops the owned process.
|
|
674
|
+
A prepared process that exited while idle is replaced before execution. Call
|
|
675
|
+
`await agent.killServer()` to dispose an unused prepared process. Prewarming is
|
|
676
|
+
host-only and opt-in. Use a new Agent for a changed cwd, environment, or policy.
|
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, a9 as RawAgentEvent, b as AgentAttachRequest, B as AttachedRun, ag as SetupLayout, am 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 DataContent, T as EmbeddedSkillConfig, U as FilePart, V as ImagePart, a1 as OpenCodeAgentOptions, a2 as OpenCodePluginConfig, a3 as OpenCodePluginEvent, a4 as OpenCodePluginHookConfig, a5 as OpenCodeProviderOptions, a6 as OpenRouterPlugin, ab as RepoSkillConfig, ai as TextPart, an as UserContentPart } from '../types-
|
|
1
|
+
import { o as AgentProviderName, h as AgentOptions, t as AgentRunConfig, s as AgentRun, r as AgentResult, a9 as RawAgentEvent, b as AgentAttachRequest, B as AttachedRun, ag as SetupLayout, am as UserContent } from '../types-NhKw_6mW.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 DataContent, T as EmbeddedSkillConfig, U as FilePart, V as ImagePart, a1 as OpenCodeAgentOptions, a2 as OpenCodePluginConfig, a3 as OpenCodePluginEvent, a4 as OpenCodePluginHookConfig, a5 as OpenCodeProviderOptions, a6 as OpenRouterPlugin, ab as RepoSkillConfig, ai as TextPart, an as UserContentPart } from '../types-NhKw_6mW.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
|
@@ -1859,17 +1859,21 @@ var BackgroundTaskTracker = class {
|
|
|
1859
1859
|
pendingWakeups = /* @__PURE__ */ new Map();
|
|
1860
1860
|
afterResult = false;
|
|
1861
1861
|
seenBackgroundWork = false;
|
|
1862
|
+
hasTaskSnapshot = false;
|
|
1862
1863
|
liveTasks() {
|
|
1863
|
-
return [
|
|
1864
|
+
return [
|
|
1865
|
+
...[...this.tasks.values()].filter(({ ambient }) => !ambient).map(({ task }) => task),
|
|
1866
|
+
...this.wakeups.values()
|
|
1867
|
+
];
|
|
1864
1868
|
}
|
|
1865
1869
|
/**
|
|
1866
1870
|
* True once any background task or scheduled wakeup was live in this run.
|
|
1867
1871
|
* The CLI queues a wake-up for every task that finishes and delivers it as
|
|
1868
1872
|
* a new turn once the model is idle — including tasks that finished
|
|
1869
1873
|
* mid-turn, whose queued turn starts right after that turn's `result`
|
|
1870
|
-
* with nothing live
|
|
1871
|
-
*
|
|
1872
|
-
*
|
|
1874
|
+
* with nothing live in between. After background work has been seen, wait
|
|
1875
|
+
* for session_state_changed/idle with an empty live set. Older CLIs that
|
|
1876
|
+
* never emit session state use an idle grace as a compatibility fallback.
|
|
1873
1877
|
*/
|
|
1874
1878
|
hasSeenBackgroundWork() {
|
|
1875
1879
|
return this.seenBackgroundWork;
|
|
@@ -1911,6 +1915,7 @@ var BackgroundTaskTracker = class {
|
|
|
1911
1915
|
const id = String(m.task_id ?? "");
|
|
1912
1916
|
switch (m.subtype) {
|
|
1913
1917
|
case "background_tasks_changed":
|
|
1918
|
+
this.hasTaskSnapshot = true;
|
|
1914
1919
|
this.tasks.clear();
|
|
1915
1920
|
for (const entry of asArray(m.tasks)) {
|
|
1916
1921
|
const task = asRecord2(entry);
|
|
@@ -1918,13 +1923,13 @@ var BackgroundTaskTracker = class {
|
|
|
1918
1923
|
}
|
|
1919
1924
|
return false;
|
|
1920
1925
|
case "task_started":
|
|
1921
|
-
if (m.is_backgrounded === true && !m.owned_by_subagent) this.addTask(m);
|
|
1926
|
+
if (!this.hasTaskSnapshot && m.is_backgrounded === true && !m.owned_by_subagent) this.addTask(m);
|
|
1922
1927
|
return false;
|
|
1923
1928
|
case "task_notification":
|
|
1924
|
-
this.tasks.delete(id);
|
|
1929
|
+
if (!this.hasTaskSnapshot) this.tasks.delete(id);
|
|
1925
1930
|
return false;
|
|
1926
1931
|
case "task_updated":
|
|
1927
|
-
if (DONE_STATUSES.has(String(asRecord2(m.patch)?.status)))
|
|
1932
|
+
if (!this.hasTaskSnapshot && DONE_STATUSES.has(String(asRecord2(m.patch)?.status)))
|
|
1928
1933
|
this.tasks.delete(id);
|
|
1929
1934
|
return false;
|
|
1930
1935
|
case "init":
|
|
@@ -1936,11 +1941,15 @@ var BackgroundTaskTracker = class {
|
|
|
1936
1941
|
addTask(task) {
|
|
1937
1942
|
const id = String(task.task_id ?? "");
|
|
1938
1943
|
if (!id) return;
|
|
1939
|
-
|
|
1944
|
+
const ambient = task.ambient === true || task.skip_transcript === true;
|
|
1945
|
+
if (!ambient) this.seenBackgroundWork = true;
|
|
1940
1946
|
this.tasks.set(id, {
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1947
|
+
ambient,
|
|
1948
|
+
task: {
|
|
1949
|
+
id,
|
|
1950
|
+
type: String(task.task_type ?? "task"),
|
|
1951
|
+
description: String(task.description ?? "")
|
|
1952
|
+
}
|
|
1944
1953
|
});
|
|
1945
1954
|
}
|
|
1946
1955
|
ingestToolUses(m) {
|
|
@@ -2021,7 +2030,7 @@ var BackgroundWait = class {
|
|
|
2021
2030
|
};
|
|
2022
2031
|
|
|
2023
2032
|
// src/agents/providers/claude-code.ts
|
|
2024
|
-
var DAEMON_PROTOCOL_VERSION = "
|
|
2033
|
+
var DAEMON_PROTOCOL_VERSION = "8";
|
|
2025
2034
|
var DAEMON_PORT = 43180;
|
|
2026
2035
|
var DAEMON_PATH = "/tmp/agentbox/claude-code/daemon.mjs";
|
|
2027
2036
|
var DAEMON_LOG_PATH = "/tmp/agentbox/claude-code/daemon.log";
|
|
@@ -2130,7 +2139,7 @@ function createClaudeCodeDaemonScript() {
|
|
|
2130
2139
|
return `import http from "node:http";
|
|
2131
2140
|
import { execSync } from "node:child_process";
|
|
2132
2141
|
import { existsSync, readFileSync } from "node:fs";
|
|
2133
|
-
import { timingSafeEqual } from "node:crypto";
|
|
2142
|
+
import { randomUUID, timingSafeEqual } from "node:crypto";
|
|
2134
2143
|
import { query, getSessionInfo } from "@anthropic-ai/claude-agent-sdk";
|
|
2135
2144
|
|
|
2136
2145
|
const VERSION = ${version};
|
|
@@ -2774,6 +2783,7 @@ var ClaudeCodeAgentAdapter = class {
|
|
|
2774
2783
|
IS_SANDBOX: "1"
|
|
2775
2784
|
};
|
|
2776
2785
|
applyCliBackgroundWaitCeiling(env);
|
|
2786
|
+
env.CLAUDE_CODE_EMIT_SESSION_STATE_EVENTS ??= "1";
|
|
2777
2787
|
const customHeaders = request.options.customHeaders;
|
|
2778
2788
|
if (customHeaders && Object.keys(customHeaders).length > 0) {
|
|
2779
2789
|
const serialized = Object.entries(customHeaders).map(([name, value]) => `${name}: ${value}`).join("\n");
|
|
@@ -2890,6 +2900,7 @@ ${serialized}` : serialized;
|
|
|
2890
2900
|
{ messageId: initialUuid }
|
|
2891
2901
|
)
|
|
2892
2902
|
);
|
|
2903
|
+
const tracker = new BackgroundTaskTracker();
|
|
2893
2904
|
const permissionMessages = async function* () {
|
|
2894
2905
|
for await (const item of parseNdjsonStream(response.body)) {
|
|
2895
2906
|
const control = item;
|
|
@@ -2905,7 +2916,7 @@ ${serialized}` : serialized;
|
|
|
2905
2916
|
if (!reply.ok) throw new Error(`Claude permission response failed: ${reply.status}`);
|
|
2906
2917
|
}
|
|
2907
2918
|
};
|
|
2908
|
-
await consumeClaudeMessages(request, sink, permissionMessages(), executeStartedAt, cleanup, () => cancelled);
|
|
2919
|
+
await consumeClaudeMessages(request, sink, permissionMessages(), executeStartedAt, cleanup, () => cancelled, {}, tracker);
|
|
2909
2920
|
return async () => void 0;
|
|
2910
2921
|
}
|
|
2911
2922
|
/**
|
|
@@ -2966,16 +2977,16 @@ ${serialized}` : serialized;
|
|
|
2966
2977
|
}
|
|
2967
2978
|
}
|
|
2968
2979
|
};
|
|
2969
|
-
async function consumeClaudeMessages(request, sink, messages, executeStartedAt, cleanup, wasCancelled = () => false, wait = {}) {
|
|
2980
|
+
async function consumeClaudeMessages(request, sink, messages, executeStartedAt, cleanup, wasCancelled = () => false, wait = {}, tracker = new BackgroundTaskTracker()) {
|
|
2970
2981
|
let accumulatedText = "";
|
|
2971
2982
|
let streamedThinkingChars = 0;
|
|
2972
2983
|
let sawResult = false;
|
|
2984
|
+
let sawSessionState = false;
|
|
2973
2985
|
let firstStreamEventLogged = false;
|
|
2974
2986
|
let firstTextDeltaLogged = false;
|
|
2975
2987
|
let lastTerminalReason;
|
|
2976
2988
|
let lastIsError = false;
|
|
2977
2989
|
const rawPayloads = [];
|
|
2978
|
-
const tracker = new BackgroundTaskTracker();
|
|
2979
2990
|
const timeoutMs = resolveBackgroundTaskTimeoutMs(request.options.backgroundTaskTimeoutMs);
|
|
2980
2991
|
const graceMs = wait.graceMs ?? BACKGROUND_TASK_GRACE_MS;
|
|
2981
2992
|
let pendingWait;
|
|
@@ -3047,7 +3058,10 @@ async function consumeClaudeMessages(request, sink, messages, executeStartedAt,
|
|
|
3047
3058
|
endWait();
|
|
3048
3059
|
}
|
|
3049
3060
|
emitTasks(tracker.liveTasks(), pendingWait !== void 0);
|
|
3050
|
-
|
|
3061
|
+
const sessionState = message.type === "system" && message.subtype === "session_state_changed" ? message.state : void 0;
|
|
3062
|
+
if (sessionState) sawSessionState = true;
|
|
3063
|
+
pendingWait?.setIdle(!sawSessionState && tracker.liveTasks().length === 0);
|
|
3064
|
+
if (sessionState === "idle" && pendingWait && tracker.liveTasks().length === 0) break;
|
|
3051
3065
|
if (message.type === "system") {
|
|
3052
3066
|
const sub = message.subtype;
|
|
3053
3067
|
if (sub === "init") {
|
|
@@ -3169,7 +3183,7 @@ async function consumeClaudeMessages(request, sink, messages, executeStartedAt,
|
|
|
3169
3183
|
debugClaude("\u2605 turn ended with %d background task(s); waiting", live.length);
|
|
3170
3184
|
endWait();
|
|
3171
3185
|
pendingWait = new BackgroundWait(graceMs, Math.max(0, timeoutMs - waitedMs));
|
|
3172
|
-
pendingWait.setIdle(live.length === 0);
|
|
3186
|
+
pendingWait.setIdle(!sawSessionState && live.length === 0);
|
|
3173
3187
|
emitTasks(live, true);
|
|
3174
3188
|
continue;
|
|
3175
3189
|
}
|
|
@@ -3243,6 +3257,7 @@ async function executeNativeClaude(request, sink, wait = {}) {
|
|
|
3243
3257
|
const prompt = new AsyncQueue();
|
|
3244
3258
|
const sessionId = request.run.resumeSessionId ?? randomUUID();
|
|
3245
3259
|
const controller = new AbortController();
|
|
3260
|
+
const tracker = new BackgroundTaskTracker();
|
|
3246
3261
|
let handle;
|
|
3247
3262
|
let processHandle;
|
|
3248
3263
|
let stopped;
|
|
@@ -3262,6 +3277,7 @@ async function executeNativeClaude(request, sink, wait = {}) {
|
|
|
3262
3277
|
prompt.push({ type: "user", uuid: messageId, message: { role: "user", content: mapToClaudeUserContent(input) }, parent_tool_use_id: null });
|
|
3263
3278
|
const hostEnv = Object.fromEntries(Object.entries({ ...process.env, ...request.options.env }).filter((entry) => entry[1] !== void 0));
|
|
3264
3279
|
applyCliBackgroundWaitCeiling(hostEnv);
|
|
3280
|
+
hostEnv.CLAUDE_CODE_EMIT_SESSION_STATE_EVENTS ??= "1";
|
|
3265
3281
|
if (request.options.customHeaders) {
|
|
3266
3282
|
const headers = Object.entries(request.options.customHeaders).map(([name, value]) => `${name}: ${value}`).join("\n");
|
|
3267
3283
|
hostEnv.ANTHROPIC_CUSTOM_HEADERS = [hostEnv.ANTHROPIC_CUSTOM_HEADERS, headers].filter(Boolean).join("\n");
|
|
@@ -3344,7 +3360,7 @@ async function executeNativeClaude(request, sink, wait = {}) {
|
|
|
3344
3360
|
stopTasks: async (ids) => {
|
|
3345
3361
|
await Promise.all(ids.map((id) => live.stopTask(id).catch(() => void 0)));
|
|
3346
3362
|
}
|
|
3347
|
-
});
|
|
3363
|
+
}, tracker);
|
|
3348
3364
|
} catch (error) {
|
|
3349
3365
|
await stop();
|
|
3350
3366
|
if (cancelled) sink.cancel();
|
|
@@ -4425,6 +4441,7 @@ async function createRuntime(request, inputParts) {
|
|
|
4425
4441
|
cleanup: async () => {
|
|
4426
4442
|
await processHandle.kill();
|
|
4427
4443
|
},
|
|
4444
|
+
isAlive: () => processHandle.child.exitCode === null && processHandle.child.signalCode === null && !processHandle.child.killed,
|
|
4428
4445
|
raw: { processHandle, codexDir },
|
|
4429
4446
|
inputItems
|
|
4430
4447
|
};
|
|
@@ -4472,11 +4489,47 @@ async function killCodexAppServer(request) {
|
|
|
4472
4489
|
{ cwd: options.cwd, timeoutMs: 1e4 }
|
|
4473
4490
|
).catch(() => void 0);
|
|
4474
4491
|
}
|
|
4492
|
+
async function initializeCodexClient(client) {
|
|
4493
|
+
await client.request("initialize", {
|
|
4494
|
+
clientInfo: { title: "AgentBox", name: "AgentBox", version: "0.1.0" },
|
|
4495
|
+
capabilities: { experimentalApi: true }
|
|
4496
|
+
});
|
|
4497
|
+
await client.notify("initialized", {});
|
|
4498
|
+
}
|
|
4475
4499
|
var CodexAgentAdapter = class {
|
|
4500
|
+
prepared;
|
|
4501
|
+
preparationGeneration = 0;
|
|
4476
4502
|
async setup(request) {
|
|
4503
|
+
const generation = this.preparationGeneration;
|
|
4504
|
+
if (request.options.provider?.prewarm && request.options.sandbox) {
|
|
4505
|
+
throw new Error("Codex prewarm is only supported for host execution.");
|
|
4506
|
+
}
|
|
4477
4507
|
await setupCodex(request);
|
|
4508
|
+
if (!request.options.provider?.prewarm || this.prepared?.isAlive?.()) return;
|
|
4509
|
+
await this.prepared?.cleanup();
|
|
4510
|
+
if (generation !== this.preparationGeneration) throw new Error("Codex preparation was cancelled.");
|
|
4511
|
+
const runtime = await createRuntime(request, []);
|
|
4512
|
+
if (generation !== this.preparationGeneration) {
|
|
4513
|
+
await runtime.cleanup();
|
|
4514
|
+
throw new Error("Codex preparation was cancelled.");
|
|
4515
|
+
}
|
|
4516
|
+
const client = new JsonRpcLineClient(runtime.source, runtime.writeLine);
|
|
4517
|
+
const prepared = { ...runtime, client };
|
|
4518
|
+
this.prepared = prepared;
|
|
4519
|
+
try {
|
|
4520
|
+
await withTimeout(initializeCodexClient(client), 1e4);
|
|
4521
|
+
if (this.prepared !== prepared) throw new Error("Codex preparation was cancelled.");
|
|
4522
|
+
} catch (error) {
|
|
4523
|
+
if (this.prepared === prepared) this.prepared = void 0;
|
|
4524
|
+
await runtime.cleanup();
|
|
4525
|
+
throw error;
|
|
4526
|
+
}
|
|
4478
4527
|
}
|
|
4479
4528
|
async killServer(request) {
|
|
4529
|
+
this.preparationGeneration++;
|
|
4530
|
+
const prepared = this.prepared;
|
|
4531
|
+
this.prepared = void 0;
|
|
4532
|
+
await prepared?.cleanup();
|
|
4480
4533
|
await killCodexAppServer(request);
|
|
4481
4534
|
}
|
|
4482
4535
|
async execute(request, sink) {
|
|
@@ -4487,11 +4540,20 @@ var CodexAgentAdapter = class {
|
|
|
4487
4540
|
"validateProviderUserInput",
|
|
4488
4541
|
() => validateProviderUserInput(request.provider, request.run.input)
|
|
4489
4542
|
);
|
|
4490
|
-
const
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4543
|
+
const prepared = this.prepared;
|
|
4544
|
+
this.prepared = void 0;
|
|
4545
|
+
let runtime;
|
|
4546
|
+
if (prepared?.isAlive?.()) {
|
|
4547
|
+
try {
|
|
4548
|
+
runtime = { ...prepared, inputItems: await buildCodexInputItems(request.options, inputParts) };
|
|
4549
|
+
} catch (error) {
|
|
4550
|
+
await prepared.cleanup();
|
|
4551
|
+
throw error;
|
|
4552
|
+
}
|
|
4553
|
+
} else {
|
|
4554
|
+
await prepared?.cleanup();
|
|
4555
|
+
runtime = await time(debugCodex, "createRuntime", () => createRuntime(request, inputParts));
|
|
4556
|
+
}
|
|
4495
4557
|
sink.setRaw(runtime.raw);
|
|
4496
4558
|
sink.emitEvent(
|
|
4497
4559
|
createNormalizedEvent("run.started", {
|
|
@@ -4760,17 +4822,7 @@ var CodexAgentAdapter = class {
|
|
|
4760
4822
|
});
|
|
4761
4823
|
try {
|
|
4762
4824
|
if (!runtime.client) {
|
|
4763
|
-
await client
|
|
4764
|
-
clientInfo: {
|
|
4765
|
-
title: "AgentBox",
|
|
4766
|
-
name: "AgentBox",
|
|
4767
|
-
version: "0.1.0"
|
|
4768
|
-
},
|
|
4769
|
-
capabilities: {
|
|
4770
|
-
experimentalApi: true
|
|
4771
|
-
}
|
|
4772
|
-
});
|
|
4773
|
-
await client.notify("initialized", {});
|
|
4825
|
+
await initializeCodexClient(client);
|
|
4774
4826
|
}
|
|
4775
4827
|
const cwd = request.options.cwd ?? process.cwd();
|
|
4776
4828
|
let threadResponse;
|
package/dist/events/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AISDKEvent, C as BackgroundTask, D as BackgroundTasksEvent, W as MessageCompletedEvent, X as MessageInjectedEvent, Y as MessageStartedEvent, Z as NativePlanEvent, _ as NormalizedAgentEvent, $ as NormalizedAgentEventBase, a0 as NormalizedAgentEventType, a7 as PermissionRequestedEvent, a8 as PermissionResolvedEvent, a9 as RawAgentEvent, aa as ReasoningDeltaEvent, ac as RunCancelledEvent, ad as RunCompletedEvent, ae as RunErrorEvent, af as RunStartedEvent, ah as TextDeltaEvent, aj as ToolCallCompletedEvent, ak as ToolCallDeltaEvent, al as ToolCallStartedEvent, ao as createNormalizedEvent, ap as normalizeRawAgentEvent, aq as toAISDKEvent, ar as toAISDKStream } from '../types-
|
|
1
|
+
export { A as AISDKEvent, C as BackgroundTask, D as BackgroundTasksEvent, W as MessageCompletedEvent, X as MessageInjectedEvent, Y as MessageStartedEvent, Z as NativePlanEvent, _ as NormalizedAgentEvent, $ as NormalizedAgentEventBase, a0 as NormalizedAgentEventType, a7 as PermissionRequestedEvent, a8 as PermissionResolvedEvent, a9 as RawAgentEvent, aa as ReasoningDeltaEvent, ac as RunCancelledEvent, ad as RunCompletedEvent, ae as RunErrorEvent, af as RunStartedEvent, ah as TextDeltaEvent, aj as ToolCallCompletedEvent, ak as ToolCallDeltaEvent, al as ToolCallStartedEvent, ao as createNormalizedEvent, ap as normalizeRawAgentEvent, aq as toAISDKEvent, ar as toAISDKStream } from '../types-NhKw_6mW.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 DataContent, T as EmbeddedSkillConfig, U as FilePart, V as ImagePart, W as MessageCompletedEvent, X as MessageInjectedEvent, Y as MessageStartedEvent, Z as NativePlanEvent, _ as NormalizedAgentEvent, $ as NormalizedAgentEventBase, a0 as NormalizedAgentEventType, a1 as OpenCodeAgentOptions, a2 as OpenCodePluginConfig, a3 as OpenCodePluginEvent, a4 as OpenCodePluginHookConfig, a5 as OpenCodeProviderOptions, a6 as OpenRouterPlugin, a7 as PermissionRequestedEvent, a8 as PermissionResolvedEvent, a9 as RawAgentEvent, aa as ReasoningDeltaEvent, ab as RepoSkillConfig, ac as RunCancelledEvent, ad as RunCompletedEvent, ae as RunErrorEvent, af as RunStartedEvent, ag as SetupLayout, ah as TextDeltaEvent, ai as TextPart, aj as ToolCallCompletedEvent, ak as ToolCallDeltaEvent, al as ToolCallStartedEvent, am as UserContent, an as UserContentPart, ao as createNormalizedEvent, ap as normalizeRawAgentEvent, aq as toAISDKEvent, ar 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 DataContent, T as EmbeddedSkillConfig, U as FilePart, V as ImagePart, W as MessageCompletedEvent, X as MessageInjectedEvent, Y as MessageStartedEvent, Z as NativePlanEvent, _ as NormalizedAgentEvent, $ as NormalizedAgentEventBase, a0 as NormalizedAgentEventType, a1 as OpenCodeAgentOptions, a2 as OpenCodePluginConfig, a3 as OpenCodePluginEvent, a4 as OpenCodePluginHookConfig, a5 as OpenCodeProviderOptions, a6 as OpenRouterPlugin, a7 as PermissionRequestedEvent, a8 as PermissionResolvedEvent, a9 as RawAgentEvent, aa as ReasoningDeltaEvent, ab as RepoSkillConfig, ac as RunCancelledEvent, ad as RunCompletedEvent, ae as RunErrorEvent, af as RunStartedEvent, ag as SetupLayout, ah as TextDeltaEvent, ai as TextPart, aj as ToolCallCompletedEvent, ak as ToolCallDeltaEvent, al as ToolCallStartedEvent, am as UserContent, an as UserContentPart, ao as createNormalizedEvent, ap as normalizeRawAgentEvent, aq as toAISDKEvent, ar as toAISDKStream } from './types-NhKw_6mW.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
|
@@ -512,6 +512,10 @@ interface AgentOptionsBase {
|
|
|
512
512
|
commands?: AgentCommandConfig[];
|
|
513
513
|
}
|
|
514
514
|
interface CodexProviderOptions {
|
|
515
|
+
/** Prepare the next host app-server during setup(), before a prompt arrives.
|
|
516
|
+
* No thread or turn is started. Each execution still owns and stops its
|
|
517
|
+
* process; killServer() also disposes an unused prepared process. */
|
|
518
|
+
prewarm?: boolean;
|
|
515
519
|
/** Native service tier; "default" explicitly selects standard speed. */
|
|
516
520
|
serviceTier?: string;
|
|
517
521
|
/** Explicit policy for new, resumed, and forked native sessions. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentbox-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.514",
|
|
4
4
|
"description": "Swappable coding agents and sandbox providers for Bun and TypeScript.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"bun": ">=1.1.0"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@anthropic-ai/claude-agent-sdk": "0.
|
|
62
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.274",
|
|
63
63
|
"@daytonaio/sdk": "^0.171.0",
|
|
64
64
|
"@types/debug": "^4.1.13",
|
|
65
65
|
"@vercel/sandbox": "2.0.0-beta.13",
|