@reticlehq/core 3.4.0 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/artifacts/artifacts-entry.d.ts +2 -0
- package/dist/artifacts/artifacts-entry.js +2 -0
- package/dist/artifacts/drive-script.d.ts +1298 -0
- package/dist/artifacts/drive-script.js +197 -0
- package/dist/artifacts/flow-constants.d.ts +1 -0
- package/dist/artifacts/flow-constants.js +1 -0
- package/dist/artifacts/flow-types.d.ts +60 -0
- package/dist/artifacts/flow-types.js +10 -0
- package/dist/artifacts/hud-notices.d.ts +134 -0
- package/dist/artifacts/hud-notices.js +124 -0
- package/dist/artifacts/impact.d.ts +135 -44
- package/dist/artifacts/impact.js +25 -0
- package/dist/artifacts/journal.d.ts +49 -0
- package/dist/artifacts/journal.js +15 -0
- package/dist/artifacts/prompt-context.d.ts +105 -0
- package/dist/artifacts/prompt-context.js +108 -0
- package/dist/desktop-contract.cjs +1 -0
- package/dist/desktop-contract.d.cts +1 -0
- package/dist/hud-entry.d.ts +1 -0
- package/dist/hud-entry.js +2 -0
- package/dist/identity/contract-fingerprint.d.ts +9 -0
- package/dist/identity/contract-fingerprint.js +12 -0
- package/dist/identity/testid-attribute.d.ts +18 -0
- package/dist/identity/testid-attribute.js +24 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/dist/onboarding.d.ts +2 -2
- package/dist/schema/command-message.json +6 -0
- package/dist/schema/command-name.json +3 -1
- package/dist/schema/event-payloads.json +16 -0
- package/dist/schema/reticle-message.json +6 -0
- package/dist/telemetry-refusal.d.ts +3 -2
- package/dist/telemetry-session.d.ts +5 -1
- package/dist/telemetry-session.js +3 -1
- package/dist/telemetry.d.ts +42 -34
- package/dist/telemetry.js +3 -3
- package/dist/tour.d.ts +1 -0
- package/dist/tour.js +13 -5
- package/dist/verdict/consequence.d.ts +3 -0
- package/dist/verdict/findings.d.ts +5 -0
- package/dist/verdict/findings.js +7 -0
- package/dist/verdict/predicate.d.ts +14 -0
- package/dist/verdict/predicate.js +7 -12
- package/dist/verdict/verdict-attribution.js +1 -0
- package/dist/verdict/verification-run.d.ts +18 -0
- package/dist/verdict/verification-run.js +8 -0
- package/dist/verdict/verified-constants.d.ts +19 -0
- package/dist/verdict/verified-constants.js +22 -0
- package/dist/wire/constants/constants.d.ts +44 -16
- package/dist/wire/constants/constants.js +44 -16
- package/dist/wire/constants/hud-controls.d.ts +1 -1
- package/dist/wire/constants/hud-controls.js +21 -0
- package/dist/wire/constants/hud-use.d.ts +64 -1
- package/dist/wire/constants/hud-use.js +40 -1
- package/dist/wire/constants/session-constants.d.ts +8 -0
- package/dist/wire/constants/session-constants.js +8 -0
- package/dist/wire/desktop-contract.d.ts +3 -0
- package/dist/wire/desktop-contract.js +3 -0
- package/dist/wire/event-payloads.d.ts +25 -4
- package/dist/wire/event-payloads.js +10 -0
- package/dist/wire/global-press.d.ts +34 -3
- package/dist/wire/global-press.js +91 -3
- package/dist/wire/hold.d.ts +14 -0
- package/dist/wire/hold.js +18 -0
- package/dist/wire/messages.d.ts +42 -18
- package/dist/wire/messages.js +8 -0
- package/dist/wire/platform-link.d.ts +161 -0
- package/dist/wire/platform-link.js +189 -0
- package/dist/wire/types.d.ts +7 -0
- package/dist/words/no-session-reason.d.ts +7 -0
- package/dist/words/no-session-reason.js +7 -0
- package/dist/words/notices.js +4 -2
- package/package.json +1 -1
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { HudVisibility } from './constants/hud-use.js';
|
|
2
|
+
/** Bumped only for a change an older reader would MISREAD. A new field is not one. */
|
|
3
|
+
export declare const PLATFORM_LINK_VERSION = 1;
|
|
4
|
+
/** What a daemon can do for the platform, as it reports it. */
|
|
5
|
+
export declare const LinkCapability: {
|
|
6
|
+
/** Reads a `DriveSpec`, and reports what it applied and what it ignored. */
|
|
7
|
+
readonly DRIVE_SPEC: "drive-spec";
|
|
8
|
+
/** Drives the person's own open tab. */
|
|
9
|
+
readonly TARGET_TAB: "target:tab";
|
|
10
|
+
/** Opens the app in a browser of its own with no window. */
|
|
11
|
+
readonly TARGET_HEADLESS: "target:headless";
|
|
12
|
+
/** Opens the app in a browser window the person can watch. */
|
|
13
|
+
readonly TARGET_HEADED: "target:headed";
|
|
14
|
+
/** Shows, hides or removes the HUD on the page it drives. */
|
|
15
|
+
readonly HUD: "hud";
|
|
16
|
+
/** Runs a drive the platform orchestrates, one batch of tool calls at a time. */
|
|
17
|
+
readonly TOOL_SESSION: "tool-session";
|
|
18
|
+
/** Sends pictures of the page while it drives. */
|
|
19
|
+
readonly FRAMES: "frames";
|
|
20
|
+
};
|
|
21
|
+
export type LinkCapability = (typeof LinkCapability)[keyof typeof LinkCapability];
|
|
22
|
+
/** Where a drive runs. */
|
|
23
|
+
export declare const DriveTarget: {
|
|
24
|
+
/** A tab the person already has open. Their HUD shows it happening. */
|
|
25
|
+
readonly TAB: "tab";
|
|
26
|
+
/** A fresh browser context with no window. */
|
|
27
|
+
readonly HEADLESS: "headless";
|
|
28
|
+
/** A fresh browser window on the person's screen. */
|
|
29
|
+
readonly HEADED: "headed";
|
|
30
|
+
};
|
|
31
|
+
export type DriveTarget = (typeof DriveTarget)[keyof typeof DriveTarget];
|
|
32
|
+
/** Who decides each step of a drive. */
|
|
33
|
+
export declare const DriveMode: {
|
|
34
|
+
/** The daemon's own Harness plans and judges it. What every daemon before this link did. */
|
|
35
|
+
readonly LOCAL: "local";
|
|
36
|
+
/** The platform decides every step over a tool session; the daemon only runs tools. */
|
|
37
|
+
readonly PLATFORM: "platform";
|
|
38
|
+
};
|
|
39
|
+
export type DriveMode = (typeof DriveMode)[keyof typeof DriveMode];
|
|
40
|
+
/** Why a field of a spec was not applied. */
|
|
41
|
+
export declare const SpecIgnoredReason: {
|
|
42
|
+
/** This daemon does not know the field: the platform is newer. */
|
|
43
|
+
readonly UNKNOWN: "unknown";
|
|
44
|
+
/** The value did not read as the field's type. */
|
|
45
|
+
readonly INVALID: "invalid";
|
|
46
|
+
/** Known and valid, but this machine cannot do it right now (no browser, no HUD on the page). */
|
|
47
|
+
readonly UNAVAILABLE: "unavailable";
|
|
48
|
+
};
|
|
49
|
+
export type SpecIgnoredReason = (typeof SpecIgnoredReason)[keyof typeof SpecIgnoredReason];
|
|
50
|
+
export interface DriveSpec {
|
|
51
|
+
target?: DriveTarget;
|
|
52
|
+
mode?: DriveMode;
|
|
53
|
+
/** The address to open, for a target that opens one. Absent: the app's own last address. */
|
|
54
|
+
url?: string;
|
|
55
|
+
hud?: HudVisibility;
|
|
56
|
+
persona?: string;
|
|
57
|
+
maxSteps?: number;
|
|
58
|
+
/** Whether pictures of the page may leave the machine. */
|
|
59
|
+
record?: boolean;
|
|
60
|
+
}
|
|
61
|
+
export interface SpecIgnored {
|
|
62
|
+
field: string;
|
|
63
|
+
reason: SpecIgnoredReason;
|
|
64
|
+
/** Why, in a person's words, when there is more to say than the reason. */
|
|
65
|
+
detail?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Read a spec as far as it can be read. Never throws: a field that does not validate, or that this
|
|
69
|
+
* daemon does not know, is reported in `ignored` and the rest still apply.
|
|
70
|
+
*/
|
|
71
|
+
export declare function parseDriveSpec(raw: unknown): {
|
|
72
|
+
spec: DriveSpec;
|
|
73
|
+
ignored: SpecIgnored[];
|
|
74
|
+
};
|
|
75
|
+
/** What a daemon did with a spec, sent back with the drive's result or its first session ask. */
|
|
76
|
+
export interface DriveApplied {
|
|
77
|
+
target: DriveTarget;
|
|
78
|
+
mode: DriveMode;
|
|
79
|
+
url?: string;
|
|
80
|
+
hud?: HudVisibility;
|
|
81
|
+
/** The tab the drive ran in. */
|
|
82
|
+
sessionId?: string;
|
|
83
|
+
}
|
|
84
|
+
/** One tool call the platform asks the daemon to run. */
|
|
85
|
+
export interface ToolSessionCall {
|
|
86
|
+
seq: number;
|
|
87
|
+
tool: string;
|
|
88
|
+
args: Record<string, unknown>;
|
|
89
|
+
}
|
|
90
|
+
/** How one call went, as the daemon ran it. `result` is the tool's own answer, unedited. */
|
|
91
|
+
export interface ToolSessionResult {
|
|
92
|
+
seq: number;
|
|
93
|
+
ok: boolean;
|
|
94
|
+
result?: unknown;
|
|
95
|
+
error?: string;
|
|
96
|
+
ms: number;
|
|
97
|
+
}
|
|
98
|
+
/** The platform's answer to a session ask: the next calls, or that the drive is over. */
|
|
99
|
+
export interface ToolSessionReply {
|
|
100
|
+
calls: ToolSessionCall[];
|
|
101
|
+
done: boolean;
|
|
102
|
+
}
|
|
103
|
+
/** Bounds a daemon holds a tool session to, whatever the platform asks. */
|
|
104
|
+
export declare const TOOL_SESSION_LIMITS: {
|
|
105
|
+
/** Calls one drive may make in all: a loop on the platform must not drive forever. */
|
|
106
|
+
readonly MAX_CALLS: 1000;
|
|
107
|
+
/** Calls taken from one answer; the rest are not run. */
|
|
108
|
+
readonly MAX_BATCH: 25;
|
|
109
|
+
/**
|
|
110
|
+
* Times one ask is sent again after the network or the platform failed it. The SAME ask, under
|
|
111
|
+
* the same `ask` number, so the platform answers it once: a resend never advances the drive twice.
|
|
112
|
+
*/
|
|
113
|
+
readonly RETRIES: 4;
|
|
114
|
+
/** The first wait before asking again; it doubles each time (0.5s, 1s, 2s, 4s). */
|
|
115
|
+
readonly RETRY_BASE_MS: 500;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Whether an ask that came back with this status is worth sending again: the platform or the network
|
|
119
|
+
* failed it (5xx, 429, 408). A refusal (4xx) is the platform's answer, and asking again changes nothing.
|
|
120
|
+
*/
|
|
121
|
+
export declare const sessionAskRetryable: (status: number) => boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Read the platform's answer. Never throws: an answer that does not read is "done", because a drive
|
|
124
|
+
* that cannot understand its orders must stop rather than guess. A call that does not read is
|
|
125
|
+
* dropped; the platform sees no result for its `seq` and decides what that means.
|
|
126
|
+
*/
|
|
127
|
+
export declare function parseToolSessionReply(raw: unknown): ToolSessionReply;
|
|
128
|
+
/** How much a platform notice matters to the person reading it. */
|
|
129
|
+
export declare const LinkNoticeLevel: {
|
|
130
|
+
readonly INFO: "info";
|
|
131
|
+
readonly WARN: "warn";
|
|
132
|
+
/** Their Reticle is older than what the platform can use: what to run to update it. */
|
|
133
|
+
readonly UPDATE: "update";
|
|
134
|
+
};
|
|
135
|
+
export type LinkNoticeLevel = (typeof LinkNoticeLevel)[keyof typeof LinkNoticeLevel];
|
|
136
|
+
/**
|
|
137
|
+
* Something the platform tells the person through their daemon: "update Reticle to drive with every
|
|
138
|
+
* option". The one way a platform reaches a daemon it cannot change, so it is kept to a sentence.
|
|
139
|
+
*/
|
|
140
|
+
export interface LinkNotice {
|
|
141
|
+
level: LinkNoticeLevel;
|
|
142
|
+
text: string;
|
|
143
|
+
url?: string;
|
|
144
|
+
}
|
|
145
|
+
export declare const LINK_NOTICE_MAX = 3;
|
|
146
|
+
export declare const LINK_NOTICE_TEXT_MAX = 300;
|
|
147
|
+
/** Read the platform's notices; one that does not read is dropped, never shown half-read. */
|
|
148
|
+
export declare function parseLinkNotices(raw: unknown): LinkNotice[];
|
|
149
|
+
/** The platform's paths the daemon calls, all with its machine key. */
|
|
150
|
+
export declare const LinkPath: {
|
|
151
|
+
/** The apps this machine has connected; answered with apps to open and whether a drive waits. */
|
|
152
|
+
readonly APPS: "/v1/harness/local-apps";
|
|
153
|
+
/** The next drive for this project, or null. */
|
|
154
|
+
readonly NEXT_DRIVE: "/v1/harness/local-drives/next";
|
|
155
|
+
/** How a drive ended. */
|
|
156
|
+
readonly driveResult: (id: string) => string;
|
|
157
|
+
/** A picture of the driven page. */
|
|
158
|
+
readonly driveFrames: (id: string) => string;
|
|
159
|
+
/** One turn of a tool session: results in, next calls out. */
|
|
160
|
+
readonly driveSession: (id: string) => string;
|
|
161
|
+
};
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The link between a person's daemon and the Reticle platform: what each says to the other.
|
|
3
|
+
*
|
|
4
|
+
* The platform deploys any day; the daemon only changes when somebody upgrades it. So this contract
|
|
5
|
+
* is built to let a newer platform ask an older daemon for things, and an older platform keep working
|
|
6
|
+
* with a newer daemon:
|
|
7
|
+
*
|
|
8
|
+
* - The daemon says which version of this link it speaks and what it can do (`LinkCapability`), on
|
|
9
|
+
* every report. The platform offers a person only what their machine said it can do, and never
|
|
10
|
+
* infers a capability from a version number.
|
|
11
|
+
* - A drive arrives with a `DriveSpec`. Every field is read on its own; one the daemon does not know,
|
|
12
|
+
* or cannot honour, is reported back as ignored with a reason. A drive never fails because the
|
|
13
|
+
* platform asked for more than this daemon understands.
|
|
14
|
+
* - A drive in `platform` mode is a tool session: the platform decides every step and the daemon
|
|
15
|
+
* only runs Reticle's own tools and returns their raw results. Planning, personas, repeats for
|
|
16
|
+
* flakiness, judging and the summary all live on the platform, so they change without a release.
|
|
17
|
+
*
|
|
18
|
+
* Every arrow points out from the daemon: it asks, the platform answers. Nothing listens for the
|
|
19
|
+
* platform on the person's machine.
|
|
20
|
+
*/
|
|
21
|
+
import { z } from 'zod';
|
|
22
|
+
import { HudVisibility } from './constants/hud-use.js';
|
|
23
|
+
/** Bumped only for a change an older reader would MISREAD. A new field is not one. */
|
|
24
|
+
export const PLATFORM_LINK_VERSION = 1;
|
|
25
|
+
/** What a daemon can do for the platform, as it reports it. */
|
|
26
|
+
export const LinkCapability = {
|
|
27
|
+
/** Reads a `DriveSpec`, and reports what it applied and what it ignored. */
|
|
28
|
+
DRIVE_SPEC: 'drive-spec',
|
|
29
|
+
/** Drives the person's own open tab. */
|
|
30
|
+
TARGET_TAB: 'target:tab',
|
|
31
|
+
/** Opens the app in a browser of its own with no window. */
|
|
32
|
+
TARGET_HEADLESS: 'target:headless',
|
|
33
|
+
/** Opens the app in a browser window the person can watch. */
|
|
34
|
+
TARGET_HEADED: 'target:headed',
|
|
35
|
+
/** Shows, hides or removes the HUD on the page it drives. */
|
|
36
|
+
HUD: 'hud',
|
|
37
|
+
/** Runs a drive the platform orchestrates, one batch of tool calls at a time. */
|
|
38
|
+
TOOL_SESSION: 'tool-session',
|
|
39
|
+
/** Sends pictures of the page while it drives. */
|
|
40
|
+
FRAMES: 'frames',
|
|
41
|
+
};
|
|
42
|
+
/** Where a drive runs. */
|
|
43
|
+
export const DriveTarget = {
|
|
44
|
+
/** A tab the person already has open. Their HUD shows it happening. */
|
|
45
|
+
TAB: 'tab',
|
|
46
|
+
/** A fresh browser context with no window. */
|
|
47
|
+
HEADLESS: 'headless',
|
|
48
|
+
/** A fresh browser window on the person's screen. */
|
|
49
|
+
HEADED: 'headed',
|
|
50
|
+
};
|
|
51
|
+
/** Who decides each step of a drive. */
|
|
52
|
+
export const DriveMode = {
|
|
53
|
+
/** The daemon's own Harness plans and judges it. What every daemon before this link did. */
|
|
54
|
+
LOCAL: 'local',
|
|
55
|
+
/** The platform decides every step over a tool session; the daemon only runs tools. */
|
|
56
|
+
PLATFORM: 'platform',
|
|
57
|
+
};
|
|
58
|
+
/** Why a field of a spec was not applied. */
|
|
59
|
+
export const SpecIgnoredReason = {
|
|
60
|
+
/** This daemon does not know the field: the platform is newer. */
|
|
61
|
+
UNKNOWN: 'unknown',
|
|
62
|
+
/** The value did not read as the field's type. */
|
|
63
|
+
INVALID: 'invalid',
|
|
64
|
+
/** Known and valid, but this machine cannot do it right now (no browser, no HUD on the page). */
|
|
65
|
+
UNAVAILABLE: 'unavailable',
|
|
66
|
+
};
|
|
67
|
+
const PERSONA_MAX = 2_000;
|
|
68
|
+
const STEPS_MAX = 500;
|
|
69
|
+
/** Each field of a spec, validated on its own so one bad field never costs the others. */
|
|
70
|
+
const SPEC_FIELDS = {
|
|
71
|
+
target: z.enum([DriveTarget.TAB, DriveTarget.HEADLESS, DriveTarget.HEADED]),
|
|
72
|
+
mode: z.enum([DriveMode.LOCAL, DriveMode.PLATFORM]),
|
|
73
|
+
url: z
|
|
74
|
+
.string()
|
|
75
|
+
.url()
|
|
76
|
+
.refine((u) => /^https?:/i.test(u)),
|
|
77
|
+
hud: z.enum([HudVisibility.SHOWN, HudVisibility.HIDDEN, HudVisibility.REMOVED]),
|
|
78
|
+
persona: z.string().min(1).max(PERSONA_MAX),
|
|
79
|
+
maxSteps: z.number().int().min(1).max(STEPS_MAX),
|
|
80
|
+
record: z.boolean(),
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Read a spec as far as it can be read. Never throws: a field that does not validate, or that this
|
|
84
|
+
* daemon does not know, is reported in `ignored` and the rest still apply.
|
|
85
|
+
*/
|
|
86
|
+
export function parseDriveSpec(raw) {
|
|
87
|
+
const ignored = [];
|
|
88
|
+
const spec = {};
|
|
89
|
+
if ('object' !== typeof raw || null === raw || Array.isArray(raw))
|
|
90
|
+
return { spec, ignored };
|
|
91
|
+
for (const [field, value] of Object.entries(raw)) {
|
|
92
|
+
const schema = SPEC_FIELDS[field];
|
|
93
|
+
if (schema === undefined) {
|
|
94
|
+
ignored.push({ field, reason: SpecIgnoredReason.UNKNOWN });
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
const parsed = schema.safeParse(value);
|
|
98
|
+
if (parsed.success)
|
|
99
|
+
spec[field] = parsed.data;
|
|
100
|
+
else
|
|
101
|
+
ignored.push({ field, reason: SpecIgnoredReason.INVALID });
|
|
102
|
+
}
|
|
103
|
+
return { spec, ignored };
|
|
104
|
+
}
|
|
105
|
+
/** Bounds a daemon holds a tool session to, whatever the platform asks. */
|
|
106
|
+
export const TOOL_SESSION_LIMITS = {
|
|
107
|
+
/** Calls one drive may make in all: a loop on the platform must not drive forever. */
|
|
108
|
+
MAX_CALLS: 1_000,
|
|
109
|
+
/** Calls taken from one answer; the rest are not run. */
|
|
110
|
+
MAX_BATCH: 25,
|
|
111
|
+
/**
|
|
112
|
+
* Times one ask is sent again after the network or the platform failed it. The SAME ask, under
|
|
113
|
+
* the same `ask` number, so the platform answers it once: a resend never advances the drive twice.
|
|
114
|
+
*/
|
|
115
|
+
RETRIES: 4,
|
|
116
|
+
/** The first wait before asking again; it doubles each time (0.5s, 1s, 2s, 4s). */
|
|
117
|
+
RETRY_BASE_MS: 500,
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Whether an ask that came back with this status is worth sending again: the platform or the network
|
|
121
|
+
* failed it (5xx, 429, 408). A refusal (4xx) is the platform's answer, and asking again changes nothing.
|
|
122
|
+
*/
|
|
123
|
+
export const sessionAskRetryable = (status) => 500 <= status || 429 === status || 408 === status;
|
|
124
|
+
const SessionCallSchema = z.object({
|
|
125
|
+
seq: z.number().int().nonnegative(),
|
|
126
|
+
tool: z.string().min(1).max(100),
|
|
127
|
+
args: z.record(z.unknown()).default({}),
|
|
128
|
+
});
|
|
129
|
+
/**
|
|
130
|
+
* Read the platform's answer. Never throws: an answer that does not read is "done", because a drive
|
|
131
|
+
* that cannot understand its orders must stop rather than guess. A call that does not read is
|
|
132
|
+
* dropped; the platform sees no result for its `seq` and decides what that means.
|
|
133
|
+
*/
|
|
134
|
+
export function parseToolSessionReply(raw) {
|
|
135
|
+
if ('object' !== typeof raw || null === raw)
|
|
136
|
+
return { calls: [], done: true };
|
|
137
|
+
const record = raw;
|
|
138
|
+
const calls = (Array.isArray(record.calls) ? record.calls : [])
|
|
139
|
+
.slice(0, TOOL_SESSION_LIMITS.MAX_BATCH)
|
|
140
|
+
.flatMap((call) => {
|
|
141
|
+
const parsed = SessionCallSchema.safeParse(call);
|
|
142
|
+
return parsed.success ? [parsed.data] : [];
|
|
143
|
+
});
|
|
144
|
+
return { calls, done: true === record.done || 0 === calls.length };
|
|
145
|
+
}
|
|
146
|
+
/** How much a platform notice matters to the person reading it. */
|
|
147
|
+
export const LinkNoticeLevel = {
|
|
148
|
+
INFO: 'info',
|
|
149
|
+
WARN: 'warn',
|
|
150
|
+
/** Their Reticle is older than what the platform can use: what to run to update it. */
|
|
151
|
+
UPDATE: 'update',
|
|
152
|
+
};
|
|
153
|
+
export const LINK_NOTICE_MAX = 3;
|
|
154
|
+
export const LINK_NOTICE_TEXT_MAX = 300;
|
|
155
|
+
/** Read the platform's notices; one that does not read is dropped, never shown half-read. */
|
|
156
|
+
export function parseLinkNotices(raw) {
|
|
157
|
+
const levels = new Set(Object.values(LinkNoticeLevel));
|
|
158
|
+
return (Array.isArray(raw) ? raw : [])
|
|
159
|
+
.flatMap((entry) => {
|
|
160
|
+
if ('object' !== typeof entry || null === entry)
|
|
161
|
+
return [];
|
|
162
|
+
const notice = entry;
|
|
163
|
+
const text = 'string' === typeof notice.text ? notice.text.trim() : '';
|
|
164
|
+
if ('string' !== typeof notice.level || !levels.has(notice.level) || 0 === text.length)
|
|
165
|
+
return [];
|
|
166
|
+
const url = 'string' === typeof notice.url && /^https?:\/\//i.test(notice.url) ? notice.url : undefined;
|
|
167
|
+
return [
|
|
168
|
+
{
|
|
169
|
+
level: notice.level,
|
|
170
|
+
text: text.slice(0, LINK_NOTICE_TEXT_MAX),
|
|
171
|
+
...(url === undefined ? {} : { url }),
|
|
172
|
+
},
|
|
173
|
+
];
|
|
174
|
+
})
|
|
175
|
+
.slice(0, LINK_NOTICE_MAX);
|
|
176
|
+
}
|
|
177
|
+
/** The platform's paths the daemon calls, all with its machine key. */
|
|
178
|
+
export const LinkPath = {
|
|
179
|
+
/** The apps this machine has connected; answered with apps to open and whether a drive waits. */
|
|
180
|
+
APPS: '/v1/harness/local-apps',
|
|
181
|
+
/** The next drive for this project, or null. */
|
|
182
|
+
NEXT_DRIVE: '/v1/harness/local-drives/next',
|
|
183
|
+
/** How a drive ended. */
|
|
184
|
+
driveResult: (id) => `/v1/harness/local-drives/${encodeURIComponent(id)}`,
|
|
185
|
+
/** A picture of the driven page. */
|
|
186
|
+
driveFrames: (id) => `/v1/harness/local-drives/${encodeURIComponent(id)}/frames`,
|
|
187
|
+
/** One turn of a tool session: results in, next calls out. */
|
|
188
|
+
driveSession: (id) => `/v1/harness/local-drives/${encodeURIComponent(id)}/session`,
|
|
189
|
+
};
|
package/dist/wire/types.d.ts
CHANGED
|
@@ -234,6 +234,13 @@ export interface QueryEmptyHint {
|
|
|
234
234
|
* stays exact; the miss answers.
|
|
235
235
|
*/
|
|
236
236
|
nameNearMiss?: string[];
|
|
237
|
+
/**
|
|
238
|
+
* Present only when a TESTID search missed and the value IS on the page under a different test-id
|
|
239
|
+
* attribute (`data-test-subj`, `data-cy`, ...). The testid locator reads one attribute; naming the
|
|
240
|
+
* one that holds the value turns "matched no element" into a one-line config fix
|
|
241
|
+
* (`testIdAttribute` in `.reticle.json`).
|
|
242
|
+
*/
|
|
243
|
+
testidFoundUnder?: string;
|
|
237
244
|
}
|
|
238
245
|
/** Result of the QUERY command / reticle_query tool. `hint` present ONLY on zero matches. */
|
|
239
246
|
export interface QueryResult {
|
|
@@ -23,6 +23,13 @@ export declare const NoSessionReason: {
|
|
|
23
23
|
readonly LEASE_EXPIRED: "lease_expired";
|
|
24
24
|
/** Connected before; the tab was closed, navigated away, or hard-reloaded. */
|
|
25
25
|
readonly TAB_GONE: "tab_gone";
|
|
26
|
+
/**
|
|
27
|
+
* Connected before, and the SDK reported the page navigating away just before the socket
|
|
28
|
+
* closed (#1256). A load-time `location.assign` to an uninstrumented page used to read as
|
|
29
|
+
* TAB_GONE — the daemon only saw the socket close. This is the departure note outranking the
|
|
30
|
+
* hedge: the tab was not closed, it left for somewhere named.
|
|
31
|
+
*/
|
|
32
|
+
readonly NAVIGATED_AWAY: "navigated_away";
|
|
26
33
|
/**
|
|
27
34
|
* Connected before, and the route the tab was on answers 5xx right now. A server error tears the
|
|
28
35
|
* page down and the SDK never reconnects, so it used to read as TAB_GONE — the URL was known, and
|
|
@@ -23,6 +23,13 @@ export const NoSessionReason = {
|
|
|
23
23
|
LEASE_EXPIRED: 'lease_expired',
|
|
24
24
|
/** Connected before; the tab was closed, navigated away, or hard-reloaded. */
|
|
25
25
|
TAB_GONE: 'tab_gone',
|
|
26
|
+
/**
|
|
27
|
+
* Connected before, and the SDK reported the page navigating away just before the socket
|
|
28
|
+
* closed (#1256). A load-time `location.assign` to an uninstrumented page used to read as
|
|
29
|
+
* TAB_GONE — the daemon only saw the socket close. This is the departure note outranking the
|
|
30
|
+
* hedge: the tab was not closed, it left for somewhere named.
|
|
31
|
+
*/
|
|
32
|
+
NAVIGATED_AWAY: 'navigated_away',
|
|
26
33
|
/**
|
|
27
34
|
* Connected before, and the route the tab was on answers 5xx right now. A server error tears the
|
|
28
35
|
* page down and the SDK never reconnects, so it used to read as TAB_GONE — the URL was known, and
|
package/dist/words/notices.js
CHANGED
|
@@ -62,8 +62,10 @@ export const THROTTLED_WARNING = 'tab throttled; timer/rAF/pointer gestures may
|
|
|
62
62
|
* failure. The CLI escape hatch is named second; an MCP-only agent has no shell.
|
|
63
63
|
*/
|
|
64
64
|
export const THROTTLED_STARVED_NOTE = 'this tab is throttled and has not rendered; a miss here is not evidence the UI is absent. ' +
|
|
65
|
-
'
|
|
66
|
-
'
|
|
65
|
+
'Bring its window to the front and retry. A web tab can instead be driven in a scriptable context: ' +
|
|
66
|
+
'reticle_run { tool: "reticle_lease", args: { action: "acquire", url } } ' +
|
|
67
|
+
'(the human can run `reticle drive <url>` if they have a shell). Never for a desktop app: a lease ' +
|
|
68
|
+
"is a browser, with none of the app's IPC.";
|
|
67
69
|
/**
|
|
68
70
|
* Carried by a `console absent` pass whose window starts where the SDK attached.
|
|
69
71
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reticlehq/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "The Reticle foundation: the shared wire contract — types, zod schemas, constants, messages, and the isomorphic kernel that every Reticle package (browser SDK, server, kits, test harness) imports. Depends only on zod and open-verification.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|