@reticlehq/core 2.0.1 → 2.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.
Files changed (70) hide show
  1. package/LICENSE +201 -112
  2. package/NOTICE +5 -0
  3. package/dist/brand.d.ts +32 -3
  4. package/dist/brand.d.ts.map +1 -1
  5. package/dist/brand.js +9 -4
  6. package/dist/brand.js.map +1 -1
  7. package/dist/consequence.d.ts +31 -0
  8. package/dist/consequence.d.ts.map +1 -0
  9. package/dist/consequence.js +45 -0
  10. package/dist/consequence.js.map +1 -0
  11. package/dist/constants.d.ts +161 -5
  12. package/dist/constants.d.ts.map +1 -1
  13. package/dist/constants.js +156 -5
  14. package/dist/constants.js.map +1 -1
  15. package/dist/daemon-registry.d.ts +5 -5
  16. package/dist/daemon-registry.d.ts.map +1 -1
  17. package/dist/daemon-registry.js +5 -5
  18. package/dist/daemon-registry.js.map +1 -1
  19. package/dist/event-payloads.d.ts +502 -0
  20. package/dist/event-payloads.d.ts.map +1 -0
  21. package/dist/event-payloads.js +138 -0
  22. package/dist/event-payloads.js.map +1 -0
  23. package/dist/flow-constants.d.ts +2 -2
  24. package/dist/flow-constants.js +7 -7
  25. package/dist/flow-constants.js.map +1 -1
  26. package/dist/flow-types.d.ts +156 -32
  27. package/dist/flow-types.d.ts.map +1 -1
  28. package/dist/flow-types.js +23 -1
  29. package/dist/flow-types.js.map +1 -1
  30. package/dist/index.d.ts +19 -6
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +26 -11
  33. package/dist/index.js.map +1 -1
  34. package/dist/journal.d.ts +90 -0
  35. package/dist/journal.d.ts.map +1 -0
  36. package/dist/journal.js +38 -0
  37. package/dist/journal.js.map +1 -0
  38. package/dist/messages.d.ts +118 -16
  39. package/dist/messages.d.ts.map +1 -1
  40. package/dist/messages.js +15 -2
  41. package/dist/messages.js.map +1 -1
  42. package/dist/notices.d.ts +4 -4
  43. package/dist/notices.js +4 -4
  44. package/dist/redaction.d.ts +4 -0
  45. package/dist/redaction.d.ts.map +1 -0
  46. package/dist/redaction.js +33 -0
  47. package/dist/redaction.js.map +1 -0
  48. package/dist/schema/event-message.json +23 -1
  49. package/dist/schema/event-type.json +10 -1
  50. package/dist/schema/reticle-event.json +23 -1
  51. package/dist/schema/reticle-message.json +23 -1
  52. package/dist/session-constants.d.ts +2 -2
  53. package/dist/session-constants.js +2 -2
  54. package/dist/state-select.d.ts.map +1 -1
  55. package/dist/state-select.js +21 -5
  56. package/dist/state-select.js.map +1 -1
  57. package/dist/toon.d.ts +13 -12
  58. package/dist/toon.d.ts.map +1 -1
  59. package/dist/toon.js +37 -20
  60. package/dist/toon.js.map +1 -1
  61. package/dist/types.d.ts +80 -18
  62. package/dist/types.d.ts.map +1 -1
  63. package/dist/types.js +9 -3
  64. package/dist/types.js.map +1 -1
  65. package/dist/upgrade.d.ts +5 -5
  66. package/dist/upgrade.js +3 -3
  67. package/dist/verification-run.d.ts +25 -23
  68. package/dist/verification-run.d.ts.map +1 -1
  69. package/dist/verification-run.js +1 -1
  70. package/package.json +6 -2
