@reticlehq/core 2.7.0 → 2.9.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/browser-misdirect.d.ts +23 -0
- package/dist/browser-misdirect.js +28 -0
- package/dist/constants.d.ts +62 -1
- package/dist/constants.js +67 -1
- package/dist/contract-fingerprint.d.ts +7 -0
- package/dist/contract-fingerprint.js +1 -1
- package/dist/desktop-contract.cjs +1 -0
- package/dist/desktop-contract.d.cts +1 -0
- package/dist/desktop-contract.d.ts +10 -0
- package/dist/desktop-contract.js +10 -0
- package/dist/event-payloads.d.ts +3 -2
- package/dist/finding-fingerprint.d.ts +23 -0
- package/dist/finding-fingerprint.js +19 -0
- package/dist/flow-constants.d.ts +2 -0
- package/dist/flow-constants.js +2 -0
- package/dist/flow-types.d.ts +10 -0
- package/dist/impact-savings.d.ts +17 -0
- package/dist/impact-savings.js +47 -0
- package/dist/impact.d.ts +1284 -0
- package/dist/impact.js +127 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +7 -1
- package/dist/notices.d.ts +14 -2
- package/dist/notices.js +15 -2
- package/dist/project-id.js +25 -4
- package/dist/security.js +18 -1
- package/dist/session-constants.d.ts +18 -0
- package/dist/session-constants.js +17 -0
- package/dist/telemetry-feedback.d.ts +2 -2
- package/dist/telemetry-session.d.ts +16 -0
- package/dist/telemetry-session.js +14 -0
- package/dist/telemetry.d.ts +574 -49
- package/dist/telemetry.js +258 -12
- package/dist/types.d.ts +12 -3
- package/dist/types.js +15 -3
- package/dist/verified-constants.d.ts +27 -0
- package/dist/verified-constants.js +27 -0
- package/package.json +1 -1
package/dist/impact.js
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* The impact record: what Reticle has actually done for this user, and what that is worth.
|
|
4
|
+
*
|
|
5
|
+
* Everything here is derived from calls that really happened - the dispatch chokepoint counts them
|
|
6
|
+
* - and is stored locally. Two kinds of number live in this file and they are NOT interchangeable:
|
|
7
|
+
*
|
|
8
|
+
* MEASURED - counted from real calls (tokens returned, verdicts, defects, sessions, minutes).
|
|
9
|
+
* ESTIMATED - a comparison against a run that did not happen (tokens/minutes SAVED). Every one of
|
|
10
|
+
* these carries the baseline it is measured against, because a saving without its
|
|
11
|
+
* denominator is not a claim, it is a slogan - and this project has already been
|
|
12
|
+
* bitten by publishing one ("2574x cheaper" compares against an LLM re-drive, not a
|
|
13
|
+
* compiled suite).
|
|
14
|
+
*
|
|
15
|
+
* The UI must render the two differently and must never present an estimate as a count.
|
|
16
|
+
*/
|
|
17
|
+
/** Storage + wire version for the impact record. Bump on any breaking shape change. */
|
|
18
|
+
export const IMPACT_SCHEMA_VERSION = 1;
|
|
19
|
+
/** How many daily buckets a store keeps - enough for a month's chart plus a fortnight of slack. */
|
|
20
|
+
export const IMPACT_DAILY_BUCKETS = 45;
|
|
21
|
+
/** Counts of things that actually happened. Every field is a tally, never an estimate. */
|
|
22
|
+
export const ImpactCountsSchema = z.object({
|
|
23
|
+
/** Session-bound tool calls that reached a handler. */
|
|
24
|
+
calls: z.number().int().nonnegative(),
|
|
25
|
+
/** Calls that produced a verdict (act_and_wait / assert). */
|
|
26
|
+
verdicts: z.number().int().nonnegative(),
|
|
27
|
+
/** Verdicts that came back verified:"yes". */
|
|
28
|
+
passed: z.number().int().nonnegative(),
|
|
29
|
+
/** Verdicts that came back verified:"no" - a defect the agent would otherwise have called done. */
|
|
30
|
+
failed: z.number().int().nonnegative(),
|
|
31
|
+
/** Verdicts Reticle could not decide. Shown, not hidden: an unknown is not a pass. */
|
|
32
|
+
unknown: z.number().int().nonnegative(),
|
|
33
|
+
/** Refusals - a drive Reticle declined rather than faking. */
|
|
34
|
+
refusals: z.number().int().nonnegative(),
|
|
35
|
+
/** Notes a human pinned to the page. */
|
|
36
|
+
marks: z.number().int().nonnegative(),
|
|
37
|
+
/** Distinct sessions seen. */
|
|
38
|
+
sessions: z.number().int().nonnegative(),
|
|
39
|
+
/** Tokens Reticle returned to the agent (estimated per call at ~4 chars/token, then summed). */
|
|
40
|
+
tokensReturned: z.number().int().nonnegative(),
|
|
41
|
+
/** Wall-clock milliseconds spent inside tool calls. */
|
|
42
|
+
drivingMs: z.number().int().nonnegative(),
|
|
43
|
+
});
|
|
44
|
+
/** One day's slice of the same counters, keyed by ISO date, for the chart. */
|
|
45
|
+
export const ImpactDaySchema = z.object({
|
|
46
|
+
/** YYYY-MM-DD, local to the machine that recorded it. */
|
|
47
|
+
date: z.string(),
|
|
48
|
+
counts: ImpactCountsSchema,
|
|
49
|
+
});
|
|
50
|
+
/** Bests worth beating. Gamification, entirely local. */
|
|
51
|
+
export const ImpactRecordsSchema = z.object({
|
|
52
|
+
/** Longest single session, in ms. */
|
|
53
|
+
longestRunMs: z.number().int().nonnegative(),
|
|
54
|
+
/** Most verdicts in one day. */
|
|
55
|
+
bestVerdictDay: z.number().int().nonnegative(),
|
|
56
|
+
/** Most defects caught in one day. */
|
|
57
|
+
bestDefectDay: z.number().int().nonnegative(),
|
|
58
|
+
/** Consecutive days with at least one verdict, up to and including today. */
|
|
59
|
+
streakDays: z.number().int().nonnegative(),
|
|
60
|
+
/** Longest such streak ever. */
|
|
61
|
+
bestStreakDays: z.number().int().nonnegative(),
|
|
62
|
+
});
|
|
63
|
+
/**
|
|
64
|
+
* A saving, with the comparison that produced it.
|
|
65
|
+
*
|
|
66
|
+
* `basis` names what the number is measured AGAINST, in the user's own words, and it is rendered
|
|
67
|
+
* next to the figure. No basis, no number.
|
|
68
|
+
*/
|
|
69
|
+
export const ImpactEstimateSchema = z.object({
|
|
70
|
+
value: z.number().nonnegative(),
|
|
71
|
+
basis: z.string(),
|
|
72
|
+
});
|
|
73
|
+
export const ImpactSavingsSchema = z.object({
|
|
74
|
+
/** Tokens not spent, vs looking at the app the way an agent without Reticle has to. */
|
|
75
|
+
tokens: ImpactEstimateSchema,
|
|
76
|
+
/** Minutes not spent, vs the re-prompt cycle a false green costs. */
|
|
77
|
+
minutes: ImpactEstimateSchema,
|
|
78
|
+
});
|
|
79
|
+
/** One scope of the record: this project, or everything on this machine. */
|
|
80
|
+
export const ImpactScopeSchema = z.object({
|
|
81
|
+
counts: ImpactCountsSchema,
|
|
82
|
+
days: z.array(ImpactDaySchema),
|
|
83
|
+
records: ImpactRecordsSchema,
|
|
84
|
+
savings: ImpactSavingsSchema,
|
|
85
|
+
/** When this scope first recorded anything (epoch ms). */
|
|
86
|
+
since: z.number().int().nonnegative(),
|
|
87
|
+
});
|
|
88
|
+
/** What the HUD receives: this project, and the machine-wide total. */
|
|
89
|
+
export const ImpactSnapshotSchema = z.object({
|
|
90
|
+
schemaVersion: z.number().int().positive(),
|
|
91
|
+
project: ImpactScopeSchema,
|
|
92
|
+
global: ImpactScopeSchema,
|
|
93
|
+
/** Project name, for the report's title row. */
|
|
94
|
+
projectName: z.string().optional(),
|
|
95
|
+
});
|
|
96
|
+
/** Empty counters - the starting point for a fresh store and the identity for merges. */
|
|
97
|
+
export function emptyImpactCounts() {
|
|
98
|
+
return {
|
|
99
|
+
calls: 0,
|
|
100
|
+
verdicts: 0,
|
|
101
|
+
passed: 0,
|
|
102
|
+
failed: 0,
|
|
103
|
+
unknown: 0,
|
|
104
|
+
refusals: 0,
|
|
105
|
+
marks: 0,
|
|
106
|
+
sessions: 0,
|
|
107
|
+
tokensReturned: 0,
|
|
108
|
+
drivingMs: 0,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
export function emptyImpactRecords() {
|
|
112
|
+
return {
|
|
113
|
+
longestRunMs: 0,
|
|
114
|
+
bestVerdictDay: 0,
|
|
115
|
+
bestDefectDay: 0,
|
|
116
|
+
streakDays: 0,
|
|
117
|
+
bestStreakDays: 0,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/** Add one delta into a running total. Pure; the store owns persistence. */
|
|
121
|
+
export function addImpactCounts(base, delta) {
|
|
122
|
+
const out = { ...base };
|
|
123
|
+
for (const key of Object.keys(out)) {
|
|
124
|
+
out[key] = out[key] + (delta[key] ?? 0);
|
|
125
|
+
}
|
|
126
|
+
return out;
|
|
127
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export * from './consequence.js';
|
|
|
26
26
|
export * from './project-id.js';
|
|
27
27
|
export * from './notices.js';
|
|
28
28
|
export * from './journal.js';
|
|
29
|
+
export * from './browser-misdirect.js';
|
|
29
30
|
export * from './daemon-registry.js';
|
|
30
31
|
export * from './security.js';
|
|
31
32
|
export * from './redaction.js';
|
|
@@ -35,4 +36,7 @@ export * from './upgrade.js';
|
|
|
35
36
|
export * from './telemetry.js';
|
|
36
37
|
export * from './telemetry-session.js';
|
|
37
38
|
export * from './telemetry-feedback.js';
|
|
38
|
-
export
|
|
39
|
+
export * from './impact.js';
|
|
40
|
+
export * from './impact-savings.js';
|
|
41
|
+
export { CONTRACT_FINGERPRINT, fnv1a, fingerprintOf } from './contract-fingerprint.js';
|
|
42
|
+
export { fingerprintFinding, type FindingIdentity } from './finding-fingerprint.js';
|
package/dist/index.js
CHANGED
|
@@ -27,6 +27,9 @@ export * from './consequence.js';
|
|
|
27
27
|
export * from './project-id.js';
|
|
28
28
|
export * from './notices.js';
|
|
29
29
|
export * from './journal.js';
|
|
30
|
+
// Not an API — three names that exist so importing the BROWSER SDK from here fails with a sentence
|
|
31
|
+
// naming @reticlehq/browser, instead of a bare SyntaxError that blanks the app. See the module.
|
|
32
|
+
export * from './browser-misdirect.js';
|
|
30
33
|
// ── INTERNAL cross-package plumbing (shared impl; not a stable outside API — may change in a minor) ─
|
|
31
34
|
export * from './daemon-registry.js'; // daemon discovery, used by the vite plugin + server
|
|
32
35
|
export * from './security.js'; // sanitize/serialize helpers shared by browser + server
|
|
@@ -37,4 +40,7 @@ export * from './upgrade.js'; // self-update policy shared by the CLI
|
|
|
37
40
|
export * from './telemetry.js';
|
|
38
41
|
export * from './telemetry-session.js'; // the session/project rollup payloads
|
|
39
42
|
export * from './telemetry-feedback.js'; // the two things a PERSON writes: feedback + a self-declared identity // anonymous adoption telemetry wire contract (DAU/WAU/MAU/installs)
|
|
40
|
-
export
|
|
43
|
+
export * from './impact.js'; // the user's own record of what Reticle has done for them (local only)
|
|
44
|
+
export * from './impact-savings.js'; // the savings model - one file, so every claim is derivable there
|
|
45
|
+
export { CONTRACT_FINGERPRINT, fnv1a, fingerprintOf } from './contract-fingerprint.js';
|
|
46
|
+
export { fingerprintFinding } from './finding-fingerprint.js';
|
package/dist/notices.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export declare function isPresenterTone(value: unknown): value is PresenterTone;
|
|
|
25
25
|
* eviction may be "I dropped the evidence", not "it never happened" — widen the buffer / grade
|
|
26
26
|
* sooner. Rides in a `buffer` block only when `dropped > 0` (silence ⇒ nothing lost).
|
|
27
27
|
*/
|
|
28
|
-
export declare const BUFFER_EVICTION_WARNING = "event buffer evicted older events (age/size cap)
|
|
28
|
+
export declare const BUFFER_EVICTION_WARNING = "event buffer evicted older events (age/size cap): a negative result here may be a false negative; the evidence may have expired. Grade sooner or widen the buffer.";
|
|
29
29
|
/**
|
|
30
30
|
* Thrown when a tool needs a live browser session and none is connected. Names the #1 real cause in a
|
|
31
31
|
* multi-repo / multi-agent setup — a PORT MISMATCH between the app's SDK and the daemon — so the agent
|
|
@@ -33,7 +33,7 @@ export declare const BUFFER_EVICTION_WARNING = "event buffer evicted older event
|
|
|
33
33
|
*/
|
|
34
34
|
export declare const NO_SESSION_CONNECTED_ERROR = "no browser session connected. Two things to check: (1) your app is running with @reticlehq/browser enabled, and (2) it points at THIS daemon's port \u2014 a mismatch between the app's reticle({ port }) / VITE_RETICLE_WS_URL and the daemon's RETICLE_PORT is the usual cause. reticle_wait_ready blocks briefly for a session to appear.";
|
|
35
35
|
/** Surfaced on act/assert results when the target tab is throttled. */
|
|
36
|
-
export declare const THROTTLED_WARNING = "tab throttled; timer/rAF/pointer gestures may silently no-op
|
|
36
|
+
export declare const THROTTLED_WARNING = "tab throttled; timer/rAF/pointer gestures may silently no-op; refocus before driving";
|
|
37
37
|
/**
|
|
38
38
|
* Pushed to the panel when the last agent's MCP connection drops — the agent (any of
|
|
39
39
|
* Codex/OpenCode/Claude/Hermes) has stopped or is waiting on you. Tells the human, who is
|
|
@@ -50,6 +50,18 @@ export declare const UNDELIVERED_NOTES_LABEL = "Undelivered (paste into your ter
|
|
|
50
50
|
export declare const AGENT_WAITING_NOTICE = "Agent finished its turn \u2014 your move. Continue in your terminal.";
|
|
51
51
|
/** Panel notice prefix when the agent is blocked on you (reticle_yield mode:'ask'); the question follows. */
|
|
52
52
|
export declare const AGENT_ASK_NOTICE = "Agent needs your input \u2014 answer in your terminal";
|
|
53
|
+
/**
|
|
54
|
+
* Returned by `reticle_session` yield/end when the turn ends with no browser session connected.
|
|
55
|
+
*
|
|
56
|
+
* Ending a turn is not an operation on a tab. The agent is reporting that it has stopped driving,
|
|
57
|
+
* and that is true whether or not anything was ever connected — so refusing it made the agent fail
|
|
58
|
+
* a call it was told is MANDATORY, on the most common state a session is in. Reported agents skip
|
|
59
|
+
* yield entirely and note the gap in prose, which is the outcome this notice exists to remove.
|
|
60
|
+
*
|
|
61
|
+
* Said back to the caller rather than swallowed, so "the panel showed nothing" is a fact the agent
|
|
62
|
+
* can put in its report instead of an absence it has to infer.
|
|
63
|
+
*/
|
|
64
|
+
export declare const YIELD_WITHOUT_SESSION_NOTE: string;
|
|
53
65
|
/**
|
|
54
66
|
* Actionable companion to THROTTLED_WARNING. Surfaced on act/assert results and
|
|
55
67
|
* reticle_sessions rows when a tab is hidden/throttled and may be un-focusable/un-recoverable from
|
package/dist/notices.js
CHANGED
|
@@ -29,7 +29,7 @@ export function isPresenterTone(value) {
|
|
|
29
29
|
* eviction may be "I dropped the evidence", not "it never happened" — widen the buffer / grade
|
|
30
30
|
* sooner. Rides in a `buffer` block only when `dropped > 0` (silence ⇒ nothing lost).
|
|
31
31
|
*/
|
|
32
|
-
export const BUFFER_EVICTION_WARNING = 'event buffer evicted older events (age/size cap)
|
|
32
|
+
export const BUFFER_EVICTION_WARNING = 'event buffer evicted older events (age/size cap): a negative result here may be a false negative; the evidence may have expired. Grade sooner or widen the buffer.';
|
|
33
33
|
/**
|
|
34
34
|
* Thrown when a tool needs a live browser session and none is connected. Names the #1 real cause in a
|
|
35
35
|
* multi-repo / multi-agent setup — a PORT MISMATCH between the app's SDK and the daemon — so the agent
|
|
@@ -37,7 +37,7 @@ export const BUFFER_EVICTION_WARNING = 'event buffer evicted older events (age/s
|
|
|
37
37
|
*/
|
|
38
38
|
export const NO_SESSION_CONNECTED_ERROR = "no browser session connected. Two things to check: (1) your app is running with @reticlehq/browser enabled, and (2) it points at THIS daemon's port — a mismatch between the app's reticle({ port }) / VITE_RETICLE_WS_URL and the daemon's RETICLE_PORT is the usual cause. reticle_wait_ready blocks briefly for a session to appear.";
|
|
39
39
|
/** Surfaced on act/assert results when the target tab is throttled. */
|
|
40
|
-
export const THROTTLED_WARNING = 'tab throttled; timer/rAF/pointer gestures may silently no-op
|
|
40
|
+
export const THROTTLED_WARNING = 'tab throttled; timer/rAF/pointer gestures may silently no-op; refocus before driving';
|
|
41
41
|
/**
|
|
42
42
|
* Pushed to the panel when the last agent's MCP connection drops — the agent (any of
|
|
43
43
|
* Codex/OpenCode/Claude/Hermes) has stopped or is waiting on you. Tells the human, who is
|
|
@@ -54,6 +54,19 @@ export const UNDELIVERED_NOTES_LABEL = 'Undelivered (paste into your terminal):'
|
|
|
54
54
|
export const AGENT_WAITING_NOTICE = 'Agent finished its turn — your move. Continue in your terminal.';
|
|
55
55
|
/** Panel notice prefix when the agent is blocked on you (reticle_yield mode:'ask'); the question follows. */
|
|
56
56
|
export const AGENT_ASK_NOTICE = 'Agent needs your input — answer in your terminal';
|
|
57
|
+
/**
|
|
58
|
+
* Returned by `reticle_session` yield/end when the turn ends with no browser session connected.
|
|
59
|
+
*
|
|
60
|
+
* Ending a turn is not an operation on a tab. The agent is reporting that it has stopped driving,
|
|
61
|
+
* and that is true whether or not anything was ever connected — so refusing it made the agent fail
|
|
62
|
+
* a call it was told is MANDATORY, on the most common state a session is in. Reported agents skip
|
|
63
|
+
* yield entirely and note the gap in prose, which is the outcome this notice exists to remove.
|
|
64
|
+
*
|
|
65
|
+
* Said back to the caller rather than swallowed, so "the panel showed nothing" is a fact the agent
|
|
66
|
+
* can put in its report instead of an absence it has to infer.
|
|
67
|
+
*/
|
|
68
|
+
export const YIELD_WITHOUT_SESSION_NOTE = 'No browser session was connected, so there was no panel to update. The turn end was still ' +
|
|
69
|
+
'recorded. If you expected an app to be attached, that is the thing to look into.';
|
|
57
70
|
/**
|
|
58
71
|
* Actionable companion to THROTTLED_WARNING. Surfaced on act/assert results and
|
|
59
72
|
* reticle_sessions rows when a tab is hidden/throttled and may be un-focusable/un-recoverable from
|
package/dist/project-id.js
CHANGED
|
@@ -19,18 +19,39 @@ export const PROJECT_ID_HASH_LENGTH = 8;
|
|
|
19
19
|
const FALLBACK_PROJECT_BASE = 'app';
|
|
20
20
|
/** `@acme/web` → `acme-web`; non-alphanumerics collapse to single dashes; edges trimmed. */
|
|
21
21
|
export function slugifyPackageName(name) {
|
|
22
|
-
|
|
22
|
+
const collapsed = name
|
|
23
23
|
.toLowerCase()
|
|
24
24
|
.replace(/^@/, '')
|
|
25
|
-
.replace(/[^a-z0-9]+/g, '-')
|
|
26
|
-
|
|
25
|
+
.replace(/[^a-z0-9]+/g, '-');
|
|
26
|
+
return trimChar(collapsed, '-');
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Trim a repeated character from both ends without a regex.
|
|
30
|
+
*
|
|
31
|
+
* `/^-+|-+$/` is an anchored quantifier, and on a string of many dashes the engine retries the
|
|
32
|
+
* match from every position: linear input, quadratic work. Nothing hostile reaches here today (the
|
|
33
|
+
* inputs are the user's own package name and path), which is exactly why it would have gone
|
|
34
|
+
* unnoticed if something ever did. Two index walks cost nothing and cannot backtrack.
|
|
35
|
+
*/
|
|
36
|
+
function trimChar(value, char) {
|
|
37
|
+
let start = 0;
|
|
38
|
+
let end = value.length;
|
|
39
|
+
while (start < end && value[start] === char)
|
|
40
|
+
start += 1;
|
|
41
|
+
while (end > start && value[end - 1] === char)
|
|
42
|
+
end -= 1;
|
|
43
|
+
return value.slice(start, end);
|
|
27
44
|
}
|
|
28
45
|
/**
|
|
29
46
|
* The last segment of a path — `node:path`'s `basename`, reimplemented because core may not import
|
|
30
47
|
* Node. Handles both separators so a Windows root produces the same id as a POSIX one.
|
|
31
48
|
*/
|
|
32
49
|
function pathTail(path) {
|
|
33
|
-
|
|
50
|
+
// Same reason as `trimChar`: an anchored `+` over a run of separators backtracks quadratically.
|
|
51
|
+
let end = path.length;
|
|
52
|
+
while (end > 0 && ('/' === path[end - 1] || '\\' === path[end - 1]))
|
|
53
|
+
end -= 1;
|
|
54
|
+
const trimmed = path.slice(0, end);
|
|
34
55
|
const cut = Math.max(trimmed.lastIndexOf('/'), trimmed.lastIndexOf('\\'));
|
|
35
56
|
return -1 === cut ? trimmed : trimmed.slice(cut + 1);
|
|
36
57
|
}
|
package/dist/security.js
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Labels that can trigger an irreversible or money-moving effect.
|
|
3
|
+
*
|
|
4
|
+
* `send` used to be a bare token here, to cover moving money, and it taxed every ordinary button
|
|
5
|
+
* that sends something: reported from the field on `Send check-in` (a POST that logs a text
|
|
6
|
+
* message) and alongside it `Send message`, `Send invite`, `Send feedback`. A false block costs a
|
|
7
|
+
* round-trip and, repeated, trains an agent to pass confirmDangerous reflexively — which is the one
|
|
8
|
+
* outcome that makes this guard worthless.
|
|
9
|
+
*
|
|
10
|
+
* The money cases are still covered, through the thing being SENT rather than the act of sending:
|
|
11
|
+
* `payment` catches "Send payment" and "Confirm payment" (which the bare-verb list missed entirely,
|
|
12
|
+
* because `\bpay\b` does not match "payment"), and `send money`/`send funds` catch the rest.
|
|
13
|
+
*
|
|
14
|
+
* The guard stays deliberately asymmetric — a false block costs one round-trip, a missed block can
|
|
15
|
+
* charge somebody's card — so this narrows the trigger without lowering money coverage. Both
|
|
16
|
+
* directions are pinned in security.test.ts.
|
|
17
|
+
*/
|
|
18
|
+
const DANGEROUS_ACTION = /\b(delete|remove|destroy|erase|drop|terminate|revoke|reset|logout|log out|sign out|close account|cancel subscription|purchase|buy|pay|payment|place order|confirm order|deploy|publish|send money|send funds|transfer|withdraw|refund)\b/i;
|
|
2
19
|
/** The hostnames that ARE loopback outright, with no parsing: the name, and IPv6 ::1 both ways. */
|
|
3
20
|
const LOOPBACK_HOSTNAMES = ['localhost', '::1', '0:0:0:0:0:0:0:1'];
|
|
4
21
|
/** IPv4 loopback is the whole 127.0.0.0/8 block, so the first octet is the entire test. */
|
|
@@ -113,3 +113,21 @@ export declare const HealthReason: {
|
|
|
113
113
|
readonly INITIAL: "initial";
|
|
114
114
|
};
|
|
115
115
|
export type HealthReason = (typeof HealthReason)[keyof typeof HealthReason];
|
|
116
|
+
/**
|
|
117
|
+
* The one thing to DO when nothing is connected — the executable half of the no-session diagnosis.
|
|
118
|
+
*
|
|
119
|
+
* The prose diagnosis tells the cases apart well, and an agent still has to translate it into a
|
|
120
|
+
* command. This is that command's kind, so the agent branches on a value instead of on a sentence.
|
|
121
|
+
* Wire-owned because it crosses daemon → agent on `reticle_sessions`.
|
|
122
|
+
*/
|
|
123
|
+
export declare const NoSessionAction: {
|
|
124
|
+
/** Nothing is listening anywhere: the app is not running. Carries the project's own dev script. */
|
|
125
|
+
readonly START_DEV_SERVER: "start_dev_server";
|
|
126
|
+
/** Something is listening but this project carries no Reticle SDK — wire it first. */
|
|
127
|
+
readonly RUN_INIT: "run_init";
|
|
128
|
+
/** A wired app is up and no page is loaded — Reticle only ever sees a page a browser has opened. */
|
|
129
|
+
readonly OPEN_APP: "open_app";
|
|
130
|
+
/** A session was here and went away: reopen the tab, or take a lease. */
|
|
131
|
+
readonly REOPEN_APP: "reopen_app";
|
|
132
|
+
};
|
|
133
|
+
export type NoSessionAction = (typeof NoSessionAction)[keyof typeof NoSessionAction];
|
|
@@ -110,3 +110,20 @@ export const HealthReason = {
|
|
|
110
110
|
HEARTBEAT: 'heartbeat',
|
|
111
111
|
INITIAL: 'initial',
|
|
112
112
|
};
|
|
113
|
+
/**
|
|
114
|
+
* The one thing to DO when nothing is connected — the executable half of the no-session diagnosis.
|
|
115
|
+
*
|
|
116
|
+
* The prose diagnosis tells the cases apart well, and an agent still has to translate it into a
|
|
117
|
+
* command. This is that command's kind, so the agent branches on a value instead of on a sentence.
|
|
118
|
+
* Wire-owned because it crosses daemon → agent on `reticle_sessions`.
|
|
119
|
+
*/
|
|
120
|
+
export const NoSessionAction = {
|
|
121
|
+
/** Nothing is listening anywhere: the app is not running. Carries the project's own dev script. */
|
|
122
|
+
START_DEV_SERVER: 'start_dev_server',
|
|
123
|
+
/** Something is listening but this project carries no Reticle SDK — wire it first. */
|
|
124
|
+
RUN_INIT: 'run_init',
|
|
125
|
+
/** A wired app is up and no page is loaded — Reticle only ever sees a page a browser has opened. */
|
|
126
|
+
OPEN_APP: 'open_app',
|
|
127
|
+
/** A session was here and went away: reopen the tab, or take a lease. */
|
|
128
|
+
REOPEN_APP: 'reopen_app',
|
|
129
|
+
};
|
|
@@ -219,10 +219,10 @@ export declare const FeedbackSchema: z.ZodObject<{
|
|
|
219
219
|
text: string;
|
|
220
220
|
kind: "bug" | "gap" | "ambiguity" | "feature_request" | "improvement" | "experience";
|
|
221
221
|
source: "agent" | "human";
|
|
222
|
+
impact?: string | undefined;
|
|
222
223
|
trace?: string | undefined;
|
|
223
224
|
rating?: number | undefined;
|
|
224
225
|
need?: string | undefined;
|
|
225
|
-
impact?: string | undefined;
|
|
226
226
|
currentApproach?: string | undefined;
|
|
227
227
|
model?: string | undefined;
|
|
228
228
|
clientVersion?: string | undefined;
|
|
@@ -237,10 +237,10 @@ export declare const FeedbackSchema: z.ZodObject<{
|
|
|
237
237
|
text: string;
|
|
238
238
|
kind: "bug" | "gap" | "ambiguity" | "feature_request" | "improvement" | "experience";
|
|
239
239
|
source: "agent" | "human";
|
|
240
|
+
impact?: string | undefined;
|
|
240
241
|
trace?: string | undefined;
|
|
241
242
|
rating?: number | undefined;
|
|
242
243
|
need?: string | undefined;
|
|
243
|
-
impact?: string | undefined;
|
|
244
244
|
currentApproach?: string | undefined;
|
|
245
245
|
model?: string | undefined;
|
|
246
246
|
clientVersion?: string | undefined;
|
|
@@ -430,6 +430,20 @@ export declare const SessionSummarySchema: z.ZodObject<{
|
|
|
430
430
|
errorsRecovered: z.ZodOptional<z.ZodNumber>;
|
|
431
431
|
/** Errors whose very next call failed again — the message did not land. */
|
|
432
432
|
errorsRepeated: z.ZodOptional<z.ZodNumber>;
|
|
433
|
+
/**
|
|
434
|
+
* Did this session ever produce a verdict? Absent on a periodic flush — nothing has ended yet.
|
|
435
|
+
*
|
|
436
|
+
* This is the release's headline metric and it was the one thing in the payload that had to be
|
|
437
|
+
* COMPUTED rather than read: `verifications > 0` over the lifetime counters, which are windowed on
|
|
438
|
+
* every other event in the stream, so the obvious query over `session_progress` answers a
|
|
439
|
+
* different question and looks like it answers this one. A metric that requires a correct
|
|
440
|
+
* subtraction to read is a metric that gets read wrong, and this one decides what the product is
|
|
441
|
+
* allowed to claim.
|
|
442
|
+
*
|
|
443
|
+
* ALWAYS present on a final summary, including `false`: a session that drove an app and never
|
|
444
|
+
* asked whether it worked is the finding, so absence and `false` must not look alike.
|
|
445
|
+
*/
|
|
446
|
+
endedWithVerdict: z.ZodOptional<z.ZodBoolean>;
|
|
433
447
|
/** Was this a clean shutdown, or a periodic flush of a still-running session? */
|
|
434
448
|
final: z.ZodBoolean;
|
|
435
449
|
/**
|
|
@@ -504,6 +518,7 @@ export declare const SessionSummarySchema: z.ZodObject<{
|
|
|
504
518
|
errorClasses?: Record<string, number> | undefined;
|
|
505
519
|
errorsRecovered?: number | undefined;
|
|
506
520
|
errorsRepeated?: number | undefined;
|
|
521
|
+
endedWithVerdict?: boolean | undefined;
|
|
507
522
|
exit?: "signal" | "idle" | "unknown" | undefined;
|
|
508
523
|
}, {
|
|
509
524
|
durationMs: number;
|
|
@@ -564,6 +579,7 @@ export declare const SessionSummarySchema: z.ZodObject<{
|
|
|
564
579
|
errorClasses?: Record<string, number> | undefined;
|
|
565
580
|
errorsRecovered?: number | undefined;
|
|
566
581
|
errorsRepeated?: number | undefined;
|
|
582
|
+
endedWithVerdict?: boolean | undefined;
|
|
567
583
|
exit?: "signal" | "idle" | "unknown" | undefined;
|
|
568
584
|
}>;
|
|
569
585
|
export type SessionSummary = z.infer<typeof SessionSummarySchema>;
|
|
@@ -299,6 +299,20 @@ export const SessionSummarySchema = z.object({
|
|
|
299
299
|
errorsRecovered: z.number().int().nonnegative().optional(),
|
|
300
300
|
/** Errors whose very next call failed again — the message did not land. */
|
|
301
301
|
errorsRepeated: z.number().int().nonnegative().optional(),
|
|
302
|
+
/**
|
|
303
|
+
* Did this session ever produce a verdict? Absent on a periodic flush — nothing has ended yet.
|
|
304
|
+
*
|
|
305
|
+
* This is the release's headline metric and it was the one thing in the payload that had to be
|
|
306
|
+
* COMPUTED rather than read: `verifications > 0` over the lifetime counters, which are windowed on
|
|
307
|
+
* every other event in the stream, so the obvious query over `session_progress` answers a
|
|
308
|
+
* different question and looks like it answers this one. A metric that requires a correct
|
|
309
|
+
* subtraction to read is a metric that gets read wrong, and this one decides what the product is
|
|
310
|
+
* allowed to claim.
|
|
311
|
+
*
|
|
312
|
+
* ALWAYS present on a final summary, including `false`: a session that drove an app and never
|
|
313
|
+
* asked whether it worked is the finding, so absence and `false` must not look alike.
|
|
314
|
+
*/
|
|
315
|
+
endedWithVerdict: z.boolean().optional(),
|
|
302
316
|
/** Was this a clean shutdown, or a periodic flush of a still-running session? */
|
|
303
317
|
final: z.boolean(),
|
|
304
318
|
/**
|