fix(pi): load installed device extensions

This commit is contained in:
2026-09-03 10:32:00 +08:00
parent 34e59bfaf2
commit 17664c5fff
2 changed files with 32 additions and 3 deletions

View File

@@ -177,11 +177,12 @@ async function createThreadRuntime(channel, rawOptions) {
const appendSystemPrompts = optionValues(args, '--append-system-prompt');
const sessionId = requiredString(optionValue(args, '--session-id'), 'Thread session id');
const forkSessionId = optionValue(args, '--fork');
const extensionPaths = optionValues(args, '--extension').map((value) => path.resolve(value));
const [makeloreExtensionPath, ...additionalExtensionPaths] = optionValues(args, '--extension')
.map((value) => path.resolve(value));
const skillPaths = optionValues(args, '--skill').map((value) => path.resolve(value));
if (extensionPaths.length !== 1) throw new Error('Thread requires exactly one Makelore extension');
if (!makeloreExtensionPath) throw new Error('Thread requires a Makelore extension');
if (appendSystemPrompts.length !== 1) throw new Error('Thread requires exactly one Makelore language prompt');
const extensionModule = await import(pathToFileURL(extensionPaths[0]).href);
const extensionModule = await import(pathToFileURL(makeloreExtensionPath).href);
if (typeof extensionModule.createMakeloreRuntime !== 'function') {
throw new Error('Makelore runtime extension factory is unavailable');
}
@@ -215,6 +216,7 @@ async function createThreadRuntime(channel, rawOptions) {
cwd: runtimeCwd,
})),
}],
additionalExtensionPaths,
additionalSkillPaths: skillPaths,
noExtensions: true,
noSkills: true,