run402-mcp 2.41.0 → 2.42.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 (42) hide show
  1. package/dist/index.js +8 -5
  2. package/dist/index.js.map +1 -1
  3. package/dist/tools/orgs.d.ts +38 -12
  4. package/dist/tools/orgs.d.ts.map +1 -1
  5. package/dist/tools/orgs.js +97 -20
  6. package/dist/tools/orgs.js.map +1 -1
  7. package/dist/tools/provision.d.ts +2 -0
  8. package/dist/tools/provision.d.ts.map +1 -1
  9. package/dist/tools/provision.js +5 -0
  10. package/dist/tools/provision.js.map +1 -1
  11. package/package.json +3 -3
  12. package/sdk/dist/control-plane-credentials.d.ts +1 -1
  13. package/sdk/dist/control-plane-credentials.js +1 -1
  14. package/sdk/dist/index.d.ts +16 -7
  15. package/sdk/dist/index.d.ts.map +1 -1
  16. package/sdk/dist/index.js +19 -8
  17. package/sdk/dist/index.js.map +1 -1
  18. package/sdk/dist/namespaces/operator.d.ts +101 -0
  19. package/sdk/dist/namespaces/operator.d.ts.map +1 -1
  20. package/sdk/dist/namespaces/operator.js +60 -1
  21. package/sdk/dist/namespaces/operator.js.map +1 -1
  22. package/sdk/dist/namespaces/org.d.ts +73 -35
  23. package/sdk/dist/namespaces/org.d.ts.map +1 -1
  24. package/sdk/dist/namespaces/org.js +122 -71
  25. package/sdk/dist/namespaces/org.js.map +1 -1
  26. package/sdk/dist/namespaces/org.types.d.ts +51 -17
  27. package/sdk/dist/namespaces/org.types.d.ts.map +1 -1
  28. package/sdk/dist/namespaces/org.types.js +7 -4
  29. package/sdk/dist/namespaces/org.types.js.map +1 -1
  30. package/sdk/dist/namespaces/projects.d.ts.map +1 -1
  31. package/sdk/dist/namespaces/projects.js +2 -0
  32. package/sdk/dist/namespaces/projects.js.map +1 -1
  33. package/sdk/dist/namespaces/projects.types.d.ts +8 -0
  34. package/sdk/dist/namespaces/projects.types.d.ts.map +1 -1
  35. package/sdk/dist/node/index.d.ts +3 -1
  36. package/sdk/dist/node/index.d.ts.map +1 -1
  37. package/sdk/dist/node/index.js +2 -1
  38. package/sdk/dist/node/index.js.map +1 -1
  39. package/sdk/dist/node/operator-claim.d.ts +49 -0
  40. package/sdk/dist/node/operator-claim.d.ts.map +1 -0
  41. package/sdk/dist/node/operator-claim.js +77 -0
  42. package/sdk/dist/node/operator-claim.js.map +1 -0
@@ -66,8 +66,9 @@ export { fileSetFromDir, normalizeRelPath } from "./files.js";
66
66
  export { NodeAssets, dir, PruneConfirmationRequired } from "./assets-node.js";
67
67
  export { loadDeployManifest, normalizeDeployManifest } from "./deploy-manifest.js";
68
68
  export { signCiDelegation } from "./ci.js";
69
+ export { signWalletOrgClaim, claimWalletOrg } from "./operator-claim.js";
69
70
  export { NodeCredentialsProvider } from "./credentials.js";
70
71
  export { setupPaidFetch, createLazyPaidFetch } from "./paid-fetch.js";
71
72
  // Re-export the isomorphic surface so Node consumers don't need two imports.
