@reticlehq/core 2.4.0 → 2.6.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 (46) hide show
  1. package/dist/consequence.d.ts +27 -0
  2. package/dist/consequence.js +26 -0
  3. package/dist/constants.d.ts +68 -0
  4. package/dist/constants.js +65 -0
  5. package/dist/contract-fingerprint.d.ts +29 -0
  6. package/dist/contract-fingerprint.js +56 -0
  7. package/dist/daemon-registry.js +1 -1
  8. package/dist/event-classification.d.ts +7 -0
  9. package/dist/event-classification.js +15 -0
  10. package/dist/event-payloads.d.ts +48 -0
  11. package/dist/event-payloads.js +12 -1
  12. package/dist/flow-constants.d.ts +8 -0
  13. package/dist/flow-constants.js +12 -0
  14. package/dist/flow-types.d.ts +23 -0
  15. package/dist/index.d.ts +3 -0
  16. package/dist/index.js +3 -0
  17. package/dist/journal.d.ts +2 -2
  18. package/dist/messages.d.ts +48 -0
  19. package/dist/messages.js +20 -0
  20. package/dist/net.d.ts +40 -0
  21. package/dist/net.js +44 -0
  22. package/dist/project-id.d.ts +28 -0
  23. package/dist/project-id.js +51 -0
  24. package/dist/redaction.js +4 -4
  25. package/dist/schema/hello-message.json +8 -0
  26. package/dist/schema/reticle-message.json +8 -0
  27. package/dist/security.js +10 -5
  28. package/dist/source-constants.d.ts +6 -0
  29. package/dist/source-constants.js +6 -0
  30. package/dist/state-select.d.ts +14 -2
  31. package/dist/state-select.js +77 -14
  32. package/dist/telemetry-feedback.d.ts +32 -10
  33. package/dist/telemetry-feedback.js +21 -0
  34. package/dist/telemetry-session.d.ts +169 -0
  35. package/dist/telemetry-session.js +139 -0
  36. package/dist/telemetry.d.ts +706 -92
  37. package/dist/telemetry.js +251 -4
  38. package/dist/toon.d.ts +2 -1
  39. package/dist/toon.js +37 -37
  40. package/dist/types.d.ts +48 -0
  41. package/dist/types.js +12 -0
  42. package/dist/upgrade.js +1 -1
  43. package/dist/verification-run.d.ts +28 -28
  44. package/dist/verified-constants.d.ts +53 -0
  45. package/dist/verified-constants.js +52 -0
  46. package/package.json +5 -3
@@ -550,13 +550,13 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
550
550
  previewUrl: z.ZodOptional<z.ZodString>;
551
551
  }, "strip", z.ZodTypeAny, {
552
552
  name: string;
553
- framework: "react" | "next" | "vite" | "other";
553
+ framework: "other" | "react" | "next" | "vite";
554
554
  commit?: string | undefined;
555
555
  env?: "local" | "preview" | "ci" | undefined;
556
556
  previewUrl?: string | undefined;
557
557
  }, {
558
558
  name: string;
559
- framework: "react" | "next" | "vite" | "other";
559
+ framework: "other" | "react" | "next" | "vite";
560
560
  commit?: string | undefined;
561
561
  env?: "local" | "preview" | "ci" | undefined;
562
562
  previewUrl?: string | undefined;
@@ -570,11 +570,11 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
570
570
  }>;
571
571
  model: z.ZodOptional<z.ZodString>;
572
572
  }, "strip", z.ZodTypeAny, {
573
- kind: "coding-agent" | "oem-pipeline" | "human";
573
+ kind: "human" | "coding-agent" | "oem-pipeline";
574
574
  id: string;
575
575
  model?: string | undefined;
576
576
  }, {
577
- kind: "coding-agent" | "oem-pipeline" | "human";
577
+ kind: "human" | "coding-agent" | "oem-pipeline";
578
578
  id: string;
579
579
  model?: string | undefined;
580
580
  }>;
