fix(discord): keep subagent hooks lazy in channel entry · openclaw/openclaw@e204a31
steipete
·
2026-04-23
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -25,9 +25,3 @@ export function registerDiscordSubagentHooks(api: OpenClawPluginApi): void {
|
25 | 25 | return handleDiscordSubagentDeliveryTarget(event); |
26 | 26 | }); |
27 | 27 | } |
28 | | - |
29 | | -export { |
30 | | -handleDiscordSubagentDeliveryTarget, |
31 | | -handleDiscordSubagentEnded, |
32 | | -handleDiscordSubagentSpawning, |
33 | | -} from "./src/subagent-hooks.js"; |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -144,7 +144,15 @@ function assertEntryFileExists(entry) {
|
144 | 144 | |
145 | 145 | async function smokeChannelEntry(entryFile) { |
146 | 146 | assertEntryFileExists(entryFile); |
147 | | -const entry = (await importBuiltModule(entryFile.path)).default; |
| 147 | +let entry; |
| 148 | +try { |
| 149 | +entry = (await importBuiltModule(entryFile.path)).default; |
| 150 | +} catch (error) { |
| 151 | +throw new Error( |
| 152 | +`${entryFile.id} ${entryFile.kind} entry failed to import ${entryFile.path}: ${error instanceof Error ? error.message : String(error)}`, |
| 153 | +{ cause: error }, |
| 154 | +); |
| 155 | +} |
148 | 156 | assert.equal(entry.kind, "bundled-channel-entry", `${entryFile.id} channel entry kind mismatch`); |
149 | 157 | assert.equal( |
150 | 158 | typeof entry.loadChannelPlugin, |
@@ -163,7 +171,15 @@ async function smokeChannelEntry(entryFile) {
|
163 | 171 | |
164 | 172 | async function smokeSetupEntry(entryFile) { |
165 | 173 | assertEntryFileExists(entryFile); |
166 | | -const entry = (await importBuiltModule(entryFile.path)).default; |
| 174 | +let entry; |
| 175 | +try { |
| 176 | +entry = (await importBuiltModule(entryFile.path)).default; |
| 177 | +} catch (error) { |
| 178 | +throw new Error( |
| 179 | +`${entryFile.id} ${entryFile.kind} entry failed to import ${entryFile.path}: ${error instanceof Error ? error.message : String(error)}`, |
| 180 | +{ cause: error }, |
| 181 | +); |
| 182 | +} |
167 | 183 | if (entry?.kind !== "bundled-channel-setup-entry") { |
168 | 184 | return false; |
169 | 185 | } |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。