mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-05 08:52:53 +00:00
Move subagent thread binding ownership into core so session-mode spawns prepare channel bindings before launching the child agent. Deprecate the legacy subagent_spawning SDK hook in code, compatibility metadata, diagnostics, and plugin docs; plugin authors should observe subagent_spawned instead. Verification: - node scripts/run-vitest.mjs src/agents/sessions-spawn-hooks.test.ts src/agents/subagent-spawn.thread-binding.test.ts src/agents/subagent-spawn.workspace.test.ts src/agents/subagent-spawn.mode-session-diagnostics.test.ts - node scripts/run-tsgo.mjs -p tsconfig.core.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core.tsbuildinfo - git diff --check - .agents/skills/autoreview/scripts/autoreview --mode local - CI run 26693808952 green, including checks-node-agentic-agents-core and checks-node-agentic-plugin-sdk
22 lines
851 B
TypeScript
22 lines
851 B
TypeScript
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/channel-entry-contract";
|
|
|
|
type FeishuSubagentHooksModule = typeof import("./src/subagent-hooks.js");
|
|
|
|
let feishuSubagentHooksPromise: Promise<FeishuSubagentHooksModule> | null = null;
|
|
|
|
function loadFeishuSubagentHooksModule() {
|
|
feishuSubagentHooksPromise ??= import("./src/subagent-hooks.js");
|
|
return feishuSubagentHooksPromise;
|
|
}
|
|
|
|
export function registerFeishuSubagentHooks(api: OpenClawPluginApi): void {
|
|
api.on("subagent_delivery_target", async (event) => {
|
|
const { handleFeishuSubagentDeliveryTarget } = await loadFeishuSubagentHooksModule();
|
|
return handleFeishuSubagentDeliveryTarget(event);
|
|
});
|
|
api.on("subagent_ended", async (event) => {
|
|
const { handleFeishuSubagentEnded } = await loadFeishuSubagentHooksModule();
|
|
handleFeishuSubagentEnded(event);
|
|
});
|
|
}
|