@reticlehq/core 2.11.0 → 2.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants.d.ts +22 -0
- package/dist/constants.js +23 -1
- package/dist/document-identity.d.ts +39 -0
- package/dist/document-identity.js +53 -0
- package/dist/edit-epoch.d.ts +36 -0
- package/dist/edit-epoch.js +40 -0
- package/dist/event-payloads.d.ts +18 -4
- package/dist/event-payloads.js +11 -1
- package/dist/findings.d.ts +62 -0
- package/dist/findings.js +75 -0
- package/dist/flow-types.d.ts +70 -0
- package/dist/flow-types.js +22 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/instrumentation-gap.d.ts +59 -1
- package/dist/instrumentation-gap.js +0 -0
- package/dist/intent.d.ts +332 -0
- package/dist/intent.js +133 -0
- package/dist/journal.d.ts +33 -0
- package/dist/journal.js +20 -0
- package/dist/messages.d.ts +84 -10
- package/dist/messages.js +20 -0
- package/dist/notices.d.ts +5 -3
- package/dist/notices.js +5 -3
- package/dist/run-context.d.ts +122 -0
- package/dist/run-context.js +118 -0
- package/dist/schema/event-message.json +10 -0
- package/dist/schema/event-type.json +1 -0
- package/dist/schema/reticle-event.json +10 -0
- package/dist/schema/reticle-message.json +10 -0
- package/dist/security.js +17 -1
- package/dist/source-constants.cjs +9 -0
- package/dist/source-constants.d.cts +4 -0
- package/dist/telemetry-session.d.ts +2 -2
- package/dist/telemetry.d.ts +4 -4
- package/dist/unreachable-notice.d.ts +19 -0
- package/dist/unreachable-notice.js +26 -0
- package/package.json +6 -2
package/dist/messages.d.ts
CHANGED
|
@@ -108,6 +108,7 @@ export declare const ReticleEventSchema: z.ZodObject<{
|
|
|
108
108
|
readonly STATE_CHANGE: "state.change";
|
|
109
109
|
readonly STORAGE_CHANGE: "storage.change";
|
|
110
110
|
readonly PAGE_HEALTH: "page.health";
|
|
111
|
+
readonly CONTEXT_OPENED: "context.opened";
|
|
111
112
|
readonly RENDER_COMMIT: "render.commit";
|
|
112
113
|
readonly FOCUS_CHANGE: "focus.change";
|
|
113
114
|
readonly FLOW_RECORDED: "flow.recorded";
|
|
@@ -138,10 +139,27 @@ export declare const ReticleEventSchema: z.ZodObject<{
|
|
|
138
139
|
attribution: z.ZodOptional<z.ZodNativeEnum<{
|
|
139
140
|
readonly WINDOW: "window";
|
|
140
141
|
}>>;
|
|
142
|
+
/**
|
|
143
|
+
* The document this was observed under. Minted once per real document; a full navigation replaces
|
|
144
|
+
* both. Lets evidence from a superseded document be excluded rather than counted against an action
|
|
145
|
+
* taken now. Optional for back-compat with SDKs that predate it, which is why absence is read as
|
|
146
|
+
* "current" rather than "foreign" — see `isSameDocument`.
|
|
147
|
+
*/
|
|
148
|
+
documentId: z.ZodOptional<z.ZodString>;
|
|
149
|
+
/**
|
|
150
|
+
* The round of source edits this was observed under — a counter the SDK advances once per applied
|
|
151
|
+
* hot update. A hot update replaces modules and re-renders INSIDE the same document, so
|
|
152
|
+
* `documentId` cannot see it; this is the edit-shaped half of the same question.
|
|
153
|
+
*
|
|
154
|
+
* Optional, and absent while nothing has hot-updated, which is why absence is read as "current"
|
|
155
|
+
* rather than "foreign" — see `isSameEditEpoch`. Most pages have no channel that could report an
|
|
156
|
+
* update at all, so a stamp of `NO_EDITS_OBSERVED` would be wire spent on the word "unknown".
|
|
157
|
+
*/
|
|
158
|
+
editEpoch: z.ZodOptional<z.ZodNumber>;
|
|
141
159
|
/** Event-type-specific payload. Kept open here; refined per observer at the edges. */
|
|
142
160
|
data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
143
161
|
}, "strip", z.ZodTypeAny, {
|
|
144
|
-
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" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
162
|
+
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" | "context.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
145
163
|
t: number;
|
|
146
164
|
sessionId: string;
|
|
147
165
|
data: Record<string, unknown>;
|
|
@@ -149,14 +167,18 @@ export declare const ReticleEventSchema: z.ZodObject<{
|
|
|
149
167
|
seq?: number | undefined;
|
|
150
168
|
actionId?: string | undefined;
|
|
151
169
|
attribution?: "window" | undefined;
|
|
170
|
+
documentId?: string | undefined;
|
|
171
|
+
editEpoch?: number | undefined;
|
|
152
172
|
}, {
|
|
153
|
-
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" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
173
|
+
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" | "context.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
154
174
|
t: number;
|
|
155
175
|
sessionId: string;
|
|
156
176
|
ref?: string | undefined;
|
|
157
177
|
seq?: number | undefined;
|
|
158
178
|
actionId?: string | undefined;
|
|
159
179
|
attribution?: "window" | undefined;
|
|
180
|
+
documentId?: string | undefined;
|
|
181
|
+
editEpoch?: number | undefined;
|
|
160
182
|
data?: Record<string, unknown> | undefined;
|
|
161
183
|
}>;
|
|
162
184
|
export type ReticleEvent = z.infer<typeof ReticleEventSchema>;
|
|
@@ -309,6 +331,7 @@ export declare const EventMessageSchema: z.ZodObject<{
|
|
|
309
331
|
readonly STATE_CHANGE: "state.change";
|
|
310
332
|
readonly STORAGE_CHANGE: "storage.change";
|
|
311
333
|
readonly PAGE_HEALTH: "page.health";
|
|
334
|
+
readonly CONTEXT_OPENED: "context.opened";
|
|
312
335
|
readonly RENDER_COMMIT: "render.commit";
|
|
313
336
|
readonly FOCUS_CHANGE: "focus.change";
|
|
314
337
|
readonly FLOW_RECORDED: "flow.recorded";
|
|
@@ -339,10 +362,27 @@ export declare const EventMessageSchema: z.ZodObject<{
|
|
|
339
362
|
attribution: z.ZodOptional<z.ZodNativeEnum<{
|
|
340
363
|
readonly WINDOW: "window";
|
|
341
364
|
}>>;
|
|
365
|
+
/**
|
|
366
|
+
* The document this was observed under. Minted once per real document; a full navigation replaces
|
|
367
|
+
* both. Lets evidence from a superseded document be excluded rather than counted against an action
|
|
368
|
+
* taken now. Optional for back-compat with SDKs that predate it, which is why absence is read as
|
|
369
|
+
* "current" rather than "foreign" — see `isSameDocument`.
|
|
370
|
+
*/
|
|
371
|
+
documentId: z.ZodOptional<z.ZodString>;
|
|
372
|
+
/**
|
|
373
|
+
* The round of source edits this was observed under — a counter the SDK advances once per applied
|
|
374
|
+
* hot update. A hot update replaces modules and re-renders INSIDE the same document, so
|
|
375
|
+
* `documentId` cannot see it; this is the edit-shaped half of the same question.
|
|
376
|
+
*
|
|
377
|
+
* Optional, and absent while nothing has hot-updated, which is why absence is read as "current"
|
|
378
|
+
* rather than "foreign" — see `isSameEditEpoch`. Most pages have no channel that could report an
|
|
379
|
+
* update at all, so a stamp of `NO_EDITS_OBSERVED` would be wire spent on the word "unknown".
|
|
380
|
+
*/
|
|
381
|
+
editEpoch: z.ZodOptional<z.ZodNumber>;
|
|
342
382
|
/** Event-type-specific payload. Kept open here; refined per observer at the edges. */
|
|
343
383
|
data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
344
384
|
}, "strip", z.ZodTypeAny, {
|
|
345
|
-
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" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
385
|
+
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" | "context.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
346
386
|
t: number;
|
|
347
387
|
sessionId: string;
|
|
348
388
|
data: Record<string, unknown>;
|
|
@@ -350,19 +390,23 @@ export declare const EventMessageSchema: z.ZodObject<{
|
|
|
350
390
|
seq?: number | undefined;
|
|
351
391
|
actionId?: string | undefined;
|
|
352
392
|
attribution?: "window" | undefined;
|
|
393
|
+
documentId?: string | undefined;
|
|
394
|
+
editEpoch?: number | undefined;
|
|
353
395
|
}, {
|
|
354
|
-
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" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
396
|
+
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" | "context.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
355
397
|
t: number;
|
|
356
398
|
sessionId: string;
|
|
357
399
|
ref?: string | undefined;
|
|
358
400
|
seq?: number | undefined;
|
|
359
401
|
actionId?: string | undefined;
|
|
360
402
|
attribution?: "window" | undefined;
|
|
403
|
+
documentId?: string | undefined;
|
|
404
|
+
editEpoch?: number | undefined;
|
|
361
405
|
data?: Record<string, unknown> | undefined;
|
|
362
406
|
}>;
|
|
363
407
|
}, "strip", z.ZodTypeAny, {
|
|
364
408
|
event: {
|
|
365
|
-
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" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
409
|
+
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" | "context.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
366
410
|
t: number;
|
|
367
411
|
sessionId: string;
|
|
368
412
|
data: Record<string, unknown>;
|
|
@@ -370,17 +414,21 @@ export declare const EventMessageSchema: z.ZodObject<{
|
|
|
370
414
|
seq?: number | undefined;
|
|
371
415
|
actionId?: string | undefined;
|
|
372
416
|
attribution?: "window" | undefined;
|
|
417
|
+
documentId?: string | undefined;
|
|
418
|
+
editEpoch?: number | undefined;
|
|
373
419
|
};
|
|
374
420
|
kind: "event";
|
|
375
421
|
}, {
|
|
376
422
|
event: {
|
|
377
|
-
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" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
423
|
+
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" | "context.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
378
424
|
t: number;
|
|
379
425
|
sessionId: string;
|
|
380
426
|
ref?: string | undefined;
|
|
381
427
|
seq?: number | undefined;
|
|
382
428
|
actionId?: string | undefined;
|
|
383
429
|
attribution?: "window" | undefined;
|
|
430
|
+
documentId?: string | undefined;
|
|
431
|
+
editEpoch?: number | undefined;
|
|
384
432
|
data?: Record<string, unknown> | undefined;
|
|
385
433
|
};
|
|
386
434
|
kind: "event";
|
|
@@ -525,6 +573,7 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
|
|
|
525
573
|
readonly STATE_CHANGE: "state.change";
|
|
526
574
|
readonly STORAGE_CHANGE: "storage.change";
|
|
527
575
|
readonly PAGE_HEALTH: "page.health";
|
|
576
|
+
readonly CONTEXT_OPENED: "context.opened";
|
|
528
577
|
readonly RENDER_COMMIT: "render.commit";
|
|
529
578
|
readonly FOCUS_CHANGE: "focus.change";
|
|
530
579
|
readonly FLOW_RECORDED: "flow.recorded";
|
|
@@ -555,10 +604,27 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
|
|
|
555
604
|
attribution: z.ZodOptional<z.ZodNativeEnum<{
|
|
556
605
|
readonly WINDOW: "window";
|
|
557
606
|
}>>;
|
|
607
|
+
/**
|
|
608
|
+
* The document this was observed under. Minted once per real document; a full navigation replaces
|
|
609
|
+
* both. Lets evidence from a superseded document be excluded rather than counted against an action
|
|
610
|
+
* taken now. Optional for back-compat with SDKs that predate it, which is why absence is read as
|
|
611
|
+
* "current" rather than "foreign" — see `isSameDocument`.
|
|
612
|
+
*/
|
|
613
|
+
documentId: z.ZodOptional<z.ZodString>;
|
|
614
|
+
/**
|
|
615
|
+
* The round of source edits this was observed under — a counter the SDK advances once per applied
|
|
616
|
+
* hot update. A hot update replaces modules and re-renders INSIDE the same document, so
|
|
617
|
+
* `documentId` cannot see it; this is the edit-shaped half of the same question.
|
|
618
|
+
*
|
|
619
|
+
* Optional, and absent while nothing has hot-updated, which is why absence is read as "current"
|
|
620
|
+
* rather than "foreign" — see `isSameEditEpoch`. Most pages have no channel that could report an
|
|
621
|
+
* update at all, so a stamp of `NO_EDITS_OBSERVED` would be wire spent on the word "unknown".
|
|
622
|
+
*/
|
|
623
|
+
editEpoch: z.ZodOptional<z.ZodNumber>;
|
|
558
624
|
/** Event-type-specific payload. Kept open here; refined per observer at the edges. */
|
|
559
625
|
data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
560
626
|
}, "strip", z.ZodTypeAny, {
|
|
561
|
-
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" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
627
|
+
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" | "context.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
562
628
|
t: number;
|
|
563
629
|
sessionId: string;
|
|
564
630
|
data: Record<string, unknown>;
|
|
@@ -566,19 +632,23 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
|
|
|
566
632
|
seq?: number | undefined;
|
|
567
633
|
actionId?: string | undefined;
|
|
568
634
|
attribution?: "window" | undefined;
|
|
635
|
+
documentId?: string | undefined;
|
|
636
|
+
editEpoch?: number | undefined;
|
|
569
637
|
}, {
|
|
570
|
-
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" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
638
|
+
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" | "context.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
571
639
|
t: number;
|
|
572
640
|
sessionId: string;
|
|
573
641
|
ref?: string | undefined;
|
|
574
642
|
seq?: number | undefined;
|
|
575
643
|
actionId?: string | undefined;
|
|
576
644
|
attribution?: "window" | undefined;
|
|
645
|
+
documentId?: string | undefined;
|
|
646
|
+
editEpoch?: number | undefined;
|
|
577
647
|
data?: Record<string, unknown> | undefined;
|
|
578
648
|
}>;
|
|
579
649
|
}, "strip", z.ZodTypeAny, {
|
|
580
650
|
event: {
|
|
581
|
-
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" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
651
|
+
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" | "context.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
582
652
|
t: number;
|
|
583
653
|
sessionId: string;
|
|
584
654
|
data: Record<string, unknown>;
|
|
@@ -586,17 +656,21 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
|
|
|
586
656
|
seq?: number | undefined;
|
|
587
657
|
actionId?: string | undefined;
|
|
588
658
|
attribution?: "window" | undefined;
|
|
659
|
+
documentId?: string | undefined;
|
|
660
|
+
editEpoch?: number | undefined;
|
|
589
661
|
};
|
|
590
662
|
kind: "event";
|
|
591
663
|
}, {
|
|
592
664
|
event: {
|
|
593
|
-
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" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
665
|
+
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" | "context.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
594
666
|
t: number;
|
|
595
667
|
sessionId: string;
|
|
596
668
|
ref?: string | undefined;
|
|
597
669
|
seq?: number | undefined;
|
|
598
670
|
actionId?: string | undefined;
|
|
599
671
|
attribution?: "window" | undefined;
|
|
672
|
+
documentId?: string | undefined;
|
|
673
|
+
editEpoch?: number | undefined;
|
|
600
674
|
data?: Record<string, unknown> | undefined;
|
|
601
675
|
};
|
|
602
676
|
kind: "event";
|
package/dist/messages.js
CHANGED
|
@@ -2,8 +2,11 @@ import { z } from 'zod';
|
|
|
2
2
|
import { EventAttribution, EventType, RETICLE_PROTOCOL_VERSION, MessageKind, TRANSPORT_LIMITS, } from './constants.js';
|
|
3
3
|
import { HumanControlKind, MarkAnchorStrategy } from './session-constants.js';
|
|
4
4
|
import { MAX_WIRE_REDACT_KEYS, MAX_WIRE_REDACT_KEY_LENGTH } from './redaction.js';
|
|
5
|
+
import { DOCUMENT_ID_LENGTH } from './document-identity.js';
|
|
6
|
+
import { NO_EDITS_OBSERVED } from './edit-epoch.js';
|
|
5
7
|
const sessionIdSchema = z.string().min(1).max(TRANSPORT_LIMITS.MAX_SESSION_ID_LENGTH);
|
|
6
8
|
const refSchema = z.string().max(TRANSPORT_LIMITS.MAX_REF_LENGTH);
|
|
9
|
+
const documentIdSchema = z.string().min(1).max(DOCUMENT_ID_LENGTH);
|
|
7
10
|
/**
|
|
8
11
|
* Live-control: the narrowed payload of a HUMAN_CONTROL event. The server safeParses
|
|
9
12
|
* `event.data` against this at the inbound boundary (unknown → narrowed; never `any`).
|
|
@@ -62,6 +65,23 @@ export const ReticleEventSchema = z.object({
|
|
|
62
65
|
actionId: refSchema.optional(),
|
|
63
66
|
/** How `actionId` was derived. Present iff `actionId` is. */
|
|
64
67
|
attribution: z.nativeEnum(EventAttribution).optional(),
|
|
68
|
+
/**
|
|
69
|
+
* The document this was observed under. Minted once per real document; a full navigation replaces
|
|
70
|
+
* both. Lets evidence from a superseded document be excluded rather than counted against an action
|
|
71
|
+
* taken now. Optional for back-compat with SDKs that predate it, which is why absence is read as
|
|
72
|
+
* "current" rather than "foreign" — see `isSameDocument`.
|
|
73
|
+
*/
|
|
74
|
+
documentId: documentIdSchema.optional(),
|
|
75
|
+
/**
|
|
76
|
+
* The round of source edits this was observed under — a counter the SDK advances once per applied
|
|
77
|
+
* hot update. A hot update replaces modules and re-renders INSIDE the same document, so
|
|
78
|
+
* `documentId` cannot see it; this is the edit-shaped half of the same question.
|
|
79
|
+
*
|
|
80
|
+
* Optional, and absent while nothing has hot-updated, which is why absence is read as "current"
|
|
81
|
+
* rather than "foreign" — see `isSameEditEpoch`. Most pages have no channel that could report an
|
|
82
|
+
* update at all, so a stamp of `NO_EDITS_OBSERVED` would be wire spent on the word "unknown".
|
|
83
|
+
*/
|
|
84
|
+
editEpoch: z.number().int().min(NO_EDITS_OBSERVED).optional(),
|
|
65
85
|
/** Event-type-specific payload. Kept open here; refined per observer at the edges. */
|
|
66
86
|
data: z.record(z.unknown()).default({}),
|
|
67
87
|
});
|
package/dist/notices.d.ts
CHANGED
|
@@ -65,7 +65,9 @@ export declare const YIELD_WITHOUT_SESSION_NOTE: string;
|
|
|
65
65
|
/**
|
|
66
66
|
* Actionable companion to THROTTLED_WARNING. Surfaced on act/assert results and
|
|
67
67
|
* reticle_sessions rows when a tab is hidden/throttled and may be un-focusable/un-recoverable from
|
|
68
|
-
* the in-page SDK + CDP path.
|
|
69
|
-
*
|
|
68
|
+
* the in-page SDK + CDP path. Names the escape hatch the AGENT can take first (`reticle_lease`
|
|
69
|
+
* through `reticle_run`, since lease is not on the default surface) and leaves `reticle drive` as
|
|
70
|
+
* the human-side equivalent: an MCP-only agent has no shell, so a CLI sentence is advice it cannot
|
|
71
|
+
* follow. Reticle cannot bring such a tab to front or recover it, so it names the limit instead.
|
|
70
72
|
*/
|
|
71
|
-
export declare const UNSCRIPTABLE_TAB_RECOMMENDATION = "tab hidden/throttled and may be un-focusable from here; refocus it, or
|
|
73
|
+
export declare const UNSCRIPTABLE_TAB_RECOMMENDATION = "tab hidden/throttled and may be un-focusable from here; refocus it, or acquire a guaranteed scriptable context yourself with `reticle_run { tool: \"reticle_lease\", action: \"acquire\", url }` (a human can equivalently run `reticle drive <url>`)";
|
package/dist/notices.js
CHANGED
|
@@ -70,7 +70,9 @@ export const YIELD_WITHOUT_SESSION_NOTE = 'No browser session was connected, so
|
|
|
70
70
|
/**
|
|
71
71
|
* Actionable companion to THROTTLED_WARNING. Surfaced on act/assert results and
|
|
72
72
|
* reticle_sessions rows when a tab is hidden/throttled and may be un-focusable/un-recoverable from
|
|
73
|
-
* the in-page SDK + CDP path.
|
|
74
|
-
*
|
|
73
|
+
* the in-page SDK + CDP path. Names the escape hatch the AGENT can take first (`reticle_lease`
|
|
74
|
+
* through `reticle_run`, since lease is not on the default surface) and leaves `reticle drive` as
|
|
75
|
+
* the human-side equivalent: an MCP-only agent has no shell, so a CLI sentence is advice it cannot
|
|
76
|
+
* follow. Reticle cannot bring such a tab to front or recover it, so it names the limit instead.
|
|
75
77
|
*/
|
|
76
|
-
export const UNSCRIPTABLE_TAB_RECOMMENDATION = 'tab hidden/throttled and may be un-focusable from here; refocus it, or
|
|
78
|
+
export const UNSCRIPTABLE_TAB_RECOMMENDATION = 'tab hidden/throttled and may be un-focusable from here; refocus it, or acquire a guaranteed scriptable context yourself with `reticle_run { tool: "reticle_lease", action: "acquire", url }` (a human can equivalently run `reticle drive <url>`)';
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a run has established, held so the agent can ASK for it back.
|
|
3
|
+
*
|
|
4
|
+
* Verification is multi-step, and the only thing holding the thread together is the agent's own
|
|
5
|
+
* context window. When that compacts, or the turn ends, or a sub-agent takes over, the thread is
|
|
6
|
+
* gone and the work restarts. The shape of that shows in the field without needing the theory: long
|
|
7
|
+
* runs of the same read-only call, an agent searching by exhaustion because it no longer remembers
|
|
8
|
+
* what it already saw.
|
|
9
|
+
*
|
|
10
|
+
* ## Pulled, never pushed
|
|
11
|
+
*
|
|
12
|
+
* An earlier version of this rode along on every tool response. It cost +136% on a verdict and was
|
|
13
|
+
* cut, because the agent still had most of that context most of the time: we paid on every call to
|
|
14
|
+
* duplicate what it already knew. The asymmetry that makes the feature work is not that Reticle
|
|
15
|
+
* remembers MORE, it is that Reticle's copy does not degrade at the moment the agent's does. So the
|
|
16
|
+
* agent asks, at the moment it knows its own memory is gone, and pays once.
|
|
17
|
+
*
|
|
18
|
+
* That inversion is why nothing here returns `undefined` for an empty run. A push had to stay silent
|
|
19
|
+
* when it had nothing to say; a pull was asked a question, and "nothing established yet" is the
|
|
20
|
+
* answer the asker needs.
|
|
21
|
+
*
|
|
22
|
+
* ## Two rules stop it becoming the thing it prevents
|
|
23
|
+
*
|
|
24
|
+
* **It must shrink, not grow.** Superseding facts REPLACE rather than append, and both blocks are
|
|
25
|
+
* capped. A context object that accumulates is a token bomb, and read-only payloads are already the
|
|
26
|
+
* largest thing this product emits.
|
|
27
|
+
*
|
|
28
|
+
* **Memory that can be wrong is worse than no memory.** A stale established fact is precisely the
|
|
29
|
+
* false-green mechanism this product exists to prevent, and stale refs are already the most common
|
|
30
|
+
* error an agent sees from us. So every fact carries the document AND the edit epoch it was observed
|
|
31
|
+
* under, and is dropped the moment either moves: no grace period, no probably-fine. The comparison
|
|
32
|
+
* is `isSameDocument`/`isSameEditEpoch` rather than a third rule written beside them.
|
|
33
|
+
*
|
|
34
|
+
* ## What may never go in
|
|
35
|
+
*
|
|
36
|
+
* Only what Reticle OBSERVED. Never what the agent intends, plans, or believes: that is not ours to
|
|
37
|
+
* hold, it is unbounded, and a verification tool that remembers what an agent was thinking is
|
|
38
|
+
* inventing evidence. `remaining` is the one forward-looking field and it is derived mechanically
|
|
39
|
+
* from declared bindings, so it remains a report of a fact — which bindings are undischarged — and
|
|
40
|
+
* not a prediction.
|
|
41
|
+
*/
|
|
42
|
+
import { type Intent } from './intent.js';
|
|
43
|
+
import type { Verified } from './verified-constants.js';
|
|
44
|
+
/**
|
|
45
|
+
* How many rows either block may carry.
|
|
46
|
+
*
|
|
47
|
+
* A decision written down in one place, because the whole feature is a bet that this answer costs
|
|
48
|
+
* fewer tokens than the re-derivation it prevents, and a cap that drifts makes that bet
|
|
49
|
+
* unmeasurable. Twelve is enough to hold the refs, routes and verdicts a single verification thread
|
|
50
|
+
* works with, and small enough that the answer stays a briefing rather than a second payload.
|
|
51
|
+
*
|
|
52
|
+
* One number for both blocks on purpose: two caps is two things to keep in step, and nothing has
|
|
53
|
+
* ever suggested proofs and observations deserve different budgets.
|
|
54
|
+
*/
|
|
55
|
+
export declare const RUN_ESTABLISHED_CAP = 12;
|
|
56
|
+
/**
|
|
57
|
+
* Evidence scoped to the page and the source revision it was taken under.
|
|
58
|
+
*
|
|
59
|
+
* Both fields are optional and absence means "current", exactly as `isSameDocument` and
|
|
60
|
+
* `isSameEditEpoch` already rule: an SDK predating either stamps nothing, and a page with no
|
|
61
|
+
* hot-update channel never stamps an epoch at all.
|
|
62
|
+
*/
|
|
63
|
+
interface ScopedEvidence {
|
|
64
|
+
/** The document this was seen under. Absent only from evidence predating document identity. */
|
|
65
|
+
readonly doc?: string | undefined;
|
|
66
|
+
/** The edit epoch this was seen under. Absent where no hot update could ever be observed. */
|
|
67
|
+
readonly epoch?: number | undefined;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* One thing this run established, with the page state it was true under.
|
|
71
|
+
*
|
|
72
|
+
* `key` is the SUBJECT — re-establishing the same subject supersedes rather than appends. `fact` is
|
|
73
|
+
* the conclusion in prose, never the transcript it came from: "e12 is the Submit button", not the
|
|
74
|
+
* snapshot that revealed it.
|
|
75
|
+
*/
|
|
76
|
+
export interface EstablishedFact extends ScopedEvidence {
|
|
77
|
+
readonly key: string;
|
|
78
|
+
readonly fact: string;
|
|
79
|
+
/** Where in the source this was about, `file:line`, when the run observed one. */
|
|
80
|
+
readonly source?: string | undefined;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* One claim a verdict already settled.
|
|
84
|
+
*
|
|
85
|
+
* The claim IS the subject: proving the same thing twice is one row, the newer one. An agent that
|
|
86
|
+
* has forgotten it proved something either re-proves it, which is slow, or assumes it, which is a
|
|
87
|
+
* false green — and both are the failure this block exists to stop, so `verified` travels with the
|
|
88
|
+
* claim rather than being flattened to a boolean.
|
|
89
|
+
*/
|
|
90
|
+
export interface ProvenClaim extends ScopedEvidence {
|
|
91
|
+
readonly claim: string;
|
|
92
|
+
readonly verified: Verified;
|
|
93
|
+
readonly source?: string | undefined;
|
|
94
|
+
}
|
|
95
|
+
/** What this run has established, what it has proved, and what nothing has discharged. */
|
|
96
|
+
export interface RunContext {
|
|
97
|
+
readonly step: number;
|
|
98
|
+
readonly established: readonly EstablishedFact[];
|
|
99
|
+
readonly proven: readonly ProvenClaim[];
|
|
100
|
+
readonly remaining: readonly string[];
|
|
101
|
+
}
|
|
102
|
+
/** Fold new observations into the established set. See `foldScoped`. */
|
|
103
|
+
export declare function foldEstablished(existing: readonly EstablishedFact[], incoming: readonly EstablishedFact[], currentDocumentId: string | undefined, currentEditEpoch: number | undefined): EstablishedFact[];
|
|
104
|
+
/** Fold new verdicts into the proven set, keyed on the claim. See `foldScoped`. */
|
|
105
|
+
export declare function foldProven(existing: readonly ProvenClaim[], incoming: readonly ProvenClaim[], currentDocumentId: string | undefined, currentEditEpoch: number | undefined): ProvenClaim[];
|
|
106
|
+
/**
|
|
107
|
+
* The declared intents no verdict has discharged yet.
|
|
108
|
+
*
|
|
109
|
+
* Derived, never inferred. This reports a property of the ledger — which bindings remain unproved —
|
|
110
|
+
* and says nothing about what the agent means to do next.
|
|
111
|
+
*/
|
|
112
|
+
export declare function remainingFor(intents: readonly Intent[]): string[];
|
|
113
|
+
/** Assemble the answer. Always answers: an empty run has an empty context, and that is the truth. */
|
|
114
|
+
export declare function buildRunContext(input: {
|
|
115
|
+
step: number;
|
|
116
|
+
intents: readonly Intent[];
|
|
117
|
+
established: readonly EstablishedFact[];
|
|
118
|
+
proven: readonly ProvenClaim[];
|
|
119
|
+
currentDocumentId: string | undefined;
|
|
120
|
+
currentEditEpoch: number | undefined;
|
|
121
|
+
}): RunContext;
|
|
122
|
+
export {};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a run has established, held so the agent can ASK for it back.
|
|
3
|
+
*
|
|
4
|
+
* Verification is multi-step, and the only thing holding the thread together is the agent's own
|
|
5
|
+
* context window. When that compacts, or the turn ends, or a sub-agent takes over, the thread is
|
|
6
|
+
* gone and the work restarts. The shape of that shows in the field without needing the theory: long
|
|
7
|
+
* runs of the same read-only call, an agent searching by exhaustion because it no longer remembers
|
|
8
|
+
* what it already saw.
|
|
9
|
+
*
|
|
10
|
+
* ## Pulled, never pushed
|
|
11
|
+
*
|
|
12
|
+
* An earlier version of this rode along on every tool response. It cost +136% on a verdict and was
|
|
13
|
+
* cut, because the agent still had most of that context most of the time: we paid on every call to
|
|
14
|
+
* duplicate what it already knew. The asymmetry that makes the feature work is not that Reticle
|
|
15
|
+
* remembers MORE, it is that Reticle's copy does not degrade at the moment the agent's does. So the
|
|
16
|
+
* agent asks, at the moment it knows its own memory is gone, and pays once.
|
|
17
|
+
*
|
|
18
|
+
* That inversion is why nothing here returns `undefined` for an empty run. A push had to stay silent
|
|
19
|
+
* when it had nothing to say; a pull was asked a question, and "nothing established yet" is the
|
|
20
|
+
* answer the asker needs.
|
|
21
|
+
*
|
|
22
|
+
* ## Two rules stop it becoming the thing it prevents
|
|
23
|
+
*
|
|
24
|
+
* **It must shrink, not grow.** Superseding facts REPLACE rather than append, and both blocks are
|
|
25
|
+
* capped. A context object that accumulates is a token bomb, and read-only payloads are already the
|
|
26
|
+
* largest thing this product emits.
|
|
27
|
+
*
|
|
28
|
+
* **Memory that can be wrong is worse than no memory.** A stale established fact is precisely the
|
|
29
|
+
* false-green mechanism this product exists to prevent, and stale refs are already the most common
|
|
30
|
+
* error an agent sees from us. So every fact carries the document AND the edit epoch it was observed
|
|
31
|
+
* under, and is dropped the moment either moves: no grace period, no probably-fine. The comparison
|
|
32
|
+
* is `isSameDocument`/`isSameEditEpoch` rather than a third rule written beside them.
|
|
33
|
+
*
|
|
34
|
+
* ## What may never go in
|
|
35
|
+
*
|
|
36
|
+
* Only what Reticle OBSERVED. Never what the agent intends, plans, or believes: that is not ours to
|
|
37
|
+
* hold, it is unbounded, and a verification tool that remembers what an agent was thinking is
|
|
38
|
+
* inventing evidence. `remaining` is the one forward-looking field and it is derived mechanically
|
|
39
|
+
* from declared bindings, so it remains a report of a fact — which bindings are undischarged — and
|
|
40
|
+
* not a prediction.
|
|
41
|
+
*/
|
|
42
|
+
import { isSameDocument } from './document-identity.js';
|
|
43
|
+
import { isSameEditEpoch } from './edit-epoch.js';
|
|
44
|
+
import { IntentState } from './intent.js';
|
|
45
|
+
/**
|
|
46
|
+
* How many rows either block may carry.
|
|
47
|
+
*
|
|
48
|
+
* A decision written down in one place, because the whole feature is a bet that this answer costs
|
|
49
|
+
* fewer tokens than the re-derivation it prevents, and a cap that drifts makes that bet
|
|
50
|
+
* unmeasurable. Twelve is enough to hold the refs, routes and verdicts a single verification thread
|
|
51
|
+
* works with, and small enough that the answer stays a briefing rather than a second payload.
|
|
52
|
+
*
|
|
53
|
+
* One number for both blocks on purpose: two caps is two things to keep in step, and nothing has
|
|
54
|
+
* ever suggested proofs and observations deserve different budgets.
|
|
55
|
+
*/
|
|
56
|
+
export const RUN_ESTABLISHED_CAP = 12;
|
|
57
|
+
/** Is this evidence still describing the page and the source revision in force? */
|
|
58
|
+
function isCurrent(evidence, currentDocumentId, currentEditEpoch) {
|
|
59
|
+
return (isSameDocument(evidence.doc, currentDocumentId) &&
|
|
60
|
+
isSameEditEpoch(evidence.epoch, currentEditEpoch));
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Drop what a navigation or an edit invalidated, supersede what was re-observed, keep the most
|
|
64
|
+
* recent within the cap.
|
|
65
|
+
*
|
|
66
|
+
* One fold with a key function rather than two, because `established` and `proven` obey the same
|
|
67
|
+
* three rules and a second copy is a second place for them to drift apart.
|
|
68
|
+
*/
|
|
69
|
+
function foldScoped(existing, incoming, keyOf, currentDocumentId, currentEditEpoch) {
|
|
70
|
+
const current = (row) => isCurrent(row, currentDocumentId, currentEditEpoch);
|
|
71
|
+
// Supersede WITHIN the batch as well as against the prior set. `buildRunContext` folds against an
|
|
72
|
+
// empty prior set, so a rule that only ever applied to `existing` never applied at all there — and
|
|
73
|
+
// the envelope's whole contract is that `key` is the subject and re-observing it replaces rather
|
|
74
|
+
// than appends. A driven session showed the same ref twice and the same claim three times:
|
|
75
|
+
// duplicates in the one payload whose entire purpose is a cheap context restore.
|
|
76
|
+
//
|
|
77
|
+
// Last wins, because the newest reading is the true one. Insertion order is preserved from the
|
|
78
|
+
// LAST occurrence, so a re-observed subject moves to the recent end where the cap protects it.
|
|
79
|
+
const fresh = new Map();
|
|
80
|
+
for (const row of incoming) {
|
|
81
|
+
if (!current(row))
|
|
82
|
+
continue;
|
|
83
|
+
const key = keyOf(row);
|
|
84
|
+
fresh.delete(key);
|
|
85
|
+
fresh.set(key, row);
|
|
86
|
+
}
|
|
87
|
+
const superseded = new Set(fresh.keys());
|
|
88
|
+
const kept = existing.filter((row) => current(row) && !superseded.has(keyOf(row)));
|
|
89
|
+
// Oldest first, so trimming from the front drops the least recent. `slice` on the tail keeps the
|
|
90
|
+
// newest, which is the half a next step is most likely to need.
|
|
91
|
+
return [...kept, ...fresh.values()].slice(-RUN_ESTABLISHED_CAP);
|
|
92
|
+
}
|
|
93
|
+
/** Fold new observations into the established set. See `foldScoped`. */
|
|
94
|
+
export function foldEstablished(existing, incoming, currentDocumentId, currentEditEpoch) {
|
|
95
|
+
return foldScoped(existing, incoming, (f) => f.key, currentDocumentId, currentEditEpoch);
|
|
96
|
+
}
|
|
97
|
+
/** Fold new verdicts into the proven set, keyed on the claim. See `foldScoped`. */
|
|
98
|
+
export function foldProven(existing, incoming, currentDocumentId, currentEditEpoch) {
|
|
99
|
+
return foldScoped(existing, incoming, (p) => p.claim, currentDocumentId, currentEditEpoch);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* The declared intents no verdict has discharged yet.
|
|
103
|
+
*
|
|
104
|
+
* Derived, never inferred. This reports a property of the ledger — which bindings remain unproved —
|
|
105
|
+
* and says nothing about what the agent means to do next.
|
|
106
|
+
*/
|
|
107
|
+
export function remainingFor(intents) {
|
|
108
|
+
return intents.filter((i) => IntentState.PROVED !== i.state).map((i) => i.statement);
|
|
109
|
+
}
|
|
110
|
+
/** Assemble the answer. Always answers: an empty run has an empty context, and that is the truth. */
|
|
111
|
+
export function buildRunContext(input) {
|
|
112
|
+
return {
|
|
113
|
+
step: input.step,
|
|
114
|
+
established: foldEstablished([], input.established, input.currentDocumentId, input.currentEditEpoch),
|
|
115
|
+
proven: foldProven([], input.proven, input.currentDocumentId, input.currentEditEpoch),
|
|
116
|
+
remaining: remainingFor(input.intents),
|
|
117
|
+
};
|
|
118
|
+
}
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"state.change",
|
|
42
42
|
"storage.change",
|
|
43
43
|
"page.health",
|
|
44
|
+
"context.opened",
|
|
44
45
|
"render.commit",
|
|
45
46
|
"focus.change",
|
|
46
47
|
"flow.recorded",
|
|
@@ -76,6 +77,15 @@
|
|
|
76
77
|
"window"
|
|
77
78
|
]
|
|
78
79
|
},
|
|
80
|
+
"documentId": {
|
|
81
|
+
"type": "string",
|
|
82
|
+
"minLength": 1,
|
|
83
|
+
"maxLength": 8
|
|
84
|
+
},
|
|
85
|
+
"editEpoch": {
|
|
86
|
+
"type": "integer",
|
|
87
|
+
"minimum": 0
|
|
88
|
+
},
|
|
79
89
|
"data": {
|
|
80
90
|
"type": "object",
|
|
81
91
|
"additionalProperties": {},
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"state.change",
|
|
35
35
|
"storage.change",
|
|
36
36
|
"page.health",
|
|
37
|
+
"context.opened",
|
|
37
38
|
"render.commit",
|
|
38
39
|
"focus.change",
|
|
39
40
|
"flow.recorded",
|
|
@@ -69,6 +70,15 @@
|
|
|
69
70
|
"window"
|
|
70
71
|
]
|
|
71
72
|
},
|
|
73
|
+
"documentId": {
|
|
74
|
+
"type": "string",
|
|
75
|
+
"minLength": 1,
|
|
76
|
+
"maxLength": 8
|
|
77
|
+
},
|
|
78
|
+
"editEpoch": {
|
|
79
|
+
"type": "integer",
|
|
80
|
+
"minimum": 0
|
|
81
|
+
},
|
|
72
82
|
"data": {
|
|
73
83
|
"type": "object",
|
|
74
84
|
"additionalProperties": {},
|
|
@@ -174,6 +174,7 @@
|
|
|
174
174
|
"state.change",
|
|
175
175
|
"storage.change",
|
|
176
176
|
"page.health",
|
|
177
|
+
"context.opened",
|
|
177
178
|
"render.commit",
|
|
178
179
|
"focus.change",
|
|
179
180
|
"flow.recorded",
|
|
@@ -207,6 +208,15 @@
|
|
|
207
208
|
"window"
|
|
208
209
|
]
|
|
209
210
|
},
|
|
211
|
+
"documentId": {
|
|
212
|
+
"type": "string",
|
|
213
|
+
"minLength": 1,
|
|
214
|
+
"maxLength": 8
|
|
215
|
+
},
|
|
216
|
+
"editEpoch": {
|
|
217
|
+
"type": "integer",
|
|
218
|
+
"minimum": 0
|
|
219
|
+
},
|
|
210
220
|
"data": {
|
|
211
221
|
"type": "object",
|
|
212
222
|
"additionalProperties": {},
|