@reticlehq/core 3.7.0 → 3.8.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 (108) hide show
  1. package/dist/activation-entry.d.ts +9 -0
  2. package/dist/activation-entry.js +9 -0
  3. package/dist/artifacts/drive-script.d.ts +64 -64
  4. package/dist/artifacts/flow-constants.d.ts +15 -0
  5. package/dist/artifacts/flow-constants.js +15 -0
  6. package/dist/artifacts/flow-expect-flat.d.ts +8 -8
  7. package/dist/artifacts/flow-results.d.ts +11 -0
  8. package/dist/artifacts/flow-types.d.ts +164 -118
  9. package/dist/artifacts/flow-types.js +12 -0
  10. package/dist/artifacts/harness-credits.d.ts +6 -3
  11. package/dist/artifacts/harness-credits.js +9 -6
  12. package/dist/artifacts/harness-map.d.ts +6 -6
  13. package/dist/artifacts/impact.d.ts +77 -80
  14. package/dist/artifacts/impact.js +34 -17
  15. package/dist/artifacts/journal.d.ts +25 -6
  16. package/dist/artifacts/journal.js +13 -0
  17. package/dist/artifacts/prompt-context.d.ts +12 -0
  18. package/dist/artifacts/prompt-context.js +14 -3
  19. package/dist/graph/app-graph.d.ts +137 -0
  20. package/dist/graph/app-graph.js +498 -0
  21. package/dist/hooks/hook-events.d.ts +22 -22
  22. package/dist/hud-entry.js +1 -1
  23. package/dist/identity/checkout.d.ts +41 -0
  24. package/dist/identity/checkout.js +118 -0
  25. package/dist/identity/state-dir.d.ts +23 -0
  26. package/dist/identity/state-dir.js +43 -0
  27. package/dist/index.d.ts +10 -0
  28. package/dist/index.js +10 -0
  29. package/dist/onboarding.d.ts +22 -1
  30. package/dist/onboarding.js +19 -0
  31. package/dist/registry/dev-server-registry.d.ts +2 -2
  32. package/dist/schema/event-message.json +3 -1
  33. package/dist/schema/event-payloads.json +116 -1
  34. package/dist/schema/event-type.json +3 -1
  35. package/dist/schema/hello-message.json +21 -0
  36. package/dist/schema/reticle-event.json +3 -1
  37. package/dist/schema/reticle-message.json +24 -1
  38. package/dist/telemetry-bug.d.ts +6 -6
  39. package/dist/telemetry-entry.d.ts +1 -1
  40. package/dist/telemetry-entry.js +1 -1
  41. package/dist/telemetry-feedback.d.ts +14 -0
  42. package/dist/telemetry-feedback.js +19 -0
  43. package/dist/telemetry-refusal.d.ts +2 -2
  44. package/dist/telemetry-session.d.ts +23 -8
  45. package/dist/telemetry-session.js +15 -4
  46. package/dist/telemetry-signals.d.ts +227 -9
  47. package/dist/telemetry-signals.js +88 -1
  48. package/dist/telemetry.d.ts +379 -72
  49. package/dist/telemetry.js +71 -5
  50. package/dist/verdict/check-sentence.d.ts +34 -0
  51. package/dist/verdict/check-sentence.js +228 -0
  52. package/dist/verdict/consequence.d.ts +15 -0
  53. package/dist/verdict/consequence.js +11 -0
  54. package/dist/verdict/findings.d.ts +10 -0
  55. package/dist/verdict/findings.js +13 -0
  56. package/dist/verdict/instrumentation-coverage.d.ts +3 -34
  57. package/dist/verdict/instrumentation-coverage.js +14 -58
  58. package/dist/verdict/instrumentation-gap.d.ts +79 -0
  59. package/dist/verdict/instrumentation-gap.js +64 -0
  60. package/dist/verdict/predicate-tree.d.ts +2 -0
  61. package/dist/verdict/predicate-tree.js +16 -0
  62. package/dist/verdict/predicate.d.ts +2 -1
  63. package/dist/verdict/predicate.js +103 -12
  64. package/dist/verdict/property-assertion.d.ts +2 -2
  65. package/dist/verdict/run-report.d.ts +166 -0
  66. package/dist/verdict/run-report.js +53 -0
  67. package/dist/verdict/security.d.ts +36 -2
  68. package/dist/verdict/security.js +94 -14
  69. package/dist/verdict/verification-run.d.ts +95 -38
  70. package/dist/verdict/verification-run.js +33 -2
  71. package/dist/verdict/verify-progress.d.ts +6 -6
  72. package/dist/wire/constants/constants.d.ts +56 -141
  73. package/dist/wire/constants/constants.js +64 -144
  74. package/dist/wire/constants/discovery.d.ts +4 -4
  75. package/dist/wire/constants/discovery.js +4 -4
  76. package/dist/wire/constants/event-types.d.ts +35 -1
  77. package/dist/wire/constants/event-types.js +33 -1
  78. package/dist/wire/constants/hud-controls.js +0 -2
  79. package/dist/wire/constants/hud-use.d.ts +4 -0
  80. package/dist/wire/constants/hud-use.js +4 -0
  81. package/dist/wire/constants/mcp-wire.d.ts +16 -0
  82. package/dist/wire/constants/mcp-wire.js +16 -0
  83. package/dist/wire/constants/response-body-reason.d.ts +19 -0
  84. package/dist/wire/constants/response-body-reason.js +18 -0
  85. package/dist/wire/constants/reticle-env.d.ts +138 -0
  86. package/dist/wire/constants/reticle-env.js +138 -0
  87. package/dist/wire/constants/session-constants.d.ts +11 -0
  88. package/dist/wire/constants/session-constants.js +11 -0
  89. package/dist/wire/event-payloads.d.ts +150 -36
  90. package/dist/wire/event-payloads.js +83 -16
  91. package/dist/wire/messages.d.ts +102 -36
  92. package/dist/wire/messages.js +16 -0
  93. package/dist/wire/narrow.d.ts +6 -0
  94. package/dist/wire/narrow.js +26 -0
  95. package/dist/wire/next-step.d.ts +90 -0
  96. package/dist/wire/next-step.js +37 -0
  97. package/dist/wire/platform-link.d.ts +7 -0
  98. package/dist/wire/platform-link.js +12 -6
  99. package/dist/wire/production/activation-ticket.d.ts +64 -0
  100. package/dist/wire/production/activation-ticket.js +148 -0
  101. package/dist/wire/production/hello-mode.d.ts +35 -0
  102. package/dist/wire/production/hello-mode.js +32 -0
  103. package/dist/wire/production/production-policy.d.ts +138 -0
  104. package/dist/wire/production/production-policy.js +133 -0
  105. package/dist/wire/tool-names.d.ts +2 -0
  106. package/dist/wire/tool-names.js +2 -0
  107. package/dist/wire/types.d.ts +73 -48
  108. package/package.json +5 -1