@@ -0,0 +1,90 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * The durable causal journal. Each session gets an append-only pair on disk:
4
+ * `.reticle/sessions/<id>/events.jsonl` (one `ReticleEvent` per line — already seq/actionId-stamped
5
+ * and browser-edge-redacted) and `actions.jsonl` (one JournalAction per line). The ring buffer becomes
6
+ * a hot cache over this ledger, so evidence survives eviction. Local-only; JSONL is versioned per line
7
+ * so a schema bump never orphans an old file.
8
+ */
9
+ /** Per-record schema version. JSONL is line-addressable, so versioning rides each record, not a header. */
10
+ export declare const JOURNAL_FILE_VERSION = 1;
11
+ /**
12
+ * An action entity — every act/navigate the server dispatches. `seqRange`/`tRange` are the window used
13
+ * to attribute events to this action (`attribution:"window"`); `effect` is a bounded summary of what
14
+ * the tool returned. Args are already edge-redacted by the browser before they reach here.
15
+ */
16
+ export declare const JournalActionSchema: z.ZodObject<{
17
+ v: z.ZodLiteral<1>;
18
+ /** The command correlation id (`c<n>`) — the natural, cross-side-stable action identity. */
19
+ actionId: z.ZodString;
20
+ /** The MCP tool / command name that drove it (e.g. "reticle_act"). */
21
+ tool: z.ZodString;
22
+ /** Redacted invocation args. */
23
+ args: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
24
+ /** Bounded effect summary (settle glyph, target, etc.). Kept open; narrowed by the writer. */
25
+ effect: z.ZodOptional<z.ZodUnknown>;
26
+ /** Whether the page settled within budget after the action, when known. */
27
+ settled: z.ZodOptional<z.ZodBoolean>;
28
+ /** Time from dispatch to settle in ms, when known. */
29
+ settledInMs: z.ZodOptional<z.ZodNumber>;
30
+ /** Inclusive seq range of events attributed to this action, when any were observed. */
31
+ seqRange: z.ZodOptional<z.ZodObject<{
32
+ from: z.ZodNumber;
33
+ to: z.ZodNumber;
34
+ }, "strip", z.ZodTypeAny, {
35
+ from: number;
36
+ to: number;
37
+ }, {
38
+ from: number;
39
+ to: number;
40
+ }>>;
41
+ /** Elapsed-ms window [dispatch, resolve] used for window attribution. */
42
+ tRange: z.ZodObject<{
43
+ from: z.ZodNumber;
44
+ to: z.ZodNumber;
45
+ }, "strip", z.ZodTypeAny, {
46
+ from: number;
47
+ to: number;
48
+ }, {
49
+ from: number;
50
+ to: number;
51
+ }>;
52
+ /** Elapsed-ms timestamp the action was recorded at (clock injected by the writer). */
53
+ at: z.ZodNumber;
54
+ }, "strip", z.ZodTypeAny, {
55
+ at: number;
56
+ actionId: string;
57
+ args: Record<string, unknown>;
58
+ tool: string;
59
+ v: 1;
60
+ tRange: {
61
+ from: number;
62
+ to: number;
63
+ };
64
+ effect?: unknown;
65
+ settled?: boolean | undefined;
66
+ settledInMs?: number | undefined;
67
+ seqRange?: {
68
+ from: number;
69
+ to: number;
70
+ } | undefined;
71
+ }, {
72
+ at: number;
73
+ actionId: string;
74
+ tool: string;
75
+ v: 1;
76
+ tRange: {
77
+ from: number;
78
+ to: number;
79
+ };
80
+ args?: Record<string, unknown> | undefined;
81
+ effect?: unknown;
82
+ settled?: boolean | undefined;
83
+ settledInMs?: number | undefined;
84
+ seqRange?: {
85
+ from: number;
86
+ to: number;
87
+ } | undefined;
88
+ }>;
89
+ export type JournalAction = z.infer<typeof JournalActionSchema>;
90
+ //# sourceMappingURL=journal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"journal.d.ts","sourceRoot":"","sources":["../src/journal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;GAMG;AAEH,2GAA2G;AAC3G,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;IAE9B,4FAA4F;;IAE5F,sEAAsE;;IAEtE,gCAAgC;;IAEhC,8FAA8F;;IAE9F,2EAA2E;;IAE3E,sDAAsD;;IAEtD,uFAAuF;;;;;;;;;;;IAEvF,yEAAyE;;;;;;;;;;;IAEzE,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEtF,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { z } from 'zod';
2
+ import { TRANSPORT_LIMITS } from './constants.js';
3
+ /**
4
+ * The durable causal journal. Each session gets an append-only pair on disk:
5
+ * `.reticle/sessions/<id>/events.jsonl` (one `ReticleEvent` per line — already seq/actionId-stamped
6
+ * and browser-edge-redacted) and `actions.jsonl` (one JournalAction per line). The ring buffer becomes
7
+ * a hot cache over this ledger, so evidence survives eviction. Local-only; JSONL is versioned per line
8
+ * so a schema bump never orphans an old file.
9
+ */
10
+ /** Per-record schema version. JSONL is line-addressable, so versioning rides each record, not a header. */
11
+ export const JOURNAL_FILE_VERSION = 1;
12
+ /**
13
+ * An action entity — every act/navigate the server dispatches. `seqRange`/`tRange` are the window used
14
+ * to attribute events to this action (`attribution:"window"`); `effect` is a bounded summary of what
15
+ * the tool returned. Args are already edge-redacted by the browser before they reach here.
16
+ */
17
+ export const JournalActionSchema = z.object({
18
+ v: z.literal(JOURNAL_FILE_VERSION),
19
+ /** The command correlation id (`c<n>`) — the natural, cross-side-stable action identity. */
20
+ actionId: z.string().min(1).max(TRANSPORT_LIMITS.MAX_REF_LENGTH),
21
+ /** The MCP tool / command name that drove it (e.g. "reticle_act"). */
22
+ tool: z.string().min(1).max(TRANSPORT_LIMITS.MAX_COMMAND_NAME_LENGTH),
23
+ /** Redacted invocation args. */
24
+ args: z.record(z.unknown()).default({}),
25
+ /** Bounded effect summary (settle glyph, target, etc.). Kept open; narrowed by the writer. */
26
+ effect: z.unknown().optional(),
27
+ /** Whether the page settled within budget after the action, when known. */
28
+ settled: z.boolean().optional(),
29
+ /** Time from dispatch to settle in ms, when known. */
30
+ settledInMs: z.number().int().min(0).optional(),
31
+ /** Inclusive seq range of events attributed to this action, when any were observed. */
32
+ seqRange: z.object({ from: z.number().int().min(0), to: z.number().int().min(0) }).optional(),
33
+ /** Elapsed-ms window [dispatch, resolve] used for window attribution. */
34
+ tRange: z.object({ from: z.number().int().min(0), to: z.number().int().min(0) }),
35
+ /** Elapsed-ms timestamp the action was recorded at (clock injected by the writer). */
36
+ at: z.number().int().min(0),
37
+ });
38
+ //# sourceMappingURL=journal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"journal.js","sourceRoot":"","sources":["../src/journal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;;;;GAMG;AAEH,2GAA2G;AAC3G,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAEtC;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,oB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AC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC5B,CAAC,CAAC"}
@@ -13,10 +13,10 @@ export declare const HumanControlDataSchema: z.ZodObject<{
13
13
  }>;
