@mu-crew/mu 3.11.2 → 3.11.3
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/AGENTS.md +2 -1
- package/dist/{chunk-2FJK6OOZ.js → chunk-3L5KO3PX.js} +3 -3
- package/dist/{chunk-JYZUNPPO.js → chunk-F7ZBF6I7.js} +24 -22
- package/dist/chunk-F7ZBF6I7.js.map +1 -0
- package/dist/{chunk-4PACTXAB.js → chunk-L2ABBTYG.js} +1 -1
- package/dist/chunk-L2ABBTYG.js.map +1 -0
- package/dist/{chunk-DXKJY3NT.js → chunk-LEORAGKV.js} +3 -3
- package/dist/{chunk-WYBOR4FX.js → chunk-R2SVBZAB.js} +20 -4
- package/dist/chunk-R2SVBZAB.js.map +1 -0
- package/dist/{cli-GRAPF5VC.js → cli-GJIO7GWD.js} +9 -8
- package/dist/cli-GJIO7GWD.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/extension/mu-pi.js +122 -32
- package/dist/extension/mu-pi.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/{tui-DGDEH4JX.js → tui-WHCLVCYE.js} +5 -5
- package/dist/tui-sync-worker.js +2 -2
- package/docs/architecture/control-socket.md +1 -1
- package/docs/guide/delegate.md +7 -0
- package/docs/reference/env.md +1 -0
- package/docs/reference/naming.md +7 -0
- package/package.json +1 -1
- package/dist/chunk-4PACTXAB.js.map +0 -1
- package/dist/chunk-JYZUNPPO.js.map +0 -1
- package/dist/chunk-WYBOR4FX.js.map +0 -1
- package/dist/cli-GRAPF5VC.js.map +0 -1
- /package/dist/{chunk-2FJK6OOZ.js.map → chunk-3L5KO3PX.js.map} +0 -0
- /package/dist/{chunk-DXKJY3NT.js.map → chunk-LEORAGKV.js.map} +0 -0
- /package/dist/{tui-DGDEH4JX.js.map → tui-WHCLVCYE.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/state-dir.ts"],"sourcesContent":["// The mu state directory, resolved from builtins only so the CLI\n// bootstrap (src/main.ts) can locate its compile cache before it loads\n// any of the CLI graph. db.ts re-exports defaultStateDir.\n\nimport { homedir } from \"node:os\";\nimport { isAbsolute, join } from \"node:path\";\n\n/**\n * Resolve the canonical mu state directory:\n * MU_STATE_DIR > $XDG_STATE_HOME/mu (absolute only) > ~/.local/state/mu\n */\nexport function defaultStateDir(): string {\n if (process.env.MU_STATE_DIR) return process.env.MU_STATE_DIR;\n return join(xdgStateHome(homedir()), \"mu\");\n}\n\n/**\n * The mu cache directory, `$XDG_CACHE_HOME/mu` (absolute only) else\n * `~/.cache/mu`: files mu can lose at any time, such as copies of data\n * that lives elsewhere too.\n */\nexport function defaultCacheDir(): string {\n const xdg = process.env.XDG_CACHE_HOME;\n return join(xdg !== undefined && isAbsolute(xdg) ? xdg : join(homedir(), \".cache\"), \"mu\");\n}\n\n/** `$XDG_STATE_HOME`, or `<home>/.local/state` when it is unset, empty,\n * or relative: the XDG spec says such a value must be ignored, and a\n * relative one would scatter state across every cwd mu runs in. */\nexport function xdgStateHome(home: string): string {\n const xdg = process.env.XDG_STATE_HOME;\n return xdg !== undefined && isAbsolute(xdg) ? xdg : join(home, \".local\", \"state\");\n}\n"],"mappings":";AAIA,SAAS,eAAe;AACxB,SAAS,YAAY,YAAY;AAM1B,SAAS,kBAA0B;AACxC,MAAI,QAAQ,IAAI,aAAc,QAAO,QAAQ,IAAI;AACjD,SAAO,KAAK,aAAa,QAAQ,CAAC,GAAG,IAAI;AAC3C;AAeO,SAAS,aAAa,MAAsB;AACjD,QAAM,MAAM,QAAQ,IAAI;AACxB,SAAO,QAAQ,UAAa,WAAW,GAAG,IAAI,MAAM,KAAK,MAAM,UAAU,OAAO;AAClF;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
groupIdFromPrefix
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-F7ZBF6I7.js";
|
|
4
4
|
import {
|
|
5
5
|
LEGACY_LOG_ONLY_SQL_EXCLUSION,
|
|
6
6
|
localMachineId,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
resolvePair,
|
|
10
10
|
resolveWorkstreamId,
|
|
11
11
|
withOpContext
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-R2SVBZAB.js";
|
|
13
13
|
|
|
14
14
|
// src/undo.ts
|
|
15
15
|
var UndoGroupNotFoundError = class extends Error {
|
|
@@ -637,4 +637,4 @@ export {
|
|
|
637
637
|
planUndo,
|
|
638
638
|
undoGroup
|
|
639
639
|
};
|
|
640
|
-
//# sourceMappingURL=chunk-
|
|
640
|
+
//# sourceMappingURL=chunk-LEORAGKV.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defaultStateDir,
|
|
3
3
|
xdgStateHome
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-L2ABBTYG.js";
|
|
5
5
|
|
|
6
6
|
// src/capture.ts
|
|
7
7
|
var UNRESOLVED = "<unresolved>";
|
|
@@ -311,7 +311,7 @@ function openDb(options = {}) {
|
|
|
311
311
|
const db = new Database(path, { readonly: options.readonly ?? false });
|
|
312
312
|
if (!options.readonly) {
|
|
313
313
|
db.pragma("busy_timeout = 5000");
|
|
314
|
-
const detectedVersion = detectExistingSchemaVersion(db);
|
|
314
|
+
const detectedVersion = db.transaction(() => detectExistingSchemaVersion(db))();
|
|
315
315
|
if (detectedVersion !== null && detectedVersion > CURRENT_SCHEMA_VERSION) {
|
|
316
316
|
try {
|
|
317
317
|
db.close();
|
|
@@ -326,7 +326,7 @@ function openDb(options = {}) {
|
|
|
326
326
|
}
|
|
327
327
|
throw new SchemaTooOldError(detectedVersion, MIN_ACCEPTED_SCHEMA_VERSION);
|
|
328
328
|
}
|
|
329
|
-
db
|
|
329
|
+
setWalMode(db);
|
|
330
330
|
db.pragma("foreign_keys = ON");
|
|
331
331
|
if (detectedVersion !== CURRENT_SCHEMA_VERSION || !schemaIsCurrent(db)) applySchema(db);
|
|
332
332
|
seedMachineIdentity(db);
|
|
@@ -418,6 +418,22 @@ var SchemaTooNewError = class extends Error {
|
|
|
418
418
|
return [{ intent: "Check which mu is on PATH", command: "which mu && mu --version" }];
|
|
419
419
|
}
|
|
420
420
|
};
|
|
421
|
+
var WAL_SWITCH_RETRY_MS = 5e3;
|
|
422
|
+
function setWalMode(db) {
|
|
423
|
+
const deadline = Date.now() + WAL_SWITCH_RETRY_MS;
|
|
424
|
+
const pause = new Int32Array(new SharedArrayBuffer(4));
|
|
425
|
+
for (; ; ) {
|
|
426
|
+
try {
|
|
427
|
+
db.pragma("journal_mode = WAL");
|
|
428
|
+
return;
|
|
429
|
+
} catch (err) {
|
|
430
|
+
const code = err.code;
|
|
431
|
+
const busy = typeof code === "string" && code.startsWith("SQLITE_BUSY");
|
|
432
|
+
if (!busy || Date.now() >= deadline) throw err;
|
|
433
|
+
Atomics.wait(pause, 0, 0, 10 + Math.floor(Math.random() * 20));
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
421
437
|
function detectExistingSchemaVersion(db) {
|
|
422
438
|
const hasVersionTable = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='schema_version'").get();
|
|
423
439
|
if (hasVersionTable) {
|
|
@@ -2789,4 +2805,4 @@ export {
|
|
|
2789
2805
|
ingestFromDb,
|
|
2790
2806
|
transportNextSteps
|
|
2791
2807
|
};
|
|
2792
|
-
//# sourceMappingURL=chunk-
|
|
2808
|
+
//# sourceMappingURL=chunk-R2SVBZAB.js.map
|