Integrate the current Grok settlement, monitor/subagent lifecycle, interrupt containment, steer visibility, and image support stack into the orchestration-v2 branch. Co-authored-by: codex <[email protected]>
78 lines
2.7 KiB
TypeScript
78 lines
2.7 KiB
TypeScript
import { NodeId, RunId } from "@t3tools/contracts";
|
|
import { describe, expect, it } from "vite-plus/test";
|
|
|
|
import { isOrchestrationV2TurnItemVisible } from "./orchestrationV2Timeline.ts";
|
|
|
|
const runId = RunId.make("run:timeline-visibility");
|
|
const nodeId = NodeId.make("node:timeline-visibility");
|
|
|
|
describe("isOrchestrationV2TurnItemVisible", () => {
|
|
it("hides unpaired interruption results from superseded attempts", () => {
|
|
expect(
|
|
isOrchestrationV2TurnItemVisible({
|
|
item: { type: "run_interrupt_result", runId, nodeId },
|
|
runs: [{ id: runId, status: "running" }],
|
|
attempts: [{ runId, rootNodeId: nodeId, status: "superseded" }],
|
|
items: [{ type: "run_interrupt_result", runId, nodeId }],
|
|
}),
|
|
).toBe(false);
|
|
});
|
|
|
|
it("keeps paired interruption results from superseded attempts", () => {
|
|
expect(
|
|
isOrchestrationV2TurnItemVisible({
|
|
item: { type: "run_interrupt_result", runId, nodeId },
|
|
runs: [{ id: runId, status: "running" }],
|
|
attempts: [{ runId, rootNodeId: nodeId, status: "superseded" }],
|
|
items: [
|
|
{ type: "run_interrupt_request", runId, nodeId },
|
|
{ type: "run_interrupt_result", runId, nodeId },
|
|
],
|
|
}),
|
|
).toBe(true);
|
|
});
|
|
|
|
it("keeps interruption results from terminal attempts without a request", () => {
|
|
expect(
|
|
isOrchestrationV2TurnItemVisible({
|
|
item: { type: "run_interrupt_result", runId, nodeId },
|
|
runs: [{ id: runId, status: "interrupted" }],
|
|
attempts: [{ runId, rootNodeId: nodeId, status: "interrupted" }],
|
|
items: [{ type: "run_interrupt_result", runId, nodeId }],
|
|
}),
|
|
).toBe(true);
|
|
});
|
|
|
|
it("keeps interruption results from terminal attempts with a request", () => {
|
|
expect(
|
|
isOrchestrationV2TurnItemVisible({
|
|
item: { type: "run_interrupt_result", runId, nodeId },
|
|
runs: [{ id: runId, status: "interrupted" }],
|
|
attempts: [{ runId, rootNodeId: nodeId, status: "interrupted" }],
|
|
items: [
|
|
{ type: "run_interrupt_request", runId, nodeId },
|
|
{ type: "run_interrupt_result", runId, nodeId },
|
|
],
|
|
}),
|
|
).toBe(true);
|
|
});
|
|
|
|
it("does not hide an interruption because another attempt was superseded", () => {
|
|
expect(
|
|
isOrchestrationV2TurnItemVisible({
|
|
item: { type: "run_interrupt_result", runId, nodeId },
|
|
runs: [{ id: runId, status: "interrupted" }],
|
|
attempts: [
|
|
{
|
|
runId,
|
|
rootNodeId: NodeId.make("node:timeline-visibility:older"),
|
|
status: "superseded",
|
|
},
|
|
{ runId, rootNodeId: nodeId, status: "interrupted" },
|
|
],
|
|
items: [{ type: "run_interrupt_result", runId, nodeId }],
|
|
}),
|
|
).toBe(true);
|
|
});
|
|
});
|