agentbox-sdk 0.1.521 → 0.1.523
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 +2 -2
- package/dist/{chunk-ZQUE5KT6.js → chunk-OGV5XZWI.js} +1 -1
- package/dist/{chunk-UUWGCVXA.js → chunk-PFGHRDL4.js} +395 -123
- 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-Bhntrw9V.d.ts → types-DM6zUiv1.d.ts} +30 -11
- package/package.json +1 -1
- /package/dist/{chunk-D4LSWCFA.js → chunk-55PSWQJZ.js} +0 -0
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,
|
|
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,
|
|
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-DM6zUiv1.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-DM6zUiv1.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-PFGHRDL4.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";
|
|
@@ -2369,6 +2369,235 @@ var BackgroundWaitFinish = class {
|
|
|
2369
2369
|
}
|
|
2370
2370
|
};
|
|
2371
2371
|
|
|
2372
|
+
// src/agents/providers/claude-native-session.ts
|
|
2373
|
+
var PARK_BUFFER_LIMIT = 16 * 1024 * 1024;
|
|
2374
|
+
var WAKE_RETRY_MS = [0, 1e3, 2e3, 4e3, 8e3, 16e3, 3e4, 6e4];
|
|
2375
|
+
var WAKE_RETRY_CEILING_MS = 6e4;
|
|
2376
|
+
var NO_USER = "No user is attached to approve this request.";
|
|
2377
|
+
var parkedSessions = /* @__PURE__ */ new Map();
|
|
2378
|
+
function findParkedNativeSession(sessionId) {
|
|
2379
|
+
return parkedSessions.get(sessionId);
|
|
2380
|
+
}
|
|
2381
|
+
function turnEdges(message) {
|
|
2382
|
+
const m = message;
|
|
2383
|
+
const state = m.type === "system" && m.subtype === "session_state_changed" ? m.state : void 0;
|
|
2384
|
+
return {
|
|
2385
|
+
started: m.type === "system" && (m.subtype === "init" || state === "running"),
|
|
2386
|
+
// A turn that dies without a result would otherwise stay active forever
|
|
2387
|
+
// and inflate the turn count an adopting run skips; idle clears it too.
|
|
2388
|
+
ended: m.type === "result" || state === "idle"
|
|
2389
|
+
};
|
|
2390
|
+
}
|
|
2391
|
+
var NativeClaudeSession = class {
|
|
2392
|
+
constructor(sessionId, kill) {
|
|
2393
|
+
this.sessionId = sessionId;
|
|
2394
|
+
this.kill = kill;
|
|
2395
|
+
}
|
|
2396
|
+
sessionId;
|
|
2397
|
+
kill;
|
|
2398
|
+
prompt = new AsyncQueue();
|
|
2399
|
+
query;
|
|
2400
|
+
iterator;
|
|
2401
|
+
handlers;
|
|
2402
|
+
parked;
|
|
2403
|
+
// Absolute end of the background budget, carried across parks so a CLI
|
|
2404
|
+
// that is adopted and parked again cannot extend its own ceiling.
|
|
2405
|
+
parkDeadline = Infinity;
|
|
2406
|
+
buffer = [];
|
|
2407
|
+
bufferedBytes = 0;
|
|
2408
|
+
bufferedResults = 0;
|
|
2409
|
+
bufferOverflowed = false;
|
|
2410
|
+
turnActive = false;
|
|
2411
|
+
pumping;
|
|
2412
|
+
ending;
|
|
2413
|
+
bind(query) {
|
|
2414
|
+
this.query = query;
|
|
2415
|
+
this.iterator = query[Symbol.asyncIterator]();
|
|
2416
|
+
}
|
|
2417
|
+
get isParked() {
|
|
2418
|
+
return this.parked !== void 0;
|
|
2419
|
+
}
|
|
2420
|
+
canUseTool = async (toolName, input, options) => {
|
|
2421
|
+
const handlers = this.handlers;
|
|
2422
|
+
if (!handlers) return { behavior: "deny", message: NO_USER };
|
|
2423
|
+
const result = await handlers.canUseTool(toolName, input, options);
|
|
2424
|
+
if (this.handlers !== handlers && result?.behavior === "deny")
|
|
2425
|
+
return { behavior: "deny", message: NO_USER };
|
|
2426
|
+
return result;
|
|
2427
|
+
};
|
|
2428
|
+
preToolUse = async (input, toolUseID, options) => this.handlers ? this.handlers.preToolUse(input, toolUseID, options) : {};
|
|
2429
|
+
/** Attach a run: `preamble` is read first, then the CLI's own output. */
|
|
2430
|
+
open(handlers, preamble = [], handoff) {
|
|
2431
|
+
this.handlers = handlers;
|
|
2432
|
+
const queue = [...preamble];
|
|
2433
|
+
let pending = handoff;
|
|
2434
|
+
return {
|
|
2435
|
+
[Symbol.asyncIterator]: () => ({
|
|
2436
|
+
next: () => {
|
|
2437
|
+
if (queue.length > 0)
|
|
2438
|
+
return Promise.resolve({ done: false, value: queue.shift() });
|
|
2439
|
+
if (pending) {
|
|
2440
|
+
const next = pending;
|
|
2441
|
+
pending = void 0;
|
|
2442
|
+
return next;
|
|
2443
|
+
}
|
|
2444
|
+
return this.pull();
|
|
2445
|
+
}
|
|
2446
|
+
})
|
|
2447
|
+
};
|
|
2448
|
+
}
|
|
2449
|
+
/**
|
|
2450
|
+
* Keep the CLI after the attached run settles. `inflight` is a read that
|
|
2451
|
+
* run started but never consumed; its message is buffered, not lost.
|
|
2452
|
+
*/
|
|
2453
|
+
park(tasks, ttlMs, parking, inflight) {
|
|
2454
|
+
if (this.ending || !this.iterator) return false;
|
|
2455
|
+
this.handlers = void 0;
|
|
2456
|
+
this.parkDeadline = Math.min(
|
|
2457
|
+
this.parkDeadline,
|
|
2458
|
+
Number.isFinite(ttlMs) ? Date.now() + Math.max(0, ttlMs) : Infinity
|
|
2459
|
+
);
|
|
2460
|
+
const parked = { tasks, parking, waking: false, wokeAt: 0 };
|
|
2461
|
+
if (Number.isFinite(this.parkDeadline)) {
|
|
2462
|
+
parked.timer = setTimeout(
|
|
2463
|
+
() => {
|
|
2464
|
+
if (this.parked !== parked) return;
|
|
2465
|
+
debugClaude("\u2605 parked CLI ran out of background budget; ending it");
|
|
2466
|
+
void this.end();
|
|
2467
|
+
},
|
|
2468
|
+
Math.min(Math.max(0, this.parkDeadline - Date.now()), 2147483647)
|
|
2469
|
+
);
|
|
2470
|
+
parked.timer.unref?.();
|
|
2471
|
+
}
|
|
2472
|
+
this.parked = parked;
|
|
2473
|
+
parkedSessions.set(this.sessionId, this);
|
|
2474
|
+
void this.pump(inflight);
|
|
2475
|
+
return true;
|
|
2476
|
+
}
|
|
2477
|
+
/**
|
|
2478
|
+
* A later run takes the parked CLI over: it learns what was live and how
|
|
2479
|
+
* many results precede its own turn, then reads what was buffered. An
|
|
2480
|
+
* attach-only run with nothing to stream leaves the park alone (undefined).
|
|
2481
|
+
*/
|
|
2482
|
+
adopt(handlers, attachOnly) {
|
|
2483
|
+
const parked = this.parked;
|
|
2484
|
+
if (!parked) return void 0;
|
|
2485
|
+
const turns = this.bufferedResults + (this.turnActive ? 1 : 0);
|
|
2486
|
+
if (attachOnly && turns === 0) return void 0;
|
|
2487
|
+
clearTimeout(parked.timer);
|
|
2488
|
+
this.parked = void 0;
|
|
2489
|
+
parkedSessions.delete(this.sessionId);
|
|
2490
|
+
const budgetLeftMs = Number.isFinite(this.parkDeadline) ? Math.max(0, this.parkDeadline - Date.now()) : null;
|
|
2491
|
+
const preamble = [
|
|
2492
|
+
{ _parked: { tasks: parked.tasks, turns, budgetLeftMs } },
|
|
2493
|
+
...this.buffer
|
|
2494
|
+
];
|
|
2495
|
+
this.buffer = [];
|
|
2496
|
+
this.bufferedBytes = 0;
|
|
2497
|
+
this.bufferedResults = 0;
|
|
2498
|
+
this.bufferOverflowed = false;
|
|
2499
|
+
const handoff = this.pumping;
|
|
2500
|
+
this.pumping = void 0;
|
|
2501
|
+
return this.open(handlers, preamble, handoff);
|
|
2502
|
+
}
|
|
2503
|
+
/** Close the CLI and the background work it owns. Idempotent. */
|
|
2504
|
+
end() {
|
|
2505
|
+
return this.ending ??= (async () => {
|
|
2506
|
+
const parked = this.parked;
|
|
2507
|
+
this.parked = void 0;
|
|
2508
|
+
this.handlers = void 0;
|
|
2509
|
+
clearTimeout(parked?.timer);
|
|
2510
|
+
if (parkedSessions.get(this.sessionId) === this)
|
|
2511
|
+
parkedSessions.delete(this.sessionId);
|
|
2512
|
+
try {
|
|
2513
|
+
await this.kill();
|
|
2514
|
+
} finally {
|
|
2515
|
+
if (parked) parked.parking.onEnded?.();
|
|
2516
|
+
}
|
|
2517
|
+
})();
|
|
2518
|
+
}
|
|
2519
|
+
pull() {
|
|
2520
|
+
return this.iterator.next().then((result) => {
|
|
2521
|
+
if (!result.done) {
|
|
2522
|
+
const { started, ended } = turnEdges(result.value);
|
|
2523
|
+
if (started) this.turnActive = true;
|
|
2524
|
+
if (ended) this.turnActive = false;
|
|
2525
|
+
}
|
|
2526
|
+
return result;
|
|
2527
|
+
});
|
|
2528
|
+
}
|
|
2529
|
+
async pump(first) {
|
|
2530
|
+
let next = first;
|
|
2531
|
+
while (this.parked) {
|
|
2532
|
+
next ??= this.pull();
|
|
2533
|
+
this.pumping = next;
|
|
2534
|
+
let result;
|
|
2535
|
+
try {
|
|
2536
|
+
result = await next;
|
|
2537
|
+
} catch (error) {
|
|
2538
|
+
if (this.pumping !== next) return;
|
|
2539
|
+
debugClaude("parked CLI stream failed: %o", error);
|
|
2540
|
+
void this.end();
|
|
2541
|
+
return;
|
|
2542
|
+
}
|
|
2543
|
+
if (this.pumping !== next) return;
|
|
2544
|
+
this.pumping = void 0;
|
|
2545
|
+
next = void 0;
|
|
2546
|
+
if (result.done) {
|
|
2547
|
+
debugClaude("\u2605 parked CLI exited");
|
|
2548
|
+
void this.end();
|
|
2549
|
+
return;
|
|
2550
|
+
}
|
|
2551
|
+
this.hold(result.value);
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2554
|
+
hold(message) {
|
|
2555
|
+
if (message && typeof message === "object" && "_parked" in message) return;
|
|
2556
|
+
const { started } = turnEdges(message);
|
|
2557
|
+
const isResult = message.type === "result";
|
|
2558
|
+
if (isResult) this.bufferedResults++;
|
|
2559
|
+
if (started || isResult) this.wake();
|
|
2560
|
+
if (message.type === "stream_event") return;
|
|
2561
|
+
const size = Buffer.byteLength(JSON.stringify(message) ?? "");
|
|
2562
|
+
if (this.bufferedBytes + size > PARK_BUFFER_LIMIT) {
|
|
2563
|
+
if (!this.bufferOverflowed) {
|
|
2564
|
+
this.bufferOverflowed = true;
|
|
2565
|
+
this.buffer.push({ _notice: "park_buffer_overflow" });
|
|
2566
|
+
this.wake();
|
|
2567
|
+
}
|
|
2568
|
+
return;
|
|
2569
|
+
}
|
|
2570
|
+
this.bufferedBytes += size;
|
|
2571
|
+
this.buffer.push(message);
|
|
2572
|
+
}
|
|
2573
|
+
wake() {
|
|
2574
|
+
const parked = this.parked;
|
|
2575
|
+
if (!parked || parked.waking) return;
|
|
2576
|
+
if (parked.wokeAt && Date.now() - parked.wokeAt < WAKE_RETRY_CEILING_MS)
|
|
2577
|
+
return;
|
|
2578
|
+
parked.waking = true;
|
|
2579
|
+
void (async () => {
|
|
2580
|
+
try {
|
|
2581
|
+
for (let attempt = 0; ; attempt++) {
|
|
2582
|
+
const delay = WAKE_RETRY_MS[attempt] ?? WAKE_RETRY_CEILING_MS;
|
|
2583
|
+
if (delay) await new Promise((resolve) => setTimeout(resolve, delay));
|
|
2584
|
+
if (this.parked !== parked) return;
|
|
2585
|
+
try {
|
|
2586
|
+
if (await parked.parking.onWake() !== false) {
|
|
2587
|
+
parked.wokeAt = Date.now();
|
|
2588
|
+
return;
|
|
2589
|
+
}
|
|
2590
|
+
} catch (error) {
|
|
2591
|
+
debugClaude("wake callback failed: %o", error);
|
|
2592
|
+
}
|
|
2593
|
+
}
|
|
2594
|
+
} finally {
|
|
2595
|
+
parked.waking = false;
|
|
2596
|
+
}
|
|
2597
|
+
})();
|
|
2598
|
+
}
|
|
2599
|
+
};
|
|
2600
|
+
|
|
2372
2601
|
// src/agents/providers/claude-code.ts
|
|
2373
2602
|
var DAEMON_PROTOCOL_VERSION = "11";
|
|
2374
2603
|
var DAEMON_PORT = 43180;
|
|
@@ -3289,30 +3518,35 @@ async function fetchWithDaemonRetry(input, init) {
|
|
|
3289
3518
|
async function* parseNdjsonStream(body) {
|
|
3290
3519
|
const reader = body.getReader();
|
|
3291
3520
|
const decoder = new TextDecoder();
|
|
3292
|
-
let
|
|
3293
|
-
|
|
3294
|
-
const { done, value } = await reader.read();
|
|
3295
|
-
if (done) break;
|
|
3296
|
-
buffer += decoder.decode(value, { stream: true });
|
|
3297
|
-
let idx;
|
|
3298
|
-
while ((idx = buffer.indexOf("\n")) !== -1) {
|
|
3299
|
-
const line = buffer.slice(0, idx).trim();
|
|
3300
|
-
buffer = buffer.slice(idx + 1);
|
|
3301
|
-
if (line) {
|
|
3302
|
-
try {
|
|
3303
|
-
yield JSON.parse(line);
|
|
3304
|
-
} catch {
|
|
3305
|
-
}
|
|
3306
|
-
}
|
|
3307
|
-
}
|
|
3308
|
-
}
|
|
3309
|
-
buffer += decoder.decode();
|
|
3310
|
-
if (buffer.trim()) {
|
|
3521
|
+
let pending = [];
|
|
3522
|
+
const parse = (line) => {
|
|
3311
3523
|
try {
|
|
3312
|
-
|
|
3524
|
+
return { value: JSON.parse(line) };
|
|
3313
3525
|
} catch {
|
|
3526
|
+
return void 0;
|
|
3314
3527
|
}
|
|
3315
|
-
}
|
|
3528
|
+
};
|
|
3529
|
+
while (true) {
|
|
3530
|
+
const { done, value } = await reader.read();
|
|
3531
|
+
if (done) break;
|
|
3532
|
+
const text2 = decoder.decode(value, { stream: true });
|
|
3533
|
+
let start = 0;
|
|
3534
|
+
let idx = text2.indexOf("\n");
|
|
3535
|
+
while (idx !== -1) {
|
|
3536
|
+
pending.push(text2.slice(start, idx));
|
|
3537
|
+
const line = pending.join("").trim();
|
|
3538
|
+
pending = [];
|
|
3539
|
+
start = idx + 1;
|
|
3540
|
+
const parsed2 = line ? parse(line) : void 0;
|
|
3541
|
+
if (parsed2) yield parsed2.value;
|
|
3542
|
+
idx = text2.indexOf("\n", start);
|
|
3543
|
+
}
|
|
3544
|
+
if (start < text2.length) pending.push(text2.slice(start));
|
|
3545
|
+
}
|
|
3546
|
+
pending.push(decoder.decode());
|
|
3547
|
+
const tail = pending.join("").trim();
|
|
3548
|
+
const parsed = tail ? parse(tail) : void 0;
|
|
3549
|
+
if (parsed) yield parsed.value;
|
|
3316
3550
|
}
|
|
3317
3551
|
async function daemonBaseUrl(sandbox) {
|
|
3318
3552
|
const url = await sandbox.getPreviewLink(DAEMON_PORT);
|
|
@@ -3646,7 +3880,8 @@ ${serialized}` : serialized;
|
|
|
3646
3880
|
await Promise.allSettled([...pendingReplies]);
|
|
3647
3881
|
}
|
|
3648
3882
|
};
|
|
3649
|
-
const
|
|
3883
|
+
const parkOption = request.options.provider?.parkBackgroundWork;
|
|
3884
|
+
const parking = parkOption && "wakeUrl" in parkOption ? parkOption : void 0;
|
|
3650
3885
|
await consumeClaudeMessages(
|
|
3651
3886
|
request,
|
|
3652
3887
|
sink,
|
|
@@ -3784,12 +4019,12 @@ async function consumeClaudeMessages(request, sink, messages, executeStartedAt,
|
|
|
3784
4019
|
);
|
|
3785
4020
|
};
|
|
3786
4021
|
const budgetLeftMs = () => Math.max(0, timeoutMs - waitedMs - (pendingWait?.elapsedMs() ?? 0));
|
|
3787
|
-
const tryPark = async () => {
|
|
4022
|
+
const tryPark = async (inflight) => {
|
|
3788
4023
|
const live = tracker.liveTasks();
|
|
3789
4024
|
const ttlMs = budgetLeftMs();
|
|
3790
4025
|
if (!wait.park || live.length === 0 || isAborted() || ttlMs <= 0)
|
|
3791
4026
|
return false;
|
|
3792
|
-
parked = await wait.park(live, ttlMs).catch(() => false);
|
|
4027
|
+
parked = await wait.park(live, ttlMs, inflight).catch(() => false);
|
|
3793
4028
|
if (parked)
|
|
3794
4029
|
debugClaude(
|
|
3795
4030
|
"\u2605 parked the harness with %d background task(s); settling",
|
|
@@ -3827,7 +4062,7 @@ async function consumeClaudeMessages(request, sink, messages, executeStartedAt,
|
|
|
3827
4062
|
break;
|
|
3828
4063
|
}
|
|
3829
4064
|
if ("reason" in step) {
|
|
3830
|
-
if (!(step.reason === "finished" && await tryPark()))
|
|
4065
|
+
if (!(step.reason === "finished" && await tryPark(next)))
|
|
3831
4066
|
expiry = step.reason;
|
|
3832
4067
|
break;
|
|
3833
4068
|
}
|
|
@@ -4147,31 +4382,29 @@ async function consumeClaudeMessages(request, sink, messages, executeStartedAt,
|
|
|
4147
4382
|
async function executeNativeClaude(request, sink, wait = {}) {
|
|
4148
4383
|
const { query } = await import("@anthropic-ai/claude-agent-sdk");
|
|
4149
4384
|
const claudeDir = claudeConfigDir(request.options);
|
|
4150
|
-
const
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
const prompt = new AsyncQueue();
|
|
4385
|
+
const attachOnly = request.run.resumeParked === true;
|
|
4386
|
+
const input = attachOnly ? [] : await validateProviderUserInput(request.provider, request.run.input);
|
|
4387
|
+
const parkOption = request.options.provider?.parkBackgroundWork;
|
|
4388
|
+
const parking = parkOption && "onWake" in parkOption ? parkOption : void 0;
|
|
4155
4389
|
const sessionId = request.run.resumeSessionId ?? randomUUID();
|
|
4390
|
+
if (request.run.forkSessionId)
|
|
4391
|
+
await findParkedNativeSession(request.run.forkSessionId)?.end();
|
|
4392
|
+
const adopting = request.run.resumeSessionId ? findParkedNativeSession(request.run.resumeSessionId) : void 0;
|
|
4156
4393
|
const controller = new AbortController();
|
|
4157
4394
|
const tracker = new BackgroundTaskTracker();
|
|
4158
4395
|
let handle;
|
|
4159
4396
|
let processHandle;
|
|
4160
|
-
let stopped;
|
|
4161
4397
|
let cancelled = false;
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
controller.abort();
|
|
4166
|
-
if (processHandle) await processHandle.kill();
|
|
4167
|
-
})();
|
|
4398
|
+
let parked = false;
|
|
4399
|
+
let session;
|
|
4400
|
+
const stop = () => session?.end() ?? Promise.resolve();
|
|
4168
4401
|
sink.setAbort(async () => {
|
|
4169
4402
|
cancelled = true;
|
|
4170
4403
|
await stop();
|
|
4171
4404
|
});
|
|
4172
4405
|
sink.setSessionId(sessionId);
|
|
4173
4406
|
const messageId = randomUUID();
|
|
4174
|
-
|
|
4407
|
+
const userMessage = {
|
|
4175
4408
|
type: "user",
|
|
4176
4409
|
uuid: messageId,
|
|
4177
4410
|
message: {
|
|
@@ -4181,7 +4414,7 @@ async function executeNativeClaude(request, sink, wait = {}) {
|
|
|
4181
4414
|
)
|
|
4182
4415
|
},
|
|
4183
4416
|
parent_tool_use_id: null
|
|
4184
|
-
}
|
|
4417
|
+
};
|
|
4185
4418
|
const hostEnv = Object.fromEntries(
|
|
4186
4419
|
Object.entries({ ...process.env, ...request.options.env }).filter(
|
|
4187
4420
|
(entry) => entry[1] !== void 0
|
|
@@ -4209,9 +4442,87 @@ async function executeNativeClaude(request, sink, wait = {}) {
|
|
|
4209
4442
|
const autoApprove = shouldAutoApproveClaudeTools(request.options);
|
|
4210
4443
|
const interactiveQuestions = hasInteractiveQuestions(request.options);
|
|
4211
4444
|
let planning = options.permissionMode === "plan";
|
|
4212
|
-
|
|
4445
|
+
const handlers = {
|
|
4446
|
+
async preToolUse(input2) {
|
|
4447
|
+
if (input2.hook_event_name !== "PreToolUse") return {};
|
|
4448
|
+
planning = input2.permission_mode === "plan";
|
|
4449
|
+
return interactiveQuestions && ["AskUserQuestion", "ExitPlanMode"].includes(input2.tool_name) ? {
|
|
4450
|
+
hookSpecificOutput: {
|
|
4451
|
+
hookEventName: "PreToolUse",
|
|
4452
|
+
permissionDecision: "ask"
|
|
4453
|
+
}
|
|
4454
|
+
} : {};
|
|
4455
|
+
},
|
|
4456
|
+
async canUseTool(toolName, input2, context) {
|
|
4457
|
+
if (cancelled || context.signal.aborted)
|
|
4458
|
+
return {
|
|
4459
|
+
behavior: "deny",
|
|
4460
|
+
message: "Run cancelled",
|
|
4461
|
+
interrupt: true
|
|
4462
|
+
};
|
|
4463
|
+
const isQuestion = toolName === "AskUserQuestion";
|
|
4464
|
+
const isPlan = toolName === "ExitPlanMode";
|
|
4465
|
+
if ((isQuestion || isPlan) && !interactiveQuestions)
|
|
4466
|
+
return {
|
|
4467
|
+
behavior: "deny",
|
|
4468
|
+
message: "No interactive user is available."
|
|
4469
|
+
};
|
|
4470
|
+
if (!isQuestion && !isPlan && planning && toolName !== "EnterPlanMode")
|
|
4471
|
+
return {
|
|
4472
|
+
behavior: "deny",
|
|
4473
|
+
message: "Finish planning before requesting write access."
|
|
4474
|
+
};
|
|
4475
|
+
if (!isQuestion && !isPlan && autoApprove)
|
|
4476
|
+
return { behavior: "allow", updatedInput: input2 };
|
|
4477
|
+
try {
|
|
4478
|
+
const response = await sink.requestPermission({
|
|
4479
|
+
type: "permission.requested",
|
|
4480
|
+
provider: request.provider,
|
|
4481
|
+
runId: request.runId,
|
|
4482
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4483
|
+
requestId: context.toolUseID,
|
|
4484
|
+
kind: isQuestion ? "question" : isPlan ? "plan" : "tool",
|
|
4485
|
+
toolName,
|
|
4486
|
+
...isQuestion ? { questions: normalizeUserQuestions("claude-code", input2) } : {},
|
|
4487
|
+
title: isQuestion ? "Your input is needed" : isPlan ? "Review the plan" : context.title ?? `Allow ${toolName}?`,
|
|
4488
|
+
message: context.description ?? context.decisionReason,
|
|
4489
|
+
input: input2,
|
|
4490
|
+
canRemember: false
|
|
4491
|
+
});
|
|
4492
|
+
if (isPlan && response.decision === "allow") planning = false;
|
|
4493
|
+
if (!cancelled && !context.signal.aborted && response.decision === "allow")
|
|
4494
|
+
return {
|
|
4495
|
+
behavior: "allow",
|
|
4496
|
+
updatedInput: isQuestion ? {
|
|
4497
|
+
...input2,
|
|
4498
|
+
answers: questionReply(
|
|
4499
|
+
"claude-code",
|
|
4500
|
+
input2,
|
|
4501
|
+
response.answers ?? []
|
|
4502
|
+
)
|
|
4503
|
+
} : input2
|
|
4504
|
+
};
|
|
4505
|
+
return { behavior: "deny", message: "The user denied this action" };
|
|
4506
|
+
} catch {
|
|
4507
|
+
return {
|
|
4508
|
+
behavior: "deny",
|
|
4509
|
+
message: "Run cancelled",
|
|
4510
|
+
interrupt: true
|
|
4511
|
+
};
|
|
4512
|
+
}
|
|
4513
|
+
}
|
|
4514
|
+
};
|
|
4515
|
+
const startCli = () => {
|
|
4516
|
+
const fresh = new NativeClaudeSession(sessionId, async () => {
|
|
4517
|
+
fresh.prompt.finish();
|
|
4518
|
+
handle?.close();
|
|
4519
|
+
controller.abort();
|
|
4520
|
+
if (processHandle) await processHandle.kill();
|
|
4521
|
+
});
|
|
4522
|
+
session = fresh;
|
|
4523
|
+
fresh.prompt.push(userMessage);
|
|
4213
4524
|
handle = query({
|
|
4214
|
-
prompt,
|
|
4525
|
+
prompt: fresh.prompt,
|
|
4215
4526
|
options: {
|
|
4216
4527
|
...options,
|
|
4217
4528
|
// Use the SDK-matched CLI by default; an installed CLI is an explicit override.
|
|
@@ -4232,89 +4543,42 @@ async function executeNativeClaude(request, sink, wait = {}) {
|
|
|
4232
4543
|
});
|
|
4233
4544
|
return processHandle.child;
|
|
4234
4545
|
},
|
|
4546
|
+
// Routed through the session so that whichever run is attached
|
|
4547
|
+
// decides, and a parked CLI with nobody attached is never left
|
|
4548
|
+
// waiting on a decision.
|
|
4235
4549
|
hooks: {
|
|
4236
4550
|
...options.hooks,
|
|
4237
4551
|
PreToolUse: [
|
|
4238
4552
|
...options.hooks?.PreToolUse ?? [],
|
|
4239
|
-
{
|
|
4240
|
-
hooks: [
|
|
4241
|
-
async (input2) => {
|
|
4242
|
-
if (input2.hook_event_name !== "PreToolUse") return {};
|
|
4243
|
-
planning = input2.permission_mode === "plan";
|
|
4244
|
-
return interactiveQuestions && ["AskUserQuestion", "ExitPlanMode"].includes(
|
|
4245
|
-
input2.tool_name
|
|
4246
|
-
) ? {
|
|
4247
|
-
hookSpecificOutput: {
|
|
4248
|
-
hookEventName: "PreToolUse",
|
|
4249
|
-
permissionDecision: "ask"
|
|
4250
|
-
}
|
|
4251
|
-
} : {};
|
|
4252
|
-
}
|
|
4253
|
-
]
|
|
4254
|
-
}
|
|
4553
|
+
{ hooks: [fresh.preToolUse] }
|
|
4255
4554
|
]
|
|
4256
4555
|
},
|
|
4257
|
-
|
|
4258
|
-
if (cancelled || context.signal.aborted)
|
|
4259
|
-
return {
|
|
4260
|
-
behavior: "deny",
|
|
4261
|
-
message: "Run cancelled",
|
|
4262
|
-
interrupt: true
|
|
4263
|
-
};
|
|
4264
|
-
const isQuestion = toolName === "AskUserQuestion";
|
|
4265
|
-
const isPlan = toolName === "ExitPlanMode";
|
|
4266
|
-
if ((isQuestion || isPlan) && !interactiveQuestions)
|
|
4267
|
-
return {
|
|
4268
|
-
behavior: "deny",
|
|
4269
|
-
message: "No interactive user is available."
|
|
4270
|
-
};
|
|
4271
|
-
if (!isQuestion && !isPlan && planning && toolName !== "EnterPlanMode")
|
|
4272
|
-
return {
|
|
4273
|
-
behavior: "deny",
|
|
4274
|
-
message: "Finish planning before requesting write access."
|
|
4275
|
-
};
|
|
4276
|
-
if (!isQuestion && !isPlan && autoApprove)
|
|
4277
|
-
return { behavior: "allow", updatedInput: input2 };
|
|
4278
|
-
try {
|
|
4279
|
-
const response = await sink.requestPermission({
|
|
4280
|
-
type: "permission.requested",
|
|
4281
|
-
provider: request.provider,
|
|
4282
|
-
runId: request.runId,
|
|
4283
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4284
|
-
requestId: context.toolUseID,
|
|
4285
|
-
kind: isQuestion ? "question" : isPlan ? "plan" : "tool",
|
|
4286
|
-
toolName,
|
|
4287
|
-
...isQuestion ? { questions: normalizeUserQuestions("claude-code", input2) } : {},
|
|
4288
|
-
title: isQuestion ? "Your input is needed" : isPlan ? "Review the plan" : context.title ?? `Allow ${toolName}?`,
|
|
4289
|
-
message: context.description ?? context.decisionReason,
|
|
4290
|
-
input: input2,
|
|
4291
|
-
canRemember: false
|
|
4292
|
-
});
|
|
4293
|
-
if (isPlan && response.decision === "allow") planning = false;
|
|
4294
|
-
if (!cancelled && !context.signal.aborted && response.decision === "allow")
|
|
4295
|
-
return {
|
|
4296
|
-
behavior: "allow",
|
|
4297
|
-
updatedInput: isQuestion ? {
|
|
4298
|
-
...input2,
|
|
4299
|
-
answers: questionReply(
|
|
4300
|
-
"claude-code",
|
|
4301
|
-
input2,
|
|
4302
|
-
response.answers ?? []
|
|
4303
|
-
)
|
|
4304
|
-
} : input2
|
|
4305
|
-
};
|
|
4306
|
-
return { behavior: "deny", message: "The user denied this action" };
|
|
4307
|
-
} catch {
|
|
4308
|
-
return {
|
|
4309
|
-
behavior: "deny",
|
|
4310
|
-
message: "Run cancelled",
|
|
4311
|
-
interrupt: true
|
|
4312
|
-
};
|
|
4313
|
-
}
|
|
4314
|
-
}
|
|
4556
|
+
canUseTool: fresh.canUseTool
|
|
4315
4557
|
}
|
|
4316
4558
|
});
|
|
4317
|
-
|
|
4559
|
+
fresh.bind(handle);
|
|
4560
|
+
return fresh.open(handlers);
|
|
4561
|
+
};
|
|
4562
|
+
const notice = (item) => (async function* () {
|
|
4563
|
+
yield item;
|
|
4564
|
+
})();
|
|
4565
|
+
try {
|
|
4566
|
+
let messages;
|
|
4567
|
+
const adopted = adopting?.adopt(handlers, attachOnly);
|
|
4568
|
+
if (adopted) {
|
|
4569
|
+
debugClaude("\u2605 adopting the CLI parked for session %s", sessionId);
|
|
4570
|
+
session = adopting;
|
|
4571
|
+
if (!attachOnly) adopting.prompt.push(userMessage);
|
|
4572
|
+
messages = adopted;
|
|
4573
|
+
} else if (attachOnly) {
|
|
4574
|
+
messages = notice({
|
|
4575
|
+
_notice: adopting ? "no_parked_turn" : "no_parked_run",
|
|
4576
|
+
sessionId
|
|
4577
|
+
});
|
|
4578
|
+
} else {
|
|
4579
|
+
messages = startCli();
|
|
4580
|
+
}
|
|
4581
|
+
const live = session?.query;
|
|
4318
4582
|
sink.setRaw({ query: live, claudeDir, runId: request.runId });
|
|
4319
4583
|
sink.emitEvent(
|
|
4320
4584
|
createNormalizedEvent("run.started", {
|
|
@@ -4329,30 +4593,38 @@ async function executeNativeClaude(request, sink, wait = {}) {
|
|
|
4329
4593
|
{ messageId }
|
|
4330
4594
|
)
|
|
4331
4595
|
);
|
|
4596
|
+
const owned = session;
|
|
4332
4597
|
await consumeClaudeMessages(
|
|
4333
4598
|
request,
|
|
4334
4599
|
sink,
|
|
4335
|
-
|
|
4600
|
+
messages,
|
|
4336
4601
|
Date.now(),
|
|
4337
4602
|
stop,
|
|
4338
4603
|
() => cancelled,
|
|
4339
4604
|
{
|
|
4340
4605
|
...wait,
|
|
4606
|
+
attachOnly,
|
|
4341
4607
|
// Native owns the CLI: ask it to stop leftover tasks before closing it.
|
|
4342
4608
|
stopTasks: async (ids) => {
|
|
4609
|
+
if (!live) return;
|
|
4343
4610
|
await Promise.all(
|
|
4344
4611
|
ids.map((id) => live.stopTask(id).catch(() => void 0))
|
|
4345
4612
|
);
|
|
4346
|
-
}
|
|
4613
|
+
},
|
|
4614
|
+
...parking && owned ? {
|
|
4615
|
+
park: async (tasks, ttlMs, inflight) => parked = owned.park(tasks, ttlMs, parking, inflight),
|
|
4616
|
+
// The CLI lives on in the session; nothing to let go of.
|
|
4617
|
+
detach: async () => void 0
|
|
4618
|
+
} : {}
|
|
4347
4619
|
},
|
|
4348
4620
|
tracker
|
|
4349
4621
|
);
|
|
4350
4622
|
} catch (error) {
|
|
4351
|
-
await stop();
|
|
4623
|
+
if (!parked) await stop();
|
|
4352
4624
|
if (cancelled) sink.cancel();
|
|
4353
4625
|
else throw error;
|
|
4354
4626
|
} finally {
|
|
4355
|
-
await stop();
|
|
4627
|
+
if (!parked) await stop();
|
|
4356
4628
|
}
|
|
4357
4629
|
}
|
|
4358
4630
|
|
|
@@ -8028,8 +8300,8 @@ var Agent = class {
|
|
|
8028
8300
|
throw new Error("AgentRunConfig.forkAtMessageId requires forkSessionId.");
|
|
8029
8301
|
}
|
|
8030
8302
|
if (runConfig.resumeParked) {
|
|
8031
|
-
if (this.provider !== AgentProvider.ClaudeCode || !this.options.sandbox) {
|
|
8032
|
-
throw new Error("AgentRunConfig.resumeParked is only supported for claude-code sandbox runs.");
|
|
8303
|
+
if (this.provider !== AgentProvider.ClaudeCode || !this.options.sandbox && this.options.configuration !== "native") {
|
|
8304
|
+
throw new Error("AgentRunConfig.resumeParked is only supported for claude-code sandbox or native runs.");
|
|
8033
8305
|
}
|
|
8034
8306
|
if (!runConfig.resumeSessionId) {
|
|
8035
8307
|
throw new Error("AgentRunConfig.resumeParked requires resumeSessionId.");
|
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,
|
|
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-DM6zUiv1.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
|
|
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-DM6zUiv1.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-PFGHRDL4.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
|
@@ -495,7 +495,7 @@ interface AgentRunConfig {
|
|
|
495
495
|
systemPrompt?: string;
|
|
496
496
|
resumeSessionId?: string;
|
|
497
497
|
/**
|
|
498
|
-
* claude-code sandbox runs: attach to the harness parked for
|
|
498
|
+
* claude-code sandbox and native runs: attach to the harness parked for
|
|
499
499
|
* {@link resumeSessionId} without sending {@link input}, and stream the
|
|
500
500
|
* turn it started on its own. Completes with empty text when nothing is
|
|
501
501
|
* parked or no such turn exists. See `provider.parkBackgroundWork`.
|
|
@@ -714,21 +714,40 @@ interface OpenCodeProviderOptions {
|
|
|
714
714
|
args?: string[];
|
|
715
715
|
plugins?: OpenCodePluginConfig[];
|
|
716
716
|
}
|
|
717
|
+
/**
|
|
718
|
+
* Parking for native (`configuration: "native"`) runs, where this process
|
|
719
|
+
* owns the CLI: the parked CLI lives on in this process, so the next run
|
|
720
|
+
* resuming the session must run in this same process to adopt it.
|
|
721
|
+
*/
|
|
722
|
+
interface NativeParkBackgroundWork {
|
|
723
|
+
/**
|
|
724
|
+
* The parked CLI started a turn on its own with nobody attached. Start a
|
|
725
|
+
* run with `resumeParked` in this process to stream it. Resolve `false`
|
|
726
|
+
* (or throw) to be asked again with backoff; anything else counts as
|
|
727
|
+
* accepted until a run attaches.
|
|
728
|
+
*/
|
|
729
|
+
onWake(): Promise<boolean | void> | boolean | void;
|
|
730
|
+
/** The parked CLI is gone: its work finished and it exited, or its budget ran out. */
|
|
731
|
+
onEnded?(): void;
|
|
732
|
+
}
|
|
717
733
|
interface ClaudeCodeProviderOptions {
|
|
718
734
|
/**
|
|
719
|
-
*
|
|
720
|
-
*
|
|
721
|
-
*
|
|
722
|
-
*
|
|
723
|
-
*
|
|
724
|
-
*
|
|
725
|
-
*
|
|
726
|
-
*
|
|
735
|
+
* End a run at its answer even when background work is still live, and
|
|
736
|
+
* keep the CLI alive for it (a "parked" run) instead of holding the run
|
|
737
|
+
* open. A run whose turn ends with nothing live is unaffected. The next run
|
|
738
|
+
* resuming that session takes the CLI over. The park lasts what is left of
|
|
739
|
+
* `backgroundTaskTimeoutMs`.
|
|
740
|
+
*
|
|
741
|
+
* Sandbox runs: when the CLI starts a turn on its own with nobody attached
|
|
742
|
+
* (a task finished, a schedule fired) the daemon POSTs
|
|
743
|
+
* `{ runId, sessionId }` to `wakeUrl` with
|
|
744
|
+
* `Authorization: Bearer <wakeToken>`; stream that turn with
|
|
745
|
+
* `resumeParked`. Native runs: see {@link NativeParkBackgroundWork}.
|
|
727
746
|
*/
|
|
728
747
|
parkBackgroundWork?: {
|
|
729
748
|
wakeUrl: string;
|
|
730
749
|
wakeToken: string;
|
|
731
|
-
};
|
|
750
|
+
} | NativeParkBackgroundWork;
|
|
732
751
|
/** Request fast mode explicitly; false overrides inherited fast settings. */
|
|
733
752
|
fastMode?: boolean;
|
|
734
753
|
binary?: string;
|
|
@@ -1009,4 +1028,4 @@ interface AgentProviderAdapter<P extends AgentProviderName = AgentProviderName>
|
|
|
1009
1028
|
attachSendMessage(request: AgentAttachRequest<P>, content: UserContent): Promise<void>;
|
|
1010
1029
|
}
|
|
1011
1030
|
|
|
1012
|
-
export { MAX_HARNESS_COMMANDS as $, type AISDKEvent as A, type AttachedRun as B, type BackgroundTask as C, type BackgroundTasksEvent as D, type ClaudeCodeAgentOptions as E, type ClaudeCodeHookConfig as F, type ClaudeCodeHookEvent as G, type ClaudeCodeHookHandler as H, type ClaudeCodeHookMatcherGroup as I, type ClaudeCodeHooksConfig as J, type ClaudeCodeProviderOptions as K, type CodexAgentOptions as L, type CodexCommandHook as M, type CodexHookEvent as N, type CodexHookMatcherGroup as O, type CodexHooksConfig as P, type CodexModelProviderConfig as Q, type CodexProviderOptions as R, type CodexSkillEntry as S, type DataContent as T, type EmbeddedSkillConfig as U, type FilePart as V, type HarnessCommandDescriptor as W, type HarnessCommandInvocation as X, type HarnessCommandSource as Y, type HarnessCommandsEvent as Z, type ImagePart as _, type AgentApprovalMode as a, MAX_HARNESS_COMMAND_ARGUMENT_HINT as a0, MAX_HARNESS_COMMAND_DESCRIPTION as a1, MAX_HARNESS_COMMAND_NAME as a2, type MessageCompletedEvent as a3, type MessageInjectedEvent as a4, type MessageStartedEvent as a5, type
|
|
1031
|
+
export { MAX_HARNESS_COMMANDS as $, type AISDKEvent as A, type AttachedRun as B, type BackgroundTask as C, type BackgroundTasksEvent as D, type ClaudeCodeAgentOptions as E, type ClaudeCodeHookConfig as F, type ClaudeCodeHookEvent as G, type ClaudeCodeHookHandler as H, type ClaudeCodeHookMatcherGroup as I, type ClaudeCodeHooksConfig as J, type ClaudeCodeProviderOptions as K, type CodexAgentOptions as L, type CodexCommandHook as M, type CodexHookEvent as N, type CodexHookMatcherGroup as O, type CodexHooksConfig as P, type CodexModelProviderConfig as Q, type CodexProviderOptions as R, type CodexSkillEntry as S, type DataContent as T, type EmbeddedSkillConfig as U, type FilePart as V, type HarnessCommandDescriptor as W, type HarnessCommandInvocation as X, type HarnessCommandSource as Y, type HarnessCommandsEvent as Z, type ImagePart as _, type AgentApprovalMode as a, MAX_HARNESS_COMMAND_ARGUMENT_HINT as a0, MAX_HARNESS_COMMAND_DESCRIPTION as a1, MAX_HARNESS_COMMAND_NAME as a2, type MessageCompletedEvent as a3, type MessageInjectedEvent as a4, type MessageStartedEvent as a5, type NativeParkBackgroundWork as a6, type NativePlanEvent as a7, type NormalizedAgentEvent as a8, type NormalizedAgentEventBase as a9, builtinHarnessCommands as aA, claudeHarnessCommands as aB, codexHarnessCommands as aC, codexSkillMention as aD, createNormalizedEvent as aE, normalizeRawAgentEvent as aF, openCodeHarnessCommands as aG, parseHarnessCommandInvocation as aH, skillDirective as aI, toAISDKEvent as aJ, toAISDKStream as aK, type NormalizedAgentEventType as aa, type OpenCodeAgentOptions as ab, type OpenCodeCommandEntry as ac, type OpenCodePluginConfig as ad, type OpenCodePluginEvent as ae, type OpenCodePluginHookConfig as af, type OpenCodeProviderOptions as ag, type OpenCodeSkillEntry as ah, type OpenRouterPlugin as ai, type PermissionRequestedEvent as aj, type PermissionResolvedEvent as ak, type RawAgentEvent as al, type ReasoningDeltaEvent as am, type RepoSkillConfig as an, type RunCancelledEvent as ao, type RunCompletedEvent as ap, type RunErrorEvent as aq, type RunStartedEvent as ar, type SetupLayout as as, type TextDeltaEvent as at, type TextPart as au, type ToolCallCompletedEvent as av, type ToolCallDeltaEvent as aw, type ToolCallStartedEvent as ax, type UserContent as ay, type UserContentPart as az, type AgentAttachRequest as b, type AgentCommandConfig as c, type AgentCostData as d, type AgentExecutionRequest as e, type AgentLocalMcpConfig as f, type AgentMcpConfig as g, type AgentOptions as h, type AgentOptionsBase as i, type AgentOptionsMap as j, type AgentPermissionDecision as k, type AgentPermissionKind as l, type AgentPermissionResponse as m, type AgentProviderAdapter as n, type AgentProviderName as o, type AgentReasoningEffort as p, type AgentRemoteMcpConfig as q, type AgentResult as r, type AgentRun as s, type AgentRunConfig as t, type AgentRunSink as u, type AgentSetupRequest as v, type AgentSkillConfig as w, type AgentSubAgentConfig as x, type AgentUserAnswer as y, type AgentUserQuestion as z };
|
package/package.json
CHANGED
|
File without changes
|