Revert "Forward live usage stream events"

This reverts commit 4779757138.
This commit is contained in:
Mohamed Boudra
2026-06-20 22:52:34 +07:00
parent 4779757138
commit 1927dbb190
2 changed files with 0 additions and 52 deletions

View File

@@ -160,45 +160,6 @@ describe("shared messages stream parsing", () => {
}
});
it("parses agent_stream usage_updated events", () => {
const fixture = {
type: "agent_stream",
payload: {
agentId: "agent_live",
timestamp: "2026-02-08T20:10:00.000Z",
event: {
type: "usage_updated",
provider: "claude",
turnId: "foreground-turn-1",
usage: {
contextWindowUsedTokens: 24_074,
contextWindowMaxTokens: 200_000,
},
},
},
};
const parsed = AgentStreamMessageSchema.parse(fixture);
expect(parsed.payload.event).toEqual({
type: "usage_updated",
provider: "claude",
turnId: "foreground-turn-1",
usage: {
contextWindowUsedTokens: 24_074,
contextWindowMaxTokens: 200_000,
},
});
const wrapped = WSOutboundMessageSchema.parse({
type: "session",
message: fixture,
});
expect(wrapped.message.type).toBe("agent_stream");
if (wrapped.message.type === "agent_stream") {
expect(wrapped.message.payload.event.type).toBe("usage_updated");
}
});
it("parses representative sub_agent tool_call event", () => {
const parsed = AgentStreamMessageSchema.parse({
type: "agent_stream",

View File

@@ -594,19 +594,11 @@ export const AgentStreamEventPayloadSchema = z.discriminatedUnion("type", [
z.object({
type: z.literal("turn_started"),
provider: AgentProviderSchema,
turnId: z.string().optional(),
}),
z.object({
type: z.literal("turn_completed"),
provider: AgentProviderSchema,
usage: AgentUsageSchema.optional(),
turnId: z.string().optional(),
}),
z.object({
type: z.literal("usage_updated"),
provider: AgentProviderSchema,
usage: AgentUsageSchema,
turnId: z.string().optional(),
}),
z.object({
type: z.literal("turn_failed"),
@@ -614,32 +606,27 @@ export const AgentStreamEventPayloadSchema = z.discriminatedUnion("type", [
error: z.string(),
code: z.string().optional(),
diagnostic: z.string().optional(),
turnId: z.string().optional(),
}),
z.object({
type: z.literal("turn_canceled"),
provider: AgentProviderSchema,
reason: z.string(),
turnId: z.string().optional(),
}),
z.object({
type: z.literal("timeline"),
provider: AgentProviderSchema,
item: AgentTimelineItemPayloadSchema,
turnId: z.string().optional(),
}),
z.object({
type: z.literal("permission_requested"),
provider: AgentProviderSchema,
request: AgentPermissionRequestPayloadSchema,
turnId: z.string().optional(),
}),
z.object({
type: z.literal("permission_resolved"),
provider: AgentProviderSchema,
requestId: z.string(),
resolution: AgentPermissionResponseSchema,
turnId: z.string().optional(),
}),
z.object({
type: z.literal("attention_required"),