@mysten-incubation/memwal-mcp 0.0.14-dev.4 → 0.0.14-rc.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.
- package/README.md +104 -1
- package/dist/auth-required.d.ts.map +1 -1
- package/dist/auth-required.js +19 -4
- package/dist/auth-required.js.map +1 -1
- package/dist/auto-save.d.ts +100 -0
- package/dist/auto-save.d.ts.map +1 -0
- package/dist/auto-save.js +290 -0
- package/dist/auto-save.js.map +1 -0
- package/dist/bridge.d.ts.map +1 -1
- package/dist/bridge.js +6 -2
- package/dist/bridge.js.map +1 -1
- package/dist/consent.d.ts +36 -0
- package/dist/consent.d.ts.map +1 -0
- package/dist/consent.js +129 -0
- package/dist/consent.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +123 -1
- package/dist/index.js.map +1 -1
- package/dist/instructions.d.ts +17 -21
- package/dist/instructions.d.ts.map +1 -1
- package/dist/instructions.js +74 -12
- package/dist/instructions.js.map +1 -1
- package/dist/memory-policy.d.ts +38 -0
- package/dist/memory-policy.d.ts.map +1 -0
- package/dist/memory-policy.js +80 -0
- package/dist/memory-policy.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -118,6 +118,7 @@ The command opens your browser, asks you to connect your Sui wallet, and saves c
|
|
|
118
118
|
```sh
|
|
119
119
|
memwal-mcp
|
|
120
120
|
memwal-mcp login
|
|
121
|
+
memwal-mcp auto-save on|off
|
|
121
122
|
memwal-mcp --logout
|
|
122
123
|
memwal-mcp --help
|
|
123
124
|
```
|
|
@@ -132,11 +133,111 @@ Use CLI flags or environment variables to override the default Walrus Memory end
|
|
|
132
133
|
| `--web-url <url>` | `MEMWAL_WEB_URL` | Override the web app URL used during login. |
|
|
133
134
|
| `--label <text>` | `MEMWAL_CLIENT_LABEL` | Friendly delegate-key label shown in Walrus Memory. |
|
|
134
135
|
| `--namespace <name>` (alias `--ns`) | `MEMWAL_NAMESPACE` | Default memory namespace applied when the agent omits one. |
|
|
136
|
+
| `auto-save on\|off` | `MEMWAL_AUTO_SAVE` | Whether the agent saves durable facts unprompted. On once you agree at login; see [Automatic Memory](#automatic-memory). |
|
|
135
137
|
|
|
136
138
|
Enable verbose stderr logging with `MEMWAL_MCP_DEBUG=1`.
|
|
137
139
|
|
|
138
140
|
Set `MEMWAL_MCP_TRANSPORT=http` to dial the relayer's Streamable HTTP endpoint instead of the default SSE pair. Opt-in: reconnect replay is not transport-aware yet, so a write interrupted mid-send may be retried and duplicated.
|
|
139
141
|
|
|
142
|
+
## Automatic Memory
|
|
143
|
+
|
|
144
|
+
MemWal saves durable facts — preferences, decisions, constraints, recurring
|
|
145
|
+
workflows — as you state them, without asking each time. That is what it is for,
|
|
146
|
+
so it is on. It asks you once first.
|
|
147
|
+
|
|
148
|
+
The question comes up in your terminal the first time you run `login`:
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
MemWal can save things about you automatically.
|
|
152
|
+
|
|
153
|
+
What that means: when you state a preference, a decision, or a setting in
|
|
154
|
+
chat — "I prefer pnpm", "we deploy from dev", "the relayer is at X" —
|
|
155
|
+
MemWal writes it to your memory without asking each time, so it is there
|
|
156
|
+
in your next session and in every other client you use.
|
|
157
|
+
|
|
158
|
+
Before you choose:
|
|
159
|
+
|
|
160
|
+
- Saved memories are permanent. They go to Walrus, which is immutable
|
|
161
|
+
storage. You can stop saving new ones at any time, but you cannot
|
|
162
|
+
delete one that is already saved.
|
|
163
|
+
- They are encrypted to your account. Only your delegate key reads them.
|
|
164
|
+
- MemWal strips obvious credentials — API keys, tokens, passwords,
|
|
165
|
+
private keys — before saving. Treat that as a safety net, not a
|
|
166
|
+
guarantee: do not paste secrets into a session with this on.
|
|
167
|
+
|
|
168
|
+
[1] Save automatically recommended, this is what MemWal is for
|
|
169
|
+
[2] Only save when I ask nothing is saved unless you say "remember this"
|
|
170
|
+
|
|
171
|
+
Your choice [1/2]:
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**Saved memories are permanent.** Walrus is immutable storage: you can stop
|
|
175
|
+
saving new ones at any time, but you cannot delete one already saved — which is
|
|
176
|
+
why you are asked before it starts rather than after.
|
|
177
|
+
|
|
178
|
+
Until you answer, nothing is saved unprompted on a new install; "remember this"
|
|
179
|
+
and recall work throughout. If you were using MemWal before this question
|
|
180
|
+
existed, it keeps saving as it always has and asks you at your next login.
|
|
181
|
+
|
|
182
|
+
The question is only ever asked in a terminal. It is never an MCP tool and never
|
|
183
|
+
something the assistant can answer for you. Change it any time:
|
|
184
|
+
|
|
185
|
+
```sh
|
|
186
|
+
npx -y @mysten-incubation/memwal-mcp auto-save on
|
|
187
|
+
npx -y @mysten-incubation/memwal-mcp auto-save off
|
|
188
|
+
npx -y @mysten-incubation/memwal-mcp auto-save # report the current setting
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
The answer is stored as `{"autoSave": true}` in `settings.json` next to your
|
|
192
|
+
credentials file, so it follows the same project-local-beats-global resolution.
|
|
193
|
+
To pin one MCP client instead, set the environment variable — it overrides the
|
|
194
|
+
file and skips the question:
|
|
195
|
+
|
|
196
|
+
```json
|
|
197
|
+
{
|
|
198
|
+
"mcpServers": {
|
|
199
|
+
"memwal": {
|
|
200
|
+
"command": "npx",
|
|
201
|
+
"args": ["-y", "@mysten-incubation/memwal-mcp"],
|
|
202
|
+
"env": { "MEMWAL_AUTO_SAVE": "1" }
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Recall is never gated, and neither is an explicit "remember this" — the setting
|
|
209
|
+
only decides whether the agent saves things you did not ask it to save. Saying
|
|
210
|
+
no costs nothing and is not asked about again.
|
|
211
|
+
|
|
212
|
+
### What is never saved
|
|
213
|
+
|
|
214
|
+
Walrus storage is append-only and encrypted: a memory that lands **cannot be
|
|
215
|
+
edited or deleted**. So credentials are excluded whichever way you answer, by the same
|
|
216
|
+
rules stated in the server instructions, the tool descriptions and the plugin
|
|
217
|
+
hooks — and enforced by a check that runs before any text is sent:
|
|
218
|
+
|
|
219
|
+
- passwords, API keys, access and refresh tokens, private keys, seed and
|
|
220
|
+
recovery phrases, authorization headers, session cookies, and connection
|
|
221
|
+
strings or URLs with an embedded `user:password`;
|
|
222
|
+
- anything you say not to save ("don't save this", "off the record");
|
|
223
|
+
- pasted third-party content — a fenced block, a quoted passage — which is not
|
|
224
|
+
a fact about you.
|
|
225
|
+
|
|
226
|
+
When a message mixes a preference with a credential, the **preference is kept**
|
|
227
|
+
and only the credential is removed: "I prefer dark mode, db is
|
|
228
|
+
`postgres://admin:hunter2@db.internal/app`" is stored with the password gone and
|
|
229
|
+
the host intact. The agent is told which kinds were removed; the secret itself
|
|
230
|
+
is never stored, logged, or echoed back.
|
|
231
|
+
|
|
232
|
+
Detection targets specific credential shapes rather than "looks random", so
|
|
233
|
+
identifiers you *do* want remembered — blob ids, Sui object ids, commit SHAs,
|
|
234
|
+
digests — pass through untouched. Where a secret is indistinguishable from an
|
|
235
|
+
identifier, the **label** decides: pasting your `credentials.json` has its
|
|
236
|
+
`delegatePrivateKey` removed, while the same 64 hex characters with nothing
|
|
237
|
+
calling them a key are stored as the digest they look like. The trade-off is
|
|
238
|
+
that a secret in no recognisable shape, and with no label near it, can still
|
|
239
|
+
slip past the check — which is why the model-facing rules exist alongside it.
|
|
240
|
+
|
|
140
241
|
## Default Namespace
|
|
141
242
|
|
|
142
243
|
By default the MCP tool schemas expose an optional `namespace` argument and the
|
|
@@ -228,7 +329,9 @@ You can also pass explicit URLs:
|
|
|
228
329
|
|
|
229
330
|
## Credential Storage
|
|
230
331
|
|
|
231
|
-
Credentials are stored locally in `~/.memwal/credentials.json
|
|
332
|
+
Credentials are stored locally in `~/.memwal/credentials.json`, and the
|
|
333
|
+
automatic-memory setting in `settings.json` beside it. To remove the
|
|
334
|
+
credentials:
|
|
232
335
|
|
|
233
336
|
```sh
|
|
234
337
|
npx -y @mysten-incubation/memwal-mcp --logout
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-required.d.ts","sourceRoot":"","sources":["../src/auth-required.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAwB,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"auth-required.d.ts","sourceRoot":"","sources":["../src/auth-required.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAwB,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAoMzE;;;;;;;;;;;;;;0EAc0E;AAC1E,eAAO,MAAM,sBAAsB,EAAE,WAAW,CAAC,MAAM,CAOrD,CAAC;AAMH;;0EAE0E;AAC1E,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAA6B,CAAC;AAS/D;;4CAE4C;AAC5C,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAuB,CAAC;AAErD;;8BAE8B;AAC9B,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAwB,CAAC;AA2CjE;;;mCAGmC;AACnC,MAAM,WAAW,kBAAkB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd;;;;4DAIwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAmID;;yCAEyC;AACzC,MAAM,WAAW,WAAW;IACxB,KAAK,EAAE,iBAAiB,CAAC;IACzB;;sCAEkC;IAClC,YAAY,EAAE,MAAM,EAAE,CAAC;CAC1B;AAwID;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,qBAAqB,CACvC,MAAM,EAAE,kBAAkB,GAC3B,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAgE7B"}
|
package/dist/auth-required.js
CHANGED
|
@@ -27,9 +27,22 @@ import { loginFailureNotice, loginPrompt, loginSuccessNotification } from "./mes
|
|
|
27
27
|
import { log } from "./logger.js";
|
|
28
28
|
import { startOrReuseLoginFlow, resolveLoginTimeoutMs } from "./login.js";
|
|
29
29
|
import { AUTH_REQUIRED_INSTRUCTIONS } from "./instructions.js";
|
|
30
|
+
import { SECRET_EXCLUSION_RULES, SECRET_EXCLUSION_SUMMARY, AUTO_SAVE_OPT_IN_RULE, } from "./memory-policy.js";
|
|
30
31
|
import { MEMWAL_MCP_VERSION } from "./version.js";
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
/**
|
|
33
|
+
* WALM-642: every write-tool description below ends with the shared policy
|
|
34
|
+
* block, the same text the `instructions` field and the plugin hooks carry, so
|
|
35
|
+
* an agent that only ever sees one of the three still gets the same rules.
|
|
36
|
+
* The signed-out variants get the one-line summary — they exist to keep a
|
|
37
|
+
* credential-less model from spamming writes, and the full block would be the
|
|
38
|
+
* longest thing in a list of tools that cannot run yet.
|
|
39
|
+
*/
|
|
40
|
+
const SIGNED_OUT_REMEMBER = "Save a fact to the user's Walrus Memory personal memory. Call ONLY when the user explicitly asks to remember/save something. Pass the full, detailed text — never summarize. " +
|
|
41
|
+
SECRET_EXCLUSION_SUMMARY;
|
|
42
|
+
const SIGNED_IN_REMEMBER = "Save a durable fact about the user or project to their Walrus Memory. Call this PROACTIVELY whenever the user states a preference, decision, constraint, correction, identity detail, or recurring workflow — even if they did not say 'remember this' — provided they have turned automatic memory on. Skip one-off tasks, the current file or bug, and small talk. Pass the full statement; do not summarize. To save several facts at once, use memwal_remember_bulk instead. By default this returns in ~1s once the relayer has accepted the job (job_id) — the Walrus write is still in flight and the fact is NOT stored yet. Do not claim it is saved. Settle it with the job-status tool this server advertises (re-list tools if you do not see one). A blob_id in the same reply means it already stored (optional wait budget). " +
|
|
43
|
+
AUTO_SAVE_OPT_IN_RULE +
|
|
44
|
+
" " +
|
|
45
|
+
SECRET_EXCLUSION_RULES;
|
|
33
46
|
const SIGNED_OUT_RECALL = "Search the user's Walrus Memory for facts relevant to a query. Returns matching memories ranked by relevance.";
|
|
34
47
|
const SIGNED_IN_RECALL = "Search the user's Walrus Memory for relevant facts before responding. Call this PROACTIVELY at the start of a task, or whenever the user references past work, prior decisions, their preferences, or anything you may have stored earlier — don't wait to be asked. A single focused query is usually enough — recall is a real retrieval over encrypted storage, so do NOT fire multiple redundant searches for the same question. Returns matching memories ranked by relevance.";
|
|
35
48
|
/** Build the static memory-tool list. `proactive` is true for the signed-in
|
|
@@ -56,7 +69,8 @@ function buildToolDefinitions(proactive) {
|
|
|
56
69
|
name: "memwal_remember_bulk",
|
|
57
70
|
title: "Remember Multiple Facts",
|
|
58
71
|
annotations: { readOnlyHint: false, destructiveHint: false },
|
|
59
|
-
description: "Save multiple durable facts in one call. Use when you learned several distinct facts at once (onboarding details, a list of preferences, decisions from a discussion). Pass an array of complete fact statements (max 20) — do not summarize. Prefer this over repeated memwal_remember calls. By default this returns in ~1s once the relayer has accepted the batch (job_ids) — the Walrus writes are still in flight and the facts are NOT stored yet. Do not claim they are saved. Settle them with the job-status tool this server advertises (re-list tools if you do not see one). A blob_id in the same reply means that fact already stored (optional wait budget)."
|
|
72
|
+
description: "Save multiple durable facts in one call. Use when you learned several distinct facts at once (onboarding details, a list of preferences, decisions from a discussion). Pass an array of complete fact statements (max 20) — do not summarize. Prefer this over repeated memwal_remember calls. By default this returns in ~1s once the relayer has accepted the batch (job_ids) — the Walrus writes are still in flight and the facts are NOT stored yet. Do not claim they are saved. Settle them with the job-status tool this server advertises (re-list tools if you do not see one). A blob_id in the same reply means that fact already stored (optional wait budget). " +
|
|
73
|
+
(proactive ? AUTO_SAVE_OPT_IN_RULE + " " + SECRET_EXCLUSION_RULES : SECRET_EXCLUSION_SUMMARY),
|
|
60
74
|
inputSchema: {
|
|
61
75
|
type: "object",
|
|
62
76
|
properties: {
|
|
@@ -125,7 +139,8 @@ function buildToolDefinitions(proactive) {
|
|
|
125
139
|
name: "memwal_analyze",
|
|
126
140
|
title: "Analyze and Remember",
|
|
127
141
|
annotations: { readOnlyHint: false, destructiveHint: true },
|
|
128
|
-
description: "Extract memorable facts from a longer passage of text (preferences, habits, biographical info, constraints) and save each as a separate Walrus Memory memory. Use this when you want MemWal's LLM to split the facts out of a transcript or notes for you; if you already know the exact facts, use memwal_remember or memwal_remember_bulk instead."
|
|
142
|
+
description: "Extract memorable facts from a longer passage of text (preferences, habits, biographical info, constraints) and save each as a separate Walrus Memory memory. Use this when you want MemWal's LLM to split the facts out of a transcript or notes for you; if you already know the exact facts, use memwal_remember or memwal_remember_bulk instead. " +
|
|
143
|
+
(proactive ? AUTO_SAVE_OPT_IN_RULE + " " + SECRET_EXCLUSION_RULES : SECRET_EXCLUSION_SUMMARY),
|
|
129
144
|
inputSchema: {
|
|
130
145
|
type: "object",
|
|
131
146
|
properties: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-required.js","sourceRoot":"","sources":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off for one MCP server process. */
|
|
2
|
+
export declare const AUTO_SAVE_ENV = "MEMWAL_AUTO_SAVE";
|
|
3
|
+
/** Where the answer is stored. Outside every repository, on purpose. */
|
|
4
|
+
export declare function settingsPath(): string;
|
|
5
|
+
/** Where the resolved state is published for the plugin hooks to read. */
|
|
6
|
+
export declare function hookStatePath(): string;
|
|
7
|
+
/**
|
|
8
|
+
* Parse a human-written boolean. Returns null for "not set" and for anything
|
|
9
|
+
* unparseable — an unreadable value must not be read as an answer.
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseBooleanSetting(raw: string | undefined | null): boolean | null;
|
|
12
|
+
/** `on`/`off` are answers; `unset` means nobody has been asked yet. */
|
|
13
|
+
export type AutoSaveState = "on" | "off" | "unset";
|
|
14
|
+
export type AutoSaveSource =
|
|
15
|
+
/** `MEMWAL_AUTO_SAVE` in this process's environment. */
|
|
16
|
+
"env"
|
|
17
|
+
/** An answer written to settings.json. */
|
|
18
|
+
| "settings"
|
|
19
|
+
/** Unset, on an install that predates the consent prompt — keeps saving. */
|
|
20
|
+
| "legacy"
|
|
21
|
+
/** Unset, on an install created after it — saves nothing until answered. */
|
|
22
|
+
| "unanswered";
|
|
23
|
+
export interface AutoSaveStatus {
|
|
24
|
+
/** Whether this process may save without being asked. */
|
|
25
|
+
enabled: boolean;
|
|
26
|
+
/** The stored answer, or `unset`. */
|
|
27
|
+
state: AutoSaveState;
|
|
28
|
+
source: AutoSaveSource;
|
|
29
|
+
/** True while the question is still owed a human answer. */
|
|
30
|
+
pendingConsent: boolean;
|
|
31
|
+
/** Where an answer lives (or would be written). */
|
|
32
|
+
path: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Resolve the current state: environment, then the stored answer, then the
|
|
36
|
+
* unset rules above.
|
|
37
|
+
*/
|
|
38
|
+
export declare function autoSaveStatus(): AutoSaveStatus;
|
|
39
|
+
/**
|
|
40
|
+
* True when this process may save without being asked.
|
|
41
|
+
*
|
|
42
|
+
* Read at call time, never cached: the answer can be written between calls in
|
|
43
|
+
* the same process.
|
|
44
|
+
*/
|
|
45
|
+
export declare function isAutoSaveEnabled(): boolean;
|
|
46
|
+
/** True while a human still owes the consent question an answer. */
|
|
47
|
+
export declare function isConsentPending(): boolean;
|
|
48
|
+
/** The file the plugin hooks read. Contains no secret — only the answer. */
|
|
49
|
+
export interface HookAutoSaveState {
|
|
50
|
+
version: number;
|
|
51
|
+
enabled: boolean;
|
|
52
|
+
state: AutoSaveState;
|
|
53
|
+
source: AutoSaveSource;
|
|
54
|
+
pendingConsent: boolean;
|
|
55
|
+
/** The settings file this was resolved from, for diagnosis only. */
|
|
56
|
+
settingsPath: string;
|
|
57
|
+
updatedAt: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Publish the resolved state where the plugin hooks can read it.
|
|
61
|
+
*
|
|
62
|
+
* This is the whole hook contract: the hooks do no resolution, consult no
|
|
63
|
+
* project directory and parse no credentials file — they read this one file out
|
|
64
|
+
* of the trusted state dir, or they fail safe. Called at every point the answer
|
|
65
|
+
* can change (`setAutoSave`, `markConsentPending`) and once at start-up, so a
|
|
66
|
+
* hook spawned in the same session as an MCP server sees the current answer.
|
|
67
|
+
*
|
|
68
|
+
* Best effort: a read-only or missing home directory must not stop the server
|
|
69
|
+
* from running, and a hook that finds no file already behaves as "off".
|
|
70
|
+
*/
|
|
71
|
+
export declare function publishHookState(): HookAutoSaveState | null;
|
|
72
|
+
/**
|
|
73
|
+
* Record the answer, preserving any other keys already in the file. Clears the
|
|
74
|
+
* pending stamp — the question has been answered and must not be asked again.
|
|
75
|
+
*/
|
|
76
|
+
export declare function setAutoSave(enabled: boolean): {
|
|
77
|
+
path: string;
|
|
78
|
+
enabled: boolean;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Mark this install as created after the consent prompt existed, so an unset
|
|
82
|
+
* state here is read as "never asked" rather than "long-standing user".
|
|
83
|
+
*
|
|
84
|
+
* Called once when a brand-new install first appears — before the signed-out
|
|
85
|
+
* server boots, and immediately after a first interactive login — so that an
|
|
86
|
+
* abandoned or headless sign-in cannot mature into automatic saving nobody
|
|
87
|
+
* agreed to. A no-op once any answer exists.
|
|
88
|
+
*/
|
|
89
|
+
export declare function markConsentPending(): void;
|
|
90
|
+
/** One line for a TTY, naming the state, where it came from, and how to flip it. */
|
|
91
|
+
export declare function autoSaveSummary(): string;
|
|
92
|
+
/**
|
|
93
|
+
* The single line a non-interactive run prints while consent is outstanding.
|
|
94
|
+
*
|
|
95
|
+
* Non-TTY is every MCP client spawn, so this is stderr-only and says what is
|
|
96
|
+
* happening rather than asking anything — there is no human on the other end of
|
|
97
|
+
* this stdin, and a prompt here would hang the server forever.
|
|
98
|
+
*/
|
|
99
|
+
export declare function pendingConsentNotice(): string | null;
|
|
100
|
+
//# sourceMappingURL=auto-save.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-save.d.ts","sourceRoot":"","sources":["../src/auto-save.ts"],"names":[],"mappings":"AA+EA,+EAA+E;AAC/E,eAAO,MAAM,aAAa,qBAAqB,CAAC;AAqBhD,wEAAwE;AACxE,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED,0EAA0E;AAC1E,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAWD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,GAAG,IAAI,CAOlF;AA4BD,uEAAuE;AACvE,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,KAAK,GAAG,OAAO,CAAC;AAEnD,MAAM,MAAM,cAAc;AACtB,wDAAwD;AACtD,KAAK;AACP,0CAA0C;GACxC,UAAU;AACZ,4EAA4E;GAC1E,QAAQ;AACV,4EAA4E;GAC1E,YAAY,CAAC;AAEnB,MAAM,WAAW,cAAc;IAC3B,yDAAyD;IACzD,OAAO,EAAE,OAAO,CAAC;IACjB,qCAAqC;IACrC,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,cAAc,CAAC;IACvB,4DAA4D;IAC5D,cAAc,EAAE,OAAO,CAAC;IACxB,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,cAAc,CAgC/C;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED,oEAAoE;AACpE,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C;AAED,4EAA4E;AAC5E,MAAM,WAAW,iBAAiB;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,cAAc,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,oEAAoE;IACpE,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,IAAI,iBAAiB,GAAG,IAAI,CAwB3D;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAOhF;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAOzC;AAED,oFAAoF;AACpF,wBAAgB,eAAe,IAAI,MAAM,CAcxC;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,GAAG,IAAI,CAUpD"}
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Automatic-save consent (WALM-642).
|
|
3
|
+
*
|
|
4
|
+
* Saving a fact the user explicitly asked for has never needed permission and
|
|
5
|
+
* still does not. What this module governs is the other thing the package does:
|
|
6
|
+
* saving what it judges durable, without being asked. That is what MemWal is
|
|
7
|
+
* for — so it is ON — but a person has to have been told what it means first.
|
|
8
|
+
*
|
|
9
|
+
* ── Three states, not two ───────────────────────────────────────────────────
|
|
10
|
+
* `off` and `on` are answers. `unset` is the absence of one, and it is not the
|
|
11
|
+
* same as `off`:
|
|
12
|
+
*
|
|
13
|
+
* - **Answered** (`autoSave: true|false` in settings.json) — from the login
|
|
14
|
+
* prompt or from `memwal-mcp auto-save on|off`. Nothing re-asks.
|
|
15
|
+
* - **Unset on an install that predates this change** — no settings file at
|
|
16
|
+
* all, but credentials on disk. These users have been auto-saving all
|
|
17
|
+
* along; switching them off would be a regression dressed up as caution, so
|
|
18
|
+
* saving CONTINUES and the question is put to them at their next
|
|
19
|
+
* interactive login.
|
|
20
|
+
* - **Unset on a new install** (`autoSaveConsent: "pending"`, stamped the
|
|
21
|
+
* moment a post-change install first appears) — nobody has been asked, so
|
|
22
|
+
* nothing is saved unprompted until someone answers. Explicit tool calls
|
|
23
|
+
* and recall keep working the whole time.
|
|
24
|
+
*
|
|
25
|
+
* The stamp is what separates the last two. Without it a headless install could
|
|
26
|
+
* sign in through the `memwal_login` tool, look indistinguishable from a
|
|
27
|
+
* long-standing user, and start saving on its own — consent by never having
|
|
28
|
+
* been asked.
|
|
29
|
+
*
|
|
30
|
+
* ── Where the answer lives: the trusted state dir, and nowhere else ─────────
|
|
31
|
+
* The answer is a decision about the HUMAN, not about a credentials directory.
|
|
32
|
+
* It used to be stored beside whichever `credentials.json` won resolution,
|
|
33
|
+
* which had two consequences, both wrong:
|
|
34
|
+
*
|
|
35
|
+
* 1. Approving a project's credentials (WALM-639) moved `settingsPath()`
|
|
36
|
+
* into the repository. A user who had already answered "off" globally got
|
|
37
|
+
* a directory with no answer in it, fell through to the legacy
|
|
38
|
+
* "credentials exist, so keep saving" rule, and had automatic memory
|
|
39
|
+
* switched back ON by an approval that was only ever about where writes
|
|
40
|
+
* go. The recorded "no" was never consulted there.
|
|
41
|
+
* 2. `setAutoSave` / `markConsentPending` then wrote the consent answer INTO
|
|
42
|
+
* the repository, where it could be committed and shipped to everyone
|
|
43
|
+
* else who cloned it.
|
|
44
|
+
*
|
|
45
|
+
* So consent now lives in the trusted state dir — `MEMWAL_CREDS_DIR` when it is
|
|
46
|
+
* set, else `~/.memwal` — the same directory auth.ts keeps the project-approval
|
|
47
|
+
* store in, and for the same reason: a record a repository can write is a
|
|
48
|
+
* repository approving itself. Project scoping of CREDENTIALS is unchanged;
|
|
49
|
+
* project scoping of CONSENT is gone.
|
|
50
|
+
*
|
|
51
|
+
* The legacy probe reads the trusted directory's own `credentials.json` for the
|
|
52
|
+
* same reason. "Has this person used MemWal before" must not be answerable by a
|
|
53
|
+
* file inside a checkout.
|
|
54
|
+
*
|
|
55
|
+
* ── How the hooks see it ───────────────────────────────────────────────────
|
|
56
|
+
* The plugin's hooks are separate processes: a hook is spawned by the client,
|
|
57
|
+
* not by this package, and inherits none of the MCP server's `env` or argv. The
|
|
58
|
+
* hooks used to re-derive the whole resolution in plain ESM, and the two
|
|
59
|
+
* implementations drifted — the hook side kept the pre-WALM-639 presence rule,
|
|
60
|
+
* so a committed `.memwal/credentials.json` (contents never parsed, only
|
|
61
|
+
* `existsSync`) turned automatic memory on for anyone who opened the repo.
|
|
62
|
+
*
|
|
63
|
+
* Re-deriving is the bug, so the hooks no longer do it. This module publishes
|
|
64
|
+
* the RESOLVED state to `auto-save-state.json` in the trusted state dir, and
|
|
65
|
+
* the hooks read only that. A repository cannot write there, the hooks do no
|
|
66
|
+
* resolution of their own, and a hook that cannot read the file fails safe
|
|
67
|
+
* (automatic memory off). See `plugin/scripts/lib/auto-save.mjs`.
|
|
68
|
+
*/
|
|
69
|
+
import { dirname, join } from "node:path";
|
|
70
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync, } from "node:fs";
|
|
71
|
+
import { projectApprovalsPath } from "./auth.js";
|
|
72
|
+
import { log } from "./logger.js";
|
|
73
|
+
/** Env var that pins automatic saving on or off for one MCP server process. */
|
|
74
|
+
export const AUTO_SAVE_ENV = "MEMWAL_AUTO_SAVE";
|
|
75
|
+
const SETTINGS_FILE = "settings.json";
|
|
76
|
+
const CREDS_FILE = "credentials.json";
|
|
77
|
+
/** Resolved state the plugin hooks read. Never written inside a repository. */
|
|
78
|
+
const HOOK_STATE_FILE = "auto-save-state.json";
|
|
79
|
+
/** Bumped if the hook-facing shape ever changes incompatibly. */
|
|
80
|
+
const HOOK_STATE_VERSION = 1;
|
|
81
|
+
/**
|
|
82
|
+
* Where records a repository must not be able to write are kept:
|
|
83
|
+
* `MEMWAL_CREDS_DIR` when set, else `~/.memwal`.
|
|
84
|
+
*
|
|
85
|
+
* Derived from `projectApprovalsPath()` rather than recomputed, so this file
|
|
86
|
+
* and auth.ts cannot drift apart the way the hook copy did. auth.ts owns the
|
|
87
|
+
* definition; this reads it back.
|
|
88
|
+
*/
|
|
89
|
+
function trustedStateDir() {
|
|
90
|
+
return dirname(projectApprovalsPath());
|
|
91
|
+
}
|
|
92
|
+
/** Where the answer is stored. Outside every repository, on purpose. */
|
|
93
|
+
export function settingsPath() {
|
|
94
|
+
return join(trustedStateDir(), SETTINGS_FILE);
|
|
95
|
+
}
|
|
96
|
+
/** Where the resolved state is published for the plugin hooks to read. */
|
|
97
|
+
export function hookStatePath() {
|
|
98
|
+
return join(trustedStateDir(), HOOK_STATE_FILE);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Parse a human-written boolean. Returns null for "not set" and for anything
|
|
102
|
+
* unparseable — an unreadable value must not be read as an answer.
|
|
103
|
+
*/
|
|
104
|
+
export function parseBooleanSetting(raw) {
|
|
105
|
+
if (raw === undefined || raw === null)
|
|
106
|
+
return null;
|
|
107
|
+
const v = raw.trim().toLowerCase();
|
|
108
|
+
if (v === "")
|
|
109
|
+
return null;
|
|
110
|
+
if (["1", "true", "on", "yes", "y", "enable", "enabled"].includes(v))
|
|
111
|
+
return true;
|
|
112
|
+
if (["0", "false", "off", "no", "n", "disable", "disabled"].includes(v))
|
|
113
|
+
return false;
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
function readSettings() {
|
|
117
|
+
const path = settingsPath();
|
|
118
|
+
if (!existsSync(path))
|
|
119
|
+
return {};
|
|
120
|
+
try {
|
|
121
|
+
const parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
122
|
+
return parsed && typeof parsed === "object" ? parsed : {};
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
// A corrupt settings file is not an answer. Fall through to unset.
|
|
126
|
+
return {};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function writeSettings(next) {
|
|
130
|
+
const path = settingsPath();
|
|
131
|
+
mkdirSync(dirname(path), { recursive: true, mode: 0o700 });
|
|
132
|
+
writeFileSync(path, `${JSON.stringify(next, null, 2)}\n`, { mode: 0o600 });
|
|
133
|
+
// `writeFileSync`'s `mode` follows POSIX `open()`: the kernel applies it
|
|
134
|
+
// when it CREATES the inode and ignores it for one that already exists, so
|
|
135
|
+
// a file left permissive by anything else would keep its old mode forever.
|
|
136
|
+
// Unlike credentials.json (see `writeSecretFile` in auth.ts) there is no
|
|
137
|
+
// secret in flight here, so tightening afterwards is enough — no reader can
|
|
138
|
+
// learn anything from the window, only whether the flag is set.
|
|
139
|
+
chmodSync(path, 0o600);
|
|
140
|
+
return path;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Resolve the current state: environment, then the stored answer, then the
|
|
144
|
+
* unset rules above.
|
|
145
|
+
*/
|
|
146
|
+
export function autoSaveStatus() {
|
|
147
|
+
const path = settingsPath();
|
|
148
|
+
const settings = readSettings();
|
|
149
|
+
const answered = typeof settings.autoSave === "boolean" ? settings.autoSave : null;
|
|
150
|
+
const state = answered === null ? "unset" : answered ? "on" : "off";
|
|
151
|
+
const fromEnv = parseBooleanSetting(process.env[AUTO_SAVE_ENV]);
|
|
152
|
+
if (fromEnv !== null) {
|
|
153
|
+
// Overrides the behaviour, and counts as a deliberate configuration
|
|
154
|
+
// act: someone who set this does not need to be asked as well.
|
|
155
|
+
return { enabled: fromEnv, state, source: "env", pendingConsent: false, path };
|
|
156
|
+
}
|
|
157
|
+
if (answered !== null) {
|
|
158
|
+
return { enabled: answered, state, source: "settings", pendingConsent: false, path };
|
|
159
|
+
}
|
|
160
|
+
// Unset. Which way it falls depends on whether this install was ever in a
|
|
161
|
+
// position to have been asked — see the module comment. The probe is the
|
|
162
|
+
// TRUSTED directory's credentials file, never a project one: "has this
|
|
163
|
+
// person used MemWal before" must not be answerable by a checkout.
|
|
164
|
+
const stamped = settings.autoSaveConsent === "pending";
|
|
165
|
+
const preExisting = !stamped && existsSync(join(trustedStateDir(), CREDS_FILE));
|
|
166
|
+
return {
|
|
167
|
+
enabled: preExisting,
|
|
168
|
+
state: "unset",
|
|
169
|
+
source: preExisting ? "legacy" : "unanswered",
|
|
170
|
+
pendingConsent: true,
|
|
171
|
+
path,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* True when this process may save without being asked.
|
|
176
|
+
*
|
|
177
|
+
* Read at call time, never cached: the answer can be written between calls in
|
|
178
|
+
* the same process.
|
|
179
|
+
*/
|
|
180
|
+
export function isAutoSaveEnabled() {
|
|
181
|
+
return autoSaveStatus().enabled;
|
|
182
|
+
}
|
|
183
|
+
/** True while a human still owes the consent question an answer. */
|
|
184
|
+
export function isConsentPending() {
|
|
185
|
+
return autoSaveStatus().pendingConsent;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Publish the resolved state where the plugin hooks can read it.
|
|
189
|
+
*
|
|
190
|
+
* This is the whole hook contract: the hooks do no resolution, consult no
|
|
191
|
+
* project directory and parse no credentials file — they read this one file out
|
|
192
|
+
* of the trusted state dir, or they fail safe. Called at every point the answer
|
|
193
|
+
* can change (`setAutoSave`, `markConsentPending`) and once at start-up, so a
|
|
194
|
+
* hook spawned in the same session as an MCP server sees the current answer.
|
|
195
|
+
*
|
|
196
|
+
* Best effort: a read-only or missing home directory must not stop the server
|
|
197
|
+
* from running, and a hook that finds no file already behaves as "off".
|
|
198
|
+
*/
|
|
199
|
+
export function publishHookState() {
|
|
200
|
+
const status = autoSaveStatus();
|
|
201
|
+
const payload = {
|
|
202
|
+
version: HOOK_STATE_VERSION,
|
|
203
|
+
enabled: status.enabled,
|
|
204
|
+
state: status.state,
|
|
205
|
+
source: status.source,
|
|
206
|
+
pendingConsent: status.pendingConsent,
|
|
207
|
+
settingsPath: status.path,
|
|
208
|
+
updatedAt: new Date().toISOString(),
|
|
209
|
+
};
|
|
210
|
+
const path = hookStatePath();
|
|
211
|
+
try {
|
|
212
|
+
mkdirSync(dirname(path), { recursive: true, mode: 0o700 });
|
|
213
|
+
writeFileSync(path, `${JSON.stringify(payload, null, 2)}\n`, { mode: 0o600 });
|
|
214
|
+
chmodSync(path, 0o600);
|
|
215
|
+
return payload;
|
|
216
|
+
}
|
|
217
|
+
catch (err) {
|
|
218
|
+
log.warn("autosave.publish_failed", {
|
|
219
|
+
path,
|
|
220
|
+
error: err instanceof Error ? err.message : String(err),
|
|
221
|
+
});
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Record the answer, preserving any other keys already in the file. Clears the
|
|
227
|
+
* pending stamp — the question has been answered and must not be asked again.
|
|
228
|
+
*/
|
|
229
|
+
export function setAutoSave(enabled) {
|
|
230
|
+
const next = { ...readSettings(), autoSave: enabled };
|
|
231
|
+
delete next.autoSaveConsent;
|
|
232
|
+
const path = writeSettings(next);
|
|
233
|
+
publishHookState();
|
|
234
|
+
log.info("autosave.set", { enabled, path });
|
|
235
|
+
return { path, enabled };
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Mark this install as created after the consent prompt existed, so an unset
|
|
239
|
+
* state here is read as "never asked" rather than "long-standing user".
|
|
240
|
+
*
|
|
241
|
+
* Called once when a brand-new install first appears — before the signed-out
|
|
242
|
+
* server boots, and immediately after a first interactive login — so that an
|
|
243
|
+
* abandoned or headless sign-in cannot mature into automatic saving nobody
|
|
244
|
+
* agreed to. A no-op once any answer exists.
|
|
245
|
+
*/
|
|
246
|
+
export function markConsentPending() {
|
|
247
|
+
const settings = readSettings();
|
|
248
|
+
if (typeof settings.autoSave === "boolean")
|
|
249
|
+
return;
|
|
250
|
+
if (settings.autoSaveConsent === "pending")
|
|
251
|
+
return;
|
|
252
|
+
writeSettings({ ...settings, autoSaveConsent: "pending" });
|
|
253
|
+
publishHookState();
|
|
254
|
+
log.info("autosave.consent_pending", { path: settingsPath() });
|
|
255
|
+
}
|
|
256
|
+
/** One line for a TTY, naming the state, where it came from, and how to flip it. */
|
|
257
|
+
export function autoSaveSummary() {
|
|
258
|
+
const status = autoSaveStatus();
|
|
259
|
+
const where = status.source === "env"
|
|
260
|
+
? `from ${AUTO_SAVE_ENV}`
|
|
261
|
+
: status.source === "settings"
|
|
262
|
+
? `from ${status.path}`
|
|
263
|
+
: status.source === "legacy"
|
|
264
|
+
? "carried over from before this setting existed"
|
|
265
|
+
: "not answered yet";
|
|
266
|
+
const how = status.enabled
|
|
267
|
+
? "Turn it off with `memwal-mcp auto-save off`."
|
|
268
|
+
: "Turn it on with `memwal-mcp auto-save on`. Facts you explicitly ask to save are stored either way.";
|
|
269
|
+
return `Automatic memory: ${status.enabled ? "ON" : "OFF"} (${where}). ${how}`;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* The single line a non-interactive run prints while consent is outstanding.
|
|
273
|
+
*
|
|
274
|
+
* Non-TTY is every MCP client spawn, so this is stderr-only and says what is
|
|
275
|
+
* happening rather than asking anything — there is no human on the other end of
|
|
276
|
+
* this stdin, and a prompt here would hang the server forever.
|
|
277
|
+
*/
|
|
278
|
+
export function pendingConsentNotice() {
|
|
279
|
+
const status = autoSaveStatus();
|
|
280
|
+
if (!status.pendingConsent)
|
|
281
|
+
return null;
|
|
282
|
+
return status.enabled
|
|
283
|
+
? "Automatic memory is ON, carried over from before this setting existed. " +
|
|
284
|
+
"Run `memwal-mcp auto-save on|off` in a terminal to confirm or change it."
|
|
285
|
+
: "Automatic memory is waiting on your answer, so nothing is being saved " +
|
|
286
|
+
"unprompted yet (facts you explicitly ask to save still are). Run " +
|
|
287
|
+
"`memwal-mcp login` in a terminal to answer, or set it directly with " +
|
|
288
|
+
"`memwal-mcp auto-save on|off`.";
|
|
289
|
+
}
|
|
290
|
+
//# sourceMappingURL=auto-save.js.map
|