@evident-ai/runner-synchroniser 3.5.1 → 3.5.2-dev.1c27282
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 +22 -47
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -50940,9 +50940,14 @@ function storeOf(config, name) {
|
|
|
50940
50940
|
|
|
50941
50941
|
// src/diagnostics.ts
|
|
50942
50942
|
init_esm_shims();
|
|
50943
|
-
|
|
50944
|
-
|
|
50943
|
+
|
|
50944
|
+
// src/assert-never.ts
|
|
50945
|
+
init_esm_shims();
|
|
50946
|
+
function assertNever(value, subject) {
|
|
50947
|
+
throw new Error(`Unhandled ${subject}: ${JSON.stringify(value)}`);
|
|
50945
50948
|
}
|
|
50949
|
+
|
|
50950
|
+
// src/diagnostics.ts
|
|
50946
50951
|
function describeRestoreOutcome(label, path, outcome) {
|
|
50947
50952
|
switch (outcome.kind) {
|
|
50948
50953
|
case "local":
|
|
@@ -50960,21 +50965,9 @@ function describeRestoreOutcome(label, path, outcome) {
|
|
|
50960
50965
|
case "disabled":
|
|
50961
50966
|
return `No ${label} credentials at ${path}; credential persistence is disabled (LITESTREAM_BUCKET/LITESTREAM_PREFIX unset), so nothing could be restored.`;
|
|
50962
50967
|
default:
|
|
50963
|
-
return assertNever(outcome);
|
|
50968
|
+
return assertNever(outcome, "restore outcome");
|
|
50964
50969
|
}
|
|
50965
50970
|
}
|
|
50966
|
-
function assertNeverSessionDb(value) {
|
|
50967
|
-
throw new Error(`Unhandled session-DB restore outcome: ${JSON.stringify(value)}`);
|
|
50968
|
-
}
|
|
50969
|
-
function assertNeverUnusableReplicaReason(value) {
|
|
50970
|
-
throw new Error(`Unhandled unusable-replica reason: ${JSON.stringify(value)}`);
|
|
50971
|
-
}
|
|
50972
|
-
function assertNeverFatalCause(value) {
|
|
50973
|
-
throw new Error(`Unhandled fatal cause: ${JSON.stringify(value)}`);
|
|
50974
|
-
}
|
|
50975
|
-
function assertNeverNoReplicaLocalDb(value) {
|
|
50976
|
-
throw new Error(`Unhandled noReplica local-DB state: ${JSON.stringify(value)}`);
|
|
50977
|
-
}
|
|
50978
50971
|
function sessionDbExitCode(outcome) {
|
|
50979
50972
|
switch (outcome.kind) {
|
|
50980
50973
|
case "disabled":
|
|
@@ -50992,7 +50985,7 @@ function sessionDbExitCode(outcome) {
|
|
|
50992
50985
|
return 30;
|
|
50993
50986
|
// shared by a genuine misconfig and a deliberate `crash` choice
|
|
50994
50987
|
default:
|
|
50995
|
-
return
|
|
50988
|
+
return assertNever(outcome, "session-DB restore outcome");
|
|
50996
50989
|
}
|
|
50997
50990
|
}
|
|
50998
50991
|
function describeUnusableReplica(reason) {
|
|
@@ -51011,7 +51004,7 @@ function describeUnusableReplica(reason) {
|
|
|
51011
51004
|
case "targetHealthy":
|
|
51012
51005
|
return `${base2} (--on-unusable-replica=prune found a newest L0 object but could not confirm it is corrupt \u2014 it either passed the LTX structural check or could not be re-read \u2014 so it declined to delete it; nothing in S3 was touched.)`;
|
|
51013
51006
|
default:
|
|
51014
|
-
return
|
|
51007
|
+
return assertNever(reason, "unusable-replica reason");
|
|
51015
51008
|
}
|
|
51016
51009
|
}
|
|
51017
51010
|
function describeSessionDbFatal(outcome, config) {
|
|
@@ -51024,7 +51017,7 @@ function describeSessionDbFatal(outcome, config) {
|
|
|
51024
51017
|
case "deliberate":
|
|
51025
51018
|
return `FATAL: ${outcome.detail}`;
|
|
51026
51019
|
default:
|
|
51027
|
-
return
|
|
51020
|
+
return assertNever(outcome.cause, "fatal cause");
|
|
51028
51021
|
}
|
|
51029
51022
|
}
|
|
51030
51023
|
function describeNoReplica(localDb) {
|
|
@@ -51034,7 +51027,7 @@ function describeNoReplica(localDb) {
|
|
|
51034
51027
|
case "empty":
|
|
51035
51028
|
return "litestream restore succeeded but left a zero-byte opencode.db; opencode will create a fresh session DB.";
|
|
51036
51029
|
default:
|
|
51037
|
-
return
|
|
51030
|
+
return assertNever(localDb, "noReplica local-DB state");
|
|
51038
51031
|
}
|
|
51039
51032
|
}
|
|
51040
51033
|
function describeSessionDbClassification(outcome, config) {
|
|
@@ -51059,24 +51052,9 @@ function describeSessionDbClassification(outcome, config) {
|
|
|
51059
51052
|
case "fatal":
|
|
51060
51053
|
return describeSessionDbFatal(outcome, config);
|
|
51061
51054
|
default:
|
|
51062
|
-
return
|
|
51055
|
+
return assertNever(outcome, "session-DB restore outcome");
|
|
51063
51056
|
}
|
|
51064
51057
|
}
|
|
51065
|
-
function assertNeverSessionDbVerify(value) {
|
|
51066
|
-
throw new Error(`Unhandled session-DB verify outcome: ${JSON.stringify(value)}`);
|
|
51067
|
-
}
|
|
51068
|
-
function assertNeverSessionDbVerifySkippedLocalDb(value) {
|
|
51069
|
-
throw new Error(`Unhandled session-DB verify skipped local-DB state: ${JSON.stringify(value)}`);
|
|
51070
|
-
}
|
|
51071
|
-
function assertNeverSessionDbVerifyExhaustedReason(value) {
|
|
51072
|
-
throw new Error(`Unhandled session-DB verify exhausted reason: ${JSON.stringify(value)}`);
|
|
51073
|
-
}
|
|
51074
|
-
function assertNeverSessionDbVerifySeparation(value) {
|
|
51075
|
-
throw new Error(`Unhandled session-DB verify separation: ${JSON.stringify(value)}`);
|
|
51076
|
-
}
|
|
51077
|
-
function assertNeverSessionDbVerifyLocalDb(value) {
|
|
51078
|
-
throw new Error(`Unhandled session-DB verify local-DB disposal: ${JSON.stringify(value)}`);
|
|
51079
|
-
}
|
|
51080
51058
|
function sessionDbVerifyExitCode(outcome) {
|
|
51081
51059
|
switch (outcome.kind) {
|
|
51082
51060
|
case "skipped":
|
|
@@ -51093,7 +51071,7 @@ function sessionDbVerifyExitCode(outcome) {
|
|
|
51093
51071
|
case "unreachable":
|
|
51094
51072
|
return 34;
|
|
51095
51073
|
default:
|
|
51096
|
-
return
|
|
51074
|
+
return assertNever(outcome.separation, "session-DB verify separation");
|
|
51097
51075
|
}
|
|
51098
51076
|
switch (outcome.localDb.kind) {
|
|
51099
51077
|
case "discarded":
|
|
@@ -51102,10 +51080,10 @@ function sessionDbVerifyExitCode(outcome) {
|
|
|
51102
51080
|
case "discardFailed":
|
|
51103
51081
|
return 34;
|
|
51104
51082
|
default:
|
|
51105
|
-
return
|
|
51083
|
+
return assertNever(outcome.localDb, "session-DB verify local-DB disposal");
|
|
51106
51084
|
}
|
|
51107
51085
|
default:
|
|
51108
|
-
return
|
|
51086
|
+
return assertNever(outcome, "session-DB verify outcome");
|
|
51109
51087
|
}
|
|
51110
51088
|
}
|
|
51111
51089
|
function describeSessionDbVerifySkipped(localDb) {
|
|
@@ -51115,7 +51093,7 @@ function describeSessionDbVerifySkipped(localDb) {
|
|
|
51115
51093
|
case "empty":
|
|
51116
51094
|
return "opencode.db is zero bytes; nothing to verify at boot.";
|
|
51117
51095
|
default:
|
|
51118
|
-
return
|
|
51096
|
+
return assertNever(localDb, "session-DB verify skipped local-DB state");
|
|
51119
51097
|
}
|
|
51120
51098
|
}
|
|
51121
51099
|
function describeSessionDbVerifyExhausted(outcome) {
|
|
@@ -51135,7 +51113,7 @@ function describeSessionDbVerifyExhausted(outcome) {
|
|
|
51135
51113
|
reason = `opencode.db failed its integrity check; the walkback search budget ran out before every retained restore point was tried (${tried}) \u2014 widen it with EVIDENT_SESSION_DB_WALKBACK_MAX_POINTS/EVIDENT_SESSION_DB_WALKBACK_BUDGET_SECONDS if there was more to try`;
|
|
51136
51114
|
break;
|
|
51137
51115
|
default:
|
|
51138
|
-
return
|
|
51116
|
+
return assertNever(outcome.reason, "session-DB verify exhausted reason");
|
|
51139
51117
|
}
|
|
51140
51118
|
let separation;
|
|
51141
51119
|
switch (outcome.separation.kind) {
|
|
@@ -51153,7 +51131,7 @@ function describeSessionDbVerifyExhausted(outcome) {
|
|
|
51153
51131
|
separation = ` Boot is stopping because replica separation could not be proven (${outcome.separation.detail}); backup history remains readable at its original key or quarantine destination.`;
|
|
51154
51132
|
break;
|
|
51155
51133
|
default:
|
|
51156
|
-
return
|
|
51134
|
+
return assertNever(outcome.separation, "session-DB verify separation");
|
|
51157
51135
|
}
|
|
51158
51136
|
let localDb;
|
|
51159
51137
|
switch (outcome.localDb.kind) {
|
|
@@ -51167,7 +51145,7 @@ function describeSessionDbVerifyExhausted(outcome) {
|
|
|
51167
51145
|
localDb = ` Boot is stopping because local disposal could not be proven; removed=${outcome.localDb.removed.join(", ") || "(none)"} survived=${outcome.localDb.survived.join(", ") || "(none)"}. See SESSION-DB-LOCAL-DISCARD-FAILED.`;
|
|
51168
51146
|
break;
|
|
51169
51147
|
default:
|
|
51170
|
-
return
|
|
51148
|
+
return assertNever(outcome.localDb, "session-DB verify local-DB disposal");
|
|
51171
51149
|
}
|
|
51172
51150
|
return `SESSION-DB-INTEGRITY-EXHAUSTED: ${reason}.${separation}${localDb}`;
|
|
51173
51151
|
}
|
|
@@ -51182,7 +51160,7 @@ function describeSessionDbVerification(outcome) {
|
|
|
51182
51160
|
case "exhausted":
|
|
51183
51161
|
return describeSessionDbVerifyExhausted(outcome);
|
|
51184
51162
|
default:
|
|
51185
|
-
return
|
|
51163
|
+
return assertNever(outcome, "session-DB verify outcome");
|
|
51186
51164
|
}
|
|
51187
51165
|
}
|
|
51188
51166
|
|
|
@@ -61540,9 +61518,6 @@ async function clearReplica(store, prefix, keys, log) {
|
|
|
61540
61518
|
}
|
|
61541
61519
|
|
|
61542
61520
|
// src/session-db.ts
|
|
61543
|
-
function assertNeverStrategy(value) {
|
|
61544
|
-
throw new Error(`Unhandled unusable-replica strategy: ${JSON.stringify(value)}`);
|
|
61545
|
-
}
|
|
61546
61521
|
async function classifySessionDbRestore(params) {
|
|
61547
61522
|
const outcome = await decideSessionDbRestore(params);
|
|
61548
61523
|
if (outcome.kind === "unusableReplica") {
|
|
@@ -61634,7 +61609,7 @@ async function decideSessionDbRestore(params) {
|
|
|
61634
61609
|
return { kind: "recovered", strategy: "clear", deleted: result.deleted, recovery };
|
|
61635
61610
|
}
|
|
61636
61611
|
default:
|
|
61637
|
-
return
|
|
61612
|
+
return assertNever(strategy, "unusable-replica strategy");
|
|
61638
61613
|
}
|
|
61639
61614
|
}
|
|
61640
61615
|
function shouldEscalateToQuarantine(reason, prefix, keys) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evident-ai/runner-synchroniser",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.2-dev.1c27282",
|
|
4
4
|
"description": "Restores and syncs the Evident runner's OpenCode credential stores (and litestream config) to an object store, so a runner survives task replacement with almost no state loss.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cli.js",
|