@reticlehq/core 2.11.0 → 2.12.0

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.
@@ -120,6 +120,14 @@ export declare const FlowExpectSchema: z.ZodObject<{
120
120
  * bare `signal` still parses, and the on-disk version stays FLOW_FILE_VERSION 1.
121
121
  */
122
122
  signalData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
123
+ /**
124
+ * Exact number of times the signal must have fired — the signal-side twin of `net.count`, and the
125
+ * only way a saved flow can keep a cardinality the agent actually asserted. Without it a
126
+ * `count: 1` drive would be recorded as bare presence, which is a strictly WEAKER claim than the
127
+ * one made: the replayed flow then goes green on the double-fire it was recorded to catch.
128
+ * Additive/optional — a flow file with a bare `signal` still parses, and FLOW_FILE_VERSION stays 1.
129
+ */
130
+ signalCount: z.ZodOptional<z.ZodNumber>;
123
131
  net: z.ZodOptional<z.ZodObject<{
124
132
  method: z.ZodOptional<z.ZodString>;
125
133
  urlContains: z.ZodOptional<z.ZodString>;
@@ -200,6 +208,7 @@ export declare const FlowExpectSchema: z.ZodObject<{
200
208
  }, "strip", z.ZodTypeAny, {
201
209
  signal?: string | undefined;
202
210
  signalData?: Record<string, unknown> | undefined;
211
+ signalCount?: number | undefined;
203
212
  net?: {
204
213
  status?: number | undefined;
205
214
  method?: string | undefined;
@@ -224,6 +233,7 @@ export declare const FlowExpectSchema: z.ZodObject<{
224
233
  }, {
225
234
  signal?: string | undefined;
226
235
  signalData?: Record<string, unknown> | undefined;
236
+ signalCount?: number | undefined;
227
237
  net?: {
228
238
  status?: number | undefined;
229
239
  method?: string | undefined;
@@ -446,6 +456,20 @@ export declare const FlowFileSchema: z.ZodObject<{
446
456
  * cannot actually check — flow-classify flags that gap.
447
457
  */
448
458
  intent: z.ZodOptional<z.ZodString>;
459
+ /**
460
+ * The intent-ledger row this flow discharges — the id in `.reticle/intent.json`.
461
+ *
462
+ * `intent` above is the prose a recorder captured; this is the LINK to the ledger that already
463
+ * models declared → bound → proved and records which verdict discharged what. Without it there
464
+ * would be two ways to say what a change is for, which is the defect this codebase keeps paying
465
+ * for: a flow's goal and an intent's statement would drift apart with nothing to reconcile them.
466
+ *
467
+ * Set at save time from the flow's own prose, or written by hand to point a flow at an intent
468
+ * declared earlier via `reticle_intent` — a flow can prove something somebody else declared.
469
+ * Optional + back-compat: a flow without it replays exactly as before, and the on-disk version
470
+ * stays FLOW_FILE_VERSION 1.
471
+ */
472
+ intentId: z.ZodOptional<z.ZodString>;
449
473
  /**
450
474
  * The project the flow was recorded against (the connecting session's HELLO `projectId`), stamped at
451
475
  * save time. Scopes a flow to its app so a shared daemon's HUD lists only the current project's flows
@@ -473,6 +497,14 @@ export declare const FlowFileSchema: z.ZodObject<{
473
497
  * bare `signal` still parses, and the on-disk version stays FLOW_FILE_VERSION 1.
474
498
  */
475
499
  signalData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
500
+ /**
501
+ * Exact number of times the signal must have fired — the signal-side twin of `net.count`, and the
502
+ * only way a saved flow can keep a cardinality the agent actually asserted. Without it a
503
+ * `count: 1` drive would be recorded as bare presence, which is a strictly WEAKER claim than the
504
+ * one made: the replayed flow then goes green on the double-fire it was recorded to catch.
505
+ * Additive/optional — a flow file with a bare `signal` still parses, and FLOW_FILE_VERSION stays 1.
506
+ */
507
+ signalCount: z.ZodOptional<z.ZodNumber>;
476
508
  net: z.ZodOptional<z.ZodObject<{
477
509
  method: z.ZodOptional<z.ZodString>;
478
510
  urlContains: z.ZodOptional<z.ZodString>;
@@ -553,6 +585,7 @@ export declare const FlowFileSchema: z.ZodObject<{
553
585
  }, "strip", z.ZodTypeAny, {
554
586
  signal?: string | undefined;
555
587
  signalData?: Record<string, unknown> | undefined;
588
+ signalCount?: number | undefined;
556
589
  net?: {
557
590
  status?: number | undefined;
558
591
  method?: string | undefined;
@@ -577,6 +610,7 @@ export declare const FlowFileSchema: z.ZodObject<{
577
610
  }, {
578
611
  signal?: string | undefined;
579
612
  signalData?: Record<string, unknown> | undefined;
613
+ signalCount?: number | undefined;
580
614
  net?: {
581
615
  status?: number | undefined;
582
616
  method?: string | undefined;
@@ -702,11 +736,13 @@ export declare const FlowFileSchema: z.ZodObject<{
702
736
  createdAt: number;
703
737
  intent?: string | undefined;
704
738
  projectId?: string | undefined;
739
+ intentId?: string | undefined;
705
740
  startPath?: string | undefined;
706
741
  fixture?: string | undefined;
707
742
  success?: {
708
743
  signal?: string | undefined;
709
744
  signalData?: Record<string, unknown> | undefined;
745
+ signalCount?: number | undefined;
710
746
  net?: {
711
747
  status?: number | undefined;
712
748
  method?: string | undefined;
@@ -762,11 +798,13 @@ export declare const FlowFileSchema: z.ZodObject<{
762
798
  createdAt: number;
763
799
  intent?: string | undefined;
764
800
  projectId?: string | undefined;
801
+ intentId?: string | undefined;
765
802
  startPath?: string | undefined;
766
803
  fixture?: string | undefined;
767
804
  success?: {
768
805
  signal?: string | undefined;
769
806
  signalData?: Record<string, unknown> | undefined;
807
+ signalCount?: number | undefined;
770
808
  net?: {
771
809
  status?: number | undefined;
772
810
  method?: string | undefined;
@@ -835,6 +873,20 @@ export declare const RecordedFlowSchema: z.ZodObject<{
835
873
  * cannot actually check — flow-classify flags that gap.
836
874
  */
837
875
  intent: z.ZodOptional<z.ZodString>;
876
+ /**
877
+ * The intent-ledger row this flow discharges — the id in `.reticle/intent.json`.
878
+ *
879
+ * `intent` above is the prose a recorder captured; this is the LINK to the ledger that already
880
+ * models declared → bound → proved and records which verdict discharged what. Without it there
881
+ * would be two ways to say what a change is for, which is the defect this codebase keeps paying
882
+ * for: a flow's goal and an intent's statement would drift apart with nothing to reconcile them.
883
+ *
884
+ * Set at save time from the flow's own prose, or written by hand to point a flow at an intent
885
+ * declared earlier via `reticle_intent` — a flow can prove something somebody else declared.
886
+ * Optional + back-compat: a flow without it replays exactly as before, and the on-disk version
887
+ * stays FLOW_FILE_VERSION 1.
888
+ */
889
+ intentId: z.ZodOptional<z.ZodString>;
838
890
  /**
839
891
  * The project the flow was recorded against (the connecting session's HELLO `projectId`), stamped at
840
892
  * save time. Scopes a flow to its app so a shared daemon's HUD lists only the current project's flows
@@ -862,6 +914,14 @@ export declare const RecordedFlowSchema: z.ZodObject<{
862
914
  * bare `signal` still parses, and the on-disk version stays FLOW_FILE_VERSION 1.
863
915
  */
864
916
  signalData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
917
+ /**
918
+ * Exact number of times the signal must have fired — the signal-side twin of `net.count`, and the
919
+ * only way a saved flow can keep a cardinality the agent actually asserted. Without it a
920
+ * `count: 1` drive would be recorded as bare presence, which is a strictly WEAKER claim than the
921
+ * one made: the replayed flow then goes green on the double-fire it was recorded to catch.
922
+ * Additive/optional — a flow file with a bare `signal` still parses, and FLOW_FILE_VERSION stays 1.
923
+ */
924
+ signalCount: z.ZodOptional<z.ZodNumber>;
865
925
  net: z.ZodOptional<z.ZodObject<{
866
926
  method: z.ZodOptional<z.ZodString>;
867
927
  urlContains: z.ZodOptional<z.ZodString>;
@@ -942,6 +1002,7 @@ export declare const RecordedFlowSchema: z.ZodObject<{
942
1002
  }, "strip", z.ZodTypeAny, {
943
1003
  signal?: string | undefined;
944
1004
  signalData?: Record<string, unknown> | undefined;
1005
+ signalCount?: number | undefined;
945
1006
  net?: {
946
1007
  status?: number | undefined;
947
1008
  method?: string | undefined;
@@ -966,6 +1027,7 @@ export declare const RecordedFlowSchema: z.ZodObject<{
966
1027
  }, {
967
1028
  signal?: string | undefined;
968
1029
  signalData?: Record<string, unknown> | undefined;
1030
+ signalCount?: number | undefined;
969
1031
  net?: {
970
1032
  status?: number | undefined;
971
1033
  method?: string | undefined;
@@ -1091,11 +1153,13 @@ export declare const RecordedFlowSchema: z.ZodObject<{
1091
1153
  createdAt: number;
1092
1154
  intent?: string | undefined;
1093
1155
  projectId?: string | undefined;
1156
+ intentId?: string | undefined;
1094
1157
  startPath?: string | undefined;
1095
1158
  fixture?: string | undefined;
1096
1159
  success?: {
1097
1160
  signal?: string | undefined;
1098
1161
  signalData?: Record<string, unknown> | undefined;
1162
+ signalCount?: number | undefined;
1099
1163
  net?: {
1100
1164
  status?: number | undefined;
1101
1165
  method?: string | undefined;
@@ -1151,11 +1215,13 @@ export declare const RecordedFlowSchema: z.ZodObject<{
1151
1215
  createdAt: number;
1152
1216
  intent?: string | undefined;
1153
1217
  projectId?: string | undefined;
1218
+ intentId?: string | undefined;
1154
1219
  startPath?: string | undefined;
1155
1220
  fixture?: string | undefined;
1156
1221
  success?: {
1157
1222
  signal?: string | undefined;
1158
1223
  signalData?: Record<string, unknown> | undefined;
1224
+ signalCount?: number | undefined;
1159
1225
  net?: {
1160
1226
  status?: number | undefined;
1161
1227
  method?: string | undefined;
@@ -1213,11 +1279,13 @@ export declare const RecordedFlowSchema: z.ZodObject<{
1213
1279
  createdAt: number;
1214
1280
  intent?: string | undefined;
1215
1281
  projectId?: string | undefined;
1282
+ intentId?: string | undefined;
1216
1283
  startPath?: string | undefined;
1217
1284
  fixture?: string | undefined;
1218
1285
  success?: {
1219
1286
  signal?: string | undefined;
1220
1287
  signalData?: Record<string, unknown> | undefined;
1288
+ signalCount?: number | undefined;
1221
1289
  net?: {
1222
1290
  status?: number | undefined;
1223
1291
  method?: string | undefined;
@@ -1276,11 +1344,13 @@ export declare const RecordedFlowSchema: z.ZodObject<{
1276
1344
  createdAt: number;
1277
1345
  intent?: string | undefined;
1278
1346
  projectId?: string | undefined;
1347
+ intentId?: string | undefined;
1279
1348
  startPath?: string | undefined;
1280
1349
  fixture?: string | undefined;
1281
1350
  success?: {
1282
1351
  signal?: string | undefined;
1283
1352
  signalData?: Record<string, unknown> | undefined;
1353
+ signalCount?: number | undefined;
1284
1354
  net?: {
1285
1355
  status?: number | undefined;
1286
1356
  method?: string | undefined;
@@ -55,6 +55,14 @@ export const FlowExpectSchema = z.object({
55
55
  * bare `signal` still parses, and the on-disk version stays FLOW_FILE_VERSION 1.
56
56
  */
57
57
  signalData: z.record(z.unknown()).optional(),
58
+ /**
59
+ * Exact number of times the signal must have fired — the signal-side twin of `net.count`, and the
60
+ * only way a saved flow can keep a cardinality the agent actually asserted. Without it a
61
+ * `count: 1` drive would be recorded as bare presence, which is a strictly WEAKER claim than the
62
+ * one made: the replayed flow then goes green on the double-fire it was recorded to catch.
63
+ * Additive/optional — a flow file with a bare `signal` still parses, and FLOW_FILE_VERSION stays 1.
64
+ */
65
+ signalCount: z.number().int().nonnegative().optional(),
58
66
  net: z
59
67
  .object({
60
68
  method: z.string().optional(),
@@ -134,6 +142,20 @@ export const FlowFileSchema = z.object({
134
142
  * cannot actually check — flow-classify flags that gap.
135
143
  */
136
144
  intent: z.string().optional(),
145
+ /**
146
+ * The intent-ledger row this flow discharges — the id in `.reticle/intent.json`.
147
+ *
148
+ * `intent` above is the prose a recorder captured; this is the LINK to the ledger that already
149
+ * models declared → bound → proved and records which verdict discharged what. Without it there
150
+ * would be two ways to say what a change is for, which is the defect this codebase keeps paying
151
+ * for: a flow's goal and an intent's statement would drift apart with nothing to reconcile them.
152
+ *
153
+ * Set at save time from the flow's own prose, or written by hand to point a flow at an intent
154
+ * declared earlier via `reticle_intent` — a flow can prove something somebody else declared.
155
+ * Optional + back-compat: a flow without it replays exactly as before, and the on-disk version
156
+ * stays FLOW_FILE_VERSION 1.
157
+ */
158
+ intentId: z.string().optional(),
137
159
  /**
138
160
  * The project the flow was recorded against (the connecting session's HELLO `projectId`), stamped at
139
161
  * save time. Scopes a flow to its app so a shared daemon's HUD lists only the current project's flows
package/dist/index.d.ts CHANGED
@@ -12,6 +12,8 @@ export * from './source-constants.js';
12
12
  export * from './event-classification.js';
13
13
  export * from './verified-constants.js';
14
14
  export * from './session-constants.js';
15
+ export * from './document-identity.js';
16
+ export * from './edit-epoch.js';
15
17
  export * from './messages.js';
16
18
  export * from './event-payloads.js';
17
19
  export * from './event-priority.js';
@@ -29,6 +31,8 @@ export * from './journal.js';
29
31
  export * from './browser-misdirect.js';
30
32
  export * from './daemon-registry.js';
31
33
  export * from './project-registry.js';
34
+ export * from './intent.js';
35
+ export * from './run-context.js';
32
36
  export * from './instrumentation-gap.js';
33
37
  export * from './security.js';
34
38
  export * from './redaction.js';
@@ -43,3 +47,4 @@ export * from './impact.js';
43
47
  export * from './impact-savings.js';
44
48
  export { CONTRACT_FINGERPRINT, fnv1a, fingerprintOf } from './contract-fingerprint.js';
45
49
  export { fingerprintFinding, type FindingIdentity } from './finding-fingerprint.js';
50
+ export * from './unreachable-notice.js';
package/dist/index.js CHANGED
@@ -13,6 +13,8 @@ export * from './source-constants.js'; // DATA_RETICLE_SOURCE_ATTR, RETICLE_ROOT
13
13
  export * from './event-classification.js'; // CHURN_TYPES — shared eviction priority for buffer/queue
14
14
  export * from './verified-constants.js'; // Verified — the one field an agent gates on
15
15
  export * from './session-constants.js';
16
+ export * from './document-identity.js'; // which document an observation belongs to
17
+ export * from './edit-epoch.js'; // which round of source edits an observation belongs to
16
18
  export * from './messages.js'; // ReticleEvent + the message schemas
17
19
  export * from './event-payloads.js'; // per-event payload schemas + wire vocab
18
20
  export * from './event-priority.js'; // which events survive the bridge rate cap
@@ -33,6 +35,8 @@ export * from './browser-misdirect.js';
33
35
  // ── INTERNAL cross-package plumbing (shared impl; not a stable outside API — may change in a minor) ─
34
36
  export * from './daemon-registry.js'; // daemon discovery, used by the vite plugin + server
35
37
  export * from './project-registry.js'; // projectId -> directory, so a cross-repo daemon can still resolve
38
+ export * from './intent.js'; // what a change was supposed to make true, captured while somebody knows
39
+ export * from './run-context.js'; // what a run established, folded and capped, for the agent to pull back
36
40
  export * from './instrumentation-gap.js'; // what Reticle could not see, and the change that would let it
37
41
  export * from './security.js'; // sanitize/serialize helpers shared by browser + server
38
42
  export * from './redaction.js'; // isSensitiveKey / scrubKnownSecrets — the shared redaction rules
@@ -47,3 +51,4 @@ export * from './impact.js'; // the user's own record of what Reticle has done f
47
51
  export * from './impact-savings.js'; // the savings model - one file, so every claim is derivable there
48
52
  export { CONTRACT_FINGERPRINT, fnv1a, fingerprintOf } from './contract-fingerprint.js';
49
53
  export { fingerprintFinding } from './finding-fingerprint.js';
54
+ export * from './unreachable-notice.js'; // the page's unreachable warning, as a contract the daemon parses
@@ -20,7 +20,10 @@
20
20
  * producing findings nobody reads. The test for whether a gap belongs here is: *did this absence
21
21
  * change the answer the agent just got?* If not, it does not fire.
22
22
  */
23
- /** The kinds of absence that can weaken a verdict. Each names a capability the app did not provide. */
23
+ /**
24
+ * The kinds of absence that can weaken a verdict. Most name a capability the app did not provide;
25
+ * `UNDECLARED_CHANGE` names one the agent did not, and is here because it costs a verdict the same.
26
+ */
24
27
  export declare const InstrumentationGapKind: {
25
28
  /**
26
29
  * An element was driven and carries no source mapping, so no `file:line` can be reported for it.
@@ -43,6 +46,61 @@ export declare const InstrumentationGapKind: {
43
46
  readonly NO_ROUTE_SIGNAL: "no-route-signal";
44
47
  /** A control was driven that the declared capability contract does not mention. */
45
48
  readonly UNDECLARED_CONTROL: "undeclared-control";
49
+ /**
50
+ * A flow cannot name a control with a stable testid, so the proposal is to add one.
51
+ *
52
+ * Honesty does not emit this on a verdict today — a missing testid is not itself a weaker
53
+ * channel the way a missing signal is. Oracles do, when they can locate the control. It
54
+ * belongs in this vocabulary so `reticle_domain` and a later honesty emit cannot disagree
55
+ * about the name of the same absence.
56
+ */
57
+ readonly MISSING_TESTID: "missing-testid";
58
+ /**
59
+ * Code changed, and this verdict is the first one taken since — with nothing declaring what the
60
+ * change was supposed to make true.
61
+ *
62
+ * The odd one out here, and deliberately so: every other kind names something the APP did not
63
+ * provide, and this one names something the AGENT did not say. It belongs beside them because it
64
+ * has the same effect on a verdict. A change with no declared intent can only be checked against
65
+ * itself, so a green means "nothing visibly broke" and gets read as "the change worked" — which is
66
+ * the definition of a false green, and the one absence no amount of instrumentation can close.
67
+ *
68
+ * It is never derived from the diff, the file name or the test name. A guessed intent reads as the
69
+ * developer's own words and an agent will act on it, which is strictly worse than honest absence.
70
+ */
71
+ readonly UNDECLARED_CHANGE: "undeclared-change";
72
+ /**
73
+ * A verdict PASSED and the ledger still holds intents nothing has proved.
74
+ *
75
+ * The mirror of `UNDECLARED_CHANGE`, and the more expensive half. That one fires when NOTHING was
76
+ * declared; this fires when something was and no verdict ever settled it — which reads identically
77
+ * to done from inside the run, because every verdict the agent drew came back green.
78
+ *
79
+ * Measured on the bench fixture: an agent fixed a form guard, drove the app, and drew SEVEN green
80
+ * verdicts, then reported FIXED. The form still accepted a whitespace-only service. Its closing
81
+ * words quoted its own patch as the evidence — seven verdicts about other things, and a conclusion
82
+ * read off the diff. No rule could see it: the change WAS declared, so `UNDECLARED_CHANGE` stayed
83
+ * silent, and each individual verdict was honestly green.
84
+ *
85
+ * A green does not settle what the run still owes, and only the ledger knows the difference. This
86
+ * is not a failure — the assertion held — so it downgrades nothing; it names the debt on the
87
+ * result the agent is already reading, at the moment it is deciding whether it is finished.
88
+ */
89
+ readonly INTENT_UNDISCHARGED: "intent-undischarged";
90
+ /**
91
+ * A flow was saved and nothing says what it is for.
92
+ *
93
+ * The second kind here that names something the AGENT did not say rather than something the app
94
+ * did not provide, and it costs the same. A saved flow is a regression test that runs for months:
95
+ * when it eventually goes red, the report can name the step that broke and nothing else, so the
96
+ * reader has to reconstruct the goal from the steps before they can judge whether the failure
97
+ * matters. An intent turns that report into a sentence about what stopped being true.
98
+ *
99
+ * Never derived from the flow name, the step names or the assertions, for the reason
100
+ * `UNDECLARED_CHANGE` gives: a guessed goal reads as the author's own words and somebody will act
101
+ * on it. Absence stays honest.
102
+ */
103
+ readonly NO_FLOW_INTENT: "no-flow-intent";
46
104
  };
47
105
  export type InstrumentationGapKind = (typeof InstrumentationGapKind)[keyof typeof InstrumentationGapKind];
48
106
  export interface InstrumentationGap {
Binary file