feat: enable permission-aware subagents

This commit is contained in:
叶林立
2026-08-26 10:49:26 +08:00
parent d3bf562189
commit 7571ba6dd9
185 changed files with 48365 additions and 26 deletions
+27
View File
@@ -0,0 +1,27 @@
/**
* Real extension fixture "lazy" for the template-driven e2e runner.
*
* Registers its tool from `session_start` rather than at load — the shape that
* broke subagents in issue #125. pi-mcp does exactly this (it can only enumerate
* tools once its MCP servers connect), and eagerly connecting at load time would
* orphan child processes on pi's non-agent code paths.
*
* The point of the fixture is the TIMING: at `loader.reload()` this extension
* contributes no tools at all, so any scoping that snapshots the tool set then
* will drop `lazy_tool` permanently. See ext-alpha.mjs for the conventions.
*/
import { Type } from "@sinclair/typebox";
export default function (pi) {
pi.on("session_start", () => {
pi.registerTool({
name: "lazy_tool",
label: "lazy_tool",
description: "Lazily-registered extension tool (e2e fixture).",
parameters: Type.Object({}),
async execute() {
return { content: [{ type: "text", text: "lazy_tool" }] };
},
});
});
}