agentbox-sdk 0.1.514 → 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 CHANGED
@@ -144,6 +144,48 @@ CLI, an AgentBox run owns the query lifetime: completing it closes the process.
144
144
  Keep the streaming input open while waiting so background continuations retain
145
145
  their hooks, permissions, and SDK MCP control channel.
146
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.
188
+
147
189
  Codex owns command polling (`write_stdin`), yielded code-mode waits (`wait`),
148
190
  and subagent waits (`wait_agent`). AgentBox finishes an ordinary Codex run on
149
191
  its root `turn/completed`, regardless of shell processes still running. It does
@@ -195,7 +237,7 @@ the end of the run.
195
237
 
196
238
  ## Agents
197
239
 
198
- Three agent providers are supported. Each wraps a CLI that runs inside the sandbox:
240
+ Four agent providers are supported. Each wraps a CLI that runs inside the sandbox:
199
241
 
200
242
  | Provider | CLI | Model format |
201
243
  | ------------- | ---------- | ----------------------------------------------- |
@@ -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-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';
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';
@@ -4,7 +4,7 @@ import {
4
4
  getAgentLayout,
5
5
  harnessCapabilities,
6
6
  resolveHarnessCommand
7
- } from "../chunk-D33LRRN7.js";
7
+ } from "../chunk-HVXPNGSC.js";
8
8
  import "../chunk-775FIGGL.js";
9
9
  import {
10
10
  AGENT_RESERVED_PORTS,