agentbox-sdk 0.1.304 → 0.1.306
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-T7C77LCW.js → chunk-7CLAJTFC.js} +82 -20
- package/dist/events/index.d.ts +1 -1
- package/dist/events/index.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/{types-Ozo1rHKs.d.ts → types-DiZSjZma.d.ts} +23 -0
- package/package.json +1 -1
- package/dist/{chunk-EK6GC6YA.js → chunk-ZDSHOGJ4.js} +1 -1
package/dist/agents/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as AgentProviderName, h as AgentOptions, t as AgentRunConfig, s as AgentRun, r as AgentResult, a2 as RawAgentEvent, b as AgentAttachRequest, y as AttachedRun } from '../types-
|
|
2
|
-
export { a as AgentApprovalMode, c as AgentCommandConfig, d as AgentCostData, e as AgentExecutionRequest, f as AgentLocalMcpConfig, g as AgentMcpConfig, i as AgentOptionsBase, j as AgentOptionsMap, k as AgentPermissionDecision, l as AgentPermissionKind, m as AgentPermissionResponse, n as AgentProviderAdapter, p as AgentReasoningEffort, q as AgentRemoteMcpConfig, u as AgentRunSink, v as AgentSetupRequest, w as AgentSkillConfig, x as AgentSubAgentConfig, C as ClaudeCodeAgentOptions, z as ClaudeCodeHookConfig, B as ClaudeCodeHookEvent, D as ClaudeCodeHookHandler, E as ClaudeCodeHookMatcherGroup, F as ClaudeCodeHooksConfig, G as ClaudeCodeProviderOptions, H as CodexAgentOptions, I as CodexCommandHook, J as CodexHookEvent, K as CodexHookMatcherGroup, L as CodexHooksConfig, M as CodexProviderOptions, N as DataContent, O as EmbeddedSkillConfig, P as FilePart, Q as ImagePart, X as OpenCodeAgentOptions, Y as OpenCodePluginConfig, Z as OpenCodePluginEvent, _ as OpenCodePluginHookConfig, $ as OpenCodeProviderOptions, a4 as RepoSkillConfig, aa as TextPart, ae as UserContent, af as UserContentPart } from '../types-
|
|
1
|
+
import { o as AgentProviderName, h as AgentOptions, t as AgentRunConfig, s as AgentRun, r as AgentResult, a2 as RawAgentEvent, b as AgentAttachRequest, y as AttachedRun } from '../types-DiZSjZma.js';
|
|
2
|
+
export { a as AgentApprovalMode, c as AgentCommandConfig, d as AgentCostData, e as AgentExecutionRequest, f as AgentLocalMcpConfig, g as AgentMcpConfig, i as AgentOptionsBase, j as AgentOptionsMap, k as AgentPermissionDecision, l as AgentPermissionKind, m as AgentPermissionResponse, n as AgentProviderAdapter, p as AgentReasoningEffort, q as AgentRemoteMcpConfig, u as AgentRunSink, v as AgentSetupRequest, w as AgentSkillConfig, x as AgentSubAgentConfig, C as ClaudeCodeAgentOptions, z as ClaudeCodeHookConfig, B as ClaudeCodeHookEvent, D as ClaudeCodeHookHandler, E as ClaudeCodeHookMatcherGroup, F as ClaudeCodeHooksConfig, G as ClaudeCodeProviderOptions, H as CodexAgentOptions, I as CodexCommandHook, J as CodexHookEvent, K as CodexHookMatcherGroup, L as CodexHooksConfig, M as CodexProviderOptions, N as DataContent, O as EmbeddedSkillConfig, P as FilePart, Q as ImagePart, X as OpenCodeAgentOptions, Y as OpenCodePluginConfig, Z as OpenCodePluginEvent, _ as OpenCodePluginHookConfig, $ as OpenCodeProviderOptions, a4 as RepoSkillConfig, aa as TextPart, ae as UserContent, af as UserContentPart } from '../types-DiZSjZma.js';
|
|
3
3
|
import { S as Sandbox } from '../Sandbox-K6VNqKeo.js';
|
|
4
4
|
export { AgentProvider } from '../enums.js';
|
|
5
5
|
import 'e2b';
|
package/dist/agents/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
createNormalizedEvent,
|
|
3
3
|
normalizeRawAgentEvent,
|
|
4
4
|
toAISDKStream
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ZDSHOGJ4.js";
|
|
6
6
|
import {
|
|
7
7
|
AgentBoxError,
|
|
8
8
|
AsyncQueue,
|
|
@@ -1595,7 +1595,7 @@ function extractOpenCodeCostData(events) {
|
|
|
1595
1595
|
}
|
|
1596
1596
|
|
|
1597
1597
|
// src/agents/providers/claude-code.ts
|
|
1598
|
-
var DAEMON_PROTOCOL_VERSION = "
|
|
1598
|
+
var DAEMON_PROTOCOL_VERSION = "2";
|
|
1599
1599
|
var DAEMON_PORT = 43180;
|
|
1600
1600
|
var DAEMON_PATH = "/tmp/agentbox/claude-code/daemon.mjs";
|
|
1601
1601
|
var DAEMON_LOG_PATH = "/tmp/agentbox/claude-code/daemon.log";
|
|
@@ -1688,7 +1688,7 @@ function createClaudeCodeDaemonScript() {
|
|
|
1688
1688
|
return `import http from "node:http";
|
|
1689
1689
|
import { execSync } from "node:child_process";
|
|
1690
1690
|
import { existsSync } from "node:fs";
|
|
1691
|
-
import { query } from "@anthropic-ai/claude-agent-sdk";
|
|
1691
|
+
import { query, getSessionInfo } from "@anthropic-ai/claude-agent-sdk";
|
|
1692
1692
|
|
|
1693
1693
|
const VERSION = ${version};
|
|
1694
1694
|
const port = Number(process.argv[2] ?? "${DAEMON_PORT}");
|
|
@@ -1787,6 +1787,16 @@ async function handleStart(req, res, runId) {
|
|
|
1787
1787
|
"x-daemon-version": VERSION,
|
|
1788
1788
|
});
|
|
1789
1789
|
|
|
1790
|
+
// Heartbeat: write a blank NDJSON line every 15s so HTTPS proxies
|
|
1791
|
+
// (Modal/Daytona tunnels, intermediate LBs) don't idle-kill the
|
|
1792
|
+
// stream during long blocking tool calls (e.g. TaskOutput block:true).
|
|
1793
|
+
// The host's parseNdjsonStream skips empty lines, so this is a no-op
|
|
1794
|
+
// for consumers but keeps the underlying TCP stream warm.
|
|
1795
|
+
const heartbeat = setInterval(() => {
|
|
1796
|
+
if (!res.writableEnded) res.write("\\n");
|
|
1797
|
+
}, 15000);
|
|
1798
|
+
if (typeof heartbeat.unref === "function") heartbeat.unref();
|
|
1799
|
+
|
|
1790
1800
|
const opts = { ...(options || {}) };
|
|
1791
1801
|
const autoApprove = !!opts.autoApproveTools;
|
|
1792
1802
|
delete opts.autoApproveTools;
|
|
@@ -1794,6 +1804,36 @@ async function handleStart(req, res, runId) {
|
|
|
1794
1804
|
opts.pathToClaudeCodeExecutable,
|
|
1795
1805
|
);
|
|
1796
1806
|
|
|
1807
|
+
// Resume-if-exists gate. \`claude --resume <id>\` errors hard with "No
|
|
1808
|
+
// conversation found with session ID" when the local session jsonl is
|
|
1809
|
+
// missing \u2014 most often because a prior post-task snapshot failed and the
|
|
1810
|
+
// sandbox state we resumed from doesn't have it. Probe the session
|
|
1811
|
+
// store; if the id isn't there, drop \`resume\` (and its companions) and
|
|
1812
|
+
// reuse the same UUID via \`sessionId\` so the host's pre-minted session
|
|
1813
|
+
// id stays consistent with what claude-agent-sdk actually emits.
|
|
1814
|
+
if (opts.resume) {
|
|
1815
|
+
let sessionExists = false;
|
|
1816
|
+
try {
|
|
1817
|
+
const info = await getSessionInfo(opts.resume, opts.cwd ? { dir: opts.cwd } : undefined);
|
|
1818
|
+
sessionExists = info !== undefined;
|
|
1819
|
+
} catch {
|
|
1820
|
+
sessionExists = false;
|
|
1821
|
+
}
|
|
1822
|
+
if (!sessionExists) {
|
|
1823
|
+
const orphanedId = opts.resume;
|
|
1824
|
+
delete opts.resume;
|
|
1825
|
+
delete opts.resumeSessionAt;
|
|
1826
|
+
delete opts.forkSession;
|
|
1827
|
+
opts.sessionId = orphanedId;
|
|
1828
|
+
res.write(
|
|
1829
|
+
JSON.stringify({
|
|
1830
|
+
_notice: "resume_session_missing",
|
|
1831
|
+
sessionId: orphanedId,
|
|
1832
|
+
}) + "\\n",
|
|
1833
|
+
);
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1797
1837
|
let queryHandle;
|
|
1798
1838
|
try {
|
|
1799
1839
|
queryHandle = query({
|
|
@@ -1804,6 +1844,7 @@ async function handleStart(req, res, runId) {
|
|
|
1804
1844
|
},
|
|
1805
1845
|
});
|
|
1806
1846
|
} catch (e) {
|
|
1847
|
+
clearInterval(heartbeat);
|
|
1807
1848
|
res.write(JSON.stringify({ _error: String(e?.message ?? e) }) + "\\n");
|
|
1808
1849
|
res.end();
|
|
1809
1850
|
return;
|
|
@@ -1813,6 +1854,7 @@ async function handleStart(req, res, runId) {
|
|
|
1813
1854
|
|
|
1814
1855
|
// Client disconnected (e.g. host process killed) \u2192 tear down.
|
|
1815
1856
|
req.on("close", () => {
|
|
1857
|
+
clearInterval(heartbeat);
|
|
1816
1858
|
if (!liveRuns.has(runId)) return;
|
|
1817
1859
|
liveRuns.delete(runId);
|
|
1818
1860
|
promptStream.end();
|
|
@@ -1827,6 +1869,7 @@ async function handleStart(req, res, runId) {
|
|
|
1827
1869
|
} catch (e) {
|
|
1828
1870
|
res.write(JSON.stringify({ _error: String(e?.message ?? e) }) + "\\n");
|
|
1829
1871
|
} finally {
|
|
1872
|
+
clearInterval(heartbeat);
|
|
1830
1873
|
liveRuns.delete(runId);
|
|
1831
1874
|
promptStream.end();
|
|
1832
1875
|
res.end();
|
|
@@ -2243,10 +2286,24 @@ var ClaudeCodeAgentAdapter = class {
|
|
|
2243
2286
|
const rawPayloads = [];
|
|
2244
2287
|
try {
|
|
2245
2288
|
for await (const item of parseNdjsonStream(response.body)) {
|
|
2246
|
-
if (item && typeof item === "object"
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2289
|
+
if (item && typeof item === "object") {
|
|
2290
|
+
const ctrl = item;
|
|
2291
|
+
if ("_error" in ctrl) {
|
|
2292
|
+
throw new Error(
|
|
2293
|
+
String(item._error ?? "daemon error")
|
|
2294
|
+
);
|
|
2295
|
+
}
|
|
2296
|
+
if ("_notice" in ctrl) {
|
|
2297
|
+
debugClaude("daemon notice: %o", ctrl);
|
|
2298
|
+
sink.emitRaw(
|
|
2299
|
+
toRawEvent(
|
|
2300
|
+
request.runId,
|
|
2301
|
+
ctrl,
|
|
2302
|
+
`daemon.${String(ctrl._notice ?? "notice")}`
|
|
2303
|
+
)
|
|
2304
|
+
);
|
|
2305
|
+
continue;
|
|
2306
|
+
}
|
|
2250
2307
|
}
|
|
2251
2308
|
const message = item;
|
|
2252
2309
|
rawPayloads.push(message);
|
|
@@ -2357,7 +2414,11 @@ var ClaudeCodeAgentAdapter = class {
|
|
|
2357
2414
|
Date.now() - executeStartedAt,
|
|
2358
2415
|
lastTerminalReason
|
|
2359
2416
|
);
|
|
2360
|
-
sink.fail(
|
|
2417
|
+
sink.fail(
|
|
2418
|
+
new Error(
|
|
2419
|
+
finalText || `claude-code run failed (terminal_reason: ${lastTerminalReason})`
|
|
2420
|
+
)
|
|
2421
|
+
);
|
|
2361
2422
|
} else {
|
|
2362
2423
|
debugClaude(
|
|
2363
2424
|
"\u2605 run.completed (%dms since execute start) chars=%d",
|
|
@@ -3724,19 +3785,13 @@ var OPEN_CODE_REASONING_LEVELS = ["low", "medium", "high", "xhigh"];
|
|
|
3724
3785
|
function openCodeAgentSlug(reasoning) {
|
|
3725
3786
|
return reasoning ? `agentbox-${reasoning}` : "agentbox";
|
|
3726
3787
|
}
|
|
3788
|
+
var FALLBACK_OPEN_CODE_AGENT_PROMPT = "You are an AI coding assistant. Follow the user's instructions.";
|
|
3727
3789
|
function buildOpenCodeConfig(options, interactiveApproval) {
|
|
3728
3790
|
const mcpConfig = buildOpenCodeMcpConfig(options.mcps);
|
|
3729
3791
|
const commandsConfig = buildOpenCodeCommandsConfig(options.commands);
|
|
3730
3792
|
const baseAgent = {
|
|
3731
3793
|
mode: "primary",
|
|
3732
|
-
|
|
3733
|
-
// PROMPT_ANTHROPIC's "You are OpenCode...") so request.run.systemPrompt
|
|
3734
|
-
// is the dominant identity statement the model sees. opencode's
|
|
3735
|
-
// session/llm.ts uses agent.prompt instead of SystemPrompt.provider(model)
|
|
3736
|
-
// when this field is truthy — codex already takes that branch via a
|
|
3737
|
-
// separate options.instructions channel, so this brings anthropic et al.
|
|
3738
|
-
// in line. Constant value, so setupId stays stable.
|
|
3739
|
-
prompt: "You are an AI coding assistant. Follow the user's instructions.",
|
|
3794
|
+
prompt: options.systemPrompt || FALLBACK_OPEN_CODE_AGENT_PROMPT,
|
|
3740
3795
|
permission: buildOpenCodePermissionConfig(interactiveApproval),
|
|
3741
3796
|
tools: {
|
|
3742
3797
|
write: true,
|
|
@@ -4320,10 +4375,17 @@ var OpenCodeAgentAdapter = class {
|
|
|
4320
4375
|
const dispatchPrompt = async (parts) => {
|
|
4321
4376
|
const body = JSON.stringify({
|
|
4322
4377
|
...request.run.model ? { model: toOpenCodeModel(request.run.model) } : {},
|
|
4323
|
-
// Per-message system prompt
|
|
4324
|
-
//
|
|
4325
|
-
//
|
|
4326
|
-
//
|
|
4378
|
+
// Per-message system prompt override. opencode appends this
|
|
4379
|
+
// *after* `agent.prompt` and the runtime appendix
|
|
4380
|
+
// (env/AGENTS.md/skills) when composing the final system
|
|
4381
|
+
// string — see `buildOpenCodeConfig` for the full ordering.
|
|
4382
|
+
// For Anthropic models specifically, this trailing-position
|
|
4383
|
+
// content tends to be ignored; callers that need the prompt
|
|
4384
|
+
// to actually steer Sonnet/Opus should pass it via
|
|
4385
|
+
// `OpenCodeAgentOptions.systemPrompt` so it's baked into
|
|
4386
|
+
// `agent.prompt` (the leading position) at setup time
|
|
4387
|
+
// instead. This per-message field stays as a per-run
|
|
4388
|
+
// override path that's effective for codex/GPT/Gemini.
|
|
4327
4389
|
...request.run.systemPrompt ? { system: request.run.systemPrompt } : {},
|
|
4328
4390
|
agent: agentSlug,
|
|
4329
4391
|
parts
|
package/dist/events/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AISDKEvent, R as MessageCompletedEvent, S as MessageInjectedEvent, T as MessageStartedEvent, U as NormalizedAgentEvent, V as NormalizedAgentEventBase, W as NormalizedAgentEventType, a0 as PermissionRequestedEvent, a1 as PermissionResolvedEvent, a2 as RawAgentEvent, a3 as ReasoningDeltaEvent, a5 as RunCancelledEvent, a6 as RunCompletedEvent, a7 as RunErrorEvent, a8 as RunStartedEvent, a9 as TextDeltaEvent, ab as ToolCallCompletedEvent, ac as ToolCallDeltaEvent, ad as ToolCallStartedEvent, ag as createNormalizedEvent, ah as normalizeRawAgentEvent, ai as toAISDKEvent, aj as toAISDKStream } from '../types-
|
|
1
|
+
export { A as AISDKEvent, R as MessageCompletedEvent, S as MessageInjectedEvent, T as MessageStartedEvent, U as NormalizedAgentEvent, V as NormalizedAgentEventBase, W as NormalizedAgentEventType, a0 as PermissionRequestedEvent, a1 as PermissionResolvedEvent, a2 as RawAgentEvent, a3 as ReasoningDeltaEvent, a5 as RunCancelledEvent, a6 as RunCompletedEvent, a7 as RunErrorEvent, a8 as RunStartedEvent, a9 as TextDeltaEvent, ab as ToolCallCompletedEvent, ac as ToolCallDeltaEvent, ad as ToolCallStartedEvent, ag as createNormalizedEvent, ah as normalizeRawAgentEvent, ai as toAISDKEvent, aj as toAISDKStream } from '../types-DiZSjZma.js';
|
|
2
2
|
import { AgentProvider } from '../enums.js';
|
|
3
3
|
import '../Sandbox-K6VNqKeo.js';
|
|
4
4
|
import 'e2b';
|
package/dist/events/index.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AISDKEvent, a as AgentApprovalMode, b as AgentAttachRequest, c as AgentCommandConfig, d as AgentCostData, e as AgentExecutionRequest, f as AgentLocalMcpConfig, g as AgentMcpConfig, h as AgentOptions, i as AgentOptionsBase, j as AgentOptionsMap, k as AgentPermissionDecision, l as AgentPermissionKind, m as AgentPermissionResponse, n as AgentProviderAdapter, o as AgentProviderName, p as AgentReasoningEffort, q as AgentRemoteMcpConfig, r as AgentResult, s as AgentRun, t as AgentRunConfig, u as AgentRunSink, v as AgentSetupRequest, w as AgentSkillConfig, x as AgentSubAgentConfig, y as AttachedRun, C as ClaudeCodeAgentOptions, z as ClaudeCodeHookConfig, B as ClaudeCodeHookEvent, D as ClaudeCodeHookHandler, E as ClaudeCodeHookMatcherGroup, F as ClaudeCodeHooksConfig, G as ClaudeCodeProviderOptions, H as CodexAgentOptions, I as CodexCommandHook, J as CodexHookEvent, K as CodexHookMatcherGroup, L as CodexHooksConfig, M as CodexProviderOptions, N as DataContent, O as EmbeddedSkillConfig, P as FilePart, Q as ImagePart, R as MessageCompletedEvent, S as MessageInjectedEvent, T as MessageStartedEvent, U as NormalizedAgentEvent, V as NormalizedAgentEventBase, W as NormalizedAgentEventType, X as OpenCodeAgentOptions, Y as OpenCodePluginConfig, Z as OpenCodePluginEvent, _ as OpenCodePluginHookConfig, $ as OpenCodeProviderOptions, a0 as PermissionRequestedEvent, a1 as PermissionResolvedEvent, a2 as RawAgentEvent, a3 as ReasoningDeltaEvent, a4 as RepoSkillConfig, a5 as RunCancelledEvent, a6 as RunCompletedEvent, a7 as RunErrorEvent, a8 as RunStartedEvent, a9 as TextDeltaEvent, aa as TextPart, ab as ToolCallCompletedEvent, ac as ToolCallDeltaEvent, ad as ToolCallStartedEvent, ae as UserContent, af as UserContentPart, ag as createNormalizedEvent, ah as normalizeRawAgentEvent, ai as toAISDKEvent, aj as toAISDKStream } from './types-
|
|
1
|
+
export { A as AISDKEvent, a as AgentApprovalMode, b as AgentAttachRequest, c as AgentCommandConfig, d as AgentCostData, e as AgentExecutionRequest, f as AgentLocalMcpConfig, g as AgentMcpConfig, h as AgentOptions, i as AgentOptionsBase, j as AgentOptionsMap, k as AgentPermissionDecision, l as AgentPermissionKind, m as AgentPermissionResponse, n as AgentProviderAdapter, o as AgentProviderName, p as AgentReasoningEffort, q as AgentRemoteMcpConfig, r as AgentResult, s as AgentRun, t as AgentRunConfig, u as AgentRunSink, v as AgentSetupRequest, w as AgentSkillConfig, x as AgentSubAgentConfig, y as AttachedRun, C as ClaudeCodeAgentOptions, z as ClaudeCodeHookConfig, B as ClaudeCodeHookEvent, D as ClaudeCodeHookHandler, E as ClaudeCodeHookMatcherGroup, F as ClaudeCodeHooksConfig, G as ClaudeCodeProviderOptions, H as CodexAgentOptions, I as CodexCommandHook, J as CodexHookEvent, K as CodexHookMatcherGroup, L as CodexHooksConfig, M as CodexProviderOptions, N as DataContent, O as EmbeddedSkillConfig, P as FilePart, Q as ImagePart, R as MessageCompletedEvent, S as MessageInjectedEvent, T as MessageStartedEvent, U as NormalizedAgentEvent, V as NormalizedAgentEventBase, W as NormalizedAgentEventType, X as OpenCodeAgentOptions, Y as OpenCodePluginConfig, Z as OpenCodePluginEvent, _ as OpenCodePluginHookConfig, $ as OpenCodeProviderOptions, a0 as PermissionRequestedEvent, a1 as PermissionResolvedEvent, a2 as RawAgentEvent, a3 as ReasoningDeltaEvent, a4 as RepoSkillConfig, a5 as RunCancelledEvent, a6 as RunCompletedEvent, a7 as RunErrorEvent, a8 as RunStartedEvent, a9 as TextDeltaEvent, aa as TextPart, ab as ToolCallCompletedEvent, ac as ToolCallDeltaEvent, ad as ToolCallStartedEvent, ae as UserContent, af as UserContentPart, ag as createNormalizedEvent, ah as normalizeRawAgentEvent, ai as toAISDKEvent, aj as toAISDKStream } from './types-DiZSjZma.js';
|
|
2
2
|
export { AGENT_RESERVED_PORTS, Agent, collectAllAgentReservedPorts } from './agents/index.js';
|
|
3
3
|
export { A as AsyncCommandHandle, C as CommandEvent, a as CommandOptions, b as CommandResult, D as DaytonaProviderOptions, c as DaytonaSandboxOptions, E as E2bProviderOptions, d as E2bSandboxOptions, G as GitCloneOptions, L as LocalDockerProviderOptions, e as LocalDockerSandboxOptions, M as ModalProviderOptions, f as ModalSandboxOptions, S as Sandbox, g as SandboxDescriptor, h as SandboxListOptions, i as SandboxOptions, j as SandboxOptionsBase, k as SandboxOptionsMap, l as SandboxProviderName, m as SandboxRaw, n as SandboxRawMap, o as SandboxResourceSpec, T as TarballEntry, V as VercelGitSource, p as VercelProviderOptions, q as VercelSandboxOptions } from './Sandbox-K6VNqKeo.js';
|
|
4
4
|
export { SandboxAdapter, buildGitCloneCommand } from './sandboxes/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Agent
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7CLAJTFC.js";
|
|
4
4
|
import {
|
|
5
5
|
ProviderLogAssembler,
|
|
6
6
|
createNormalizedEvent,
|
|
7
7
|
normalizeRawAgentEvent,
|
|
8
8
|
toAISDKEvent,
|
|
9
9
|
toAISDKStream
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-ZDSHOGJ4.js";
|
|
11
11
|
import {
|
|
12
12
|
Sandbox,
|
|
13
13
|
SandboxAdapter,
|
|
@@ -385,6 +385,29 @@ interface CodexAgentOptions extends AgentOptionsBase {
|
|
|
385
385
|
}
|
|
386
386
|
interface OpenCodeAgentOptions extends AgentOptionsBase {
|
|
387
387
|
provider?: OpenCodeProviderOptions;
|
|
388
|
+
/**
|
|
389
|
+
* Setup-time system prompt baked into the opencode agent's `prompt` field.
|
|
390
|
+
*
|
|
391
|
+
* When set, this REPLACES opencode's built-in provider prompt
|
|
392
|
+
* (`anthropic.txt` / `codex.txt` / `gemini.txt` / etc.) and is the most
|
|
393
|
+
* prominent system message the model sees. Use this when you need the
|
|
394
|
+
* prompt to actually steer Anthropic models — opencode appends
|
|
395
|
+
* {@link AgentRunConfig.systemPrompt} *after* its long provider prompt,
|
|
396
|
+
* which Sonnet/Opus tend to ignore in favor of the leading content.
|
|
397
|
+
*
|
|
398
|
+
* Trade-off: replacing the provider prompt drops opencode's hand-tuned
|
|
399
|
+
* Anthropic tool-usage hints. Models still receive tool definitions and
|
|
400
|
+
* the runtime appendix (MCPs/skills/sub-agents/commands) via the
|
|
401
|
+
* per-message `system` field, so tools remain functional — just less
|
|
402
|
+
* prominently announced.
|
|
403
|
+
*
|
|
404
|
+
* Setup-time field: changing it between runs invalidates the
|
|
405
|
+
* setup-manifest cache and triggers a re-upload of the agent config on
|
|
406
|
+
* the next `setup()` call. {@link AgentRunConfig.systemPrompt} continues
|
|
407
|
+
* to work as a per-message override (appended after `agent.prompt`),
|
|
408
|
+
* which is fine for codex/GPT models but weak for Anthropic.
|
|
409
|
+
*/
|
|
410
|
+
systemPrompt?: string;
|
|
388
411
|
}
|
|
389
412
|
interface ClaudeCodeAgentOptions extends AgentOptionsBase {
|
|
390
413
|
provider?: ClaudeCodeProviderOptions;
|
package/package.json
CHANGED
|
@@ -466,8 +466,8 @@ var ClaudeCodeLogAssembler = class {
|
|
|
466
466
|
const text = this.textByMessageId.get(messageId) ?? "";
|
|
467
467
|
const thinking = this.thinkingByMessageId.get(messageId) ?? "";
|
|
468
468
|
const content = [];
|
|
469
|
-
if (text) content.push({ type: "text", text });
|
|
470
469
|
if (thinking) content.push({ type: "thinking", thinking });
|
|
470
|
+
if (text) content.push({ type: "text", text });
|
|
471
471
|
for (const block of extraBlocks) content.push(clone(block));
|
|
472
472
|
const next = {
|
|
473
473
|
type: "message.updated",
|