@memfork/cli 0.1.53 → 0.1.55
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/dist/cli.js +22 -2
- package/dist/commands/install.js +4 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -182,9 +182,29 @@ program.parseAsync(process.argv).catch((e) => {
|
|
|
182
182
|
process.exit(1);
|
|
183
183
|
});
|
|
184
184
|
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
185
|
+
/**
|
|
186
|
+
* Flush stdout/stderr, then exit with `code`.
|
|
187
|
+
*
|
|
188
|
+
* Commands like `commit` open keep-alive sockets to the relayer / Sui RPC that
|
|
189
|
+
* hold Node's event loop open long after the work is done — so the process
|
|
190
|
+
* would otherwise hang for ~minutes instead of returning. Agents (Codex) read
|
|
191
|
+
* this as a stuck command and retry, producing duplicate commits. We exit
|
|
192
|
+
* explicitly once the command resolves.
|
|
193
|
+
*
|
|
194
|
+
* We can't use a bare `process.exit()` because it truncates buffered output
|
|
195
|
+
* when stdout is a pipe (which it always is under an agent). Writing an empty
|
|
196
|
+
* chunk with a callback guarantees the prior writes have drained first.
|
|
197
|
+
*/
|
|
198
|
+
function flushAndExit(code) {
|
|
199
|
+
let pending = 2;
|
|
200
|
+
const done = () => { if (--pending === 0)
|
|
201
|
+
process.exit(code); };
|
|
202
|
+
process.stdout.write("", done);
|
|
203
|
+
process.stderr.write("", done);
|
|
204
|
+
}
|
|
185
205
|
function wrap(fn) {
|
|
186
206
|
return (...args) => {
|
|
187
|
-
fn(...args).
|
|
207
|
+
fn(...args).then(() => flushAndExit(0), (e) => {
|
|
188
208
|
if (e.name === "ConfigError") {
|
|
189
209
|
console.error(chalk.red("\n " + String(e.message)));
|
|
190
210
|
console.error(chalk.cyan(" → Run `memfork init` to configure.\n"));
|
|
@@ -192,7 +212,7 @@ function wrap(fn) {
|
|
|
192
212
|
else {
|
|
193
213
|
console.error(chalk.red("\nError: " + String(e)));
|
|
194
214
|
}
|
|
195
|
-
|
|
215
|
+
flushAndExit(1);
|
|
196
216
|
});
|
|
197
217
|
};
|
|
198
218
|
}
|
package/dist/commands/install.js
CHANGED
|
@@ -222,13 +222,15 @@ function upsertCodexMcp(tomlPath, creds) {
|
|
|
222
222
|
// `disabled_tools` denies the raw MemWal write tools so the agent cannot
|
|
223
223
|
// bypass the on-chain DAG. All persistence is forced through `memfork commit`
|
|
224
224
|
// (which writes MemWal *and* anchors on Sui). Recall + health + restore stay
|
|
225
|
-
// enabled
|
|
226
|
-
//
|
|
225
|
+
// enabled and are auto-approved (read-only / diagnostic — no approval needed).
|
|
226
|
+
// Users who want raw, unanchored memory can install the standalone MemWal
|
|
227
|
+
// plugin instead.
|
|
227
228
|
const block = `
|
|
228
229
|
[mcp_servers.memwal]
|
|
229
230
|
url = "${creds.relayerUrl}"
|
|
230
231
|
http_headers = { Authorization = "Bearer ${creds.delegateKey}", x-memwal-account-id = "${creds.accountId}" }
|
|
231
232
|
disabled_tools = ["memwal_remember", "memwal_remember_bulk", "memwal_analyze"]
|
|
233
|
+
default_tools_approval_mode = "auto"
|
|
232
234
|
`;
|
|
233
235
|
if (existing.includes("[mcp_servers.memwal]")) {
|
|
234
236
|
// Replace the existing block — from the header through every following line
|