ai-sdk-sandbox-gce 0.3.5 → 0.3.6
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/CHANGELOG.md +6 -0
- package/README.md +5 -4
- package/dist/server/http/exec-relay.js +5 -4
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# ai-sdk-sandbox-gce
|
|
2
2
|
|
|
3
|
+
## 0.3.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- af7195c: A command whose machine's agent stops before it exits (the agent restarted or killed, the machine stopping) no longer leaves the caller waiting until its own timeout: the service cuts its streamed answer at once, and the session, its exit code never coming, asks for the process by id, then reports it as killed (exit code 137). The service's answer used to stay open, a `run` or a `wait()` blocked for as long as the request could last.
|
|
8
|
+
|
|
3
9
|
## 0.3.5
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -135,7 +135,7 @@ gcloud compute instances create sandbox-proxy --zone=$ZONE --machine-type=e2-sma
|
|
|
135
135
|
#!/bin/sh
|
|
136
136
|
set -e
|
|
137
137
|
# The version of the proxy: the one your application depends on.
|
|
138
|
-
VERSION=0.3.
|
|
138
|
+
VERSION=0.3.6
|
|
139
139
|
# Writes $2 to the file $1 when it differs, and says whether it did.
|
|
140
140
|
changed() {
|
|
141
141
|
mkdir -p "$(dirname "$1")"
|
|
@@ -282,7 +282,7 @@ echo "deb [signed-by=/etc/apt/keyrings/nodesource.asc] https://deb.nodesource.co
|
|
|
282
282
|
> /etc/apt/sources.list.d/nodesource.list
|
|
283
283
|
apt-get update
|
|
284
284
|
apt-get install -y nodejs
|
|
285
|
-
npm install --global ai-sdk-sandbox-gce@0.3.
|
|
285
|
+
npm install --global ai-sdk-sandbox-gce@0.3.6 pnpm@10
|
|
286
286
|
|
|
287
287
|
# The sandbox's user: sudo without a password, and Docker.
|
|
288
288
|
useradd --create-home --shell /bin/bash agent
|
|
@@ -310,7 +310,7 @@ The agent runs as root and starts the commands as `agent`, in its own service: `
|
|
|
310
310
|
|
|
311
311
|
### 4. The service
|
|
312
312
|
|
|
313
|
-
The service's image is published on Docker Hub with each release, `docker.io/fpasquet/ai-sdk-sandbox-gce:<version>`: Node.js and the package, built by the release workflow from the version on npm. Deploy the version your application depends on. Each image carries a provenance attestation, which `gh attestation verify oci://docker.io/fpasquet/ai-sdk-sandbox-gce:0.3.
|
|
313
|
+
The service's image is published on Docker Hub with each release, `docker.io/fpasquet/ai-sdk-sandbox-gce:<version>`: Node.js and the package, built by the release workflow from the version on npm. Deploy the version your application depends on. Each image carries a provenance attestation, which `gh attestation verify oci://docker.io/fpasquet/ai-sdk-sandbox-gce:0.3.6 --owner fpasquet` checks; its [`Dockerfile`](https://github.com/fpasquet/ai-sdk-harness/blob/main/packages/sandbox-gce/Dockerfile) builds the same image from your own registry.
|
|
314
314
|
|
|
315
315
|
Its service account gets a role of its own, with what the service calls and nothing else, limited by a condition to the names it uses: the sandboxes' machines and disks (`sbx-`), the proxy's machine, the sandbox images and templates (`ai-sdk-`).
|
|
316
316
|
|
|
@@ -348,7 +348,7 @@ for secret in sandbox-agent-secret sandbox-proxy-token sandbox-service-token; do
|
|
|
348
348
|
--member=serviceAccount:sandboxes@$PROJECT.iam.gserviceaccount.com --role=roles/secretmanager.secretAccessor
|
|
349
349
|
done
|
|
350
350
|
|
|
351
|
-
gcloud run deploy sandboxes --region=$REGION --image=docker.io/fpasquet/ai-sdk-sandbox-gce:0.3.
|
|
351
|
+
gcloud run deploy sandboxes --region=$REGION --image=docker.io/fpasquet/ai-sdk-sandbox-gce:0.3.6 \
|
|
352
352
|
--service-account=sandboxes@$PROJECT.iam.gserviceaccount.com \
|
|
353
353
|
--network=sandboxes --subnet=service --vpc-egress=private-ranges-only \
|
|
354
354
|
--no-allow-unauthenticated --min-instances=0 --timeout=3600 --concurrency=1000 \
|
|
@@ -581,6 +581,7 @@ The machine has no external address, and the VPC firewall, applied outside the g
|
|
|
581
581
|
- The base URLs go to the proxy too, as above.
|
|
582
582
|
- `HTTP_PROXY` points at the proxy as well: plain HTTP to an allowed host, as Debian's package mirrors serve, is passed on as it is, no credential put in. Anything else in plain HTTP is refused.
|
|
583
583
|
- `NO_PROXY` covers the machine itself, the proxy and the private ranges Docker puts its containers in. A container reached by its Compose service name is not covered: add the names to `NO_PROXY` in the Compose file.
|
|
584
|
+
- Docker gives the containers these variables too. busybox `wget`, the one of Alpine images, ignores `NO_PROXY`: a healthcheck that probes its own container with it, `wget -qO- http://127.0.0.1:3000/health`, reaches the proxy, which refuses a private address, and the container never becomes healthy (`docker compose up --wait` fails). Probe without the proxy: `wget -Y off -qO- …`, or `curl --noproxy '*' …`.
|
|
584
585
|
- The proxy never connects to a private address, however it is named or allowed: loopback, link-local (its own metadata server), the private ranges of the VPC. It checks the address a name resolves to, at the moment it connects. In IPv6, it only reaches global unicast addresses (`2000::/3`), never one carrying a private IPv4 address (NAT64, 6to4, IPv4-mapped) nor a Teredo one.
|
|
585
586
|
|
|
586
587
|
`allowedHosts` adds hosts for one sandbox, on top of the service's `SANDBOX_ALLOWED_HOSTS`. `*.example.com` covers the subdomains of `example.com`. `setNetworkPolicy` replaces the sandbox's own hosts: `allow-all` lets it reach any host over HTTPS, `deny-all` none but the service's and the base URLs'. CIDR rules are not supported.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { pipeline } from 'node:stream/promises';
|
|
1
2
|
import { readCommandLine } from '../../common/command-line.js';
|
|
2
3
|
import { HttpError } from '../../common/http-error.js';
|
|
3
4
|
/** The agent's error, as its JSON says it. */
|
|
@@ -44,8 +45,8 @@ export async function execRelay(sandboxes, name, { request, response }) {
|
|
|
44
45
|
});
|
|
45
46
|
// At once: the caller waits for the process's id, and a quiet command writes nothing for long.
|
|
46
47
|
response.flushHeaders();
|
|
47
|
-
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
await
|
|
48
|
+
// Either side gone, the other is let go. The agent stopping mid-command (restarted, its machine
|
|
49
|
+
// stopping), the answer is cut rather than ended: the caller, its exit frame never coming, then
|
|
50
|
+
// waits for the process by id. The caller gone, the process runs on, its exit kept by id.
|
|
51
|
+
await pipeline(answer, response).catch(() => undefined);
|
|
51
52
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-sdk-sandbox-gce",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "Compute Engine sandboxes for AI SDK harness agents: Claude Code, Codex and friends in a virtual machine of their own on Google Cloud, Docker included, stopped between turns.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
"vitest": "^5.0.5",
|
|
59
59
|
"zod": "^4.6.7",
|
|
60
60
|
"@repo/build": "0.0.0",
|
|
61
|
-
"@repo/prettier-config": "0.0.0",
|
|
62
61
|
"@repo/eslint-config": "0.0.0",
|
|
63
|
-
"@repo/
|
|
64
|
-
"@repo/typescript-config": "0.0.0"
|
|
62
|
+
"@repo/prettier-config": "0.0.0",
|
|
63
|
+
"@repo/typescript-config": "0.0.0",
|
|
64
|
+
"@repo/vitest-config": "0.0.0"
|
|
65
65
|
},
|
|
66
66
|
"author": {
|
|
67
67
|
"name": "Fabien Pasquet",
|