@mulmoclaude/core 7.7.2 → 7.8.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/assets/helps/error-recovery.md +21 -0
- package/assets/helps/spreadsheet.md +8 -7
- package/dist/{atomic-C3NMg6-j.js → atomic-Dw7dV4TL.js} +1 -1
- package/dist/{atomic-C3NMg6-j.js.map → atomic-Dw7dV4TL.js.map} +1 -1
- package/dist/{atomic-cqafMWEI.cjs → atomic-bzFw4-ix.cjs} +3 -3
- package/dist/atomic-bzFw4-ix.cjs.map +1 -0
- package/dist/collection/index.cjs +6 -6
- package/dist/collection/index.js +6 -6
- package/dist/collection/paths.cjs +1 -1
- package/dist/collection/paths.js +1 -1
- package/dist/collection/registry/index.cjs +1 -1
- package/dist/collection/registry/index.js +1 -1
- package/dist/collection/registry/server/index.cjs +11 -11
- package/dist/collection/registry/server/index.cjs.map +1 -1
- package/dist/collection/registry/server/index.js +10 -10
- package/dist/collection/server/index.cjs +5 -5
- package/dist/collection/server/index.js +5 -5
- package/dist/collection-watchers/index.cjs +6 -6
- package/dist/collection-watchers/index.cjs.map +1 -1
- package/dist/collection-watchers/index.js +6 -6
- package/dist/collection-watchers/index.js.map +1 -1
- package/dist/{containment-Dc3gO4wD.cjs → containment-NZYJbiaa.cjs} +2 -2
- package/dist/{containment-Dc3gO4wD.cjs.map → containment-NZYJbiaa.cjs.map} +1 -1
- package/dist/{containment-D_vAa6eT.js → containment-Ne0w06jN.js} +1 -1
- package/dist/{containment-D_vAa6eT.js.map → containment-Ne0w06jN.js.map} +1 -1
- package/dist/{discovery-CY4pvgo9.cjs → discovery-Cu35oXeW.cjs} +13 -13
- package/dist/{discovery-CY4pvgo9.cjs.map → discovery-Cu35oXeW.cjs.map} +1 -1
- package/dist/{discovery-CImpaG95.js → discovery-DTOodl_M.js} +10 -10
- package/dist/{discovery-CImpaG95.js.map → discovery-DTOodl_M.js.map} +1 -1
- package/dist/{dist-734JaRYi.cjs → dist-DK0zTPR1.cjs} +1 -1
- package/dist/{dist-734JaRYi.cjs.map → dist-DK0zTPR1.cjs.map} +1 -1
- package/dist/{dist-BmO4oSQy.js → dist-wmt60Ec-.js} +1 -1
- package/dist/{dist-BmO4oSQy.js.map → dist-wmt60Ec-.js.map} +1 -1
- package/dist/errorMessage-CEWGPYzN.js +1 -0
- package/dist/errorMessage-DCZuXjO4.cjs +1 -0
- package/dist/{errors-0QwjDxsv.js → errors-DfW0e2uv.js} +2 -2
- package/dist/{errors-0QwjDxsv.js.map → errors-DfW0e2uv.js.map} +1 -1
- package/dist/{errors-B9mCEVG9.cjs → errors-WLfupg-H.cjs} +2 -2
- package/dist/{errors-B9mCEVG9.cjs.map → errors-WLfupg-H.cjs.map} +1 -1
- package/dist/feeds/index.cjs +2 -2
- package/dist/feeds/index.js +2 -2
- package/dist/feeds/paths.cjs +1 -1
- package/dist/feeds/server/index.cjs +13 -13
- package/dist/feeds/server/index.js +11 -11
- package/dist/file-change/index.cjs +2 -2
- package/dist/file-change/index.js +1 -1
- package/dist/files/index.cjs +9 -9
- package/dist/files/index.js +7 -7
- package/dist/global-config/index.cjs +1 -1
- package/dist/global-config/index.js +1 -1
- package/dist/google/index.cjs +16 -16
- package/dist/google/index.cjs.map +1 -1
- package/dist/google/index.js +14 -14
- package/dist/google/index.js.map +1 -1
- package/dist/{graph-DBbzemby.js → graph-CVoiWp8B.js} +2 -2
- package/dist/{graph-DBbzemby.js.map → graph-CVoiWp8B.js.map} +1 -1
- package/dist/{graph-BvVMZfDV.cjs → graph-RyHEgm-F.cjs} +2 -2
- package/dist/{graph-BvVMZfDV.cjs.map → graph-RyHEgm-F.cjs.map} +1 -1
- package/dist/{iconGlyph-CFOiFsmq.cjs → iconGlyph-BhtU1a9P.cjs} +1 -1
- package/dist/{iconGlyph-CFOiFsmq.cjs.map → iconGlyph-BhtU1a9P.cjs.map} +1 -1
- package/dist/{iconGlyph-D9h__VaM.js → iconGlyph-DjE_HLf4.js} +1 -1
- package/dist/{iconGlyph-D9h__VaM.js.map → iconGlyph-DjE_HLf4.js.map} +1 -1
- package/dist/{ingestTypes-CLDvn7kw.cjs → ingestTypes-CmO3SNaO.cjs} +2 -2
- package/dist/{ingestTypes-CLDvn7kw.cjs.map → ingestTypes-CmO3SNaO.cjs.map} +1 -1
- package/dist/{ingestTypes-DuXuSBSn.js → ingestTypes-V3bHEQ2i.js} +2 -2
- package/dist/{ingestTypes-DuXuSBSn.js.map → ingestTypes-V3bHEQ2i.js.map} +1 -1
- package/dist/{itemId-D2XAQ8RU.cjs → itemId-D3mJhGu0.cjs} +1 -1
- package/dist/{itemId-D2XAQ8RU.cjs.map → itemId-D3mJhGu0.cjs.map} +1 -1
- package/dist/{itemId-D_pSpa3U.js → itemId-D7pPwaX6.js} +1 -1
- package/dist/{itemId-D_pSpa3U.js.map → itemId-D7pPwaX6.js.map} +1 -1
- package/dist/{json-BizOSThv.js → json-C23c3t1W.js} +2 -2
- package/dist/{json-BizOSThv.js.map → json-C23c3t1W.js.map} +1 -1
- package/dist/{json-BGdV2cz6.cjs → json-CWiVjlka.cjs} +2 -2
- package/dist/{json-BGdV2cz6.cjs.map → json-CWiVjlka.cjs.map} +1 -1
- package/dist/{listen-uiEnXcW9.js → listen-DFP9Lrbd.js} +2 -2
- package/dist/{listen-uiEnXcW9.js.map → listen-DFP9Lrbd.js.map} +1 -1
- package/dist/{listen-OmfLDX1l.cjs → listen-jSwqWZfE.cjs} +2 -2
- package/dist/{listen-OmfLDX1l.cjs.map → listen-jSwqWZfE.cjs.map} +1 -1
- package/dist/notifier/index.cjs +1 -1
- package/dist/notifier/index.js +1 -1
- package/dist/{notifier-htdf4ekH.js → notifier-BkIAgskG.js} +3 -3
- package/dist/{notifier-htdf4ekH.js.map → notifier-BkIAgskG.js.map} +1 -1
- package/dist/{notifier-CRTk34EC.cjs → notifier-nv9c1r6T.cjs} +3 -3
- package/dist/{notifier-CRTk34EC.cjs.map → notifier-nv9c1r6T.cjs.map} +1 -1
- package/dist/{paths-DUHAueEv.cjs → paths-D0WRbJTV.cjs} +2 -2
- package/dist/{paths-DUHAueEv.cjs.map → paths-D0WRbJTV.cjs.map} +1 -1
- package/dist/{paths-BMQNHdaJ.js → paths-qvo3SsnP.js} +2 -2
- package/dist/{paths-BMQNHdaJ.js.map → paths-qvo3SsnP.js.map} +1 -1
- package/dist/plugin-vue/i18n.cjs +1 -1
- package/dist/plugin-vue/i18n.cjs.map +1 -1
- package/dist/plugin-vue/i18n.js +1 -1
- package/dist/plugin-vue/index.cjs +2 -2
- package/dist/plugin-vue/index.cjs.map +1 -1
- package/dist/plugin-vue/index.js +2 -2
- package/dist/plugin-vue/index.js.map +1 -1
- package/dist/{project-mU6-xLfy.js → project-CSx7gqgs.js} +1 -1
- package/dist/{project-mU6-xLfy.js.map → project-CSx7gqgs.js.map} +1 -1
- package/dist/{project-DDTIVEMU.cjs → project-sS_ltoWz.cjs} +1 -1
- package/dist/{project-DDTIVEMU.cjs.map → project-sS_ltoWz.cjs.map} +1 -1
- package/dist/prompt-files/index.cjs +3 -3
- package/dist/prompt-files/index.cjs.map +1 -1
- package/dist/prompt-files/index.js +1 -1
- package/dist/{promptSafety-CjxafW2b.cjs → promptSafety-BkFiS7El.cjs} +3 -3
- package/dist/{promptSafety-CjxafW2b.cjs.map → promptSafety-BkFiS7El.cjs.map} +1 -1
- package/dist/{promptSafety-B8LECAkY.js → promptSafety-Dp9Zga_t.js} +3 -3
- package/dist/{promptSafety-B8LECAkY.js.map → promptSafety-Dp9Zga_t.js.map} +1 -1
- package/dist/{relPath-CZiP2S_a.cjs → relPath-B-c9FUkm.cjs} +2 -2
- package/dist/{relPath-CZiP2S_a.cjs.map → relPath-B-c9FUkm.cjs.map} +1 -1
- package/dist/{relPath-BkKmqiiF.js → relPath-DV2ZrxF_.js} +1 -1
- package/dist/{relPath-BkKmqiiF.js.map → relPath-DV2ZrxF_.js.map} +1 -1
- package/dist/remote-host/index.cjs +1 -1
- package/dist/remote-host/index.js +1 -1
- package/dist/remote-host/server/index.cjs +4 -4
- package/dist/remote-host/server/index.cjs.map +1 -1
- package/dist/remote-host/server/index.js +4 -4
- package/dist/remote-host/server/index.js.map +1 -1
- package/dist/{remote-host-11euEZKP.cjs → remote-host-B6r8BkA1.cjs} +2 -2
- package/dist/{remote-host-11euEZKP.cjs.map → remote-host-B6r8BkA1.cjs.map} +1 -1
- package/dist/{remote-host-TiMhcW1o.js → remote-host-BI_3SnK1.js} +2 -2
- package/dist/{remote-host-TiMhcW1o.js.map → remote-host-BI_3SnK1.js.map} +1 -1
- package/dist/remote-view/index.cjs +2 -2
- package/dist/remote-view/index.js +2 -2
- package/dist/{rolldown-runtime-CmQyd0Gu.cjs → rolldown-runtime-C5rMTSut.cjs} +8 -6
- package/dist/{root-s0MUUMQU.js → root-DDMQu5hb.js} +1 -1
- package/dist/{root-s0MUUMQU.js.map → root-DDMQu5hb.js.map} +1 -1
- package/dist/{root-Ccgd3H5S.cjs → root-kKYFqEMf.cjs} +2 -2
- package/dist/{root-Ccgd3H5S.cjs.map → root-kKYFqEMf.cjs.map} +1 -1
- package/dist/runtime-plugins/index.cjs +104 -15
- package/dist/runtime-plugins/index.cjs.map +1 -1
- package/dist/runtime-plugins/index.d.ts +1 -0
- package/dist/runtime-plugins/index.js +99 -15
- package/dist/runtime-plugins/index.js.map +1 -1
- package/dist/runtime-plugins/ledgerLock.d.ts +16 -0
- package/dist/scheduler/index.cjs +5 -5
- package/dist/scheduler/index.js +4 -4
- package/dist/{server-BXtSbL-b.cjs → server-BNmwQGcq.cjs} +15 -15
- package/dist/server-BNmwQGcq.cjs.map +1 -0
- package/dist/{server-B5TZjZN9.js → server-BpCUehxP.js} +14 -14
- package/dist/{server-B5TZjZN9.js.map → server-BpCUehxP.js.map} +1 -1
- package/dist/skill-bridge/index.cjs +3 -3
- package/dist/skill-bridge/index.cjs.map +1 -1
- package/dist/skill-bridge/index.js +2 -2
- package/dist/{slug-DVkuPjIv.cjs → slug-BRj6KEiN.cjs} +1 -1
- package/dist/{slug-DVkuPjIv.cjs.map → slug-BRj6KEiN.cjs.map} +1 -1
- package/dist/{slug-D24AYqCZ.js → slug-X5tnZoc-.js} +1 -1
- package/dist/{slug-D24AYqCZ.js.map → slug-X5tnZoc-.js.map} +1 -1
- package/dist/{templatePath-CB3wtVpe.js → templatePath-B5mHTFDX.js} +1 -1
- package/dist/{templatePath-CB3wtVpe.js.map → templatePath-B5mHTFDX.js.map} +1 -1
- package/dist/{templatePath-BIh7wqgS.cjs → templatePath-DSawCKNy.cjs} +1 -1
- package/dist/{templatePath-BIh7wqgS.cjs.map → templatePath-DSawCKNy.cjs.map} +1 -1
- package/dist/{text-BQAuwKVj.js → text-BpGv7qxC.js} +1 -1
- package/dist/{text-BQAuwKVj.js.map → text-BpGv7qxC.js.map} +1 -1
- package/dist/{text-BQiyo5R9.cjs → text-CPK6ABnv.cjs} +1 -1
- package/dist/{text-BQiyo5R9.cjs.map → text-CPK6ABnv.cjs.map} +1 -1
- package/dist/{types-DPycxnDf.cjs → types-Bmk0fWDr.cjs} +1 -1
- package/dist/{types-DPycxnDf.cjs.map → types-Bmk0fWDr.cjs.map} +1 -1
- package/dist/{types-BLCZTGW2.js → types-CuiYCIof.js} +1 -1
- package/dist/{types-BLCZTGW2.js.map → types-CuiYCIof.js.map} +1 -1
- package/dist/utils/index.cjs +3 -3
- package/dist/utils/index.js +3 -3
- package/dist/whisper/client.cjs.map +1 -1
- package/dist/whisper/client.js.map +1 -1
- package/dist/whisper/index.cjs +7 -7
- package/dist/whisper/index.cjs.map +1 -1
- package/dist/whisper/index.js +5 -5
- package/dist/wiki/index.cjs +3 -3
- package/dist/wiki/index.js +3 -3
- package/dist/wiki/paths.cjs +2 -2
- package/dist/wiki/paths.js +1 -1
- package/dist/wiki/server/index.cjs +7 -7
- package/dist/wiki/server/index.js +5 -5
- package/dist/{withinRoot-CheaBWt0.js → withinRoot-Dc756J5K.js} +2 -2
- package/dist/{withinRoot-CheaBWt0.js.map → withinRoot-Dc756J5K.js.map} +1 -1
- package/dist/{withinRoot-CHPN9eHD.cjs → withinRoot-OaOVCBHa.cjs} +2 -2
- package/dist/withinRoot-OaOVCBHa.cjs.map +1 -0
- package/dist/workspace-setup/index.js +1 -1
- package/package.json +5 -5
- package/dist/atomic-cqafMWEI.cjs.map +0 -1
- package/dist/errorMessage-D0kR547_.cjs +0 -1
- package/dist/errorMessage-TpKxrmeo.js +0 -1
- package/dist/server-BXtSbL-b.cjs.map +0 -1
- package/dist/withinRoot-CHPN9eHD.cjs.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { c as isRecord, i as hasStringProp } from "../dist-
|
|
2
|
-
import { n as isWithinRoot, r as realpathSyncOrNull, t as isInsideRoot } from "../containment-D_vAa6eT.js";
|
|
3
|
-
import { t as writeJsonAtomic } from "../json-BizOSThv.js";
|
|
4
|
-
import { n as writeFileAtomic } from "../atomic-C3NMg6-j.js";
|
|
5
|
-
import { isPluginFactory } from "gui-chat-protocol";
|
|
1
|
+
import { c as isRecord, i as hasStringProp } from "../dist-wmt60Ec-.js";
|
|
6
2
|
import { closeSync, constants, existsSync, fstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
7
|
-
import path from "node:path";
|
|
8
|
-
import { createHash } from "node:crypto";
|
|
9
|
-
import { constants as constants$1, mkdir, mkdtemp, open, readFile, rm, writeFile } from "node:fs/promises";
|
|
10
3
|
import { execFileSync } from "node:child_process";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { createHash, randomUUID, timingSafeEqual } from "node:crypto";
|
|
11
6
|
import { pathToFileURL } from "node:url";
|
|
7
|
+
import { isPluginFactory } from "gui-chat-protocol";
|
|
8
|
+
import { n as isWithinRoot, r as realpathSyncOrNull, t as isInsideRoot } from "../containment-Ne0w06jN.js";
|
|
9
|
+
import { constants as constants$1, mkdir, mkdtemp, open, readFile, rm, writeFile } from "node:fs/promises";
|
|
10
|
+
import { t as writeJsonAtomic } from "../json-C23c3t1W.js";
|
|
12
11
|
import { createGunzip } from "node:zlib";
|
|
12
|
+
import { n as writeFileAtomic } from "../atomic-Dw7dV4TL.js";
|
|
13
13
|
// src/runtime-plugins/ledger.ts
|
|
14
14
|
var hasValidSource = (value) => !Object.hasOwn(value, "source") || typeof value.source === "string";
|
|
15
15
|
var isLedgerEntry = (value) => hasStringProp(value, "name") && hasStringProp(value, "version") && hasStringProp(value, "tgz") && hasStringProp(value, "installedAt") && hasValidSource(value);
|
|
@@ -692,6 +692,71 @@ async function readLedgerForWrite(ledgerPath) {
|
|
|
692
692
|
} : parseLedgerText(ledgerPath, read.text);
|
|
693
693
|
}
|
|
694
694
|
var writeLedger = (ledgerPath, raw) => writeJsonAtomic(ledgerPath, raw);
|
|
695
|
+
// src/runtime-plugins/ledgerLock.ts
|
|
696
|
+
/** How long a writer waits for another to finish before giving up. */
|
|
697
|
+
var LEDGER_LOCK_WAIT_MS = 1e4;
|
|
698
|
+
var LEDGER_LOCK_RETRY_MS = 50;
|
|
699
|
+
var LedgerBusyError = class extends Error {};
|
|
700
|
+
var ledgerLockPath = (ledgerPath) => `${ledgerPath}.lock`;
|
|
701
|
+
var hasCode = (err, code) => isRecord(err) && err.code === code;
|
|
702
|
+
/** Creates the lock holding `token`; false when another writer holds it. A failed write leaves no lock. */
|
|
703
|
+
async function tryCreate(lockPath, token) {
|
|
704
|
+
const opened = await open(lockPath, "wx").catch((err) => {
|
|
705
|
+
if (hasCode(err, "EEXIST")) return null;
|
|
706
|
+
throw err;
|
|
707
|
+
});
|
|
708
|
+
if (opened === null) return false;
|
|
709
|
+
try {
|
|
710
|
+
await opened.writeFile(token);
|
|
711
|
+
} catch (err) {
|
|
712
|
+
await opened.close().catch(() => void 0);
|
|
713
|
+
await rm(lockPath, { force: true });
|
|
714
|
+
throw err;
|
|
715
|
+
}
|
|
716
|
+
await opened.close();
|
|
717
|
+
return true;
|
|
718
|
+
}
|
|
719
|
+
/** Removes the lock only while it still carries `token`: if someone removed it by hand, it is not ours. */
|
|
720
|
+
async function release(lockPath, token) {
|
|
721
|
+
const held = await readFile(lockPath).catch(() => null);
|
|
722
|
+
const ours = Buffer.from(token);
|
|
723
|
+
if (held !== null && held.length === ours.length && timingSafeEqual(held, ours)) await rm(lockPath, { force: true });
|
|
724
|
+
}
|
|
725
|
+
/** `kill(pid, 0)` sends nothing: ESRCH means no such process, EPERM means one we may not signal. */
|
|
726
|
+
function processIsRunning(pid) {
|
|
727
|
+
try {
|
|
728
|
+
process.kill(pid, 0);
|
|
729
|
+
return true;
|
|
730
|
+
} catch (err) {
|
|
731
|
+
return hasCode(err, "EPERM");
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
var PID_PREFIX = /^(\d+) /;
|
|
735
|
+
async function busyError(lockPath, ledgerPath, isRunning) {
|
|
736
|
+
const held = await readFile(lockPath, "utf-8").catch(() => "");
|
|
737
|
+
const pid = Number(PID_PREFIX.exec(held)?.[1] ?? NaN);
|
|
738
|
+
if (Number.isInteger(pid) && pid > 0 && !isRunning(pid)) return new LedgerBusyError(`${lockPath} was left by a writer that is no longer running (pid ${pid}); remove it and try again`);
|
|
739
|
+
return new LedgerBusyError(`another install or removal is editing ${ledgerPath}; try again when it finishes`);
|
|
740
|
+
}
|
|
741
|
+
var defaultSleep = (delayMs) => new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
742
|
+
/** Runs `work` holding the ledger's lock; throws LedgerBusyError when another writer keeps it past the wait. */
|
|
743
|
+
async function withLedgerLock(ledgerPath, work, deps = {}) {
|
|
744
|
+
const now = deps.now ?? Date.now;
|
|
745
|
+
const sleep = deps.sleep ?? defaultSleep;
|
|
746
|
+
const lockPath = ledgerLockPath(ledgerPath);
|
|
747
|
+
const token = `${process.pid} ${randomUUID()}\n`;
|
|
748
|
+
await mkdir(path.dirname(lockPath), { recursive: true });
|
|
749
|
+
const deadline = now() + (deps.waitMs ?? 1e4);
|
|
750
|
+
while (!await tryCreate(lockPath, token)) {
|
|
751
|
+
if (now() >= deadline) throw await busyError(lockPath, ledgerPath, deps.isRunning ?? processIsRunning);
|
|
752
|
+
await sleep(LEDGER_LOCK_RETRY_MS);
|
|
753
|
+
}
|
|
754
|
+
try {
|
|
755
|
+
return await work();
|
|
756
|
+
} finally {
|
|
757
|
+
await release(lockPath, token);
|
|
758
|
+
}
|
|
759
|
+
}
|
|
695
760
|
// src/runtime-plugins/download.ts
|
|
696
761
|
var DownloadError = class extends Error {};
|
|
697
762
|
async function readCapped(body, url, maxBytes, signal) {
|
|
@@ -1085,8 +1150,7 @@ async function preparePlan(source, deps) {
|
|
|
1085
1150
|
tgz,
|
|
1086
1151
|
replaces
|
|
1087
1152
|
},
|
|
1088
|
-
bytes: fetched.bytes
|
|
1089
|
-
raw: ledger.raw
|
|
1153
|
+
bytes: fetched.bytes
|
|
1090
1154
|
};
|
|
1091
1155
|
}
|
|
1092
1156
|
async function writePackageFile(plan, bytes, pluginsDir) {
|
|
@@ -1099,7 +1163,20 @@ async function writePackageFile(plan, bytes, pluginsDir) {
|
|
|
1099
1163
|
fileWasThere
|
|
1100
1164
|
};
|
|
1101
1165
|
}
|
|
1102
|
-
|
|
1166
|
+
var sameEntry = (left, right) => left === null || right === null ? left === right : left.version === right.version && left.tgz === right.tgz && left.installedAt === right.installedAt && (left.source ?? null) === (right.source ?? null);
|
|
1167
|
+
/** The ledger as it is now, under the lock, refused when the entry this install replaces is no longer
|
|
1168
|
+
* the one the plan showed: another writer installed or removed it while this one downloaded. */
|
|
1169
|
+
async function currentLedger(plan, deps) {
|
|
1170
|
+
const ledger = await readLedgerForWrite(deps.paths.ledgerPath);
|
|
1171
|
+
if (!ledger.ok) throw new InstallError(ledger.error);
|
|
1172
|
+
if (!sameEntry(parseLedger(ledger.raw).find((entry) => entry.name === plan.name) ?? null, plan.replaces)) throw new InstallError(`${plan.name} changed in the ledger while this install ran; check it again`);
|
|
1173
|
+
return ledger.raw;
|
|
1174
|
+
}
|
|
1175
|
+
async function commit(plan, bytes, deps) {
|
|
1176
|
+
return withLedgerLock(deps.paths.ledgerPath, () => commitLocked(plan, bytes, deps));
|
|
1177
|
+
}
|
|
1178
|
+
async function commitLocked(plan, bytes, deps) {
|
|
1179
|
+
const raw = await currentLedger(plan, deps);
|
|
1103
1180
|
const { tgzPath, fileWasThere } = await writePackageFile(plan, bytes, deps.paths.pluginsDir);
|
|
1104
1181
|
const installedAt = (deps.now ?? (() => /* @__PURE__ */ new Date()))().toISOString();
|
|
1105
1182
|
const entry = {
|
|
@@ -1118,7 +1195,7 @@ async function commit(plan, bytes, raw, deps) {
|
|
|
1118
1195
|
return entry;
|
|
1119
1196
|
}
|
|
1120
1197
|
var failure = (err, action) => {
|
|
1121
|
-
if (err instanceof InstallError || err instanceof DownloadError) return {
|
|
1198
|
+
if (err instanceof InstallError || err instanceof DownloadError || err instanceof LedgerBusyError) return {
|
|
1122
1199
|
status: "failed",
|
|
1123
1200
|
error: err.message
|
|
1124
1201
|
};
|
|
@@ -1135,14 +1212,14 @@ async function installRuntimePlugin(input, deps) {
|
|
|
1135
1212
|
error: parsed.error
|
|
1136
1213
|
};
|
|
1137
1214
|
try {
|
|
1138
|
-
const { plan, bytes
|
|
1215
|
+
const { plan, bytes } = await preparePlan(parsed.source, deps);
|
|
1139
1216
|
if (!await deps.confirm(plan)) return {
|
|
1140
1217
|
status: "cancelled",
|
|
1141
1218
|
plan
|
|
1142
1219
|
};
|
|
1143
1220
|
return {
|
|
1144
1221
|
status: "installed",
|
|
1145
|
-
entry: await commit(plan, bytes,
|
|
1222
|
+
entry: await commit(plan, bytes, deps),
|
|
1146
1223
|
replaced: plan.replaces
|
|
1147
1224
|
};
|
|
1148
1225
|
} catch (err) {
|
|
@@ -1151,6 +1228,13 @@ async function installRuntimePlugin(input, deps) {
|
|
|
1151
1228
|
}
|
|
1152
1229
|
/** Take `name` out of the ledger. Its package file, unpacked copy and data folders are left in place. */
|
|
1153
1230
|
async function uninstallRuntimePlugin(name, paths) {
|
|
1231
|
+
try {
|
|
1232
|
+
return await withLedgerLock(paths.ledgerPath, () => removeFromLedger(name, paths));
|
|
1233
|
+
} catch (err) {
|
|
1234
|
+
return failure(err, "uninstall");
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
async function removeFromLedger(name, paths) {
|
|
1154
1238
|
const ledger = await readLedgerForWrite(paths.ledgerPath);
|
|
1155
1239
|
if (!ledger.ok) return {
|
|
1156
1240
|
status: "failed",
|
|
@@ -1169,6 +1253,6 @@ async function uninstallRuntimePlugin(name, paths) {
|
|
|
1169
1253
|
entry
|
|
1170
1254
|
};
|
|
1171
1255
|
}
|
|
1172
|
-
export { DownloadError, EXTRACT_MARKER, GITHUB_API, NPM_REGISTRY, downloadBytes, downloadJson, ensureInsideBase, extractTgz, fetchPackage, inspectPackage, installRuntimePlugin, installedFileName, isCacheValid, isExactVersion, isLedgerEntry, isNpmPackageName, isNpmVersionSpec, linkLeadingOut, loadPluginFromCacheDir, matchesIntegrity, packageFileName, parseInstallSource, parseLedger, prepareLedgerEntry, readLedgerForWrite, resolveEntrySpecifier, resolveExecute, resolveGithubAsset, resolveNpmRelease, resolvesInside, sourceLabel, toPackageJson, uninstallRuntimePlugin, verifyGithubBytes, verifyNpmBytes, withLedgerEntry, withoutLedgerEntry, writeLedger };
|
|
1256
|
+
export { DownloadError, EXTRACT_MARKER, GITHUB_API, LEDGER_LOCK_WAIT_MS, LedgerBusyError, NPM_REGISTRY, downloadBytes, downloadJson, ensureInsideBase, extractTgz, fetchPackage, inspectPackage, installRuntimePlugin, installedFileName, isCacheValid, isExactVersion, isLedgerEntry, isNpmPackageName, isNpmVersionSpec, ledgerLockPath, linkLeadingOut, loadPluginFromCacheDir, matchesIntegrity, packageFileName, parseInstallSource, parseLedger, prepareLedgerEntry, processIsRunning, readLedgerForWrite, resolveEntrySpecifier, resolveExecute, resolveGithubAsset, resolveNpmRelease, resolvesInside, sourceLabel, toPackageJson, uninstallRuntimePlugin, verifyGithubBytes, verifyNpmBytes, withLedgerEntry, withLedgerLock, withoutLedgerEntry, writeLedger };
|
|
1173
1257
|
|
|
1174
1258
|
//# sourceMappingURL=index.js.map
|