@akagilnc/pi-workflow-roles 0.1.5483 → 0.1.5571
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/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/acp-host/production-host.js +6312 -6376
- package/dist/analyst-gate-cycles-read.js +28 -78
- package/dist/analyst-ledger.js +26 -42
- package/dist/analyst-metric-families/acceptance-success-rework.js +25 -1
- package/dist/analyst-metric-families/round-timeline.js +2 -5
- package/dist/archivist-record-entry.js +4 -3
- package/dist/archivist-record-pointer.js +71 -36
- package/dist/atomic-write.js +2 -2
- package/dist/auditor-dossier-tool.js +11 -6
- package/dist/auditor-soul.js +5 -12
- package/dist/collector-config.js +6 -5
- package/dist/doctor-evidence.js +8 -4
- package/dist/engine-detour-usage.js +8 -22
- package/dist/headless-host/production-host.js +5969 -6011
- package/dist/host-descriptions.js +0 -4
- package/dist/host-session-record.js +266 -267
- package/dist/ledger-session-read.js +5 -0
- package/dist/migrate-book-topology.js +1369 -722
- package/dist/navigator-public-session.js +13 -17
- package/dist/notary-source-run.js +8 -16
- package/dist/packaged-role-registry.js +5 -56
- package/dist/pi/durable-principal.js +2 -3
- package/dist/pi/role-turn-host.js +79 -15
- package/dist/public-cli/auto-resume.js +8 -47
- package/dist/public-cli/instruction-seat-run.js +9 -7
- package/dist/public-cli/invocation.js +67 -100
- package/dist/public-cli/main.js +2689 -2532
- package/dist/public-cli/post-admission.js +96 -55
- package/dist/public-cli/run-lifecycle.js +44 -100
- package/dist/public-cli/settlement.js +184 -429
- package/dist/public-cli/terminal.js +0 -12
- package/dist/role-run-placement.js +53 -16
- package/dist/role-run-relocation.js +111 -52
- package/dist/run-dossier-files.js +30 -0
- package/dist/run-dossier.js +322 -0
- package/dist/run-terminal-artifacts.js +69 -202
- package/dist/run-ticket-number.js +49 -7
- package/dist/session-assistant-usage.js +9 -18
- package/dist/session-identity.js +49 -19
- package/dist/sitian-appender.js +29 -18
- package/dist/sitian-facade.js +11 -0
- package/dist/sitian-reader.js +44 -29
- package/dist/submission-gate.js +1 -1
- package/dist/submission-ledger.js +4 -4
- package/dist/ticket-provenance-contracts.js +2 -8
- package/dist/ticket-provenance.js +25 -9
- package/package.json +1 -1
- package/scripts/build-package.mjs +2 -0
- package/src/acp-host/production-host.ts +1 -1
- package/src/acp-host/role-turn-host.ts +11 -4
- package/src/analyst-gate-cycles-read.ts +31 -88
- package/src/analyst-ledger.ts +36 -51
- package/src/analyst-metric-families/acceptance-success-rework.ts +24 -1
- package/src/analyst-metric-families/gate-cycles.ts +1 -1
- package/src/analyst-metric-families/round-timeline.ts +2 -5
- package/src/analyst-page.ts +3 -3
- package/src/archivist-record-entry.ts +6 -5
- package/src/archivist-record-pointer.ts +92 -42
- package/src/atomic-write.ts +3 -1
- package/src/auditor-dossier-tool.ts +14 -8
- package/src/auditor-soul.ts +5 -10
- package/src/book-topology-migration-placement.ts +16 -3
- package/src/book-topology-record-class-migrators.ts +4 -2
- package/src/book-topology-runs-migrator.ts +6 -3
- package/src/collector-config.ts +5 -3
- package/src/doctor-contracts.ts +1 -1
- package/src/doctor-evidence.ts +7 -3
- package/src/engine-detour-tool.ts +1 -1
- package/src/engine-detour-usage.ts +12 -25
- package/src/external-host-turn-loop.ts +25 -0
- package/src/factory-board.ts +16 -81
- package/src/headless-host/production-host.ts +1 -4
- package/src/headless-host/role-turn-host.ts +56 -21
- package/src/host-descriptions.ts +0 -6
- package/src/host-session-record.ts +224 -140
- package/src/ledger-session-read.ts +6 -0
- package/src/navigator-public-session.ts +13 -18
- package/src/navigator-work-context.ts +3 -1
- package/src/notary-role.ts +2 -1
- package/src/notary-source-run.ts +8 -18
- package/src/packaged-role-registry.ts +1 -65
- package/src/pi/adapter.ts +50 -7
- package/src/pi/durable-principal.ts +2 -4
- package/src/pi/role-turn-host.ts +85 -14
- package/src/public-cli/auto-resume.ts +7 -43
- package/src/public-cli/instruction-seat-run.ts +13 -6
- package/src/public-cli/invocation.ts +90 -144
- package/src/public-cli/post-admission.ts +111 -72
- package/src/public-cli/run-lifecycle.ts +47 -115
- package/src/public-cli/settlement.ts +221 -589
- package/src/public-cli/terminal.ts +1 -61
- package/src/role-envelope.ts +4 -2
- package/src/role-run-placement.ts +65 -17
- package/src/role-run-relocation.ts +110 -70
- package/src/role-runtime.ts +46 -69
- package/src/run-dossier-files.ts +33 -0
- package/src/run-dossier.ts +357 -0
- package/src/run-terminal-artifacts.ts +84 -240
- package/src/run-ticket-number.ts +82 -14
- package/src/session-assistant-usage.ts +8 -20
- package/src/session-identity.ts +52 -21
- package/src/sitian-appender.ts +33 -26
- package/src/sitian-facade.ts +22 -0
- package/src/sitian-reader.ts +62 -32
- package/src/submission-gate.ts +1 -1
- package/src/submission-ledger.ts +4 -4
- package/src/ticket-provenance-contracts.ts +3 -6
- package/src/ticket-provenance.ts +23 -11
- package/src/ticket-snapshot.ts +3 -2
- package/src/ticket-trajectory.ts +95 -109
|
@@ -8,14 +8,15 @@
|
|
|
8
8
|
import { chmod, lstat, open, readdir, readFile, unlink, writeFile } from "node:fs/promises";
|
|
9
9
|
import { basename, isAbsolute, join } from "node:path";
|
|
10
10
|
import { activationBookDirectory, resolveActivationLedgerHome, } from "../activation-ledger-topology.js";
|
|
11
|
-
import { listBookRunDirectories } from "../role-run-placement.js";
|
|
11
|
+
import { findRoleRunDirectory, listBookRunDirectories, parseRunLeaf, sessionFileIn } from "../role-run-placement.js";
|
|
12
12
|
import { isSafePositiveTicketNumber } from "../run-ticket-number.js";
|
|
13
13
|
import { CliUsageError } from "./cli-errors.js";
|
|
14
14
|
import { parseCollectorRepository } from "../collector-config.js";
|
|
15
|
-
import { rewriteAdmittedRoleRunPage, rewriteRunDirectoryPathValue, } from "../role-run-relocation.js";
|
|
15
|
+
import { retainedRunPathsMatch, rewriteAdmittedRoleRunPage, rewriteRunDirectoryPathValue, } from "../role-run-relocation.js";
|
|
16
16
|
import { appendEngineSessionMaterial, engineSessionMaterialFromOptions, pickEngineAxis, } from "../package-resources/engine-material.js";
|
|
17
17
|
import { packagedResumeSourcePath, packagedRoleMetadata, } from "../packaged-role-registry.js";
|
|
18
18
|
import { admittedReviewerBaseFault, recordEffectiveInvocationModel, requireAuthorityRef, isReviewerLens, } from "./invocation.js";
|
|
19
|
+
import { readPageSync, writeSectionSync } from "../run-dossier.js";
|
|
19
20
|
import { isRecord, errorText, isEnoent } from "../unknown-value.js";
|
|
20
21
|
/** Default for the #422 configurable single-call auto-resume ceiling
|
|
21
22
|
* (public-cli.json top-level `autoResumeLimit`). No longer the runtime truth
|
|
@@ -41,11 +42,10 @@ export function buildAutoResumeContinuationPrompt(options) {
|
|
|
41
42
|
...pickEngineAxis(options),
|
|
42
43
|
})).join("\n");
|
|
43
44
|
}
|
|
44
|
-
const RUN_STATE_FILE = "run-state.json";
|
|
45
45
|
const WRITER_LOCK_FILE = "writer.lock";
|
|
46
46
|
export async function writeRoleRunState(runDirectory, record) {
|
|
47
47
|
const payload = { ...record, runDirectory };
|
|
48
|
-
|
|
48
|
+
writeSectionSync(runDirectory, "runState", { ...payload });
|
|
49
49
|
}
|
|
50
50
|
function parseSameTicketSummonsMaterials(raw) {
|
|
51
51
|
if (!isRecord(raw))
|
|
@@ -106,43 +106,34 @@ function parseCurrentCourtState(raw) {
|
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
108
|
async function readRoleRunStateRaw(runDirectory) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
// file is genuine infrastructure/data damage and must keep its own
|
|
117
|
-
// identity — callers route it through the controlled-failure seam
|
|
118
|
-
// (markRunRunning/markRunTerminal/recordCurrentCourt)
|
|
119
|
-
// instead of it being relabeled "run state missing" (#836).
|
|
120
|
-
if (errorCodeOf(error) === "ENOENT")
|
|
121
|
-
return undefined;
|
|
122
|
-
throw error;
|
|
123
|
-
}
|
|
124
|
-
return raw;
|
|
109
|
+
// Only true absence (no state.jsonl run-state row) is a lawful "no run state
|
|
110
|
+
// yet". A real read failure (EISDIR, EACCES, ...) or an illegal latest payload
|
|
111
|
+
// is genuine infrastructure/data damage and must keep its own identity —
|
|
112
|
+
// callers route it through the controlled-failure seam
|
|
113
|
+
// (markRunRunning/markRunTerminal/recordCurrentCourt) instead of it being
|
|
114
|
+
// relabeled "run state missing" (#836). readPageSync throws those.
|
|
115
|
+
return readPageSync(runDirectory, "runState");
|
|
125
116
|
}
|
|
126
117
|
function parseRoleRunIdentity(raw, runDirectory) {
|
|
127
118
|
if (!isRecord(raw)) {
|
|
128
|
-
throw new TypeError("Invalid run-state
|
|
119
|
+
throw new TypeError("Invalid state.jsonl run-state");
|
|
129
120
|
}
|
|
130
121
|
const record = raw;
|
|
131
122
|
if (typeof record.runId !== "string" || record.runId.trim() === "") {
|
|
132
|
-
throw new TypeError("Invalid run-state
|
|
123
|
+
throw new TypeError("Invalid state.jsonl run-state");
|
|
133
124
|
}
|
|
134
125
|
const role = typeof record.role === "string" ? packagedRoleMetadata(record.role)?.role : undefined;
|
|
135
126
|
if (role === undefined) {
|
|
136
|
-
throw new TypeError("Invalid run-state
|
|
127
|
+
throw new TypeError("Invalid state.jsonl run-state");
|
|
137
128
|
}
|
|
138
129
|
if (record.state !== "admitted" &&
|
|
139
130
|
record.state !== "running" &&
|
|
140
131
|
record.state !== "resumable" &&
|
|
141
132
|
record.state !== "terminal") {
|
|
142
|
-
throw new TypeError("Invalid run-state
|
|
133
|
+
throw new TypeError("Invalid state.jsonl run-state");
|
|
143
134
|
}
|
|
144
135
|
if (typeof record.bookKey !== "string")
|
|
145
|
-
throw new TypeError("Invalid run-state
|
|
136
|
+
throw new TypeError("Invalid state.jsonl run-state");
|
|
146
137
|
return {
|
|
147
138
|
runId: record.runId,
|
|
148
139
|
role,
|
|
@@ -158,11 +149,9 @@ async function readRoleRunStateDisk(runDirectory) {
|
|
|
158
149
|
const identity = parseRoleRunIdentity(raw, runDirectory);
|
|
159
150
|
const record = raw;
|
|
160
151
|
if (typeof record.projectRoot !== "string")
|
|
161
|
-
throw new TypeError("Invalid run-state
|
|
152
|
+
throw new TypeError("Invalid state.jsonl run-state");
|
|
162
153
|
if (typeof record.sessionDirectory !== "string")
|
|
163
|
-
throw new TypeError("Invalid run-state
|
|
164
|
-
if (typeof record.admittedRequestPath !== "string")
|
|
165
|
-
throw new TypeError("Invalid run-state.json");
|
|
154
|
+
throw new TypeError("Invalid state.jsonl run-state");
|
|
166
155
|
const storedRunDirectory = typeof record.runDirectory === "string" && record.runDirectory.trim() !== ""
|
|
167
156
|
? record.runDirectory
|
|
168
157
|
: runDirectory;
|
|
@@ -185,7 +174,6 @@ async function readRoleRunStateDisk(runDirectory) {
|
|
|
185
174
|
bookKey: identity.bookKey,
|
|
186
175
|
projectRoot: record.projectRoot,
|
|
187
176
|
runDirectory: runDir,
|
|
188
|
-
admittedRequestPath: rewriteRunDirectoryPathValue(record.admittedRequestPath, storedRunDirectory, runDirectory),
|
|
189
177
|
principalWire,
|
|
190
178
|
...(phase === undefined ? {} : { phase }),
|
|
191
179
|
...(currentCourt === undefined ? {} : { currentCourt }),
|
|
@@ -203,11 +191,10 @@ async function writeRoleRunStateDisk(runDirectory, disk) {
|
|
|
203
191
|
...(disk.principalWire.sessionFile === undefined
|
|
204
192
|
? {}
|
|
205
193
|
: { sessionFile: disk.principalWire.sessionFile }),
|
|
206
|
-
admittedRequestPath: disk.admittedRequestPath,
|
|
207
194
|
...(disk.phase === undefined ? {} : { phase: disk.phase }),
|
|
208
195
|
...(disk.currentCourt === undefined ? {} : { currentCourt: disk.currentCourt }),
|
|
209
196
|
};
|
|
210
|
-
|
|
197
|
+
writeSectionSync(runDirectory, "runState", payload);
|
|
211
198
|
}
|
|
212
199
|
/** One authority.decode of the uninterpreted wire → record + opaque principal (frozen wire itself). */
|
|
213
200
|
function materializeRoleRunFromDisk(disk, authority) {
|
|
@@ -224,7 +211,6 @@ function materializeRoleRunFromDisk(disk, authority) {
|
|
|
224
211
|
sessionDirectory: coordinates.sessionDirectory,
|
|
225
212
|
sessionFile: coordinates.sessionFile,
|
|
226
213
|
runDirectory: disk.runDirectory,
|
|
227
|
-
admittedRequestPath: disk.admittedRequestPath,
|
|
228
214
|
...(disk.phase === undefined ? {} : { phase: disk.phase }),
|
|
229
215
|
},
|
|
230
216
|
};
|
|
@@ -265,14 +251,13 @@ export async function markRunAdmitted(admitted, authority) {
|
|
|
265
251
|
projectRoot: admitted.projectRoot,
|
|
266
252
|
sessionDirectory,
|
|
267
253
|
sessionFile,
|
|
268
|
-
admittedRequestPath: admitted.admittedRequestPath,
|
|
269
254
|
...(workerPhase === undefined ? {} : { phase: workerPhase }),
|
|
270
255
|
});
|
|
271
256
|
}
|
|
272
257
|
/**
|
|
273
258
|
* Shared dispatch execution seam: transition to running, then record the
|
|
274
259
|
* effective launch model (initial or resume override) and the authoritative
|
|
275
|
-
* seat engine/host onto invocation.
|
|
260
|
+
* seat engine/host onto the invocation section.
|
|
276
261
|
* Role runners must not coordinate lifecycle ledger writes themselves.
|
|
277
262
|
* Engine axis is authoritative here (#617): present string is written; omit/undefined
|
|
278
263
|
* clears any prior engine key so unset-engine + resume does not keep a stale value.
|
|
@@ -645,33 +630,9 @@ export async function findRunDirectoryById(home, runId, onlyBookKey, onlyRole) {
|
|
|
645
630
|
return undefined;
|
|
646
631
|
throw error;
|
|
647
632
|
}
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
continue;
|
|
652
|
-
const bookDir = activationBookDirectory(ledgerHome, bookKey);
|
|
653
|
-
let runDirectories;
|
|
654
|
-
try {
|
|
655
|
-
runDirectories = await listBookRunDirectories(bookDir);
|
|
656
|
-
}
|
|
657
|
-
catch (error) {
|
|
658
|
-
if (errorCodeOf(error) === "ENOENT")
|
|
659
|
-
continue;
|
|
660
|
-
throw error;
|
|
661
|
-
}
|
|
662
|
-
for (const runDirectory of runDirectories) {
|
|
663
|
-
const entry = basename(runDirectory);
|
|
664
|
-
if ((onlyRole === undefined && (entry === `${runId}@judge` || entry.startsWith(`${runId}@`))) ||
|
|
665
|
-
entry === `${runId}@${onlyRole}`) {
|
|
666
|
-
matches.push(runDirectory);
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
if (matches.length === 0)
|
|
671
|
-
return undefined;
|
|
672
|
-
if (matches.length === 1)
|
|
673
|
-
return matches[0];
|
|
674
|
-
throw new Error(`ambiguous role run id ${runId}: ${matches.join(", ")}`);
|
|
633
|
+
return findRoleRunDirectory(bookKeys
|
|
634
|
+
.filter((bookKey) => onlyBookKey === undefined || bookKey === onlyBookKey)
|
|
635
|
+
.map((bookKey) => activationBookDirectory(ledgerHome, bookKey)), runId, onlyRole);
|
|
675
636
|
}
|
|
676
637
|
/** Code-owned gate inspector summons prefix (public-role-summons / #747). */
|
|
677
638
|
export const GATE_DOSSIER_POINTER_PREFIX = "卷宗指针:";
|
|
@@ -688,19 +649,9 @@ export function parentRunPathFromGatePointerInstruction(instruction) {
|
|
|
688
649
|
* Missing page → undefined; damage / non-ENOENT IO propagates.
|
|
689
650
|
*/
|
|
690
651
|
export async function readRunParentPath(runDirectory) {
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
raw = JSON.parse(await readFile(join(runDirectory, "admitted-request.json"), "utf8"));
|
|
694
|
-
}
|
|
695
|
-
catch (error) {
|
|
696
|
-
if (errorCodeOf(error) === "ENOENT")
|
|
697
|
-
return undefined;
|
|
698
|
-
throw error;
|
|
699
|
-
}
|
|
700
|
-
if (!isRecord(raw)) {
|
|
652
|
+
const record = readPageSync(runDirectory, "admitted");
|
|
653
|
+
if (record === undefined)
|
|
701
654
|
return undefined;
|
|
702
|
-
}
|
|
703
|
-
const record = raw;
|
|
704
655
|
if (typeof record.sourceRunPath === "string" && record.sourceRunPath.trim() !== "") {
|
|
705
656
|
return record.sourceRunPath;
|
|
706
657
|
}
|
|
@@ -723,7 +674,7 @@ async function runHasFormedSessionPrincipal(runDirectory) {
|
|
|
723
674
|
const sessionFile = typeof disk.principalWire.sessionFile === "string" &&
|
|
724
675
|
disk.principalWire.sessionFile.trim() !== ""
|
|
725
676
|
? disk.principalWire.sessionFile
|
|
726
|
-
:
|
|
677
|
+
: sessionFileIn(disk.principalWire.sessionDirectory);
|
|
727
678
|
try {
|
|
728
679
|
const stat = await lstat(sessionFile);
|
|
729
680
|
return stat.isFile() && !stat.isSymbolicLink();
|
|
@@ -759,19 +710,15 @@ export async function findLatestRunIdForSeatTicket(input) {
|
|
|
759
710
|
return undefined;
|
|
760
711
|
throw error;
|
|
761
712
|
}
|
|
762
|
-
const suffix = `@${input.role}`;
|
|
763
713
|
let best;
|
|
764
714
|
for (const runDirectory of runDirectories) {
|
|
765
|
-
const
|
|
766
|
-
if (
|
|
767
|
-
continue;
|
|
768
|
-
const runId = entry.slice(0, entry.length - suffix.length);
|
|
769
|
-
if (runId.length === 0)
|
|
715
|
+
const parsed = parseRunLeaf(basename(runDirectory));
|
|
716
|
+
if (parsed === undefined || parsed.role !== input.role)
|
|
770
717
|
continue;
|
|
718
|
+
const runId = parsed.runId;
|
|
771
719
|
const parentPath = await readRunParentPath(runDirectory);
|
|
772
|
-
//
|
|
773
|
-
|
|
774
|
-
if (parentPath !== input.parentRunPath && basename(parentPath ?? "") !== basename(input.parentRunPath))
|
|
720
|
+
// Follow the parent's retained placement without collapsing distinct book/subject bindings.
|
|
721
|
+
if (!await retainedRunPathsMatch(parentPath, input.parentRunPath, input.parentRunPath))
|
|
775
722
|
continue;
|
|
776
723
|
// Durable fact: never resume-select a provisional that never formed principal.
|
|
777
724
|
if (!(await runHasFormedSessionPrincipal(runDirectory)))
|
|
@@ -817,7 +764,7 @@ async function loadResumableRunRecord(home, runId, authority) {
|
|
|
817
764
|
throw new CliUsageError(`unknown role run id: ${runId}`);
|
|
818
765
|
}
|
|
819
766
|
const { run, principal } = materialized;
|
|
820
|
-
// Reconstruct admitted identity from durable run record + admitted
|
|
767
|
+
// Reconstruct admitted identity from durable run record + the admitted section.
|
|
821
768
|
let instruction = "";
|
|
822
769
|
let instructionEmpty = true;
|
|
823
770
|
let attachments = [];
|
|
@@ -845,9 +792,10 @@ async function loadResumableRunRecord(home, runId, authority) {
|
|
|
845
792
|
let sourceRunPath;
|
|
846
793
|
let sourceRun;
|
|
847
794
|
try {
|
|
848
|
-
const
|
|
849
|
-
if (
|
|
850
|
-
|
|
795
|
+
const record = readPageSync(run.runDirectory, "admitted");
|
|
796
|
+
if (record === undefined)
|
|
797
|
+
throw new Error("state.jsonl has no admitted-request row");
|
|
798
|
+
{
|
|
851
799
|
const storedRunDirectory = typeof record.runDirectory === "string" && record.runDirectory.trim() !== ""
|
|
852
800
|
? record.runDirectory
|
|
853
801
|
: run.runDirectory;
|
|
@@ -888,7 +836,7 @@ async function loadResumableRunRecord(home, runId, authority) {
|
|
|
888
836
|
lens = record.lens;
|
|
889
837
|
}
|
|
890
838
|
// Collector — admitted repository/PR identity (#633 resume).
|
|
891
|
-
if (
|
|
839
|
+
if (isSafePositiveTicketNumber(record.prNumber)) {
|
|
892
840
|
prNumber = record.prNumber;
|
|
893
841
|
}
|
|
894
842
|
if (typeof record.repository === "string" && record.repository.trim() !== "") {
|
|
@@ -907,7 +855,7 @@ async function loadResumableRunRecord(home, runId, authority) {
|
|
|
907
855
|
waitWindowMs = record.waitWindowMs;
|
|
908
856
|
}
|
|
909
857
|
// Doctor — admitted single-case identity (#633 resume).
|
|
910
|
-
if (
|
|
858
|
+
if (isSafePositiveTicketNumber(record.issueNumber)) {
|
|
911
859
|
issueNumber = record.issueNumber;
|
|
912
860
|
}
|
|
913
861
|
if (typeof record.caseRunsPath === "string" && record.caseRunsPath.trim() !== "") {
|
|
@@ -915,9 +863,7 @@ async function loadResumableRunRecord(home, runId, authority) {
|
|
|
915
863
|
}
|
|
916
864
|
if (isRecord(record.caseIdentity)) {
|
|
917
865
|
const ci = record.caseIdentity;
|
|
918
|
-
if (
|
|
919
|
-
Number.isSafeInteger(ci.issueNumber) &&
|
|
920
|
-
ci.issueNumber >= 1 &&
|
|
866
|
+
if (isSafePositiveTicketNumber(ci.issueNumber) &&
|
|
921
867
|
typeof ci.runsPath === "string" &&
|
|
922
868
|
ci.runsPath.trim() !== "") {
|
|
923
869
|
caseIdentity = { issueNumber: ci.issueNumber, runsPath: ci.runsPath };
|
|
@@ -984,9 +930,8 @@ async function loadResumableRunRecord(home, runId, authority) {
|
|
|
984
930
|
}
|
|
985
931
|
let model;
|
|
986
932
|
try {
|
|
987
|
-
const
|
|
988
|
-
if (
|
|
989
|
-
const rec = invocationRaw;
|
|
933
|
+
const rec = readPageSync(run.runDirectory, "invocation");
|
|
934
|
+
if (rec !== undefined) {
|
|
990
935
|
if (typeof rec.provider === "string" && typeof rec.model === "string") {
|
|
991
936
|
model = {
|
|
992
937
|
provider: rec.provider,
|
|
@@ -1013,9 +958,9 @@ async function loadResumableRunRecord(home, runId, authority) {
|
|
|
1013
958
|
throw new CliUsageError(`role run invocation identity is unreadable: ${runId}`, { cause: error });
|
|
1014
959
|
}
|
|
1015
960
|
}
|
|
1016
|
-
const sourceRunLeaf = basename(sourceRunPath ?? "")
|
|
1017
|
-
const referencedRunId = sourceRun?.runId ?? sourceRunLeaf
|
|
1018
|
-
const referencedRole = sourceRun?.role ?? sourceRunLeaf
|
|
961
|
+
const sourceRunLeaf = parseRunLeaf(basename(sourceRunPath ?? ""));
|
|
962
|
+
const referencedRunId = sourceRun?.runId ?? sourceRunLeaf?.runId;
|
|
963
|
+
const referencedRole = sourceRun?.role ?? sourceRunLeaf?.role;
|
|
1019
964
|
if (referencedRunId !== undefined && referencedRunId !== "") {
|
|
1020
965
|
const currentSourceRunDirectory = await findRunDirectoryById(home, referencedRunId, run.bookKey, referencedRole);
|
|
1021
966
|
if (currentSourceRunDirectory !== undefined) {
|
|
@@ -1073,7 +1018,6 @@ function resumedBaseAdmitted(loaded) {
|
|
|
1073
1018
|
attachments: loaded.admittedFields.attachments,
|
|
1074
1019
|
runDirectory: loaded.run.runDirectory,
|
|
1075
1020
|
principal: loaded.principal,
|
|
1076
|
-
admittedRequestPath: loaded.run.admittedRequestPath,
|
|
1077
1021
|
...(loaded.admittedFields.model === undefined ? {} : { model: loaded.admittedFields.model }),
|
|
1078
1022
|
...restoredTicketFields(loaded.admittedFields),
|
|
1079
1023
|
};
|