@run402/sdk 2.39.4 → 2.41.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 (37) hide show
  1. package/README.md +1 -1
  2. package/core-dist/control-plane-session.d.ts +53 -0
  3. package/core-dist/control-plane-session.js +114 -0
  4. package/dist/control-plane-credentials.d.ts +45 -0
  5. package/dist/control-plane-credentials.d.ts.map +1 -0
  6. package/dist/control-plane-credentials.js +57 -0
  7. package/dist/control-plane-credentials.js.map +1 -0
  8. package/dist/errors.d.ts +31 -1
  9. package/dist/errors.d.ts.map +1 -1
  10. package/dist/errors.js +59 -0
  11. package/dist/errors.js.map +1 -1
  12. package/dist/index.d.ts +6 -2
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +4 -2
  15. package/dist/index.js.map +1 -1
  16. package/dist/kernel.d.ts.map +1 -1
  17. package/dist/kernel.js +4 -1
  18. package/dist/kernel.js.map +1 -1
  19. package/dist/namespaces/operator-session.d.ts +223 -0
  20. package/dist/namespaces/operator-session.d.ts.map +1 -0
  21. package/dist/namespaces/operator-session.js +230 -0
  22. package/dist/namespaces/operator-session.js.map +1 -0
  23. package/dist/namespaces/operator.d.ts +63 -0
  24. package/dist/namespaces/operator.d.ts.map +1 -1
  25. package/dist/namespaces/operator.js +51 -0
  26. package/dist/namespaces/operator.js.map +1 -1
  27. package/dist/namespaces/org.d.ts +55 -23
  28. package/dist/namespaces/org.d.ts.map +1 -1
  29. package/dist/namespaces/org.js +117 -52
  30. package/dist/namespaces/org.js.map +1 -1
  31. package/dist/namespaces/org.types.d.ts +37 -1
  32. package/dist/namespaces/org.types.d.ts.map +1 -1
  33. package/dist/namespaces/transfers.d.ts +58 -0
  34. package/dist/namespaces/transfers.d.ts.map +1 -1
  35. package/dist/namespaces/transfers.js +40 -0
  36. package/dist/namespaces/transfers.js.map +1 -1
  37. package/package.json +1 -1
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"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,CAAC,EAAE,OAAO,CAAC;IACnB,iFAAiF;IACjF,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,OAAO;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,CAAC,CAAC;CACT;AAED,wDAAwD;AACxD,MAAM,WAAW,MAAM;IACrB,mIAAmI;IACnI,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3D,mBAAmB,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;IACzF,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACpD,gIAAgI;IAChI,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC;IAC1C;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACzC;AAED,wBAAsB,OAAO,CAAC,CAAC,EAC7B,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,CAAC,CAAC,CAEZ;AAED,wBAAsB,mBAAmB,CAAC,CAAC,EACzC,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAqG9B;AAiBD,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAUxD"}
package/dist/kernel.js CHANGED
@@ -10,7 +10,7 @@
10
10
  * or a response-shaped error value — they either get the parsed body as T
11
11
  * or an exception.
12
12
  */
13
- import { ApiError, NetworkError, NotAuthorizedError, PaymentRequired, TransferFreezeError, Unauthorized, } from "./errors.js";
13
+ import { ApiError, NetworkError, NotAuthorizedError, PaymentRequired, StepUpRequiredError, TransferFreezeError, Unauthorized, } from "./errors.js";
14
14
  export async function request(kernel, path, opts) {
15
15
  return (await requestWithResponse(kernel, path, opts)).body;
16
16
  }
