@fro.bot/systematic 3.4.0 → 3.4.1

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 CHANGED
@@ -3,7 +3,7 @@
3
3
  <picture>
4
4
  <source media="(prefers-color-scheme: dark)" srcset="./assets/banner.svg">
5
5
  <source media="(prefers-color-scheme: light)" srcset="./assets/banner.svg">
6
- <img alt="Systematic — Compound-Engineering Workflows for OpenCode, Pi, and Claude Code" src="./assets/banner.svg" width="100%">
6
+ <img alt="Systematic — Compound-Engineering Loops for OpenCode, Pi, and Claude Code" src="./assets/banner.svg" width="100%">
7
7
  </picture>
8
8
 
9
9
  <br><br>
@@ -29,7 +29,7 @@ You want AI that follows your process, not just your prompts. You want repeatabl
29
29
 
30
30
  ## What You Get
31
31
 
32
- Systematic is a compound-engineering workflow: brainstorm, plan, work, review — each phase a structured skill that guides the AI through requirements exploration, implementation planning, execution, and code review, capturing what was learned along the way. It ships 31 bundled skills and 37 specialized agents for architecture, security, performance, design, and code review.
32
+ Systematic is a compound-engineering loop: brainstorm, plan, work, review — each phase a structured skill that guides the AI through requirements exploration, implementation planning, execution, and code review, capturing what was learned along the way. It ships 31 bundled skills and 37 specialized agents for architecture, security, performance, design, and code review.
33
33
 
34
34
  The workflow runs on three harnesses from one source: [OpenCode](https://opencode.ai/), [Pi](https://github.com/earendil-works/pi-coding-agent), and Claude Code. Each gets a native install path; skill and agent content is identical across all three.
35
35
 
package/dist/index.js CHANGED
@@ -2890,6 +2890,19 @@ function seedFromMarker(marker) {
2890
2890
  capabilityFlags: marker.capabilityFlags
2891
2891
  };
2892
2892
  }
