agent-neckbeard 1.1.26 → 1.1.28

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/docs/MODAL.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Modal Provider
2
2
 
3
- Modal is supported by both `Agent` and `SandboxClient`. It requires **Node.js 22 or later on the host** and uses the `modal` JavaScript SDK, pinned to the 0.10 release line. E2B and Daytona retain the package's existing host Node.js support.
3
+ Modal is supported by both `LegacyBundledAgent` and `SandboxClient`. It requires **Node.js 22 or later on the host** and uses the `modal` JavaScript SDK, pinned to the 0.10 release line. E2B and Daytona retain the package's existing host Node.js support.
4
4
 
5
5
  ## Configuration
6
6
 
@@ -39,19 +39,25 @@ All settings except `provider` are optional:
39
39
  | `timeoutMs` | `3600000` | Fixed sandbox lifetime, multiples of `1000` milliseconds from `1000` through `86400000` (24 hours); e.g. `1001` is rejected before SDK I/O |
40
40
  | `cpu` | Modal default | Positive finite CPU reservation, fractional values accepted |
41
41
  | `memoryMiB` | Modal default | Positive integer memory reservation |
42
+ | `regions` | any region | Regions the sandbox may run in, such as `['us']` or `['us-east']`; see [Region Selection](#region-selection) |
43
+ | `networkBlockAll` | `false` | Block all outbound traffic; cannot be combined with non-empty allow lists |
44
+ | `networkAllowList` | unset | Comma-separated CIDR ranges the sandbox may reach, any protocol |
45
+ | `domainAllowList` | unset | Comma-separated domains the sandbox may reach over HTTPS; `*.` wildcards match the domain and its subdomains |
46
+ | `command` | unset | `SandboxClient.create()` only: runs as the sandbox's main process and uses `template` as-is, without the setup layer below. `Agent` uses it for prebuilt images |
47
+ | `registrySecret` | unset | `SandboxClient.create()` only: name of a Modal Secret with `REGISTRY_USERNAME` and `REGISTRY_PASSWORD`, to pull a private `template` |
42
48
 
43
- The adapter extends the registry image with `USER root`, Bash, Python 3, util-linux (`flock`/`setsid`), coreutils, sudo, curl, and CA certificates. **It forces root for both setup and payload execution, even if your custom image declares a non-root user.** There is currently no user override. Custom images must support `apt-get` and provide a compatible Node.js/npm installation for `Agent`. Home and work directories are `/root`; runtime files live in `/root/agent`. The first image build can add latency; Modal caches image layers.
49
+ The adapter extends the registry image with `USER root`, Bash, Python 3, util-linux (`flock`/`setsid`), coreutils, sudo, curl, and CA certificates. **It forces root for both setup and payload execution, even if your custom image declares a non-root user.** There is currently no user override. Custom images must support `apt-get` and provide a compatible Node.js/npm installation for `LegacyBundledAgent`. The runtime starts with a fixed `PATH`, so when the image's `node`, `npm`, or `npx` resolve elsewhere, such as an nvm install, the adapter links them into `/usr/local/bin`. Home and work directories are `/root`; runtime files live in `/root/agent`. The first image build can add latency; Modal caches image layers.
44
50
 
45
- Use the same sandbox settings in an Agent:
51
+ Use the same sandbox settings in a `LegacyBundledAgent`:
46
52
 
47
53
  ```typescript
48
- const agent = new Agent({
54
+ const agent = new LegacyBundledAgent({
49
55
  sandbox: { provider: 'modal', appName: 'my-agents', timeoutMs: 3_600_000 },
50
56
  // sourceFile, inputSchema, outputSchema, run, etc.
51
57
  });
52
58
  ```
53
59
 
54
- `SandboxClient.create()` additionally accepts `envs` and an explicit `tokenId` / `tokenSecret` pair. Both credentials must be supplied together. `Agent` deliberately uses host SDK credentials rather than storing them in agent config.
60
+ `SandboxClient.create()` additionally accepts `envs` and an explicit `tokenId` / `tokenSecret` pair. Both credentials must be supplied together. `LegacyBundledAgent` deliberately uses host SDK credentials rather than storing them in agent config.
55
61
 
56
62
  Reconnect from a different host using only the persisted sandbox ID and credentials for the same workspace:
57
63
 
@@ -63,19 +69,19 @@ const sandbox = await SandboxClient.connect({
63
69
  });
64
70
  ```
65
71
 
66
- Reconnect does not create a replacement sandbox, restart a terminated sandbox, or extend its lifetime. Creation-only options are rejected on connect. `Agent.run(..., { sandboxId })` and attached sessions reconnect and recover the HTTP runtime using the existing shared lifecycle.
72
+ Reconnect does not create a replacement sandbox, restart a terminated sandbox, or extend its lifetime. Creation-only options are rejected on connect. `LegacyBundledAgent.run(..., { sandboxId })` and attached sessions reconnect and recover the HTTP runtime using the existing shared lifecycle.
67
73
 
68
74
  ## Claude Permissions Under Root
69
75
 
70
- For a consumer using Claude Agent SDK with `permissionMode: 'bypassPermissions'` in this root-based Modal image, explicitly set **`Agent.envs: { IS_SANDBOX: '1' }`** in addition to the SDK's permission options. Otherwise Claude's root-user check can reject `--dangerously-skip-permissions`. Consumer direct-agent acceptance succeeded after this explicit workaround; it is not something the provider enables automatically.
76
+ For a consumer using Claude Agent SDK with `permissionMode: 'bypassPermissions'` in this root-based Modal image, explicitly set **`LegacyBundledAgent.envs: { IS_SANDBOX: '1' }`** in addition to the SDK's permission options. Otherwise Claude's root-user check can reject `--dangerously-skip-permissions`. Consumer direct-agent acceptance succeeded after this explicit workaround; it is not something the provider enables automatically.
71
77
 
72
78
  ```typescript
73
79
  import { fileURLToPath } from 'node:url';
74
- import { Agent } from 'agent-neckbeard';
80
+ import { LegacyBundledAgent } from 'agent-neckbeard';
75
81
  import { query } from '@anthropic-ai/claude-agent-sdk';
76
82
  import { z } from 'zod';
77
83
 
78
- export const claudeAgent = new Agent({
84
+ export const claudeAgent = new LegacyBundledAgent({
79
85
  sourceFile: fileURLToPath(import.meta.url),
80
86
  sandbox: { provider: 'modal', timeoutMs: 600_000 },
81
87
  envs: {
@@ -102,7 +108,7 @@ export const claudeAgent = new Agent({
102
108
  });
103
109
  ```
104
110
 
105
- From your host caller, deploy/run inside `try/finally` and call `await claudeAgent.kill()` in `finally`. Install and pin your supported Claude Agent SDK and schema dependency in that consumer. Do not put Modal provider credentials in `Agent.envs`.
111
+ From your host caller, deploy/run inside `try/finally` and call `await claudeAgent.kill()` in `finally`. Install and pin your supported Claude Agent SDK and schema dependency in that consumer. Do not put Modal provider credentials in `LegacyBundledAgent.envs`.
106
112
 
107
113
  Bypassing permissions allows agent tool execution without interactive approval, as root inside this image. Opt in only when that matches your application's trust and isolation policy. `IS_SANDBOX` is a CLI compatibility hint, not an isolation mechanism: it does not drop root privileges or replace tool restrictions, network policy, or private HTTP authentication. For permission-restricted agents, configure the appropriate Claude permission mode instead; the provider does not add bypass settings or `IS_SANDBOX` by default.
108
114
 
@@ -121,11 +127,21 @@ No encrypted or unencrypted public tunnels are created. The adapter obtains a po
121
127
  - Detached commands use the existing `DetachedProcessController`, not a bare background exec/PID handle. Prepare/release fencing, `beforeRelease`, stable `launchId` adoption, clean lifecycle environment, descriptor-based payload environment handoff, process-tree stop confirmation, bounded diagnostic logs, and exact-generation artifact disposal are unchanged.
122
128
  - Persist the complete `SandboxDetachedCommand` returned by `startDetachedCommand()`. Modal handles use the `modal-process-v2:` ownership prefix and the existing on-disk V3 lifecycle protocol. Foreign, malformed, and legacy/native handles are rejected before provider I/O.
123
129
  - Stop first, optionally read final diagnostics, then dispose artifacts. Disposal is irreversible and does not replace exact stop confirmation. Do not call stop after disposal; the proof required to stop has intentionally been removed.
124
- - `destroy()` waits for Modal termination and tolerates a provider not-found response. Other provider failures still reject. Failed `Agent.deploy()` attempts retain the shared best-effort stop/destroy cleanup and preserve the original error.
130
+ - `destroy()` waits for Modal termination and tolerates a provider not-found response. Other provider failures still reject. Failed `LegacyBundledAgent.deploy()` attempts retain the shared best-effort stop/destroy cleanup and preserve the original error.
131
+
132
+ ## Region Selection
133
+
134
+ Without `regions`, Modal may place a sandbox in any region worldwide. Every file and command call from the host pays the round trip, so a sandbox far from the host slows deploys and turns: from a us-east host, measured per-call latency ranged from about 80 ms in us-east to about 1.5 s in ap-south. Pin `regions` near the host, preferring a broad region such as `us`, which Modal bills at 1.15x, over a narrow one such as `us-east`, at 1.75x and with a smaller pool of capacity. See [Region selection](https://modal.com/docs/guide/region-selection).
135
+
136
+ ## Network Policy
137
+
138
+ `networkBlockAll`, `networkAllowList`, and `domainAllowList` take the same shape as the Daytona options, so a Daytona network policy carries over by changing the provider. They map to Modal's `blockNetwork`, `outboundCidrAllowlist`, and `outboundDomainAllowlist` (beta). Blank lists count as unset, traffic matching either list is allowed, and without any of them Modal's default open egress applies. They are creation-only; `connect()` rejects them.
139
+
140
+ Modal matches domains by the TLS SNI, so `domainAllowList` only allows HTTPS on port 443. Plain HTTP and other TCP or UDP traffic is blocked unless its IP is in `networkAllowList`. Debian images fetch apt packages over HTTP, so when `domainAllowList` is set the adapter rewrites the image's apt sources to HTTPS, and `dependencies.apt` installs work if the mirror's domain (for example `deb.debian.org`, covered by `*.debian.org`) is allowed. A custom image whose mirror has no HTTPS endpoint can't install apt packages under a domain allow list. DNS is always allowed unless all traffic is blocked. Modal does not decrypt TLS, so an allowed SNI paired with a different `Host` header on a shared endpoint is not caught. Blocked connections are logged to the sandbox's system output. See [Sandbox networking](https://modal.com/docs/guide/sandbox-networking).
125
141
 
126
142
  ## Unsupported Options
127
143
 
128
- Modal config uses a strict allowlist. Unknown options are rejected rather than silently dropped, including `apiKey`, `allowPublicTraffic` (even `false`), public tunnel ports, `requestTimeoutMs`, Daytona network policies, auto-stop/auto-delete settings, idle timeout, GPUs, volumes, private registry credentials, custom working directories, snapshots, and experimental SDK features. Network policy passthrough is not part of this adapter. Modal's default outbound network policy applies.
144
+ Modal config uses a strict allowlist. Unknown options are rejected rather than silently dropped, including `apiKey`, `allowPublicTraffic` (even `false`), public tunnel ports, `requestTimeoutMs`, auto-stop/auto-delete settings, idle timeout, GPUs, volumes, private registry credentials, custom working directories, snapshots, and experimental SDK features, including runtime network policy updates.
129
145
 
130
146
  `setTimeout()` is unsupported: choose the lifetime at creation. Foreground command options support only `cwd`, `envs`, `timeoutMs`, `onStdout`, and `onStderr`; do not pass a provider-native `background` option. Use `startDetachedCommand()` instead.
131
147
 
@@ -133,7 +149,7 @@ The separate public durable Pi supervisor target remains Daytona-specific. This
133
149
 
134
150
  ## Next.js and Live Tests
135
151
 
136
- Use `withNeckbeardNextConfig(...)` and an explicit Agent `sourceFile` as usual. The helper externalizes both `agent-neckbeard` and `modal`; package builds also leave the Modal SDK external. No SDK client is created merely by importing Neckbeard. Use Node.js 22+ for Modal routes/workers.
152
+ Use `withNeckbeardNextConfig(...)` and an explicit `LegacyBundledAgent` `sourceFile` as usual. The helper externalizes both `agent-neckbeard` and `modal`; package builds also leave the Modal SDK external. No SDK client is created merely by importing Neckbeard. Use Node.js 22+ for Modal routes/workers.
137
153
 
138
154
  ```bash
139
155
  npm test -- --runInBand tests/unit/modal.test.ts tests/unit/modal-resources.test.ts tests/unit/modal-config.test.ts
@@ -1,8 +1,8 @@
1
1
  # Durable Sessions (Sandbox Supervisor)
2
2
 
3
- > **Deprecated.** The durable-session supervisor is no longer maintained and will be removed in a future major release. Attached sessions (`Agent.createSession()`) remain supported, but they are not durable: a turn stops when its caller disconnects, and nothing is replayed.
3
+ > **Deprecated.** The durable-session supervisor is no longer maintained and will be removed in a future major release. Attached sessions (`LegacyBundledAgent.createSession()`) remain supported, but they are not durable: a turn stops when its caller disconnects, and nothing is replayed.
4
4
 
5
- The sandbox supervisor is the implementation of Neckbeard's opt-in durable-session runtime. It is separate from the attached HTTP/SSE session transport: importing `agent-neckbeard/supervisor` does not change `Agent.deploy()`, `run()`, `createSession()`, the deprecated `invoke()` wrapper, or `kill()`.
5
+ The sandbox supervisor is the implementation of Neckbeard's opt-in durable-session runtime. It is separate from the attached HTTP/SSE session transport: importing `agent-neckbeard/supervisor` does not change `LegacyBundledAgent.deploy()`, `run()`, `createSession()`, the deprecated `invoke()` wrapper, or `kill()`.
6
6
 
7
7
  The v1 adapter embeds Pi through `@earendil-works/pi-coding-agent`'s structured SDK. The generated Node runtime connects outward from a Daytona sandbox to a WebSocket gateway, journals durable events before sending them, and lets an accepted Pi turn continue when the gateway or Hatchet worker disconnects.
8
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-neckbeard",
3
- "version": "1.1.26",
3
+ "version": "1.1.28",
4
4
  "description": "Deploy AI agents to E2B, Daytona, and Modal sandboxes, or local Docker containers",
5
5
  "type": "module",
6
6
  "exports": {
@@ -23,8 +23,31 @@
23
23
  "types": "./dist/supervisor.d.cts",
24
24
  "default": "./dist/supervisor.cjs"
25
25
  }
26
+ },
27
+ "./serve": {
28
+ "import": {
29
+ "types": "./dist/serve.d.ts",
30
+ "default": "./dist/serve.js"
31
+ },
32
+ "require": {
33
+ "types": "./dist/serve.d.cts",
34
+ "default": "./dist/serve.cjs"
35
+ }
36
+ },
37
+ "./build": {
38
+ "import": {
39
+ "types": "./dist/build.d.ts",
40
+ "default": "./dist/build.js"
41
+ },
42
+ "require": {
43
+ "types": "./dist/build.d.cts",
44
+ "default": "./dist/build.cjs"
45
+ }
26
46
  }
27
47
  },
48
+ "bin": {
49
+ "neckbeard": "./dist/cli.js"
50
+ },
28
51
  "main": "./dist/index.cjs",
29
52
  "module": "./dist/index.js",
30
53
  "types": "./dist/index.d.cts",
@@ -34,7 +57,11 @@
34
57
  "CHANGELOG.md",
35
58
  "docs/SUPERVISOR.md",
36
59
  "docs/MODAL.md",
37
- "docs/DOCKER.md"
60
+ "docs/DOCKER.md",
61
+ "docs/AGENT.md",
62
+ "docs/DAYTONA.md",
63
+ "docs/E2B.md",
64
+ "docs/LEGACY.md"
38
65
  ],
39
66
  "engines": {
40
67
  "node": ">=20.18.1 <21 || >=22"
@@ -67,18 +94,31 @@
67
94
  "esbuild": "^0.28.2",
68
95
  "modal": "^0.10.0"
69
96
  },
97
+ "optionalDependencies": {
98
+ "skills": "1.8.1"
99
+ },
70
100
  "peerDependencies": {
71
- "zod": "^3.0.0 || ^4.0.0"
101
+ "zod": "^3.0.0 || ^4.0.0",
102
+ "@earendil-works/pi-coding-agent": ">=1.3.0 <2.0.0",
103
+ "braintrust": ">=3.44.0 <4.0.0"
72
104
  },
73
105
  "peerDependenciesMeta": {
74
106
  "zod": {
75
107
  "optional": true
108
+ },
109
+ "@earendil-works/pi-coding-agent": {
110
+ "optional": true
111
+ },
112
+ "braintrust": {
113
+ "optional": true
76
114
  }
77
115
  },
78
116
  "devDependencies": {
117
+ "@earendil-works/pi-coding-agent": "1.5.2",
79
118
  "@grpc/grpc-js": "^1.14.4",
80
119
  "@types/jest": "^30.0.0",
81
120
  "@types/node": "^22.0.0",
121
+ "braintrust": "3.44.0",
82
122
  "dotenv": "^17.3.1",
83
123
  "jest": "^30.3.0",
84
124
  "ts-jest": "^29.4.6",
@@ -1,48 +0,0 @@
1
- import {
2
- isSerializedError
3
- } from "./chunk-33IXN6MM.js";
4
-
5
- // src/runtime/protocol.ts
6
- var RUNTIME_PROTOCOL_VERSION = 1;
7
- var RUNTIME_ABORT_GRACE_MS = 1e4;
8
- function isHarnessEvent(value) {
9
- if (!value || typeof value !== "object") return false;
10
- const candidate = value;
11
- if (typeof candidate.kind !== "string") return false;
12
- if (typeof candidate.invocationId !== "string") return false;
13
- if (!hasValidMetadata(candidate)) return false;
14
- switch (candidate.kind) {
15
- case "started":
16
- case "done":
17
- return true;
18
- case "frame":
19
- return Object.hasOwn(candidate, "data");
20
- case "output":
21
- return Object.hasOwn(candidate, "output");
22
- case "error":
23
- return isSerializedError(candidate.error);
24
- default:
25
- return false;
26
- }
27
- }
28
- function hasValidMetadata(candidate) {
29
- if (candidate.protocolVersion !== void 0 && candidate.protocolVersion !== RUNTIME_PROTOCOL_VERSION) {
30
- return false;
31
- }
32
- if (candidate.sequence !== void 0 && typeof candidate.sequence !== "number") {
33
- return false;
34
- }
35
- if (candidate.timestamp !== void 0 && typeof candidate.timestamp !== "string") {
36
- return false;
37
- }
38
- if (candidate.elapsedMs !== void 0 && typeof candidate.elapsedMs !== "number") {
39
- return false;
40
- }
41
- return true;
42
- }
43
-
44
- export {
45
- RUNTIME_PROTOCOL_VERSION,
46
- RUNTIME_ABORT_GRACE_MS,
47
- isHarnessEvent
48
- };