@reticlehq/core 3.4.0 → 3.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.
- package/dist/artifacts/artifacts-entry.d.ts +2 -0
- package/dist/artifacts/artifacts-entry.js +2 -0
- package/dist/artifacts/drive-script.d.ts +1298 -0
- package/dist/artifacts/drive-script.js +197 -0
- package/dist/artifacts/flow-constants.d.ts +1 -0
- package/dist/artifacts/flow-constants.js +1 -0
- package/dist/artifacts/flow-types.d.ts +60 -0
- package/dist/artifacts/flow-types.js +10 -0
- package/dist/artifacts/hud-notices.d.ts +134 -0
- package/dist/artifacts/hud-notices.js +124 -0
- package/dist/artifacts/impact.d.ts +135 -44
- package/dist/artifacts/impact.js +25 -0
- package/dist/artifacts/journal.d.ts +49 -0
- package/dist/artifacts/journal.js +15 -0
- package/dist/artifacts/prompt-context.d.ts +105 -0
- package/dist/artifacts/prompt-context.js +108 -0
- package/dist/desktop-contract.cjs +1 -0
- package/dist/desktop-contract.d.cts +1 -0
- package/dist/hud-entry.d.ts +1 -0
- package/dist/hud-entry.js +2 -0
- package/dist/identity/contract-fingerprint.d.ts +9 -0
- package/dist/identity/contract-fingerprint.js +12 -0
- package/dist/identity/testid-attribute.d.ts +18 -0
- package/dist/identity/testid-attribute.js +24 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/dist/onboarding.d.ts +2 -2
- package/dist/schema/command-message.json +6 -0
- package/dist/schema/command-name.json +3 -1
- package/dist/schema/event-payloads.json +16 -0
- package/dist/schema/reticle-message.json +6 -0
- package/dist/telemetry-refusal.d.ts +3 -2
- package/dist/telemetry-session.d.ts +5 -1
- package/dist/telemetry-session.js +3 -1
- package/dist/telemetry.d.ts +42 -34
- package/dist/telemetry.js +3 -3
- package/dist/tour.d.ts +1 -0
- package/dist/tour.js +13 -5
- package/dist/verdict/consequence.d.ts +3 -0
- package/dist/verdict/findings.d.ts +5 -0
- package/dist/verdict/findings.js +7 -0
- package/dist/verdict/predicate.d.ts +14 -0
- package/dist/verdict/predicate.js +7 -12
- package/dist/verdict/verdict-attribution.js +1 -0
- package/dist/verdict/verification-run.d.ts +18 -0
- package/dist/verdict/verification-run.js +8 -0
- package/dist/verdict/verified-constants.d.ts +19 -0
- package/dist/verdict/verified-constants.js +22 -0
- package/dist/wire/constants/constants.d.ts +44 -16
- package/dist/wire/constants/constants.js +44 -16
- package/dist/wire/constants/hud-controls.d.ts +1 -1
- package/dist/wire/constants/hud-controls.js +21 -0
- package/dist/wire/constants/hud-use.d.ts +64 -1
- package/dist/wire/constants/hud-use.js +40 -1
- package/dist/wire/constants/session-constants.d.ts +8 -0
- package/dist/wire/constants/session-constants.js +8 -0
- package/dist/wire/desktop-contract.d.ts +3 -0
- package/dist/wire/desktop-contract.js +3 -0
- package/dist/wire/event-payloads.d.ts +25 -4
- package/dist/wire/event-payloads.js +10 -0
- package/dist/wire/global-press.d.ts +34 -3
- package/dist/wire/global-press.js +91 -3
- package/dist/wire/hold.d.ts +14 -0
- package/dist/wire/hold.js +18 -0
- package/dist/wire/messages.d.ts +42 -18
- package/dist/wire/messages.js +8 -0
- package/dist/wire/platform-link.d.ts +161 -0
- package/dist/wire/platform-link.js +189 -0
- package/dist/wire/types.d.ts +7 -0
- package/dist/words/no-session-reason.d.ts +7 -0
- package/dist/words/no-session-reason.js +7 -0
- package/dist/words/notices.js +4 -2
- package/package.json +1 -1
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A drive script: the Harness's plan, written down before it drives, in a language small enough to
|
|
3
|
+
* check.
|
|
4
|
+
*
|
|
5
|
+
* Journeys say WHAT to drive: replay a saved flow (deterministic, no model), act and wait on one
|
|
6
|
+
* exact control, hand an open goal to the model, assert a consequence. Lanes say HOW: each lane is
|
|
7
|
+
* one browser context driven in order, and lanes run side by side. A journey that needs another one
|
|
8
|
+
* either follows it in the same lane (and inherits its page) or waits on it from a later lane (a
|
|
9
|
+
* barrier: it starts once that journey passed, and is blocked if it failed).
|
|
10
|
+
*
|
|
11
|
+
* A checkpoint names a point a journey can come back to, and how: replay a flow up to a step. A
|
|
12
|
+
* branch drives several cases from that point; every case after the first re-enters it first, so
|
|
13
|
+
* each case starts from the same page and not from wherever the previous case left it.
|
|
14
|
+
*
|
|
15
|
+
* Daemon-side only: the HUD draws a plan from a flat view of it (`PlanView`), never this schema.
|
|
16
|
+
*/
|
|
17
|
+
import { z } from 'zod';
|
|
18
|
+
import { PredicateSchema } from '../verdict/predicate.js';
|
|
19
|
+
export const ScriptStepKind = {
|
|
20
|
+
REPLAY: 'replay',
|
|
21
|
+
ACT: 'act',
|
|
22
|
+
ASSERT: 'assert',
|
|
23
|
+
CHECKPOINT: 'checkpoint',
|
|
24
|
+
BRANCH: 'branch',
|
|
25
|
+
};
|
|
26
|
+
export const ScriptSource = { LOCAL: 'local', PLATFORM: 'platform' };
|
|
27
|
+
const ReplayStep = z.object({
|
|
28
|
+
kind: z.literal(ScriptStepKind.REPLAY),
|
|
29
|
+
flow: z.string().min(1),
|
|
30
|
+
/** Continue at this step on the page as it is: a branch case picking up at its checkpoint. */
|
|
31
|
+
at: z.number().int().positive().optional(),
|
|
32
|
+
/** Stop before this step. Absent: the whole flow. */
|
|
33
|
+
to: z.number().int().positive().optional(),
|
|
34
|
+
});
|
|
35
|
+
const ActStep = z
|
|
36
|
+
.object({
|
|
37
|
+
kind: z.literal(ScriptStepKind.ACT),
|
|
38
|
+
/** Exact: a target, an action and the consequence that must follow. */
|
|
39
|
+
target: z.record(z.string(), z.unknown()).optional(),
|
|
40
|
+
action: z.string().min(1).optional(),
|
|
41
|
+
args: z.record(z.string(), z.unknown()).optional(),
|
|
42
|
+
until: PredicateSchema.optional(),
|
|
43
|
+
/** Open: what the model should accomplish, in plain words. */
|
|
44
|
+
goal: z.string().min(1).optional(),
|
|
45
|
+
maxSteps: z.number().int().positive().max(40).optional(),
|
|
46
|
+
})
|
|
47
|
+
.refine((step) => (step.action === undefined) !== (step.goal === undefined), {
|
|
48
|
+
message: 'an act step is exact (`action`) or open (`goal`), never both and never neither',
|
|
49
|
+
});
|
|
50
|
+
const AssertStep = z.object({ kind: z.literal(ScriptStepKind.ASSERT), predicate: PredicateSchema });
|
|
51
|
+
const CheckpointStep = z.object({
|
|
52
|
+
kind: z.literal(ScriptStepKind.CHECKPOINT),
|
|
53
|
+
id: z.string().min(1),
|
|
54
|
+
/** How to get back here: replay this flow up to (not including) step `to`. */
|
|
55
|
+
reenter: z.object({ flow: z.string().min(1), to: z.number().int().positive() }),
|
|
56
|
+
});
|
|
57
|
+
const LeafStep = z.union([ReplayStep, ActStep, AssertStep]);
|
|
58
|
+
const BranchStep = z.object({
|
|
59
|
+
kind: z.literal(ScriptStepKind.BRANCH),
|
|
60
|
+
/** The checkpoint every case starts from. */
|
|
61
|
+
at: z.string().min(1),
|
|
62
|
+
cases: z
|
|
63
|
+
.array(z.object({
|
|
64
|
+
label: z.string().min(1),
|
|
65
|
+
/** Taken only when this holds once the checkpoint is re-entered. Absent: always taken. */
|
|
66
|
+
when: PredicateSchema.optional(),
|
|
67
|
+
steps: z.array(LeafStep).min(1),
|
|
68
|
+
}))
|
|
69
|
+
.min(2),
|
|
70
|
+
});
|
|
71
|
+
export const ScriptStepSchema = z.union([LeafStep, CheckpointStep, BranchStep]);
|
|
72
|
+
export const JourneySchema = z.object({
|
|
73
|
+
id: z.string().min(1),
|
|
74
|
+
title: z.string().min(1),
|
|
75
|
+
persona: z.string().optional(),
|
|
76
|
+
dependsOn: z.array(z.string()).default([]),
|
|
77
|
+
steps: z.array(ScriptStepSchema).min(1),
|
|
78
|
+
});
|
|
79
|
+
export const LaneSchema = z.object({
|
|
80
|
+
id: z.string().min(1),
|
|
81
|
+
/** Driven in this order, in one browser context. */
|
|
82
|
+
journeys: z.array(z.string()).min(1),
|
|
83
|
+
});
|
|
84
|
+
export const DriveScriptSchema = z.object({
|
|
85
|
+
version: z.literal(1),
|
|
86
|
+
source: z.enum([ScriptSource.LOCAL, ScriptSource.PLATFORM]),
|
|
87
|
+
personas: z.array(z.object({ name: z.string(), journey: z.string() })).default([]),
|
|
88
|
+
journeys: z.array(JourneySchema),
|
|
89
|
+
lanes: z.array(LaneSchema),
|
|
90
|
+
/** At most this many lanes at once. Absent: as many as the browser pool can lease. */
|
|
91
|
+
maxParallel: z.number().int().positive().optional(),
|
|
92
|
+
});
|
|
93
|
+
/**
|
|
94
|
+
* Every reason this script cannot run as written, or none.
|
|
95
|
+
*
|
|
96
|
+
* A dependency is honoured one of two ways: earlier in the same lane, or in an EARLIER lane (a
|
|
97
|
+
* barrier). Pointing only backwards is what makes a script acyclic and a barrier unable to wait on
|
|
98
|
+
* a lane that has not started, so no separate cycle check is needed.
|
|
99
|
+
*/
|
|
100
|
+
export function checkScript(script) {
|
|
101
|
+
const problems = [];
|
|
102
|
+
const byId = new Map();
|
|
103
|
+
for (const journey of script.journeys) {
|
|
104
|
+
if (byId.has(journey.id))
|
|
105
|
+
problems.push(`journey "${journey.id}" is declared twice`);
|
|
106
|
+
byId.set(journey.id, journey);
|
|
107
|
+
}
|
|
108
|
+
const placed = new Set(script.lanes.flatMap((lane) => lane.journeys));
|
|
109
|
+
for (const journey of script.journeys) {
|
|
110
|
+
if (!placed.has(journey.id))
|
|
111
|
+
problems.push(`journey "${journey.id}" is in no lane`);
|
|
112
|
+
for (const dep of journey.dependsOn) {
|
|
113
|
+
if (!byId.has(dep))
|
|
114
|
+
problems.push(`journey "${journey.id}" depends on unknown "${dep}"`);
|
|
115
|
+
}
|
|
116
|
+
problems.push(...checkBranches(journey));
|
|
117
|
+
}
|
|
118
|
+
script.lanes.forEach((lane, laneIndex) => {
|
|
119
|
+
lane.journeys.forEach((id, position) => {
|
|
120
|
+
const journey = byId.get(id);
|
|
121
|
+
if (journey === undefined) {
|
|
122
|
+
problems.push(`lane "${lane.id}" names unknown journey "${id}"`);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
for (const dep of journey.dependsOn) {
|
|
126
|
+
if (!byId.has(dep))
|
|
127
|
+
continue;
|
|
128
|
+
const sameLane = lane.journeys.slice(0, position).includes(dep);
|
|
129
|
+
const earlierLane = script.lanes
|
|
130
|
+
.slice(0, laneIndex)
|
|
131
|
+
.some((other) => other.journeys.includes(dep));
|
|
132
|
+
if (!sameLane && !earlierLane) {
|
|
133
|
+
problems.push(`journey "${id}" in lane "${lane.id}" needs "${dep}", which is neither earlier in its lane nor in an earlier lane`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
return problems;
|
|
139
|
+
}
|
|
140
|
+
function checkBranches(journey) {
|
|
141
|
+
const problems = [];
|
|
142
|
+
const seen = new Set();
|
|
143
|
+
for (const step of journey.steps) {
|
|
144
|
+
if (ScriptStepKind.CHECKPOINT === step.kind)
|
|
145
|
+
seen.add(step.id);
|
|
146
|
+
if (ScriptStepKind.BRANCH === step.kind && !seen.has(step.at)) {
|
|
147
|
+
problems.push(`journey "${journey.id}" branches at "${step.at}", which is not a checkpoint before it`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return problems;
|
|
151
|
+
}
|
|
152
|
+
/** The lane barrier a journey waits on: its dependencies that are not earlier in its own lane. */
|
|
153
|
+
export function barriersOf(script, laneId, journeyId) {
|
|
154
|
+
const lane = script.lanes.find((each) => each.id === laneId);
|
|
155
|
+
const journey = script.journeys.find((each) => each.id === journeyId);
|
|
156
|
+
if (lane === undefined || journey === undefined)
|
|
157
|
+
return [];
|
|
158
|
+
const before = lane.journeys.slice(0, lane.journeys.indexOf(journeyId));
|
|
159
|
+
return journey.dependsOn.filter((dep) => !before.includes(dep));
|
|
160
|
+
}
|
|
161
|
+
/** One line a person reads for a step: what it drives, in the plan's own words. */
|
|
162
|
+
export function stepLabel(step) {
|
|
163
|
+
switch (step.kind) {
|
|
164
|
+
case ScriptStepKind.REPLAY:
|
|
165
|
+
return `Replay ${step.flow}${step.at === undefined ? '' : ` from step ${String(step.at)}`}${step.to === undefined ? '' : ` to step ${String(step.to)}`}`;
|
|
166
|
+
case ScriptStepKind.ACT:
|
|
167
|
+
return step.goal ?? `${step.action ?? ''} ${targetText(step.target)}`.trim();
|
|
168
|
+
case ScriptStepKind.ASSERT:
|
|
169
|
+
return `Check ${predicateText(step.predicate)}`;
|
|
170
|
+
case ScriptStepKind.CHECKPOINT:
|
|
171
|
+
return `Checkpoint ${step.id}`;
|
|
172
|
+
case ScriptStepKind.BRANCH:
|
|
173
|
+
return `Branch at ${step.at}: ${step.cases.map((c) => c.label).join(' / ')}`;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
function targetText(target) {
|
|
177
|
+
if (target === undefined)
|
|
178
|
+
return '';
|
|
179
|
+
const value = Object.values(target).find((v) => 'string' === typeof v);
|
|
180
|
+
return 'string' === typeof value ? value : '';
|
|
181
|
+
}
|
|
182
|
+
function predicateText(predicate) {
|
|
183
|
+
if ('object' !== typeof predicate || null === predicate)
|
|
184
|
+
return 'a consequence';
|
|
185
|
+
const record = predicate;
|
|
186
|
+
const query = record['query'];
|
|
187
|
+
const inner = 'object' === typeof query && null !== query ? query : {};
|
|
188
|
+
const named = record['name'] ??
|
|
189
|
+
record['urlContains'] ??
|
|
190
|
+
record['pathname'] ??
|
|
191
|
+
record['path'] ??
|
|
192
|
+
record['text'] ??
|
|
193
|
+
inner['testid'] ??
|
|
194
|
+
inner['text'];
|
|
195
|
+
const kind = 'string' === typeof record['kind'] ? record['kind'] : 'consequence';
|
|
196
|
+
return 'string' === typeof named ? `${kind} ${named}` : kind;
|
|
197
|
+
}
|
|
@@ -162,6 +162,7 @@ export declare const ReplayStatus: {
|
|
|
162
162
|
readonly OK: "ok";
|
|
163
163
|
readonly DRIFT: "drift";
|
|
164
164
|
readonly ERROR: "error";
|
|
165
|
+
readonly UNVERIFIABLE: "unverifiable";
|
|
165
166
|
};
|
|
166
167
|
export type ReplayStatus = (typeof ReplayStatus)[keyof typeof ReplayStatus];
|
|
167
168
|
/**
|
|
@@ -173,6 +173,7 @@ export const ReplayStatus = {
|
|
|
173
173
|
OK: 'ok', // every anchor resolved and every step ran green
|
|
174
174
|
DRIFT: 'drift', // an anchor missed (testid renamed / signal not observed) — legible drift returned
|
|
175
175
|
ERROR: 'error', // the flow could not load or a resolved action failed
|
|
176
|
+
UNVERIFIABLE: 'unverifiable', // run could not be completed or graded (precondition unmet, secrets missing, document replaced)
|
|
176
177
|
};
|
|
177
178
|
/**
|
|
178
179
|
* Why an anchor failed to resolve at replay time (the "whose fault is
|
|
@@ -54,14 +54,20 @@ export declare const FlowAnchorSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObj
|
|
|
54
54
|
kind: z.ZodLiteral<"role">;
|
|
55
55
|
role: z.ZodString;
|
|
56
56
|
name: z.ZodOptional<z.ZodString>;
|
|
57
|
+
nth: z.ZodOptional<z.ZodNumber>;
|
|
58
|
+
of: z.ZodOptional<z.ZodNumber>;
|
|
57
59
|
}, "strip", z.ZodTypeAny, {
|
|
58
60
|
kind: "role";
|
|
59
61
|
role: string;
|
|
60
62
|
name?: string | undefined;
|
|
63
|
+
of?: number | undefined;
|
|
64
|
+
nth?: number | undefined;
|
|
61
65
|
}, {
|
|
62
66
|
kind: "role";
|
|
63
67
|
role: string;
|
|
64
68
|
name?: string | undefined;
|
|
69
|
+
of?: number | undefined;
|
|
70
|
+
nth?: number | undefined;
|
|
65
71
|
}>, z.ZodObject<{
|
|
66
72
|
kind: z.ZodLiteral<"signal">;
|
|
67
73
|
name: z.ZodString;
|
|
@@ -339,6 +345,16 @@ export interface FlowStepResult {
|
|
|
339
345
|
* reader to skim past it, and the whole value here is that its presence is the signal.
|
|
340
346
|
*/
|
|
341
347
|
contradictions?: Contradiction[];
|
|
348
|
+
/**
|
|
349
|
+
* The console errors and uncaught exceptions this step's window saw, the first few only; `digest`
|
|
350
|
+
* still counts every one. A run artifact's `evidence.consoleErrors` is built from these, so it
|
|
351
|
+
* reports what replay observed instead of claiming a clean console. Omitted when there were none.
|
|
352
|
+
*/
|
|
353
|
+
consoleErrors?: {
|
|
354
|
+
level: string;
|
|
355
|
+
message: string;
|
|
356
|
+
at: number;
|
|
357
|
+
}[];
|
|
342
358
|
ok: boolean;
|
|
343
359
|
error?: string;
|
|
344
360
|
note?: string;
|
|
@@ -621,6 +637,12 @@ export declare const FlowFileSchema: z.ZodObject<{
|
|
|
621
637
|
* the on-disk version stays FLOW_FILE_VERSION 1.
|
|
622
638
|
*/
|
|
623
639
|
startPath: z.ZodOptional<z.ZodString>;
|
|
640
|
+
/**
|
|
641
|
+
* The saved flow this one was generated from, with different parameters (a fixture's customer,
|
|
642
|
+
* a seeded id). A suite that writes runtime copies of a template and deletes them after replay
|
|
643
|
+
* proved the template, and a strict pass of a copy counts toward it in the gate (#1321).
|
|
644
|
+
*/
|
|
645
|
+
template: z.ZodOptional<z.ZodString>;
|
|
624
646
|
fixture: z.ZodOptional<z.ZodString>;
|
|
625
647
|
/**
|
|
626
648
|
* What must already be true for this flow to mean anything, and what it leaves true.
|
|
@@ -1564,14 +1586,20 @@ export declare const FlowFileSchema: z.ZodObject<{
|
|
|
1564
1586
|
kind: z.ZodLiteral<"role">;
|
|
1565
1587
|
role: z.ZodString;
|
|
1566
1588
|
name: z.ZodOptional<z.ZodString>;
|
|
1589
|
+
nth: z.ZodOptional<z.ZodNumber>;
|
|
1590
|
+
of: z.ZodOptional<z.ZodNumber>;
|
|
1567
1591
|
}, "strip", z.ZodTypeAny, {
|
|
1568
1592
|
kind: "role";
|
|
1569
1593
|
role: string;
|
|
1570
1594
|
name?: string | undefined;
|
|
1595
|
+
of?: number | undefined;
|
|
1596
|
+
nth?: number | undefined;
|
|
1571
1597
|
}, {
|
|
1572
1598
|
kind: "role";
|
|
1573
1599
|
role: string;
|
|
1574
1600
|
name?: string | undefined;
|
|
1601
|
+
of?: number | undefined;
|
|
1602
|
+
nth?: number | undefined;
|
|
1575
1603
|
}>, z.ZodObject<{
|
|
1576
1604
|
kind: z.ZodLiteral<"signal">;
|
|
1577
1605
|
name: z.ZodString;
|
|
@@ -1726,6 +1754,7 @@ export declare const FlowFileSchema: z.ZodObject<{
|
|
|
1726
1754
|
intent?: string | undefined;
|
|
1727
1755
|
status?: "active" | "quarantined" | "draft" | undefined;
|
|
1728
1756
|
startPath?: string | undefined;
|
|
1757
|
+
template?: string | undefined;
|
|
1729
1758
|
learned?: {
|
|
1730
1759
|
state: "open" | "guarded";
|
|
1731
1760
|
kind: string;
|
|
@@ -1755,6 +1784,8 @@ export declare const FlowFileSchema: z.ZodObject<{
|
|
|
1755
1784
|
kind: "role";
|
|
1756
1785
|
role: string;
|
|
1757
1786
|
name?: string | undefined;
|
|
1787
|
+
of?: number | undefined;
|
|
1788
|
+
nth?: number | undefined;
|
|
1758
1789
|
} | {
|
|
1759
1790
|
kind: "signal";
|
|
1760
1791
|
name: string;
|
|
@@ -1790,6 +1821,7 @@ export declare const FlowFileSchema: z.ZodObject<{
|
|
|
1790
1821
|
intent?: string | undefined;
|
|
1791
1822
|
status?: "active" | "quarantined" | "draft" | undefined;
|
|
1792
1823
|
startPath?: string | undefined;
|
|
1824
|
+
template?: string | undefined;
|
|
1793
1825
|
learned?: {
|
|
1794
1826
|
state: "open" | "guarded";
|
|
1795
1827
|
kind: string;
|
|
@@ -1924,6 +1956,8 @@ export declare const FlowFileSchema: z.ZodObject<{
|
|
|
1924
1956
|
kind: "role";
|
|
1925
1957
|
role: string;
|
|
1926
1958
|
name?: string | undefined;
|
|
1959
|
+
of?: number | undefined;
|
|
1960
|
+
nth?: number | undefined;
|
|
1927
1961
|
} | {
|
|
1928
1962
|
kind: "signal";
|
|
1929
1963
|
name: string;
|
|
@@ -2021,6 +2055,12 @@ export declare const RecordedFlowSchema: z.ZodObject<{
|
|
|
2021
2055
|
* the on-disk version stays FLOW_FILE_VERSION 1.
|
|
2022
2056
|
*/
|
|
2023
2057
|
startPath: z.ZodOptional<z.ZodString>;
|
|
2058
|
+
/**
|
|
2059
|
+
* The saved flow this one was generated from, with different parameters (a fixture's customer,
|
|
2060
|
+
* a seeded id). A suite that writes runtime copies of a template and deletes them after replay
|
|
2061
|
+
* proved the template, and a strict pass of a copy counts toward it in the gate (#1321).
|
|
2062
|
+
*/
|
|
2063
|
+
template: z.ZodOptional<z.ZodString>;
|
|
2024
2064
|
fixture: z.ZodOptional<z.ZodString>;
|
|
2025
2065
|
/**
|
|
2026
2066
|
* What must already be true for this flow to mean anything, and what it leaves true.
|
|
@@ -2964,14 +3004,20 @@ export declare const RecordedFlowSchema: z.ZodObject<{
|
|
|
2964
3004
|
kind: z.ZodLiteral<"role">;
|
|
2965
3005
|
role: z.ZodString;
|
|
2966
3006
|
name: z.ZodOptional<z.ZodString>;
|
|
3007
|
+
nth: z.ZodOptional<z.ZodNumber>;
|
|
3008
|
+
of: z.ZodOptional<z.ZodNumber>;
|
|
2967
3009
|
}, "strip", z.ZodTypeAny, {
|
|
2968
3010
|
kind: "role";
|
|
2969
3011
|
role: string;
|
|
2970
3012
|
name?: string | undefined;
|
|
3013
|
+
of?: number | undefined;
|
|
3014
|
+
nth?: number | undefined;
|
|
2971
3015
|
}, {
|
|
2972
3016
|
kind: "role";
|
|
2973
3017
|
role: string;
|
|
2974
3018
|
name?: string | undefined;
|
|
3019
|
+
of?: number | undefined;
|
|
3020
|
+
nth?: number | undefined;
|
|
2975
3021
|
}>, z.ZodObject<{
|
|
2976
3022
|
kind: z.ZodLiteral<"signal">;
|
|
2977
3023
|
name: z.ZodString;
|
|
@@ -3126,6 +3172,7 @@ export declare const RecordedFlowSchema: z.ZodObject<{
|
|
|
3126
3172
|
intent?: string | undefined;
|
|
3127
3173
|
status?: "active" | "quarantined" | "draft" | undefined;
|
|
3128
3174
|
startPath?: string | undefined;
|
|
3175
|
+
template?: string | undefined;
|
|
3129
3176
|
learned?: {
|
|
3130
3177
|
state: "open" | "guarded";
|
|
3131
3178
|
kind: string;
|
|
@@ -3155,6 +3202,8 @@ export declare const RecordedFlowSchema: z.ZodObject<{
|
|
|
3155
3202
|
kind: "role";
|
|
3156
3203
|
role: string;
|
|
3157
3204
|
name?: string | undefined;
|
|
3205
|
+
of?: number | undefined;
|
|
3206
|
+
nth?: number | undefined;
|
|
3158
3207
|
} | {
|
|
3159
3208
|
kind: "signal";
|
|
3160
3209
|
name: string;
|
|
@@ -3190,6 +3239,7 @@ export declare const RecordedFlowSchema: z.ZodObject<{
|
|
|
3190
3239
|
intent?: string | undefined;
|
|
3191
3240
|
status?: "active" | "quarantined" | "draft" | undefined;
|
|
3192
3241
|
startPath?: string | undefined;
|
|
3242
|
+
template?: string | undefined;
|
|
3193
3243
|
learned?: {
|
|
3194
3244
|
state: "open" | "guarded";
|
|
3195
3245
|
kind: string;
|
|
@@ -3324,6 +3374,8 @@ export declare const RecordedFlowSchema: z.ZodObject<{
|
|
|
3324
3374
|
kind: "role";
|
|
3325
3375
|
role: string;
|
|
3326
3376
|
name?: string | undefined;
|
|
3377
|
+
of?: number | undefined;
|
|
3378
|
+
nth?: number | undefined;
|
|
3327
3379
|
} | {
|
|
3328
3380
|
kind: "signal";
|
|
3329
3381
|
name: string;
|
|
@@ -3361,6 +3413,7 @@ export declare const RecordedFlowSchema: z.ZodObject<{
|
|
|
3361
3413
|
intent?: string | undefined;
|
|
3362
3414
|
status?: "active" | "quarantined" | "draft" | undefined;
|
|
3363
3415
|
startPath?: string | undefined;
|
|
3416
|
+
template?: string | undefined;
|
|
3364
3417
|
learned?: {
|
|
3365
3418
|
state: "open" | "guarded";
|
|
3366
3419
|
kind: string;
|
|
@@ -3390,6 +3443,8 @@ export declare const RecordedFlowSchema: z.ZodObject<{
|
|
|
3390
3443
|
kind: "role";
|
|
3391
3444
|
role: string;
|
|
3392
3445
|
name?: string | undefined;
|
|
3446
|
+
of?: number | undefined;
|
|
3447
|
+
nth?: number | undefined;
|
|
3393
3448
|
} | {
|
|
3394
3449
|
kind: "signal";
|
|
3395
3450
|
name: string;
|
|
@@ -3428,6 +3483,7 @@ export declare const RecordedFlowSchema: z.ZodObject<{
|
|
|
3428
3483
|
intent?: string | undefined;
|
|
3429
3484
|
status?: "active" | "quarantined" | "draft" | undefined;
|
|
3430
3485
|
startPath?: string | undefined;
|
|
3486
|
+
template?: string | undefined;
|
|
3431
3487
|
learned?: {
|
|
3432
3488
|
state: "open" | "guarded";
|
|
3433
3489
|
kind: string;
|
|
@@ -3562,6 +3618,8 @@ export declare const RecordedFlowSchema: z.ZodObject<{
|
|
|
3562
3618
|
kind: "role";
|
|
3563
3619
|
role: string;
|
|
3564
3620
|
name?: string | undefined;
|
|
3621
|
+
of?: number | undefined;
|
|
3622
|
+
nth?: number | undefined;
|
|
3565
3623
|
} | {
|
|
3566
3624
|
kind: "signal";
|
|
3567
3625
|
name: string;
|
|
@@ -3642,6 +3700,8 @@ export interface FlowChip {
|
|
|
3642
3700
|
name: string;
|
|
3643
3701
|
/** The testid the flow's first step anchors to, when it has one — the panel hides chips that cannot start on the current page. */
|
|
3644
3702
|
start?: string;
|
|
3703
|
+
/** Saved time, used to put recent flows first in the HUD. Older flow stores may omit it. */
|
|
3704
|
+
createdAt?: number;
|
|
3645
3705
|
}
|
|
3646
3706
|
/** One recorded known bug, as stored on a flow. */
|
|
3647
3707
|
export type KnownBug = NonNullable<FlowFile['knownBugs']>[number];
|
|
@@ -43,6 +43,10 @@ export const FlowAnchorSchema = z.discriminatedUnion('kind', [
|
|
|
43
43
|
kind: z.literal(AnchorKind.ROLE),
|
|
44
44
|
role: z.string().min(1),
|
|
45
45
|
name: z.string().optional(),
|
|
46
|
+
// Which of several same-named controls was recorded, in page order, and how many there were.
|
|
47
|
+
// Honoured only while the page still has exactly `of` of them; otherwise the step is ambiguous.
|
|
48
|
+
nth: z.number().int().min(0).optional(),
|
|
49
|
+
of: z.number().int().min(2).optional(),
|
|
46
50
|
}),
|
|
47
51
|
z.object({ kind: z.literal(AnchorKind.SIGNAL), name: z.string().min(1) }),
|
|
48
52
|
// Auto-anchor: re-find an element by component identity / source location when it has no testid.
|
|
@@ -200,6 +204,12 @@ export const FlowFileSchema = z.object({
|
|
|
200
204
|
* the on-disk version stays FLOW_FILE_VERSION 1.
|
|
201
205
|
*/
|
|
202
206
|
startPath: z.string().optional(),
|
|
207
|
+
/**
|
|
208
|
+
* The saved flow this one was generated from, with different parameters (a fixture's customer,
|
|
209
|
+
* a seeded id). A suite that writes runtime copies of a template and deletes them after replay
|
|
210
|
+
* proved the template, and a strict pass of a copy counts toward it in the gate (#1321).
|
|
211
|
+
*/
|
|
212
|
+
template: z.string().min(1).optional(),
|
|
203
213
|
// FUTURE: fixtures/preconditions — schema slot reserved, unpopulated this cut. The recorder
|
|
204
214
|
// never writes it and no fixture runner exists.
|
|
205
215
|
fixture: z.string().optional(),
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The notices the HUD's rail shows, edited without a release.
|
|
3
|
+
*
|
|
4
|
+
* The slides used to be compiled into the SDK, so changing a sentence meant shipping a version. The
|
|
5
|
+
* daemon now fetches a small JSON file from our own site, keeps the entries that apply to this
|
|
6
|
+
* machine, and pushes them to the HUD in the impact snapshot. The page never fetches it: the HUD runs
|
|
7
|
+
* inside somebody else's app, whose Content-Security-Policy may forbid the request.
|
|
8
|
+
*
|
|
9
|
+
* Everything here is pure. Fetching and caching live in the daemon; the clock arrives as an argument.
|
|
10
|
+
*/
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
/** Where the daemon reads the notices from. Overridable for self-hosting and tests. */
|
|
13
|
+
export declare const HUD_NOTICES_URL = "https://reticle.sh/hud/notices.v1.json";
|
|
14
|
+
export declare const NOTICES_FILE_VERSION = 1;
|
|
15
|
+
/** What the HUD renders. Only display fields: the audience rules never leave the daemon. */
|
|
16
|
+
export declare const HudNoticeSchema: z.ZodObject<{
|
|
17
|
+
id: z.ZodString;
|
|
18
|
+
kicker: z.ZodOptional<z.ZodString>;
|
|
19
|
+
title: z.ZodString;
|
|
20
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
21
|
+
cta: z.ZodOptional<z.ZodObject<{
|
|
22
|
+
label: z.ZodString;
|
|
23
|
+
url: z.ZodEffects<z.ZodString, string, string>;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
label: string;
|
|
26
|
+
url: string;
|
|
27
|
+
}, {
|
|
28
|
+
label: string;
|
|
29
|
+
url: string;
|
|
30
|
+
}>>;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
id: string;
|
|
33
|
+
title: string;
|
|
34
|
+
detail?: string | undefined;
|
|
35
|
+
kicker?: string | undefined;
|
|
36
|
+
cta?: {
|
|
37
|
+
label: string;
|
|
38
|
+
url: string;
|
|
39
|
+
} | undefined;
|
|
40
|
+
}, {
|
|
41
|
+
id: string;
|
|
42
|
+
title: string;
|
|
43
|
+
detail?: string | undefined;
|
|
44
|
+
kicker?: string | undefined;
|
|
45
|
+
cta?: {
|
|
46
|
+
label: string;
|
|
47
|
+
url: string;
|
|
48
|
+
} | undefined;
|
|
49
|
+
}>;
|
|
50
|
+
export type HudNotice = z.infer<typeof HudNoticeSchema>;
|
|
51
|
+
/** One entry in the file: a notice plus who sees it and when. */
|
|
52
|
+
export declare const HudNoticeEntrySchema: z.ZodObject<{
|
|
53
|
+
id: z.ZodString;
|
|
54
|
+
kicker: z.ZodOptional<z.ZodString>;
|
|
55
|
+
title: z.ZodString;
|
|
56
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
57
|
+
cta: z.ZodOptional<z.ZodObject<{
|
|
58
|
+
label: z.ZodString;
|
|
59
|
+
url: z.ZodEffects<z.ZodString, string, string>;
|
|
60
|
+
}, "strip", z.ZodTypeAny, {
|
|
61
|
+
label: string;
|
|
62
|
+
url: string;
|
|
63
|
+
}, {
|
|
64
|
+
label: string;
|
|
65
|
+
url: string;
|
|
66
|
+
}>>;
|
|
67
|
+
} & {
|
|
68
|
+
audience: z.ZodOptional<z.ZodObject<{
|
|
69
|
+
signedIn: z.ZodOptional<z.ZodBoolean>;
|
|
70
|
+
entitled: z.ZodOptional<z.ZodBoolean>;
|
|
71
|
+
}, "strip", z.ZodTypeAny, {
|
|
72
|
+
signedIn?: boolean | undefined;
|
|
73
|
+
entitled?: boolean | undefined;
|
|
74
|
+
}, {
|
|
75
|
+
signedIn?: boolean | undefined;
|
|
76
|
+
entitled?: boolean | undefined;
|
|
77
|
+
}>>;
|
|
78
|
+
/** ISO dates. Shown from `from` (inclusive) until `until` (exclusive). */
|
|
79
|
+
from: z.ZodOptional<z.ZodString>;
|
|
80
|
+
until: z.ZodOptional<z.ZodString>;
|
|
81
|
+
/** Oldest SDK that can show it, e.g. "x.y.z". */
|
|
82
|
+
minSdk: z.ZodOptional<z.ZodString>;
|
|
83
|
+
/** Higher shows first. */
|
|
84
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
85
|
+
}, "strip", z.ZodTypeAny, {
|
|
86
|
+
id: string;
|
|
87
|
+
title: string;
|
|
88
|
+
from?: string | undefined;
|
|
89
|
+
detail?: string | undefined;
|
|
90
|
+
until?: string | undefined;
|
|
91
|
+
kicker?: string | undefined;
|
|
92
|
+
cta?: {
|
|
93
|
+
label: string;
|
|
94
|
+
url: string;
|
|
95
|
+
} | undefined;
|
|
96
|
+
audience?: {
|
|
97
|
+
signedIn?: boolean | undefined;
|
|
98
|
+
entitled?: boolean | undefined;
|
|
99
|
+
} | undefined;
|
|
100
|
+
minSdk?: string | undefined;
|
|
101
|
+
weight?: number | undefined;
|
|
102
|
+
}, {
|
|
103
|
+
id: string;
|
|
104
|
+
title: string;
|
|
105
|
+
from?: string | undefined;
|
|
106
|
+
detail?: string | undefined;
|
|
107
|
+
until?: string | undefined;
|
|
108
|
+
kicker?: string | undefined;
|
|
109
|
+
cta?: {
|
|
110
|
+
label: string;
|
|
111
|
+
url: string;
|
|
112
|
+
} | undefined;
|
|
113
|
+
audience?: {
|
|
114
|
+
signedIn?: boolean | undefined;
|
|
115
|
+
entitled?: boolean | undefined;
|
|
116
|
+
} | undefined;
|
|
117
|
+
minSdk?: string | undefined;
|
|
118
|
+
weight?: number | undefined;
|
|
119
|
+
}>;
|
|
120
|
+
export type HudNoticeEntry = z.infer<typeof HudNoticeEntrySchema>;
|
|
121
|
+
/**
|
|
122
|
+
* The entries in a notices file this SDK understands. An unknown version or shape answers nothing,
|
|
123
|
+
* and a bad entry is dropped on its own, so one typo cannot take the whole rail down.
|
|
124
|
+
*/
|
|
125
|
+
export declare function parseHudNotices(file: unknown): HudNoticeEntry[];
|
|
126
|
+
/** What is known about this machine when choosing. `undefined` means "not heard yet". */
|
|
127
|
+
export interface NoticeContext {
|
|
128
|
+
signedIn: boolean | undefined;
|
|
129
|
+
entitled: boolean | undefined;
|
|
130
|
+
sdkVersion: string;
|
|
131
|
+
now: number;
|
|
132
|
+
}
|
|
133
|
+
/** The notices this machine should see now, heaviest first, display fields only. */
|
|
134
|
+
export declare function selectNotices(entries: readonly HudNoticeEntry[], ctx: NoticeContext): HudNotice[];
|