@reticlehq/core 2.1.0 → 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 (65) 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/constants.d.ts +140 -5
  8. package/dist/constants.d.ts.map +1 -1
  9. package/dist/constants.js +136 -5
  10. package/dist/constants.js.map +1 -1
  11. package/dist/daemon-registry.d.ts +5 -5
  12. package/dist/daemon-registry.d.ts.map +1 -1
  13. package/dist/daemon-registry.js +5 -5
  14. package/dist/daemon-registry.js.map +1 -1
  15. package/dist/event-payloads.d.ts +502 -0
  16. package/dist/event-payloads.d.ts.map +1 -0
  17. package/dist/event-payloads.js +138 -0
  18. package/dist/event-payloads.js.map +1 -0
  19. package/dist/flow-constants.d.ts +2 -2
  20. package/dist/flow-constants.js +7 -7
  21. package/dist/flow-constants.js.map +1 -1
  22. package/dist/flow-types.d.ts +155 -32
  23. package/dist/flow-types.d.ts.map +1 -1
  24. package/dist/flow-types.js +23 -1
  25. package/dist/flow-types.js.map +1 -1
  26. package/dist/index.d.ts +19 -7
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +26 -12
  29. package/dist/index.js.map +1 -1
  30. package/dist/journal.d.ts +90 -0
  31. package/dist/journal.d.ts.map +1 -0
  32. package/dist/journal.js +38 -0
  33. package/dist/journal.js.map +1 -0
  34. package/dist/messages.d.ts +112 -16
  35. package/dist/messages.d.ts.map +1 -1
  36. package/dist/messages.js +15 -2
  37. package/dist/messages.js.map +1 -1
  38. package/dist/notices.d.ts +4 -4
  39. package/dist/notices.js +4 -4
  40. package/dist/redaction.d.ts +4 -0
  41. package/dist/redaction.d.ts.map +1 -0
  42. package/dist/redaction.js +33 -0
  43. package/dist/redaction.js.map +1 -0
  44. package/dist/schema/event-message.json +21 -1
  45. package/dist/schema/event-type.json +8 -1
  46. package/dist/schema/reticle-event.json +21 -1
  47. package/dist/schema/reticle-message.json +21 -1
  48. package/dist/session-constants.d.ts +2 -2
  49. package/dist/session-constants.js +2 -2
  50. package/dist/state-select.d.ts.map +1 -1
  51. package/dist/state-select.js +21 -5
  52. package/dist/state-select.js.map +1 -1
  53. package/dist/toon.d.ts +10 -10
  54. package/dist/toon.d.ts.map +1 -1
  55. package/dist/toon.js +34 -18
  56. package/dist/toon.js.map +1 -1
  57. package/dist/types.d.ts +70 -12
  58. package/dist/types.d.ts.map +1 -1
  59. package/dist/types.js +5 -0
  60. package/dist/types.js.map +1 -1
  61. package/dist/upgrade.d.ts +5 -5
  62. package/dist/upgrade.js +3 -3
  63. package/dist/verification-run.d.ts +23 -23
  64. package/dist/verification-run.js +1 -1
  65. 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,oBAAoB,CAAC;IAClC,4FAA4F;IAC5F,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,gBAAgB,CAAC,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odObject<{
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;
@@ -96,37 +96,65 @@ export declare const ReticleEventSchema: z.ZodObject<{
96
96
  readonly CONSOLE_LOG: "console.log";
97
97
  readonly CONSOLE_WARN: "console.warn";
98
98
  readonly CONSOLE_ERROR: "console.error";
99
+ readonly CONSOLE_INFO: "console.info";
100
+ readonly CONSOLE_DEBUG: "console.debug";
99
101
  readonly ERROR_UNCAUGHT: "error.uncaught";
100
102
  readonly VISIBLE_SHOWN: "visible.shown";
101
- readonly VISIBLE_HIDDEN: "visible.hidden";
102
103
  readonly ANIM_START: "anim.start";
103
104
  readonly ANIM_END: "anim.end";
104
105
  readonly SCROLL_POSITION: "scroll.position";
105
106
  readonly REVEAL_SHOWN: "reveal.shown";
106
107
  readonly SIGNAL: "signal";
107
108
  readonly STATE_CHANGE: "state.change";
109
+ readonly STORAGE_CHANGE: "storage.change";
108
110
  readonly PAGE_HEALTH: "page.health";
111
+ readonly RENDER_COMMIT: "render.commit";
112
+ readonly FOCUS_CHANGE: "focus.change";
109
113
  readonly FLOW_RECORDED: "flow.recorded";
110
114
  readonly TRANSPORT_OVERFLOW: "transport.overflow";
115
+ readonly TRUNCATED: "truncated";
116
+ readonly BLIND_SPOT: "blind-spot";
117
+ readonly NET_DETAIL: "net.detail";
111
118
  readonly HUMAN_CONTROL: "human.control";
112
119
  readonly HUMAN_MARK: "human.mark";
113
120
  }>;
114
121
  sessionId: z.ZodString;
115
122
  /** Stable element reference this event concerns, when applicable (e.g. "e7"). */
116
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
+ }>>;
117
139
  /** Event-type-specific payload. Kept open here; refined per observer at the edges. */