14
14
  text: z.ZodOptional<z.ZodString>;
15
15
  }, "strip", z.ZodTypeAny, {
16
- kind: "message" | "pause" | "resume" | "end" | "replay";
16
+ kind: "pause" | "resume" | "end" | "message" | "replay";
17
17
  text?: string | undefined;
18
18
  }, {
19
- kind: "message" | "pause" | "resume" | "end" | "replay";
19
+ kind: "pause" | "resume" | "end" | "message" | "replay";
20
20
  text?: string | undefined;
21
21
  }>;
22
22
  export type HumanControlData = z.infer<typeof HumanControlDataSchema>;
@@ -79,7 +79,7 @@ export type HumanMarkData = z.infer<typeof HumanMarkDataSchema>;
79
79
  /**
80
80
  * A normalized observation pushed from the browser into the ring buffer.
81
81
  * `t` is a monotonic millisecond timestamp relative to session start (clock injected,
82
- * never `Date.now()` inside pure logic — see plan engineering standards).
82
+ * never `Date.now` inside pure logic — see plan engineering standards).
83
83
  */
84
84
  export declare const ReticleEventSchema: z.ZodObject<{
85
85
  t: z.ZodNumber;
@@ -90,41 +90,71 @@ export declare const ReticleEventSchema: z.ZodObject<{
90
90
  readonly DOM_TEXT: "dom.text";
91
91
  readonly NET_REQUEST: "net.request";
92
92
  readonly NET_PENDING: "net.pending";
93
+ readonly NET_STREAM: "net.stream";
94
+ readonly PERF: "perf";
93
95
  readonly ROUTE_CHANGE: "route.change";
94
96
  readonly CONSOLE_LOG: "console.log";
95
97
  readonly CONSOLE_WARN: "console.warn";
96
98
  readonly CONSOLE_ERROR: "console.error";
99
+ readonly CONSOLE_INFO: "console.info";
100
+ readonly CONSOLE_DEBUG: "console.debug";
97
101
  readonly ERROR_UNCAUGHT: "error.uncaught";
98
102
  readonly VISIBLE_SHOWN: "visible.shown";
99
- readonly VISIBLE_HIDDEN: "visible.hidden";
100
103
  readonly ANIM_START: "anim.start";
101
104
  readonly ANIM_END: "anim.end";
102
105
  readonly SCROLL_POSITION: "scroll.position";
103
106
  readonly REVEAL_SHOWN: "reveal.shown";
104
107
  readonly SIGNAL: "signal";
105
108
  readonly STATE_CHANGE: "state.change";
109
+ readonly STORAGE_CHANGE: "storage.change";
106
110
  readonly PAGE_HEALTH: "page.health";
111
+ readonly RENDER_COMMIT: "render.commit";
112
+ readonly FOCUS_CHANGE: "focus.change";
107
113
  readonly FLOW_RECORDED: "flow.recorded";
108
114
  readonly TRANSPORT_OVERFLOW: "transport.overflow";
115
+ readonly TRUNCATED: "truncated";
116
+ readonly BLIND_SPOT: "blind-spot";
117
+ readonly NET_DETAIL: "net.detail";
109
118
  readonly HUMAN_CONTROL: "human.control";
110
119
  readonly HUMAN_MARK: "human.mark";
111
120
  }>;
112
121
  sessionId: z.ZodString;
113
122
  /** Stable element reference this event concerns, when applicable (e.g. "e7"). */
114
123
  ref: z.ZodOptional<z.ZodString>;
124
+ /**
125
+ * Monotonic per-session sequence number stamped by the SDK. Gives events a total order independent
126
+ * of `t` (which can tie at millisecond resolution). Optional for back-compat with pre-2.2 SDKs.
127
+ */
128
+ seq: z.ZodOptional<z.ZodNumber>;
129
+ /**
130
+ * The action this event is attributed to, when one was active at observation time. Set together with
131
+ * `attribution` (the tier of that link). Optional: ambient events observed outside any action window
132
+ * carry neither.
133
+ */
134
+ actionId: z.ZodOptional<z.ZodString>;
135
+ /** How `actionId` was derived. Present iff `actionId` is. */
136
+ attribution: z.ZodOptional<z.ZodNativeEnum<{
137
+ readonly WINDOW: "window";
138
+ }>>;
115
139
  /** Event-type-specific payload. Kept open here; refined per observer at the edges. */
116
140
  data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
117
141
  }, "strip", z.ZodTypeAny, {
118
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "route.change" | "console.log" | "console.warn" | "console.error" | "error.uncaught" | "visible.shown" | "visible.hidden" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "page.health" | "flow.recorded" | "transport.overflow" | "human.control" | "human.mark";
142
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "net.detail" | "human.control" | "human.mark";
119
143
  t: number;
120
144
  sessionId: string;
121
145
  data: Record<string, unknown>;
122
146
  ref?: string | undefined;
147
+ seq?: number | undefined;
148
+ actionId?: string | undefined;
149
+ attribution?: "window" | undefined;
123
150
  }, {
124
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "route.change" | "console.log" | "console.warn" | "console.error" | "error.uncaught" | "visible.shown" | "visible.hidden" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "page.health" | "flow.recorded" | "transport.overflow" | "human.control" | "human.mark";
151
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "net.detail" | "human.control" | "human.mark";
125
152
  t: number;
126
153
  sessionId: string;
127
154
  ref?: string | undefined;
155
+ seq?: number | undefined;
156
+ actionId?: string | undefined;
157
+ attribution?: "window" | undefined;
128
158
  data?: Record<string, unknown> | undefined;
129
159
  }>;
