@reticlehq/core 3.1.0 → 3.3.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.
Files changed (82) hide show
  1. package/dist/artifacts/flow-composition.d.ts +3 -2
  2. package/dist/artifacts/flow-constants.d.ts +59 -2
  3. package/dist/artifacts/flow-constants.js +63 -3
  4. package/dist/artifacts/flow-expect-flat.d.ts +260 -0
  5. package/dist/artifacts/flow-expect-flat.js +284 -0
  6. package/dist/artifacts/flow-mutation-target.d.ts +0 -1
  7. package/dist/artifacts/flow-mutation-target.js +26 -2
  8. package/dist/artifacts/flow-step-tool.d.ts +2 -0
  9. package/dist/artifacts/flow-types.d.ts +1071 -1225
  10. package/dist/artifacts/flow-types.js +96 -140
  11. package/dist/artifacts/impact.d.ts +200 -20
  12. package/dist/artifacts/impact.js +72 -0
  13. package/dist/artifacts/journal.d.ts +85 -6
  14. package/dist/artifacts/journal.js +51 -1
  15. package/dist/hooks/hook-events.d.ts +18 -18
  16. package/dist/hud-entry.d.ts +9 -0
  17. package/dist/hud-entry.js +9 -0
  18. package/dist/identity/brand.d.ts +46 -0
  19. package/dist/identity/brand.js +7 -0
  20. package/dist/identity/source-constants.d.ts +11 -0
  21. package/dist/identity/source-constants.js +11 -0
  22. package/dist/index.d.ts +9 -0
  23. package/dist/index.js +26 -2
  24. package/dist/onboarding.d.ts +2 -2
  25. package/dist/realm/registry.d.ts +0 -8
  26. package/dist/realm/registry.js +1 -11
  27. package/dist/schema/event-message.json +3 -1
  28. package/dist/schema/event-payloads.json +74 -1
  29. package/dist/schema/event-type.json +3 -1
  30. package/dist/schema/reticle-event.json +3 -1
  31. package/dist/schema/reticle-message.json +3 -1
  32. package/dist/source-constants.cjs +1 -0
  33. package/dist/source-constants.d.cts +1 -0
  34. package/dist/telemetry-feedback.d.ts +6 -6
  35. package/dist/telemetry-refusal.d.ts +2 -2
  36. package/dist/telemetry-session.d.ts +25 -2
  37. package/dist/telemetry-session.js +13 -0
  38. package/dist/telemetry.d.ts +184 -102
  39. package/dist/telemetry.js +29 -1
  40. package/dist/verdict/consequence.d.ts +10 -0
  41. package/dist/verdict/consequence.js +13 -0
  42. package/dist/verdict/intent.d.ts +36 -12
  43. package/dist/verdict/intent.js +66 -10
  44. package/dist/verdict/predicate-tree.d.ts +47 -0
  45. package/dist/verdict/predicate-tree.js +146 -0
  46. package/dist/verdict/predicate.d.ts +129 -0
  47. package/dist/verdict/predicate.js +394 -0
  48. package/dist/verdict/property-assertion.d.ts +191 -0
  49. package/dist/verdict/property-assertion.js +42 -0
  50. package/dist/verdict/security.js +16 -4
  51. package/dist/verdict/verdict-attribution.d.ts +52 -0
  52. package/dist/verdict/verdict-attribution.js +87 -0
  53. package/dist/verdict/verification-run.d.ts +98 -84
  54. package/dist/verdict/verification-run.js +8 -1
  55. package/dist/verdict/verified-constants.d.ts +18 -0
  56. package/dist/verdict/verified-constants.js +18 -0
  57. package/dist/wire/constants/constants.d.ts +108 -98
  58. package/dist/wire/constants/constants.js +116 -97
  59. package/dist/wire/constants/discovery.d.ts +25 -0
  60. package/dist/wire/constants/discovery.js +25 -0
  61. package/dist/wire/constants/event-types.d.ts +122 -0
  62. package/dist/wire/constants/event-types.js +121 -0
  63. package/dist/wire/constants/hud-controls.d.ts +19 -0
  64. package/dist/wire/constants/hud-controls.js +95 -0
  65. package/dist/wire/constants/hud-use.d.ts +27 -0
  66. package/dist/wire/constants/hud-use.js +24 -0
  67. package/dist/wire/constants/session-constants.d.ts +24 -0
  68. package/dist/wire/constants/session-constants.js +24 -0
  69. package/dist/wire/event-payloads.d.ts +70 -10
  70. package/dist/wire/event-payloads.js +20 -1
  71. package/dist/wire/messages.d.ts +90 -48
  72. package/dist/wire/messages.js +17 -0
  73. package/dist/wire/net.d.ts +42 -0
  74. package/dist/wire/net.js +48 -0
  75. package/dist/wire/snapshot-tree.d.ts +33 -0
  76. package/dist/wire/snapshot-tree.js +43 -0
  77. package/dist/wire/state-select.d.ts +2 -1
  78. package/dist/wire/state-select.js +56 -3
  79. package/dist/wire/toon.js +28 -7
  80. package/dist/wire/types.d.ts +91 -66
  81. package/dist/wire/types.js +23 -1
  82. package/package.json +5 -1
