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 +71 -0
- package/dist/agents/index.d.ts +15 -4
- package/dist/agents/index.js +8 -4
- package/dist/{chunk-TUBBWIOM.js → chunk-76AFK7XN.js} +1 -1
- package/dist/{chunk-34LDITII.js → chunk-BO4J4KSM.js} +803 -442
- package/dist/{chunk-AVXJMCBC.js → chunk-MTQ2S46C.js} +22 -0
- package/dist/events/index.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +8 -4
- package/dist/sandboxes/index.js +2 -2
- package/dist/{types-3VRJIiW0.d.ts → types-BQ-_AUfY.d.ts} +57 -4
- package/package.json +5 -3
|
@@ -156,6 +156,27 @@ import { setTimeout as sleepTimeout } from "timers/promises";
|
|
|
156
156
|
async function sleep(ms) {
|
|
157
157
|
await sleepTimeout(ms);
|
|
158
158
|
}
|
|
159
|
+
async function getAvailablePort(host = "127.0.0.1") {
|
|
160
|
+
return new Promise((resolve, reject) => {
|
|
161
|
+
const server = net.createServer();
|
|
162
|
+
server.once("error", reject);
|
|
163
|
+
server.listen(0, host, () => {
|
|
164
|
+
const address = server.address();
|
|
165
|
+
if (!address || typeof address === "string") {
|
|
166
|
+
reject(new Error("Could not determine an available port."));
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const { port } = address;
|
|
170
|
+
server.close((error) => {
|
|
171
|
+
if (error) {
|
|
172
|
+
reject(error);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
resolve(port);
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
}
|
|
159
180
|
async function waitFor(predicate, options) {
|
|
160
181
|
const timeoutMs = options?.timeoutMs ?? 15e3;
|
|
161
182
|
const intervalMs = options?.intervalMs ?? 250;
|
|
@@ -270,6 +291,7 @@ export {
|
|
|
270
291
|
debugRelay,
|
|
271
292
|
time,
|
|
272
293
|
sleep,
|
|
294
|
+
getAvailablePort,
|
|
273
295
|
waitFor,
|
|
274
296
|
readStreamAsText,
|
|
275
297
|
readStreamAsBytes,
|
package/dist/events/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AISDKEvent,
|
|
1
|
+
export { A as AISDKEvent, U as MessageCompletedEvent, V as MessageInjectedEvent, W as MessageStartedEvent, X as NativePlanEvent, Y as NormalizedAgentEvent, Z as NormalizedAgentEventBase, _ as NormalizedAgentEventType, a5 as PermissionRequestedEvent, a6 as PermissionResolvedEvent, a7 as RawAgentEvent, a8 as ReasoningDeltaEvent, aa as RunCancelledEvent, ab as RunCompletedEvent, ac as RunErrorEvent, ad as RunStartedEvent, af as TextDeltaEvent, ah as ToolCallCompletedEvent, ai as ToolCallDeltaEvent, aj as ToolCallStartedEvent, am as createNormalizedEvent, an as normalizeRawAgentEvent, ao as toAISDKEvent, ap as toAISDKStream } from '../types-BQ-_AUfY.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,5 +1,5 @@
|
|
|
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,
|
|
2
|
-
export { AGENT_RESERVED_PORTS, Agent, agentboxRoot, collectAllAgentReservedPorts, getAgentLayout } from './agents/index.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 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, U as MessageCompletedEvent, V as MessageInjectedEvent, W as MessageStartedEvent, X as NativePlanEvent, Y as NormalizedAgentEvent, Z as NormalizedAgentEventBase, _ as NormalizedAgentEventType, $ as OpenCodeAgentOptions, a0 as OpenCodePluginConfig, a1 as OpenCodePluginEvent, a2 as OpenCodePluginHookConfig, a3 as OpenCodeProviderOptions, a4 as OpenRouterPlugin, a5 as PermissionRequestedEvent, a6 as PermissionResolvedEvent, a7 as RawAgentEvent, a8 as ReasoningDeltaEvent, a9 as RepoSkillConfig, aa as RunCancelledEvent, ab as RunCompletedEvent, ac as RunErrorEvent, ad as RunStartedEvent, ae as SetupLayout, af as TextDeltaEvent, ag as TextPart, ah as ToolCallCompletedEvent, ai as ToolCallDeltaEvent, aj as ToolCallStartedEvent, ak as UserContent, al as UserContentPart, am as createNormalizedEvent, an as normalizeRawAgentEvent, ao as toAISDKEvent, ap as toAISDKStream } from './types-BQ-_AUfY.js';
|
|
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';
|
|
5
5
|
export { ProviderLogAssembler } from './events/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Agent,
|
|
3
3
|
agentboxRoot,
|
|
4
|
-
getAgentLayout
|
|
5
|
-
|
|
4
|
+
getAgentLayout,
|
|
5
|
+
harnessCapabilities,
|
|
6
|
+
resolveHarnessCommand
|
|
7
|
+
} from "./chunk-BO4J4KSM.js";
|
|
6
8
|
import {
|
|
7
9
|
ProviderLogAssembler,
|
|
8
10
|
createNormalizedEvent,
|
|
@@ -14,11 +16,11 @@ import {
|
|
|
14
16
|
Sandbox,
|
|
15
17
|
SandboxAdapter,
|
|
16
18
|
buildGitCloneCommand
|
|
17
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-76AFK7XN.js";
|
|
18
20
|
import {
|
|
19
21
|
AGENT_RESERVED_PORTS,
|
|
20
22
|
collectAllAgentReservedPorts
|
|
21
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-MTQ2S46C.js";
|
|
22
24
|
import "./chunk-NSJM57Z4.js";
|
|
23
25
|
import {
|
|
24
26
|
AgentProvider,
|
|
@@ -37,7 +39,9 @@ export {
|
|
|
37
39
|
collectAllAgentReservedPorts,
|
|
38
40
|
createNormalizedEvent,
|
|
39
41
|
getAgentLayout,
|
|
42
|
+
harnessCapabilities,
|
|
40
43
|
normalizeRawAgentEvent,
|
|
44
|
+
resolveHarnessCommand,
|
|
41
45
|
toAISDKEvent,
|
|
42
46
|
toAISDKStream
|
|
43
47
|
};
|
package/dist/sandboxes/index.js
CHANGED
|
@@ -9,7 +9,7 @@ interface RawAgentEvent<TPayload = unknown> {
|
|
|
9
9
|
payload: TPayload;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
type NormalizedAgentEventType = "run.started" | "message.started" | "message.injected" | "text.delta" | "reasoning.delta" | "tool.call.started" | "tool.call.delta" | "tool.call.completed" | "permission.requested" | "permission.resolved" | "message.completed" | "run.completed" | "run.cancelled" | "run.error";
|
|
12
|
+
type NormalizedAgentEventType = "plan.completed" | "run.started" | "message.started" | "message.injected" | "text.delta" | "reasoning.delta" | "tool.call.started" | "tool.call.delta" | "tool.call.completed" | "permission.requested" | "permission.resolved" | "message.completed" | "run.completed" | "run.cancelled" | "run.error";
|
|
13
13
|
interface NormalizedAgentEventBase {
|
|
14
14
|
provider: string;
|
|
15
15
|
runId: string;
|
|
@@ -72,6 +72,8 @@ interface PermissionRequestedEvent extends NormalizedAgentEventBase {
|
|
|
72
72
|
type: "permission.requested";
|
|
73
73
|
requestId: string;
|
|
74
74
|
kind: AgentPermissionKind;
|
|
75
|
+
toolName?: string;
|
|
76
|
+
questions?: AgentUserQuestion[];
|
|
75
77
|
title?: string;
|
|
76
78
|
message?: string;
|
|
77
79
|
input?: unknown;
|
|
@@ -82,6 +84,7 @@ interface PermissionResolvedEvent extends NormalizedAgentEventBase {
|
|
|
82
84
|
requestId: string;
|
|
83
85
|
decision: AgentPermissionDecision;
|
|
84
86
|
remember?: boolean;
|
|
87
|
+
answers?: AgentUserAnswer[];
|
|
85
88
|
}
|
|
86
89
|
interface MessageCompletedEvent extends NormalizedAgentEventBase {
|
|
87
90
|
type: "message.completed";
|
|
@@ -105,7 +108,11 @@ interface RunErrorEvent extends NormalizedAgentEventBase {
|
|
|
105
108
|
type: "run.error";
|
|
106
109
|
error: string;
|
|
107
110
|
}
|
|
108
|
-
|
|
111
|
+
interface NativePlanEvent extends NormalizedAgentEventBase {
|
|
112
|
+
type: "plan.completed";
|
|
113
|
+
text: string;
|
|
114
|
+
}
|
|
115
|
+
type NormalizedAgentEvent = NativePlanEvent | RunStartedEvent | MessageStartedEvent | MessageInjectedEvent | TextDeltaEvent | ReasoningDeltaEvent | ToolCallStartedEvent | ToolCallDeltaEvent | ToolCallCompletedEvent | PermissionRequestedEvent | PermissionResolvedEvent | MessageCompletedEvent | RunCompletedEvent | RunCancelledEvent | RunErrorEvent;
|
|
109
116
|
declare function createNormalizedEvent<TType extends NormalizedAgentEventType>(type: TType, base: Omit<NormalizedAgentEventBase, "type" | "timestamp"> & {
|
|
110
117
|
timestamp?: string;
|
|
111
118
|
}, extra?: Record<string, unknown>): NormalizedAgentEvent;
|
|
@@ -382,17 +389,53 @@ interface AgentRunConfig {
|
|
|
382
389
|
*/
|
|
383
390
|
forkAtMessageId?: string;
|
|
384
391
|
reasoning?: AgentReasoningEffort;
|
|
392
|
+
/** Native collaboration mode; independent of tool permissions. */
|
|
393
|
+
mode?: "plan" | "default";
|
|
394
|
+
/** Native goal objective. Unsupported harnesses reject it. */
|
|
395
|
+
goal?: string;
|
|
385
396
|
}
|
|
386
397
|
type AgentApprovalMode = "auto" | "interactive";
|
|
387
|
-
type AgentPermissionKind = "bash" | "edit" | "tool" | "network" | "file-change" | "unknown";
|
|
398
|
+
type AgentPermissionKind = "bash" | "edit" | "tool" | "network" | "file-change" | "question" | "plan" | "unknown";
|
|
388
399
|
type AgentPermissionDecision = "allow" | "deny";
|
|
400
|
+
interface AgentUserQuestion {
|
|
401
|
+
id: string;
|
|
402
|
+
question: string;
|
|
403
|
+
header?: string;
|
|
404
|
+
options: Array<{
|
|
405
|
+
label: string;
|
|
406
|
+
description?: string;
|
|
407
|
+
}>;
|
|
408
|
+
multiple: boolean;
|
|
409
|
+
allowCustom: boolean;
|
|
410
|
+
}
|
|
411
|
+
interface AgentUserAnswer {
|
|
412
|
+
questionId: string;
|
|
413
|
+
values: string[];
|
|
414
|
+
}
|
|
389
415
|
interface AgentPermissionResponse {
|
|
390
416
|
requestId: string;
|
|
391
417
|
decision: AgentPermissionDecision;
|
|
392
418
|
remember?: boolean;
|
|
419
|
+
/** Required when allowing a question request. Never changes tool arguments. */
|
|
420
|
+
answers?: AgentUserAnswer[];
|
|
393
421
|
}
|
|
394
422
|
interface AgentOptionsBase {
|
|
395
423
|
sandbox?: Sandbox;
|
|
424
|
+
/** Use the host harness's own settings and built-in prompt without generating
|
|
425
|
+
* AgentBox configuration, skills, hooks, plugins, or MCP definitions.
|
|
426
|
+
* Available only for host execution. The default remains "managed".
|
|
427
|
+
*/
|
|
428
|
+
configuration?: "managed" | "native";
|
|
429
|
+
/** Private, persistent host directory for generated configuration and sessions.
|
|
430
|
+
* Use one directory per execution environment. Must be absolute; unavailable
|
|
431
|
+
* for sandbox-backed agents, whose state belongs inside the sandbox.
|
|
432
|
+
*/
|
|
433
|
+
stateDirectory?: string;
|
|
434
|
+
/** Host process ownership. Use "inherited" only when the caller supervises
|
|
435
|
+
* an existing POSIX process group and will terminate its descendants.
|
|
436
|
+
* The default "owned" gives each native runtime its own process group.
|
|
437
|
+
*/
|
|
438
|
+
processGroup?: "owned" | "inherited";
|
|
396
439
|
cwd?: string;
|
|
397
440
|
env?: Record<string, string>;
|
|
398
441
|
/**
|
|
@@ -425,12 +468,22 @@ interface AgentOptionsBase {
|
|
|
425
468
|
*/
|
|
426
469
|
customHeaders?: Record<string, string>;
|
|
427
470
|
approvalMode?: AgentApprovalMode;
|
|
471
|
+
/** Route questions and plan approvals to the caller even with automatic tool approval. */
|
|
472
|
+
interactiveQuestions?: boolean;
|
|
473
|
+
/** Explicitly bypass the harness tool sandbox; does not answer user questions. */
|
|
474
|
+
fullAccess?: boolean;
|
|
428
475
|
mcps?: AgentMcpConfig[];
|
|
429
476
|
skills?: AgentSkillConfig[];
|
|
430
477
|
subAgents?: AgentSubAgentConfig[];
|
|
431
478
|
commands?: AgentCommandConfig[];
|
|
432
479
|
}
|
|
433
480
|
interface CodexProviderOptions {
|
|
481
|
+
/** Managed host execution defaults to read-only; native configuration uses the CLI's settings. */
|
|
482
|
+
sandboxMode?: "read-only" | "workspace-write" | "danger-full-access";
|
|
483
|
+
/** Additional task worktrees permitted by native Codex's write sandbox. */
|
|
484
|
+
writableRoots?: string[];
|
|
485
|
+
/** Network access for an explicit host workspace-write policy; defaults to false. */
|
|
486
|
+
networkAccess?: boolean;
|
|
434
487
|
binary?: string;
|
|
435
488
|
env?: Record<string, string>;
|
|
436
489
|
brokerEndpoint?: string;
|
|
@@ -729,4 +782,4 @@ interface AgentProviderAdapter<P extends AgentProviderName = AgentProviderName>
|
|
|
729
782
|
attachSendMessage(request: AgentAttachRequest<P>, content: UserContent): Promise<void>;
|
|
730
783
|
}
|
|
731
784
|
|
|
732
|
-
export { type
|
|
785
|
+
export { type OpenCodeAgentOptions as $, type AISDKEvent as A, type AttachedRun as B, type ClaudeCodeAgentOptions as C, type ClaudeCodeHookConfig as D, type ClaudeCodeHookEvent as E, type ClaudeCodeHookHandler as F, type ClaudeCodeHookMatcherGroup as G, type ClaudeCodeHooksConfig as H, type ClaudeCodeProviderOptions as I, type CodexAgentOptions as J, type CodexCommandHook as K, type CodexHookEvent as L, type CodexHookMatcherGroup as M, type CodexHooksConfig as N, type CodexModelProviderConfig as O, type CodexProviderOptions as P, type DataContent as Q, type EmbeddedSkillConfig as R, type FilePart as S, type ImagePart as T, type MessageCompletedEvent as U, type MessageInjectedEvent as V, type MessageStartedEvent as W, type NativePlanEvent as X, type NormalizedAgentEvent as Y, type NormalizedAgentEventBase as Z, type NormalizedAgentEventType as _, type AgentApprovalMode as a, type OpenCodePluginConfig as a0, type OpenCodePluginEvent as a1, type OpenCodePluginHookConfig as a2, type OpenCodeProviderOptions as a3, type OpenRouterPlugin as a4, type PermissionRequestedEvent as a5, type PermissionResolvedEvent as a6, type RawAgentEvent as a7, type ReasoningDeltaEvent as a8, type RepoSkillConfig as a9, type RunCancelledEvent as aa, type RunCompletedEvent as ab, type RunErrorEvent as ac, type RunStartedEvent as ad, type SetupLayout as ae, type TextDeltaEvent as af, type TextPart as ag, type ToolCallCompletedEvent as ah, type ToolCallDeltaEvent as ai, type ToolCallStartedEvent as aj, type UserContent as ak, type UserContentPart as al, createNormalizedEvent as am, normalizeRawAgentEvent as an, toAISDKEvent as ao, toAISDKStream as ap, type AgentAttachRequest as b, type AgentCommandConfig as c, type AgentCostData as d, type AgentExecutionRequest as e, type AgentLocalMcpConfig as f, type AgentMcpConfig as g, type AgentOptions as h, type AgentOptionsBase as i, type AgentOptionsMap as j, type AgentPermissionDecision as k, type AgentPermissionKind as l, type AgentPermissionResponse as m, type AgentProviderAdapter as n, type AgentProviderName as o, type AgentReasoningEffort as p, type AgentRemoteMcpConfig as q, type AgentResult as r, type AgentRun as s, type AgentRunConfig as t, type AgentRunSink as u, type AgentSetupRequest as v, type AgentSkillConfig as w, type AgentSubAgentConfig as x, type AgentUserAnswer as y, type AgentUserQuestion as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentbox-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.508",
|
|
4
4
|
"description": "Swappable coding agents and sandbox providers for Bun and TypeScript.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"scripts": {
|
|
43
43
|
"dev": "tsup src/index.ts src/enums.ts src/agents/index.ts src/sandboxes/index.ts src/events/index.ts src/cli.ts --format esm --dts --clean --watch",
|
|
44
44
|
"build": "tsup src/index.ts src/enums.ts src/agents/index.ts src/sandboxes/index.ts src/events/index.ts src/cli.ts --format esm --dts --clean",
|
|
45
|
+
"prepack": "npm run build",
|
|
45
46
|
"typecheck": "tsc --noEmit",
|
|
46
47
|
"lint": "eslint . --max-warnings=0",
|
|
47
48
|
"lint:fix": "eslint . --fix",
|
|
@@ -58,6 +59,7 @@
|
|
|
58
59
|
"bun": ">=1.1.0"
|
|
59
60
|
},
|
|
60
61
|
"dependencies": {
|
|
62
|
+
"@anthropic-ai/claude-agent-sdk": "0.2.141",
|
|
61
63
|
"@daytonaio/sdk": "^0.171.0",
|
|
62
64
|
"@types/debug": "^4.1.13",
|
|
63
65
|
"@vercel/sandbox": "2.0.0-beta.13",
|
|
@@ -67,10 +69,10 @@
|
|
|
67
69
|
"eventsource-parser": "^3.0.6",
|
|
68
70
|
"modal": "^0.7.4",
|
|
69
71
|
"tar-stream": "^3.1.8",
|
|
70
|
-
"ws": "^8.20.0"
|
|
72
|
+
"ws": "^8.20.0",
|
|
73
|
+
"zod": "4.3.6"
|
|
71
74
|
},
|
|
72
75
|
"devDependencies": {
|
|
73
|
-
"@anthropic-ai/claude-agent-sdk": "^0.2.123",
|
|
74
76
|
"@eslint/js": "^10.0.1",
|
|
75
77
|
"@types/dockerode": "^3.3.42",
|
|
76
78
|
"@types/node": "^25.5.2",
|