@reticlehq/core 3.3.0 → 3.4.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/README.md +1 -1
- package/dist/artifacts/flow-constants.d.ts +19 -0
- package/dist/artifacts/flow-constants.js +36 -1
- package/dist/artifacts/flow-expect-flat.d.ts +16 -16
- package/dist/artifacts/flow-expect-flat.js +2 -2
- package/dist/artifacts/flow-mutation-target.js +4 -0
- package/dist/artifacts/flow-types.d.ts +393 -297
- package/dist/artifacts/flow-types.js +17 -2
- package/dist/artifacts/journal.d.ts +3 -2
- package/dist/hooks/hook-events.d.ts +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/registry/daemon-registry.d.ts +14 -4
- package/dist/registry/daemon-registry.js +20 -4
- package/dist/schema/event-payloads.json +3 -0
- package/dist/telemetry-refusal.d.ts +3 -2
- package/dist/telemetry.d.ts +11 -10
- package/dist/verdict/compare-source.d.ts +80 -0
- package/dist/verdict/compare-source.js +93 -0
- package/dist/verdict/consequence.d.ts +2 -0
- package/dist/verdict/consequence.js +2 -0
- package/dist/verdict/instrumentation-gap.js +1 -1
- package/dist/verdict/intent.d.ts +12 -12
- package/dist/verdict/predicate-tree.d.ts +35 -0
- package/dist/verdict/predicate-tree.js +40 -0
- package/dist/verdict/predicate.d.ts +11 -2
- package/dist/verdict/predicate.js +38 -2
- package/dist/verdict/verification-run.d.ts +261 -28
- package/dist/verdict/verification-run.js +36 -0
- package/dist/wire/channel.d.ts +10 -0
- package/dist/wire/channel.js +25 -0
- package/dist/wire/constants/constants.d.ts +45 -4
- package/dist/wire/constants/constants.js +57 -4
- package/dist/wire/event-payloads.d.ts +12 -9
- package/dist/wire/event-payloads.js +8 -3
- package/dist/wire/messages.d.ts +24 -24
- package/dist/wire/net.d.ts +17 -0
- package/dist/wire/net.js +17 -0
- package/dist/wire/redaction.js +17 -0
- package/dist/wire/toon.d.ts +1 -1
- package/dist/wire/toon.js +2 -1
- package/dist/wire/types.d.ts +44 -44
- package/dist/words/no-session-reason.d.ts +7 -0
- package/dist/words/no-session-reason.js +7 -0
- package/dist/words/notices.d.ts +7 -0
- package/dist/words/notices.js +9 -2
- package/package.json +3 -2
|
@@ -7,6 +7,7 @@ import { CONSEQUENCE_KINDS, PRESENCE_GRADED } from '../verdict/consequence.js';
|
|
|
7
7
|
import { PredicateKind } from '../verdict/consequence.js';
|
|
8
8
|
import { PredicateSchema } from '../verdict/predicate.js';
|
|
9
9
|
import { sessionBoundField, sessionRefRefusal } from '../verdict/predicate-tree.js';
|
|
10
|
+
import { isConsequenceSource } from '../verdict/compare-source.js';
|
|
10
11
|
import { FlowExpectSchema, flowExpectToPredicate } from './flow-expect-flat.js';
|
|
11
12
|
// The older flat shape and its reader live together; both are re-exported so the one public name
|
|
12
13
|
// for "a flow's types" still answers for them.
|
|
@@ -140,6 +141,9 @@ const baseFlowStep = z.object({
|
|
|
140
141
|
degraded: z.boolean().optional(),
|
|
141
142
|
timeoutMs: z.number().int().positive().optional(),
|
|
142
143
|
invoke: z.string().min(1).optional(),
|
|
144
|
+
/** See FlowStep.page / FlowStep.endPage. */
|
|
145
|
+
page: z.string().optional(),
|
|
146
|
+
endPage: z.string().optional(),
|
|
143
147
|
});
|
|
144
148
|
export const FlowStepSchema = baseFlowStep.extend({
|
|
145
149
|
steps: z.lazy(() => z.array(FlowStepSchema).optional()),
|
|
@@ -217,6 +221,14 @@ export const FlowFileSchema = z.object({
|
|
|
217
221
|
*/
|
|
218
222
|
requires: ExpectListSchema.optional(),
|
|
219
223
|
ensures: ExpectListSchema.optional(),
|
|
224
|
+
/**
|
|
225
|
+
* Who made this flow, stamped at save: the agent that drove it (its MCP client name) and the
|
|
226
|
+
* person signed in to the cloud key on that machine. Either is absent when it was not known —
|
|
227
|
+
* never guessed.
|
|
228
|
+
*/
|
|
229
|
+
author: z
|
|
230
|
+
.object({ agent: z.string().min(1).optional(), person: z.string().min(1).optional() })
|
|
231
|
+
.optional(),
|
|
220
232
|
/** From the injected clock (ms) — deterministic in tests, byte-stable on disk. */
|
|
221
233
|
createdAt: z.number(),
|
|
222
234
|
steps: z.array(FlowStepSchema),
|
|
@@ -377,7 +389,9 @@ export function staleKnownBugs(notes, currentAssertions) {
|
|
|
377
389
|
}
|
|
378
390
|
/** True when a FlowExpect asserts at least one consequence (any of the ConsequenceKind fields set). */
|
|
379
391
|
export function flowExpectHasConsequence(expect) {
|
|
380
|
-
return expectClauses(expect).some((clause) => CONSEQUENCE_KINDS.has(clause.kind)
|
|
392
|
+
return expectClauses(expect).some((clause) => CONSEQUENCE_KINDS.has(clause.kind) ||
|
|
393
|
+
(PredicateKind.COMPARE === clause.kind &&
|
|
394
|
+
(isConsequenceSource(clause.left) || isConsequenceSource(clause.right))));
|
|
381
395
|
}
|
|
382
396
|
/**
|
|
383
397
|
* True when a FlowExpect checks ONLY presence — an element, rendered text or a route, no consequence.
|
|
@@ -398,7 +412,8 @@ export function flowExpectHasConsequence(expect) {
|
|
|
398
412
|
export function flowExpectIsPresenceOnly(expect) {
|
|
399
413
|
if (expect === undefined || flowExpectHasConsequence(expect))
|
|
400
414
|
return false;
|
|
401
|
-
|
|
415
|
+
// A `compare` reaching here reads text on both sides, which is two readings of the same DOM.
|
|
416
|
+
return expectClauses(expect).some((clause) => PRESENCE_GRADED.has(clause.kind) || PredicateKind.COMPARE === clause.kind);
|
|
402
417
|
}
|
|
403
418
|
/**
|
|
404
419
|
* Every clause an expectation contains, composites flattened.
|
|
@@ -183,6 +183,7 @@ export declare const JournalVerdictEffectSchema: z.ZodObject<{
|
|
|
183
183
|
readonly CONSOLE: "console";
|
|
184
184
|
readonly ANIMATION: "animation";
|
|
185
185
|
readonly SETTLED: "settled";
|
|
186
|
+
readonly COMPARE: "compare";
|
|
186
187
|
readonly ALL_OF: "allOf";
|
|
187
188
|
readonly ANY_OF: "anyOf";
|
|
188
189
|
readonly NOT: "not";
|
|
@@ -226,7 +227,7 @@ export declare const JournalVerdictEffectSchema: z.ZodObject<{
|
|
|
226
227
|
}, "strip", z.ZodTypeAny, {
|
|
227
228
|
claim: string;
|
|
228
229
|
verified: "yes" | "no" | "unknown" | "no-fault";
|
|
229
|
-
kind?: "signal" | "
|
|
230
|
+
kind?: "signal" | "net" | "state" | "element" | "text" | "route" | "console" | "animation" | "settled" | "compare" | "allOf" | "anyOf" | "not" | undefined;
|
|
230
231
|
declaredBeforeActing?: boolean | undefined;
|
|
231
232
|
grade?: string | undefined;
|
|
232
233
|
couldNotSee?: string[] | undefined;
|
|
@@ -235,7 +236,7 @@ export declare const JournalVerdictEffectSchema: z.ZodObject<{
|
|
|
235
236
|
}, {
|
|
236
237
|
claim: string;
|
|
237
238
|
verified: "yes" | "no" | "unknown" | "no-fault";
|
|
238
|
-
kind?: "signal" | "
|
|
239
|
+
kind?: "signal" | "net" | "state" | "element" | "text" | "route" | "console" | "animation" | "settled" | "compare" | "allOf" | "anyOf" | "not" | undefined;
|
|
239
240
|
declaredBeforeActing?: boolean | undefined;
|
|
240
241
|
grade?: string | undefined;
|
|
241
242
|
couldNotSee?: string[] | undefined;
|
|
@@ -98,9 +98,9 @@ export declare const BugFoundHookPayloadSchema: z.ZodObject<{
|
|
|
98
98
|
tool: z.ZodString;
|
|
99
99
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
100
100
|
}, "strip", z.ZodTypeAny, {
|
|
101
|
+
kind: string;
|
|
101
102
|
event: "bug_found";
|
|
102
103
|
at: string;
|
|
103
|
-
kind: string;
|
|
104
104
|
tool: string;
|
|
105
105
|
repeat: boolean;
|
|
106
106
|
route?: string | undefined;
|
|
@@ -109,9 +109,9 @@ export declare const BugFoundHookPayloadSchema: z.ZodObject<{
|
|
|
109
109
|
sessionId?: string | undefined;
|
|
110
110
|
fingerprint?: string | undefined;
|
|
111
111
|
}, {
|
|
112
|
+
kind: string;
|
|
112
113
|
event: "bug_found";
|
|
113
114
|
at: string;
|
|
114
|
-
kind: string;
|
|
115
115
|
tool: string;
|
|
116
116
|
repeat: boolean;
|
|
117
117
|
route?: string | undefined;
|
|
@@ -211,9 +211,9 @@ export declare const HookPayloadSchema: z.ZodDiscriminatedUnion<"event", [z.ZodO
|
|
|
211
211
|
tool: z.ZodString;
|
|
212
212
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
213
213
|
}, "strip", z.ZodTypeAny, {
|
|
214
|
+
kind: string;
|
|
214
215
|
event: "bug_found";
|
|
215
216
|
at: string;
|
|
216
|
-
kind: string;
|
|
217
217
|
tool: string;
|
|
218
218
|
repeat: boolean;
|
|
219
219
|
route?: string | undefined;
|
|
@@ -222,9 +222,9 @@ export declare const HookPayloadSchema: z.ZodDiscriminatedUnion<"event", [z.ZodO
|
|
|
222
222
|
sessionId?: string | undefined;
|
|
223
223
|
fingerprint?: string | undefined;
|
|
224
224
|
}, {
|
|
225
|
+
kind: string;
|
|
225
226
|
event: "bug_found";
|
|
226
227
|
at: string;
|
|
227
|
-
kind: string;
|
|
228
228
|
tool: string;
|
|
229
229
|
repeat: boolean;
|
|
230
230
|
route?: string | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ export * from './verdict/findings.js';
|
|
|
51
51
|
export * from './wire/desktop-contract.js';
|
|
52
52
|
export * from './verdict/consequence.js';
|
|
53
53
|
export * from './verdict/property-assertion.js';
|
|
54
|
+
export * from './verdict/compare-source.js';
|
|
54
55
|
export * from './verdict/predicate.js';
|
|
55
56
|
export * from './verdict/predicate-tree.js';
|
|
56
57
|
export * from './artifacts/flow-expect-flat.js';
|
package/dist/index.js
CHANGED
|
@@ -66,6 +66,7 @@ export * from './verdict/consequence.js';
|
|
|
66
66
|
// The predicate CONTRACT: what a caller may declare, and what a saved flow may carry. The engine
|
|
67
67
|
// owns the reasoning over it and re-exports both halves as one surface.
|
|
68
68
|
export * from './verdict/property-assertion.js';
|
|
69
|
+
export * from './verdict/compare-source.js';
|
|
69
70
|
export * from './verdict/predicate.js';
|
|
70
71
|
export * from './verdict/predicate-tree.js';
|
|
71
72
|
// The version 1 reader: a flat expect lifted to the predicate a v2 file stores directly.
|
|
@@ -27,9 +27,19 @@ export type DaemonRegistryEntry = z.infer<typeof DaemonRegistryEntrySchema>;
|
|
|
27
27
|
/**
|
|
28
28
|
* Pick the daemon port an app should connect to, given the registry entries, the app's projectId, and
|
|
29
29
|
* a liveness probe. Pure so both the vite and next plugins share one rule and it's unit-testable:
|
|
30
|
-
* 1.
|
|
31
|
-
*
|
|
32
|
-
*
|
|
30
|
+
* 1. the port the project CONFIGURED wins whenever a live daemon is registered on it that is not
|
|
31
|
+
* another project's (a daemon naming no project counts; one naming a different project never does);
|
|
32
|
+
* 2. otherwise drop dead daemons (crashed, stale entry);
|
|
33
|
+
* 3. among the living, prefer the one whose projectId matches the app's — lowest port wins on a tie;
|
|
34
|
+
* 4. return null when nothing matches, so the caller falls back to the default port (never guesses a
|
|
33
35
|
* mismatched daemon — a wrong auto-connect is worse than the honest default).
|
|
36
|
+
*
|
|
37
|
+
* The first rule exists because `init --port <new>` starts a daemon on the new port while the old one
|
|
38
|
+
* for the same project is still alive. Discovery by projectId then found both, took the lower, and
|
|
39
|
+
* the page dialled the OLD daemon: init waited on the new one and exited with "connected to a
|
|
40
|
+
* DIFFERENT Reticle daemon". `.reticle.json` is what the daemon and the CLI follow, so when a daemon
|
|
41
|
+
* answers there it is the answer; the registry only speaks when nothing does. Another project's
|
|
42
|
+
* daemon squatting that port is not an answer: the pairing token is per machine, so taking it would
|
|
43
|
+
* pair this page with that project's bridge while this project's own daemon sat live elsewhere.
|
|
34
44
|
*/
|
|
35
|
-
export declare function pickDaemonPort(entries: readonly DaemonRegistryEntry[], projectId: string | undefined, isAlive: (pid: number) => boolean): number | null;
|
|
45
|
+
export declare function pickDaemonPort(entries: readonly DaemonRegistryEntry[], projectId: string | undefined, isAlive: (pid: number) => boolean, configuredPort?: number): number | null;
|
|
@@ -31,12 +31,28 @@ export const DaemonRegistryEntrySchema = z.object({
|
|
|
31
31
|
/**
|
|
32
32
|
* Pick the daemon port an app should connect to, given the registry entries, the app's projectId, and
|
|
33
33
|
* a liveness probe. Pure so both the vite and next plugins share one rule and it's unit-testable:
|
|
34
|
-
* 1.
|
|
35
|
-
*
|
|
36
|
-
*
|
|
34
|
+
* 1. the port the project CONFIGURED wins whenever a live daemon is registered on it that is not
|
|
35
|
+
* another project's (a daemon naming no project counts; one naming a different project never does);
|
|
36
|
+
* 2. otherwise drop dead daemons (crashed, stale entry);
|
|
37
|
+
* 3. among the living, prefer the one whose projectId matches the app's — lowest port wins on a tie;
|
|
38
|
+
* 4. return null when nothing matches, so the caller falls back to the default port (never guesses a
|
|
37
39
|
* mismatched daemon — a wrong auto-connect is worse than the honest default).
|
|
40
|
+
*
|
|
41
|
+
* The first rule exists because `init --port <new>` starts a daemon on the new port while the old one
|
|
42
|
+
* for the same project is still alive. Discovery by projectId then found both, took the lower, and
|
|
43
|
+
* the page dialled the OLD daemon: init waited on the new one and exited with "connected to a
|
|
44
|
+
* DIFFERENT Reticle daemon". `.reticle.json` is what the daemon and the CLI follow, so when a daemon
|
|
45
|
+
* answers there it is the answer; the registry only speaks when nothing does. Another project's
|
|
46
|
+
* daemon squatting that port is not an answer: the pairing token is per machine, so taking it would
|
|
47
|
+
* pair this page with that project's bridge while this project's own daemon sat live elsewhere.
|
|
38
48
|
*/
|
|
39
|
-
export function pickDaemonPort(entries, projectId, isAlive) {
|
|
49
|
+
export function pickDaemonPort(entries, projectId, isAlive, configuredPort) {
|
|
50
|
+
if (undefined !== configuredPort &&
|
|
51
|
+
entries.some((e) => e.port === configuredPort &&
|
|
52
|
+
isAlive(e.pid) &&
|
|
53
|
+
(e.projectId === undefined || projectId === undefined || e.projectId === projectId))) {
|
|
54
|
+
return configuredPort;
|
|
55
|
+
}
|
|
40
56
|
if (projectId === undefined || 0 === projectId.length)
|
|
41
57
|
return null;
|
|
42
58
|
const matches = entries
|
|
@@ -63,6 +63,7 @@ export declare const ToolRefusalSchema: z.ZodObject<{
|
|
|
63
63
|
readonly AUTH_REFUSED: "auth_refused";
|
|
64
64
|
readonly LEASE_EXPIRED: "lease_expired";
|
|
65
65
|
readonly TAB_GONE: "tab_gone";
|
|
66
|
+
readonly ROUTE_SERVER_ERROR: "route_server_error";
|
|
66
67
|
readonly APP_NOT_REOPENED: "app_not_reopened";
|
|
67
68
|
readonly CONFIG_ELSEWHERE: "config_elsewhere";
|
|
68
69
|
readonly NO_LISTENER_NO_CONFIG: "no_listener_no_config";
|
|
@@ -84,11 +85,11 @@ export declare const ToolRefusalSchema: z.ZodObject<{
|
|
|
84
85
|
reason: "other" | "no_session" | "no_match" | "unsupported" | "bad_args" | "not_ready";
|
|
85
86
|
tool: string;
|
|
86
87
|
retried: boolean;
|
|
87
|
-
noSessionReason?: "auth_refused" | "lease_expired" | "tab_gone" | "app_not_reopened" | "config_elsewhere" | "no_listener_no_config" | "no_listener" | "no_config" | "sdk_not_reaching_daemon" | undefined;
|
|
88
|
+
noSessionReason?: "auth_refused" | "lease_expired" | "tab_gone" | "route_server_error" | "app_not_reopened" | "config_elsewhere" | "no_listener_no_config" | "no_listener" | "no_config" | "sdk_not_reaching_daemon" | undefined;
|
|
88
89
|
}, {
|
|
89
90
|
reason: "other" | "no_session" | "no_match" | "unsupported" | "bad_args" | "not_ready";
|
|
90
91
|
tool: string;
|
|
91
92
|
retried: boolean;
|
|
92
|
-
noSessionReason?: "auth_refused" | "lease_expired" | "tab_gone" | "app_not_reopened" | "config_elsewhere" | "no_listener_no_config" | "no_listener" | "no_config" | "sdk_not_reaching_daemon" | undefined;
|
|
93
|
+
noSessionReason?: "auth_refused" | "lease_expired" | "tab_gone" | "route_server_error" | "app_not_reopened" | "config_elsewhere" | "no_listener_no_config" | "no_listener" | "no_config" | "sdk_not_reaching_daemon" | undefined;
|
|
93
94
|
}>;
|
|
94
95
|
export type ToolRefusal = z.infer<typeof ToolRefusalSchema>;
|
package/dist/telemetry.d.ts
CHANGED
|
@@ -699,7 +699,7 @@ export declare const BugFoundSchema: z.ZodObject<{
|
|
|
699
699
|
}, "strip", z.ZodTypeAny, {
|
|
700
700
|
kind: string;
|
|
701
701
|
source: "replay" | "contradiction" | "crawl" | "assertion";
|
|
702
|
-
attribution: "reticle" | "
|
|
702
|
+
attribution: "reticle" | "request" | "app" | "unclassified";
|
|
703
703
|
falseGreen: boolean;
|
|
704
704
|
repeat: boolean;
|
|
705
705
|
tool?: string | undefined;
|
|
@@ -707,7 +707,7 @@ export declare const BugFoundSchema: z.ZodObject<{
|
|
|
707
707
|
}, {
|
|
708
708
|
kind: string;
|
|
709
709
|
source: "replay" | "contradiction" | "crawl" | "assertion";
|
|
710
|
-
attribution: "reticle" | "
|
|
710
|
+
attribution: "reticle" | "request" | "app" | "unclassified";
|
|
711
711
|
falseGreen: boolean;
|
|
712
712
|
repeat: boolean;
|
|
713
713
|
tool?: string | undefined;
|
|
@@ -2214,7 +2214,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
|
|
|
2214
2214
|
}, "strip", z.ZodTypeAny, {
|
|
2215
2215
|
kind: string;
|
|
2216
2216
|
source: "replay" | "contradiction" | "crawl" | "assertion";
|
|
2217
|
-
attribution: "reticle" | "
|
|
2217
|
+
attribution: "reticle" | "request" | "app" | "unclassified";
|
|
2218
2218
|
falseGreen: boolean;
|
|
2219
2219
|
repeat: boolean;
|
|
2220
2220
|
tool?: string | undefined;
|
|
@@ -2222,7 +2222,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
|
|
|
2222
2222
|
}, {
|
|
2223
2223
|
kind: string;
|
|
2224
2224
|
source: "replay" | "contradiction" | "crawl" | "assertion";
|
|
2225
|
-
attribution: "reticle" | "
|
|
2225
|
+
attribution: "reticle" | "request" | "app" | "unclassified";
|
|
2226
2226
|
falseGreen: boolean;
|
|
2227
2227
|
repeat: boolean;
|
|
2228
2228
|
tool?: string | undefined;
|
|
@@ -2243,6 +2243,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
|
|
|
2243
2243
|
readonly AUTH_REFUSED: "auth_refused";
|
|
2244
2244
|
readonly LEASE_EXPIRED: "lease_expired";
|
|
2245
2245
|
readonly TAB_GONE: "tab_gone";
|
|
2246
|
+
readonly ROUTE_SERVER_ERROR: "route_server_error";
|
|
2246
2247
|
readonly APP_NOT_REOPENED: "app_not_reopened";
|
|
2247
2248
|
readonly CONFIG_ELSEWHERE: "config_elsewhere";
|
|
2248
2249
|
readonly NO_LISTENER_NO_CONFIG: "no_listener_no_config";
|
|
@@ -2255,12 +2256,12 @@ export declare const TelemetryEventSchema: z.ZodObject<{
|
|
|
2255
2256
|
reason: "other" | "no_session" | "no_match" | "unsupported" | "bad_args" | "not_ready";
|
|
2256
2257
|
tool: string;
|
|
2257
2258
|
retried: boolean;
|
|
2258
|
-
noSessionReason?: "auth_refused" | "lease_expired" | "tab_gone" | "app_not_reopened" | "config_elsewhere" | "no_listener_no_config" | "no_listener" | "no_config" | "sdk_not_reaching_daemon" | undefined;
|
|
2259
|
+
noSessionReason?: "auth_refused" | "lease_expired" | "tab_gone" | "route_server_error" | "app_not_reopened" | "config_elsewhere" | "no_listener_no_config" | "no_listener" | "no_config" | "sdk_not_reaching_daemon" | undefined;
|
|
2259
2260
|
}, {
|
|
2260
2261
|
reason: "other" | "no_session" | "no_match" | "unsupported" | "bad_args" | "not_ready";
|
|
2261
2262
|
tool: string;
|
|
2262
2263
|
retried: boolean;
|
|
2263
|
-
noSessionReason?: "auth_refused" | "lease_expired" | "tab_gone" | "app_not_reopened" | "config_elsewhere" | "no_listener_no_config" | "no_listener" | "no_config" | "sdk_not_reaching_daemon" | undefined;
|
|
2264
|
+
noSessionReason?: "auth_refused" | "lease_expired" | "tab_gone" | "route_server_error" | "app_not_reopened" | "config_elsewhere" | "no_listener_no_config" | "no_listener" | "no_config" | "sdk_not_reaching_daemon" | undefined;
|
|
2264
2265
|
}>>;
|
|
2265
2266
|
/** Only on `mcp_connection_lost`: which stage of the outage, why, and after how many retries. */
|
|
2266
2267
|
outage: z.ZodOptional<z.ZodObject<{
|
|
@@ -2455,7 +2456,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
|
|
|
2455
2456
|
bug?: {
|
|
2456
2457
|
kind: string;
|
|
2457
2458
|
source: "replay" | "contradiction" | "crawl" | "assertion";
|
|
2458
|
-
attribution: "reticle" | "
|
|
2459
|
+
attribution: "reticle" | "request" | "app" | "unclassified";
|
|
2459
2460
|
falseGreen: boolean;
|
|
2460
2461
|
repeat: boolean;
|
|
2461
2462
|
tool?: string | undefined;
|
|
@@ -2611,7 +2612,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
|
|
|
2611
2612
|
reason: "other" | "no_session" | "no_match" | "unsupported" | "bad_args" | "not_ready";
|
|
2612
2613
|
tool: string;
|
|
2613
2614
|
retried: boolean;
|
|
2614
|
-
noSessionReason?: "auth_refused" | "lease_expired" | "tab_gone" | "app_not_reopened" | "config_elsewhere" | "no_listener_no_config" | "no_listener" | "no_config" | "sdk_not_reaching_daemon" | undefined;
|
|
2615
|
+
noSessionReason?: "auth_refused" | "lease_expired" | "tab_gone" | "route_server_error" | "app_not_reopened" | "config_elsewhere" | "no_listener_no_config" | "no_listener" | "no_config" | "sdk_not_reaching_daemon" | undefined;
|
|
2615
2616
|
} | undefined;
|
|
2616
2617
|
outage?: {
|
|
2617
2618
|
reason: "other" | "sse_ended" | "daemon_shutdown" | "sse_error" | "sse_aborted" | "sse_closed" | "connect_error";
|
|
@@ -2681,7 +2682,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
|
|
|
2681
2682
|
bug?: {
|
|
2682
2683
|
kind: string;
|
|
2683
2684
|
source: "replay" | "contradiction" | "crawl" | "assertion";
|
|
2684
|
-
attribution: "reticle" | "
|
|
2685
|
+
attribution: "reticle" | "request" | "app" | "unclassified";
|
|
2685
2686
|
falseGreen: boolean;
|
|
2686
2687
|
repeat: boolean;
|
|
2687
2688
|
tool?: string | undefined;
|
|
@@ -2837,7 +2838,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
|
|
|
2837
2838
|
reason: "other" | "no_session" | "no_match" | "unsupported" | "bad_args" | "not_ready";
|
|
2838
2839
|
tool: string;
|
|
2839
2840
|
retried: boolean;
|
|
2840
|
-
noSessionReason?: "auth_refused" | "lease_expired" | "tab_gone" | "app_not_reopened" | "config_elsewhere" | "no_listener_no_config" | "no_listener" | "no_config" | "sdk_not_reaching_daemon" | undefined;
|
|
2841
|
+
noSessionReason?: "auth_refused" | "lease_expired" | "tab_gone" | "route_server_error" | "app_not_reopened" | "config_elsewhere" | "no_listener_no_config" | "no_listener" | "no_config" | "sdk_not_reaching_daemon" | undefined;
|
|
2841
2842
|
} | undefined;
|
|
2842
2843
|
outage?: {
|
|
2843
2844
|
reason: "other" | "sse_ended" | "daemon_shutdown" | "sse_error" | "sse_aborted" | "sse_closed" | "connect_error";
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `compare` predicate's contract: where each side's value is read from, and how the two are
|
|
3
|
+
* compared.
|
|
4
|
+
*
|
|
5
|
+
* Every other predicate checks one observation against a value the CALLER supplies. That leaves one
|
|
6
|
+
* claim unsayable: "the page shows what the server answered". The refund case is the one that
|
|
7
|
+
* shipped — the server read `1187.01` as paise and answered `{"refunded":11.87}`, the page displayed
|
|
8
|
+
* the number the user had typed, and every channel was green. `bodyContains` catches it only when
|
|
9
|
+
* the agent already knows the right number, and an agent verifying a fix usually does not.
|
|
10
|
+
*
|
|
11
|
+
* `compare` reads two observed values and relates them, so the claim needs no expected value at all.
|
|
12
|
+
* The sources are the four channels that carry a VALUE (a request or response field, a signal
|
|
13
|
+
* payload field, a store path, an element's text). Route, console and animation carry events, not
|
|
14
|
+
* values, so they are not sources.
|
|
15
|
+
*/
|
|
16
|
+
import { z } from 'zod';
|
|
17
|
+
import { PredicateKind } from './consequence.js';
|
|
18
|
+
/** Which half of an exchange a `net` source reads. */
|
|
19
|
+
export declare const NetBodySide: {
|
|
20
|
+
readonly RESPONSE: "response";
|
|
21
|
+
readonly REQUEST: "request";
|
|
22
|
+
};
|
|
23
|
+
export type NetBodySide = (typeof NetBodySide)[keyof typeof NetBodySide];
|
|
24
|
+
/**
|
|
25
|
+
* How the two readings are compared.
|
|
26
|
+
*
|
|
27
|
+
* `value` is strict equality of two scalars: `"11.87"` and `11.87` differ, because text and a JSON
|
|
28
|
+
* number are different things and saying they agree would be a guess. `number` reads ONE number out
|
|
29
|
+
* of each side (a JSON number as is, a string by its only numeric token, so `"₹1,187.01"` reads as
|
|
30
|
+
* 1187.01) and compares those, within `tolerance`. A string with no number, or with two, is
|
|
31
|
+
* unreadable rather than unequal: picking one would be a guess about which the caller meant.
|
|
32
|
+
*/
|
|
33
|
+
export declare const CompareAs: {
|
|
34
|
+
readonly VALUE: "value";
|
|
35
|
+
readonly NUMBER: "number";
|
|
36
|
+
};
|
|
37
|
+
export type CompareAs = (typeof CompareAs)[keyof typeof CompareAs];
|
|
38
|
+
export type CompareSource = {
|
|
39
|
+
from: typeof PredicateKind.NET;
|
|
40
|
+
urlContains: string;
|
|
41
|
+
method?: string;
|
|
42
|
+
/** Which body the path reads. Defaults to the response, the half a UI cannot fake. */
|
|
43
|
+
body?: NetBodySide;
|
|
44
|
+
path: string;
|
|
45
|
+
} | {
|
|
46
|
+
from: typeof PredicateKind.SIGNAL;
|
|
47
|
+
name: string;
|
|
48
|
+
path: string;
|
|
49
|
+
} | {
|
|
50
|
+
from: typeof PredicateKind.STATE;
|
|
51
|
+
store?: string;
|
|
52
|
+
path: string;
|
|
53
|
+
}
|
|
54
|
+
/** The whole text of the element `scope` names (a CSS selector), itself included. */
|
|
55
|
+
| {
|
|
56
|
+
from: typeof PredicateKind.TEXT;
|
|
57
|
+
scope: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Cast rather than annotated for the reason `PredicateSchema` is: zod infers optional fields as
|
|
61
|
+
* `| undefined`, which `exactOptionalPropertyTypes` will not assign to the hand-written type.
|
|
62
|
+
*/
|
|
63
|
+
export declare const CompareSourceSchema: z.ZodType<CompareSource>;
|
|
64
|
+
/**
|
|
65
|
+
* Does this source read a value the APP produced — a request, a payload, a store — rather than
|
|
66
|
+
* rendered text?
|
|
67
|
+
*
|
|
68
|
+
* Decides how a `compare` grades. With at least one such side, a pass means the page agrees with the
|
|
69
|
+
* app's own record of what happened, which a healed-but-wrong locator cannot fake. Text against text
|
|
70
|
+
* is a presence-grade claim, because both sides are readings of the same DOM.
|
|
71
|
+
*/
|
|
72
|
+
export declare function isConsequenceSource(source: CompareSource): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Do two sources read the same value, for refusing a comparison with itself?
|
|
75
|
+
*
|
|
76
|
+
* Spelled-out defaults are filled in first. Otherwise `{ body: "response" }` against a source that
|
|
77
|
+
* left `body` out would read as two different sources, and a comparison that cannot fail would get
|
|
78
|
+
* past the refusal just by being written two ways.
|
|
79
|
+
*/
|
|
80
|
+
export declare function sameCompareSource(a: CompareSource, b: CompareSource): boolean;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `compare` predicate's contract: where each side's value is read from, and how the two are
|
|
3
|
+
* compared.
|
|
4
|
+
*
|
|
5
|
+
* Every other predicate checks one observation against a value the CALLER supplies. That leaves one
|
|
6
|
+
* claim unsayable: "the page shows what the server answered". The refund case is the one that
|
|
7
|
+
* shipped — the server read `1187.01` as paise and answered `{"refunded":11.87}`, the page displayed
|
|
8
|
+
* the number the user had typed, and every channel was green. `bodyContains` catches it only when
|
|
9
|
+
* the agent already knows the right number, and an agent verifying a fix usually does not.
|
|
10
|
+
*
|
|
11
|
+
* `compare` reads two observed values and relates them, so the claim needs no expected value at all.
|
|
12
|
+
* The sources are the four channels that carry a VALUE (a request or response field, a signal
|
|
13
|
+
* payload field, a store path, an element's text). Route, console and animation carry events, not
|
|
14
|
+
* values, so they are not sources.
|
|
15
|
+
*/
|
|
16
|
+
import { z } from 'zod';
|
|
17
|
+
import { PredicateKind } from './consequence.js';
|
|
18
|
+
/** Which half of an exchange a `net` source reads. */
|
|
19
|
+
export const NetBodySide = {
|
|
20
|
+
RESPONSE: 'response',
|
|
21
|
+
REQUEST: 'request',
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* How the two readings are compared.
|
|
25
|
+
*
|
|
26
|
+
* `value` is strict equality of two scalars: `"11.87"` and `11.87` differ, because text and a JSON
|
|
27
|
+
* number are different things and saying they agree would be a guess. `number` reads ONE number out
|
|
28
|
+
* of each side (a JSON number as is, a string by its only numeric token, so `"₹1,187.01"` reads as
|
|
29
|
+
* 1187.01) and compares those, within `tolerance`. A string with no number, or with two, is
|
|
30
|
+
* unreadable rather than unequal: picking one would be a guess about which the caller meant.
|
|
31
|
+
*/
|
|
32
|
+
export const CompareAs = {
|
|
33
|
+
VALUE: 'value',
|
|
34
|
+
NUMBER: 'number',
|
|
35
|
+
};
|
|
36
|
+
/** A path into a JSON value: `data.total`, `items.0.id` — the grammar `state.path` speaks. */
|
|
37
|
+
const pathField = z.string().min(1);
|
|
38
|
+
/**
|
|
39
|
+
* Cast rather than annotated for the reason `PredicateSchema` is: zod infers optional fields as
|
|
40
|
+
* `| undefined`, which `exactOptionalPropertyTypes` will not assign to the hand-written type.
|
|
41
|
+
*/
|
|
42
|
+
export const CompareSourceSchema = z.discriminatedUnion('from', [
|
|
43
|
+
z
|
|
44
|
+
.object({
|
|
45
|
+
from: z.literal(PredicateKind.NET),
|
|
46
|
+
urlContains: z.string().min(1),
|
|
47
|
+
method: z.string().optional(),
|
|
48
|
+
body: z.enum([NetBodySide.RESPONSE, NetBodySide.REQUEST]).optional(),
|
|
49
|
+
path: pathField,
|
|
50
|
+
})
|
|
51
|
+
.strict(),
|
|
52
|
+
z
|
|
53
|
+
.object({ from: z.literal(PredicateKind.SIGNAL), name: z.string().min(1), path: pathField })
|
|
54
|
+
.strict(),
|
|
55
|
+
z
|
|
56
|
+
.object({ from: z.literal(PredicateKind.STATE), store: z.string().optional(), path: pathField })
|
|
57
|
+
.strict(),
|
|
58
|
+
z.object({ from: z.literal(PredicateKind.TEXT), scope: z.string().min(1) }).strict(),
|
|
59
|
+
]);
|
|
60
|
+
/**
|
|
61
|
+
* Does this source read a value the APP produced — a request, a payload, a store — rather than
|
|
62
|
+
* rendered text?
|
|
63
|
+
*
|
|
64
|
+
* Decides how a `compare` grades. With at least one such side, a pass means the page agrees with the
|
|
65
|
+
* app's own record of what happened, which a healed-but-wrong locator cannot fake. Text against text
|
|
66
|
+
* is a presence-grade claim, because both sides are readings of the same DOM.
|
|
67
|
+
*/
|
|
68
|
+
export function isConsequenceSource(source) {
|
|
69
|
+
return PredicateKind.TEXT !== source.from;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Do two sources read the same value, for refusing a comparison with itself?
|
|
73
|
+
*
|
|
74
|
+
* Spelled-out defaults are filled in first. Otherwise `{ body: "response" }` against a source that
|
|
75
|
+
* left `body` out would read as two different sources, and a comparison that cannot fail would get
|
|
76
|
+
* past the refusal just by being written two ways.
|
|
77
|
+
*/
|
|
78
|
+
export function sameCompareSource(a, b) {
|
|
79
|
+
const left = withDefaults(a);
|
|
80
|
+
const right = withDefaults(b);
|
|
81
|
+
const keys = new Set([...Object.keys(left), ...Object.keys(right)]);
|
|
82
|
+
return [...keys].every((key) => left[key] === right[key]);
|
|
83
|
+
}
|
|
84
|
+
function withDefaults(source) {
|
|
85
|
+
// The network reader matches methods case-blind, so `GET` and `get` pick the same call.
|
|
86
|
+
if (PredicateKind.NET === source.from)
|
|
87
|
+
return {
|
|
88
|
+
...source,
|
|
89
|
+
body: source.body ?? NetBodySide.RESPONSE,
|
|
90
|
+
method: source.method?.toUpperCase(),
|
|
91
|
+
};
|
|
92
|
+
return { ...source };
|
|
93
|
+
}
|
|
@@ -43,6 +43,8 @@ export declare const PredicateKind: {
|
|
|
43
43
|
readonly CONSOLE: "console";
|
|
44
44
|
readonly ANIMATION: "animation";
|
|
45
45
|
readonly SETTLED: "settled";
|
|
46
|
+
/** Two observed values, related to each other — see compare-source.ts. */
|
|
47
|
+
readonly COMPARE: "compare";
|
|
46
48
|
readonly ALL_OF: "allOf";
|
|
47
49
|
readonly ANY_OF: "anyOf";
|
|
48
50
|
readonly NOT: "not";
|
|
@@ -119,7 +119,7 @@ export const InstrumentationGapKind = {
|
|
|
119
119
|
*/
|
|
120
120
|
const GAP_FIX = {
|
|
121
121
|
[InstrumentationGapKind.NO_SOURCE_MAPPING]: 'add the Reticle build plugin (@reticlehq/vite-plugin, @reticlehq/next, or the babel plugin) so elements carry data-reticle-source',
|
|
122
|
-
[InstrumentationGapKind.NO_STORE_REGISTERED]: 'register the store with reticle.registerStore(name, getState) so
|
|
122
|
+
[InstrumentationGapKind.NO_STORE_REGISTERED]: 'register the store itself with reticle.registerStore(name, store), or registerStore(name, getState, subscribe), so its changes are observed — a bare getter can be read but never reports a change',
|
|
123
123
|
[InstrumentationGapKind.NO_SIGNAL_ON_MUTATION]: 'fire reticle.signal(name, data) where this state is committed — commitAndSignal binds the two so they cannot drift',
|
|
124
124
|
[InstrumentationGapKind.UNDECLARED_CONTROL]: 'add this control to reticle.describe() so the capability contract matches what the app actually exposes',
|
|
125
125
|
[InstrumentationGapKind.MISSING_TESTID]: 'add data-testid="..." on this control so the flow can name it after a refactor',
|
package/dist/verdict/intent.d.ts
CHANGED
|
@@ -39,12 +39,12 @@ export declare const IntentSurfaceSchema: z.ZodObject<{
|
|
|
39
39
|
flow: z.ZodOptional<z.ZodString>;
|
|
40
40
|
files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
41
41
|
}, "strip", z.ZodTypeAny, {
|
|
42
|
-
flow?: string | undefined;
|
|
43
42
|
route?: string | undefined;
|
|
43
|
+
flow?: string | undefined;
|
|
44
44
|
files?: string[] | undefined;
|
|
45
45
|
}, {
|
|
46
|
-
flow?: string | undefined;
|
|
47
46
|
route?: string | undefined;
|
|
47
|
+
flow?: string | undefined;
|
|
48
48
|
files?: string[] | undefined;
|
|
49
49
|
}>;
|
|
50
50
|
export type IntentSurface = z.infer<typeof IntentSurfaceSchema>;
|
|
@@ -75,12 +75,12 @@ export declare const IntentSchema: z.ZodObject<{
|
|
|
75
75
|
flow: z.ZodOptional<z.ZodString>;
|
|
76
76
|
files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
77
77
|
}, "strip", z.ZodTypeAny, {
|
|
78
|
-
flow?: string | undefined;
|
|
79
78
|
route?: string | undefined;
|
|
79
|
+
flow?: string | undefined;
|
|
80
80
|
files?: string[] | undefined;
|
|
81
81
|
}, {
|
|
82
|
-
flow?: string | undefined;
|
|
83
82
|
route?: string | undefined;
|
|
83
|
+
flow?: string | undefined;
|
|
84
84
|
files?: string[] | undefined;
|
|
85
85
|
}>>;
|
|
86
86
|
provenBy: z.ZodOptional<z.ZodObject<{
|
|
@@ -113,8 +113,8 @@ export declare const IntentSchema: z.ZodObject<{
|
|
|
113
113
|
statement: string;
|
|
114
114
|
declaredAt: number;
|
|
115
115
|
surface?: {
|
|
116
|
-
flow?: string | undefined;
|
|
117
116
|
route?: string | undefined;
|
|
117
|
+
flow?: string | undefined;
|
|
118
118
|
files?: string[] | undefined;
|
|
119
119
|
} | undefined;
|
|
120
120
|
binding?: unknown;
|
|
@@ -133,8 +133,8 @@ export declare const IntentSchema: z.ZodObject<{
|
|
|
133
133
|
statement: string;
|
|
134
134
|
declaredAt: number;
|
|
135
135
|
surface?: {
|
|
136
|
-
flow?: string | undefined;
|
|
137
136
|
route?: string | undefined;
|
|
137
|
+
flow?: string | undefined;
|
|
138
138
|
files?: string[] | undefined;
|
|
139
139
|
} | undefined;
|
|
140
140
|
binding?: unknown;
|
|
@@ -164,12 +164,12 @@ export declare const IntentFileSchema: z.ZodObject<{
|
|
|
164
164
|
flow: z.ZodOptional<z.ZodString>;
|
|
165
165
|
files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
166
166
|
}, "strip", z.ZodTypeAny, {
|
|
167
|
-
flow?: string | undefined;
|
|
168
167
|
route?: string | undefined;
|
|
168
|
+
flow?: string | undefined;
|
|
169
169
|
files?: string[] | undefined;
|
|
170
170
|
}, {
|
|
171
|
-
flow?: string | undefined;
|
|
172
171
|
route?: string | undefined;
|
|
172
|
+
flow?: string | undefined;
|
|
173
173
|
files?: string[] | undefined;
|
|
174
174
|
}>>;
|
|
175
175
|
provenBy: z.ZodOptional<z.ZodObject<{
|
|
@@ -202,8 +202,8 @@ export declare const IntentFileSchema: z.ZodObject<{
|
|
|
202
202
|
statement: string;
|
|
203
203
|
declaredAt: number;
|
|
204
204
|
surface?: {
|
|
205
|
-
flow?: string | undefined;
|
|
206
205
|
route?: string | undefined;
|
|
206
|
+
flow?: string | undefined;
|
|
207
207
|
files?: string[] | undefined;
|
|
208
208
|
} | undefined;
|
|
209
209
|
binding?: unknown;
|
|
@@ -222,8 +222,8 @@ export declare const IntentFileSchema: z.ZodObject<{
|
|
|
222
222
|
statement: string;
|
|
223
223
|
declaredAt: number;
|
|
224
224
|
surface?: {
|
|
225
|
-
flow?: string | undefined;
|
|
226
225
|
route?: string | undefined;
|
|
226
|
+
flow?: string | undefined;
|
|
227
227
|
files?: string[] | undefined;
|
|
228
228
|
} | undefined;
|
|
229
229
|
binding?: unknown;
|
|
@@ -245,8 +245,8 @@ export declare const IntentFileSchema: z.ZodObject<{
|
|
|
245
245
|
statement: string;
|
|
246
246
|
declaredAt: number;
|
|
247
247
|
surface?: {
|
|
248
|
-
flow?: string | undefined;
|
|
249
248
|
route?: string | undefined;
|
|
249
|
+
flow?: string | undefined;
|
|
250
250
|
files?: string[] | undefined;
|
|
251
251
|
} | undefined;
|
|
252
252
|
binding?: unknown;
|
|
@@ -268,8 +268,8 @@ export declare const IntentFileSchema: z.ZodObject<{
|
|
|
268
268
|
statement: string;
|
|
269
269
|
declaredAt: number;
|
|
270
270
|
surface?: {
|
|
271
|
-
flow?: string | undefined;
|
|
272
271
|
route?: string | undefined;
|
|
272
|
+
flow?: string | undefined;
|
|
273
273
|
files?: string[] | undefined;
|
|
274
274
|
} | undefined;
|
|
275
275
|
binding?: unknown;
|