118
140
  data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
119
141
  }, "strip", z.ZodTypeAny, {
120
- 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" | "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";
121
143
  t: number;
122
144
  sessionId: string;
123
145
  data: Record<string, unknown>;
124
146
  ref?: string | undefined;
147
+ seq?: number | undefined;
148
+ actionId?: string | undefined;
149
+ attribution?: "window" | undefined;
125
150
  }, {
126
- 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" | "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";
127
152
  t: number;
128
153
  sessionId: string;
129
154
  ref?: string | undefined;
155
+ seq?: number | undefined;
156
+ actionId?: string | undefined;
157
+ attribution?: "window" | undefined;
130
158
  data?: Record<string, unknown> | undefined;
131
159
  }>;
132
160
  export type ReticleEvent = z.infer<typeof ReticleEventSchema>;
@@ -231,54 +259,88 @@ export declare const EventMessageSchema: z.ZodObject<{
231
259
  readonly CONSOLE_LOG: "console.log";
232
260
  readonly CONSOLE_WARN: "console.warn";
233
261
  readonly CONSOLE_ERROR: "console.error";
262
+ readonly CONSOLE_INFO: "console.info";
263
+ readonly CONSOLE_DEBUG: "console.debug";
234
264
  readonly ERROR_UNCAUGHT: "error.uncaught";
235
265
  readonly VISIBLE_SHOWN: "visible.shown";
236
- readonly VISIBLE_HIDDEN: "visible.hidden";
237
266
  readonly ANIM_START: "anim.start";
238
267
  readonly ANIM_END: "anim.end";
239
268
  readonly SCROLL_POSITION: "scroll.position";
240
269
  readonly REVEAL_SHOWN: "reveal.shown";
241
270
  readonly SIGNAL: "signal";
242
271
  readonly STATE_CHANGE: "state.change";
272
+ readonly STORAGE_CHANGE: "storage.change";
243
273
  readonly PAGE_HEALTH: "page.health";
274
+ readonly RENDER_COMMIT: "render.commit";
275
+ readonly FOCUS_CHANGE: "focus.change";
244
276
  readonly FLOW_RECORDED: "flow.recorded";
245
277
  readonly TRANSPORT_OVERFLOW: "transport.overflow";
278
+ readonly TRUNCATED: "truncated";
279
+ readonly BLIND_SPOT: "blind-spot";
280
+ readonly NET_DETAIL: "net.detail";
246
281
  readonly HUMAN_CONTROL: "human.control";
247
282
  readonly HUMAN_MARK: "human.mark";
248
283
  }>;
249
284
  sessionId: z.ZodString;
250
285
  /** Stable element reference this event concerns, when applicable (e.g. "e7"). */
251
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
+ }>>;
252
302
  /** Event-type-specific payload. Kept open here; refined per observer at the edges. */
253
303
  data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
254
304
  }, "strip", z.ZodTypeAny, {
255
- 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" | "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";
256
306
  t: number;
257
307
  sessionId: string;
258
308
  data: Record<string, unknown>;
259
309
  ref?: string | undefined;
310
+ seq?: number | undefined;
311
+ actionId?: string | undefined;
312
+ attribution?: "window" | undefined;
260
313
  }, {
261
- 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" | "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";
262
315
  t: number;
263
316
  sessionId: string;
264
317
  ref?: string | undefined;
318
+ seq?: number | undefined;
319
+ actionId?: string | undefined;
320
+ attribution?: "window" | undefined;
265
321
  data?: Record<string, unknown> | undefined;
266
322
  }>;
