@mnemonik/cli 7.131.0 → 7.132.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 (49) hide show
  1. package/dist/auth/claudeCodeSignIn.d.ts +54 -0
  2. package/dist/auth/claudeCodeSignIn.d.ts.map +1 -0
  3. package/dist/auth/claudeCodeSignIn.js +108 -0
  4. package/dist/auth/claudeCodeSignIn.js.map +1 -0
  5. package/dist/auth/codexAuthorization.d.ts +47 -0
  6. package/dist/auth/codexAuthorization.d.ts.map +1 -0
  7. package/dist/auth/codexAuthorization.js +882 -0
  8. package/dist/auth/codexAuthorization.js.map +1 -0
  9. package/dist/auth/cursorAuthorization.d.ts +47 -0
  10. package/dist/auth/cursorAuthorization.d.ts.map +1 -0
  11. package/dist/auth/cursorAuthorization.js +116 -0
  12. package/dist/auth/cursorAuthorization.js.map +1 -0
  13. package/dist/auth/status.d.ts +65 -11
  14. package/dist/auth/status.d.ts.map +1 -1
  15. package/dist/auth/status.js +41 -12
  16. package/dist/auth/status.js.map +1 -1
  17. package/dist/auth/storedAuthorization.d.ts +50 -0
  18. package/dist/auth/storedAuthorization.d.ts.map +1 -0
  19. package/dist/auth/storedAuthorization.js +24 -0
  20. package/dist/auth/storedAuthorization.js.map +1 -0
  21. package/dist/authorizationWords.d.ts +69 -0
  22. package/dist/authorizationWords.d.ts.map +1 -0
  23. package/dist/authorizationWords.js +5275 -0
  24. package/dist/authorizationWords.js.map +1 -0
  25. package/dist/digests.json +47 -27
  26. package/dist/humanReason.js +6 -6
  27. package/dist/humanReason.js.map +1 -1
  28. package/dist/install/hosts.d.ts.map +1 -1
  29. package/dist/install/hosts.js +2 -1
  30. package/dist/install/hosts.js.map +1 -1
  31. package/dist/installation.d.ts +2 -0
  32. package/dist/installation.d.ts.map +1 -1
  33. package/dist/installation.js +12 -0
  34. package/dist/installation.js.map +1 -1
  35. package/dist/output.d.ts +5 -2
  36. package/dist/output.d.ts.map +1 -1
  37. package/dist/output.js +7 -3
  38. package/dist/output.js.map +1 -1
  39. package/dist/router.d.ts +12 -7
  40. package/dist/router.d.ts.map +1 -1
  41. package/dist/router.js +145 -62
  42. package/dist/router.js.map +1 -1
  43. package/dist/sbom.json +21 -21
  44. package/dist/scanner-release.json +18 -18
  45. package/dist/status.d.ts +67 -30
  46. package/dist/status.d.ts.map +1 -1
  47. package/dist/status.js +140 -33
  48. package/dist/status.js.map +1 -1
  49. package/package.json +31 -31
