agentbox-sdk 0.1.503 → 0.1.508

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
@@ -504,6 +504,77 @@ AGENTBOX_RUN_MATRIX_E2E=1 npm run test:e2e:matrix # provider matrix
504
504
 
505
505
  Live test suites are opt-in because they provision real infrastructure.
506
506
 
507
+ ## Host execution settings
508
+
509
+ Use `configuration: "native"` to run a host harness with its own configuration,
510
+ built-in prompt, credentials, and repository instructions. AgentBox does not
511
+ generate settings, skills, commands, subagents, hooks, plugins, or MCP definitions
512
+ in this mode. It cannot be combined with a sandbox or AgentBox-managed skills,
513
+ MCPs, commands, subagents, or RTK. Omit `systemPrompt` when starting a turn to keep
514
+ the harness's built-in instructions unchanged.
515
+
516
+ ```ts
517
+ const agent = new Agent("codex", {
518
+ cwd: "/absolute/path/to/project",
519
+ configuration: "native",
520
+ approvalMode: "interactive",
521
+ });
522
+ await agent.setup();
523
+ ```
524
+
525
+ Start a turn with `agent.stream({ input })`, consume its async event iterator,
526
+ and answer permission requests with `run.respondToPermission()`. Await
527
+ `run.finished` for the result and call `agent.killServer()` to release the runtime.
528
+
529
+ The default `configuration: "managed"` retains AgentBox-generated configuration
530
+ for host and sandbox execution.
531
+
532
+ `stateDirectory` selects a private, persistent directory for generated agent
533
+ configuration and session state on the host. It must be an absolute path and
534
+ cannot be combined with `sandbox`. Use a different directory for each execution
535
+ environment to prevent unrelated local jobs from overwriting configuration.
536
+ This setting does not copy credentials from the user's account.
537
+
538
+ With native configuration, Codex uses the user's sandbox and approval settings.
539
+ Managed host execution defaults to read-only. An explicit
540
+ `provider: { sandboxMode: "workspace-write" }` enables a host write policy;
541
+ `writableRoots` adds allowed directories and `networkAccess` enables network
542
+ access for that policy (disabled by default). The shared
543
+ `approvalMode: "interactive"` routes permission requests to the caller; it does
544
+ not itself change the native harness's policy. Cloud sandbox defaults are unchanged.
545
+
546
+ Host Claude runs the Anthropic SDK with the SDK-matched CLI by default.
547
+ `provider.binary` explicitly selects another compatible CLI. Sign-in and session
548
+ storage remain CLI-owned. Managed configuration loads generated skills, commands,
549
+ and subagents as a private local plugin. Native configuration loads user, project,
550
+ and local settings instead. Neither mode copies the CLI's credentials.
551
+
552
+ Each host OpenCode Agent owns an authenticated loopback server on an ephemeral
553
+ port. Managed configuration uses an isolated configuration directory; native
554
+ configuration preserves the user's configuration paths. `killServer()` stops
555
+ only that Agent's process. It never discovers or kills another server by port number.
556
+
557
+ All three providers normalize interactive questions into `permission.requested`
558
+ events with `kind: "question"`. Respond with `decision: "allow"` and an `answers`
559
+ array containing each `questionId` and its selected or custom `values`, or use
560
+ `decision: "deny"` to skip. Invalid answers leave the request pending for correction.
561
+ Question answers cannot modify unrelated tool arguments. Ordinary tool requests
562
+ use the same API without `answers`.
563
+
564
+ Native runtimes own a POSIX process group by default. Termination is bounded and
565
+ escalates to SIGKILL if the process ignores SIGTERM. A supervisor that launches
566
+ each run in its own process group can set `processGroup: "inherited"`; that
567
+ supervisor is then responsible for stopping the complete group before reporting
568
+ that a run has stopped. This option is unavailable for cloud sandboxes.
569
+
570
+ ## Packaging
571
+
572
+ `npm pack` builds the package from maintained TypeScript source before creating
573
+ the archive. Host execution includes the pinned Anthropic SDK and its Zod peer
574
+ as runtime dependencies; consumers do not need package-manager extensions.
575
+ Run `npm run check` before publishing. Provider integration tests use fake local
576
+ CLIs and SDK mocks; live tests remain opt-in.
577
+
507
578
  ## License
508
579
 
509
580
  MIT
