@ora-ai/cli 0.23.0 → 0.25.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 (194) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/README.md +44 -13
  3. package/dist/agent-skills/skills-command.d.ts.map +1 -1
  4. package/dist/agent-skills/skills-command.js +2 -2
  5. package/dist/agent-skills/skills-command.js.map +1 -1
  6. package/dist/auth-commands.d.ts +25 -9
  7. package/dist/auth-commands.d.ts.map +1 -1
  8. package/dist/auth-commands.js +59 -49
  9. package/dist/auth-commands.js.map +1 -1
  10. package/dist/core/auth.d.ts +2 -2
  11. package/dist/core/auth.d.ts.map +1 -1
  12. package/dist/core/auth.js +5 -4
  13. package/dist/core/auth.js.map +1 -1
  14. package/dist/core/cli-arguments.d.ts +21 -0
  15. package/dist/core/cli-arguments.d.ts.map +1 -0
  16. package/dist/core/cli-arguments.js +53 -0
  17. package/dist/core/cli-arguments.js.map +1 -0
  18. package/dist/core/config.d.ts +10 -5
  19. package/dist/core/config.d.ts.map +1 -1
  20. package/dist/core/config.js +10 -7
  21. package/dist/core/config.js.map +1 -1
  22. package/dist/core/credentials/api-key-credential.d.ts +29 -0
  23. package/dist/core/credentials/api-key-credential.d.ts.map +1 -0
  24. package/dist/core/credentials/api-key-credential.js +58 -0
  25. package/dist/core/credentials/api-key-credential.js.map +1 -0
  26. package/dist/core/credentials/ci-oidc-credential.d.ts +44 -0
  27. package/dist/core/credentials/ci-oidc-credential.d.ts.map +1 -0
  28. package/dist/core/credentials/ci-oidc-credential.js +82 -0
  29. package/dist/core/credentials/ci-oidc-credential.js.map +1 -0
  30. package/dist/core/credentials/credential-chain.d.ts +25 -0
  31. package/dist/core/credentials/credential-chain.d.ts.map +1 -0
  32. package/dist/core/credentials/credential-chain.js +39 -0
  33. package/dist/core/credentials/credential-chain.js.map +1 -0
  34. package/dist/core/credentials/credential.d.ts +73 -0
  35. package/dist/core/credentials/credential.d.ts.map +1 -0
  36. package/dist/core/credentials/credential.js +9 -0
  37. package/dist/core/credentials/credential.js.map +1 -0
  38. package/dist/core/credentials/device-session-credential.d.ts +27 -0
  39. package/dist/core/credentials/device-session-credential.d.ts.map +1 -0
  40. package/dist/core/credentials/device-session-credential.js +78 -0
  41. package/dist/core/credentials/device-session-credential.js.map +1 -0
  42. package/dist/core/credentials/identity-lines.d.ts +14 -0
  43. package/dist/core/credentials/identity-lines.d.ts.map +1 -0
  44. package/dist/core/credentials/identity-lines.js +45 -0
  45. package/dist/core/credentials/identity-lines.js.map +1 -0
  46. package/dist/core/credentials/refusal-words.d.ts +15 -0
  47. package/dist/core/credentials/refusal-words.d.ts.map +1 -0
  48. package/dist/core/credentials/refusal-words.js +56 -0
  49. package/dist/core/credentials/refusal-words.js.map +1 -0
  50. package/dist/core/credentials/sign-in-areas.d.ts +18 -0
  51. package/dist/core/credentials/sign-in-areas.d.ts.map +1 -0
  52. package/dist/core/credentials/sign-in-areas.js +22 -0
  53. package/dist/core/credentials/sign-in-areas.js.map +1 -0
  54. package/dist/core/http.d.ts +10 -4
  55. package/dist/core/http.d.ts.map +1 -1
  56. package/dist/core/http.js +7 -5
  57. package/dist/core/http.js.map +1 -1
  58. package/dist/core/identity.d.ts +11 -0
  59. package/dist/core/identity.d.ts.map +1 -0
  60. package/dist/core/identity.js +21 -0
  61. package/dist/core/identity.js.map +1 -0
  62. package/dist/core/limit-story.d.ts +11 -0
  63. package/dist/core/limit-story.d.ts.map +1 -0
  64. package/dist/core/limit-story.js +16 -0
  65. package/dist/core/limit-story.js.map +1 -0
  66. package/dist/core/login.d.ts +5 -3
  67. package/dist/core/login.d.ts.map +1 -1
  68. package/dist/core/login.js +5 -3
  69. package/dist/core/login.js.map +1 -1
  70. package/dist/core/oauth/metadata.d.ts +24 -0
  71. package/dist/core/oauth/metadata.d.ts.map +1 -0
  72. package/dist/core/oauth/metadata.js +99 -0
  73. package/dist/core/oauth/metadata.js.map +1 -0
  74. package/dist/core/oauth/oauth-client.d.ts +70 -0
  75. package/dist/core/oauth/oauth-client.d.ts.map +1 -0
  76. package/dist/core/oauth/oauth-client.js +136 -0
  77. package/dist/core/oauth/oauth-client.js.map +1 -0
  78. package/dist/core/oauth/oauth-error.d.ts +18 -0
  79. package/dist/core/oauth/oauth-error.d.ts.map +1 -0
  80. package/dist/core/oauth/oauth-error.js +31 -0
  81. package/dist/core/oauth/oauth-error.js.map +1 -0
  82. package/dist/core/oauth/sign-in-error.d.ts +15 -0
  83. package/dist/core/oauth/sign-in-error.d.ts.map +1 -0
  84. package/dist/core/oauth/sign-in-error.js +21 -0
  85. package/dist/core/oauth/sign-in-error.js.map +1 -0
  86. package/dist/core/oauth/sign-in-target.d.ts +31 -0
  87. package/dist/core/oauth/sign-in-target.d.ts.map +1 -0
  88. package/dist/core/oauth/sign-in-target.js +44 -0
  89. package/dist/core/oauth/sign-in-target.js.map +1 -0
  90. package/dist/core/output.d.ts +14 -3
  91. package/dist/core/output.d.ts.map +1 -1
  92. package/dist/core/output.js +38 -38
  93. package/dist/core/output.js.map +1 -1
  94. package/dist/core/retry-after.d.ts +8 -0
  95. package/dist/core/retry-after.d.ts.map +1 -0
  96. package/dist/core/retry-after.js +18 -0
  97. package/dist/core/retry-after.js.map +1 -0
  98. package/dist/core/run-operation.d.ts +26 -10
  99. package/dist/core/run-operation.d.ts.map +1 -1
  100. package/dist/core/run-operation.js +40 -21
  101. package/dist/core/run-operation.js.map +1 -1
  102. package/dist/core/session/device-session-auth.d.ts +29 -0
  103. package/dist/core/session/device-session-auth.d.ts.map +1 -0
  104. package/dist/core/session/device-session-auth.js +92 -0
  105. package/dist/core/session/device-session-auth.js.map +1 -0
  106. package/dist/core/session/file-lock.d.ts +33 -0
  107. package/dist/core/session/file-lock.d.ts.map +1 -0
  108. package/dist/core/session/file-lock.js +145 -0
  109. package/dist/core/session/file-lock.js.map +1 -0
  110. package/dist/core/session/session-refusals.d.ts +22 -0
  111. package/dist/core/session/session-refusals.d.ts.map +1 -0
  112. package/dist/core/session/session-refusals.js +23 -0
  113. package/dist/core/session/session-refusals.js.map +1 -0
  114. package/dist/core/session/session-store.d.ts +53 -0
  115. package/dist/core/session/session-store.d.ts.map +1 -0
  116. package/dist/core/session/session-store.js +71 -0
  117. package/dist/core/session/session-store.js.map +1 -0
  118. package/dist/core/sign-in.d.ts +2 -2
  119. package/dist/core/sign-in.js +2 -2
  120. package/dist/core/token-expiry.d.ts +9 -0
  121. package/dist/core/token-expiry.d.ts.map +1 -0
  122. package/dist/core/token-expiry.js +11 -0
  123. package/dist/core/token-expiry.js.map +1 -0
  124. package/dist/core/url.d.ts +5 -0
  125. package/dist/core/url.d.ts.map +1 -0
  126. package/dist/core/url.js +17 -0
  127. package/dist/core/url.js.map +1 -0
  128. package/dist/generated/operations.d.ts +2 -1
  129. package/dist/generated/operations.d.ts.map +1 -1
  130. package/dist/generated/operations.js +32 -5
  131. package/dist/generated/operations.js.map +1 -1
  132. package/dist/generated/types.d.ts +584 -0
  133. package/dist/generated/types.d.ts.map +1 -1
  134. package/dist/generated/types.js +1 -1
  135. package/dist/interactive/menu.d.ts.map +1 -1
  136. package/dist/interactive/menu.js +4 -2
  137. package/dist/interactive/menu.js.map +1 -1
  138. package/dist/interactive/session.d.ts.map +1 -1
  139. package/dist/interactive/session.js +17 -8
  140. package/dist/interactive/session.js.map +1 -1
  141. package/dist/login/browser-opener.d.ts +20 -0
  142. package/dist/login/browser-opener.d.ts.map +1 -0
  143. package/dist/login/browser-opener.js +43 -0
  144. package/dist/login/browser-opener.js.map +1 -0
  145. package/dist/login/device-flow.d.ts +60 -0
  146. package/dist/login/device-flow.d.ts.map +1 -0
  147. package/dist/login/device-flow.js +98 -0
  148. package/dist/login/device-flow.js.map +1 -0
  149. package/dist/login/device-login.d.ts +27 -0
  150. package/dist/login/device-login.d.ts.map +1 -0
  151. package/dist/login/device-login.js +148 -0
  152. package/dist/login/device-login.js.map +1 -0
  153. package/dist/login/device-presenter.d.ts +24 -0
  154. package/dist/login/device-presenter.d.ts.map +1 -0
  155. package/dist/login/device-presenter.js +69 -0
  156. package/dist/login/device-presenter.js.map +1 -0
  157. package/dist/login/login-command.d.ts +14 -0
  158. package/dist/login/login-command.d.ts.map +1 -0
  159. package/dist/login/login-command.js +73 -0
  160. package/dist/login/login-command.js.map +1 -0
  161. package/dist/login/login-deps.d.ts +17 -0
  162. package/dist/login/login-deps.d.ts.map +1 -0
  163. package/dist/login/login-deps.js +18 -0
  164. package/dist/login/login-deps.js.map +1 -0
  165. package/dist/login/piped-input.d.ts +23 -0
  166. package/dist/login/piped-input.d.ts.map +1 -0
  167. package/dist/login/piped-input.js +36 -0
  168. package/dist/login/piped-input.js.map +1 -0
  169. package/dist/login/requested-scopes.d.ts +22 -0
  170. package/dist/login/requested-scopes.d.ts.map +1 -0
  171. package/dist/login/requested-scopes.js +43 -0
  172. package/dist/login/requested-scopes.js.map +1 -0
  173. package/dist/program.d.ts +16 -5
  174. package/dist/program.d.ts.map +1 -1
  175. package/dist/program.js +35 -10
  176. package/dist/program.js.map +1 -1
  177. package/dist/study-ci/ci-command.d.ts.map +1 -1
  178. package/dist/study-ci/ci-command.js +2 -2
  179. package/dist/study-ci/ci-command.js.map +1 -1
  180. package/dist/study-ci/ci-rehearse-command.d.ts.map +1 -1
  181. package/dist/study-ci/ci-rehearse-command.js +2 -2
  182. package/dist/study-ci/ci-rehearse-command.js.map +1 -1
  183. package/dist/tunnel/connection-end.d.ts +30 -0
  184. package/dist/tunnel/connection-end.d.ts.map +1 -0
  185. package/dist/tunnel/connection-end.js +29 -0
  186. package/dist/tunnel/connection-end.js.map +1 -0
  187. package/dist/tunnel-command.d.ts.map +1 -1
  188. package/dist/tunnel-command.js +24 -8
  189. package/dist/tunnel-command.js.map +1 -1
  190. package/package.json +3 -2
  191. package/dist/core/credential-sources.d.ts +0 -45
  192. package/dist/core/credential-sources.d.ts.map +0 -1
  193. package/dist/core/credential-sources.js +0 -65
  194. package/dist/core/credential-sources.js.map +0 -1
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Authorization-server metadata (RFC 8414), read from the issuer instead of guessed: the CLI never builds an OAuth
3
+ * endpoint path itself. oidc-provider serves both well-known documents at the issuer root while its endpoints live
4
+ * under `/oauth2`; whichever document answers first wins.
5
+ *
6
+ * RFC 8414 §3.3: the `issuer` a document names MUST equal the issuer it was fetched from, or the document is refused
7
+ * — a mix-up defence, so a token request can never be steered to a server other than the one the person signs in to.
8
+ *
9
+ * When no document can be used, the failure says which of three things happened, because each has its own fix:
10
+ * - nothing is published there (an Ora that predates browser sign-in) → use an api key, which works as before;
11
+ * - a document is published, for ANOTHER issuer → the api url or auth url is not the one that server serves;
12
+ * - the server could not be asked (unreachable, its own error, told to wait) → try again.
13
+ */
14
+ import { isHttpUrl, parseUrl } from "../url.js";
15
+ import { SignInError, signInNotOffered } from "./sign-in-error.js";
16
+ const WELL_KNOWN_PATHS = ["/.well-known/oauth-authorization-server", "/.well-known/openid-configuration"];
17
+ /** How long one document may take. A server that does not answer in time could not be asked ("trouble"). */
18
+ const DISCOVERY_TIMEOUT_MS = 10_000;
19
+ const sameIssuer = (a, b) => a.replace(/\/+$/, "") === b.replace(/\/+$/, "");
20
+ /** The metadata a document carries, or null when it is not a usable document for `issuer`. */
21
+ export function parseMetadata(body, issuer) {
22
+ if (typeof body !== "object" || body === null)
23
+ return null;
24
+ const doc = body;
25
+ if (typeof doc.issuer !== "string" || !sameIssuer(doc.issuer, issuer))
26
+ return null;
27
+ if (!isHttpUrl(doc.token_endpoint))
28
+ return null;
29
+ return {
30
+ issuer: doc.issuer,
31
+ tokenEndpoint: doc.token_endpoint,
32
+ ...(isHttpUrl(doc.device_authorization_endpoint) ? { deviceAuthorizationEndpoint: doc.device_authorization_endpoint } : {}),
33
+ ...(isHttpUrl(doc.revocation_endpoint) ? { revocationEndpoint: doc.revocation_endpoint } : {}),
34
+ };
35
+ }
36
+ /** A 5xx or a 429 is the server's own trouble, not the absence of a document: asking again may well find one. */
37
+ const isTrouble = (status) => status >= 500 || status === 429;
38
+ const isForeign = (miss) => miss.kind === "foreign";
39
+ /** The issuer a body names, when it is a document for some issuer OTHER than the one asked. */
40
+ function foreignIssuer(body, issuer) {
41
+ if (typeof body !== "object" || body === null)
42
+ return null;
43
+ const named = body.issuer;
44
+ return typeof named === "string" && named.length > 0 && !sameIssuer(named, issuer) ? named : null;
45
+ }
46
+ /**
47
+ * A server-sent issuer made safe to print: the URL as the parser serializes it (control characters, spaces and line
48
+ * breaks percent-encoded or dropped — never the raw text a server chose), or a plain phrase when it is no http(s) URL.
49
+ */
50
+ function printable(issuer) {
51
+ const url = parseUrl(issuer);
52
+ if (!url || (url.protocol !== "https:" && url.protocol !== "http:"))
53
+ return "another issuer";
54
+ return url.href.replace(/\/+$/, "").slice(0, 200);
55
+ }
56
+ async function askFor(url, issuer, fetchFn) {
57
+ let res;
58
+ try {
59
+ res = await fetchFn(url, { headers: { accept: "application/json" }, signal: AbortSignal.timeout(DISCOVERY_TIMEOUT_MS) });
60
+ }
61
+ catch {
62
+ return { kind: "trouble" };
63
+ }
64
+ if (!res.ok) {
65
+ // An error response is never read as a document, whatever its body. Its connection is released now, so a
66
+ // "not found" page left unread never holds the process open after the failure is printed.
67
+ await res.body?.cancel().catch(() => undefined);
68
+ return isTrouble(res.status) ? { kind: "trouble" } : { kind: "absent" };
69
+ }
70
+ const body = await res.json().catch(() => null);
71
+ const metadata = parseMetadata(body, issuer);
72
+ if (metadata)
73
+ return { kind: "found", metadata };
74
+ const other = foreignIssuer(body, issuer);
75
+ return other === null ? { kind: "absent" } : { kind: "foreign", issuer: other };
76
+ }
77
+ /** Why no document could be used — the most telling reason first. */
78
+ function discoveryFailure(base, misses) {
79
+ const foreign = misses.find(isForeign);
80
+ if (foreign) {
81
+ return new SignInError(`The sign-in server at ${base} answers for ${printable(foreign.issuer)}, not for ${base}, so it was not used. Check --api-url, or pass --auth-url.`, "AUTH_SERVER_MISMATCH");
82
+ }
83
+ if (misses.some((miss) => miss.kind === "trouble")) {
84
+ return new SignInError(`Could not reach Ora's sign-in server at ${base}. Check --api-url (or set --auth-url), or sign in with an api key: ora login --api-key`, "AUTH_SERVER_UNAVAILABLE");
85
+ }
86
+ return signInNotOffered(base);
87
+ }
88
+ export async function discoverMetadata(issuer, fetchFn) {
89
+ const base = issuer.replace(/\/+$/, "");
90
+ const misses = [];
91
+ for (const path of WELL_KNOWN_PATHS) {
92
+ const answer = await askFor(`${base}${path}`, issuer, fetchFn);
93
+ if (answer.kind === "found")
94
+ return answer.metadata;
95
+ misses.push(answer);
96
+ }
97
+ throw discoveryFailure(base, misses);
98
+ }
99
+ //# sourceMappingURL=metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../src/core/oauth/metadata.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAUnE,MAAM,gBAAgB,GAAG,CAAC,yCAAyC,EAAE,mCAAmC,CAAU,CAAC;AAEnH,4GAA4G;AAC5G,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAEpC,MAAM,UAAU,GAAG,CAAC,CAAS,EAAE,CAAS,EAAW,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAEtG,8FAA8F;AAC9F,MAAM,UAAU,aAAa,CAAC,IAAa,EAAE,MAAc;IACzD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAC3D,MAAM,GAAG,GAAG,IAA+B,CAAC;IAC5C,IAAI,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,EAA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AC,IAAI,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;IACD,MAAM,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACvC,CAAC"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * The CLI as an OAuth public client of Ora's authorization server: device authorization (RFC 8628), the token
3
+ * endpoint (device-code polling and refresh, RFC 6749 §6) and revocation (RFC 7009). Form-encoded, `client_id` in
4
+ * the body (a public client has no secret), and `resource` (RFC 8707) on every token request so each access token is
5
+ * bound to the public API's audience.
6
+ *
7
+ * No loop, no sleep, no presentation here: one call is one HTTP exchange. The polling cadence and the renewal of an
8
+ * expired code live in login/device-flow.ts.
9
+ */
10
+ export declare const DEVICE_CODE_GRANT = "urn:ietf:params:oauth:grant-type:device_code";
11
+ /**
12
+ * How long one exchange with the sign-in server may take. It must stay well under the refresh lock's stale window
13
+ * (session/file-lock.ts, DEFAULT_STALE_MS; oauth-client.test.ts holds the two apart): a refresh that hung longer would
14
+ * have its lock broken by a second `ora` process, which would then send the same refresh token — a replay, which
15
+ * ends the whole sign-in.
16
+ */
17
+ export declare const OAUTH_REQUEST_TIMEOUT_MS = 15000;
18
+ export interface OAuthEndpoints {
19
+ tokenEndpoint: string;
20
+ deviceAuthorizationEndpoint?: string;
21
+ revocationEndpoint?: string;
22
+ }
23
+ export interface DeviceAuthorization {
24
+ deviceCode: string;
25
+ userCode: string;
26
+ verificationUri: string;
27
+ verificationUriComplete?: string;
28
+ /** Epoch ms. */
29
+ expiresAt: number;
30
+ intervalMs: number;
31
+ }
32
+ export interface TokenSet {
33
+ accessToken: string;
34
+ /** Epoch ms. */
35
+ expiresAt: number;
36
+ refreshToken?: string;
37
+ scope?: string;
38
+ }
39
+ export type DevicePoll = {
40
+ kind: "pending";
41
+ } | {
42
+ kind: "slow_down";
43
+ } | {
44
+ kind: "tokens";
45
+ tokens: TokenSet;
46
+ };
47
+ export interface OAuthClientDeps {
48
+ endpoints: OAuthEndpoints;
49
+ clientId: string;
50
+ fetchFn: typeof fetch;
51
+ now: () => number;
52
+ }
53
+ export declare class OAuthClient {
54
+ private readonly deps;
55
+ constructor(deps: OAuthClientDeps);
56
+ /** POST device_authorization_endpoint: a device code for this client, these scopes, this audience. */
57
+ startDeviceAuthorization(req: {
58
+ scope: string;
59
+ resource: string;
60
+ }): Promise<DeviceAuthorization>;
61
+ /** One poll of the token endpoint. Pending and slow_down are answers, not errors; every other OAuth error throws. */
62
+ pollDeviceToken(authorization: DeviceAuthorization, resource: string): Promise<DevicePoll>;
63
+ /** Refresh: the server rotates the refresh token, so the caller MUST store the one this returns. */
64
+ refresh(refreshToken: string, resource: string): Promise<TokenSet>;
65
+ /** Best-effort revocation (RFC 7009 answers 200 even for an unknown token). False when the server has no endpoint. */
66
+ revoke(token: string, hint: "refresh_token" | "access_token"): Promise<boolean>;
67
+ private tokenSet;
68
+ private post;
69
+ }
70
+ //# sourceMappingURL=oauth-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-client.d.ts","sourceRoot":"","sources":["../../../src/core/oauth/oauth-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,eAAO,MAAM,iBAAiB,iDAAiD,CAAC;AAMhF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAE/C,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,gBAAgB;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,UAAU,GAAG;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,QAAQ,CAAA;CAAE,CAAC;AAE5G,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,cAAc,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,KAAK,CAAC;IACtB,GAAG,EAAE,MAAM,MAAM,CAAC;CACnB;AAED,qBAAa,WAAW;IACV,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,eAAe;IAElD,sGAAsG;IAChG,wBAAwB,CAAC,GAAG,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC;IA0BtG,qHAAqH;IAC/G,eAAe,CAAC,aAAa,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAgBhG,oGAAoG;IAC9F,OAAO,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAUxE,sHAAsH;IAChH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,GAAG,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IAOrF,OAAO,CAAC,QAAQ;YAiBF,IAAI;CAiBnB"}
@@ -0,0 +1,136 @@
1
+ /**
2
+ * The CLI as an OAuth public client of Ora's authorization server: device authorization (RFC 8628), the token
3
+ * endpoint (device-code polling and refresh, RFC 6749 §6) and revocation (RFC 7009). Form-encoded, `client_id` in
4
+ * the body (a public client has no secret), and `resource` (RFC 8707) on every token request so each access token is
5
+ * bound to the public API's audience.
6
+ *
7
+ * No loop, no sleep, no presentation here: one call is one HTTP exchange. The polling cadence and the renewal of an
8
+ * expired code live in login/device-flow.ts.
9
+ */
10
+ import { isHttpUrl } from "../url.js";
11
+ import { OAuthError, oauthErrorFrom } from "./oauth-error.js";
12
+ export const DEVICE_CODE_GRANT = "urn:ietf:params:oauth:grant-type:device_code";
13
+ /** RFC 8628 §3.2: when the server names no interval, poll every 5 seconds. */
14
+ const DEFAULT_INTERVAL_S = 5;
15
+ /** An access token whose response omits `expires_in` is treated as short-lived. */
16
+ const DEFAULT_ACCESS_TOKEN_TTL_S = 300;
17
+ /**
18
+ * How long one exchange with the sign-in server may take. It must stay well under the refresh lock's stale window
19
+ * (session/file-lock.ts, DEFAULT_STALE_MS; oauth-client.test.ts holds the two apart): a refresh that hung longer would
20
+ * have its lock broken by a second `ora` process, which would then send the same refresh token — a replay, which
21
+ * ends the whole sign-in.
22
+ */
23
+ export const OAUTH_REQUEST_TIMEOUT_MS = 15_000;
24
+ export class OAuthClient {
25
+ deps;
26
+ constructor(deps) {
27
+ this.deps = deps;
28
+ }
29
+ /** POST device_authorization_endpoint: a device code for this client, these scopes, this audience. */
30
+ async startDeviceAuthorization(req) {
31
+ const endpoint = this.deps.endpoints.deviceAuthorizationEndpoint;
32
+ if (!endpoint) {
33
+ throw new OAuthError("unsupported_grant_type", "this sign-in server does not offer device sign-in", 400);
34
+ }
35
+ const body = await this.post(endpoint, { client_id: this.deps.clientId, scope: req.scope, resource: req.resource });
36
+ const deviceCode = str(body.device_code);
37
+ const userCode = str(body.user_code);
38
+ const verificationUri = isHttpUrl(body.verification_uri) ? body.verification_uri : undefined;
39
+ if (!deviceCode || !userCode || !verificationUri) {
40
+ throw new OAuthError("invalid_response", "the device authorization response is missing a required field", 502);
41
+ }
42
+ const expiresIn = num(body.expires_in);
43
+ if (expiresIn === undefined) {
44
+ throw new OAuthError("invalid_response", "the device authorization response has no expires_in", 502);
45
+ }
46
+ return {
47
+ deviceCode,
48
+ userCode,
49
+ verificationUri,
50
+ ...(isHttpUrl(body.verification_uri_complete) ? { verificationUriComplete: body.verification_uri_complete } : {}),
51
+ expiresAt: this.deps.now() + expiresIn * 1000,
52
+ intervalMs: (num(body.interval) ?? DEFAULT_INTERVAL_S) * 1000,
53
+ };
54
+ }
55
+ /** One poll of the token endpoint. Pending and slow_down are answers, not errors; every other OAuth error throws. */
56
+ async pollDeviceToken(authorization, resource) {
57
+ try {
58
+ const body = await this.post(this.deps.endpoints.tokenEndpoint, {
59
+ grant_type: DEVICE_CODE_GRANT,
60
+ device_code: authorization.deviceCode,
61
+ client_id: this.deps.clientId,
62
+ resource,
63
+ });
64
+ return { kind: "tokens", tokens: this.tokenSet(body) };
65
+ }
66
+ catch (err) {
67
+ if (err instanceof OAuthError && err.error === "authorization_pending")
68
+ return { kind: "pending" };
69
+ if (err instanceof OAuthError && err.error === "slow_down")
70
+ return { kind: "slow_down" };
71
+ throw err;
72
+ }
73
+ }
74
+ /** Refresh: the server rotates the refresh token, so the caller MUST store the one this returns. */
75
+ async refresh(refreshToken, resource) {
76
+ const body = await this.post(this.deps.endpoints.tokenEndpoint, {
77
+ grant_type: "refresh_token",
78
+ refresh_token: refreshToken,
79
+ client_id: this.deps.clientId,
80
+ resource,
81
+ });
82
+ return this.tokenSet(body);
83
+ }
84
+ /** Best-effort revocation (RFC 7009 answers 200 even for an unknown token). False when the server has no endpoint. */
85
+ async revoke(token, hint) {
86
+ const endpoint = this.deps.endpoints.revocationEndpoint;
87
+ if (!endpoint)
88
+ return false;
89
+ await this.post(endpoint, { token, token_type_hint: hint, client_id: this.deps.clientId });
90
+ return true;
91
+ }
92
+ tokenSet(body) {
93
+ const accessToken = str(body.access_token);
94
+ if (!accessToken)
95
+ throw new OAuthError("invalid_response", "the token response has no access_token", 502);
96
+ const tokenType = str(body.token_type);
97
+ if (tokenType && tokenType.toLowerCase() !== "bearer") {
98
+ throw new OAuthError("invalid_response", `unsupported token type "${tokenType}"`, 502);
99
+ }
100
+ const refreshToken = str(body.refresh_token);
101
+ const scope = str(body.scope);
102
+ return {
103
+ accessToken,
104
+ expiresAt: this.deps.now() + (num(body.expires_in) ?? DEFAULT_ACCESS_TOKEN_TTL_S) * 1000,
105
+ ...(refreshToken ? { refreshToken } : {}),
106
+ ...(scope ? { scope } : {}),
107
+ };
108
+ }
109
+ async post(url, params) {
110
+ const res = await this.deps.fetchFn(url, {
111
+ method: "POST",
112
+ headers: { "content-type": "application/x-www-form-urlencoded", accept: "application/json" },
113
+ body: new URLSearchParams(params).toString(),
114
+ signal: AbortSignal.timeout(OAUTH_REQUEST_TIMEOUT_MS),
115
+ });
116
+ if (!res.ok)
117
+ throw await oauthErrorFrom(res);
118
+ const text = await res.text();
119
+ if (!text)
120
+ return {};
121
+ try {
122
+ const parsed = JSON.parse(text);
123
+ return typeof parsed === "object" && parsed !== null ? parsed : {};
124
+ }
125
+ catch {
126
+ throw new OAuthError("invalid_response", "the sign-in server answered something that is not JSON", 502);
127
+ }
128
+ }
129
+ }
130
+ function str(value) {
131
+ return typeof value === "string" && value.length > 0 ? value : undefined;
132
+ }
133
+ function num(value) {
134
+ return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : undefined;
135
+ }
136
+ //# sourceMappingURL=oauth-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-client.js","sourceRoot":"","sources":["../../../src/core/oauth/oauth-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE9D,MAAM,CAAC,MAAM,iBAAiB,GAAG,8CAA8C,CAAC;AAEhF,8EAA8E;AAC9E,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,mFAAmF;AACnF,MAAM,0BAA0B,GAAG,GAAG,CA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DAAwD,EAAE,GAAG,CAAC,CAAC;QAC1G,CAAC;IACH,CAAC;CACF;AAED,SAAS,GAAG,CAAC,KAAc;IACzB,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3E,CAAC;AAED,SAAS,GAAG,CAAC,KAAc;IACzB,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9F,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * An OAuth error response (RFC 6749 §5.2, RFC 8628 §3.5): `{error, error_description?}`. `error` is the protocol's
3
+ * own code — `authorization_pending`, `slow_down`, `access_denied`, `expired_token`, `invalid_grant`, … — and is
4
+ * what callers branch on; the description is for people. `retryAfter` is the response's `Retry-After`, in seconds.
5
+ */
6
+ export declare class OAuthError extends Error {
7
+ readonly error: string;
8
+ readonly description: string | undefined;
9
+ readonly status: number;
10
+ readonly retryAfter?: number | undefined;
11
+ constructor(error: string, description: string | undefined, status: number, retryAfter?: number | undefined);
12
+ }
13
+ /**
14
+ * Reads an error response body into an OAuthError; a body that isn't one (the ingress's plain-text 429, an HTML 502)
15
+ * becomes `server_error`, keeping the status and `Retry-After`.
16
+ */
17
+ export declare function oauthErrorFrom(res: Response): Promise<OAuthError>;
18
+ //# sourceMappingURL=oauth-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-error.d.ts","sourceRoot":"","sources":["../../../src/core/oauth/oauth-error.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,qBAAa,UAAW,SAAQ,KAAK;IAEjC,QAAQ,CAAC,KAAK,EAAE,MAAM;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS;IACxC,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM;gBAHnB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,MAAM,YAAA;CAK/B;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAUvE"}
@@ -0,0 +1,31 @@
1
+ import { retryAfterSeconds } from "../retry-after.js";
2
+ /**
3
+ * An OAuth error response (RFC 6749 §5.2, RFC 8628 §3.5): `{error, error_description?}`. `error` is the protocol's
4
+ * own code — `authorization_pending`, `slow_down`, `access_denied`, `expired_token`, `invalid_grant`, … — and is
5
+ * what callers branch on; the description is for people. `retryAfter` is the response's `Retry-After`, in seconds.
6
+ */
7
+ export class OAuthError extends Error {
8
+ error;
9
+ description;
10
+ status;
11
+ retryAfter;
12
+ constructor(error, description, status, retryAfter) {
13
+ super(description ? `${error}: ${description}` : error);
14
+ this.error = error;
15
+ this.description = description;
16
+ this.status = status;
17
+ this.retryAfter = retryAfter;
18
+ this.name = "OAuthError";
19
+ }
20
+ }
21
+ /**
22
+ * Reads an error response body into an OAuthError; a body that isn't one (the ingress's plain-text 429, an HTML 502)
23
+ * becomes `server_error`, keeping the status and `Retry-After`.
24
+ */
25
+ export async function oauthErrorFrom(res) {
26
+ const body = (await res.json().catch(() => ({})));
27
+ const error = typeof body.error === "string" && body.error.length > 0 ? body.error : "server_error";
28
+ const description = typeof body.error_description === "string" ? body.error_description : undefined;
29
+ return new OAuthError(error, description ?? (error === "server_error" ? `HTTP ${res.status}` : undefined), res.status, retryAfterSeconds(res.headers.get("retry-after")));
30
+ }
31
+ //# sourceMappingURL=oauth-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-error.js","sourceRoot":"","sources":["../../../src/core/oauth/oauth-error.ts"],"names":[],"mappings":"AAAA,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,CAAC;AACJ,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Signing in did not complete: the sign-in server is unreachable, the code was declined, the codes kept expiring.
3
+ * Unlike an AuthError (a credential the platform refused), there is no credential yet — so it renders as its own
4
+ * sentence, never as "your sign-in no longer works".
5
+ */
6
+ export declare class SignInError extends Error {
7
+ readonly code: string;
8
+ constructor(message: string, code: string);
9
+ }
10
+ /**
11
+ * The server asked has no browser sign-in to offer: an Ora that predates it (no sign-in document, or one without a
12
+ * device endpoint). Not a fault to retry — api keys work there as they always have, so the message says how.
13
+ */
14
+ export declare function signInNotOffered(issuer: string): SignInError;
15
+ //# sourceMappingURL=sign-in-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign-in-error.d.ts","sourceRoot":"","sources":["../../../src/core/oauth/sign-in-error.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,WAAY,SAAQ,KAAK;IAGlC,QAAQ,CAAC,IAAI,EAAE,MAAM;gBADrB,OAAO,EAAE,MAAM,EACN,IAAI,EAAE,MAAM;CAKxB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAK5D"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Signing in did not complete: the sign-in server is unreachable, the code was declined, the codes kept expiring.
3
+ * Unlike an AuthError (a credential the platform refused), there is no credential yet — so it renders as its own
4
+ * sentence, never as "your sign-in no longer works".
5
+ */
6
+ export class SignInError extends Error {
7
+ code;
8
+ constructor(message, code) {
9
+ super(message);
10
+ this.code = code;
11
+ this.name = "SignInError";
12
+ }
13
+ }
14
+ /**
15
+ * The server asked has no browser sign-in to offer: an Ora that predates it (no sign-in document, or one without a
16
+ * device endpoint). Not a fault to retry — api keys work there as they always have, so the message says how.
17
+ */
18
+ export function signInNotOffered(issuer) {
19
+ return new SignInError(`This server does not offer browser sign-in yet (asked ${issuer}). Sign in with an api key instead: ora login --api-key`, "SIGN_IN_NOT_OFFERED");
20
+ }
21
+ //# sourceMappingURL=sign-in-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign-in-error.js","sourceRoot":"","sources":["../../../src/core/oauth/sign-in-error.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK;IAGzB;IAFX,YACE,OAAe,EACN,IAAY;QAErB,KAAK,CAAC,OAAO,CAAC,CAAC;QAFN,SAAI,GAAJ,IAAI,CAAQ;QAGrB,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,OAAO,IAAI,WAAW,CACpB,yDAAyD,MAAM,yDAAyD,EACxH,qBAAqB,CACtB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Where device sign-in goes, for a given API: the authorization server (the issuer, `account.<domain>`), the client
3
+ * the CLI signs in as, and the audience its tokens are for (the public API's origin).
4
+ *
5
+ * Precedence, like the api url's (config.ts): `--auth-url` flag > `ORA_AUTH_URL` env > config.json `authUrl` > the
6
+ * issuer DERIVED from the api url — `api.<domain>` → `account.<domain>`, the platform's host convention
7
+ * (`https://api.ora.ai` → `https://account.ora.ai`, dev `http://api.ora.localhost:8081` →
8
+ * `http://account.ora.localhost:8081`).
9
+ */
10
+ /**
11
+ * The CLI's own client id. Every published CLI is the first-party public client (no secret) the authorization server
12
+ * knows by this id, so it is a constant, not a setting.
13
+ */
14
+ export declare const CLI_CLIENT_ID = "ora-cli";
15
+ export interface SignInTarget {
16
+ issuer: string;
17
+ clientId: string;
18
+ /** RFC 8707 resource: the public API's canonical origin, every access token's audience. */
19
+ resource: string;
20
+ }
21
+ /** `https://API.ora.ai/` → `https://api.ora.ai`: lowercase scheme and host, no path, no trailing slash. */
22
+ export declare function apiResource(apiUrl: string): string;
23
+ /** `api.<domain>` → `account.<domain>`, keeping scheme and port. Null when the host does not start with `api.`. */
24
+ export declare function deriveIssuer(apiUrl: string): string | null;
25
+ export declare function resolveSignInTarget(opts: {
26
+ apiUrl: string;
27
+ authUrlFlag?: string;
28
+ configAuthUrl?: string;
29
+ env: NodeJS.ProcessEnv;
30
+ }): SignInTarget;
31
+ //# sourceMappingURL=sign-in-target.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign-in-target.d.ts","sourceRoot":"","sources":["../../../src/core/oauth/sign-in-target.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH;;;GAGG;AACH,eAAO,MAAM,aAAa,YAAY,CAAC;AAEvC,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,2FAA2F;IAC3F,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,2GAA2G;AAC3G,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAIlD;AAED,mHAAmH;AACnH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK1D;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;CACxB,GAAG,YAAY,CAcf"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Where device sign-in goes, for a given API: the authorization server (the issuer, `account.<domain>`), the client
3
+ * the CLI signs in as, and the audience its tokens are for (the public API's origin).
4
+ *
5
+ * Precedence, like the api url's (config.ts): `--auth-url` flag > `ORA_AUTH_URL` env > config.json `authUrl` > the
6
+ * issuer DERIVED from the api url — `api.<domain>` → `account.<domain>`, the platform's host convention
7
+ * (`https://api.ora.ai` → `https://account.ora.ai`, dev `http://api.ora.localhost:8081` →
8
+ * `http://account.ora.localhost:8081`).
9
+ */
10
+ import { SignInError } from "./sign-in-error.js";
11
+ import { parseUrl } from "../url.js";
12
+ /**
13
+ * The CLI's own client id. Every published CLI is the first-party public client (no secret) the authorization server
14
+ * knows by this id, so it is a constant, not a setting.
15
+ */
16
+ export const CLI_CLIENT_ID = "ora-cli";
17
+ /** `https://API.ora.ai/` → `https://api.ora.ai`: lowercase scheme and host, no path, no trailing slash. */
18
+ export function apiResource(apiUrl) {
19
+ const url = parseUrl(apiUrl);
20
+ if (!url)
21
+ throw new SignInError(`"${apiUrl}" is not a valid API URL`, "INVALID_API_URL");
22
+ return `${url.protocol}//${url.host.toLowerCase()}`;
23
+ }
24
+ /** `api.<domain>` → `account.<domain>`, keeping scheme and port. Null when the host does not start with `api.`. */
25
+ export function deriveIssuer(apiUrl) {
26
+ const url = parseUrl(apiUrl);
27
+ if (!url || !/^api\./i.test(url.hostname))
28
+ return null;
29
+ const host = url.host.replace(/^api\./i, "account.");
30
+ return `${url.protocol}//${host.toLowerCase()}`;
31
+ }
32
+ export function resolveSignInTarget(opts) {
33
+ const explicit = opts.authUrlFlag || opts.env.ORA_AUTH_URL || opts.configAuthUrl;
34
+ const issuer = (explicit || deriveIssuer(opts.apiUrl))?.replace(/\/+$/, "");
35
+ if (!issuer) {
36
+ throw new SignInError(`Can't tell where to sign in for ${opts.apiUrl}. Pass --auth-url (Ora's account origin), or use an api key: ora login --api-key`, "AUTH_URL_REQUIRED");
37
+ }
38
+ return {
39
+ issuer,
40
+ clientId: CLI_CLIENT_ID,
41
+ resource: apiResource(opts.apiUrl),
42
+ };
43
+ }
44
+ //# sourceMappingURL=sign-in-target.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign-in-target.js","sourceRoot":"","sources":["../../../src/core/oauth/sign-in-target.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC;;;GAGG;AACH,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EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC;KACnC,CAAC;AACJ,CAAC"}
@@ -5,15 +5,26 @@
5
5
  * trajectory/insight/journey/run-list renderers — render/index.ts), falling
6
6
  * back to the same plain rendering when none of them claims the payload.
7
7
  * renderError is where the CLI earns its keep: the 402 paywall and 403 scope
8
- * stories are precomputed guidance, not bare codes.
8
+ * stories are precomputed guidance, not bare codes — worded for the credential
9
+ * that was refused (an api key is told to mint one, a browser sign-in to sign
10
+ * in again: credentials/refusal-words.ts). The words come bound to the caller
11
+ * that met the error (run-operation.ts callerOf); there is no default kind.
9
12
  */
10
13
  import "../render/index.js";
11
14
  import type { OutputMode } from "../render/mode.js";
15
+ import type { RefusalWords } from "./credentials/credential.js";
12
16
  export declare function renderResult(data: unknown, opts: {
13
17
  mode: OutputMode;
14
18
  }): string;
15
- export declare function renderError(err: unknown, ctx?: {
19
+ export interface RenderErrorContext {
16
20
  scope?: string | null;
17
21
  mode?: OutputMode;
18
- }): string;
22
+ /**
23
+ * The refused credential's own words (credentials/refusal-words.ts), bound by the caller that met the error
24
+ * (run-operation.ts callerOf). Without them a refusal is told as the API said it, with no advice: an error met with
25
+ * no credential resolved is no credential's refusal, and is never worded for one kind of credential.
26
+ */
27
+ words?: RefusalWords;
28
+ }
29
+ export declare function renderError(err: unknown, ctx?: RenderErrorContext): string;
19
30
  //# sourceMappingURL=output.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/core/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAOpD,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GAAG,MAAM,CAO9E;AAwCD,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,CAAC,EAAE,UAAU,CAAA;CAAO,GAAG,MAAM,CAKxG"}
1
+ {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/core/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAKpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAIhE,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GAAG,MAAM,CAO9E;AAwCD,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;;;OAIG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,GAAE,kBAAuB,GAAG,MAAM,CAS9E"}