130
160
  export type ReticleEvent = z.infer<typeof ReticleEventSchema>;
@@ -223,58 +253,94 @@ export declare const EventMessageSchema: z.ZodObject<{
223
253
  readonly DOM_TEXT: "dom.text";
224
254
  readonly NET_REQUEST: "net.request";
225
255
  readonly NET_PENDING: "net.pending";
256
+ readonly NET_STREAM: "net.stream";
257
+ readonly PERF: "perf";
226
258
  readonly ROUTE_CHANGE: "route.change";
227
259
  readonly CONSOLE_LOG: "console.log";
228
260
  readonly CONSOLE_WARN: "console.warn";
229
261
  readonly CONSOLE_ERROR: "console.error";
262
+ readonly CONSOLE_INFO: "console.info";
263
+ readonly CONSOLE_DEBUG: "console.debug";
230
264
  readonly ERROR_UNCAUGHT: "error.uncaught";
231
265
  readonly VISIBLE_SHOWN: "visible.shown";
232
- readonly VISIBLE_HIDDEN: "visible.hidden";
233
266
  readonly ANIM_START: "anim.start";
234
267
  readonly ANIM_END: "anim.end";
235
268
  readonly SCROLL_POSITION: "scroll.position";
236
269
  readonly REVEAL_SHOWN: "reveal.shown";
237
270
  readonly SIGNAL: "signal";
238
271
  readonly STATE_CHANGE: "state.change";
272
+ readonly STORAGE_CHANGE: "storage.change";
239
273
  readonly PAGE_HEALTH: "page.health";
274
+ readonly RENDER_COMMIT: "render.commit";
275
+ readonly FOCUS_CHANGE: "focus.change";
240
276
  readonly FLOW_RECORDED: "flow.recorded";
241
277
  readonly TRANSPORT_OVERFLOW: "transport.overflow";
278
+ readonly TRUNCATED: "truncated";
279
+ readonly BLIND_SPOT: "blind-spot";
280
+ readonly NET_DETAIL: "net.detail";
242
281
  readonly HUMAN_CONTROL: "human.control";
243
282
  readonly HUMAN_MARK: "human.mark";
244
283
  }>;
