mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:30:42 +00:00
fix(discord): keep subagent hooks lazy in channel entry
This commit is contained in:
@@ -25,9 +25,3 @@ export function registerDiscordSubagentHooks(api: OpenClawPluginApi): void {
|
||||
return handleDiscordSubagentDeliveryTarget(event);
|
||||
});
|
||||
}
|
||||
|
||||
export {
|
||||
handleDiscordSubagentDeliveryTarget,
|
||||
handleDiscordSubagentEnded,
|
||||
handleDiscordSubagentSpawning,
|
||||
} from "./src/subagent-hooks.js";
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user