@@ -140,6 +140,60 @@ 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 a drive could actually run if the offer were taken.
164
+ *
165
+ * Entitlement is not readiness. A workspace can be fully entitled against a deployment that holds
166
+ * no key for its provider, and then every signal reads healthy while a drive cannot start —
167
+ * including the card, which would sell three free months of something unusable and burn the one
168
+ * claim the person gets. Absent means "not told", which is treated as drivable for the same
169
+ * reason `claimed` is required and the rest are not: silence from an older platform must not
170
+ * switch the feature off.
171
+ */
172
+ drivable: z.boolean().optional(),
173
+ /**
174
+ * Whether claiming would still grant anything.
175
+ *
176
+ * Carried separately because `claimed` is "running RIGHT NOW", and an expired free period reads
177
+ * `claimed: false` — the same as never having taken it. Without this the HUD would advertise a
178
+ * three-month offer to the one group of people who can never accept it again, which is worse than
179
+ * saying nothing at all. Absent ⇒ treated as still offerable: an older platform that does not
180
+ * report it also has no expiries to get wrong.
181
+ */
182
+ eligible: z.boolean().optional(),
183
+ });
184
+ /**
185
+ * What the platform says about autonomous driving for this project.
186
+ *
187
+ * Mirrors `PlatformModelConfig` on the server side; both are the same wire answer read by different
188
+ * layers. Kept here because it crosses daemon -> browser, which is what makes it a wire type.
189
+ */
190
+ export const HarnessConfigSchema = z.object({
191
+ provider: z.string(),
192
+ /** The switch somebody set. The platform's default is on. */
193
+ harnessEnabled: z.boolean(),
194
+ /** Whether this workspace may drive on OUR model spend. Never folded into the switch. */
195
+ harnessEntitled: z.boolean(),
196
+ });
143
197
  export const ImpactSnapshotSchema = z.object({
144
198
  schemaVersion: z.number().int().positive(),
145
199
  project: ImpactScopeSchema,
@@ -158,6 +212,24 @@ export const ImpactSnapshotSchema = z.object({
158
212
  * kind of nag that gets a dev-only HUD switched off for good.
159
213
  */
160
214
  account: AccountStateSchema.optional(),
215
+ /**
216
+ * The harness offer, when the daemon knows it. Absent is "unknown" and shows nothing — see
217
+ * `HarnessOfferSchema` for why that asymmetry is deliberate.
218
+ */
219
+ harnessOffer: HarnessOfferSchema.optional(),
220
+ /**
221
+ * The harness switch and whether this workspace may drive on our spend.
222
+ *
223
+ * Two fields, never one, and the HUD renders them differently: `harnessEnabled` is a switch the
224
+ * person owns, `harnessEntitled` is a fact about their account. A panel that collapsed them would
225
+ * show "off" to somebody whose free months lapsed and invite them to turn on something they no
226
+ * longer have.
227
+ *
228
+ * Absent means the daemon has not heard -- an offline machine, an unlinked project, an older
229
+ * platform -- and the panel shows no control at all rather than guessing. Showing a switch that
230
+ * cannot be honoured is worse than showing none.
231
+ */
232
+ harnessConfig: HarnessConfigSchema.optional(),
161
233
  });
162
234
  /** Empty counters - the starting point for a fresh store and the identity for merges. */
163
235
  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
  *
@@ -110,6 +162,31 @@ export declare const JournalVerdictEffectSchema: z.ZodObject<{
110
162
  }>;
111
163
  /** `file:line` for the element driven, when the page told us one. */
112
164
  source: z.ZodOptional<z.ZodString>;
165
+ /**
166
+ * Which source of truth answering the claim required -- the predicate's own kind.
167
+ *
168
+ * A run folded from this journal has to say what a check READ, and with no field here it had
169
+ * nothing to say it from: every check ever folded was stamped `element`, including the ones whose
170
+ * own `grade` in the same object said `net`. Channel routing reads this, so a network verdict
171
+ * arrived as a UI verdict.
172
+ *
173
+ * Optional, because a record written before this field existed has no kind and must not be read
174
+ * as though it had one.
175
+ */
176
+ kind: z.ZodOptional<z.ZodNativeEnum<{
177
+ readonly ELEMENT: "element";
178
+ readonly TEXT: "text";
179
+ readonly SIGNAL: "signal";
180
+ readonly NET: "net";
181
+ readonly STATE: "state";
182
+ readonly ROUTE: "route";
183
+ readonly CONSOLE: "console";
184
+ readonly ANIMATION: "animation";
185
+ readonly SETTLED: "settled";
186
+ readonly ALL_OF: "allOf";
187
+ readonly ANY_OF: "anyOf";
188
+ readonly NOT: "not";
189
+ }>>;
113
190
  /**
114
191
  * Was the claim written down BEFORE the action, or after it?
115
192
  *
@@ -148,19 +225,21 @@ export declare const JournalVerdictEffectSchema: z.ZodObject<{
148
225
  reason: z.ZodOptional<z.ZodString>;
149
226
  }, "strip", z.ZodTypeAny, {
150
227
  claim: string;
151
- verified: "unknown" | "yes" | "no" | "no-fault";
152
- source?: string | undefined;
153
- reason?: string | undefined;
228
+ verified: "yes" | "no" | "unknown" | "no-fault";
229
+ kind?: "signal" | "text" | "net" | "state" | "element" | "route" | "console" | "animation" | "settled" | "allOf" | "anyOf" | "not" | undefined;
154
230
  declaredBeforeActing?: boolean | undefined;
155
231
  grade?: string | undefined;
156
232
  couldNotSee?: string[] | undefined;
233
+ reason?: string | undefined;
234
+ source?: string | undefined;
157
235
  }, {
158
236
  claim: string;
159
- verified: "unknown" | "yes" | "no" | "no-fault";
160
- source?: string | undefined;
161
- reason?: string | undefined;
237
+ verified: "yes" | "no" | "unknown" | "no-fault";
238
+ kind?: "signal" | "text" | "net" | "state" | "element" | "route" | "console" | "animation" | "settled" | "allOf" | "anyOf" | "not" | undefined;
162
239
  declaredBeforeActing?: boolean | undefined;
163
240
  grade?: string | undefined;
164
241
  couldNotSee?: string[] | undefined;
242
+ reason?: string | undefined;
243
+ source?: string | undefined;
165
244
  }>;
166
245
  export type JournalVerdictEffect = z.infer<typeof JournalVerdictEffectSchema>;
@@ -1,6 +1,7 @@
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
+ import { PredicateKind } from '../verdict/consequence.js';
4
5
  /**
5
6
  * The durable causal journal. Each session gets an append-only pair on disk:
6
7
  * `.reticle/sessions/<id>/events.jsonl` (one `ReticleEvent` per line — already seq/actionId-stamped
@@ -36,6 +37,43 @@ export const JournalActionSchema = z.object({
36
37
  /** Elapsed-ms timestamp the action was recorded at (clock injected by the writer). */
37
38
  at: z.number().int().min(0),
38
39
  });
