@fro.bot/systematic 3.22.2 → 3.22.3
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/index.js +61 -29
- package/package.json +6 -4
package/dist/index.js
CHANGED
|
@@ -3652,11 +3652,11 @@ function createReceiptLedger(options = {}) {
|
|
|
3652
3652
|
unit: null
|
|
3653
3653
|
};
|
|
3654
3654
|
function digestIdentity(domain, identity) {
|
|
3655
|
-
const
|
|
3656
|
-
if (!
|
|
3655
|
+
const trimmed = typeof identity === "string" ? identity.trim() : "";
|
|
3656
|
+
if (!trimmed || !DIGEST_DOMAIN_SET.has(domain)) {
|
|
3657
3657
|
return digestReceiptIdentity(domain, "invalid", sessionSaltBytes);
|
|
3658
3658
|
}
|
|
3659
|
-
return digestReceiptIdentity(domain,
|
|
3659
|
+
return digestReceiptIdentity(domain, trimmed, sessionSaltBytes);
|
|
3660
3660
|
}
|
|
3661
3661
|
function digestContext(context, operation) {
|
|
3662
3662
|
return {
|
|
@@ -8704,7 +8704,7 @@ function createWorkflowGuard(options) {
|
|
|
8704
8704
|
return operation === "push" || operation === "pr-creation" || operation === "check-readback" || operation === "review-readback";
|
|
8705
8705
|
}
|
|
8706
8706
|
function stateFingerprint(operation, state) {
|
|
8707
|
-
const value = [
|
|
8707
|
+
const value = JSON.stringify([
|
|
8708
8708
|
operation,
|
|
8709
8709
|
state.workspaceIdentity,
|
|
8710
8710
|
state.repositoryIdentity ?? "-",
|
|
@@ -8715,7 +8715,7 @@ function createWorkflowGuard(options) {
|
|
|
8715
8715
|
state.pullRequest?.state ?? "-",
|
|
8716
8716
|
state.checkState ?? "-",
|
|
8717
8717
|
state.reviewDecision ?? "-"
|
|
8718
|
-
]
|
|
8718
|
+
]);
|
|
8719
8719
|
return options.ledger.digestIdentity("resource", value);
|
|
8720
8720
|
}
|
|
8721
8721
|
function operationBeforeReason(input, unit) {
|
|
@@ -10535,6 +10535,9 @@ function normalizeTarget(args2) {
|
|
|
10535
10535
|
function digestCall(ledger, callID) {
|
|
10536
10536
|
return ledger.digestIdentity("call", callID);
|
|
10537
10537
|
}
|
|
10538
|
+
function isLocalOperationAfter(host) {
|
|
10539
|
+
return isLocalOperationTool(host.tool);
|
|
10540
|
+
}
|
|
10538
10541
|
function isLocalOperationTool(tool) {
|
|
10539
10542
|
return tool === "write" || tool === "edit" || tool === "apply_patch" || tool === "bash";
|
|
10540
10543
|
}
|
|
@@ -10749,49 +10752,52 @@ function deriveOpencodeOperationTarget(tool, args2, options) {
|
|
|
10749
10752
|
}
|
|
10750
10753
|
return tool === "bash" ? deriveBashTarget(args2, sessionLocation, parentTargetRoot, options, realPath) : unavailableOperationTarget();
|
|
10751
10754
|
}
|
|
10752
|
-
function serializeStableArray(value, depth
|
|
10755
|
+
function serializeStableArray(value, depth) {
|
|
10756
|
+
if (Object.getOwnPropertySymbols(value).length > 0)
|
|
10757
|
+
return;
|
|
10753
10758
|
const entries = [];
|
|
10754
|
-
let remaining = budget;
|
|
10755
10759
|
for (const entry of value) {
|
|
10756
|
-
const serialized = stableSerialize(entry, depth + 1
|
|
10760
|
+
const serialized = stableSerialize(entry, depth + 1);
|
|
10757
10761
|
if (serialized === undefined)
|
|
10758
10762
|
return;
|
|
10759
10763
|
entries.push(serialized);
|
|
10760
|
-
remaining -= serialized.length;
|
|
10761
10764
|
}
|
|
10762
10765
|
return `[${entries.join(",")}]`;
|
|
10763
10766
|
}
|
|
10764
|
-
function serializeStableRecord(value, depth
|
|
10767
|
+
function serializeStableRecord(value, depth) {
|
|
10765
10768
|
const entries = [];
|
|
10766
|
-
let remaining = budget;
|
|
10767
10769
|
for (const key of Object.keys(value).sort()) {
|
|
10768
|
-
const serialized = stableSerialize(value[key], depth + 1
|
|
10770
|
+
const serialized = stableSerialize(value[key], depth + 1);
|
|
10769
10771
|
if (serialized === undefined)
|
|
10770
10772
|
return;
|
|
10771
|
-
|
|
10772
|
-
entries.push(entry);
|
|
10773
|
-
remaining -= entry.length;
|
|
10773
|
+
entries.push(`${JSON.stringify(key)}:${serialized}`);
|
|
10774
10774
|
}
|
|
10775
10775
|
return `{${entries.join(",")}}`;
|
|
10776
10776
|
}
|
|
10777
|
-
function
|
|
10778
|
-
|
|
10777
|
+
function isPlainObject(value) {
|
|
10778
|
+
const prototype = Object.getPrototypeOf(value);
|
|
10779
|
+
if (prototype === null)
|
|
10780
|
+
return true;
|
|
10781
|
+
const parent = Object.getPrototypeOf(prototype);
|
|
10782
|
+
return parent === null;
|
|
10783
|
+
}
|
|
10784
|
+
function stableSerialize(value, depth = 0) {
|
|
10785
|
+
if (depth > 8)
|
|
10779
10786
|
return;
|
|
10780
10787
|
if (value === null)
|
|
10781
10788
|
return "null";
|
|
10782
|
-
if (typeof value === "string")
|
|
10783
|
-
if (value.length > budget)
|
|
10784
|
-
return;
|
|
10789
|
+
if (typeof value === "string")
|
|
10785
10790
|
return JSON.stringify(value);
|
|
10786
|
-
}
|
|
10787
10791
|
if (typeof value === "number" || typeof value === "boolean") {
|
|
10788
10792
|
return JSON.stringify(value);
|
|
10789
10793
|
}
|
|
10790
10794
|
if (Array.isArray(value))
|
|
10791
|
-
return serializeStableArray(value, depth
|
|
10792
|
-
if (!isRecord7(value))
|
|
10795
|
+
return serializeStableArray(value, depth);
|
|
10796
|
+
if (!isRecord7(value) || !isPlainObject(value))
|
|
10797
|
+
return;
|
|
10798
|
+
if (Object.getOwnPropertySymbols(value).length > 0)
|
|
10793
10799
|
return;
|
|
10794
|
-
return serializeStableRecord(value, depth
|
|
10800
|
+
return serializeStableRecord(value, depth);
|
|
10795
10801
|
}
|
|
10796
10802
|
function canonicalPatchText(patchText, sessionLocation) {
|
|
10797
10803
|
if (patchTextFileTargets(patchText) === undefined)
|
|
@@ -10835,8 +10841,9 @@ function canonicalHunks(value, sessionLocation) {
|
|
|
10835
10841
|
return hunks;
|
|
10836
10842
|
}
|
|
10837
10843
|
function canonicalOperationArgs(tool, args2, sessionLocation) {
|
|
10838
|
-
if (tool !== "apply_patch" || !isRecord7(args2))
|
|
10844
|
+
if (tool !== "apply_patch" || !isRecord7(args2) || !isPlainObject(args2)) {
|
|
10839
10845
|
return args2;
|
|
10846
|
+
}
|
|
10840
10847
|
const patchPaths = patchFileTargets(args2);
|
|
10841
10848
|
if (patchPaths === undefined)
|
|
10842
10849
|
return args2;
|
|
@@ -10854,6 +10861,8 @@ function canonicalOperationArgs(tool, args2, sessionLocation) {
|
|
|
10854
10861
|
return hunks === undefined ? args2 : { ...args2, hunks };
|
|
10855
10862
|
}
|
|
10856
10863
|
function argsFingerprint(ledger, tool, args2, sessionLocation) {
|
|
10864
|
+
if (stableSerialize(args2) === undefined)
|
|
10865
|
+
return;
|
|
10857
10866
|
const serialized = stableSerialize(canonicalOperationArgs(tool, args2, sessionLocation));
|
|
10858
10867
|
return serialized === undefined ? undefined : ledger.digestIdentity("call", serialized);
|
|
10859
10868
|
}
|
|
@@ -11103,6 +11112,7 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
|
|
|
11103
11112
|
const callBindings = new Map;
|
|
11104
11113
|
const pendingOperations = new Map;
|
|
11105
11114
|
const sealedOperations = new Map;
|
|
11115
|
+
const skippedOperations = new Set;
|
|
11106
11116
|
const abandonedOperations = new Map;
|
|
11107
11117
|
const rolledUpChildren = new Set;
|
|
11108
11118
|
const questionAttestation = createQuestionAttestation();
|
|
@@ -11888,6 +11898,10 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
|
|
|
11888
11898
|
});
|
|
11889
11899
|
pendingOperations.delete(callDigest);
|
|
11890
11900
|
}
|
|
11901
|
+
for (const callDigest of skippedOperations) {
|
|
11902
|
+
abandonedOperations.set(callDigest, { skipped: true });
|
|
11903
|
+
}
|
|
11904
|
+
skippedOperations.clear();
|
|
11891
11905
|
}
|
|
11892
11906
|
function readStatus() {
|
|
11893
11907
|
return guard ? guard.status() : unavailableWorkflowStatus();
|
|
@@ -11931,6 +11945,13 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
|
|
|
11931
11945
|
})
|
|
11932
11946
|
};
|
|
11933
11947
|
}
|
|
11948
|
+
function operationObservationApplies() {
|
|
11949
|
+
const current = readStatus();
|
|
11950
|
+
if (current.state === "disabled" || current.state === "unavailable") {
|
|
11951
|
+
return false;
|
|
11952
|
+
}
|
|
11953
|
+
return current.epoch?.status === "active" || pendingSkills.size > 0;
|
|
11954
|
+
}
|
|
11934
11955
|
function observerReadbackApplies() {
|
|
11935
11956
|
return options.observer !== undefined && requireGuard().status().epoch !== null;
|
|
11936
11957
|
}
|
|
@@ -12281,6 +12302,10 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
|
|
|
12281
12302
|
async function prepareOperation(host, args2) {
|
|
12282
12303
|
if (!options.observer || !isLocalOperationTool(host.tool))
|
|
12283
12304
|
return;
|
|
12305
|
+
if (!operationObservationApplies()) {
|
|
12306
|
+
skippedOperations.add(digestCall(ledger, host.callID));
|
|
12307
|
+
return;
|
|
12308
|
+
}
|
|
12284
12309
|
const initiator = currentInitiator();
|
|
12285
12310
|
const { parentTargetRoot, sessionLocation } = effectiveTargetContext();
|
|
12286
12311
|
const fingerprint = argsFingerprint(ledger, host.tool, args2, sessionLocation);
|
|
@@ -12997,6 +13022,8 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
|
|
|
12997
13022
|
const sealed = sealedOperations.get(callDigest);
|
|
12998
13023
|
const abandoned = abandonedOperations.get(callDigest);
|
|
12999
13024
|
const prior = sealed ?? abandoned;
|
|
13025
|
+
if (prior !== undefined && "skipped" in prior)
|
|
13026
|
+
return true;
|
|
13000
13027
|
return prior !== undefined && fingerprint !== undefined && prior.tool === host.tool && prior.argsFingerprint === fingerprint;
|
|
13001
13028
|
}
|
|
13002
13029
|
function takePendingOperation(callDigest, host, fingerprint) {
|
|
@@ -13245,15 +13272,20 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
|
|
|
13245
13272
|
[SYSTEMATIC_WORKFLOW_RECEIPT_METADATA_KEY]: existing ? Array.isArray(existing) ? [...existing, marker] : [existing, marker] : marker
|
|
13246
13273
|
};
|
|
13247
13274
|
}
|
|
13248
|
-
|
|
13249
|
-
if (
|
|
13275
|
+
function takeOperationToFinish(callDigest, host) {
|
|
13276
|
+
if (skippedOperations.has(callDigest))
|
|
13250
13277
|
return;
|
|
13251
|
-
const callDigest = digestCall(ledger, host.callID);
|
|
13252
13278
|
const { sessionLocation } = effectiveTargetContext();
|
|
13253
13279
|
const fingerprint = argsFingerprint(ledger, host.tool, host.args, sessionLocation);
|
|
13254
13280
|
if (isSealedOperationReplay(callDigest, host, fingerprint))
|
|
13255
13281
|
return;
|
|
13256
|
-
|
|
13282
|
+
return takePendingOperation(callDigest, host, fingerprint);
|
|
13283
|
+
}
|
|
13284
|
+
async function finishOperation(host, output) {
|
|
13285
|
+
if (!options.observer || !isLocalOperationAfter(host))
|
|
13286
|
+
return;
|
|
13287
|
+
const callDigest = digestCall(ledger, host.callID);
|
|
13288
|
+
const pending = takeOperationToFinish(callDigest, host);
|
|
13257
13289
|
if (!pending)
|
|
13258
13290
|
return;
|
|
13259
13291
|
const result = await completeOperationObservation(callDigest, host, pending, output);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fro.bot/systematic",
|
|
3
|
-
"version": "3.22.
|
|
3
|
+
"version": "3.22.3",
|
|
4
4
|
"description": "Compound-engineering loops for OpenCode, Pi, and Claude Code",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://fro.bot/systematic",
|
|
@@ -99,8 +99,8 @@
|
|
|
99
99
|
"devDependencies": {
|
|
100
100
|
"@biomejs/biome": "2.5.15",
|
|
101
101
|
"@earendil-works/pi-coding-agent": "0.83.0",
|
|
102
|
-
"@opencode-ai/plugin": "1.
|
|
103
|
-
"@opencode-ai/sdk": "1.
|
|
102
|
+
"@opencode-ai/plugin": "1.19.0",
|
|
103
|
+
"@opencode-ai/sdk": "1.19.0",
|
|
104
104
|
"@semantic-release/exec": "7.1.0",
|
|
105
105
|
"@tintinweb/pi-subagents": "0.14.3",
|
|
106
106
|
"@types/bun": "latest",
|
|
@@ -129,7 +129,9 @@
|
|
|
129
129
|
"brace-expansion": "^5.0.8",
|
|
130
130
|
"conventional-changelog-writer": ">=9",
|
|
131
131
|
"devalue": "^5.9.3",
|
|
132
|
-
"
|
|
132
|
+
"fast-uri": "~3.1.7",
|
|
133
|
+
"smol-toml": "~1.9.0",
|
|
134
|
+
"source-map-js": "^1.2.2"
|
|
133
135
|
},
|
|
134
136
|
"publishConfig": {
|
|
135
137
|
"access": "public",
|