mirror of
https://github.com/murashit/codex-panel.git
synced 2026-07-22 06:57:10 +00:00
Move task progress mapping to app-server
This commit is contained in:
parent
60ae60c1e1
commit
4cb72e957d
3 changed files with 19 additions and 10 deletions
|
|
@ -24,7 +24,7 @@ import {
|
|||
streamingFileChangeMessageStreamItem,
|
||||
type AppServerFileChange,
|
||||
} from "../mappers/message-stream/file-changes";
|
||||
import { taskProgressMessageStreamItem } from "../../domain/message-stream/factories/task-progress";
|
||||
import { taskProgressMessageStreamItem } from "../mappers/message-stream/task-progress";
|
||||
import type { MessageStreamItem, MessageStreamItemKind } from "../../domain/message-stream/items";
|
||||
import { goalChangeItem } from "../../domain/message-stream/factories/goal-items";
|
||||
import { hookRunMessageStreamItem } from "../mappers/message-stream/hook-run-items";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
import type { ExecutionState, MessageStreamItem } from "../items";
|
||||
import { executionStateFromStatus, RUNNING_EXECUTION_STATE, type ExecutionStateByStatus } from "../execution-state";
|
||||
import type { ExecutionState, MessageStreamItem } from "../../../domain/message-stream/items";
|
||||
import {
|
||||
executionStateFromStatus,
|
||||
RUNNING_EXECUTION_STATE,
|
||||
type ExecutionStateByStatus,
|
||||
} from "../../../domain/message-stream/execution-state";
|
||||
|
||||
const TASK_STATES = {
|
||||
pending: RUNNING_EXECUTION_STATE,
|
||||
|
|
@ -9,7 +13,7 @@ const TASK_STATES = {
|
|||
|
||||
type TaskStepStatus = "pending" | "inProgress" | "completed";
|
||||
|
||||
export interface TaskPlanStep {
|
||||
interface TaskPlanStep {
|
||||
step: string;
|
||||
status: TaskStepStatus;
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { collabAgentStateExecutionState } from "../../../../src/features/chat/domain/message-stream/agent-state";
|
||||
import { activeAgentRunSummary } from "../../../../src/features/chat/domain/message-stream/semantics/active-turn";
|
||||
import { activeTurnLiveItems } from "../../../../src/features/chat/domain/message-stream/semantics/active-turn";
|
||||
import { messageStreamLayoutBlocks } from "../../../../src/features/chat/presentation/message-stream/layout";
|
||||
import { upsertMessageStreamItemById } from "../../../../src/features/chat/domain/message-stream/updates";
|
||||
import { taskProgressMessageStreamItem } from "../../../../src/features/chat/domain/message-stream/factories/task-progress";
|
||||
import { taskProgressMessageStreamItem } from "../../../../src/features/chat/app-server/mappers/message-stream/task-progress";
|
||||
import { normalizeProposedPlanMarkdown } from "../../../../src/features/chat/domain/message-stream/format/proposed-plan";
|
||||
import { pathRelativeToRoot } from "../../../../src/shared/path/file-paths";
|
||||
import { permissionRows } from "../../../../src/features/chat/domain/message-stream/format/permission-rows";
|
||||
|
|
@ -61,6 +61,11 @@ function autoReviewResultItem(id: string, turnId: string, text = "Auto-review ap
|
|||
};
|
||||
}
|
||||
|
||||
function activeAgentSummary(items: readonly MessageStreamItem[], activeTurnId: string | null) {
|
||||
if (!activeTurnId) return null;
|
||||
return activeTurnLiveItems({ items }, activeTurnId).find((item) => item.kind === "agentSummary")?.summary ?? null;
|
||||
}
|
||||
|
||||
describe("turn item conversion preserves app-server semantics", () => {
|
||||
it("sorts app-server turns oldest first before converting messages", () => {
|
||||
const userMessage: TurnItem = {
|
||||
|
|
@ -1241,14 +1246,14 @@ describe("display block grouping keeps message stream details subordinate to con
|
|||
},
|
||||
];
|
||||
|
||||
expect(activeAgentRunSummary(items, "t1")).toEqual({
|
||||
expect(activeAgentSummary(items, "t1")).toEqual({
|
||||
running: 1,
|
||||
completed: 1,
|
||||
failed: 1,
|
||||
agents: [{ threadId: "running", status: "running", messagePreview: null }],
|
||||
additionalAgents: 0,
|
||||
});
|
||||
expect(activeAgentRunSummary(items, null)).toBeNull();
|
||||
expect(activeAgentSummary(items, null)).toBeNull();
|
||||
});
|
||||
|
||||
it("summarizes active subagent previews and fallback receiver states", () => {
|
||||
|
|
@ -1291,7 +1296,7 @@ describe("display block grouping keeps message stream details subordinate to con
|
|||
},
|
||||
];
|
||||
|
||||
expect(activeAgentRunSummary(items, "t1")).toMatchObject({
|
||||
expect(activeAgentSummary(items, "t1")).toMatchObject({
|
||||
running: 5,
|
||||
completed: 0,
|
||||
failed: 1,
|
||||
|
|
@ -1325,7 +1330,7 @@ describe("display block grouping keeps message stream details subordinate to con
|
|||
},
|
||||
];
|
||||
|
||||
expect(activeAgentRunSummary(items, "t1")).toBeNull();
|
||||
expect(activeAgentSummary(items, "t1")).toBeNull();
|
||||
});
|
||||
|
||||
it("adds edited files to the final assistant message", () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue