@reticlehq/core 3.1.0 → 3.2.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.
@@ -139,6 +139,16 @@ export declare const DriftReason: {
139
139
  * step whose anchor was fine.
140
140
  */
141
141
  readonly EXPECT_ELEMENT_NOT_FOUND: "expect_element_not_found";
142
+ /**
143
+ * The step's `expect.net` named a request that was still ON THE WIRE when the budget ended.
144
+ *
145
+ * A blind spot, not a failed assertion. Reported as SIGNAL_NOT_OBSERVED it reads as "the request
146
+ * you declared never happened", which sends a reader hunting a feature that works — the live
147
+ * verdict path already refuses to grade a named in-flight request as a miss, and replay was the
148
+ * one reader that had not asked the question. The fix for this drift is a longer budget or a
149
+ * faster endpoint; the fix for SIGNAL_NOT_OBSERVED is the handler behind the action.
150
+ */
151
+ readonly NET_STILL_IN_FLIGHT: "net_still_in_flight";
142
152
  };
143
153
  export type DriftReason = (typeof DriftReason)[keyof typeof DriftReason];
144
154
  /**
@@ -133,6 +133,16 @@ export const DriftReason = {
133
133
  * step whose anchor was fine.
134
134
  */
135
135
  EXPECT_ELEMENT_NOT_FOUND: 'expect_element_not_found',
136
+ /**
137
+ * The step's `expect.net` named a request that was still ON THE WIRE when the budget ended.
138
+ *
139
+ * A blind spot, not a failed assertion. Reported as SIGNAL_NOT_OBSERVED it reads as "the request
140
+ * you declared never happened", which sends a reader hunting a feature that works — the live
141
+ * verdict path already refuses to grade a named in-flight request as a miss, and replay was the
142
+ * one reader that had not asked the question. The fix for this drift is a longer budget or a
143
+ * faster endpoint; the fix for SIGNAL_NOT_OBSERVED is the handler behind the action.
144
+ */
145
+ NET_STILL_IN_FLIGHT: 'net_still_in_flight',
136
146
  };
137
147
  /**
138
148
  * Did the step's anchor resolve and its action RUN, leaving only the declared consequence unmet?
@@ -150,7 +160,10 @@ export const DriftReason = {
150
160
  export function isConsequenceDrift(reason) {
151
161
  return (DriftReason.SIGNAL_NOT_OBSERVED === reason ||
152
162
  DriftReason.STATE_MISMATCH === reason ||
153
- DriftReason.EXPECT_ELEMENT_NOT_FOUND === reason);
163
+ DriftReason.EXPECT_ELEMENT_NOT_FOUND === reason ||
164
+ // Same class: the anchor resolved, the action ran, and the page is where the step left it. Only
165
+ // the answer is missing. Excluding it would halt a sweep on a slow endpoint.
166
+ DriftReason.NET_STILL_IN_FLIGHT === reason);
154
167
  }
155
168
  /** Default timeout (ms) a signal anchor waits to be observed at replay. */
156
169
  export const FLOW_SIGNAL_TIMEOUT_MS = 4000;
@@ -1708,8 +1708,8 @@ export declare const FlowFileSchema: z.ZodObject<{
1708
1708
  steps: FlowStep[];
1709
1709
  version: 1;
1710
1710
  createdAt: number;
1711
- status?: "active" | "quarantined" | "draft" | undefined;
1712
1711
  intent?: string | undefined;
1712
+ status?: "active" | "quarantined" | "draft" | undefined;
1713
1713
  intentId?: string | undefined;
1714
1714
  projectId?: string | undefined;
1715
1715
  startPath?: string | undefined;
@@ -1873,8 +1873,8 @@ export declare const FlowFileSchema: z.ZodObject<{
1873
1873
  steps: FlowStep[];
1874
1874
  version: 1;
1875
1875
  createdAt: number;
1876
- status?: "active" | "quarantined" | "draft" | undefined;
1877
1876
  intent?: string | undefined;
1877
+ status?: "active" | "quarantined" | "draft" | undefined;
1878
1878
  intentId?: string | undefined;
1879
1879
  projectId?: string | undefined;
1880
1880
  startPath?: string | undefined;
@@ -2987,8 +2987,8 @@ export declare const RecordedFlowSchema: z.ZodObject<{
2987
2987
  steps: FlowStep[];
2988
2988
  version: 1;
2989
2989
  createdAt: number;
2990
- status?: "active" | "quarantined" | "draft" | undefined;
2991
2990
  intent?: string | undefined;
2991
+ status?: "active" | "quarantined" | "draft" | undefined;
2992
2992
  intentId?: string | undefined;
2993
2993
  projectId?: string | undefined;
2994
2994
  startPath?: string | undefined;
@@ -3152,8 +3152,8 @@ export declare const RecordedFlowSchema: z.ZodObject<{
3152
3152
  steps: FlowStep[];
3153
3153
  version: 1;
3154
3154
  createdAt: number;
3155
- status?: "active" | "quarantined" | "draft" | undefined;
3156
3155
  intent?: string | undefined;
3156
+ status?: "active" | "quarantined" | "draft" | undefined;
3157
3157
  intentId?: string | undefined;
3158
3158
  projectId?: string | undefined;
3159
3159
  startPath?: string | undefined;
@@ -3319,8 +3319,8 @@ export declare const RecordedFlowSchema: z.ZodObject<{
3319
3319
  steps: FlowStep[];
3320
3320
  version: 1;
3321
3321
  createdAt: number;
3322
- status?: "active" | "quarantined" | "draft" | undefined;
3323
3322
  intent?: string | undefined;
3323
+ status?: "active" | "quarantined" | "draft" | undefined;
3324
3324
  intentId?: string | undefined;
3325
3325
  projectId?: string | undefined;
3326
3326
  startPath?: string | undefined;
@@ -3487,8 +3487,8 @@ export declare const RecordedFlowSchema: z.ZodObject<{
3487
3487
  steps: FlowStep[];
3488
3488
  version: 1;
3489
3489
  createdAt: number;
3490
- status?: "active" | "quarantined" | "draft" | undefined;
3491
3490
  intent?: string | undefined;
3491
+ status?: "active" | "quarantined" | "draft" | undefined;
3492
3492
  intentId?: string | undefined;
3493
3493
  projectId?: string | undefined;
3494
3494
  startPath?: string | undefined;
@@ -620,6 +620,71 @@ export declare const AccountStateSchema: z.ZodObject<{
620
620
  host?: string | undefined;
621
621
  }>;
622
622
  export type AccountState = z.infer<typeof AccountStateSchema>;
623
+ /**
624
+ * The standing offer on the autonomous harness, as the daemon last heard it from the platform.
625
+ *
626
+ * `claimed` is the only field that decides whether anything is shown, and ABSENCE of this whole
627
+ * object means "we do not know" — never "not claimed". That distinction is the difference between
628
+ * an offer and a nag: a machine that is offline, unlinked, or paired with an older daemon has not
629
+ * told us the person still needs this, and advertising at them anyway is how a dev-only HUD gets
630
+ * switched off for good. The account field beside this one already carries that warning; it applies
631
+ * here with more force, because this one is marketing.
632
+ */
633
+ export declare const HarnessOfferSchema: z.ZodObject<{
634
+ /** True once this org has claimed. A claimed offer is shown as remaining time, never as a pitch. */
635
+ claimed: z.ZodBoolean;
636
+ /** When the free period ends, epoch ms. Absent when nothing has been claimed. */
637
+ expiresAt: z.ZodOptional<z.ZodNumber>;
638
+ /** Whole days left, already computed — the HUD has no clock worth trusting for this. */
639
+ daysRemaining: z.ZodOptional<z.ZodNumber>;
640
+ /** Where claiming happens. Absent ⇒ the HUD shows nothing, because a pitch with no door is noise. */
641
+ claimUrl: z.ZodOptional<z.ZodString>;
642
+ /**
643
+ * Whether claiming would still grant anything.
644
+ *
645
+ * Carried separately because `claimed` is "running RIGHT NOW", and an expired free period reads
646
+ * `claimed: false` — the same as never having taken it. Without this the HUD would advertise a
647
+ * three-month offer to the one group of people who can never accept it again, which is worse than
648
+ * saying nothing at all. Absent ⇒ treated as still offerable: an older platform that does not
649
+ * report it also has no expiries to get wrong.
650
+ */
651
+ eligible: z.ZodOptional<z.ZodBoolean>;
652
+ }, "strip", z.ZodTypeAny, {
653
+ claimed: boolean;
654
+ expiresAt?: number | undefined;
655
+ daysRemaining?: number | undefined;
656
+ claimUrl?: string | undefined;
657
+ eligible?: boolean | undefined;
658
+ }, {
659
+ claimed: boolean;
660
+ expiresAt?: number | undefined;
661
+ daysRemaining?: number | undefined;
662
+ claimUrl?: string | undefined;
663
+ eligible?: boolean | undefined;
664
+ }>;
665
+ export type HarnessOffer = z.infer<typeof HarnessOfferSchema>;
666
+ /**
667
+ * What the platform says about autonomous driving for this project.
668
+ *
669
+ * Mirrors `PlatformModelConfig` on the server side; both are the same wire answer read by different
670
+ * layers. Kept here because it crosses daemon -> browser, which is what makes it a wire type.
671
+ */
672
+ export declare const HarnessConfigSchema: z.ZodObject<{
673
+ provider: z.ZodString;
674
+ /** The switch somebody set. The platform's default is on. */
675
+ harnessEnabled: z.ZodBoolean;
676
+ /** Whether this workspace may drive on OUR model spend. Never folded into the switch. */
677
+ harnessEntitled: z.ZodBoolean;
678
+ }, "strip", z.ZodTypeAny, {
679
+ provider: string;
680
+ harnessEnabled: boolean;
681
+ harnessEntitled: boolean;
682
+ }, {
683
+ provider: string;
684
+ harnessEnabled: boolean;
685
+ harnessEntitled: boolean;
686
+ }>;
687
+ export type HarnessConfig = z.infer<typeof HarnessConfigSchema>;
623
688
  export declare const ImpactSnapshotSchema: z.ZodObject<{
624
689
  schemaVersion: z.ZodNumber;
625
690
  project: z.ZodObject<{
@@ -1287,6 +1352,69 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
1287
1352
  org?: string | undefined;
1288
1353
  host?: string | undefined;
1289
1354
  }>>;
1355
+ /**
1356
+ * The harness offer, when the daemon knows it. Absent is "unknown" and shows nothing — see
1357
+ * `HarnessOfferSchema` for why that asymmetry is deliberate.
1358
+ */
1359
+ harnessOffer: z.ZodOptional<z.ZodObject<{
1360
+ /** True once this org has claimed. A claimed offer is shown as remaining time, never as a pitch. */
1361
+ claimed: z.ZodBoolean;
1362
+ /** When the free period ends, epoch ms. Absent when nothing has been claimed. */
1363
+ expiresAt: z.ZodOptional<z.ZodNumber>;
1364
+ /** Whole days left, already computed — the HUD has no clock worth trusting for this. */
1365
+ daysRemaining: z.ZodOptional<z.ZodNumber>;
1366
+ /** Where claiming happens. Absent ⇒ the HUD shows nothing, because a pitch with no door is noise. */
1367
+ claimUrl: z.ZodOptional<z.ZodString>;
1368
+ /**
1369
+ * Whether claiming would still grant anything.
1370
+ *
1371
+ * Carried separately because `claimed` is "running RIGHT NOW", and an expired free period reads
1372
+ * `claimed: false` — the same as never having taken it. Without this the HUD would advertise a
1373
+ * three-month offer to the one group of people who can never accept it again, which is worse than
1374
+ * saying nothing at all. Absent ⇒ treated as still offerable: an older platform that does not
1375
+ * report it also has no expiries to get wrong.
1376
+ */
1377
+ eligible: z.ZodOptional<z.ZodBoolean>;
1378
+ }, "strip", z.ZodTypeAny, {
1379
+ claimed: boolean;
1380
+ expiresAt?: number | undefined;
1381
+ daysRemaining?: number | undefined;
1382
+ claimUrl?: string | undefined;
1383
+ eligible?: boolean | undefined;
1384
+ }, {
1385
+ claimed: boolean;
1386
+ expiresAt?: number | undefined;
1387
+ daysRemaining?: number | undefined;
1388
+ claimUrl?: string | undefined;
1389
+ eligible?: boolean | undefined;
1390
+ }>>;
1391
+ /**
1392
+ * The harness switch and whether this workspace may drive on our spend.
1393
+ *
1394
+ * Two fields, never one, and the HUD renders them differently: `harnessEnabled` is a switch the
1395
+ * person owns, `harnessEntitled` is a fact about their account. A panel that collapsed them would
1396
+ * show "off" to somebody whose free months lapsed and invite them to turn on something they no
1397
+ * longer have.
1398
+ *
1399
+ * Absent means the daemon has not heard -- an offline machine, an unlinked project, an older
1400
+ * platform -- and the panel shows no control at all rather than guessing. Showing a switch that
1401
+ * cannot be honoured is worse than showing none.
1402
+ */
1403
+ harnessConfig: z.ZodOptional<z.ZodObject<{
1404
+ provider: z.ZodString;
1405
+ /** The switch somebody set. The platform's default is on. */
1406
+ harnessEnabled: z.ZodBoolean;
1407
+ /** Whether this workspace may drive on OUR model spend. Never folded into the switch. */
1408
+ harnessEntitled: z.ZodBoolean;
1409
+ }, "strip", z.ZodTypeAny, {
1410
+ provider: string;
1411
+ harnessEnabled: boolean;
1412
+ harnessEntitled: boolean;
1413
+ }, {
1414
+ provider: string;
1415
+ harnessEnabled: boolean;
1416
+ harnessEntitled: boolean;
1417
+ }>>;
1290
1418
  }, "strip", z.ZodTypeAny, {
1291
1419
  project: {
1292
1420
  since: number;
@@ -1403,6 +1531,18 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
1403
1531
  org?: string | undefined;
1404
1532
  host?: string | undefined;
1405
1533
  } | undefined;
1534
+ harnessOffer?: {
1535
+ claimed: boolean;
1536
+ expiresAt?: number | undefined;
1537
+ daysRemaining?: number | undefined;
1538
+ claimUrl?: string | undefined;
1539
+ eligible?: boolean | undefined;
1540
+ } | undefined;
1541
+ harnessConfig?: {
1542
+ provider: string;
1543
+ harnessEnabled: boolean;
1544
+ harnessEntitled: boolean;
1545
+ } | undefined;
1406
1546
  }, {
1407
1547
  project: {
1408
1548
  since: number;
@@ -1519,6 +1659,18 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
1519
1659
  org?: string | undefined;
1520
1660
  host?: string | undefined;
1521
1661
  } | undefined;
1662
+ harnessOffer?: {
1663
+ claimed: boolean;
1664
+ expiresAt?: number | undefined;
1665
+ daysRemaining?: number | undefined;
1666
+ claimUrl?: string | undefined;
1667
+ eligible?: boolean | undefined;
1668
+ } | undefined;
1669
+ harnessConfig?: {
1670
+ provider: string;
1671
+ harnessEnabled: boolean;
1672
+ harnessEntitled: boolean;
1673
+ } | undefined;
1522
1674
  }>;
1523
1675
  export type ImpactSnapshot = z.infer<typeof ImpactSnapshotSchema>;
1524
1676
  /** Empty counters - the starting point for a fresh store and the identity for merges. */
@@ -140,6 +140,49 @@ export const AccountStateSchema = z.object({
140
140
  email: z.string().optional(),
141
141
  host: z.string().optional(),
142
142
  });
143
+ /**
144
+ * The standing offer on the autonomous harness, as the daemon last heard it from the platform.
145
+ *
146
+ * `claimed` is the only field that decides whether anything is shown, and ABSENCE of this whole
147
+ * object means "we do not know" — never "not claimed". That distinction is the difference between
148
+ * an offer and a nag: a machine that is offline, unlinked, or paired with an older daemon has not
149
+ * told us the person still needs this, and advertising at them anyway is how a dev-only HUD gets
150
+ * switched off for good. The account field beside this one already carries that warning; it applies
151
+ * here with more force, because this one is marketing.
152
+ */
153
+ export const HarnessOfferSchema = z.object({
154
+ /** True once this org has claimed. A claimed offer is shown as remaining time, never as a pitch. */
155
+ claimed: z.boolean(),
156
+ /** When the free period ends, epoch ms. Absent when nothing has been claimed. */
157
+ expiresAt: z.number().optional(),
158
+ /** Whole days left, already computed — the HUD has no clock worth trusting for this. */
159
+ daysRemaining: z.number().optional(),
160
+ /** Where claiming happens. Absent ⇒ the HUD shows nothing, because a pitch with no door is noise. */
161
+ claimUrl: z.string().optional(),
162
+ /**
163
+ * Whether claiming would still grant anything.
164
+ *
165
+ * Carried separately because `claimed` is "running RIGHT NOW", and an expired free period reads
166
+ * `claimed: false` — the same as never having taken it. Without this the HUD would advertise a
167
+ * three-month offer to the one group of people who can never accept it again, which is worse than
168
+ * saying nothing at all. Absent ⇒ treated as still offerable: an older platform that does not
169
+ * report it also has no expiries to get wrong.
170
+ */
171
+ eligible: z.boolean().optional(),
172
+ });
173
+ /**
174
+ * What the platform says about autonomous driving for this project.
175
+ *
176
+ * Mirrors `PlatformModelConfig` on the server side; both are the same wire answer read by different
177
+ * layers. Kept here because it crosses daemon -> browser, which is what makes it a wire type.
178
+ */
179
+ export const HarnessConfigSchema = z.object({
180
+ provider: z.string(),
181
+ /** The switch somebody set. The platform's default is on. */
182
+ harnessEnabled: z.boolean(),
183
+ /** Whether this workspace may drive on OUR model spend. Never folded into the switch. */
184
+ harnessEntitled: z.boolean(),
185
+ });
143
186
  export const ImpactSnapshotSchema = z.object({
144
187
  schemaVersion: z.number().int().positive(),
145
188
  project: ImpactScopeSchema,
@@ -158,6 +201,24 @@ export const ImpactSnapshotSchema = z.object({
158
201
  * kind of nag that gets a dev-only HUD switched off for good.
159
202
  */
160
203
  account: AccountStateSchema.optional(),
204
+ /**
205
+ * The harness offer, when the daemon knows it. Absent is "unknown" and shows nothing — see
206
+ * `HarnessOfferSchema` for why that asymmetry is deliberate.
207
+ */
208
+ harnessOffer: HarnessOfferSchema.optional(),
209
+ /**
210
+ * The harness switch and whether this workspace may drive on our spend.
211
+ *
212
+ * Two fields, never one, and the HUD renders them differently: `harnessEnabled` is a switch the
213
+ * person owns, `harnessEntitled` is a fact about their account. A panel that collapsed them would
214
+ * show "off" to somebody whose free months lapsed and invite them to turn on something they no
215
+ * longer have.
216
+ *
217
+ * Absent means the daemon has not heard -- an offline machine, an unlinked project, an older
218
+ * platform -- and the panel shows no control at all rather than guessing. Showing a switch that
219
+ * cannot be honoured is worse than showing none.
220
+ */
221
+ harnessConfig: HarnessConfigSchema.optional(),
161
222
  });
162
223
  /** Empty counters - the starting point for a fresh store and the identity for merges. */
163
224
  export function emptyImpactCounts() {
@@ -87,6 +87,58 @@ export declare const JournalActionSchema: z.ZodObject<{
87
87
  } | undefined;
88
88
  }>;
89
89
  export type JournalAction = z.infer<typeof JournalActionSchema>;
90
+ /**
91
+ * The report written beside `events.jsonl` when its byte ceiling refuses a batch.
92
+ *
93
+ * The event ledger is bounded on disk, and a bound means a ledger can be INCOMPLETE. The refusal is
94
+ * declared twice on purpose, because neither declaration can do the other's job:
95
+ *
96
+ * - IN-BAND, as one `TRUNCATED` record on the event stream, so every existing reader sees it with
97
+ * no new field and no new allowlist.
98
+ * - OUT-OF-BAND, as this file, because the in-band record carries a `t` and every journal-backed
99
+ * query filters on `t`. A window opened after the ceiling was hit contains no marker and no
100
+ * events, which is exactly a complete window in which nothing happened.
101
+ *
102
+ * Every field but `v` and `channel` is OPTIONAL, and that is a rule rather than a convenience: the
103
+ * file's PRESENCE is the durable fact ("this ledger was closed"), while its contents are a detail
104
+ * that a truncated or corrupted write can lose. A reader that cannot parse the details reports them
105
+ * absent. It must never fill them in from what is true NOW — the current ceiling is not necessarily
106
+ * the ceiling that closed the ledger — and it must never read an unparseable file as an open one.
107
+ */
108
+ export declare const JournalWriteLossSchema: z.ZodObject<{
109
+ v: z.ZodLiteral<1>;
110
+ /** Which channel lost data — the same vocabulary the in-band `TRUNCATED` record names. */
111
+ channel: z.ZodLiteral<"journal">;
112
+ /** The ceiling that refused the write, in bytes. */
113
+ capBytes: z.ZodOptional<z.ZodNumber>;
114
+ /** Bytes already in the ledger when it was closed. */
115
+ bytesOnDisk: z.ZodOptional<z.ZodNumber>;
116
+ /**
117
+ * Events in the ONE batch that was refused — never a running total of everything dropped after.
118
+ *
119
+ * An append-only file cannot revise a line it has already written, and re-emitting a fresh count
120
+ * per refusal would recreate the growth this bound exists to stop. The load-bearing fact is that
121
+ * the ledger closed; the count says how much was in the batch that closed it, and nothing more.
122
+ */
123
+ droppedInBatch: z.ZodOptional<z.ZodNumber>;
124
+ /** Elapsed-ms stamp of the last record in the first refused batch; not a loss-window boundary. */
125
+ at: z.ZodOptional<z.ZodNumber>;
126
+ }, "strip", z.ZodTypeAny, {
127
+ channel: "journal";
128
+ v: 1;
129
+ at?: number | undefined;
130
+ capBytes?: number | undefined;
131
+ bytesOnDisk?: number | undefined;
132
+ droppedInBatch?: number | undefined;
133
+ }, {
134
+ channel: "journal";
135
+ v: 1;
136
+ at?: number | undefined;
137
+ capBytes?: number | undefined;
138
+ bytesOnDisk?: number | undefined;
139
+ droppedInBatch?: number | undefined;
140
+ }>;
141
+ export type JournalWriteLoss = z.infer<typeof JournalWriteLossSchema>;
90
142
  /**
91
143
  * The bounded verdict summary a verification tool writes into a journal action's `effect`.
92
144
  *
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { TRANSPORT_LIMITS } from '../wire/constants/constants.js';
2
+ import { TRANSPORT_LIMITS, TruncationChannel } from '../wire/constants/constants.js';
3
3
  import { Verified } from '../verdict/verified-constants.js';
4
4
  /**
5
5
  * The durable causal journal. Each session gets an append-only pair on disk:
@@ -36,6 +36,43 @@ export const JournalActionSchema = z.object({
36
36
  /** Elapsed-ms timestamp the action was recorded at (clock injected by the writer). */
37
37
  at: z.number().int().min(0),
38
38
  });
39
+ /**
40
+ * The report written beside `events.jsonl` when its byte ceiling refuses a batch.
41
+ *
42
+ * The event ledger is bounded on disk, and a bound means a ledger can be INCOMPLETE. The refusal is
43
+ * declared twice on purpose, because neither declaration can do the other's job:
44
+ *
45
+ * - IN-BAND, as one `TRUNCATED` record on the event stream, so every existing reader sees it with
46
+ * no new field and no new allowlist.
47
+ * - OUT-OF-BAND, as this file, because the in-band record carries a `t` and every journal-backed
48
+ * query filters on `t`. A window opened after the ceiling was hit contains no marker and no
49
+ * events, which is exactly a complete window in which nothing happened.
50
+ *
51
+ * Every field but `v` and `channel` is OPTIONAL, and that is a rule rather than a convenience: the
52
+ * file's PRESENCE is the durable fact ("this ledger was closed"), while its contents are a detail
53
+ * that a truncated or corrupted write can lose. A reader that cannot parse the details reports them
54
+ * absent. It must never fill them in from what is true NOW — the current ceiling is not necessarily
55
+ * the ceiling that closed the ledger — and it must never read an unparseable file as an open one.
56
+ */
57
+ export const JournalWriteLossSchema = z.object({
58
+ v: z.literal(JOURNAL_FILE_VERSION),
59
+ /** Which channel lost data — the same vocabulary the in-band `TRUNCATED` record names. */
60
+ channel: z.literal(TruncationChannel.JOURNAL),
61
+ /** The ceiling that refused the write, in bytes. */
62
+ capBytes: z.number().int().min(1).optional(),
63
+ /** Bytes already in the ledger when it was closed. */
64
+ bytesOnDisk: z.number().int().min(0).optional(),
65
+ /**
66
+ * Events in the ONE batch that was refused — never a running total of everything dropped after.
67
+ *
68
+ * An append-only file cannot revise a line it has already written, and re-emitting a fresh count
69
+ * per refusal would recreate the growth this bound exists to stop. The load-bearing fact is that
70
+ * the ledger closed; the count says how much was in the batch that closed it, and nothing more.
71
+ */
72
+ droppedInBatch: z.number().int().min(0).optional(),
73
+ /** Elapsed-ms stamp of the last record in the first refused batch; not a loss-window boundary. */
74
+ at: z.number().optional(),
75
+ });
39
76
  /**
40
77
  * The bounded verdict summary a verification tool writes into a journal action's `effect`.
41
78
  *
@@ -53,4 +53,50 @@ export declare const asRef: (value: string) => Ref;
53
53
  export declare const asFlowName: (value: string) => FlowName;
54
54
  /** Mint a SessionId — call ONLY behind isValidSessionId, or on a literal in a test. */
55
55
  export declare const asSessionId: (value: string) => SessionId;
56
+ /**
57
+ * The stable build-stamped identity of an APP (`acme-web-9f3c1d`) — the one path identifier that
58
+ * had no brand.
59
+ *
60
+ * The incident shape: `sessionRoot(deps, sessionId)` and `rootForProjectId(deps, projectId)` sit
61
+ * two lines apart with the SAME signature (`(ToolDeps, string | undefined) => string`), so swapping
62
+ * the arguments compiles. Neither then throws. `sessionRoot` given a projectId asks the session
63
+ * manager for a session by that name, gets a throw, catches it and answers the daemon root;
64
+ * `rootForProjectId` given a sessionId matches no candidate, resolves `NO_MATCH` and answers the
65
+ * daemon root. No error, no log — artifacts land in a directory belonging to whichever tree the
66
+ * daemon was launched in, and the tool reports success. That is the same silent-wrong-root family
67
+ * `artifact-root-resolver` was written to end, arriving through the type system instead of the
68
+ * filesystem.
69
+ *
70
+ * ASYMMETRY — read this before trusting it. Branding `ProjectId` alone closes ONE direction:
71
+ *
72
+ * - CAUGHT: a plain-`string` sessionId passed where a `ProjectId` is expected. `string` is not
73
+ * assignable to `ProjectId`, so `rootForProjectId(deps, sessionId)` is a compile error. This is
74
+ * the dangerous direction, because it is the one that silently writes to the wrong project.
75
+ * - NOT CAUGHT: a `ProjectId` passed where a `sessionId` is expected. `ProjectId` IS assignable to
76
+ * `string`, so `sessionRoot(deps, projectId)` still compiles. It fails safe-ish — the lookup
77
+ * throws, is caught, and the caller gets the daemon root — but it is not a compile error.
78
+ *
79
+ * The line is drawn there because closing the second direction means branding `sessionId` at every
80
+ * tool-call boundary where it arrives as a raw `unknown` argument off the wire, which is a much
81
+ * larger change than this one. Stating it is the point: a half-closed door that claims to be shut
82
+ * is worse than one labelled honestly.
83
+ *
84
+ * Minted at PROVENANCE, not at validation, and that distinction is load-bearing here. A project id
85
+ * and a session id are both single safe path segments, so `SAFE_SEGMENT_PATTERN` cannot tell them
86
+ * apart — minting on that guard would LAUNDER a mistyped sessionId into a `ProjectId` and hand back
87
+ * exactly the confidence this brand exists to withhold. The mints are the places a value is known to
88
+ * be a project's id because of WHERE IT CAME FROM: the page's HELLO `projectId` field, the
89
+ * `projectId` key of a project's own `.reticle.json`, and the names of the subdirectories under
90
+ * `.reticle/flows/`, which the flow store is the only writer of and writes from an already-branded
91
+ * id. `safeProjectId` stays a FILTER over an already-branded value — it decides whether an id is
92
+ * safe on disk, never whether it is a project.
93
+ */
94
+ export type ProjectId = Brand<string, 'ProjectId'>;
95
+ /**
96
+ * Mint a ProjectId — call ONLY where the value's PROVENANCE says it is a project's id: the HELLO
97
+ * message's `projectId` field, `.reticle.json`'s `projectId` key, a directory Reticle itself named
98
+ * after one, or a literal in a test. Never on a string that merely passed a path-segment guard; see
99
+ * the asymmetry note above.
100
+ */
101
+ export declare const asProjectId: (value: string) => ProjectId;
56
102
  export {};
@@ -18,3 +18,10 @@ export const asRef = (value) => value;
18
18
  export const asFlowName = (value) => value;
19
19
  /** Mint a SessionId — call ONLY behind isValidSessionId, or on a literal in a test. */
20
20
  export const asSessionId = (value) => value;
21
+ /**
22
+ * Mint a ProjectId — call ONLY where the value's PROVENANCE says it is a project's id: the HELLO
23
+ * message's `projectId` field, `.reticle.json`'s `projectId` key, a directory Reticle itself named
24
+ * after one, or a literal in a test. Never on a string that merely passed a path-segment guard; see
25
+ * the asymmetry note above.
26
+ */
27
+ export const asProjectId = (value) => value;
package/dist/index.d.ts CHANGED
@@ -66,6 +66,7 @@ export * from './words/no-session-reason.js';
66
66
  export * from './telemetry-refusal.js';
67
67
  export * from './wire/narrow.js';
68
68
  export * from './wire/tool-names.js';
69
+ export * from './wire/snapshot-tree.js';
69
70
  export * from './wire/platform.js';
70
71
  export * from './wire/channel.js';
71
72
  export * from './verdict/revision.js';
package/dist/index.js CHANGED
@@ -42,7 +42,7 @@ export * from './artifacts/step-effect.js'; // StepEffect: a leaf, so the page n
42
42
  export * from './artifacts/flow-composition.js'; // canFollow: may B replay straight after A
43
43
  export * from './verdict/verification-run.js'; // run/verdict shapes for the CI surface
44
44
  export * from './wire/types.js';
45
- export * from './identity/brand.js'; // RunId / SessionId / Ref brands + validators
45
+ export * from './identity/brand.js'; // RunId / SessionId / ProjectId / Ref brands + validators
46
46
  export * from './wire/net.js'; // NetInitiator / ipc:// scheme — network + desktop-IPC call vocabulary
47
47
  export * from './verdict/findings.js'; // crawl anomalies + cross-channel contradictions
48
48
  export * from './wire/desktop-contract.js'; // the Electron preload/main/renderer/daemon string contract
@@ -70,6 +70,7 @@ export * from './words/no-session-reason.js';
70
70
  export * from './telemetry-refusal.js';
71
71
  export * from './wire/narrow.js';
72
72
  export * from './wire/tool-names.js';
73
+ export * from './wire/snapshot-tree.js'; // parseInteractive — the browser writes this format, Node reads it
73
74
  export * from './wire/platform.js';
74
75
  export * from './wire/channel.js';
75
76
  export * from './verdict/revision.js';
@@ -91,6 +91,9 @@
91
91
  },
92
92
  "urlRaw": {
93
93
  "type": "string"
94
+ },
95
+ "requestShape": {
96
+ "type": "string"
94
97
  }
95
98
  },
96
99
  "required": [
@@ -718,7 +721,8 @@
718
721
  "end",
719
722
  "message",
720
723
  "replay",
721
- "sync"
724
+ "sync",
725
+ "harness"
722
726
  ]
723
727
  },
724
728
  "text": {