refactor(agents): bind subagent threads in core (#88416)

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
This commit is contained in:
Peter Steinberger
2026-05-30 21:19:09 +01:00
committed by GitHub
parent 4ac90a5b48
commit 3fc0df953c
25 changed files with 796 additions and 248 deletions

View File

@@ -5,6 +5,7 @@ import {
import { beforeEach, describe, expect, it } from "vitest";
import type { ClawdbotConfig, OpenClawPluginApi } from "../runtime-api.js";
import { registerFeishuSubagentHooks } from "../subagent-hooks-api.js";
import { handleFeishuSubagentSpawning } from "./subagent-hooks.js";
import {
createFeishuThreadBindingManager,
testing as threadBindingTesting,
@@ -18,7 +19,10 @@ const baseConfig: ClawdbotConfig = {
function registerHandlersForTest(config: Record<string, unknown> = baseConfig) {
return registerHookHandlersForTest<OpenClawPluginApi>({
config,
register: registerFeishuSubagentHooks,
register: (api) => {
registerFeishuSubagentHooks(api);
api.on("subagent_spawning", (event, ctx) => handleFeishuSubagentSpawning(event, ctx));
},
});
}