feat(coding-agent): expose streamingBehavior on InputEvent

Add streamingBehavior to InputEvent so extensions can distinguish
idle prompts from mid-stream steers and queued follow-ups.

- Add streamingBehavior field to InputEvent type
- Thread it through ExtensionRunner.emitInput() and AgentSession.prompt()
- Add streaming-aware input gate example with tests
- Document in extensions.md
This commit is contained in:
Danny Thomas
2026-05-28 15:52:38 +10:00
parent b85bf65678
commit bcea4b2e27
8 changed files with 158 additions and 3 deletions

View File

@@ -94,6 +94,18 @@ describe("Input Event", () => {
}
});
it("passes streamingBehavior correctly", async () => {
const r = await createRunner(
`export default p => p.on("input", async e => { globalThis.testVar = e.streamingBehavior; return { action: "continue" }; });`,
);
await r.emitInput("x", undefined, "interactive", "steer");
expect((globalThis as any).testVar).toBe("steer");
await r.emitInput("x", undefined, "interactive", "followUp");
expect((globalThis as any).testVar).toBe("followUp");
await r.emitInput("x", undefined, "interactive");
expect((globalThis as any).testVar).toBeUndefined();
});
it("catches handler errors and continues", async () => {
const r = await createRunner(`export default p => p.on("input", async () => { throw new Error("boom"); });`);
const errs: string[] = [];