feat: add authenticated voice pipeline API docs
CI / Verify and package (ubuntu-latest) (push) Canceled after 0s
CI / Verify and package (windows-latest) (push) Canceled after 0s

This commit is contained in:
snowspeeder
2026-08-04 19:09:33 -04:00
parent a2e4f1d576
commit 0793fa0ac4
14 changed files with 1874 additions and 9 deletions
@@ -65,6 +65,21 @@ describe("PiSessionService", () => {
await service.dispose();
});
it("forwards Pi's native agent_settled event without inferring it from agent_end", async () => {
const { fake, service, events } = messagesService([]);
await service.status(sessionRef("session-1"));
fake.emit({ type: "agent_end" });
await new Promise<void>((resolve) => setImmediate(resolve));
expect(events.sessionEvents.map(({ event }) => event).filter((event) => event.type === "agent.settled")).toEqual([]);
fake.emit({ type: "agent_settled" });
expect(events.sessionEvents.map(({ event }) => event).filter((event) => event.type === "agent.settled")).toEqual([
{ type: "agent.settled" },
]);
await service.dispose();
});
it("annotates the join-time stream snapshot partial with the current thinking level", async () => {
const streamingMessage = {
role: "assistant",
+4
View File
@@ -3224,6 +3224,9 @@ export class PiSessionService implements SessionRouteService {
this.publishActivityForEvent(session, event);
const eventType = getString(event, "type");
if (eventType === "agent_end") this.abortRunScopedExtensionDialogs(session.sessionId);
// Pi itself emits agent_settled only after automatic retries, compaction,
// and queued continuations are exhausted. Preserve that native lifecycle
// event; never infer it from agent_end or mutable runtime flags.
if (eventType === "compaction_end") this.scheduleCompactionQueueDrain(session.sessionId);
if (eventType === "agent_start" || eventType === "agent_end") this.scheduleCompactionQueueDrain(session.sessionId);
this.publishStatus(session);
@@ -4209,6 +4212,7 @@ function toClientEvent(event: unknown, thinkingLevel?: string): SessionUiEvent {
}
if (eventType === "agent_start") return { type: "agent.start" };
if (eventType === "agent_end") return { type: "agent.end" };
if (eventType === "agent_settled") return { type: "agent.settled" };
if (eventType === "message_end") {
const message = getProperty(event, "message");
if (message === undefined) return { type: "message.end" };