@reticlehq/core 2.7.0 → 2.9.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/browser-misdirect.d.ts +23 -0
- package/dist/browser-misdirect.js +28 -0
- package/dist/constants.d.ts +62 -1
- package/dist/constants.js +67 -1
- package/dist/contract-fingerprint.d.ts +7 -0
- package/dist/contract-fingerprint.js +1 -1
- package/dist/desktop-contract.cjs +1 -0
- package/dist/desktop-contract.d.cts +1 -0
- package/dist/desktop-contract.d.ts +10 -0
- package/dist/desktop-contract.js +10 -0
- package/dist/event-payloads.d.ts +3 -2
- package/dist/finding-fingerprint.d.ts +23 -0
- package/dist/finding-fingerprint.js +19 -0
- package/dist/flow-constants.d.ts +2 -0
- package/dist/flow-constants.js +2 -0
- package/dist/flow-types.d.ts +10 -0
- package/dist/impact-savings.d.ts +17 -0
- package/dist/impact-savings.js +47 -0
- package/dist/impact.d.ts +1284 -0
- package/dist/impact.js +127 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +7 -1
- package/dist/notices.d.ts +14 -2
- package/dist/notices.js +15 -2
- package/dist/project-id.js +25 -4
- package/dist/security.js +18 -1
- package/dist/session-constants.d.ts +18 -0
- package/dist/session-constants.js +17 -0
- package/dist/telemetry-feedback.d.ts +2 -2
- package/dist/telemetry-session.d.ts +16 -0
- package/dist/telemetry-session.js +14 -0
- package/dist/telemetry.d.ts +574 -49
- package/dist/telemetry.js +258 -12
- package/dist/types.d.ts +12 -3
- package/dist/types.js +15 -3
- package/dist/verified-constants.d.ts +27 -0
- package/dist/verified-constants.js +27 -0
- package/package.json +1 -1
package/dist/telemetry.js
CHANGED
|
@@ -128,6 +128,24 @@ export const TelemetryEventKind = {
|
|
|
128
128
|
* is a real rate rather than an inference, and a reconnecting page cannot inflate it.
|
|
129
129
|
*/
|
|
130
130
|
APP_INSTRUMENTED: 'app_instrumented',
|
|
131
|
+
/**
|
|
132
|
+
* A daemon has been up long enough that no app is going to arrive on its own.
|
|
133
|
+
*
|
|
134
|
+
* The exact counterpart of `app_instrumented`, and the reason it has to exist: that event only
|
|
135
|
+
* fires on SUCCESS, so the far larger population — daemons that never get an app at all — is
|
|
136
|
+
* measurable today only by the ABSENCE of an event, and an absence cannot distinguish "nothing
|
|
137
|
+
* was wired" from "the process died before it could tell us" from "we never sent it".
|
|
138
|
+
*
|
|
139
|
+
* The funnel breaks here and nowhere else, so this is the one silence worth turning into a signal.
|
|
140
|
+
* Fired ONCE per daemon run, and never after an app has connected, so a daemon that starts slowly
|
|
141
|
+
* and then works reports nothing.
|
|
142
|
+
*
|
|
143
|
+
* Read it against `agentAttached`: a stalled daemon with no agent is a person who installed and
|
|
144
|
+
* walked away, which is not a defect. A stalled daemon WITH an agent attached is the failure this
|
|
145
|
+
* product currently has — the tools are there, something is asking for them, and there is no app
|
|
146
|
+
* on the other end.
|
|
147
|
+
*/
|
|
148
|
+
INSTRUMENTATION_STALLED: 'instrumentation_stalled',
|
|
131
149
|
/**
|
|
132
150
|
* The agent LOST its Reticle tools — the worst thing this product does to anyone, and until now
|
|
133
151
|
* completely invisible in the field.
|
|
@@ -163,6 +181,19 @@ export const TelemetryEventKind = {
|
|
|
163
181
|
* human watching the screen would have caught" is the argument.
|
|
164
182
|
*/
|
|
165
183
|
BUG_FOUND: 'bug_found',
|
|
184
|
+
/**
|
|
185
|
+
* A tool could not do what was asked, and said so.
|
|
186
|
+
*
|
|
187
|
+
* The refusal path already computes a precise diagnosis, hands it to the agent as prose, and then
|
|
188
|
+
* throws it away. So the largest cohort in the funnel — the users who connect an agent and never
|
|
189
|
+
* drive — is visible only by subtraction, and the three genuinely different situations behind it
|
|
190
|
+
* (nothing was ever wired here, the app is not running, a session was lost) arrive as one silence.
|
|
191
|
+
*
|
|
192
|
+
* `noSessionErrors` on the session summary counts one of those causes and only at the end of a
|
|
193
|
+
* session, without the tool, without the discriminator, and without whether the agent tried again.
|
|
194
|
+
* This carries the fact at the moment it happens. See issue #172.
|
|
195
|
+
*/
|
|
196
|
+
TOOL_REFUSED: 'tool_refused',
|
|
166
197
|
};
|
|
167
198
|
/**
|
|
168
199
|
* Events that belong to a DAEMON RUN, and therefore carry `sessionId`.
|
|
@@ -181,11 +212,13 @@ const SESSION_SCOPED = new Set([
|
|
|
181
212
|
TelemetryEventKind.SESSION_PROGRESS,
|
|
182
213
|
TelemetryEventKind.MCP_CLIENT_CONNECTED,
|
|
183
214
|
TelemetryEventKind.APP_INSTRUMENTED,
|
|
215
|
+
TelemetryEventKind.INSTRUMENTATION_STALLED,
|
|
184
216
|
TelemetryEventKind.PROJECT_PROFILED,
|
|
185
217
|
TelemetryEventKind.VERIFICATION_COMPLETED,
|
|
186
218
|
TelemetryEventKind.BUG_FOUND,
|
|
187
219
|
TelemetryEventKind.RUNTIME_CRASHED,
|
|
188
220
|
TelemetryEventKind.FEEDBACK_SUBMITTED,
|
|
221
|
+
TelemetryEventKind.TOOL_REFUSED,
|
|
189
222
|
]);
|
|
190
223
|
/** True when this event happened inside a daemon run, so a `sessionId` on it means something. */
|
|
191
224
|
export function isSessionScoped(kind) {
|
|
@@ -428,15 +461,23 @@ export const BugSource = {
|
|
|
428
461
|
* WHOSE fault the defect was.
|
|
429
462
|
*
|
|
430
463
|
* `bugsFound` is the number this product would most like to publish, and it is not publishable
|
|
431
|
-
* without this.
|
|
432
|
-
*
|
|
433
|
-
*
|
|
434
|
-
*
|
|
464
|
+
* without this. It shipped twice and was wrong both times: across two full real drives EVERY
|
|
465
|
+
* `attribution: 'app'` was a misattribution, so a single session would have published defects
|
|
466
|
+
* against a customer's product that did not exist. A metric confidently wrong about whose fault
|
|
467
|
+
* something is, is worse than no metric — it is the number a founder steers on, and it points at the
|
|
468
|
+
* customer. It was removed, and an ABSENT field then made "nobody classified this" and "we looked
|
|
469
|
+
* and could not tell" the same fact, which is the other half of the same problem.
|
|
470
|
+
*
|
|
471
|
+
* So it is back with two rules, and both are what the earlier versions lacked:
|
|
435
472
|
*
|
|
436
|
-
*
|
|
437
|
-
*
|
|
438
|
-
*
|
|
439
|
-
*
|
|
473
|
+
* 1. **Always present.** `UNCLASSIFIED` is a value, not a gap. Absence would mean an old sender or a
|
|
474
|
+
* path that forgot; a value means the classifier ran and declined.
|
|
475
|
+
* 2. **`APP` requires POSITIVE evidence** — something the app itself did: a request that came back
|
|
476
|
+
* failed, a signal the app fired carrying data that disagrees with its own screen, a written
|
|
477
|
+
* field echoed back changed. Never "nothing else explained it". Core already draws exactly this
|
|
478
|
+
* line for the verdict, in `ABSENCE_DERIVED_CONTRADICTIONS`, and that is the line reused rather
|
|
479
|
+
* than a second judgement invented next to it — every one of the historical misattributions was
|
|
480
|
+
* an absence-derived kind, so this rule produces zero of them on the same data.
|
|
440
481
|
*/
|
|
441
482
|
export const BugAttribution = {
|
|
442
483
|
/** A defect in the app under test — the only bucket that belongs in a published defect count. */
|
|
@@ -445,6 +486,15 @@ export const BugAttribution = {
|
|
|
445
486
|
REQUEST: 'request',
|
|
446
487
|
/** Reticle could not see or could not drive. Our bug, or our configuration. Ship a fix. */
|
|
447
488
|
RETICLE: 'reticle',
|
|
489
|
+
/**
|
|
490
|
+
* The classifier looked and the evidence could not say.
|
|
491
|
+
*
|
|
492
|
+
* The honest majority, and it must stay a value rather than becoming a gap: a failed
|
|
493
|
+
* `element.present` covers "the button is missing", "the API is down" and "the agent mistyped a
|
|
494
|
+
* testid" identically, and an owner invented for it would put a guess into the one number we
|
|
495
|
+
* intend to publish. Exclude it from a defect count; never fold it into `app`.
|
|
496
|
+
*/
|
|
497
|
+
UNCLASSIFIED: 'unclassified',
|
|
448
498
|
};
|
|
449
499
|
/**
|
|
450
500
|
* One defect Reticle found in the app under test.
|
|
@@ -489,10 +539,69 @@ export const BugFoundSchema = z.object({
|
|
|
489
539
|
*/
|
|
490
540
|
repeat: z.boolean(),
|
|
491
541
|
/**
|
|
492
|
-
* Whose fault it was
|
|
493
|
-
*
|
|
542
|
+
* Whose fault it was, ALWAYS present — `unclassified` when the evidence cannot say, never absent.
|
|
543
|
+
*
|
|
544
|
+
* Absence and "we looked and could not tell" are different facts, and only one of them is a
|
|
545
|
+
* measurement. Count `attribution: 'app'` for defects found in anybody's product; see
|
|
546
|
+
* `BugAttribution` for why `app` needs positive evidence.
|
|
547
|
+
*/
|
|
548
|
+
attribution: z.nativeEnum(BugAttribution),
|
|
549
|
+
/**
|
|
550
|
+
* A stable hash identifying THIS defect across sessions — same kind at the same route = same
|
|
551
|
+
* fingerprint, regardless of when or where it was found.
|
|
552
|
+
*
|
|
553
|
+
* The inputs (route, selector) never travel raw — only the 8-char hex hash does, following the
|
|
554
|
+
* same privacy pattern as `projectId`. The analytics side groups on it to answer "was this bug
|
|
555
|
+
* fixed?" (the fingerprint stops appearing) and to deduplicate the same defect found by parallel
|
|
556
|
+
* agents in one run.
|
|
557
|
+
*
|
|
558
|
+
* OPTIONAL because old senders and the `reticle verify` CLI path do not yet compute it. Absent
|
|
559
|
+
* means "not fingerprinted", never "a different defect from one that has a fingerprint".
|
|
560
|
+
*/
|
|
561
|
+
fingerprint: z.string().max(16).optional(),
|
|
562
|
+
});
|
|
563
|
+
/**
|
|
564
|
+
* WHY a tool could not do what was asked.
|
|
565
|
+
*
|
|
566
|
+
* Derived from the refusal paths that actually exist rather than invented: every member below is a
|
|
567
|
+
* bucket over `error-recovery.ts`'s recovery table, which is the single place a thrown message is
|
|
568
|
+
* turned into a next action. That table is the vocabulary; this is its coarse grouping, and a new
|
|
569
|
+
* entry there cannot compile without being classified here.
|
|
570
|
+
*
|
|
571
|
+
* The five that matter belong to four different owners, which is the whole reason for splitting
|
|
572
|
+
* them: `no_session` is the install's second half never happening, `bad_args` is the agent's own
|
|
573
|
+
* call, `not_ready` is the environment, and `no_match` / `unsupported` are the app and our own
|
|
574
|
+
* capability surface. One undifferentiated "the agent stopped" number cannot be acted on by anyone.
|
|
575
|
+
*/
|
|
576
|
+
export const RefusalReason = {
|
|
577
|
+
/** There was no app to reach: nothing connected, no session by that id, or several with none named. */
|
|
578
|
+
NO_SESSION: 'no_session',
|
|
579
|
+
/** The target did not exist: a stale ref, a missing baseline, an option value the select has not got. */
|
|
580
|
+
NO_MATCH: 'no_match',
|
|
581
|
+
/** Reticle refuses to pretend: a rich-text surface, a disabled field, a destructive control. */
|
|
582
|
+
UNSUPPORTED: 'unsupported',
|
|
583
|
+
/** The call did not match the schema, or named a value our own validators reject. */
|
|
584
|
+
BAD_ARGS: 'bad_args',
|
|
585
|
+
/** Nothing is wrong with the call; the world is not ready — a throttled tab, a timeout, no browser. */
|
|
586
|
+
NOT_READY: 'not_ready',
|
|
587
|
+
/** A refusal this list does not name. A classifier that cannot say "I don't know" lies instead. */
|
|
588
|
+
OTHER: 'other',
|
|
589
|
+
};
|
|
590
|
+
/** One tool call that could not be served. */
|
|
591
|
+
export const ToolRefusalSchema = z.object({
|
|
592
|
+
/** Which tool. A name from our own fixed namespace, never app data. */
|
|
593
|
+
tool: z.string().min(1).max(64),
|
|
594
|
+
reason: z.nativeEnum(RefusalReason),
|
|
595
|
+
/**
|
|
596
|
+
* TRUE when the call immediately before this one was the SAME tool, also refused.
|
|
597
|
+
*
|
|
598
|
+
* Reported on the RETRY rather than on the first refusal, because the first refusal has to be sent
|
|
599
|
+
* at the moment it happens: deferring it until the next call is known would lose it entirely for
|
|
600
|
+
* the agent that gives up, and that agent is the whole population this event exists to describe.
|
|
601
|
+
* So count `retried: true` for retries; the ratio against all refusals is whether our diagnosis
|
|
602
|
+
* gets anybody unstuck.
|
|
494
603
|
*/
|
|
495
|
-
|
|
604
|
+
retried: z.boolean(),
|
|
496
605
|
});
|
|
497
606
|
/** An MCP client attaching. Separates "installed and running" from "someone is actually using it". */
|
|
498
607
|
export const McpConnectionSchema = z.object({
|
|
@@ -523,6 +632,26 @@ export const AppInstrumentationSchema = z.object({
|
|
|
523
632
|
/** How long the daemon had been up. Large values mean Reticle sat there with nothing wired. */
|
|
524
633
|
msToFirstApp: z.number().int().nonnegative(),
|
|
525
634
|
});
|
|
635
|
+
/**
|
|
636
|
+
* The shape of a daemon that waited and got nothing.
|
|
637
|
+
*
|
|
638
|
+
* Deliberately the same three facts as `AppInstrumentation` rather than a richer payload, so the
|
|
639
|
+
* success and failure cases are directly comparable: the only difference between them should be
|
|
640
|
+
* which event carries them. `msWaited` is the counterpart of `msToFirstApp`.
|
|
641
|
+
*
|
|
642
|
+
* What it does NOT carry is any attempt to say WHY, because at this point the daemon does not know.
|
|
643
|
+
* Whether a dev server is listening is a live probe, and running one on a timer to enrich a metric
|
|
644
|
+
* would be collecting for the metric's sake. The diagnosis belongs where a human or an agent asks
|
|
645
|
+
* for it, not here.
|
|
646
|
+
*/
|
|
647
|
+
export const InstrumentationStallSchema = z.object({
|
|
648
|
+
/** Whether `reticle init` had been run in this directory (a projectId is stamped). */
|
|
649
|
+
initialized: z.boolean(),
|
|
650
|
+
/** Whether an MCP client is attached. The difference between an idle install and a broken one. */
|
|
651
|
+
agentAttached: z.boolean(),
|
|
652
|
+
/** How long the daemon has been up with no app on the other end. */
|
|
653
|
+
msWaited: z.number().int().nonnegative(),
|
|
654
|
+
});
|
|
526
655
|
/**
|
|
527
656
|
* WHICH stage of an MCP outage this is. Reported at most twice per proxy process, and the two are
|
|
528
657
|
* different facts: `first` says the session lost its tools at all, `budget_spent` says the proxy
|
|
@@ -531,6 +660,18 @@ export const AppInstrumentationSchema = z.object({
|
|
|
531
660
|
export const OutageStage = {
|
|
532
661
|
FIRST: 'first',
|
|
533
662
|
BUDGET_SPENT: 'budget_spent',
|
|
663
|
+
/**
|
|
664
|
+
* The link came back on its own, and `attempts` says what it cost.
|
|
665
|
+
*
|
|
666
|
+
* Without it `first` is unfalsifiable. It is emitted at the moment of the drop, when the attempt
|
|
667
|
+
* counter is 1 by construction and the cap keeps any later drop from ever replacing it — so every
|
|
668
|
+
* event in the field carried the same stage and the same attempt count, and neither could carry
|
|
669
|
+
* another. That reads as "reconnection never advances past the first attempt" and it is really
|
|
670
|
+
* "this event is emitted before there is anything to say". `recovered` is the counterpart that
|
|
671
|
+
* makes the pair mean something: `first` with no `recovered` and no `budget_spent` is a session
|
|
672
|
+
* whose tools never came back.
|
|
673
|
+
*/
|
|
674
|
+
RECOVERED: 'recovered',
|
|
534
675
|
};
|
|
535
676
|
/**
|
|
536
677
|
* WHY the stream went away, as far as the proxy can tell. A closed vocabulary because the proxy's
|
|
@@ -538,8 +679,17 @@ export const OutageStage = {
|
|
|
538
679
|
* without a raw string reaching the wire, per the classifier rule.
|
|
539
680
|
*/
|
|
540
681
|
export const OutageReason = {
|
|
541
|
-
/** The SSE stream ended cleanly
|
|
682
|
+
/** The SSE stream ended cleanly and nothing said why. */
|
|
542
683
|
SSE_ENDED: 'sse_ended',
|
|
684
|
+
/**
|
|
685
|
+
* The daemon ANNOUNCED that it was retiring before it closed the stream.
|
|
686
|
+
*
|
|
687
|
+
* Not an outage the agent suffered, and separating it is the whole point: a scheduled shutdown and
|
|
688
|
+
* a daemon dying under a live client are the same clean stream end on this side of the socket, so
|
|
689
|
+
* the metric meant to say "the agent lost its tools" spent most of its volume counting the daemon
|
|
690
|
+
* going to sleep exactly as designed. Split out, `sse_ended` finally means what it says.
|
|
691
|
+
*/
|
|
692
|
+
DAEMON_SHUTDOWN: 'daemon_shutdown',
|
|
543
693
|
/** The stream errored. */
|
|
544
694
|
SSE_ERROR: 'sse_error',
|
|
545
695
|
/** The socket died under us with neither `end` nor `error` — daemon killed, network reset. */
|
|
@@ -578,6 +728,73 @@ export const McpOutageSchema = z.object({
|
|
|
578
728
|
*/
|
|
579
729
|
pendingLost: z.number().int().nonnegative().optional(),
|
|
580
730
|
});
|
|
731
|
+
/**
|
|
732
|
+
* WHICH published route brought this install in.
|
|
733
|
+
*
|
|
734
|
+
* Four routes ship at once — the SKILL.md paste URL, an `npx skills add` package, a Claude Code
|
|
735
|
+
* plugin, and docs.reticle.sh — and not one install can be attributed to any of them today. Every
|
|
736
|
+
* decision about where to spend effort on distribution is therefore made blind.
|
|
737
|
+
*
|
|
738
|
+
* The value is NEVER inferred. It is read from a single explicit marker (`RETICLE_INSTALL_SOURCE`)
|
|
739
|
+
* that a channel sets on itself, narrowed against this list, and anything else reports `UNKNOWN`.
|
|
740
|
+
* That is deliberate and it means `unknown` will stay large: a guessed attribution is worse than no
|
|
741
|
+
* attribution, because a distribution decision made on a guess is indistinguishable from one made on
|
|
742
|
+
* a measurement. Read a small `unknown` as a marker that spread, never as success.
|
|
743
|
+
*
|
|
744
|
+
* What the marker CANNOT be derived from, and why nothing here tries:
|
|
745
|
+
* - `npm_config_user_agent` says npm/pnpm ran us. Every one of these routes runs through npx, so it
|
|
746
|
+
* separates none of them.
|
|
747
|
+
* - The presence of `.claude-plugin/` or an installed skill directory says a plugin or a skill is
|
|
748
|
+
* present in the repo, not that it is the thing that ran `init` — and both are present at once on
|
|
749
|
+
* any machine that has tried more than one route.
|
|
750
|
+
* - A first-run heuristic on which command ran first says nothing about who told the user to run it.
|
|
751
|
+
*/
|
|
752
|
+
export const InstallSource = {
|
|
753
|
+
/** The canonical SKILL.md paste URL — the marker is in the command SKILL.md tells the agent to run. */
|
|
754
|
+
SKILL_FILE: 'skill_file',
|
|
755
|
+
/** The `npx skills add` package, which ships its own copy of the skill carrying its own marker. */
|
|
756
|
+
NPX_SKILL: 'npx_skill',
|
|
757
|
+
/** The Claude Code plugin, which sets the marker in the `env` of the MCP server it registers. */
|
|
758
|
+
PLUGIN: 'plugin',
|
|
759
|
+
/** docs.reticle.sh, whose install snippets carry the marker. */
|
|
760
|
+
DOCS_SITE: 'docs_site',
|
|
761
|
+
/** The repository README's install snippet. */
|
|
762
|
+
README: 'readme',
|
|
763
|
+
/** Somebody typed the command with no channel in front of it. Only ever self-declared. */
|
|
764
|
+
CLI_DIRECT: 'cli_direct',
|
|
765
|
+
/** No marker, or one this list does not name. The honest answer, and expected to dominate. */
|
|
766
|
+
UNKNOWN: 'unknown',
|
|
767
|
+
};
|
|
768
|
+
/**
|
|
769
|
+
* Why a run LOOKS automated, when `CI` alone does not say so.
|
|
770
|
+
*
|
|
771
|
+
* Advisory only — see the `automation` field on the event and `automation-hint.ts` for what these
|
|
772
|
+
* are and, more importantly, what they are not allowed to be used for.
|
|
773
|
+
*/
|
|
774
|
+
export const AutomationHint = {
|
|
775
|
+
/** A container runtime marker is present at the filesystem root. */
|
|
776
|
+
CONTAINER: 'container',
|
|
777
|
+
/** A hosted dev environment declared itself (Codespaces, Gitpod, Cloud Shell, dev container). */
|
|
778
|
+
HOSTED_WORKSPACE: 'hosted_workspace',
|
|
779
|
+
/** Neither end of the process is attached to a terminal. The weakest of the three. */
|
|
780
|
+
NO_TTY: 'no_tty',
|
|
781
|
+
};
|
|
782
|
+
/**
|
|
783
|
+
* What `init` SAW after it finished writing, when it stayed to look.
|
|
784
|
+
*
|
|
785
|
+
* The install has two halves — register the MCP server so the agent has the tools, and get the SDK
|
|
786
|
+
* into a running page so there is something to look at — and nothing joined "init finished" to "an
|
|
787
|
+
* app connected". `init` exited 0 having written files, and the second half was completed by far
|
|
788
|
+
* fewer people than the first with no event able to tell the two apart.
|
|
789
|
+
*/
|
|
790
|
+
export const InitConfirmation = {
|
|
791
|
+
/** An app carrying the SDK reached the daemon while `init` watched. This is what installed means. */
|
|
792
|
+
CONNECTED: 'connected',
|
|
793
|
+
/** Nothing was listening on the bridge port, so no session could arrive. Not a failed install. */
|
|
794
|
+
NO_DAEMON: 'no_daemon',
|
|
795
|
+
/** A daemon was up and no app connected inside the window — the dev server is the outstanding step. */
|
|
796
|
+
NO_SESSION: 'no_session',
|
|
797
|
+
};
|
|
581
798
|
/** How `reticle init` went. The onboarding funnel, which had no instrumentation whatsoever. */
|
|
582
799
|
export const InitOutcomeSchema = z.object({
|
|
583
800
|
ok: z.boolean(),
|
|
@@ -587,6 +804,14 @@ export const InitOutcomeSchema = z.object({
|
|
|
587
804
|
stack: z.string().max(64).optional(),
|
|
588
805
|
/** Whether the MCP registration step succeeded — the step most likely to fail silently. */
|
|
589
806
|
mcpRegistered: z.boolean().optional(),
|
|
807
|
+
/**
|
|
808
|
+
* What `init` saw when it waited for an app to connect.
|
|
809
|
+
*
|
|
810
|
+
* ABSENT means it never looked, which is the honest answer for every scripted run: `init` only
|
|
811
|
+
* waits when a human is at the terminal. Read an absent value as "not measured", never as a
|
|
812
|
+
* failure to connect, or the funnel reads scripted installs as losses.
|
|
813
|
+
*/
|
|
814
|
+
confirmation: z.nativeEnum(InitConfirmation).optional(),
|
|
590
815
|
});
|
|
591
816
|
/**
|
|
592
817
|
* One anonymous telemetry event. `anonymousId` and the optional hashed `projectId` are the only
|
|
@@ -620,6 +845,16 @@ export const TelemetryEventSchema = z.object({
|
|
|
620
845
|
version: z.string().min(1).max(64),
|
|
621
846
|
/** Runs inside CI? Separates real human DAU from pipeline traffic (both matter, differently). */
|
|
622
847
|
ci: z.boolean(),
|
|
848
|
+
/**
|
|
849
|
+
* ADVISORY hint that this run looks automated, when something beyond `CI` suggests it.
|
|
850
|
+
*
|
|
851
|
+
* `ci` reads one environment variable, which is right for a GitHub Actions runner and blind to a
|
|
852
|
+
* cloud agent sandbox — our own gate has landed in the user data with `ci: false`. This is the
|
|
853
|
+
* second angle, and it is NEVER a filter: people work in containers, in Codespaces, and over ssh
|
|
854
|
+
* with no terminal. Never exclude a row because this is set; absent means nothing looked
|
|
855
|
+
* automated, not that a human was present. See automation-hint.ts for the rejected signals.
|
|
856
|
+
*/
|
|
857
|
+
automation: z.nativeEnum(AutomationHint).optional(),
|
|
623
858
|
/**
|
|
624
859
|
* What `projectId` was derived from. On EVERY event, not just the profile, because the core
|
|
625
860
|
* counting questions ("users per project", "projects per user") run over all events and need to
|
|
@@ -666,8 +901,19 @@ export const TelemetryEventSchema = z.object({
|
|
|
666
901
|
init: InitOutcomeSchema.optional(),
|
|
667
902
|
/** Only on `bug_found`. */
|
|
668
903
|
bug: BugFoundSchema.optional(),
|
|
904
|
+
/** Only on `tool_refused`: which tool, why, and whether the agent tried the same thing again. */
|
|
905
|
+
refusal: ToolRefusalSchema.optional(),
|
|
669
906
|
/** Only on `mcp_connection_lost`: which stage of the outage, why, and after how many retries. */
|
|
670
907
|
outage: McpOutageSchema.optional(),
|
|
671
908
|
/** Only on `app_instrumented`: the install's second half finally happening. */
|
|
672
909
|
instrumentation: AppInstrumentationSchema.optional(),
|
|
910
|
+
/** Only on `instrumentation_stalled`: the install's second half not happening. */
|
|
911
|
+
stall: InstrumentationStallSchema.optional(),
|
|
912
|
+
/**
|
|
913
|
+
* Only on `reticle_installed` / `init_completed`: which published route brought this install in.
|
|
914
|
+
*
|
|
915
|
+
* A scalar rather than a block because it belongs to two different events that have no payload in
|
|
916
|
+
* common, and because there is exactly one fact to carry. Absent on every other kind.
|
|
917
|
+
*/
|
|
918
|
+
installSource: z.nativeEnum(InstallSource).optional(),
|
|
673
919
|
});
|
package/dist/types.d.ts
CHANGED
|
@@ -2,7 +2,16 @@ import type { Ref } from './brand.js';
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { type AnnotationErrorCode, type AnnotationTarget, ElementState } from './constants.js';
|
|
4
4
|
import type { FlowExpect } from './flow-types.js';
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* A query describing which element(s) to find, Testing-Library style.
|
|
7
|
+
*
|
|
8
|
+
* Strict, for the same reason the predicate union that wraps it is: a key nobody spells is a schema
|
|
9
|
+
* error naming the key, never a stripped field. Reported from the field —
|
|
10
|
+
* `{ kind: 'element', query: { css: "a[href='…']" } }` parsed, `css` was dropped, the empty query
|
|
11
|
+
* that survived matched nothing, and the verdict read "no element matched {}" about an element that
|
|
12
|
+
* was on the page. A stripped locator here is a false RED, and an agent that believes it goes and
|
|
13
|
+
* "fixes" correct code.
|
|
14
|
+
*/
|
|
6
15
|
export declare const ElementQuerySchema: z.ZodObject<{
|
|
7
16
|
by: z.ZodOptional<z.ZodNativeEnum<{
|
|
8
17
|
readonly ROLE: "role";
|
|
@@ -33,7 +42,7 @@ export declare const ElementQuerySchema: z.ZodObject<{
|
|
|
33
42
|
file: z.ZodString;
|
|
34
43
|
line: z.ZodNumber;
|
|
35
44
|
column: z.ZodOptional<z.ZodNumber>;
|
|
36
|
-
}, "
|
|
45
|
+
}, "strict", z.ZodTypeAny, {
|
|
37
46
|
file: string;
|
|
38
47
|
line: number;
|
|
39
48
|
column?: number | undefined;
|
|
@@ -54,7 +63,7 @@ export declare const ElementQuerySchema: z.ZodObject<{
|
|
|
54
63
|
* verification was handed back to the human. Requires `scope`.
|
|
55
64
|
*/
|
|
56
65
|
self: z.ZodOptional<z.ZodBoolean>;
|
|
57
|
-
}, "
|
|
66
|
+
}, "strict", z.ZodTypeAny, {
|
|
58
67
|
testid?: string | undefined;
|
|
59
68
|
role?: string | undefined;
|
|
60
69
|
component?: string | undefined;
|
package/dist/types.js
CHANGED
|
@@ -2,8 +2,18 @@ import { z } from 'zod';
|
|
|
2
2
|
import { AnnotationKind, CONTRACT_FILE_VERSION, ElementState, QueryBy, RunKind, RunStatus, } from './constants.js';
|
|
3
3
|
import { PROJECT_FILE_VERSION } from './flow-constants.js';
|
|
4
4
|
import { RiskSurface } from './verification-run.js';
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* A query describing which element(s) to find, Testing-Library style.
|
|
7
|
+
*
|
|
8
|
+
* Strict, for the same reason the predicate union that wraps it is: a key nobody spells is a schema
|
|
9
|
+
* error naming the key, never a stripped field. Reported from the field —
|
|
10
|
+
* `{ kind: 'element', query: { css: "a[href='…']" } }` parsed, `css` was dropped, the empty query
|
|
11
|
+
* that survived matched nothing, and the verdict read "no element matched {}" about an element that
|
|
12
|
+
* was on the page. A stripped locator here is a false RED, and an agent that believes it goes and
|
|
13
|
+
* "fixes" correct code.
|
|
14
|
+
*/
|
|
15
|
+
export const ElementQuerySchema = z
|
|
16
|
+
.object({
|
|
7
17
|
by: z.nativeEnum(QueryBy).optional(),
|
|
8
18
|
value: z.string().optional(),
|
|
9
19
|
role: z.string().optional(),
|
|
@@ -23,6 +33,7 @@ export const ElementQuerySchema = z.object({
|
|
|
23
33
|
/** Source location of the target element (auto-anchor resolution) — the precise, granular match. */
|
|
24
34
|
source: z
|
|
25
35
|
.object({ file: z.string(), line: z.number(), column: z.number().optional() })
|
|
36
|
+
.strict()
|
|
26
37
|
.optional(),
|
|
27
38
|
/** CSS selector or ref to scope the search. */
|
|
28
39
|
scope: z.string().optional(),
|
|
@@ -36,7 +47,8 @@ export const ElementQuerySchema = z.object({
|
|
|
36
47
|
* verification was handed back to the human. Requires `scope`.
|
|
37
48
|
*/
|
|
38
49
|
self: z.boolean().optional(),
|
|
39
|
-
})
|
|
50
|
+
})
|
|
51
|
+
.strict();
|
|
40
52
|
/** One named flow advertised by the app (mirrors the browser CapabilityFlow). */
|
|
41
53
|
export const CapabilityFlowSchema = z.object({
|
|
42
54
|
name: z.string(),
|
|
@@ -70,8 +70,21 @@ export declare const VerifiedReason: {
|
|
|
70
70
|
readonly OUTCOME_UNREAD: "outcome_unread";
|
|
71
71
|
/** The page never settled, so the reaction window may have closed early. */
|
|
72
72
|
readonly UNSETTLED: "unsettled";
|
|
73
|
+
/**
|
|
74
|
+
* The assertion held, but a channel's outcome had not been observed when the window closed — an
|
|
75
|
+
* ABSENCE-derived finding (see ABSENCE_DERIVED_CONTRADICTIONS), not evidence against the action.
|
|
76
|
+
*
|
|
77
|
+
* Split out of UNSETTLED because that word is a claim about idle, and this clause fires
|
|
78
|
+
* independently of whether the page went idle. One field report was, verbatim, "internally
|
|
79
|
+
* contradictory": `verifiedReason: "unsettled"` beside `settled: true`, a passing nested verdict,
|
|
80
|
+
* the requested POST at 200 and a clean console. Both halves came from this rule, and a verdict
|
|
81
|
+
* whose own evidence block denies its stated reason is a verdict nobody can act on.
|
|
82
|
+
*/
|
|
83
|
+
readonly EVIDENCE_INCOMPLETE: "evidence_incomplete";
|
|
73
84
|
/** Held at a real grade over a clean capture with no channel disagreeing. */
|
|
74
85
|
readonly PROVED: "proved";
|
|
86
|
+
/** A passing absence assertion targeted a region Reticle could not observe. */
|
|
87
|
+
readonly ABSENCE_BLIND_SPOT: "absence_blind_spot";
|
|
75
88
|
};
|
|
76
89
|
export type VerifiedReason = (typeof VerifiedReason)[keyof typeof VerifiedReason];
|
|
77
90
|
/**
|
|
@@ -176,5 +189,19 @@ export declare const BlindSpotKind: {
|
|
|
176
189
|
* is declared, and the verdict over it reports partial coverage.
|
|
177
190
|
*/
|
|
178
191
|
readonly VERDICTLESS_SEND: "verdictless-send";
|
|
192
|
+
/**
|
|
193
|
+
* No SUBSCRIBABLE store is registered, so the app's own state is unobservable.
|
|
194
|
+
*
|
|
195
|
+
* Without it, "the store did not change" and "nothing was watching the store" are the same empty
|
|
196
|
+
* `stateDiffs` — and the first reading is a confident wrong answer. It is the common case, not an
|
|
197
|
+
* exotic one: `init` writes a capabilities file that registers nothing until someone edits it, and
|
|
198
|
+
* a store passed as a bare getter is readable but silent, so an app can hold state, change it on
|
|
199
|
+
* every click, and report an empty state channel forever with no error anywhere.
|
|
200
|
+
*
|
|
201
|
+
* BOUNDING, never impeaching (see `impeachesCapture`): what WAS observed — DOM, network, console,
|
|
202
|
+
* storage — is observed completely. Only the state channel is dark, and it lights up the moment a
|
|
203
|
+
* subscribable store registers, which is when the SDK emits this kind with count 0.
|
|
204
|
+
*/
|
|
205
|
+
readonly UNWATCHED_STATE: "unwatched-state";
|
|
179
206
|
};
|
|
180
207
|
export type BlindSpotKind = (typeof BlindSpotKind)[keyof typeof BlindSpotKind];
|
|
@@ -69,8 +69,21 @@ export const VerifiedReason = {
|
|
|
69
69
|
OUTCOME_UNREAD: 'outcome_unread',
|
|
70
70
|
/** The page never settled, so the reaction window may have closed early. */
|
|
71
71
|
UNSETTLED: 'unsettled',
|
|
72
|
+
/**
|
|
73
|
+
* The assertion held, but a channel's outcome had not been observed when the window closed — an
|
|
74
|
+
* ABSENCE-derived finding (see ABSENCE_DERIVED_CONTRADICTIONS), not evidence against the action.
|
|
75
|
+
*
|
|
76
|
+
* Split out of UNSETTLED because that word is a claim about idle, and this clause fires
|
|
77
|
+
* independently of whether the page went idle. One field report was, verbatim, "internally
|
|
78
|
+
* contradictory": `verifiedReason: "unsettled"` beside `settled: true`, a passing nested verdict,
|
|
79
|
+
* the requested POST at 200 and a clean console. Both halves came from this rule, and a verdict
|
|
80
|
+
* whose own evidence block denies its stated reason is a verdict nobody can act on.
|
|
81
|
+
*/
|
|
82
|
+
EVIDENCE_INCOMPLETE: 'evidence_incomplete',
|
|
72
83
|
/** Held at a real grade over a clean capture with no channel disagreeing. */
|
|
73
84
|
PROVED: 'proved',
|
|
85
|
+
/** A passing absence assertion targeted a region Reticle could not observe. */
|
|
86
|
+
ABSENCE_BLIND_SPOT: 'absence_blind_spot',
|
|
74
87
|
};
|
|
75
88
|
/**
|
|
76
89
|
* WHAT made a capture unclean — the closed vocabulary behind `UNCLEAN_CAPTURE`.
|
|
@@ -173,4 +186,18 @@ export const BlindSpotKind = {
|
|
|
173
186
|
* is declared, and the verdict over it reports partial coverage.
|
|
174
187
|
*/
|
|
175
188
|
VERDICTLESS_SEND: 'verdictless-send',
|
|
189
|
+
/**
|
|
190
|
+
* No SUBSCRIBABLE store is registered, so the app's own state is unobservable.
|
|
191
|
+
*
|
|
192
|
+
* Without it, "the store did not change" and "nothing was watching the store" are the same empty
|
|
193
|
+
* `stateDiffs` — and the first reading is a confident wrong answer. It is the common case, not an
|
|
194
|
+
* exotic one: `init` writes a capabilities file that registers nothing until someone edits it, and
|
|
195
|
+
* a store passed as a bare getter is readable but silent, so an app can hold state, change it on
|
|
196
|
+
* every click, and report an empty state channel forever with no error anywhere.
|
|
197
|
+
*
|
|
198
|
+
* BOUNDING, never impeaching (see `impeachesCapture`): what WAS observed — DOM, network, console,
|
|
199
|
+
* storage — is observed completely. Only the state channel is dark, and it lights up the moment a
|
|
200
|
+
* subscribable store registers, which is when the SDK emits this kind with count 0.
|
|
201
|
+
*/
|
|
202
|
+
UNWATCHED_STATE: 'unwatched-state',
|
|
176
203
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reticlehq/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "The Reticle foundation: the shared wire contract — types, zod schemas, constants, messages, and the isomorphic kernel that every Reticle package (browser SDK, server, kits, test harness) imports. Depends only on zod.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|