Files
Jyotisha/frontend/src/lib/contracts/rectification-entry.ts
T
jesse-uxandGrok (agent loop) d2296c2654 把前后端共用的请求契约和小工具收成一份,避免再各抄一份。
报告创建请求、校正入口和同名类型改从 contracts 推导;同义的对象判断与 sha256 改走共享函数。调用处用 import 别名保留原名,使 diff 低于 1500 行。行为、哈希和状态字符串不变。

Co-Authored-By: Grok (agent loop)
2026-10-15 22:22:44 +08:00

79 lines
2.1 KiB
TypeScript

export const RECTIFICATION_CASE_STATUSES = [
"draft",
"collecting_evidence",
"candidate_ready",
"candidate_accepted",
"needs_rebaseline",
"paused",
"confirmed",
"closed",
"abandoned",
"superseded",
] as const;
export type RectificationCaseStatus = (typeof RECTIFICATION_CASE_STATUSES)[number];
/** Statuses that may be resumed by the user. */
export const RESUMABLE_CASE_STATUSES: readonly RectificationCaseStatus[] = [
"draft",
"collecting_evidence",
"candidate_ready",
"candidate_accepted",
"needs_rebaseline",
"paused",
];
/** Statuses that only allow read-only history access. */
export const TERMINAL_CASE_STATUSES: readonly RectificationCaseStatus[] = [
"confirmed",
"closed",
"abandoned",
"superseded",
];
export type OpenRectificationDisposition = "created" | "resumed" | "readonly";
/** Wire shape. Status stays a string so cached and older payloads still parse. */
export type OpenRectificationCaseResponseWire = Readonly<{
disposition: OpenRectificationDisposition;
caseId: string;
sessionId: string;
status: string;
shouldStartOpening: boolean;
skillVersion: string;
}>;
export type OpenRectificationCaseResponse = Omit<OpenRectificationCaseResponseWire, "status"> & {
readonly status: RectificationCaseStatus;
};
type LatestResumableWire = Readonly<{
caseId: string;
status: string;
lastActivityAt: string;
}>;
type LatestTerminalWire = Readonly<{
caseId: string;
status: string;
hasUsableTime: boolean;
}>;
export type RectificationEntrySummaryWire = Readonly<{
hasResumableCase: boolean;
hasTerminalCaseWithTime: boolean;
latestResumable: LatestResumableWire | null;
latestTerminal: LatestTerminalWire | null;
}>;
export type RectificationEntrySummary = Readonly<{
hasResumableCase: boolean;
hasTerminalCaseWithTime: boolean;
latestResumable: (Omit<LatestResumableWire, "status"> & {
readonly status: RectificationCaseStatus;
}) | null;
latestTerminal: (Omit<LatestTerminalWire, "status"> & {
readonly status: RectificationCaseStatus;
}) | null;
}>;