@@ -1,5 +1,5 @@
1
- import { o as AgentProviderName, h as AgentOptions, t as AgentRunConfig, s as AgentRun, r as AgentResult, a4 as RawAgentEvent, b as AgentAttachRequest, y as AttachedRun, ab as SetupLayout } from '../types-3VRJIiW0.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 CodexModelProviderConfig, N as CodexProviderOptions, O as DataContent, P as EmbeddedSkillConfig, Q as FilePart, R as ImagePart, Y as OpenCodeAgentOptions, Z as OpenCodePluginConfig, _ as OpenCodePluginEvent, $ as OpenCodePluginHookConfig, a0 as OpenCodeProviderOptions, a1 as OpenRouterPlugin, a6 as RepoSkillConfig, ad as TextPart, ah as UserContent, ai as UserContentPart } from '../types-3VRJIiW0.js';
1
+ import { o as AgentProviderName, h as AgentOptions, t as AgentRunConfig, s as AgentRun, r as AgentResult, a7 as RawAgentEvent, b as AgentAttachRequest, B as AttachedRun, ae as SetupLayout, ak as UserContent } from '../types-BQ-_AUfY.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, C as ClaudeCodeAgentOptions, D as ClaudeCodeHookConfig, E as ClaudeCodeHookEvent, F as ClaudeCodeHookHandler, G as ClaudeCodeHookMatcherGroup, H as ClaudeCodeHooksConfig, I as ClaudeCodeProviderOptions, J as CodexAgentOptions, K as CodexCommandHook, L as CodexHookEvent, M as CodexHookMatcherGroup, N as CodexHooksConfig, O as CodexModelProviderConfig, P as CodexProviderOptions, Q as DataContent, R as EmbeddedSkillConfig, S as FilePart, T as ImagePart, $ as OpenCodeAgentOptions, a0 as OpenCodePluginConfig, a1 as OpenCodePluginEvent, a2 as OpenCodePluginHookConfig, a3 as OpenCodeProviderOptions, a4 as OpenRouterPlugin, a9 as RepoSkillConfig, ag as TextPart, al as UserContentPart } from '../types-BQ-_AUfY.js';
3
3
  import { S as Sandbox } from '../Sandbox-DcKAU-E3.js';
4
4
  export { AgentProvider } from '../enums.js';
5
5
  import 'e2b';
@@ -93,7 +93,7 @@ declare class Agent<P extends AgentProviderName = AgentProviderName> {
93
93
  * - **Sandbox**: `/tmp/agentbox/<provider>` inside the sandbox.
94
94
  * - **Local host**: `<os.tmpdir()>/agentbox-<provider>` on the host.
95
95
  */
96
- declare function agentboxRoot(provider: AgentProviderName, hasSandbox?: boolean): string;
96
+ declare function agentboxRoot(provider: AgentProviderName, hasSandbox?: boolean, stateDirectory?: string): string;
97
97
  /**
98
98
  * Resolve the on-disk layout (config dirs per provider) for the given
99
99
  * agentbox root. Public so external consumers (e.g. agentbox-driven
@@ -124,4 +124,15 @@ declare function getAgentLayout(rootDir: string): SetupLayout;
124
124
  declare const AGENT_RESERVED_PORTS: Record<AgentProviderName, readonly number[]>;
125
125
  declare function collectAllAgentReservedPorts(): number[];
126
126
 
127
- export { AGENT_RESERVED_PORTS, Agent, AgentAttachRequest, AgentOptions, AgentProviderName, AgentResult, AgentRun, AgentRunConfig, AttachedRun, SetupLayout, agentboxRoot, collectAllAgentReservedPorts, getAgentLayout };
127
+ type HarnessCommand = "plan" | "agent" | "goal";
128
+ interface HarnessCapabilities {
129
+ commands: HarnessCommand[];
130
+ planning: "explicit" | "agent-directed";
131
+ questions: boolean;
132
+ fullAccess: boolean;
133
+ }
134
+ /** Adapter capabilities. Runtime adapters additionally validate commands against the live harness. */
135
+ declare function harnessCapabilities(provider: AgentProviderName): HarnessCapabilities;
136
+ declare function resolveHarnessCommand(provider: AgentProviderName, input: UserContent): Pick<AgentRunConfig, "input" | "mode" | "goal">;
137
+
138
+ export { AGENT_RESERVED_PORTS, Agent, AgentAttachRequest, AgentOptions, AgentProviderName, AgentResult, AgentRun, AgentRunConfig, AttachedRun, type HarnessCapabilities, type HarnessCommand, SetupLayout, UserContent, agentboxRoot, collectAllAgentReservedPorts, getAgentLayout, harnessCapabilities, resolveHarnessCommand };
@@ -1,13 +1,15 @@
1
1
  import {
2
2
  Agent,
3
3
  agentboxRoot,
4
- getAgentLayout
5
- } from "../chunk-34LDITII.js";
4
+ getAgentLayout,
5
+ harnessCapabilities,
6
+ resolveHarnessCommand
7
+ } from "../chunk-BO4J4KSM.js";
6
8
  import "../chunk-775FIGGL.js";
7
9
  import {
8
10
  AGENT_RESERVED_PORTS,
9
11
  collectAllAgentReservedPorts
10
- } from "../chunk-AVXJMCBC.js";
12
+ } from "../chunk-MTQ2S46C.js";
11
13
  import "../chunk-NSJM57Z4.js";
12
14
  import {
13
15
  AgentProvider
@@ -18,5 +20,7 @@ export {
18
20
  AgentProvider,
19
21
  agentboxRoot,
20
22
  collectAllAgentReservedPorts,
21
- getAgentLayout
23
+ getAgentLayout,
24
+ harnessCapabilities,
25
+ resolveHarnessCommand
22
26
  };
@@ -10,7 +10,7 @@ import {
10
10
  sleep,
11
11
  suppressUnhandledRejection,
12
12
  time
13
- } from "./chunk-AVXJMCBC.js";
13
+ } from "./chunk-MTQ2S46C.js";
14
14
  import {
15
15
  shellQuote,
16
16
  toShellCommand