@@ -81,6 +81,14 @@ export declare const PromptContextSchema: z.ZodObject<{
81
81
  /** When the request was given, epoch ms. A run long after it is not about it. */
82
82
  at: z.ZodOptional<z.ZodNumber>;
83
83
  shared: z.ZodOptional<z.ZodBoolean>;
84
+ /**
85
+ * What the agent said when it finished the turn this run belongs to: the first `agent_stop`
86
+ * message at or after the run's last Reticle call, redacted and bounded where it was recorded.
87
+ * The user's words' counterpart, so it leaves the machine under the same `shared` decision.
88
+ */
89
+ closingClaim: z.ZodOptional<z.ZodString>;
90
+ /** When that turn ended, epoch ms. */
91
+ closingClaimAt: z.ZodOptional<z.ZodNumber>;
84
92
  }, "strip", z.ZodTypeAny, {
85
93
  statements: {
86
94
  text: string;
@@ -90,6 +98,8 @@ export declare const PromptContextSchema: z.ZodObject<{
90
98
  at?: number | undefined;
91
99
  request?: string | undefined;
92
100
  shared?: boolean | undefined;
101
+ closingClaim?: string | undefined;
102
+ closingClaimAt?: number | undefined;
93
103
  }, {
94
104
  at?: number | undefined;
95
105
  request?: string | undefined;
@@ -99,6 +109,8 @@ export declare const PromptContextSchema: z.ZodObject<{
99
109
  source: "agent" | "user";
100
110
  }[] | undefined;
101
111
  shared?: boolean | undefined;
112
+ closingClaim?: string | undefined;
113
+ closingClaimAt?: number | undefined;
102
114
  }>;
103
115
  export type PromptContext = z.infer<typeof PromptContextSchema>;
104
116
  /** A run as it may leave this machine: its prompt context only when the project shares it. */
@@ -64,9 +64,11 @@ const STATEMENT_RULES = [
64
64
  * function without changing what is stored.
65
65
  */
66
66
  export function classifyStatement(text) {
67
- for (const rule of STATEMENT_RULES)
68
- if (rule.words.test(text))
67
+ for (const rule of STATEMENT_RULES) {
68
+ if (rule.words.test(text)) {
69
69
  return rule.kind;
70
+ }
71
+ }
70
72
  return StatementKind.BUSINESS_INTENT;
71
73
  }
72
74
  /** A request split into the sentences a reader would weigh one at a time. */
@@ -98,11 +100,20 @@ export const PromptContextSchema = z.object({
98
100
  /** When the request was given, epoch ms. A run long after it is not about it. */
99
101
  at: z.number().optional(),
100
102
  shared: z.boolean().optional(),
103
+ /**
104
+ * What the agent said when it finished the turn this run belongs to: the first `agent_stop`
105
+ * message at or after the run's last Reticle call, redacted and bounded where it was recorded.
106
+ * The user's words' counterpart, so it leaves the machine under the same `shared` decision.
107
+ */
108
+ closingClaim: z.string().max(20_000).optional(),
109
+ /** When that turn ended, epoch ms. */
110
+ closingClaimAt: z.number().optional(),
101
111
  });
102
112
  /** A run as it may leave this machine: its prompt context only when the project shares it. */
103
113
  export function shareableRun(run) {
104
- if ('object' !== typeof run || null === run || !('context' in run))
114
+ if ('object' !== typeof run || null === run || !('context' in run)) {
105
115
  return run;
116
+ }
106
117
  const { context, ...rest } = run;
107
118
  return true === context?.shared ? run : rest;
108
119
  }
@@ -0,0 +1,137 @@
1
+ /**
2
+ * The App Graph (what the cloud calls the App Map): the app as a graph, built from what each run recorded.
3
+ *
4
+ * Nodes are screens (route patterns), actions (what an act pressed, anchored the way a saved flow
5
+ * anchors it), requests (method and route pattern) and the things writes made. Edges say a screen HAS
6
+ * an action, an action LEADS TO a screen, SENDS a request and MAKES a thing. Everything here was
7
+ * observed: the model's words never add a node. Ids collapse (`templatePath`), so a hundred
8
+ * conversations are one screen and a row the drive created is a thing made, never a new screen: the
9
+ * create-and-back-out loop a state graph otherwise falls into: each new row looks like a new screen,
10
+ * so the drive keeps making rows and backing out.
11
+ *
12
+ * Pure: a run's acts and recording in, a run's map out; merged into the app's map across runs. One fold,
13
+ * here in core, so the cloud verifier and the open-source daemon describe an app the same way: a fix to
14
+ * how a screen is named lands in both. A run's acts arrive already parsed (`DrivenStep`): reading them
15
+ * off a harness's tool calls needs the server package, so each caller does that and hands this the steps.
16
+ */
17
+ import type { ReticleEvent } from '../wire/messages.js';
18
+ /** One act a drive dispatched, anchored the way a flow anchors it, with its own window of events. */
19
+ export interface DrivenStep {
20
+ anchor: Record<string, unknown>;
21
+ since: number;
22
+ window: readonly ReticleEvent[];
23
+ /** Whether the consequence it declared held: absent when it declared none. */
24
+ held?: boolean;
25
+ }
26
+ /** What a layout audit measured wrong on a screen (clipped text, overlap, contrast). */
27
+ export interface LayoutDefectSeen {
28
+ kind: string;
29
+ what: string;
30
+ value: number;
31
+ bound: number;
32
+ }
33
+ /** An app's identity: its origin, so every path of one deployment is one app. */
34
+ export declare function appIdentity(url: string): string;
35
+ /** A path or URL as a route pattern: query dropped, origin dropped, record ids as `:id`. */
36
+ export declare function templatePath(url: string): string;
37
+ /** The route a route-change event names: the app's own pattern first, else the path it went to. */
38
+ export declare const routeOf: (data: Record<string, unknown>) => string | undefined;
39
+ export declare const MapNodeKind: {
40
+ readonly SCREEN: "screen";
41
+ readonly ACTION: "action";
42
+ readonly REQUEST: "request";
43
+ readonly THING: "thing";
44
+ };
45
+ export type MapNodeKind = (typeof MapNodeKind)[keyof typeof MapNodeKind];
46
+ export declare const MapEdgeKind: {
47
+ readonly HAS: "has";
48
+ readonly LEADS_TO: "leads-to";
49
+ readonly SENDS: "sends";
50
+ readonly MAKES: "makes";
51
+ };
52
+ export type MapEdgeKind = (typeof MapEdgeKind)[keyof typeof MapEdgeKind];
53
+ export interface MapNode {
54
+ id: string;
55
+ kind: MapNodeKind;
56
+ label: string;
57
+ /** Runs that saw it. */
58
+ seen: number;
59
+ lastRun: string;
60
+ /** For an action: runs in which a consequence it declared held, and in which one was refuted. */
61
+ proven?: number;
62
+ refuted?: number;
63
+ /** For an action: runs in which it was pressed. An action only seen on its screen has none. */
64
+ pressed?: number;
65
+ /** For a pressed action: how to press it again, as the act that pressed it named the element. */
66
+ anchor?: Anchor;
67
+ /** For a screen: problems the latest run that reached it found there. Cleared by a clean one. */
68
+ found?: number;
69
+ }
70
+ /** How an act names an element: by test id, or by role and accessible name. */
71
+ export interface Anchor {
72
+ by: string;
73
+ value: string;
74
+ name?: string;
75
+ }
76
+ export interface MapEdge {
77
+ from: string;
78
+ to: string;
79
+ kind: MapEdgeKind;
80
+ seen: number;
81
+ lastRun: string;
82
+ }
83
+ export interface AppMap {
84
+ nodes: readonly MapNode[];
85
+ edges: readonly MapEdge[];
86
+ }
87
+ /** One run's map, before it is merged: what it saw, without counts. */
88
+ export interface RunMap {
89
+ nodes: Map<string, {
90
+ kind: MapNodeKind;
91
+ label: string;
92
+ held?: boolean;
93
+ pressed?: true;
94
+ anchor?: Anchor;
95
+ found?: number;
96
+ }>;
97
+ edges: Map<string, {
98
+ from: string;
99
+ to: string;
100
+ kind: MapEdgeKind;
101
+ }>;
102
+ }
103
+ /** One control a look saw on a screen. */
104
+ export interface SeenControl {
105
+ role: string;
106
+ name: string;
107
+ testid?: string;
108
+ /** The component it renders in, when the engine names it: a data-named row's identity. */
109
+ component?: string;
110
+ }
111
+ /** The controls each look saw, and on which screen. */
112
+ export interface SeenScreen {
113
+ screen: string;
114
+ controls: readonly SeenControl[];
115
+ /** What the engine's layout audit measured wrong on it, when it was asked. */
116
+ defects?: readonly LayoutDefectSeen[];
117
+ }
118
+ /** The controls in a snapshot tree; rows (long, data-named, with no test id) left out. */
119
+ export declare const controlsOf: (tree: string) => SeenControl[];
120
+ /** The map one run recorded. `start` is the route the run was loaded on. */
121
+ export declare function mapOfRun(steps: readonly DrivenStep[], events: readonly ReticleEvent[], start?: string, seen?: readonly SeenScreen[]): RunMap;
122
+ /** The app's map with one more run folded in: counts add up, nothing a run did not see is lost. */
123
+ export declare function mergeMap(map: AppMap | undefined, run: RunMap, runId: string): AppMap;
124
+ /** What the map knows, in one line. */
125
+ export declare function mapLine(map: AppMap): string;
126
+ /**
127
+ * The most important screens first, with how much of each is proven: where the next run should go.
128
+ * Importance is read off the graph, never guessed: the actions that lead to a screen, and, twice over,
129
+ * the kinds of thing its actions make (the work people come to do).
130
+ */
131
+ export declare function frontierLine(map: AppMap): string;
132
+ /**
133
+ * The actions to press to get from one screen to another, by the map's pressed edges: the shortest
134
+ * way, each by the anchor it was pressed with. Empty when already there; undefined when the map knows
135
+ * no way (a run then reaches it some other way, or a replay starts where it is).
136
+ */
137
+ export declare function pathTo(map: AppMap, from: string, to: string): Anchor[] | undefined;