@mysten-incubation/memwal-mcp 0.0.14-dev.1 → 0.0.14-dev.10

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 (50) hide show
  1. package/README.md +238 -1
  2. package/dist/auth-required.d.ts +105 -0
  3. package/dist/auth-required.d.ts.map +1 -1
  4. package/dist/auth-required.js +48 -14
  5. package/dist/auth-required.js.map +1 -1
  6. package/dist/auth.d.ts +179 -18
  7. package/dist/auth.d.ts.map +1 -1
  8. package/dist/auth.js +458 -35
  9. package/dist/auth.js.map +1 -1
  10. package/dist/auto-save.d.ts +100 -0
  11. package/dist/auto-save.d.ts.map +1 -0
  12. package/dist/auto-save.js +290 -0
  13. package/dist/auto-save.js.map +1 -0
  14. package/dist/bridge.d.ts +10 -2
  15. package/dist/bridge.d.ts.map +1 -1
  16. package/dist/bridge.js +155 -25
  17. package/dist/bridge.js.map +1 -1
  18. package/dist/consent.d.ts +36 -0
  19. package/dist/consent.d.ts.map +1 -0
  20. package/dist/consent.js +129 -0
  21. package/dist/consent.js.map +1 -0
  22. package/dist/health-probe.d.ts +35 -0
  23. package/dist/health-probe.d.ts.map +1 -0
  24. package/dist/health-probe.js +87 -0
  25. package/dist/health-probe.js.map +1 -0
  26. package/dist/index.d.ts +11 -2
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +266 -5
  29. package/dist/index.js.map +1 -1
  30. package/dist/instructions.d.ts +17 -21
  31. package/dist/instructions.d.ts.map +1 -1
  32. package/dist/instructions.js +74 -12
  33. package/dist/instructions.js.map +1 -1
  34. package/dist/login.d.ts +15 -1
  35. package/dist/login.d.ts.map +1 -1
  36. package/dist/login.js +109 -9
  37. package/dist/login.js.map +1 -1
  38. package/dist/memory-policy.d.ts +38 -0
  39. package/dist/memory-policy.d.ts.map +1 -0
  40. package/dist/memory-policy.js +80 -0
  41. package/dist/memory-policy.js.map +1 -0
  42. package/dist/messages.d.ts +10 -3
  43. package/dist/messages.d.ts.map +1 -1
  44. package/dist/messages.js +16 -5
  45. package/dist/messages.js.map +1 -1
  46. package/dist/recovery.d.ts +1 -0
  47. package/dist/recovery.d.ts.map +1 -1
  48. package/dist/recovery.js +15 -13
  49. package/dist/recovery.js.map +1 -1
  50. package/package.json +1 -1