40
+ /**
41
+ * The report written beside `events.jsonl` when its byte ceiling refuses a batch.
42
+ *
43
+ * The event ledger is bounded on disk, and a bound means a ledger can be INCOMPLETE. The refusal is
44
+ * declared twice on purpose, because neither declaration can do the other's job:
45
+ *
46
+ * - IN-BAND, as one `TRUNCATED` record on the event stream, so every existing reader sees it with
47
+ * no new field and no new allowlist.
48
+ * - OUT-OF-BAND, as this file, because the in-band record carries a `t` and every journal-backed
49
+ * query filters on `t`. A window opened after the ceiling was hit contains no marker and no
50
+ * events, which is exactly a complete window in which nothing happened.
51
+ *
52
+ * Every field but `v` and `channel` is OPTIONAL, and that is a rule rather than a convenience: the
53
+ * file's PRESENCE is the durable fact ("this ledger was closed"), while its contents are a detail
54
+ * that a truncated or corrupted write can lose. A reader that cannot parse the details reports them
55
+ * absent. It must never fill them in from what is true NOW — the current ceiling is not necessarily
56
+ * the ceiling that closed the ledger — and it must never read an unparseable file as an open one.
57
+ */
58
+ export const JournalWriteLossSchema = z.object({
59
+ v: z.literal(JOURNAL_FILE_VERSION),
60
+ /** Which channel lost data — the same vocabulary the in-band `TRUNCATED` record names. */
61
+ channel: z.literal(TruncationChannel.JOURNAL),
62
+ /** The ceiling that refused the write, in bytes. */
63
+ capBytes: z.number().int().min(1).optional(),
64
+ /** Bytes already in the ledger when it was closed. */
65
+ bytesOnDisk: z.number().int().min(0).optional(),
66
+ /**
67
+ * Events in the ONE batch that was refused — never a running total of everything dropped after.
68
+ *
69
+ * An append-only file cannot revise a line it has already written, and re-emitting a fresh count
70
+ * per refusal would recreate the growth this bound exists to stop. The load-bearing fact is that
71
+ * the ledger closed; the count says how much was in the batch that closed it, and nothing more.
72
+ */
73
+ droppedInBatch: z.number().int().min(0).optional(),
74
+ /** Elapsed-ms stamp of the last record in the first refused batch; not a loss-window boundary. */
75
+ at: z.number().optional(),
76
+ });
39
77
  /**
40
78
  * The bounded verdict summary a verification tool writes into a journal action's `effect`.
41
79
  *
@@ -54,6 +92,18 @@ export const JournalVerdictEffectSchema = z.object({
54
92
  verified: z.nativeEnum(Verified),
55
93
  /** `file:line` for the element driven, when the page told us one. */
