@mrciphersmith/keryx 0.4.14 → 0.4.15
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/cli.js +79 -53
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -24305,7 +24305,7 @@ var package_default;
|
|
|
24305
24305
|
var init_package = __esm(() => {
|
|
24306
24306
|
package_default = {
|
|
24307
24307
|
name: "@mrciphersmith/keryx",
|
|
24308
|
-
version: "0.4.
|
|
24308
|
+
version: "0.4.15",
|
|
24309
24309
|
description: "Version-controlled project context for AI coding agents: code graph, architecture wiki, project memory, relevant tests, quality signals, and task flows.",
|
|
24310
24310
|
private: false,
|
|
24311
24311
|
publishConfig: {
|
|
@@ -297625,7 +297625,7 @@ var init_native_coverage_generated = __esm(() => {
|
|
|
297625
297625
|
registryDigest: "286041ef4394afd4de97b4da37e31ccb2728c485cd32488c737a2686c244fbca",
|
|
297626
297626
|
contractDigest: "43cd83cfbd494ce63e1f6c86a5a0c057a160f4a537d8119358e0f262412a96c9",
|
|
297627
297627
|
subjectCatalogueDigest: "819a324bfef3387bf464f5c78d4831751b03c9c4f3cb636471e2d8f4bd88d6cc",
|
|
297628
|
-
inventoryDigest: "
|
|
297628
|
+
inventoryDigest: "3b511b4103523ed7d7a43acfe8bb142baf7fe65d63fbb10a23a4907c2aca0ca2",
|
|
297629
297629
|
releaseReady: true,
|
|
297630
297630
|
counts: {
|
|
297631
297631
|
registeredCommands: 74,
|
|
@@ -297903,7 +297903,7 @@ var init_native_coverage_generated = __esm(() => {
|
|
|
297903
297903
|
"workspace.navigate"
|
|
297904
297904
|
],
|
|
297905
297905
|
otherBlockers: [],
|
|
297906
|
-
descriptorDigest: "
|
|
297906
|
+
descriptorDigest: "4c0cb7f45d35dfad8bd25c2093d7fa50a174e767b2e1570b16f9eb8fa3b0c222"
|
|
297907
297907
|
};
|
|
297908
297908
|
});
|
|
297909
297909
|
|
|
@@ -339521,7 +339521,6 @@ async function createSessionHost(options) {
|
|
|
339521
339521
|
decisionJournal: { session: questionJournal.session, lastDecisionId: questionJournal.lastDecisionId },
|
|
339522
339522
|
restriction,
|
|
339523
339523
|
...rewindPort === undefined ? {} : { rewind: rewindPort },
|
|
339524
|
-
close: closeForCommand,
|
|
339525
339524
|
record,
|
|
339526
339525
|
catalogue: catalogue(),
|
|
339527
339526
|
runtime: options.runtime,
|
|
@@ -339734,30 +339733,37 @@ async function createSessionHost(options) {
|
|
|
339734
339733
|
throw new SessionHostError("recovery-required");
|
|
339735
339734
|
if (active !== undefined || request.expectedSessionVersion !== record.version || request.expectedHistoryVersion !== record.historyVersion || request.expectedWorkspaceBaseline !== record.workspaceBaseline)
|
|
339736
339735
|
throw new SessionHostError("stale-resume-pins");
|
|
339737
|
-
const
|
|
339738
|
-
|
|
339739
|
-
|
|
339740
|
-
|
|
339741
|
-
|
|
339742
|
-
|
|
339743
|
-
|
|
339744
|
-
|
|
339745
|
-
|
|
339746
|
-
|
|
339747
|
-
|
|
339748
|
-
|
|
339749
|
-
|
|
339750
|
-
|
|
339751
|
-
|
|
339752
|
-
|
|
339753
|
-
|
|
339754
|
-
|
|
339755
|
-
|
|
339756
|
-
|
|
339757
|
-
|
|
339758
|
-
|
|
339759
|
-
|
|
339736
|
+
const reacquired = options.workspace.checkoutLease?.reacquire();
|
|
339737
|
+
try {
|
|
339738
|
+
const verified = await options.workspace.verify(record.workspaceBaseline);
|
|
339739
|
+
if (!verified.ok)
|
|
339740
|
+
throw new SessionHostError("workspace-conflict");
|
|
339741
|
+
if (opened.lease.checkLost())
|
|
339742
|
+
throw new SessionHostError("native-lease-lost");
|
|
339743
|
+
if (opened.lease.released) {
|
|
339744
|
+
const reopened = openLeasedSession({ cwd: options.cwd, resumeId: nativeId, ...options.dataDir === undefined ? {} : { dataDir: options.dataDir } });
|
|
339745
|
+
unwatchLease();
|
|
339746
|
+
opened = reopened;
|
|
339747
|
+
handle = reopened.handle;
|
|
339748
|
+
options.onNativeLease?.({ token: opened.lease.owner.token, nativeSessionId: handle.summary.id });
|
|
339749
|
+
history.splice(0, history.length, ...reopened.history);
|
|
339750
|
+
archive.splice(0, archive.length, ...reopened.archive);
|
|
339751
|
+
archiveCursor = history.length;
|
|
339752
|
+
options.runtime.bindSessionDir(handle.dir);
|
|
339753
|
+
unwatchLease = opened.lease.onLost(onLeaseLost);
|
|
339754
|
+
try {
|
|
339755
|
+
await attachSessionServices();
|
|
339756
|
+
} catch {
|
|
339757
|
+
lostResumable = false;
|
|
339758
|
+
record.state = "recovery-required";
|
|
339759
|
+
state();
|
|
339760
|
+
throw new SessionHostError("recovery-required");
|
|
339761
|
+
}
|
|
339760
339762
|
}
|
|
339763
|
+
} catch (cause) {
|
|
339764
|
+
if (reacquired && opened.lease.released)
|
|
339765
|
+
options.workspace.checkoutLease?.release();
|
|
339766
|
+
throw cause;
|
|
339761
339767
|
}
|
|
339762
339768
|
lostRun = undefined;
|
|
339763
339769
|
lostResumable = false;
|
|
@@ -339875,16 +339881,25 @@ async function createSessionHost(options) {
|
|
|
339875
339881
|
state();
|
|
339876
339882
|
throw new SessionHostError("native-lease-lost");
|
|
339877
339883
|
}
|
|
339878
|
-
|
|
339879
|
-
if (!
|
|
339880
|
-
|
|
339881
|
-
|
|
339882
|
-
|
|
339883
|
-
|
|
339884
|
+
try {
|
|
339885
|
+
if (!opened.lease.released) {
|
|
339886
|
+
for (const abort of inspections.keys())
|
|
339887
|
+
abort.abort(new SessionHostError("session-closed"));
|
|
339888
|
+
const stopped = await options.runtime.stop();
|
|
339889
|
+
const settled = await within4(Promise.allSettled([...inspections.values()]).then(() => true), false, SETTLE_BOUND_MS);
|
|
339890
|
+
if (stopped.status !== "stopped" || !settled || !await closeSessionServices() || opened.lease.checkLost()) {
|
|
339891
|
+
throw new SessionHostError("recovery-required");
|
|
339892
|
+
}
|
|
339893
|
+
syncHistory();
|
|
339894
|
+
await options.runtime.preserveSession();
|
|
339895
|
+
releaseSessionLease(opened.lease);
|
|
339884
339896
|
}
|
|
339885
|
-
|
|
339886
|
-
|
|
339887
|
-
|
|
339897
|
+
options.workspace.checkoutLease?.release();
|
|
339898
|
+
} catch {
|
|
339899
|
+
record.state = "recovery-required";
|
|
339900
|
+
state();
|
|
339901
|
+
fenceLease();
|
|
339902
|
+
return { status: "recovery-required" };
|
|
339888
339903
|
}
|
|
339889
339904
|
for (const item of queueItems)
|
|
339890
339905
|
if (item.state === "queued") {
|
|
@@ -340406,6 +340421,10 @@ async function createSessionHost(options) {
|
|
|
340406
340421
|
let outcome;
|
|
340407
340422
|
try {
|
|
340408
340423
|
const context = commandContext(operation.operationId, undefined, inspection.context);
|
|
340424
|
+
context.close = () => {
|
|
340425
|
+
inspection.close();
|
|
340426
|
+
return closeForCommand();
|
|
340427
|
+
};
|
|
340409
340428
|
if (options.lifecycle !== undefined) {
|
|
340410
340429
|
context.lifecycle = options.lifecycle;
|
|
340411
340430
|
context.lifecycleInput = lifecycleInput;
|
|
@@ -341003,6 +341022,8 @@ function acquireCheckoutLease(cwd, owner) {
|
|
|
341003
341022
|
};
|
|
341004
341023
|
return { get nonce() {
|
|
341005
341024
|
return nonce;
|
|
341025
|
+
}, get released() {
|
|
341026
|
+
return released;
|
|
341006
341027
|
}, assertOwnership, reacquire() {
|
|
341007
341028
|
if (!released)
|
|
341008
341029
|
throw new MachineError("lease-owner-mismatch");
|
|
@@ -344694,17 +344715,11 @@ class MachineBridge {
|
|
|
344694
344715
|
const request = validateControl("SessionResume", Object.fromEntries(Object.entries(args).filter(([key]) => key !== "sessionId")));
|
|
344695
344716
|
if (!request.ok || !verifyBaseline(mapping.cwd, hosted.workspace.baseline()))
|
|
344696
344717
|
throw new MachineError("workspace-conflict");
|
|
344697
|
-
if (hosted.
|
|
344698
|
-
|
|
344699
|
-
|
|
344700
|
-
|
|
344701
|
-
|
|
344702
|
-
source.lease.release(source.lease.nonce);
|
|
344703
|
-
source.leaseReleased = true;
|
|
344704
|
-
}
|
|
344705
|
-
this.lifecycleContext(input);
|
|
344706
|
-
hosted.lease.reacquire();
|
|
344707
|
-
hosted.leaseReleased = false;
|
|
344718
|
+
if (hosted.lease.released && source !== hosted && source.mapping.cwd === mapping.cwd && !source.lease.released) {
|
|
344719
|
+
const closed = await input.releaseSource();
|
|
344720
|
+
if (closed.state !== "closed")
|
|
344721
|
+
throw new MachineError("recovery-required");
|
|
344722
|
+
source.lease.release(source.lease.nonce);
|
|
344708
344723
|
}
|
|
344709
344724
|
this.lifecycleContext(input);
|
|
344710
344725
|
let actual;
|
|
@@ -344743,7 +344758,6 @@ class MachineBridge {
|
|
|
344743
344758
|
throw new MachineError("recovery-required");
|
|
344744
344759
|
this.lifecycleContext(input);
|
|
344745
344760
|
source.lease.release(source.lease.nonce);
|
|
344746
|
-
source.leaseReleased = true;
|
|
344747
344761
|
}
|
|
344748
344762
|
this.lifecycleContext(input);
|
|
344749
344763
|
const lease = acquireCheckoutLease(mapping.cwd, { hubId: this.options.enrollment.hubId, runId: record.sessionId, daemonId: this.daemonId });
|
|
@@ -344826,7 +344840,19 @@ class MachineBridge {
|
|
|
344826
344840
|
}
|
|
344827
344841
|
return this.connection?.connected ? readSessionActionAuthority({ hubUrl: this.options.enrollment.hubUrl, secret: readMachineSecret(this.options.enrollment), action }) : Promise.resolve(false);
|
|
344828
344842
|
},
|
|
344829
|
-
workspace: { ...workspace,
|
|
344843
|
+
workspace: { ...workspace, checkoutLease: {
|
|
344844
|
+
release: () => {
|
|
344845
|
+
if (!lease.released)
|
|
344846
|
+
lease.release(lease.nonce);
|
|
344847
|
+
},
|
|
344848
|
+
reacquire: () => {
|
|
344849
|
+
if (lease.released) {
|
|
344850
|
+
lease.reacquire();
|
|
344851
|
+
return true;
|
|
344852
|
+
}
|
|
344853
|
+
return false;
|
|
344854
|
+
}
|
|
344855
|
+
}, rewind: {
|
|
344830
344856
|
ownership: () => {
|
|
344831
344857
|
lease.assertOwnership();
|
|
344832
344858
|
const baseline = workspace.baseline();
|
|
@@ -345049,7 +345075,7 @@ class MachineBridge {
|
|
|
345049
345075
|
for (const [id, hosted] of this.hosted) {
|
|
345050
345076
|
if (sessionId !== undefined && id !== sessionId)
|
|
345051
345077
|
continue;
|
|
345052
|
-
let checkoutOwned = hosted.
|
|
345078
|
+
let checkoutOwned = !hosted.lease.released;
|
|
345053
345079
|
try {
|
|
345054
345080
|
if (checkoutOwned)
|
|
345055
345081
|
hosted.lease.assertOwnership();
|
|
@@ -345355,7 +345381,7 @@ class MachineBridge {
|
|
|
345355
345381
|
if (runs.some((run) => run.terminal?.outcome === "unknown") || unresolved.length >= 1000 || unresolved.some((row) => row.checkout === hosted.mapping.checkoutId))
|
|
345356
345382
|
return settle(ownerRefusal("recovery-required"), true);
|
|
345357
345383
|
try {
|
|
345358
|
-
if (hosted.
|
|
345384
|
+
if (hosted.lease.released)
|
|
345359
345385
|
throw new MachineError("lease-owner-mismatch");
|
|
345360
345386
|
hosted.lease.assertOwnership();
|
|
345361
345387
|
} catch (cause) {
|
|
@@ -345394,9 +345420,9 @@ class MachineBridge {
|
|
|
345394
345420
|
hosted.host.setConnected(false);
|
|
345395
345421
|
await hosted.host.dispose("machine-stop");
|
|
345396
345422
|
const state = await hosted.host.inspect();
|
|
345397
|
-
if (!hosted.
|
|
345423
|
+
if (!hosted.lease.released && (state.state === "idle" || state.state === "closed" || hosted.host.resumableAfterLost()))
|
|
345398
345424
|
hosted.lease.release(hosted.lease.nonce);
|
|
345399
|
-
else if (!hosted.
|
|
345425
|
+
else if (!hosted.lease.released)
|
|
345400
345426
|
provenStop = false;
|
|
345401
345427
|
}
|
|
345402
345428
|
this.hosted.clear();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrciphersmith/keryx",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.15",
|
|
4
4
|
"description": "Version-controlled project context for AI coding agents: code graph, architecture wiki, project memory, relevant tests, quality signals, and task flows.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|