@reticlehq/core 1.3.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -88
- package/dist/brand.d.ts +21 -0
- package/dist/brand.d.ts.map +1 -0
- package/dist/brand.js +16 -0
- package/dist/brand.js.map +1 -0
- package/dist/constants.d.ts +371 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +343 -0
- package/dist/constants.js.map +1 -0
- package/dist/flow-constants.d.ts +175 -0
- package/dist/flow-constants.d.ts.map +1 -0
- package/dist/flow-constants.js +162 -0
- package/dist/flow-constants.js.map +1 -0
- package/dist/flow-types.d.ts +1182 -0
- package/dist/flow-types.d.ts.map +1 -0
- package/dist/flow-types.js +144 -0
- package/dist/flow-types.js.map +1 -0
- package/dist/index.d.ts +13 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -5563
- package/dist/index.js.map +1 -0
- package/dist/messages.d.ts +424 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +103 -0
- package/dist/messages.js.map +1 -0
- package/dist/notices.d.ts +47 -0
- package/dist/notices.d.ts.map +1 -0
- package/dist/notices.js +51 -0
- package/dist/notices.js.map +1 -0
- package/dist/schema/command-message.json +41 -0
- package/dist/schema/command-result.json +34 -0
- package/dist/schema/event-message.json +77 -0
- package/dist/schema/event-type.json +35 -0
- package/dist/schema/hello-message.json +59 -0
- package/dist/schema/reticle-event.json +63 -0
- package/dist/schema/reticle-message.json +193 -0
- package/dist/security.d.ts +5 -0
- package/dist/security.d.ts.map +1 -0
- package/dist/security.js +22 -0
- package/dist/security.js.map +1 -0
- package/dist/session-constants.d.ts +116 -0
- package/dist/session-constants.d.ts.map +1 -0
- package/dist/session-constants.js +113 -0
- package/dist/session-constants.js.map +1 -0
- package/dist/state-select.d.ts +23 -0
- package/dist/state-select.d.ts.map +1 -0
- package/dist/state-select.js +60 -0
- package/dist/state-select.js.map +1 -0
- package/dist/toon.d.ts +44 -0
- package/dist/toon.d.ts.map +1 -0
- package/dist/toon.js +153 -0
- package/dist/toon.js.map +1 -0
- package/dist/types.d.ts +833 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +165 -0
- package/dist/types.js.map +1 -0
- package/dist/upgrade.d.ts +74 -0
- package/dist/upgrade.d.ts.map +1 -0
- package/dist/upgrade.js +88 -0
- package/dist/upgrade.js.map +1 -0
- package/dist/verification-run.d.ts +1195 -0
- package/dist/verification-run.d.ts.map +1 -0
- package/dist/verification-run.js +261 -0
- package/dist/verification-run.js.map +1 -0
- package/package.json +32 -79
- package/dist/babel.d.ts +0 -7
- package/dist/babel.js +0 -32
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -11273
- package/dist/eslint.d.ts +0 -1
- package/dist/eslint.js +0 -134
- package/dist/loader.cjs +0 -52
- package/dist/next.d.ts +0 -21
- package/dist/next.js +0 -24
- package/dist/server.d.ts +0 -1
- package/dist/server.js +0 -9495
- package/dist/test.d.ts +0 -1
- package/dist/test.js +0 -9377
- package/dist/vite.d.ts +0 -1
- package/dist/vite.js +0 -196
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Live-control: the narrowed payload of a HUMAN_CONTROL event. The server safeParses
|
|
4
|
+
* `event.data` against this at the inbound boundary (unknown → narrowed; never `any`).
|
|
5
|
+
*/
|
|
6
|
+
export declare const HumanControlDataSchema: z.ZodObject<{
|
|
7
|
+
kind: z.ZodNativeEnum<{
|
|
8
|
+
readonly PAUSE: "pause";
|
|
9
|
+
readonly RESUME: "resume";
|
|
10
|
+
readonly END: "end";
|
|
11
|
+
readonly MESSAGE: "message";
|
|
12
|
+
readonly REPLAY: "replay";
|
|
13
|
+
}>;
|
|
14
|
+
text: z.ZodOptional<z.ZodString>;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
kind: "pause" | "resume" | "end" | "message" | "replay";
|
|
17
|
+
text?: string | undefined;
|
|
18
|
+
}, {
|
|
19
|
+
kind: "pause" | "resume" | "end" | "message" | "replay";
|
|
20
|
+
text?: string | undefined;
|
|
21
|
+
}>;
|
|
22
|
+
export type HumanControlData = z.infer<typeof HumanControlDataSchema>;
|
|
23
|
+
/**
|
|
24
|
+
* Human review: the narrowed payload of a HUMAN_MARK event. A human flagged a mistake pinned to an
|
|
25
|
+
* element on the running page; the server safeParses `event.data` against this at the inbound
|
|
26
|
+
* boundary (unknown → narrowed; never `any`) and stores it for the agent to drain.
|
|
27
|
+
*
|
|
28
|
+
* `anchor` is the re-resolvable element address (auto-anchor's string, e.g.
|
|
29
|
+
* `component:Submit@src/Checkout.tsx:42`); `strategy` is its durability tier; `source` is the
|
|
30
|
+
* stamped file:line when the framework provided one — the single most useful field for the agent,
|
|
31
|
+
* because it points straight at the code to fix.
|
|
32
|
+
*/
|
|
33
|
+
export declare const HumanMarkDataSchema: z.ZodObject<{
|
|
34
|
+
note: z.ZodString;
|
|
35
|
+
anchor: z.ZodString;
|
|
36
|
+
strategy: z.ZodNativeEnum<{
|
|
37
|
+
readonly TESTID: "testid";
|
|
38
|
+
readonly COMPONENT: "component";
|
|
39
|
+
readonly ROLE: "role";
|
|
40
|
+
readonly POSITION: "position";
|
|
41
|
+
}>;
|
|
42
|
+
/** Human-legible element label (role + accessible name / text), to show the agent what was flagged. */
|
|
43
|
+
label: z.ZodOptional<z.ZodString>;
|
|
44
|
+
/** Source file:line stamped by the framework's compiler/plugin, when available. */
|
|
45
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
46
|
+
file: z.ZodString;
|
|
47
|
+
line: z.ZodNumber;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
file: string;
|
|
50
|
+
line: number;
|
|
51
|
+
}, {
|
|
52
|
+
file: string;
|
|
53
|
+
line: number;
|
|
54
|
+
}>>;
|
|
55
|
+
/** Route/URL the mark was made on, so the agent can reproduce the context. */
|
|
56
|
+
route: z.ZodOptional<z.ZodString>;
|
|
57
|
+
}, "strip", z.ZodTypeAny, {
|
|
58
|
+
note: string;
|
|
59
|
+
anchor: string;
|
|
60
|
+
strategy: "testid" | "role" | "component" | "position";
|
|
61
|
+
label?: string | undefined;
|
|
62
|
+
source?: {
|
|
63
|
+
file: string;
|
|
64
|
+
line: number;
|
|
65
|
+
} | undefined;
|
|
66
|
+
route?: string | undefined;
|
|
67
|
+
}, {
|
|
68
|
+
note: string;
|
|
69
|
+
anchor: string;
|
|
70
|
+
strategy: "testid" | "role" | "component" | "position";
|
|
71
|
+
label?: string | undefined;
|
|
72
|
+
source?: {
|
|
73
|
+
file: string;
|
|
74
|
+
line: number;
|
|
75
|
+
} | undefined;
|
|
76
|
+
route?: string | undefined;
|
|
77
|
+
}>;
|
|
78
|
+
export type HumanMarkData = z.infer<typeof HumanMarkDataSchema>;
|
|
79
|
+
/**
|
|
80
|
+
* A normalized observation pushed from the browser into the ring buffer.
|
|
81
|
+
* `t` is a monotonic millisecond timestamp relative to session start (clock injected,
|
|
82
|
+
* never `Date.now()` inside pure logic — see plan engineering standards).
|
|
83
|
+
*/
|
|
84
|
+
export declare const ReticleEventSchema: z.ZodObject<{
|
|
85
|
+
t: z.ZodNumber;
|
|
86
|
+
type: z.ZodNativeEnum<{
|
|
87
|
+
readonly DOM_ADDED: "dom.added";
|
|
88
|
+
readonly DOM_REMOVED: "dom.removed";
|
|
89
|
+
readonly DOM_ATTR: "dom.attr";
|
|
90
|
+
readonly DOM_TEXT: "dom.text";
|
|
91
|
+
readonly NET_REQUEST: "net.request";
|
|
92
|
+
readonly NET_PENDING: "net.pending";
|
|
93
|
+
readonly ROUTE_CHANGE: "route.change";
|
|
94
|
+
readonly CONSOLE_LOG: "console.log";
|
|
95
|
+
readonly CONSOLE_WARN: "console.warn";
|
|
96
|
+
readonly CONSOLE_ERROR: "console.error";
|
|
97
|
+
readonly ERROR_UNCAUGHT: "error.uncaught";
|
|
98
|
+
readonly VISIBLE_SHOWN: "visible.shown";
|
|
99
|
+
readonly VISIBLE_HIDDEN: "visible.hidden";
|
|
100
|
+
readonly ANIM_START: "anim.start";
|
|
101
|
+
readonly ANIM_END: "anim.end";
|
|
102
|
+
readonly SCROLL_POSITION: "scroll.position";
|
|
103
|
+
readonly REVEAL_SHOWN: "reveal.shown";
|
|
104
|
+
readonly SIGNAL: "signal";
|
|
105
|
+
readonly STATE_CHANGE: "state.change";
|
|
106
|
+
readonly PAGE_HEALTH: "page.health";
|
|
107
|
+
readonly FLOW_RECORDED: "flow.recorded";
|
|
108
|
+
readonly TRANSPORT_OVERFLOW: "transport.overflow";
|
|
109
|
+
readonly HUMAN_CONTROL: "human.control";
|
|
110
|
+
readonly HUMAN_MARK: "human.mark";
|
|
111
|
+
}>;
|
|
112
|
+
sessionId: z.ZodString;
|
|
113
|
+
/** Stable element reference this event concerns, when applicable (e.g. "e7"). */
|
|
114
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
115
|
+
/** Event-type-specific payload. Kept open here; refined per observer at the edges. */
|
|
116
|
+
data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
117
|
+
}, "strip", z.ZodTypeAny, {
|
|
118
|
+
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "route.change" | "console.log" | "console.warn" | "console.error" | "error.uncaught" | "visible.shown" | "visible.hidden" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "page.health" | "flow.recorded" | "transport.overflow" | "human.control" | "human.mark";
|
|
119
|
+
t: number;
|
|
120
|
+
sessionId: string;
|
|
121
|
+
data: Record<string, unknown>;
|
|
122
|
+
ref?: string | undefined;
|
|
123
|
+
}, {
|
|
124
|
+
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "route.change" | "console.log" | "console.warn" | "console.error" | "error.uncaught" | "visible.shown" | "visible.hidden" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "page.health" | "flow.recorded" | "transport.overflow" | "human.control" | "human.mark";
|
|
125
|
+
t: number;
|
|
126
|
+
sessionId: string;
|
|
127
|
+
ref?: string | undefined;
|
|
128
|
+
data?: Record<string, unknown> | undefined;
|
|
129
|
+
}>;
|
|
130
|
+
export type ReticleEvent = z.infer<typeof ReticleEventSchema>;
|
|
131
|
+
/** Browser announces itself to the bridge on connect. */
|
|
132
|
+
export declare const HelloMessageSchema: z.ZodObject<{
|
|
133
|
+
kind: z.ZodLiteral<"hello">;
|
|
134
|
+
protocolVersion: z.ZodLiteral<1>;
|
|
135
|
+
sessionId: z.ZodString;
|
|
136
|
+
url: z.ZodString;
|
|
137
|
+
title: z.ZodString;
|
|
138
|
+
/**
|
|
139
|
+
* Stable project identity stamped by the build plugin (e.g. "acme-web-9f3c1d"). Survives port
|
|
140
|
+
* changes, so session resolution can scope to the right app even when its dev server boots on a
|
|
141
|
+
* different port than usual. Optional for back-compat with v1.0 SDKs that don't send it; absent
|
|
142
|
+
* ⇒ resolution falls back to origin + recency.
|
|
143
|
+
*/
|
|
144
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
145
|
+
adapters: z.ZodArray<z.ZodString, "many">;
|
|
146
|
+
/** Optional browser/bridge pairing token. Required when the bridge configures one. */
|
|
147
|
+
token: z.ZodOptional<z.ZodString>;
|
|
148
|
+
/** Whether the app has advertised a capability registry (reticle.describe). */
|
|
149
|
+
hasCapabilities: z.ZodOptional<z.ZodBoolean>;
|
|
150
|
+
}, "strip", z.ZodTypeAny, {
|
|
151
|
+
kind: "hello";
|
|
152
|
+
sessionId: string;
|
|
153
|
+
protocolVersion: 1;
|
|
154
|
+
url: string;
|
|
155
|
+
title: string;
|
|
156
|
+
adapters: string[];
|
|
157
|
+
projectId?: string | undefined;
|
|
158
|
+
token?: string | undefined;
|
|
159
|
+
hasCapabilities?: boolean | undefined;
|
|
160
|
+
}, {
|
|
161
|
+
kind: "hello";
|
|
162
|
+
sessionId: string;
|
|
163
|
+
protocolVersion: 1;
|
|
164
|
+
url: string;
|
|
165
|
+
title: string;
|
|
166
|
+
adapters: string[];
|
|
167
|
+
projectId?: string | undefined;
|
|
168
|
+
token?: string | undefined;
|
|
169
|
+
hasCapabilities?: boolean | undefined;
|
|
170
|
+
}>;
|
|
171
|
+
export type HelloMessage = z.infer<typeof HelloMessageSchema>;
|
|
172
|
+
/** Agent -> browser request, routed by the bridge with a correlation id. */
|
|
173
|
+
export declare const CommandMessageSchema: z.ZodObject<{
|
|
174
|
+
kind: z.ZodLiteral<"command">;
|
|
175
|
+
id: z.ZodString;
|
|
176
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
177
|
+
name: z.ZodString;
|
|
178
|
+
args: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
179
|
+
}, "strip", z.ZodTypeAny, {
|
|
180
|
+
kind: "command";
|
|
181
|
+
id: string;
|
|
182
|
+
name: string;
|
|
183
|
+
args: Record<string, unknown>;
|
|
184
|
+
sessionId?: string | undefined;
|
|
185
|
+
}, {
|
|
186
|
+
kind: "command";
|
|
187
|
+
id: string;
|
|
188
|
+
name: string;
|
|
189
|
+
sessionId?: string | undefined;
|
|
190
|
+
args?: Record<string, unknown> | undefined;
|
|
191
|
+
}>;
|
|
192
|
+
export type CommandMessage = z.infer<typeof CommandMessageSchema>;
|
|
193
|
+
/** Browser -> agent reply to a command. */
|
|
194
|
+
export declare const CommandResultSchema: z.ZodObject<{
|
|
195
|
+
kind: z.ZodLiteral<"command_result">;
|
|
196
|
+
id: z.ZodString;
|
|
197
|
+
ok: z.ZodBoolean;
|
|
198
|
+
result: z.ZodOptional<z.ZodUnknown>;
|
|
199
|
+
error: z.ZodOptional<z.ZodString>;
|
|
200
|
+
}, "strip", z.ZodTypeAny, {
|
|
201
|
+
ok: boolean;
|
|
202
|
+
kind: "command_result";
|
|
203
|
+
id: string;
|
|
204
|
+
error?: string | undefined;
|
|
205
|
+
result?: unknown;
|
|
206
|
+
}, {
|
|
207
|
+
ok: boolean;
|
|
208
|
+
kind: "command_result";
|
|
209
|
+
id: string;
|
|
210
|
+
error?: string | undefined;
|
|
211
|
+
result?: unknown;
|
|
212
|
+
}>;
|
|
213
|
+
export type CommandResult = z.infer<typeof CommandResultSchema>;
|
|
214
|
+
/** Browser -> bridge streamed observation. */
|
|
215
|
+
export declare const EventMessageSchema: z.ZodObject<{
|
|
216
|
+
kind: z.ZodLiteral<"event">;
|
|
217
|
+
event: z.ZodObject<{
|
|
218
|
+
t: z.ZodNumber;
|
|
219
|
+
type: z.ZodNativeEnum<{
|
|
220
|
+
readonly DOM_ADDED: "dom.added";
|
|
221
|
+
readonly DOM_REMOVED: "dom.removed";
|
|
222
|
+
readonly DOM_ATTR: "dom.attr";
|
|
223
|
+
readonly DOM_TEXT: "dom.text";
|
|
224
|
+
readonly NET_REQUEST: "net.request";
|
|
225
|
+
readonly NET_PENDING: "net.pending";
|
|
226
|
+
readonly ROUTE_CHANGE: "route.change";
|
|
227
|
+
readonly CONSOLE_LOG: "console.log";
|
|
228
|
+
readonly CONSOLE_WARN: "console.warn";
|
|
229
|
+
readonly CONSOLE_ERROR: "console.error";
|
|
230
|
+
readonly ERROR_UNCAUGHT: "error.uncaught";
|
|
231
|
+
readonly VISIBLE_SHOWN: "visible.shown";
|
|
232
|
+
readonly VISIBLE_HIDDEN: "visible.hidden";
|
|
233
|
+
readonly ANIM_START: "anim.start";
|
|
234
|
+
readonly ANIM_END: "anim.end";
|
|
235
|
+
readonly SCROLL_POSITION: "scroll.position";
|
|
236
|
+
readonly REVEAL_SHOWN: "reveal.shown";
|
|
237
|
+
readonly SIGNAL: "signal";
|
|
238
|
+
readonly STATE_CHANGE: "state.change";
|
|
239
|
+
readonly PAGE_HEALTH: "page.health";
|
|
240
|
+
readonly FLOW_RECORDED: "flow.recorded";
|
|
241
|
+
readonly TRANSPORT_OVERFLOW: "transport.overflow";
|
|
242
|
+
readonly HUMAN_CONTROL: "human.control";
|
|
243
|
+
readonly HUMAN_MARK: "human.mark";
|
|
244
|
+
}>;
|
|
245
|
+
sessionId: z.ZodString;
|
|
246
|
+
/** Stable element reference this event concerns, when applicable (e.g. "e7"). */
|
|
247
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
248
|
+
/** Event-type-specific payload. Kept open here; refined per observer at the edges. */
|
|
249
|
+
data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
250
|
+
}, "strip", z.ZodTypeAny, {
|
|
251
|
+
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "route.change" | "console.log" | "console.warn" | "console.error" | "error.uncaught" | "visible.shown" | "visible.hidden" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "page.health" | "flow.recorded" | "transport.overflow" | "human.control" | "human.mark";
|
|
252
|
+
t: number;
|
|
253
|
+
sessionId: string;
|
|
254
|
+
data: Record<string, unknown>;
|
|
255
|
+
ref?: string | undefined;
|
|
256
|
+
}, {
|
|
257
|
+
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "route.change" | "console.log" | "console.warn" | "console.error" | "error.uncaught" | "visible.shown" | "visible.hidden" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "page.health" | "flow.recorded" | "transport.overflow" | "human.control" | "human.mark";
|
|
258
|
+
t: number;
|
|
259
|
+
sessionId: string;
|
|
260
|
+
ref?: string | undefined;
|
|
261
|
+
data?: Record<string, unknown> | undefined;
|
|
262
|
+
}>;
|
|
263
|
+
}, "strip", z.ZodTypeAny, {
|
|
264
|
+
event: {
|
|
265
|
+
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "route.change" | "console.log" | "console.warn" | "console.error" | "error.uncaught" | "visible.shown" | "visible.hidden" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "page.health" | "flow.recorded" | "transport.overflow" | "human.control" | "human.mark";
|
|
266
|
+
t: number;
|
|
267
|
+
sessionId: string;
|
|
268
|
+
data: Record<string, unknown>;
|
|
269
|
+
ref?: string | undefined;
|
|
270
|
+
};
|
|
271
|
+
kind: "event";
|
|
272
|
+
}, {
|
|
273
|
+
event: {
|
|
274
|
+
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "route.change" | "console.log" | "console.warn" | "console.error" | "error.uncaught" | "visible.shown" | "visible.hidden" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "page.health" | "flow.recorded" | "transport.overflow" | "human.control" | "human.mark";
|
|
275
|
+
t: number;
|
|
276
|
+
sessionId: string;
|
|
277
|
+
ref?: string | undefined;
|
|
278
|
+
data?: Record<string, unknown> | undefined;
|
|
279
|
+
};
|
|
280
|
+
kind: "event";
|
|
281
|
+
}>;
|
|
282
|
+
export type EventMessage = z.infer<typeof EventMessageSchema>;
|
|
283
|
+
export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
284
|
+
kind: z.ZodLiteral<"hello">;
|
|
285
|
+
protocolVersion: z.ZodLiteral<1>;
|
|
286
|
+
sessionId: z.ZodString;
|
|
287
|
+
url: z.ZodString;
|
|
288
|
+
title: z.ZodString;
|
|
289
|
+
/**
|
|
290
|
+
* Stable project identity stamped by the build plugin (e.g. "acme-web-9f3c1d"). Survives port
|
|
291
|
+
* changes, so session resolution can scope to the right app even when its dev server boots on a
|
|
292
|
+
* different port than usual. Optional for back-compat with v1.0 SDKs that don't send it; absent
|
|
293
|
+
* ⇒ resolution falls back to origin + recency.
|
|
294
|
+
*/
|
|
295
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
296
|
+
adapters: z.ZodArray<z.ZodString, "many">;
|
|
297
|
+
/** Optional browser/bridge pairing token. Required when the bridge configures one. */
|
|
298
|
+
token: z.ZodOptional<z.ZodString>;
|
|
299
|
+
/** Whether the app has advertised a capability registry (reticle.describe). */
|
|
300
|
+
hasCapabilities: z.ZodOptional<z.ZodBoolean>;
|
|
301
|
+
}, "strip", z.ZodTypeAny, {
|
|
302
|
+
kind: "hello";
|
|
303
|
+
sessionId: string;
|
|
304
|
+
protocolVersion: 1;
|
|
305
|
+
url: string;
|
|
306
|
+
title: string;
|
|
307
|
+
adapters: string[];
|
|
308
|
+
projectId?: string | undefined;
|
|
309
|
+
token?: string | undefined;
|
|
310
|
+
hasCapabilities?: boolean | undefined;
|
|
311
|
+
}, {
|
|
312
|
+
kind: "hello";
|
|
313
|
+
sessionId: string;
|
|
314
|
+
protocolVersion: 1;
|
|
315
|
+
url: string;
|
|
316
|
+
title: string;
|
|
317
|
+
adapters: string[];
|
|
318
|
+
projectId?: string | undefined;
|
|
319
|
+
token?: string | undefined;
|
|
320
|
+
hasCapabilities?: boolean | undefined;
|
|
321
|
+
}>, z.ZodObject<{
|
|
322
|
+
kind: z.ZodLiteral<"command">;
|
|
323
|
+
id: z.ZodString;
|
|
324
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
325
|
+
name: z.ZodString;
|
|
326
|
+
args: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
327
|
+
}, "strip", z.ZodTypeAny, {
|
|
328
|
+
kind: "command";
|
|
329
|
+
id: string;
|
|
330
|
+
name: string;
|
|
331
|
+
args: Record<string, unknown>;
|
|
332
|
+
sessionId?: string | undefined;
|
|
333
|
+
}, {
|
|
334
|
+
kind: "command";
|
|
335
|
+
id: string;
|
|
336
|
+
name: string;
|
|
337
|
+
sessionId?: string | undefined;
|
|
338
|
+
args?: Record<string, unknown> | undefined;
|
|
339
|
+
}>, z.ZodObject<{
|
|
340
|
+
kind: z.ZodLiteral<"command_result">;
|
|
341
|
+
id: z.ZodString;
|
|
342
|
+
ok: z.ZodBoolean;
|
|
343
|
+
result: z.ZodOptional<z.ZodUnknown>;
|
|
344
|
+
error: z.ZodOptional<z.ZodString>;
|
|
345
|
+
}, "strip", z.ZodTypeAny, {
|
|
346
|
+
ok: boolean;
|
|
347
|
+
kind: "command_result";
|
|
348
|
+
id: string;
|
|
349
|
+
error?: string | undefined;
|
|
350
|
+
result?: unknown;
|
|
351
|
+
}, {
|
|
352
|
+
ok: boolean;
|
|
353
|
+
kind: "command_result";
|
|
354
|
+
id: string;
|
|
355
|
+
error?: string | undefined;
|
|
356
|
+
result?: unknown;
|
|
357
|
+
}>, z.ZodObject<{
|
|
358
|
+
kind: z.ZodLiteral<"event">;
|
|
359
|
+
event: z.ZodObject<{
|
|
360
|
+
t: z.ZodNumber;
|
|
361
|
+
type: z.ZodNativeEnum<{
|
|
362
|
+
readonly DOM_ADDED: "dom.added";
|
|
363
|
+
readonly DOM_REMOVED: "dom.removed";
|
|
364
|
+
readonly DOM_ATTR: "dom.attr";
|
|
365
|
+
readonly DOM_TEXT: "dom.text";
|
|
366
|
+
readonly NET_REQUEST: "net.request";
|
|
367
|
+
readonly NET_PENDING: "net.pending";
|
|
368
|
+
readonly ROUTE_CHANGE: "route.change";
|
|
369
|
+
readonly CONSOLE_LOG: "console.log";
|
|
370
|
+
readonly CONSOLE_WARN: "console.warn";
|
|
371
|
+
readonly CONSOLE_ERROR: "console.error";
|
|
372
|
+
readonly ERROR_UNCAUGHT: "error.uncaught";
|
|
373
|
+
readonly VISIBLE_SHOWN: "visible.shown";
|
|
374
|
+
readonly VISIBLE_HIDDEN: "visible.hidden";
|
|
375
|
+
readonly ANIM_START: "anim.start";
|
|
376
|
+
readonly ANIM_END: "anim.end";
|
|
377
|
+
readonly SCROLL_POSITION: "scroll.position";
|
|
378
|
+
readonly REVEAL_SHOWN: "reveal.shown";
|
|
379
|
+
readonly SIGNAL: "signal";
|
|
380
|
+
readonly STATE_CHANGE: "state.change";
|
|
381
|
+
readonly PAGE_HEALTH: "page.health";
|
|
382
|
+
readonly FLOW_RECORDED: "flow.recorded";
|
|
383
|
+
readonly TRANSPORT_OVERFLOW: "transport.overflow";
|
|
384
|
+
readonly HUMAN_CONTROL: "human.control";
|
|
385
|
+
readonly HUMAN_MARK: "human.mark";
|
|
386
|
+
}>;
|
|
387
|
+
sessionId: z.ZodString;
|
|
388
|
+
/** Stable element reference this event concerns, when applicable (e.g. "e7"). */
|
|
389
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
390
|
+
/** Event-type-specific payload. Kept open here; refined per observer at the edges. */
|
|
391
|
+
data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
392
|
+
}, "strip", z.ZodTypeAny, {
|
|
393
|
+
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "route.change" | "console.log" | "console.warn" | "console.error" | "error.uncaught" | "visible.shown" | "visible.hidden" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "page.health" | "flow.recorded" | "transport.overflow" | "human.control" | "human.mark";
|
|
394
|
+
t: number;
|
|
395
|
+
sessionId: string;
|
|
396
|
+
data: Record<string, unknown>;
|
|
397
|
+
ref?: string | undefined;
|
|
398
|
+
}, {
|
|
399
|
+
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "route.change" | "console.log" | "console.warn" | "console.error" | "error.uncaught" | "visible.shown" | "visible.hidden" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "page.health" | "flow.recorded" | "transport.overflow" | "human.control" | "human.mark";
|
|
400
|
+
t: number;
|
|
401
|
+
sessionId: string;
|
|
402
|
+
ref?: string | undefined;
|
|
403
|
+
data?: Record<string, unknown> | undefined;
|
|
404
|
+
}>;
|
|
405
|
+
}, "strip", z.ZodTypeAny, {
|
|
406
|
+
event: {
|
|
407
|
+
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "route.change" | "console.log" | "console.warn" | "console.error" | "error.uncaught" | "visible.shown" | "visible.hidden" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "page.health" | "flow.recorded" | "transport.overflow" | "human.control" | "human.mark";
|
|
408
|
+
t: number;
|
|
409
|
+
sessionId: string;
|
|
410
|
+
data: Record<string, unknown>;
|
|
411
|
+
ref?: string | undefined;
|
|
412
|
+
};
|
|
413
|
+
kind: "event";
|
|
414
|
+
}, {
|
|
415
|
+
event: {
|
|
416
|
+
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "route.change" | "console.log" | "console.warn" | "console.error" | "error.uncaught" | "visible.shown" | "visible.hidden" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "page.health" | "flow.recorded" | "transport.overflow" | "human.control" | "human.mark";
|
|
417
|
+
t: number;
|
|
418
|
+
sessionId: string;
|
|
419
|
+
ref?: string | undefined;
|
|
420
|
+
data?: Record<string, unknown> | undefined;
|
|
421
|
+
};
|
|
422
|
+
kind: "event";
|
|
423
|
+
}>]>;
|
|
424
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;EAGjC,CAAC;AACH,MAAM,MAAM,gBAA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G,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,oBAAoB;;;;;;IA5C/B;;;;;OAKG;;;IAKH,sFAAsF;;IAEtF,+EAA+E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA1B/E,iFAAiF;;QAEjF,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6DtF,CAAC"}
|
package/dist/messages.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { EventType, RETICLE_PROTOCOL_VERSION, MessageKind, TRANSPORT_LIMITS } from './constants.js';
|
|
3
|
+
import { HumanControlKind, MarkAnchorStrategy } from './session-constants.js';
|
|
4
|
+
const sessionIdSchema = z.string().min(1).max(TRANSPORT_LIMITS.MAX_SESSION_ID_LENGTH);
|
|
5
|
+
const refSchema = z.string().max(TRANSPORT_LIMITS.MAX_REF_LENGTH);
|
|
6
|
+
/**
|
|
7
|
+
* Live-control: the narrowed payload of a HUMAN_CONTROL event. The server safeParses
|
|
8
|
+
* `event.data` against this at the inbound boundary (unknown → narrowed; never `any`).
|
|
9
|
+
*/
|
|
10
|
+
export const HumanControlDataSchema = z.object({
|
|
11
|
+
kind: z.nativeEnum(HumanControlKind),
|
|
12
|
+
text: z.string().optional(),
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* Human review: the narrowed payload of a HUMAN_MARK event. A human flagged a mistake pinned to an
|
|
16
|
+
* element on the running page; the server safeParses `event.data` against this at the inbound
|
|
17
|
+
* boundary (unknown → narrowed; never `any`) and stores it for the agent to drain.
|
|
18
|
+
*
|
|
19
|
+
* `anchor` is the re-resolvable element address (auto-anchor's string, e.g.
|
|
20
|
+
* `component:Submit@src/Checkout.tsx:42`); `strategy` is its durability tier; `source` is the
|
|
21
|
+
* stamped file:line when the framework provided one — the single most useful field for the agent,
|
|
22
|
+
* because it points straight at the code to fix.
|
|
23
|
+
*/
|
|
24
|
+
export const HumanMarkDataSchema = z.object({
|
|
25
|
+
note: z.string().min(1).max(TRANSPORT_LIMITS.MAX_MARK_NOTE_LENGTH),
|
|
26
|
+
anchor: z.string().max(TRANSPORT_LIMITS.MAX_REF_LENGTH),
|
|
27
|
+
strategy: z.nativeEnum(MarkAnchorStrategy),
|
|
28
|
+
/** Human-legible element label (role + accessible name / text), to show the agent what was flagged. */
|
|
29
|
+
label: z.string().max(TRANSPORT_LIMITS.MAX_MARK_LABEL_LENGTH).optional(),
|
|
30
|
+
/** Source file:line stamped by the framework's compiler/plugin, when available. */
|
|
31
|
+
source: z
|
|
32
|
+
.object({
|
|
33
|
+
file: z.string().max(TRANSPORT_LIMITS.MAX_URL_LENGTH),
|
|
34
|
+
line: z.number().int().min(0),
|
|
35
|
+
})
|
|
36
|
+
.optional(),
|
|
37
|
+
/** Route/URL the mark was made on, so the agent can reproduce the context. */
|
|
38
|
+
route: z.string().max(TRANSPORT_LIMITS.MAX_URL_LENGTH).optional(),
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* A normalized observation pushed from the browser into the ring buffer.
|
|
42
|
+
* `t` is a monotonic millisecond timestamp relative to session start (clock injected,
|
|
43
|
+
* never `Date.now()` inside pure logic — see plan engineering standards).
|
|
44
|
+
*/
|
|
45
|
+
export const ReticleEventSchema = z.object({
|
|
46
|
+
t: z.number(),
|
|
47
|
+
type: z.nativeEnum(EventType),
|
|
48
|
+
sessionId: sessionIdSchema,
|
|
49
|
+
/** Stable element reference this event concerns, when applicable (e.g. "e7"). */
|
|
50
|
+
ref: refSchema.optional(),
|
|
51
|
+
/** Event-type-specific payload. Kept open here; refined per observer at the edges. */
|
|
52
|
+
data: z.record(z.unknown()).default({}),
|
|
53
|
+
});
|
|
54
|
+
/** Browser announces itself to the bridge on connect. */
|
|
55
|
+
export const HelloMessageSchema = z.object({
|
|
56
|
+
kind: z.literal(MessageKind.HELLO),
|
|
57
|
+
protocolVersion: z.literal(RETICLE_PROTOCOL_VERSION),
|
|
58
|
+
sessionId: sessionIdSchema,
|
|
59
|
+
url: z.string().max(TRANSPORT_LIMITS.MAX_URL_LENGTH),
|
|
60
|
+
title: z.string().max(TRANSPORT_LIMITS.MAX_TITLE_LENGTH),
|
|
61
|
+
/**
|
|
62
|
+
* Stable project identity stamped by the build plugin (e.g. "acme-web-9f3c1d"). Survives port
|
|
63
|
+
* changes, so session resolution can scope to the right app even when its dev server boots on a
|
|
64
|
+
* different port than usual. Optional for back-compat with v1.0 SDKs that don't send it; absent
|
|
65
|
+
* ⇒ resolution falls back to origin + recency.
|
|
66
|
+
*/
|
|
67
|
+
projectId: sessionIdSchema.optional(),
|
|
68
|
+
adapters: z
|
|
69
|
+
.array(z.string().max(TRANSPORT_LIMITS.MAX_ADAPTER_NAME_LENGTH))
|
|
70
|
+
.max(TRANSPORT_LIMITS.MAX_ADAPTERS),
|
|
71
|
+
/** Optional browser/bridge pairing token. Required when the bridge configures one. */
|
|
72
|
+
token: z.string().max(TRANSPORT_LIMITS.MAX_TOKEN_LENGTH).optional(),
|
|
73
|
+
/** Whether the app has advertised a capability registry (reticle.describe). */
|
|
74
|
+
hasCapabilities: z.boolean().optional(),
|
|
75
|
+
});
|
|
76
|
+
/** Agent -> browser request, routed by the bridge with a correlation id. */
|
|
77
|
+
export const CommandMessageSchema = z.object({
|
|
78
|
+
kind: z.literal(MessageKind.COMMAND),
|
|
79
|
+
id: z.string().min(1).max(TRANSPORT_LIMITS.MAX_COMMAND_ID_LENGTH),
|
|
80
|
+
sessionId: sessionIdSchema.optional(),
|
|
81
|
+
name: z.string().min(1).max(TRANSPORT_LIMITS.MAX_COMMAND_NAME_LENGTH),
|
|
82
|
+
args: z.record(z.unknown()).default({}),
|
|
83
|
+
});
|
|
84
|
+
/** Browser -> agent reply to a command. */
|
|
85
|
+
export const CommandResultSchema = z.object({
|
|
86
|
+
kind: z.literal(MessageKind.COMMAND_RESULT),
|
|
87
|
+
id: z.string().min(1).max(TRANSPORT_LIMITS.MAX_COMMAND_ID_LENGTH),
|
|
88
|
+
ok: z.boolean(),
|
|
89
|
+
result: z.unknown().optional(),
|
|
90
|
+
error: z.string().max(TRANSPORT_LIMITS.MAX_ERROR_LENGTH).optional(),
|
|
91
|
+
});
|
|
92
|
+
/** Browser -> bridge streamed observation. */
|
|
93
|
+
export const EventMessageSchema = z.object({
|
|
94
|
+
kind: z.literal(MessageKind.EVENT),
|
|
95
|
+
event: ReticleEventSchema,
|
|
96
|
+
});
|
|
97
|
+
export const ReticleMessageSchema = z.discriminatedUnion('kind', [
|
|
98
|
+
HelloMessageSchema,
|
|
99
|
+
CommandMessageSchema,
|
|
100
|
+
CommandResultSchema,
|
|
101
|
+
EventMessageSchema,
|
|
102
|
+
]);
|
|
103
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACpG,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE9E,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;AACtF,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;AAElE;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,IAAI,EAAE,CAAC,CAAC,UAAU,CAAC,gBAAgB,CAAC;IACpC,IA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ts so the prose can grow without bloating that file.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Tone of a PRESENTER push, rides the command as optional `tone`. Lets the panel tell apart the ways
|
|
7
|
+
* a session can stop, so the human on the browser always knows the agent's mode:
|
|
8
|
+
* calm — a normal, human/agent-driven end ("done").
|
|
9
|
+
* waiting — the agent finished its turn / went idle; it will resume on your next message.
|
|
10
|
+
* ask — the agent is blocked and needs your input to continue (carries the question as text).
|
|
11
|
+
* warn — the agent stopped unexpectedly (crashed / disconnected) — switch to your terminal.
|
|
12
|
+
*/
|
|
13
|
+
export declare const PresenterTone: {
|
|
14
|
+
readonly CALM: "calm";
|
|
15
|
+
readonly WAITING: "waiting";
|
|
16
|
+
readonly ASK: "ask";
|
|
17
|
+
readonly WARN: "warn";
|
|
18
|
+
};
|
|
19
|
+
export type PresenterTone = (typeof PresenterTone)[keyof typeof PresenterTone];
|
|
20
|
+
/** Narrow an unknown wire value to a PresenterTone (defaults handled by the caller). */
|
|
21
|
+
export declare function isPresenterTone(value: unknown): value is PresenterTone;
|
|
22
|
+
/** Surfaced on act/assert results when the target tab is throttled. */
|
|
23
|
+
export declare const THROTTLED_WARNING = "tab throttled; timer/rAF/pointer gestures may silently no-op \u2014 refocus before driving";
|
|
24
|
+
/**
|
|
25
|
+
* Pushed to the panel when the last agent's MCP connection drops — the agent (any of
|
|
26
|
+
* Codex/OpenCode/Claude/Hermes) has stopped or is waiting on you. Tells the human, who is
|
|
27
|
+
* on the browser, that control is back on the terminal so a typed prompt isn't silently lost.
|
|
28
|
+
*/
|
|
29
|
+
export declare const AGENT_STOPPED_NOTICE = "Agent stopped \u2014 switch to your terminal to continue.";
|
|
30
|
+
/**
|
|
31
|
+
* Prefixes any human notes typed into the panel but not yet read when the session ends — folded into
|
|
32
|
+
* the end banner so a prompt sent in the death-race (agent stops mid-keystroke) is surfaced back to
|
|
33
|
+
* the human, copyable, instead of vanishing into a dead inbox.
|
|
34
|
+
*/
|
|
35
|
+
export declare const UNDELIVERED_NOTES_LABEL = "Undelivered (paste into your terminal):";
|
|
36
|
+
/** Panel notice when the agent yields after finishing its turn (reticle_yield mode:'waiting'). */
|
|
37
|
+
export declare const AGENT_WAITING_NOTICE = "Agent finished its turn \u2014 your move. Continue in your terminal.";
|
|
38
|
+
/** Panel notice prefix when the agent is blocked on you (reticle_yield mode:'ask'); the question follows. */
|
|
39
|
+
export declare const AGENT_ASK_NOTICE = "Agent needs your input \u2014 answer in your terminal";
|
|
40
|
+
/**
|
|
41
|
+
* Actionable companion to THROTTLED_WARNING. Surfaced on act/assert results and
|
|
42
|
+
* reticle_sessions rows when a tab is hidden/throttled and may be un-focusable/un-recoverable from
|
|
43
|
+
* the in-page SDK + CDP path. Points at the `reticle drive` escape hatch (a guaranteed scriptable
|
|
44
|
+
* context). Reticle cannot bring such a tab to front or recover it, so it names the limit instead.
|
|
45
|
+
*/
|
|
46
|
+
export declare const UNSCRIPTABLE_TAB_RECOMMENDATION = "tab hidden/throttled and may be un-focusable from here; refocus it, or run `reticle drive <url>` for a guaranteed scriptable context";
|
|
47
|
+
//# sourceMappingURL=notices.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notices.d.ts","sourceRoot":"","sources":["../src/notices.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa;;;;;CAKhB,CAAC;AACX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAE/E,wFAAwF;AACxF,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAOtE;AAED,uEAAuE;AACvE,eAAO,MAAM,iBAAiB,+FAC2D,CAAC;AAE1F;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,8DAAyD,CAAC;AAE3F;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,4CAA4C,CAAC;AAEjF,kGAAkG;AAClG,eAAO,MAAM,oBAAoB,yEACkC,CAAC;AAEpE,6GAA6G;AAC7G,eAAO,MAAM,gBAAgB,0DAAqD,CAAC;AAEnF;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,yIAC4F,CAAC"}
|
package/dist/notices.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Human-facing HUD/notice copy that crosses the wire to the panel or surfaces on tool results.
|
|
3
|
+
* Kept apart from the wire enums in constants.ts so the prose can grow without bloating that file.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Tone of a PRESENTER push, rides the command as optional `tone`. Lets the panel tell apart the ways
|
|
7
|
+
* a session can stop, so the human on the browser always knows the agent's mode:
|
|
8
|
+
* calm — a normal, human/agent-driven end ("done").
|
|
9
|
+
* waiting — the agent finished its turn / went idle; it will resume on your next message.
|
|
10
|
+
* ask — the agent is blocked and needs your input to continue (carries the question as text).
|
|
11
|
+
* warn — the agent stopped unexpectedly (crashed / disconnected) — switch to your terminal.
|
|
12
|
+
*/
|
|
13
|
+
export const PresenterTone = {
|
|
14
|
+
CALM: 'calm',
|
|
15
|
+
WAITING: 'waiting',
|
|
16
|
+
ASK: 'ask',
|
|
17
|
+
WARN: 'warn',
|
|
18
|
+
};
|
|
19
|
+
/** Narrow an unknown wire value to a PresenterTone (defaults handled by the caller). */
|
|
20
|
+
export function isPresenterTone(value) {
|
|
21
|
+
return (value === PresenterTone.CALM ||
|
|
22
|
+
value === PresenterTone.WAITING ||
|
|
23
|
+
value === PresenterTone.ASK ||
|
|
24
|
+
value === PresenterTone.WARN);
|
|
25
|
+
}
|
|
26
|
+
/** Surfaced on act/assert results when the target tab is throttled. */
|
|
27
|
+
export const THROTTLED_WARNING = 'tab throttled; timer/rAF/pointer gestures may silently no-op — refocus before driving';
|
|
28
|
+
/**
|
|
29
|
+
* Pushed to the panel when the last agent's MCP connection drops — the agent (any of
|
|
30
|
+
* Codex/OpenCode/Claude/Hermes) has stopped or is waiting on you. Tells the human, who is
|
|
31
|
+
* on the browser, that control is back on the terminal so a typed prompt isn't silently lost.
|
|
32
|
+
*/
|
|
33
|
+
export const AGENT_STOPPED_NOTICE = 'Agent stopped — switch to your terminal to continue.';
|
|
34
|
+
/**
|
|
35
|
+
* Prefixes any human notes typed into the panel but not yet read when the session ends — folded into
|
|
36
|
+
* the end banner so a prompt sent in the death-race (agent stops mid-keystroke) is surfaced back to
|
|
37
|
+
* the human, copyable, instead of vanishing into a dead inbox.
|
|
38
|
+
*/
|
|
39
|
+
export const UNDELIVERED_NOTES_LABEL = 'Undelivered (paste into your terminal):';
|
|
40
|
+
/** Panel notice when the agent yields after finishing its turn (reticle_yield mode:'waiting'). */
|
|
41
|
+
export const AGENT_WAITING_NOTICE = 'Agent finished its turn — your move. Continue in your terminal.';
|
|
42
|
+
/** Panel notice prefix when the agent is blocked on you (reticle_yield mode:'ask'); the question follows. */
|
|
43
|
+
export const AGENT_ASK_NOTICE = 'Agent needs your input — answer in your terminal';
|
|
44
|
+
/**
|
|
45
|
+
* Actionable companion to THROTTLED_WARNING. Surfaced on act/assert results and
|
|
46
|
+
* reticle_sessions rows when a tab is hidden/throttled and may be un-focusable/un-recoverable from
|
|
47
|
+
* the in-page SDK + CDP path. Points at the `reticle drive` escape hatch (a guaranteed scriptable
|
|
48
|
+
* context). Reticle cannot bring such a tab to front or recover it, so it names the limit instead.
|
|
49
|
+
*/
|
|
50
|
+
export const UNSCRIPTABLE_TAB_RECOMMENDATION = 'tab hidden/throttled and may be un-focusable from here; refocus it, or run `reticle drive <url>` for a guaranteed scriptable context';
|
|
51
|
+
//# sourceMappingURL=notices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notices.js","sourceRoot":"","sources":["../src/notices.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;CACJ,CAAC;AAGX,wFAAwF;AACxF,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,CACL,KAAK,KAAK,aAAa,CAAC,IAAI;QAC5B,KAAK,KAAK,aAAa,CAAC,OAAO;QAC/B,KAAK,KAAK,aAAa,CAAC,GAAG;QAC3B,KAAK,KAAK,aAAa,CAAC,IAAI,CAC7B,CAAC;AACJ,CAAC;AAED,uEAAuE;AACvE,MAAM,CAAC,MAAM,iBAAiB,GAC5B,uFAAuF,CAAC;AAE1F;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,sDAAsD,CAAC;AAE3F;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,yCAAyC,CAAC;AAEjF,kGAAkG;AAClG,MAAM,CAAC,MAAM,oBAAoB,GAC/B,iEAAiE,CAAC;AAEpE,6GAA6G;AAC7G,MAAM,CAAC,MAAM,gBAAgB,GAAG,kDAAkD,CAAC;AAEnF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAC1C,sIAAsI,CAAC"}
|