@@ -0,0 +1,54 @@
1
+ import { type StoredAuthorization } from './storedAuthorization.js';
2
+ /**
3
+ * What Claude Code itself holds for Mnemonik's MCP server on this computer.
4
+ *
5
+ * On 2026-10-12 a network outage emptied Claude Code's stored Mnemonik
6
+ * authorization while the server still held a valid grant, and status said
7
+ * signed in. The server's grant says an authorization exists; only Claude
8
+ * Code's own store says whether Claude Code can use it. Read the way Claude
9
+ * Code 2.1.296 reads it:
10
+ *
11
+ * - The entry is `mcpOAuth["mnemonik|" + sha256(JSON.stringify({type, url,
12
+ * headers}))[0..16]]`, keyed by the declaration in ~/.claude.json, so an
13
+ * authorization stored for an older declaration (other headers) is not this one's.
14
+ * - Linux and Windows keep the document in ~/.claude/.credentials.json; a
15
+ * missing file means Claude Code holds nothing.
16
+ * - macOS keeps it in the login Keychain, generic password service
17
+ * `Claude Code-credentials`, account $USER, written and read with
18
+ * /usr/bin/security; the file is read only when that item does not exist.
19
+ * Over SSH the Keychain is locked and `security` exits 36
20
+ * (errSecInteractionNotAllowed); that is said as such, never as "missing".
21
+ * - Windows uses Credential Manager instead when CLAUDE_CODE_FORCE_WINDOWS_CREDMAN
22
+ * is 1 or ~/.claude.json caches `tengu_windows_credman: true`; that store is
23
+ * not read here.
24
+ *
25
+ * Only key names, presence and `expiresAt` are looked at (storedAuthorization.ts).
26
+ */
27
+ export type { StoredAuthorization } from './storedAuthorization.js';
28
+ export declare const CLAUDE_CODE_KEYCHAIN_SERVICE = "Claude Code-credentials";
29
+ export type KeychainRead = (service: string, account: string) => Promise<{
30
+ code: number | null;
31
+ stdout: string;
32
+ }>;
33
+ export interface ClaudeCodeStoreOptions {
34
+ home: string;
35
+ platform?: NodeJS.Platform;
36
+ env?: NodeJS.ProcessEnv;
37
+ now?: () => number;
38
+ /** The macOS Keychain read; /usr/bin/security by default. */
39
+ keychain?: KeychainRead;
40
+ }
41
+ /** Claude Code's key for a server's stored sign-in (its `zl(name, config)`). */
42
+ export declare function claudeCodeCredentialKey(name: string, declaration: {
43
+ type: string;
44
+ url: string;
45
+ headers?: unknown;
46
+ }): string;
47
+ /** One stored entry, judged as Claude Code judges it when it connects. */
48
+ export declare function claudeCodeEntryState(entry: unknown, now: number): StoredAuthorization;
49
+ /**
50
+ * Claude Code's stored Mnemonik authorization on this computer, or undefined
51
+ * when Claude Code has no Mnemonik HTTP declaration that authorizes with OAuth here.
52
+ */
53
+ export declare function claudeCodeStoredAuthorization(options: ClaudeCodeStoreOptions): Promise<StoredAuthorization | undefined>;
54
+ //# sourceMappingURL=claudeCodeSignIn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claudeCodeSignIn.d.ts","sourceRoot":"","sources":["../../src/auth/claudeCodeSignIn.ts"],"names":[],"mappings":"AAKA,OAAO,EAIL,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,YAAY,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAMpE,eAAO,MAAM,4BAA4B,4BAA4B,CAAC;AAEtE,MAAM,MAAM,YAAY,GAAG,CACzB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,KACZ,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEtD,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,YAAY,CAAC;CACzB;AAqED,gFAAgF;AAChF,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAC5D,MAAM,CAMR;AAKD,0EAA0E;AAC1E,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,mBAAmB,CAYrF;AAED;;;GAGG;AACH,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAwC1C"}
@@ -0,0 +1,108 @@
1
+ import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
+
3
+ // packages/cli/src/auth/claudeCodeSignIn.ts
4
+ import { execFile } from "node:child_process";
5
+ import { createHash } from "node:crypto";
6
+ import { readFile } from "node:fs/promises";
7
+ import { userInfo } from "node:os";
8
+ import { join } from "node:path";
9
+ import {
10
+ object,
11
+ parseObject as parse,
12
+ unreadable
13
+ } from "./storedAuthorization.js";
14
+ var KEYCHAIN_ITEM_NOT_FOUND = 44;
15
+ var KEYCHAIN_LOCKED = 36;
16
+ var CLAUDE_CODE_KEYCHAIN_SERVICE = "Claude Code-credentials";
17
+ var readKeychain = (service, account) => new Promise((resolve) => {
18
+ execFile(
19
+ "/usr/bin/security",
20
+ ["find-generic-password", "-a", account, "-w", "-s", service],
21
+ { encoding: "utf8", timeout: 2e3, maxBuffer: 1024 * 1024, windowsHide: true },
22
+ (error, stdout) => resolve(
23
+ error ? { code: typeof error.code === "number" ? error.code : null, stdout: "" } : { code: 0, stdout }
24
+ )
25
+ );
26
+ });
27
+ function keychainAccount(env) {
28
+ let name;
29
+ try {
30
+ name = env.USER || userInfo().username;
31
+ } catch {
32
+ name = void 0;
33
+ }
34
+ return name && /^[a-zA-Z0-9._-]+$/u.test(name) ? name : "claude-code-user";
35
+ }
36
+ async function credentialDocument(options, config) {
37
+ const { env, home, platform } = options;
38
+ const parsed = (text2, failure) => {
39
+ const document = parse(text2);
40
+ return document ? { document } : { unreadable: failure };
41
+ };
42
+ if (platform === "darwin") {
43
+ const item = await options.keychain(CLAUDE_CODE_KEYCHAIN_SERVICE, keychainAccount(env)).catch(() => void 0);
44
+ if (item?.code === 0) return parsed(item.stdout.trim(), unreadable("keychain_unreadable"));
45
+ if (item?.code === KEYCHAIN_LOCKED) return { unreadable: unreadable("keychain_locked") };
46
+ if (item?.code !== KEYCHAIN_ITEM_NOT_FOUND)
47
+ return { unreadable: unreadable("keychain_unreadable") };
48
+ }
49
+ if (platform === "win32" && (env.CLAUDE_CODE_FORCE_WINDOWS_CREDMAN === "1" || object(config.cachedGrowthBookFeatures) && config.cachedGrowthBookFeatures.tengu_windows_credman === true))
50
+ return { unreadable: unreadable("credential_manager") };
51
+ let text;
52
+ try {
53
+ text = await readFile(join(home, ".claude", ".credentials.json"), "utf8");
54
+ } catch (error) {
55
+ return error.code === "ENOENT" ? { document: null } : { unreadable: unreadable("file_unreadable") };
56
+ }
57
+ return parsed(text, unreadable("file_unreadable"));
58
+ }
59
+ function claudeCodeCredentialKey(name, declaration) {
60
+ const type = declaration.type === "streamable-http" ? "http" : declaration.type;
61
+ const digest = createHash("sha256").update(JSON.stringify({ type, url: declaration.url, headers: declaration.headers || {} })).digest("hex");
62
+ return `${name}|${digest.slice(0, 16)}`;
63
+ }
64
+ var token = (value) => typeof value === "string" && value.length > 0;
65
+ function claudeCodeEntryState(entry, now) {
66
+ if (!object(entry) || !token(entry.accessToken) && !token(entry.refreshToken))
67
+ return { state: "missing", expiresAt: null };
68
+ const expires = typeof entry.expiresAt === "number" && Number.isFinite(entry.expiresAt) ? entry.expiresAt : void 0;
69
+ const expiresAt = expires === void 0 ? null : new Date(expires).toISOString();
70
+ if (token(entry.accessToken) && (expires === void 0 || expires > now))
71
+ return { state: "authorized", expiresAt };
72
+ return { state: token(entry.refreshToken) ? "renewable" : "missing", expiresAt };
73
+ }
74
+ async function claudeCodeStoredAuthorization(options) {
75
+ const env = options.env ?? process.env;
76
+ const raw = await readFile(join(options.home, ".claude.json"), "utf8").catch(() => void 0);
77
+ const config = raw === void 0 ? void 0 : parse(raw);
78
+ const declaration = object(config?.mcpServers) ? config.mcpServers.mnemonik : void 0;
79
+ if (!config || !object(declaration) || typeof declaration.url !== "string" || typeof declaration.type !== "string" || !["http", "streamable-http", "sse"].includes(declaration.type))
80
+ return void 0;
81
+ if (declaration.headersHelper !== void 0 || object(declaration.headers) && Object.keys(declaration.headers).some((name) => name.toLowerCase() === "authorization"))
82
+ return void 0;
83
+ if (env.CLAUDE_CONFIG_DIR || env.CLAUDE_SECURESTORAGE_CONFIG_DIR !== void 0)
84
+ return unreadable("custom_folder");
85
+ const document = await credentialDocument(
86
+ {
87
+ home: options.home,
88
+ env,
89
+ platform: options.platform ?? process.platform,
90
+ keychain: options.keychain ?? readKeychain
91
+ },
92
+ config
93
+ );
94
+ if ("unreadable" in document) return document.unreadable;
95
+ const entries = object(document.document?.mcpOAuth) ? document.document.mcpOAuth : {};
96
+ const key = claudeCodeCredentialKey("mnemonik", {
97
+ type: declaration.type,
98
+ url: declaration.url,
99
+ headers: declaration.headers
100
+ });
101
+ return claudeCodeEntryState(entries[key], (options.now ?? Date.now)());
102
+ }
103
+ export {
104
+ CLAUDE_CODE_KEYCHAIN_SERVICE,
105
+ claudeCodeCredentialKey,
106
+ claudeCodeEntryState,
107
+ claudeCodeStoredAuthorization
108
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claudeCodeSignIn.js","sourceRoot":"","sources":["../../src/auth/claudeCodeSignIn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAA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O,CAAC,IAAI;QAClB,GAAG;QACH,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ;QAC9C,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,YAAY;KAC3C,EACD,MAAM,CACP,CAAC;IACF,IAAI,YAAY,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC,UAAU,CAAC;IACzD,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IACtF,MAAM,GAAG,GAAG,uBAAuB,CAAC,UAAU,EAAE;QAC9C,IAAI,EAAE,WAAW,CAAC,IAAI;QACtB,GAAG,EAAE,WAAW,CAAC,GAAG;QACpB,OAAO,EAAE,WAAW,CAAC,OAAO;KAC7B,CAAC,CAAC;IACH,OAAO,oBAAoB,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AACzE,CAAC"}
@@ -0,0 +1,47 @@
1
+ import { type StoredAuthorization } from './storedAuthorization.js';
2
+ /**
3
+ * What Codex itself holds for Mnemonik's MCP server on this computer.
4
+ *
5
+ * Until 2026-10-13 Codex's authorization came from the server's record alone,
6
+ * so the false "authorized" seen for Claude Code on 2026-10-12 could happen for
7
+ * Codex too. Read the way Codex 0.162.1 reads it (codex-rs/rmcp-client/src/oauth.rs,
8
+ * resolved_store.rs; codex-rs/config/src/types.rs):
9
+ *
10
+ * - Where: `mcp_oauth_credentials_store` at the top of $CODEX_HOME/config.toml
11
+ * (CODEX_HOME defaults to ~/.codex): `auto` (the default) tries the
12
+ * operating system's keyring first and falls back to the file; `file` uses
13
+ * $CODEX_HOME/.credentials.json only; `keyring` uses the keyring only. The
14
+ * keyring (macOS Keychain, Windows Credential Manager, the Secret Service on
15
+ * Linux) is never read here: that store is said to be unchecked.
16
+ * - The file is a JSON object of entries keyed `mnemonik|` and the first 16
17
+ * hex characters of the SHA-256 of `{"type":"http","url":<url>,"headers":{}}`
18
+ * (codexCredentialKey; headers are always empty in the key, whatever the
19
+ * declaration sends). For a plain server name Codex finds the entry by its
20
+ * `server_name` and `server_url`, in key order, skipping executor-owned ones.
21
+ * - `auto` with an entry in the file: Codex wrote it there because its keyring
22
+ * failed, and it removes the file entry whenever a keyring save succeeds, so
23
+ * the file entry is the one it uses. `auto` with nothing in the file: on macOS
24
+ * and Windows the keyring holds it (unchecked); on Linux it can only be in a
25
+ * Secret Service keyring, so when this user has none, Codex holds nothing.
26
+ * - Usable as Codex judges it (oauth_tokens_are_usable): a client id; then an
27
+ * access token that does not expire within 30 seconds, or else a refresh
28
+ * token together with the issuer it is bound to.
29
+ *
30
+ * Only key names, presence and `expires_at` are looked at.
31
+ */
32
+ export interface CodexStoreOptions {
33
+ home: string;
34
+ platform?: NodeJS.Platform;
35
+ env?: NodeJS.ProcessEnv;
36
+ now?: () => number;
37
+ }
38
+ /** Codex's key for a server's stored authorization (compute_store_key). */
39
+ export declare function codexCredentialKey(name: string, url: string): string;
40
+ /** One file entry, judged as Codex judges it when it connects. */
41
+ export declare function codexEntryState(entry: Record<string, unknown>, now: number): StoredAuthorization;
42
+ /**
43
+ * Codex's stored Mnemonik authorization on this computer, or undefined when
44
+ * Codex has no Mnemonik HTTP declaration that authorizes with OAuth here.
45
+ */
46
+ export declare function codexStoredAuthorization(options: CodexStoreOptions): Promise<StoredAuthorization | undefined>;
47
+ //# sourceMappingURL=codexAuthorization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codexAuthorization.d.ts","sourceRoot":"","sources":["../../src/auth/codexAuthorization.ts"],"names":[],"mappings":"AAIA,OAAO,EAKL,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAKD,2EAA2E;AAC3E,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAKpE;AAED,kEAAkE;AAClE,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,mBAAmB,CAahG;AAgBD;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAyD1C"}