245
284
  sessionId: z.ZodString;
246
285
  /** Stable element reference this event concerns, when applicable (e.g. "e7"). */
247
286
  ref: z.ZodOptional<z.ZodString>;
287
+ /**
288
+ * Monotonic per-session sequence number stamped by the SDK. Gives events a total order independent
289
+ * of `t` (which can tie at millisecond resolution). Optional for back-compat with pre-2.2 SDKs.
290
+ */
291
+ seq: z.ZodOptional<z.ZodNumber>;
292
+ /**
293
+ * The action this event is attributed to, when one was active at observation time. Set together with
294
+ * `attribution` (the tier of that link). Optional: ambient events observed outside any action window
295
+ * carry neither.
296
+ */
297
+ actionId: z.ZodOptional<z.ZodString>;
298
+ /** How `actionId` was derived. Present iff `actionId` is. */
299
+ attribution: z.ZodOptional<z.ZodNativeEnum<{
300
+ readonly WINDOW: "window";
301
+ }>>;
248
302
  /** Event-type-specific payload. Kept open here; refined per observer at the edges. */
249
303
  data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
250
304
  }, "strip", z.ZodTypeAny, {
251
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "route.change" | "console.log" | "console.warn" | "console.error" | "error.uncaught" | "visible.shown" | "visible.hidden" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "page.health" | "flow.recorded" | "transport.overflow" | "human.control" | "human.mark";
305
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "net.detail" | "human.control" | "human.mark";
252
306
  t: number;
253
307
  sessionId: string;
254
308
  data: Record<string, unknown>;
255
309
  ref?: string | undefined;
310
+ seq?: number | undefined;
311
+ actionId?: string | undefined;
312
+ attribution?: "window" | undefined;
256
313
  }, {
257
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "route.change" | "console.log" | "console.warn" | "console.error" | "error.uncaught" | "visible.shown" | "visible.hidden" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "page.health" | "flow.recorded" | "transport.overflow" | "human.control" | "human.mark";
314
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "net.detail" | "human.control" | "human.mark";
258
315
  t: number;
259
316
  sessionId: string;
260
317
  ref?: string | undefined;
318
+ seq?: number | undefined;
319
+ actionId?: string | undefined;
320
+ attribution?: "window" | undefined;
261
321
  data?: Record<string, unknown> | undefined;
262
322
  }>;
263
323
  }, "strip", z.ZodTypeAny, {
264
324
  event: {
265
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "route.change" | "console.log" | "console.warn" | "console.error" | "error.uncaught" | "visible.shown" | "visible.hidden" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "page.health" | "flow.recorded" | "transport.overflow" | "human.control" | "human.mark";
325
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "net.detail" | "human.control" | "human.mark";
266
326
  t: number;
267
327
  sessionId: string;
268
328
  data: Record<string, unknown>;
269
329
  ref?: string | undefined;
330
+ seq?: number | undefined;
331
+ actionId?: string | undefined;
332
+ attribution?: "window" | undefined;
270
333
  };
271
334
  kind: "event";
272
335
  }, {
273
336
  event: {
274
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "route.change" | "console.log" | "console.warn" | "console.error" | "error.uncaught" | "visible.shown" | "visible.hidden" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "page.health" | "flow.recorded" | "transport.overflow" | "human.control" | "human.mark";
337
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "net.detail" | "human.control" | "human.mark";
275
338
  t: number;
276
339
  sessionId: string;
277
340
  ref?: string | undefined;
341
+ seq?: number | undefined;
342
+ actionId?: string | undefined;
343
+ attribution?: "window" | undefined;
278
344
  data?: Record<string, unknown> | undefined;
279
345
  };
280
346
  kind: "event";
@@ -365,58 +431,94 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
365
431
  readonly DOM_TEXT: "dom.text";
366
432
  readonly NET_REQUEST: "net.request";
367
433
  readonly NET_PENDING: "net.pending";
434
+ readonly NET_STREAM: "net.stream";
435
+ readonly PERF: "perf";
368
436
  readonly ROUTE_CHANGE: "route.change";
369
437
  readonly CONSOLE_LOG: "console.log";
370
438
  readonly CONSOLE_WARN: "console.warn";
371
439
  readonly CONSOLE_ERROR: "console.error";
440
+ readonly CONSOLE_INFO: "console.info";
441
+ readonly CONSOLE_DEBUG: "console.debug";
372
442
  readonly ERROR_UNCAUGHT: "error.uncaught";
373
443
  readonly VISIBLE_SHOWN: "visible.shown";
374
- readonly VISIBLE_HIDDEN: "visible.hidden";
375
444
  readonly ANIM_START: "anim.start";
376
445
  readonly ANIM_END: "anim.end";
377
446
  readonly SCROLL_POSITION: "scroll.position";
378
447
  readonly REVEAL_SHOWN: "reveal.shown";
379
448
  readonly SIGNAL: "signal";
380
449
  readonly STATE_CHANGE: "state.change";
450
+ readonly STORAGE_CHANGE: "storage.change";
381
451
  readonly PAGE_HEALTH: "page.health";
452
+ readonly RENDER_COMMIT: "render.commit";
453
+ readonly FOCUS_CHANGE: "focus.change";
382
454
  readonly FLOW_RECORDED: "flow.recorded";
383
455
  readonly TRANSPORT_OVERFLOW: "transport.overflow";
456
+ readonly TRUNCATED: "truncated";
457
+ readonly BLIND_SPOT: "blind-spot";
458
+ readonly NET_DETAIL: "net.detail";
384
459
  readonly HUMAN_CONTROL: "human.control";
385
460
  readonly HUMAN_MARK: "human.mark";
386
461
  }>;
