@smthrs/journal 0.0.0-stage → 1.0.0-rc.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/CHANGELOG.md +149 -0
- package/LICENSE +21 -0
- package/README.md +206 -2
- package/dist/cjs/CallFact.d.ts +129 -0
- package/dist/cjs/CallFact.d.ts.map +1 -0
- package/dist/cjs/CallFact.js +106 -0
- package/dist/cjs/CallFact.js.map +7 -0
- package/dist/cjs/Consensus.d.ts +440 -0
- package/dist/cjs/Consensus.d.ts.map +1 -0
- package/dist/cjs/Consensus.js +251 -0
- package/dist/cjs/Consensus.js.map +7 -0
- package/dist/cjs/EngineEvent.d.ts +890 -0
- package/dist/cjs/EngineEvent.d.ts.map +1 -0
- package/dist/cjs/EngineEvent.js +383 -0
- package/dist/cjs/EngineEvent.js.map +7 -0
- package/dist/cjs/ExecutionFact.d.ts +216 -0
- package/dist/cjs/ExecutionFact.d.ts.map +1 -0
- package/dist/cjs/ExecutionFact.js +303 -0
- package/dist/cjs/ExecutionFact.js.map +7 -0
- package/dist/cjs/Journal.d.ts +617 -0
- package/dist/cjs/Journal.d.ts.map +1 -0
- package/dist/cjs/Journal.js +190 -0
- package/dist/cjs/Journal.js.map +7 -0
- package/dist/cjs/JournalEvent.d.ts +421 -0
- package/dist/cjs/JournalEvent.d.ts.map +1 -0
- package/dist/cjs/JournalEvent.js +281 -0
- package/dist/cjs/JournalEvent.js.map +7 -0
- package/dist/cjs/JournalGeneration.d.ts +34 -0
- package/dist/cjs/JournalGeneration.d.ts.map +1 -0
- package/dist/cjs/JournalGeneration.js +72 -0
- package/dist/cjs/JournalGeneration.js.map +7 -0
- package/dist/cjs/JournalMetrics.d.ts +72 -0
- package/dist/cjs/JournalMetrics.d.ts.map +1 -0
- package/dist/cjs/JournalMetrics.js +55 -0
- package/dist/cjs/JournalMetrics.js.map +7 -0
- package/dist/cjs/Migrations.d.ts +42 -0
- package/dist/cjs/Migrations.d.ts.map +1 -0
- package/dist/cjs/Migrations.js +58 -0
- package/dist/cjs/Migrations.js.map +7 -0
- package/dist/cjs/OwnerId.d.ts +40 -0
- package/dist/cjs/OwnerId.d.ts.map +1 -0
- package/dist/cjs/OwnerId.js +40 -0
- package/dist/cjs/OwnerId.js.map +7 -0
- package/dist/cjs/Projection.d.ts +29 -0
- package/dist/cjs/Projection.d.ts.map +1 -0
- package/dist/cjs/Projection.js +25 -0
- package/dist/cjs/Projection.js.map +7 -0
- package/dist/cjs/RedactedLogger.d.ts +121 -0
- package/dist/cjs/RedactedLogger.d.ts.map +1 -0
- package/dist/cjs/RedactedLogger.js +235 -0
- package/dist/cjs/RedactedLogger.js.map +7 -0
- package/dist/cjs/Redaction.d.ts +350 -0
- package/dist/cjs/Redaction.d.ts.map +1 -0
- package/dist/cjs/Redaction.js +928 -0
- package/dist/cjs/Redaction.js.map +7 -0
- package/dist/cjs/SqlConsensus.d.ts +44 -0
- package/dist/cjs/SqlConsensus.d.ts.map +1 -0
- package/dist/cjs/SqlConsensus.js +243 -0
- package/dist/cjs/SqlConsensus.js.map +7 -0
- package/dist/cjs/SqlJournal.d.ts +173 -0
- package/dist/cjs/SqlJournal.d.ts.map +1 -0
- package/dist/cjs/SqlJournal.js +1568 -0
- package/dist/cjs/SqlJournal.js.map +7 -0
- package/dist/cjs/StepFact.d.ts +66 -0
- package/dist/cjs/StepFact.d.ts.map +1 -0
- package/dist/cjs/StepFact.js +68 -0
- package/dist/cjs/StepFact.js.map +7 -0
- package/dist/cjs/index.d.ts +95 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +63 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/internal/JournalInternalFault.d.ts +37 -0
- package/dist/cjs/internal/JournalInternalFault.d.ts.map +1 -0
- package/dist/cjs/internal/JournalInternalFault.js +43 -0
- package/dist/cjs/internal/JournalInternalFault.js.map +7 -0
- package/dist/cjs/migrations/0001_initial.d.ts +15 -0
- package/dist/cjs/migrations/0001_initial.d.ts.map +1 -0
- package/dist/cjs/migrations/0001_initial.js +54 -0
- package/dist/cjs/migrations/0001_initial.js.map +7 -0
- package/dist/cjs/migrations/0002_checkpoints.d.ts +27 -0
- package/dist/cjs/migrations/0002_checkpoints.d.ts.map +1 -0
- package/dist/cjs/migrations/0002_checkpoints.js +48 -0
- package/dist/cjs/migrations/0002_checkpoints.js.map +7 -0
- package/dist/cjs/migrations/0003_startup_index.d.ts +15 -0
- package/dist/cjs/migrations/0003_startup_index.d.ts.map +1 -0
- package/dist/cjs/migrations/0003_startup_index.js +40 -0
- package/dist/cjs/migrations/0003_startup_index.js.map +7 -0
- package/dist/cjs/migrations/0004_dedup.d.ts +15 -0
- package/dist/cjs/migrations/0004_dedup.d.ts.map +1 -0
- package/dist/cjs/migrations/0004_dedup.js +57 -0
- package/dist/cjs/migrations/0004_dedup.js.map +7 -0
- package/dist/cjs/migrations/0005_run_event_type.d.ts +15 -0
- package/dist/cjs/migrations/0005_run_event_type.d.ts.map +1 -0
- package/dist/cjs/migrations/0005_run_event_type.js +40 -0
- package/dist/cjs/migrations/0005_run_event_type.js.map +7 -0
- package/dist/cjs/migrations/0006_consensus.d.ts +22 -0
- package/dist/cjs/migrations/0006_consensus.d.ts.map +1 -0
- package/dist/cjs/migrations/0006_consensus.js +84 -0
- package/dist/cjs/migrations/0006_consensus.js.map +7 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/test/Notifying.d.ts +65 -0
- package/dist/cjs/test/Notifying.d.ts.map +1 -0
- package/dist/cjs/test/Notifying.js +62 -0
- package/dist/cjs/test/Notifying.js.map +7 -0
- package/dist/cjs/test/TestJournal.d.ts +43 -0
- package/dist/cjs/test/TestJournal.d.ts.map +1 -0
- package/dist/cjs/test/TestJournal.js +43 -0
- package/dist/cjs/test/TestJournal.js.map +7 -0
- package/dist/esm/CallFact.d.ts +129 -0
- package/dist/esm/CallFact.d.ts.map +1 -0
- package/dist/esm/CallFact.js +96 -0
- package/dist/esm/CallFact.js.map +1 -0
- package/dist/esm/Consensus.d.ts +440 -0
- package/dist/esm/Consensus.d.ts.map +1 -0
- package/dist/esm/Consensus.js +454 -0
- package/dist/esm/Consensus.js.map +1 -0
- package/dist/esm/EngineEvent.d.ts +890 -0
- package/dist/esm/EngineEvent.d.ts.map +1 -0
- package/dist/esm/EngineEvent.js +614 -0
- package/dist/esm/EngineEvent.js.map +1 -0
- package/dist/esm/ExecutionFact.d.ts +216 -0
- package/dist/esm/ExecutionFact.d.ts.map +1 -0
- package/dist/esm/ExecutionFact.js +374 -0
- package/dist/esm/ExecutionFact.js.map +1 -0
- package/dist/esm/Journal.d.ts +617 -0
- package/dist/esm/Journal.d.ts.map +1 -0
- package/dist/esm/Journal.js +323 -0
- package/dist/esm/Journal.js.map +1 -0
- package/dist/esm/JournalEvent.d.ts +421 -0
- package/dist/esm/JournalEvent.d.ts.map +1 -0
- package/dist/esm/JournalEvent.js +517 -0
- package/dist/esm/JournalEvent.js.map +1 -0
- package/dist/esm/JournalGeneration.d.ts +34 -0
- package/dist/esm/JournalGeneration.d.ts.map +1 -0
- package/dist/esm/JournalGeneration.js +65 -0
- package/dist/esm/JournalGeneration.js.map +1 -0
- package/dist/esm/JournalMetrics.d.ts +72 -0
- package/dist/esm/JournalMetrics.d.ts.map +1 -0
- package/dist/esm/JournalMetrics.js +79 -0
- package/dist/esm/JournalMetrics.js.map +1 -0
- package/dist/esm/Migrations.d.ts +42 -0
- package/dist/esm/Migrations.d.ts.map +1 -0
- package/dist/esm/Migrations.js +59 -0
- package/dist/esm/Migrations.js.map +1 -0
- package/dist/esm/OwnerId.d.ts +40 -0
- package/dist/esm/OwnerId.d.ts.map +1 -0
- package/dist/esm/OwnerId.js +33 -0
- package/dist/esm/OwnerId.js.map +1 -0
- package/dist/esm/Projection.d.ts +29 -0
- package/dist/esm/Projection.d.ts.map +1 -0
- package/dist/esm/Projection.js +13 -0
- package/dist/esm/Projection.js.map +1 -0
- package/dist/esm/RedactedLogger.d.ts +121 -0
- package/dist/esm/RedactedLogger.d.ts.map +1 -0
- package/dist/esm/RedactedLogger.js +445 -0
- package/dist/esm/RedactedLogger.js.map +1 -0
- package/dist/esm/Redaction.d.ts +350 -0
- package/dist/esm/Redaction.d.ts.map +1 -0
- package/dist/esm/Redaction.js +1584 -0
- package/dist/esm/Redaction.js.map +1 -0
- package/dist/esm/SqlConsensus.d.ts +44 -0
- package/dist/esm/SqlConsensus.d.ts.map +1 -0
- package/dist/esm/SqlConsensus.js +252 -0
- package/dist/esm/SqlConsensus.js.map +1 -0
- package/dist/esm/SqlJournal.d.ts +173 -0
- package/dist/esm/SqlJournal.d.ts.map +1 -0
- package/dist/esm/SqlJournal.js +1858 -0
- package/dist/esm/SqlJournal.js.map +1 -0
- package/dist/esm/StepFact.d.ts +66 -0
- package/dist/esm/StepFact.d.ts.map +1 -0
- package/dist/esm/StepFact.js +50 -0
- package/dist/esm/StepFact.js.map +1 -0
- package/dist/esm/index.d.ts +95 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +95 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internal/JournalInternalFault.d.ts +37 -0
- package/dist/esm/internal/JournalInternalFault.d.ts.map +1 -0
- package/dist/esm/internal/JournalInternalFault.js +28 -0
- package/dist/esm/internal/JournalInternalFault.js.map +1 -0
- package/dist/esm/migrations/0001_initial.d.ts +15 -0
- package/dist/esm/migrations/0001_initial.d.ts.map +1 -0
- package/dist/esm/migrations/0001_initial.js +32 -0
- package/dist/esm/migrations/0001_initial.js.map +1 -0
- package/dist/esm/migrations/0002_checkpoints.d.ts +27 -0
- package/dist/esm/migrations/0002_checkpoints.d.ts.map +1 -0
- package/dist/esm/migrations/0002_checkpoints.js +38 -0
- package/dist/esm/migrations/0002_checkpoints.js.map +1 -0
- package/dist/esm/migrations/0003_startup_index.d.ts +15 -0
- package/dist/esm/migrations/0003_startup_index.d.ts.map +1 -0
- package/dist/esm/migrations/0003_startup_index.js +18 -0
- package/dist/esm/migrations/0003_startup_index.js.map +1 -0
- package/dist/esm/migrations/0004_dedup.d.ts +15 -0
- package/dist/esm/migrations/0004_dedup.d.ts.map +1 -0
- package/dist/esm/migrations/0004_dedup.js +38 -0
- package/dist/esm/migrations/0004_dedup.js.map +1 -0
- package/dist/esm/migrations/0005_run_event_type.d.ts +15 -0
- package/dist/esm/migrations/0005_run_event_type.d.ts.map +1 -0
- package/dist/esm/migrations/0005_run_event_type.js +18 -0
- package/dist/esm/migrations/0005_run_event_type.js.map +1 -0
- package/dist/esm/migrations/0006_consensus.d.ts +22 -0
- package/dist/esm/migrations/0006_consensus.d.ts.map +1 -0
- package/dist/esm/migrations/0006_consensus.js +69 -0
- package/dist/esm/migrations/0006_consensus.js.map +1 -0
- package/dist/esm/test/Notifying.d.ts +65 -0
- package/dist/esm/test/Notifying.d.ts.map +1 -0
- package/dist/esm/test/Notifying.js +62 -0
- package/dist/esm/test/Notifying.js.map +1 -0
- package/dist/esm/test/TestJournal.d.ts +43 -0
- package/dist/esm/test/TestJournal.d.ts.map +1 -0
- package/dist/esm/test/TestJournal.js +27 -0
- package/dist/esm/test/TestJournal.js.map +1 -0
- package/docs/README.md +164 -0
- package/docs/api.md +639 -0
- package/docs/concepts/compaction.md +157 -0
- package/docs/concepts/idempotency.md +127 -0
- package/docs/concepts/owner-fence.md +124 -0
- package/docs/concepts/redaction.md +218 -0
- package/docs/concepts/state-event-authority.md +159 -0
- package/docs/concepts/two-channels.md +167 -0
- package/docs/guides/commit-state-and-entry.md +114 -0
- package/docs/guides/compact-a-run.md +134 -0
- package/docs/guides/fold-a-projection.md +106 -0
- package/docs/guides/read-a-run.md +139 -0
- package/docs/guides/redact-log-output.md +94 -0
- package/docs/guides/testing.md +124 -0
- package/docs/guides/write-lifecycle-events.md +110 -0
- package/docs/installation.md +133 -0
- package/docs/quickstart.md +143 -0
- package/docs/troubleshooting.md +214 -0
- package/package.json +263 -3
- package/src/CallFact.ts +117 -0
- package/src/Consensus.ts +683 -0
- package/src/EngineEvent.ts +823 -0
- package/src/ExecutionFact.ts +433 -0
- package/src/Journal.ts +688 -0
- package/src/JournalEvent.ts +654 -0
- package/src/JournalGeneration.ts +77 -0
- package/src/JournalMetrics.ts +89 -0
- package/src/Migrations.ts +62 -0
- package/src/OwnerId.ts +42 -0
- package/src/Projection.ts +31 -0
- package/src/RedactedLogger.ts +483 -0
- package/src/Redaction.ts +1784 -0
- package/src/SqlConsensus.ts +344 -0
- package/src/SqlJournal.ts +2732 -0
- package/src/StepFact.ts +69 -0
- package/src/index.ts +109 -0
- package/src/internal/JournalInternalFault.ts +40 -0
- package/src/migrations/0001_initial.ts +41 -0
- package/src/migrations/0002_checkpoints.ts +46 -0
- package/src/migrations/0003_startup_index.ts +19 -0
- package/src/migrations/0004_dedup.ts +43 -0
- package/src/migrations/0005_run_event_type.ts +19 -0
- package/src/migrations/0006_consensus.ts +83 -0
- package/src/test/Notifying.ts +101 -0
- package/src/test/TestJournal.ts +52 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EngineEvent.d.ts","sourceRoot":"","sources":["../../src/EngineEvent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAA;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;IAoBlB,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;AAEzC;;;;;GAKG;AACH,eAAO,MAAM,OAAO;;EAAyD,CAAA;AAE7E;;;;;GAKG;AACH,eAAO,MAAM,OAAO;;;EAGlB,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc;;;;;IAAmC,CAAA;AAC9D;;;;;GAKG;AACH,M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B;;;;;EAKhC,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,IAAI,CAAA;AAE/C;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAA;AAEjD;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAA;AAEjD;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,IAAI,CAAA;AAE7C;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAC,IAAI,CAAA;AAEjE;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,GAAG,OAAO,uBAAuB,CAAC,IAAI,CAAA;AAEzE;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,OAAO,oBAAoB,CAAC,IAAI,CAAA;AAEnE;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAA;AAE7D;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAC,IAAI,CAAA;AAE/D;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAAG,OAAO,sBAAsB,CAAC,IAAI,CAAA;AAEvE;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG,OAAO,qBAAqB,CAAC,IAAI,CAAA;AAErE;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc;;;;;;;CAOjB,CAAA"}
|
|
@@ -0,0 +1,614 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Versioned engine history contracts over the open journal. These schemas do
|
|
3
|
+
* not change journal admission or make history the engine's recovery store.
|
|
4
|
+
*
|
|
5
|
+
* @since 1.0.0
|
|
6
|
+
*/
|
|
7
|
+
import * as Cause from "effect/Cause";
|
|
8
|
+
import * as Effect from "effect/Effect";
|
|
9
|
+
import * as Schema from "effect/Schema";
|
|
10
|
+
import * as Event from "./JournalEvent.js";
|
|
11
|
+
/**
|
|
12
|
+
* Required lineage coordinates for a root or derived run.
|
|
13
|
+
*
|
|
14
|
+
* @category schemas
|
|
15
|
+
* @since 1.0.0
|
|
16
|
+
*/
|
|
17
|
+
export const Lineage = Schema.Union([
|
|
18
|
+
Schema.Struct({
|
|
19
|
+
kind: Schema.Literal("root"),
|
|
20
|
+
runId: Event.RunId,
|
|
21
|
+
lineageId: Event.LineageId,
|
|
22
|
+
rootRunId: Event.RunId,
|
|
23
|
+
round: Schema.Literal(0),
|
|
24
|
+
parentRunId: Schema.Null
|
|
25
|
+
}).check(Schema.makeFilter((value) => value.runId === value.rootRunId)),
|
|
26
|
+
Schema.Struct({
|
|
27
|
+
kind: Schema.Literals(["child", "fork", "continuation"]),
|
|
28
|
+
runId: Event.RunId,
|
|
29
|
+
lineageId: Event.LineageId,
|
|
30
|
+
rootRunId: Event.RunId,
|
|
31
|
+
round: Event.NonNegativeQuantity,
|
|
32
|
+
parentRunId: Event.RunId
|
|
33
|
+
}).check(Schema.makeFilter((value) => value.runId !== value.parentRunId && value.runId !== value.rootRunId &&
|
|
34
|
+
(value.kind !== "continuation" || value.round > 0)))
|
|
35
|
+
]);
|
|
36
|
+
/**
|
|
37
|
+
* Encoded values only: class instances must first pass their own codec.
|
|
38
|
+
*
|
|
39
|
+
* @category schemas
|
|
40
|
+
* @since 1.0.0
|
|
41
|
+
*/
|
|
42
|
+
export const Success = Schema.TaggedStruct("Success", { value: Schema.Json });
|
|
43
|
+
/**
|
|
44
|
+
* Failure channels stay distinct, including interruption and encoding failure.
|
|
45
|
+
*
|
|
46
|
+
* @category schemas
|
|
47
|
+
* @since 1.0.0
|
|
48
|
+
*/
|
|
49
|
+
export const Failure = Schema.TaggedStruct("Failure", {
|
|
50
|
+
reason: Schema.Literals(["error", "defect", "interrupted", "encoding"]),
|
|
51
|
+
detail: Schema.Json
|
|
52
|
+
});
|
|
53
|
+
/**
|
|
54
|
+
* Encoded success or a classified failure.
|
|
55
|
+
*
|
|
56
|
+
* @category schemas
|
|
57
|
+
* @since 1.0.0
|
|
58
|
+
*/
|
|
59
|
+
export const ResultEnvelope = Schema.Union([Success, Failure]);
|
|
60
|
+
const timing = { startedAtMs: Event.TimestampMs };
|
|
61
|
+
const live = {
|
|
62
|
+
...timing,
|
|
63
|
+
heartbeatAtMs: Schema.optionalKey(Event.TimestampMs),
|
|
64
|
+
checkpoint: Schema.optionalKey(Schema.Json),
|
|
65
|
+
finishedAtMs: Schema.optionalKey(Schema.Never),
|
|
66
|
+
result: Schema.optionalKey(Schema.Never)
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Completion and its outcome are inseparable; live states cannot carry either.
|
|
70
|
+
*
|
|
71
|
+
* @category schemas
|
|
72
|
+
* @since 1.0.0
|
|
73
|
+
*/
|
|
74
|
+
export const AttemptLifecycle = Schema.Union([
|
|
75
|
+
Schema.Struct({ state: Schema.Literal("running"), ...live }),
|
|
76
|
+
Schema.Struct({ state: Schema.Literal("suspended"), ...live }),
|
|
77
|
+
Schema.Struct({
|
|
78
|
+
state: Schema.Literal("succeeded"),
|
|
79
|
+
...timing,
|
|
80
|
+
finishedAtMs: Event.TimestampMs,
|
|
81
|
+
result: Success
|
|
82
|
+
}),
|
|
83
|
+
Schema.Struct({
|
|
84
|
+
state: Schema.Literal("failed"),
|
|
85
|
+
...timing,
|
|
86
|
+
finishedAtMs: Event.TimestampMs,
|
|
87
|
+
result: Failure
|
|
88
|
+
})
|
|
89
|
+
]);
|
|
90
|
+
/**
|
|
91
|
+
* Complete identity and state of one versioned attempt event.
|
|
92
|
+
*
|
|
93
|
+
* @category schemas
|
|
94
|
+
* @since 1.0.0
|
|
95
|
+
*/
|
|
96
|
+
export const AttemptPayload = Schema.Struct({
|
|
97
|
+
version: Schema.Literal(2),
|
|
98
|
+
lineage: Lineage,
|
|
99
|
+
executionId: Event.RunId,
|
|
100
|
+
stepKeyDigest: Event.DispatchId,
|
|
101
|
+
attempt: Event.NonNegativeQuantity,
|
|
102
|
+
lifecycle: AttemptLifecycle
|
|
103
|
+
}).check(Schema.makeFilter((value) => value.executionId === value.lineage.runId));
|
|
104
|
+
/**
|
|
105
|
+
* Durable wait identities; ownership and cancellation remain independent facts.
|
|
106
|
+
*
|
|
107
|
+
* @category schemas
|
|
108
|
+
* @since 1.0.0
|
|
109
|
+
*/
|
|
110
|
+
export const Wait = Schema.Union([
|
|
111
|
+
Schema.TaggedStruct("Deferred", { waitId: Event.WaitId }),
|
|
112
|
+
Schema.TaggedStruct("Clock", { waitId: Event.WaitId, dueAtMs: Event.TimestampMs })
|
|
113
|
+
]);
|
|
114
|
+
/**
|
|
115
|
+
* A complete execution observation, without operational ownership leases.
|
|
116
|
+
*
|
|
117
|
+
* @category schemas
|
|
118
|
+
* @since 1.0.0
|
|
119
|
+
*/
|
|
120
|
+
export const ExecutionLifecycle = Schema.Union([
|
|
121
|
+
Schema.Struct({ state: Schema.Literal("running"), waits: Schema.Array(Wait) }),
|
|
122
|
+
Schema.Struct({ state: Schema.Literal("suspended"), waits: Schema.NonEmptyArray(Wait) }),
|
|
123
|
+
Schema.Struct({ state: Schema.Literal("completed"), result: ResultEnvelope })
|
|
124
|
+
]);
|
|
125
|
+
/**
|
|
126
|
+
* Versioned execution, deferred and clock observations. Every variant records
|
|
127
|
+
* its semantic identity and encoded value independently of diagnostics.
|
|
128
|
+
*
|
|
129
|
+
* @category schemas
|
|
130
|
+
* @since 1.0.0
|
|
131
|
+
*/
|
|
132
|
+
export const StatePayload = Schema.Struct({
|
|
133
|
+
version: Schema.Literal(2),
|
|
134
|
+
lineage: Lineage,
|
|
135
|
+
executionId: Event.RunId,
|
|
136
|
+
event: Schema.Union([
|
|
137
|
+
Schema.TaggedStruct("Execution", { lifecycle: ExecutionLifecycle }),
|
|
138
|
+
Schema.TaggedStruct("DeferredCompleted", { waitId: Event.WaitId, result: ResultEnvelope }),
|
|
139
|
+
Schema.TaggedStruct("ClockScheduled", {
|
|
140
|
+
clockId: Event.CommandId,
|
|
141
|
+
waitId: Event.WaitId,
|
|
142
|
+
dueAtMs: Event.TimestampMs
|
|
143
|
+
})
|
|
144
|
+
])
|
|
145
|
+
}).check(Schema.makeFilter((value) => value.executionId === value.lineage.runId));
|
|
146
|
+
/**
|
|
147
|
+
* Event family for complete execution, deferred and clock observations.
|
|
148
|
+
*
|
|
149
|
+
* @category constants
|
|
150
|
+
* @since 1.0.0
|
|
151
|
+
*/
|
|
152
|
+
export const stateEventType = "flows.engine.v2.state-event";
|
|
153
|
+
/**
|
|
154
|
+
* New identity prevents old readers mistaking complete state for historical markers.
|
|
155
|
+
*
|
|
156
|
+
* @category constants
|
|
157
|
+
* @since 1.0.0
|
|
158
|
+
*/
|
|
159
|
+
export const attemptEventType = "flows.engine.v2.attempt-lifecycle";
|
|
160
|
+
/**
|
|
161
|
+
* Malformed, foreign, unsupported or inconsistent event evidence.
|
|
162
|
+
*
|
|
163
|
+
* @category errors
|
|
164
|
+
* @since 1.0.0
|
|
165
|
+
*/
|
|
166
|
+
export class EventError extends Schema.TaggedError()("@smthrs/journal/EngineEventError", {
|
|
167
|
+
code: Schema.Literals(["malformed", "unsupported", "foreign", "transition"]),
|
|
168
|
+
message: Schema.String,
|
|
169
|
+
cause: Schema.Unknown
|
|
170
|
+
}) {
|
|
171
|
+
}
|
|
172
|
+
const strict = { onExcessProperty: "error" };
|
|
173
|
+
const decodeRow = (input) => Effect.gen(function* () {
|
|
174
|
+
const raw = yield* Schema.decodeUnknownEffect(Schema.toEncoded(Event.Entry))(input);
|
|
175
|
+
return yield* Schema.decodeUnknownEffect(Event.Entry)(raw);
|
|
176
|
+
});
|
|
177
|
+
const decodePayload = Schema.decodeUnknownSync(AttemptPayload, strict);
|
|
178
|
+
const decodeJson = Schema.decodeUnknownSync(Schema.Json);
|
|
179
|
+
/**
|
|
180
|
+
* Decode untrusted committed input. Unknown events in the known engine namespace
|
|
181
|
+
* are unsupported errors, never ignored. Original schema/accessor errors stay
|
|
182
|
+
* in cause; foreign identity includes the conflicting evidence in cause.
|
|
183
|
+
*
|
|
184
|
+
* @category decoders
|
|
185
|
+
* @since 1.0.0
|
|
186
|
+
*/
|
|
187
|
+
export const decodeEntry = (input, consumer) => Effect.gen(function* () {
|
|
188
|
+
const entry = yield* decodeRow(input);
|
|
189
|
+
if (entry.runId !== consumer.runId || !consumer.sources.includes(entry.sourceId)) {
|
|
190
|
+
throw new EventError({
|
|
191
|
+
code: "foreign",
|
|
192
|
+
message: "event run or source is outside the consumer scope",
|
|
193
|
+
cause: entry
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
if (entry.eventType !== attemptEventType && entry.eventType !== stateEventType) {
|
|
197
|
+
if (entry.eventType.startsWith("flows.engine.")) {
|
|
198
|
+
throw new EventError({
|
|
199
|
+
code: "unsupported",
|
|
200
|
+
message: "unsupported engine event family or version",
|
|
201
|
+
cause: entry
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
return consumer.unknown === "ignore" ? { _tag: "Ignored" } : { _tag: "Unknown", entry };
|
|
205
|
+
}
|
|
206
|
+
const decoded = entry.eventType === attemptEventType
|
|
207
|
+
? { _tag: "Attempt", payload: yield* Schema.decodeUnknownEffect(AttemptPayload, strict)(entry.payload) }
|
|
208
|
+
: { _tag: "State", payload: yield* Schema.decodeUnknownEffect(StatePayload, strict)(entry.payload) };
|
|
209
|
+
const { payload } = decoded;
|
|
210
|
+
if (payload.lineage.runId !== entry.runId || payload.lineage.lineageId !== consumer.lineageId ||
|
|
211
|
+
payload.lineage.rootRunId !== consumer.rootRunId || payload.lineage.round !== consumer.round ||
|
|
212
|
+
payload.lineage.parentRunId !== consumer.parentRunId) {
|
|
213
|
+
throw new EventError({
|
|
214
|
+
code: "foreign",
|
|
215
|
+
message: "event lineage disagrees with its journal or consumer",
|
|
216
|
+
cause: payload.lineage
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
// The optional journal side channel is disclosure only. Semantic lineage
|
|
220
|
+
// lives in payload and cannot be replaced by diagnostic metadata.
|
|
221
|
+
yield* Schema.decodeUnknownEffect(Schema.Json)(entry.meta);
|
|
222
|
+
return { ...decoded, entry };
|
|
223
|
+
}).pipe(Effect.catchCause((failure) => {
|
|
224
|
+
const cause = Cause.squash(failure);
|
|
225
|
+
return Effect.fail(cause instanceof EventError
|
|
226
|
+
? cause
|
|
227
|
+
: new EventError({ code: "malformed", message: "invalid engine event", cause }));
|
|
228
|
+
}));
|
|
229
|
+
/**
|
|
230
|
+
* Construct a versioned submission, validating before journal redaction.
|
|
231
|
+
*
|
|
232
|
+
* @category constructors
|
|
233
|
+
* @since 1.0.0
|
|
234
|
+
*/
|
|
235
|
+
export const attempt = (payload, sourceId, sourceSeq, diagnostics = null) => {
|
|
236
|
+
const validated = decodePayload(payload);
|
|
237
|
+
return new Event.Input({
|
|
238
|
+
runId: validated.lineage.runId,
|
|
239
|
+
sourceId,
|
|
240
|
+
sourceSeq,
|
|
241
|
+
eventType: attemptEventType,
|
|
242
|
+
payload: validated,
|
|
243
|
+
meta: decodeJson(diagnostics)
|
|
244
|
+
});
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* Construct a versioned execution, deferred or clock submission. Existing
|
|
248
|
+
* unversioned writers are unchanged and cannot manufacture missing lineage.
|
|
249
|
+
*
|
|
250
|
+
* @category constructors
|
|
251
|
+
* @since 1.0.0
|
|
252
|
+
*/
|
|
253
|
+
export const stateEvent = (payload, sourceId, sourceSeq, diagnostics = null) => {
|
|
254
|
+
const validated = Schema.decodeUnknownSync(StatePayload, strict)(payload);
|
|
255
|
+
return new Event.Input({
|
|
256
|
+
runId: validated.lineage.runId,
|
|
257
|
+
sourceId,
|
|
258
|
+
sourceSeq,
|
|
259
|
+
eventType: stateEventType,
|
|
260
|
+
payload: validated,
|
|
261
|
+
meta: decodeJson(diagnostics)
|
|
262
|
+
});
|
|
263
|
+
};
|
|
264
|
+
/**
|
|
265
|
+
* Historical attempt markers deliberately remain incomplete evidence. No
|
|
266
|
+
* result, timestamp, round or lineage root is invented for old rows.
|
|
267
|
+
*
|
|
268
|
+
* @category schemas
|
|
269
|
+
* @since 1.0.0
|
|
270
|
+
*/
|
|
271
|
+
export const CurrentAttempt = Schema.Union([
|
|
272
|
+
Schema.Struct({
|
|
273
|
+
eventType: Schema.Literal("flows.engine.attempt-started"),
|
|
274
|
+
payload: Schema.Struct({
|
|
275
|
+
version: Schema.optionalKey(Schema.Never),
|
|
276
|
+
runId: Event.RunId,
|
|
277
|
+
stepKeyDigest: Event.DispatchId,
|
|
278
|
+
attempt: Event.NonNegativeQuantity,
|
|
279
|
+
tier: Schema.Literals(["sealed", "compensable", "irreversible"])
|
|
280
|
+
})
|
|
281
|
+
}),
|
|
282
|
+
Schema.Struct({
|
|
283
|
+
eventType: Schema.Literal("flows.engine.attempt-finished"),
|
|
284
|
+
payload: Schema.Struct({
|
|
285
|
+
version: Schema.optionalKey(Schema.Never),
|
|
286
|
+
runId: Event.RunId,
|
|
287
|
+
stepKeyDigest: Event.DispatchId,
|
|
288
|
+
attempt: Event.NonNegativeQuantity,
|
|
289
|
+
state: Schema.Literals(["succeeded", "failed"])
|
|
290
|
+
})
|
|
291
|
+
})
|
|
292
|
+
]);
|
|
293
|
+
/**
|
|
294
|
+
* Decode current markers using their recorded lineage, without upgrading bytes.
|
|
295
|
+
*
|
|
296
|
+
* @category decoders
|
|
297
|
+
* @since 1.0.0
|
|
298
|
+
*/
|
|
299
|
+
export const decodeCurrentAttempt = (input, consumer) => Effect.gen(function* () {
|
|
300
|
+
const entry = yield* decodeRow(input);
|
|
301
|
+
const marker = yield* Schema.decodeUnknownEffect(CurrentAttempt)(entry);
|
|
302
|
+
const meta = yield* Schema.decodeUnknownEffect(Schema.Struct({ lineageId: Event.LineageId }))(entry.meta);
|
|
303
|
+
if (entry.runId !== consumer.runId || marker.payload.runId !== entry.runId ||
|
|
304
|
+
meta.lineageId !== consumer.lineageId || !consumer.sources.includes(entry.sourceId)) {
|
|
305
|
+
throw new EventError({
|
|
306
|
+
code: "foreign",
|
|
307
|
+
message: "current attempt marker is outside the consumer scope",
|
|
308
|
+
cause: entry
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
return { entry, marker, lineageId: meta.lineageId };
|
|
312
|
+
}).pipe(Effect.catchCause((failure) => {
|
|
313
|
+
const cause = Cause.squash(failure);
|
|
314
|
+
return Effect.fail(cause instanceof EventError
|
|
315
|
+
? cause
|
|
316
|
+
: new EventError({ code: "malformed", message: "invalid current attempt marker", cause }));
|
|
317
|
+
}));
|
|
318
|
+
/**
|
|
319
|
+
* Where a declaration was written, as a durable record may carry it.
|
|
320
|
+
*
|
|
321
|
+
* Repo-relative by contract: a journal is read on machines that are not the
|
|
322
|
+
* one that wrote it, so an absolute path is at best noise and at worst an
|
|
323
|
+
* operator's home directory published into a run's history. A writer that
|
|
324
|
+
* cannot make a path relative omits the field.
|
|
325
|
+
*
|
|
326
|
+
* @category schemas
|
|
327
|
+
* @since 1.0.0
|
|
328
|
+
*/
|
|
329
|
+
export const DeclaredAt = Schema.Struct({
|
|
330
|
+
path: Schema.NonEmptyString.check(Schema.makeFilter((value) => !value.startsWith("/"))),
|
|
331
|
+
line: Event.NonNegativeQuantity
|
|
332
|
+
});
|
|
333
|
+
/**
|
|
334
|
+
* A root that names the whole filesystem, which is no root at all.
|
|
335
|
+
*
|
|
336
|
+
* `process.cwd()` is `"/"` for a host a launcher started outside any
|
|
337
|
+
* directory, and relativizing against it would make every absolute path
|
|
338
|
+
* "relative": an operator's home directory, minus one leading slash, written
|
|
339
|
+
* into a run's permanent history. The empty string is the same statement, and
|
|
340
|
+
* a Windows drive root (`C:` or `C:\`) is the same statement again. @private
|
|
341
|
+
*/
|
|
342
|
+
const isFilesystemRoot = (root) => root === "" || root === "/" || /^[A-Za-z]:[\\/]?$/.test(root);
|
|
343
|
+
/**
|
|
344
|
+
* A declaration path as {@link DeclaredAt} may carry it: relative to the
|
|
345
|
+
* root, or nothing.
|
|
346
|
+
*
|
|
347
|
+
* It lives beside the schema that refuses an absolute path, because obeying
|
|
348
|
+
* that refusal is the writer's one job and every writer obeys it the same
|
|
349
|
+
* way. A path outside the root is omitted rather than recorded with `..`
|
|
350
|
+
* segments, because a reader resolving those would have to know the root,
|
|
351
|
+
* which is exactly the machine-specific fact this strips. A root that is the
|
|
352
|
+
* filesystem itself strips nothing, so it is read as no root.
|
|
353
|
+
*
|
|
354
|
+
* @category accessors
|
|
355
|
+
* @since 1.0.0
|
|
356
|
+
*/
|
|
357
|
+
export const relativePath = (root, path) => {
|
|
358
|
+
if (root === undefined || isFilesystemRoot(root) || path === "")
|
|
359
|
+
return undefined;
|
|
360
|
+
const base = root.endsWith("/") ? root : `${root}/`;
|
|
361
|
+
if (!path.startsWith(base))
|
|
362
|
+
return undefined;
|
|
363
|
+
const relative = path.slice(base.length);
|
|
364
|
+
return relative === "" ? undefined : relative;
|
|
365
|
+
};
|
|
366
|
+
/**
|
|
367
|
+
* One node of the graph a run was driven from.
|
|
368
|
+
*
|
|
369
|
+
* `kind` is open text because the two executors name kinds differently and
|
|
370
|
+
* both are true: the plan scheduler's node is a `step`, an `agent` or a
|
|
371
|
+
* `merge`, while the interpreter's is the authoring variant it was observed
|
|
372
|
+
* at. A closed union here would force one of them to lie.
|
|
373
|
+
*
|
|
374
|
+
* @category schemas
|
|
375
|
+
* @since 1.0.0
|
|
376
|
+
*/
|
|
377
|
+
export const NodeSummary = Schema.Struct({
|
|
378
|
+
id: Schema.NonEmptyString,
|
|
379
|
+
kind: Schema.String,
|
|
380
|
+
dependsOn: Schema.Array(Schema.NonEmptyString),
|
|
381
|
+
tier: Schema.Literals(["sealed", "compensable", "irreversible"]),
|
|
382
|
+
key: Schema.optionalKey(Schema.String),
|
|
383
|
+
generation: Schema.optionalKey(Event.NonNegativeQuantity),
|
|
384
|
+
action: Schema.optionalKey(Schema.String),
|
|
385
|
+
effects: Schema.optionalKey(Schema.Json),
|
|
386
|
+
declaredAt: Schema.optionalKey(DeclaredAt)
|
|
387
|
+
});
|
|
388
|
+
/**
|
|
389
|
+
* One edge of that graph, with the reason the builder drew it.
|
|
390
|
+
*
|
|
391
|
+
* @category schemas
|
|
392
|
+
* @since 1.0.0
|
|
393
|
+
*/
|
|
394
|
+
export const EdgeSummary = Schema.Struct({
|
|
395
|
+
from: Schema.NonEmptyString,
|
|
396
|
+
to: Schema.NonEmptyString,
|
|
397
|
+
reason: Schema.Literals(["value", "continuation", "failure"])
|
|
398
|
+
});
|
|
399
|
+
/**
|
|
400
|
+
* The immutable name of a tree a host read declaration sites out of.
|
|
401
|
+
*
|
|
402
|
+
* Exactly the forty lowercase hex digits the only producer emits: a jj
|
|
403
|
+
* working-copy commit id, or a git commit for a tree that still matches one
|
|
404
|
+
* (`SourceRevision.objectId`). It is narrowed here rather than left as text
|
|
405
|
+
* because a reader puts it straight into a contents route's `?ref=`, and
|
|
406
|
+
* `DeclaredAt` beside it refuses an absolute path for the same class of
|
|
407
|
+
* reason: a field that only ever holds one shape should refuse the others at
|
|
408
|
+
* the boundary rather than at whatever spawns a process downstream.
|
|
409
|
+
*
|
|
410
|
+
* @category schemas
|
|
411
|
+
* @since 1.0.0
|
|
412
|
+
*/
|
|
413
|
+
export const SourceRevision = Schema.NonEmptyString.check(Schema.makeFilter((value) => /^[0-9a-f]{40}$/.test(value)));
|
|
414
|
+
/**
|
|
415
|
+
* The graph, or one page of it, carried beside a plan record.
|
|
416
|
+
*
|
|
417
|
+
* `edges` is optional because only one writer can answer it honestly. A plan
|
|
418
|
+
* names its edges through each node's `dependsOn` and knows no reason for
|
|
419
|
+
* them; an interpreter knows the reason it drew each one. A writer without
|
|
420
|
+
* reasons omits the field rather than labelling every edge `value`.
|
|
421
|
+
*
|
|
422
|
+
* @category schemas
|
|
423
|
+
* @since 1.0.0
|
|
424
|
+
*/
|
|
425
|
+
export const NodeGraph = Schema.Struct({
|
|
426
|
+
nodes: Schema.Array(NodeSummary),
|
|
427
|
+
edges: Schema.optionalKey(Schema.Array(EdgeSummary)),
|
|
428
|
+
/**
|
|
429
|
+
* The revision of the tree the nodes on this page were read out of.
|
|
430
|
+
*
|
|
431
|
+
* A `declaredAt` is a path and a line, and neither says which bytes were
|
|
432
|
+
* at that line: a working tree moves, so the same path after an edit or a
|
|
433
|
+
* branch switch is a different file. Only the writer can answer this —
|
|
434
|
+
* like the root a path is made relative to — so it travels with the page
|
|
435
|
+
* the sites travel on, and a reader can ask for the file AT this revision
|
|
436
|
+
* instead of whatever is on disk when they look.
|
|
437
|
+
*
|
|
438
|
+
* Optional because only a writer served out of a version-controlled tree
|
|
439
|
+
* can name one. A writer that cannot says nothing, and a reader that has
|
|
440
|
+
* nothing shows no code rather than code it cannot bind (D-068).
|
|
441
|
+
*/
|
|
442
|
+
sourceRevision: Schema.optionalKey(SourceRevision)
|
|
443
|
+
});
|
|
444
|
+
/**
|
|
445
|
+
* A plan was recorded and a run is about to be driven under it.
|
|
446
|
+
*
|
|
447
|
+
* `nodes` is the node COUNT the record has always carried. The node list
|
|
448
|
+
* arrives beside it as `graph`, optional and paged, because a journal entry
|
|
449
|
+
* has a byte bound: what does not fit follows as {@link SubgraphAppended}
|
|
450
|
+
* pages rather than being clipped.
|
|
451
|
+
*
|
|
452
|
+
* Everything an executor cannot honestly answer is optional rather than
|
|
453
|
+
* invented. The interpreter drives a graph with no plan id, no plan digest
|
|
454
|
+
* and no store to record an outcome with, and saying so is the point of this
|
|
455
|
+
* schema.
|
|
456
|
+
*
|
|
457
|
+
* @category schemas
|
|
458
|
+
* @since 1.0.0
|
|
459
|
+
*/
|
|
460
|
+
export const PlanRecordedPayload = Schema.Struct({
|
|
461
|
+
planId: Schema.optionalKey(Schema.NonEmptyString),
|
|
462
|
+
flow: Schema.NonEmptyString,
|
|
463
|
+
digest: Schema.optionalKey(Schema.String),
|
|
464
|
+
baseDigest: Schema.optionalKey(Schema.String),
|
|
465
|
+
generation: Event.NonNegativeQuantity,
|
|
466
|
+
nodes: Event.NonNegativeQuantity,
|
|
467
|
+
outcome: Schema.optionalKey(Schema.String),
|
|
468
|
+
page: Schema.optionalKey(Event.NonNegativeQuantity),
|
|
469
|
+
pages: Schema.optionalKey(Event.NonNegativeQuantity),
|
|
470
|
+
graph: Schema.optionalKey(NodeGraph)
|
|
471
|
+
});
|
|
472
|
+
/**
|
|
473
|
+
* An elaboration appended a pre-keyed subgraph to the same plan, or the next
|
|
474
|
+
* page of a graph too large for one record.
|
|
475
|
+
*
|
|
476
|
+
* @category schemas
|
|
477
|
+
* @since 1.0.0
|
|
478
|
+
*/
|
|
479
|
+
export const SubgraphAppendedPayload = Schema.Struct({
|
|
480
|
+
planId: Schema.optionalKey(Schema.NonEmptyString),
|
|
481
|
+
flow: Schema.optionalKey(Schema.NonEmptyString),
|
|
482
|
+
digest: Schema.optionalKey(Schema.String),
|
|
483
|
+
baseDigest: Schema.optionalKey(Schema.String),
|
|
484
|
+
generation: Event.NonNegativeQuantity,
|
|
485
|
+
nodeIds: Schema.Array(Schema.NonEmptyString),
|
|
486
|
+
page: Schema.optionalKey(Event.NonNegativeQuantity),
|
|
487
|
+
pages: Schema.optionalKey(Event.NonNegativeQuantity),
|
|
488
|
+
graph: Schema.optionalKey(NodeGraph)
|
|
489
|
+
});
|
|
490
|
+
/**
|
|
491
|
+
* A plan node was admitted and its work is about to start.
|
|
492
|
+
*
|
|
493
|
+
* @category schemas
|
|
494
|
+
* @since 1.0.0
|
|
495
|
+
*/
|
|
496
|
+
export const NodeScheduledPayload = Schema.Struct({
|
|
497
|
+
planId: Schema.optionalKey(Schema.NonEmptyString),
|
|
498
|
+
nodeId: Schema.NonEmptyString,
|
|
499
|
+
kind: Schema.String,
|
|
500
|
+
planKey: Schema.optionalKey(Schema.String),
|
|
501
|
+
dispatchKey: Schema.optionalKey(Schema.String),
|
|
502
|
+
attempt: Event.PositiveQuantity,
|
|
503
|
+
priority: Schema.optionalKey(Schema.Int),
|
|
504
|
+
waited: Schema.optionalKey(Event.NonNegativeQuantity),
|
|
505
|
+
action: Schema.optionalKey(Schema.String)
|
|
506
|
+
});
|
|
507
|
+
/**
|
|
508
|
+
* A bounded look at what a node settled with.
|
|
509
|
+
*
|
|
510
|
+
* `preview` is JSON text, redacted before it was encoded and cut to a fixed
|
|
511
|
+
* ceiling afterwards, so a long value costs a durable row a known number of
|
|
512
|
+
* bytes rather than however many it happens to hold. `truncated` says the cut
|
|
513
|
+
* happened, which is also the warning that the text is a PREFIX of JSON and
|
|
514
|
+
* no longer parses. `bytes` is the size of the encoding the preview was cut
|
|
515
|
+
* from, so a reader can say how much was left out without being shown it; a
|
|
516
|
+
* value too large for a writer to redact at all is named by the size of its
|
|
517
|
+
* own encoding, with an empty preview and the flag set.
|
|
518
|
+
*
|
|
519
|
+
* Redaction comes first and truncation second on purpose: cutting the text
|
|
520
|
+
* first can split a credential across the boundary, and a textual redactor
|
|
521
|
+
* scanning the remains would no longer recognise it.
|
|
522
|
+
*
|
|
523
|
+
* @category schemas
|
|
524
|
+
* @since 1.0.0
|
|
525
|
+
*/
|
|
526
|
+
export const NodeResultSummary = Schema.Struct({
|
|
527
|
+
preview: Schema.String,
|
|
528
|
+
bytes: Event.NonNegativeQuantity,
|
|
529
|
+
truncated: Schema.Boolean
|
|
530
|
+
});
|
|
531
|
+
/**
|
|
532
|
+
* A plan node reached an outcome.
|
|
533
|
+
*
|
|
534
|
+
* The outcomes are Skyframe's evaluation states: `built` ran,
|
|
535
|
+
* `clean` was served from records, `failed` raised, `skipped` was never
|
|
536
|
+
* reached, and `deferred` is a scheduling debt the plan scheduler alone
|
|
537
|
+
* records.
|
|
538
|
+
*
|
|
539
|
+
* `attempts` is the executor's own count. For the plan scheduler it is the
|
|
540
|
+
* node's; for the interpreter it is the highest durable attempt any of this
|
|
541
|
+
* node's dispatches ran as, because the interpreter settles each node once
|
|
542
|
+
* and a retry happens underneath it inside one dispatch.
|
|
543
|
+
*
|
|
544
|
+
* `stepKeyDigests` names the dispatches the node drove, and it is the join
|
|
545
|
+
* `flows.engine.attempt-started` could not make on its own: an attempt record
|
|
546
|
+
* carries a step key digest and no node id, so an attempt belongs to the node
|
|
547
|
+
* whose settlement claims its digest. A retried dispatch keeps ONE digest —
|
|
548
|
+
* the attempt is folded into no key — so the list is distinct dispatches, not
|
|
549
|
+
* attempts. A writer that derives no digests omits the field; a node that
|
|
550
|
+
* dispatched nothing records an empty list, which is a different statement.
|
|
551
|
+
*
|
|
552
|
+
* `result` is what the node settled with: the success value for `built` and
|
|
553
|
+
* `clean`, the typed failure for `failed`, bounded and redacted by the writer.
|
|
554
|
+
* Absent when the writer kept none.
|
|
555
|
+
*
|
|
556
|
+
* @category schemas
|
|
557
|
+
* @since 1.0.0
|
|
558
|
+
*/
|
|
559
|
+
export const NodeSettledPayload = Schema.Struct({
|
|
560
|
+
planId: Schema.optionalKey(Schema.NonEmptyString),
|
|
561
|
+
nodeId: Schema.NonEmptyString,
|
|
562
|
+
planKey: Schema.optionalKey(Schema.String),
|
|
563
|
+
dispatchKey: Schema.optionalKey(Schema.String),
|
|
564
|
+
stepKeyDigests: Schema.optionalKey(Schema.Array(Schema.NonEmptyString)),
|
|
565
|
+
outcome: Schema.Literals(["built", "clean", "failed", "skipped", "deferred"]),
|
|
566
|
+
attempts: Event.NonNegativeQuantity,
|
|
567
|
+
rebases: Schema.optionalKey(Event.NonNegativeQuantity),
|
|
568
|
+
action: Schema.optionalKey(Schema.String),
|
|
569
|
+
result: Schema.optionalKey(NodeResultSummary)
|
|
570
|
+
});
|
|
571
|
+
/**
|
|
572
|
+
* A scheduled node's dispatch identity was invalidated and re-keyed.
|
|
573
|
+
*
|
|
574
|
+
* @category schemas
|
|
575
|
+
* @since 1.0.0
|
|
576
|
+
*/
|
|
577
|
+
export const NodeInvalidatedPayload = Schema.Struct({
|
|
578
|
+
planId: Schema.NonEmptyString,
|
|
579
|
+
nodeId: Schema.NonEmptyString,
|
|
580
|
+
planKey: Schema.String,
|
|
581
|
+
from: Schema.String,
|
|
582
|
+
to: Schema.String,
|
|
583
|
+
reason: Schema.Literal("measured-inputs-changed")
|
|
584
|
+
});
|
|
585
|
+
/**
|
|
586
|
+
* The reconciliation seam returned a verdict for a deviation.
|
|
587
|
+
*
|
|
588
|
+
* @category schemas
|
|
589
|
+
* @since 1.0.0
|
|
590
|
+
*/
|
|
591
|
+
export const NodeReconciledPayload = Schema.Struct({
|
|
592
|
+
planId: Schema.NonEmptyString,
|
|
593
|
+
nodeId: Schema.NonEmptyString,
|
|
594
|
+
trigger: Schema.String,
|
|
595
|
+
verdict: Schema.Json
|
|
596
|
+
});
|
|
597
|
+
/**
|
|
598
|
+
* The event type each node and plan payload is recorded under.
|
|
599
|
+
*
|
|
600
|
+
* Readers and writers share these identities, so a value here is stored
|
|
601
|
+
* history and changing one requires migrating it.
|
|
602
|
+
*
|
|
603
|
+
* @category constants
|
|
604
|
+
* @since 1.0.0
|
|
605
|
+
*/
|
|
606
|
+
export const nodeEventTypes = {
|
|
607
|
+
planRecorded: "flows.engine.plan-recorded",
|
|
608
|
+
subgraphAppended: "flows.engine.subgraph-appended",
|
|
609
|
+
nodeScheduled: "flows.engine.node-scheduled",
|
|
610
|
+
nodeSettled: "flows.engine.node-settled",
|
|
611
|
+
nodeInvalidated: "flows.engine.node-invalidated",
|
|
612
|
+
nodeReconciled: "flows.engine.node-reconciled"
|
|
613
|
+
};
|
|
614
|
+
//# sourceMappingURL=EngineEvent.js.map
|