run402 4.12.0 → 4.12.2

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 (40) hide show
  1. package/cli.mjs +6 -0
  2. package/lib/command-manifest.mjs +6 -0
  3. package/lib/delegates.mjs +189 -0
  4. package/lib/deploy-v2.mjs +53 -5
  5. package/lib/sites.mjs +7 -3
  6. package/package.json +1 -1
  7. package/sdk/dist/delegate-credentials.d.ts +37 -0
  8. package/sdk/dist/delegate-credentials.d.ts.map +1 -0
  9. package/sdk/dist/delegate-credentials.js +41 -0
  10. package/sdk/dist/delegate-credentials.js.map +1 -0
  11. package/sdk/dist/index.d.ts +12 -0
  12. package/sdk/dist/index.d.ts.map +1 -1
  13. package/sdk/dist/index.js +11 -0
  14. package/sdk/dist/index.js.map +1 -1
  15. package/sdk/dist/namespaces/delegates.d.ts +50 -0
  16. package/sdk/dist/namespaces/delegates.d.ts.map +1 -0
  17. package/sdk/dist/namespaces/delegates.js +99 -0
  18. package/sdk/dist/namespaces/delegates.js.map +1 -0
  19. package/sdk/dist/namespaces/delegates.types.d.ts +88 -0
  20. package/sdk/dist/namespaces/delegates.types.d.ts.map +1 -0
  21. package/sdk/dist/namespaces/delegates.types.js +10 -0
  22. package/sdk/dist/namespaces/delegates.types.js.map +1 -0
  23. package/sdk/dist/namespaces/deploy.d.ts.map +1 -1
  24. package/sdk/dist/namespaces/deploy.js +9 -1
  25. package/sdk/dist/namespaces/deploy.js.map +1 -1
  26. package/sdk/dist/node/credentials.d.ts +17 -1
  27. package/sdk/dist/node/credentials.d.ts.map +1 -1
  28. package/sdk/dist/node/credentials.js +28 -0
  29. package/sdk/dist/node/credentials.js.map +1 -1
  30. package/sdk/dist/node/index.d.ts +8 -1
  31. package/sdk/dist/node/index.d.ts.map +1 -1
  32. package/sdk/dist/node/index.js +2 -1
  33. package/sdk/dist/node/index.js.map +1 -1
  34. package/sdk/dist/node/paid-fetch.d.ts.map +1 -1
  35. package/sdk/dist/node/paid-fetch.js +27 -0
  36. package/sdk/dist/node/paid-fetch.js.map +1 -1
  37. package/sdk/dist/scoped.d.ts +12 -0
  38. package/sdk/dist/scoped.d.ts.map +1 -1
  39. package/sdk/dist/scoped.js +23 -0
  40. package/sdk/dist/scoped.js.map +1 -1