56
94
  source: z.string().max(TRANSPORT_LIMITS.MAX_URL_LENGTH).optional(),
95
+ /**
96
+ * Which source of truth answering the claim required -- the predicate's own kind.
97
+ *
98
+ * A run folded from this journal has to say what a check READ, and with no field here it had
99
+ * nothing to say it from: every check ever folded was stamped `element`, including the ones whose
100
+ * own `grade` in the same object said `net`. Channel routing reads this, so a network verdict
101
+ * arrived as a UI verdict.
102
+ *
103
+ * Optional, because a record written before this field existed has no kind and must not be read
104
+ * as though it had one.
105
+ */
106
+ kind: z.nativeEnum(PredicateKind).optional(),
57
107
  /**
58
108
  * Was the claim written down BEFORE the action, or after it?
59
109
  *
@@ -70,8 +70,8 @@ export declare const VerdictHookPayloadSchema: z.ZodObject<{
70
70
  at: string;
71
71
  tool: string;
72
72
  verified: string;
73
- projectId?: string | undefined;
74
73
  url?: string | undefined;
74
+ projectId?: string | undefined;
75
75
  sessionId?: string | undefined;
76
76
  because?: string | undefined;
77
77
  }, {
@@ -79,8 +79,8 @@ export declare const VerdictHookPayloadSchema: z.ZodObject<{
79
79
  at: string;
80
80
  tool: string;
81
81
  verified: string;
82
- projectId?: string | undefined;
83
82
  url?: string | undefined;
83
+ projectId?: string | undefined;
84
84
  sessionId?: string | undefined;
85
85
  because?: string | undefined;
86
86
  }>;
@@ -99,8 +99,8 @@ export declare const BugFoundHookPayloadSchema: z.ZodObject<{
99
99
  sessionId: z.ZodOptional<z.ZodString>;
100
100
  }, "strip", z.ZodTypeAny, {
101
101
  event: "bug_found";
102
- kind: string;
103
102
  at: string;
103
+ kind: string;
104
104
  tool: string;
105
105
  repeat: boolean;
106
106
  route?: string | undefined;
@@ -110,8 +110,8 @@ export declare const BugFoundHookPayloadSchema: z.ZodObject<{
110
110
  fingerprint?: string | undefined;
111
111
  }, {
112
112
  event: "bug_found";
113
- kind: string;
114
113
  at: string;
114
+ kind: string;
115
115
  tool: string;
116
116
  repeat: boolean;
117
117
  route?: string | undefined;
@@ -133,15 +133,15 @@ export declare const SessionHookPayloadSchema: z.ZodObject<{
133
133
  event: "session_started" | "session_ended";
134
134
  at: string;
135
135
  sessionId: string;
136
- projectId?: string | undefined;
137
136
  url?: string | undefined;
137
+ projectId?: string | undefined;
138
138
  runtime?: string | undefined;
139
139
  }, {
140
140
  event: "session_started" | "session_ended";
141
141
  at: string;
142
142
  sessionId: string;
143
- projectId?: string | undefined;
144
143
  url?: string | undefined;
144
+ projectId?: string | undefined;
145
145
  runtime?: string | undefined;
146
146
  }>;
147
147
  export type SessionHookPayload = z.infer<typeof SessionHookPayloadSchema>;
@@ -154,15 +154,15 @@ export declare const SyncHookPayloadSchema: z.ZodObject<{
154
154
  ok: z.ZodBoolean;
155
155
  error: z.ZodOptional<z.ZodString>;
156
156
  }, "strip", z.ZodTypeAny, {
157
- event: "sync_completed";
158
157
  ok: boolean;
158
+ event: "sync_completed";
159
159
  at: string;
160
160
  runsPushed: number;
161
161
  error?: string | undefined;
162
162
  projectId?: string | undefined;
163
163
  }, {
164
- event: "sync_completed";
165
164
  ok: boolean;
165
+ event: "sync_completed";
166
166
  at: string;
167
167
  runsPushed: number;
168
168
  error?: string | undefined;
@@ -185,8 +185,8 @@ export declare const HookPayloadSchema: z.ZodDiscriminatedUnion<"event", [z.ZodO
185
185
  at: string;
186
186
  tool: string;
187
187
  verified: string;
188
- projectId?: string | undefined;
189
188
  url?: string | undefined;
189
+ projectId?: string | undefined;
190
190
  sessionId?: string | undefined;
191
191
  because?: string | undefined;
192
192
  }, {
@@ -194,8 +194,8 @@ export declare const HookPayloadSchema: z.ZodDiscriminatedUnion<"event", [z.ZodO
194
194
  at: string;
195
195
  tool: string;
196
196
  verified: string;
197
- projectId?: string | undefined;
198
197
  url?: string | undefined;
198
+ projectId?: string | undefined;
199
199
  sessionId?: string | undefined;
200
200
  because?: string | undefined;
201
201
  }>, z.ZodObject<{
@@ -212,8 +212,8 @@ export declare const HookPayloadSchema: z.ZodDiscriminatedUnion<"event", [z.ZodO
212
212
  sessionId: z.ZodOptional<z.ZodString>;
213
213
  }, "strip", z.ZodTypeAny, {
214
214
  event: "bug_found";
215
- kind: string;
216
215
  at: string;
216
+ kind: string;
217
217
  tool: string;
218
218
  repeat: boolean;
219
219
  route?: string | undefined;
@@ -223,8 +223,8 @@ export declare const HookPayloadSchema: z.ZodDiscriminatedUnion<"event", [z.ZodO
223
223
  fingerprint?: string | undefined;
224
224
  }, {
225
225
  event: "bug_found";
226
- kind: string;
227
226
  at: string;
227
+ kind: string;
228
228
  tool: string;
229
229
  repeat: boolean;
230
230
  route?: string | undefined;
@@ -244,15 +244,15 @@ export declare const HookPayloadSchema: z.ZodDiscriminatedUnion<"event", [z.ZodO
244
244
  event: "session_started";
245
245
  at: string;
246
246
  sessionId: string;
247
- projectId?: string | undefined;
248
247
  url?: string | undefined;
248
+ projectId?: string | undefined;
249
249
  runtime?: string | undefined;
250
250
  }, {
251
251
  event: "session_started";
252
252
  at: string;
253
253
  sessionId: string;
254
- projectId?: string | undefined;
255
254
  url?: string | undefined;
255
+ projectId?: string | undefined;
256
256
  runtime?: string | undefined;
257
257
  }>, z.ZodObject<{
258
258
  at: z.ZodString;
@@ -266,15 +266,15 @@ export declare const HookPayloadSchema: z.ZodDiscriminatedUnion<"event", [z.ZodO
266
266
  event: "session_ended";
267
267
  at: string;
268
268
  sessionId: string;
269
- projectId?: string | undefined;
270
269
  url?: string | undefined;
270
+ projectId?: string | undefined;
271
271
  runtime?: string | undefined;
272
272
  }, {
273
273
  event: "session_ended";
274
274
  at: string;
275
275
  sessionId: string;
276
- projectId?: string | undefined;
277
276
  url?: string | undefined;
277
+ projectId?: string | undefined;
278
278
  runtime?: string | undefined;
279
279
  }>, z.ZodObject<{
280
280
  at: z.ZodString;
@@ -285,15 +285,15 @@ export declare const HookPayloadSchema: z.ZodDiscriminatedUnion<"event", [z.ZodO
285
285
  ok: z.ZodBoolean;
286
286
  error: z.ZodOptional<z.ZodString>;
287
287
  }, "strip", z.ZodTypeAny, {
288
- event: "sync_completed";
289
288
  ok: boolean;
289
+ event: "sync_completed";
290
290
  at: string;
291
291
  runsPushed: number;
292
292
  error?: string | undefined;
293
293
  projectId?: string | undefined;
294
294
  }, {
295
- event: "sync_completed";
296
295
  ok: boolean;
296
+ event: "sync_completed";
297
297
  at: string;
298
298
  runsPushed: number;
299
299
  error?: string | undefined;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * `@reticlehq/core/hud` — the HUD's control names, for the panel that renders them and the daemon
3
+ * that counts them.
4
+ *
5
+ * A subpath for the reason `./tour` is one: the SDK loads core's root entry on every page, and the
6
+ * control list re-exported from there landed in a chunk every page downloads, though only the lazily
7
+ * loaded panel ever reads it. `first-load-size` measured it.
8
+ */
9
+ export * from './wire/constants/hud-controls.js';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * `@reticlehq/core/hud` — the HUD's control names, for the panel that renders them and the daemon
3
+ * that counts them.
4
+ *
5
+ * A subpath for the reason `./tour` is one: the SDK loads core's root entry on every page, and the
6
+ * control list re-exported from there landed in a chunk every page downloads, though only the lazily
7
+ * loaded panel ever reads it. `first-load-size` measured it.
8
+ */
9
+ export * from './wire/constants/hud-controls.js';
@@ -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;
@@ -30,3 +30,14 @@ export declare const RETICLE_ROOT_GLOBAL = "__RETICLE_ROOT__";
30
30
  * package's version. See `sdkVersion` on the HELLO message.