72
- export { Run402, Run402Error, PaymentRequired, ProjectNotFound, Unauthorized, NotAuthorizedError, ApiError, NetworkError, LocalError, Run402DeployError, EMPTY_STATIC_MANIFEST_METADATA, ROUTE_HTTP_METHODS, Ci, CI_SESSION_CREDENTIALS, Deploy, Org, Grants, files, CI_AUDIENCE, CI_GITHUB_ACTIONS_ISSUER, CI_GITHUB_ACTIONS_PROVIDER, DEFAULT_CI_DELEGATION_CHAIN_ID, V1_CI_ALLOWED_ACTIONS, V1_CI_ALLOWED_EVENTS_DEFAULT, assertCiDeployableSpec, buildCiDelegationResourceUri, buildCiDelegationStatement, buildDeployResolveSummary, createCiSessionCredentials, githubActionsCredentials, isRun402Error, isPaymentRequired, isProjectNotFound, isUnauthorized, isNotAuthorized, isApiError, isNetworkError, isLocalError, isDeployError, isRetryableRun402Error, isCiSessionCredentials, isDeployResolveRouteHit, isDeployResolveStaticHit, normalizeCiRouteScopes, normalizeCiDelegationValues, normalizeDeployResolveRequest, normalizeStaticManifestMetadata, summarizeDeployResult, validateCiNonce, validateCiRouteScope, validateCiSubjectMatch, withRetry, } from "../index.js";
73
+ export { Run402, Run402Error, PaymentRequired, ProjectNotFound, Unauthorized, NotAuthorizedError, StepUpRequiredError, ApiError, NetworkError, LocalError, Run402DeployError, EMPTY_STATIC_MANIFEST_METADATA, ROUTE_HTTP_METHODS, Ci, CI_SESSION_CREDENTIALS, Deploy, Orgs, ScopedOrg, Grants, files, CI_AUDIENCE, CI_GITHUB_ACTIONS_ISSUER, CI_GITHUB_ACTIONS_PROVIDER, DEFAULT_CI_DELEGATION_CHAIN_ID, V1_CI_ALLOWED_ACTIONS, V1_CI_ALLOWED_EVENTS_DEFAULT, assertCiDeployableSpec, buildCiDelegationResourceUri, buildCiDelegationStatement, buildDeployResolveSummary, createCiSessionCredentials, githubActionsCredentials, isRun402Error, isPaymentRequired, isProjectNotFound, isUnauthorized, isNotAuthorized, isStepUpRequired, isApiError, isNetworkError, isLocalError, isDeployError, isRetryableRun402Error, isCiSessionCredentials, isDeployResolveRouteHit, isDeployResolveStaticHit, normalizeCiRouteScopes, normalizeCiDelegationValues, normalizeDeployResolveRequest, normalizeStaticManifestMetadata, summarizeDeployResult, validateCiNonce, validateCiRouteScope, validateCiSubjectMatch, withRetry, } from "../index.js";
73
74
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAsB,MAAM,aAAa,CAAC;AAGzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AA6B9C;;;;;;;;;GAS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MAAM,SAAS,CAAC;AAE3C,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAEzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtE,6EAA6E;AAC7E,OAAO,EACL,MAAM,EACN,WAAW,EACX,eAAe,EACf,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,8BAA8B,EAC9B,kBAAkB,EAClB,EAAE,EACF,sBAAsB,EACtB,MAAM,EACN,IAAI,EACJ,SAAS,EACT,MAAM,EACN,KAAK,EACL,WAAW,EACX,wBAAwB,EACxB,0BAA0B,EAC1B,8BAA8B,EAC9B,qBAAqB,EACrB,4BAA4B,EAC5B,sBAAsB,EACtB,4BAA4B,EAC5B,0BAA0B,EAC1B,yBAAyB,EACzB,0BAA0B,EAC1B,wBAAwB,EACxB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,YAAY,EACZ,aAAa,EACb,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACxB,sBAAsB,EACtB,2BAA2B,EAC3B,6BAA6B,EAC7B,+BAA+B,EAC/B,qBAAqB,EACrB,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACtB,SAAS,GACV,MAAM,aAAa,CAAC"}
@@ -0,0 +1,49 @@
1
+ /** Node-only wallet-owned org claim helpers (v1.82, first-class-orgs). */
2
+ import type { Run402 } from "../index.js";
3
+ import type { ClaimResult } from "../namespaces/operator.js";
4
+ export interface SignWalletOrgClaimOptions {
5
+ apiBase?: string;
6
+ allowancePath?: string;
7
+ /** SIWX chain id; defaults to `eip155:84532`. Not pinned by the gateway (only the nonce is action-bound). */
8
+ chainId?: string;
9
+ issuedAt?: string;
10
+ expirationTime?: string;
11
+ }
12
+ /**
13
+ * Build the `SIGN-IN-WITH-X` wallet proof for a wallet-org claim: a fresh CAIP-122
14
+ * SIWX message carrying the challenge `nonce`, signed by the local allowance.
15
+ * The gateway binds the action/wallet/org/expiry server-side via the nonce, so
16
+ * there is no canonical statement to match (simpler than `signCiDelegation`).
17
+ */
18
+ export declare function signWalletOrgClaim(nonce: string, opts?: SignWalletOrgClaimOptions): string;
19
+ export interface ClaimWalletOrgOptions {
20
+ /**
21
+ * The wallet (0x EVM address) whose agent-owned org to claim. Defaults to the
22
+ * active allowance address — the proof is always signed by the active wallet,
23
+ * so an override must match the active wallet (select it via `--wallet`).
24
+ */
25
+ wallet?: string;
26
+ /** Org id to claim — supply only on the second round, after a `select_org` result. */
27
+ orgId?: string;
28
+ /** Optional label to set on the claimed org. `null`/`""` clears. */
29
+ displayName?: string | null;
30
+ /** Override the control-plane session bearer (default: the local live session cache). */
31
+ token?: string;
32
+ apiBase?: string;
33
+ allowancePath?: string;
34
+ controlPlaneSessionPath?: string;
35
+ chainId?: string;
36
+ }
37
+ /**
38
+ * Run the full wallet-org claim dance (Node): resolve the human's write-capable
39
+ * control-plane session from the local cache, request a challenge, sign the
40
+ * nonce with the active allowance, and submit both proofs. Returns the
41
+ * discriminated {@link ClaimResult} — a `select_org` result is returned, not
42
+ * thrown; re-invoke with `{ orgId }` to claim a specific org (this re-runs a
43
+ * fresh challenge + signature, which is fine: the nonce is claim-scoped).
44
+ *
45
+ * Does NOT drive the WebAuthn step-up: a stale session surfaces
46
+ * `StepUpRequiredError` for the caller (CLI) to handle.
47
+ */
48
+ export declare function claimWalletOrg(r: Run402, opts?: ClaimWalletOrgOptions): Promise<ClaimResult>;
49
+ //# sourceMappingURL=operator-claim.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operator-claim.d.ts","sourceRoot":"","sources":["../../src/node/operator-claim.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAO1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,MAAM,WAAW,yBAAyB;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6GAA6G;IAC7G,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,yBAA8B,GAAG,MAAM,CAyB9F;AAED,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sFAAsF;IACtF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,yFAAyF;IACzF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,GAAE,qBAA0B,GAAG,OAAO,CAAC,WAAW,CAAC,CAqCtG"}
@@ -0,0 +1,77 @@
1
+ /** Node-only wallet-owned org claim helpers (v1.82, first-class-orgs). */
2
+ import { readAllowance } from "../../core-dist/allowance.js";
3
+ import { buildSIWxAuthHeaders } from "../../core-dist/allowance-auth.js";
4
+ import { getApiBase } from "../../core-dist/config.js";
5
+ import { loadLiveControlPlaneSession } from "../../core-dist/control-plane-session.js";
6
+ import { LocalError } from "../errors.js";
7
+ /**
8
+ * Build the `SIGN-IN-WITH-X` wallet proof for a wallet-org claim: a fresh CAIP-122
9
+ * SIWX message carrying the challenge `nonce`, signed by the local allowance.
10
+ * The gateway binds the action/wallet/org/expiry server-side via the nonce, so
11
+ * there is no canonical statement to match (simpler than `signCiDelegation`).
12
+ */
13
+ export function signWalletOrgClaim(nonce, opts = {}) {
14
+ if (!nonce || typeof nonce !== "string") {
15
+ throw new LocalError("signWalletOrgClaim requires the challenge nonce", "signing wallet-org claim");
16
+ }
17
+ const allowance = readAllowance(opts.allowancePath);
18
+ if (!allowance || !allowance.address || !allowance.privateKey) {
19
+ throw new LocalError("No local allowance configured. Run `run402 init` or `run402 allowance create` before claiming a wallet org.", "signing wallet-org claim");
20
+ }
21
+ const apiBase = opts.apiBase ?? getApiBase();
22
+ const url = new URL("/agent/v1/operator/claim-wallet-org", apiBase);
23
+ const now = new Date();
24
+ const headers = buildSIWxAuthHeaders({
25
+ allowance,
26
+ domain: url.hostname,
27
+ uri: url.toString(),
28
+ statement: "Claim wallet-owned org",
29
+ chainId: opts.chainId ?? "eip155:84532",
30
+ nonce,
31
+ issuedAt: opts.issuedAt ?? now.toISOString(),
32
+ expirationTime: opts.expirationTime ?? new Date(now.getTime() + 5 * 60 * 1000).toISOString(),
33
+ });
34
+ return headers["SIGN-IN-WITH-X"];
35
+ }
36
+ /**
37
+ * Run the full wallet-org claim dance (Node): resolve the human's write-capable
38
+ * control-plane session from the local cache, request a challenge, sign the
39
+ * nonce with the active allowance, and submit both proofs. Returns the
40
+ * discriminated {@link ClaimResult} — a `select_org` result is returned, not
41
+ * thrown; re-invoke with `{ orgId }` to claim a specific org (this re-runs a
42
+ * fresh challenge + signature, which is fine: the nonce is claim-scoped).
43
+ *
44
+ * Does NOT drive the WebAuthn step-up: a stale session surfaces
45
+ * `StepUpRequiredError` for the caller (CLI) to handle.
46
+ */
47
+ export async function claimWalletOrg(r, opts = {}) {
48
+ let token = opts.token;
49
+ if (!token) {
50
+ const session = loadLiveControlPlaneSession(opts.controlPlaneSessionPath);
51
+ if (!session) {
52
+ throw new LocalError("No live control-plane session. Run `run402 operator login --loopback` (write-capable, passkey-fresh) before claiming a wallet org.", "claiming wallet org");
53
+ }
54
+ token = session.control_plane_session_token;
55
+ }
56
+ let wallet = opts.wallet;
57
+ if (!wallet) {
58
+ const allowance = readAllowance(opts.allowancePath);
59
+ if (!allowance || !allowance.address) {
60
+ throw new LocalError("No wallet specified and no local allowance address found. Pass { wallet } or run `run402 init`.", "claiming wallet org");
61
+ }
62
+ wallet = allowance.address;
63
+ }
64
+ const challenge = await r.operator.claimWalletOrg.challenge({ wallet, token });
65
+ const siwx = signWalletOrgClaim(challenge.nonce, {
66
+ apiBase: opts.apiBase,
67
+ allowancePath: opts.allowancePath,
68
+ chainId: opts.chainId,
69
+ });
70
+ return r.operator.claimWalletOrg.submit({
71
+ token,
72
+ siwx,
73
+ orgId: opts.orgId,
74
+ displayName: opts.displayName,
75
+ });
76
+ }
77
+ //# sourceMappingURL=operator-claim.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operator-claim.js","sourceRoot":"","sources":["../../src/node/operator-claim.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAE1E,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAa1C;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAa,EAAE,OAAkC,EAAE;IACpF,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,MAAM,IAAI,UAAU,CAAC,iDAAiD,EAAE,0BAA0B,CAAC,CAAC;IACtG,CAAC;IACD,MAAM,SAAS,GAAG,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