run402-mcp 2.39.3 → 2.40.0

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.
Files changed (36) hide show
  1. package/README.md +2 -2
  2. package/core/dist/control-plane-session.d.ts +53 -0
  3. package/core/dist/control-plane-session.d.ts.map +1 -0
  4. package/core/dist/control-plane-session.js +114 -0
  5. package/core/dist/control-plane-session.js.map +1 -0
  6. package/dist/tools/orgs.js +4 -4
  7. package/dist/tools/orgs.js.map +1 -1
  8. package/package.json +3 -3
  9. package/sdk/README.md +1 -1
  10. package/sdk/core-dist/control-plane-session.d.ts +53 -0
  11. package/sdk/core-dist/control-plane-session.js +114 -0
  12. package/sdk/dist/errors.d.ts +31 -1
  13. package/sdk/dist/errors.d.ts.map +1 -1
  14. package/sdk/dist/errors.js +59 -0
  15. package/sdk/dist/errors.js.map +1 -1
  16. package/sdk/dist/index.d.ts +2 -2
  17. package/sdk/dist/index.d.ts.map +1 -1
  18. package/sdk/dist/index.js +2 -2
  19. package/sdk/dist/index.js.map +1 -1
  20. package/sdk/dist/kernel.d.ts.map +1 -1
  21. package/sdk/dist/kernel.js +4 -1
  22. package/sdk/dist/kernel.js.map +1 -1
  23. package/sdk/dist/namespaces/operator.d.ts +53 -0
  24. package/sdk/dist/namespaces/operator.d.ts.map +1 -1
  25. package/sdk/dist/namespaces/operator.js +40 -0
  26. package/sdk/dist/namespaces/operator.js.map +1 -1
  27. package/sdk/dist/namespaces/org.d.ts +55 -23
  28. package/sdk/dist/namespaces/org.d.ts.map +1 -1
  29. package/sdk/dist/namespaces/org.js +117 -52
  30. package/sdk/dist/namespaces/org.js.map +1 -1
  31. package/sdk/dist/namespaces/org.types.d.ts +37 -1
  32. package/sdk/dist/namespaces/org.types.d.ts.map +1 -1
  33. package/sdk/dist/namespaces/transfers.d.ts +58 -0
  34. package/sdk/dist/namespaces/transfers.d.ts.map +1 -1
  35. package/sdk/dist/namespaces/transfers.js +40 -0
  36. package/sdk/dist/namespaces/transfers.js.map +1 -1
package/README.md CHANGED
@@ -306,7 +306,7 @@ The SDK is organised as 23 namespaces: `projects`, `assets`, `cache`, `ci`, `sit
306
306
  npm install -g run402
307
307
  ```
308
308
 