@@ -0,0 +1,36 @@
1
+ import type { Readable, Writable } from "node:stream";
2
+ /** The prompt body, everything above the input line. */
3
+ export declare const CONSENT_PROMPT: string;
4
+ /** The input line. Enter alone takes the recommended option. */
5
+ export declare const CONSENT_QUESTION = "Your choice [1/2]: ";
6
+ /** What to say when the answer is neither 1 nor 2. */
7
+ export declare const CONSENT_REPROMPT = "Please answer 1 or 2 (or press Enter for 1).";
8
+ /**
9
+ * Map one line of input to an answer.
10
+ *
11
+ * Empty (a bare Enter) accepts option 1. Anything that is not 1 or 2 returns
12
+ * `null`, which means re-ask — never "assume the recommended one", because a
13
+ * typo is not an answer to a question about permanent storage.
14
+ */
15
+ export declare function interpretConsentAnswer(raw: string): boolean | null;
16
+ /**
17
+ * Ask the question on a terminal and resolve to the answer.
18
+ *
19
+ * Resolves `null` — meaning "no answer given" — if the input stream ends first
20
+ * (Ctrl-D, a closed pipe, a killed terminal). The caller leaves the state unset
21
+ * in that case and asks again next time rather than recording a choice the user
22
+ * never made.
23
+ *
24
+ * Streams are injected so this is testable without a pty; `main()` passes the
25
+ * real stdin and stderr. Output goes to stderr because stdout belongs to the
26
+ * MCP protocol on every other path in this package.
27
+ */
28
+ export declare function askAutoSaveConsent(opts: {
29
+ input: Readable;
30
+ output: Writable;
31
+ /** Guard against an accidental headless call. Defaults to requiring a TTY. */
32
+ isTTY?: boolean;
33
+ }): Promise<boolean | null>;
34
+ /** What is printed once the answer is in. */
35
+ export declare function consentOutcomeNotice(enabled: boolean, path: string): string;
36
+ //# sourceMappingURL=consent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consent.d.ts","sourceRoot":"","sources":["../src/consent.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEtD,wDAAwD;AACxD,eAAO,MAAM,cAAc,QAyBf,CAAC;AAEb,gEAAgE;AAChE,eAAO,MAAM,gBAAgB,wBAAwB,CAAC;AAEtD,sDAAsD;AACtD,eAAO,MAAM,gBAAgB,iDACqB,CAAC;AAEnD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAMlE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE;IAC3C,KAAK,EAAE,QAAQ,CAAC;IAChB,MAAM,EAAE,QAAQ,CAAC;IACjB,8EAA8E;IAC9E,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CA4B1B;AAED,6CAA6C;AAC7C,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAO3E"}
@@ -0,0 +1,129 @@
1
+ /**
2
+ * The automatic-memory consent question (WALM-642).
3
+ *
4
+ * Asked at interactive login and NOWHERE else. Deliberately not an MCP tool,
5
+ * not a tool description, not an instruction, and not anything a model can
6
+ * reach: a model answering on the user's behalf is not consent, and an
7
+ * agent-shaped surface for this question would be exactly that. The only caller
8
+ * is `main()` in index.ts, behind `process.stdin.isTTY`.
9
+ *
10
+ * Login is the gate because MemWal is unusable without it, so every real user
11
+ * passes through it once, and it is already a moment that requires a terminal.
12
+ *
13
+ * On the wording — it is the substance of this change, not decoration:
14
+ *
15
+ * - It names the consequence ("writes it to your memory without asking each
16
+ * time"), not the feature. Someone should be able to picture what happens
17
+ * to them, in their own session, from reading it.
18
+ * - Permanence leads, because it is the fact that changes the answer. Walrus
19
+ * is immutable: you can stop saving new memories but you cannot take back
20
+ * one already saved. Burying that under "we value your privacy" would make
21
+ * this a cookie banner, which it is not.
22
+ * - The redaction claim is deliberately hedged. `redaction.ts` documents real
23
+ * residual gaps — an unlabelled hex secret, a bare BIP-39 word run — so
24
+ * "safety net, not a guarantee" is the accurate claim and must stay. Saying
25
+ * more would be selling a promise the code does not make.
26
+ * - Declining is free and is stated as a normal choice, not a warning. A "no"
27
+ * is recorded once and never asked again.
28
+ */
29
+ import { createInterface } from "node:readline";
30
+ /** The prompt body, everything above the input line. */
31
+ export const CONSENT_PROMPT = [
32
+ "",
33
+ "MemWal can save things about you automatically.",
34
+ "",
35
+ "What that means: when you state a preference, a decision, or a setting in",
36
+ 'chat — "I prefer pnpm", "we deploy from dev", "the relayer is at X" —',
37
+ "MemWal writes it to your memory without asking each time, so it is there",
38
+ "in your next session and in every other client you use.",
39
+ "",
40
+ "Before you choose:",
41
+ "",
42
+ " - Saved memories are permanent. They go to Walrus, which is immutable",
43
+ " storage. You can stop saving new ones at any time, but you cannot",
44
+ " delete one that is already saved.",
45
+ " - They are encrypted to your account. Only your delegate key reads them.",
46
+ " - MemWal strips obvious credentials — API keys, tokens, passwords,",
47
+ " private keys — before saving. Treat that as a safety net, not a",
48
+ " guarantee: do not paste secrets into a session with this on.",
49
+ "",
50
+ " [1] Save automatically recommended, this is what MemWal is for",
51
+ ' [2] Only save when I ask nothing is saved unless you say "remember this"',
52
+ "",
53
+ "Change this any time with `memwal-mcp auto-save on|off`.",
54
+ "See what is stored with `memwal_recall`.",
55
+ "",
56
+ ].join("\n");
57
+ /** The input line. Enter alone takes the recommended option. */
58
+ export const CONSENT_QUESTION = "Your choice [1/2]: ";
59
+ /** What to say when the answer is neither 1 nor 2. */
60
+ export const CONSENT_REPROMPT = "Please answer 1 or 2 (or press Enter for 1).";
61
+ /**
62
+ * Map one line of input to an answer.
63
+ *
64
+ * Empty (a bare Enter) accepts option 1. Anything that is not 1 or 2 returns
65
+ * `null`, which means re-ask — never "assume the recommended one", because a
66
+ * typo is not an answer to a question about permanent storage.
67
+ */
68
+ export function interpretConsentAnswer(raw) {
69
+ const v = raw.trim().toLowerCase();
70
+ if (v === "")
71
+ return true;
72
+ if (v === "1")
73
+ return true;
74
+ if (v === "2")
75
+ return false;
76
+ return null;
77
+ }
78
+ /**
79
+ * Ask the question on a terminal and resolve to the answer.
80
+ *
81
+ * Resolves `null` — meaning "no answer given" — if the input stream ends first
82
+ * (Ctrl-D, a closed pipe, a killed terminal). The caller leaves the state unset
83
+ * in that case and asks again next time rather than recording a choice the user
84
+ * never made.
85
+ *
86
+ * Streams are injected so this is testable without a pty; `main()` passes the
87
+ * real stdin and stderr. Output goes to stderr because stdout belongs to the
88
+ * MCP protocol on every other path in this package.
89
+ */
90
+ export async function askAutoSaveConsent(opts) {
91
+ // A prompt with nobody in front of it is a hang, not a question. The
92
+ // caller already checks this; the second check is here because the cost of
93
+ // getting it wrong is an MCP server that never finishes starting.
94
+ if (opts.isTTY === false)
95
+ return null;
96
+ opts.output.write(`${CONSENT_PROMPT}\n`);
97
+ const rl = createInterface({ input: opts.input, terminal: false });
98
+ try {
99
+ opts.output.write(CONSENT_QUESTION);
100
+ // The interface's async iterator, rather than a promise per `line`
101
+ // event: attaching a fresh listener after each answer drops any line
102
+ // that arrived while nothing was listening, which deadlocks the re-ask
103
+ // path the moment input is buffered rather than typed.
104
+ for await (const line of rl) {
105
+ const answer = interpretConsentAnswer(line);
106
+ if (answer !== null)
107
+ return answer;
108
+ opts.output.write(`${CONSENT_REPROMPT}\n`);
109
+ opts.output.write(CONSENT_QUESTION);
110
+ }
111
+ // Exhausted without an answer: Ctrl-D, a closed pipe, a killed
112
+ // terminal. Not a choice, and not recorded as one.
113
+ opts.output.write("\n");
114
+ return null;
115
+ }
116
+ finally {
117
+ rl.close();
118
+ }
119
+ }
120
+ /** What is printed once the answer is in. */
121
+ export function consentOutcomeNotice(enabled, path) {
122
+ return enabled
123
+ ? "Automatic memory is ON. MemWal will save durable facts as you state them. " +
124
+ `Turn it off any time with \`memwal-mcp auto-save off\`. (${path})`
125
+ : "Automatic memory is OFF. Nothing is saved unless you ask for it — " +
126
+ '"remember this" still works, and so does recall. ' +
127
+ `Turn it on any time with \`memwal-mcp auto-save on\`. (${path})`;
128
+ }
129
+ //# sourceMappingURL=consent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consent.js","sourceRoot":"","sources":["../src/consent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGhD,wDAAwD;AACxD,MAAM,CAAC,MAAM,cAAc,GAAG;IAC1B,EAAE;IACF,iDAAiD;IACjD,EAAE;IACF,2EAA2E;IAC3E,uEAAuE;IACvE,0EAA0E;IAC1E,yDAAyD;IACzD,EAAE;IACF,oBAAoB;IACpB,EAAE;IACF,yEAAyE;IACzE,uEAAuE;IACvE,uCAAuC;IACvC,4EAA4E;IAC5E,sEAAsE;IACtE,qEAAqE;IACrE,kEAAkE;IAClE,EAAE;IACF,uEAAuE;IACvE,+EAA+E;IAC/E,EAAE;IACF,0DAA0D;IAC1D,0CAA0C;IAC1C,EAAE;CACL,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,gEAAgE;AAChE,MAAM,CAAC,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AAEtD,sDAAsD;AACtD,MAAM,CAAC,MAAM,gBAAgB,GACzB,8CAA8C,CAAC;AAEnD;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAAC,GAAW;IAC9C,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACnC,IAAI,CAAC,KAAK,EAAE;QAAE,OAAO,IAAI,CAAC;IAC1B,IAAI,CAAC,KAAK,GAAG;QAAE,OAAO,IAAI,CAAC;IAC3B,IAAI,CAAC,KAAK,GAAG;QAAE,OAAO,KAAK,CAAC;IAC5B,OAAO,IAAI,CAAC;AAChB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,U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**
2
+ * Ask the relayer's public `/health` why a call went unanswered: down,
3
+ * unreachable from this machine, configured wrong, or up with one call stuck.
4
+ * Each wants a different next step, so the bridge probes before it answers.
5
+ */
6
+ export type HealthProbe = {
7
+ kind: "ok";
8
+ ms: number;
9
+ version?: string;
10
+ writesUnavailable?: boolean;
11
+ } | {
12
+ kind: "http";
13
+ ms: number;
14
+ status: number;
15
+ } | {
16
+ kind: "unreachable";
17
+ ms: number;
18
+ code: string;
19
+ } | {
20
+ kind: "timeout";
21
+ ms: number;
22
+ };
23
+ /** Override via `MEMWAL_MCP_HEALTH_PROBE_MS`, mostly for tests. */
24
+ export declare function resolveHealthProbeMs(): number;
25
+ /** `GET {baseUrl}/health`, bounded by `timeoutMs`. Never rejects: a probe
26
+ * that fails is itself the answer. */
27
+ export declare function probeRelayerHealth(baseUrl: string, timeoutMs: number): Promise<HealthProbe>;
28
+ /** `health` is the value for a `Relayer health:` line; `verdict` says what
29
+ * it means for the call; `reachable` is whether a plain retry can help. */
30
+ export declare function describeHealthProbe(probe: HealthProbe, relayerUrl: string): {
31
+ health: string;
32
+ verdict: string;
33
+ reachable: boolean;
34
+ };
35
+ //# sourceMappingURL=health-probe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health-probe.d.ts","sourceRoot":"","sources":["../src/health-probe.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,WAAW,GACjB;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAAE,GACzE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC5C;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACjD;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAQtC,mEAAmE;AACnE,wBAAgB,oBAAoB,IAAI,MAAM,CAM7C;AAED;sCACsC;AACtC,wBAAsB,kBAAkB,CACpC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAClB,OAAO,CAAC,WAAW,CAAC,CA6BtB;AAKD;2EAC2E;AAC3E,wBAAgB,mBAAmB,CAC/B,KAAK,EAAE,WAAW,EAClB,UAAU,EAAE,MAAM,GACnB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAiCzD"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Ask the relayer's public `/health` why a call went unanswered: down,
3
+ * unreachable from this machine, configured wrong, or up with one call stuck.
4
+ * Each wants a different next step, so the bridge probes before it answers.
5
+ */
6
+ const DEFAULT_HEALTH_PROBE_MS = 3_000;
7
+ const MIN_HEALTH_PROBE_MS = 100;
8
+ /** A diagnosis nobody waits a minute for. Also keeps the value inside what
9
+ * `AbortSignal.timeout` accepts. */
10
+ const MAX_HEALTH_PROBE_MS = 60_000;
11
+ /** Override via `MEMWAL_MCP_HEALTH_PROBE_MS`, mostly for tests. */
12
+ export function resolveHealthProbeMs() {
13
+ const raw = process.env.MEMWAL_MCP_HEALTH_PROBE_MS;
14
+ if (!raw)
15
+ return DEFAULT_HEALTH_PROBE_MS;
16
+ const n = Math.floor(Number(raw));
17
+ if (!Number.isFinite(n) || n < MIN_HEALTH_PROBE_MS)
18
+ return DEFAULT_HEALTH_PROBE_MS;
19
+ return Math.min(n, MAX_HEALTH_PROBE_MS);
20
+ }
21
+ /** `GET {baseUrl}/health`, bounded by `timeoutMs`. Never rejects: a probe
22
+ * that fails is itself the answer. */
23
+ export async function probeRelayerHealth(baseUrl, timeoutMs) {
24
+ const started = Date.now();
25
+ let signal;
26
+ try {
27
+ // Inside the `try`: `AbortSignal.timeout` throws on a value it
28
+ // cannot take, and this function must not reject.
29
+ signal = AbortSignal.timeout(timeoutMs);
30
+ const res = await fetch(`${baseUrl.replace(/\/+$/, "")}/health`, { signal });
31
+ const ms = Date.now() - started;
32
+ if (!res.ok) {
33
+ await res.body?.cancel();
34
+ return { kind: "http", ms, status: res.status };
35
+ }
36
+ const body = (await res.json().catch(() => null));
37
+ const version = typeof body?.version === "string" ? body.version : undefined;
38
+ // `/health` answers 200 while writes are paused or Postgres is
39
+ // full; "ok" alone would hide the cause of a failed write.
40
+ const writesUnavailable = body?.write_ready === false || body?.writes === "paused";
41
+ return { kind: "ok", ms, version, ...(writesUnavailable ? { writesUnavailable } : {}) };
42
+ }
43
+ catch (err) {
44
+ const ms = Date.now() - started;
45
+ if (signal?.aborted)
46
+ return { kind: "timeout", ms };
47
+ const code = err?.cause?.code;
48
+ return { kind: "unreachable", ms, code: typeof code === "string" ? code : "unknown" };
49
+ }
50
+ }
51
+ /** DNS could not find the host: the one cause a user fixes on their side. */
52
+ const UNRESOLVED_CODES = new Set(["ENOTFOUND", "EAI_AGAIN"]);
53
+ /** `health` is the value for a `Relayer health:` line; `verdict` says what
54
+ * it means for the call; `reachable` is whether a plain retry can help. */
55
+ export function describeHealthProbe(probe, relayerUrl) {
56
+ switch (probe.kind) {
57
+ case "ok":
58
+ return {
59
+ health: `ok (${probe.ms}ms${probe.version ? `, v${probe.version}` : ""}` +
60
+ `${probe.writesUnavailable ? ", writes unavailable" : ""})`,
61
+ verdict: "The relayer is up, so this call stalled inside it or its reply was lost on the way back.",
62
+ reachable: true,
63
+ };
64
+ case "http":
65
+ return {
66
+ health: `HTTP ${probe.status} (${probe.ms}ms)`,
67
+ verdict: "The relayer answered but is not healthy.",
68
+ reachable: false,
69
+ };
70
+ case "timeout":
71
+ return {
72
+ health: `no answer within ${(probe.ms / 1000).toFixed(1)}s`,
73
+ verdict: `The relayer at ${relayerUrl} is down, overloaded, or not reachable from this machine.`,
74
+ reachable: false,
75
+ };
76
+ case "unreachable":
77
+ return {
78
+ health: `unreachable (${probe.code})`,
79
+ verdict: UNRESOLVED_CODES.has(probe.code)
80
+ ? `The relayer host in ${relayerUrl} could not be resolved. Check the relayer URL ` +
81
+ "(MEMWAL_SERVER_URL or --relayer) and this machine's network."
82
+ : `The relayer at ${relayerUrl} is down or not reachable from this machine.`,
83
+ reachable: false,
84
+ };
85
+ }
86
+ }
87
+ //# sourceMappingURL=health-probe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health-probe.js","sourceRoot":"","sources":["../src/health-probe.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,MAAM,uBAAuB,GAAG,KAAK,CAAC;AACtC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAChC;oCACoC;AACpC,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAEnC,mEAAmE;AACnE,MAAM,UAAU,oBAAoB;IAChC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC;IACnD,IAAI,CAAC,GAAG;QAAE,OAAO,uBAAuB,CAAC;IACzC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAClC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,mBAAmB;QAAE,OAAO,uBAAuB,CAAC;IACnF,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC;AAC5C,CAAC;AAED;sCACsC;AACtC,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACpC,OAAe,EACf,SAAiB;IAEjB,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC3B,IAAI,MAA+B,CAAC;IACpC,IAAI,CAAC;QACD,+DAA+D;QAC/D,kDAAkD;QAClD,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACxC,MAAM,G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AAC,CAAC,uBAAuB,UAAU,gDAAgD;wBACjF,8DAA8D;oBAChE,CAAC,CAAC,kBAAkB,UAAU,8CAA8C;gBAChF,SAAS,EAAE,KAAK;aACnB,CAAC;IACV,CAAC;AACL,CAAC"}
package/dist/index.d.ts CHANGED
@@ -7,10 +7,17 @@ interface ParsedArgs {
7
7
  help: boolean;
8
8
  logout: boolean;
9
9
  forceLogin: boolean;
10
+ /** Approve the project-local credentials found from the working directory
11
+ * (WALM-639). A repo file is inert until this has been run for it. */
12
+ approveProject: boolean;
13
+ /** Withdraw that approval again. */
14
+ revokeProject: boolean;
10
15
  relayerUrl?: string;
11
16
  webUrl?: string;
12
17
  label?: string;
13
18
  namespace?: string;
19
+ /** `auto-save on|off|status` — the automatic-memory opt-in (WALM-642). */
20
+ autoSave?: "on" | "off" | "status";
14
21
  /** Args parseArgs did not recognise, in the order seen. For a flag
15
22
  * written `--key=value`, only `--key` is recorded — see parseArgs. */
16
23
  unknown: string[];
@@ -20,8 +27,10 @@ export declare function main(argv?: string[]): Promise<void>;
20
27
  /** The `--help` body. Exported so tests can assert it stays in step with the
21
28
  * flags parseArgs actually accepts. */
22
29
  export declare function helpText(): string;
23
- export { loadCreds, saveCreds, clearCreds, credsPath } from "./auth.js";
30
+ export { loadCreds, saveCreds, clearCreds, credsPath, resolveCreds, approveProjectCreds, revokeProjectCredsApproval, formatProjectCredsNotice, formatProjectCredsStorageWarning, } from "./auth.js";
31
+ export { isAutoSaveEnabled, isConsentPending, autoSaveStatus, setAutoSave, markConsentPending, publishHookState, settingsPath, hookStatePath, } from "./auto-save.js";
32
+ export { askAutoSaveConsent, interpretConsentAnswer, CONSENT_PROMPT } from "./consent.js";
24
33
  export { loginFlow } from "./login.js";
25
34
  export { runBridge } from "./bridge.js";
26
- export type { MemWalCredentials } from "./auth.js";
35
+ export type { MemWalCredentials, CredsResolution, ProjectCredsDecision } from "./auth.js";
27
36
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAkBA;;;;GAIG;AACH,UAAU,UAAU;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;2EACuE;IACvE,OAAO,EAAE,MAAM,EAAE,CAAC;CACrB;AAeD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAiFpD;AAED,wBAAsB,IAAI,CAAC,IAAI,GAAE,MAAM,EAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CA6MhF;AAMD;wCACwC;AACxC,wBAAgB,QAAQ,IAAI,MAAM,CA4FjC;AAGD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAsCA;;;;GAIG;AACH,UAAU,UAAU;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB;0EACsE;IACtE,cAAc,EAAE,OAAO,CAAC;IACxB,oCAAoC;IACpC,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,M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