267
323
  }, "strip", z.ZodTypeAny, {
268
324
  event: {
269
- 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" | "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";
270
326
  t: number;
271
327
  sessionId: string;
272
328
  data: Record<string, unknown>;
273
329
  ref?: string | undefined;
330
+ seq?: number | undefined;
331
+ actionId?: string | undefined;
332
+ attribution?: "window" | undefined;
274
333
  };
275
334
  kind: "event";
276
335
  }, {
277
336
  event: {
278
- 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" | "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";
279
338
  t: number;
280
339
  sessionId: string;
281
340
  ref?: string | undefined;
341
+ seq?: number | undefined;
342
+ actionId?: string | undefined;
343
+ attribution?: "window" | undefined;
282
344
  data?: Record<string, unknown> | undefined;
283
345
  };
284
346
  kind: "event";
@@ -375,54 +437,88 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
375
437
  readonly CONSOLE_LOG: "console.log";
376
438
  readonly CONSOLE_WARN: "console.warn";
377
439
  readonly CONSOLE_ERROR: "console.error";
440
+ readonly CONSOLE_INFO: "console.info";
441
+ readonly CONSOLE_DEBUG: "console.debug";
378
442
  readonly ERROR_UNCAUGHT: "error.uncaught";
379
443
  readonly VISIBLE_SHOWN: "visible.shown";
380
- readonly VISIBLE_HIDDEN: "visible.hidden";
381
444
  readonly ANIM_START: "anim.start";
382
445
  readonly ANIM_END: "anim.end";
383
446
  readonly SCROLL_POSITION: "scroll.position";
384
447
  readonly REVEAL_SHOWN: "reveal.shown";
385
448
  readonly SIGNAL: "signal";
386
449
  readonly STATE_CHANGE: "state.change";
450
+ readonly STORAGE_CHANGE: "storage.change";
387
451
  readonly PAGE_HEALTH: "page.health";
452
+ readonly RENDER_COMMIT: "render.commit";
453
+ readonly FOCUS_CHANGE: "focus.change";
388
454
  readonly FLOW_RECORDED: "flow.recorded";
389
455
  readonly TRANSPORT_OVERFLOW: "transport.overflow";
456
+ readonly TRUNCATED: "truncated";
457
+ readonly BLIND_SPOT: "blind-spot";
458
+ readonly NET_DETAIL: "net.detail";
390
459
  readonly HUMAN_CONTROL: "human.control";
391
460
  readonly HUMAN_MARK: "human.mark";
392
461
  }>;
393
462
  sessionId: z.ZodString;
394
463
  /** Stable element reference this event concerns, when applicable (e.g. "e7"). */
395
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
+ }>>;
396
480
  /** Event-type-specific payload. Kept open here; refined per observer at the edges. */
397
481
  data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
398
482
  }, "strip", z.ZodTypeAny, {
399
- 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" | "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";
400
484
  t: number;
401
485
  sessionId: string;
402
486
  data: Record<string, unknown>;
403
487
  ref?: string | undefined;
488
+ seq?: number | undefined;
489
+ actionId?: string | undefined;
490
+ attribution?: "window" | undefined;
404
491
  }, {
405
- 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" | "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";
406
493
  t: number;
407
494
  sessionId: string;
408
495
  ref?: string | undefined;
496
+ seq?: number | undefined;
497
+ actionId?: string | undefined;
498
+ attribution?: "window" | undefined;
409
499
  data?: Record<string, unknown> | undefined;
410
500
  }>;
411
501
  }, "strip", z.ZodTypeAny, {
412
502
  event: {
413
- 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" | "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";
414
504
  t: number;
415
505
  sessionId: string;
416
506
  data: Record<string, unknown>;
417
507
  ref?: string | undefined;
508
+ seq?: number | undefined;
509
+ actionId?: string | undefined;
510
+ attribution?: "window" | undefined;
418
511
  };
419
512
  kind: "event";
420
513
  }, {
421
514
  event: {
422
- 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" | "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";
423
516
  t: number;
424
517
  sessionId: string;
425
518
  ref?: string | undefined;
519
+ seq?: number | undefined;
520
+ actionId?: string | undefined;
521
+ attribution?: "window" | undefined;
426
522
  data?: Record<string, unknown> | undefined;
427
523
  };
428
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,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;EAGjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;IAI9B,uGAAuG;;IAEvG,mFAAmF;;;;;;;;;;;IAOnF,8EAA8E;;;;;;;;;;;;;;;;;;;;;;EAE9E,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAI7B,iFAAiF;;IAEjF,sFAA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OAAO,mBAAmB,CAAC,CAAC;AAEhE,8CAA8C;AAC9C,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAjE7B,iFAAiF;;QAEjF;;;WAGG;;QAEH;;;;WAIG;;QAEH,6DAA6D;;;;QAE7D,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqDtF,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,oBAAoB;;;;;;IA5C/B;;;;;OAKG;;;IAKH,sFAAsF;;IAEtF,+EAA+E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAvC/E,iFAAiF;;QAEjF;;;WAGG;;QAEH;;;;WAIG;;QAEH,6DAA6D;;;;QAE7D,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6DtF,CAAC"}
package/dist/messages.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- 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,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACpG,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE9E,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;AACtF,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;AAElE;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C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O,CAAC,WAAW,CAAC,cAAc,CAAC;IAC3C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,gBAAgB,CAAC,qBAAqB,CAAC;IACjE,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE;IACf,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC9B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC,QAAQ,EAAE;CACpE,CAAC,CAAC;AAGH,8CAA8C;AAC9C,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC;IAClC,KAAK,EAAE,kBAAkB;CAC1B,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC/D,kBAAkB;IAClB,oBAAoB;IACpB,mBAAmB;IACnB,kBAAkB;CACnB,CAAC,CAAC"}
package/dist/notices.d.ts 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 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"}