@axiom-lattice/microsandbox-service 0.1.10 → 0.1.12

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 CHANGED
@@ -1,5 +1,22 @@
1
1
  # @axiom-lattice/microsandbox-service
2
2
 
3
+ ## 0.1.12
4
+
5
+ ### Patch Changes
6
+
7
+ - a19e0aa: Unify the sandbox service base-URL env and treat missing sandbox files as a structured not-found (ADR-174 / ADR-175).
8
+
9
+ The resident plugin deployment runtime now reads `MICROSANDBOX_SERVICE_BASE_URL` only (dropping `MICROSANDBOX_SERVICE_URL`), so a provider-only config also enables `manage_plugin` deploy/undeploy/status; `sandbox-console` reads `VITE_MICROSANDBOX_SERVICE_BASE_URL`. `MICROSANDBOX_SERVICE_URL` no longer has any effect.
10
+
11
+ `opensandbox-gateway` now preserves the sandbox's upstream HTTP status (and surfaces execd's `{ code, message }`) instead of collapsing every failure to `500 "Download failed"`, and `MicrosandboxServiceClient` attaches the HTTP status to request errors; `microsandbox-service` `readFile`/`downloadFile` map missing files to `404 FILE_NOT_FOUND` (matching `deleteFile`). A missing sandbox file (e.g. the plugin-skill manifest) is therefore classified as not-found rather than a hard failure, fixing `Error loading skill content: ... Download failed`.
12
+
13
+ ## 0.1.11
14
+
15
+ ### Patch Changes
16
+
17
+ - 26fecff: task refactor
18
+ - 910bd08: enhance tasks
19
+
3
20
  ## 0.1.10
4
21
 
5
22
  ### Patch Changes
package/README.md CHANGED
@@ -54,6 +54,9 @@ Supported environment variables:
54
54
  - `MICROSANDBOX_IDLE_TIMEOUT_SEC` default: `600` — auto-stop after N seconds of inactivity. Set to `0` to disable
55
55
  - `MICROSANDBOX_VOLUME_QUOTA_MIB` default: `2048` — storage quota for named volumes
56
56
  - `MICROSANDBOX_CLI_PATH` default: `~/.microsandbox/bin/msb` — path to the `msb` binary
57
+ - `MICROSANDBOX_API_KEY` — when set, every `/api/*` request must send `Authorization: Bearer <key>` (`/health` stays open)
58
+ - `MICROSANDBOX_HOST_PORT_MIN` default: `40000` — lowest host port used when publishing guest ports
59
+ - `MICROSANDBOX_HOST_PORT_MAX` default: `60000` — highest host port used when publishing guest ports
57
60
 
58
61
  Example:
59
62
 
@@ -132,6 +135,73 @@ pnpm --filter @axiom-lattice/microsandbox-service dev
132
135
 
133
136
  This command watches source files, rebuilds the package, and restarts the service automatically.
134
137
 