@@ -62,6 +62,9 @@ export async function requestWithResponse(kernel, path, opts) {
62
62
  if (res.status === 402) {
63
63
  throw new PaymentRequired(`${displayMessage(resBody, "Payment required")} while ${context}`, 402, resBody, context);
64
64
  }
65
+ if (res.status === 403 && envelopeCode(resBody) === "STEP_UP_REQUIRED") {
66
+ throw new StepUpRequiredError(`${displayMessage(resBody, "Step-up authentication required")} while ${context}`, res.status, resBody, context);
67
+ }
65
68
  if (res.status === 403 && envelopeCode(resBody) === "NOT_AUTHORIZED") {
66
69
  // Org-owned control-plane denial (gateway v1.77+): authenticated but lacks
67
70
  // the required org membership/role or per-project grant. Distinct from a
@@ -1 +1 @@
1
- {"version":3,"file":"kernel.js","sourceRoot":"","sources":["../src/kernel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,YAAY,GACb,MAAM,aAAa,CAAC;AA2CrB,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,MAAoB,EACpB,IAAY,EACZ,IAAoB;IAEpB,OAAO,CAAC,MAAM,mBAAmB,CAAI,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AACjE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,MAAoB,EACpB,IAAY,EACZ,IAAoB;IAEpB,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;IAC/C,MAAM,EAAE,MAAM,GAAG,KAAK,EAAE,OAAO,GAAG,EAAE,EAAE,IAAI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IAAI,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,GAAG,CAAC,KAAK,CAAC;IAC9E,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,YAAY,CAAC,IAAa;IACjC,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1E,MAAM,IAAI,GAAI,IAAgC,CAAC,IAAI,CAAC;IACpD,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,MAAoB;IAC9C,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,OAAO,EAAE,CAAI,IAAY,EAAE,IAAoB,EAAE,EAAE,CAAC,OAAO,CAAI,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC;QAClF,mBAAmB,EAAE,CAAI,IAAY,EAAE,IAAoB,EAAE,EAAE,CAC7D,mBAAmB,CAAI,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC;QAC5C,UAAU,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7D,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,KAAK,EAAE,MAAM,CAAC,KAAK;KACpB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,223 @@
1
+ /**
2
+ * `operator.session` — the hosted/browser control-plane **session** surface
3
+ * (gateway v1.78 `passkey-principals-onboarding`). The write-capable human
4
+ * principal: log in (email magic-link / passkey / Google / GitHub), manage the
5
+ * session (whoami / refresh / revoke), enrol a passkey, run a step-up ceremony,
6
+ * and manage authenticators + recovery codes.
7
+ *
8
+ * Reached as `r.operator.session.*`. Distinct from the read-only operator
9
+ * overview session (`r.operator.deviceStart`/`overview`) and from the CLI
10
+ * loopback-PKCE write-login (`r.operator.buildCliAuthorizeUrl`/`exchangeCliToken`,
11
+ * which is the headless variant of this same browser ceremony). All three are
12
+ * the one human principal; this group is the browser/console front door that the
13
+ * hosted login pages and `@run402/sdk` consumers call.
14
+ *
15
+ * Isomorphic — no Node APIs. The token model mirrors {@link Operator.overview}:
16
+ * the public *mint* methods (`email`/`verifyEmail`/`passkey*`/`consumeRecoveryCode`)
17
+ * send no auth (the body or the magic-link token IS the credential); the
18
+ * *session-bound* methods take `opts.token` to send the `control_plane_session`
19
+ * bearer explicitly, and fall back to the credential provider's default auth
20
+ * (e.g. {@link controlPlaneSessionCredentials} or a SIWX wallet) when omitted.
21
+ *
22
+ * WebAuthn option/assertion payloads are opaque passthroughs (`unknown`) — the
23
+ * browser runs the actual ceremony; a headless client cannot.
24
+ *
25
+ * High-stakes writes (invite, membership, handoff, delete) require a **fresh
26
+ * passkey** — a magic-link/OAuth session does NOT satisfy step-up, so the
27
+ * gateway returns {@link StepUpRequiredError}; `stepUpOptions`/`stepUpVerify`
28
+ * are how a long-lived session re-establishes that freshness.
29
+ */
30
+ import type { Client } from "../kernel.js";
31
+ import type { ControlPlaneSession } from "./operator.js";
32
+ import type { Principal, OrgMembership } from "./org.types.js";
33
+ /** OAuth identity providers bridged for control-plane login. */
34
+ export type ControlPlaneOAuthProvider = "google" | "github";
35
+ /** Generic, non-enumerating response from {@link OperatorSession.email}. */
36
+ export interface MagicLinkSendResult {
37
+ status: string;
38
+ message: string;
39
+ [key: string]: unknown;
40
+ }
41
+ /**
42
+ * Result of {@link OperatorSession.consumeRecoveryCode} — a minted session that
43
+ * cannot perform high-stakes ops until a passkey is enrolled
44
+ * (`must_enroll_passkey: true`). Recovery `amr` never satisfies step-up.
45
+ */
46
+ export interface RecoveryConsumeResult extends ControlPlaneSession {
47
+ must_enroll_passkey?: boolean;
48
+ note?: string;
49
+ }
50
+ /**
51
+ * Result of {@link OperatorSession.whoami} (`GET /agent/v1/control-plane/session`)
52
+ * — the live session's principal, every org membership (newly-active rows here
53
+ * are the auto-claimed invites), and the freshness substrate (`amr` + per-AMR
54
+ * `amr_times`) the step-up gate reads. Forward-compatible.
55
+ */
56
+ export interface ControlPlaneWhoAmI {
57
+ principal: Principal;
58
+ memberships: OrgMembership[];
59
+ /** Auth methods satisfied on this session, e.g. `["passkey"]`. */
60
+ amr: string[];
61
+ /** Per-AMR last-proven time (epoch ms or ISO), the step-up freshness source. */
62
+ amr_times?: Record<string, unknown>;
63
+ [key: string]: unknown;
64
+ }
65
+ /** Result of {@link OperatorSession.refresh} (`POST …/session/refresh`). */
66
+ export interface ControlPlaneRefreshResult {
67
+ control_plane_session_token: string;
68
+ token_type?: string;
69
+ expires_in?: number;
70
+ [key: string]: unknown;
71
+ }
72
+ /** WebAuthn options envelope (`{ options }`) — opaque; handed to the browser. */
73
+ export interface WebAuthnOptionsResult {
74
+ options: unknown;
75
+ [key: string]: unknown;
76
+ }
77
+ /** Result of {@link OperatorSession.enrollPasskeyVerify}. */
78
+ export interface EnrollPasskeyResult {
79
+ status: string;
80
+ credential_id: string;
81
+ [key: string]: unknown;
82
+ }
83
+ /** Result of {@link OperatorSession.stepUpVerify}. */
84
+ export interface StepUpVerifyResult {
85
+ status: string;
86
+ stepped_up: boolean;
87
+ [key: string]: unknown;
88
+ }
89
+ /** Result of {@link OperatorSession.issueRecoveryCodes} — shown ONCE. */
90
+ export interface RecoveryCodesResult {
91
+ status: string;
92
+ recovery_codes: string[];
93
+ note?: string;
94
+ [key: string]: unknown;
95
+ }
96
+ /** One active authenticator (no secret material). Forward-compatible. */
97
+ export interface Authenticator {
98
+ id: string;
99
+ kind: string;
100
+ [key: string]: unknown;
101
+ }
102
+ /** Result of {@link OperatorSession.revokeAuthenticator}. */
103
+ export interface AuthenticatorRevokeResult {
104
+ status: string;
105
+ kind: string;
106
+ [key: string]: unknown;
107
+ }
108
+ /** Options bag carrying the optional `control_plane_session` bearer. */
109
+ export interface SessionTokenOpts {
110
+ /**
111
+ * The `control_plane_session` bearer. When omitted, the request falls back to
112
+ * the credential provider's default auth (e.g. {@link controlPlaneSessionCredentials}).
113
+ */
114
+ token?: string;
115
+ }
116
+ export declare class OperatorSession {
117
+ private readonly client;
118
+ constructor(client: Client);
119
+ /**
120
+ * Send a control-plane sign-in magic link to `email`
121
+ * (`POST /agent/v1/control-plane/session/email`). Non-enumerating: an
122
+ * identical response whether or not the email can sign in. Rate-limited.
123
+ */
124
+ email(input: {
125
+ email: string;
126
+ }): Promise<MagicLinkSendResult>;
127
+ /**
128
+ * Exchange a magic-link token for a control-plane session
129
+ * (`POST …/session/email/verify`). Verifies the email, resolves/creates the
130
+ * principal, **auto-claims any pending invites**, and mints the session
131
+ * (`amr: ["email"]`).
132
+ */
133
+ verifyEmail(input: {
134
+ token: string;
135
+ }): Promise<ControlPlaneSession>;
136
+ /**
137
+ * Get WebAuthn login options for an email's passkeys
138
+ * (`POST …/session/passkey/options`). Opaque — pass `options` to the browser's
139
+ * `navigator.credentials.get`.
140
+ */
141
+ passkeyOptions(input: {
142
+ email: string;
143
+ }): Promise<WebAuthnOptionsResult>;
144
+ /**
145
+ * Verify a WebAuthn assertion and mint a session (`amr: ["passkey"]`)
146
+ * (`POST …/session/passkey/verify`). `response` is the opaque assertion from
147
+ * the browser.
148
+ */
149
+ passkeyVerify(input: {
150
+ email: string;
151
+ response: unknown;
152
+ }): Promise<ControlPlaneSession>;
153
+ /**
154
+ * Build the browser OAuth start URL for `provider`
155
+ * (`GET …/oauth/:provider/start`). Pure — no network. Open it in a browser;
156
+ * the gateway 302s to the provider, then the callback lands on the console
157
+ * with the session token in the URL fragment.
158
+ *
159
+ * Note: the live bridge can return `503` until the gateway provisions the
160
+ * provider's `CONTROL_PLANE_{GOOGLE,GITHUB}_*` client credentials.
161
+ */
162
+ oauthUrl(provider: ControlPlaneOAuthProvider): string;
163
+ /**
164
+ * Run the recovery-code ceremony (`POST …/recovery/consume`). Mints a session
165
+ * with `amr: ["recovery_code"]` which **cannot** do high-stakes ops
166
+ * (`must_enroll_passkey: true`) — enrol a passkey to restore full access.
167
+ */
168
+ consumeRecoveryCode(input: {
169
+ code: string;
170
+ }): Promise<RecoveryConsumeResult>;
171
+ /**
172
+ * Resolve the current session's principal + memberships + freshness
173
+ * (`GET /agent/v1/control-plane/session`). The `memberships` reflect any
174
+ * invites auto-claimed at login.
175
+ */
176
+ whoami(opts?: SessionTokenOpts): Promise<ControlPlaneWhoAmI>;
177
+ /** Rotate the access token (`POST …/session/refresh`). */
178
+ refresh(opts?: SessionTokenOpts): Promise<ControlPlaneRefreshResult>;
179
+ /** Sign out — revoke the session server-side (`POST …/session/revoke`). Idempotent. */
180
+ revoke(opts?: SessionTokenOpts): Promise<{
181
+ status: string;
182
+ [key: string]: unknown;
183
+ }>;
184
+ /** WebAuthn registration options for a new passkey (`POST …/passkey/enroll/options`). */
185
+ enrollPasskeyOptions(opts?: SessionTokenOpts): Promise<WebAuthnOptionsResult>;
186
+ /** Verify a passkey registration (`POST …/passkey/enroll/verify`). `label` names the authenticator. */
187
+ enrollPasskeyVerify(input: {
188
+ response: unknown;
189
+ label?: string | null;
190
+ } & SessionTokenOpts): Promise<EnrollPasskeyResult>;
191
+ /**
192
+ * WebAuthn step-up options for a high-stakes op (`POST …/step-up/options`).
193
+ * `opClass` binds the elevation, e.g. `"org.invite"` / `"org.membership"` /
194
+ * `"project.transfer"` (see {@link StepUpRequiredError.requiredAmr}).
195
+ */
196
+ stepUpOptions(input?: {
197
+ opClass?: string;
198
+ } & SessionTokenOpts): Promise<WebAuthnOptionsResult>;
199
+ /**
200
+ * Verify a step-up assertion (`POST …/step-up/verify`) → refreshes session
201
+ * passkey-freshness and records an action-bound elevation when `opClass` (and
202
+ * optionally `objectKind`/`objectId`) are given. Retry the gated write after.
203
+ */
204
+ stepUpVerify(input: {
205
+ response: unknown;
206
+ opClass?: string;
207
+ objectKind?: string | null;
208
+ objectId?: string | null;
209
+ } & SessionTokenOpts): Promise<StepUpVerifyResult>;
210
+ /** (Re)issue recovery codes — shown ONCE (`POST …/recovery/issue`). */
211
+ issueRecoveryCodes(opts?: SessionTokenOpts): Promise<RecoveryCodesResult>;
212
+ /** List my active authenticators — no secret material (`GET …/authenticators`). */
213
+ listAuthenticators(opts?: SessionTokenOpts): Promise<Authenticator[]>;
214
+ /**
215
+ * Revoke an authenticator (`DELETE …/authenticators/:id`). Step-up enforced;
216
+ * the gateway refuses to remove the last passkey of a sole org owner
217
+ * (`OWNER_NEEDS_PASSKEY`).
218
+ */
219
+ revokeAuthenticator(input: {
220
+ id: string;
221
+ } & SessionTokenOpts): Promise<AuthenticatorRevokeResult>;
222
+ }
223
+ //# sourceMappingURL=operator-session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operator-session.d.ts","sourceRoot":"","sources":["../../src/namespaces/operator-session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/D,gEAAgE;AAChE,MAAM,MAAM,yBAAyB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE5D,4EAA4E;AAC5E,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAsB,SAAQ,mBAAmB;IAChE,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,aAAa,EAAE,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G,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAU9F,yFAAyF;IACnF,oBAAoB,CAAC,IAAI,GAAE,gBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAQvF,uGAAuG;IACjG,mBAAmB,CACvB,KAAK,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,gBAAgB,GACrE,OAAO,CAAC,mBAAmB,CAAC;IAY/B;;;;OAIG;IACG,aAAa,CAAC,KAAK,GAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,gBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAUxG;;;;OAIG;IACG,YAAY,CAChB,KAAK,EAAE;QACL,QAAQ,EAAE,OAAO,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC1B,GAAG,gBAAgB,GACnB,OAAO,CAAC,kBAAkB,CAAC;IAiB9B,uEAAuE;IACjE,kBAAkB,CAAC,IAAI,GAAE,gBAAqB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAUnF,mFAAmF;IAC7E,kBAAkB,CAAC,IAAI,GAAE,gBAAqB,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAQ/E;;;;OAIG;IACG,mBAAmB,CAAC,KAAK,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,gBAAgB,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAOxG"}
@@ -0,0 +1,230 @@
1
+ /**
2
+ * `operator.session` — the hosted/browser control-plane **session** surface
3
+ * (gateway v1.78 `passkey-principals-onboarding`). The write-capable human
4
+ * principal: log in (email magic-link / passkey / Google / GitHub), manage the
5
+ * session (whoami / refresh / revoke), enrol a passkey, run a step-up ceremony,
6
+ * and manage authenticators + recovery codes.
7
+ *
8
+ * Reached as `r.operator.session.*`. Distinct from the read-only operator
9
+ * overview session (`r.operator.deviceStart`/`overview`) and from the CLI
10
+ * loopback-PKCE write-login (`r.operator.buildCliAuthorizeUrl`/`exchangeCliToken`,
11
+ * which is the headless variant of this same browser ceremony). All three are
12
+ * the one human principal; this group is the browser/console front door that the
13
+ * hosted login pages and `@run402/sdk` consumers call.
14
+ *
15
+ * Isomorphic — no Node APIs. The token model mirrors {@link Operator.overview}:
16
+ * the public *mint* methods (`email`/`verifyEmail`/`passkey*`/`consumeRecoveryCode`)
17
+ * send no auth (the body or the magic-link token IS the credential); the
18
+ * *session-bound* methods take `opts.token` to send the `control_plane_session`
19
+ * bearer explicitly, and fall back to the credential provider's default auth
20
+ * (e.g. {@link controlPlaneSessionCredentials} or a SIWX wallet) when omitted.
21
+ *
22
+ * WebAuthn option/assertion payloads are opaque passthroughs (`unknown`) — the
23
+ * browser runs the actual ceremony; a headless client cannot.
24
+ *
25
+ * High-stakes writes (invite, membership, handoff, delete) require a **fresh
26
+ * passkey** — a magic-link/OAuth session does NOT satisfy step-up, so the
27
+ * gateway returns {@link StepUpRequiredError}; `stepUpOptions`/`stepUpVerify`
28
+ * are how a long-lived session re-establishes that freshness.
29
+ */
30
+ export class OperatorSession {
31
+ client;
32
+ constructor(client) {
33
+ this.client = client;
34
+ }
35
+ // ── login / mint (public — no auth; the body or link token is the credential) ──
36
+ /**
37
+ * Send a control-plane sign-in magic link to `email`
38
+ * (`POST /agent/v1/control-plane/session/email`). Non-enumerating: an
39
+ * identical response whether or not the email can sign in. Rate-limited.
40
+ */
41
+ async email(input) {
42
+ return this.client.request("/agent/v1/control-plane/session/email", {
43
+ method: "POST",
44
+ body: { email: input.email },
45
+ withAuth: false,
46
+ context: "sending control-plane magic link",
47
+ });
48
+ }
49
+ /**
50
+ * Exchange a magic-link token for a control-plane session
51
+ * (`POST …/session/email/verify`). Verifies the email, resolves/creates the
52
+ * principal, **auto-claims any pending invites**, and mints the session
53
+ * (`amr: ["email"]`).
54
+ */
55
+ async verifyEmail(input) {
56
+ return this.client.request("/agent/v1/control-plane/session/email/verify", {
57
+ method: "POST",
58
+ body: { token: input.token },
59
+ withAuth: false,
60
+ context: "verifying control-plane magic link",
61
+ });
62
+ }
63
+ /**
64
+ * Get WebAuthn login options for an email's passkeys
65
+ * (`POST …/session/passkey/options`). Opaque — pass `options` to the browser's
66
+ * `navigator.credentials.get`.
67
+ */
68
+ async passkeyOptions(input) {
69
+ return this.client.request("/agent/v1/control-plane/session/passkey/options", {
70
+ method: "POST",
71
+ body: { email: input.email },
72
+ withAuth: false,
73
+ context: "requesting control-plane passkey login options",
74
+ });
75
+ }
76
+ /**
77
+ * Verify a WebAuthn assertion and mint a session (`amr: ["passkey"]`)
78
+ * (`POST …/session/passkey/verify`). `response` is the opaque assertion from
79
+ * the browser.
80
+ */
81
+ async passkeyVerify(input) {
82
+ return this.client.request("/agent/v1/control-plane/session/passkey/verify", {
83
+ method: "POST",
84
+ body: { email: input.email, response: input.response },
85
+ withAuth: false,
86
+ context: "verifying control-plane passkey login",
87
+ });
88
+ }
89
+ /**
90
+ * Build the browser OAuth start URL for `provider`
91
+ * (`GET …/oauth/:provider/start`). Pure — no network. Open it in a browser;
92
+ * the gateway 302s to the provider, then the callback lands on the console
93
+ * with the session token in the URL fragment.
94
+ *
95
+ * Note: the live bridge can return `503` until the gateway provisions the
96
+ * provider's `CONTROL_PLANE_{GOOGLE,GITHUB}_*` client credentials.
97
+ */
98
+ oauthUrl(provider) {
99
+ return `${this.client.apiBase}/agent/v1/control-plane/oauth/${encodeURIComponent(provider)}/start`;
100
+ }
101
+ /**
102
+ * Run the recovery-code ceremony (`POST …/recovery/consume`). Mints a session
103
+ * with `amr: ["recovery_code"]` which **cannot** do high-stakes ops
104
+ * (`must_enroll_passkey: true`) — enrol a passkey to restore full access.
105
+ */
106
+ async consumeRecoveryCode(input) {
107
+ return this.client.request("/agent/v1/control-plane/recovery/consume", {
108
+ method: "POST",
109
+ body: { code: input.code },
110
+ withAuth: false,
111
+ context: "consuming control-plane recovery code",
112
+ });
113
+ }
114
+ // ── session lifecycle (bearer; falls back to credential provider) ──
115
+ /**
116
+ * Resolve the current session's principal + memberships + freshness
117
+ * (`GET /agent/v1/control-plane/session`). The `memberships` reflect any
118
+ * invites auto-claimed at login.
119
+ */
120
+ async whoami(opts = {}) {
121
+ return this.client.request("/agent/v1/control-plane/session", {
122
+ ...authFor(opts),
123
+ context: "resolving control-plane session",
124
+ });
125
+ }
126
+ /** Rotate the access token (`POST …/session/refresh`). */
127
+ async refresh(opts = {}) {
128
+ return this.client.request("/agent/v1/control-plane/session/refresh", {
129
+ method: "POST",
130
+ ...authFor(opts),
131
+ context: "refreshing control-plane session",
132
+ });
133
+ }
134
+ /** Sign out — revoke the session server-side (`POST …/session/revoke`). Idempotent. */
135
+ async revoke(opts = {}) {
136
+ return this.client.request("/agent/v1/control-plane/session/revoke", {
137
+ method: "POST",
138
+ ...authFor(opts),
139
+ context: "revoking control-plane session",
140
+ });
141
+ }
142
+ // ── passkey enrollment (bearer + step-up, enforced by the gateway) ──
143
+ /** WebAuthn registration options for a new passkey (`POST …/passkey/enroll/options`). */
144
+ async enrollPasskeyOptions(opts = {}) {
145
+ return this.client.request("/agent/v1/control-plane/passkey/enroll/options", {
146
+ method: "POST",
147
+ ...authFor(opts),
148
+ context: "requesting control-plane passkey enrollment options",
149
+ });
150
+ }
151
+ /** Verify a passkey registration (`POST …/passkey/enroll/verify`). `label` names the authenticator. */
152
+ async enrollPasskeyVerify(input) {
153
+ const { token, response, label } = input;
154
+ return this.client.request("/agent/v1/control-plane/passkey/enroll/verify", {
155
+ method: "POST",
156
+ body: { response, ...(label !== undefined ? { label } : {}) },
157
+ ...authFor({ token }),
158
+ context: "verifying control-plane passkey enrollment",
159
+ });
160
+ }
161
+ // ── step-up ceremony (bearer) ──
162
+ /**
163
+ * WebAuthn step-up options for a high-stakes op (`POST …/step-up/options`).
164
+ * `opClass` binds the elevation, e.g. `"org.invite"` / `"org.membership"` /
165
+ * `"project.transfer"` (see {@link StepUpRequiredError.requiredAmr}).
166
+ */
167
+ async stepUpOptions(input = {}) {
168
+ const { token, opClass } = input;
169
+ return this.client.request("/agent/v1/control-plane/step-up/options", {
170
+ method: "POST",
171
+ body: opClass ? { op_class: opClass } : {},
172
+ ...authFor({ token }),
173
+ context: "requesting control-plane step-up options",
174
+ });
175
+ }
176
+ /**
177
+ * Verify a step-up assertion (`POST …/step-up/verify`) → refreshes session
178
+ * passkey-freshness and records an action-bound elevation when `opClass` (and
179
+ * optionally `objectKind`/`objectId`) are given. Retry the gated write after.
180
+ */
181
+ async stepUpVerify(input) {
182
+ const { token, response, opClass, objectKind, objectId } = input;
183
+ return this.client.request("/agent/v1/control-plane/step-up/verify", {
184
+ method: "POST",
185
+ body: {
186
+ response,
187
+ ...(opClass !== undefined ? { op_class: opClass } : {}),
188
+ ...(objectKind !== undefined ? { object_kind: objectKind } : {}),
189
+ ...(objectId !== undefined ? { object_id: objectId } : {}),
190
+ },
191
+ ...authFor({ token }),
192
+ context: "verifying control-plane step-up",
193
+ });
194
+ }
195
+ // ── recovery codes (bearer + step-up) ──
196
+ /** (Re)issue recovery codes — shown ONCE (`POST …/recovery/issue`). */
197
+ async issueRecoveryCodes(opts = {}) {
198
+ return this.client.request("/agent/v1/control-plane/recovery/issue", {
199
+ method: "POST",
200
+ ...authFor(opts),
201
+ context: "issuing control-plane recovery codes",
202
+ });
203
+ }
204
+ // ── authenticator management (bearer) ──
205
+ /** List my active authenticators — no secret material (`GET …/authenticators`). */
206
+ async listAuthenticators(opts = {}) {
207
+ const res = await this.client.request("/agent/v1/control-plane/authenticators", { ...authFor(opts), context: "listing control-plane authenticators" });
208
+ return res.authenticators ?? [];
209
+ }
210
+ /**
211
+ * Revoke an authenticator (`DELETE …/authenticators/:id`). Step-up enforced;
212
+ * the gateway refuses to remove the last passkey of a sole org owner
213
+ * (`OWNER_NEEDS_PASSKEY`).
214
+ */
215
+ async revokeAuthenticator(input) {
216
+ const { token, id } = input;
217
+ return this.client.request(`/agent/v1/control-plane/authenticators/${encodeURIComponent(id)}`, { method: "DELETE", ...authFor({ token }), context: "revoking control-plane authenticator" });
218
+ }
219
+ }
220
+ /**
221
+ * Build the auth half of a request: explicit `Authorization: Bearer <token>`
222
+ * (and `withAuth: false`) when a token is passed, else fall through to the
223
+ * credential provider (`withAuth` defaults true). Mirrors {@link Operator.overview}.
224
+ */
225
+ function authFor(opts) {
226
+ return opts.token
227
+ ? { headers: { Authorization: `Bearer ${opts.token}` }, withAuth: false }
228
+ : {};
229
+ }
230
+ //# sourceMappingURL=operator-session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operator-session.js","sourceRoot":"","sources":["../../src/namespaces/operator-session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAqGH,MAAM,OAAO,eAAe;IACG;IAA7B,YAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAE/C,kFAAkF;IAElF;;;;OAIG;IACH,KAAK,CAAC,KAAK,CAAC,KAAwB;QAClC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAsB,uCAAuC,EAAE;YACvF,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE;YAC5B,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,kCAAkC;SAC5C,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,WAAW,CAAC,KAAwB;QACxC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAsB,8CAA8C,EAAE;YAC9F,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE;YAC5B,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,oCAAoC;SAC9C,CAAC,CAAC;IACL,CAAC;IAED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MAAM,CAAC,OAAO,CAAsB,wCAAwC,EAAE;YACxF,MAAM,EAAE,MAAM;YACd,GAAG,OAAO,CAAC,IAAI,CAAC;YAChB,OAAO,EAAE,sCAAsC;SAChD,CAAC,CAAC;IACL,CAAC;IAED,0CAA0C;IAE1C,mFAAmF;IACnF,KAAK,CAAC,kBAAkB,CAAC,OAAyB,EAAE;QAClD,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CACnC,wCAAwC,EACxC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,sCAAsC,EAAE,CACtE,CAAC;QACF,OAAO,GAAG,CAAC,cAAc,IAAI,EAAE,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,mBAAmB,CAAC,KAAwC;QAChE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,KAAK,CAAC;QAC5B,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,0CAA0C,kBAAkB,CAAC,EAAE,CAAC,EAAE,EAClE,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,sCAAsC,EAAE,CAC7F,CAAC;IACJ,CAAC;CACF;AAED;;;;GAIG;AACH,SAAS,OAAO,CAAC,IAAsB;IACrC,OAAO,IAAI,CAAC,KAAK;QACf,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,IAAI,CAAC,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE;QACzE,CAAC,CAAC,EAAE,CAAC;AACT,CAAC"}
@@ -18,6 +18,7 @@
18
18
  * Gateway contract: kychee-com/run402-private#443 (RFC 8628 device-auth bridge).
19
19
  */
20
20
  import type { Client } from "../kernel.js";
21
+ import { OperatorSession } from "./operator-session.js";
21
22
  /** RFC 8628 device-authorization start response. */
22
23
  export interface DeviceAuthStart {
23
24
  device_code: string;
@@ -72,8 +73,58 @@ export interface OperatorOverview {
72
73
  advisories?: unknown[];
73
74
  [key: string]: unknown;
74
75
  }
76
+ /**
77
+ * A write-capable control-plane session minted by the loopback-PKCE flow
78
+ * (`POST /agent/v1/control-plane/cli/token`). Distinct from the device-flow
79
+ * {@link OperatorSessionToken} (read-only): this carries `provenance` and
80
+ * `amr`, and is accepted everywhere a SIWX wallet is. Forward-compatible.
81
+ */
82
+ export interface ControlPlaneSession {
83
+ control_plane_session_token: string;
84
+ token_type?: string;
85
+ /** Relative lifetime in seconds. */
86
+ expires_in?: number;
87
+ /** How it was minted — `loopback_pkce` for the CLI write-login. */
88
+ provenance?: string;
89
+ /** The control-plane principal id. */
90
+ principal_id?: string;
91
+ /** Auth methods satisfied (e.g. `["passkey"]`). */
92
+ amr?: string[];
93
+ [key: string]: unknown;
94
+ }
95
+ /** Parameters for {@link Operator.buildCliAuthorizeUrl}. */
96
+ export interface CliAuthorizeParams {
97
+ /** The CLI's loopback redirect, e.g. `http://127.0.0.1:54321/callback`. */
98
+ redirectUri: string;
99
+ /** PKCE S256 challenge = base64url(sha256(verifier)). */
100
+ codeChallenge: string;
101
+ /** Opaque CSRF state echoed back on the redirect. */
102
+ state: string;
103
+ /** Replay nonce. */
104
+ nonce: string;
105
+ }
106
+ /** Parameters for {@link Operator.exchangeCliToken}. */
107
+ export interface CliTokenExchange {
108
+ /** Authorization code received on the loopback redirect. */
109
+ code: string;
110
+ /** The PKCE verifier whose hash was sent as `codeChallenge`. */
111
+ codeVerifier: string;
112
+ /** Must match the `redirectUri` used at authorize time. */
113
+ redirectUri: string;
114
+ /** Must match the `state` used at authorize time. */
115
+ state: string;
116
+ }
75
117
  export declare class Operator {
76
118
  private readonly client;
119
+ /**
120
+ * The hosted/browser control-plane **session** surface (gateway v1.78):
121
+ * `r.operator.session.email`, `verifyEmail`, `passkeyVerify`, `whoami`,
122
+ * `refresh`, `revoke`, and the step-up / authenticator helpers.
123
+ * The write-capable human login + step-up + authenticators, distinct from the
124
+ * read-only device/overview methods on this class and the loopback-PKCE
125
+ * CLI write-login below. See {@link OperatorSession}.
126
+ */
127
+ readonly session: OperatorSession;
77
128
  constructor(client: Client);
78
129
  /**
79
130
  * Begin the device-authorization flow. Unauthenticated. Returns the codes the
@@ -108,5 +159,17 @@ export declare class Operator {
108
159
  revoke(opts: {
109
160
  token: string;
110
161
  }): Promise<void>;
162
+ /**
163
+ * Build the loopback-PKCE authorize URL the CLI opens in the browser. Pure —
164
+ * no network, no Node APIs — so it is safe in any runtime. The caller
165
+ * generates `codeChallenge`/`state`/`nonce` and runs the redirect server.
166
+ */
167
+ buildCliAuthorizeUrl(params: CliAuthorizeParams): string;
168
+ /**
169
+ * Exchange the loopback authorization code (+ PKCE verifier) for a
170
+ * write-capable {@link ControlPlaneSession}. Unauthenticated — the code +
171
+ * verifier are the credential.
172
+ */
173
+ exchangeCliToken(params: CliTokenExchange): Promise<ControlPlaneSession>;
111
174
  }
112
175
  //# sourceMappingURL=operator.d.ts.map