@@ -0,0 +1,50 @@
1
+ /**
2
+ * `delegates` namespace — scoped, revocable, expiring credentials an OWNER
3
+ * mints for an agent (gateway `cryptographic-delegates`, v1.79). Maps to
4
+ * `/projects/v1/:project_id/delegates`. Every mutation requires the caller to
5
+ * be an active owner of the project's owning org.
6
+ *
7
+ * A delegate always NARROWS an existing `project_grant` — mint the grant first
8
+ * (`r.grants.create(...)`), then hang a delegate off its `grant_id`. A delegate
9
+ * can never be an owner; that is enforced structurally by the gateway.
10
+ *
11
+ * The practical reason this exists on the client: project API keys are
12
+ * stateless JWTs handed out once at create and never re-issued, so an agent
13
+ * that loses local state has no way back into its own project. A delegate is
14
+ * the supported recovery path — the owner still holds a wallet, and SIWX is
15
+ * enough to mint a fresh deploy credential.
16
+ *
17
+ * Exposed both unscoped (`r.delegates.create(projectId, …)`) and
18
+ * project-scoped (`r.project(id).delegates.create(…)`), mirroring `r.grants`.
19
+ */
20
+ import type { Client } from "../kernel.js";
21
+ import type { CreateDelegateInput, DelegateCreateResult, DelegateListResult, DelegateRevokeResult } from "./delegates.types.js";
22
+ export declare class Delegates {
23
+ private readonly client;
24
+ constructor(client: Client);
25
+ /**
26
+ * Issue a delegate against an existing grant
27
+ * (`POST /projects/v1/:project_id/delegates`). Requires owner of the project's org.
28
+ *
29
+ * The returned `token` is shown **once**. Persist it immediately; there is no
30
+ * way to read it back, only to rotate for a new one.
31
+ */
32
+ create(projectId: string, input: CreateDelegateInput): Promise<DelegateCreateResult>;
33
+ /**
34
+ * List a project's delegates (`GET /projects/v1/:project_id/delegates`).
35
+ * Never returns a token or any secret material — names, scope and caps only.
36
+ */
37
+ list(projectId: string): Promise<DelegateListResult>;
38
+ /**
39
+ * Revoke a delegate (`DELETE /projects/v1/:project_id/delegates/:delegate_id`).
40
+ * Effective immediately for subsequent requests.
41
+ */
42
+ revoke(projectId: string, delegateId: string): Promise<DelegateRevokeResult>;
43
+ /**
44
+ * Rotate a delegate (`POST /projects/v1/:project_id/delegates/:delegate_id/rotate`)
45
+ * — revokes the old credential and reissues the same principal/grant/scope/cap.
46
+ * The new `token` is again shown once.
47
+ */
48
+ rotate(projectId: string, delegateId: string): Promise<DelegateCreateResult>;
49
+ }
50
+ //# sourceMappingURL=delegates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delegates.d.ts","sourceRoot":"","sources":["../../src/namespaces/delegates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EAErB,MAAM,sBAAsB,CAAC;AAE9B,qBAAa,SAAS;IACR,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAE3C;;;;;;OAMG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAgC1F;;;OAGG;IACG,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAU1D;;;OAGG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAalF;;;;OAIG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAYnF"}
@@ -0,0 +1,99 @@
1
+ /**
2
+ * `delegates` namespace — scoped, revocable, expiring credentials an OWNER
3
+ * mints for an agent (gateway `cryptographic-delegates`, v1.79). Maps to
4
+ * `/projects/v1/:project_id/delegates`. Every mutation requires the caller to
5
+ * be an active owner of the project's owning org.
6
+ *
7
+ * A delegate always NARROWS an existing `project_grant` — mint the grant first
8
+ * (`r.grants.create(...)`), then hang a delegate off its `grant_id`. A delegate
9
+ * can never be an owner; that is enforced structurally by the gateway.
10
+ *
11
+ * The practical reason this exists on the client: project API keys are
12
+ * stateless JWTs handed out once at create and never re-issued, so an agent
13
+ * that loses local state has no way back into its own project. A delegate is
14
+ * the supported recovery path — the owner still holds a wallet, and SIWX is
15
+ * enough to mint a fresh deploy credential.
16
+ *
17
+ * Exposed both unscoped (`r.delegates.create(projectId, …)`) and
18
+ * project-scoped (`r.project(id).delegates.create(…)`), mirroring `r.grants`.
19
+ */
20
+ import { LocalError } from "../errors.js";
21
+ export class Delegates {
22
+ client;
23
+ constructor(client) {
24
+ this.client = client;
25
+ }
26
+ /**
27
+ * Issue a delegate against an existing grant
28
+ * (`POST /projects/v1/:project_id/delegates`). Requires owner of the project's org.
29
+ *
30
+ * The returned `token` is shown **once**. Persist it immediately; there is no
31
+ * way to read it back, only to rotate for a new one.
32
+ */
33
+ async create(projectId, input) {
34
+ if (!projectId) {
35
+ throw new LocalError("delegates.create requires a projectId", "issuing project delegate");
36
+ }
37
+ if (!input?.grantId) {
38
+ throw new LocalError("delegates.create requires { grantId } — mint a grant first with grants.create()", "issuing project delegate");
39
+ }
40
+ // The gateway REQUIRES a scope object and 400s without one. Default to the
41
+ // common case (this grant's capability on this project) so the caller does
42
+ // not have to know the wire schema to do the obvious thing.
43
+ const scope = input.scope ?? {
44
+ v: 1,
45
+ capabilities: ["deploy"],
46
+ projects: [projectId],
47
+ };
48
+ const body = {
49
+ grant_id: input.grantId,
50
+ kind: input.kind ?? "run402_agent_key",
51
+ scope,
52
+ };
53
+ if (input.spendCap !== undefined)
54
+ body.spend_cap = input.spendCap;
55
+ if (input.expiresAt !== undefined)
56
+ body.expires_at = input.expiresAt;
57
+ if (input.publicSubject !== undefined)
58
+ body.public_subject = input.publicSubject;
59
+ return this.client.request(`/projects/v1/${encodeURIComponent(projectId)}/delegates`, { method: "POST", body, context: "issuing project delegate" });
60
+ }
61
+ /**
62
+ * List a project's delegates (`GET /projects/v1/:project_id/delegates`).
63
+ * Never returns a token or any secret material — names, scope and caps only.
64
+ */
65
+ async list(projectId) {
66
+ if (!projectId) {
67
+ throw new LocalError("delegates.list requires a projectId", "listing project delegates");
68
+ }
69
+ return this.client.request(`/projects/v1/${encodeURIComponent(projectId)}/delegates`, { method: "GET", context: "listing project delegates" });
70
+ }
71
+ /**
72
+ * Revoke a delegate (`DELETE /projects/v1/:project_id/delegates/:delegate_id`).
73
+ * Effective immediately for subsequent requests.
74
+ */
75
+ async revoke(projectId, delegateId) {
76
+ if (!projectId) {
77
+ throw new LocalError("delegates.revoke requires a projectId", "revoking project delegate");
78
+ }
79
+ if (!delegateId) {
80
+ throw new LocalError("delegates.revoke requires a delegateId", "revoking project delegate");
81
+ }
82
+ return this.client.request(`/projects/v1/${encodeURIComponent(projectId)}/delegates/${encodeURIComponent(delegateId)}`, { method: "DELETE", context: "revoking project delegate" });
83
+ }
84
+ /**
85
+ * Rotate a delegate (`POST /projects/v1/:project_id/delegates/:delegate_id/rotate`)
86
+ * — revokes the old credential and reissues the same principal/grant/scope/cap.
87
+ * The new `token` is again shown once.
88
+ */
89
+ async rotate(projectId, delegateId) {
90
+ if (!projectId) {
91
+ throw new LocalError("delegates.rotate requires a projectId", "rotating project delegate");
92
+ }
93
+ if (!delegateId) {
94
+ throw new LocalError("delegates.rotate requires a delegateId", "rotating project delegate");
95
+ }
96
+ return this.client.request(`/projects/v1/${encodeURIComponent(projectId)}/delegates/${encodeURIComponent(delegateId)}/rotate`, { method: "POST", context: "rotating project delegate" });
97
+ }
98
+ }
99
+ //# sourceMappingURL=delegates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delegates.js","sourceRoot":"","sources":["../../src/namespaces/delegates.ts"],"names":[],"mappings":"AAAA;;;;;;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,gBAAgB,kBAAkB,CAAC,SAAS,CAAC,cAAc,kBAAkB,CAAC,UAAU,CAAC,SAAS,EAClG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,2BAA2B,EAAE,CACzD,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Request/response types for the `delegates` namespace — scoped, revocable,
3
+ * expiring credentials an OWNER mints for an agent (gateway
4
+ * `cryptographic-delegates`). Maps to `/projects/v1/:project_id/delegates`.
5
+ *
6
+ * A delegate always NARROWS an existing `project_grant`; it is never broader
7
+ * than the grant it hangs off, and it can never be an owner.
8
+ */
9
+ /** Delegate kinds the gateway accepts. Only `run402_agent_key` returns a bearer. */
10
+ export type DelegateKind = "run402_agent_key" | "ci_oidc" | "tempo_access_key" | "base_disposable_eoa" | "erc7710";
11
+ /**
12
+ * Delegate scope (`scope` JSONB, compiled server-side to `DelegateScopeV1`).
13
+ * REQUIRED by the gateway — omitting it returns `400 INVALID_DELEGATE_SCOPE`.
14
+ */
15
+ export interface DelegateScope {
16
+ /** Schema version. Must be `1`. */
17
+ v: 1;
18
+ /** Non-empty capability list, e.g. `["deploy"]`. */
19
+ capabilities: string[];
20
+ /** Optional project allowlist. Defaults to the issuing project. */
21
+ projects?: string[];
22
+ [key: string]: unknown;
23
+ }
24
+ /** Spend cap (`spend_cap` JSONB). Enforced at SEND time, not control-plane authz. */
25
+ export interface DelegateSpendCap {
26
+ v: 1;
27
+ currency: "usd_micros";
28
+ per_tx?: number;
29
+ per_period?: number;
30
+ [key: string]: unknown;
31
+ }
32
+ /** Input to {@link Delegates.create}. */
33
+ export interface CreateDelegateInput {
34
+ /** The `project_grant` this delegate narrows. Required by the gateway. */
35
+ grantId: string;
36
+ /** Delegate kind. Defaults to `"run402_agent_key"` (the bearer-returning kind). */
37
+ kind?: DelegateKind;
38
+ /**
39
+ * Scope. If omitted the SDK sends `{ v:1, capabilities:["deploy"], projects:[projectId] }`
40
+ * so the common "let this agent deploy this one project" case is one call.
41
+ */
42
+ scope?: DelegateScope;
43
+ /** Optional spend cap (payment rails only). */
44
+ spendCap?: DelegateSpendCap;
45
+ /** Optional ISO-8601 expiry. Omit for a non-expiring delegate. */
46
+ expiresAt?: string | null;
47
+ /** Optional rail-specific public subject. */
48
+ publicSubject?: string;
49
+ }
50
+ /**
51
+ * Result of {@link Delegates.create} / {@link Delegates.rotate}.
52
+ *
53
+ * `token` is returned **once** and never again — persist it immediately
54
+ * (Secrets Manager, CI secret) or you must rotate to get a new one.
55
+ */
56
+ export interface DelegateCreateResult {
57
+ status: string;
58
+ delegate_id: string;
59
+ /** The bearer. Present for `run402_agent_key`. Shown once. */
60
+ token?: string;
61
+ expires_at: string | null;
62
+ [key: string]: unknown;
63
+ }
64
+ /** A delegate as returned by {@link Delegates.list} — never includes a token. */
65
+ export interface DelegateSummary {
66
+ id: string;
67
+ project_id: string;
68
+ principal_id: string;
69
+ kind: DelegateKind;
70
+ scope: Record<string, unknown>;
71
+ spend_cap: Record<string, unknown> | null;
72
+ expires_at: string | null;
73
+ revoked_at: string | null;
74
+ created_at: string;
75
+ [key: string]: unknown;
76
+ }
77
+ /** Result of {@link Delegates.list}. */
78
+ export interface DelegateListResult {
79
+ delegates: DelegateSummary[];
80
+ [key: string]: unknown;
81
+ }
82
+ /** Result of {@link Delegates.revoke}. */
83
+ export interface DelegateRevokeResult {
84
+ status: string;
85
+ delegate_id: string;
86
+ [key: string]: unknown;
87
+ }
88
+ //# sourceMappingURL=delegates.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delegates.types.d.ts","sourceRoot":"","sources":["../../src/namespaces/delegates.types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,oFAAoF;AACpF,MAAM,MAAM,YAAY,GACpB,kBAAkB,GAClB,SAAS,GACT,kBAAkB,GAClB,qBAAqB,GACrB,SAAS,CAAC;AAEd;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,mCAAmC;IACnC,CAAC,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AC;IAC/B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC1C,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,wCAAwC;AACxC,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,0CAA0C;AAC1C,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Request/response types for the `delegates` namespace — scoped, revocable,
3
+ * expiring credentials an OWNER mints for an agent (gateway
4
+ * `cryptographic-delegates`). Maps to `/projects/v1/:project_id/delegates`.
5
+ *
6
+ * A delegate always NARROWS an existing `project_grant`; it is never broader
7
+ * than the grant it hangs off, and it can never be an owner.
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=delegates.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delegates.types.js","sourceRoot":"","sources":["../../src/namespaces/delegates.types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/namespaces/deploy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAmB3C,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EAQtB,WAAW,EACX,oBAAoB,EAEpB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,oB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O,CAAC,mBAAmB,CAAC;IAyB/B;;;;OAIG;IACG,gBAAgB,CACpB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,wBAAwB,GAC7B,OAAO,CAAC,uBAAuB,CAAC;IAoCnC;;;;OAIG;IACG,UAAU,CAAC,IAAI,EAAE,2BAA2B,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA2B9E;;;;OAIG;IACG,gBAAgB,CACpB,IAAI,EAAE,uBAAuB,GAC5B,OAAO,CAAC,sBAAsB,CAAC;IAqBlC;;;;OAIG;IACG,IAAI,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IA+BnE;;;;OAIG;IACG,OAAO,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAW1E;AAk5DD;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;iEAG6D;IAC7D,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;CACvC"}
@@ -19,6 +19,7 @@
19
19
  * behavior; this file is the implementation.