2893
+ function registrationDigestFromMarker(marker) {
2894
+ if (marker.kind === "mint")
2895
+ return marker.envelope.registrationDigest;
2896
+ return marker.registrationDigest;
2897
+ }
2898
+ function filterMarkersByRegistration(markers, ownRegistrationDigest) {
2899
+ return markers.filter((input) => {
2900
+ const validation = validateReceiptMarker(input);
2901
+ if (validation.status !== "valid")
2902
+ return true;
2903
+ return registrationDigestFromMarker(validation.marker) === ownRegistrationDigest;
2904
+ });
2905
+ }
2893
2906
  function extractReceiptReadbackSeed(inputs) {
2894
2907
  if (inputs.length === 0)
2895
2908
  return { status: "empty" };
@@ -10400,6 +10413,11 @@ var statusToolSchema = exports_external.object(statusToolShape).strict();
10400
10413
  function isRecord7(value) {
10401
10414
  return typeof value === "object" && value !== null && !Array.isArray(value);
10402
10415
  }
10416
+ function decodeSessionSaltBytes(hex) {
10417
+ if (typeof hex !== "string" || hex.length !== 64 || !/^[0-9a-f]+$/.test(hex))
10418
+ return;
10419
+ return Uint8Array.from(Buffer.from(hex, "hex"));
10420
+ }
10403
10421
  function boundedString(value, maxLength) {
10404
10422
  return typeof value === "string" && value.length > 0 && value.length <= maxLength;
10405
10423
  }
@@ -10979,6 +10997,46 @@ function createSessionRuntime(options) {
10979
10997
  function seedAgrees(nextLedger, seed) {
10980
10998
  return nextLedger.metadata.registrationDigest === seed.registrationDigest && JSON.stringify(nextLedger.metadata.capabilityFlags) === JSON.stringify(["workflow-guard"]);
10981
10999
  }
11000
+ function candidateSeedFromMarker(input) {
11001
+ const validation = validateReceiptMarker(input);
11002
+ if (validation.status !== "valid")
11003
+ return;
11004
+ const marker = validation.marker;
11005
+ if (marker.kind === "mint") {
11006
+ const salt = decodeSessionSaltBytes(marker.sessionSalt);
11007
+ return salt ? { salt, digest: marker.envelope.registrationDigest } : undefined;
11008
+ }
11009
+ if (marker.kind === "control" && marker.control === "progression") {
11010
+ const salt = decodeSessionSaltBytes(marker.sessionSalt);
11011
+ return salt ? { salt, digest: marker.registrationDigest } : undefined;
11012
+ }
11013
+ return;
11014
+ }
11015
+ function candidateAgreesWithOwnIdentity(salt, digest2) {
11016
+ try {
11017
+ const probe = createReceiptLedger({
11018
+ capabilityFlags: ["workflow-guard"],
11019
+ registrationIdentity: options.registrationIdentity,
11020
+ sessionSalt: salt
11021
+ });
11022
+ return probe.metadata.registrationDigest === digest2;
11023
+ } catch {
11024
+ return false;
11025
+ }
11026
+ }
11027
+ function resolveOwnRegistrationDigest(markers) {
11028
+ const seenDigests = new Set;
11029
+ for (const input of markers) {
11030
+ const candidate = candidateSeedFromMarker(input);
11031
+ if (!candidate || seenDigests.has(candidate.digest))
11032
+ continue;
11033
+ seenDigests.add(candidate.digest);
11034
+ if (candidateAgreesWithOwnIdentity(candidate.salt, candidate.digest)) {
11035
+ return candidate.digest;
11036
+ }
11037
+ }
11038
+ return;
11039
+ }
10982
11040
  function recoverPersistedMarkers(markers) {
10983
11041
  const seed = extractReceiptReadbackSeed(markers);
10984
11042
  if (seed.status !== "ready")
@@ -11017,6 +11075,39 @@ function createSessionRuntime(options) {
11017
11075
  initialized = true;
11018
11076
  return true;
11019
11077
  }
11078
+ function classifyMarkersFromParts(parts2) {
11079
+ const allMarkers = [];
11080
+ for (const part of parts2)
11081
+ collectReceiptMarkers(part, allMarkers);
11082
+ if (allMarkers.length === 0)
11083
+ return { kind: "foreign-empty" };
11084
+ const ownDigest = resolveOwnRegistrationDigest(allMarkers);
11085
+ if (ownDigest !== undefined) {
11086
+ return {
11087
+ kind: "own",
11088
+ markers: filterMarkersByRegistration(allMarkers, ownDigest)
11089
+ };
11090
+ }
11091
+ for (const input of allMarkers) {
11092
+ const validation = validateReceiptMarker(input);
11093
+ if (validation.status !== "valid") {
11094
+ return { kind: "ambiguous" };
11095
+ }
11096
+ const candidate = candidateSeedFromMarker(input);
11097
+ if (candidate === undefined) {
11098
+ return { kind: "ambiguous" };
11099
+ }
11100
+ }
11101
+ return { kind: "foreign-empty" };
11102
+ }
11103
+ function publishEmptyMarkers(parts2, allowFresh) {
11104
+ if (allowFresh && !parts2.some((part) => containsGuardHistory(part))) {
11105
+ publishFresh();
11106
+ } else {
11107
+ retryableEmptyHistory = true;
11108
+ publishUnavailable();
11109
+ }
11110
+ }
11020
11111
  async function initializeSession(sessionID, allowFresh) {
11021
11112
  const reader = options.hostReadback?.readSessionParts;
11022
11113
  if (!reader) {
@@ -11030,19 +11121,16 @@ function createSessionRuntime(options) {
11030
11121
  publishUnavailable();
11031
11122
  return;
11032
11123
  }
11033
- const markers = [];
11034
- for (const part of parts2)
11035
- collectReceiptMarkers(part, markers);
11036
- if (markers.length === 0) {
11037
- if (allowFresh && !parts2.some((part) => containsGuardHistory(part))) {
11038
- publishFresh();
11039
- } else {
11040
- retryableEmptyHistory = true;
11041
- publishUnavailable();
11042
- }
11124
+ const classification = classifyMarkersFromParts(parts2);
11125
+ if (classification.kind === "ambiguous") {
11126
+ publishUnavailable();
11043
11127
  return;
11044
11128
  }
11045
- if (!recoverPersistedMarkers(markers))
11129
+ if (classification.kind === "foreign-empty") {
11130
+ publishEmptyMarkers(parts2, allowFresh);
11131
+ return;
11132
+ }
11133
+ if (!recoverPersistedMarkers(classification.markers))
11046
11134
  publishUnavailable();
11047
11135
  }
11048
11136
  async function recoverFromHost(sessionID, allowFresh = true) {
@@ -11080,12 +11168,15 @@ function createSessionRuntime(options) {
11080
11168
  markUnavailable();
11081
11169
  return;
11082
11170
  }
11083
- const markers = [];
11084
- for (const part of parts2)
11085
- collectReceiptMarkers(part, markers);
11086
- if (markers.length === 0)
11171
+ const classification = classifyMarkersFromParts(parts2);
11172
+ if (classification.kind === "foreign-empty")
11087
11173
  return;
11088
- const seed = extractReceiptReadbackSeed(markers);
11174
+ if (classification.kind === "ambiguous") {
11175
+ markUnavailable();
11176
+ return;
11177
+ }
11178
+ const ownMarkers = classification.markers;
11179
+ const seed = extractReceiptReadbackSeed(ownMarkers);
11089
11180
  if (seed.status !== "ready") {
11090
11181
  markUnavailable();
11091
11182
  return;
@@ -11099,7 +11190,7 @@ function createSessionRuntime(options) {
11099
11190
  markUnavailable();
11100
11191
  return;
11101
11192
  }
11102
- const recovered = childLedger.recoverReadback(markers);
11193
+ const recovered = childLedger.recoverReadback(ownMarkers);
11103
11194
  if (recovered.status === "rejected") {
11104
11195
  markUnavailable();
11105
11196
  return;
@@ -156,6 +156,16 @@ export type ReceiptReadbackSeedResult = {
156
156
  };
157
157
  export declare function digestReceiptIdentity(domain: ReceiptDigestDomain, identity: string, sessionSalt: Uint8Array): string;
158
158
  export declare function validateReceiptMarker(input: unknown): ReceiptMarkerValidation;
159
+ /**
160
+ * Filters a raw marker array, retaining only markers that belong to the given
161
+ * registrationDigest. Markers that cannot be parsed (malformed, unknown schema,
162
+ * etc.) are retained as-is so that downstream callers can fail-closed on them.
163
+ *
164
+ * Use this before extractReceiptReadbackSeed / foldReceiptReadback when the
165
+ * shared metadata array may contain markers from multiple concurrent
166
+ * registrations (e.g. dual-registration in a single OpenCode session).
167
+ */
168
+ export declare function filterMarkersByRegistration(markers: readonly unknown[], ownRegistrationDigest: string): unknown[];
159
169
  export declare function extractReceiptReadbackSeed(inputs: readonly unknown[]): ReceiptReadbackSeedResult;
160
170
  export declare function projectReceiptMintMarker(receipt: unknown, sessionSalt: Uint8Array): ReceiptMintMarker | undefined;
161
171
  export declare function projectReceiptConsumptionMarker(receipt: unknown, transitionDigest: string, timestamp?: number): ReceiptConsumeMarker | undefined;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fro.bot/systematic",
3
- "version": "3.4.0",
4
- "description": "Structured engineering workflows for OpenCode",
3
+ "version": "3.4.1",
4
+ "description": "Compound-engineering loops for OpenCode, Pi, and Claude Code",
5
5
  "type": "module",
6
6
  "homepage": "https://fro.bot/systematic",
7
7
  "main": "./dist/index.js",