@mulmoclaude/core 7.3.0 → 7.4.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 +1 -1
- package/dist/plugin-vue/index.cjs +185 -31
- package/dist/plugin-vue/index.cjs.map +1 -1
- package/dist/plugin-vue/index.js +185 -31
- package/dist/plugin-vue/index.js.map +1 -1
- package/dist/runtime-plugins/extract.d.ts +19 -0
- package/dist/runtime-plugins/index.cjs +329 -0
- package/dist/runtime-plugins/index.cjs.map +1 -0
- package/dist/runtime-plugins/index.d.ts +4 -0
- package/dist/runtime-plugins/index.js +316 -0
- package/dist/runtime-plugins/index.js.map +1 -0
- package/dist/runtime-plugins/ledger.d.ts +14 -0
- package/dist/runtime-plugins/load.d.ts +77 -0
- package/dist/runtime-plugins/packageJson.d.ts +29 -0
- package/package.json +8 -2
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Sentinel file written at the end of a successful extract. The
|
|
2
|
+
* loader uses its presence (not just `existsSync(cachePath)`) as the
|
|
3
|
+
* cache-validity check, so a partial extract (interrupted tar, ENOSPC
|
|
4
|
+
* half-write) is detected and re-extracted on the next boot instead
|
|
5
|
+
* of becoming a permanent broken state. */
|
|
6
|
+
export declare const EXTRACT_MARKER = ".extract-complete";
|
|
7
|
+
export declare function isCacheValid(cachePath: string): boolean;
|
|
8
|
+
/** Run `tar xzf` to extract a tgz into the version-keyed cache slot.
|
|
9
|
+
* `--strip-components=1` drops the `package/` prefix that npm packs
|
|
10
|
+
* add. `execFileSync` (not `execSync`) so paths bypass shell parsing
|
|
11
|
+
* and never trip on metacharacters in workspace paths. Synchronous
|
|
12
|
+
* because boot is single-threaded and the alternative (a stream
|
|
13
|
+
* pipeline) adds dependencies for no benefit.
|
|
14
|
+
*
|
|
15
|
+
* On failure, the partial directory is removed so the next boot
|
|
16
|
+
* re-extracts cleanly (no sticky broken state). The completion
|
|
17
|
+
* marker is written ONLY after tar exits 0 — readers should test
|
|
18
|
+
* `isCacheValid()`, not `existsSync(cachePath)`. */
|
|
19
|
+
export declare function extractTgz(tgzAbs: string, destDir: string): void;
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_rolldown_runtime = require("../rolldown-runtime-CmQyd0Gu.cjs");
|
|
3
|
+
const require_dist = require("../dist-734JaRYi.cjs");
|
|
4
|
+
const require_containment = require("../containment-Dc3gO4wD.cjs");
|
|
5
|
+
let gui_chat_protocol = require("gui-chat-protocol");
|
|
6
|
+
let node_fs = require("node:fs");
|
|
7
|
+
let node_path = require("node:path");
|
|
8
|
+
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
9
|
+
let node_child_process = require("node:child_process");
|
|
10
|
+
let node_url = require("node:url");
|
|
11
|
+
// src/runtime-plugins/ledger.ts
|
|
12
|
+
var isLedgerEntry = (value) => require_dist.hasStringProp(value, "name") && require_dist.hasStringProp(value, "version") && require_dist.hasStringProp(value, "tgz") && require_dist.hasStringProp(value, "installedAt");
|
|
13
|
+
/** The well-formed entries of a parsed ledger; anything that is not an array reads as empty. */
|
|
14
|
+
var parseLedger = (raw) => {
|
|
15
|
+
if (!Array.isArray(raw)) return [];
|
|
16
|
+
return raw.filter(isLedgerEntry);
|
|
17
|
+
};
|
|
18
|
+
// src/runtime-plugins/packageJson.ts
|
|
19
|
+
var optionalString = (value) => typeof value === "string" ? value : void 0;
|
|
20
|
+
/** Rebuild the fields the loader reads from arbitrary parsed JSON.
|
|
21
|
+
* Field-by-field rather than a predicate, so a plugin shipping a
|
|
22
|
+
* non-string `main` can't reach `path.join` as if it were one.
|
|
23
|
+
* Returns null when the parsed value isn't an object at all. */
|
|
24
|
+
function toPackageJson(value) {
|
|
25
|
+
if (!require_dist.isRecord(value)) return null;
|
|
26
|
+
return {
|
|
27
|
+
name: optionalString(value.name),
|
|
28
|
+
version: optionalString(value.version),
|
|
29
|
+
exports: value.exports,
|
|
30
|
+
main: optionalString(value.main),
|
|
31
|
+
module: optionalString(value.module)
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/** Resolve the entry-point path from a plugin's `package.json`. Covers
|
|
35
|
+
* the four legal `exports` shapes per the Node.js spec, then falls
|
|
36
|
+
* through to `module` / `main` for legacy packages.
|
|
37
|
+
*
|
|
38
|
+
* Legal `exports` forms (Node.js docs):
|
|
39
|
+
* 1. String sugar: `"exports": "./index.js"`
|
|
40
|
+
* 2. Conditional root: `"exports": { "import": "./esm.js", … }`
|
|
41
|
+
* 3. Subpath map: `"exports": { ".": "./index.js", "./util": "./util.js", … }`
|
|
42
|
+
* 4. Subpath + cond.: `"exports": { ".": { "import": "./esm.js", "require": "./cjs.js" } }`
|
|
43
|
+
*
|
|
44
|
+
* Earlier the loader only matched form (4) and fell straight through
|
|
45
|
+
* to `module` / `main`. Real npm packages using forms (1)-(3) failed
|
|
46
|
+
* to load (#1077 review). */
|
|
47
|
+
function resolveEntrySpecifier(pkg) {
|
|
48
|
+
const fromExports = resolveExportsField(pkg.exports);
|
|
49
|
+
if (fromExports) return fromExports;
|
|
50
|
+
if (typeof pkg.module === "string") return pkg.module;
|
|
51
|
+
if (typeof pkg.main === "string") return pkg.main;
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
function resolveExportsField(exportsField) {
|
|
55
|
+
const root = pickExportsTarget(exportsField);
|
|
56
|
+
if (root) return root;
|
|
57
|
+
if (require_dist.isRecord(exportsField)) return pickExportsTarget(exportsField["."]);
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
/** Walk a Node.js `exports` value and return the first string entry
|
|
61
|
+
* point this ESM loader can use. Handles every legal target shape:
|
|
62
|
+
*
|
|
63
|
+
* - string: return it directly.
|
|
64
|
+
* - array: try each element in order; first resolvable wins.
|
|
65
|
+
* Per the spec arrays are a fallback chain — Node tries each
|
|
66
|
+
* until one resolves on disk. We don't probe disk here, so
|
|
67
|
+
* "first string-or-resolvable-condition" approximates that.
|
|
68
|
+
* - condition object: prefer `import` (ESM-specific), then
|
|
69
|
+
* `default` (universal fallback).
|
|
70
|
+
* - everything else (e.g. only `require`, only nested arrays of
|
|
71
|
+
* condition objects with no string targets): null. */
|
|
72
|
+
function pickExportsTarget(value) {
|
|
73
|
+
if (typeof value === "string") return value;
|
|
74
|
+
if (Array.isArray(value)) {
|
|
75
|
+
for (const entry of value) {
|
|
76
|
+
const resolved = pickExportsTarget(entry);
|
|
77
|
+
if (resolved) return resolved;
|
|
78
|
+
}
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
if (!require_dist.isRecord(value)) return null;
|
|
82
|
+
const fromImport = pickExportsTarget(value.import);
|
|
83
|
+
if (fromImport) return fromImport;
|
|
84
|
+
return pickExportsTarget(value.default);
|
|
85
|
+
}
|
|
86
|
+
// src/runtime-plugins/extract.ts
|
|
87
|
+
/** Sentinel file written at the end of a successful extract. The
|
|
88
|
+
* loader uses its presence (not just `existsSync(cachePath)`) as the
|
|
89
|
+
* cache-validity check, so a partial extract (interrupted tar, ENOSPC
|
|
90
|
+
* half-write) is detected and re-extracted on the next boot instead
|
|
91
|
+
* of becoming a permanent broken state. */
|
|
92
|
+
var EXTRACT_MARKER = ".extract-complete";
|
|
93
|
+
function isCacheValid(cachePath) {
|
|
94
|
+
return (0, node_fs.existsSync)(node_path.default.join(cachePath, EXTRACT_MARKER));
|
|
95
|
+
}
|
|
96
|
+
/** Run `tar xzf` to extract a tgz into the version-keyed cache slot.
|
|
97
|
+
* `--strip-components=1` drops the `package/` prefix that npm packs
|
|
98
|
+
* add. `execFileSync` (not `execSync`) so paths bypass shell parsing
|
|
99
|
+
* and never trip on metacharacters in workspace paths. Synchronous
|
|
100
|
+
* because boot is single-threaded and the alternative (a stream
|
|
101
|
+
* pipeline) adds dependencies for no benefit.
|
|
102
|
+
*
|
|
103
|
+
* On failure, the partial directory is removed so the next boot
|
|
104
|
+
* re-extracts cleanly (no sticky broken state). The completion
|
|
105
|
+
* marker is written ONLY after tar exits 0 — readers should test
|
|
106
|
+
* `isCacheValid()`, not `existsSync(cachePath)`. */
|
|
107
|
+
function extractTgz(tgzAbs, destDir) {
|
|
108
|
+
if ((0, node_fs.existsSync)(destDir)) (0, node_fs.rmSync)(destDir, {
|
|
109
|
+
recursive: true,
|
|
110
|
+
force: true
|
|
111
|
+
});
|
|
112
|
+
(0, node_fs.mkdirSync)(destDir, { recursive: true });
|
|
113
|
+
try {
|
|
114
|
+
(0, node_child_process.execFileSync)("tar", [
|
|
115
|
+
"-xzf",
|
|
116
|
+
tgzAbs,
|
|
117
|
+
"-C",
|
|
118
|
+
destDir,
|
|
119
|
+
"--strip-components=1"
|
|
120
|
+
], { stdio: "pipe" });
|
|
121
|
+
(0, node_fs.writeFileSync)(node_path.default.join(destDir, EXTRACT_MARKER), "");
|
|
122
|
+
} catch (err) {
|
|
123
|
+
try {
|
|
124
|
+
(0, node_fs.rmSync)(destDir, {
|
|
125
|
+
recursive: true,
|
|
126
|
+
force: true
|
|
127
|
+
});
|
|
128
|
+
} catch {}
|
|
129
|
+
throw err;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
// src/runtime-plugins/load.ts
|
|
133
|
+
var isToolDefinition = (value) => {
|
|
134
|
+
if (!require_dist.isRecord(value)) return false;
|
|
135
|
+
return typeof value.name === "string" && typeof value.description === "string";
|
|
136
|
+
};
|
|
137
|
+
function readPackageJson(cachePath, log) {
|
|
138
|
+
const pkgPath = node_path.default.join(cachePath, "package.json");
|
|
139
|
+
try {
|
|
140
|
+
const pkg = toPackageJson(JSON.parse((0, node_fs.readFileSync)(pkgPath, "utf-8")));
|
|
141
|
+
if (!pkg) log.warn("package.json is not an object — skipping", { path: pkgPath });
|
|
142
|
+
return pkg;
|
|
143
|
+
} catch (err) {
|
|
144
|
+
log.warn("package.json read/parse failed", {
|
|
145
|
+
path: pkgPath,
|
|
146
|
+
error: String(err)
|
|
147
|
+
});
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/** Two carrier shapes (#1110 backward compatibility):
|
|
152
|
+
*
|
|
153
|
+
* 1. **Factory** (`export default definePlugin(setup)`) — `mod.default`
|
|
154
|
+
* is a function. Call it with the plugin's runtime; the return
|
|
155
|
+
* value carries `TOOL_DEFINITION` and the handler keyed by
|
|
156
|
+
* `TOOL_DEFINITION.name`. Closure over runtime gives the handler
|
|
157
|
+
* access to scoped pubsub / files / log without per-call context
|
|
158
|
+
* threading.
|
|
159
|
+
* 2. **Legacy** (`export const TOOL_DEFINITION = ...; export async
|
|
160
|
+
* function <name>(context, args) ...`) — `mod.TOOL_DEFINITION` and
|
|
161
|
+
* `mod[<name>]` directly. Continues to work; existing
|
|
162
|
+
* @gui-chat-plugin packages don't need to migrate.
|
|
163
|
+
*/
|
|
164
|
+
function resolveCarrier(name, mod, deps) {
|
|
165
|
+
const defaultExport = mod.default;
|
|
166
|
+
if ((0, gui_chat_protocol.isPluginFactory)(defaultExport)) return {
|
|
167
|
+
carrier: defaultExport(deps.runtimeFor(name)),
|
|
168
|
+
usingFactory: true
|
|
169
|
+
};
|
|
170
|
+
return {
|
|
171
|
+
carrier: mod,
|
|
172
|
+
usingFactory: false
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
/** Callability is the whole of what a dynamically imported export can be
|
|
176
|
+
* proved to have, so parameters and result stay `unknown` — the loader
|
|
177
|
+
* never inspects either. */
|
|
178
|
+
var isPluginHandler = (value) => typeof value === "function";
|
|
179
|
+
/** Pull the executable from a carrier. Factory-shape handlers take
|
|
180
|
+
* `(args)` only (runtime is closed over) so we wrap to discard the
|
|
181
|
+
* legacy `context` arg the dispatch route passes. Legacy-shape
|
|
182
|
+
* handlers keep the `(context, args)` signature unchanged. Returns
|
|
183
|
+
* null when no function is exported under `definition.name` — the
|
|
184
|
+
* plugin still appears in `tools/list` but dispatch logs + 500s. */
|
|
185
|
+
function resolveExecute(carrier, definitionName, usingFactory) {
|
|
186
|
+
const handler = Object.hasOwn(carrier, definitionName) ? carrier[definitionName] : void 0;
|
|
187
|
+
if (!isPluginHandler(handler)) return null;
|
|
188
|
+
if (usingFactory) return (_context, args) => handler(args);
|
|
189
|
+
return handler;
|
|
190
|
+
}
|
|
191
|
+
/** Read the optional `OAUTH_CALLBACK_ALIAS` named export. Validated
|
|
192
|
+
* against `^[a-z0-9][a-z0-9-]{0,30}$` — short, lowercase,
|
|
193
|
+
* URL-friendly, can't be `..` or contain `/`. A bad alias is logged
|
|
194
|
+
* and ignored (the plugin still loads; just skips the OAuth route
|
|
195
|
+
* registration). */
|
|
196
|
+
var OAUTH_CALLBACK_ALIAS_RE = /^[a-z0-9][a-z0-9-]{0,30}$/;
|
|
197
|
+
function resolveOauthCallbackAlias(name, mod, log) {
|
|
198
|
+
const raw = mod.OAUTH_CALLBACK_ALIAS;
|
|
199
|
+
if (raw === void 0) return null;
|
|
200
|
+
if (typeof raw !== "string" || !OAUTH_CALLBACK_ALIAS_RE.test(raw)) {
|
|
201
|
+
log.warn("OAUTH_CALLBACK_ALIAS export is not a valid alias — ignoring", {
|
|
202
|
+
name,
|
|
203
|
+
raw: String(raw)
|
|
204
|
+
});
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
return raw;
|
|
208
|
+
}
|
|
209
|
+
/** Load a plugin from an already-extracted cache directory. Accepts
|
|
210
|
+
* paths explicitly, so tests don't need a real workspace. Returns
|
|
211
|
+
* null on any structural failure (missing package.json, missing
|
|
212
|
+
* TOOL_DEFINITION, broken import); the caller treats nulls as "skip". */
|
|
213
|
+
async function loadPluginFromCacheDir(name, version, cachePath, deps) {
|
|
214
|
+
const { log } = deps;
|
|
215
|
+
const pkg = readPackageJson(cachePath, log);
|
|
216
|
+
if (!pkg) return null;
|
|
217
|
+
const entrySpec = resolveEntrySpecifier(pkg);
|
|
218
|
+
if (!entrySpec) {
|
|
219
|
+
log.warn("no entry specifier in package.json — skipping", { name });
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
const entryAbs = node_path.default.join(cachePath, entrySpec);
|
|
223
|
+
try {
|
|
224
|
+
const mod = await import((0, node_url.pathToFileURL)(entryAbs).href);
|
|
225
|
+
if (!require_dist.isRecord(mod)) {
|
|
226
|
+
log.warn("plugin module namespace is not an object — skipping", {
|
|
227
|
+
name,
|
|
228
|
+
entrySpec
|
|
229
|
+
});
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
const { carrier, usingFactory } = resolveCarrier(name, mod, deps);
|
|
233
|
+
const definition = carrier.TOOL_DEFINITION;
|
|
234
|
+
if (!isToolDefinition(definition)) {
|
|
235
|
+
log.warn("no TOOL_DEFINITION export — skipping", {
|
|
236
|
+
name,
|
|
237
|
+
entrySpec,
|
|
238
|
+
shape: usingFactory ? "factory" : "legacy"
|
|
239
|
+
});
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
const execute = resolveExecute(carrier, definition.name, usingFactory);
|
|
243
|
+
if (!execute) log.warn("no execute handler matching TOOL_DEFINITION.name — dispatch will fail", {
|
|
244
|
+
name,
|
|
245
|
+
expectedExport: definition.name,
|
|
246
|
+
shape: usingFactory ? "factory" : "legacy"
|
|
247
|
+
});
|
|
248
|
+
return {
|
|
249
|
+
name,
|
|
250
|
+
version,
|
|
251
|
+
cachePath,
|
|
252
|
+
definition,
|
|
253
|
+
execute,
|
|
254
|
+
oauthCallbackAlias: resolveOauthCallbackAlias(name, mod, log)
|
|
255
|
+
};
|
|
256
|
+
} catch (err) {
|
|
257
|
+
log.error("import failed", {
|
|
258
|
+
name,
|
|
259
|
+
entrySpec,
|
|
260
|
+
error: String(err)
|
|
261
|
+
});
|
|
262
|
+
return null;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
/** Lexical anchor: confirm `candidate` resolves inside `base`. Catches
|
|
266
|
+
* malformed ledger entries (`name` containing `../../etc`) before we
|
|
267
|
+
* touch the disk. The asset route trusts registry membership, so a
|
|
268
|
+
* registered cachePath that escaped the base would expose arbitrary
|
|
269
|
+
* files via the unauthenticated GET — this check is the first
|
|
270
|
+
* line of defence (defence-in-depth: realpath after extract is the
|
|
271
|
+
* symlink-escape backstop). */
|
|
272
|
+
function ensureInsideBase(candidate, base) {
|
|
273
|
+
return require_containment.isWithinRoot(node_path.default.resolve(base), node_path.default.resolve(candidate));
|
|
274
|
+
}
|
|
275
|
+
/** Make a ledger entry's cache directory ready to load: both of its paths anchored inside their
|
|
276
|
+
* roots, its tgz present, and the tgz extracted unless a complete extract is already there.
|
|
277
|
+
* Returns the cache directory, or null (logged) when the entry cannot be loaded. */
|
|
278
|
+
function prepareLedgerEntry(entry, roots, log) {
|
|
279
|
+
const tgzAbs = node_path.default.join(roots.pluginsDir, entry.tgz);
|
|
280
|
+
const cachePath = node_path.default.join(roots.cacheDir, entry.name, entry.version);
|
|
281
|
+
if (!ensureInsideBase(tgzAbs, roots.pluginsDir)) {
|
|
282
|
+
log.warn("ledger entry tgz escapes plugins root — skipping", {
|
|
283
|
+
name: entry.name,
|
|
284
|
+
tgz: entry.tgz
|
|
285
|
+
});
|
|
286
|
+
return null;
|
|
287
|
+
}
|
|
288
|
+
if (!ensureInsideBase(cachePath, roots.cacheDir)) {
|
|
289
|
+
log.warn("ledger entry escapes plugin cache root — skipping", {
|
|
290
|
+
name: entry.name,
|
|
291
|
+
version: entry.version
|
|
292
|
+
});
|
|
293
|
+
return null;
|
|
294
|
+
}
|
|
295
|
+
if (!(0, node_fs.existsSync)(tgzAbs)) {
|
|
296
|
+
log.warn("tgz missing — skipping", {
|
|
297
|
+
name: entry.name,
|
|
298
|
+
tgz: entry.tgz
|
|
299
|
+
});
|
|
300
|
+
return null;
|
|
301
|
+
}
|
|
302
|
+
if (!isCacheValid(cachePath)) try {
|
|
303
|
+
extractTgz(tgzAbs, cachePath);
|
|
304
|
+
log.info("extracted", {
|
|
305
|
+
name: entry.name,
|
|
306
|
+
version: entry.version
|
|
307
|
+
});
|
|
308
|
+
} catch (err) {
|
|
309
|
+
log.error("extract failed", {
|
|
310
|
+
name: entry.name,
|
|
311
|
+
error: String(err)
|
|
312
|
+
});
|
|
313
|
+
return null;
|
|
314
|
+
}
|
|
315
|
+
return cachePath;
|
|
316
|
+
}
|
|
317
|
+
exports.EXTRACT_MARKER = EXTRACT_MARKER;
|
|
318
|
+
exports.ensureInsideBase = ensureInsideBase;
|
|
319
|
+
exports.extractTgz = extractTgz;
|
|
320
|
+
exports.isCacheValid = isCacheValid;
|
|
321
|
+
exports.isLedgerEntry = isLedgerEntry;
|
|
322
|
+
exports.loadPluginFromCacheDir = loadPluginFromCacheDir;
|
|
323
|
+
exports.parseLedger = parseLedger;
|
|
324
|
+
exports.prepareLedgerEntry = prepareLedgerEntry;
|
|
325
|
+
exports.resolveEntrySpecifier = resolveEntrySpecifier;
|
|
326
|
+
exports.resolveExecute = resolveExecute;
|
|
327
|
+
exports.toPackageJson = toPackageJson;
|
|
328
|
+
|
|
329
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["hasStringProp","isRecord","existsSync","path","isRecord","path","readFileSync","isPluginFactory","pathToFileURL","isWithinRoot","existsSync"],"sources":["../../src/runtime-plugins/ledger.ts","../../src/runtime-plugins/packageJson.ts","../../src/runtime-plugins/extract.ts","../../src/runtime-plugins/load.ts"],"sourcesContent":["// The runtime-plugin install ledger (`plugins/plugins.json` in the workspace). Shared by every host\n// that reads the same workspace, so they agree on which entries count.\nimport { hasStringProp } from \"@mulmoclaude/common\";\n\nexport interface LedgerEntry {\n /** npm package name, e.g. `@gui-chat-plugin/weather`. */\n name: string;\n /** Semver string from the tgz's `package.json`, e.g. `0.1.0`. */\n version: string;\n /** Basename of the tgz inside `plugins/`. Joined with the plugins\n * root to read. */\n tgz: string;\n /** ISO 8601 timestamp of the install. */\n installedAt: string;\n}\n\nexport const isLedgerEntry = (value: unknown): value is LedgerEntry =>\n hasStringProp(value, \"name\") && hasStringProp(value, \"version\") && hasStringProp(value, \"tgz\") && hasStringProp(value, \"installedAt\");\n\n/** The well-formed entries of a parsed ledger; anything that is not an array reads as empty. */\nexport const parseLedger = (raw: unknown): LedgerEntry[] => {\n if (!Array.isArray(raw)) return [];\n return raw.filter(isLedgerEntry);\n};\n","// Reading a runtime plugin's `package.json`: the fields the loader uses, and the entry point it imports.\nimport { isRecord } from \"@mulmoclaude/common\";\n\nexport interface PackageJson {\n name?: string | undefined;\n version?: string | undefined;\n /** Left unnarrowed because every legal Node.js `exports` value is\n * accepted here — string sugar, array fallback chain, condition or\n * subpath map. `pickExportsTarget` is what discriminates them. */\n exports?: unknown | undefined;\n main?: string | undefined;\n module?: string | undefined;\n}\n\nconst optionalString = (value: unknown): string | undefined => (typeof value === \"string\" ? value : undefined);\n\n/** Rebuild the fields the loader reads from arbitrary parsed JSON.\n * Field-by-field rather than a predicate, so a plugin shipping a\n * non-string `main` can't reach `path.join` as if it were one.\n * Returns null when the parsed value isn't an object at all. */\nexport function toPackageJson(value: unknown): PackageJson | null {\n if (!isRecord(value)) return null;\n return {\n name: optionalString(value.name),\n version: optionalString(value.version),\n exports: value.exports,\n main: optionalString(value.main),\n module: optionalString(value.module),\n };\n}\n\n/** Resolve the entry-point path from a plugin's `package.json`. Covers\n * the four legal `exports` shapes per the Node.js spec, then falls\n * through to `module` / `main` for legacy packages.\n *\n * Legal `exports` forms (Node.js docs):\n * 1. String sugar: `\"exports\": \"./index.js\"`\n * 2. Conditional root: `\"exports\": { \"import\": \"./esm.js\", … }`\n * 3. Subpath map: `\"exports\": { \".\": \"./index.js\", \"./util\": \"./util.js\", … }`\n * 4. Subpath + cond.: `\"exports\": { \".\": { \"import\": \"./esm.js\", \"require\": \"./cjs.js\" } }`\n *\n * Earlier the loader only matched form (4) and fell straight through\n * to `module` / `main`. Real npm packages using forms (1)-(3) failed\n * to load (#1077 review). */\nexport function resolveEntrySpecifier(pkg: PackageJson): string | null {\n const fromExports = resolveExportsField(pkg.exports);\n if (fromExports) return fromExports;\n if (typeof pkg.module === \"string\") return pkg.module;\n if (typeof pkg.main === \"string\") return pkg.main;\n return null;\n}\n\nfunction resolveExportsField(exportsField: unknown): string | null {\n // Form 1: top-level string sugar.\n // Form A: array fallback chain (e.g. [\"./dist/index.js\", \"./fallback.js\"]).\n // Form 2: conditional root (e.g. `{ import, require, default }`).\n // Form 3 / 4: subpath map keyed by `.` — value can be a string,\n // array, or condition object (Codex review iter-2 on #1116).\n const root = pickExportsTarget(exportsField);\n if (root) return root;\n if (isRecord(exportsField)) {\n return pickExportsTarget(exportsField[\".\"]);\n }\n return null;\n}\n\n/** Walk a Node.js `exports` value and return the first string entry\n * point this ESM loader can use. Handles every legal target shape:\n *\n * - string: return it directly.\n * - array: try each element in order; first resolvable wins.\n * Per the spec arrays are a fallback chain — Node tries each\n * until one resolves on disk. We don't probe disk here, so\n * \"first string-or-resolvable-condition\" approximates that.\n * - condition object: prefer `import` (ESM-specific), then\n * `default` (universal fallback).\n * - everything else (e.g. only `require`, only nested arrays of\n * condition objects with no string targets): null. */\nfunction pickExportsTarget(value: unknown): string | null {\n if (typeof value === \"string\") return value;\n if (Array.isArray(value)) {\n for (const entry of value) {\n const resolved = pickExportsTarget(entry);\n if (resolved) return resolved;\n }\n return null;\n }\n if (!isRecord(value)) return null;\n // Condition object — `import` first (the ESM-specific condition\n // match), then `default` (the universal fallback that \"always\n // matches\" per the Node.js spec).\n const fromImport = pickExportsTarget(value.import);\n if (fromImport) return fromImport;\n return pickExportsTarget(value.default);\n}\n","// Extracting a runtime plugin's tgz into its version-keyed cache slot.\nimport { existsSync, mkdirSync, rmSync, writeFileSync } from \"node:fs\";\nimport { execFileSync } from \"node:child_process\";\nimport path from \"node:path\";\n\n/** Sentinel file written at the end of a successful extract. The\n * loader uses its presence (not just `existsSync(cachePath)`) as the\n * cache-validity check, so a partial extract (interrupted tar, ENOSPC\n * half-write) is detected and re-extracted on the next boot instead\n * of becoming a permanent broken state. */\nexport const EXTRACT_MARKER = \".extract-complete\";\n\nexport function isCacheValid(cachePath: string): boolean {\n return existsSync(path.join(cachePath, EXTRACT_MARKER));\n}\n\n/** Run `tar xzf` to extract a tgz into the version-keyed cache slot.\n * `--strip-components=1` drops the `package/` prefix that npm packs\n * add. `execFileSync` (not `execSync`) so paths bypass shell parsing\n * and never trip on metacharacters in workspace paths. Synchronous\n * because boot is single-threaded and the alternative (a stream\n * pipeline) adds dependencies for no benefit.\n *\n * On failure, the partial directory is removed so the next boot\n * re-extracts cleanly (no sticky broken state). The completion\n * marker is written ONLY after tar exits 0 — readers should test\n * `isCacheValid()`, not `existsSync(cachePath)`. */\nexport function extractTgz(tgzAbs: string, destDir: string): void {\n // Wipe any leftover from a previous failed extract before writing.\n if (existsSync(destDir)) rmSync(destDir, { recursive: true, force: true });\n mkdirSync(destDir, { recursive: true });\n try {\n execFileSync(\"tar\", [\"-xzf\", tgzAbs, \"-C\", destDir, \"--strip-components=1\"], { stdio: \"pipe\" });\n writeFileSync(path.join(destDir, EXTRACT_MARKER), \"\");\n } catch (err) {\n // Tear down the partial tree so isCacheValid() stays false next boot.\n try {\n rmSync(destDir, { recursive: true, force: true });\n } catch {\n // best-effort cleanup\n }\n throw err;\n }\n}\n","// Loading one runtime plugin: from an extracted cache directory to its TOOL_DEFINITION and handler.\n// The host injects what is its own — the runtime a factory plugin is built with, and the logger —\n// so every host that reads the same ledger loads a plugin the same way.\nimport { existsSync, readFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport type { PluginRuntime, ToolDefinition } from \"gui-chat-protocol\";\nimport { isPluginFactory } from \"gui-chat-protocol\";\nimport { isRecord } from \"@mulmoclaude/common\";\nimport { isWithinRoot } from \"../files/containment.js\";\nimport { extractTgz, isCacheValid } from \"./extract.js\";\nimport type { LedgerEntry } from \"./ledger.js\";\nimport { resolveEntrySpecifier, toPackageJson, type PackageJson } from \"./packageJson.js\";\n\nexport interface RuntimePlugin {\n /** npm package name, e.g. `@gui-chat-plugin/weather`. */\n name: string;\n /** Semver string from the tgz's `package.json`. */\n version: string;\n /** Absolute path to the extracted plugin directory under\n * `plugins/.cache/<name>/<version>/`. */\n cachePath: string;\n /** TOOL_DEFINITION export from the plugin's `dist/index.js`. The\n * shape matches static plugins, so the same MCP merge / dispatch\n * path applies. */\n definition: ToolDefinition;\n /** Server-side handler the dispatch route calls. The convention\n * across @gui-chat-plugin packages is to export it under the same\n * key as `TOOL_DEFINITION.name` (e.g. weather → `fetchWeather`,\n * browse → `browse`); we capture it at load time so the dispatch\n * route doesn't have to re-resolve. The signature follows\n * gui-chat-protocol's `ToolPluginCore.execute`:\n * `(context: ToolContext, args) => Promise<ToolResult>` — context\n * first, args second. `null` means the module shipped a\n * TOOL_DEFINITION but no matching handler — the dispatch will 500\n * with a useful message. */\n execute: ((context: unknown, args: unknown) => unknown) | null;\n /** Optional short, URL-safe alias for the OAuth callback route\n * (#1162). When the plugin's module exports\n * `OAUTH_CALLBACK_ALIAS = \"<alias>\"`, the host registers\n * `/api/plugins/runtime/oauth-callback/<alias>` and forwards\n * `kind: \"oauthCallback\"` dispatch args to this plugin. The\n * package-name-in-path shape was rejected by Spotify Dashboard\n * because of the percent-encoded `@` / `/` characters, so OAuth\n * plugins declare a short alias (e.g. `\"spotify\"`) instead. Null\n * for non-OAuth plugins. */\n oauthCallbackAlias: string | null;\n}\n\n/** The host's logger. Every call carries a data object, so a host can prefix and forward it as is. */\nexport interface RuntimePluginLogger {\n info: (message: string, data: Record<string, unknown>) => void;\n warn: (message: string, data: Record<string, unknown>) => void;\n error: (message: string, data: Record<string, unknown>) => void;\n}\n\nexport interface LoadDeps {\n /** The runtime a FACTORY plugin (`export default definePlugin(...)`) is built with. Called only\n * for a factory module, once per load. */\n runtimeFor: (pkgName: string) => PluginRuntime;\n log: RuntimePluginLogger;\n}\n\n/** Where a ledger's tgz files live, and where they are extracted. */\nexport interface RuntimePluginRoots {\n pluginsDir: string;\n cacheDir: string;\n}\n\nconst isToolDefinition = (value: unknown): value is ToolDefinition => {\n if (!isRecord(value)) return false;\n return typeof value.name === \"string\" && typeof value.description === \"string\";\n};\n\nfunction readPackageJson(cachePath: string, log: RuntimePluginLogger): PackageJson | null {\n const pkgPath = path.join(cachePath, \"package.json\");\n try {\n const parsed: unknown = JSON.parse(readFileSync(pkgPath, \"utf-8\"));\n const pkg = toPackageJson(parsed);\n if (!pkg) log.warn(\"package.json is not an object — skipping\", { path: pkgPath });\n return pkg;\n } catch (err) {\n log.warn(\"package.json read/parse failed\", { path: pkgPath, error: String(err) });\n return null;\n }\n}\n\n/** Two carrier shapes (#1110 backward compatibility):\n *\n * 1. **Factory** (`export default definePlugin(setup)`) — `mod.default`\n * is a function. Call it with the plugin's runtime; the return\n * value carries `TOOL_DEFINITION` and the handler keyed by\n * `TOOL_DEFINITION.name`. Closure over runtime gives the handler\n * access to scoped pubsub / files / log without per-call context\n * threading.\n * 2. **Legacy** (`export const TOOL_DEFINITION = ...; export async\n * function <name>(context, args) ...`) — `mod.TOOL_DEFINITION` and\n * `mod[<name>]` directly. Continues to work; existing\n * @gui-chat-plugin packages don't need to migrate.\n */\nfunction resolveCarrier(name: string, mod: Record<string, unknown>, deps: LoadDeps): { carrier: Record<string, unknown>; usingFactory: boolean } {\n const defaultExport = mod.default;\n if (isPluginFactory(defaultExport)) {\n return { carrier: defaultExport(deps.runtimeFor(name)), usingFactory: true };\n }\n return { carrier: mod, usingFactory: false };\n}\n\n/** Callability is the whole of what a dynamically imported export can be\n * proved to have, so parameters and result stay `unknown` — the loader\n * never inspects either. */\nconst isPluginHandler = (value: unknown): value is (...args: unknown[]) => unknown => typeof value === \"function\";\n\n/** Pull the executable from a carrier. Factory-shape handlers take\n * `(args)` only (runtime is closed over) so we wrap to discard the\n * legacy `context` arg the dispatch route passes. Legacy-shape\n * handlers keep the `(context, args)` signature unchanged. Returns\n * null when no function is exported under `definition.name` — the\n * plugin still appears in `tools/list` but dispatch logs + 500s. */\nexport function resolveExecute(\n carrier: Record<string, unknown>,\n definitionName: string,\n usingFactory: boolean,\n): ((context: unknown, args: unknown) => unknown) | null {\n // Own-property guard: a bare `carrier[definitionName]` for a plugin naming its\n // tool `constructor` / `toString` resolves to an Object.prototype function,\n // defeating the `typeof … !== \"function\"` gate below (#2319).\n const handler = Object.hasOwn(carrier, definitionName) ? carrier[definitionName] : undefined;\n if (!isPluginHandler(handler)) return null;\n if (usingFactory) return (_context, args) => handler(args);\n return handler;\n}\n\n/** Read the optional `OAUTH_CALLBACK_ALIAS` named export. Validated\n * against `^[a-z0-9][a-z0-9-]{0,30}$` — short, lowercase,\n * URL-friendly, can't be `..` or contain `/`. A bad alias is logged\n * and ignored (the plugin still loads; just skips the OAuth route\n * registration). */\nconst OAUTH_CALLBACK_ALIAS_RE = /^[a-z0-9][a-z0-9-]{0,30}$/;\nfunction resolveOauthCallbackAlias(name: string, mod: Record<string, unknown>, log: RuntimePluginLogger): string | null {\n const raw = mod.OAUTH_CALLBACK_ALIAS;\n if (raw === undefined) return null;\n if (typeof raw !== \"string\" || !OAUTH_CALLBACK_ALIAS_RE.test(raw)) {\n // eslint-disable-next-line @typescript-eslint/no-base-to-string -- this branch exists BECAUSE `raw` is the wrong shape; echoing whatever it stringifies to is the diagnostic.\n log.warn(\"OAUTH_CALLBACK_ALIAS export is not a valid alias — ignoring\", { name, raw: String(raw) });\n return null;\n }\n return raw;\n}\n\n/** Load a plugin from an already-extracted cache directory. Accepts\n * paths explicitly, so tests don't need a real workspace. Returns\n * null on any structural failure (missing package.json, missing\n * TOOL_DEFINITION, broken import); the caller treats nulls as \"skip\". */\nexport async function loadPluginFromCacheDir(name: string, version: string, cachePath: string, deps: LoadDeps): Promise<RuntimePlugin | null> {\n const { log } = deps;\n const pkg = readPackageJson(cachePath, log);\n if (!pkg) return null;\n const entrySpec = resolveEntrySpecifier(pkg);\n if (!entrySpec) {\n log.warn(\"no entry specifier in package.json — skipping\", { name });\n return null;\n }\n const entryAbs = path.join(cachePath, entrySpec);\n try {\n const mod: unknown = await import(pathToFileURL(entryAbs).href);\n if (!isRecord(mod)) {\n log.warn(\"plugin module namespace is not an object — skipping\", { name, entrySpec });\n return null;\n }\n const { carrier, usingFactory } = resolveCarrier(name, mod, deps);\n const definition = carrier.TOOL_DEFINITION;\n if (!isToolDefinition(definition)) {\n log.warn(\"no TOOL_DEFINITION export — skipping\", { name, entrySpec, shape: usingFactory ? \"factory\" : \"legacy\" });\n return null;\n }\n const execute = resolveExecute(carrier, definition.name, usingFactory);\n if (!execute) {\n log.warn(\"no execute handler matching TOOL_DEFINITION.name — dispatch will fail\", {\n name,\n expectedExport: definition.name,\n shape: usingFactory ? \"factory\" : \"legacy\",\n });\n }\n const oauthCallbackAlias = resolveOauthCallbackAlias(name, mod, log);\n return { name, version, cachePath, definition, execute, oauthCallbackAlias };\n } catch (err) {\n log.error(\"import failed\", { name, entrySpec, error: String(err) });\n return null;\n }\n}\n\n/** Lexical anchor: confirm `candidate` resolves inside `base`. Catches\n * malformed ledger entries (`name` containing `../../etc`) before we\n * touch the disk. The asset route trusts registry membership, so a\n * registered cachePath that escaped the base would expose arbitrary\n * files via the unauthenticated GET — this check is the first\n * line of defence (defence-in-depth: realpath after extract is the\n * symlink-escape backstop). */\nexport function ensureInsideBase(candidate: string, base: string): boolean {\n return isWithinRoot(path.resolve(base), path.resolve(candidate));\n}\n\n/** Make a ledger entry's cache directory ready to load: both of its paths anchored inside their\n * roots, its tgz present, and the tgz extracted unless a complete extract is already there.\n * Returns the cache directory, or null (logged) when the entry cannot be loaded. */\nexport function prepareLedgerEntry(entry: LedgerEntry, roots: RuntimePluginRoots, log: RuntimePluginLogger): string | null {\n const tgzAbs = path.join(roots.pluginsDir, entry.tgz);\n const cachePath = path.join(roots.cacheDir, entry.name, entry.version);\n // Anchor checks BEFORE any disk probe (`existsSync` / `realpath`).\n // The ledger has two separate user-controlled fields — `tgz` and\n // (`name`, `version`) — and each joins against a different base.\n // Both must stay inside their respective bases; otherwise even a\n // stat-only probe would touch a path outside the intended roots.\n if (!ensureInsideBase(tgzAbs, roots.pluginsDir)) {\n log.warn(\"ledger entry tgz escapes plugins root — skipping\", { name: entry.name, tgz: entry.tgz });\n return null;\n }\n if (!ensureInsideBase(cachePath, roots.cacheDir)) {\n log.warn(\"ledger entry escapes plugin cache root — skipping\", {\n name: entry.name,\n version: entry.version,\n });\n return null;\n }\n if (!existsSync(tgzAbs)) {\n log.warn(\"tgz missing — skipping\", { name: entry.name, tgz: entry.tgz });\n return null;\n }\n if (!isCacheValid(cachePath)) {\n try {\n extractTgz(tgzAbs, cachePath);\n log.info(\"extracted\", { name: entry.name, version: entry.version });\n } catch (err) {\n log.error(\"extract failed\", { name: entry.name, error: String(err) });\n return null;\n }\n }\n return cachePath;\n}\n"],"mappings":";;;;;;;;;;;AAgBA,IAAa,iBAAiB,UAC5BA,aAAAA,cAAc,OAAO,MAAM,KAAKA,aAAAA,cAAc,OAAO,SAAS,KAAKA,aAAAA,cAAc,OAAO,KAAK,KAAKA,aAAAA,cAAc,OAAO,aAAa;;AAGtI,IAAa,eAAe,QAAgC;CAC1D,IAAI,CAAC,MAAM,QAAQ,GAAG,GAAG,OAAO,CAAC;CACjC,OAAO,IAAI,OAAO,aAAa;AACjC;;ACTA,IAAM,kBAAkB,UAAwC,OAAO,UAAU,WAAW,QAAQ,KAAA;;;;;AAMpG,SAAgB,cAAc,OAAoC;CAChE,IAAI,CAACC,aAAAA,SAAS,KAAK,GAAG,OAAO;CAC7B,OAAO;EACL,MAAM,eAAe,MAAM,IAAI;EAC/B,SAAS,eAAe,MAAM,OAAO;EACrC,SAAS,MAAM;EACf,MAAM,eAAe,MAAM,IAAI;EAC/B,QAAQ,eAAe,MAAM,MAAM;CACrC;AACF;;;;;;;;;;;;;;AAeA,SAAgB,sBAAsB,KAAiC;CACrE,MAAM,cAAc,oBAAoB,IAAI,OAAO;CACnD,IAAI,aAAa,OAAO;CACxB,IAAI,OAAO,IAAI,WAAW,UAAU,OAAO,IAAI;CAC/C,IAAI,OAAO,IAAI,SAAS,UAAU,OAAO,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;EAAE,CAAC;EAClE,OAAO;CACT;AACF;;;;;;;;AASA,SAAgB,iBAAiB,WAAmB,MAAuB;CACzE,OAAOK,oBAAAA,aAAaJ,UAAAA,QAAK,QAAQ,IAAI,GAAGA,UAAAA,QAAK,QAAQ,SAAS,CAAC;AACjE;;;;AAKA,SAAgB,mBAAmB,OAAoB,OAA2B,KAAyC;CACzH,MAAM,SAASA,UAAAA,QAAK,KAAK,MAAM,YAAY,MAAM,GAAG;CACpD,MAAM,YAAYA,UAAAA,QAAK,KAAK,MAAM,UAAU,MAAM,MAAM,MAAM,OAAO;CAMrE,IAAI,CAAC,iBAAiB,QAAQ,MAAM,UAAU,GAAG;EAC/C,IAAI,KAAK,oDAAoD;GAAE,MAAM,MAAM;GAAM,KAAK,MAAM;EAAI,CAAC;EACjG,OAAO;CACT;CACA,IAAI,CAAC,iBAAiB,WAAW,MAAM,QAAQ,GAAG;EAChD,IAAI,KAAK,qDAAqD;GAC5D,MAAM,MAAM;GACZ,SAAS,MAAM;EACjB,CAAC;EACD,OAAO;CACT;CACA,IAAI,EAAA,GAACK,QAAAA,WAAAA,CAAW,MAAM,GAAG;EACvB,IAAI,KAAK,0BAA0B;GAAE,MAAM,MAAM;GAAM,KAAK,MAAM;EAAI,CAAC;EACvE,OAAO;CACT;CACA,IAAI,CAAC,aAAa,SAAS,GACzB,IAAI;EACF,WAAW,QAAQ,SAAS;EAC5B,IAAI,KAAK,aAAa;GAAE,MAAM,MAAM;GAAM,SAAS,MAAM;EAAQ,CAAC;CACpE,SAAS,KAAK;EACZ,IAAI,MAAM,kBAAkB;GAAE,MAAM,MAAM;GAAM,OAAO,OAAO,GAAG;EAAE,CAAC;EACpE,OAAO;CACT;CAEF,OAAO;AACT"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { isLedgerEntry, parseLedger, type LedgerEntry } from './ledger.js';
|
|
2
|
+
export { resolveEntrySpecifier, toPackageJson, type PackageJson } from './packageJson.js';
|
|
3
|
+
export { EXTRACT_MARKER, extractTgz, isCacheValid } from './extract.js';
|
|
4
|
+
export { ensureInsideBase, loadPluginFromCacheDir, prepareLedgerEntry, resolveExecute, type LoadDeps, type RuntimePlugin, type RuntimePluginLogger, type RuntimePluginRoots, } from './load.js';
|