387
462
  sessionId: z.ZodString;
388
463
  /** Stable element reference this event concerns, when applicable (e.g. "e7"). */
389
464
  ref: z.ZodOptional<z.ZodString>;
465
+ /**
466
+ * Monotonic per-session sequence number stamped by the SDK. Gives events a total order independent
467
+ * of `t` (which can tie at millisecond resolution). Optional for back-compat with pre-2.2 SDKs.
468
+ */
469
+ seq: z.ZodOptional<z.ZodNumber>;
470
+ /**
471
+ * The action this event is attributed to, when one was active at observation time. Set together with
472
+ * `attribution` (the tier of that link). Optional: ambient events observed outside any action window
473
+ * carry neither.
474
+ */
475
+ actionId: z.ZodOptional<z.ZodString>;
476
+ /** How `actionId` was derived. Present iff `actionId` is. */
477
+ attribution: z.ZodOptional<z.ZodNativeEnum<{
478
+ readonly WINDOW: "window";
479
+ }>>;
390
480
  /** Event-type-specific payload. Kept open here; refined per observer at the edges. */
391
481
  data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
392
482
  }, "strip", z.ZodTypeAny, {
393
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "route.change" | "console.log" | "console.warn" | "console.error" | "error.uncaught" | "visible.shown" | "visible.hidden" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "page.health" | "flow.recorded" | "transport.overflow" | "human.control" | "human.mark";
483
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "net.detail" | "human.control" | "human.mark";
394
484
  t: number;
395
485
  sessionId: string;
396
486
  data: Record<string, unknown>;
397
487
  ref?: string | undefined;
488
+ seq?: number | undefined;
489
+ actionId?: string | undefined;
490
+ attribution?: "window" | undefined;
398
491
  }, {
399
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "route.change" | "console.log" | "console.warn" | "console.error" | "error.uncaught" | "visible.shown" | "visible.hidden" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "page.health" | "flow.recorded" | "transport.overflow" | "human.control" | "human.mark";
492
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "net.detail" | "human.control" | "human.mark";
400
493
  t: number;
401
494
  sessionId: string;
402
495
  ref?: string | undefined;
496
+ seq?: number | undefined;
497
+ actionId?: string | undefined;
498
+ attribution?: "window" | undefined;
403
499
  data?: Record<string, unknown> | undefined;
404
500
  }>;