31
31
  */
32
32
  export declare const RETICLE_SDK_VERSION_GLOBAL = "__RETICLE_SDK_VERSION__";
33
+ /**
34
+ * The per-file opt-out for source stamping: a file whose FIRST non-empty line is a comment carrying
35
+ * this marker — the `//` line form, the block-comment form, or `<!-- @reticle-ignore -->` for a
36
+ * Svelte component — is not stamped at all.
37
+ *
38
+ * Whole file, first line, on purpose. The reasons to opt out are file-shaped ("this component is
39
+ * generated", "stamping this one breaks a snapshot test"), and a marker that worked from line 40
40
+ * would be a marker nobody can find. The string lives here so the Babel plugin, the Vite plugin and
41
+ * the docs cannot drift on it; the stampers own the line check (#853).
42
+ */
43
+ export declare const RETICLE_IGNORE_MARKER = "@reticle-ignore";
@@ -30,3 +30,14 @@ export const RETICLE_ROOT_GLOBAL = '__RETICLE_ROOT__';
30
30
  * package's version. See `sdkVersion` on the HELLO message.
31
31
  */
32
32
  export const RETICLE_SDK_VERSION_GLOBAL = '__RETICLE_SDK_VERSION__';
33
+ /**
34
+ * The per-file opt-out for source stamping: a file whose FIRST non-empty line is a comment carrying
35
+ * this marker — the `//` line form, the block-comment form, or `<!-- @reticle-ignore -->` for a
36
+ * Svelte component — is not stamped at all.
37
+ *
38
+ * Whole file, first line, on purpose. The reasons to opt out are file-shaped ("this component is
39
+ * generated", "stamping this one breaks a snapshot test"), and a marker that worked from line 40
40
+ * would be a marker nobody can find. The string lives here so the Babel plugin, the Vite plugin and
41
+ * the docs cannot drift on it; the stampers own the line check (#853).
42
+ */
43
+ export const RETICLE_IGNORE_MARKER = '@reticle-ignore';
package/dist/index.d.ts CHANGED
@@ -28,14 +28,18 @@ export * from './identity/source-constants.js';
28
28
  export * from './wire/event-classification.js';
