@xrkseek/harness 0.2.7 → 0.3.1
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/node_modules/@xrkseek/core-tools/dist/settings-tools.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-tools/dist/settings-tools.js +10 -7
- package/node_modules/@xrkseek/core-tools/dist/settings-tools.js.map +1 -1
- package/node_modules/@xrkseek/preset-harness/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@xrkseek/preset-minimal/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@xrkseek/server-face/dist/adapt/index.d.ts +1 -0
- package/node_modules/@xrkseek/server-face/dist/adapt/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/adapt/index.js +1 -0
- package/node_modules/@xrkseek/server-face/dist/adapt/index.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/adapt/model-route.d.ts +37 -0
- package/node_modules/@xrkseek/server-face/dist/adapt/model-route.d.ts.map +1 -0
- package/node_modules/@xrkseek/server-face/dist/adapt/model-route.js +40 -0
- package/node_modules/@xrkseek/server-face/dist/adapt/model-route.js.map +1 -0
- package/node_modules/@xrkseek/server-face/dist/adapt/wire-event.d.ts +6 -0
- package/node_modules/@xrkseek/server-face/dist/adapt/wire-event.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/adapt/wire-event.js +6 -2
- package/node_modules/@xrkseek/server-face/dist/adapt/wire-event.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/context.d.ts +6 -0
- package/node_modules/@xrkseek/server-face/dist/context.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/cordis-bridge.d.ts +2 -0
- package/node_modules/@xrkseek/server-face/dist/cordis-bridge.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/cordis-bridge.js +2 -1
- package/node_modules/@xrkseek/server-face/dist/cordis-bridge.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/cost-meter-record.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/cost-meter-record.js +3 -2
- package/node_modules/@xrkseek/server-face/dist/cost-meter-record.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/handlers/remotes.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/handlers/remotes.js +12 -27
- package/node_modules/@xrkseek/server-face/dist/handlers/remotes.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/handlers/session.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/handlers/session.js +18 -5
- package/node_modules/@xrkseek/server-face/dist/handlers/session.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/index.d.ts +5 -2
- package/node_modules/@xrkseek/server-face/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/index.js +5 -2
- package/node_modules/@xrkseek/server-face/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/plugin-boot.d.ts +22 -0
- package/node_modules/@xrkseek/server-face/dist/plugin-boot.d.ts.map +1 -0
- package/node_modules/@xrkseek/server-face/dist/plugin-boot.js +92 -0
- package/node_modules/@xrkseek/server-face/dist/plugin-boot.js.map +1 -0
- package/node_modules/@xrkseek/server-face/dist/plugin-disabled.d.ts +6 -0
- package/node_modules/@xrkseek/server-face/dist/plugin-disabled.d.ts.map +1 -0
- package/node_modules/@xrkseek/server-face/dist/plugin-disabled.js +6 -0
- package/node_modules/@xrkseek/server-face/dist/plugin-disabled.js.map +1 -0
- package/node_modules/@xrkseek/server-face/dist/plugin-inventory.d.ts +41 -10
- package/node_modules/@xrkseek/server-face/dist/plugin-inventory.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/plugin-inventory.js +126 -98
- package/node_modules/@xrkseek/server-face/dist/plugin-inventory.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/projections/units/cost-usage.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/projections/units/cost-usage.js +3 -9
- package/node_modules/@xrkseek/server-face/dist/projections/units/cost-usage.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/runtime.d.ts +5 -0
- package/node_modules/@xrkseek/server-face/dist/runtime.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/runtime.js +14 -8
- package/node_modules/@xrkseek/server-face/dist/runtime.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/settings-credentials.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/settings-credentials.js +43 -2
- package/node_modules/@xrkseek/server-face/dist/settings-credentials.js.map +1 -1
- package/node_modules/@xrkseek/server-host/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-host/dist/index.js +39 -26
- package/node_modules/@xrkseek/server-host/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/server-http/dist/dsh-compat/market.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-http/dist/dsh-compat/market.js +3 -2
- package/node_modules/@xrkseek/server-http/dist/dsh-compat/market.js.map +1 -1
- package/node_modules/@xrkseek/server-http/dist/index.d.ts +2 -2
- package/node_modules/@xrkseek/server-http/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-http/dist/index.js +2 -2
- package/node_modules/@xrkseek/server-http/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/server-http/dist/xrk/plugin-mutate.d.ts +33 -0
- package/node_modules/@xrkseek/server-http/dist/xrk/plugin-mutate.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-http/dist/xrk/plugin-mutate.js +150 -38
- package/node_modules/@xrkseek/server-http/dist/xrk/plugin-mutate.js.map +1 -1
- package/node_modules/@xrkseek/server-http/dist/xrk/plugin-services.d.ts +2 -0
- package/node_modules/@xrkseek/server-http/dist/xrk/plugin-services.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-http/dist/xrk/plugin-services.js +17 -33
- package/node_modules/@xrkseek/server-http/dist/xrk/plugin-services.js.map +1 -1
- package/node_modules/@xrkseek/server-loader/dist/atomic-write.d.ts +2 -0
- package/node_modules/@xrkseek/server-loader/dist/atomic-write.d.ts.map +1 -0
- package/node_modules/@xrkseek/server-loader/dist/atomic-write.js +14 -0
- package/node_modules/@xrkseek/server-loader/dist/atomic-write.js.map +1 -0
- package/node_modules/@xrkseek/server-loader/dist/index.d.ts +2 -0
- package/node_modules/@xrkseek/server-loader/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-loader/dist/index.js +2 -0
- package/node_modules/@xrkseek/server-loader/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/server-loader/dist/managed-state.d.ts +86 -0
- package/node_modules/@xrkseek/server-loader/dist/managed-state.d.ts.map +1 -0
- package/node_modules/@xrkseek/server-loader/dist/managed-state.js +341 -0
- package/node_modules/@xrkseek/server-loader/dist/managed-state.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,GAGlB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAgB,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAqB,MAAM,UAAU,CAAC;AAC7E,OAAO,EAGN,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAiC,MAAM,cAAc,CAAC;AAChF,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,0BAA0B,EAC1B,uBAAuB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,aA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B,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,GAGtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,4BAA4B,GAE7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,uBAAuB,EACvB,4BAA4B,EAC5B,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,2BAA2B,EAC3B,oBAAoB,GACrB,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { atomicWriteText } from "@xrkseek/server-loader";
|
|
2
|
+
export interface ClientBootEntry {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly url: string;
|
|
5
|
+
readonly rev: string;
|
|
6
|
+
readonly inject: readonly string[];
|
|
7
|
+
readonly immediately?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface ClientBootReconcileResult {
|
|
10
|
+
readonly rev: string;
|
|
11
|
+
readonly entries: readonly ClientBootEntry[];
|
|
12
|
+
/** False when on-disk boot already matched (no rewrite / no cache bust). */
|
|
13
|
+
readonly wrote: boolean;
|
|
14
|
+
/** True when disabled file was rewritten (orphan prune and/or canonicalize). */
|
|
15
|
+
readonly prunedDisabled: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Rewrite `{pluginsDir}/web/boot.json` from `.xrk-plugins.json` client rows,
|
|
19
|
+
* omitting soft-disabled ids and pruning/canonicalizing the disabled file.
|
|
20
|
+
*/
|
|
21
|
+
export declare function reconcileClientBootAt(pluginsDir: string): ClientBootReconcileResult;
|
|
22
|
+
//# sourceMappingURL=plugin-boot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-boot.d.ts","sourceRoot":"","sources":["../src/plugin-boot.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,SAAS,eAAe,EAAE,CAAC;IAC7C,4EAA4E;IAC5E,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,gFAAgF;IAChF,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;CAClC;AAiBD;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,GACjB,yBAAyB,CAiF3B"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared client-plugin boot overlay reconcile (CLI + Face + Host).
|
|
3
|
+
* Soft-disable disk I/O lives in `@xrkseek/server-loader` (shared leaf).
|
|
4
|
+
* Boot writer stays here: content-stable rev + atomic replace.
|
|
5
|
+
*/
|
|
6
|
+
import { createHash } from "node:crypto";
|
|
7
|
+
import { existsSync, mkdirSync, readFileSync, rmSync } from "node:fs";
|
|
8
|
+
import path from "node:path";
|
|
9
|
+
import { atomicWriteText, canonicalizeDisabledPluginIdsAt, isPluginSoftDisabledAt, readDisabledPluginIdsAt, readManagedPackageIndexAt, readManagedPluginPackagesAt, writeDisabledPluginIdsAt, } from "@xrkseek/server-loader";
|
|
10
|
+
export { atomicWriteText } from "@xrkseek/server-loader";
|
|
11
|
+
function entriesFingerprint(entries) {
|
|
12
|
+
return createHash("sha256")
|
|
13
|
+
.update(JSON.stringify(entries))
|
|
14
|
+
.digest("hex")
|
|
15
|
+
.slice(0, 16);
|
|
16
|
+
}
|
|
17
|
+
function sameEntries(a, b) {
|
|
18
|
+
if (!a || a.length !== b.length)
|
|
19
|
+
return false;
|
|
20
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Rewrite `{pluginsDir}/web/boot.json` from `.xrk-plugins.json` client rows,
|
|
24
|
+
* omitting soft-disabled ids and pruning/canonicalizing the disabled file.
|
|
25
|
+
*/
|
|
26
|
+
export function reconcileClientBootAt(pluginsDir) {
|
|
27
|
+
const root = path.resolve(pluginsDir);
|
|
28
|
+
const index = readManagedPackageIndexAt(root);
|
|
29
|
+
const disabled = readDisabledPluginIdsAt(root);
|
|
30
|
+
const packages = readManagedPluginPackagesAt(root);
|
|
31
|
+
const entries = [];
|
|
32
|
+
for (const [name, entry] of packages) {
|
|
33
|
+
if (entry.kind !== "client" && entry.kind !== "both")
|
|
34
|
+
continue;
|
|
35
|
+
if (isPluginSoftDisabledAt(name, disabled, index))
|
|
36
|
+
continue;
|
|
37
|
+
entries.push({
|
|
38
|
+
id: name,
|
|
39
|
+
url: `/plugins/${name}/client.js`,
|
|
40
|
+
rev: entry.version ?? "0",
|
|
41
|
+
inject: entry.clientInject ?? [],
|
|
42
|
+
...(entry.clientImmediately ? { immediately: true } : {}),
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
const prunedDisabled = canonicalizeDisabledPluginIdsAt(root, disabled, index);
|
|
46
|
+
if (prunedDisabled)
|
|
47
|
+
writeDisabledPluginIdsAt(root, disabled);
|
|
48
|
+
entries.sort((a, b) => a.id.localeCompare(b.id));
|
|
49
|
+
const webDir = path.join(root, "web");
|
|
50
|
+
const bootPath = path.join(webDir, "boot.json");
|
|
51
|
+
if (entries.length === 0) {
|
|
52
|
+
if (existsSync(bootPath)) {
|
|
53
|
+
rmSync(bootPath, { force: true });
|
|
54
|
+
return {
|
|
55
|
+
rev: `xrk-plugins-empty`,
|
|
56
|
+
entries,
|
|
57
|
+
wrote: true,
|
|
58
|
+
prunedDisabled,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
rev: `xrk-plugins-empty`,
|
|
63
|
+
entries,
|
|
64
|
+
wrote: false,
|
|
65
|
+
prunedDisabled,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
let previous;
|
|
69
|
+
if (existsSync(bootPath)) {
|
|
70
|
+
try {
|
|
71
|
+
previous = JSON.parse(readFileSync(bootPath, "utf8"));
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
previous = undefined;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (sameEntries(previous?.entries, entries)) {
|
|
78
|
+
return {
|
|
79
|
+
rev: typeof previous?.rev === "string" && previous.rev
|
|
80
|
+
? previous.rev
|
|
81
|
+
: `xrk-plugins-${entriesFingerprint(entries)}`,
|
|
82
|
+
entries,
|
|
83
|
+
wrote: false,
|
|
84
|
+
prunedDisabled,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const rev = `xrk-plugins-${entriesFingerprint(entries)}`;
|
|
88
|
+
mkdirSync(webDir, { recursive: true });
|
|
89
|
+
atomicWriteText(bootPath, `${JSON.stringify({ rev, entries }, null, 2)}\n`);
|
|
90
|
+
return { rev, entries, wrote: true, prunedDisabled };
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=plugin-boot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-boot.js","sourceRoot":"","sources":["../src/plugin-boot.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EA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,CAAC;IAED,IAAI,QAES,CAAC;IACd,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACzB,IAAI,CAAC;YACH,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAGnD,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,QAAQ,GAAG,SAAS,CAAC;QACvB,CAAC;IACH,CAAC;IAED,IAAI,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;QAC5C,OAAO;YACL,GAAG,EACD,OAAO,QAAQ,EAAE,GAAG,KAAK,QAAQ,IAAI,QAAQ,CAAC,GAAG;gBAC/C,CAAC,CAAC,QAAQ,CAAC,GAAG;gBACd,CAAC,CAAC,eAAe,kBAAkB,CAAC,OAAO,CAAC,EAAE;YAClD,OAAO;YACP,KAAK,EAAE,KAAK;YACZ,cAAc;SACf,CAAC;IACJ,CAAC;IAED,MAAM,GAAG,GAAG,eAAe,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC;IACzD,SAAS,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACvC,eAAe,CACb,QAAQ,EACR,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CACjD,CAAC;IACF,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Soft-disable helpers — leaf implementation lives in `@xrkseek/server-loader`
|
|
3
|
+
* so HTTP / Face / Host / CLI share one disk contract without Face↔HTTP cycles.
|
|
4
|
+
*/
|
|
5
|
+
export { DISABLED_PLUGINS_FILE, MANAGED_PLUGINS_INVENTORY_FILE, canonicalizeDisabledPluginIdsAt, clearSoftDisabledIdsAt, disabledPluginsPath, isPluginSoftDisabledAt, lookupManagedPluginSourceAt, managedPluginsInventoryPath, readDisabledPluginIdsAt, readManagedPackageIndexAt, readManagedPluginPackagesAt, setSoftDisabledAt, writeDisabledPluginIdsAt, type ManagedPackageIndex, type ManagedPluginPackageMeta, } from "@xrkseek/server-loader";
|
|
6
|
+
//# sourceMappingURL=plugin-disabled.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-disabled.d.ts","sourceRoot":"","sources":["../src/plugin-disabled.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,qBAAqB,EACrB,8BAA8B,EAC9B,+BAA+B,EAC/B,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC3B,uBAAuB,EACvB,yBAAyB,EACzB,2BAA2B,EAC3B,iBAAiB,EACjB,wBAAwB,EACxB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,GAC9B,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Soft-disable helpers — leaf implementation lives in `@xrkseek/server-loader`
|
|
3
|
+
* so HTTP / Face / Host / CLI share one disk contract without Face↔HTTP cycles.
|
|
4
|
+
*/
|
|
5
|
+
export { DISABLED_PLUGINS_FILE, MANAGED_PLUGINS_INVENTORY_FILE, canonicalizeDisabledPluginIdsAt, clearSoftDisabledIdsAt, disabledPluginsPath, isPluginSoftDisabledAt, lookupManagedPluginSourceAt, managedPluginsInventoryPath, readDisabledPluginIdsAt, readManagedPackageIndexAt, readManagedPluginPackagesAt, setSoftDisabledAt, writeDisabledPluginIdsAt, } from "@xrkseek/server-loader";
|
|
6
|
+
//# sourceMappingURL=plugin-disabled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-disabled.js","sourceRoot":"","sources":["../src/plugin-disabled.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,qBAAqB,EACrB,8BAA8B,EAC9B,+BAA+B,EAC/B,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC3B,uBAAuB,EACvB,yBAAyB,EACzB,2BAA2B,EAC3B,iBAAiB,EACjB,wBAAwB,GAGzB,MAAM,wBAAwB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ToolDefinition } from "@xrkseek/core-tools";
|
|
2
2
|
import type { FaceRuntime } from "./context.js";
|
|
3
|
+
export { DISABLED_PLUGINS_FILE, clearSoftDisabledIdsAt, canonicalizeDisabledPluginIdsAt, isPluginSoftDisabledAt, lookupManagedPluginSourceAt, readDisabledPluginIdsAt, readManagedPackageIndexAt, readManagedPluginPackagesAt, setSoftDisabledAt, writeDisabledPluginIdsAt, } from "./plugin-disabled.js";
|
|
3
4
|
/** DSH `pluginInventory/list` fiber phase. */
|
|
4
5
|
export type FacePluginFiberPhase = "pending" | "loading" | "active" | "failed" | "unloading" | null;
|
|
5
6
|
export interface FacePluginInventoryEntry {
|
|
@@ -12,6 +13,22 @@ export interface FacePluginInventoryEntry {
|
|
|
12
13
|
* edit / disable / delete. Built-in product-shell and MCP rows stay false.
|
|
13
14
|
*/
|
|
14
15
|
readonly managed: boolean;
|
|
16
|
+
/** CLI inventory version when known (Codex-style plugin summary). */
|
|
17
|
+
readonly version?: string;
|
|
18
|
+
/** `client` | `process` | `both` | `mcp` | `cordis` | `builtin`. */
|
|
19
|
+
readonly kind?: string;
|
|
20
|
+
/** Original `plugin add` spec when managed. */
|
|
21
|
+
readonly source?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Soft-disable / re-enable / install changed disk state but this Host
|
|
24
|
+
* process still has the opposite live set — restart to apply.
|
|
25
|
+
*/
|
|
26
|
+
readonly needsRestart?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface FaceManagedPluginMeta {
|
|
29
|
+
readonly version?: string;
|
|
30
|
+
readonly kind?: string;
|
|
31
|
+
readonly source?: string;
|
|
15
32
|
}
|
|
16
33
|
export interface FaceWebPlugin {
|
|
17
34
|
readonly id: string;
|
|
@@ -48,23 +65,37 @@ export interface FaceProcessPlugin {
|
|
|
48
65
|
/** MCP supervisor health (Host `mcp:*` plugins). */
|
|
49
66
|
readonly mcpHealth?: "connected" | "reconnecting" | "gave-up";
|
|
50
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Managed plugins root: Host `pluginsDir` (incl. `XRK_PLUGINS_DIR`) wins;
|
|
70
|
+
* otherwise `{harnessHome}/plugins`.
|
|
71
|
+
*/
|
|
72
|
+
export declare function resolveManagedPluginsDir(runtime: Pick<FaceRuntime, "productDir" | "hostPublic">): string;
|
|
73
|
+
/**
|
|
74
|
+
* Reinstall/update spec: keep registry / github sources; local path installs
|
|
75
|
+
* are cwd-sensitive after Host restart → fall back to `name@latest`.
|
|
76
|
+
*/
|
|
77
|
+
export declare function resolveManagedPluginUpdateSpec(entryId: string, source: string | undefined): string;
|
|
51
78
|
/** Package names recorded by `xrk-harness plugin add`. */
|
|
52
|
-
export declare function readUserPluginNames(runtime: Pick<FaceRuntime, "productDir">): Set<string>;
|
|
53
|
-
/**
|
|
54
|
-
export declare function
|
|
79
|
+
export declare function readUserPluginNames(runtime: Pick<FaceRuntime, "productDir" | "hostPublic">): Set<string>;
|
|
80
|
+
/** CLI inventory rows keyed by package name (version / kind / source). */
|
|
81
|
+
export declare function readUserPluginPackages(runtime: Pick<FaceRuntime, "productDir" | "hostPublic">): Map<string, FaceManagedPluginMeta>;
|
|
55
82
|
/** Soft-disabled managed plugin ids (Settings inventory toggle). */
|
|
56
|
-
export declare function readDisabledPluginIds(runtime: Pick<FaceRuntime, "productDir">): Set<string>;
|
|
57
|
-
export declare function writeDisabledPluginIds(runtime: Pick<FaceRuntime, "productDir">, ids: ReadonlySet<string>): void;
|
|
83
|
+
export declare function readDisabledPluginIds(runtime: Pick<FaceRuntime, "productDir" | "hostPublic">): Set<string>;
|
|
84
|
+
export declare function writeDisabledPluginIds(runtime: Pick<FaceRuntime, "productDir" | "hostPublic">, ids: ReadonlySet<string>): void;
|
|
58
85
|
/** Absolute install directory for a managed plugin, if it exists on disk. */
|
|
59
|
-
export declare function resolveManagedPluginDir(runtime: Pick<FaceRuntime, "productDir">, entryId: string, moduleName?: string): string | undefined;
|
|
86
|
+
export declare function resolveManagedPluginDir(runtime: Pick<FaceRuntime, "productDir" | "hostPublic">, entryId: string, moduleName?: string): string | undefined;
|
|
60
87
|
/**
|
|
61
|
-
* Rewrite `{pluginsDir}/web/boot.json` from inventory client rows
|
|
62
|
-
*
|
|
88
|
+
* Rewrite `{pluginsDir}/web/boot.json` from inventory client rows.
|
|
89
|
+
* Delegates to shared {@link reconcileClientBootAt} (stable rev · atomic write).
|
|
63
90
|
*/
|
|
64
|
-
export declare function reconcileManagedClientBoot(runtime: Pick<FaceRuntime, "productDir">): void;
|
|
91
|
+
export declare function reconcileManagedClientBoot(runtime: Pick<FaceRuntime, "productDir" | "hostPublic">): void;
|
|
65
92
|
/**
|
|
66
93
|
* Host process plugins first (user-managed sorted ahead), then product-shell
|
|
67
|
-
* boot entries
|
|
94
|
+
* boot entries, then CLI inventory packages missing from live boot.
|
|
95
|
+
*
|
|
96
|
+
* Soft-disabled client packages are dropped from `web/boot.json` (and thus from
|
|
97
|
+
* Host `webPlugins`) so they do not load — but Settings must still list them
|
|
98
|
+
* from `.xrk-plugins.json`, otherwise there is no row to re-enable.
|
|
68
99
|
*/
|
|
69
100
|
export declare function listFacePluginInventory(runtime: Pick<FaceRuntime, "plugins" | "webPlugins" | "hostPublic" | "productDir">): FacePluginInventoryEntry[];
|
|
70
101
|
export declare function collectFacePluginCommands(plugins: readonly FaceProcessPlugin[] | undefined): readonly FacePluginCommand[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-inventory.d.ts","sourceRoot":"","sources":["../src/plugin-inventory.ts"],"names":[],"m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AG,YAAY,GAAG,YAAY,GAAG,YAAY,CACvD,GACA,wBAAwB,EAAE,CAuG5B;AAED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,SAAS,iBAAiB,EAAE,GAAG,SAAS,GAChD,SAAS,iBAAiB,EAAE,CAY9B;AAED,0DAA0D;AAC1D,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,YAAY,GAAG,YAAY,GAAG,YAAY,CAAC,EAClF,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,GACf;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAY7C"}
|
|
@@ -3,51 +3,64 @@
|
|
|
3
3
|
* User-installed packages (`~/.xrk/plugins/.xrk-plugins.json`) are marked
|
|
4
4
|
* `managed` so the Settings inventory can pin them and offer remove/disable.
|
|
5
5
|
*/
|
|
6
|
-
import { existsSync
|
|
6
|
+
import { existsSync } from "node:fs";
|
|
7
7
|
import path from "node:path";
|
|
8
|
-
import {
|
|
8
|
+
import { isPluginSoftDisabledAt, readDisabledPluginIdsAt, readManagedPackageIndexAt, readManagedPluginPackagesAt, setSoftDisabledAt, writeDisabledPluginIdsAt, } from "@xrkseek/server-loader";
|
|
9
|
+
import { resolveCordisFiberState, hasStagedCordisClient } from "./cordis-bridge.js";
|
|
10
|
+
import { reconcileClientBootAt } from "./plugin-boot.js";
|
|
9
11
|
import { resolveHarnessHome } from "./settings-document.js";
|
|
10
|
-
|
|
12
|
+
export { DISABLED_PLUGINS_FILE, clearSoftDisabledIdsAt, canonicalizeDisabledPluginIdsAt, isPluginSoftDisabledAt, lookupManagedPluginSourceAt, readDisabledPluginIdsAt, readManagedPackageIndexAt, readManagedPluginPackagesAt, setSoftDisabledAt, writeDisabledPluginIdsAt, } from "./plugin-disabled.js";
|
|
13
|
+
/**
|
|
14
|
+
* Managed plugins root: Host `pluginsDir` (incl. `XRK_PLUGINS_DIR`) wins;
|
|
15
|
+
* otherwise `{harnessHome}/plugins`.
|
|
16
|
+
*/
|
|
17
|
+
export function resolveManagedPluginsDir(runtime) {
|
|
18
|
+
const fromHost = runtime.hostPublic?.pluginsDir?.trim();
|
|
19
|
+
if (fromHost)
|
|
20
|
+
return path.resolve(fromHost);
|
|
11
21
|
return path.join(resolveHarnessHome(runtime), "plugins");
|
|
12
22
|
}
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
/** Alias used by inventory helpers in this module. */
|
|
24
|
+
function pluginsDirOf(runtime) {
|
|
25
|
+
return resolveManagedPluginsDir(runtime);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Reinstall/update spec: keep registry / github sources; local path installs
|
|
29
|
+
* are cwd-sensitive after Host restart → fall back to `name@latest`.
|
|
30
|
+
*/
|
|
31
|
+
export function resolveManagedPluginUpdateSpec(entryId, source) {
|
|
32
|
+
const id = entryId.trim();
|
|
33
|
+
const s = source?.trim();
|
|
34
|
+
if (!id)
|
|
35
|
+
return "unknown@latest";
|
|
36
|
+
if (!s)
|
|
37
|
+
return `${id}@latest`;
|
|
38
|
+
if (/^(file:|link:)/i.test(s))
|
|
39
|
+
return `${id}@latest`;
|
|
40
|
+
if (path.isAbsolute(s) || s.startsWith("."))
|
|
41
|
+
return `${id}@latest`;
|
|
42
|
+
// Unscoped path-like strings (`ext/pkg`) without a registry/git scheme.
|
|
43
|
+
if (!s.startsWith("@") &&
|
|
44
|
+
!s.includes("@") &&
|
|
45
|
+
!/^[a-z][a-z0-9+.-]*:/i.test(s) &&
|
|
46
|
+
/[/\\]/.test(s)) {
|
|
47
|
+
return `${id}@latest`;
|
|
28
48
|
}
|
|
29
|
-
return
|
|
49
|
+
return s;
|
|
30
50
|
}
|
|
31
|
-
|
|
32
|
-
|
|
51
|
+
/** Package names recorded by `xrk-harness plugin add`. */
|
|
52
|
+
export function readUserPluginNames(runtime) {
|
|
53
|
+
return new Set(readUserPluginPackages(runtime).keys());
|
|
33
54
|
}
|
|
34
|
-
/**
|
|
35
|
-
export function
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return out;
|
|
44
|
-
for (const id of raw.ids) {
|
|
45
|
-
if (typeof id === "string" && id.trim())
|
|
46
|
-
out.add(id.trim());
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
catch {
|
|
50
|
-
/* empty */
|
|
55
|
+
/** CLI inventory rows keyed by package name (version / kind / source). */
|
|
56
|
+
export function readUserPluginPackages(runtime) {
|
|
57
|
+
const out = new Map();
|
|
58
|
+
for (const [name, meta] of readManagedPluginPackagesAt(pluginsDirOf(runtime))) {
|
|
59
|
+
out.set(name, {
|
|
60
|
+
...(meta.version ? { version: meta.version } : {}),
|
|
61
|
+
...(meta.kind ? { kind: meta.kind } : {}),
|
|
62
|
+
...(meta.source ? { source: meta.source } : {}),
|
|
63
|
+
});
|
|
51
64
|
}
|
|
52
65
|
return out;
|
|
53
66
|
}
|
|
@@ -56,9 +69,7 @@ export function readDisabledPluginIds(runtime) {
|
|
|
56
69
|
return readDisabledPluginIdsAt(pluginsDirOf(runtime));
|
|
57
70
|
}
|
|
58
71
|
export function writeDisabledPluginIds(runtime, ids) {
|
|
59
|
-
|
|
60
|
-
mkdirSync(dir, { recursive: true });
|
|
61
|
-
writeFileSync(disabledListPath(dir), `${JSON.stringify({ ids: [...ids].sort() }, null, 2)}\n`, "utf8");
|
|
72
|
+
writeDisabledPluginIdsAt(pluginsDirOf(runtime), ids);
|
|
62
73
|
}
|
|
63
74
|
/** Absolute install directory for a managed plugin, if it exists on disk. */
|
|
64
75
|
export function resolveManagedPluginDir(runtime, entryId, moduleName) {
|
|
@@ -80,72 +91,48 @@ export function resolveManagedPluginDir(runtime, entryId, moduleName) {
|
|
|
80
91
|
return undefined;
|
|
81
92
|
}
|
|
82
93
|
/**
|
|
83
|
-
* Rewrite `{pluginsDir}/web/boot.json` from inventory client rows
|
|
84
|
-
*
|
|
94
|
+
* Rewrite `{pluginsDir}/web/boot.json` from inventory client rows.
|
|
95
|
+
* Delegates to shared {@link reconcileClientBootAt} (stable rev · atomic write).
|
|
85
96
|
*/
|
|
86
97
|
export function reconcileManagedClientBoot(runtime) {
|
|
87
|
-
|
|
88
|
-
const invPath = path.join(root, ".xrk-plugins.json");
|
|
89
|
-
const disabled = readDisabledPluginIdsAt(root);
|
|
90
|
-
const entries = [];
|
|
91
|
-
if (existsSync(invPath)) {
|
|
92
|
-
try {
|
|
93
|
-
const raw = JSON.parse(readFileSync(invPath, "utf8"));
|
|
94
|
-
for (const entry of Object.values(raw.packages ?? {})) {
|
|
95
|
-
const name = entry.name?.trim();
|
|
96
|
-
if (!name)
|
|
97
|
-
continue;
|
|
98
|
-
if (entry.kind !== "client" && entry.kind !== "both")
|
|
99
|
-
continue;
|
|
100
|
-
if (disabled.has(name))
|
|
101
|
-
continue;
|
|
102
|
-
entries.push({
|
|
103
|
-
id: name,
|
|
104
|
-
url: `/plugins/${name}/client.js`,
|
|
105
|
-
rev: typeof entry.version === "string" ? entry.version : "0",
|
|
106
|
-
inject: entry.clientInject ?? [],
|
|
107
|
-
...(entry.clientImmediately ? { immediately: true } : {}),
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
catch {
|
|
112
|
-
/* leave entries empty → drop stale boot.json */
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
entries.sort((a, b) => a.id.localeCompare(b.id));
|
|
116
|
-
const webDir = path.join(root, "web");
|
|
117
|
-
mkdirSync(webDir, { recursive: true });
|
|
118
|
-
const bootPath = path.join(webDir, "boot.json");
|
|
119
|
-
if (entries.length === 0) {
|
|
120
|
-
if (existsSync(bootPath))
|
|
121
|
-
rmSync(bootPath, { force: true });
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
writeFileSync(bootPath, `${JSON.stringify({ rev: `xrk-plugins-${Date.now()}`, entries }, null, 2)}\n`, "utf8");
|
|
98
|
+
reconcileClientBootAt(pluginsDirOf(runtime));
|
|
125
99
|
}
|
|
126
|
-
function isManagedProcessPlugin(plugin, userNames) {
|
|
100
|
+
function isManagedProcessPlugin(plugin, userNames, runtime) {
|
|
127
101
|
if (plugin.id.startsWith("mcp:"))
|
|
128
102
|
return false;
|
|
129
103
|
if (userNames.has(plugin.id))
|
|
130
104
|
return true;
|
|
131
|
-
//
|
|
132
|
-
|
|
133
|
-
|
|
105
|
+
// Only staged / inventory community cordis are managed — not product-shell
|
|
106
|
+
// cordis stubs (those must not gain Settings disable/delete).
|
|
107
|
+
if (plugin.kind === "cordis") {
|
|
108
|
+
return hasStagedCordisClient(runtime, plugin.id);
|
|
109
|
+
}
|
|
134
110
|
return false;
|
|
135
111
|
}
|
|
136
112
|
/**
|
|
137
113
|
* Host process plugins first (user-managed sorted ahead), then product-shell
|
|
138
|
-
* boot entries
|
|
114
|
+
* boot entries, then CLI inventory packages missing from live boot.
|
|
115
|
+
*
|
|
116
|
+
* Soft-disabled client packages are dropped from `web/boot.json` (and thus from
|
|
117
|
+
* Host `webPlugins`) so they do not load — but Settings must still list them
|
|
118
|
+
* from `.xrk-plugins.json`, otherwise there is no row to re-enable.
|
|
139
119
|
*/
|
|
140
120
|
export function listFacePluginInventory(runtime) {
|
|
141
121
|
const seen = new Set();
|
|
122
|
+
const liveIds = new Set();
|
|
142
123
|
const entries = [];
|
|
143
|
-
const
|
|
124
|
+
const packages = readUserPluginPackages(runtime);
|
|
125
|
+
const userNames = new Set(packages.keys());
|
|
144
126
|
const disabled = readDisabledPluginIds(runtime);
|
|
145
|
-
const
|
|
127
|
+
const packageIndex = readManagedPackageIndexAt(pluginsDirOf(runtime));
|
|
128
|
+
const softDisabledOf = (...ids) => ids.some((id) => isPluginSoftDisabledAt(id, disabled, packageIndex));
|
|
129
|
+
const metaOf = (id) => packages.get(id) ?? {};
|
|
130
|
+
const push = (entry, options = {}) => {
|
|
146
131
|
if (seen.has(entry.entryId))
|
|
147
132
|
return;
|
|
148
133
|
seen.add(entry.entryId);
|
|
134
|
+
if (options.live)
|
|
135
|
+
liveIds.add(entry.entryId);
|
|
149
136
|
entries.push(entry);
|
|
150
137
|
};
|
|
151
138
|
for (const plugin of runtime.plugins ?? []) {
|
|
@@ -153,27 +140,68 @@ export function listFacePluginInventory(runtime) {
|
|
|
153
140
|
const fiber = cordis
|
|
154
141
|
? resolveCordisFiberState(runtime, plugin.id)
|
|
155
142
|
: { enabled: true, fiberPhase: "active" };
|
|
156
|
-
const managed = isManagedProcessPlugin(plugin, userNames);
|
|
157
|
-
const softDisabled = managed &&
|
|
143
|
+
const managed = isManagedProcessPlugin(plugin, userNames, runtime);
|
|
144
|
+
const softDisabled = managed && softDisabledOf(plugin.id);
|
|
145
|
+
const meta = metaOf(plugin.id);
|
|
146
|
+
const kind = meta.kind ??
|
|
147
|
+
(plugin.id.startsWith("mcp:")
|
|
148
|
+
? "mcp"
|
|
149
|
+
: cordis
|
|
150
|
+
? "cordis"
|
|
151
|
+
: "process");
|
|
158
152
|
push({
|
|
159
153
|
entryId: plugin.id,
|
|
160
154
|
moduleName: plugin.id,
|
|
161
155
|
enabled: softDisabled ? false : fiber.enabled,
|
|
162
156
|
fiberPhase: softDisabled ? null : fiber.fiberPhase,
|
|
163
157
|
managed,
|
|
164
|
-
|
|
158
|
+
...(meta.version ? { version: meta.version } : {}),
|
|
159
|
+
kind,
|
|
160
|
+
...(meta.source ? { source: meta.source } : {}),
|
|
161
|
+
}, { live: true });
|
|
165
162
|
}
|
|
166
163
|
for (const web of runtime.webPlugins ?? []) {
|
|
167
164
|
const managed = userNames.has(web.id) || userNames.has(web.moduleName ?? "");
|
|
168
|
-
const softDisabled = managed &&
|
|
165
|
+
const softDisabled = managed && softDisabledOf(web.id, web.moduleName ?? "");
|
|
166
|
+
const meta = packages.get(web.id) ?? packages.get(web.moduleName ?? "") ?? {};
|
|
169
167
|
push({
|
|
170
168
|
entryId: web.id,
|
|
171
169
|
moduleName: web.moduleName ?? web.id,
|
|
172
170
|
enabled: softDisabled ? false : true,
|
|
173
171
|
fiberPhase: softDisabled ? null : "active",
|
|
174
172
|
managed,
|
|
173
|
+
...(meta.version ? { version: meta.version } : {}),
|
|
174
|
+
kind: meta.kind ?? "client",
|
|
175
|
+
...(meta.source ? { source: meta.source } : {}),
|
|
176
|
+
}, { live: true });
|
|
177
|
+
}
|
|
178
|
+
// Inventory is the durable source for managed packages. Client-only rows that
|
|
179
|
+
// were soft-disabled (or installed after this Host start) are not in webPlugins.
|
|
180
|
+
for (const [name, meta] of packages) {
|
|
181
|
+
if (seen.has(name))
|
|
182
|
+
continue;
|
|
183
|
+
const softDisabled = softDisabledOf(name);
|
|
184
|
+
push({
|
|
185
|
+
entryId: name,
|
|
186
|
+
moduleName: name,
|
|
187
|
+
enabled: !softDisabled,
|
|
188
|
+
fiberPhase: null,
|
|
189
|
+
managed: true,
|
|
190
|
+
...(meta.version ? { version: meta.version } : {}),
|
|
191
|
+
kind: meta.kind ?? "client",
|
|
192
|
+
...(meta.source ? { source: meta.source } : {}),
|
|
175
193
|
});
|
|
176
194
|
}
|
|
195
|
+
for (let i = 0; i < entries.length; i++) {
|
|
196
|
+
const entry = entries[i];
|
|
197
|
+
if (!entry.managed)
|
|
198
|
+
continue;
|
|
199
|
+
const live = liveIds.has(entry.entryId);
|
|
200
|
+
const needsRestart = (entry.enabled && !live) || (!entry.enabled && live);
|
|
201
|
+
if (!needsRestart)
|
|
202
|
+
continue;
|
|
203
|
+
entries[i] = { ...entry, needsRestart: true };
|
|
204
|
+
}
|
|
177
205
|
entries.sort((a, b) => {
|
|
178
206
|
if (a.managed !== b.managed)
|
|
179
207
|
return a.managed ? -1 : 1;
|
|
@@ -203,12 +231,12 @@ export function setFacePluginInventoryEnabled(runtime, entryId, enabled) {
|
|
|
203
231
|
return { ok: false, error: "plugin not found" };
|
|
204
232
|
if (!entry.managed)
|
|
205
233
|
return { ok: false, error: "builtin plugins cannot be toggled here" };
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
234
|
+
// Durable key = CLI inventory package name; aliases stripped on write.
|
|
235
|
+
setSoftDisabledAt(pluginsDirOf(runtime), {
|
|
236
|
+
enabled,
|
|
237
|
+
entryId: entry.entryId,
|
|
238
|
+
aliases: [entry.moduleName],
|
|
239
|
+
});
|
|
212
240
|
reconcileManagedClientBoot(runtime);
|
|
213
241
|
return { ok: true };
|
|
214
242
|
}
|