309
- Every subcommand prints JSON to stdout, JSON errors to stderr, exits 0 on success and 1 on failure — designed for an agent shell, not a human. Full reference: [`cli/llms-cli.txt`](./cli/llms-cli.txt) (also at <https://run402.com/llms-cli.txt>).
309
+ Every subcommand prints JSON to stdout, JSON errors to stderr, exits 0 on success and 1 on failure — designed for an agent shell, not a human. Full reference: [`cli/llms-cli.txt`](./cli/llms-cli.txt) (also at <https://docs.run402.com/llms-cli.txt>).
310
310
 
311
311
  ```bash
312
312
  run402 init # one-shot allowance + faucet + tier check
@@ -572,7 +572,7 @@ Architecture: every tool / subcommand / skill script is a thin shim over an `@ru
572
572
 
573
573
  - Web: <https://run402.com>
574
574
  - API docs (HTTP): <https://run402.com/llms.txt> · <https://run402.com/openapi.json>
575
- - CLI docs: <https://run402.com/llms-cli.txt>
575
+ - CLI docs: <https://docs.run402.com/llms-cli.txt>
576
576
  - Status: <https://api.run402.com/status>
577
577
  - Health: <https://api.run402.com/health>
578
578
 
@@ -0,0 +1,53 @@
1
+ /**
2
+ * A cached **control-plane session** — the human principal's *write-capable*
3
+ * bearer, minted by the loopback-PKCE flow (`run402 operator login --loopback`).
4
+ * Distinct from the device-flow {@link OperatorSession} (read-only): this one
5
+ * carries `provenance` (`loopback_pkce`) and `amr`, and is accepted everywhere a
6
+ * SIWX wallet is. Cached at the BASE config dir (email/principal-scoped, shared
7
+ * across local named wallets), mode 0600 — the token is as sensitive as the
8
+ * allowance key.
9
+ *
10
+ * Stored shape vs the gateway payload: the gateway returns a relative
11
+ * `expires_in` (seconds); we persist the absolute `expires_at` (epoch ms) so a
12
+ * cached session can be expiry-checked without knowing when it was written.
13
+ */
14
+ export interface ControlPlaneSessionCache {
15
+ control_plane_session_token: string;
16
+ token_type: string;
17
+ provenance: string;
18
+ principal_id: string;
19
+ amr: string[];
20
+ /** Epoch ms when the session expires (issued_at + expires_in). */
21
+ expires_at: number;
22
+ }
23
+ /** The token payload returned by `POST /agent/v1/control-plane/cli/token`. */
24
+ export interface ControlPlaneSessionTokenResponse {
25
+ control_plane_session_token: string;
26
+ token_type?: string;
27
+ provenance?: string;
28
+ principal_id?: string;
29
+ amr?: string[];
30
+ expires_in?: number;
31
+ }
32
+ /**
33
+ * Path to the cached control-plane session: `{base}/control-plane-session.json`.
34
+ * `RUN402_CONTROL_PLANE_SESSION_PATH` overrides for testing.
35
+ */
36
+ export declare function getControlPlaneSessionPath(): string;
37
+ /**
38
+ * Load the cached control-plane session. Returns `null` for the "no session"
39
+ * cases (absent, unreadable, unparseable). Throws when the file parses as JSON
40
+ * but the shape is wrong, so a corrupted cache surfaces a clear fix-it.
41
+ */
42
+ export declare function readControlPlaneSession(path?: string): ControlPlaneSessionCache | null;
43
+ /** Persist a control-plane session atomically (temp-file + rename), mode 0600. */
44
+ export declare function saveControlPlaneSession(data: ControlPlaneSessionCache, path?: string): void;
45
+ /** Delete the cached control-plane session — local half of `operator logout`. Idempotent. */
46
+ export declare function clearControlPlaneSession(path?: string): void;
47
+ /** Whether a cached session is past its usable life (with a small skew buffer). */
48
+ export declare function isControlPlaneSessionExpired(session: ControlPlaneSessionCache, nowMs?: number, skewMs?: number): boolean;
49
+ /** Read the cached session and return it only if still usable; `null` if absent or expired. */
50
+ export declare function loadLiveControlPlaneSession(path?: string, nowMs?: number): ControlPlaneSessionCache | null;
51
+ /** Map a gateway token payload (relative `expires_in`) into the cached shape (absolute `expires_at`). */
52
+ export declare function controlPlaneSessionFromTokenResponse(resp: ControlPlaneSessionTokenResponse, nowMs?: number): ControlPlaneSessionCache;
53
+ //# sourceMappingURL=control-plane-session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control-plane-session.d.ts","sourceRoot":"","sources":["../src/control-plane-session.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;GAYG;AACH,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1
+ import { readFileSync, writeFileSync, mkdirSync, existsSync, chmodSync, renameSync, statSync, rmSync, } from "node:fs";
2
+ import { dirname, join } from "node:path";
3
+ import { randomBytes } from "node:crypto";
4
+ import { getConfigBaseDir } from "./config.js";
5
+ /**
6
+ * Path to the cached control-plane session: `{base}/control-plane-session.json`.
7
+ * `RUN402_CONTROL_PLANE_SESSION_PATH` overrides for testing.
8
+ */
9
+ export function getControlPlaneSessionPath() {
10
+ return (process.env.RUN402_CONTROL_PLANE_SESSION_PATH ||
11
+ join(getConfigBaseDir(), "control-plane-session.json"));
12
+ }
13
+ /** Tighten 0600 if group/other-readable, warning once. Best-effort, POSIX-only. */
14
+ function selfHealPermissions(p) {
15
+ if (process.platform === "win32")
16
+ return;
17
+ try {
18
+ const mode = statSync(p).mode & 0o777;
19
+ if ((mode & 0o077) !== 0) {
20
+ chmodSync(p, 0o600);
21
+ process.stderr.write(`warning: tightened permissions on ${p} from ${mode.toString(8)} to 600 (was readable by other users).\n`);
22
+ }
23
+ }
24
+ catch {
25
+ // Best-effort; never block a read on a chmod/stat failure.
26
+ }
27
+ }
28
+ /**
29
+ * Load the cached control-plane session. Returns `null` for the "no session"
30
+ * cases (absent, unreadable, unparseable). Throws when the file parses as JSON
31
+ * but the shape is wrong, so a corrupted cache surfaces a clear fix-it.
32
+ */
33
+ export function readControlPlaneSession(path) {
34
+ const p = path ?? getControlPlaneSessionPath();
35
+ if (!existsSync(p))
36
+ return null;
37
+ selfHealPermissions(p);
38
+ let raw;
39
+ try {
40
+ raw = readFileSync(p, "utf-8");
41
+ }
42
+ catch {
43
+ return null;
44
+ }
45
+ let parsed;
46
+ try {
47
+ parsed = JSON.parse(raw);
48
+ }
49
+ catch {
50
+ return null;
51
+ }
52
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
53
+ throw new Error("control-plane-session.json must contain a JSON object. Delete it and run 'run402 operator login --loopback' to recreate it.");
54
+ }
55
+ const data = parsed;
56
+ if (typeof data.control_plane_session_token !== "string" ||
57
+ data.control_plane_session_token.length === 0) {
58
+ throw new Error("control-plane-session.json missing valid 'control_plane_session_token'. Run 'run402 operator login --loopback' to refresh it.");
59
+ }
60
+ if (typeof data.expires_at !== "number" || !Number.isFinite(data.expires_at)) {
61
+ throw new Error("control-plane-session.json missing valid 'expires_at'. Run 'run402 operator login --loopback' to refresh it.");
62
+ }
63
+ return {
64
+ control_plane_session_token: data.control_plane_session_token,
65
+ token_type: typeof data.token_type === "string" ? data.token_type : "Bearer",
66
+ provenance: typeof data.provenance === "string" ? data.provenance : "loopback_pkce",
67
+ principal_id: typeof data.principal_id === "string" ? data.principal_id : "",
68
+ amr: Array.isArray(data.amr) ? data.amr.filter((a) => typeof a === "string") : [],
69
+ expires_at: data.expires_at,
70
+ };
71
+ }
72
+ /** Persist a control-plane session atomically (temp-file + rename), mode 0600. */
73
+ export function saveControlPlaneSession(data, path) {
74
+ const p = path ?? getControlPlaneSessionPath();
75
+ const dir = dirname(p);
76
+ mkdirSync(dir, { recursive: true });
77
+ const tmp = join(dir, `.control-plane-session.${randomBytes(4).toString("hex")}.tmp`);
78
+ writeFileSync(tmp, JSON.stringify(data, null, 2), { mode: 0o600 });
79
+ renameSync(tmp, p);
80
+ chmodSync(p, 0o600);
81
+ }
82
+ /** Delete the cached control-plane session — local half of `operator logout`. Idempotent. */
83
+ export function clearControlPlaneSession(path) {
84
+ const p = path ?? getControlPlaneSessionPath();
85
+ try {
86
+ rmSync(p, { force: true });
87
+ }
88
+ catch {
89
+ // Best-effort: a failed unlink should never crash logout.
90
+ }
91
+ }
92
+ /** Whether a cached session is past its usable life (with a small skew buffer). */
93
+ export function isControlPlaneSessionExpired(session, nowMs = Date.now(), skewMs = 10_000) {
94
+ return nowMs + skewMs >= session.expires_at;
95
+ }
96
+ /** Read the cached session and return it only if still usable; `null` if absent or expired. */
97
+ export function loadLiveControlPlaneSession(path, nowMs = Date.now()) {
98
+ const s = readControlPlaneSession(path);
99
+ if (!s)
100
+ return null;
101
+ return isControlPlaneSessionExpired(s, nowMs) ? null : s;
102
+ }
103
+ /** Map a gateway token payload (relative `expires_in`) into the cached shape (absolute `expires_at`). */
104
+ export function controlPlaneSessionFromTokenResponse(resp, nowMs = Date.now()) {
105
+ return {
106
+ control_plane_session_token: resp.control_plane_session_token,
107
+ token_type: resp.token_type ?? "Bearer",
108
+ provenance: resp.provenance ?? "loopback_pkce",
109
+ principal_id: resp.principal_id ?? "",
110
+ amr: Array.isArray(resp.amr) ? resp.amr.filter((a) => typeof a === "string") : [],
111
+ expires_at: nowMs + (typeof resp.expires_in === "number" ? resp.expires_in : 0) * 1000,
112
+ };
113
+ }
114
+ //# sourceMappingURL=control-plane-session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control-plane-session.js","sourceRoot":"","sources":["../src/control-plane-session.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,aAAa,EACb,SAAS,EACT,UAAU,EACV,SAAS,EACT,UAAU,EACV,QAAQ,EACR,MAAM,GACP,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAmC/C;;;GAGG;AACH,MAAM,UAAU,0BAA0B;IACxC,OAAO,CACL,OAAO,CAAC,GAAG,CAAC,iCAAiC;QAC7C,IAAI,CAAC,gBAAgB,EAAE,EAAE,4BAA4B,CAAC,CACvD,CAAC;AACJ,CAAC;AAED,mFAAmF;AACnF,SAAS,mBAAmB,CAAC,CAAS;IACpC,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO;QAAE,OAAO;IACzC,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC;QACtC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,EAAE,C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E,IAAI,CAAC,YAAY,IAAI,EAAE;QACrC,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE;QAC9F,UAAU,EAAE,KAAK,GAAG,CAAC,OAAO,IAAI,CAAC,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI;KACvF,CAAC;AACJ,CAAC"}
@@ -51,7 +51,7 @@ export const listOrgMembersSchema = {
51
51
  };
52
52
  export async function handleListOrgMembers(args) {
53
53
  try {
54
- const members = await getSdk().org.members(args.billing_account_id);
54
+ const members = await getSdk().org.members.list(args.billing_account_id);
55
55
  if (members.length === 0) {
56
56
  return { content: [{ type: "text", text: `No members in \`${args.billing_account_id}\`.` }] };
57
57
  }
@@ -73,7 +73,7 @@ export const addOrgMemberSchema = {
73
73
  };
74
74
  export async function handleAddOrgMember(args) {
75
75
  try {
76
- const res = await getSdk().org.addMember(args.billing_account_id, {
76
+ const res = await getSdk().org.members.add(args.billing_account_id, {
77
77
  wallet: args.wallet,
78
78
  role: args.role,
79
79
  });
@@ -98,7 +98,7 @@ export const setOrgMemberRoleSchema = {
98
98
  };
99
99
  export async function handleSetOrgMemberRole(args) {
100
100
  try {
101
- const res = await getSdk().org.setRole(args.billing_account_id, args.principal_id, args.role);
101
+ const res = await getSdk().org.members.setRole(args.billing_account_id, args.principal_id, args.role);
102
102
  return {
103
103
  content: [{ type: "text", text: `Principal \`${res.principal_id}\` is now ${res.role}.` }],
104
104
  };
@@ -114,7 +114,7 @@ export const removeOrgMemberSchema = {
114
114
  };
115
115
  export async function handleRemoveOrgMember(args) {
116
116
  try {
117
- const res = await getSdk().org.removeMember(args.billing_account_id, args.principal_id);
117
+ const res = await getSdk().org.members.revoke(args.billing_account_id, args.principal_id);
118
118
  return {
119
119
  content: [{ type: "text", text: `Removed principal \`${res.principal_id}\` from \`${args.billing_account_id}\`.` }],
120
120
  };
@@ -1 +1 @@
1
- {"version":3,"file":"orgs.js","sourceRoot":"","sources":["../../src/tools/orgs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAK3C,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;AAE1E,+EAA+E;AAE/E,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAE/B,MAAM,CAAC,KAAK,UAAU,YAAY;IAChC,IAAI,CAAC;QACH,MAAM,EAAE,GAAG,MAAM,MAAM,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;QACvC,MAAM,KAAK,GAAG;YACZ,eAAe,EAAE,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC,SAAS,CAAC,IAAI,GAAG,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI;YAC5H,yBAAyB,EAAE,CAAC,gBAAgB,IAAI;YAChD,kBAAkB,EAAE,CAAC,WAAW,CAAC,MAAM,IAAI;YAC3C,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,CACnB,CAAC,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,CAAC,kBAAkB,aAAa,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,MAAM,GAAG,CAC5E;SACF,CAAC;QACF,IAAI,EAAE,CAAC,WAAW,CAAC,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C;QACH,MAAM,GAAG,GAAG,MAAM,MAAM,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC1F,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,GAAG,CAAC,YAAY,aAAa,IAAI,CAAC,kBAAkB,KAAK,EAAE,CAAC;SACpH,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,WAAW,CAAC,GAAG,EAAE,qBAAqB,CAAC,CAAC;IACjD,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "run402-mcp",
3
- "version": "2.39.3",
3
+ "version": "2.40.0",
4
4
  "description": "MCP server for Run402 — AI-native Postgres databases with REST API, auth, storage, and row-level security. Pay with x402 USDC micropayments.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -29,8 +29,8 @@
29
29
  "test:skill": "node --test --import tsx SKILL.test.ts",
30
30
  "test:sync": "node --test --import tsx sync.test.ts",
31
31
  "test:docs": "npm run check:docs --workspace=@run402/sdk -- --skip-build",
32
- "test": "node --experimental-test-module-mocks --test --import tsx SKILL.test.ts sync.test.ts 'core/src/**/*.test.ts' 'sdk/src/**/*.test.ts' 'src/**/*.test.ts' && node --test cli-output-contract.test.mjs cli-e2e.test.mjs cli-help.test.mjs cli-provision-active.test.mjs cli-argv.test.mjs cli-env.test.mjs cli-wallets.test.mjs cli-org.test.mjs && npm run test:docs",
33
- "test:e2e": "node --test cli-output-contract.test.mjs cli-e2e.test.mjs cli-help.test.mjs cli-provision-active.test.mjs cli-argv.test.mjs cli-env.test.mjs cli-wallets.test.mjs cli-org.test.mjs",
32
+ "test": "node --experimental-test-module-mocks --test --import tsx SKILL.test.ts sync.test.ts 'core/src/**/*.test.ts' 'sdk/src/**/*.test.ts' 'src/**/*.test.ts' && node --test cli-output-contract.test.mjs cli-e2e.test.mjs cli-help.test.mjs cli-provision-active.test.mjs cli-argv.test.mjs cli-env.test.mjs cli-wallets.test.mjs cli-org.test.mjs cli-ci.test.mjs cli-deploy-ci.test.mjs && npm run test:docs",
33
+ "test:e2e": "node --test cli-output-contract.test.mjs cli-e2e.test.mjs cli-help.test.mjs cli-provision-active.test.mjs cli-argv.test.mjs cli-env.test.mjs cli-wallets.test.mjs cli-org.test.mjs cli-ci.test.mjs cli-deploy-ci.test.mjs",
34
34
  "test:help": "node --test cli-help.test.mjs",
35
35
  "test:integration": "node --test --import tsx core/src/siwx-integration.integ.ts",
36
36
  "test:integration:full": "node --test --import tsx cli-integration.test.ts",
package/sdk/README.md CHANGED
@@ -581,7 +581,7 @@ All five release in lockstep.
581
581
  ## Links
582
582
 
583
583
  - HTTP API reference: <https://run402.com/llms.txt>
584
- - CLI reference: <https://run402.com/llms-cli.txt>
584
+ - CLI reference: <https://docs.run402.com/llms-cli.txt>
585
585
  - Run402: <https://run402.com>
586
586
 
587
587
  ## License
@@ -0,0 +1,53 @@
1
+ /**
2
+ * A cached **control-plane session** — the human principal's *write-capable*
3
+ * bearer, minted by the loopback-PKCE flow (`run402 operator login --loopback`).
4
+ * Distinct from the device-flow {@link OperatorSession} (read-only): this one
5
+ * carries `provenance` (`loopback_pkce`) and `amr`, and is accepted everywhere a
6
+ * SIWX wallet is. Cached at the BASE config dir (email/principal-scoped, shared
7
+ * across local named wallets), mode 0600 — the token is as sensitive as the
8
+ * allowance key.
9
+ *
10
+ * Stored shape vs the gateway payload: the gateway returns a relative
11
+ * `expires_in` (seconds); we persist the absolute `expires_at` (epoch ms) so a
12
+ * cached session can be expiry-checked without knowing when it was written.
13
+ */
14
+ export interface ControlPlaneSessionCache {
15
+ control_plane_session_token: string;
16
+ token_type: string;
17
+ provenance: string;
18
+ principal_id: string;
19
+ amr: string[];
20
+ /** Epoch ms when the session expires (issued_at + expires_in). */
21
+ expires_at: number;
22
+ }
23
+ /** The token payload returned by `POST /agent/v1/control-plane/cli/token`. */
24
+ export interface ControlPlaneSessionTokenResponse {
25
+ control_plane_session_token: string;
26
+ token_type?: string;
27
+ provenance?: string;
28
+ principal_id?: string;
29
+ amr?: string[];
30
+ expires_in?: number;
31
+ }
32
+ /**
33
+ * Path to the cached control-plane session: `{base}/control-plane-session.json`.
34
+ * `RUN402_CONTROL_PLANE_SESSION_PATH` overrides for testing.
35
+ */
36
+ export declare function getControlPlaneSessionPath(): string;
37
+ /**
38
+ * Load the cached control-plane session. Returns `null` for the "no session"
39
+ * cases (absent, unreadable, unparseable). Throws when the file parses as JSON
40
+ * but the shape is wrong, so a corrupted cache surfaces a clear fix-it.
41
+ */
42
+ export declare function readControlPlaneSession(path?: string): ControlPlaneSessionCache | null;
43
+ /** Persist a control-plane session atomically (temp-file + rename), mode 0600. */
44
+ export declare function saveControlPlaneSession(data: ControlPlaneSessionCache, path?: string): void;
45
+ /** Delete the cached control-plane session — local half of `operator logout`. Idempotent. */
46
+ export declare function clearControlPlaneSession(path?: string): void;
47
+ /** Whether a cached session is past its usable life (with a small skew buffer). */
48
+ export declare function isControlPlaneSessionExpired(session: ControlPlaneSessionCache, nowMs?: number, skewMs?: number): boolean;
49
+ /** Read the cached session and return it only if still usable; `null` if absent or expired. */
50
+ export declare function loadLiveControlPlaneSession(path?: string, nowMs?: number): ControlPlaneSessionCache | null;
51
+ /** Map a gateway token payload (relative `expires_in`) into the cached shape (absolute `expires_at`). */
52
+ export declare function controlPlaneSessionFromTokenResponse(resp: ControlPlaneSessionTokenResponse, nowMs?: number): ControlPlaneSessionCache;
53
+ //# sourceMappingURL=control-plane-session.d.ts.map
@@ -0,0 +1,114 @@
1
+ import { readFileSync, writeFileSync, mkdirSync, existsSync, chmodSync, renameSync, statSync, rmSync, } from "node:fs";
2
+ import { dirname, join } from "node:path";
3
+ import { randomBytes } from "node:crypto";
4
+ import { getConfigBaseDir } from "./config.js";
5
+ /**
6
+ * Path to the cached control-plane session: `{base}/control-plane-session.json`.
7
+ * `RUN402_CONTROL_PLANE_SESSION_PATH` overrides for testing.
8
+ */
9
+ export function getControlPlaneSessionPath() {
10
+ return (process.env.RUN402_CONTROL_PLANE_SESSION_PATH ||
11
+ join(getConfigBaseDir(), "control-plane-session.json"));
12
+ }
13
+ /** Tighten 0600 if group/other-readable, warning once. Best-effort, POSIX-only. */
14
+ function selfHealPermissions(p) {
15
+ if (process.platform === "win32")
16
+ return;
17
+ try {
18
+ const mode = statSync(p).mode & 0o777;
19
+ if ((mode & 0o077) !== 0) {
20
+ chmodSync(p, 0o600);
21
+ process.stderr.write(`warning: tightened permissions on ${p} from ${mode.toString(8)} to 600 (was readable by other users).\n`);
22
+ }
23
+ }
24
+ catch {
25
+ // Best-effort; never block a read on a chmod/stat failure.
26
+ }
27
+ }
28
+ /**
29
+ * Load the cached control-plane session. Returns `null` for the "no session"
30
+ * cases (absent, unreadable, unparseable). Throws when the file parses as JSON
31
+ * but the shape is wrong, so a corrupted cache surfaces a clear fix-it.
32
+ */
33
+ export function readControlPlaneSession(path) {
34
+ const p = path ?? getControlPlaneSessionPath();
35
+ if (!existsSync(p))
36
+ return null;
37
+ selfHealPermissions(p);
38
+ let raw;
39
+ try {
40
+ raw = readFileSync(p, "utf-8");
41
+ }
42
+ catch {
43
+ return null;
44
+ }
45
+ let parsed;
46
+ try {
47
+ parsed = JSON.parse(raw);
48
+ }
49
+ catch {
50
+ return null;
51
+ }
52
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
53
+ throw new Error("control-plane-session.json must contain a JSON object. Delete it and run 'run402 operator login --loopback' to recreate it.");
54
+ }
55
+ const data = parsed;
56
+ if (typeof data.control_plane_session_token !== "string" ||
57
+ data.control_plane_session_token.length === 0) {
58
+ throw new Error("control-plane-session.json missing valid 'control_plane_session_token'. Run 'run402 operator login --loopback' to refresh it.");
59
+ }
60
+ if (typeof data.expires_at !== "number" || !Number.isFinite(data.expires_at)) {
61
+ throw new Error("control-plane-session.json missing valid 'expires_at'. Run 'run402 operator login --loopback' to refresh it.");
62
+ }
63
+ return {
64
+ control_plane_session_token: data.control_plane_session_token,
65
+ token_type: typeof data.token_type === "string" ? data.token_type : "Bearer",
66
+ provenance: typeof data.provenance === "string" ? data.provenance : "loopback_pkce",
67
+ principal_id: typeof data.principal_id === "string" ? data.principal_id : "",
68
+ amr: Array.isArray(data.amr) ? data.amr.filter((a) => typeof a === "string") : [],
69
+ expires_at: data.expires_at,
70
+ };
71
+ }
72
+ /** Persist a control-plane session atomically (temp-file + rename), mode 0600. */
73
+ export function saveControlPlaneSession(data, path) {
74
+ const p = path ?? getControlPlaneSessionPath();
75
+ const dir = dirname(p);
76
+ mkdirSync(dir, { recursive: true });
77
+ const tmp = join(dir, `.control-plane-session.${randomBytes(4).toString("hex")}.tmp`);
78
+ writeFileSync(tmp, JSON.stringify(data, null, 2), { mode: 0o600 });
79
+ renameSync(tmp, p);
80
+ chmodSync(p, 0o600);
81
+ }
82
+ /** Delete the cached control-plane session — local half of `operator logout`. Idempotent. */
83
+ export function clearControlPlaneSession(path) {
84
+ const p = path ?? getControlPlaneSessionPath();
85
+ try {
86
+ rmSync(p, { force: true });
87
+ }
88
+ catch {
89
+ // Best-effort: a failed unlink should never crash logout.
90
+ }
91
+ }
92
+ /** Whether a cached session is past its usable life (with a small skew buffer). */
93
+ export function isControlPlaneSessionExpired(session, nowMs = Date.now(), skewMs = 10_000) {
94
+ return nowMs + skewMs >= session.expires_at;
95
+ }
96
+ /** Read the cached session and return it only if still usable; `null` if absent or expired. */
97
+ export function loadLiveControlPlaneSession(path, nowMs = Date.now()) {
98
+ const s = readControlPlaneSession(path);
99
+ if (!s)
100
+ return null;
101
+ return isControlPlaneSessionExpired(s, nowMs) ? null : s;
102
+ }
103
+ /** Map a gateway token payload (relative `expires_in`) into the cached shape (absolute `expires_at`). */
104
+ export function controlPlaneSessionFromTokenResponse(resp, nowMs = Date.now()) {
105
+ return {
106
+ control_plane_session_token: resp.control_plane_session_token,
107
+ token_type: resp.token_type ?? "Bearer",
108
+ provenance: resp.provenance ?? "loopback_pkce",
109
+ principal_id: resp.principal_id ?? "",
110
+ amr: Array.isArray(resp.amr) ? resp.amr.filter((a) => typeof a === "string") : [],
111
+ expires_at: nowMs + (typeof resp.expires_in === "number" ? resp.expires_in : 0) * 1000,
112
+ };
113
+ }
114
+ //# sourceMappingURL=control-plane-session.js.map
@@ -15,7 +15,7 @@
15
15
  * (or the exported `is*` guards) to branch on errors safely across SDK copies
16
16
  * and realms — value comparison, no class-identity dependency.
17
17
  */
18
- export type Run402ErrorKind = "payment_required" | "project_not_found" | "unauthorized" | "not_authorized" | "api_error" | "network_error" | "local_error" | "deploy_error" | "transfer_freeze";
18
+ export type Run402ErrorKind = "payment_required" | "project_not_found" | "unauthorized" | "not_authorized" | "api_error" | "network_error" | "local_error" | "deploy_error" | "transfer_freeze" | "step_up_required";
19
19
  /**
20
20
  * Quota-denial scope discriminator (v1.46+). Indicates whether a quota-related
21
21
  * denial was enforced against the pooled billing-account total (`"account"`)
@@ -252,6 +252,34 @@ export declare class TransferFreezeError extends Run402Error {
252
252
  readonly projectId: string | null;
253
253
  constructor(message: string, status: number, body: unknown, context: string);
254
254
  }
255
+ /**
256
+ * HTTP 403 `STEP_UP_REQUIRED` — the gateway requires a fresh, same-client
257
+ * step-up (a recent `passkey` AMR) before this high-stakes control-plane
258
+ * operation (delete / transfer / membership / invite / payment drain·rotate)
259
+ * may proceed. A `device_flow`-minted session can never satisfy it; the caller
260
+ * must complete the challenge at {@link challengeUrl} (e.g. via
261
+ * `run402 operator login --step-up`) on the same client and retry.
262
+ *
263
+ * Typed fields are lifted from the gateway `details` envelope; the same
264
+ * remediation pointer is also present in {@link Run402Error.nextActions} as an
265
+ * `authenticate` action.
266
+ */
267
+ export declare class StepUpRequiredError extends Run402Error {
268
+ static readonly DEFAULT_CODE = "STEP_UP_REQUIRED";
269
+ static readonly DEFAULT_CATEGORY = "auth";
270
+ static readonly DEFAULT_RETRYABLE = false;
271
+ readonly kind: "step_up_required";
272
+ /** AMRs that would satisfy the step-up (e.g. `["passkey"]`). Empty when the gateway omitted it. */
273
+ readonly requiredAmr: string[];
274
+ /** Max age in seconds the satisfying auth may be; null when the gateway omitted it. */
275
+ readonly maxAgeSeconds: number | null;
276
+ /** Where to run the step-up challenge; null when the gateway omitted it. */
277
+ readonly challengeUrl: string | null;
278
+ /** Why the step-up was demanded (e.g. `"device_flow_forbidden"`); null when absent. */
279
+ readonly reason: string | null;
280
+ constructor(message: string, status: number, body: unknown, context: string);
281
+ toJSON(): Record<string, unknown>;
282
+ }
255
283
  /** True if `e` is any {@link Run402Error} subclass instance, regardless of which SDK copy created it. */
256
284
  export declare function isRun402Error(e: unknown): e is Run402Error;
257
285
  /** True if `e` is a {@link PaymentRequired}. Survives duplicate SDK copies and realms. */
@@ -272,6 +300,8 @@ export declare function isLocalError(e: unknown): e is LocalError;
272
300
  export declare function isDeployError(e: unknown): e is Run402DeployError;
273
301
  /** True if `e` is a {@link TransferFreezeError}. */
274
302
  export declare function isTransferFreezeError(e: unknown): e is TransferFreezeError;
303
+ /** True if `e` is a {@link StepUpRequiredError}. Survives duplicate SDK copies and realms. */
304
+ export declare function isStepUpRequired(e: unknown): e is StepUpRequiredError;
275
305
  /**
276
306
  * Extract the v1.46+ quota-denial scope from an error. Returns `"account"`
277
307
  * for pooled denials, `"project"` for the orphan fallback, or `undefined`
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;GAIG;AACH,MAAM,MAAM,eAAe,GACvB,kBAAkB,GAClB,mBAAmB,GACnB,cAAc,GACd,gBAAgB,GAChB,WAAW,GACX,eAAe,GACf,aAAa,GACb,cAAc,GACd,iBAAiB,CAAC;AAEtB;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,SAAS,CAAC;AAErD,8BAAsB,WAAY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AEtE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAU1D"}
@@ -372,6 +372,61 @@ function pickNextActionPath(actions, type) {
372
372
  }
373
373
  return null;
374
374
  }
375
+ /**
376
+ * HTTP 403 `STEP_UP_REQUIRED` — the gateway requires a fresh, same-client
377
+ * step-up (a recent `passkey` AMR) before this high-stakes control-plane
378
+ * operation (delete / transfer / membership / invite / payment drain·rotate)
379
+ * may proceed. A `device_flow`-minted session can never satisfy it; the caller
380
+ * must complete the challenge at {@link challengeUrl} (e.g. via
381
+ * `run402 operator login --step-up`) on the same client and retry.
382
+ *
383
+ * Typed fields are lifted from the gateway `details` envelope; the same
384
+ * remediation pointer is also present in {@link Run402Error.nextActions} as an
385
+ * `authenticate` action.
386
+ */
387
+ export class StepUpRequiredError extends Run402Error {
388
+ static DEFAULT_CODE = "STEP_UP_REQUIRED";
389
+ static DEFAULT_CATEGORY = "auth";
390
+ static DEFAULT_RETRYABLE = false;
391
+ kind = "step_up_required";
392
+ /** AMRs that would satisfy the step-up (e.g. `["passkey"]`). Empty when the gateway omitted it. */
393
+ requiredAmr;
394
+ /** Max age in seconds the satisfying auth may be; null when the gateway omitted it. */
395
+ maxAgeSeconds;
396
+ /** Where to run the step-up challenge; null when the gateway omitted it. */
397
+ challengeUrl;
398
+ /** Why the step-up was demanded (e.g. `"device_flow_forbidden"`); null when absent. */
399
+ reason;
400
+ constructor(message, status, body, context) {
401
+ super(message, status, body, context);
402
+ const envelope = body && typeof body === "object" && !Array.isArray(body)
403
+ ? body
404
+ : null;
405
+ const details = envelope &&
406
+ typeof envelope.details === "object" &&
407
+ envelope.details !== null &&
408
+ !Array.isArray(envelope.details)
409
+ ? envelope.details
410
+ : null;
411
+ this.requiredAmr = Array.isArray(details?.required_amr)
412
+ ? details.required_amr.filter((x) => typeof x === "string")
413
+ : [];
414
+ this.maxAgeSeconds =
415
+ typeof details?.max_age_seconds === "number" ? details.max_age_seconds : null;
416
+ this.challengeUrl =
417
+ typeof details?.challenge_url === "string" ? details.challenge_url : null;
418
+ this.reason = typeof details?.reason === "string" ? details.reason : null;
419
+ }
420
+ toJSON() {
421
+ return {
422
+ ...super.toJSON(),
423
+ requiredAmr: this.requiredAmr,
424
+ maxAgeSeconds: this.maxAgeSeconds,
425
+ challengeUrl: this.challengeUrl,
426
+ reason: this.reason,
427
+ };
428
+ }
429
+ }
375
430
  // ─── Type guards ─────────────────────────────────────────────────────────────
376
431
  //
377
432
  // Identity-free guards. Each one checks the structural brand and (for subclass
@@ -421,6 +476,10 @@ export function isDeployError(e) {
421
476
  export function isTransferFreezeError(e) {
422
477
  return isRun402Error(e) && e.kind === "transfer_freeze";
423
478
  }
479
+ /** True if `e` is a {@link StepUpRequiredError}. Survives duplicate SDK copies and realms. */
480
+ export function isStepUpRequired(e) {
481
+ return isRun402Error(e) && e.kind === "step_up_required";
482
+ }
424
483
  /**
425
484
  * Extract the v1.46+ quota-denial scope from an error. Returns `"account"`
426
485
  * for pooled denials, `"project"` for the orphan fallback, or `undefined`