@springbrand/agent-runtime 0.3.0-alpha.3 → 0.3.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -43,6 +43,13 @@ const RETIRED_SCHEDULE_CALLBACKS = [
|
|
|
43
43
|
"_chatRecoveryRetry",
|
|
44
44
|
] as const;
|
|
45
45
|
|
|
46
|
+
const LEGACY_TERMINAL_SUBMISSION_STATUSES = new Set([
|
|
47
|
+
"completed",
|
|
48
|
+
"failed",
|
|
49
|
+
"aborted",
|
|
50
|
+
"skipped",
|
|
51
|
+
]);
|
|
52
|
+
|
|
46
53
|
type LegacyRecord = Record<string, unknown> & {
|
|
47
54
|
id: string;
|
|
48
55
|
parentId: string | null;
|
|
@@ -790,6 +797,9 @@ export function migrateLegacyPiSession(
|
|
|
790
797
|
const knownSubmissions = new Set(
|
|
791
798
|
submissions.map((row) => row.submission_id),
|
|
792
799
|
);
|
|
800
|
+
const submissionStatuses = new Map(
|
|
801
|
+
submissions.map((row) => [row.submission_id, row.status]),
|
|
802
|
+
);
|
|
793
803
|
for (const submission of submissions) {
|
|
794
804
|
if (submission.status !== "pending" || !submission.queued_input_json)
|
|
795
805
|
continue;
|
|
@@ -838,8 +848,12 @@ export function migrateLegacyPiSession(
|
|
|
838
848
|
if (!knownSubmissions.has(row.submission_id))
|
|
839
849
|
throw new Error("Dangling recovery submission");
|
|
840
850
|
const record = decodePiToolRecoveryMilestone(row.body);
|
|
841
|
-
if (!record || record.turnId !== row.submission_id)
|
|
851
|
+
if (!record || record.turnId !== row.submission_id) {
|
|
852
|
+
if (LEGACY_TERMINAL_SUBMISSION_STATUSES.has(
|
|
853
|
+
submissionStatuses.get(row.submission_id) ?? "",
|
|
854
|
+
)) continue;
|
|
842
855
|
throw new Error("Invalid legacy recovery milestone");
|
|
856
|
+
}
|
|
843
857
|
const bodies = bySubmission.get(row.submission_id) ?? [];
|
|
844
858
|
bodies.push(row.body);
|
|
845
859
|
bySubmission.set(row.submission_id, bodies);
|