@reticlehq/core 2.12.0 → 2.13.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/constants.d.ts +18 -0
- package/dist/constants.js +18 -0
- package/dist/dev-server-registry.d.ts +85 -0
- package/dist/dev-server-registry.js +120 -0
- package/dist/event-payloads.d.ts +6 -0
- package/dist/event-payloads.js +2 -0
- package/dist/flow-types.d.ts +18 -0
- package/dist/impact.d.ts +176 -0
- package/dist/impact.js +36 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/net.d.ts +34 -0
- package/dist/net.js +86 -0
- package/dist/no-session-reason.d.ts +35 -0
- package/dist/no-session-reason.js +34 -0
- package/dist/notices.d.ts +79 -8
- package/dist/notices.js +83 -8
- package/dist/security.d.ts +8 -2
- package/dist/security.js +21 -3
- package/dist/session-constants.d.ts +8 -0
- package/dist/session-constants.js +8 -0
- package/dist/telemetry-license.d.ts +12 -0
- package/dist/telemetry-license.js +12 -0
- package/dist/telemetry-refusal.d.ts +94 -0
- package/dist/telemetry-refusal.js +61 -0
- package/dist/telemetry-session.d.ts +149 -0
- package/dist/telemetry-session.js +114 -0
- package/dist/telemetry.d.ts +163 -91
- package/dist/telemetry.js +46 -44
- package/dist/types.d.ts +9 -0
- package/dist/verified-constants.d.ts +8 -0
- package/dist/verified-constants.js +10 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export * from './notices.js';
|
|
|
30
30
|
export * from './journal.js';
|
|
31
31
|
export * from './browser-misdirect.js';
|
|
32
32
|
export * from './daemon-registry.js';
|
|
33
|
+
export * from './dev-server-registry.js';
|
|
33
34
|
export * from './project-registry.js';
|
|
34
35
|
export * from './intent.js';
|
|
35
36
|
export * from './run-context.js';
|
|
@@ -40,6 +41,8 @@ export * from './state-select.js';
|
|
|
40
41
|
export * from './toon.js';
|
|
41
42
|
export * from './upgrade.js';
|
|
42
43
|
export * from './telemetry.js';
|
|
44
|
+
export * from './no-session-reason.js';
|
|
45
|
+
export * from './telemetry-refusal.js';
|
|
43
46
|
export * from './telemetry-session.js';
|
|
44
47
|
export * from './telemetry-license.js';
|
|
45
48
|
export * from './telemetry-feedback.js';
|
package/dist/index.js
CHANGED
|
@@ -34,6 +34,7 @@ export * from './journal.js';
|
|
|
34
34
|
export * from './browser-misdirect.js';
|
|
35
35
|
// ── INTERNAL cross-package plumbing (shared impl; not a stable outside API — may change in a minor) ─
|
|
36
36
|
export * from './daemon-registry.js'; // daemon discovery, used by the vite plugin + server
|
|
37
|
+
export * from './dev-server-registry.js'; // the return leg: dev servers announcing themselves
|
|
37
38
|
export * from './project-registry.js'; // projectId -> directory, so a cross-repo daemon can still resolve
|
|
38
39
|
export * from './intent.js'; // what a change was supposed to make true, captured while somebody knows
|
|
39
40
|
export * from './run-context.js'; // what a run established, folded and capped, for the agent to pull back
|
|
@@ -44,6 +45,9 @@ export * from './state-select.js'; // selectPath / capDepth — shared by browse
|
|
|
44
45
|
export * from './toon.js'; // TOON encoding used by the server's result encoder
|
|
45
46
|
export * from './upgrade.js'; // self-update policy shared by the CLI
|
|
46
47
|
export * from './telemetry.js';
|
|
48
|
+
// Split out of telemetry.js at the 1000-line cap; the barrel keeps the import path callers use.
|
|
49
|
+
export * from './no-session-reason.js';
|
|
50
|
+
export * from './telemetry-refusal.js';
|
|
47
51
|
export * from './telemetry-session.js'; // the session/project rollup payloads
|
|
48
52
|
export * from './telemetry-license.js'; // LicenseActivation — shared by the licence gate and telemetry
|
|
49
53
|
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)
|
package/dist/net.d.ts
CHANGED
|
@@ -79,3 +79,37 @@ export type DevToolingChannel = (typeof DevToolingChannel)[keyof typeof DevTooli
|
|
|
79
79
|
* exclusion is disclosed alongside the verdict.
|
|
80
80
|
*/
|
|
81
81
|
export declare function isDevToolingUrl(url: string | undefined): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Is this call to somebody ELSE's site — an analytics beacon, a vendor SDK bootstrap, a CDN ping?
|
|
84
|
+
*
|
|
85
|
+
* The axis a verdict needs and never had. A contradiction is a statement about the app under test,
|
|
86
|
+
* and a failed third-party request says nothing about whether the caller's action worked: reported
|
|
87
|
+
* from several apps, any analytics package installed was enough to grade a correct drive
|
|
88
|
+
* `contradicted`, and on one app every assertion came back that way forever.
|
|
89
|
+
*
|
|
90
|
+
* Deliberately NOT a vendor list. `DevToolingChannel` above states why a list is the wrong shape
|
|
91
|
+
* here: widening it until it can swallow an app endpoint turns a false negative into a false GREEN.
|
|
92
|
+
* An origin comparison has no list to widen — it asks one structural question about the page itself.
|
|
93
|
+
*
|
|
94
|
+
* Ports are deliberately ignored: a dev app on :3000 talking to its API on :8787 is the ordinary
|
|
95
|
+
* local setup, and grading that as a stranger's traffic would silence the detector on our own bench.
|
|
96
|
+
*
|
|
97
|
+
* Absence of `appUrl` disables the axis entirely — the same rule the document scoping follows, so a
|
|
98
|
+
* caller who cannot say which page is under test gets exactly the behaviour it had before this.
|
|
99
|
+
*/
|
|
100
|
+
export declare function isThirdPartyUrl(url: string | undefined, appUrl: string | undefined): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* The unredacted URL, kept so a grader can match `urlContains` against the path the app actually
|
|
103
|
+
* requested. `url` is what is rendered to the agent and stored as the displayed value; this field
|
|
104
|
+
* is the match haystack and must not be projected back into a transcript.
|
|
105
|
+
*
|
|
106
|
+
* Redaction runs at emit time and there is otherwise no raw copy. Public REST segments that happen
|
|
107
|
+
* to follow a sensitive name (`/auth/token/refresh-context`, `/verify/CERT_INFY_10`) are rewritten
|
|
108
|
+
* to `[REDACTED]`, so matching only `url` reports "the request did not happen".
|
|
109
|
+
*/
|
|
110
|
+
export declare const URL_RAW = "urlRaw";
|
|
111
|
+
/**
|
|
112
|
+
* The URL a filter or predicate should match against: the raw request when the observer kept one,
|
|
113
|
+
* otherwise the displayed (possibly redacted) `url`.
|
|
114
|
+
*/
|
|
115
|
+
export declare function urlForMatch(data: Record<string, unknown>): string;
|
package/dist/net.js
CHANGED
|
@@ -82,3 +82,89 @@ export function isDevToolingUrl(url) {
|
|
|
82
82
|
return false;
|
|
83
83
|
return DEV_TOOLING_PATTERNS.some((pattern) => url.includes(pattern));
|
|
84
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Schemes whose "host" is not a host at all — the app's own machinery, never somebody else's server.
|
|
87
|
+
*
|
|
88
|
+
* `ipc://` is a desktop command (see IPC_URL_SCHEME), `data:`/`blob:` are bytes the page itself made.
|
|
89
|
+
* None of them can be third-party, so the axis below declines to judge them.
|
|
90
|
+
*/
|
|
91
|
+
const FIRST_PARTY_PROTOCOLS = ['http:', 'https:'];
|
|
92
|
+
/** How many trailing labels of a hostname stand in for the registrable domain. */
|
|
93
|
+
const REGISTRABLE_LABELS = 2;
|
|
94
|
+
function hostOf(url, base) {
|
|
95
|
+
try {
|
|
96
|
+
const parsed = new URL(url, base);
|
|
97
|
+
if (!FIRST_PARTY_PROTOCOLS.includes(parsed.protocol))
|
|
98
|
+
return undefined;
|
|
99
|
+
return parsed.hostname.toLowerCase();
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* The registrable domain, approximated by the last two labels.
|
|
107
|
+
*
|
|
108
|
+
* ponytail: no public-suffix list. `foo.co.uk` and `bar.co.uk` read as the same site, which keeps a
|
|
109
|
+
* third-party call classified as first-party — i.e. it preserves today's behaviour rather than
|
|
110
|
+
* inventing a new one. The opposite approximation (hostname equality alone) would have broken the
|
|
111
|
+
* far more common `app.example.com` calling `api.example.com`, which is the app's OWN backend, and
|
|
112
|
+
* silenced the detector where it earns its keep. Swap in a PSL if a real app is ever mis-graded.
|
|
113
|
+
*/
|
|
114
|
+
function registrableDomain(host) {
|
|
115
|
+
const labels = host.split('.');
|
|
116
|
+
if (labels.length <= REGISTRABLE_LABELS)
|
|
117
|
+
return host;
|
|
118
|
+
// An IPv4 literal has four labels and no registrable domain — compare it whole.
|
|
119
|
+
if (/^[0-9.]+$/.test(host))
|
|
120
|
+
return host;
|
|
121
|
+
return labels.slice(-REGISTRABLE_LABELS).join('.');
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Is this call to somebody ELSE's site — an analytics beacon, a vendor SDK bootstrap, a CDN ping?
|
|
125
|
+
*
|
|
126
|
+
* The axis a verdict needs and never had. A contradiction is a statement about the app under test,
|
|
127
|
+
* and a failed third-party request says nothing about whether the caller's action worked: reported
|
|
128
|
+
* from several apps, any analytics package installed was enough to grade a correct drive
|
|
129
|
+
* `contradicted`, and on one app every assertion came back that way forever.
|
|
130
|
+
*
|
|
131
|
+
* Deliberately NOT a vendor list. `DevToolingChannel` above states why a list is the wrong shape
|
|
132
|
+
* here: widening it until it can swallow an app endpoint turns a false negative into a false GREEN.
|
|
133
|
+
* An origin comparison has no list to widen — it asks one structural question about the page itself.
|
|
134
|
+
*
|
|
135
|
+
* Ports are deliberately ignored: a dev app on :3000 talking to its API on :8787 is the ordinary
|
|
136
|
+
* local setup, and grading that as a stranger's traffic would silence the detector on our own bench.
|
|
137
|
+
*
|
|
138
|
+
* Absence of `appUrl` disables the axis entirely — the same rule the document scoping follows, so a
|
|
139
|
+
* caller who cannot say which page is under test gets exactly the behaviour it had before this.
|
|
140
|
+
*/
|
|
141
|
+
export function isThirdPartyUrl(url, appUrl) {
|
|
142
|
+
if (url === undefined || appUrl === undefined)
|
|
143
|
+
return false;
|
|
144
|
+
const target = hostOf(url, appUrl);
|
|
145
|
+
const app = hostOf(appUrl, appUrl);
|
|
146
|
+
if (target === undefined || app === undefined)
|
|
147
|
+
return false;
|
|
148
|
+
return registrableDomain(target) !== registrableDomain(app);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* The unredacted URL, kept so a grader can match `urlContains` against the path the app actually
|
|
152
|
+
* requested. `url` is what is rendered to the agent and stored as the displayed value; this field
|
|
153
|
+
* is the match haystack and must not be projected back into a transcript.
|
|
154
|
+
*
|
|
155
|
+
* Redaction runs at emit time and there is otherwise no raw copy. Public REST segments that happen
|
|
156
|
+
* to follow a sensitive name (`/auth/token/refresh-context`, `/verify/CERT_INFY_10`) are rewritten
|
|
157
|
+
* to `[REDACTED]`, so matching only `url` reports "the request did not happen".
|
|
158
|
+
*/
|
|
159
|
+
export const URL_RAW = 'urlRaw';
|
|
160
|
+
/**
|
|
161
|
+
* The URL a filter or predicate should match against: the raw request when the observer kept one,
|
|
162
|
+
* otherwise the displayed (possibly redacted) `url`.
|
|
163
|
+
*/
|
|
164
|
+
export function urlForMatch(data) {
|
|
165
|
+
const raw = data[URL_RAW];
|
|
166
|
+
if ('string' === typeof raw && 0 < raw.length)
|
|
167
|
+
return raw;
|
|
168
|
+
const url = data['url'];
|
|
169
|
+
return 'string' === typeof url ? url : '';
|
|
170
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHY an install has produced no session — the closed vocabulary, on its own.
|
|
3
|
+
*
|
|
4
|
+
* Split out of telemetry.ts when that file crossed the 1000-line cap. It belongs apart regardless:
|
|
5
|
+
* telemetry.ts is the wire contract, and this is the taxonomy the no-session DIAGNOSIS owns, read
|
|
6
|
+
* by `explainNoSession`, the session manager and the refusal reporter alike.
|
|
7
|
+
*
|
|
8
|
+
* `no_session` is the largest refusal cohort, and on its own it is a set difference: the daemon
|
|
9
|
+
* started, no app connected, and nothing says which of several opposite situations that was.
|
|
10
|
+
* "Restarted the dev server and it still did not connect" and "never started the app" need
|
|
11
|
+
* opposite fixes and arrived as the same silence (#615).
|
|
12
|
+
*
|
|
13
|
+
* Derived from `explainNoSession`'s branches rather than classified beside them, so the code and
|
|
14
|
+
* the sentence the user is shown cannot drift apart. A reason describing a diagnosis nobody
|
|
15
|
+
* received would be worse than none.
|
|
16
|
+
*/
|
|
17
|
+
export declare const NoSessionReason: {
|
|
18
|
+
/** Connected before; the session that went was a pooled lease that aged out. */
|
|
19
|
+
readonly LEASE_EXPIRED: "lease_expired";
|
|
20
|
+
/** Connected before; the tab was closed, navigated away, or hard-reloaded. */
|
|
21
|
+
readonly TAB_GONE: "tab_gone";
|
|
22
|
+
/** This project has connected before, but not to this daemon run. Usually a restart with no reopen. */
|
|
23
|
+
readonly APP_NOT_REOPENED: "app_not_reopened";
|
|
24
|
+
/** A `.reticle.json` exists OUTSIDE this daemon's directory: a scope problem, not an install one. */
|
|
25
|
+
readonly CONFIG_ELSEWHERE: "config_elsewhere";
|
|
26
|
+
/** Nothing listening on the scanned ports AND no config here. The weakest position, and common. */
|
|
27
|
+
readonly NO_LISTENER_NO_CONFIG: "no_listener_no_config";
|
|
28
|
+
/** Nothing listening, but the project is wired. The dev server is the missing half. */
|
|
29
|
+
readonly NO_LISTENER: "no_listener";
|
|
30
|
+
/** Something is listening, but there is no config in this directory. */
|
|
31
|
+
readonly NO_CONFIG: "no_config";
|
|
32
|
+
/** Wired, listening, and still nothing arrived: the SDK is not reaching this daemon. */
|
|
33
|
+
readonly SDK_NOT_REACHING_DAEMON: "sdk_not_reaching_daemon";
|
|
34
|
+
};
|
|
35
|
+
export type NoSessionReason = (typeof NoSessionReason)[keyof typeof NoSessionReason];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHY an install has produced no session — the closed vocabulary, on its own.
|
|
3
|
+
*
|
|
4
|
+
* Split out of telemetry.ts when that file crossed the 1000-line cap. It belongs apart regardless:
|
|
5
|
+
* telemetry.ts is the wire contract, and this is the taxonomy the no-session DIAGNOSIS owns, read
|
|
6
|
+
* by `explainNoSession`, the session manager and the refusal reporter alike.
|
|
7
|
+
*
|
|
8
|
+
* `no_session` is the largest refusal cohort, and on its own it is a set difference: the daemon
|
|
9
|
+
* started, no app connected, and nothing says which of several opposite situations that was.
|
|
10
|
+
* "Restarted the dev server and it still did not connect" and "never started the app" need
|
|
11
|
+
* opposite fixes and arrived as the same silence (#615).
|
|
12
|
+
*
|
|
13
|
+
* Derived from `explainNoSession`'s branches rather than classified beside them, so the code and
|
|
14
|
+
* the sentence the user is shown cannot drift apart. A reason describing a diagnosis nobody
|
|
15
|
+
* received would be worse than none.
|
|
16
|
+
*/
|
|
17
|
+
export const NoSessionReason = {
|
|
18
|
+
/** Connected before; the session that went was a pooled lease that aged out. */
|
|
19
|
+
LEASE_EXPIRED: 'lease_expired',
|
|
20
|
+
/** Connected before; the tab was closed, navigated away, or hard-reloaded. */
|
|
21
|
+
TAB_GONE: 'tab_gone',
|
|
22
|
+
/** This project has connected before, but not to this daemon run. Usually a restart with no reopen. */
|
|
23
|
+
APP_NOT_REOPENED: 'app_not_reopened',
|
|
24
|
+
/** A `.reticle.json` exists OUTSIDE this daemon's directory: a scope problem, not an install one. */
|
|
25
|
+
CONFIG_ELSEWHERE: 'config_elsewhere',
|
|
26
|
+
/** Nothing listening on the scanned ports AND no config here. The weakest position, and common. */
|
|
27
|
+
NO_LISTENER_NO_CONFIG: 'no_listener_no_config',
|
|
28
|
+
/** Nothing listening, but the project is wired. The dev server is the missing half. */
|
|
29
|
+
NO_LISTENER: 'no_listener',
|
|
30
|
+
/** Something is listening, but there is no config in this directory. */
|
|
31
|
+
NO_CONFIG: 'no_config',
|
|
32
|
+
/** Wired, listening, and still nothing arrived: the SDK is not reaching this daemon. */
|
|
33
|
+
SDK_NOT_REACHING_DAEMON: 'sdk_not_reaching_daemon',
|
|
34
|
+
};
|
package/dist/notices.d.ts
CHANGED
|
@@ -30,10 +30,27 @@ export declare const BUFFER_EVICTION_WARNING = "event buffer evicted older event
|
|
|
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
|
|
32
32
|
* checks the wiring instead of only the "is the SDK enabled?" dead end.
|
|
33
|
+
*
|
|
34
|
+
* It used to end by naming `reticle_wait_ready`, which is retired (see RETIRED_FROM_SURFACE) and
|
|
35
|
+
* answers `unknown tool`. This is the most-thrown error in the product — `resolve` raises it on
|
|
36
|
+
* every tool call while nothing is connected — so the one sentence carrying the ACTION sent the
|
|
37
|
+
* reader to a tool that does not exist, at the moment they had least idea what to do next.
|
|
38
|
+
*
|
|
39
|
+
* `reticle_sessions` is the live answer and a strictly better one: it returns the ranked diagnosis
|
|
40
|
+
* (which of the causes above this actually is, plus the port scan and a next action) rather than
|
|
41
|
+
* blocking and telling you nothing. It is the same tool `#unknownSessionError` already points at,
|
|
42
|
+
* so the two no-session paths now agree.
|
|
33
43
|
*/
|
|
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.
|
|
44
|
+
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. Call reticle_sessions for the diagnosis \u2014 it names which of these it is, and what to do next \u2014 rather than retrying this call.";
|
|
35
45
|
/** Surfaced on act/assert results when the target tab is throttled. */
|
|
36
46
|
export declare const THROTTLED_WARNING = "tab throttled; timer/rAF/pointer gestures may silently no-op; refocus before driving";
|
|
47
|
+
/**
|
|
48
|
+
* Prefixed onto a wait/assert miss when the session is throttled. A background tab is starved by
|
|
49
|
+
* the browser, so a timeout there is not evidence the UI is absent — it may never have rendered.
|
|
50
|
+
* `inconclusive` on the verdict (this string) is what stops that miss being graded as a product
|
|
51
|
+
* failure. The CLI escape hatch is named second; an MCP-only agent has no shell.
|
|
52
|
+
*/
|
|
53
|
+
export declare const THROTTLED_STARVED_NOTE: string;
|
|
37
54
|
/**
|
|
38
55
|
* Pushed to the panel when the last agent's MCP connection drops — the agent (any of
|
|
39
56
|
* Codex/OpenCode/Claude/Hermes) has stopped or is waiting on you. Tells the human, who is
|
|
@@ -63,11 +80,65 @@ export declare const AGENT_ASK_NOTICE = "Agent needs your input \u2014 answer in
|
|
|
63
80
|
*/
|
|
64
81
|
export declare const YIELD_WITHOUT_SESSION_NOTE: string;
|
|
65
82
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
83
|
+
* What leasing COSTS, said once and appended to every recommendation that offers it.
|
|
84
|
+
*
|
|
85
|
+
* A lease is a separate pooled context. It is the highest-value path in the product for autonomous
|
|
86
|
+
* work — and it is invisible to the person sitting in front of the app, because the HUD lives in
|
|
87
|
+
* THEIR tab. Recommending it without saying so produced exactly the failure it invites: an agent
|
|
88
|
+
* took the advice, drove fifteen calls into a context nobody could see, and the developer watching
|
|
89
|
+
* an empty HUD asked why nothing was running. The product looked broken while working correctly.
|
|
90
|
+
*
|
|
91
|
+
* The tradeoff is the whole content of the hint. An agent that knows a human is watching should
|
|
92
|
+
* spend a slower tab to stay visible; one working alone should lease and not think about it.
|
|
93
|
+
*/
|
|
94
|
+
export declare const LEASE_IS_INVISIBLE_NOTE = "note that a lease is a SEPARATE context: the human watching this tab sees nothing of what you do there, so prefer this tab while someone is following along";
|
|
95
|
+
/**
|
|
96
|
+
* A tab that is HIDDEN — backgrounded, or in another window.
|
|
97
|
+
*
|
|
98
|
+
* The genuinely risky case, and the one this recommendation was written for. A background tab has
|
|
99
|
+
* its timers and rAF clamped hard, so synthetic events can land on a page that never advances, and
|
|
100
|
+
* Reticle cannot bring it to the front. Naming the limit is the honest move.
|
|
101
|
+
*
|
|
102
|
+
* Names the escape hatch the AGENT can take first (`reticle_lease` through `reticle_run`, since
|
|
103
|
+
* lease is not on the default surface) and leaves `reticle drive` as the human-side equivalent: an
|
|
104
|
+
* MCP-only agent has no shell, so a CLI sentence is advice it cannot follow.
|
|
105
|
+
*/
|
|
106
|
+
/**
|
|
107
|
+
* A DESKTOP window that has gone to the background, which is a different problem with a different fix.
|
|
108
|
+
*
|
|
109
|
+
* The web answer — acquire a lease, or run `reticle drive <url>` — is unavailable here and saying it
|
|
110
|
+
* is worse than saying nothing. A lease opens a headless BROWSER context; an Electron or Tauri app's
|
|
111
|
+
* window IS the client, and a browser pointed at the same dev-server URL is a different program with
|
|
112
|
+
* no main process, no preload and no Rust commands. Driven on MarkText, a shipped Electron editor:
|
|
113
|
+
* its window went behind, the session reported hidden+throttled, and the only advice offered was the
|
|
114
|
+
* one thing that could not be done — while the thing that works, bringing the window forward, went
|
|
115
|
+
* unsaid.
|
|
116
|
+
*
|
|
117
|
+
* No `reticle_lease` and no `reticle drive` in this sentence, deliberately. Both are checked by test.
|
|
118
|
+
*/
|
|
119
|
+
export declare const DESKTOP_WINDOW_BACKGROUNDED = "this app window is in the background, and a backgrounded webview clamps its timers and rAF \u2014 a synthetic action can land on a page that never advances. Bring the app window to the front and retry. A lease is NOT the answer for a desktop app: it opens a browser context, which has none of this app's IPC or commands.";
|
|
120
|
+
export declare const HIDDEN_TAB_RECOMMENDATION: string;
|
|
121
|
+
/**
|
|
122
|
+
* A tab that is NOT hidden but has gone quiet — the `throttled` flag without `hidden`.
|
|
123
|
+
*
|
|
124
|
+
* Worth being exact, because the flag's name oversells it: `throttled` is `hidden || stale`, and
|
|
125
|
+
* stale only means no health heartbeat arrived inside the window. For a tab that is not hidden that
|
|
126
|
+
* usually means nothing worse than a quiet page, and such a tab is very often driveable.
|
|
127
|
+
*
|
|
128
|
+
* Split out because the old single message treated this as equivalent to hidden and it is not.
|
|
129
|
+
* Measured in the field: a session flagged throttled took a sign-in and two clean net-grade verdicts
|
|
130
|
+
* with no retries, while the recommendation had already sent the agent into a lease the watching
|
|
131
|
+
* human could not see. One flag produced advice that cost the product's main trust surface and
|
|
132
|
+
* bought nothing.
|
|
133
|
+
*
|
|
134
|
+
* So this reports the uncertainty honestly — it MAY be slow, timing-sensitive work is what suffers —
|
|
135
|
+
* and offers the precise instrument for that (`refuseWhenThrottled`) rather than a different
|
|
136
|
+
* browser.
|
|
137
|
+
*/
|
|
138
|
+
export declare const THROTTLED_TAB_RECOMMENDATION: string;
|
|
139
|
+
/**
|
|
140
|
+
* @deprecated Use {@link HIDDEN_TAB_RECOMMENDATION} or {@link THROTTLED_TAB_RECOMMENDATION}.
|
|
141
|
+
* Retained so an older consumer pinned to this name still compiles; it is the hidden-tab wording,
|
|
142
|
+
* which is the case the single message was actually correct for.
|
|
72
143
|
*/
|
|
73
|
-
export declare const UNSCRIPTABLE_TAB_RECOMMENDATION
|
|
144
|
+
export declare const UNSCRIPTABLE_TAB_RECOMMENDATION: string;
|
package/dist/notices.js
CHANGED
|
@@ -34,10 +34,29 @@ export const BUFFER_EVICTION_WARNING = 'event buffer evicted older events (age/s
|
|
|
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
|
|
36
36
|
* checks the wiring instead of only the "is the SDK enabled?" dead end.
|
|
37
|
+
*
|
|
38
|
+
* It used to end by naming `reticle_wait_ready`, which is retired (see RETIRED_FROM_SURFACE) and
|
|
39
|
+
* answers `unknown tool`. This is the most-thrown error in the product — `resolve` raises it on
|
|
40
|
+
* every tool call while nothing is connected — so the one sentence carrying the ACTION sent the
|
|
41
|
+
* reader to a tool that does not exist, at the moment they had least idea what to do next.
|
|
42
|
+
*
|
|
43
|
+
* `reticle_sessions` is the live answer and a strictly better one: it returns the ranked diagnosis
|
|
44
|
+
* (which of the causes above this actually is, plus the port scan and a next action) rather than
|
|
45
|
+
* blocking and telling you nothing. It is the same tool `#unknownSessionError` already points at,
|
|
46
|
+
* so the two no-session paths now agree.
|
|
37
47
|
*/
|
|
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.
|
|
48
|
+
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. Call reticle_sessions for the diagnosis — it names which of these it is, and what to do next — rather than retrying this call.";
|
|
39
49
|
/** Surfaced on act/assert results when the target tab is throttled. */
|
|
40
50
|
export const THROTTLED_WARNING = 'tab throttled; timer/rAF/pointer gestures may silently no-op; refocus before driving';
|
|
51
|
+
/**
|
|
52
|
+
* Prefixed onto a wait/assert miss when the session is throttled. A background tab is starved by
|
|
53
|
+
* the browser, so a timeout there is not evidence the UI is absent — it may never have rendered.
|
|
54
|
+
* `inconclusive` on the verdict (this string) is what stops that miss being graded as a product
|
|
55
|
+
* failure. The CLI escape hatch is named second; an MCP-only agent has no shell.
|
|
56
|
+
*/
|
|
57
|
+
export const THROTTLED_STARVED_NOTE = 'this tab is throttled and has not rendered; a miss here is not evidence the UI is absent. ' +
|
|
58
|
+
'acquire a scriptable context with reticle_run { tool: "reticle_lease", action: "acquire", url } ' +
|
|
59
|
+
'(the human can run `reticle drive <url>` if they have a shell)';
|
|
41
60
|
/**
|
|
42
61
|
* Pushed to the panel when the last agent's MCP connection drops — the agent (any of
|
|
43
62
|
* Codex/OpenCode/Claude/Hermes) has stopped or is waiting on you. Tells the human, who is
|
|
@@ -68,11 +87,67 @@ export const AGENT_ASK_NOTICE = 'Agent needs your input — answer in your termi
|
|
|
68
87
|
export const YIELD_WITHOUT_SESSION_NOTE = 'No browser session was connected, so there was no panel to update. The turn end was still ' +
|
|
69
88
|
'recorded. If you expected an app to be attached, that is the thing to look into.';
|
|
70
89
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
90
|
+
* What leasing COSTS, said once and appended to every recommendation that offers it.
|
|
91
|
+
*
|
|
92
|
+
* A lease is a separate pooled context. It is the highest-value path in the product for autonomous
|
|
93
|
+
* work — and it is invisible to the person sitting in front of the app, because the HUD lives in
|
|
94
|
+
* THEIR tab. Recommending it without saying so produced exactly the failure it invites: an agent
|
|
95
|
+
* took the advice, drove fifteen calls into a context nobody could see, and the developer watching
|
|
96
|
+
* an empty HUD asked why nothing was running. The product looked broken while working correctly.
|
|
97
|
+
*
|
|
98
|
+
* The tradeoff is the whole content of the hint. An agent that knows a human is watching should
|
|
99
|
+
* spend a slower tab to stay visible; one working alone should lease and not think about it.
|
|
100
|
+
*/
|
|
101
|
+
export const LEASE_IS_INVISIBLE_NOTE = 'note that a lease is a SEPARATE context: the human watching this tab sees nothing of what you do there, so prefer this tab while someone is following along';
|
|
102
|
+
/**
|
|
103
|
+
* A tab that is HIDDEN — backgrounded, or in another window.
|
|
104
|
+
*
|
|
105
|
+
* The genuinely risky case, and the one this recommendation was written for. A background tab has
|
|
106
|
+
* its timers and rAF clamped hard, so synthetic events can land on a page that never advances, and
|
|
107
|
+
* Reticle cannot bring it to the front. Naming the limit is the honest move.
|
|
108
|
+
*
|
|
109
|
+
* Names the escape hatch the AGENT can take first (`reticle_lease` through `reticle_run`, since
|
|
110
|
+
* lease is not on the default surface) and leaves `reticle drive` as the human-side equivalent: an
|
|
111
|
+
* MCP-only agent has no shell, so a CLI sentence is advice it cannot follow.
|
|
112
|
+
*/
|
|
113
|
+
/**
|
|
114
|
+
* A DESKTOP window that has gone to the background, which is a different problem with a different fix.
|
|
115
|
+
*
|
|
116
|
+
* The web answer — acquire a lease, or run `reticle drive <url>` — is unavailable here and saying it
|
|
117
|
+
* is worse than saying nothing. A lease opens a headless BROWSER context; an Electron or Tauri app's
|
|
118
|
+
* window IS the client, and a browser pointed at the same dev-server URL is a different program with
|
|
119
|
+
* no main process, no preload and no Rust commands. Driven on MarkText, a shipped Electron editor:
|
|
120
|
+
* its window went behind, the session reported hidden+throttled, and the only advice offered was the
|
|
121
|
+
* one thing that could not be done — while the thing that works, bringing the window forward, went
|
|
122
|
+
* unsaid.
|
|
123
|
+
*
|
|
124
|
+
* No `reticle_lease` and no `reticle drive` in this sentence, deliberately. Both are checked by test.
|
|
125
|
+
*/
|
|
126
|
+
export const DESKTOP_WINDOW_BACKGROUNDED = "this app window is in the background, and a backgrounded webview clamps its timers and rAF — a synthetic action can land on a page that never advances. Bring the app window to the front and retry. A lease is NOT the answer for a desktop app: it opens a browser context, which has none of this app's IPC or commands.";
|
|
127
|
+
export const HIDDEN_TAB_RECOMMENDATION = 'tab hidden and may be un-focusable from here; timers and rAF are clamped in a background tab, so an action can land on a page that never advances. Refocus it, or acquire a guaranteed scriptable context yourself with `reticle_run { tool: "reticle_lease", action: "acquire", url }` (a human can equivalently run `reticle drive <url>`) — ' +
|
|
128
|
+
LEASE_IS_INVISIBLE_NOTE;
|
|
129
|
+
/**
|
|
130
|
+
* A tab that is NOT hidden but has gone quiet — the `throttled` flag without `hidden`.
|
|
131
|
+
*
|
|
132
|
+
* Worth being exact, because the flag's name oversells it: `throttled` is `hidden || stale`, and
|
|
133
|
+
* stale only means no health heartbeat arrived inside the window. For a tab that is not hidden that
|
|
134
|
+
* usually means nothing worse than a quiet page, and such a tab is very often driveable.
|
|
135
|
+
*
|
|
136
|
+
* Split out because the old single message treated this as equivalent to hidden and it is not.
|
|
137
|
+
* Measured in the field: a session flagged throttled took a sign-in and two clean net-grade verdicts
|
|
138
|
+
* with no retries, while the recommendation had already sent the agent into a lease the watching
|
|
139
|
+
* human could not see. One flag produced advice that cost the product's main trust surface and
|
|
140
|
+
* bought nothing.
|
|
141
|
+
*
|
|
142
|
+
* So this reports the uncertainty honestly — it MAY be slow, timing-sensitive work is what suffers —
|
|
143
|
+
* and offers the precise instrument for that (`refuseWhenThrottled`) rather than a different
|
|
144
|
+
* browser.
|
|
145
|
+
*/
|
|
146
|
+
export const THROTTLED_TAB_RECOMMENDATION = 'tab is not hidden but has not reported health recently — usually a quiet page rather than a stuck one, and very often still driveable. This is also the tab a human can see, so try it first. Timing-sensitive work (animations, debounces, gestures) is what degrades: pass `refuseWhenThrottled: true` to refuse rather than act over events that may not land. Lease a separate context only if a drive here actually fails; ' +
|
|
147
|
+
LEASE_IS_INVISIBLE_NOTE;
|
|
148
|
+
/**
|
|
149
|
+
* @deprecated Use {@link HIDDEN_TAB_RECOMMENDATION} or {@link THROTTLED_TAB_RECOMMENDATION}.
|
|
150
|
+
* Retained so an older consumer pinned to this name still compiles; it is the hidden-tab wording,
|
|
151
|
+
* which is the case the single message was actually correct for.
|
|
77
152
|
*/
|
|
78
|
-
export const UNSCRIPTABLE_TAB_RECOMMENDATION =
|
|
153
|
+
export const UNSCRIPTABLE_TAB_RECOMMENDATION = HIDDEN_TAB_RECOMMENDATION;
|
package/dist/security.d.ts
CHANGED
|
@@ -20,5 +20,11 @@ export declare const OPAQUE_ORIGIN = "null";
|
|
|
20
20
|
* pairing token, exactly as they do for a request that omits `Origin` entirely.
|
|
21
21
|
*/
|
|
22
22
|
export declare function isOpaqueOrigin(origin: string): boolean;
|
|
23
|
-
/**
|
|
24
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Best-effort classifier for labels and tool names that can trigger irreversible effects.
|
|
25
|
+
*
|
|
26
|
+
* `role` is the resolved ARIA role of the control. An `option` is a value picker: its text names
|
|
27
|
+
* the value, not an action, so "Payment" as a select choice is not a payment. Callers that have no
|
|
28
|
+
* role (a tool name, a click with no role on the descriptor) omit it and the text decides.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isDangerousActionText(text: string, role?: string): boolean;
|
package/dist/security.js
CHANGED
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
* `payment` catches "Send payment" and "Confirm payment" (which the bare-verb list missed entirely,
|
|
12
12
|
* because `\bpay\b` does not match "payment"), and `send money`/`send funds` catch the rest.
|
|
13
13
|
*
|
|
14
|
+
* `logout` / `log out` / `sign out` were here and are not. Signing out is reversible, and the
|
|
15
|
+
* words fire on almost every authenticated drive — a `Log out` menuitem was blocked on every
|
|
16
|
+
* session. Same cost as `send`: a guard that fires on routine controls trains agents to pass
|
|
17
|
+
* `confirmDangerous` reflexively.
|
|
18
|
+
*
|
|
14
19
|
* The guard stays deliberately asymmetric — a false block costs one round-trip, a missed block can
|
|
15
20
|
* charge somebody's card — so this narrows the trigger without lowering money coverage. Both
|
|
16
21
|
* directions are pinned in security.test.ts.
|
|
@@ -31,7 +36,12 @@
|
|
|
31
36
|
* not protecting anybody — it is training agents to route around it, which is worse than not having
|
|
32
37
|
* it, because the routing-around generalises to the buttons that DO matter.
|
|
33
38
|
*/
|
|
34
|
-
const DANGEROUS_ACTION = /\b(delete|remove|destroy|erase|drop|terminate|revoke|reset|
|
|
39
|
+
const DANGEROUS_ACTION = /\b(delete|remove|destroy|erase|drop|terminate|revoke|reset|close account|cancel subscription|purchase|buy|pay|payment|place order|confirm order|send money|send funds|transfer|withdraw|refund)\b/i;
|
|
40
|
+
/**
|
|
41
|
+
* Roles that pick a value from a list, not perform an action. Selecting "Payment" as a document
|
|
42
|
+
* type is not a payment. `menuitem` is deliberately not here: a menu item labelled Delete still is.
|
|
43
|
+
*/
|
|
44
|
+
const VALUE_PICKER_ROLE = 'option';
|
|
35
45
|
/** The hostnames that ARE loopback outright, with no parsing: the name, and IPv6 ::1 both ways. */
|
|
36
46
|
const LOOPBACK_HOSTNAMES = ['localhost', '::1', '0:0:0:0:0:0:0:1'];
|
|
37
47
|
/** IPv4 loopback is the whole 127.0.0.0/8 block, so the first octet is the entire test. */
|
|
@@ -98,7 +108,15 @@ export function isOpaqueOrigin(origin) {
|
|
|
98
108
|
return true;
|
|
99
109
|
}
|
|
100
110
|
}
|
|
101
|
-
/**
|
|
102
|
-
|
|
111
|
+
/**
|
|
112
|
+
* Best-effort classifier for labels and tool names that can trigger irreversible effects.
|
|
113
|
+
*
|
|
114
|
+
* `role` is the resolved ARIA role of the control. An `option` is a value picker: its text names
|
|
115
|
+
* the value, not an action, so "Payment" as a select choice is not a payment. Callers that have no
|
|
116
|
+
* role (a tool name, a click with no role on the descriptor) omit it and the text decides.
|
|
117
|
+
*/
|
|
118
|
+
export function isDangerousActionText(text, role) {
|
|
119
|
+
if (role !== undefined && role.trim().toLowerCase() === VALUE_PICKER_ROLE)
|
|
120
|
+
return false;
|
|
103
121
|
return DANGEROUS_ACTION.test(text.replace(/[_-]+/g, ' '));
|
|
104
122
|
}
|
|
@@ -129,5 +129,13 @@ export declare const NoSessionAction: {
|
|
|
129
129
|
readonly OPEN_APP: "open_app";
|
|
130
130
|
/** A session was here and went away: reopen the tab, or take a lease. */
|
|
131
131
|
readonly REOPEN_APP: "reopen_app";
|
|
132
|
+
/**
|
|
133
|
+
* The app IS connected — to another daemon on this machine. Nothing to open, nothing to install.
|
|
134
|
+
*
|
|
135
|
+
* Its own kind because every other action here is wrong for it: the app is running, wired and
|
|
136
|
+
* live, so `open_app`, `run_init` and `start_dev_server` all send the agent to fix something that
|
|
137
|
+
* is not broken, and `reopen_app` points it at a tab that is already open.
|
|
138
|
+
*/
|
|
139
|
+
readonly DAEMON_SPLIT: "daemon_split";
|
|
132
140
|
};
|
|
133
141
|
export type NoSessionAction = (typeof NoSessionAction)[keyof typeof NoSessionAction];
|
|
@@ -126,4 +126,12 @@ export const NoSessionAction = {
|
|
|
126
126
|
OPEN_APP: 'open_app',
|
|
127
127
|
/** A session was here and went away: reopen the tab, or take a lease. */
|
|
128
128
|
REOPEN_APP: 'reopen_app',
|
|
129
|
+
/**
|
|
130
|
+
* The app IS connected — to another daemon on this machine. Nothing to open, nothing to install.
|
|
131
|
+
*
|
|
132
|
+
* Its own kind because every other action here is wrong for it: the app is running, wired and
|
|
133
|
+
* live, so `open_app`, `run_init` and `start_dev_server` all send the agent to fix something that
|
|
134
|
+
* is not broken, and `reopen_app` points it at a tab that is already open.
|
|
135
|
+
*/
|
|
136
|
+
DAEMON_SPLIT: 'daemon_split',
|
|
129
137
|
};
|
|
@@ -15,6 +15,18 @@
|
|
|
15
15
|
* This is a STATUS, never an identity. It says whether a key verified, not whose key it is; the
|
|
16
16
|
* separate `licenseId` carries the opaque id, and the organisation NAME never goes on the wire at all.
|
|
17
17
|
*/
|
|
18
|
+
/**
|
|
19
|
+
* A licence key is present in the environment — whatever this build was able to conclude about it.
|
|
20
|
+
*
|
|
21
|
+
* Separate from `licenseStatus` because status can be ABSENT: `eval` reports nothing at all, by
|
|
22
|
+
* design, since it means no issuer key is baked and that is every OSS install. The consequence was
|
|
23
|
+
* that a customer who pastes a real enterprise key into a build which cannot verify it produced no
|
|
24
|
+
* licence signal whatsoever — indistinguishable from someone who has never held a key. The one
|
|
25
|
+
* population most worth seeing was the one that could not be seen.
|
|
26
|
+
*
|
|
27
|
+
* Never the key. This is a boolean; the key itself is a credential and never leaves the machine.
|
|
28
|
+
*/
|
|
29
|
+
export declare const LICENSE_KEY_PRESENT = "licenseKeyPresent";
|
|
18
30
|
export declare const LicenseActivation: {
|
|
19
31
|
/** A valid, unexpired, correctly-signed key covering this build. */
|
|
20
32
|
readonly ACTIVE: "active";
|
|
@@ -15,6 +15,18 @@
|
|
|
15
15
|
* This is a STATUS, never an identity. It says whether a key verified, not whose key it is; the
|
|
16
16
|
* separate `licenseId` carries the opaque id, and the organisation NAME never goes on the wire at all.
|
|
17
17
|
*/
|
|
18
|
+
/**
|
|
19
|
+
* A licence key is present in the environment — whatever this build was able to conclude about it.
|
|
20
|
+
*
|
|
21
|
+
* Separate from `licenseStatus` because status can be ABSENT: `eval` reports nothing at all, by
|
|
22
|
+
* design, since it means no issuer key is baked and that is every OSS install. The consequence was
|
|
23
|
+
* that a customer who pastes a real enterprise key into a build which cannot verify it produced no
|
|
24
|
+
* licence signal whatsoever — indistinguishable from someone who has never held a key. The one
|
|
25
|
+
* population most worth seeing was the one that could not be seen.
|
|
26
|
+
*
|
|
27
|
+
* Never the key. This is a boolean; the key itself is a credential and never leaves the machine.
|
|
28
|
+
*/
|
|
29
|
+
export const LICENSE_KEY_PRESENT = 'licenseKeyPresent';
|
|
18
30
|
export const LicenseActivation = {
|
|
19
31
|
/** A valid, unexpired, correctly-signed key covering this build. */
|
|
20
32
|
ACTIVE: 'active',
|