20
20
  */
21
21
  import { isCiSessionCredentials } from "../ci-credentials.js";
22
+ import { isDelegateCredentials } from "../delegate-credentials.js";
22
23
  import { assertCiDeployableSpec } from "./ci.js";
23
24
  import { ROUTE_PRICING_NETWORKS, ROUTE_HTTP_METHODS, normalizeDeployResolveRequest, } from "./deploy.types.js";
24
25
  import { ApiError, LocalError, NetworkError, PaymentRequired, Run402DeployError, Unauthorized, isTransferFreezeError, } from "../errors.js";
@@ -3824,7 +3825,11 @@ async function uploadInlineCas(client, projectId, bytes, contentType) {
3824
3825
  * projects in any of today's other apikey-auth tools).
3825
3826
  */
3826
3827
  async function apikeyHeaders(client, projectId) {
3827
- if (isCiClient(client))
3828
+ // A CI session and a delegate both already authorize these routes via
3829
+ // `Authorization: Bearer`, supplied by the kernel's getAuth. Attaching an
3830
+ // apikey beside a bearer mixes credential families on one request, which the
3831
+ // kernel explicitly forbids — so stand down and let the bearer carry it.
3832
+ if (isCiClient(client) || isDelegateClient(client))
3828
3833
  return {};
3829
3834
  const project = await client.getProject(projectId);
3830
3835
  if (!project)
@@ -3834,6 +3839,9 @@ async function apikeyHeaders(client, projectId) {
3834
3839
  function isCiClient(client) {
3835
3840
  return isCiSessionCredentials(client.credentials);
3836
3841
  }
3842
+ function isDelegateClient(client) {
3843
+ return isDelegateCredentials(client.credentials);
3844
+ }
3837
3845
  function makeEmitter(cb) {
3838
3846
  if (!cb)
3839
3847
  return () => { };