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:
@@ -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[] = [];
|
||||
|
||||
Reference in New Issue
Block a user