@@ -987,6 +987,18 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
987
987
  evidenceRef?: string | undefined;
988
988
  failureReason?: string | undefined;
989
989
  }[];
990
+ agent: {
991
+ kind: "human" | "coding-agent" | "oem-pipeline";
992
+ id: string;
993
+ model?: string | undefined;
994
+ };
995
+ project: {
996
+ name: string;
997
+ framework: "other" | "react" | "next" | "vite";
998
+ commit?: string | undefined;
999
+ env?: "local" | "preview" | "ci" | undefined;
1000
+ previewUrl?: string | undefined;
1001
+ };
990
1002
  durationMs: number;
991
1003
  createdAt: number;
992
1004
  evidence: {
@@ -1017,18 +1029,6 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
1017
1029
  schemaVersion: 1;
1018
1030
  runId: string & z.BRAND<"RunId">;
1019
1031
  profile: "dev" | "prod-preview";
1020
- project: {
1021
- name: string;
1022
- framework: "react" | "next" | "vite" | "other";
1023
- commit?: string | undefined;
1024
- env?: "local" | "preview" | "ci" | undefined;
1025
- previewUrl?: string | undefined;
1026
- };
1027
- agent: {
1028
- kind: "coding-agent" | "oem-pipeline" | "human";
1029
- id: string;
1030
- model?: string | undefined;
1031
- };
1032
1032
  trigger: {
1033
1033
  kind: "manual" | "edit" | "ci" | "oem";
1034
1034
  note?: string | undefined;
@@ -1082,6 +1082,18 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
1082
1082
  signedAt: number;
1083
1083
  } | undefined;
1084
1084
  }, {
1085
+ agent: {
1086
+ kind: "human" | "coding-agent" | "oem-pipeline";
1087
+ id: string;
1088
+ model?: string | undefined;
1089
+ };
1090
+ project: {
1091
+ name: string;
1092
+ framework: "other" | "react" | "next" | "vite";
1093
+ commit?: string | undefined;
1094
+ env?: "local" | "preview" | "ci" | undefined;
1095
+ previewUrl?: string | undefined;
1096
+ };
1085
1097
  durationMs: number;
1086
1098
  createdAt: number;
1087
1099
  evidence: {
@@ -1112,18 +1124,6 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
1112
1124
  schemaVersion: 1;
1113
1125
  runId: string;
1114
1126
  profile: "dev" | "prod-preview";
1115
- project: {
1116
- name: string;
1117
- framework: "react" | "next" | "vite" | "other";
1118
- commit?: string | undefined;
1119
- env?: "local" | "preview" | "ci" | undefined;
1120
- previewUrl?: string | undefined;
1121
- };
1122
- agent: {
1123
- kind: "coding-agent" | "oem-pipeline" | "human";
1124
- id: string;
1125
- model?: string | undefined;
1126
- };
1127
1127
  trigger: {
1128
1128
  kind: "manual" | "edit" | "ci" | "oem";
1129
1129
  note?: string | undefined;
@@ -21,6 +21,59 @@ export declare const Verified: {
21
21
  readonly UNKNOWN: "unknown";
22
22
  };
23
23
  export type Verified = (typeof Verified)[keyof typeof Verified];
24
+ /**
25
+ * WHY a verdict came out the way it did — the deciding clause of the rule, named.
26
+ *
27
+ * `Verified` has three values and the rule has eleven clauses, so the wire collapsed opposite facts
28
+ * into one string. Measured over a real session: `unknown` covered "the agent malformed the call",
29
+ * "the app answered 202 and has not finished", and "Reticle could not see the capture" — three
30
+ * owners needing three opposite responses, one bar on a dashboard. `no` was no better: "channels
31
+ * disagree" (Reticle earning its keep) and "the agent's predicate failed" read identically.
32
+ *
33
+ * This is the SINGLE list. `decideVerified` returns a member from each clause, and the telemetry
34
+ * schema narrows to `z.nativeEnum` of this — so a new clause cannot ship without a member here, and
35
+ * a member cannot exist without a clause producing it (`verified.test.ts` asserts the two sets are
36
+ * equal). Nothing anywhere re-lists these.
37
+ */
38
+ export declare const VerifiedReason: {
39
+ /** The assertion was never EVALUATED — under-specified call, or nothing instrumented to read. */
40
+ readonly INCONCLUSIVE: "inconclusive";
41
+ /**
42
+ * The tab went away mid-wait, so the action's outcome was never observed. NOT a failure.
43
+ *
44
+ * This existed as a fact and had nowhere to go. `waitForPredicate` finishes a disconnected wait
45
+ * with `{ pass: false, failureReason: 'session disconnected' }`, and the only clause that took a
46
+ * false `pass` said ASSERTION_FAILED — so a reload during a wait produced, verbatim:
47
+ *
48
+ * verified: "no", verifiedReason: "assertion_failed",
49
+ * because: "the declared consequence did not hold", source: "src/components/Counter.tsx:18"
50
+ *
51
+ * The app was fine; the observer left. An agent reading that goes and edits Counter.tsx. Every
52
+ * other clause in this rule is tuned to avoid claiming more than was observed, and the absence of
53
+ * this member made the nearest available answer a false claim in the opposite direction — a false
54
+ * RED, from the layer whose entire job is not to produce one.
55
+ */
56
+ readonly OBSERVATION_LOST: "observation_lost";
57
+ /** The declared consequence did not hold. */
58
+ readonly ASSERTION_FAILED: "assertion_failed";
59
+ /** Channels disagreed about the action — the false green this product exists to catch. */
60
+ readonly CONTRADICTED: "contradicted";
61
+ /** The consequence was already true beforehand, so it proves nothing about the action. */
62
+ readonly ALREADY_TRUE: "already_true";
63
+ /** The capture was not clean, so a green would only describe what happened to be observed. */
64
+ readonly UNCLEAN_CAPTURE: "unclean_capture";
65
+ /** Nothing was asserted at a real grade — the assertion could not have failed. */
66
+ readonly VACUOUS_GRADE: "vacuous_grade";
67
+ /** A write answered 202 Accepted: the outcome does not exist yet. */
68
+ readonly OUTCOME_PENDING: "outcome_pending";
69
+ /** A 2xx whose body was never recorded, so the one channel that could disagree was closed. */
70
+ readonly OUTCOME_UNREAD: "outcome_unread";
71
+ /** The page never settled, so the reaction window may have closed early. */
72
+ readonly UNSETTLED: "unsettled";
73
+ /** Held at a real grade over a clean capture with no channel disagreeing. */
74
+ readonly PROVED: "proved";
75
+ };
76
+ export type VerifiedReason = (typeof VerifiedReason)[keyof typeof VerifiedReason];
24
77
  /**
25
78
  * Actionable companion to NO_PROVIDER for the tools that genuinely intercept or capture through CDP
26
79
  * — network mocking and viewport control — which is NOT "visual capture".
@@ -20,6 +20,58 @@ export const Verified = {
20
20
  /** Not determinable from this evidence — vacuous grade, dirty capture, or never settled. */
21
21
  UNKNOWN: 'unknown',
22
22
  };
23
+ /**
24
+ * WHY a verdict came out the way it did — the deciding clause of the rule, named.
25
+ *
26
+ * `Verified` has three values and the rule has eleven clauses, so the wire collapsed opposite facts
27
+ * into one string. Measured over a real session: `unknown` covered "the agent malformed the call",
28
+ * "the app answered 202 and has not finished", and "Reticle could not see the capture" — three
29
+ * owners needing three opposite responses, one bar on a dashboard. `no` was no better: "channels
30
+ * disagree" (Reticle earning its keep) and "the agent's predicate failed" read identically.
31
+ *
32
+ * This is the SINGLE list. `decideVerified` returns a member from each clause, and the telemetry
33
+ * schema narrows to `z.nativeEnum` of this — so a new clause cannot ship without a member here, and
34
+ * a member cannot exist without a clause producing it (`verified.test.ts` asserts the two sets are
35
+ * equal). Nothing anywhere re-lists these.
36
+ */
37
+ export const VerifiedReason = {
38
+ /** The assertion was never EVALUATED — under-specified call, or nothing instrumented to read. */
39
+ INCONCLUSIVE: 'inconclusive',
40
+ /**
41
+ * The tab went away mid-wait, so the action's outcome was never observed. NOT a failure.
42
+ *
43
+ * This existed as a fact and had nowhere to go. `waitForPredicate` finishes a disconnected wait
44
+ * with `{ pass: false, failureReason: 'session disconnected' }`, and the only clause that took a
45
+ * false `pass` said ASSERTION_FAILED — so a reload during a wait produced, verbatim:
46
+ *
47
+ * verified: "no", verifiedReason: "assertion_failed",
48
+ * because: "the declared consequence did not hold", source: "src/components/Counter.tsx:18"
49
+ *
50
+ * The app was fine; the observer left. An agent reading that goes and edits Counter.tsx. Every
51
+ * other clause in this rule is tuned to avoid claiming more than was observed, and the absence of
52
+ * this member made the nearest available answer a false claim in the opposite direction — a false
53
+ * RED, from the layer whose entire job is not to produce one.
54
+ */
55
+ OBSERVATION_LOST: 'observation_lost',
56
+ /** The declared consequence did not hold. */
57
+ ASSERTION_FAILED: 'assertion_failed',
58
+ /** Channels disagreed about the action — the false green this product exists to catch. */
59
+ CONTRADICTED: 'contradicted',
60
+ /** The consequence was already true beforehand, so it proves nothing about the action. */
61
+ ALREADY_TRUE: 'already_true',
62
+ /** The capture was not clean, so a green would only describe what happened to be observed. */
63
+ UNCLEAN_CAPTURE: 'unclean_capture',
64
+ /** Nothing was asserted at a real grade — the assertion could not have failed. */
65
+ VACUOUS_GRADE: 'vacuous_grade',
66
+ /** A write answered 202 Accepted: the outcome does not exist yet. */
67
+ OUTCOME_PENDING: 'outcome_pending',
68
+ /** A 2xx whose body was never recorded, so the one channel that could disagree was closed. */
69
+ OUTCOME_UNREAD: 'outcome_unread',
70
+ /** The page never settled, so the reaction window may have closed early. */
71
+ UNSETTLED: 'unsettled',
72
+ /** Held at a real grade over a clean capture with no channel disagreeing. */
73
+ PROVED: 'proved',
74
+ };
23
75
  /**
24
76
  * Actionable companion to NO_PROVIDER for the tools that genuinely intercept or capture through CDP
25
77
  * — network mocking and viewport control — which is NOT "visual capture".
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reticlehq/core",
3
- "version": "2.4.0",
3
+ "version": "2.6.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",
@@ -14,7 +14,8 @@
14
14
  "./desktop-contract": {
15
15
  "types": "./dist/desktop-contract.d.cts",
16
16
  "default": "./dist/desktop-contract.cjs"
17
- }
17
+ },
18
+ "./package.json": "./package.json"
18
19
  },
19
20
  "dependencies": {
20
21
  "zod": "^3.24.1"
@@ -54,6 +55,7 @@
54
55
  "build": "tsc -b && node scripts/gen-schema.mjs && node scripts/gen-desktop-contract.mjs",
55
56
  "typecheck": "tsc -b",
56
57
  "lint": "eslint src",
57
- "test:unit": "vitest run src --passWithNoTests"
58
+ "test:unit": "vitest run src --passWithNoTests",
59
+ "test:coverage": "vitest run src --passWithNoTests --coverage.enabled --coverage.provider=v8 --coverage.reporter=text-summary --coverage.include='src/**/*.ts' --coverage.exclude='src/**/*.test.ts'"
58
60
  }
59
61
  }