mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-01 18:07:00 +01:00
Preserve the reviewed candidate source and mainline provider behavior. Co-Authored-By: Paperclip <noreply@paperclip.ing>
21 lines
1.5 KiB
TypeScript
21 lines
1.5 KiB
TypeScript
import { readFileSync } from "node:fs";
|
|
import { readCopilotStopAcknowledgement } from "./copilot-stop-acknowledgement.js";
|
|
|
|
// Synthetic scope/times over a retained, sanitized current-mainline API response.
|
|
// This helper calibrates fixture assertions; it provides no live qualification.
|
|
export const retainedMainlineStop = JSON.parse(readFileSync(new URL("./fixtures/copilot-mainline-stop-ack-v15.json", import.meta.url), "utf8"));
|
|
export function applyMainlineStopMetadata(run: Record<string, any>) {
|
|
const existing = run.resultJson ?? {}, template = structuredClone(retainedMainlineStop.run.resultJson);
|
|
const requestedAt = existing.startupCancellation?.requestedAt ?? template.startupCancellation.requestedAt;
|
|
run.runtimeMode = "native";
|
|
run.resultJson = { ...existing, cancelledByActorType: "user", cancelledByUserId: "local-board",
|
|
cancellation: { ...template.cancellation, recordedAt: requestedAt },
|
|
startupCancellation: { requestedAt, beforeNativeSelection: false },
|
|
nativeCancellation: { ...template.nativeCancellation, ...existing.nativeCancellation,
|
|
intentId: template.nativeCancellation.intentId, companyId: run.companyId, runId: run.id, issueId: run.nativeIssueId } };
|
|
}
|
|
export function stopAcknowledgementForTest(run: Record<string, any>, fixtureCorrelationId: string, dispatchMonotonicNs: string) {
|
|
return readCopilotStopAcknowledgement(run, { companyId: run.companyId, runId: run.id, issueId: run.nativeIssueId, callerUserId: "local-board" },
|
|
fixtureCorrelationId, dispatchMonotonicNs, (BigInt(dispatchMonotonicNs) + 1n).toString());
|
|
}
|