mirror of
https://github.com/murashit/codex-panel.git
synced 2026-07-22 17:30:31 +00:00
70 lines
2 KiB
TypeScript
70 lines
2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { threadActivationSnapshotFromAppServerResponse } from "../../src/app-server/services/threads";
|
|
import type { Thread as AppServerThread } from "../../src/generated/app-server/v2/Thread";
|
|
import type { ThreadResumeResponse } from "../../src/generated/app-server/v2/ThreadResumeResponse";
|
|
|
|
describe("app-server thread activation", () => {
|
|
it("maps app-server activation responses into panel-owned snapshots", () => {
|
|
expect(threadActivationSnapshotFromAppServerResponse(responseFixture(threadFixture("thread", "Resumed")))).toMatchObject({
|
|
thread: {
|
|
id: "thread",
|
|
name: "Resumed",
|
|
archived: false,
|
|
},
|
|
cwd: "/vault",
|
|
model: "gpt-5.5",
|
|
serviceTier: "fast",
|
|
approvalsReviewer: "user",
|
|
reasoningEffort: "high",
|
|
approvalPolicy: "on-request",
|
|
sandboxPolicy: { type: "readOnly", networkAccess: false },
|
|
activePermissionProfile: null,
|
|
});
|
|
});
|
|
});
|
|
|
|
function responseFixture(thread: AppServerThread): ThreadResumeResponse {
|
|
return {
|
|
thread,
|
|
model: "gpt-5.5",
|
|
modelProvider: "openai",
|
|
serviceTier: "fast",
|
|
approvalPolicy: "on-request",
|
|
cwd: "/vault",
|
|
runtimeWorkspaceRoots: [],
|
|
instructionSources: [],
|
|
approvalsReviewer: "user",
|
|
activePermissionProfile: null,
|
|
sandbox: { type: "readOnly", networkAccess: false },
|
|
reasoningEffort: "high",
|
|
multiAgentMode: "explicitRequestOnly",
|
|
initialTurnsPage: null,
|
|
};
|
|
}
|
|
|
|
function threadFixture(id: string, name: string): AppServerThread {
|
|
return {
|
|
id,
|
|
sessionId: "session",
|
|
forkedFromId: null,
|
|
parentThreadId: null,
|
|
preview: "",
|
|
ephemeral: false,
|
|
modelProvider: "openai",
|
|
createdAt: 1,
|
|
updatedAt: 1,
|
|
recencyAt: null,
|
|
status: { type: "idle" },
|
|
path: null,
|
|
cwd: "/vault",
|
|
cliVersion: "0.0.0",
|
|
source: "unknown",
|
|
threadSource: null,
|
|
agentNickname: null,
|
|
agentRole: null,
|
|
gitInfo: null,
|
|
name,
|
|
turns: [],
|
|
};
|
|
}
|