@sagentlab/navarch-runtime 0.1.162 → 0.1.163
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/dist/api.cjs +1 -1
- package/dist/git-worktree.cjs +9 -0
- package/dist/session.cjs +9 -3
- package/package.json +1 -1
package/dist/api.cjs
CHANGED
|
@@ -136,7 +136,7 @@ class NavarchApiClient {
|
|
|
136
136
|
}
|
|
137
137
|
/** schema-design.md §7 — `POST /api/dispatch/claim {machine_capacity, capabilities} → task + context bundle`. */
|
|
138
138
|
async claim(req) {
|
|
139
|
-
const result = await this.request("POST", "/api/dispatch/claim", req, { allowEmpty: true });
|
|
139
|
+
const result = await this.request("POST", "/api/dispatch/claim", { ...req, delivery_baseline_protocol: 1 }, { allowEmpty: true });
|
|
140
140
|
if (!result || result.task == null)
|
|
141
141
|
return null;
|
|
142
142
|
return result;
|
package/dist/git-worktree.cjs
CHANGED
|
@@ -72,6 +72,7 @@ class GitWorktree {
|
|
|
72
72
|
sessionTokenMarker;
|
|
73
73
|
hostedCheckpointRef;
|
|
74
74
|
hostedCheckpointLocalRef;
|
|
75
|
+
hostedCheckpointLeaseId;
|
|
75
76
|
/** Set when the resumed remote branch had lost its ownership commit and must be re-marked. */
|
|
76
77
|
adoptedUnmarkedBranch = false;
|
|
77
78
|
constructor(options) {
|
|
@@ -122,6 +123,7 @@ class GitWorktree {
|
|
|
122
123
|
this.ownershipCommitIdentity = options.ownershipCommitIdentity ?? { name: "Navarch", email: "runtime@navarch.local" };
|
|
123
124
|
this.hostedCheckpointRef = options.restoreHostedCheckpoint ? hostedCheckpointRef(options.taskId) : null;
|
|
124
125
|
this.hostedCheckpointLocalRef = `refs/navarch/restored-checkpoints/${taskKey}`;
|
|
126
|
+
this.hostedCheckpointLeaseId = options.hostedCheckpointLeaseId;
|
|
125
127
|
}
|
|
126
128
|
async prepare(signal) {
|
|
127
129
|
signal?.throwIfAborted();
|
|
@@ -331,6 +333,13 @@ class GitWorktree {
|
|
|
331
333
|
if (!/^[0-9a-f]{40,64}$/i.test(sha) || !/^[0-9a-f]{40,64}$/i.test(parent)) {
|
|
332
334
|
throw new Error("the checkpoint ref did not resolve to a snapshot commit with a parent");
|
|
333
335
|
}
|
|
336
|
+
if (this.hostedCheckpointLeaseId !== undefined) {
|
|
337
|
+
const body = (await this.runGit(["--git-dir", this.repositoryPath, "show", "-s", "--format=%B", sha], false)).stdout;
|
|
338
|
+
const leases = body.split("\n").filter(line => line.startsWith("Navarch-Checkpoint-Lease:"));
|
|
339
|
+
if (leases.length !== 1 || leases[0] !== `Navarch-Checkpoint-Lease: ${this.hostedCheckpointLeaseId}`) {
|
|
340
|
+
throw new Error("checkpoint lease identity is missing or different; remote checkpoint preserved");
|
|
341
|
+
}
|
|
342
|
+
}
|
|
334
343
|
return { ref, sha: sha, parent: parent };
|
|
335
344
|
}
|
|
336
345
|
catch (error) {
|
package/dist/session.cjs
CHANGED
|
@@ -371,6 +371,7 @@ async function runClaimedSession(deps, claimed, sessionId, lifecycle) {
|
|
|
371
371
|
: undefined,
|
|
372
372
|
// Hosted runs skip checkpoints for verify tasks, which deliver a verdict.
|
|
373
373
|
restoreHostedCheckpoint: !deliveryBinding && !allowBranchRename && task.task_type !== "verify",
|
|
374
|
+
...(claimed.delivery_baseline_required ? { hostedCheckpointLeaseId: leaseId } : {}),
|
|
374
375
|
...(commitIdentity ? { ownershipCommitIdentity: commitIdentity.committer } : {}),
|
|
375
376
|
});
|
|
376
377
|
credentialConsumer.worktree = gitWorktree;
|
|
@@ -762,9 +763,14 @@ async function runClaimedSession(deps, claimed, sessionId, lifecycle) {
|
|
|
762
763
|
// after a restart, so a retry cannot relabel inherited commits as output.
|
|
763
764
|
if (claimed.delivery_baseline_required) {
|
|
764
765
|
const initialHead = await (0, delivery_cjs_1.captureDeliveryBaseline)(gitWorktree.worktreePath);
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
766
|
+
if (!/^[0-9a-f]{40}$/.test(initialHead))
|
|
767
|
+
throw new Error("Delivery baseline capture returned an invalid SHA");
|
|
768
|
+
const baseline = await api.heartbeatLease(leaseId, { delivery_baseline_sha: initialHead }).catch((error) => {
|
|
769
|
+
throw new Error(`Delivery baseline registration failed: ${String(error)}`);
|
|
770
|
+
});
|
|
771
|
+
if (typeof baseline.delivery_baseline_sha !== "string" || !/^[0-9a-f]{40}$/.test(baseline.delivery_baseline_sha)) {
|
|
772
|
+
throw new Error("The control plane did not persist a valid required delivery baseline acknowledgement");
|
|
773
|
+
}
|
|
768
774
|
deliveryBaselineSha = baseline.delivery_baseline_sha;
|
|
769
775
|
}
|
|
770
776
|
const { browserUse, playwrightSuites } = (0, browser_evidence_cjs_1.navarchBrowserTools)({
|
package/package.json
CHANGED