@agentswf/sandbox 0.1.0-beta.3 → 0.1.0-beta.4

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/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@agentswf/sandbox",
3
- "version": "0.1.0-beta.3",
3
+ "version": "0.1.0-beta.4",
4
4
  "description": "agents.wf: the sandboxes a workflow opens, and their providers",
5
5
  "license": "MIT",
6
- "homepage": "https://github.com/romanlv/agentswf",
6
+ "homepage": "https://agents.wf",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "git+https://github.com/romanlv/agentswf.git",
@@ -28,7 +28,7 @@
28
28
  "docker"
29
29
  ],
30
30
  "dependencies": {
31
- "@agentswf/contract": "0.1.0-beta.3"
31
+ "@agentswf/contract": "0.1.0-beta.4"
32
32
  },
33
33
  "publishConfig": {
34
34
  "access": "public"
package/src/resolve.ts CHANGED
@@ -8,7 +8,7 @@ import type { Gitdir, ResolvedSandbox, SandboxProviders } from "./seam";
8
8
  const REACH_KEYS = ["read", "write", "network", "sockets", "webSearch"] as const;
9
9
 
10
10
  export type SandboxResolution = {
11
- /** The environment key the sandbox runs under: the one the spec named, else the default. */
11
+ /** The environment key the sandbox runs under, the one the spec named. */
12
12
  provider: SandboxEnvironmentKey;
13
13
  sandbox: ResolvedSandbox<unknown>;
14
14
  };
@@ -70,8 +70,10 @@ export async function resolveSandbox(
70
70
  if (named.length > 1) {
71
71
  throw new Error(`a sandbox has one environment, not ${named.join(" and ")}`);
72
72
  }
73
- const provider = named[0] ?? options.providers.default;
74
- if (provider === undefined) throw new Error("no sandbox provider is installed");
73
+ const provider = named[0];
74
+ if (provider === undefined) {
75
+ throw new Error('a sandbox spec names its provider: add "srt": {} or "docker": {}');
76
+ }
75
77
  const installed = options.providers.installed[provider];
76
78
  if (!installed) {
77
79
  const why = options.providers.unavailable?.[provider];
@@ -79,7 +81,7 @@ export async function resolveSandbox(
79
81
  `the ${provider} sandbox provider is not ${why ? `usable: ${why}` : "installed"}`,
80
82
  );
81
83
  }
82
- const environment = installed.environment(named[0] === undefined ? {} : spec[named[0]]);
84
+ const environment = installed.environment(spec[provider]);
83
85
 
84
86
  const home = await realpath(options.home ?? homedir());
85
87
  const runRoot = await realpath(options.runRoot);
package/src/seam.ts CHANGED
@@ -31,8 +31,6 @@ export interface SandboxProvider<E> {
31
31
  /** The providers an operator installed, keyed by the environment name a spec uses for each. */
32
32
  export type SandboxProviders = {
33
33
  readonly installed: Readonly<Partial<Record<SandboxEnvironmentKey, SandboxProvider<unknown>>>>;
34
- /** The environment a spec that names none runs in; absent when nothing is installed. */
35
- readonly default?: SandboxEnvironmentKey;
36
34
  /** Why a provider this machine has could not be set up: said when a spec names it. */
37
35
  readonly unavailable?: Readonly<Partial<Record<SandboxEnvironmentKey, string>>>;
38
36
  };
@@ -159,7 +157,7 @@ export type AgentDoor = {
159
157
  launcher: string;
160
158
  /** The launcher's contents for a box, copied to `launcher` inside it: `bundle` run by `bun` from `PATH`. */
161
159
  boxScript: string;
162
- /** The bundled `wf` command, a host file copied to the same path inside a box. */
160
+ /** The bundled `wfa` command, a host file copied to the same path inside a box. */
163
161
  bundle: string;
164
162
  /** Host paths the host launcher reads: its interpreter and the bundle. */
165
163
  reads: readonly string[];
package/src/srt/index.ts CHANGED
@@ -141,7 +141,7 @@ function openSandbox(
141
141
  HOME: options.home,
142
142
  PATH: [...options.path, ...SYSTEM_PATH].join(":"),
143
143
  CLAUDE_CODE_TMPDIR: temp,
144
- // The `wf result <<'WF_JSON'` every prompt asks for needs a heredoc's temp file. zsh
144
+ // The `wfa result <<'WF_JSON'` every prompt asks for needs a heredoc's temp file. zsh
145
145
  // writes it under `TMPPREFIX`, `/tmp/zsh` by default, which is denied; macOS's bash 3.2
146
146
  // writes it in `/var/tmp` whatever `TMPDIR` says, which is denied too (X22). So the
147
147
  // harnesses' shell is zsh, its heredocs in the sandbox's temp.
@@ -94,7 +94,7 @@ export function sandboxConformance(name: string, setup: ConformanceSetup | undef
94
94
  {
95
95
  read: reach.read,
96
96
  write: reach.write,
97
- ...(environment ? { [environment.key]: environment.settings } : {}),
97
+ [environment?.key ?? "srt"]: environment?.settings ?? {},
98
98
  },
99
99
  {
100
100
  key,
@@ -104,7 +104,6 @@ export function sandboxConformance(name: string, setup: ConformanceSetup | undef
104
104
  harnessState: [],
105
105
  providers: {
106
106
  installed: { [environment?.key ?? "srt"]: setup.provider },
107
- default: environment?.key ?? "srt",
108
107
  },
109
108
  },
110
109
  );
@@ -341,7 +340,7 @@ async function openDoor(servers: Server[], directories: string[]): Promise<Agent
341
340
  directories.push(directory);
342
341
  const endpoint = join(directory, "s.sock");
343
342
  const bundle = join(directory, "door.js");
344
- const launcher = join(directory, "wf");
343
+ const launcher = join(directory, "wfa");
345
344
  const server = createServer({ allowHalfOpen: true }, (socket) => {
346
345
  let said = "";
347
346
  socket.on("data", (data) => {