fix(discord): keep subagent hooks lazy in channel entry

This commit is contained in:
Peter Steinberger
2026-04-23 09:27:47 +01:00
parent 4df0d55f06
commit e204a31831
2 changed files with 18 additions and 8 deletions

View File

@@ -25,9 +25,3 @@ export function registerDiscordSubagentHooks(api: OpenClawPluginApi): void {
return handleDiscordSubagentDeliveryTarget(event);
});
}
export {
handleDiscordSubagentDeliveryTarget,
handleDiscordSubagentEnded,
handleDiscordSubagentSpawning,
} from "./src/subagent-hooks.js";

View File

@@ -144,7 +144,15 @@ function assertEntryFileExists(entry) {
async function smokeChannelEntry(entryFile) {
assertEntryFileExists(entryFile);
const entry = (await importBuiltModule(entryFile.path)).default;
let entry;
try {
entry = (await importBuiltModule(entryFile.path)).default;
} catch (error) {
throw new Error(
`${entryFile.id} ${entryFile.kind} entry failed to import ${entryFile.path}: ${error instanceof Error ? error.message : String(error)}`,
{ cause: error },
);
}
assert.equal(entry.kind, "bundled-channel-entry", `${entryFile.id} channel entry kind mismatch`);
assert.equal(
typeof entry.loadChannelPlugin,
@@ -163,7 +171,15 @@ async function smokeChannelEntry(entryFile) {
async function smokeSetupEntry(entryFile) {
assertEntryFileExists(entryFile);
const entry = (await importBuiltModule(entryFile.path)).default;
let entry;
try {
entry = (await importBuiltModule(entryFile.path)).default;
} catch (error) {
throw new Error(
`${entryFile.id} ${entryFile.kind} entry failed to import ${entryFile.path}: ${error instanceof Error ? error.message : String(error)}`,
{ cause: error },
);
}
if (entry?.kind !== "bundled-channel-setup-entry") {
return false;
}