@owlmeans/cli-auth 0.1.18-rc.14 → 0.1.18-rc.15

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.
package/README.md CHANGED
@@ -6,7 +6,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
6
6
  your project's skill store (`.agents/skills/`):
7
7
 
8
8
  ```sh
9
- npx @owlmeans/agent-skills@^0.1.18-rc.47
9
+ npx @owlmeans/agent-skills@^0.1.18-rc.48
10
10
  ```
11
11
 
12
12
  The embedded files are version-matched to this package release. Do not edit them
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
3
  "package": "@owlmeans/cli-auth",
4
- "version": "0.1.18-rc.14",
5
- "generatedAt": "2026-10-03T20:05:07.612Z",
4
+ "version": "0.1.18-rc.15",
5
+ "generatedAt": "2026-10-05T08:32:19.139Z",
6
6
  "canonicalRepo": "https://github.com/owlmeans/common",
7
7
  "entries": [
8
8
  {
@@ -8,7 +8,7 @@ user-invocable: false
8
8
  # @owlmeans/cli-auth
9
9
 
10
10
  **Layer:** Tooling (Node/Bun — no React, no DOM, no framework runtime)
11
- **Install:** `"@owlmeans/cli-auth": "^0.1.18-rc.14"` in `dependencies`
11
+ **Install:** `"@owlmeans/cli-auth": "^0.1.18-rc.15"` in `dependencies`
12
12
  **Contracts:** `@owlmeans/oauth` (discovery, device authorization, polling, revoke, `SignInRequired`)
13
13
  **Server half:** any API built on `@owlmeans/server-oauth`; **consumers:** `@owlmeans/viable-mcp`
14
14
 
@@ -0,0 +1,2 @@
1
+ export declare const COMMAND_BY_PLATFORM: Record<string, string>;
2
+ //# sourceMappingURL=consts.local.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.local.d.ts","sourceRoot":"","sources":["../src/consts.local.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAItD,CAAA"}
@@ -0,0 +1,6 @@
1
+ export const COMMAND_BY_PLATFORM = {
2
+ darwin: 'open',
3
+ win32: 'start',
4
+ linux: 'xdg-open',
5
+ };
6
+ //# sourceMappingURL=consts.local.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.local.js","sourceRoot":"","sources":["../src/consts.local.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAA2B;IACzD,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,UAAU;CAClB,CAAA"}
package/build/holder.d.ts CHANGED
@@ -1,38 +1,3 @@
1
- export interface CliCredentialsOptions {
2
- /** The API origin this credential set is for, and the OAuth `resource` it is scoped to unless
3
- * `resource` says otherwise. */
4
- apiUrl: string;
5
- /** This CLI's OAuth `client_id` — a static one the authorization server declared, or an https
6
- * Client ID Metadata Document URL. */
7
- clientId: string;
8
- deviceName?: string;
9
- resource?: string;
10
- scope?: string;
11
- /** Which key in `~/.owlmeans` (and the environment) carries the token. */
12
- tokenEnvKey: string;
13
- /** Which key records the URL a stored token belongs to. A file naming no URL at all is treated
14
- * as belonging to whichever `apiUrl` is asked for — only an explicit MISMATCH refuses it. */
15
- apiUrlEnvKey: string;
16
- env?: NodeJS.ProcessEnv;
17
- /** Best-effort progress — "open this URL and enter this code", "signed in", a failure. A host
18
- * wires this to stderr, an MCP `notifications/message`, or nothing at all. */
19
- onNotify?: (message: string) => void;
20
- }
21
- export interface CliCredentials {
22
- /** The token this call site should use right now: the environment, then the bound file value,
23
- * or `null` when neither has one. */
24
- token: () => Promise<string | null>;
25
- /** Ensure a usable token exists. Starts or joins a device sign-in when there is none, waits up
26
- * to `waitMs` for it to be approved, and returns the token. The sign-in keeps running in the
27
- * background past that wait — a later `require()` call picks up wherever it left off, rather
28
- * than starting over. */
29
- require: (waitMs?: number) => Promise<string>;
30
- /** A 401 happened while presenting `rejectedToken`. A token that came from the FILE is forgotten
31
- * so the next `require()` signs in again; a token that came from the ENVIRONMENT is reported —
32
- * silently trying another identity behind an operator's back is worse than failing loudly. */
33
- invalidate: (rejectedToken: string) => Promise<void>;
34
- /** Revoke the current token at the server and remove it from the file. */
35
- signOut: () => Promise<void>;
36
- }
1
+ import type { CliCredentials, CliCredentialsOptions } from './types.js';
37
2
  export declare const makeCliCredentials: (opts: CliCredentialsOptions) => CliCredentials;
38
3
  //# sourceMappingURL=holder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"holder.d.ts","sourceRoot":"","sources":["../src/holder.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,qBAAqB;IACpC;oCACgC;IAChC,MAAM,EAAE,MAAM,CAAA;IACd;0CACsC;IACtC,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,0EAA0E;IAC1E,WAAW,EAAE,MAAM,CAAA;IACnB;iGAC6F;IAC7F,YAAY,EAAE,MAAM,CAAA;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;IACvB;kFAC8E;IAC9E,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CACrC;AAED,MAAM,WAAW,cAAc;IAC7B;yCACqC;IACrC,KAAK,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;IACnC;;;6BAGyB;IACzB,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;IAC7C;;kGAE8F;IAC9F,UAAU,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACpD,0EAA0E;IAC1E,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC7B;AAkBD,eAAO,MAAM,kBAAkB,SAAU,qBAAqB,KAAG,cAoJhE,CAAA"}
1
+ {"version":3,"file":"holder.d.ts","sourceRoot":"","sources":["../src/holder.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAkB,cAAc,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAmBvF,eAAO,MAAM,kBAAkB,SAAU,qBAAqB,KAAG,cAoJhE,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"holder.js","sourceRoot":"","sources":["../src/holder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAC5C,OAAO,EACL,2BAA2B,EAAE,iBAAiB,EAAE,UAAU,EAAE,qBAAqB,EACjF,eAAe,EAAE,0BAA0B,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EACxF,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AACjF,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAE/E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAyC/C,MAAM,iBAAiB,GAAG,GAAW,EAAE;IACrC,IAAI,GAAG,GAAG,KAAK,CAAA;IACf,IAAI,CAAC;QACH,GAAG,GAAG,QAAQ,EAAE,CAAC,QAAQ,CAAA;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,2FAA2F;IAC7F,CAAC;IAED,OAAO,GAAG,QAAQ,EAAE,MAAM,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,qBAAqB,CAAC,CAAA;AACjE,CAAC,CAAA;AAED;oFACoF;AACpF,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAwC,CAAA;AAExE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAA2B,EAAkB,EAAE;IAChF,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,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YAC7B,IAAI,OAAO,IAAI,IAAI;gBAAE,OAAM;YAE3B,MAAM,MAAM,GAAG,MAAM,2BAA2B,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAA;YAC/E,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;gBACnB,MAAM,WAAW,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;YAC/F,CAAC;YACD,MAAM,YAAY,CAAC,eAAe,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,SAAS,EAAE,CAAC,CAAA;QACxE,CAAC;KACF,CAAA;AACH,CAAC,CAAA"}
package/build/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './consts.js';
2
2
  export * from './env-file.js';
3
3
  export * from './lock.js';
4
+ export type * from './types.js';
4
5
  export * from './open-browser.js';
5
6
  export * from './holder.js';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,mBAAmB,YAAY,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AAEzB,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA"}
package/build/lock.d.ts CHANGED
@@ -1,23 +1,4 @@
1
- /**
2
- * What one process tells every other one about the sign-in it is driving — the browser URL and
3
- * code so a SECOND process can show the same "waiting on…" state instead of opening a second
4
- * browser tab for the same API URL.
5
- */
6
- export interface SignInLockInfo {
7
- pid: number;
8
- apiUrl: string;
9
- verificationUri: string;
10
- verificationUriComplete?: string;
11
- userCode?: string;
12
- /** The device flow's own secret — protected the same way the eventual access token is (mode
13
- * `0600`, same directory as the credentials file), so a joining process can poll the SAME
14
- * pending authorization instead of requesting a second one nobody will ever display. */
15
- deviceCode: string;
16
- interval: number;
17
- expiresAt: number;
18
- /** Proves ownership at release time — a process only clears the lock it itself wrote. */
19
- nonce: string;
20
- }
1
+ import type { SignInLockInfo } from './types.js';
21
2
  export declare const lockPathFor: (credentialsPath: string) => string;
22
3
  export declare const readLock: (path: string) => Promise<SignInLockInfo | null>;
23
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"lock.d.ts","sourceRoot":"","sources":["../src/lock.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,eAAe,EAAE,MAAM,CAAA;IACvB,uBAAuB,CAAC,EAAE,MAAM,CAAA;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;4FAEwF;IACxF,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,yFAAyF;IACzF,KAAK,EAAE,MAAM,CAAA;CACd;AAED,eAAO,MAAM,WAAW,oBAAqB,MAAM,KAAG,MAAmC,CAAA;AAEzF,eAAO,MAAM,QAAQ,SAAgB,MAAM,KAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAM1E,CAAA;AAYD;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,SACpB,MAAM,UAAU,MAAM,QAAQ,IAAI,CAAC,cAAc,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC,KACnF,OAAO,CAAC;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,cAAc,CAAA;CAAE,CAWlD,CAAA;AAED;6FAC6F;AAC7F,eAAO,MAAM,WAAW,SAAgB,MAAM,SAAS,MAAM,KAAG,OAAO,CAAC,IAAI,CAK3E,CAAA"}
1
+ {"version":3,"file":"lock.d.ts","sourceRoot":"","sources":["../src/lock.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAEhD,eAAO,MAAM,WAAW,oBAAqB,MAAM,KAAG,MAAmC,CAAA;AAEzF,eAAO,MAAM,QAAQ,SAAgB,MAAM,KAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAM1E,CAAA;AAYD;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,SACpB,MAAM,UAAU,MAAM,QAAQ,IAAI,CAAC,cAAc,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC,KACnF,OAAO,CAAC;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,cAAc,CAAA;CAAE,CAWlD,CAAA;AAED;6FAC6F;AAC7F,eAAO,MAAM,WAAW,SAAgB,MAAM,SAAS,MAAM,KAAG,OAAO,CAAC,IAAI,CAK3E,CAAA"}
package/build/lock.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"lock.js","sourceRoot":"","sources":["../src/l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,CAAC,CAAA;IAE5D,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;AACpC,CAAC,CAAA;AAED;6FAC6F;AAC7F,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAAE,IAAY,EAAE,KAAa,EAAiB,EAAE;IAC9E,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAA;IACrC,IAAI,QAAQ,EAAE,KAAK,KAAK,KAAK,EAAE,CAAC;QAC9B,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;IAC3C,CAAC;AACH,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"open-browser.d.ts","sourceRoot":"","sources":["../src/open-browser.ts"],"names":[],"mappings":"AAQA;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,QAAS,MAAM,QAAO,MAAM,CAAC,UAAU,KAAiB,OAsB/E,CAAA"}
1
+ {"version":3,"file":"open-browser.d.ts","sourceRoot":"","sources":["../src/open-browser.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,QAAS,MAAM,QAAO,MAAM,CAAC,UAAU,KAAiB,OAsB/E,CAAA"}
@@ -1,9 +1,5 @@
1
1
  import { spawn } from 'node:child_process';
2
- const COMMAND_BY_PLATFORM = {
3
- darwin: 'open',
4
- win32: 'start',
5
- linux: 'xdg-open',
6
- };
2
+ import { COMMAND_BY_PLATFORM } from './consts.local.js';
7
3
  /**
8
4
  * Best-effort: open `url` in the person's default browser. `false` on any failure — a CLI whose
9
5
  * whole job is print-a-URL-and-poll must still work over SSH, in a container, or on a platform
@@ -1 +1 @@
1
- {"version":3,"file":"open-browser.js","sourceRoot":"","sources":["../src/open-browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE1C,MAAM,mBAAmB,GAA2B;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CAAC,KAAK,EAAE,CAAA;QAEb,OAAO,IAAI,CAAA;IACb,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC,CAAA"}
@@ -0,0 +1,57 @@
1
+ export interface CliCredentialsOptions {
2
+ /** The API origin this credential set is for, and the OAuth `resource` it is scoped to unless
3
+ * `resource` says otherwise. */
4
+ apiUrl: string;
5
+ /** This CLI's OAuth `client_id` — a static one the authorization server declared, or an https
6
+ * Client ID Metadata Document URL. */
7
+ clientId: string;
8
+ deviceName?: string;
9
+ resource?: string;
10
+ scope?: string;
11
+ /** Which key in `~/.owlmeans` (and the environment) carries the token. */
12
+ tokenEnvKey: string;
13
+ /** Which key records the URL a stored token belongs to. A file naming no URL at all is treated
14
+ * as belonging to whichever `apiUrl` is asked for — only an explicit MISMATCH refuses it. */
15
+ apiUrlEnvKey: string;
16
+ env?: NodeJS.ProcessEnv;
17
+ /** Best-effort progress — "open this URL and enter this code", "signed in", a failure. A host
18
+ * wires this to stderr, an MCP `notifications/message`, or nothing at all. */
19
+ onNotify?: (message: string) => void;
20
+ }
21
+ export interface CliCredentials {
22
+ /** The token this call site should use right now: the environment, then the bound file value,
23
+ * or `null` when neither has one. */
24
+ token: () => Promise<string | null>;
25
+ /** Ensure a usable token exists. Starts or joins a device sign-in when there is none, waits up
26
+ * to `waitMs` for it to be approved, and returns the token. The sign-in keeps running in the
27
+ * background past that wait — a later `require()` call picks up wherever it left off, rather
28
+ * than starting over. */
29
+ require: (waitMs?: number) => Promise<string>;
30
+ /** A 401 happened while presenting `rejectedToken`. A token that came from the FILE is forgotten
31
+ * so the next `require()` signs in again; a token that came from the ENVIRONMENT is reported —
32
+ * silently trying another identity behind an operator's back is worse than failing loudly. */
33
+ invalidate: (rejectedToken: string) => Promise<void>;
34
+ /** Revoke the current token at the server and remove it from the file. */
35
+ signOut: () => Promise<void>;
36
+ }
37
+ /**
38
+ * What one process tells every other one about the sign-in it is driving — the browser URL and
39
+ * code so a SECOND process can show the same "waiting on…" state instead of opening a second
40
+ * browser tab for the same API URL.
41
+ */
42
+ export interface SignInLockInfo {
43
+ pid: number;
44
+ apiUrl: string;
45
+ verificationUri: string;
46
+ verificationUriComplete?: string;
47
+ userCode?: string;
48
+ /** The device flow's own secret — protected the same way the eventual access token is (mode
49
+ * `0600`, same directory as the credentials file), so a joining process can poll the SAME
50
+ * pending authorization instead of requesting a second one nobody will ever display. */
51
+ deviceCode: string;
52
+ interval: number;
53
+ expiresAt: number;
54
+ /** Proves ownership at release time — a process only clears the lock it itself wrote. */
55
+ nonce: string;
56
+ }
57
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC;oCACgC;IAChC,MAAM,EAAE,MAAM,CAAA;IACd;0CACsC;IACtC,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,0EAA0E;IAC1E,WAAW,EAAE,MAAM,CAAA;IACnB;iGAC6F;IAC7F,YAAY,EAAE,MAAM,CAAA;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;IACvB;kFAC8E;IAC9E,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CACrC;AAED,MAAM,WAAW,cAAc;IAC7B;yCACqC;IACrC,KAAK,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;IACnC;;;6BAGyB;IACzB,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;IAC7C;;kGAE8F;IAC9F,UAAU,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACpD,0EAA0E;IAC1E,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,eAAe,EAAE,MAAM,CAAA;IACvB,uBAAuB,CAAC,EAAE,MAAM,CAAA;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;4FAEwF;IACxF,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,yFAAyF;IACzF,KAAK,EAAE,MAAM,CAAA;CACd"}
package/build/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owlmeans/cli-auth",
3
- "version": "0.1.18-rc.14",
3
+ "version": "0.1.18-rc.15",
4
4
  "license": "MIT",
5
5
  "description": "OAuth device-authorization sign-in for a command-line tool: a dotenv-style ~/.owlmeans credentials file (overridable, environment always wins), a cross-process sign-in lock so several invocations converge on one browser round trip, a browser opener, and a small credential holder a CLI wraps its API calls with.",
6
6
  "type": "module",
@@ -23,12 +23,12 @@
23
23
  }
24
24
  },
25
25
  "dependencies": {
26
- "@owlmeans/error": "^0.1.18-rc.36",
27
- "@owlmeans/oauth": "^0.1.18-rc.14"
26
+ "@owlmeans/error": "^0.1.18-rc.37",
27
+ "@owlmeans/oauth": "^0.1.18-rc.15"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@owlmeans/dep-config": "workspace:*",
31
- "@types/bun": "^1.4.0",
31
+ "@types/bun": "^1.4.2",
32
32
  "nodemon": "^3.1.14",
33
33
  "typescript": "^7.0.2"
34
34
  },
@@ -0,0 +1,5 @@
1
+ export const COMMAND_BY_PLATFORM: Record<string, string> = {
2
+ darwin: 'open',
3
+ win32: 'start',
4
+ linux: 'xdg-open',
5
+ }
package/src/holder.ts CHANGED
@@ -1,53 +1,11 @@
1
1
  import { hostname, userInfo } from 'node:os'
2
- import {
3
- discoverAuthorizationServer, OAuthAccessDenied, OAuthError, OAUTH_DEVICE_NAME_MAX,
4
- pollDeviceToken, requestDeviceAuthorization, revokeToken, signInRequired, TokenRejected
5
- } from '@owlmeans/oauth'
6
- import type { AuthorizationServerMetadata, DeviceSignInOutcome } from '@owlmeans/oauth'
2
+ import { discoverAuthorizationServer, OAuthAccessDenied, OAuthError, OAUTH_DEVICE_NAME_MAX, pollDeviceToken, requestDeviceAuthorization, revokeToken, signInRequired, TokenRejected, type AuthorizationServerMetadata, type DeviceSignInOutcome } from '@owlmeans/oauth'
7
3
  import { DEFAULT_WAIT_MS } from './consts.js'
8
4
  import { readCredentialsFile, resolveEnvFile, setEnvValues } from './env-file.js'
9
5
  import { claimOrJoinLock, lockPathFor, readLock, releaseLock } from './lock.js'
10
- import type { SignInLockInfo } from './lock.js'
6
+ import type { SignInLockInfo, CliCredentials, CliCredentialsOptions } from './types.js'
11
7
  import { openBrowser } from './open-browser.js'
12
8
 
13
- export interface CliCredentialsOptions {
14
- /** The API origin this credential set is for, and the OAuth `resource` it is scoped to unless
15
- * `resource` says otherwise. */
16
- apiUrl: string
17
- /** This CLI's OAuth `client_id` — a static one the authorization server declared, or an https
18
- * Client ID Metadata Document URL. */
19
- clientId: string
20
- deviceName?: string
21
- resource?: string
22
- scope?: string
23
- /** Which key in `~/.owlmeans` (and the environment) carries the token. */
24
- tokenEnvKey: string
25
- /** Which key records the URL a stored token belongs to. A file naming no URL at all is treated
26
- * as belonging to whichever `apiUrl` is asked for — only an explicit MISMATCH refuses it. */
27
- apiUrlEnvKey: string
28
- env?: NodeJS.ProcessEnv
29
- /** Best-effort progress — "open this URL and enter this code", "signed in", a failure. A host
30
- * wires this to stderr, an MCP `notifications/message`, or nothing at all. */
31
- onNotify?: (message: string) => void
32
- }
33
-
34
- export interface CliCredentials {
35
- /** The token this call site should use right now: the environment, then the bound file value,
36
- * or `null` when neither has one. */
37
- token: () => Promise<string | null>
38
- /** Ensure a usable token exists. Starts or joins a device sign-in when there is none, waits up
39
- * to `waitMs` for it to be approved, and returns the token. The sign-in keeps running in the
40
- * background past that wait — a later `require()` call picks up wherever it left off, rather
41
- * than starting over. */
42
- require: (waitMs?: number) => Promise<string>
43
- /** A 401 happened while presenting `rejectedToken`. A token that came from the FILE is forgotten
44
- * so the next `require()` signs in again; a token that came from the ENVIRONMENT is reported —
45
- * silently trying another identity behind an operator's back is worse than failing loudly. */
46
- invalidate: (rejectedToken: string) => Promise<void>
47
- /** Revoke the current token at the server and remove it from the file. */
48
- signOut: () => Promise<void>
49
- }
50
-
51
9
 
52
10
  const defaultDeviceName = (): string => {
53
11
  let who = 'cli'
package/src/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './consts.js'
2
2
  export * from './env-file.js'
3
3
  export * from './lock.js'
4
+ export type * from './types.js'
4
5
  export * from './open-browser.js'
5
6
  export * from './holder.js'
package/src/lock.ts CHANGED
@@ -1,27 +1,7 @@
1
1
  import { randomBytes } from 'node:crypto'
2
2
  import { mkdir, readFile, unlink, writeFile } from 'node:fs/promises'
3
3
  import { dirname } from 'node:path'
4
-
5
- /**
6
- * What one process tells every other one about the sign-in it is driving — the browser URL and
7
- * code so a SECOND process can show the same "waiting on…" state instead of opening a second
8
- * browser tab for the same API URL.
9
- */
10
- export interface SignInLockInfo {
11
- pid: number
12
- apiUrl: string
13
- verificationUri: string
14
- verificationUriComplete?: string
15
- userCode?: string
16
- /** The device flow's own secret — protected the same way the eventual access token is (mode
17
- * `0600`, same directory as the credentials file), so a joining process can poll the SAME
18
- * pending authorization instead of requesting a second one nobody will ever display. */
19
- deviceCode: string
20
- interval: number
21
- expiresAt: number
22
- /** Proves ownership at release time — a process only clears the lock it itself wrote. */
23
- nonce: string
24
- }
4
+ import type { SignInLockInfo } from './types.js'
25
5
 
26
6
  export const lockPathFor = (credentialsPath: string): string => `${credentialsPath}.lock`
27
7
 
@@ -1,10 +1,5 @@
1
1
  import { spawn } from 'node:child_process'
2
-
3
- const COMMAND_BY_PLATFORM: Record<string, string> = {
4
- darwin: 'open',
5
- win32: 'start',
6
- linux: 'xdg-open',
7
- }
2
+ import { COMMAND_BY_PLATFORM } from './consts.local.js'
8
3
 
9
4
  /**
10
5
  * Best-effort: open `url` in the person's default browser. `false` on any failure — a CLI whose
package/src/types.ts ADDED
@@ -0,0 +1,58 @@
1
+ export interface CliCredentialsOptions {
2
+ /** The API origin this credential set is for, and the OAuth `resource` it is scoped to unless
3
+ * `resource` says otherwise. */
4
+ apiUrl: string
5
+ /** This CLI's OAuth `client_id` — a static one the authorization server declared, or an https
6
+ * Client ID Metadata Document URL. */
7
+ clientId: string
8
+ deviceName?: string
9
+ resource?: string
10
+ scope?: string
11
+ /** Which key in `~/.owlmeans` (and the environment) carries the token. */
12
+ tokenEnvKey: string
13
+ /** Which key records the URL a stored token belongs to. A file naming no URL at all is treated
14
+ * as belonging to whichever `apiUrl` is asked for — only an explicit MISMATCH refuses it. */
15
+ apiUrlEnvKey: string
16
+ env?: NodeJS.ProcessEnv
17
+ /** Best-effort progress — "open this URL and enter this code", "signed in", a failure. A host
18
+ * wires this to stderr, an MCP `notifications/message`, or nothing at all. */
19
+ onNotify?: (message: string) => void
20
+ }
21
+
22
+ export interface CliCredentials {
23
+ /** The token this call site should use right now: the environment, then the bound file value,
24
+ * or `null` when neither has one. */
25
+ token: () => Promise<string | null>
26
+ /** Ensure a usable token exists. Starts or joins a device sign-in when there is none, waits up
27
+ * to `waitMs` for it to be approved, and returns the token. The sign-in keeps running in the
28
+ * background past that wait — a later `require()` call picks up wherever it left off, rather
29
+ * than starting over. */
30
+ require: (waitMs?: number) => Promise<string>
31
+ /** A 401 happened while presenting `rejectedToken`. A token that came from the FILE is forgotten
32
+ * so the next `require()` signs in again; a token that came from the ENVIRONMENT is reported —
33
+ * silently trying another identity behind an operator's back is worse than failing loudly. */
34
+ invalidate: (rejectedToken: string) => Promise<void>
35
+ /** Revoke the current token at the server and remove it from the file. */
36
+ signOut: () => Promise<void>
37
+ }
38
+
39
+ /**
40
+ * What one process tells every other one about the sign-in it is driving — the browser URL and
41
+ * code so a SECOND process can show the same "waiting on…" state instead of opening a second
42
+ * browser tab for the same API URL.
43
+ */
44
+ export interface SignInLockInfo {
45
+ pid: number
46
+ apiUrl: string
47
+ verificationUri: string
48
+ verificationUriComplete?: string
49
+ userCode?: string
50
+ /** The device flow's own secret — protected the same way the eventual access token is (mode
51
+ * `0600`, same directory as the credentials file), so a joining process can poll the SAME
52
+ * pending authorization instead of requesting a second one nobody will ever display. */
53
+ deviceCode: string
54
+ interval: number
55
+ expiresAt: number
56
+ /** Proves ownership at release time — a process only clears the lock it itself wrote. */
57
+ nonce: string
58
+ }