mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-21 10:16:44 +00:00
* feat(discord): show subagent progress Co-authored-by: Kyle Klouzal <kklouzal@users.noreply.github.com> * fix(discord): serialize progress cleanup ownership Co-authored-by: Kyle Klouzal <kklouzal@users.noreply.github.com> * test(discord): type progress state fixtures * refactor(discord): split subagent progress state * fix(discord): persist terminal progress outcomes * fix(discord): narrow persisted cleanup rows * refactor(discord): keep progress internals private * perf(discord): preserve lazy progress loading * chore(plugin-sdk): refresh API baseline after rebase --------- Co-authored-by: Peter Steinberger <steipete@gmail.com> Co-authored-by: Kyle Klouzal <kklouzal@users.noreply.github.com>
32 lines
1.4 KiB
TypeScript
32 lines
1.4 KiB
TypeScript
// Discord API module exposes the plugin public contract.
|
|
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/channel-entry-contract";
|
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
|
|
const loadDiscordSubagentHooksModule = createLazyRuntimeModule(
|
|
() => import("./src/subagent-hooks.js"),
|
|
);
|
|
const loadDiscordSubagentProgressModule = createLazyRuntimeModule(
|
|
() => import("./src/subagent-progress.js"),
|
|
);
|
|
|
|
// Subagent hooks live behind a dedicated barrel so the bundled entry can
|
|
// register one stable hook wiring path while keeping the handler module lazy.
|
|
export function registerDiscordSubagentHooks(api: OpenClawPluginApi): void {
|
|
api.on("gateway_start", async () => {
|
|
const { recoverDiscordSubagentProgress } = await loadDiscordSubagentProgressModule();
|
|
await recoverDiscordSubagentProgress(api);
|
|
});
|
|
api.on("subagent_progress", async (event) => {
|
|
const { handleDiscordSubagentProgress } = await loadDiscordSubagentProgressModule();
|
|
await handleDiscordSubagentProgress(api, event);
|
|
});
|
|
api.on("subagent_ended", async (event) => {
|
|
const { handleDiscordSubagentEnded } = await loadDiscordSubagentHooksModule();
|
|
handleDiscordSubagentEnded(event);
|
|
});
|
|
api.on("subagent_delivery_target", async (event) => {
|
|
const { handleDiscordSubagentDeliveryTarget } = await loadDiscordSubagentHooksModule();
|
|
return handleDiscordSubagentDeliveryTarget(event);
|
|
});
|
|
}
|