run402-mcp 4.151.0 → 4.152.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.
@@ -3364,7 +3364,7 @@ A wallet **authenticates** (SIWX → a control-plane *principal*); an **org** ow
3364
3364
  - **`r.org(id).invites.list()` / `.create({ email, role, inviteTtlHours? })` / `.revoke(principalId)`** — email invites, claimed automatically at the invitee's first login.
3365
3365
  - **`r.org(id).audit({ limit?, before? })`** → control-plane audit trail (admin+), newest-first; page with `before`.
3366
3366
  - **`r.grants.create(projectId, { wallet, capability, policy?, expiresAt?, key? })`** / **`r.grants.list(projectId)`** / **`r.grants.revoke(projectId, grantId)`** — per-project capability grants for agent/CI principals; requires owner of the project's org. `capability` examples: `"deploy"`, `"functions:write"`. `list` returns each grant with its grant keys nested under `keys`, never a token. Revoking a grant revokes every key minted against it.
3367
- - **Grant keys** — a credential minted against exactly one grant: narrower than it, spend-capped, expiring, revocable on its own, never an owner. `create` with `key: { kind?, scope?, spendCap?, expiresAt?, publicSubject? }` (`{}` takes every default: kind `run402_agent_key`, scope = the grant's capability) mints the grant's first key in the same transaction; **`r.grants.createKey(projectId, grantId, key?)`** mints another; **`r.grants.revokeKey(projectId, keyId)`** / **`r.grants.rotateKey(projectId, keyId)`** revoke or replace one. `key.token` is returned ONCE from `create`, `createKey`, and `rotateKey` — persist it immediately. An agent presents it as `RUN402_GRANT_KEY` (or `run402({ grantKey })` from `@run402/sdk/node`), which makes it the sole credential class for that client.
3367
+ - **Grant keys** — a credential minted against exactly one grant: narrower than it, spend-capped, expiring, revocable on its own, never an owner. `create` with `key: { kind?, scope?, spendCap?, expiresAt?, publicSubject? }` (`{}` takes every default: kind `run402_agent_key`, scope = the grant's capability) mints the grant's first key in the same transaction; **`r.grants.createKey(projectId, grantId, key?)`** mints another; **`r.grants.revokeKey(projectId, keyId)`** / **`r.grants.rotateKey(projectId, keyId)`** revoke or replace one. `key.token` is returned ONCE from `create`, `createKey`, and `rotateKey` — persist it immediately. An agent presents it as `RUN402_GRANT_KEY` (or `run402({ grantKey })` from `@run402/sdk/node`), which makes it the sole credential class for that client. The key's `spendCap` (USD micros: `per_tx`, `per_period`, `period`) bounds what the key and every short-lived token it mints spend on managed jobs, signers (provision, transfer, call, deploy) and images; past it the gateway answers `403 SPEND_CAP_EXCEEDED` / `SPEND_CAP_PER_TX_EXCEEDED`, and a key minted without a cap spends nothing (`403 GRANT_KEY_NO_SPEND_CAP`). `r.grants.list` shows `spent_usd_micros` and `resets_at` on each capped key. Code a key deploys runs with the project's service key, so a `deploy` or `functions:write` scope is spend-equivalent to it, bounded by the organization's allowance, not the key's cap.
3368
3368
  - Also project-scoped: **`r.project(id).grants.create({...})`** / `.list()` / `.revoke(grantId)` / `.createKey(grantId, key?)` / `.revokeKey(keyId)` / `.rotateKey(keyId)`.
3369
3369
 
3370
3370
  Control-plane denials throw `NotAuthorizedError` (403 `NOT_AUTHORIZED`, carrying `requiredRole` / `requiredCapability` / `reason`). Bad input is `ApiError` `code: "VALIDATION_ERROR"` (400). Exported types: `OrgRole`, `Principal`, `OrgMembership`, `OrgMember`, `WhoAmIResult`, `OrgSummary`, `OrgDetail`, `CreateOrgInput`, `ProjectGrant`, `GrantKey`, `GrantKeyInput`, `MintedGrantKey`, plus input/result types.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "run402-mcp",
3
- "version": "4.151.0",
3
+ "version": "4.152.0",
4
4
  "packageManager": "npm@11.19.0",
5
5
  "mcpName": "com.run402/mcp",
6
6
  "description": "MCP server for Run402 — full-stack backend infrastructure for AI agents: Postgres, auth, storage, serverless functions and atomic deploys. Paid with x402/MPP. Includes $0.03 image generation.",
@@ -13,8 +13,12 @@
13
13
  * `/projects/v1/:project_id/grant-keys/:key_id[...]`. Every call requires the
14
14
  * caller to be an active owner of the project's org.
15
15
  */
16
- /** Grant-key kinds. Only `run402_agent_key` returns a bearer `token`. */
17
- export type GrantKeyKind = "run402_agent_key" | "ci_oidc" | "tempo_access_key" | "base_disposable_eoa" | "erc7710";
16
+ /**
17
+ * Grant-key kinds. `run402_agent_key` is the bearer an agent holds and the
18
+ * only kind these routes mint; a `ci_oidc` key is a CI binding
19
+ * (`run402 ci link`).
20
+ */
21
+ export type GrantKeyKind = "run402_agent_key" | "ci_oidc";
18
22
  /**
19
23
  * Grant-key scope (`scope` JSONB). Always a subset of the grant: a key never
20
24
  * widens it. Omit to take the grant's own capability.
@@ -28,7 +32,12 @@ export interface GrantKeyScope {
28
32
  projects?: string[];
29
33
  [key: string]: unknown;
30
34
  }
31
- /** Spend cap (`spend_cap` JSONB). Required for the payment-rail kinds; enforced at send time. */
35
+ /**
36
+ * Spend cap (`spend_cap` JSONB), in USD micros. Enforced when the key or a
37
+ * token it minted spends: a managed job, a signer provision, transfer, call or
38
+ * deploy, an image. A key with no cap spends nothing
39
+ * (`403 GRANT_KEY_NO_SPEND_CAP`). Code the key deploys is not capped by it.
40
+ */
32
41
  export interface GrantKeySpendCap {
33
42
  v: 1;
34
43
  currency: "usd_micros";
@@ -43,11 +52,11 @@ export interface GrantKeyInput {
43
52
  kind?: GrantKeyKind;
44
53
  /** Defaults to the grant's own capability. */
45
54
  scope?: GrantKeyScope;
46
- /** Spend cap (payment-rail kinds). */
55
+ /** Spend cap. Omit and the key, and every token it mints, spends nothing. */
47
56
  spendCap?: GrantKeySpendCap | null;
48
57
  /** ISO-8601 expiry; omit or `null` for none beyond the grant's. */
49
58
  expiresAt?: string | null;
50
- /** Rail-specific public subject. */
59
+ /** Kind-specific public subject. */
51
60
  publicSubject?: string;
52
61
  }
53
62
  /** Input to {@link Grants.create}. */
@@ -98,6 +107,10 @@ export interface GrantKey {
98
107
  expires_at: string | null;
99
108
  revoked_at: string | null;
100
109
  created_at: string;
110
+ /** On a capped key: what it and the tokens it minted spent this period (USD micros). */
111
+ spent_usd_micros?: number;
112
+ /** On a capped key: when the current period ends (ISO-8601). */
113
+ resets_at?: string;
101
114
  [key: string]: unknown;
102
115
  }
103
116
  /** A per-project capability grant with its grant keys nested. */
@@ -1 +1 @@
1
- {"version":3,"file":"grants.types.d.ts","sourceRoot":"","sources":["../../src/namespaces/grants.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,yEAAyE;AACzE,MAAM,MAAM,YAAY,GACpB,kBAAkB,GAClB,SAAS,GACT,kBAAkB,GAClB,qBAAqB,GACrB,SAAS,CAAC;AAEd;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,mCAAmC;IACnC,CAAC,EAAE,CAAC,CAAC;IACL,oDAAoD;IACpD,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,iGAAiG;AACjG,MAAM,WAAW,gBAAgB;IAC/B,CAAC,EAAE,CAAC,CAAC;IACL,QAAQ,EAAE,YAAY,CAAC;IACvB,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,2EAA2E;AAC3E,MAAM,WAAW,aAAa;IAC5B,oEAAoE;IACpE,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,8CAA8C;IAC9C,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACnC,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,oCAAoC;IACpC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,sCAAsC;AACtC,MAAM,WAAW,gBAAgB;IAC/B,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf,mEAAmE;I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