29
29
  export * from './wire/global-press.js';
30
30
  export * from './verdict/verified-constants.js';
31
+ export * from './verdict/verdict-attribution.js';
31
32
  export * from './verdict/verify-progress.js';
32
33
  export * from './wire/constants/session-constants.js';
34
+ export * from './wire/constants/hud-use.js';
35
+ export * from './wire/constants/discovery.js';
33
36
  export * from './identity/document-identity.js';
34
37
  export * from './identity/edit-epoch.js';
35
38
  export * from './wire/messages.js';
36
39
  export * from './wire/event-payloads.js';
37
40
  export * from './wire/event-priority.js';
38
41
  export * from './artifacts/flow-constants.js';
42
+ export * from './artifacts/flow-step-tool.js';
39
43
  export * from './artifacts/flow-types.js';
40
44
  export * from './artifacts/step-effect.js';
41
45
  export * from './artifacts/flow-composition.js';
@@ -46,6 +50,10 @@ export * from './wire/net.js';
46
50
  export * from './verdict/findings.js';
47
51
  export * from './wire/desktop-contract.js';
48
52
  export * from './verdict/consequence.js';
53
+ export * from './verdict/property-assertion.js';
54
+ export * from './verdict/predicate.js';
55
+ export * from './verdict/predicate-tree.js';
56
+ export * from './artifacts/flow-expect-flat.js';
49
57
  export * from './identity/project-id.js';
