agentbox-sdk 0.1.517 → 0.1.519

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
@@ -711,7 +711,18 @@ events with `kind: "question"`. Respond with `decision: "allow"` and an `answers
711
711
  array containing each `questionId` and its selected or custom `values`, or use
712
712
  `decision: "deny"` to skip. Invalid answers leave the request pending for correction.
713
713
  Question answers cannot modify unrelated tool arguments. Ordinary tool requests
714
- use the same API without `answers`.
714
+ use the same API without `answers`. Denying a Codex command or file change sends
715
+ `decline`, so the agent can continue without that action. Stopping the whole run
716
+ is a separate operation (`run.abort()`).
717
+
718
+ Codex can also ask without pausing (`request_user_input_async`): the app-server
719
+ accepts the call itself and the turn keeps working. That ask is not a permission
720
+ request; it arrives as a `message.completed` event carrying `questions` (same
721
+ `AgentUserQuestion` shape, bare-string options become labels) next to the text
722
+ Codex rendered for it. Nothing is pending, so there is nothing to respond to:
723
+ relay the user's choice as a follow-up message (`run.sendMessage()` while the
724
+ run is live, otherwise the next run of the session). Claude Code and OpenCode
725
+ have no non-blocking ask; their questions always pause as `permission.requested`.
715
726
 
716
727
  Native runtimes own a POSIX process group by default. Termination is bounded and
717
728
  escalates to SIGKILL if the process ignores SIGTERM. A supervisor that launches
@@ -1,5 +1,5 @@
1
- import { o as AgentProviderName, h as AgentOptions, t as AgentRunConfig, s as AgentRun, r as AgentResult, ak as RawAgentEvent, b as AgentAttachRequest, B as AttachedRun, ar as SetupLayout, ax as UserContent } from '../types-CrbPZ814.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, aa as OpenCodeAgentOptions, ab as OpenCodeCommandEntry, ac as OpenCodePluginConfig, ad as OpenCodePluginEvent, ae as OpenCodePluginHookConfig, af as OpenCodeProviderOptions, ag as OpenCodeSkillEntry, ah as OpenRouterPlugin, am as RepoSkillConfig, at as TextPart, ay as UserContentPart, az as builtinHarnessCommands, aA as claudeHarnessCommands, aB as codexHarnessCommands, aC as codexSkillMention, aF as openCodeHarnessCommands, aG as parseHarnessCommandInvocation, aH as skillDirective } from '../types-CrbPZ814.js';
1
+ import { o as AgentProviderName, h as AgentOptions, t as AgentRunConfig, s as AgentRun, r as AgentResult, ak as RawAgentEvent, b as AgentAttachRequest, B as AttachedRun, ar as SetupLayout, ax as UserContent } from '../types-DjHP7dFq.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, aa as OpenCodeAgentOptions, ab as OpenCodeCommandEntry, ac as OpenCodePluginConfig, ad as OpenCodePluginEvent, ae as OpenCodePluginHookConfig, af as OpenCodeProviderOptions, ag as OpenCodeSkillEntry, ah as OpenRouterPlugin, am as RepoSkillConfig, at as TextPart, ay as UserContentPart, az as builtinHarnessCommands, aA as claudeHarnessCommands, aB as codexHarnessCommands, aC as codexSkillMention, aF as openCodeHarnessCommands, aG as parseHarnessCommandInvocation, aH as skillDirective } from '../types-DjHP7dFq.js';
3
3
  import { S as Sandbox } from '../Sandbox-DcKAU-E3.js';
4
4
  export { AgentProvider } from '../enums.js';
5
5
  import 'e2b';
@@ -15,7 +15,7 @@ import {
15
15
  parseHarnessCommandInvocation,
16
16
  resolveHarnessCommand,
17
17
  skillDirective
18
- } from "../chunk-U3E62L37.js";
18
+ } from "../chunk-REVRD4IY.js";
19
19
  import "../chunk-V4M4LPPT.js";
20
20
  import {
21
21
  AGENT_RESERVED_PORTS,
@@ -405,6 +405,34 @@ function normalizeUserQuestions(provider, input) {
405
405
  return result;
406
406
  });
407
407
  }
408
+ function normalizeAsyncUserQuestions(provider, questions) {
409
+ if (!Array.isArray(questions) || !questions.length || questions.length > 10) return void 0;
410
+ try {
411
+ return questions.map((value, index) => {
412
+ const item = record(value);
413
+ if (item.isSecret === true) throw new Error("Secret questions cannot be relayed");
414
+ const options = item.options ?? [];
415
+ if (!Array.isArray(options) || options.length > 30) throw new Error("Unsupported agent question options");
416
+ const result = {
417
+ id: String(index),
418
+ question: text(item.title ?? item.question, 1e4),
419
+ ...item.header ? { header: text(item.header, 200) } : {},
420
+ // Codex async options are bare strings; blocking shapes use {label, description}.
421
+ options: options.map((value2) => {
422
+ if (typeof value2 === "string") return { label: text(value2, 1e3) };
423
+ const option = record(value2);
424
+ return { label: text(option.label, 1e3), ...option.description ? { description: text(option.description, 1e4) } : {} };
425
+ }),
426
+ multiple: provider === "claude-code" ? item.multiSelect === true : provider === "open-code" && item.multiple === true,
427
+ allowCustom: provider === "open-code" ? item.custom !== false : true
428
+ };
429
+ if (new Set(result.options.map((option) => option.label)).size !== result.options.length) throw new Error("Duplicate agent question options");
430
+ return result;
431
+ });
432
+ } catch {
433
+ return void 0;
434
+ }
435
+ }
408
436
  function validateUserAnswers(questions, answers) {
409
437
  if (!questions?.length || !answers || answers.length !== questions.length || new Set(answers.map((answer) => answer.questionId)).size !== answers.length) throw new Error("Answer each agent question once");
410
438
  return questions.map((question) => {
@@ -4752,8 +4780,12 @@ function toNormalizedCodexEvents(runId, notification) {
4752
4780
  return [];
4753
4781
  }
4754
4782
  if (item.type === "agentMessage" && typeof item.text === "string") {
4783
+ const questions = normalizeAsyncUserQuestions(AgentProvider.Codex, item.questions);
4755
4784
  return [
4756
- createNormalizedEvent("message.completed", base, { text: item.text })
4785
+ createNormalizedEvent("message.completed", base, {
4786
+ text: item.text,
4787
+ ...questions ? { questions } : {}
4788
+ })
4757
4789
  ];
4758
4790
  }
4759
4791
  if (item.type === "reasoning" && item.summary) {
@@ -4899,7 +4931,7 @@ function toCodexApprovalDecision(notification, response) {
4899
4931
  (part) => typeof part === "string"
4900
4932
  ) : [];
4901
4933
  if (response.decision === "deny") {
4902
- return availableDecisions.includes("decline") ? "decline" : "cancel";
4934
+ return "decline";
4903
4935
  }
4904
4936
  if (response.remember && availableDecisions.includes("acceptForSession")) {
4905
4937
  return "acceptForSession";
@@ -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, a6 as NativePlanEvent, a7 as NormalizedAgentEvent, a8 as NormalizedAgentEventBase, a9 as NormalizedAgentEventType, ai as PermissionRequestedEvent, aj as PermissionResolvedEvent, ak as RawAgentEvent, al as ReasoningDeltaEvent, an as RunCancelledEvent, ao as RunCompletedEvent, ap as RunErrorEvent, aq as RunStartedEvent, as as TextDeltaEvent, au as ToolCallCompletedEvent, av as ToolCallDeltaEvent, aw as ToolCallStartedEvent, aD as createNormalizedEvent, aE as normalizeRawAgentEvent, aI as toAISDKEvent, aJ as toAISDKStream } from '../types-CrbPZ814.js';
1
+ export { A as AISDKEvent, C as BackgroundTask, D as BackgroundTasksEvent, Z as HarnessCommandsEvent, a3 as MessageCompletedEvent, a4 as MessageInjectedEvent, a5 as MessageStartedEvent, a6 as NativePlanEvent, a7 as NormalizedAgentEvent, a8 as NormalizedAgentEventBase, a9 as NormalizedAgentEventType, ai as PermissionRequestedEvent, aj as PermissionResolvedEvent, ak as RawAgentEvent, al as ReasoningDeltaEvent, an as RunCancelledEvent, ao as RunCompletedEvent, ap as RunErrorEvent, aq as RunStartedEvent, as as TextDeltaEvent, au as ToolCallCompletedEvent, av as ToolCallDeltaEvent, aw as ToolCallStartedEvent, aD as createNormalizedEvent, aE as normalizeRawAgentEvent, aI as toAISDKEvent, aJ as toAISDKStream } from '../types-DjHP7dFq.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 NativePlanEvent, a7 as NormalizedAgentEvent, a8 as NormalizedAgentEventBase, a9 as NormalizedAgentEventType, aa as OpenCodeAgentOptions, ab as OpenCodeCommandEntry, ac as OpenCodePluginConfig, ad as OpenCodePluginEvent, ae as OpenCodePluginHookConfig, af as OpenCodeProviderOptions, ag as OpenCodeSkillEntry, ah as OpenRouterPlugin, ai as PermissionRequestedEvent, aj as PermissionResolvedEvent, ak as RawAgentEvent, al as ReasoningDeltaEvent, am as RepoSkillConfig, an as RunCancelledEvent, ao as RunCompletedEvent, ap as RunErrorEvent, aq as RunStartedEvent, ar as SetupLayout, as as TextDeltaEvent, at as TextPart, au as ToolCallCompletedEvent, av as ToolCallDeltaEvent, aw as ToolCallStartedEvent, ax as UserContent, ay as UserContentPart, az as builtinHarnessCommands, aA as claudeHarnessCommands, aB as codexHarnessCommands, aC as codexSkillMention, aD as createNormalizedEvent, aE as normalizeRawAgentEvent, aF as openCodeHarnessCommands, aG as parseHarnessCommandInvocation, aH as skillDirective, aI as toAISDKEvent, aJ as toAISDKStream } from './types-CrbPZ814.js';
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 NativePlanEvent, a7 as NormalizedAgentEvent, a8 as NormalizedAgentEventBase, a9 as NormalizedAgentEventType, aa as OpenCodeAgentOptions, ab as OpenCodeCommandEntry, ac as OpenCodePluginConfig, ad as OpenCodePluginEvent, ae as OpenCodePluginHookConfig, af as OpenCodeProviderOptions, ag as OpenCodeSkillEntry, ah as OpenRouterPlugin, ai as PermissionRequestedEvent, aj as PermissionResolvedEvent, ak as RawAgentEvent, al as ReasoningDeltaEvent, am as RepoSkillConfig, an as RunCancelledEvent, ao as RunCompletedEvent, ap as RunErrorEvent, aq as RunStartedEvent, ar as SetupLayout, as as TextDeltaEvent, at as TextPart, au as ToolCallCompletedEvent, av as ToolCallDeltaEvent, aw as ToolCallStartedEvent, ax as UserContent, ay as UserContentPart, az as builtinHarnessCommands, aA as claudeHarnessCommands, aB as codexHarnessCommands, aC as codexSkillMention, aD as createNormalizedEvent, aE as normalizeRawAgentEvent, aF as openCodeHarnessCommands, aG as parseHarnessCommandInvocation, aH as skillDirective, aI as toAISDKEvent, aJ as toAISDKStream } from './types-DjHP7dFq.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-U3E62L37.js";
18
+ } from "./chunk-REVRD4IY.js";
19
19
  import {
20
20
  ProviderLogAssembler,
21
21
  createNormalizedEvent,
@@ -180,6 +180,15 @@ interface MessageCompletedEvent extends NormalizedAgentEventBase {
180
180
  * the assistant turn rather than the user one.
181
181
  */
182
182
  messageId?: string;
183
+ /**
184
+ * Questions the harness asked without pausing the turn (Codex
185
+ * `request_user_input_async`: an `agentMessage` item with
186
+ * `delivery: "async"`). Nothing is pending and the run keeps working;
187
+ * an answer, if any, is a follow-up user message (`AgentRun.sendMessage`
188
+ * while the run is live, or the next run). Blocking questions never use
189
+ * this field: they arrive as `permission.requested` with `kind: "question"`.
190
+ */
191
+ questions?: AgentUserQuestion[];
183
192
  }
184
193
  /** Work the harness left running past its turn (background shell, monitor,
185
194
  * background subagent, scheduled wakeup). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentbox-sdk",
3
- "version": "0.1.517",
3
+ "version": "0.1.519",
4
4
  "description": "Swappable coding agents and sandbox providers for Bun and TypeScript.",
5
5
  "license": "MIT",
6
6
  "repository": {