@reticlehq/core 3.7.0 → 3.8.1
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/activation-entry.d.ts +9 -0
- package/dist/activation-entry.js +9 -0
- package/dist/artifacts/drive-script.d.ts +84 -1217
- package/dist/artifacts/drive-script.js +1 -1
- package/dist/artifacts/flow-constants.d.ts +15 -0
- package/dist/artifacts/flow-constants.js +15 -0
- package/dist/artifacts/flow-expect-flat.d.ts +8 -192
- package/dist/artifacts/flow-expect-flat.js +2 -2
- package/dist/artifacts/flow-results.d.ts +26 -0
- package/dist/artifacts/flow-types.d.ts +212 -2295
- package/dist/artifacts/flow-types.js +14 -2
- package/dist/artifacts/harness-credits.d.ts +6 -3
- package/dist/artifacts/harness-credits.js +9 -6
- package/dist/artifacts/harness-map.d.ts +8 -69
- package/dist/artifacts/harness-map.js +1 -1
- package/dist/artifacts/hud-notices.d.ts +8 -82
- package/dist/artifacts/hud-notices.js +1 -1
- package/dist/artifacts/impact.d.ts +104 -1665
- package/dist/artifacts/impact.js +38 -21
- package/dist/artifacts/journal.d.ts +15 -231
- package/dist/artifacts/journal.js +15 -2
- package/dist/artifacts/prompt-context.d.ts +7 -33
- package/dist/artifacts/prompt-context.js +15 -4
- package/dist/artifacts/screenshot-upload.d.ts +3 -26
- package/dist/artifacts/screenshot-upload.js +1 -1
- package/dist/graph/app-graph.d.ts +137 -0
- package/dist/graph/app-graph.js +498 -0
- package/dist/hooks/hook-events.d.ts +15 -171
- package/dist/hooks/hook-events.js +1 -1
- package/dist/hud-entry.js +1 -1
- package/dist/identity/checkout.d.ts +41 -0
- package/dist/identity/checkout.js +118 -0
- package/dist/identity/state-dir.d.ts +23 -0
- package/dist/identity/state-dir.js +43 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +10 -0
- package/dist/onboarding.d.ts +23 -52
- package/dist/onboarding.js +20 -1
- package/dist/registry/daemon-registry.d.ts +2 -14
- package/dist/registry/daemon-registry.js +1 -1
- package/dist/registry/dev-server-registry.d.ts +2 -31
- package/dist/registry/dev-server-registry.js +1 -1
- package/dist/registry/project-registry.d.ts +4 -32
- package/dist/registry/project-registry.js +1 -1
- package/dist/schema/command-message.json +65 -68
- package/dist/schema/command-name.json +29 -33
- package/dist/schema/command-result.json +25 -30
- package/dist/schema/event-message.json +104 -101
- package/dist/schema/event-payloads.json +246 -108
- package/dist/schema/event-type.json +47 -48
- package/dist/schema/hello-message.json +150 -133
- package/dist/schema/reticle-event.json +98 -94
- package/dist/schema/reticle-message.json +338 -310
- package/dist/telemetry-bug.d.ts +4 -75
- package/dist/telemetry-bug.js +1 -1
- package/dist/telemetry-entry.d.ts +1 -1
- package/dist/telemetry-entry.js +1 -1
- package/dist/telemetry-feedback.d.ts +17 -91
- package/dist/telemetry-feedback.js +20 -1
- package/dist/telemetry-refusal.d.ts +4 -31
- package/dist/telemetry-refusal.js +1 -1
- package/dist/telemetry-session.d.ts +45 -624
- package/dist/telemetry-session.js +25 -12
- package/dist/telemetry-signals.d.ts +211 -86
- package/dist/telemetry-signals.js +100 -2
- package/dist/telemetry.d.ts +321 -1691
- package/dist/telemetry.js +72 -6
- package/dist/verdict/check-sentence.d.ts +34 -0
- package/dist/verdict/check-sentence.js +228 -0
- package/dist/verdict/compare-source.d.ts +1 -1
- package/dist/verdict/compare-source.js +1 -1
- package/dist/verdict/consequence.d.ts +15 -0
- package/dist/verdict/consequence.js +11 -0
- package/dist/verdict/disparity.d.ts +8 -56
- package/dist/verdict/disparity.js +1 -1
- package/dist/verdict/findings.d.ts +10 -0
- package/dist/verdict/findings.js +13 -0
- package/dist/verdict/instrumentation-coverage.d.ts +6 -37
- package/dist/verdict/instrumentation-coverage.js +15 -59
- package/dist/verdict/instrumentation-gap.d.ts +72 -0
- package/dist/verdict/instrumentation-gap.js +64 -0
- package/dist/verdict/intent.d.ts +25 -224
- package/dist/verdict/intent.js +1 -1
- package/dist/verdict/predicate-tree.d.ts +2 -0
- package/dist/verdict/predicate-tree.js +16 -0
- package/dist/verdict/predicate.d.ts +3 -2
- package/dist/verdict/predicate.js +107 -16
- package/dist/verdict/property-assertion.d.ts +23 -101
- package/dist/verdict/property-assertion.js +1 -1
- package/dist/verdict/run-report.d.ts +71 -0
- package/dist/verdict/run-report.js +53 -0
- package/dist/verdict/security.d.ts +48 -2
- package/dist/verdict/security.js +185 -18
- package/dist/verdict/verification-run.d.ts +124 -1623
- package/dist/verdict/verification-run.js +37 -6
- package/dist/verdict/verify-progress.d.ts +22 -64
- package/dist/verdict/verify-progress.js +1 -1
- package/dist/wire/constants/constants.d.ts +56 -141
- package/dist/wire/constants/constants.js +64 -144
- package/dist/wire/constants/discovery.d.ts +4 -4
- package/dist/wire/constants/discovery.js +4 -4
- package/dist/wire/constants/event-types.d.ts +37 -1
- package/dist/wire/constants/event-types.js +35 -1
- package/dist/wire/constants/hud-controls.js +0 -2
- package/dist/wire/constants/hud-use.d.ts +4 -0
- package/dist/wire/constants/hud-use.js +4 -0
- package/dist/wire/constants/mcp-wire.d.ts +16 -0
- package/dist/wire/constants/mcp-wire.js +16 -0
- package/dist/wire/constants/response-body-reason.d.ts +19 -0
- package/dist/wire/constants/response-body-reason.js +18 -0
- package/dist/wire/constants/reticle-env.d.ts +140 -0
- package/dist/wire/constants/reticle-env.js +140 -0
- package/dist/wire/constants/session-constants.d.ts +11 -0
- package/dist/wire/constants/session-constants.js +11 -0
- package/dist/wire/event-payloads.d.ts +173 -629
- package/dist/wire/event-payloads.js +107 -23
- package/dist/wire/event-priority.js +1 -0
- package/dist/wire/messages.d.ts +90 -713
- package/dist/wire/messages.js +19 -3
- package/dist/wire/narrow.d.ts +6 -0
- package/dist/wire/narrow.js +26 -0
- package/dist/wire/next-step.d.ts +50 -0
- package/dist/wire/next-step.js +37 -0
- package/dist/wire/platform-link.d.ts +7 -0
- package/dist/wire/platform-link.js +14 -8
- package/dist/wire/production/activation-ticket.d.ts +64 -0
- package/dist/wire/production/activation-ticket.js +148 -0
- package/dist/wire/production/hello-mode.d.ts +35 -0
- package/dist/wire/production/hello-mode.js +32 -0
- package/dist/wire/production/production-policy.d.ts +92 -0
- package/dist/wire/production/production-policy.js +133 -0
- package/dist/wire/tool-names.d.ts +2 -0
- package/dist/wire/tool-names.js +2 -0
- package/dist/wire/types.d.ts +102 -700
- package/dist/wire/types.js +5 -5
- package/dist/words/upgrade.d.ts +3 -13
- package/dist/words/upgrade.js +1 -1
- package/package.json +7 -4
|
@@ -205,3 +205,19 @@ export function sessionBoundField(predicate) {
|
|
|
205
205
|
return undefined;
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
+
/** True when any clause of this predicate, at any depth, is a computed `compare`. */
|
|
209
|
+
export function computesComparison(predicate) {
|
|
210
|
+
if (predicate === undefined)
|
|
211
|
+
return false;
|
|
212
|
+
switch (predicate.kind) {
|
|
213
|
+
case PredicateKind.COMPARE:
|
|
214
|
+
return true;
|
|
215
|
+
case PredicateKind.ALL_OF:
|
|
216
|
+
case PredicateKind.ANY_OF:
|
|
217
|
+
return predicate.predicates.some(computesComparison);
|
|
218
|
+
case PredicateKind.NOT:
|
|
219
|
+
return computesComparison(predicate.predicate);
|
|
220
|
+
default:
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
* the contract, not the reasoning. A reader looking for "what may I write" is in the right file; a
|
|
16
16
|
* reader looking for "what does it decide" is one package out.
|
|
17
17
|
*/
|
|
18
|
-
import
|
|
18
|
+
import * as z from 'zod';
|
|
19
19
|
import { type ElementQuery } from '../wire/types.js';
|
|
20
20
|
import { ElementState } from '../wire/constants/constants.js';
|
|
21
21
|
import { CompareAs, type CompareSource } from './compare-source.js';
|
|
22
|
-
import { PredicateKind } from './consequence.js';
|
|
22
|
+
import { PredicateKind, SettledChannel } from './consequence.js';
|
|
23
23
|
import { type PropertyAssertion } from './property-assertion.js';
|
|
24
24
|
export type Predicate = {
|
|
25
25
|
kind: typeof PredicateKind.ELEMENT;
|
|
@@ -113,6 +113,7 @@ export type Predicate = {
|
|
|
113
113
|
} | {
|
|
114
114
|
kind: typeof PredicateKind.SETTLED;
|
|
115
115
|
quietMs?: number;
|
|
116
|
+
channel?: SettledChannel;
|
|
116
117
|
} | {
|
|
117
118
|
kind: typeof PredicateKind.COMPARE;
|
|
118
119
|
left: CompareSource;
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
* the contract, not the reasoning. A reader looking for "what may I write" is in the right file; a
|
|
16
16
|
* reader looking for "what does it decide" is one package out.
|
|
17
17
|
*/
|
|
18
|
-
import
|
|
18
|
+
import * as z from 'zod';
|
|
19
19
|
import { ElementQuerySchema } from '../wire/types.js';
|
|
20
20
|
import { ElementState } from '../wire/constants/constants.js';
|
|
21
21
|
import { CompareAs, CompareSourceSchema, sameCompareSource, } from './compare-source.js';
|
|
22
|
-
import { PredicateKind } from './consequence.js';
|
|
22
|
+
import { PredicateKind, SettledChannel } from './consequence.js';
|
|
23
23
|
import { propertyAssertionSchema } from './property-assertion.js';
|
|
24
24
|
/**
|
|
25
25
|
* Spellings an agent plausibly reaches for, mapped to the real field.
|
|
@@ -65,13 +65,14 @@ const PREDICATE_ALIASES = {
|
|
|
65
65
|
// no other meaning here. Observed twice in one drive on a real app, and each rejection cost a round
|
|
66
66
|
// trip AND produced no verdict — a composite is what an agent reaches for precisely when it has two
|
|
67
67
|
// things to prove at once, so failing it is expensive at the worst moment.
|
|
68
|
-
|
|
69
|
-
[PredicateKind.
|
|
68
|
+
// The kind's own name as the key (`{ allOf: [...] }`) is the shorthand `inferKind` reads.
|
|
69
|
+
[PredicateKind.ALL_OF]: { of: 'predicates', allOf: 'predicates' },
|
|
70
|
+
[PredicateKind.ANY_OF]: { of: 'predicates', anyOf: 'predicates' },
|
|
70
71
|
// `of` on `not` for the same reason it is accepted on the composites above — an agent that learned
|
|
71
72
|
// the spelling one line earlier applies it to the third composite, and `not` was the one that
|
|
72
73
|
// rejected it. The refusal did name `predicate`, but naming a field still costs the round trip
|
|
73
74
|
// that produced no verdict, and the guess is unambiguous: `not` has exactly one child.
|
|
74
|
-
[PredicateKind.NOT]: { of: 'predicate' },
|
|
75
|
+
[PredicateKind.NOT]: { of: 'predicate', not: 'predicate' },
|
|
75
76
|
};
|
|
76
77
|
/**
|
|
77
78
|
* The word half the assertion world spells `kind`.
|
|
@@ -105,6 +106,86 @@ function renameKindSpelling(obj) {
|
|
|
105
106
|
delete out[KIND_SPELLING];
|
|
106
107
|
return out;
|
|
107
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Keys that are also the name of a kind. `{ text: "Saved" }` and `{ allOf: [...] }` are what agents
|
|
111
|
+
* write when they leave out `kind`. The key names the kind, and the alias table maps it to a field.
|
|
112
|
+
*/
|
|
113
|
+
const KIND_NAMED_KEYS = {
|
|
114
|
+
text: PredicateKind.TEXT,
|
|
115
|
+
allOf: PredicateKind.ALL_OF,
|
|
116
|
+
anyOf: PredicateKind.ANY_OF,
|
|
117
|
+
not: PredicateKind.NOT,
|
|
118
|
+
};
|
|
119
|
+
/** Each kind and every key it takes: its fields, its aliases and, for `element`, flat query fields. */
|
|
120
|
+
let keysByKind;
|
|
121
|
+
function keysOfEachKind() {
|
|
122
|
+
if (keysByKind !== undefined) {
|
|
123
|
+
return keysByKind;
|
|
124
|
+
}
|
|
125
|
+
const out = new Map();
|
|
126
|
+
for (const option of predicateUnion().options) {
|
|
127
|
+
const shape = option.shape;
|
|
128
|
+
const kind = String(shape['kind'].value);
|
|
129
|
+
const flat = PredicateKind.ELEMENT === kind ? ELEMENT_QUERY_FIELDS : [];
|
|
130
|
+
out.set(kind, new Set([
|
|
131
|
+
...Object.keys(shape).filter((key) => 'kind' !== key),
|
|
132
|
+
...Object.keys(PREDICATE_ALIASES[kind] ?? {}),
|
|
133
|
+
...flat,
|
|
134
|
+
]));
|
|
135
|
+
}
|
|
136
|
+
keysByKind = out;
|
|
137
|
+
return out;
|
|
138
|
+
}
|
|
139
|
+
const writtenKeys = (obj) => Object.keys(obj).filter((key) => obj[key] !== undefined);
|
|
140
|
+
/**
|
|
141
|
+
* The kind of a predicate written with no `kind`, when its keys fit exactly one kind.
|
|
142
|
+
*
|
|
143
|
+
* A key that names a kind (`text`, `allOf`, `anyOf`, `not`) selects that kind, if the kind takes
|
|
144
|
+
* every other key too. Otherwise the kind is the only one that takes every key. Keys that fit two
|
|
145
|
+
* kinds (`name` is on `signal` and `animation`) or none give no kind, and the schema refuses them.
|
|
146
|
+
* This only supplies `kind`: the predicate that results is the one the explicit form gives.
|
|
147
|
+
*/
|
|
148
|
+
function inferKind(obj) {
|
|
149
|
+
const keys = writtenKeys(obj);
|
|
150
|
+
if (0 === keys.length) {
|
|
151
|
+
return undefined;
|
|
152
|
+
}
|
|
153
|
+
const kinds = keysOfEachKind();
|
|
154
|
+
const takesAll = (kind) => {
|
|
155
|
+
const accepted = kinds.get(kind);
|
|
156
|
+
return accepted !== undefined && keys.every((key) => accepted.has(key));
|
|
157
|
+
};
|
|
158
|
+
const named = keys.flatMap((key) => {
|
|
159
|
+
const kind = KIND_NAMED_KEYS[key];
|
|
160
|
+
return kind === undefined ? [] : [kind];
|
|
161
|
+
});
|
|
162
|
+
if (1 < named.length) {
|
|
163
|
+
return undefined;
|
|
164
|
+
}
|
|
165
|
+
const [byName] = named;
|
|
166
|
+
if (byName !== undefined) {
|
|
167
|
+
return takesAll(byName) ? byName : undefined;
|
|
168
|
+
}
|
|
169
|
+
const fits = [...kinds.keys()].filter(takesAll);
|
|
170
|
+
return 1 === fits.length ? fits[0] : undefined;
|
|
171
|
+
}
|
|
172
|
+
/** The kind inferred for a predicate written with neither `kind` nor `type`, if any. */
|
|
173
|
+
function kindToInfer(given) {
|
|
174
|
+
const renamed = renameKindSpelling(given);
|
|
175
|
+
return renamed['kind'] === undefined ? inferKind(renamed) : undefined;
|
|
176
|
+
}
|
|
177
|
+
/** `type` renamed to `kind`, then the kind inferred from the keys when neither was written. */
|
|
178
|
+
function withKind(given) {
|
|
179
|
+
const renamed = renameKindSpelling(given);
|
|
180
|
+
const kind = kindToInfer(given);
|
|
181
|
+
return kind === undefined ? renamed : { ...renamed, kind };
|
|
182
|
+
}
|
|
183
|
+
/** Why a predicate with no `kind` was refused: the keys it had, and the kinds there are. */
|
|
184
|
+
function noKindRefusal(obj) {
|
|
185
|
+
const keys = writtenKeys(obj).map((key) => `\`${key}\``);
|
|
186
|
+
return (`this predicate has no \`kind\`, and its keys (${keys.length > 0 ? keys.join(', ') : 'none'}) ` +
|
|
187
|
+
`do not fit exactly one kind. Add \`kind\`: one of ${[...keysOfEachKind().keys()].join(', ')}`);
|
|
188
|
+
}
|
|
108
189
|
/**
|
|
109
190
|
* Which aliases a predicate as WRITTEN would have renamed, as `kind.from → to` (and `type → kind`).
|
|
110
191
|
*
|
|
@@ -122,7 +203,11 @@ export function predicateAliasesUsed(input, depth = 0) {
|
|
|
122
203
|
if (given['kind'] === undefined && 'string' === typeof given[KIND_SPELLING]) {
|
|
123
204
|
used.push(`${KIND_SPELLING} → kind`);
|
|
124
205
|
}
|
|
125
|
-
const
|
|
206
|
+
const inferred = kindToInfer(given);
|
|
207
|
+
if (inferred !== undefined) {
|
|
208
|
+
used.push(`(no kind) → kind: "${inferred}"`);
|
|
209
|
+
}
|
|
210
|
+
const obj = withKind(given);
|
|
126
211
|
const kind = 'string' === typeof obj['kind'] ? obj['kind'] : '';
|
|
127
212
|
for (const [from, to] of Object.entries(PREDICATE_ALIASES[kind] ?? {})) {
|
|
128
213
|
if (obj[from] !== undefined && obj[to] === undefined)
|
|
@@ -134,7 +219,7 @@ export function predicateAliasesUsed(input, depth = 0) {
|
|
|
134
219
|
used.push(`element.${field} → query.${field}`);
|
|
135
220
|
}
|
|
136
221
|
}
|
|
137
|
-
for (const field of ['predicates', 'of', 'predicate']) {
|
|
222
|
+
for (const field of ['predicates', 'of', 'predicate', 'allOf', 'anyOf', 'not']) {
|
|
138
223
|
const child = obj[field];
|
|
139
224
|
for (const nested of Array.isArray(child) ? child : [child]) {
|
|
140
225
|
used.push(...predicateAliasesUsed(nested, depth + 1));
|
|
@@ -143,11 +228,14 @@ export function predicateAliasesUsed(input, depth = 0) {
|
|
|
143
228
|
return used;
|
|
144
229
|
}
|
|
145
230
|
/** Rename known aliases before parse; an explicit canonical key always wins. */
|
|
146
|
-
function applyPredicateAliases(input) {
|
|
231
|
+
function applyPredicateAliases(input, ctx) {
|
|
147
232
|
if (typeof input !== 'object' || null === input || Array.isArray(input))
|
|
148
233
|
return input;
|
|
149
234
|
const given = input;
|
|
150
|
-
const obj =
|
|
235
|
+
const obj = withKind(given);
|
|
236
|
+
if (obj['kind'] === undefined) {
|
|
237
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, message: noKindRefusal(obj) });
|
|
238
|
+
}
|
|
151
239
|
const kind = 'string' === typeof obj['kind'] ? obj['kind'] : '';
|
|
152
240
|
const aliases = PREDICATE_ALIASES[kind];
|
|
153
241
|
let out = obj;
|
|
@@ -164,10 +252,13 @@ function applyPredicateAliases(input) {
|
|
|
164
252
|
return PredicateKind.ELEMENT === kind ? liftElementQuery(out) : out;
|
|
165
253
|
}
|
|
166
254
|
/**
|
|
167
|
-
* Fold flat query fields into `query`.
|
|
168
|
-
*
|
|
255
|
+
* Fold flat query fields into `query`. With an explicit `query` nothing is folded and nothing is
|
|
256
|
+
* dropped: merging would invent a locator neither side wrote, and dropping a flat `value` checked
|
|
257
|
+
* only that the element exists. The strict schema refuses the flat field instead, by name.
|
|
169
258
|
*/
|
|
170
259
|
function liftElementQuery(obj) {
|
|
260
|
+
if (obj['query'] !== undefined)
|
|
261
|
+
return obj;
|
|
171
262
|
const loose = ELEMENT_QUERY_FIELDS.filter((field) => obj[field] !== undefined);
|
|
172
263
|
if (0 === loose.length)
|
|
173
264
|
return obj;
|
|
@@ -177,8 +268,7 @@ function liftElementQuery(obj) {
|
|
|
177
268
|
query[field] = out[field];
|
|
178
269
|
delete out[field];
|
|
179
270
|
}
|
|
180
|
-
|
|
181
|
-
out['query'] = query;
|
|
271
|
+
out['query'] = query;
|
|
182
272
|
return out;
|
|
183
273
|
}
|
|
184
274
|
/**
|
|
@@ -337,7 +427,7 @@ function predicateUnion() {
|
|
|
337
427
|
.object({
|
|
338
428
|
kind: z.literal(PredicateKind.SIGNAL),
|
|
339
429
|
name: z.string().optional(),
|
|
340
|
-
dataMatches: z.record(z.unknown()).optional(),
|
|
430
|
+
dataMatches: z.record(z.string(), z.unknown()).optional(),
|
|
341
431
|
/**
|
|
342
432
|
* Exact number of matching signals since the action — presence becomes cardinality.
|
|
343
433
|
*
|
|
@@ -371,6 +461,7 @@ function predicateUnion() {
|
|
|
371
461
|
.object({
|
|
372
462
|
kind: z.literal(PredicateKind.SETTLED),
|
|
373
463
|
quietMs: z.number().positive().optional(),
|
|
464
|
+
channel: z.enum([SettledChannel.NETWORK, SettledChannel.APP]).optional(),
|
|
374
465
|
})
|
|
375
466
|
.strict(),
|
|
376
467
|
z
|
|
@@ -501,9 +592,9 @@ export function predicateShapeFor(kind) {
|
|
|
501
592
|
for (const option of predicateUnion().options) {
|
|
502
593
|
const shape = option.shape;
|
|
503
594
|
const literal = shape?.['kind'];
|
|
504
|
-
|
|
505
|
-
if (value === kind)
|
|
595
|
+
if (literal instanceof z.ZodLiteral && literal.value === kind) {
|
|
506
596
|
return shape;
|
|
597
|
+
}
|
|
507
598
|
}
|
|
508
599
|
return null;
|
|
509
600
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Split out of the engine with the rest of the predicate contract, and for the same reason: a saved
|
|
9
9
|
* flow carries one of these now, so core has to be able to parse what it reads.
|
|
10
10
|
*/
|
|
11
|
-
import
|
|
11
|
+
import * as z from 'zod';
|
|
12
12
|
import { MeasureOp } from 'open-verification';
|
|
13
13
|
export type PropertyAssertion =
|
|
14
14
|
/** Produced something at all — the honest floor for any generated output. */
|
|
@@ -63,129 +63,51 @@ export interface Baseline {
|
|
|
63
63
|
readonly taken: true;
|
|
64
64
|
readonly value: unknown;
|
|
65
65
|
}
|
|
66
|
-
export declare const propertyAssertionSchema: z.ZodDiscriminatedUnion<
|
|
66
|
+
export declare const propertyAssertionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
67
67
|
property: z.ZodLiteral<"nonEmpty">;
|
|
68
|
-
},
|
|
69
|
-
property: "nonEmpty";
|
|
70
|
-
}, {
|
|
71
|
-
property: "nonEmpty";
|
|
72
|
-
}>, z.ZodObject<{
|
|
68
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
73
69
|
property: z.ZodLiteral<"oneOf">;
|
|
74
|
-
values: z.ZodArray<z.ZodUnknown
|
|
75
|
-
},
|
|
76
|
-
values: unknown[];
|
|
77
|
-
property: "oneOf";
|
|
78
|
-
}, {
|
|
79
|
-
values: unknown[];
|
|
80
|
-
property: "oneOf";
|
|
81
|
-
}>, z.ZodObject<{
|
|
70
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
71
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
82
72
|
property: z.ZodLiteral<"withinTolerance">;
|
|
83
73
|
of: z.ZodNumber;
|
|
84
74
|
tolerance: z.ZodNumber;
|
|
85
|
-
},
|
|
86
|
-
tolerance: number;
|
|
87
|
-
property: "withinTolerance";
|
|
88
|
-
of: number;
|
|
89
|
-
}, {
|
|
90
|
-
tolerance: number;
|
|
91
|
-
property: "withinTolerance";
|
|
92
|
-
of: number;
|
|
93
|
-
}>, z.ZodObject<{
|
|
75
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
94
76
|
property: z.ZodLiteral<"matchesPattern">;
|
|
95
77
|
pattern: z.ZodString;
|
|
96
|
-
},
|
|
97
|
-
property: "matchesPattern";
|
|
98
|
-
pattern: string;
|
|
99
|
-
}, {
|
|
100
|
-
property: "matchesPattern";
|
|
101
|
-
pattern: string;
|
|
102
|
-
}>, z.ZodObject<{
|
|
78
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
103
79
|
property: z.ZodLiteral<"type">;
|
|
104
|
-
is: z.ZodEnum<
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}>, z.ZodObject<{
|
|
80
|
+
is: z.ZodEnum<{
|
|
81
|
+
string: "string";
|
|
82
|
+
number: "number";
|
|
83
|
+
boolean: "boolean";
|
|
84
|
+
object: "object";
|
|
85
|
+
array: "array";
|
|
86
|
+
}>;
|
|
87
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
112
88
|
property: z.ZodLiteral<"changed">;
|
|
113
|
-
},
|
|
114
|
-
property: "changed";
|
|
115
|
-
}, {
|
|
116
|
-
property: "changed";
|
|
117
|
-
}>, z.ZodObject<{
|
|
89
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
118
90
|
property: z.ZodLiteral<"unchanged">;
|
|
119
|
-
},
|
|
120
|
-
property: "unchanged";
|
|
121
|
-
}, {
|
|
122
|
-
property: "unchanged";
|
|
123
|
-
}>, z.ZodObject<{
|
|
91
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
124
92
|
property: z.ZodLiteral<"increased">;
|
|
125
93
|
by: z.ZodOptional<z.ZodObject<{
|
|
126
|
-
op: z.
|
|
94
|
+
op: z.ZodEnum<{
|
|
127
95
|
readonly EQUALS: "equals";
|
|
128
96
|
readonly AT_LEAST: "at-least";
|
|
129
97
|
readonly AT_MOST: "at-most";
|
|
130
98
|
}>;
|
|
131
99
|
value: z.ZodNumber;
|
|
132
|
-
/** Never negative — a negative tolerance NARROWS the band, which is a different claim by accident. */
|
|
133
100
|
tolerance: z.ZodOptional<z.ZodNumber>;
|
|
134
|
-
},
|
|
135
|
-
|
|
136
|
-
op: "equals" | "at-least" | "at-most";
|
|
137
|
-
tolerance?: number | undefined;
|
|
138
|
-
}, {
|
|
139
|
-
value: number;
|
|
140
|
-
op: "equals" | "at-least" | "at-most";
|
|
141
|
-
tolerance?: number | undefined;
|
|
142
|
-
}>>;
|
|
143
|
-
}, "strict", z.ZodTypeAny, {
|
|
144
|
-
property: "increased";
|
|
145
|
-
by?: {
|
|
146
|
-
value: number;
|
|
147
|
-
op: "equals" | "at-least" | "at-most";
|
|
148
|
-
tolerance?: number | undefined;
|
|
149
|
-
} | undefined;
|
|
150
|
-
}, {
|
|
151
|
-
property: "increased";
|
|
152
|
-
by?: {
|
|
153
|
-
value: number;
|
|
154
|
-
op: "equals" | "at-least" | "at-most";
|
|
155
|
-
tolerance?: number | undefined;
|
|
156
|
-
} | undefined;
|
|
157
|
-
}>, z.ZodObject<{
|
|
101
|
+
}, z.core.$strict>>;
|
|
102
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
158
103
|
property: z.ZodLiteral<"decreased">;
|
|
159
104
|
by: z.ZodOptional<z.ZodObject<{
|
|
160
|
-
op: z.
|
|
105
|
+
op: z.ZodEnum<{
|
|
161
106
|
readonly EQUALS: "equals";
|
|
162
107
|
readonly AT_LEAST: "at-least";
|
|
163
108
|
readonly AT_MOST: "at-most";
|
|
164
109
|
}>;
|
|
165
110
|
value: z.ZodNumber;
|
|
166
|
-
/** Never negative — a negative tolerance NARROWS the band, which is a different claim by accident. */
|
|
167
111
|
tolerance: z.ZodOptional<z.ZodNumber>;
|
|
168
|
-
},
|
|
169
|
-
|
|
170
|
-
op: "equals" | "at-least" | "at-most";
|
|
171
|
-
tolerance?: number | undefined;
|
|
172
|
-
}, {
|
|
173
|
-
value: number;
|
|
174
|
-
op: "equals" | "at-least" | "at-most";
|
|
175
|
-
tolerance?: number | undefined;
|
|
176
|
-
}>>;
|
|
177
|
-
}, "strict", z.ZodTypeAny, {
|
|
178
|
-
property: "decreased";
|
|
179
|
-
by?: {
|
|
180
|
-
value: number;
|
|
181
|
-
op: "equals" | "at-least" | "at-most";
|
|
182
|
-
tolerance?: number | undefined;
|
|
183
|
-
} | undefined;
|
|
184
|
-
}, {
|
|
185
|
-
property: "decreased";
|
|
186
|
-
by?: {
|
|
187
|
-
value: number;
|
|
188
|
-
op: "equals" | "at-least" | "at-most";
|
|
189
|
-
tolerance?: number | undefined;
|
|
190
|
-
} | undefined;
|
|
191
|
-
}>]>;
|
|
112
|
+
}, z.core.$strict>>;
|
|
113
|
+
}, z.core.$strict>], "property">;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Split out of the engine with the rest of the predicate contract, and for the same reason: a saved
|
|
9
9
|
* flow carries one of these now, so core has to be able to parse what it reads.
|
|
10
10
|
*/
|
|
11
|
-
import
|
|
11
|
+
import * as z from 'zod';
|
|
12
12
|
import { MeasureOp } from 'open-verification';
|
|
13
13
|
const deltaSchema = z
|
|
14
14
|
.object({
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The end-of-run report: what an agent's run checked, what held, and what it left on disk.
|
|
3
|
+
*
|
|
4
|
+
* The server builds it from what it measured, and the agent shows it as the last part of its
|
|
5
|
+
* answer. The agent does not write the verdicts: an agent asked to summarise an `unknown` tends to
|
|
6
|
+
* summarise it into a pass. Every number here was counted during the run. A number that was not
|
|
7
|
+
* measured is left out, never shown as a zero.
|
|
8
|
+
*/
|
|
9
|
+
import * as z from 'zod';
|
|
10
|
+
/** The output field that carries the report. */
|
|
11
|
+
export declare const RUN_REPORT_FIELD = "runReport";
|
|
12
|
+
/** What the agent does with the report. One sentence, said with the report every time. */
|
|
13
|
+
export declare const RUN_REPORT_INSTRUCTION = "End your answer to the user with `runReport.markdown`, unchanged. Do not reword its verdicts.";
|
|
14
|
+
/** Where the hosted dashboard is. */
|
|
15
|
+
export declare const CLOUD_DASHBOARD_URL = "https://app.reticle.sh";
|
|
16
|
+
/**
|
|
17
|
+
* The one line about Reticle Cloud. It is shown only when the project is not linked, it is
|
|
18
|
+
* labelled, and `RETICLE_NO_UPSELL` turns it off. It names no price: the price lives in
|
|
19
|
+
* reticle-cloud's billing, changes with the plan and the currency, and a number here would drift.
|
|
20
|
+
*/
|
|
21
|
+
export declare const CLOUD_VALUE_LINE: string;
|
|
22
|
+
export declare const RunReportClaimSchema: z.ZodObject<{
|
|
23
|
+
claim: z.ZodString;
|
|
24
|
+
verified: z.ZodEnum<{
|
|
25
|
+
readonly YES: "yes";
|
|
26
|
+
readonly NO: "no";
|
|
27
|
+
readonly UNKNOWN: "unknown";
|
|
28
|
+
readonly NO_FAULT: "no-fault";
|
|
29
|
+
}>;
|
|
30
|
+
evidence: z.ZodOptional<z.ZodString>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
export type RunReportClaim = z.infer<typeof RunReportClaimSchema>;
|
|
33
|
+
export declare const RunReportSchema: z.ZodObject<{
|
|
34
|
+
verified: z.ZodEnum<{
|
|
35
|
+
readonly YES: "yes";
|
|
36
|
+
readonly NO: "no";
|
|
37
|
+
readonly UNKNOWN: "unknown";
|
|
38
|
+
readonly NO_FAULT: "no-fault";
|
|
39
|
+
}>;
|
|
40
|
+
claims: z.ZodArray<z.ZodObject<{
|
|
41
|
+
claim: z.ZodString;
|
|
42
|
+
verified: z.ZodEnum<{
|
|
43
|
+
readonly YES: "yes";
|
|
44
|
+
readonly NO: "no";
|
|
45
|
+
readonly UNKNOWN: "unknown";
|
|
46
|
+
readonly NO_FAULT: "no-fault";
|
|
47
|
+
}>;
|
|
48
|
+
evidence: z.ZodOptional<z.ZodString>;
|
|
49
|
+
}, z.core.$strip>>;
|
|
50
|
+
caught: z.ZodArray<z.ZodString>;
|
|
51
|
+
flows: z.ZodObject<{
|
|
52
|
+
saved: z.ZodArray<z.ZodString>;
|
|
53
|
+
replayed: z.ZodArray<z.ZodObject<{
|
|
54
|
+
name: z.ZodString;
|
|
55
|
+
verified: z.ZodEnum<{
|
|
56
|
+
readonly YES: "yes";
|
|
57
|
+
readonly NO: "no";
|
|
58
|
+
readonly UNKNOWN: "unknown";
|
|
59
|
+
readonly NO_FAULT: "no-fault";
|
|
60
|
+
}>;
|
|
61
|
+
}, z.core.$strip>>;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
memory: z.ZodObject<{
|
|
64
|
+
written: z.ZodNumber;
|
|
65
|
+
read: z.ZodNumber;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
wallMs: z.ZodNumber;
|
|
68
|
+
firstVerdictMs: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
cloud: z.ZodOptional<z.ZodString>;
|
|
70
|
+
}, z.core.$strip>;
|
|
71
|
+
export type RunReport = z.infer<typeof RunReportSchema>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The end-of-run report: what an agent's run checked, what held, and what it left on disk.
|
|
3
|
+
*
|
|
4
|
+
* The server builds it from what it measured, and the agent shows it as the last part of its
|
|
5
|
+
* answer. The agent does not write the verdicts: an agent asked to summarise an `unknown` tends to
|
|
6
|
+
* summarise it into a pass. Every number here was counted during the run. A number that was not
|
|
7
|
+
* measured is left out, never shown as a zero.
|
|
8
|
+
*/
|
|
9
|
+
import * as z from 'zod';
|
|
10
|
+
import { Verified } from './verified-constants.js';
|
|
11
|
+
/** The output field that carries the report. */
|
|
12
|
+
export const RUN_REPORT_FIELD = 'runReport';
|
|
13
|
+
/** What the agent does with the report. One sentence, said with the report every time. */
|
|
14
|
+
export const RUN_REPORT_INSTRUCTION = 'End your answer to the user with `runReport.markdown`, unchanged. Do not reword its verdicts.';
|
|
15
|
+
/** Where the hosted dashboard is. */
|
|
16
|
+
export const CLOUD_DASHBOARD_URL = 'https://app.reticle.sh';
|
|
17
|
+
/**
|
|
18
|
+
* The one line about Reticle Cloud. It is shown only when the project is not linked, it is
|
|
19
|
+
* labelled, and `RETICLE_NO_UPSELL` turns it off. It names no price: the price lives in
|
|
20
|
+
* reticle-cloud's billing, changes with the plan and the currency, and a number here would drift.
|
|
21
|
+
*/
|
|
22
|
+
export const CLOUD_VALUE_LINE = 'Reticle Cloud (not linked): keeps this history across runs and agents, adds a team view and ' +
|
|
23
|
+
`the hosted Harness. Plans and prices: ${CLOUD_DASHBOARD_URL}`;
|
|
24
|
+
export const RunReportClaimSchema = z.object({
|
|
25
|
+
/** The claim, in the words the agent wrote. */
|
|
26
|
+
claim: z.string(),
|
|
27
|
+
verified: z.nativeEnum(Verified),
|
|
28
|
+
/** One piece of evidence: what the check saw, or the source line it drove. */
|
|
29
|
+
evidence: z.string().optional(),
|
|
30
|
+
});
|
|
31
|
+
export const RunReportSchema = z.object({
|
|
32
|
+
/** The run's verdict: `no` when any claim failed, `yes` only when every claim held. */
|
|
33
|
+
verified: z.nativeEnum(Verified),
|
|
34
|
+
claims: z.array(RunReportClaimSchema),
|
|
35
|
+
/** Claims the agent expected to hold that Reticle found false. */
|
|
36
|
+
caught: z.array(z.string()),
|
|
37
|
+
flows: z.object({
|
|
38
|
+
saved: z.array(z.string()),
|
|
39
|
+
replayed: z.array(z.object({ name: z.string(), verified: z.nativeEnum(Verified) })),
|
|
40
|
+
}),
|
|
41
|
+
memory: z.object({
|
|
42
|
+
/** Notes and statements written for the next run. */
|
|
43
|
+
written: z.number().int().min(0),
|
|
44
|
+
/** Notes and statements from earlier runs that this run was given. */
|
|
45
|
+
read: z.number().int().min(0),
|
|
46
|
+
}),
|
|
47
|
+
/** From the run's first Reticle call to this report. */
|
|
48
|
+
wallMs: z.number().int().min(0),
|
|
49
|
+
/** From the run's first Reticle call to its first decided claim or replay. Absent when none. */
|
|
50
|
+
firstVerdictMs: z.number().int().min(0).optional(),
|
|
51
|
+
/** `CLOUD_VALUE_LINE`, only when the project is not linked. */
|
|
52
|
+
cloud: z.string().optional(),
|
|
53
|
+
});
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* True only for literal loopback hosts and `localhost`, never a lookalike DNS name such as
|
|
3
|
+
* 127.example.com. Names under `.localhost` are not included: this is the guard against DNS
|
|
4
|
+
* rebinding, and a browser that sends those names to DNS lets a hostile network answer them.
|
|
5
|
+
*/
|
|
2
6
|
export declare function isLoopbackHostname(hostname: string): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* True for a name under `.localhost`, such as the `<branch>.<app>.localhost` a dev proxy serves for
|
|
9
|
+
* each git worktree. RFC 6761 reserves these names for loopback, and browsers resolve them locally.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isLocalhostSubdomain(hostname: string): boolean;
|
|
3
12
|
/**
|
|
4
13
|
* True when the page is local: an ordinary loopback document, or a desktop webview.
|
|
5
14
|
*
|
|
@@ -20,6 +29,18 @@ export declare const OPAQUE_ORIGIN = "null";
|
|
|
20
29
|
* pairing token, exactly as they do for a request that omits `Origin` entirely.
|
|
21
30
|
*/
|
|
22
31
|
export declare function isOpaqueOrigin(origin: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Strip filename-like tokens from text before the text is classified.
|
|
34
|
+
* Callers apply this to a control's name, text and value only: an href or a form action is a
|
|
35
|
+
* target, not words on the control, and its destination must be read whole.
|
|
36
|
+
*
|
|
37
|
+
* The scan walks each maximal run of filename characters once and checks that run's dots
|
|
38
|
+
* once, so a label costs time in proportion to its length. The one-pattern version this
|
|
39
|
+
* replaces took about 97 seconds on a 100,000 hyphen label in a local check; the scan
|
|
40
|
+
* takes milliseconds on the same label, and a fuzz comparison over 20,000 generated
|
|
41
|
+
* labels found no difference in what it strips.
|
|
42
|
+
*/
|
|
43
|
+
export declare function withoutFilenameTokens(text: string): string;
|
|
23
44
|
/**
|
|
24
45
|
* Best-effort classifier for labels and tool names that can trigger irreversible effects.
|
|
25
46
|
*
|
|
@@ -28,6 +49,8 @@ export declare function isOpaqueOrigin(origin: string): boolean;
|
|
|
28
49
|
* role (a tool name, a click with no role on the descriptor) omit it and the text decides.
|
|
29
50
|
*/
|
|
30
51
|
export declare function isDangerousActionText(text: string, role?: string): boolean;
|
|
52
|
+
export declare function isInertHref(href: string): boolean;
|
|
53
|
+
export declare function isDangerousNavigation(href: string): boolean;
|
|
31
54
|
export declare const OutwardAction: {
|
|
32
55
|
readonly INVITE: "invite";
|
|
33
56
|
readonly SEND: "send";
|
|
@@ -44,7 +67,30 @@ export declare const OutwardAction: {
|
|
|
44
67
|
readonly CHANGE_STATE: "change state";
|
|
45
68
|
};
|
|
46
69
|
export type OutwardAction = (typeof OutwardAction)[keyof typeof OutwardAction];
|
|
47
|
-
/** The
|
|
70
|
+
/** The origins of the payment providers an app sends a buyer to. A host or any subdomain of it. */
|
|
71
|
+
export declare const PAYMENT_PROVIDER_HOSTS: readonly ["stripe.com", "checkout.dodopayments.com", "paddle.com", "lemonsqueezy.com", "paypal.com", "razorpay.com", "braintreegateway.com"];
|
|
72
|
+
/** Is this an absolute URL on a payment provider's origin? A relative URL stays on the app. */
|
|
73
|
+
export declare function isPaymentProviderUrl(url: string): boolean;
|
|
74
|
+
/** What a text field says about itself. Any part may be absent. */
|
|
75
|
+
export interface PaymentFieldFacts {
|
|
76
|
+
autocomplete?: string | undefined;
|
|
77
|
+
name?: string | undefined;
|
|
78
|
+
id?: string | undefined;
|
|
79
|
+
inputMode?: string | undefined;
|
|
80
|
+
/** Its accessible name or placeholder. */
|
|
81
|
+
label?: string | undefined;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Is this a field for card or bank details? `inputMode` alone decides nothing (a quantity is numeric
|
|
85
|
+
* too); it travels in the facts so a numeric field named "cvv" still reads as one.
|
|
86
|
+
*/
|
|
87
|
+
export declare function isPaymentField(facts: PaymentFieldFacts): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* The outward action a control would take, from its text and role; value pickers take none.
|
|
90
|
+
*
|
|
91
|
+
* Paying is never read from a control's words, only from where it goes: a link or form in `text`
|
|
92
|
+
* that points at a payment provider. `PAY` stays in the journey vocabulary, so "she pays" allows it.
|
|
93
|
+
*/
|
|
48
94
|
export declare function outwardActionOf(text: string, role?: string): OutwardAction | undefined;
|
|
49
95
|
/**
|
|
50
96
|
* The outward actions a journey asks for in so many words. "Invite a teammate" asks for invite;
|