50
58
  export * from './words/notices.js';
51
59
  export * from './artifacts/journal.js';
@@ -66,6 +74,7 @@ export * from './words/no-session-reason.js';
66
74
  export * from './telemetry-refusal.js';
67
75
  export * from './wire/narrow.js';
68
76
  export * from './wire/tool-names.js';
77
+ export * from './wire/snapshot-tree.js';
69
78
  export * from './wire/platform.js';
70
79
  export * from './wire/channel.js';
71
80
  export * from './verdict/revision.js';
package/dist/index.js CHANGED
@@ -29,24 +29,47 @@ export * from './identity/source-constants.js'; // DATA_RETICLE_SOURCE_ATTR, RET
29
29
  export * from './wire/event-classification.js'; // CHURN_TYPES — shared eviction priority for buffer/queue
30
30
  export * from './wire/global-press.js'; // which press is a document key (Escape / Tab / a shortcut)
31
31
  export * from './verdict/verified-constants.js'; // Verified — the one field an agent gates on
32
+ // Its own module so a page that never needs it does not download it — see first-load-size.
33
+ export * from './verdict/verdict-attribution.js';
32
34
  export * from './verdict/verify-progress.js'; // VerifyPhase — what a run is doing while it is still doing it
33
35
  export * from './wire/constants/session-constants.js';
