promigence 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.
@@ -32,3 +32,4 @@ export declare const PRICING: {
32
32
  readonly granularity_seconds: 1;
33
33
  readonly interim_interval_seconds: 60;
34
34
  };
35
+ export declare const SANDBOX_STATES: readonly ["queued", "awaiting_capacity", "ready", "running", "paused", "ended"];
package/dist/generated.js CHANGED
@@ -285,3 +285,4 @@ export const PRICING = {
285
285
  granularity_seconds: 1,
286
286
  interim_interval_seconds: 60,
287
287
  };
288
+ export const SANDBOX_STATES = ["queued", "awaiting_capacity", "ready", "running", "paused", "ended"];
package/dist/login.js CHANGED
@@ -239,7 +239,20 @@ function loopbackUris(cfg) {
239
239
  skipped: all.filter((u) => !isUsableLoopbackUri(u)).map((u) => JSON.stringify(u)),
240
240
  };
241
241
  }
242
- async function listenLoopback(uris, expectState, squatted) {
242
+ const LOOP_CSS = "html{background:#09090b;color:#ededf0;font:16px/1.6 ui-sans-serif,system-ui,-apple-system,Segoe UI,sans-serif}"
243
+ + "body{min-height:100vh;margin:0;display:flex;align-items:center;justify-content:center;padding:24px}"
244
+ + "main{max-width:460px;border:1px solid #2a2a30;background:#111113;padding:32px 34px}"
245
+ + "b{display:block;color:#39ff14;font-size:12px;letter-spacing:.14em;text-transform:uppercase;margin-bottom:14px}"
246
+ + "h1{font-size:24px;margin:0 0 10px;letter-spacing:-.01em}p{margin:0;color:#a1a1aa}";
247
+ const LOOP_CSP = `default-src 'none'; style-src 'sha256-${createHash("sha256").update(LOOP_CSS).digest("base64")}'`;
248
+ export function loopbackPage(title, body) {
249
+ return `<!doctype html><html lang=en><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1">`
250
+ + `<title>${title}</title><style>${LOOP_CSS}</style><main><b>Promigence</b><h1>${title}</h1><p>${body}</p></main></html>`;
251
+ }
252
+ export function finishUrl(consoleOrigin, outcome) {
253
+ return consoleOrigin ? `${consoleOrigin}/cli/${outcome}` : undefined;
254
+ }
255
+ async function listenLoopback(uris, expectState, squatted, consoleOrigin) {
243
256
  for (const uri of uris) {
244
257
  const u = new URL(uri);
245
258
  const hosts = new Set([`localhost:${u.port}`, `127.0.0.1:${u.port}`, `[::1]:${u.port}`]);
@@ -250,7 +263,7 @@ async function listenLoopback(uris, expectState, squatted) {
250
263
  res.setHeader("content-type", "text/html; charset=utf-8");
251
264
  res.setHeader("cache-control", "no-store");
252
265
  res.setHeader("x-content-type-options", "nosniff");
253
- res.setHeader("content-security-policy", "default-src 'none'");
266
+ res.setHeader("content-security-policy", LOOP_CSP);
254
267
  res.setHeader("referrer-policy", "no-referrer");
255
268
  if (!hosts.has((req.headers.host ?? "").toLowerCase())) {
256
269
  res.writeHead(400).end();
@@ -275,17 +288,24 @@ async function listenLoopback(uris, expectState, squatted) {
275
288
  const code = got.searchParams.get("code");
276
289
  const state = got.searchParams.get("state") ?? "";
277
290
  const error = got.searchParams.get("error");
278
- const page = (title, body) => `<!doctype html><meta charset=utf-8><title>${title}</title><h1>${title}</h1><p>${body}</p>`;
291
+ const page = loopbackPage;
292
+ const finish = (outcome, status, title, body) => {
293
+ const to = finishUrl(consoleOrigin, outcome);
294
+ if (to)
295
+ res.writeHead(303, { location: to }).end();
296
+ else
297
+ res.writeHead(status).end(page(title, body));
298
+ };
279
299
  if (state !== expectState) {
280
300
  res.writeHead(400).end(page("Promigence login", "This login link is not the one the CLI started. Return to the terminal."));
281
301
  return;
282
302
  }
283
303
  if (error || !code) {
284
- res.writeHead(400).end(page("Promigence login failed", "Return to the terminal for details."));
304
+ finish(error === "access_denied" ? "cancelled" : "sign-in-failed", 400, "Sign-in did not finish", "Return to your terminal for the details.");
285
305
  fail(new AuthError(`login was not completed: ${error ?? "no code"} ${got.searchParams.get("error_description") ?? ""}`.trim(), FAILED_SIGN_IN_FIX));
286
306
  return;
287
307
  }
288
- res.writeHead(200).end(page("Logged in to Promigence", "You can close this tab and return to the terminal."));
308
+ finish("signed-in", 200, "You're signed in", "The Promigence CLI is signed in. You can close this tab and return to your terminal.");
289
309
  settle({ code, state });
290
310
  });
291
311
  const v4err = await bindOn(server, Number(u.port), "127.0.0.1");
@@ -383,7 +403,15 @@ async function loopbackOrPaste(ctx, cfg, state) {
383
403
  return undefined;
384
404
  const { usable, skipped } = loopbackUris(cfg);
385
405
  const squatted = [];
386
- const loop = await listenLoopback(usable, state, squatted);
406
+ const via = consoleAuthorizeUrl(cfg);
407
+ let origin;
408
+ try {
409
+ origin = via ? new URL(via).origin : undefined;
410
+ }
411
+ catch {
412
+ origin = undefined;
413
+ }
414
+ const loop = await listenLoopback(usable, state, squatted, origin);
387
415
  if (loop)
388
416
  return loop;
389
417
  if (squatted.length) {
@@ -1,5 +1,5 @@
1
1
  /** Promigence SDK — constants, error hierarchy and shared types. */
2
- export declare const VERSION = "0.1.0-beta.3";
2
+ export declare const VERSION = "0.1.0-beta.4";
3
3
  export declare const DOCS_URL = "https://promigence.ai";
4
4
  /** The error reference; each code is an anchor on it (the API's `docs` link has the same form). */
5
5
  export declare const ERRORS_DOCS_URL = "https://www.promigence.ai/docs/errors";
package/dist/sdk/core.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { hintArg } from "./hint.js";
2
- export const VERSION = "0.1.0-beta.3";
2
+ export const VERSION = "0.1.0-beta.4";
3
3
  export const DOCS_URL = "https://promigence.ai";
4
4
  export const ERRORS_DOCS_URL = "https://www.promigence.ai/docs/errors";
5
5
  export const DEFAULT_API_URL = "https://api.promigence.ai/v1";
@@ -4050,7 +4050,8 @@ export interface SandboxList {
4050
4050
  next_cursor?: string | null;
4051
4051
  sandboxes: Array<SandboxView>;
4052
4052
  /**
4053
- * The state filter this list was produced with; empty when none was given.
4053
+ * The state filter this list was produced with; empty when none was given. `queued` keeps
4054
+ * every waiting sandbox; `awaiting_capacity` only those waiting for capacity being added.
4054
4055
  */
4055
4056
  state: Array<string>;
4056
4057
  }
@@ -4357,7 +4358,7 @@ export interface SandboxView {
4357
4358
  cost_usd?: number | null;
4358
4359
  /**
4359
4360
  * Milliseconds from the start request, after any time queued, to the sandbox being handed
4360
- * over: it does not include `queued_ms`. `total_ms` is the whole wait.
4361
+ * over: it does not include `queued_ms`. Add `queued_ms` for the whole wait.
4361
4362
  */
4362
4363
  e2e_ms?: number | null;
4363
4364
  /**
package/dist/surface.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { VERSION, DOCS_URL } from "./sdk/index.js";
2
+ import { SANDBOX_STATES } from "./generated.js";
2
3
  export { VERSION, DOCS_URL };
3
4
  export const SCHEMA = "promigence.cli/v1";
4
5
  export const GUIDE_POINTER = "AI agents: run 'promigence agent-guide' (~1.2k tokens) before using this tool.";
@@ -1070,7 +1071,7 @@ export const COMMANDS = [
1070
1071
  summary: "your sandboxes, newest first",
1071
1072
  flags: [
1072
1073
  { name: "--limit", arg: "N", summary: "how many (default 50)" },
1073
- { name: "--state", arg: "S", summary: "only these states, e.g. running,ready", repeatable: true },
1074
+ { name: "--state", arg: "S", summary: `only these states, comma-separated: ${SANDBOX_STATES.join(", ")}`, repeatable: true },
1074
1075
  { name: "--label", arg: "K=V", summary: "only sandboxes whose run carries every label given", repeatable: true },
1075
1076
  { name: "--cursor", arg: "C", summary: "the next_cursor of an earlier page" },
1076
1077
  json,
package/llms.txt CHANGED
@@ -1,4 +1,4 @@
1
- # Promigence — promigence@0.1.0-beta.3
1
+ # Promigence — promigence@0.1.0-beta.4
2
2
 
3
3
  > Verified, reproducible, forkable execution environments for agents. The CLI is the
4
4
  > `promigence` command (package `promigence`, which is also the TypeScript SDK).
@@ -126,7 +126,7 @@
126
126
 
127
127
  ---
128
128
 
129
- # Promigence — agent guide (promigence@0.1.0-beta.3)
129
+ # Promigence — agent guide (promigence@0.1.0-beta.4)
130
130
 
131
131
  Promigence is an **environment runtime**: verified, reproducible, forkable execution
132
132
  environments, billed per second (vCPU + memory). The model is one line:
@@ -196,4 +196,4 @@ Highest-precedence code wins: 2 > 5 > 6 > 7/8/9/10 > 11 > 3 > 12 > 4 > 1 > 0.
196
196
  · `promigence <command> --help` · https://promigence.ai
197
197
  Same surface as MCP tools: `promigence mcp` (stdio; `claude mcp add promigence -- promigence mcp`).
198
198
 
199
- Live in v0.1.0-beta.3: login · signup · logout · auth login · keys list/create/revoke · org list/create/switch/members/invite/invites/uninvite/resend/role/remove/leave/join/audit/rename/delete · project list/create/rename/delete/cap/move · me · billing card/usage/portal · doctor · ping · init · examples · templates +show · agent-guide · mcp · snapshot create/status/list/inspect/verify/export/delete/builds/alias · image resolve · github connect/status/disconnect/untrack · repos · gitlab connect/status/disconnect/untrack · run +quote/report/status/cancel/kill/replay/open/captures/list · fork · exec +output/ps/stdin/kill · files put/get/ls/search/mkdir/mv/cp/chmod/rm · agent start · sandbox kill/network/shell/ssh/list/pause/resume/snapshot/info/extend/autopause/probe · port expose/list/revoke · secrets set/list/delete · bench burst · runners github/gitlab · status · referrals +apply · pricing · credits +claim
199
+ Live in v0.1.0-beta.4: login · signup · logout · auth login · keys list/create/revoke · org list/create/switch/members/invite/invites/uninvite/resend/role/remove/leave/join/audit/rename/delete · project list/create/rename/delete/cap/move · me · billing card/usage/portal · doctor · ping · init · examples · templates +show · agent-guide · mcp · snapshot create/status/list/inspect/verify/export/delete/builds/alias · image resolve · github connect/status/disconnect/untrack · repos · gitlab connect/status/disconnect/untrack · run +quote/report/status/cancel/kill/replay/open/captures/list · fork · exec +output/ps/stdin/kill · files put/get/ls/search/mkdir/mv/cp/chmod/rm · agent start · sandbox kill/network/shell/ssh/list/pause/resume/snapshot/info/extend/autopause/probe · port expose/list/revoke · secrets set/list/delete · bench burst · runners github/gitlab · status · referrals +apply · pricing · credits +claim
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "promigence",
3
- "version": "0.1.0-beta.3",
3
+ "version": "0.1.0-beta.4",
4
4
  "description": "The fastest sandboxes for AI agents and code. Snapshot an environment once, fork it as often as you need, run commands in every copy, and get a report that tells environment failures from task failures. Billed per second, with a quote before a run and a hard spend cap. One package: the promigence command and the TypeScript SDK.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://www.promigence.ai",