@clicksmith/core 0.1.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.
@@ -0,0 +1,2320 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * The current {@link CaptureBundle} schema version. Bumped whenever the wire
5
+ * format changes in a backward-incompatible way.
6
+ */
7
+ declare const CURRENT_BUNDLE_VERSION: 5;
8
+ /**
9
+ * A `source` locator is the most precise: it points at the exact file/line that
10
+ * rendered the element, recovered from a dev-only `data-loc` attribute injected
11
+ * by `@clicksmith/unplugin`.
12
+ */
13
+ declare const SourceLocatorSchema: z.ZodObject<{
14
+ kind: z.ZodLiteral<"source">;
15
+ file: z.ZodString;
16
+ line: z.ZodNumber;
17
+ column: z.ZodOptional<z.ZodNumber>;
18
+ export: z.ZodOptional<z.ZodString>;
19
+ }, "strip", z.ZodTypeAny, {
20
+ kind: "source";
21
+ file: string;
22
+ line: number;
23
+ column?: number | undefined;
24
+ export?: string | undefined;
25
+ }, {
26
+ kind: "source";
27
+ file: string;
28
+ line: number;
29
+ column?: number | undefined;
30
+ export?: string | undefined;
31
+ }>;
32
+ /** A stable, author-provided attribute such as `data-testid` or `id`. */
33
+ declare const AttrLocatorSchema: z.ZodObject<{
34
+ kind: z.ZodLiteral<"attr">;
35
+ attr: z.ZodString;
36
+ value: z.ZodString;
37
+ selector: z.ZodString;
38
+ }, "strip", z.ZodTypeAny, {
39
+ kind: "attr";
40
+ value: string;
41
+ attr: string;
42
+ selector: string;
43
+ }, {
44
+ kind: "attr";
45
+ value: string;
46
+ attr: string;
47
+ selector: string;
48
+ }>;
49
+ /** An accessibility-based locator: ARIA role + accessible name. */
50
+ declare const BehavioralLocatorSchema: z.ZodObject<{
51
+ kind: z.ZodLiteral<"behavioral">;
52
+ role: z.ZodString;
53
+ name: z.ZodString;
54
+ nth: z.ZodOptional<z.ZodNumber>;
55
+ }, "strip", z.ZodTypeAny, {
56
+ kind: "behavioral";
57
+ role: string;
58
+ name: string;
59
+ nth?: number | undefined;
60
+ }, {
61
+ kind: "behavioral";
62
+ role: string;
63
+ name: string;
64
+ nth?: number | undefined;
65
+ }>;
66
+ /** Last-resort structural locator: a CSS selector plus a DOM fingerprint. */
67
+ declare const DomLocatorSchema: z.ZodObject<{
68
+ kind: z.ZodLiteral<"dom">;
69
+ selector: z.ZodString;
70
+ fingerprint: z.ZodString;
71
+ }, "strip", z.ZodTypeAny, {
72
+ kind: "dom";
73
+ selector: string;
74
+ fingerprint: string;
75
+ }, {
76
+ kind: "dom";
77
+ selector: string;
78
+ fingerprint: string;
79
+ }>;
80
+ /**
81
+ * Discriminated union of all locator kinds, ranked exactly
82
+ * `source -> attr -> behavioral -> dom` (see `locator.ts`).
83
+ */
84
+ declare const LocatorSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
85
+ kind: z.ZodLiteral<"source">;
86
+ file: z.ZodString;
87
+ line: z.ZodNumber;
88
+ column: z.ZodOptional<z.ZodNumber>;
89
+ export: z.ZodOptional<z.ZodString>;
90
+ }, "strip", z.ZodTypeAny, {
91
+ kind: "source";
92
+ file: string;
93
+ line: number;
94
+ column?: number | undefined;
95
+ export?: string | undefined;
96
+ }, {
97
+ kind: "source";
98
+ file: string;
99
+ line: number;
100
+ column?: number | undefined;
101
+ export?: string | undefined;
102
+ }>, z.ZodObject<{
103
+ kind: z.ZodLiteral<"attr">;
104
+ attr: z.ZodString;
105
+ value: z.ZodString;
106
+ selector: z.ZodString;
107
+ }, "strip", z.ZodTypeAny, {
108
+ kind: "attr";
109
+ value: string;
110
+ attr: string;
111
+ selector: string;
112
+ }, {
113
+ kind: "attr";
114
+ value: string;
115
+ attr: string;
116
+ selector: string;
117
+ }>, z.ZodObject<{
118
+ kind: z.ZodLiteral<"behavioral">;
119
+ role: z.ZodString;
120
+ name: z.ZodString;
121
+ nth: z.ZodOptional<z.ZodNumber>;
122
+ }, "strip", z.ZodTypeAny, {
123
+ kind: "behavioral";
124
+ role: string;
125
+ name: string;
126
+ nth?: number | undefined;
127
+ }, {
128
+ kind: "behavioral";
129
+ role: string;
130
+ name: string;
131
+ nth?: number | undefined;
132
+ }>, z.ZodObject<{
133
+ kind: z.ZodLiteral<"dom">;
134
+ selector: z.ZodString;
135
+ fingerprint: z.ZodString;
136
+ }, "strip", z.ZodTypeAny, {
137
+ kind: "dom";
138
+ selector: string;
139
+ fingerprint: string;
140
+ }, {
141
+ kind: "dom";
142
+ selector: string;
143
+ fingerprint: string;
144
+ }>]>;
145
+ declare const ElementDescriptorSchema: z.ZodObject<{
146
+ tag: z.ZodString;
147
+ text: z.ZodOptional<z.ZodString>;
148
+ role: z.ZodOptional<z.ZodString>;
149
+ label: z.ZodOptional<z.ZodString>;
150
+ attrs: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
151
+ iconHints: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
152
+ }, "strip", z.ZodTypeAny, {
153
+ tag: string;
154
+ attrs: Record<string, string>;
155
+ role?: string | undefined;
156
+ text?: string | undefined;
157
+ label?: string | undefined;
158
+ iconHints?: string[] | undefined;
159
+ }, {
160
+ tag: string;
161
+ role?: string | undefined;
162
+ text?: string | undefined;
163
+ label?: string | undefined;
164
+ attrs?: Record<string, string> | undefined;
165
+ iconHints?: string[] | undefined;
166
+ }>;
167
+ declare const NearContextSchema: z.ZodObject<{
168
+ labels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
169
+ headings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
170
+ landmarks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
171
+ parentText: z.ZodOptional<z.ZodString>;
172
+ }, "strip", z.ZodTypeAny, {
173
+ labels?: string[] | undefined;
174
+ headings?: string[] | undefined;
175
+ landmarks?: string[] | undefined;
176
+ parentText?: string | undefined;
177
+ }, {
178
+ labels?: string[] | undefined;
179
+ headings?: string[] | undefined;
180
+ landmarks?: string[] | undefined;
181
+ parentText?: string | undefined;
182
+ }>;
183
+ declare const ConditionsSchema: z.ZodObject<{
184
+ viewport: z.ZodObject<{
185
+ w: z.ZodNumber;
186
+ h: z.ZodNumber;
187
+ }, "strip", z.ZodTypeAny, {
188
+ w: number;
189
+ h: number;
190
+ }, {
191
+ w: number;
192
+ h: number;
193
+ }>;
194
+ theme: z.ZodOptional<z.ZodEnum<["light", "dark"]>>;
195
+ mediaQueries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
196
+ }, "strip", z.ZodTypeAny, {
197
+ viewport: {
198
+ w: number;
199
+ h: number;
200
+ };
201
+ theme?: "light" | "dark" | undefined;
202
+ mediaQueries?: Record<string, boolean> | undefined;
203
+ }, {
204
+ viewport: {
205
+ w: number;
206
+ h: number;
207
+ };
208
+ theme?: "light" | "dark" | undefined;
209
+ mediaQueries?: Record<string, boolean> | undefined;
210
+ }>;
211
+ declare const CapturedElementSchema: z.ZodObject<{
212
+ /** 1-based identifier surfaced to users as `#N`. Stable within a session. */
213
+ id: z.ZodNumber;
214
+ ts: z.ZodString;
215
+ locator: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
216
+ kind: z.ZodLiteral<"source">;
217
+ file: z.ZodString;
218
+ line: z.ZodNumber;
219
+ column: z.ZodOptional<z.ZodNumber>;
220
+ export: z.ZodOptional<z.ZodString>;
221
+ }, "strip", z.ZodTypeAny, {
222
+ kind: "source";
223
+ file: string;
224
+ line: number;
225
+ column?: number | undefined;
226
+ export?: string | undefined;
227
+ }, {
228
+ kind: "source";
229
+ file: string;
230
+ line: number;
231
+ column?: number | undefined;
232
+ export?: string | undefined;
233
+ }>, z.ZodObject<{
234
+ kind: z.ZodLiteral<"attr">;
235
+ attr: z.ZodString;
236
+ value: z.ZodString;
237
+ selector: z.ZodString;
238
+ }, "strip", z.ZodTypeAny, {
239
+ kind: "attr";
240
+ value: string;
241
+ attr: string;
242
+ selector: string;
243
+ }, {
244
+ kind: "attr";
245
+ value: string;
246
+ attr: string;
247
+ selector: string;
248
+ }>, z.ZodObject<{
249
+ kind: z.ZodLiteral<"behavioral">;
250
+ role: z.ZodString;
251
+ name: z.ZodString;
252
+ nth: z.ZodOptional<z.ZodNumber>;
253
+ }, "strip", z.ZodTypeAny, {
254
+ kind: "behavioral";
255
+ role: string;
256
+ name: string;
257
+ nth?: number | undefined;
258
+ }, {
259
+ kind: "behavioral";
260
+ role: string;
261
+ name: string;
262
+ nth?: number | undefined;
263
+ }>, z.ZodObject<{
264
+ kind: z.ZodLiteral<"dom">;
265
+ selector: z.ZodString;
266
+ fingerprint: z.ZodString;
267
+ }, "strip", z.ZodTypeAny, {
268
+ kind: "dom";
269
+ selector: string;
270
+ fingerprint: string;
271
+ }, {
272
+ kind: "dom";
273
+ selector: string;
274
+ fingerprint: string;
275
+ }>]>;
276
+ el: z.ZodObject<{
277
+ tag: z.ZodString;
278
+ text: z.ZodOptional<z.ZodString>;
279
+ role: z.ZodOptional<z.ZodString>;
280
+ label: z.ZodOptional<z.ZodString>;
281
+ attrs: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
282
+ iconHints: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
283
+ }, "strip", z.ZodTypeAny, {
284
+ tag: string;
285
+ attrs: Record<string, string>;
286
+ role?: string | undefined;
287
+ text?: string | undefined;
288
+ label?: string | undefined;
289
+ iconHints?: string[] | undefined;
290
+ }, {
291
+ tag: string;
292
+ role?: string | undefined;
293
+ text?: string | undefined;
294
+ label?: string | undefined;
295
+ attrs?: Record<string, string> | undefined;
296
+ iconHints?: string[] | undefined;
297
+ }>;
298
+ near: z.ZodDefault<z.ZodObject<{
299
+ labels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
300
+ headings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
301
+ landmarks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
302
+ parentText: z.ZodOptional<z.ZodString>;
303
+ }, "strip", z.ZodTypeAny, {
304
+ labels?: string[] | undefined;
305
+ headings?: string[] | undefined;
306
+ landmarks?: string[] | undefined;
307
+ parentText?: string | undefined;
308
+ }, {
309
+ labels?: string[] | undefined;
310
+ headings?: string[] | undefined;
311
+ landmarks?: string[] | undefined;
312
+ parentText?: string | undefined;
313
+ }>>;
314
+ conditions: z.ZodObject<{
315
+ viewport: z.ZodObject<{
316
+ w: z.ZodNumber;
317
+ h: z.ZodNumber;
318
+ }, "strip", z.ZodTypeAny, {
319
+ w: number;
320
+ h: number;
321
+ }, {
322
+ w: number;
323
+ h: number;
324
+ }>;
325
+ theme: z.ZodOptional<z.ZodEnum<["light", "dark"]>>;
326
+ mediaQueries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
327
+ }, "strip", z.ZodTypeAny, {
328
+ viewport: {
329
+ w: number;
330
+ h: number;
331
+ };
332
+ theme?: "light" | "dark" | undefined;
333
+ mediaQueries?: Record<string, boolean> | undefined;
334
+ }, {
335
+ viewport: {
336
+ w: number;
337
+ h: number;
338
+ };
339
+ theme?: "light" | "dark" | undefined;
340
+ mediaQueries?: Record<string, boolean> | undefined;
341
+ }>;
342
+ screenshot: z.ZodOptional<z.ZodString>;
343
+ frameworkHints: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
344
+ }, "strip", z.ZodTypeAny, {
345
+ id: number;
346
+ ts: string;
347
+ locator: {
348
+ kind: "source";
349
+ file: string;
350
+ line: number;
351
+ column?: number | undefined;
352
+ export?: string | undefined;
353
+ } | {
354
+ kind: "attr";
355
+ value: string;
356
+ attr: string;
357
+ selector: string;
358
+ } | {
359
+ kind: "behavioral";
360
+ role: string;
361
+ name: string;
362
+ nth?: number | undefined;
363
+ } | {
364
+ kind: "dom";
365
+ selector: string;
366
+ fingerprint: string;
367
+ };
368
+ el: {
369
+ tag: string;
370
+ attrs: Record<string, string>;
371
+ role?: string | undefined;
372
+ text?: string | undefined;
373
+ label?: string | undefined;
374
+ iconHints?: string[] | undefined;
375
+ };
376
+ near: {
377
+ labels?: string[] | undefined;
378
+ headings?: string[] | undefined;
379
+ landmarks?: string[] | undefined;
380
+ parentText?: string | undefined;
381
+ };
382
+ conditions: {
383
+ viewport: {
384
+ w: number;
385
+ h: number;
386
+ };
387
+ theme?: "light" | "dark" | undefined;
388
+ mediaQueries?: Record<string, boolean> | undefined;
389
+ };
390
+ screenshot?: string | undefined;
391
+ frameworkHints?: Record<string, unknown> | undefined;
392
+ }, {
393
+ id: number;
394
+ ts: string;
395
+ locator: {
396
+ kind: "source";
397
+ file: string;
398
+ line: number;
399
+ column?: number | undefined;
400
+ export?: string | undefined;
401
+ } | {
402
+ kind: "attr";
403
+ value: string;
404
+ attr: string;
405
+ selector: string;
406
+ } | {
407
+ kind: "behavioral";
408
+ role: string;
409
+ name: string;
410
+ nth?: number | undefined;
411
+ } | {
412
+ kind: "dom";
413
+ selector: string;
414
+ fingerprint: string;
415
+ };
416
+ el: {
417
+ tag: string;
418
+ role?: string | undefined;
419
+ text?: string | undefined;
420
+ label?: string | undefined;
421
+ attrs?: Record<string, string> | undefined;
422
+ iconHints?: string[] | undefined;
423
+ };
424
+ conditions: {
425
+ viewport: {
426
+ w: number;
427
+ h: number;
428
+ };
429
+ theme?: "light" | "dark" | undefined;
430
+ mediaQueries?: Record<string, boolean> | undefined;
431
+ };
432
+ near?: {
433
+ labels?: string[] | undefined;
434
+ headings?: string[] | undefined;
435
+ landmarks?: string[] | undefined;
436
+ parentText?: string | undefined;
437
+ } | undefined;
438
+ screenshot?: string | undefined;
439
+ frameworkHints?: Record<string, unknown> | undefined;
440
+ }>;
441
+ declare const ExecutionModeSchema: z.ZodEnum<["plan", "edit"]>;
442
+ declare const IsolationSchema: z.ZodEnum<["worktree", "branch", "inplace"]>;
443
+ /**
444
+ * How a run should be executed. The defaults — `plan` + `worktree` + no
445
+ * auto-apply — are the immutable safe path. Any deviation (edit mode, inplace
446
+ * isolation, or auto-apply) is a risky option requiring explicit confirmation.
447
+ */
448
+ declare const ExecutionOptionsSchema: z.ZodObject<{
449
+ mode: z.ZodDefault<z.ZodEnum<["plan", "edit"]>>;
450
+ isolation: z.ZodDefault<z.ZodEnum<["worktree", "branch", "inplace"]>>;
451
+ autoApply: z.ZodDefault<z.ZodBoolean>;
452
+ agentId: z.ZodOptional<z.ZodString>;
453
+ /** Git ref the sandbox should branch from. Defaults to the current HEAD. */
454
+ baseRef: z.ZodOptional<z.ZodString>;
455
+ }, "strip", z.ZodTypeAny, {
456
+ mode: "plan" | "edit";
457
+ isolation: "worktree" | "branch" | "inplace";
458
+ autoApply: boolean;
459
+ agentId?: string | undefined;
460
+ baseRef?: string | undefined;
461
+ }, {
462
+ mode?: "plan" | "edit" | undefined;
463
+ isolation?: "worktree" | "branch" | "inplace" | undefined;
464
+ autoApply?: boolean | undefined;
465
+ agentId?: string | undefined;
466
+ baseRef?: string | undefined;
467
+ }>;
468
+ declare const ElementEnrichmentSchema: z.ZodObject<{
469
+ elementId: z.ZodNumber;
470
+ reviewContext: z.ZodOptional<z.ZodString>;
471
+ impactRadius: z.ZodOptional<z.ZodUnknown>;
472
+ affectedFlows: z.ZodOptional<z.ZodUnknown>;
473
+ }, "strip", z.ZodTypeAny, {
474
+ elementId: number;
475
+ reviewContext?: string | undefined;
476
+ impactRadius?: unknown;
477
+ affectedFlows?: unknown;
478
+ }, {
479
+ elementId: number;
480
+ reviewContext?: string | undefined;
481
+ impactRadius?: unknown;
482
+ affectedFlows?: unknown;
483
+ }>;
484
+ declare const EnrichmentSchema: z.ZodObject<{
485
+ source: z.ZodLiteral<"code-review-graph">;
486
+ perElement: z.ZodDefault<z.ZodArray<z.ZodObject<{
487
+ elementId: z.ZodNumber;
488
+ reviewContext: z.ZodOptional<z.ZodString>;
489
+ impactRadius: z.ZodOptional<z.ZodUnknown>;
490
+ affectedFlows: z.ZodOptional<z.ZodUnknown>;
491
+ }, "strip", z.ZodTypeAny, {
492
+ elementId: number;
493
+ reviewContext?: string | undefined;
494
+ impactRadius?: unknown;
495
+ affectedFlows?: unknown;
496
+ }, {
497
+ elementId: number;
498
+ reviewContext?: string | undefined;
499
+ impactRadius?: unknown;
500
+ affectedFlows?: unknown;
501
+ }>, "many">>;
502
+ warnings: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
503
+ }, "strip", z.ZodTypeAny, {
504
+ source: "code-review-graph";
505
+ perElement: {
506
+ elementId: number;
507
+ reviewContext?: string | undefined;
508
+ impactRadius?: unknown;
509
+ affectedFlows?: unknown;
510
+ }[];
511
+ warnings: string[];
512
+ }, {
513
+ source: "code-review-graph";
514
+ perElement?: {
515
+ elementId: number;
516
+ reviewContext?: string | undefined;
517
+ impactRadius?: unknown;
518
+ affectedFlows?: unknown;
519
+ }[] | undefined;
520
+ warnings?: string[] | undefined;
521
+ }>;
522
+ declare const AppContextSchema: z.ZodObject<{
523
+ url: z.ZodString;
524
+ route: z.ZodString;
525
+ page: z.ZodOptional<z.ZodString>;
526
+ }, "strip", z.ZodTypeAny, {
527
+ url: string;
528
+ route: string;
529
+ page?: string | undefined;
530
+ }, {
531
+ url: string;
532
+ route: string;
533
+ page?: string | undefined;
534
+ }>;
535
+ /**
536
+ * The finalized, agent-ready payload produced when a user submits a session.
537
+ * Version 5.
538
+ */
539
+ declare const CaptureBundleSchema: z.ZodObject<{
540
+ v: z.ZodLiteral<5>;
541
+ sessionId: z.ZodString;
542
+ submittedAt: z.ZodString;
543
+ prompt: z.ZodString;
544
+ app: z.ZodObject<{
545
+ url: z.ZodString;
546
+ route: z.ZodString;
547
+ page: z.ZodOptional<z.ZodString>;
548
+ }, "strip", z.ZodTypeAny, {
549
+ url: string;
550
+ route: string;
551
+ page?: string | undefined;
552
+ }, {
553
+ url: string;
554
+ route: string;
555
+ page?: string | undefined;
556
+ }>;
557
+ elements: z.ZodArray<z.ZodObject<{
558
+ /** 1-based identifier surfaced to users as `#N`. Stable within a session. */
559
+ id: z.ZodNumber;
560
+ ts: z.ZodString;
561
+ locator: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
562
+ kind: z.ZodLiteral<"source">;
563
+ file: z.ZodString;
564
+ line: z.ZodNumber;
565
+ column: z.ZodOptional<z.ZodNumber>;
566
+ export: z.ZodOptional<z.ZodString>;
567
+ }, "strip", z.ZodTypeAny, {
568
+ kind: "source";
569
+ file: string;
570
+ line: number;
571
+ column?: number | undefined;
572
+ export?: string | undefined;
573
+ }, {
574
+ kind: "source";
575
+ file: string;
576
+ line: number;
577
+ column?: number | undefined;
578
+ export?: string | undefined;
579
+ }>, z.ZodObject<{
580
+ kind: z.ZodLiteral<"attr">;
581
+ attr: z.ZodString;
582
+ value: z.ZodString;
583
+ selector: z.ZodString;
584
+ }, "strip", z.ZodTypeAny, {
585
+ kind: "attr";
586
+ value: string;
587
+ attr: string;
588
+ selector: string;
589
+ }, {
590
+ kind: "attr";
591
+ value: string;
592
+ attr: string;
593
+ selector: string;
594
+ }>, z.ZodObject<{
595
+ kind: z.ZodLiteral<"behavioral">;
596
+ role: z.ZodString;
597
+ name: z.ZodString;
598
+ nth: z.ZodOptional<z.ZodNumber>;
599
+ }, "strip", z.ZodTypeAny, {
600
+ kind: "behavioral";
601
+ role: string;
602
+ name: string;
603
+ nth?: number | undefined;
604
+ }, {
605
+ kind: "behavioral";
606
+ role: string;
607
+ name: string;
608
+ nth?: number | undefined;
609
+ }>, z.ZodObject<{
610
+ kind: z.ZodLiteral<"dom">;
611
+ selector: z.ZodString;
612
+ fingerprint: z.ZodString;
613
+ }, "strip", z.ZodTypeAny, {
614
+ kind: "dom";
615
+ selector: string;
616
+ fingerprint: string;
617
+ }, {
618
+ kind: "dom";
619
+ selector: string;
620
+ fingerprint: string;
621
+ }>]>;
622
+ el: z.ZodObject<{
623
+ tag: z.ZodString;
624
+ text: z.ZodOptional<z.ZodString>;
625
+ role: z.ZodOptional<z.ZodString>;
626
+ label: z.ZodOptional<z.ZodString>;
627
+ attrs: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
628
+ iconHints: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
629
+ }, "strip", z.ZodTypeAny, {
630
+ tag: string;
631
+ attrs: Record<string, string>;
632
+ role?: string | undefined;
633
+ text?: string | undefined;
634
+ label?: string | undefined;
635
+ iconHints?: string[] | undefined;
636
+ }, {
637
+ tag: string;
638
+ role?: string | undefined;
639
+ text?: string | undefined;
640
+ label?: string | undefined;
641
+ attrs?: Record<string, string> | undefined;
642
+ iconHints?: string[] | undefined;
643
+ }>;
644
+ near: z.ZodDefault<z.ZodObject<{
645
+ labels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
646
+ headings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
647
+ landmarks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
648
+ parentText: z.ZodOptional<z.ZodString>;
649
+ }, "strip", z.ZodTypeAny, {
650
+ labels?: string[] | undefined;
651
+ headings?: string[] | undefined;
652
+ landmarks?: string[] | undefined;
653
+ parentText?: string | undefined;
654
+ }, {
655
+ labels?: string[] | undefined;
656
+ headings?: string[] | undefined;
657
+ landmarks?: string[] | undefined;
658
+ parentText?: string | undefined;
659
+ }>>;
660
+ conditions: z.ZodObject<{
661
+ viewport: z.ZodObject<{
662
+ w: z.ZodNumber;
663
+ h: z.ZodNumber;
664
+ }, "strip", z.ZodTypeAny, {
665
+ w: number;
666
+ h: number;
667
+ }, {
668
+ w: number;
669
+ h: number;
670
+ }>;
671
+ theme: z.ZodOptional<z.ZodEnum<["light", "dark"]>>;
672
+ mediaQueries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
673
+ }, "strip", z.ZodTypeAny, {
674
+ viewport: {
675
+ w: number;
676
+ h: number;
677
+ };
678
+ theme?: "light" | "dark" | undefined;
679
+ mediaQueries?: Record<string, boolean> | undefined;
680
+ }, {
681
+ viewport: {
682
+ w: number;
683
+ h: number;
684
+ };
685
+ theme?: "light" | "dark" | undefined;
686
+ mediaQueries?: Record<string, boolean> | undefined;
687
+ }>;
688
+ screenshot: z.ZodOptional<z.ZodString>;
689
+ frameworkHints: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
690
+ }, "strip", z.ZodTypeAny, {
691
+ id: number;
692
+ ts: string;
693
+ locator: {
694
+ kind: "source";
695
+ file: string;
696
+ line: number;
697
+ column?: number | undefined;
698
+ export?: string | undefined;
699
+ } | {
700
+ kind: "attr";
701
+ value: string;
702
+ attr: string;
703
+ selector: string;
704
+ } | {
705
+ kind: "behavioral";
706
+ role: string;
707
+ name: string;
708
+ nth?: number | undefined;
709
+ } | {
710
+ kind: "dom";
711
+ selector: string;
712
+ fingerprint: string;
713
+ };
714
+ el: {
715
+ tag: string;
716
+ attrs: Record<string, string>;
717
+ role?: string | undefined;
718
+ text?: string | undefined;
719
+ label?: string | undefined;
720
+ iconHints?: string[] | undefined;
721
+ };
722
+ near: {
723
+ labels?: string[] | undefined;
724
+ headings?: string[] | undefined;
725
+ landmarks?: string[] | undefined;
726
+ parentText?: string | undefined;
727
+ };
728
+ conditions: {
729
+ viewport: {
730
+ w: number;
731
+ h: number;
732
+ };
733
+ theme?: "light" | "dark" | undefined;
734
+ mediaQueries?: Record<string, boolean> | undefined;
735
+ };
736
+ screenshot?: string | undefined;
737
+ frameworkHints?: Record<string, unknown> | undefined;
738
+ }, {
739
+ id: number;
740
+ ts: string;
741
+ locator: {
742
+ kind: "source";
743
+ file: string;
744
+ line: number;
745
+ column?: number | undefined;
746
+ export?: string | undefined;
747
+ } | {
748
+ kind: "attr";
749
+ value: string;
750
+ attr: string;
751
+ selector: string;
752
+ } | {
753
+ kind: "behavioral";
754
+ role: string;
755
+ name: string;
756
+ nth?: number | undefined;
757
+ } | {
758
+ kind: "dom";
759
+ selector: string;
760
+ fingerprint: string;
761
+ };
762
+ el: {
763
+ tag: string;
764
+ role?: string | undefined;
765
+ text?: string | undefined;
766
+ label?: string | undefined;
767
+ attrs?: Record<string, string> | undefined;
768
+ iconHints?: string[] | undefined;
769
+ };
770
+ conditions: {
771
+ viewport: {
772
+ w: number;
773
+ h: number;
774
+ };
775
+ theme?: "light" | "dark" | undefined;
776
+ mediaQueries?: Record<string, boolean> | undefined;
777
+ };
778
+ near?: {
779
+ labels?: string[] | undefined;
780
+ headings?: string[] | undefined;
781
+ landmarks?: string[] | undefined;
782
+ parentText?: string | undefined;
783
+ } | undefined;
784
+ screenshot?: string | undefined;
785
+ frameworkHints?: Record<string, unknown> | undefined;
786
+ }>, "many">;
787
+ execution: z.ZodObject<{
788
+ mode: z.ZodDefault<z.ZodEnum<["plan", "edit"]>>;
789
+ isolation: z.ZodDefault<z.ZodEnum<["worktree", "branch", "inplace"]>>;
790
+ autoApply: z.ZodDefault<z.ZodBoolean>;
791
+ agentId: z.ZodOptional<z.ZodString>;
792
+ /** Git ref the sandbox should branch from. Defaults to the current HEAD. */
793
+ baseRef: z.ZodOptional<z.ZodString>;
794
+ }, "strip", z.ZodTypeAny, {
795
+ mode: "plan" | "edit";
796
+ isolation: "worktree" | "branch" | "inplace";
797
+ autoApply: boolean;
798
+ agentId?: string | undefined;
799
+ baseRef?: string | undefined;
800
+ }, {
801
+ mode?: "plan" | "edit" | undefined;
802
+ isolation?: "worktree" | "branch" | "inplace" | undefined;
803
+ autoApply?: boolean | undefined;
804
+ agentId?: string | undefined;
805
+ baseRef?: string | undefined;
806
+ }>;
807
+ enrichment: z.ZodOptional<z.ZodObject<{
808
+ source: z.ZodLiteral<"code-review-graph">;
809
+ perElement: z.ZodDefault<z.ZodArray<z.ZodObject<{
810
+ elementId: z.ZodNumber;
811
+ reviewContext: z.ZodOptional<z.ZodString>;
812
+ impactRadius: z.ZodOptional<z.ZodUnknown>;
813
+ affectedFlows: z.ZodOptional<z.ZodUnknown>;
814
+ }, "strip", z.ZodTypeAny, {
815
+ elementId: number;
816
+ reviewContext?: string | undefined;
817
+ impactRadius?: unknown;
818
+ affectedFlows?: unknown;
819
+ }, {
820
+ elementId: number;
821
+ reviewContext?: string | undefined;
822
+ impactRadius?: unknown;
823
+ affectedFlows?: unknown;
824
+ }>, "many">>;
825
+ warnings: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
826
+ }, "strip", z.ZodTypeAny, {
827
+ source: "code-review-graph";
828
+ perElement: {
829
+ elementId: number;
830
+ reviewContext?: string | undefined;
831
+ impactRadius?: unknown;
832
+ affectedFlows?: unknown;
833
+ }[];
834
+ warnings: string[];
835
+ }, {
836
+ source: "code-review-graph";
837
+ perElement?: {
838
+ elementId: number;
839
+ reviewContext?: string | undefined;
840
+ impactRadius?: unknown;
841
+ affectedFlows?: unknown;
842
+ }[] | undefined;
843
+ warnings?: string[] | undefined;
844
+ }>>;
845
+ }, "strip", z.ZodTypeAny, {
846
+ v: 5;
847
+ sessionId: string;
848
+ submittedAt: string;
849
+ prompt: string;
850
+ app: {
851
+ url: string;
852
+ route: string;
853
+ page?: string | undefined;
854
+ };
855
+ elements: {
856
+ id: number;
857
+ ts: string;
858
+ locator: {
859
+ kind: "source";
860
+ file: string;
861
+ line: number;
862
+ column?: number | undefined;
863
+ export?: string | undefined;
864
+ } | {
865
+ kind: "attr";
866
+ value: string;
867
+ attr: string;
868
+ selector: string;
869
+ } | {
870
+ kind: "behavioral";
871
+ role: string;
872
+ name: string;
873
+ nth?: number | undefined;
874
+ } | {
875
+ kind: "dom";
876
+ selector: string;
877
+ fingerprint: string;
878
+ };
879
+ el: {
880
+ tag: string;
881
+ attrs: Record<string, string>;
882
+ role?: string | undefined;
883
+ text?: string | undefined;
884
+ label?: string | undefined;
885
+ iconHints?: string[] | undefined;
886
+ };
887
+ near: {
888
+ labels?: string[] | undefined;
889
+ headings?: string[] | undefined;
890
+ landmarks?: string[] | undefined;
891
+ parentText?: string | undefined;
892
+ };
893
+ conditions: {
894
+ viewport: {
895
+ w: number;
896
+ h: number;
897
+ };
898
+ theme?: "light" | "dark" | undefined;
899
+ mediaQueries?: Record<string, boolean> | undefined;
900
+ };
901
+ screenshot?: string | undefined;
902
+ frameworkHints?: Record<string, unknown> | undefined;
903
+ }[];
904
+ execution: {
905
+ mode: "plan" | "edit";
906
+ isolation: "worktree" | "branch" | "inplace";
907
+ autoApply: boolean;
908
+ agentId?: string | undefined;
909
+ baseRef?: string | undefined;
910
+ };
911
+ enrichment?: {
912
+ source: "code-review-graph";
913
+ perElement: {
914
+ elementId: number;
915
+ reviewContext?: string | undefined;
916
+ impactRadius?: unknown;
917
+ affectedFlows?: unknown;
918
+ }[];
919
+ warnings: string[];
920
+ } | undefined;
921
+ }, {
922
+ v: 5;
923
+ sessionId: string;
924
+ submittedAt: string;
925
+ prompt: string;
926
+ app: {
927
+ url: string;
928
+ route: string;
929
+ page?: string | undefined;
930
+ };
931
+ elements: {
932
+ id: number;
933
+ ts: string;
934
+ locator: {
935
+ kind: "source";
936
+ file: string;
937
+ line: number;
938
+ column?: number | undefined;
939
+ export?: string | undefined;
940
+ } | {
941
+ kind: "attr";
942
+ value: string;
943
+ attr: string;
944
+ selector: string;
945
+ } | {
946
+ kind: "behavioral";
947
+ role: string;
948
+ name: string;
949
+ nth?: number | undefined;
950
+ } | {
951
+ kind: "dom";
952
+ selector: string;
953
+ fingerprint: string;
954
+ };
955
+ el: {
956
+ tag: string;
957
+ role?: string | undefined;
958
+ text?: string | undefined;
959
+ label?: string | undefined;
960
+ attrs?: Record<string, string> | undefined;
961
+ iconHints?: string[] | undefined;
962
+ };
963
+ conditions: {
964
+ viewport: {
965
+ w: number;
966
+ h: number;
967
+ };
968
+ theme?: "light" | "dark" | undefined;
969
+ mediaQueries?: Record<string, boolean> | undefined;
970
+ };
971
+ near?: {
972
+ labels?: string[] | undefined;
973
+ headings?: string[] | undefined;
974
+ landmarks?: string[] | undefined;
975
+ parentText?: string | undefined;
976
+ } | undefined;
977
+ screenshot?: string | undefined;
978
+ frameworkHints?: Record<string, unknown> | undefined;
979
+ }[];
980
+ execution: {
981
+ mode?: "plan" | "edit" | undefined;
982
+ isolation?: "worktree" | "branch" | "inplace" | undefined;
983
+ autoApply?: boolean | undefined;
984
+ agentId?: string | undefined;
985
+ baseRef?: string | undefined;
986
+ };
987
+ enrichment?: {
988
+ source: "code-review-graph";
989
+ perElement?: {
990
+ elementId: number;
991
+ reviewContext?: string | undefined;
992
+ impactRadius?: unknown;
993
+ affectedFlows?: unknown;
994
+ }[] | undefined;
995
+ warnings?: string[] | undefined;
996
+ } | undefined;
997
+ }>;
998
+ declare const SessionStatusSchema: z.ZodEnum<["active", "submitted", "expired"]>;
999
+ /**
1000
+ * An in-progress capture session held by the daemon before the user submits.
1001
+ * Finalizing a session produces a {@link CaptureBundleSchema}.
1002
+ */
1003
+ declare const SessionSchema: z.ZodObject<{
1004
+ id: z.ZodString;
1005
+ createdAt: z.ZodString;
1006
+ updatedAt: z.ZodString;
1007
+ expiresAt: z.ZodString;
1008
+ status: z.ZodDefault<z.ZodEnum<["active", "submitted", "expired"]>>;
1009
+ app: z.ZodObject<{
1010
+ url: z.ZodString;
1011
+ route: z.ZodString;
1012
+ page: z.ZodOptional<z.ZodString>;
1013
+ }, "strip", z.ZodTypeAny, {
1014
+ url: string;
1015
+ route: string;
1016
+ page?: string | undefined;
1017
+ }, {
1018
+ url: string;
1019
+ route: string;
1020
+ page?: string | undefined;
1021
+ }>;
1022
+ elements: z.ZodDefault<z.ZodArray<z.ZodObject<{
1023
+ /** 1-based identifier surfaced to users as `#N`. Stable within a session. */
1024
+ id: z.ZodNumber;
1025
+ ts: z.ZodString;
1026
+ locator: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
1027
+ kind: z.ZodLiteral<"source">;
1028
+ file: z.ZodString;
1029
+ line: z.ZodNumber;
1030
+ column: z.ZodOptional<z.ZodNumber>;
1031
+ export: z.ZodOptional<z.ZodString>;
1032
+ }, "strip", z.ZodTypeAny, {
1033
+ kind: "source";
1034
+ file: string;
1035
+ line: number;
1036
+ column?: number | undefined;
1037
+ export?: string | undefined;
1038
+ }, {
1039
+ kind: "source";
1040
+ file: string;
1041
+ line: number;
1042
+ column?: number | undefined;
1043
+ export?: string | undefined;
1044
+ }>, z.ZodObject<{
1045
+ kind: z.ZodLiteral<"attr">;
1046
+ attr: z.ZodString;
1047
+ value: z.ZodString;
1048
+ selector: z.ZodString;
1049
+ }, "strip", z.ZodTypeAny, {
1050
+ kind: "attr";
1051
+ value: string;
1052
+ attr: string;
1053
+ selector: string;
1054
+ }, {
1055
+ kind: "attr";
1056
+ value: string;
1057
+ attr: string;
1058
+ selector: string;
1059
+ }>, z.ZodObject<{
1060
+ kind: z.ZodLiteral<"behavioral">;
1061
+ role: z.ZodString;
1062
+ name: z.ZodString;
1063
+ nth: z.ZodOptional<z.ZodNumber>;
1064
+ }, "strip", z.ZodTypeAny, {
1065
+ kind: "behavioral";
1066
+ role: string;
1067
+ name: string;
1068
+ nth?: number | undefined;
1069
+ }, {
1070
+ kind: "behavioral";
1071
+ role: string;
1072
+ name: string;
1073
+ nth?: number | undefined;
1074
+ }>, z.ZodObject<{
1075
+ kind: z.ZodLiteral<"dom">;
1076
+ selector: z.ZodString;
1077
+ fingerprint: z.ZodString;
1078
+ }, "strip", z.ZodTypeAny, {
1079
+ kind: "dom";
1080
+ selector: string;
1081
+ fingerprint: string;
1082
+ }, {
1083
+ kind: "dom";
1084
+ selector: string;
1085
+ fingerprint: string;
1086
+ }>]>;
1087
+ el: z.ZodObject<{
1088
+ tag: z.ZodString;
1089
+ text: z.ZodOptional<z.ZodString>;
1090
+ role: z.ZodOptional<z.ZodString>;
1091
+ label: z.ZodOptional<z.ZodString>;
1092
+ attrs: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
1093
+ iconHints: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1094
+ }, "strip", z.ZodTypeAny, {
1095
+ tag: string;
1096
+ attrs: Record<string, string>;
1097
+ role?: string | undefined;
1098
+ text?: string | undefined;
1099
+ label?: string | undefined;
1100
+ iconHints?: string[] | undefined;
1101
+ }, {
1102
+ tag: string;
1103
+ role?: string | undefined;
1104
+ text?: string | undefined;
1105
+ label?: string | undefined;
1106
+ attrs?: Record<string, string> | undefined;
1107
+ iconHints?: string[] | undefined;
1108
+ }>;
1109
+ near: z.ZodDefault<z.ZodObject<{
1110
+ labels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1111
+ headings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1112
+ landmarks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1113
+ parentText: z.ZodOptional<z.ZodString>;
1114
+ }, "strip", z.ZodTypeAny, {
1115
+ labels?: string[] | undefined;
1116
+ headings?: string[] | undefined;
1117
+ landmarks?: string[] | undefined;
1118
+ parentText?: string | undefined;
1119
+ }, {
1120
+ labels?: string[] | undefined;
1121
+ headings?: string[] | undefined;
1122
+ landmarks?: string[] | undefined;
1123
+ parentText?: string | undefined;
1124
+ }>>;
1125
+ conditions: z.ZodObject<{
1126
+ viewport: z.ZodObject<{
1127
+ w: z.ZodNumber;
1128
+ h: z.ZodNumber;
1129
+ }, "strip", z.ZodTypeAny, {
1130
+ w: number;
1131
+ h: number;
1132
+ }, {
1133
+ w: number;
1134
+ h: number;
1135
+ }>;
1136
+ theme: z.ZodOptional<z.ZodEnum<["light", "dark"]>>;
1137
+ mediaQueries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
1138
+ }, "strip", z.ZodTypeAny, {
1139
+ viewport: {
1140
+ w: number;
1141
+ h: number;
1142
+ };
1143
+ theme?: "light" | "dark" | undefined;
1144
+ mediaQueries?: Record<string, boolean> | undefined;
1145
+ }, {
1146
+ viewport: {
1147
+ w: number;
1148
+ h: number;
1149
+ };
1150
+ theme?: "light" | "dark" | undefined;
1151
+ mediaQueries?: Record<string, boolean> | undefined;
1152
+ }>;
1153
+ screenshot: z.ZodOptional<z.ZodString>;
1154
+ frameworkHints: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1155
+ }, "strip", z.ZodTypeAny, {
1156
+ id: number;
1157
+ ts: string;
1158
+ locator: {
1159
+ kind: "source";
1160
+ file: string;
1161
+ line: number;
1162
+ column?: number | undefined;
1163
+ export?: string | undefined;
1164
+ } | {
1165
+ kind: "attr";
1166
+ value: string;
1167
+ attr: string;
1168
+ selector: string;
1169
+ } | {
1170
+ kind: "behavioral";
1171
+ role: string;
1172
+ name: string;
1173
+ nth?: number | undefined;
1174
+ } | {
1175
+ kind: "dom";
1176
+ selector: string;
1177
+ fingerprint: string;
1178
+ };
1179
+ el: {
1180
+ tag: string;
1181
+ attrs: Record<string, string>;
1182
+ role?: string | undefined;
1183
+ text?: string | undefined;
1184
+ label?: string | undefined;
1185
+ iconHints?: string[] | undefined;
1186
+ };
1187
+ near: {
1188
+ labels?: string[] | undefined;
1189
+ headings?: string[] | undefined;
1190
+ landmarks?: string[] | undefined;
1191
+ parentText?: string | undefined;
1192
+ };
1193
+ conditions: {
1194
+ viewport: {
1195
+ w: number;
1196
+ h: number;
1197
+ };
1198
+ theme?: "light" | "dark" | undefined;
1199
+ mediaQueries?: Record<string, boolean> | undefined;
1200
+ };
1201
+ screenshot?: string | undefined;
1202
+ frameworkHints?: Record<string, unknown> | undefined;
1203
+ }, {
1204
+ id: number;
1205
+ ts: string;
1206
+ locator: {
1207
+ kind: "source";
1208
+ file: string;
1209
+ line: number;
1210
+ column?: number | undefined;
1211
+ export?: string | undefined;
1212
+ } | {
1213
+ kind: "attr";
1214
+ value: string;
1215
+ attr: string;
1216
+ selector: string;
1217
+ } | {
1218
+ kind: "behavioral";
1219
+ role: string;
1220
+ name: string;
1221
+ nth?: number | undefined;
1222
+ } | {
1223
+ kind: "dom";
1224
+ selector: string;
1225
+ fingerprint: string;
1226
+ };
1227
+ el: {
1228
+ tag: string;
1229
+ role?: string | undefined;
1230
+ text?: string | undefined;
1231
+ label?: string | undefined;
1232
+ attrs?: Record<string, string> | undefined;
1233
+ iconHints?: string[] | undefined;
1234
+ };
1235
+ conditions: {
1236
+ viewport: {
1237
+ w: number;
1238
+ h: number;
1239
+ };
1240
+ theme?: "light" | "dark" | undefined;
1241
+ mediaQueries?: Record<string, boolean> | undefined;
1242
+ };
1243
+ near?: {
1244
+ labels?: string[] | undefined;
1245
+ headings?: string[] | undefined;
1246
+ landmarks?: string[] | undefined;
1247
+ parentText?: string | undefined;
1248
+ } | undefined;
1249
+ screenshot?: string | undefined;
1250
+ frameworkHints?: Record<string, unknown> | undefined;
1251
+ }>, "many">>;
1252
+ prompt: z.ZodOptional<z.ZodString>;
1253
+ /**
1254
+ * High-water mark of element ids ever assigned. Ensures `#N` ids are never
1255
+ * reused, even after the highest-numbered element is removed.
1256
+ */
1257
+ lastElementId: z.ZodDefault<z.ZodNumber>;
1258
+ }, "strip", z.ZodTypeAny, {
1259
+ status: "active" | "submitted" | "expired";
1260
+ id: string;
1261
+ app: {
1262
+ url: string;
1263
+ route: string;
1264
+ page?: string | undefined;
1265
+ };
1266
+ elements: {
1267
+ id: number;
1268
+ ts: string;
1269
+ locator: {
1270
+ kind: "source";
1271
+ file: string;
1272
+ line: number;
1273
+ column?: number | undefined;
1274
+ export?: string | undefined;
1275
+ } | {
1276
+ kind: "attr";
1277
+ value: string;
1278
+ attr: string;
1279
+ selector: string;
1280
+ } | {
1281
+ kind: "behavioral";
1282
+ role: string;
1283
+ name: string;
1284
+ nth?: number | undefined;
1285
+ } | {
1286
+ kind: "dom";
1287
+ selector: string;
1288
+ fingerprint: string;
1289
+ };
1290
+ el: {
1291
+ tag: string;
1292
+ attrs: Record<string, string>;
1293
+ role?: string | undefined;
1294
+ text?: string | undefined;
1295
+ label?: string | undefined;
1296
+ iconHints?: string[] | undefined;
1297
+ };
1298
+ near: {
1299
+ labels?: string[] | undefined;
1300
+ headings?: string[] | undefined;
1301
+ landmarks?: string[] | undefined;
1302
+ parentText?: string | undefined;
1303
+ };
1304
+ conditions: {
1305
+ viewport: {
1306
+ w: number;
1307
+ h: number;
1308
+ };
1309
+ theme?: "light" | "dark" | undefined;
1310
+ mediaQueries?: Record<string, boolean> | undefined;
1311
+ };
1312
+ screenshot?: string | undefined;
1313
+ frameworkHints?: Record<string, unknown> | undefined;
1314
+ }[];
1315
+ createdAt: string;
1316
+ updatedAt: string;
1317
+ expiresAt: string;
1318
+ lastElementId: number;
1319
+ prompt?: string | undefined;
1320
+ }, {
1321
+ id: string;
1322
+ app: {
1323
+ url: string;
1324
+ route: string;
1325
+ page?: string | undefined;
1326
+ };
1327
+ createdAt: string;
1328
+ updatedAt: string;
1329
+ expiresAt: string;
1330
+ status?: "active" | "submitted" | "expired" | undefined;
1331
+ prompt?: string | undefined;
1332
+ elements?: {
1333
+ id: number;
1334
+ ts: string;
1335
+ locator: {
1336
+ kind: "source";
1337
+ file: string;
1338
+ line: number;
1339
+ column?: number | undefined;
1340
+ export?: string | undefined;
1341
+ } | {
1342
+ kind: "attr";
1343
+ value: string;
1344
+ attr: string;
1345
+ selector: string;
1346
+ } | {
1347
+ kind: "behavioral";
1348
+ role: string;
1349
+ name: string;
1350
+ nth?: number | undefined;
1351
+ } | {
1352
+ kind: "dom";
1353
+ selector: string;
1354
+ fingerprint: string;
1355
+ };
1356
+ el: {
1357
+ tag: string;
1358
+ role?: string | undefined;
1359
+ text?: string | undefined;
1360
+ label?: string | undefined;
1361
+ attrs?: Record<string, string> | undefined;
1362
+ iconHints?: string[] | undefined;
1363
+ };
1364
+ conditions: {
1365
+ viewport: {
1366
+ w: number;
1367
+ h: number;
1368
+ };
1369
+ theme?: "light" | "dark" | undefined;
1370
+ mediaQueries?: Record<string, boolean> | undefined;
1371
+ };
1372
+ near?: {
1373
+ labels?: string[] | undefined;
1374
+ headings?: string[] | undefined;
1375
+ landmarks?: string[] | undefined;
1376
+ parentText?: string | undefined;
1377
+ } | undefined;
1378
+ screenshot?: string | undefined;
1379
+ frameworkHints?: Record<string, unknown> | undefined;
1380
+ }[] | undefined;
1381
+ lastElementId?: number | undefined;
1382
+ }>;
1383
+
1384
+ type SourceLocator = z.infer<typeof SourceLocatorSchema>;
1385
+ type AttrLocator = z.infer<typeof AttrLocatorSchema>;
1386
+ type BehavioralLocator = z.infer<typeof BehavioralLocatorSchema>;
1387
+ type DomLocator = z.infer<typeof DomLocatorSchema>;
1388
+ type Locator = z.infer<typeof LocatorSchema>;
1389
+ type LocatorKind = Locator['kind'];
1390
+ type ElementDescriptor = z.infer<typeof ElementDescriptorSchema>;
1391
+ type NearContext = z.infer<typeof NearContextSchema>;
1392
+ type Conditions = z.infer<typeof ConditionsSchema>;
1393
+ type CapturedElement = z.infer<typeof CapturedElementSchema>;
1394
+ type ExecutionMode = z.infer<typeof ExecutionModeSchema>;
1395
+ type Isolation = z.infer<typeof IsolationSchema>;
1396
+ type ExecutionOptions = z.infer<typeof ExecutionOptionsSchema>;
1397
+ type ElementEnrichment = z.infer<typeof ElementEnrichmentSchema>;
1398
+ type Enrichment = z.infer<typeof EnrichmentSchema>;
1399
+ type AppContext = z.infer<typeof AppContextSchema>;
1400
+ type CaptureBundle = z.infer<typeof CaptureBundleSchema>;
1401
+ type SessionStatus = z.infer<typeof SessionStatusSchema>;
1402
+ type Session = z.infer<typeof SessionSchema>;
1403
+ /**
1404
+ * The shape the extension sends when capturing an element — everything in a
1405
+ * {@link CapturedElement} except the daemon-assigned `id`.
1406
+ */
1407
+ type CapturedElementInput = Omit<CapturedElement, 'id'>;
1408
+
1409
+ /**
1410
+ * Platform-neutral identifier helpers. These rely only on the Web Crypto API
1411
+ * (`globalThis.crypto`), which is available in modern browsers and Node >= 20,
1412
+ * with a deterministic-enough fallback so `core` never imports `node:crypto`.
1413
+ */
1414
+ /** A new opaque session id, e.g. `cs_lt4f9q_a1b2c3d4`. */
1415
+ declare function newSessionId(now?: Date): string;
1416
+ /** A new opaque run id, e.g. `run_lt4f9q_a1b2c3d4`. */
1417
+ declare function newRunId(now?: Date): string;
1418
+ /**
1419
+ * Assign the next element id for a session. Ids are 1-based, strictly
1420
+ * increasing, and never reused — even after the highest-numbered mark is
1421
+ * removed — so user-typed references like `#2` remain stable for the life of
1422
+ * the session. Pass the session's high-water mark (`lastElementId`) so removal
1423
+ * of the top id still advances the counter.
1424
+ */
1425
+ declare function nextElementId(existingIds: readonly number[], lastSeen?: number): number;
1426
+ /** Parse a `#N` reference (e.g. `"#3"`, `"3"`, `"# 3"`) into a number. */
1427
+ declare function parseElementRef(ref: string): number | undefined;
1428
+
1429
+ /**
1430
+ * The canonical locator priority, best first. This ordering is a hard contract
1431
+ * shared by the extension (which picks the best locator it can build) and the
1432
+ * agent instructions (which teach the agent to trust higher-ranked locators).
1433
+ */
1434
+ declare const LOCATOR_PRIORITY: readonly ["source", "attr", "behavioral", "dom"];
1435
+ /** Numeric rank of a locator kind; lower is more precise. */
1436
+ declare function locatorRank(kind: LocatorKind): number;
1437
+ /**
1438
+ * Comparator for `Array.prototype.sort`, ordering locators best-first per
1439
+ * {@link LOCATOR_PRIORITY}.
1440
+ */
1441
+ declare function compareLocators(a: Locator, b: Locator): number;
1442
+ /** Return a new array of locators sorted best-first. Does not mutate input. */
1443
+ declare function rankLocators(locators: readonly Locator[]): Locator[];
1444
+ /** The single most precise locator from a list, or `undefined` if empty. */
1445
+ declare function pickBestLocator(locators: readonly Locator[]): Locator | undefined;
1446
+ /**
1447
+ * A compact, human- and agent-readable description of a locator, suitable for
1448
+ * embedding in instructions or logs.
1449
+ */
1450
+ declare function describeLocator(locator: Locator): string;
1451
+ /** Whether a locator points directly at source (the strongest signal). */
1452
+ declare function isSourceResolved(locator: Locator): boolean;
1453
+
1454
+ /** Default localhost port the daemon listens on. */
1455
+ declare const DEFAULT_DAEMON_PORT = 8722;
1456
+ /** Default localhost host. ClickSmith only ever binds loopback. */
1457
+ declare const DEFAULT_DAEMON_HOST = "127.0.0.1";
1458
+ /** Default time-to-live for an unfinished capture session: 24 hours. */
1459
+ declare const DEFAULT_SESSION_TTL_MS: number;
1460
+ /**
1461
+ * The immutable safe defaults: plan mode, worktree isolation, no auto-apply.
1462
+ * Any change away from these is considered a "risky option".
1463
+ */
1464
+ declare const DEFAULT_EXECUTION_OPTIONS: ExecutionOptions;
1465
+ /**
1466
+ * Whether a set of execution options deviates from the safe defaults and
1467
+ * therefore requires explicit user confirmation in the extension/CLI:
1468
+ * non-plan mode, in-place isolation, or auto-apply.
1469
+ */
1470
+ declare function requiresConfirmation(execution: ExecutionOptions): boolean;
1471
+ /** Human-readable reasons a given execution config is considered risky. */
1472
+ declare function confirmationReasons(execution: ExecutionOptions): string[];
1473
+
1474
+ interface CreateSessionInput {
1475
+ app: AppContext;
1476
+ now?: Date;
1477
+ ttlMs?: number;
1478
+ id?: string;
1479
+ }
1480
+ /** Create a fresh, empty, active capture session. Pure. */
1481
+ declare function createSession(input: CreateSessionInput): Session;
1482
+ /**
1483
+ * Append a captured element to a session, assigning the next stable id. Returns
1484
+ * a new session plus the fully-formed element (so callers know the assigned id).
1485
+ * Pure — the input session is not mutated.
1486
+ */
1487
+ declare function appendElement(session: Session, input: CapturedElementInput, now?: Date): {
1488
+ session: Session;
1489
+ element: CapturedElement;
1490
+ };
1491
+ /**
1492
+ * Remove a captured element by id. Ids are never renumbered, keeping existing
1493
+ * `#N` references valid. Returns the new session and whether anything changed.
1494
+ * Pure.
1495
+ */
1496
+ declare function removeElement(session: Session, elementId: number, now?: Date): {
1497
+ session: Session;
1498
+ removed: boolean;
1499
+ };
1500
+ /** Find a captured element by its `#N` id. */
1501
+ declare function findElement(session: Session, elementId: number): CapturedElement | undefined;
1502
+ /** Whether a session has passed its expiry (and was never submitted). */
1503
+ declare function isExpired(session: Session, now?: Date): boolean;
1504
+ /** Slide a session's expiry forward by `ttlMs` from `now`. Pure. */
1505
+ declare function touchSession(session: Session, now?: Date, ttlMs?: number): Session;
1506
+ interface FinalizeInput {
1507
+ prompt: string;
1508
+ execution?: ExecutionOptions;
1509
+ submittedAt?: Date;
1510
+ enrichment?: CaptureBundle['enrichment'];
1511
+ }
1512
+ /**
1513
+ * Finalize a session into a validated v5 {@link CaptureBundle}. Throws if the
1514
+ * session has no elements or the prompt is empty. Does not mutate the session.
1515
+ */
1516
+ declare function finalizeSession(session: Session, input: FinalizeInput): CaptureBundle;
1517
+
1518
+ type ValidationResult = {
1519
+ ok: true;
1520
+ bundle: CaptureBundle;
1521
+ } | {
1522
+ ok: false;
1523
+ error: z.ZodError;
1524
+ };
1525
+ /** Validate an unknown value as a {@link CaptureBundle} without throwing. */
1526
+ declare function validateBundle(value: unknown): ValidationResult;
1527
+ /** Validate and throw on failure (with a readable message). */
1528
+ declare function parseBundle(value: unknown): CaptureBundle;
1529
+ /** Deterministically serialize a bundle to JSON (stable key order, 2-space). */
1530
+ declare function serializeBundle(bundle: CaptureBundle): string;
1531
+ /** Parse a JSON string into a validated bundle. */
1532
+ declare function deserializeBundle(json: string): CaptureBundle;
1533
+ /** Whether a value claims to be the current bundle version. */
1534
+ declare function isCurrentVersion(value: unknown): boolean;
1535
+
1536
+ /** The element payload the extension sends (everything but the daemon id). */
1537
+ declare const CapturedElementInputSchema: z.ZodObject<Omit<{
1538
+ id: z.ZodNumber;
1539
+ ts: z.ZodString;
1540
+ locator: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
1541
+ kind: z.ZodLiteral<"source">;
1542
+ file: z.ZodString;
1543
+ line: z.ZodNumber;
1544
+ column: z.ZodOptional<z.ZodNumber>;
1545
+ export: z.ZodOptional<z.ZodString>;
1546
+ }, "strip", z.ZodTypeAny, {
1547
+ kind: "source";
1548
+ file: string;
1549
+ line: number;
1550
+ column?: number | undefined;
1551
+ export?: string | undefined;
1552
+ }, {
1553
+ kind: "source";
1554
+ file: string;
1555
+ line: number;
1556
+ column?: number | undefined;
1557
+ export?: string | undefined;
1558
+ }>, z.ZodObject<{
1559
+ kind: z.ZodLiteral<"attr">;
1560
+ attr: z.ZodString;
1561
+ value: z.ZodString;
1562
+ selector: z.ZodString;
1563
+ }, "strip", z.ZodTypeAny, {
1564
+ kind: "attr";
1565
+ value: string;
1566
+ attr: string;
1567
+ selector: string;
1568
+ }, {
1569
+ kind: "attr";
1570
+ value: string;
1571
+ attr: string;
1572
+ selector: string;
1573
+ }>, z.ZodObject<{
1574
+ kind: z.ZodLiteral<"behavioral">;
1575
+ role: z.ZodString;
1576
+ name: z.ZodString;
1577
+ nth: z.ZodOptional<z.ZodNumber>;
1578
+ }, "strip", z.ZodTypeAny, {
1579
+ kind: "behavioral";
1580
+ role: string;
1581
+ name: string;
1582
+ nth?: number | undefined;
1583
+ }, {
1584
+ kind: "behavioral";
1585
+ role: string;
1586
+ name: string;
1587
+ nth?: number | undefined;
1588
+ }>, z.ZodObject<{
1589
+ kind: z.ZodLiteral<"dom">;
1590
+ selector: z.ZodString;
1591
+ fingerprint: z.ZodString;
1592
+ }, "strip", z.ZodTypeAny, {
1593
+ kind: "dom";
1594
+ selector: string;
1595
+ fingerprint: string;
1596
+ }, {
1597
+ kind: "dom";
1598
+ selector: string;
1599
+ fingerprint: string;
1600
+ }>]>;
1601
+ el: z.ZodObject<{
1602
+ tag: z.ZodString;
1603
+ text: z.ZodOptional<z.ZodString>;
1604
+ role: z.ZodOptional<z.ZodString>;
1605
+ label: z.ZodOptional<z.ZodString>;
1606
+ attrs: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
1607
+ iconHints: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1608
+ }, "strip", z.ZodTypeAny, {
1609
+ tag: string;
1610
+ attrs: Record<string, string>;
1611
+ role?: string | undefined;
1612
+ text?: string | undefined;
1613
+ label?: string | undefined;
1614
+ iconHints?: string[] | undefined;
1615
+ }, {
1616
+ tag: string;
1617
+ role?: string | undefined;
1618
+ text?: string | undefined;
1619
+ label?: string | undefined;
1620
+ attrs?: Record<string, string> | undefined;
1621
+ iconHints?: string[] | undefined;
1622
+ }>;
1623
+ near: z.ZodDefault<z.ZodObject<{
1624
+ labels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1625
+ headings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1626
+ landmarks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1627
+ parentText: z.ZodOptional<z.ZodString>;
1628
+ }, "strip", z.ZodTypeAny, {
1629
+ labels?: string[] | undefined;
1630
+ headings?: string[] | undefined;
1631
+ landmarks?: string[] | undefined;
1632
+ parentText?: string | undefined;
1633
+ }, {
1634
+ labels?: string[] | undefined;
1635
+ headings?: string[] | undefined;
1636
+ landmarks?: string[] | undefined;
1637
+ parentText?: string | undefined;
1638
+ }>>;
1639
+ conditions: z.ZodObject<{
1640
+ viewport: z.ZodObject<{
1641
+ w: z.ZodNumber;
1642
+ h: z.ZodNumber;
1643
+ }, "strip", z.ZodTypeAny, {
1644
+ w: number;
1645
+ h: number;
1646
+ }, {
1647
+ w: number;
1648
+ h: number;
1649
+ }>;
1650
+ theme: z.ZodOptional<z.ZodEnum<["light", "dark"]>>;
1651
+ mediaQueries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
1652
+ }, "strip", z.ZodTypeAny, {
1653
+ viewport: {
1654
+ w: number;
1655
+ h: number;
1656
+ };
1657
+ theme?: "light" | "dark" | undefined;
1658
+ mediaQueries?: Record<string, boolean> | undefined;
1659
+ }, {
1660
+ viewport: {
1661
+ w: number;
1662
+ h: number;
1663
+ };
1664
+ theme?: "light" | "dark" | undefined;
1665
+ mediaQueries?: Record<string, boolean> | undefined;
1666
+ }>;
1667
+ screenshot: z.ZodOptional<z.ZodString>;
1668
+ frameworkHints: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1669
+ }, "id">, "strip", z.ZodTypeAny, {
1670
+ ts: string;
1671
+ locator: {
1672
+ kind: "source";
1673
+ file: string;
1674
+ line: number;
1675
+ column?: number | undefined;
1676
+ export?: string | undefined;
1677
+ } | {
1678
+ kind: "attr";
1679
+ value: string;
1680
+ attr: string;
1681
+ selector: string;
1682
+ } | {
1683
+ kind: "behavioral";
1684
+ role: string;
1685
+ name: string;
1686
+ nth?: number | undefined;
1687
+ } | {
1688
+ kind: "dom";
1689
+ selector: string;
1690
+ fingerprint: string;
1691
+ };
1692
+ el: {
1693
+ tag: string;
1694
+ attrs: Record<string, string>;
1695
+ role?: string | undefined;
1696
+ text?: string | undefined;
1697
+ label?: string | undefined;
1698
+ iconHints?: string[] | undefined;
1699
+ };
1700
+ near: {
1701
+ labels?: string[] | undefined;
1702
+ headings?: string[] | undefined;
1703
+ landmarks?: string[] | undefined;
1704
+ parentText?: string | undefined;
1705
+ };
1706
+ conditions: {
1707
+ viewport: {
1708
+ w: number;
1709
+ h: number;
1710
+ };
1711
+ theme?: "light" | "dark" | undefined;
1712
+ mediaQueries?: Record<string, boolean> | undefined;
1713
+ };
1714
+ screenshot?: string | undefined;
1715
+ frameworkHints?: Record<string, unknown> | undefined;
1716
+ }, {
1717
+ ts: string;
1718
+ locator: {
1719
+ kind: "source";
1720
+ file: string;
1721
+ line: number;
1722
+ column?: number | undefined;
1723
+ export?: string | undefined;
1724
+ } | {
1725
+ kind: "attr";
1726
+ value: string;
1727
+ attr: string;
1728
+ selector: string;
1729
+ } | {
1730
+ kind: "behavioral";
1731
+ role: string;
1732
+ name: string;
1733
+ nth?: number | undefined;
1734
+ } | {
1735
+ kind: "dom";
1736
+ selector: string;
1737
+ fingerprint: string;
1738
+ };
1739
+ el: {
1740
+ tag: string;
1741
+ role?: string | undefined;
1742
+ text?: string | undefined;
1743
+ label?: string | undefined;
1744
+ attrs?: Record<string, string> | undefined;
1745
+ iconHints?: string[] | undefined;
1746
+ };
1747
+ conditions: {
1748
+ viewport: {
1749
+ w: number;
1750
+ h: number;
1751
+ };
1752
+ theme?: "light" | "dark" | undefined;
1753
+ mediaQueries?: Record<string, boolean> | undefined;
1754
+ };
1755
+ near?: {
1756
+ labels?: string[] | undefined;
1757
+ headings?: string[] | undefined;
1758
+ landmarks?: string[] | undefined;
1759
+ parentText?: string | undefined;
1760
+ } | undefined;
1761
+ screenshot?: string | undefined;
1762
+ frameworkHints?: Record<string, unknown> | undefined;
1763
+ }>;
1764
+ declare const CaptureRequestSchema: z.ZodObject<{
1765
+ /** Append to this session if present; otherwise the daemon opens one. */
1766
+ sessionId: z.ZodOptional<z.ZodString>;
1767
+ app: z.ZodObject<{
1768
+ url: z.ZodString;
1769
+ route: z.ZodString;
1770
+ page: z.ZodOptional<z.ZodString>;
1771
+ }, "strip", z.ZodTypeAny, {
1772
+ url: string;
1773
+ route: string;
1774
+ page?: string | undefined;
1775
+ }, {
1776
+ url: string;
1777
+ route: string;
1778
+ page?: string | undefined;
1779
+ }>;
1780
+ element: z.ZodObject<Omit<{
1781
+ id: z.ZodNumber;
1782
+ ts: z.ZodString;
1783
+ locator: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
1784
+ kind: z.ZodLiteral<"source">;
1785
+ file: z.ZodString;
1786
+ line: z.ZodNumber;
1787
+ column: z.ZodOptional<z.ZodNumber>;
1788
+ export: z.ZodOptional<z.ZodString>;
1789
+ }, "strip", z.ZodTypeAny, {
1790
+ kind: "source";
1791
+ file: string;
1792
+ line: number;
1793
+ column?: number | undefined;
1794
+ export?: string | undefined;
1795
+ }, {
1796
+ kind: "source";
1797
+ file: string;
1798
+ line: number;
1799
+ column?: number | undefined;
1800
+ export?: string | undefined;
1801
+ }>, z.ZodObject<{
1802
+ kind: z.ZodLiteral<"attr">;
1803
+ attr: z.ZodString;
1804
+ value: z.ZodString;
1805
+ selector: z.ZodString;
1806
+ }, "strip", z.ZodTypeAny, {
1807
+ kind: "attr";
1808
+ value: string;
1809
+ attr: string;
1810
+ selector: string;
1811
+ }, {
1812
+ kind: "attr";
1813
+ value: string;
1814
+ attr: string;
1815
+ selector: string;
1816
+ }>, z.ZodObject<{
1817
+ kind: z.ZodLiteral<"behavioral">;
1818
+ role: z.ZodString;
1819
+ name: z.ZodString;
1820
+ nth: z.ZodOptional<z.ZodNumber>;
1821
+ }, "strip", z.ZodTypeAny, {
1822
+ kind: "behavioral";
1823
+ role: string;
1824
+ name: string;
1825
+ nth?: number | undefined;
1826
+ }, {
1827
+ kind: "behavioral";
1828
+ role: string;
1829
+ name: string;
1830
+ nth?: number | undefined;
1831
+ }>, z.ZodObject<{
1832
+ kind: z.ZodLiteral<"dom">;
1833
+ selector: z.ZodString;
1834
+ fingerprint: z.ZodString;
1835
+ }, "strip", z.ZodTypeAny, {
1836
+ kind: "dom";
1837
+ selector: string;
1838
+ fingerprint: string;
1839
+ }, {
1840
+ kind: "dom";
1841
+ selector: string;
1842
+ fingerprint: string;
1843
+ }>]>;
1844
+ el: z.ZodObject<{
1845
+ tag: z.ZodString;
1846
+ text: z.ZodOptional<z.ZodString>;
1847
+ role: z.ZodOptional<z.ZodString>;
1848
+ label: z.ZodOptional<z.ZodString>;
1849
+ attrs: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
1850
+ iconHints: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1851
+ }, "strip", z.ZodTypeAny, {
1852
+ tag: string;
1853
+ attrs: Record<string, string>;
1854
+ role?: string | undefined;
1855
+ text?: string | undefined;
1856
+ label?: string | undefined;
1857
+ iconHints?: string[] | undefined;
1858
+ }, {
1859
+ tag: string;
1860
+ role?: string | undefined;
1861
+ text?: string | undefined;
1862
+ label?: string | undefined;
1863
+ attrs?: Record<string, string> | undefined;
1864
+ iconHints?: string[] | undefined;
1865
+ }>;
1866
+ near: z.ZodDefault<z.ZodObject<{
1867
+ labels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1868
+ headings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1869
+ landmarks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1870
+ parentText: z.ZodOptional<z.ZodString>;
1871
+ }, "strip", z.ZodTypeAny, {
1872
+ labels?: string[] | undefined;
1873
+ headings?: string[] | undefined;
1874
+ landmarks?: string[] | undefined;
1875
+ parentText?: string | undefined;
1876
+ }, {
1877
+ labels?: string[] | undefined;
1878
+ headings?: string[] | undefined;
1879
+ landmarks?: string[] | undefined;
1880
+ parentText?: string | undefined;
1881
+ }>>;
1882
+ conditions: z.ZodObject<{
1883
+ viewport: z.ZodObject<{
1884
+ w: z.ZodNumber;
1885
+ h: z.ZodNumber;
1886
+ }, "strip", z.ZodTypeAny, {
1887
+ w: number;
1888
+ h: number;
1889
+ }, {
1890
+ w: number;
1891
+ h: number;
1892
+ }>;
1893
+ theme: z.ZodOptional<z.ZodEnum<["light", "dark"]>>;
1894
+ mediaQueries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
1895
+ }, "strip", z.ZodTypeAny, {
1896
+ viewport: {
1897
+ w: number;
1898
+ h: number;
1899
+ };
1900
+ theme?: "light" | "dark" | undefined;
1901
+ mediaQueries?: Record<string, boolean> | undefined;
1902
+ }, {
1903
+ viewport: {
1904
+ w: number;
1905
+ h: number;
1906
+ };
1907
+ theme?: "light" | "dark" | undefined;
1908
+ mediaQueries?: Record<string, boolean> | undefined;
1909
+ }>;
1910
+ screenshot: z.ZodOptional<z.ZodString>;
1911
+ frameworkHints: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1912
+ }, "id">, "strip", z.ZodTypeAny, {
1913
+ ts: string;
1914
+ locator: {
1915
+ kind: "source";
1916
+ file: string;
1917
+ line: number;
1918
+ column?: number | undefined;
1919
+ export?: string | undefined;
1920
+ } | {
1921
+ kind: "attr";
1922
+ value: string;
1923
+ attr: string;
1924
+ selector: string;
1925
+ } | {
1926
+ kind: "behavioral";
1927
+ role: string;
1928
+ name: string;
1929
+ nth?: number | undefined;
1930
+ } | {
1931
+ kind: "dom";
1932
+ selector: string;
1933
+ fingerprint: string;
1934
+ };
1935
+ el: {
1936
+ tag: string;
1937
+ attrs: Record<string, string>;
1938
+ role?: string | undefined;
1939
+ text?: string | undefined;
1940
+ label?: string | undefined;
1941
+ iconHints?: string[] | undefined;
1942
+ };
1943
+ near: {
1944
+ labels?: string[] | undefined;
1945
+ headings?: string[] | undefined;
1946
+ landmarks?: string[] | undefined;
1947
+ parentText?: string | undefined;
1948
+ };
1949
+ conditions: {
1950
+ viewport: {
1951
+ w: number;
1952
+ h: number;
1953
+ };
1954
+ theme?: "light" | "dark" | undefined;
1955
+ mediaQueries?: Record<string, boolean> | undefined;
1956
+ };
1957
+ screenshot?: string | undefined;
1958
+ frameworkHints?: Record<string, unknown> | undefined;
1959
+ }, {
1960
+ ts: string;
1961
+ locator: {
1962
+ kind: "source";
1963
+ file: string;
1964
+ line: number;
1965
+ column?: number | undefined;
1966
+ export?: string | undefined;
1967
+ } | {
1968
+ kind: "attr";
1969
+ value: string;
1970
+ attr: string;
1971
+ selector: string;
1972
+ } | {
1973
+ kind: "behavioral";
1974
+ role: string;
1975
+ name: string;
1976
+ nth?: number | undefined;
1977
+ } | {
1978
+ kind: "dom";
1979
+ selector: string;
1980
+ fingerprint: string;
1981
+ };
1982
+ el: {
1983
+ tag: string;
1984
+ role?: string | undefined;
1985
+ text?: string | undefined;
1986
+ label?: string | undefined;
1987
+ attrs?: Record<string, string> | undefined;
1988
+ iconHints?: string[] | undefined;
1989
+ };
1990
+ conditions: {
1991
+ viewport: {
1992
+ w: number;
1993
+ h: number;
1994
+ };
1995
+ theme?: "light" | "dark" | undefined;
1996
+ mediaQueries?: Record<string, boolean> | undefined;
1997
+ };
1998
+ near?: {
1999
+ labels?: string[] | undefined;
2000
+ headings?: string[] | undefined;
2001
+ landmarks?: string[] | undefined;
2002
+ parentText?: string | undefined;
2003
+ } | undefined;
2004
+ screenshot?: string | undefined;
2005
+ frameworkHints?: Record<string, unknown> | undefined;
2006
+ }>;
2007
+ }, "strip", z.ZodTypeAny, {
2008
+ app: {
2009
+ url: string;
2010
+ route: string;
2011
+ page?: string | undefined;
2012
+ };
2013
+ element: {
2014
+ ts: string;
2015
+ locator: {
2016
+ kind: "source";
2017
+ file: string;
2018
+ line: number;
2019
+ column?: number | undefined;
2020
+ export?: string | undefined;
2021
+ } | {
2022
+ kind: "attr";
2023
+ value: string;
2024
+ attr: string;
2025
+ selector: string;
2026
+ } | {
2027
+ kind: "behavioral";
2028
+ role: string;
2029
+ name: string;
2030
+ nth?: number | undefined;
2031
+ } | {
2032
+ kind: "dom";
2033
+ selector: string;
2034
+ fingerprint: string;
2035
+ };
2036
+ el: {
2037
+ tag: string;
2038
+ attrs: Record<string, string>;
2039
+ role?: string | undefined;
2040
+ text?: string | undefined;
2041
+ label?: string | undefined;
2042
+ iconHints?: string[] | undefined;
2043
+ };
2044
+ near: {
2045
+ labels?: string[] | undefined;
2046
+ headings?: string[] | undefined;
2047
+ landmarks?: string[] | undefined;
2048
+ parentText?: string | undefined;
2049
+ };
2050
+ conditions: {
2051
+ viewport: {
2052
+ w: number;
2053
+ h: number;
2054
+ };
2055
+ theme?: "light" | "dark" | undefined;
2056
+ mediaQueries?: Record<string, boolean> | undefined;
2057
+ };
2058
+ screenshot?: string | undefined;
2059
+ frameworkHints?: Record<string, unknown> | undefined;
2060
+ };
2061
+ sessionId?: string | undefined;
2062
+ }, {
2063
+ app: {
2064
+ url: string;
2065
+ route: string;
2066
+ page?: string | undefined;
2067
+ };
2068
+ element: {
2069
+ ts: string;
2070
+ locator: {
2071
+ kind: "source";
2072
+ file: string;
2073
+ line: number;
2074
+ column?: number | undefined;
2075
+ export?: string | undefined;
2076
+ } | {
2077
+ kind: "attr";
2078
+ value: string;
2079
+ attr: string;
2080
+ selector: string;
2081
+ } | {
2082
+ kind: "behavioral";
2083
+ role: string;
2084
+ name: string;
2085
+ nth?: number | undefined;
2086
+ } | {
2087
+ kind: "dom";
2088
+ selector: string;
2089
+ fingerprint: string;
2090
+ };
2091
+ el: {
2092
+ tag: string;
2093
+ role?: string | undefined;
2094
+ text?: string | undefined;
2095
+ label?: string | undefined;
2096
+ attrs?: Record<string, string> | undefined;
2097
+ iconHints?: string[] | undefined;
2098
+ };
2099
+ conditions: {
2100
+ viewport: {
2101
+ w: number;
2102
+ h: number;
2103
+ };
2104
+ theme?: "light" | "dark" | undefined;
2105
+ mediaQueries?: Record<string, boolean> | undefined;
2106
+ };
2107
+ near?: {
2108
+ labels?: string[] | undefined;
2109
+ headings?: string[] | undefined;
2110
+ landmarks?: string[] | undefined;
2111
+ parentText?: string | undefined;
2112
+ } | undefined;
2113
+ screenshot?: string | undefined;
2114
+ frameworkHints?: Record<string, unknown> | undefined;
2115
+ };
2116
+ sessionId?: string | undefined;
2117
+ }>;
2118
+ type CaptureRequest = z.infer<typeof CaptureRequestSchema>;
2119
+ interface CaptureResponse {
2120
+ sessionId: string;
2121
+ element: CapturedElement;
2122
+ }
2123
+ declare const SubmitRequestSchema: z.ZodObject<{
2124
+ sessionId: z.ZodString;
2125
+ prompt: z.ZodString;
2126
+ execution: z.ZodOptional<z.ZodObject<{
2127
+ mode: z.ZodOptional<z.ZodDefault<z.ZodEnum<["plan", "edit"]>>>;
2128
+ isolation: z.ZodOptional<z.ZodDefault<z.ZodEnum<["worktree", "branch", "inplace"]>>>;
2129
+ autoApply: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2130
+ agentId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
2131
+ baseRef: z.ZodOptional<z.ZodOptional<z.ZodString>>;
2132
+ }, "strip", z.ZodTypeAny, {
2133
+ mode?: "plan" | "edit" | undefined;
2134
+ isolation?: "worktree" | "branch" | "inplace" | undefined;
2135
+ autoApply?: boolean | undefined;
2136
+ agentId?: string | undefined;
2137
+ baseRef?: string | undefined;
2138
+ }, {
2139
+ mode?: "plan" | "edit" | undefined;
2140
+ isolation?: "worktree" | "branch" | "inplace" | undefined;
2141
+ autoApply?: boolean | undefined;
2142
+ agentId?: string | undefined;
2143
+ baseRef?: string | undefined;
2144
+ }>>;
2145
+ enrichment: z.ZodOptional<z.ZodObject<{
2146
+ source: z.ZodLiteral<"code-review-graph">;
2147
+ perElement: z.ZodDefault<z.ZodArray<z.ZodObject<{
2148
+ elementId: z.ZodNumber;
2149
+ reviewContext: z.ZodOptional<z.ZodString>;
2150
+ impactRadius: z.ZodOptional<z.ZodUnknown>;
2151
+ affectedFlows: z.ZodOptional<z.ZodUnknown>;
2152
+ }, "strip", z.ZodTypeAny, {
2153
+ elementId: number;
2154
+ reviewContext?: string | undefined;
2155
+ impactRadius?: unknown;
2156
+ affectedFlows?: unknown;
2157
+ }, {
2158
+ elementId: number;
2159
+ reviewContext?: string | undefined;
2160
+ impactRadius?: unknown;
2161
+ affectedFlows?: unknown;
2162
+ }>, "many">>;
2163
+ warnings: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
2164
+ }, "strip", z.ZodTypeAny, {
2165
+ source: "code-review-graph";
2166
+ perElement: {
2167
+ elementId: number;
2168
+ reviewContext?: string | undefined;
2169
+ impactRadius?: unknown;
2170
+ affectedFlows?: unknown;
2171
+ }[];
2172
+ warnings: string[];
2173
+ }, {
2174
+ source: "code-review-graph";
2175
+ perElement?: {
2176
+ elementId: number;
2177
+ reviewContext?: string | undefined;
2178
+ impactRadius?: unknown;
2179
+ affectedFlows?: unknown;
2180
+ }[] | undefined;
2181
+ warnings?: string[] | undefined;
2182
+ }>>;
2183
+ }, "strip", z.ZodTypeAny, {
2184
+ sessionId: string;
2185
+ prompt: string;
2186
+ execution?: {
2187
+ mode?: "plan" | "edit" | undefined;
2188
+ isolation?: "worktree" | "branch" | "inplace" | undefined;
2189
+ autoApply?: boolean | undefined;
2190
+ agentId?: string | undefined;
2191
+ baseRef?: string | undefined;
2192
+ } | undefined;
2193
+ enrichment?: {
2194
+ source: "code-review-graph";
2195
+ perElement: {
2196
+ elementId: number;
2197
+ reviewContext?: string | undefined;
2198
+ impactRadius?: unknown;
2199
+ affectedFlows?: unknown;
2200
+ }[];
2201
+ warnings: string[];
2202
+ } | undefined;
2203
+ }, {
2204
+ sessionId: string;
2205
+ prompt: string;
2206
+ execution?: {
2207
+ mode?: "plan" | "edit" | undefined;
2208
+ isolation?: "worktree" | "branch" | "inplace" | undefined;
2209
+ autoApply?: boolean | undefined;
2210
+ agentId?: string | undefined;
2211
+ baseRef?: string | undefined;
2212
+ } | undefined;
2213
+ enrichment?: {
2214
+ source: "code-review-graph";
2215
+ perElement?: {
2216
+ elementId: number;
2217
+ reviewContext?: string | undefined;
2218
+ impactRadius?: unknown;
2219
+ affectedFlows?: unknown;
2220
+ }[] | undefined;
2221
+ warnings?: string[] | undefined;
2222
+ } | undefined;
2223
+ }>;
2224
+ type SubmitRequest = z.infer<typeof SubmitRequestSchema>;
2225
+ interface SubmitResponse {
2226
+ runId: string;
2227
+ bundle: CaptureBundle;
2228
+ }
2229
+ interface ApplyResponse {
2230
+ applied: boolean;
2231
+ commit?: string;
2232
+ conflicts?: string[];
2233
+ }
2234
+ interface HealthResponse {
2235
+ ok: true;
2236
+ name: 'clicksmith-daemon';
2237
+ version: string;
2238
+ host: string;
2239
+ port: number;
2240
+ repoRoot: string | null;
2241
+ activeSessions: number;
2242
+ }
2243
+ type SessionResponse = Session;
2244
+ interface RemoveElementResponse {
2245
+ removed: boolean;
2246
+ }
2247
+ declare const RunStatusSchema: z.ZodEnum<["pending", "running", "plan-ready", "done", "applying", "applied", "error", "apply-error"]>;
2248
+ type RunStatus = z.infer<typeof RunStatusSchema>;
2249
+ interface RunSummary {
2250
+ runId: string;
2251
+ sessionId: string;
2252
+ agentId: string;
2253
+ status: RunStatus;
2254
+ createdAt: string;
2255
+ sandbox: SandboxInfo | null;
2256
+ }
2257
+ interface SandboxInfo {
2258
+ isolation: 'worktree' | 'branch' | 'inplace';
2259
+ path: string;
2260
+ branch: string | null;
2261
+ baseCommit: string;
2262
+ }
2263
+ /** Events streamed from daemon to the extension over the WebSocket. */
2264
+ type ServerEvent = {
2265
+ type: 'capture-ack';
2266
+ sessionId: string;
2267
+ element: CapturedElement;
2268
+ } | {
2269
+ type: 'element-removed';
2270
+ sessionId: string;
2271
+ elementId: number;
2272
+ } | {
2273
+ type: 'agent-started';
2274
+ runId: string;
2275
+ sessionId: string;
2276
+ agentId: string;
2277
+ sandbox: SandboxInfo | null;
2278
+ } | {
2279
+ type: 'agent-log';
2280
+ runId: string;
2281
+ stream: 'stdout' | 'stderr';
2282
+ chunk: string;
2283
+ } | {
2284
+ type: 'plan-ready';
2285
+ runId: string;
2286
+ plan?: string;
2287
+ diff?: string;
2288
+ } | {
2289
+ type: 'agent-done';
2290
+ runId: string;
2291
+ exitCode: number;
2292
+ } | {
2293
+ type: 'agent-error';
2294
+ runId: string;
2295
+ message: string;
2296
+ } | {
2297
+ type: 'apply-started';
2298
+ runId: string;
2299
+ } | {
2300
+ type: 'apply-done';
2301
+ runId: string;
2302
+ commit?: string;
2303
+ } | {
2304
+ type: 'apply-error';
2305
+ runId: string;
2306
+ message: string;
2307
+ conflicts?: string[];
2308
+ };
2309
+ type ServerEventType = ServerEvent['type'];
2310
+ /** Messages the extension may send to the daemon over the WebSocket. */
2311
+ type ClientMessage = {
2312
+ type: 'subscribe';
2313
+ sessionId?: string;
2314
+ } | {
2315
+ type: 'ping';
2316
+ };
2317
+ /** Ordered list of every WS event type, useful for tests and docs. */
2318
+ declare const SERVER_EVENT_TYPES: readonly ["capture-ack", "element-removed", "agent-started", "agent-log", "plan-ready", "agent-done", "agent-error", "apply-started", "apply-done", "apply-error"];
2319
+
2320
+ export { type AppContext, AppContextSchema, type ApplyResponse, type AttrLocator, AttrLocatorSchema, type BehavioralLocator, BehavioralLocatorSchema, CURRENT_BUNDLE_VERSION, type CaptureBundle, CaptureBundleSchema, type CaptureRequest, CaptureRequestSchema, type CaptureResponse, type CapturedElement, type CapturedElementInput, CapturedElementInputSchema, CapturedElementSchema, type ClientMessage, type Conditions, ConditionsSchema, type CreateSessionInput, DEFAULT_DAEMON_HOST, DEFAULT_DAEMON_PORT, DEFAULT_EXECUTION_OPTIONS, DEFAULT_SESSION_TTL_MS, type DomLocator, DomLocatorSchema, type ElementDescriptor, ElementDescriptorSchema, type ElementEnrichment, ElementEnrichmentSchema, type Enrichment, EnrichmentSchema, type ExecutionMode, ExecutionModeSchema, type ExecutionOptions, ExecutionOptionsSchema, type FinalizeInput, type HealthResponse, type Isolation, IsolationSchema, LOCATOR_PRIORITY, type Locator, type LocatorKind, LocatorSchema, type NearContext, NearContextSchema, type RemoveElementResponse, type RunStatus, RunStatusSchema, type RunSummary, SERVER_EVENT_TYPES, type SandboxInfo, type ServerEvent, type ServerEventType, type Session, type SessionResponse, SessionSchema, type SessionStatus, SessionStatusSchema, type SourceLocator, SourceLocatorSchema, type SubmitRequest, SubmitRequestSchema, type SubmitResponse, type ValidationResult, appendElement, compareLocators, confirmationReasons, createSession, describeLocator, deserializeBundle, finalizeSession, findElement, isCurrentVersion, isExpired, isSourceResolved, locatorRank, newRunId, newSessionId, nextElementId, parseBundle, parseElementRef, pickBestLocator, rankLocators, removeElement, requiresConfirmation, serializeBundle, touchSession, validateBundle };