36
+ export * from './wire/constants/hud-use.js'; // where the HUD sits, for HUD_USED events
37
+ export * from './wire/constants/discovery.js'; // the call-the-founder invitation, one link for every surface
34
38
  export * from './identity/document-identity.js'; // which document an observation belongs to
35
39
  export * from './identity/edit-epoch.js'; // which round of source edits an observation belongs to
36
40
  export * from './wire/messages.js'; // ReticleEvent + the message schemas
37
41
  export * from './wire/event-payloads.js'; // per-event payload schemas + wire vocab
38
42
  export * from './wire/event-priority.js'; // which events survive the bridge rate cap
39
43
  export * from './artifacts/flow-constants.js'; // moved off wire/constants/constants, which had no use for them
40
- export * from './artifacts/flow-types.js'; // FlowStep, FlowExpect, FlowStepTool, replay result shapes
44
+ /*
45
+ * The leaf FIRST, and separately from the file it describes. `flow-step-tool.ts` was extracted out
46
+ * of `flow-types.ts` precisely so the browser SDK — which imports `FlowStepTool` and nothing else
47
+ * from there — would stop downloading eleven zod schemas it can never use. `flow-types.ts` then
48
+ * re-exported the two names for convenience, which put the whole module straight back on the
49
+ * barrel's path to them and quietly undid the extraction: measured at 6,222 B of every page load,
50
+ * reached through one constant.
51
+ *
52
+ * That is the same shape as the z-index that dragged the panel's stylesheet in, and as `StepEffect`
53
+ * on the line below. A leaf is only a leaf if the barrel names it directly.
54
+ */
55
+ export * from './artifacts/flow-step-tool.js'; // FlowStepTool / CROSS_STEP_ADDRESS: a leaf, named directly
56
+ export * from './artifacts/flow-types.js'; // FlowStep, FlowExpect, replay result shapes
41
57
  export * from './artifacts/step-effect.js'; // StepEffect: a leaf, so the page never downloads it
42
58
  export * from './artifacts/flow-composition.js'; // canFollow: may B replay straight after A
43
59
  export * from './verdict/verification-run.js'; // run/verdict shapes for the CI surface
44
60
  export * from './wire/types.js';
45
- export * from './identity/brand.js'; // RunId / SessionId / Ref brands + validators
61
+ export * from './identity/brand.js'; // RunId / SessionId / ProjectId / Ref brands + validators
46
62
  export * from './wire/net.js'; // NetInitiator / ipc:// scheme — network + desktop-IPC call vocabulary
47
63
  export * from './verdict/findings.js'; // crawl anomalies + cross-channel contradictions
48
64
  export * from './wire/desktop-contract.js'; // the Electron preload/main/renderer/daemon string contract
49
65
  export * from './verdict/consequence.js';
66
+ // The predicate CONTRACT: what a caller may declare, and what a saved flow may carry. The engine
67
+ // owns the reasoning over it and re-exports both halves as one surface.
68
+ export * from './verdict/property-assertion.js';
69
+ export * from './verdict/predicate.js';
70
+ export * from './verdict/predicate-tree.js';
71
+ // The version 1 reader: a flat expect lifted to the predicate a v2 file stores directly.
72
+ export * from './artifacts/flow-expect-flat.js';
50
73
  export * from './identity/project-id.js';
51
74
  export * from './words/notices.js';
52
75
  export * from './artifacts/journal.js';
@@ -70,6 +93,7 @@ export * from './words/no-session-reason.js';
70
93
  export * from './telemetry-refusal.js';
71
94
  export * from './wire/narrow.js';
72
95
  export * from './wire/tool-names.js';
96
+ export * from './wire/snapshot-tree.js'; // parseInteractive — the browser writes this format, Node reads it
73
97
  export * from './wire/platform.js';
74
98
  export * from './wire/channel.js';
75
99
  export * from './verdict/revision.js';