138
+ ## HTTP API
139
+
140
+ Every response uses a JSON envelope: success is `{ "success": true, "data": ... }`, failure is
141
+ `{ "success": false, "error": { "code": "...", "message": "..." } }`. When `MICROSANDBOX_API_KEY`
142
+ is set, all `/api/*` requests require `Authorization: Bearer <key>` (`/health` stays open).
143
+
144
+ ### Sandbox lifecycle
145
+
146
+ | Method | Path | Purpose |
147
+ |--------|------|---------|
148
+ | `GET` | `/api/sandboxes` | List sandboxes |
149
+ | `GET` | `/api/sandboxes/:name` | Inspect one sandbox |
150
+ | `PUT` | `/api/sandboxes/:name` | Create-or-reuse (`ensure`) |
151
+ | `POST` | `/api/sandboxes/:name/start` | Start / resume |
152
+ | `POST` | `/api/sandboxes/:name/stop` | Pause |
153
+ | `POST` | `/api/sandboxes/:name/kill` | Kill |
154
+ | `DELETE` | `/api/sandboxes/:name` | Delete |
155
+ | `GET` | `/api/sandboxes/:name/status` | Status |
156
+ | `POST` | `/api/sandboxes/:name/logs` | Logs |
157
+ | `GET` | `/api/sandboxes/:name/endpoints/:port` | Resolve a published guest port |
158
+ | `ANY` | `/api/sandboxes/:name/proxy/:port/*` | Stream to a published guest port |
159
+
160
+ File/shell operations are under `/api/files/*` and `/api/shell/exec`; image and named-volume
161
+ operations under `/api/images/*` and `/api/volumes/:name/fs/*`.
162
+
163
+ ### Resident-service primitives
164
+
165
+ `PUT /api/sandboxes/:name` accepts three optional fields beyond image/resource/volume config:
166
+
167
+ | Field | Type | Meaning |
168
+ |-------|------|---------|
169
+ | `entrypoint` | `string[]` | Main process command; replaces the default `tail -f /dev/null`. Use this to run a long-lived service (e.g. a plugin host daemon). |
170
+ | `timeoutSeconds` | `number` \| `null` | Sandbox lifetime. `null` means no expiry. **Currently inert** in the registry — positive values are not yet applied and changes do not force a recreate (scheduled for Plan 3). |
171
+ | `exposePorts` | `number[]` | Guest ports to publish. Each is mapped to a deterministic host port within `[MICROSANDBOX_HOST_PORT_MIN, MICROSANDBOX_HOST_PORT_MAX]`. |
172
+
173
+ Create a resident service and resolve its endpoint:
174
+
175
+ ```bash
176
+ curl -X PUT http://127.0.0.1:4002/api/sandboxes/plugin-weather \
177
+ -H 'content-type: application/json' \
178
+ -d '{
179
+ "image": "kioko12520/sandbox:0.1.0",
180
+ "entrypoint": ["node", "/root/.agents/.plugin-host/server.js"],
181
+ "exposePorts": [8080]
182
+ }'
183
+
184
+ curl http://127.0.0.1:4002/api/sandboxes/plugin-weather/endpoints/8080
185
+ # { "success": true, "data": { "endpoint": "/api/sandboxes/plugin-weather/proxy/8080" } }
186
+ ```
187
+
188
+ `GET /api/sandboxes/:name/endpoints/:port` responses:
189
+
190
+ - `200` — `{ "success": true, "data": { "endpoint": "/api/sandboxes/<name>/proxy/<port>" } }`
191
+ (a relative proxy path the caller composes with its configured service base URL; may also
192
+ include `headers` for proxied backends)
193
+ - `400 INVALID_REQUEST` — `:port` is not an integer in `1..65535`
194
+ - `404 ENDPOINT_NOT_PUBLISHED` — the port was not published for this sandbox
195
+
196
+ The guest→host mapping is recovered from the sandbox's persisted config, so it survives service
197
+ restarts. The loopback mapping stays internal; the returned path points at the proxy route below.
198
+
199
+ `ANY /api/sandboxes/:name/proxy/:port/*` streams the request to the sandbox's published guest
200
+ port (any method, unbuffered, so SSE and large payloads pass through). Authenticate to this
201
+ service with `Authorization: Bearer <MICROSANDBOX_API_KEY>`; the proxy **strips** that header
202
+ before forwarding, so the service key never reaches the (unauthenticated) sandbox host behind
203
+ the loopback-bound port.
204
+
135
205
  ## Operational Notes
136
206
 
137
207
  - Invalid startup configuration exits non-zero.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  buildApp
3
- } from "./chunk-2GSPCUXK.mjs";
3
+ } from "./chunk-Z6NN3T6H.mjs";
4
4
 
5
5
  // src/lib/server-cli.ts
6
6
  function parsePort(raw, source) {
@@ -97,4 +97,4 @@ async function startServer({
97
97
  export {
98
98
  startServer
99
99
  };
100
- //# sourceMappingURL=chunk-7PYAXMHC.mjs.map
100
+ //# sourceMappingURL=chunk-O5VQK7SY.mjs.map