agentbox-sdk 0.1.513 → 0.1.515
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 +58 -2
- package/dist/agents/index.d.ts +2 -2
- package/dist/agents/index.js +1 -1
- package/dist/{chunk-XJWZR2NR.js → chunk-HVXPNGSC.js} +861 -194
- package/dist/events/index.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{types-NhKw_6mW.d.ts → types-BKvKgRMY.d.ts} +46 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -123,12 +123,68 @@ 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.
|
|
146
|
+
|
|
147
|
+
The host decides when a wait has stopped being useful. A foreground command
|
|
148
|
+
that outlives Bash's timeout is moved to the background by the CLI, and a model
|
|
149
|
+
that answers without it leaves the run open for work nobody needs.
|
|
150
|
+
`run.finishBackgroundWait()` ends the wait: a run that is only waiting stops
|
|
151
|
+
what is left and completes with the answer it already has (`run.completed`,
|
|
152
|
+
not `run.cancelled` as with `abort()`). The request latches, so calling it
|
|
153
|
+
while a turn is active applies at that turn's end; a run that never waits
|
|
154
|
+
ignores it. Use it when the user moves on, for example by sending a follow-up.
|
|
155
|
+
It applies equally to Codex native goal waits and OpenCode background subagents.
|
|
156
|
+
|
|
157
|
+
```ts
|
|
158
|
+
for await (const event of run) {
|
|
159
|
+
if (event.type === "background.tasks" && event.waiting && userMovedOn()) {
|
|
160
|
+
await run.finishBackgroundWait();
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**Parked runs (claude-code in a sandbox).** A sandbox outlives the run, and so
|
|
166
|
+
does the in-sandbox daemon, so a run there does not have to stay open at all.
|
|
167
|
+
With `provider.parkBackgroundWork: { wakeUrl, wakeToken }` a run whose turn
|
|
168
|
+
ends with background work still live **completes at its answer** and the daemon
|
|
169
|
+
keeps the CLI for that work; the last `background.tasks` event carries
|
|
170
|
+
`parked: true` and the tasks still running. A turn that ends with nothing live
|
|
171
|
+
is untouched: the CLI winds down as before. While parked:
|
|
172
|
+
|
|
173
|
+
- The next run that resumes the session takes the same CLI over (never a second
|
|
174
|
+
one on the session). It learns what was live, skips the results of turns that
|
|
175
|
+
ran before its own input, answers, and parks again if work is still live.
|
|
176
|
+
- When the CLI starts a turn on its own with nobody attached, the daemon POSTs
|
|
177
|
+
`{ runId, sessionId }` to `wakeUrl` with `Authorization: Bearer <wakeToken>`,
|
|
178
|
+
retrying until it gets a 2xx. Stream that turn with
|
|
179
|
+
`agent.stream({ input: "", resumeSessionId, resumeParked: true })`; it
|
|
180
|
+
completes with empty text if nothing is parked. Whether to act on a wake is
|
|
181
|
+
the host's call: a host already running that session is attached to the same
|
|
182
|
+
CLI, which delivers the turn inside that run.
|
|
183
|
+
- The park lasts what is left of `backgroundTaskTimeoutMs`, then the CLI winds
|
|
184
|
+
down as at the wait ceiling. A rewind (`forkSessionId`) and an explicit
|
|
185
|
+
`DELETE` end it too. With parking on, `finishBackgroundWait()` parks rather
|
|
186
|
+
than stops the work. Output is buffered while nobody is attached (partial
|
|
187
|
+
deltas excepted), up to 16 MB.
|
|
132
188
|
|
|
133
189
|
Codex owns command polling (`write_stdin`), yielded code-mode waits (`wait`),
|
|
134
190
|
and subagent waits (`wait_agent`). AgentBox finishes an ordinary Codex run on
|
|
@@ -181,7 +237,7 @@ the end of the run.
|
|
|
181
237
|
|
|
182
238
|
## Agents
|
|
183
239
|
|
|
184
|
-
|
|
240
|
+
Four agent providers are supported. Each wraps a CLI that runs inside the sandbox:
|
|
185
241
|
|
|
186
242
|
| Provider | CLI | Model format |
|
|
187
243
|
| ------------- | ---------- | ----------------------------------------------- |
|
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-BKvKgRMY.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-BKvKgRMY.js';
|
|
3
3
|
import { S as Sandbox } from '../Sandbox-DcKAU-E3.js';
|
|
4
4
|
export { AgentProvider } from '../enums.js';
|
|
5
5
|
import 'e2b';
|