405
501
  }, "strip", z.ZodTypeAny, {
406
502
  event: {
407
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "route.change" | "console.log" | "console.warn" | "console.error" | "error.uncaught" | "visible.shown" | "visible.hidden" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "page.health" | "flow.recorded" | "transport.overflow" | "human.control" | "human.mark";
503
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "net.detail" | "human.control" | "human.mark";
408
504
  t: number;
409
505
  sessionId: string;
410
506
  data: Record<string, unknown>;
411
507
  ref?: string | undefined;
508
+ seq?: number | undefined;
509
+ actionId?: string | undefined;
510
+ attribution?: "window" | undefined;
412
511
  };
413
512
  kind: "event";
414
513
  }, {
415
514
  event: {
416
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "route.change" | "console.log" | "console.warn" | "console.error" | "error.uncaught" | "visible.shown" | "visible.hidden" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "page.health" | "flow.recorded" | "transport.overflow" | "human.control" | "human.mark";
515
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "net.detail" | "human.control" | "human.mark";
417
516
  t: number;
418
517
  sessionId: string;
419
518
  ref?: string | undefined;
519
+ seq?: number | undefined;
520
+ actionId?: string | undefined;
521
+ attribution?: "window" | undefined;
420
522
  data?: Record<string, unknown> | undefined;
421
523
  };
422
524
  kind: "event";
@@ -1 +1 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB;;;GAGG;AACH,e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- import { EventType, RETICLE_PROTOCOL_VERSION, MessageKind, TRANSPORT_LIMITS } from './constants.js';
2
+ import { EventAttribution, EventType, RETICLE_PROTOCOL_VERSION, MessageKind, TRANSPORT_LIMITS, } from './constants.js';
3
3
  import { HumanControlKind, MarkAnchorStrategy } from './session-constants.js';
4
4
  const sessionIdSchema = z.string().min(1).max(TRANSPORT_LIMITS.MAX_SESSION_ID_LENGTH);
5
5
  const refSchema = z.string().max(TRANSPORT_LIMITS.MAX_REF_LENGTH);
@@ -40,7 +40,7 @@ export const HumanMarkDataSchema = z.object({
40
40
  /**
41
41
  * A normalized observation pushed from the browser into the ring buffer.
42
42
  * `t` is a monotonic millisecond timestamp relative to session start (clock injected,
43
- * never `Date.now()` inside pure logic — see plan engineering standards).
43
+ * never `Date.now` inside pure logic — see plan engineering standards).
44
44
  */
45
45
  export const ReticleEventSchema = z.object({
46
46
  t: z.number(),
@@ -48,6 +48,19 @@ export const ReticleEventSchema = z.object({
48
48
  sessionId: sessionIdSchema,
49
49
  /** Stable element reference this event concerns, when applicable (e.g. "e7"). */
50
50
  ref: refSchema.optional(),
51
+ /**
52
+ * Monotonic per-session sequence number stamped by the SDK. Gives events a total order independent
53
+ * of `t` (which can tie at millisecond resolution). Optional for back-compat with pre-2.2 SDKs.
54
+ */
55
+ seq: z.number().int().min(0).optional(),
56
+ /**
57
+ * The action this event is attributed to, when one was active at observation time. Set together with
58
+ * `attribution` (the tier of that link). Optional: ambient events observed outside any action window
59
+ * carry neither.
60
+ */
61
+ actionId: refSchema.optional(),
62
+ /** How `actionId` was derived. Present iff `actionId` is. */
63
+ attribution: z.nativeEnum(EventAttribution).optional(),
51
64
  /** Event-type-specific payload. Kept open here; refined per observer at the edges. */
52
65
  data: z.record(z.unknown()).default({}),
53
66
  });
@@ -1 +1 @@
1
- {"version":3,"file":"messages.js","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,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@@
5
5
  /**
6
6
  * Tone of a PRESENTER push, rides the command as optional `tone`. Lets the panel tell apart the ways
7
7
  * a session can stop, so the human on the browser always knows the agent's mode:
8
- * calm — a normal, human/agent-driven end ("done").
9
- * waiting — the agent finished its turn / went idle; it will resume on your next message.
10
- * ask — the agent is blocked and needs your input to continue (carries the question as text).
11
- * warn — the agent stopped unexpectedly (crashed / disconnected) — switch to your terminal.
8
+ * calm — a normal, human/agent-driven end ("done").
9
+ * waiting — the agent finished its turn / went idle; it will resume on your next message.
10
+ * ask — the agent is blocked and needs your input to continue (carries the question as text).
11
+ * warn — the agent stopped unexpectedly (crashed / disconnected) — switch to your terminal.
12
12
  */
13
13
  export declare const PresenterTone: {
14
14
  readonly CALM: "calm";
package/dist/notices.js CHANGED
@@ -5,10 +5,10 @@
5
5
  /**
6
6
  * Tone of a PRESENTER push, rides the command as optional `tone`. Lets the panel tell apart the ways
7
7
  * a session can stop, so the human on the browser always knows the agent's mode:
8
- * calm — a normal, human/agent-driven end ("done").
9
- * waiting — the agent finished its turn / went idle; it will resume on your next message.
10
- * ask — the agent is blocked and needs your input to continue (carries the question as text).
11
- * warn — the agent stopped unexpectedly (crashed / disconnected) — switch to your terminal.
8
+ * calm — a normal, human/agent-driven end ("done").
9
+ * waiting — the agent finished its turn / went idle; it will resume on your next message.
10
+ * ask — the agent is blocked and needs your input to continue (carries the question as text).
11
+ * warn — the agent stopped unexpectedly (crashed / disconnected) — switch to your terminal.
12
12
  */
13
13
  export const PresenterTone = {
14
14
  CALM: 'calm',
@@ -0,0 +1,4 @@
1
+ export declare function isSensitiveKey(key: string): boolean;
2
+ /** Redact high-confidence secret shapes anywhere in a text/value, independent of any surrounding key. */
3
+ export declare function scrubKnownSecrets(text: string): string;
4
+ //# sourceMappingURL=redaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redaction.d.ts","sourceRoot":"","sources":["../src/redaction.ts"],"names":[],"mappings":"AAuBA,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEnD;AASD,yGAAyG;AACzG,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtD"}
@@ -0,0 +1,33 @@
1
+ import { REDACTED_VALUE } from './constants.js';
2
+ /**
3
+ * Wire redaction rules — which field names carry credentials, and which VALUE shapes are secrets
4
+ * regardless of the field they sit in.
5
+ *
6
+ * These live in core because they are a property of the wire, not of one side of it. They were
7
+ * implemented in the browser SDK, which was the only consumer until the driven path began capturing
8
+ * request bodies straight from the network stack — those are raw and unscrubbed, and duplicating a
9
+ * security regex to redact them would be the worst possible place to have two copies drift.
10
+ */
11
+ // `token` must match auth CREDENTIALS, not compound design fields. Bare/separated `token(s)` and
12
+ // auth-prefixed tokens (accessToken, auth_token, sessionToken, …) are redacted; `colorToken`,
13
+ // `backgroundToken`, `tokenCount`, `designToken` are NOT — they were false-positives that redacted
14
+ // legitimate reticle_inspect/reticle_state output.
15
+ // `token` must match auth CREDENTIALS, not compound design fields (see note above). `cookie` is
16
+ // boundary-anchored the same way: it targets the `Cookie` / `Set-Cookie` HTTP HEADER names (which
17
+ // bundle the session credential and were the one wire payload reaching the journal + the agent
18
+ // unredacted), NOT any key that merely contains the substring — `scopecookie`, `cookieConsent`,
19
+ // `cookiePolicy` are legitimate app values an agent may need to read, and stay visible.
20
+ const SENSITIVE_KEY = /password|passwd|passcode|secret|(?:(?:access|refresh|auth|bearer|api|id|session|csrf|client)[-_]?tokens?|(?:^|[-_])tokens?(?=$|[-_]))|session[-_]?id|(?:^|[-_])(?:sid|pwd|jwt)(?=$|[-_])|authorization|(?:^|[-_])(?:set[-_])?cookie(?=$|[-_])|api[-_]?key|access[-_]?key|private[-_]?key|client[-_]?secret|credit[-_]?card|card[-_]?number|cvv|cvc|ssn/i;
21
+ export function isSensitiveKey(key) {
22
+ return SENSITIVE_KEY.test(key);
23
+ }
24
+ // High-confidence credential SHAPES, redacted regardless of key name — for scanning body/value text where
25
+ // a secret can sit under a benign key (`{"note":"<jwt>"}`, `<meta content="sk_live_…">`). Deliberately
26
+ // narrow (JWT, known provider prefixes) so it never corrupts legitimate prose the way a broad
27
+ // entropy/length heuristic would.
28
+ const KNOWN_SECRET = /eyJ[A-Za-z0-9_-]{4,}\.[A-Za-z0-9_-]{4,}\.[A-Za-z0-9_-]{4,}|(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{10,}|AKIA[0-9A-Z]{16}|gh[pousr]_[A-Za-z0-9]{20,}|xox[baprs]-[A-Za-z0-9-]{10,}|ya29\.[A-Za-z0-9._-]{20,}/g;
29
+ /** Redact high-confidence secret shapes anywhere in a text/value, independent of any surrounding key. */
30
+ export function scrubKnownSecrets(text) {
31
+ return text.replace(KNOWN_SECRET, REDACTED_VALUE);
32
+ }
33
+ //# sourceMappingURL=redaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redaction.js","sourceRoot":"","sources":["../src/redaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD;;;;;;;;GAQG;AACH,iGAAiG;AACjG,8FAA8F;AAC9F,mGAAmG;AACnG,mDAAmD;AACnD,gGAAgG;AAChG,kGAAkG;AAClG,+FAA+F;AAC/F,gGAAgG;AAChG,wFAAwF;AACxF,MAAM,aAAa,GACjB,yVAAyV,CAAC;AAE5V,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,OAAO,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACjC,CAAC;AAED,0GAA0G;AAC1G,uGAAuG;AACvG,8FAA8F;AAC9F,kCAAkC;AAClC,MAAM,YAAY,GAChB,yMAAyM,CAAC;AAE5M,yGAAyG;AACzG,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;AACpD,CAAC"}