@inspecto-dev/core 0.3.7 → 0.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __defProps = Object.defineProperties;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
5
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
7
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
- var __getProtoOf = Object.getPrototypeOf;
10
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
11
9
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
10
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -37,14 +35,6 @@ var __copyProps = (to, from, except, desc) => {
37
35
  }
38
36
  return to;
39
37
  };
40
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
41
- // If the importer is in node compatibility mode or this is not an ESM
42
- // file that has been converted to a CommonJS file using a Babel-
43
- // compatible transform (i.e. "__esModule" has not been set), then set
44
- // "default" to the CommonJS "module.exports" for node compatibility.
45
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
46
- mod
47
- ));
48
38
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
49
39
  var __async = (__this, __arguments, generator) => {
50
40
  return new Promise((resolve, reject) => {
@@ -249,38 +239,39 @@ var init_styles_annotate = __esm({
249
239
  annotateStyles = `
250
240
  .${annotateSidebarClass} {
251
241
  position: fixed;
252
- top: 16px;
253
- right: 16px;
242
+ top: 18px;
243
+ right: 18px;
254
244
  z-index: 2147483647;
255
- width: min(380px, calc(100vw - 32px));
256
- min-height: 220px;
257
- max-height: calc(100vh - 32px);
245
+ width: min(408px, calc(100vw - 28px));
246
+ min-height: 240px;
247
+ max-height: calc(100vh - 36px);
258
248
  display: flex;
259
249
  flex-direction: column;
260
- gap: 14px;
250
+ gap: 16px;
261
251
  box-sizing: border-box;
262
- padding: 15px 15px 16px;
252
+ padding: 18px 18px 18px;
263
253
  overflow: visible;
264
254
  color: var(--inspecto-text-primary);
265
255
  background:
266
- radial-gradient(circle at top right, rgba(93, 82, 243, 0.12), transparent 34%),
267
- linear-gradient(180deg, rgba(32, 32, 36, 0.96) 0%, rgba(21, 21, 24, 0.96) 100%);
268
- border: 1px solid rgba(255, 255, 255, 0.07);
269
- border-radius: 22px;
270
- box-shadow: 0 22px 42px rgba(0, 0, 0, 0.24);
271
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
256
+ radial-gradient(circle at top right, rgba(14, 165, 233, 0.18), transparent 36%),
257
+ radial-gradient(circle at top left, rgba(14, 165, 233, 0.08), transparent 28%),
258
+ linear-gradient(180deg, rgba(13, 20, 31, 0.985) 0%, rgba(8, 14, 24, 0.985) 100%);
259
+ border: 1px solid rgba(148, 163, 184, 0.16);
260
+ border-radius: 28px;
261
+ box-shadow: var(--inspecto-shadow-floating);
262
+ font-family: 'SF Pro Display', 'Segoe UI', 'Inter', sans-serif;
272
263
  pointer-events: auto;
273
- backdrop-filter: blur(14px);
274
- -webkit-backdrop-filter: blur(14px);
264
+ backdrop-filter: blur(18px) saturate(140%);
265
+ -webkit-backdrop-filter: blur(18px) saturate(140%);
275
266
  }
276
267
 
277
268
  .${annotateSidebarHeaderClass} {
278
269
  display: flex;
279
270
  align-items: flex-start;
280
271
  justify-content: space-between;
281
- gap: 12px;
282
- padding-bottom: 10px;
283
- border-bottom: 1px solid rgba(255, 255, 255, 0.06);
272
+ gap: 14px;
273
+ padding-bottom: 14px;
274
+ border-bottom: 1px solid rgba(148, 163, 184, 0.14);
284
275
  }
285
276
 
286
277
  .${annotateSidebarLabelClass} {
@@ -292,25 +283,25 @@ var init_styles_annotate = __esm({
292
283
  }
293
284
 
294
285
  .${annotateSidebarLabelClass} [data-inspecto-annotate-title="true"] {
295
- font-size: 15px;
296
- line-height: 1.2;
297
- font-weight: 700;
286
+ font-size: 16px;
287
+ line-height: 1.15;
288
+ font-weight: 760;
298
289
  color: var(--inspecto-text-primary);
299
- letter-spacing: 0;
290
+ letter-spacing: -0.02em;
300
291
  }
301
292
 
302
293
  .${annotateSidebarLabelClass} [data-inspecto-annotate-header-status="true"] {
303
294
  display: inline-flex;
304
295
  align-items: center;
305
296
  align-self: flex-start;
306
- min-height: 24px;
307
- padding: 0 9px;
297
+ min-height: 26px;
298
+ padding: 0 10px;
308
299
  border-radius: var(--inspecto-radius-pill);
309
- background: rgba(255, 255, 255, 0.04);
310
- border: 1px solid rgba(255, 255, 255, 0.06);
300
+ background: rgba(148, 163, 184, 0.1);
301
+ border: 1px solid rgba(148, 163, 184, 0.14);
311
302
  font-size: 11px;
312
303
  line-height: 1.2;
313
- font-weight: 600;
304
+ font-weight: 650;
314
305
  color: var(--inspecto-text-secondary);
315
306
  }
316
307
 
@@ -326,18 +317,26 @@ var init_styles_annotate = __esm({
326
317
  .${annotateSidebarSectionClass} {
327
318
  display: flex;
328
319
  flex-direction: column;
329
- gap: 8px;
320
+ gap: 10px;
330
321
  min-height: 0;
331
- padding: 12px;
332
- border: 1px solid rgba(255, 255, 255, 0.05);
333
- border-radius: 18px;
334
- background: rgba(255, 255, 255, 0.022);
322
+ padding: 14px;
323
+ border: 1px solid rgba(148, 163, 184, 0.12);
324
+ border-radius: 20px;
325
+ background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(148, 163, 184, 0.04) 100%);
326
+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
335
327
  }
336
328
 
337
- .${annotateSidebarSectionClass}[data-variant="modes"] { gap: 8px; padding: 8px 10px; }
329
+ .${annotateSidebarSectionClass}[data-variant="modes"] { gap: 8px; padding: 10px 12px; }
338
330
  .${annotateSidebarSectionClass}[data-variant="draft"] { gap: 0; padding: 0; border: none; background: transparent; }
339
- .${annotateSidebarSectionClass}[data-variant="chip-preview"] { gap: 8px; padding: 10px; background: rgba(255, 255, 255, 0.03); }
340
- .${annotateSidebarSectionClass}[data-variant="records"] { padding: 0; overflow: hidden; background: rgba(255, 255, 255, 0.028); border-color: rgba(255, 255, 255, 0.08); }
331
+ .${annotateSidebarSectionClass}[data-variant="chip-preview"] { gap: 8px; padding: 12px; background: rgba(255, 255, 255, 0.045); }
332
+ .${annotateSidebarSectionClass}[data-variant="records"] { padding: 0; overflow: hidden; background: rgba(255, 255, 255, 0.038); border-color: rgba(148, 163, 184, 0.16); }
333
+ .${annotateSidebarSectionClass}[data-variant="latest-session"] {
334
+ padding: 14px;
335
+ background:
336
+ radial-gradient(circle at top right, rgba(14, 165, 233, 0.12), transparent 34%),
337
+ linear-gradient(180deg, rgba(255, 255, 255, 0.055) 0%, rgba(148, 163, 184, 0.05) 100%);
338
+ border-color: rgba(14, 165, 233, 0.18);
339
+ }
341
340
  .${annotateSidebarSectionClass}[data-variant="full-prompt"] { padding: 0; gap: 0; background: transparent; border: none; border-radius: 0; opacity: 0.72; }
342
341
 
343
342
  .${annotateSidebarSectionClass} h3 {
@@ -351,25 +350,25 @@ var init_styles_annotate = __esm({
351
350
  .${annotateSidebarSectionClass}[data-variant="empty-state"] {
352
351
  flex: 1 1 auto;
353
352
  justify-content: center;
354
- gap: 10px;
355
- padding: 10px 2px 0;
353
+ gap: 12px;
354
+ padding: 20px 6px 8px;
356
355
  background: transparent;
357
356
  border-color: transparent;
358
357
  }
359
358
 
360
359
  .${annotateSidebarSectionClass}[data-variant="empty-state"] [data-inspecto-annotate-empty-title="true"] {
361
- font-size: 17px;
362
- line-height: 1.25;
363
- font-weight: 700;
360
+ font-size: 18px;
361
+ line-height: 1.18;
362
+ font-weight: 760;
364
363
  color: var(--inspecto-text-primary);
365
- max-width: 22ch;
364
+ max-width: 20ch;
365
+ letter-spacing: -0.03em;
366
366
  }
367
367
 
368
368
  .${annotateSidebarSectionClass}[data-variant="empty-state"] [data-inspecto-annotate-empty-body="true"] {
369
- max-width: 29ch;
370
- color: rgba(255, 255, 255, 0.56);
369
+ color: var(--inspecto-text-secondary);
371
370
  font-size: 12px;
372
- line-height: 1.55;
371
+ line-height: 1.62;
373
372
  }
374
373
 
375
374
  .${annotateSidebarInputClass},
@@ -386,10 +385,10 @@ var init_styles_annotate = __esm({
386
385
  }
387
386
 
388
387
  .${annotateSidebarInputClass} {
389
- min-height: 104px;
390
- padding: 12px 13px;
388
+ min-height: 112px;
389
+ padding: 14px 15px;
391
390
  resize: vertical;
392
- line-height: 1.5;
391
+ line-height: 1.55;
393
392
  }
394
393
 
395
394
  .${annotateSidebarHintClass} {
@@ -402,11 +401,11 @@ var init_styles_annotate = __esm({
402
401
 
403
402
  .${annotateSidebarChipClass} {
404
403
  appearance: none;
405
- border: 1px solid rgba(93, 82, 243, 0.24);
406
- background: rgba(93, 82, 243, 0.12);
407
- color: #d7d3ff;
404
+ border: 1px solid rgba(14, 165, 233, 0.24);
405
+ background: rgba(14, 165, 233, 0.14);
406
+ color: #d7f4ff;
408
407
  border-radius: var(--inspecto-radius-pill);
409
- padding: 5px 8px 5px 10px;
408
+ padding: 6px 9px 6px 11px;
410
409
  font: inherit;
411
410
  font-size: 11px;
412
411
  font-weight: 600;
@@ -425,8 +424,8 @@ var init_styles_annotate = __esm({
425
424
  .${annotateSidebarChipClass}:hover,
426
425
  .${annotateSidebarChipClass}:focus-visible {
427
426
  outline: none;
428
- background: rgba(93, 82, 243, 0.2);
429
- border-color: rgba(93, 82, 243, 0.42);
427
+ background: rgba(14, 165, 233, 0.22);
428
+ border-color: rgba(14, 165, 233, 0.42);
430
429
  color: #ffffff;
431
430
  transform: translateY(-1px);
432
431
  }
@@ -470,33 +469,50 @@ var init_styles_annotate = __esm({
470
469
  .${annotateTargetListClass}, .${annotateQueueListClass} {
471
470
  display: flex;
472
471
  flex-direction: column;
473
- gap: 0;
474
- max-height: 180px;
472
+ gap: 2px;
473
+ max-height: 220px;
475
474
  overflow: auto;
476
- padding: 0 10px 10px;
475
+ padding: 6px 10px 12px;
477
476
  }
478
477
 
479
478
  .${annotateSidebarTargetItemClass}, .${annotateSidebarQueueItemClass} {
480
479
  display: flex;
481
480
  flex-direction: column;
482
- gap: 4px;
483
- padding: 10px 10px;
484
- margin: 4px 6px;
485
- border: none;
486
- border-bottom: 1px solid rgba(255, 255, 255, 0.06);
487
- border-radius: 14px;
488
- background: transparent;
481
+ gap: 5px;
482
+ padding: 12px 12px;
483
+ margin: 0;
484
+ border: 1px solid transparent;
485
+ border-radius: 16px;
486
+ background: rgba(255, 255, 255, 0.022);
489
487
  cursor: pointer;
490
488
  box-sizing: border-box;
491
- transition: background 0.15s ease, color 0.15s ease, margin 0.15s ease, padding 0.15s ease, border-color 0.15s ease;
489
+ transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
492
490
  }
493
491
 
494
- .${annotateSidebarQueueItemClass}:hover { background: rgba(255, 255, 255, 0.04); }
495
- .${annotateSidebarQueueItemClass}:focus-visible { outline: none; background: rgba(255, 255, 255, 0.03); box-shadow: inset 0 0 0 1px var(--inspecto-border-focus); }
496
- .${annotateSidebarQueueItemClass}[data-selected="true"] { background: rgba(93, 82, 243, 0.1); box-shadow: inset 3px 0 0 rgba(93, 82, 243, 0.85); border-bottom-color: transparent; }
497
- .${annotateSidebarQueueItemClass} > :not(.${annotateSidebarActionsClass}):first-child { font-size: 12px; line-height: 1.4; color: var(--inspecto-text-primary); word-break: break-word; }
498
- .${annotateSidebarQueueItemClass} > .${annotateSidebarQueueMetaClass} { order: 2; font-size: 10px; line-height: 1.35; color: var(--inspecto-text-tertiary); }
499
- .${annotateQueueListClass} > .${annotateSidebarQueueItemClass}:last-child { border-bottom: none; padding-bottom: 2px; }
492
+ .${annotateSidebarQueueItemClass}:hover {
493
+ background: rgba(255, 255, 255, 0.05);
494
+ border-color: rgba(148, 163, 184, 0.16);
495
+ transform: translateY(-1px);
496
+ }
497
+ .${annotateSidebarQueueItemClass}:focus-visible {
498
+ outline: none;
499
+ background: rgba(255, 255, 255, 0.05);
500
+ border-color: var(--inspecto-border-focus);
501
+ box-shadow: 0 0 0 1px var(--inspecto-border-focus);
502
+ }
503
+ .${annotateSidebarQueueItemClass}[data-selected="true"] {
504
+ background: linear-gradient(180deg, rgba(14, 165, 233, 0.12) 0%, rgba(14, 165, 233, 0.07) 100%);
505
+ border-color: rgba(14, 165, 233, 0.28);
506
+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 10px 24px rgba(8, 14, 24, 0.16);
507
+ }
508
+ .${annotateSidebarQueueItemClass} > :not(.${annotateSidebarActionsClass}):first-child {
509
+ font-size: 12px;
510
+ line-height: 1.45;
511
+ color: var(--inspecto-text-primary);
512
+ word-break: break-word;
513
+ font-weight: 620;
514
+ }
515
+ .${annotateSidebarQueueItemClass} > .${annotateSidebarQueueMetaClass} { order: 2; font-size: 10px; line-height: 1.4; color: var(--inspecto-text-tertiary); }
500
516
 
501
517
  .${annotateSidebarTargetItemClass} {
502
518
  display: grid;
@@ -504,14 +520,12 @@ var init_styles_annotate = __esm({
504
520
  grid-template-areas: "label action";
505
521
  column-gap: 10px;
506
522
  align-items: center;
507
- padding: 6px 0;
508
- border: none;
509
- border-radius: 0;
510
- border-bottom: 1px solid rgba(127, 127, 127, 0.16);
511
- background: transparent;
523
+ padding: 10px 12px;
524
+ border-color: rgba(148, 163, 184, 0.12);
525
+ background: rgba(255, 255, 255, 0.02);
512
526
  }
513
527
 
514
- .${annotateTargetListClass} > .${annotateSidebarTargetItemClass}:last-child { border-bottom: none; padding-bottom: 0; }
528
+ .${annotateTargetListClass} > .${annotateSidebarTargetItemClass}:last-child { margin-bottom: 0; }
515
529
 
516
530
  .${annotateBadgeClass} {
517
531
  grid-area: label;
@@ -536,22 +550,22 @@ var init_styles_annotate = __esm({
536
550
  line-height: 1.5;
537
551
  }
538
552
 
539
- .${annotateSidebarFooterClass} { display: flex; flex-direction: column; gap: 8px; padding-top: 2px; }
540
- .${annotateSidebarFooterClass} .${annotateSidebarActionsClass} { justify-content: flex-end; align-items: stretch; }
541
- .${annotateSidebarActionsClass} { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
553
+ .${annotateSidebarFooterClass} { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
554
+ .${annotateSidebarFooterClass} .${annotateSidebarActionsClass} { justify-content: flex-end; align-items: stretch; gap: 10px; }
555
+ .${annotateSidebarActionsClass} { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; justify-content: flex-end; }
542
556
 
543
557
  .${annotateSidebarButtonClass} {
544
558
  appearance: none;
545
559
  border: 1px solid var(--inspecto-border-subtle);
546
- background: rgba(255, 255, 255, 0.04);
560
+ background: rgba(255, 255, 255, 0.05);
547
561
  color: var(--inspecto-text-primary);
548
562
  border-radius: var(--inspecto-radius-pill);
549
- padding: 7px 10px;
563
+ padding: 8px 12px;
550
564
  font: inherit;
551
565
  font-size: 11px;
552
- font-weight: 500;
566
+ font-weight: 600;
553
567
  cursor: pointer;
554
- transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
568
+ transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
555
569
  }
556
570
 
557
571
  .${annotateSidebarButtonClass}[data-role="mode"][data-selected="true"] { background: rgba(255, 255, 255, 0.1); color: #ffffff; border-color: transparent; }
@@ -560,11 +574,55 @@ var init_styles_annotate = __esm({
560
574
  .${annotateSidebarHeaderClass} .${annotateSidebarButtonClass} { width: 30px; height: 30px; padding: 0; border-radius: var(--inspecto-radius-pill); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; line-height: 1; flex: 0 0 auto; }
561
575
  .${annotateSidebarHeaderClass} .${runtimeToggleClass} { overflow: visible; }
562
576
  .${annotateSidebarHeaderClass} [data-inspecto-annotate-header-actions="true"] { padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.025); border: 1px solid rgba(255, 255, 255, 0.05); gap: 4px; flex-wrap: nowrap; flex: 0 0 auto; margin-top: 1px; }
563
- .${annotateSidebarButtonClass}:hover { background: var(--inspecto-surface-hover); color: #ffffff; border-color: transparent; transform: translateY(-1px); }
577
+ .${annotateSidebarButtonClass}:hover { background: var(--inspecto-surface-hover); color: #ffffff; border-color: rgba(148, 163, 184, 0.12); transform: translateY(-1px); }
564
578
  .${annotateSidebarButtonClass}:disabled { opacity: 0.5; cursor: not-allowed; }
565
- .${annotateSidebarClass} .${annotateSidebarButtonClass}.primary { background: linear-gradient(180deg, var(--inspecto-accent-primary) 0%, var(--inspecto-accent-primary-strong) 100%); color: #ffffff; border-color: transparent; box-shadow: var(--inspecto-shadow-accent); }
566
- .${annotateSidebarFooterClass} .${annotateSidebarButtonClass} { min-height: 36px; padding: 0 12px; font-size: 11px; font-weight: 600; border-radius: var(--inspecto-radius-pill); }
567
- .${annotateSidebarFooterClass} .${annotateSidebarButtonClass}[data-role="raw-preview"] { min-width: 48px; justify-content: center; color: var(--inspecto-text-secondary); background: rgba(255, 255, 255, 0.045); }
579
+ .${annotateSidebarClass} .${annotateSidebarButtonClass}.primary {
580
+ background: linear-gradient(180deg, var(--inspecto-accent-primary) 0%, var(--inspecto-accent-primary-strong) 100%);
581
+ color: #ffffff;
582
+ border-color: rgba(14, 165, 233, 0.22);
583
+ box-shadow: var(--inspecto-shadow-accent);
584
+ }
585
+ .${annotateSidebarFooterClass} .${annotateSidebarButtonClass} {
586
+ min-height: 40px;
587
+ padding: 0 14px;
588
+ font-size: 11px;
589
+ font-weight: 650;
590
+ border-radius: var(--inspecto-radius-pill);
591
+ justify-content: center;
592
+ display: inline-flex;
593
+ align-items: center;
594
+ }
595
+ .${annotateSidebarFooterClass} .${annotateSidebarButtonClass}[data-emphasis="secondary"] {
596
+ background: rgba(255, 255, 255, 0.04);
597
+ color: var(--inspecto-text-secondary);
598
+ border-color: rgba(148, 163, 184, 0.12);
599
+ box-shadow: none;
600
+ opacity: 0.92;
601
+ white-space: nowrap;
602
+ }
603
+ .${annotateSidebarFooterClass} .${annotateSidebarButtonClass}[data-role="quick-ask"][data-emphasis="secondary"] {
604
+ background: rgba(255, 255, 255, 0.04);
605
+ color: var(--inspecto-text-secondary);
606
+ border-color: rgba(148, 163, 184, 0.12);
607
+ text-decoration: none;
608
+ min-height: 40px;
609
+ padding: 0 14px;
610
+ box-shadow: none;
611
+ white-space: nowrap;
612
+ }
613
+ .${annotateSidebarFooterClass} .${annotateSidebarButtonClass}[data-emphasis="secondary"]:hover {
614
+ background: rgba(255, 255, 255, 0.08);
615
+ color: #ffffff;
616
+ border-color: rgba(255, 255, 255, 0.12);
617
+ transform: translateY(-1px);
618
+ }
619
+ .${annotateSidebarFooterClass} .${annotateSidebarButtonClass}[data-role="quick-ask"][data-emphasis="secondary"]:hover {
620
+ background: rgba(255, 255, 255, 0.08);
621
+ border-color: rgba(255, 255, 255, 0.12);
622
+ color: #ffffff;
623
+ transform: translateY(-1px);
624
+ }
625
+ .${annotateSidebarFooterClass} .${annotateSidebarButtonClass}[data-role="raw-preview"] { min-width: 48px; justify-content: center; color: var(--inspecto-text-secondary); background: rgba(255, 255, 255, 0.045); padding: 0 10px; }
568
626
  .${annotateSidebarFooterClass} .${annotateSidebarButtonClass}[data-role="raw-preview"][data-selected="true"] { background: rgba(93, 82, 243, 0.16); border-color: rgba(93, 82, 243, 0.32); color: #e5e2ff; }
569
627
  .${annotateSidebarFooterClass} .${annotateSidebarButtonClass}[data-role="send-all"] { min-width: 76px; }
570
628
 
@@ -789,10 +847,26 @@ var init_styles_launcher = __esm({
789
847
  }
790
848
 
791
849
  .${badgeClass}-panel-header {
850
+ display: flex;
851
+ align-items: flex-start;
852
+ justify-content: space-between;
853
+ gap: 10px;
854
+ padding: 2px 4px 4px;
855
+ }
856
+
857
+ .${badgeClass}-panel-header-copy {
792
858
  display: flex;
793
859
  flex-direction: column;
794
860
  gap: 3px;
795
- padding: 2px 4px 4px;
861
+ min-width: 0;
862
+ flex: 1 1 auto;
863
+ }
864
+
865
+ .${badgeClass}-panel-header-actions {
866
+ display: inline-flex;
867
+ align-items: center;
868
+ gap: 6px;
869
+ flex: 0 0 auto;
796
870
  }
797
871
 
798
872
  .${badgeClass}-panel-header [data-inspecto-launcher-panel-title="true"] {
@@ -817,6 +891,7 @@ var init_styles_launcher = __esm({
817
891
  .${badgeClass}-panel-group[data-inspecto-launcher-utility-group="true"] {
818
892
  padding-top: 6px;
819
893
  border-top: 1px solid rgba(255, 255, 255, 0.06);
894
+ gap: 6px;
820
895
  }
821
896
 
822
897
  .${badgeClass}-panel-button {
@@ -880,27 +955,47 @@ var init_styles_launcher = __esm({
880
955
 
881
956
  .${badgeClass}-panel-button:disabled { cursor: not-allowed; opacity: 0.5; }
882
957
 
883
- .${badgeClass}-panel-button.secondary {
958
+ .${badgeClass}-panel-toggle-button {
959
+ appearance: none;
960
+ width: 28px;
961
+ height: 28px;
884
962
  padding: 0;
885
- background: transparent;
963
+ border: 1px solid var(--inspecto-border-subtle);
964
+ border-radius: var(--inspecto-radius-pill);
965
+ background: var(--inspecto-surface-subtle);
886
966
  color: var(--inspecto-text-secondary);
887
- border-color: transparent;
888
- display: flex;
889
- align-items: flex-start;
967
+ display: inline-flex;
968
+ align-items: center;
890
969
  justify-content: center;
891
- gap: 4px;
892
- box-shadow: none;
893
- min-height: 0;
970
+ cursor: pointer;
971
+ transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
894
972
  }
895
973
 
896
- .${badgeClass}-panel-button.secondary [data-inspecto-launcher-title="true"] {
897
- font-weight: 600;
898
- font-size: 11px;
974
+ .${badgeClass}-panel-toggle-button svg {
975
+ width: 14px;
976
+ height: 14px;
977
+ display: block;
978
+ }
979
+
980
+ .${badgeClass}-panel-toggle-button[aria-pressed="true"] {
981
+ background: linear-gradient(180deg, var(--inspecto-accent-primary) 0%, var(--inspecto-accent-primary-strong) 100%);
982
+ color: #ffffff;
983
+ border-color: transparent;
984
+ box-shadow: 0 10px 18px rgba(70, 57, 215, 0.24);
899
985
  }
900
986
 
901
- .${badgeClass}-panel-button.secondary [data-inspecto-launcher-description="true"] {
987
+ .${badgeClass}-panel-toggle-button:hover {
988
+ transform: translateY(-1px);
989
+ border-color: rgba(255, 255, 255, 0.12);
990
+ }
991
+
992
+ .${badgeClass}-panel-status-text {
902
993
  font-size: 10px;
903
- max-width: none;
994
+ font-weight: 600;
995
+ line-height: 1.2;
996
+ color: var(--inspecto-text-secondary);
997
+ white-space: nowrap;
998
+ text-align: right;
904
999
  }
905
1000
 
906
1001
  .${badgeClass}-panel-hint {
@@ -1231,8 +1326,7 @@ var init_styles_overlay_menu = __esm({
1231
1326
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
1232
1327
  }
1233
1328
 
1234
- .${menuItemClass}[data-role="runtime-context-toggle"],
1235
- .${menuItemClass}[data-role="screenshot-context-toggle"] {
1329
+ .${menuItemClass}[data-role="runtime-context-toggle"] {
1236
1330
  flex: 0 0 auto;
1237
1331
  width: 28px;
1238
1332
  height: 28px;
@@ -1357,6 +1451,7 @@ var init_styles_theme = __esm({
1357
1451
  --inspecto-text-tertiary: rgba(255, 255, 255, 0.46);
1358
1452
  --inspecto-accent-primary: #5d52f3;
1359
1453
  --inspecto-accent-primary-strong: #4639d7;
1454
+ --inspecto-success-color: #10b981;
1360
1455
  --inspecto-shadow-floating: 0 20px 48px rgba(0, 0, 0, 0.28);
1361
1456
  --inspecto-shadow-accent: 0 8px 18px rgba(79, 70, 229, 0.28);
1362
1457
  --inspecto-radius-pill: 999px;
@@ -1404,6 +1499,7 @@ var init_styles_theme = __esm({
1404
1499
  --inspecto-text-tertiary: rgba(255, 255, 255, 0.46);
1405
1500
  --inspecto-accent-primary: #5d52f3;
1406
1501
  --inspecto-accent-primary-strong: #4639d7;
1502
+ --inspecto-success-color: #10b981;
1407
1503
  --inspecto-shadow-floating: 0 20px 48px rgba(0, 0, 0, 0.28);
1408
1504
  --inspecto-shadow-accent: 0 8px 18px rgba(79, 70, 229, 0.28);
1409
1505
  --inspecto-radius-pill: 999px;
@@ -1463,7 +1559,7 @@ function applyHeaderIconButtonStyles(button) {
1463
1559
  button.style.borderColor = "var(--inspecto-border-subtle)";
1464
1560
  button.style.background = "var(--inspecto-surface-subtle)";
1465
1561
  button.style.color = "var(--inspecto-text-secondary)";
1466
- button.style.font = '600 14px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif';
1562
+ button.style.font = '600 11px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif';
1467
1563
  button.style.borderRadius = "var(--inspecto-radius-pill)";
1468
1564
  button.style.display = "inline-flex";
1469
1565
  button.style.alignItems = "center";
@@ -1489,12 +1585,11 @@ var init_styles = __esm({
1489
1585
  });
1490
1586
 
1491
1587
  // src/icons.ts
1492
- var bugIconSvg, screenshotIconSvg, inspectFilledIconSvg, cssIconSvg, pureMarkIconSvg, closeIconSvg, pauseIconSvg, playIconSvg;
1588
+ var bugIconSvg, inspectFilledIconSvg, cssIconSvg, pureMarkIconSvg, closeIconSvg, pauseIconSvg, playIconSvg;
1493
1589
  var init_icons = __esm({
1494
1590
  "src/icons.ts"() {
1495
1591
  "use strict";
1496
1592
  bugIconSvg = `<svg viewBox="0 0 24 24" width="16" height="16" fill="none" xmlns="http://www.w3.org/2000/svg" stroke=""><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M17.416 2.62412C17.7607 2.39435 17.8538 1.9287 17.624 1.58405C17.3943 1.23941 16.9286 1.14628 16.584 1.37604L13.6687 3.31955C13.1527 3.11343 12.5897 3.00006 12.0001 3.00006C11.4105 3.00006 10.8474 3.11345 10.3314 3.31962L7.41603 1.37604C7.07138 1.14628 6.60573 1.23941 6.37596 1.58405C6.1462 1.9287 6.23933 2.39435 6.58397 2.62412L8.9437 4.19727C8.24831 4.84109 7.75664 5.70181 7.57617 6.6719C8.01128 6.55973 8.46749 6.50006 8.93763 6.50006H15.0626C15.5328 6.50006 15.989 6.55973 16.4241 6.6719C16.2436 5.70176 15.7519 4.841 15.0564 4.19717L17.416 2.62412Z" fill="currentColor"></path> <path d="M1.25 14.0001C1.25 13.5859 1.58579 13.2501 2 13.2501H5V11.9376C5 11.1019 5.26034 10.327 5.70435 9.68959L3.22141 8.69624C2.83684 8.54238 2.6498 8.10589 2.80366 7.72131C2.95752 7.33673 3.39401 7.1497 3.77859 7.30356L6.91514 8.55841C7.50624 8.20388 8.19807 8.00006 8.9375 8.00006H15.0625C15.8019 8.00006 16.4938 8.20388 17.0849 8.55841L20.2214 7.30356C20.606 7.1497 21.0425 7.33673 21.1963 7.72131C21.3502 8.10589 21.1632 8.54238 20.7786 8.69624L18.2957 9.68959C18.7397 10.327 19 11.1019 19 11.9376V13.2501H22C22.4142 13.2501 22.75 13.5859 22.75 14.0001C22.75 14.4143 22.4142 14.7501 22 14.7501H19V15.0001C19 16.1808 18.7077 17.2932 18.1915 18.2689L20.7786 19.3039C21.1632 19.4578 21.3502 19.8943 21.1963 20.2789C21.0425 20.6634 20.606 20.8505 20.2214 20.6966L17.3288 19.5394C16.1974 20.8664 14.5789 21.7655 12.75 21.9604V15.0001C12.75 14.5858 12.4142 14.2501 12 14.2501C11.5858 14.2501 11.25 14.5858 11.25 15.0001V21.9604C9.42109 21.7655 7.80265 20.8664 6.67115 19.5394L3.77859 20.6966C3.39401 20.8505 2.95752 20.6634 2.80366 20.2789C2.6498 19.8943 2.83684 19.4578 3.22141 19.3039L5.80852 18.2689C5.29231 17.2932 5 16.1808 5 15.0001V14.7501H2C1.58579 14.7501 1.25 14.4143 1.25 14.0001Z" fill="currentColor"></path> </g></svg>`;
1497
- screenshotIconSvg = `<svg viewBox="-0.51 -0.51 51.82 51.82" width="16" height="16" xmlns="http://www.w3.org/2000/svg" fill="none"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="5.08"> <path d="M19.844 7.938H7.938v11.905m0 11.113v11.906h11.905m23.019-11.906v11.906H30.956m11.906-23.018V7.938H30.956"></path> <circle cx="25.4" cy="25.4" r="8.731"></circle> </g> </g></svg>`;
1498
1593
  inspectFilledIconSvg = `<svg viewBox="0 0 512 512" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="#000000"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <title>mouse-select-filled</title> <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <g id="add" fill="currentColor" transform="translate(62.226343, 62.126933)"> <polygon id="Fill-6" points="7.10542736e-15 7.10542736e-15 364.440324 103.2064 276.37835 189.916864 369.025732 282.559083 282.478894 369.108395 189.860868 276.466176 103.10699 364.539733"> </polygon> </g> </g> </g></svg>`;
1499
1594
  cssIconSvg = `<svg height="200px" width="200px" version="1.1" id="_x32_" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 512 512" xml:space="preserve" fill="#000000"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <style type="text/css"> .st0{fill:currentColor;} </style> <g> <path class="st0" d="M378.413,0H208.297h-13.182L185.8,9.314L57.02,138.102l-9.314,9.314v13.176v265.514 c0,47.36,38.528,85.895,85.896,85.895h244.811c47.353,0,85.881-38.535,85.881-85.895V85.896C464.294,38.528,425.766,0,378.413,0z M432.497,426.105c0,29.877-24.214,54.091-54.084,54.091H133.602c-29.884,0-54.098-24.214-54.098-54.091V160.591h83.716 c24.885,0,45.077-20.178,45.077-45.07V31.804h170.116c29.87,0,54.084,24.214,54.084,54.092V426.105z"></path> <path class="st0" d="M169.574,268.949c5.837,0,9.104,2.171,12.499,6.786c2.709,3.805,5.432,5.167,8.825,5.167 c5.028,0,9.105-3.673,9.105-8.965c0-2.171-0.684-4.078-1.774-5.977c-4.622-8.288-14.802-14.669-28.655-14.669 c-16.171,0-28.124,7.603-33.012,22.685c-1.899,6.11-2.57,10.865-2.57,24.989c0,14.125,0.67,18.881,2.57,24.99 c4.888,15.081,16.841,22.685,33.012,22.685c13.853,0,24.033-6.382,28.655-14.67c1.09-1.899,1.774-3.805,1.774-5.976 c0-5.3-4.078-8.965-9.105-8.965c-3.393,0-6.116,1.361-8.825,5.16c-3.394,4.622-6.662,6.794-12.499,6.794 c-7.471,0-11.814-3.938-13.853-10.187c-1.089-3.393-1.494-6.654-1.494-19.83c0-13.175,0.406-16.436,1.494-19.829 C157.76,272.887,162.103,268.949,169.574,268.949z"></path> <path class="st0" d="M255.149,289.595l-4.888-0.684c-10.725-1.494-14.398-5.02-14.398-10.187c0-5.837,4.343-9.915,12.498-9.915 c5.698,0,11.409,1.634,15.892,3.805c1.899,0.95,3.938,1.494,5.837,1.494c4.888,0,8.7-3.666,8.7-8.693 c0-3.261-1.494-5.977-4.762-8.016c-5.432-3.394-15.612-6.11-25.806-6.11c-19.97,0-32.733,11.269-32.733,28.25 c0,16.304,10.32,25.13,29.2,27.713l4.901,0.677c10.99,1.494,14.258,4.888,14.258,10.32c0,6.389-5.306,10.872-15.082,10.872 c-6.787,0-12.219-1.767-19.83-5.977c-1.634-0.956-3.672-1.634-5.837-1.634c-5.166,0-8.965,3.938-8.965,8.832 c0,3.254,1.634,6.382,4.748,8.42c6.116,3.799,16.031,7.876,29.074,7.876c24.032,0,36.266-12.358,36.266-29.067 C284.223,300.865,274.307,292.311,255.149,289.595z"></path> <path class="st0" d="M338.697,289.595l-4.888-0.684c-10.738-1.494-14.398-5.02-14.398-10.187c0-5.837,4.344-9.915,12.484-9.915 c5.712,0,11.423,1.634,15.892,3.805c1.913,0.95,3.952,1.494,5.851,1.494c4.887,0,8.686-3.666,8.686-8.693 c0-3.261-1.494-5.977-4.748-8.016c-5.432-3.394-15.626-6.11-25.806-6.11c-19.969,0-32.733,11.269-32.733,28.25 c0,16.304,10.32,25.13,29.2,27.713l4.888,0.677c11.004,1.494,14.258,4.888,14.258,10.32c0,6.389-5.292,10.872-15.068,10.872 c-6.8,0-12.232-1.767-19.829-5.977c-1.634-0.956-3.673-1.634-5.851-1.634c-5.153,0-8.965,3.938-8.965,8.832 c0,3.254,1.634,6.382,4.762,8.42c6.117,3.799,16.032,7.876,29.06,7.876c24.047,0,36.266-12.358,36.266-29.067 C367.758,300.865,357.843,292.311,338.697,289.595z"></path> </g> </g></svg>`;
1500
1595
  pureMarkIconSvg = `<svg viewBox="0 0 24 24" width="16" height="16" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="1.75"></circle><path d="M12 6.5C8.962 6.5 6.5 8.962 6.5 12S8.962 17.5 12 17.5H17.5V12C17.5 8.962 15.038 6.5 12 6.5Z" fill="currentColor" opacity="0.28"></path><path d="M12 9V15" stroke="currentColor" stroke-width="1.75" stroke-linecap="round"></path><path d="M9 12H15" stroke="currentColor" stroke-width="1.75" stroke-linecap="round"></path></svg>`;
@@ -1504,6 +1599,248 @@ var init_icons = __esm({
1504
1599
  }
1505
1600
  });
1506
1601
 
1602
+ // src/i18n.ts
1603
+ function normalizeLocale(locale) {
1604
+ if (!locale) return DEFAULT_LOCALE;
1605
+ if (BUILTIN_MESSAGES[locale]) return locale;
1606
+ if (locale.toLowerCase().startsWith("zh")) return "zh-CN";
1607
+ if (locale.toLowerCase().startsWith("en")) return "en";
1608
+ return DEFAULT_LOCALE;
1609
+ }
1610
+ function resolveBrowserLocale() {
1611
+ if (typeof navigator === "undefined") return DEFAULT_LOCALE;
1612
+ return normalizeLocale(navigator.language);
1613
+ }
1614
+ function interpolate(template, vars) {
1615
+ if (!vars) return template;
1616
+ return template.replace(/\{(\w+)\}/g, (_, key) => {
1617
+ var _a2;
1618
+ return String((_a2 = vars[key]) != null ? _a2 : "");
1619
+ });
1620
+ }
1621
+ function configureI18n(input) {
1622
+ var _a2, _b;
1623
+ currentLocale = normalizeLocale((_a2 = input == null ? void 0 : input.locale) != null ? _a2 : resolveBrowserLocale());
1624
+ currentMessages = (_b = input == null ? void 0 : input.messages) != null ? _b : {};
1625
+ }
1626
+ function t(key, vars) {
1627
+ var _a2, _b, _c, _d, _e;
1628
+ const message = (_e = (_d = (_b = currentMessages[key]) != null ? _b : (_a2 = BUILTIN_MESSAGES[currentLocale]) == null ? void 0 : _a2[key]) != null ? _d : (_c = BUILTIN_MESSAGES[DEFAULT_LOCALE]) == null ? void 0 : _c[key]) != null ? _e : key;
1629
+ return interpolate(message, vars);
1630
+ }
1631
+ function runtimeSummaryLabel(kind, count) {
1632
+ const suffix = count === 1 ? "one" : "other";
1633
+ return t(`runtime.summary.${kind}.${suffix}`, { count });
1634
+ }
1635
+ var DEFAULT_LOCALE, EN_MESSAGES, ZH_CN_MESSAGES, BUILTIN_MESSAGES, currentLocale, currentMessages;
1636
+ var init_i18n = __esm({
1637
+ "src/i18n.ts"() {
1638
+ "use strict";
1639
+ DEFAULT_LOCALE = "en";
1640
+ EN_MESSAGES = {
1641
+ "launcher.title": "Inspecto",
1642
+ "launcher.panel.title": "Choose a mode",
1643
+ "launcher.panel.subtitle": "Your next page click will follow this mode.",
1644
+ "launcher.action.inspect.title": "Inspect",
1645
+ "launcher.action.inspect.description": "Click one component to inspect or ask AI",
1646
+ "launcher.action.annotate.title": "Annotate",
1647
+ "launcher.action.annotate.description": "Capture notes across components, then create a task or ask once",
1648
+ "launcher.action.pause.title": "Pause selection",
1649
+ "launcher.action.pause.description": "Use the page normally for a moment",
1650
+ "launcher.action.resume.title": "Resume selection",
1651
+ "launcher.action.resume.description": "Start capturing page clicks again",
1652
+ "launcher.hint.hotkeyDisabled": "Hotkey disabled. Open the launcher to choose Inspect or Annotate.",
1653
+ "launcher.hint.hotkeyQuickJump": "Hotkey: {hotkey} for quick jump",
1654
+ "launcher.state.paused": "Selection paused",
1655
+ "launcher.state.annotate": "Annotate mode",
1656
+ "launcher.state.inspect": "Inspect mode",
1657
+ "launcher.state.ready": "Ready",
1658
+ "menu.openInEditor": "Open in Editor",
1659
+ "menu.attachRuntime": "Attach runtime context",
1660
+ "menu.runtimeEnabled": "Runtime context enabled",
1661
+ "menu.runtimeFixOnly": "Runtime context defaults to fix actions only until you choose otherwise",
1662
+ "menu.attachCss": "Attach CSS context",
1663
+ "menu.cssEnabled": "CSS context enabled",
1664
+ "menu.ask.placeholder.default": "Add a custom ask or extra instruction...",
1665
+ "menu.ask.placeholder.fallback": "Ask anything about this component...",
1666
+ "menu.ask.placeholder.setup": "Inspecto setup needs attention...",
1667
+ "menu.ask.ariaLabel": "Custom ask",
1668
+ "menu.preview.show": "Show preview",
1669
+ "menu.preview.hide": "Hide preview",
1670
+ "menu.sending": "Sending...",
1671
+ "menu.error.openIde": "Unable to open file in the editor.",
1672
+ "annotate.mode.title": "Annotate mode",
1673
+ "annotate.quickCapture.toggle": "Toggle quick capture",
1674
+ "annotate.exitMode": "Exit annotate mode",
1675
+ "annotate.empty.title": "Start by clicking a component",
1676
+ "annotate.empty.body": "Each click opens one note. Save a few notes first, then add an overall goal and create a task or ask once.",
1677
+ "annotate.instruction.placeholder": "Overall goal for this batch (optional)...",
1678
+ "annotate.instruction.ariaLabel": "Overall goal",
1679
+ "annotate.previewMessage": "Preview message",
1680
+ "annotate.batchPayload": "Batch payload",
1681
+ "annotate.previewRawPrompt": "View raw prompt payload",
1682
+ "annotate.copyContext": "Copy context",
1683
+ "annotate.copyContext.copied": "Copied",
1684
+ "annotate.copyContext.failed": "Failed to copy",
1685
+ "annotate.saveNote": "Save note",
1686
+ "annotate.updateNote": "Update note",
1687
+ "annotate.askAi": "Ask AI",
1688
+ "annotate.askAiHint": "Ask AI",
1689
+ "annotate.createTask": "Create Task",
1690
+ "annotate.createTaskHint": "Create Task",
1691
+ "annotate.recommendedAction": "Recommended: {action}",
1692
+ "annotate.recommendedAction.agentHint": "Recommended: {action}",
1693
+ "annotate.recommendedAction.askHint": "Recommended: {action}",
1694
+ "annotate.sent": "Sent",
1695
+ "annotate.taskCreated": "Created",
1696
+ "annotate.cancel": "Cancel",
1697
+ "annotate.delete": "Delete",
1698
+ "annotate.composer.placeholder": "What should change for this component?",
1699
+ "annotate.records.none": "No records included yet.",
1700
+ "annotate.target.unknown": "Unknown target",
1701
+ "annotate.source.unknown": "Unknown source",
1702
+ "annotate.note.optionalEmpty": "Optional note left empty.",
1703
+ "annotate.note.none": "No note provided",
1704
+ "annotate.runtimeErrors": "{count} errors",
1705
+ "annotate.liveStatus.quickAskSending": "Sending notes to your IDE assistant.",
1706
+ "annotate.liveStatus.createTaskSending": "Creating a task from your notes.",
1707
+ "annotate.liveStatus.quickAskSent": "Notes sent to your IDE assistant.",
1708
+ "annotate.liveStatus.taskCreated": "Task created from your notes.",
1709
+ "annotate.latestSession.title": "Current task",
1710
+ "annotate.latestSession.refresh": "Refresh current task",
1711
+ "annotate.latestSession.meta.loaded": "{count} annotations",
1712
+ "annotate.latestSession.meta.summary": "Refresh to load details",
1713
+ "annotate.latestSession.loading": "Refreshing latest task...",
1714
+ "annotate.latestSession.pending": "",
1715
+ "annotate.latestSession.acknowledged": "AI acknowledged.",
1716
+ "annotate.latestSession.inProgress": "AI working...",
1717
+ "annotate.latestSession.resolved": "AI finished. Check the page.",
1718
+ "annotate.latestSession.dismissed": "Task dismissed.",
1719
+ "annotate.latestSession.noDetail": "Sent to AI.",
1720
+ "annotate.latestSession.hint.pending": "If it has not started, ask AI to continue.",
1721
+ "annotate.latestSession.hint.acknowledged": "AI connected. Waiting for update.",
1722
+ "annotate.latestSession.hint.in_progress": "Stay for updates, or refresh later.",
1723
+ "annotate.latestSession.hint.resolved": "Review the result. Create a follow-up if needed.",
1724
+ "annotate.latestSession.reconnect": "Reconnect",
1725
+ "annotate.latestSession.error.disconnected": "Connection lost. Reconnect to keep following this task.",
1726
+ "annotate.latestSession.status.pending": "waiting",
1727
+ "annotate.latestSession.status.acknowledged": "acknowledged",
1728
+ "annotate.latestSession.status.in_progress": "in progress",
1729
+ "annotate.latestSession.status.resolved": "complete",
1730
+ "annotate.latestSession.status.dismissed": "dismissed",
1731
+ "annotate.header.capturing": "Capturing clicks",
1732
+ "annotate.header.quickCaptureOn": "{label} on",
1733
+ "runtime.summary.error.one": "{count} runtime error",
1734
+ "runtime.summary.error.other": "{count} runtime errors",
1735
+ "runtime.summary.request.one": "{count} failed request",
1736
+ "runtime.summary.request.other": "{count} failed requests"
1737
+ };
1738
+ ZH_CN_MESSAGES = {
1739
+ "launcher.panel.title": "\u9009\u62E9\u6A21\u5F0F",
1740
+ "launcher.panel.subtitle": "\u4F60\u4E0B\u4E00\u6B21\u9875\u9762\u70B9\u51FB\u5C06\u6309\u5F53\u524D\u6A21\u5F0F\u6267\u884C\u3002",
1741
+ "launcher.action.inspect.title": "\u68C0\u67E5",
1742
+ "launcher.action.inspect.description": "\u70B9\u51FB\u4E00\u4E2A\u7EC4\u4EF6\u8FDB\u884C\u68C0\u67E5\u6216\u5411 AI \u63D0\u95EE",
1743
+ "launcher.action.annotate.title": "\u6279\u6CE8",
1744
+ "launcher.action.annotate.description": "\u8DE8\u7EC4\u4EF6\u8BB0\u5F55\u6279\u6CE8\uFF0C\u7136\u540E\u521B\u5EFA\u4EFB\u52A1\u6216\u4E00\u6B21\u6027\u63D0\u95EE",
1745
+ "launcher.action.pause.title": "\u6682\u505C\u9009\u62E9",
1746
+ "launcher.action.pause.description": "\u6682\u65F6\u6309\u6B63\u5E38\u65B9\u5F0F\u64CD\u4F5C\u9875\u9762",
1747
+ "launcher.action.resume.title": "\u6062\u590D\u9009\u62E9",
1748
+ "launcher.action.resume.description": "\u91CD\u65B0\u5F00\u59CB\u6355\u83B7\u9875\u9762\u70B9\u51FB",
1749
+ "launcher.hint.hotkeyDisabled": "\u5FEB\u6377\u952E\u5DF2\u7981\u7528\u3002\u6253\u5F00\u542F\u52A8\u5668\u540E\u9009\u62E9\u201C\u68C0\u67E5\u201D\u6216\u201C\u6279\u6CE8\u201D\u3002",
1750
+ "launcher.hint.hotkeyQuickJump": "\u5FEB\u6377\u952E\uFF1A{hotkey}\uFF08\u5FEB\u901F\u8DF3\u8F6C\uFF09",
1751
+ "launcher.state.paused": "\u5DF2\u6682\u505C\u9009\u62E9",
1752
+ "launcher.state.annotate": "\u6279\u6CE8\u6A21\u5F0F",
1753
+ "launcher.state.inspect": "\u68C0\u67E5\u6A21\u5F0F",
1754
+ "launcher.state.ready": "\u5C31\u7EEA",
1755
+ "menu.openInEditor": "\u5728\u7F16\u8F91\u5668\u4E2D\u6253\u5F00",
1756
+ "menu.attachRuntime": "\u9644\u52A0\u8FD0\u884C\u65F6\u4E0A\u4E0B\u6587",
1757
+ "menu.runtimeEnabled": "\u5DF2\u542F\u7528\u8FD0\u884C\u65F6\u4E0A\u4E0B\u6587",
1758
+ "menu.runtimeFixOnly": "\u8FD0\u884C\u65F6\u4E0A\u4E0B\u6587\u9ED8\u8BA4\u4EC5\u7528\u4E8E\u4FEE\u590D\u7C7B\u64CD\u4F5C\uFF0C\u76F4\u5230\u4F60\u624B\u52A8\u5207\u6362",
1759
+ "menu.attachCss": "\u9644\u52A0 CSS \u4E0A\u4E0B\u6587",
1760
+ "menu.cssEnabled": "\u5DF2\u542F\u7528 CSS \u4E0A\u4E0B\u6587",
1761
+ "menu.ask.placeholder.default": "\u6DFB\u52A0\u81EA\u5B9A\u4E49\u63D0\u95EE\u6216\u989D\u5916\u8BF4\u660E...",
1762
+ "menu.ask.placeholder.fallback": "\u8BE2\u95EE\u4E0E\u6B64\u7EC4\u4EF6\u76F8\u5173\u7684\u4EFB\u4F55\u95EE\u9898...",
1763
+ "menu.ask.placeholder.setup": "Inspecto \u73AF\u5883\u9700\u8981\u68C0\u67E5...",
1764
+ "menu.ask.ariaLabel": "\u81EA\u5B9A\u4E49\u63D0\u95EE",
1765
+ "menu.preview.show": "\u663E\u793A\u9884\u89C8",
1766
+ "menu.preview.hide": "\u9690\u85CF\u9884\u89C8",
1767
+ "menu.sending": "\u53D1\u9001\u4E2D...",
1768
+ "menu.error.openIde": "\u65E0\u6CD5\u5728\u7F16\u8F91\u5668\u4E2D\u6253\u5F00\u6587\u4EF6\u3002",
1769
+ "annotate.mode.title": "\u6279\u6CE8\u6A21\u5F0F",
1770
+ "annotate.quickCapture.toggle": "\u5207\u6362\u5FEB\u901F\u6355\u83B7",
1771
+ "annotate.exitMode": "\u9000\u51FA\u6279\u6CE8\u6A21\u5F0F",
1772
+ "annotate.empty.title": "\u5148\u70B9\u51FB\u4E00\u4E2A\u7EC4\u4EF6\u5F00\u59CB",
1773
+ "annotate.empty.body": "\u6BCF\u6B21\u70B9\u51FB\u53EF\u8BB0\u5F55\u4E00\u6761\u6279\u6CE8\u3002\u5148\u4FDD\u5B58\u51E0\u6761\uFF0C\u518D\u8865\u5145\u6574\u4F53\u76EE\u6807\uFF0C\u7136\u540E\u521B\u5EFA\u4EFB\u52A1\u6216\u4E00\u6B21\u6027\u63D0\u95EE\u3002",
1774
+ "annotate.instruction.placeholder": "\u672C\u6279\u6B21\u7684\u6574\u4F53\u76EE\u6807\uFF08\u53EF\u9009\uFF09...",
1775
+ "annotate.instruction.ariaLabel": "\u6574\u4F53\u76EE\u6807",
1776
+ "annotate.previewMessage": "\u9884\u89C8\u6D88\u606F",
1777
+ "annotate.batchPayload": "\u6279\u6B21\u8F7D\u8377",
1778
+ "annotate.previewRawPrompt": "\u67E5\u770B\u539F\u59CB prompt \u8F7D\u8377",
1779
+ "annotate.copyContext": "\u590D\u5236\u4E0A\u4E0B\u6587",
1780
+ "annotate.copyContext.copied": "\u5DF2\u590D\u5236",
1781
+ "annotate.copyContext.failed": "\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5",
1782
+ "annotate.saveNote": "\u4FDD\u5B58",
1783
+ "annotate.updateNote": "\u66F4\u65B0",
1784
+ "annotate.askAi": "\u95EE AI",
1785
+ "annotate.askAiHint": "\u95EE AI",
1786
+ "annotate.createTask": "\u521B\u5EFA\u4EFB\u52A1",
1787
+ "annotate.createTaskHint": "\u521B\u5EFA\u4EFB\u52A1",
1788
+ "annotate.recommendedAction": "\u63A8\u8350\uFF1A{action}",
1789
+ "annotate.recommendedAction.agentHint": "\u63A8\u8350\uFF1A{action}",
1790
+ "annotate.recommendedAction.askHint": "\u63A8\u8350\uFF1A{action}",
1791
+ "annotate.sent": "\u5DF2\u53D1\u9001",
1792
+ "annotate.taskCreated": "\u5DF2\u521B\u5EFA",
1793
+ "annotate.cancel": "\u53D6\u6D88",
1794
+ "annotate.delete": "\u5220\u9664",
1795
+ "annotate.composer.placeholder": "\u8FD9\u4E2A\u7EC4\u4EF6\u9700\u8981\u4FEE\u6539\u4EC0\u4E48\uFF1F",
1796
+ "annotate.records.none": "\u8FD8\u6CA1\u6709\u5305\u542B\u8BB0\u5F55\u3002",
1797
+ "annotate.target.unknown": "\u672A\u77E5\u76EE\u6807",
1798
+ "annotate.source.unknown": "\u672A\u77E5\u6765\u6E90",
1799
+ "annotate.note.optionalEmpty": "\u53EF\u9009\u5907\u6CE8\u4E3A\u7A7A\u3002",
1800
+ "annotate.note.none": "\u672A\u63D0\u4F9B\u5907\u6CE8",
1801
+ "annotate.runtimeErrors": "{count} \u4E2A\u9519\u8BEF",
1802
+ "annotate.liveStatus.quickAskSending": "\u6B63\u5728\u5C06\u6279\u6CE8\u53D1\u9001\u7ED9 AI \u52A9\u624B\u3002",
1803
+ "annotate.liveStatus.createTaskSending": "\u6B63\u5728\u6839\u636E\u6279\u6CE8\u521B\u5EFA\u4EFB\u52A1\u3002",
1804
+ "annotate.liveStatus.quickAskSent": "\u6279\u6CE8\u5DF2\u53D1\u9001\u7ED9 AI \u52A9\u624B\u3002",
1805
+ "annotate.liveStatus.taskCreated": "\u5DF2\u6839\u636E\u6279\u6CE8\u521B\u5EFA\u4EFB\u52A1\u3002",
1806
+ "annotate.latestSession.title": "\u5F53\u524D\u4EFB\u52A1",
1807
+ "annotate.latestSession.refresh": "\u5237\u65B0\u5F53\u524D\u4EFB\u52A1",
1808
+ "annotate.latestSession.meta.loaded": "\u5305\u542B {count} \u6761\u6279\u6CE8",
1809
+ "annotate.latestSession.meta.summary": "\u5305\u542B\u591A\u6761\u6279\u6CE8 \u2022 \u5237\u65B0\u4EE5\u52A0\u8F7D\u8BE6\u60C5",
1810
+ "annotate.latestSession.loading": "\u6B63\u5728\u5237\u65B0\u6700\u65B0\u4EFB\u52A1...",
1811
+ "annotate.latestSession.pending": "",
1812
+ "annotate.latestSession.acknowledged": "AI \u5DF2\u63A5\u624B\u3002",
1813
+ "annotate.latestSession.inProgress": "AI \u5904\u7406\u4E2D...",
1814
+ "annotate.latestSession.resolved": "AI \u5DF2\u5B8C\u6210\u5904\u7406\u3002\u8BF7\u56DE\u5230\u9875\u9762\u786E\u8BA4\u3002",
1815
+ "annotate.latestSession.dismissed": "\u4EFB\u52A1\u5DF2\u88AB\u5FFD\u7565\u3002",
1816
+ "annotate.latestSession.noDetail": "\u5DF2\u53D1\u9001\u7ED9 AI\u3002",
1817
+ "annotate.latestSession.hint.pending": "\u5982\u679C\u8FD8\u6CA1\u6709\u5F00\u59CB\uFF0C\u8BF7\u8BA9 AI \u7EE7\u7EED\u5904\u7406\u3002",
1818
+ "annotate.latestSession.hint.acknowledged": "AI \u5DF2\u8FDE\u63A5\uFF0C\u6B63\u5728\u7B49\u5F85\u66F4\u65B0\u3002",
1819
+ "annotate.latestSession.hint.in_progress": "\u53EF\u7559\u5728\u8FD9\u91CC\u67E5\u770B\u8FDB\u5C55\uFF0C\u6216\u7A0D\u540E\u624B\u52A8\u5237\u65B0\u3002",
1820
+ "annotate.latestSession.hint.resolved": "\u8BF7\u786E\u8BA4\u7ED3\u679C\uFF1B\u5982\u679C\u8FD8\u6709\u95EE\u9898\uFF0C\u53EF\u521B\u5EFA\u540E\u7EED\u4EFB\u52A1\u3002",
1821
+ "annotate.latestSession.reconnect": "\u91CD\u65B0\u8FDE\u63A5",
1822
+ "annotate.latestSession.error.disconnected": "\u8FDE\u63A5\u5DF2\u65AD\u5F00\u3002\u91CD\u65B0\u8FDE\u63A5\u4EE5\u7EE7\u7EED\u8DDF\u8FDB\u8FD9\u6761\u4EFB\u52A1\u3002",
1823
+ "annotate.latestSession.status.pending": "\u7B49\u5F85\u4E2D",
1824
+ "annotate.latestSession.status.acknowledged": "\u5DF2\u9886\u53D6",
1825
+ "annotate.latestSession.status.in_progress": "\u5904\u7406\u4E2D",
1826
+ "annotate.latestSession.status.resolved": "\u5DF2\u5B8C\u6210",
1827
+ "annotate.latestSession.status.dismissed": "\u5DF2\u5FFD\u7565",
1828
+ "annotate.header.capturing": "\u6B63\u5728\u6355\u83B7\u70B9\u51FB",
1829
+ "annotate.header.quickCaptureOn": "{label} \u5DF2\u5F00\u542F",
1830
+ "runtime.summary.error.one": "{count} \u4E2A\u8FD0\u884C\u65F6\u9519\u8BEF",
1831
+ "runtime.summary.error.other": "{count} \u4E2A\u8FD0\u884C\u65F6\u9519\u8BEF",
1832
+ "runtime.summary.request.one": "{count} \u4E2A\u5931\u8D25\u8BF7\u6C42",
1833
+ "runtime.summary.request.other": "{count} \u4E2A\u5931\u8D25\u8BF7\u6C42"
1834
+ };
1835
+ BUILTIN_MESSAGES = {
1836
+ en: EN_MESSAGES,
1837
+ "zh-CN": ZH_CN_MESSAGES
1838
+ };
1839
+ currentLocale = DEFAULT_LOCALE;
1840
+ currentMessages = {};
1841
+ }
1842
+ });
1843
+
1507
1844
  // src/annotate-overlay-dom.ts
1508
1845
  function createAnnotateOverlayDom(shadowRoot, tokens) {
1509
1846
  const layer = document.createElement("div");
@@ -1566,30 +1903,16 @@ function createAnnotateOverlayDom(shadowRoot, tokens) {
1566
1903
  composerHeaderActions.style.gap = "6px";
1567
1904
  const composerOpenButton = document.createElement("button");
1568
1905
  composerOpenButton.type = "button";
1569
- composerOpenButton.setAttribute("aria-label", "Open in Editor");
1570
- composerOpenButton.title = "Open in Editor";
1906
+ composerOpenButton.setAttribute("aria-label", t("menu.openInEditor"));
1907
+ composerOpenButton.title = t("menu.openInEditor");
1571
1908
  composerOpenButton.textContent = "\u2197";
1572
1909
  composerOpenButton.style.appearance = "none";
1573
1910
  composerOpenButton.style.cursor = "pointer";
1574
1911
  applyHeaderIconButtonStyles(composerOpenButton);
1575
- const composerScreenshotButton = document.createElement("button");
1576
- composerScreenshotButton.type = "button";
1577
- composerScreenshotButton.setAttribute("aria-label", "Attach screenshot context");
1578
- composerScreenshotButton.title = "Attach screenshot context";
1579
- composerScreenshotButton.style.appearance = "none";
1580
- composerScreenshotButton.style.cursor = "pointer";
1581
- composerScreenshotButton.style.display = "none";
1582
- applyHeaderIconButtonStyles(composerScreenshotButton);
1583
- composerScreenshotButton.innerHTML = screenshotIconSvg;
1584
- const screenshotSvgElement = composerScreenshotButton.querySelector("svg");
1585
- if (screenshotSvgElement) {
1586
- screenshotSvgElement.style.width = "18px";
1587
- screenshotSvgElement.style.height = "18px";
1588
- }
1589
1912
  const composerCssButton = document.createElement("button");
1590
1913
  composerCssButton.type = "button";
1591
- composerCssButton.setAttribute("aria-label", "Attach CSS context");
1592
- composerCssButton.title = "Attach CSS context";
1914
+ composerCssButton.setAttribute("aria-label", t("menu.attachCss"));
1915
+ composerCssButton.title = t("menu.attachCss");
1593
1916
  composerCssButton.style.appearance = "none";
1594
1917
  composerCssButton.style.cursor = "pointer";
1595
1918
  composerCssButton.style.display = "none";
@@ -1602,8 +1925,8 @@ function createAnnotateOverlayDom(shadowRoot, tokens) {
1602
1925
  }
1603
1926
  const composerRuntimeButton = document.createElement("button");
1604
1927
  composerRuntimeButton.type = "button";
1605
- composerRuntimeButton.setAttribute("aria-label", "Attach runtime context");
1606
- composerRuntimeButton.title = "Attach runtime context";
1928
+ composerRuntimeButton.setAttribute("aria-label", t("menu.attachRuntime"));
1929
+ composerRuntimeButton.title = t("menu.attachRuntime");
1607
1930
  composerRuntimeButton.style.appearance = "none";
1608
1931
  composerRuntimeButton.style.position = "relative";
1609
1932
  composerRuntimeButton.style.cursor = "pointer";
@@ -1633,7 +1956,7 @@ function createAnnotateOverlayDom(shadowRoot, tokens) {
1633
1956
  composerRuntimeBadge.style.display = "none";
1634
1957
  composerRuntimeButton.append(composerRuntimeIcon, composerRuntimeBadge);
1635
1958
  const composerInput = document.createElement("textarea");
1636
- composerInput.placeholder = "What should change for this component?";
1959
+ composerInput.placeholder = t("annotate.composer.placeholder");
1637
1960
  composerInput.style.width = "100%";
1638
1961
  composerInput.style.minHeight = "100px";
1639
1962
  composerInput.style.boxSizing = "border-box";
@@ -1654,44 +1977,39 @@ function createAnnotateOverlayDom(shadowRoot, tokens) {
1654
1977
  composerActions.style.gap = "8px";
1655
1978
  const cancelButton = document.createElement("button");
1656
1979
  cancelButton.type = "button";
1657
- cancelButton.textContent = "Cancel";
1980
+ cancelButton.textContent = t("annotate.cancel");
1658
1981
  cancelButton.style.appearance = "none";
1659
1982
  cancelButton.style.border = "none";
1660
1983
  cancelButton.style.background = "transparent";
1661
1984
  cancelButton.style.color = tokens.textSecondary();
1662
- cancelButton.style.font = '500 14px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif';
1985
+ cancelButton.style.font = '500 11px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif';
1663
1986
  cancelButton.style.padding = "8px 10px";
1664
1987
  cancelButton.style.cursor = "pointer";
1665
1988
  const deleteButton = document.createElement("button");
1666
1989
  deleteButton.type = "button";
1667
- deleteButton.textContent = "Delete";
1990
+ deleteButton.textContent = t("annotate.delete");
1668
1991
  deleteButton.style.appearance = "none";
1669
1992
  deleteButton.style.border = "none";
1670
1993
  deleteButton.style.background = "transparent";
1671
1994
  deleteButton.style.color = "rgba(248, 113, 113, 0.92)";
1672
- deleteButton.style.font = '500 14px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif';
1995
+ deleteButton.style.font = '500 11px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif';
1673
1996
  deleteButton.style.padding = "8px 10px";
1674
1997
  deleteButton.style.cursor = "pointer";
1675
1998
  deleteButton.style.display = "none";
1676
1999
  const addButton = document.createElement("button");
1677
2000
  addButton.type = "button";
1678
- addButton.textContent = "Save note";
2001
+ addButton.textContent = t("annotate.saveNote");
1679
2002
  addButton.style.appearance = "none";
1680
2003
  addButton.style.border = "none";
1681
2004
  addButton.style.borderRadius = tokens.radiusPill();
1682
2005
  addButton.style.background = `linear-gradient(180deg, ${tokens.accentPrimary()} 0%, ${tokens.accentPrimaryStrong()} 100%)`;
1683
2006
  addButton.style.color = "#ffffff";
1684
- addButton.style.font = '600 14px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif';
2007
+ addButton.style.font = '600 11px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif';
1685
2008
  addButton.style.minHeight = "36px";
1686
2009
  addButton.style.padding = "0 18px";
1687
2010
  addButton.style.cursor = "pointer";
1688
2011
  addButton.style.boxShadow = tokens.shadowAccent();
1689
- composerHeaderActions.append(
1690
- composerScreenshotButton,
1691
- composerCssButton,
1692
- composerRuntimeButton,
1693
- composerOpenButton
1694
- );
2012
+ composerHeaderActions.append(composerCssButton, composerRuntimeButton, composerOpenButton);
1695
2013
  composerActions.append(deleteButton, cancelButton, addButton);
1696
2014
  composerHeader.append(composerHeaderText, composerHeaderActions);
1697
2015
  composer.append(composerHeader, composerInput, composerActions);
@@ -1720,7 +2038,6 @@ function createAnnotateOverlayDom(shadowRoot, tokens) {
1720
2038
  composerHeaderTitle,
1721
2039
  composerHeaderMeta,
1722
2040
  composerOpenButton,
1723
- composerScreenshotButton,
1724
2041
  composerCssButton,
1725
2042
  composerRuntimeButton,
1726
2043
  composerRuntimeBadge,
@@ -1737,6 +2054,7 @@ var init_annotate_overlay_dom = __esm({
1737
2054
  "use strict";
1738
2055
  init_styles();
1739
2056
  init_icons();
2057
+ init_i18n();
1740
2058
  }
1741
2059
  });
1742
2060
 
@@ -1793,6 +2111,15 @@ function applyOverlayState(box, state, tokens) {
1793
2111
  const badge = box.querySelector("[data-inspecto-annotate-overlay-order]");
1794
2112
  const accentPrimaryColor = tokens.accentPrimary();
1795
2113
  const accentPrimaryStrongColor = tokens.accentPrimaryStrong();
2114
+ const successColor = tokens.successColor();
2115
+ if (state === "completed") {
2116
+ box.style.border = `2px solid ${successColor}`;
2117
+ box.style.background = "rgba(16, 185, 129, 0.05)";
2118
+ box.style.boxShadow = "none";
2119
+ badge.style.background = successColor;
2120
+ badge.style.opacity = "0.68";
2121
+ return;
2122
+ }
1796
2123
  if (state === "saved") {
1797
2124
  box.style.border = `2px solid ${accentPrimaryStrongColor}`;
1798
2125
  box.style.background = "rgba(79, 70, 229, 0.05)";
@@ -1880,6 +2207,7 @@ function createAnnotateOverlay(shadowRoot) {
1880
2207
  textTertiary: () => readToken("--inspecto-text-tertiary", "rgba(255, 255, 255, 0.46)"),
1881
2208
  accentPrimary: () => readToken("--inspecto-accent-primary", "#5d52f3"),
1882
2209
  accentPrimaryStrong: () => readToken("--inspecto-accent-primary-strong", "#4639d7"),
2210
+ successColor: () => readToken("--inspecto-success-color", "#10b981"),
1883
2211
  shadowFloating: () => readToken("--inspecto-shadow-floating", "0 20px 48px rgba(0, 0, 0, 0.28)"),
1884
2212
  shadowAccent: () => readToken("--inspecto-shadow-accent", "0 8px 18px rgba(79, 70, 229, 0.28)"),
1885
2213
  radiusSm: () => readToken("--inspecto-radius-sm", "12px"),
@@ -1894,7 +2222,6 @@ function createAnnotateOverlay(shadowRoot) {
1894
2222
  composerHeaderTitle,
1895
2223
  composerHeaderMeta,
1896
2224
  composerOpenButton,
1897
- composerScreenshotButton,
1898
2225
  composerCssButton,
1899
2226
  composerRuntimeButton,
1900
2227
  composerRuntimeBadge,
@@ -1987,7 +2314,7 @@ function createAnnotateOverlay(shadowRoot) {
1987
2314
  composer.style.top = `${top}px`;
1988
2315
  }
1989
2316
  function render(targets, composerOptions) {
1990
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
2317
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
1991
2318
  const nextIds = new Set(targets.map((target) => target.id));
1992
2319
  for (const [id, box] of boxes) {
1993
2320
  if (!nextIds.has(id)) {
@@ -2012,8 +2339,8 @@ function createAnnotateOverlay(shadowRoot) {
2012
2339
  const badge = box.querySelector("[data-inspecto-annotate-overlay-order]");
2013
2340
  const noteBadge = box.querySelector("[data-inspecto-annotate-overlay-note]");
2014
2341
  badge.textContent = String(target.order);
2015
- if (((_b = target.state) != null ? _b : "current") === "saved") {
2016
- const trimmedNote = (_d = (_c = target.note) == null ? void 0 : _c.trim()) != null ? _d : "";
2342
+ if (((_b = target.state) != null ? _b : "current") === "saved" || ((_c = target.state) != null ? _c : "current") === "completed") {
2343
+ const trimmedNote = (_e = (_d = target.note) == null ? void 0 : _d.trim()) != null ? _e : "";
2017
2344
  const hasNote = trimmedNote.length > 0;
2018
2345
  noteBadge.style.display = hasNote ? "block" : "none";
2019
2346
  noteBadge.textContent = hasNote ? formatOverlayNoteBadge(trimmedNote) : "";
@@ -2048,42 +2375,26 @@ function createAnnotateOverlay(shadowRoot) {
2048
2375
  }
2049
2376
  }
2050
2377
  if (targets.length > 0 && composerOptions) {
2051
- const targetChanged = activeComposerTargetId !== ((_g = (_f = composerOptions.targetId) != null ? _f : (_e = targets[0]) == null ? void 0 : _e.id) != null ? _g : null);
2052
- const composerTarget = (_h = targets.find((target) => {
2378
+ const targetChanged = activeComposerTargetId !== ((_h = (_g = composerOptions.targetId) != null ? _g : (_f = targets[0]) == null ? void 0 : _f.id) != null ? _h : null);
2379
+ const composerTarget = (_i = targets.find((target) => {
2053
2380
  var _a3;
2054
2381
  return ((_a3 = target.state) != null ? _a3 : "current") === "current";
2055
- })) != null ? _h : targets[0];
2056
- activeComposerTargetId = (_k = (_j = composerOptions.targetId) != null ? _j : (_i = targets[0]) == null ? void 0 : _i.id) != null ? _k : null;
2382
+ })) != null ? _i : targets[0];
2383
+ activeComposerTargetId = (_l = (_k = composerOptions.targetId) != null ? _k : (_j = targets[0]) == null ? void 0 : _j.id) != null ? _l : null;
2057
2384
  composerHeaderTitle.textContent = composerOptions.targetLabel;
2058
- composerHeaderMeta.textContent = (_l = composerOptions.targetMeta) != null ? _l : "";
2385
+ composerHeaderMeta.textContent = (_m = composerOptions.targetMeta) != null ? _m : "";
2059
2386
  composerHeaderMeta.style.display = composerOptions.targetMeta ? "" : "none";
2060
2387
  composerOpenButton.onclick = () => {
2061
2388
  var _a3;
2062
2389
  return (_a3 = composerOptions.onOpenInEditor) == null ? void 0 : _a3.call(composerOptions);
2063
2390
  };
2064
- composerScreenshotButton.style.display = composerOptions.canAttachScreenshotContext ? "inline-flex" : "none";
2065
- composerScreenshotButton.setAttribute(
2066
- "aria-pressed",
2067
- composerOptions.screenshotContextEnabled ? "true" : "false"
2068
- );
2069
- composerScreenshotButton.dataset.visualState = composerOptions.screenshotContextEnabled ? "active" : "inactive";
2070
- composerScreenshotButton.title = composerOptions.screenshotContextEnabled ? "Screenshot context enabled" : "Attach screenshot context";
2071
- applyComposerRuntimeButtonState(
2072
- composerScreenshotButton,
2073
- tokens,
2074
- composerOptions.screenshotContextEnabled === true
2075
- );
2076
- composerScreenshotButton.onclick = () => {
2077
- var _a3;
2078
- return (_a3 = composerOptions.onToggleScreenshotContext) == null ? void 0 : _a3.call(composerOptions);
2079
- };
2080
2391
  composerCssButton.style.display = composerOptions.canAttachCssContext ? "inline-flex" : "none";
2081
2392
  composerCssButton.setAttribute(
2082
2393
  "aria-pressed",
2083
2394
  composerOptions.cssContextEnabled ? "true" : "false"
2084
2395
  );
2085
2396
  composerCssButton.dataset.visualState = composerOptions.cssContextEnabled ? "active" : "inactive";
2086
- composerCssButton.title = composerOptions.cssContextEnabled ? "CSS context enabled" : "Attach CSS context";
2397
+ composerCssButton.title = composerOptions.cssContextEnabled ? t("menu.cssEnabled") : t("menu.attachCss");
2087
2398
  applyComposerRuntimeButtonState(
2088
2399
  composerCssButton,
2089
2400
  tokens,
@@ -2100,10 +2411,10 @@ function createAnnotateOverlay(shadowRoot) {
2100
2411
  );
2101
2412
  composerRuntimeButton.dataset.visualState = composerOptions.runtimeContextEnabled ? "active" : "inactive";
2102
2413
  composerRuntimeBadge.textContent = formatRuntimeErrorCount(
2103
- (_m = composerOptions.runtimeErrorCount) != null ? _m : 0
2414
+ (_n = composerOptions.runtimeErrorCount) != null ? _n : 0
2104
2415
  );
2105
- composerRuntimeBadge.style.display = composerOptions.runtimeContextEnabled && ((_n = composerOptions.runtimeErrorCount) != null ? _n : 0) > 0 ? "" : "none";
2106
- composerRuntimeButton.title = composerOptions.runtimeContextEnabled ? composerOptions.runtimeErrorCount ? `Runtime context enabled \u2022 ${formatRuntimeErrorCount(composerOptions.runtimeErrorCount)} errors` : composerOptions.runtimeContextSummary ? `Runtime context enabled \u2022 ${composerOptions.runtimeContextSummary}` : "Runtime context enabled" : composerOptions.runtimeErrorCount ? `Attach runtime context \u2022 ${formatRuntimeErrorCount(composerOptions.runtimeErrorCount)} errors` : "Attach runtime context";
2416
+ composerRuntimeBadge.style.display = composerOptions.runtimeContextEnabled && ((_o = composerOptions.runtimeErrorCount) != null ? _o : 0) > 0 ? "" : "none";
2417
+ composerRuntimeButton.title = composerOptions.runtimeContextEnabled ? composerOptions.runtimeErrorCount ? `${t("menu.runtimeEnabled")} \u2022 ${t("annotate.runtimeErrors", { count: formatRuntimeErrorCount(composerOptions.runtimeErrorCount) })}` : composerOptions.runtimeContextSummary ? `${t("menu.runtimeEnabled")} \u2022 ${composerOptions.runtimeContextSummary}` : t("menu.runtimeEnabled") : composerOptions.runtimeErrorCount ? `${t("menu.attachRuntime")} \u2022 ${t("annotate.runtimeErrors", { count: formatRuntimeErrorCount(composerOptions.runtimeErrorCount) })}` : t("menu.attachRuntime");
2107
2418
  applyComposerRuntimeButtonState(
2108
2419
  composerRuntimeButton,
2109
2420
  tokens,
@@ -2124,7 +2435,7 @@ function createAnnotateOverlay(shadowRoot) {
2124
2435
  var _a3;
2125
2436
  return (_a3 = composerOptions.onUpdateNote) == null ? void 0 : _a3.call(composerOptions, composerInput.value);
2126
2437
  };
2127
- addButton.textContent = (_o = composerOptions.saveLabel) != null ? _o : "Save note";
2438
+ addButton.textContent = (_p = composerOptions.saveLabel) != null ? _p : t("annotate.saveNote");
2128
2439
  addButton.onclick = () => {
2129
2440
  var _a3;
2130
2441
  return (_a3 = composerOptions.onSave) == null ? void 0 : _a3.call(composerOptions);
@@ -2147,17 +2458,15 @@ function createAnnotateOverlay(shadowRoot) {
2147
2458
  activeComposerPlacement = null;
2148
2459
  composerInput.value = "";
2149
2460
  composerInput.oninput = null;
2150
- addButton.textContent = "Save note";
2461
+ addButton.textContent = t("annotate.saveNote");
2151
2462
  addButton.onclick = null;
2152
2463
  cancelButton.onclick = null;
2153
2464
  composerOpenButton.onclick = null;
2154
- composerScreenshotButton.style.display = "none";
2155
- composerScreenshotButton.onclick = null;
2156
2465
  composerCssButton.style.display = "none";
2157
2466
  composerCssButton.onclick = null;
2158
2467
  composerCssButton.setAttribute("aria-pressed", "false");
2159
2468
  composerCssButton.dataset.visualState = "inactive";
2160
- composerCssButton.title = "Attach CSS context";
2469
+ composerCssButton.title = t("menu.attachCss");
2161
2470
  applyComposerRuntimeButtonState(composerCssButton, tokens, false);
2162
2471
  composerRuntimeButton.style.display = "none";
2163
2472
  composerRuntimeButton.onclick = null;
@@ -2175,10 +2484,8 @@ function createAnnotateOverlay(shadowRoot) {
2175
2484
  activeComposerTargetId = null;
2176
2485
  activeComposerPlacement = null;
2177
2486
  composerInput.value = "";
2178
- addButton.textContent = "Save note";
2487
+ addButton.textContent = t("annotate.saveNote");
2179
2488
  composerOpenButton.onclick = null;
2180
- composerScreenshotButton.style.display = "none";
2181
- composerScreenshotButton.onclick = null;
2182
2489
  composerRuntimeButton.style.display = "none";
2183
2490
  composerRuntimeButton.onclick = null;
2184
2491
  deleteButton.style.display = "none";
@@ -2192,6 +2499,7 @@ var init_annotate_overlay = __esm({
2192
2499
  "src/annotate-overlay.ts"() {
2193
2500
  "use strict";
2194
2501
  init_annotate_overlay_dom();
2502
+ init_i18n();
2195
2503
  init_annotate_overlay_helpers();
2196
2504
  }
2197
2505
  });
@@ -2206,9 +2514,29 @@ function parseAttrValue(value) {
2206
2514
  if (isNaN(line) || isNaN(col) || !file) return null;
2207
2515
  return { file, line, column: col };
2208
2516
  }
2517
+ function parseAstroAttrValue(file, loc) {
2518
+ const parts = loc.split(":");
2519
+ if (parts.length !== 2) return null;
2520
+ const line = parseInt(parts[0], 10);
2521
+ const column = parseInt(parts[1], 10);
2522
+ if (isNaN(line) || isNaN(column) || !file) return null;
2523
+ return { file, line, column };
2524
+ }
2525
+ function getInspectableLocation(el) {
2526
+ const attrValue = el.getAttribute(ATTR_NAME);
2527
+ if (attrValue) {
2528
+ return parseAttrValue(attrValue);
2529
+ }
2530
+ const astroFile = el.getAttribute(ASTRO_FILE_ATTR_NAME);
2531
+ const astroLoc = el.getAttribute(ASTRO_LOC_ATTR_NAME);
2532
+ if (astroFile && astroLoc) {
2533
+ return parseAstroAttrValue(astroFile, astroLoc);
2534
+ }
2535
+ return null;
2536
+ }
2209
2537
  function findInspectable(el) {
2210
2538
  while (el) {
2211
- if (el.hasAttribute(ATTR_NAME)) return el;
2539
+ if (getInspectableLocation(el)) return el;
2212
2540
  el = el.parentElement;
2213
2541
  }
2214
2542
  return null;
@@ -2258,11 +2586,13 @@ function createElementSelector(element) {
2258
2586
  }
2259
2587
  return segments.join(" > ");
2260
2588
  }
2261
- var ATTR_NAME;
2589
+ var ATTR_NAME, ASTRO_FILE_ATTR_NAME, ASTRO_LOC_ATTR_NAME;
2262
2590
  var init_component_utils = __esm({
2263
2591
  "src/component-utils.ts"() {
2264
2592
  "use strict";
2265
2593
  ATTR_NAME = "data-inspecto";
2594
+ ASTRO_FILE_ATTR_NAME = "data-astro-source-file";
2595
+ ASTRO_LOC_ATTR_NAME = "data-astro-source-loc";
2266
2596
  }
2267
2597
  });
2268
2598
 
@@ -2424,7 +2754,16 @@ function findElementForLocation(_ctx, location, selector) {
2424
2754
  const byLocation = Array.from(document.querySelectorAll(`[${ATTR_NAME}]`)).find(
2425
2755
  (candidate) => candidate.getAttribute(ATTR_NAME) === locationAttr
2426
2756
  );
2427
- return byLocation instanceof Element ? byLocation : null;
2757
+ if (byLocation instanceof Element) {
2758
+ return byLocation;
2759
+ }
2760
+ const byAstroLocation = Array.from(
2761
+ document.querySelectorAll("[data-astro-source-file][data-astro-source-loc]")
2762
+ ).find((candidate) => {
2763
+ const candidateLocation = getInspectableLocation(candidate);
2764
+ return (candidateLocation == null ? void 0 : candidateLocation.file) === location.file && candidateLocation.line === location.line && candidateLocation.column === location.column;
2765
+ });
2766
+ return byAstroLocation instanceof Element ? byAstroLocation : null;
2428
2767
  }
2429
2768
  function rebindCurrentAnnotationElements(ctx) {
2430
2769
  const state = asAnnotateContext(ctx);
@@ -2566,12 +2905,9 @@ function buildAnnotateFullPrompt(input) {
2566
2905
  const prompt = instruction ? `${instruction}
2567
2906
 
2568
2907
  ${body}` : body;
2569
- return appendScreenshotContextSection(
2570
- appendCssContextToPrompt(
2571
- appendRuntimeContextSection(prompt, input.runtimeContext),
2572
- input.cssContextPrompt
2573
- ),
2574
- input.screenshotContext
2908
+ return appendCssContextToPrompt(
2909
+ appendRuntimeContextSection(prompt, input.runtimeContext),
2910
+ input.cssContextPrompt
2575
2911
  );
2576
2912
  }
2577
2913
  function buildSelectedElementsPrompt(annotations) {
@@ -2603,22 +2939,6 @@ function appendRuntimeContextSection(prompt, runtimeContext) {
2603
2939
 
2604
2940
  ${buildRuntimeContextSection(runtimeContext.records)}`;
2605
2941
  }
2606
- function appendScreenshotContextSection(prompt, screenshotContext) {
2607
- if (!screenshotContext || !screenshotContext.imageDataUrl && !screenshotContext.imageAssetId) {
2608
- return prompt;
2609
- }
2610
- const lines = [
2611
- "Visual screenshot context attached:",
2612
- `- capturedAt=${screenshotContext.capturedAt}`,
2613
- `- mimeType=${screenshotContext.mimeType}`
2614
- ];
2615
- if (screenshotContext.imageAssetId) {
2616
- lines.push(`- imageAssetId=${screenshotContext.imageAssetId}`);
2617
- }
2618
- return `${prompt}
2619
-
2620
- ${lines.join("\n")}`;
2621
- }
2622
2942
  function buildRuntimeContextSection(records) {
2623
2943
  return ["Relevant runtime context:", ...records.map(formatRuntimeRecord)].join("\n");
2624
2944
  }
@@ -2661,15 +2981,26 @@ function fetchIdeInfo(force = false) {
2661
2981
  }
2662
2982
  function openFile(req) {
2663
2983
  return __async(this, null, function* () {
2984
+ return (yield openFileWithDiagnostics(req)).success;
2985
+ });
2986
+ }
2987
+ function openFileWithDiagnostics(req) {
2988
+ return __async(this, null, function* () {
2989
+ var _a2;
2664
2990
  try {
2665
- const res = yield fetch(`${BASE_URL}${import_types.INSPECTO_API_PATHS.IDE_OPEN}`, {
2991
+ const res = yield fetch(`${BASE_URL}${import_types.INSPECTO_API_PATHS.SOURCE_OPEN}`, {
2666
2992
  method: "POST",
2667
2993
  headers: { "Content-Type": "application/json" },
2668
2994
  body: JSON.stringify(req)
2669
2995
  });
2670
- return res.ok;
2996
+ if (res.ok) return { success: true };
2997
+ const err = yield res.json().catch(() => ({}));
2998
+ return {
2999
+ success: false,
3000
+ errorCode: (_a2 = err.errorCode) != null ? _a2 : "IDE_UNAVAILABLE"
3001
+ };
2671
3002
  } catch (e) {
2672
- return false;
3003
+ return { success: false, errorCode: "SERVER_UNAVAILABLE" };
2673
3004
  }
2674
3005
  });
2675
3006
  }
@@ -2681,64 +3012,179 @@ function fetchSnippet(file, line, column, maxLines = 100) {
2681
3012
  column: String(column),
2682
3013
  maxLines: String(maxLines)
2683
3014
  });
2684
- const res = yield fetch(`${BASE_URL}${import_types.INSPECTO_API_PATHS.PROJECT_SNIPPET}?${params}`);
2685
- if (!res.ok) {
2686
- const err = yield res.json().catch(() => ({}));
2687
- throw Object.assign(new Error("snippet fetch failed"), { errorCode: err.errorCode });
3015
+ try {
3016
+ const res = yield fetch(`${BASE_URL}${import_types.INSPECTO_API_PATHS.PROJECT_SNIPPET}?${params}`);
3017
+ if (!res.ok) {
3018
+ const err = yield res.json().catch(() => ({}));
3019
+ throw Object.assign(new Error("snippet fetch failed"), { errorCode: err.errorCode });
3020
+ }
3021
+ return res.json();
3022
+ } catch (err) {
3023
+ if (err.errorCode) throw err;
3024
+ throw Object.assign(new Error("Local dev server unavailable"), {
3025
+ errorCode: "SERVER_UNAVAILABLE"
3026
+ });
2688
3027
  }
2689
- return res.json();
2690
3028
  });
2691
3029
  }
2692
3030
  function sendToAi(req) {
2693
3031
  return __async(this, null, function* () {
2694
3032
  var _a2;
2695
- const res = yield fetch(`${BASE_URL}${import_types.INSPECTO_API_PATHS.AI_DISPATCH}`, {
2696
- method: "POST",
2697
- headers: { "Content-Type": "application/json" },
2698
- body: JSON.stringify(req)
2699
- });
2700
- if (!res.ok) {
2701
- const err = yield res.json().catch(() => ({}));
3033
+ try {
3034
+ const res = yield fetch(`${BASE_URL}${import_types.INSPECTO_API_PATHS.AI_DISPATCH}`, {
3035
+ method: "POST",
3036
+ headers: { "Content-Type": "application/json" },
3037
+ body: JSON.stringify(req)
3038
+ });
3039
+ if (!res.ok) {
3040
+ const err = yield res.json().catch(() => ({}));
3041
+ return {
3042
+ success: false,
3043
+ error: (_a2 = err.error) != null ? _a2 : "Request failed",
3044
+ errorCode: err.errorCode
3045
+ };
3046
+ }
3047
+ return res.json();
3048
+ } catch (e) {
2702
3049
  return {
2703
3050
  success: false,
2704
- error: (_a2 = err.error) != null ? _a2 : "Request failed",
2705
- errorCode: err.errorCode
3051
+ error: "Local dev server unavailable",
3052
+ errorCode: "SERVER_UNAVAILABLE"
2706
3053
  };
2707
3054
  }
2708
- return res.json();
2709
3055
  });
2710
3056
  }
2711
3057
  function sendAnnotationsToAi(req) {
2712
3058
  return __async(this, null, function* () {
2713
3059
  var _a2;
2714
- const res = yield fetch(`${BASE_URL}${AI_BATCH_DISPATCH_PATH}`, {
2715
- method: "POST",
2716
- headers: { "Content-Type": "application/json" },
2717
- body: JSON.stringify(req)
2718
- });
2719
- if (!res.ok) {
2720
- const err = yield res.json().catch(() => ({}));
3060
+ try {
3061
+ const res = yield fetch(`${BASE_URL}${AI_BATCH_DISPATCH_PATH}`, {
3062
+ method: "POST",
3063
+ headers: { "Content-Type": "application/json" },
3064
+ body: JSON.stringify(req)
3065
+ });
3066
+ if (!res.ok) {
3067
+ const err = yield res.json().catch(() => ({}));
3068
+ return {
3069
+ success: false,
3070
+ error: (_a2 = err.error) != null ? _a2 : "Request failed",
3071
+ errorCode: err.errorCode
3072
+ };
3073
+ }
3074
+ return res.json();
3075
+ } catch (e) {
2721
3076
  return {
2722
3077
  success: false,
2723
- error: (_a2 = err.error) != null ? _a2 : "Request failed",
2724
- errorCode: err.errorCode
3078
+ error: "Local dev server unavailable",
3079
+ errorCode: "SERVER_UNAVAILABLE"
2725
3080
  };
2726
3081
  }
2727
- return res.json();
2728
3082
  });
2729
3083
  }
3084
+ function fetchAnnotationSession(sessionId) {
3085
+ return __async(this, null, function* () {
3086
+ var _a2;
3087
+ try {
3088
+ const res = yield fetch(
3089
+ `${BASE_URL}${import_types.INSPECTO_API_PATHS.SESSIONS}/${encodeURIComponent(sessionId)}`
3090
+ );
3091
+ if (!res.ok) {
3092
+ const err = yield res.json().catch(() => ({}));
3093
+ return {
3094
+ success: false,
3095
+ error: (_a2 = err.error) != null ? _a2 : "Request failed",
3096
+ errorCode: err.errorCode
3097
+ };
3098
+ }
3099
+ const payload = yield res.json();
3100
+ return __spreadValues(__spreadValues({
3101
+ success: payload.success
3102
+ }, payload.session !== void 0 ? { session: payload.session } : {}), payload.error !== void 0 ? { error: payload.error } : {});
3103
+ } catch (e) {
3104
+ return {
3105
+ success: false,
3106
+ error: "Local dev server unavailable",
3107
+ errorCode: "SERVER_UNAVAILABLE"
3108
+ };
3109
+ }
3110
+ });
3111
+ }
3112
+ function openAnnotationSessionEventStream(sessionId, handlers) {
3113
+ if (!sessionId.trim() || typeof EventSource !== "function") {
3114
+ return null;
3115
+ }
3116
+ const params = new URLSearchParams({ sessionId: sessionId.trim() });
3117
+ const source = new EventSource(`${BASE_URL}${import_types.INSPECTO_API_PATHS.SESSION_EVENTS}?${params}`);
3118
+ const handleEvent = (event) => {
3119
+ const messageEvent = event;
3120
+ try {
3121
+ const payload = JSON.parse(messageEvent.data);
3122
+ handlers.onEvent(payload);
3123
+ } catch (e) {
3124
+ }
3125
+ };
3126
+ source.addEventListener("session-created", handleEvent);
3127
+ source.addEventListener("session-message-appended", handleEvent);
3128
+ source.addEventListener("session-status-updated", handleEvent);
3129
+ if (handlers.onError) {
3130
+ source.addEventListener("error", handlers.onError);
3131
+ }
3132
+ return {
3133
+ close() {
3134
+ source.close();
3135
+ }
3136
+ };
3137
+ }
2730
3138
  var import_types, BASE_URL, _a, AI_BATCH_DISPATCH_PATH, cachedConfig;
2731
3139
  var init_http = __esm({
2732
3140
  "src/http.ts"() {
2733
3141
  "use strict";
2734
3142
  import_types = require("@inspecto-dev/types");
2735
- BASE_URL = globalThis.__AI_INSPECTOR_SERVER_URL__ || "http://127.0.0.1:5678";
3143
+ BASE_URL = globalThis.__AI_INSPECTOR_SERVER_URL__ || "http://0.0.0.0:5678";
2736
3144
  AI_BATCH_DISPATCH_PATH = (_a = import_types.INSPECTO_API_PATHS.AI_BATCH_DISPATCH) != null ? _a : "/inspecto/api/v1/ai/dispatch/annotations";
2737
3145
  cachedConfig = null;
2738
3146
  }
2739
3147
  });
2740
3148
 
2741
3149
  // src/component-annotate-ui.ts
3150
+ function formatContextAsMarkdown(instruction, annotations) {
3151
+ let md = "";
3152
+ if (instruction) {
3153
+ md += `${instruction}
3154
+
3155
+ `;
3156
+ }
3157
+ if (annotations.length > 0) {
3158
+ md += "### Selected Elements\n\n";
3159
+ annotations.forEach((ann, index) => {
3160
+ md += `**Annotation ${index + 1}**
3161
+ `;
3162
+ if (ann.note) {
3163
+ md += `* Note: ${ann.note}
3164
+ `;
3165
+ }
3166
+ ann.targets.forEach((target, targetIndex) => {
3167
+ md += `
3168
+ * Target ${targetIndex + 1}:
3169
+ `;
3170
+ if (target.label) md += ` - Label: \`${target.label}\`
3171
+ `;
3172
+ if (target.location)
3173
+ md += ` - Location: \`${target.location.file.split("/").pop() || target.location.file}:${target.location.line}:${target.location.column}\`
3174
+ `;
3175
+ if (target.selector) md += ` - Selector: \`${target.selector}\`
3176
+ `;
3177
+ if (target.snippet) md += `
3178
+ \`\`\`
3179
+ ${target.snippet}
3180
+ \`\`\`
3181
+ `;
3182
+ });
3183
+ md += "\n---\n\n";
3184
+ });
3185
+ }
3186
+ return md.trim();
3187
+ }
2742
3188
  function hasCurrentRecordUi(ctx) {
2743
3189
  return Boolean(asAnnotateContext(ctx).annotateSession.current.target);
2744
3190
  }
@@ -2763,6 +3209,7 @@ function clearAnnotateSuccess(ctx) {
2763
3209
  clearTimeout(state.annotateSuccessTimeout);
2764
3210
  state.annotateSuccessTimeout = null;
2765
3211
  }
3212
+ state.annotateSuccessOnClear = null;
2766
3213
  if (hadSuccess) {
2767
3214
  state.updateAnnotateSidebar();
2768
3215
  }
@@ -2772,11 +3219,29 @@ function showAnnotateSuccess(ctx, scope) {
2772
3219
  clearAnnotateSuccess(state);
2773
3220
  state.annotateSuccessScope = scope;
2774
3221
  state.annotateSuccessTimeout = setTimeout(() => {
3222
+ const onClear = state.annotateSuccessOnClear;
2775
3223
  state.annotateSuccessScope = null;
2776
3224
  state.annotateSuccessTimeout = null;
3225
+ state.annotateSuccessOnClear = null;
3226
+ onClear == null ? void 0 : onClear();
2777
3227
  state.updateAnnotateSidebar();
2778
3228
  }, 1500);
2779
3229
  }
3230
+ function updateLatestSessionState(ctx, session) {
3231
+ const state = asAnnotateContext(ctx);
3232
+ state.annotateLatestSessionDetail = session;
3233
+ state.annotateLatestSessionSummary = {
3234
+ id: session.id,
3235
+ status: session.status,
3236
+ createdAt: session.createdAt,
3237
+ updatedAt: session.updatedAt
3238
+ };
3239
+ state.annotateLatestSessionError = "";
3240
+ if (session.status === "resolved" || session.status === "dismissed") {
3241
+ state.stopLatestAnnotateSessionStream();
3242
+ }
3243
+ state.renderAnnotateSelectionOverlay();
3244
+ }
2780
3245
  function toAnnotateErrorMessage(_ctx, errorCode, fallback) {
2781
3246
  if (errorCode === "FORBIDDEN_PATH") {
2782
3247
  return "Some selected targets are outside the current project workspace.";
@@ -2784,6 +3249,9 @@ function toAnnotateErrorMessage(_ctx, errorCode, fallback) {
2784
3249
  if (errorCode === "INVALID_REQUEST") {
2785
3250
  return "The current annotation batch is incomplete. Check your targets and try again.";
2786
3251
  }
3252
+ if (errorCode === "SERVER_UNAVAILABLE") {
3253
+ return "Inspecto could not reach the local dev server. Restart your dev server, then try again. If it still fails, run `inspecto doctor` or `npx @inspecto-dev/cli doctor` from the project root.";
3254
+ }
2787
3255
  return fallback != null ? fallback : "Request failed";
2788
3256
  }
2789
3257
  function toAnnotationTransportFromRecordUi(_ctx, record) {
@@ -2797,8 +3265,9 @@ function toAnnotationTransportFromRecordUi(_ctx, record) {
2797
3265
  ]
2798
3266
  };
2799
3267
  }
2800
- function sendAnnotationBatch(ctx, annotations, scope, instruction, onSuccess) {
3268
+ function sendAnnotationBatch(ctx, annotations, scope, instruction, deliveryMode, onSuccess) {
2801
3269
  return __async(this, null, function* () {
3270
+ var _a2, _b;
2802
3271
  const state = asAnnotateContext(ctx);
2803
3272
  if (annotations.length === 0 || state.annotateSendState.isSending) return;
2804
3273
  state.annotateSendState = { isSending: true, scope };
@@ -2806,26 +3275,38 @@ function sendAnnotationBatch(ctx, annotations, scope, instruction, onSuccess) {
2806
3275
  try {
2807
3276
  yield state.configLoadPromise;
2808
3277
  const runtimeContext = state.getAnnotateRuntimeContext(annotations);
2809
- const screenshotContext = state.annotateScreenshotContextEnabled ? yield state.captureAnnotateScreenshotContext(annotations, scope) : null;
2810
3278
  const cssContextPrompt = state.getAnnotateCssContextPrompt(annotations);
2811
- const result = yield sendAnnotationsToAi(__spreadValues(__spreadValues(__spreadValues({
3279
+ const result = yield sendAnnotationsToAi(__spreadProps(__spreadValues(__spreadValues({
2812
3280
  instruction,
2813
- annotations,
2814
- responseMode: state.getAnnotationResponseMode()
2815
- }, runtimeContext ? { runtimeContext } : {}), screenshotContext ? { screenshotContext } : {}), cssContextPrompt ? { cssContextPrompt } : {}));
3281
+ annotations
3282
+ }, runtimeContext ? { runtimeContext } : {}), cssContextPrompt ? { cssContextPrompt } : {}), {
3283
+ deliveryMode
3284
+ }));
2816
3285
  if (!result.success) {
2817
3286
  state.annotateErrorMessage = toAnnotateErrorMessage(state, result.errorCode, result.error);
2818
3287
  state.updateAnnotateSidebar();
2819
3288
  return;
2820
3289
  }
3290
+ state.annotateLatestSessionSummary = (_a2 = result.session) != null ? _a2 : null;
3291
+ state.annotateLatestSessionDetail = null;
3292
+ state.annotateLatestSessionError = "";
3293
+ if ((_b = result.session) == null ? void 0 : _b.id) {
3294
+ state.startLatestAnnotateSessionStream(result.session.id);
3295
+ void state.refreshLatestAnnotateSession();
3296
+ } else {
3297
+ state.stopLatestAnnotateSessionStream();
3298
+ }
2821
3299
  onSuccess();
2822
3300
  state.annotateErrorMessage = "";
2823
3301
  state.showAnnotateSuccess(scope);
2824
- state.annotateElements.clear();
2825
3302
  state.renderAnnotateSelectionOverlay();
2826
3303
  state.updateAnnotateSidebar();
2827
- } catch (e) {
2828
- state.annotateErrorMessage = "Request failed";
3304
+ } catch (err) {
3305
+ state.annotateErrorMessage = toAnnotateErrorMessage(
3306
+ state,
3307
+ err.errorCode,
3308
+ err.message
3309
+ );
2829
3310
  state.updateAnnotateSidebar();
2830
3311
  } finally {
2831
3312
  state.annotateSendState = { isSending: false, scope: null };
@@ -2833,7 +3314,56 @@ function sendAnnotationBatch(ctx, annotations, scope, instruction, onSuccess) {
2833
3314
  }
2834
3315
  });
2835
3316
  }
3317
+ function refreshLatestAnnotateSession(ctx) {
3318
+ return __async(this, null, function* () {
3319
+ var _a2, _b, _c, _d;
3320
+ const state = asAnnotateContext(ctx);
3321
+ const sessionId = (_c = (_a2 = state.annotateLatestSessionSummary) == null ? void 0 : _a2.id) != null ? _c : (_b = state.annotateLatestSessionDetail) == null ? void 0 : _b.id;
3322
+ if (!sessionId || state.annotateLatestSessionLoading) return;
3323
+ state.annotateLatestSessionLoading = true;
3324
+ state.annotateLatestSessionError = "";
3325
+ state.updateAnnotateSidebar();
3326
+ try {
3327
+ const result = yield fetchAnnotationSession(sessionId);
3328
+ if (!result.success || !result.session) {
3329
+ state.annotateLatestSessionError = toAnnotateErrorMessage(
3330
+ state,
3331
+ result.errorCode,
3332
+ (_d = result.error) != null ? _d : "Failed to refresh latest session."
3333
+ );
3334
+ return;
3335
+ }
3336
+ updateLatestSessionState(state, result.session);
3337
+ } finally {
3338
+ state.annotateLatestSessionLoading = false;
3339
+ state.updateAnnotateSidebar();
3340
+ }
3341
+ });
3342
+ }
3343
+ function startLatestAnnotateSessionStream(ctx, sessionId) {
3344
+ const state = asAnnotateContext(ctx);
3345
+ state.stopLatestAnnotateSessionStream();
3346
+ const connection = openAnnotationSessionEventStream(sessionId, {
3347
+ onEvent: (event) => {
3348
+ if (event.session.id !== sessionId) return;
3349
+ updateLatestSessionState(state, event.session);
3350
+ state.updateAnnotateSidebar();
3351
+ },
3352
+ onError: () => {
3353
+ state.annotateLatestSessionError = "Live session updates disconnected. You can refresh to reconnect.";
3354
+ state.updateAnnotateSidebar();
3355
+ }
3356
+ });
3357
+ state.annotateLatestSessionStream = connection;
3358
+ }
3359
+ function stopLatestAnnotateSessionStream(ctx) {
3360
+ var _a2;
3361
+ const state = asAnnotateContext(ctx);
3362
+ (_a2 = state.annotateLatestSessionStream) == null ? void 0 : _a2.close();
3363
+ state.annotateLatestSessionStream = null;
3364
+ }
2836
3365
  function getAnnotateSidebarOptions(ctx) {
3366
+ var _a2;
2837
3367
  const state = asAnnotateContext(ctx);
2838
3368
  const includedRecords = state.annotateSession.records;
2839
3369
  const savedAnnotations = state.annotateSession.records.map(
@@ -2854,10 +3384,12 @@ function getAnnotateSidebarOptions(ctx) {
2854
3384
  const fullInstruction = composeAnnotateInstruction(state);
2855
3385
  const allRuntimeContext = state.getAnnotateRuntimeContext(allAnnotations);
2856
3386
  const allCssContextPrompt = state.getAnnotateCssContextPrompt(allAnnotations);
3387
+ const deliveryPreference = (_a2 = state.annotateDeliveryMode) != null ? _a2 : "both";
3388
+ let preferredAction = "create-task";
3389
+ if (deliveryPreference === "ide") preferredAction = "quick-ask";
3390
+ if (deliveryPreference === "agent") preferredAction = "create-task";
2857
3391
  return {
2858
3392
  mode: state.annotateCapturePaused ? "capture-paused" : "capture-enabled",
2859
- canAttachScreenshotContext: false,
2860
- screenshotContextEnabled: state.annotateScreenshotContextEnabled,
2861
3393
  canAttachCssContext: false,
2862
3394
  cssContextEnabled: false,
2863
3395
  canAttachRuntimeContext: state.canAttachRuntimeContext(),
@@ -2870,13 +3402,18 @@ function getAnnotateSidebarOptions(ctx) {
2870
3402
  fullPrompt: buildAnnotateFullPrompt({
2871
3403
  instruction: fullInstruction,
2872
3404
  annotations: allAnnotations,
2873
- responseMode: state.getAnnotationResponseMode(),
2874
3405
  runtimeContext: allRuntimeContext,
2875
3406
  cssContextPrompt: allCssContextPrompt
2876
3407
  }),
2877
3408
  isSending: state.annotateSendState.isSending,
2878
3409
  sendingScope: state.annotateSendState.scope,
2879
3410
  successScope: state.annotateSuccessScope,
3411
+ preferredAction,
3412
+ annotateDeliveryMode: state.annotateDeliveryMode,
3413
+ latestSessionSummary: state.annotateLatestSessionSummary,
3414
+ latestSessionDetail: state.annotateLatestSessionDetail,
3415
+ latestSessionLoading: state.annotateLatestSessionLoading,
3416
+ latestSessionError: state.annotateLatestSessionError,
2880
3417
  quickCaptureEnabled: state.annotateQuickCaptureEnabled,
2881
3418
  errorMessage: state.annotateErrorMessage,
2882
3419
  onPauseCapture: () => {
@@ -2909,11 +3446,11 @@ function getAnnotateSidebarOptions(ctx) {
2909
3446
  state.updateAnnotateSidebar();
2910
3447
  },
2911
3448
  onRemovePromptChip: (recordId) => {
2912
- var _a2;
3449
+ var _a3;
2913
3450
  state.clearAnnotateError();
2914
3451
  state.clearAnnotateSuccess();
2915
3452
  const currentTarget = state.annotateSession.current.id === recordId ? state.annotateSession.current.target : null;
2916
- const savedRecord = (_a2 = state.annotateSession.records.find((record) => record.id === recordId)) != null ? _a2 : null;
3453
+ const savedRecord = (_a3 = state.annotateSession.records.find((record) => record.id === recordId)) != null ? _a3 : null;
2917
3454
  if (currentTarget) {
2918
3455
  clearDraftForTarget(state, currentTarget);
2919
3456
  state.annotateSession = clearCurrentRecord(state.annotateSession);
@@ -2931,8 +3468,38 @@ function getAnnotateSidebarOptions(ctx) {
2931
3468
  state.clearAnnotateSuccess();
2932
3469
  beginEditingRecord(state, recordId);
2933
3470
  },
2934
- onSend: () => {
2935
- var _a2;
3471
+ onRefreshLatestSession: () => {
3472
+ void state.refreshLatestAnnotateSession();
3473
+ },
3474
+ onCopyContext: () => {
3475
+ var _a3;
3476
+ const transports = state.annotateSession.records.map(
3477
+ (record) => toAnnotationTransportFromRecordUi(null, record)
3478
+ );
3479
+ if (hasCurrentRecordUi(state) && state.annotateSession.current.target) {
3480
+ transports.push(
3481
+ toAnnotationTransportFromRecordUi(null, {
3482
+ id: state.annotateSession.current.id,
3483
+ displayOrder: (_a3 = state.annotateSession.current.displayOrder) != null ? _a3 : getNextRecordDisplayOrderUi(state),
3484
+ target: state.annotateSession.current.target,
3485
+ note: state.annotateSession.current.note,
3486
+ intent: state.annotateSession.current.intent
3487
+ })
3488
+ );
3489
+ }
3490
+ const instruction = composeAnnotateInstruction(state);
3491
+ const markdown = formatContextAsMarkdown(instruction, transports);
3492
+ return navigator.clipboard.writeText(markdown).then(() => {
3493
+ state.annotateErrorMessage = "";
3494
+ }).catch((err) => {
3495
+ console.error("Failed to copy to clipboard:", err);
3496
+ state.annotateErrorMessage = t("annotate.copyContext.failed");
3497
+ state.updateAnnotateSidebar();
3498
+ throw err;
3499
+ });
3500
+ },
3501
+ onQuickAsk: () => {
3502
+ var _a3;
2936
3503
  const transports = state.annotateSession.records.map(
2937
3504
  (record) => toAnnotationTransportFromRecordUi(null, record)
2938
3505
  );
@@ -2940,7 +3507,7 @@ function getAnnotateSidebarOptions(ctx) {
2940
3507
  transports.push(
2941
3508
  toAnnotationTransportFromRecordUi(null, {
2942
3509
  id: state.annotateSession.current.id,
2943
- displayOrder: (_a2 = state.annotateSession.current.displayOrder) != null ? _a2 : getNextRecordDisplayOrderUi(state),
3510
+ displayOrder: (_a3 = state.annotateSession.current.displayOrder) != null ? _a3 : getNextRecordDisplayOrderUi(state),
2944
3511
  target: state.annotateSession.current.target,
2945
3512
  note: state.annotateSession.current.note,
2946
3513
  intent: state.annotateSession.current.intent
@@ -2950,12 +3517,42 @@ function getAnnotateSidebarOptions(ctx) {
2950
3517
  void sendAnnotationBatch(
2951
3518
  state,
2952
3519
  transports,
2953
- "batch",
3520
+ "quick-ask",
2954
3521
  composeAnnotateInstruction(state),
3522
+ "ide",
2955
3523
  () => {
3524
+ state.annotateInstructionDraft = "";
2956
3525
  state.annotateDrafts.clear();
2957
3526
  state.annotateEditingRecord = null;
2958
3527
  state.annotateSession = createEmptySession();
3528
+ state.annotateElements.clear();
3529
+ state.renderAnnotateSelectionOverlay();
3530
+ }
3531
+ );
3532
+ },
3533
+ onCreateTask: () => {
3534
+ var _a3;
3535
+ const transports = state.annotateSession.records.map(
3536
+ (record) => toAnnotationTransportFromRecordUi(null, record)
3537
+ );
3538
+ if (hasCurrentRecordUi(state) && state.annotateSession.current.target) {
3539
+ transports.push(
3540
+ toAnnotationTransportFromRecordUi(null, {
3541
+ id: state.annotateSession.current.id,
3542
+ displayOrder: (_a3 = state.annotateSession.current.displayOrder) != null ? _a3 : getNextRecordDisplayOrderUi(state),
3543
+ target: state.annotateSession.current.target,
3544
+ note: state.annotateSession.current.note,
3545
+ intent: state.annotateSession.current.intent
3546
+ })
3547
+ );
3548
+ }
3549
+ void sendAnnotationBatch(
3550
+ state,
3551
+ transports,
3552
+ "create-task",
3553
+ composeAnnotateInstruction(state),
3554
+ "agent",
3555
+ () => {
2959
3556
  }
2960
3557
  );
2961
3558
  },
@@ -2976,15 +3573,16 @@ function renderAnnotateSelectionOverlay(ctx) {
2976
3573
  return;
2977
3574
  }
2978
3575
  const overlayTargets = state.annotateSession.records.map((record) => {
2979
- var _a3;
3576
+ var _a3, _b2, _c;
2980
3577
  if (((_a3 = state.annotateEditingRecord) == null ? void 0 : _a3.id) === record.id) return null;
2981
3578
  const element = findElementForAnnotationTarget(state, record.target);
2982
3579
  if (!element) return null;
3580
+ const overlayState = ((_b2 = state.annotateLatestSessionSummary) == null ? void 0 : _b2.status) === "resolved" || ((_c = state.annotateLatestSessionDetail) == null ? void 0 : _c.status) === "resolved" ? "completed" : "saved";
2983
3581
  return {
2984
3582
  id: record.id,
2985
3583
  element,
2986
3584
  order: record.displayOrder,
2987
- state: "saved",
3585
+ state: overlayState,
2988
3586
  note: record.note,
2989
3587
  onActivate: () => {
2990
3588
  state.clearAnnotateError();
@@ -3013,15 +3611,13 @@ function renderAnnotateSelectionOverlay(ctx) {
3013
3611
  onOpenInEditor: () => {
3014
3612
  void openFile(target.location);
3015
3613
  },
3016
- canAttachScreenshotContext: false,
3017
- screenshotContextEnabled: false,
3018
3614
  canAttachCssContext: state.canAttachCssContext(),
3019
3615
  cssContextEnabled: (_b = state.annotateSession.current.cssContextEnabled) != null ? _b : false,
3020
3616
  canAttachRuntimeContext: false,
3021
3617
  runtimeContextEnabled: false,
3022
3618
  runtimeContextSummary: "",
3023
3619
  runtimeErrorCount: 0,
3024
- saveLabel: state.annotateEditingRecord ? "Update note" : "Save note",
3620
+ saveLabel: state.annotateEditingRecord ? t("annotate.updateNote") : t("annotate.saveNote"),
3025
3621
  onToggleCssContext: () => {
3026
3622
  var _a3;
3027
3623
  state.annotateSession = updateCurrentRecordCssContextEnabled(
@@ -3038,9 +3634,23 @@ function renderAnnotateSelectionOverlay(ctx) {
3038
3634
  state.updateAnnotateSidebar();
3039
3635
  },
3040
3636
  onSave: () => {
3637
+ var _a3, _b2;
3041
3638
  if (!hasCurrentRecordUi(state)) return;
3042
3639
  state.clearAnnotateError();
3043
3640
  state.clearAnnotateSuccess();
3641
+ if (((_a3 = state.annotateLatestSessionSummary) == null ? void 0 : _a3.status) === "resolved" || ((_b2 = state.annotateLatestSessionDetail) == null ? void 0 : _b2.status) === "resolved") {
3642
+ const currentDraft = state.annotateSession.current;
3643
+ state.annotateLatestSessionSummary = null;
3644
+ state.annotateLatestSessionDetail = null;
3645
+ state.stopLatestAnnotateSessionStream();
3646
+ state.annotateInstructionDraft = "";
3647
+ state.annotateDrafts.clear();
3648
+ state.annotateEditingRecord = null;
3649
+ state.annotateSession = {
3650
+ current: currentDraft,
3651
+ records: []
3652
+ };
3653
+ }
3044
3654
  clearDraftForTarget(state, state.annotateSession.current.target);
3045
3655
  state.annotateSession = saveCurrentRecord(state.annotateSession);
3046
3656
  state.annotateEditingRecord = null;
@@ -3079,6 +3689,7 @@ var init_component_annotate_ui = __esm({
3079
3689
  init_http();
3080
3690
  init_component_annotate_shared();
3081
3691
  init_component_annotate_targets();
3692
+ init_i18n();
3082
3693
  }
3083
3694
  });
3084
3695
 
@@ -3130,7 +3741,7 @@ function createBadge(ctx) {
3130
3741
  stateSpan.hidden = true;
3131
3742
  const titleSpan = document.createElement("span");
3132
3743
  titleSpan.className = `${badgeClass}-title`;
3133
- titleSpan.textContent = "Inspecto";
3744
+ titleSpan.textContent = t("launcher.title");
3134
3745
  const eyes = document.createElement("span");
3135
3746
  eyes.className = `${badgeClass}-eyes`;
3136
3747
  eyes.setAttribute("aria-hidden", "true");
@@ -3154,14 +3765,18 @@ function createBadge(ctx) {
3154
3765
  panel.dataset.inspectoLauncherPanel = "true";
3155
3766
  const panelHeader = document.createElement("div");
3156
3767
  panelHeader.className = `${badgeClass}-panel-header`;
3157
- panelHeader.innerHTML = '<div data-inspecto-launcher-panel-title="true">Choose a mode</div><div data-inspecto-launcher-panel-subtitle="true">Your next page click will follow this mode.</div>';
3768
+ const panelHeaderCopy = document.createElement("div");
3769
+ panelHeaderCopy.className = `${badgeClass}-panel-header-copy`;
3770
+ panelHeaderCopy.innerHTML = `<div data-inspecto-launcher-panel-title="true">${t("launcher.panel.title")}</div><div data-inspecto-launcher-panel-subtitle="true">${t("launcher.panel.subtitle")}</div>`;
3771
+ const panelHeaderActions = document.createElement("div");
3772
+ panelHeaderActions.className = `${badgeClass}-panel-header-actions`;
3158
3773
  const modeGroup = document.createElement("div");
3159
3774
  modeGroup.className = `${badgeClass}-panel-group`;
3160
3775
  const inspectBtn = document.createElement("button");
3161
3776
  inspectBtn.type = "button";
3162
3777
  inspectBtn.className = `${badgeClass}-panel-button`;
3163
3778
  inspectBtn.dataset.inspectoLauncherAction = "inspect";
3164
- inspectBtn.innerHTML = '<span data-inspecto-launcher-title="true">Inspect</span><span data-inspecto-launcher-description="true">Click one component to inspect or ask AI</span>';
3779
+ inspectBtn.innerHTML = `<span data-inspecto-launcher-title="true">${t("launcher.action.inspect.title")}</span><span data-inspecto-launcher-description="true">${t("launcher.action.inspect.description")}</span>`;
3165
3780
  inspectBtn.addEventListener("click", (event) => {
3166
3781
  event.stopPropagation();
3167
3782
  if (state.disabled) setPaused(state, false);
@@ -3174,7 +3789,7 @@ function createBadge(ctx) {
3174
3789
  annotateBtn.type = "button";
3175
3790
  annotateBtn.className = `${badgeClass}-panel-button`;
3176
3791
  annotateBtn.dataset.inspectoLauncherAction = "annotate";
3177
- annotateBtn.innerHTML = '<span data-inspecto-launcher-title="true">Annotate</span><span data-inspecto-launcher-description="true">Capture notes across components, then Ask AI once</span>';
3792
+ annotateBtn.innerHTML = `<span data-inspecto-launcher-title="true">${t("launcher.action.annotate.title")}</span><span data-inspecto-launcher-description="true">${t("launcher.action.annotate.description")}</span>`;
3178
3793
  annotateBtn.addEventListener("click", (event) => {
3179
3794
  event.stopPropagation();
3180
3795
  if (state.disabled) setPaused(state, false);
@@ -3185,13 +3800,18 @@ function createBadge(ctx) {
3185
3800
  });
3186
3801
  const pauseBtn = document.createElement("button");
3187
3802
  pauseBtn.type = "button";
3188
- pauseBtn.className = `${badgeClass}-panel-button secondary`;
3803
+ pauseBtn.className = `${badgeClass}-panel-toggle-button`;
3189
3804
  pauseBtn.dataset.inspectoLauncherAction = "pause";
3190
- pauseBtn.innerHTML = '<span data-inspecto-launcher-title="true">Pause selection</span><span data-inspecto-launcher-description="true">Use the page normally for a moment</span>';
3805
+ pauseBtn.setAttribute("aria-label", t("launcher.action.pause.title"));
3806
+ pauseBtn.setAttribute("aria-pressed", "false");
3807
+ pauseBtn.innerHTML = pauseIconSvg;
3191
3808
  pauseBtn.addEventListener("click", (event) => {
3192
3809
  event.stopPropagation();
3193
3810
  setPaused(state, !state.disabled);
3194
3811
  });
3812
+ const pauseText = document.createElement("div");
3813
+ pauseText.className = `${badgeClass}-panel-status-text`;
3814
+ pauseText.dataset.inspectoLauncherPauseText = "true";
3195
3815
  const hotkeyHint = document.createElement("div");
3196
3816
  hotkeyHint.className = `${badgeClass}-panel-hint`;
3197
3817
  hotkeyHint.dataset.inspectoLauncherHint = "hotkey";
@@ -3199,7 +3819,9 @@ function createBadge(ctx) {
3199
3819
  utilityGroup.className = `${badgeClass}-panel-group`;
3200
3820
  utilityGroup.dataset.inspectoLauncherUtilityGroup = "true";
3201
3821
  modeGroup.append(inspectBtn, annotateBtn);
3202
- utilityGroup.append(pauseBtn, hotkeyHint);
3822
+ panelHeader.append(panelHeaderCopy, panelHeaderActions);
3823
+ utilityGroup.append(hotkeyHint);
3824
+ panelHeaderActions.append(pauseText, pauseBtn);
3203
3825
  panel.append(panelHeader, modeGroup, utilityGroup);
3204
3826
  titleBlock.append(titleSpan, stateSpan);
3205
3827
  content.append(indicator, titleBlock);
@@ -3332,10 +3954,13 @@ function updateBadgeContent(ctx) {
3332
3954
  const pauseBtn = state.badge.querySelector(
3333
3955
  `[data-inspecto-launcher-action="pause"]`
3334
3956
  );
3957
+ const pauseText = state.badge.querySelector(
3958
+ `[data-inspecto-launcher-pause-text]`
3959
+ );
3335
3960
  const hotkeyHint = state.badge.querySelector(
3336
3961
  `[data-inspecto-launcher-hint="hotkey"]`
3337
3962
  );
3338
- if (!indicator || !titleSpan || !stateSpan || !panel || !inspectBtn || !annotateBtn || !pauseBtn || !hotkeyHint) {
3963
+ if (!indicator || !titleSpan || !stateSpan || !panel || !inspectBtn || !annotateBtn || !pauseBtn || !pauseText || !hotkeyHint) {
3339
3964
  return;
3340
3965
  }
3341
3966
  const updateModeButton = (button, active) => {
@@ -3344,32 +3969,39 @@ function updateBadgeContent(ctx) {
3344
3969
  };
3345
3970
  let stateLabel;
3346
3971
  if (state.disabled) {
3347
- stateLabel = "Selection paused";
3972
+ stateLabel = t("launcher.state.paused");
3348
3973
  indicator.dataset.state = "paused";
3349
3974
  state.badge.classList.remove("active");
3350
3975
  state.badge.classList.add("disabled");
3351
3976
  } else if (state.mode === "annotate") {
3352
- stateLabel = "Annotate mode";
3977
+ stateLabel = t("launcher.state.annotate");
3353
3978
  indicator.dataset.state = "annotate";
3354
3979
  state.badge.classList.remove("disabled");
3355
3980
  state.badge.classList.add("active");
3356
3981
  } else if (state.active) {
3357
- stateLabel = "Inspect mode";
3982
+ stateLabel = t("launcher.state.inspect");
3358
3983
  indicator.dataset.state = "inspect";
3359
3984
  state.badge.classList.remove("disabled");
3360
3985
  state.badge.classList.add("active");
3361
3986
  } else {
3362
- stateLabel = "Ready";
3987
+ stateLabel = t("launcher.state.ready");
3363
3988
  indicator.dataset.state = "ready";
3364
3989
  state.badge.classList.remove("active", "disabled");
3365
3990
  }
3366
3991
  stateSpan.dataset.state = indicator.dataset.state;
3367
3992
  stateSpan.hidden = false;
3368
- titleSpan.textContent = "Inspecto";
3993
+ titleSpan.textContent = t("launcher.title");
3369
3994
  stateSpan.textContent = stateLabel;
3370
3995
  panel.style.display = state.launcherPanelOpen ? "flex" : "none";
3371
- pauseBtn.innerHTML = state.disabled ? '<span data-inspecto-launcher-title="true">Resume selection</span><span data-inspecto-launcher-description="true">Start capturing page clicks again</span>' : '<span data-inspecto-launcher-title="true">Pause selection</span><span data-inspecto-launcher-description="true">Use the page normally for a moment</span>';
3372
- hotkeyHint.textContent = getEffectiveHotKeys(state) === false ? "Hotkey disabled. Open the launcher to choose Inspect or Annotate." : `Hotkey: ${getHotKeyLabel(state)} for quick jump`;
3996
+ const isPaused = state.disabled;
3997
+ pauseBtn.setAttribute(
3998
+ "aria-label",
3999
+ isPaused ? t("launcher.action.resume.title") : t("launcher.action.pause.title")
4000
+ );
4001
+ pauseBtn.setAttribute("aria-pressed", isPaused ? "true" : "false");
4002
+ pauseBtn.innerHTML = isPaused ? playIconSvg : pauseIconSvg;
4003
+ pauseText.textContent = isPaused ? t("launcher.action.resume.title") : t("launcher.action.pause.title");
4004
+ hotkeyHint.textContent = getEffectiveHotKeys(state) === false ? t("launcher.hint.hotkeyDisabled") : t("launcher.hint.hotkeyQuickJump", { hotkey: getHotKeyLabel(state) });
3373
4005
  inspectBtn.style.display = state.disabled ? "none" : "inline-flex";
3374
4006
  annotateBtn.style.display = state.disabled ? "none" : "inline-flex";
3375
4007
  updateModeButton(inspectBtn, !state.disabled && state.active && state.mode === "inspect");
@@ -3453,6 +4085,8 @@ var init_component_launcher = __esm({
3453
4085
  "use strict";
3454
4086
  init_styles();
3455
4087
  init_component_utils();
4088
+ init_i18n();
4089
+ init_icons();
3456
4090
  }
3457
4091
  });
3458
4092
 
@@ -3520,21 +4154,16 @@ function buildFixBugPrompt(input) {
3520
4154
  const evidence = selectFixBugEvidence(input.records);
3521
4155
  const templateGuidance = normalizeTemplateGuidance(input.template);
3522
4156
  return [
3523
- "You are fixing a bug for the currently inspected UI target.",
4157
+ "Fix the bug for the inspected UI target.",
3524
4158
  buildSourceContextSection(input.location, input.snippet),
3525
4159
  buildEvidenceSection(evidence),
3526
- "Guardrails:",
3527
- "- Prioritize evidence-backed conclusions.",
3528
- "- Separate confirmed evidence from hypotheses.",
3529
- "- Avoid strong claims when the runtime evidence is weak or unrelated.",
3530
- "- Ask follow-up questions if the evidence is insufficient for a safe fix.",
3531
- "Response contract:",
3532
- "1. Most likely root cause",
3533
- "2. Confirmed evidence",
3534
- "3. Hypotheses",
3535
- "4. Minimal fix",
3536
- "5. Follow-up questions (only if needed)",
3537
- templateGuidance ? `Configured intent guidance (reference only):
4160
+ [
4161
+ "Task:",
4162
+ "- Identify the likely root cause.",
4163
+ "- Propose the smallest safe fix.",
4164
+ "- Separate evidence from guesses when needed."
4165
+ ].join("\n"),
4166
+ templateGuidance ? `Additional guidance:
3538
4167
  ${indentBlock(templateGuidance)}` : ""
3539
4168
  ].join("\n\n");
3540
4169
  }
@@ -3543,7 +4172,7 @@ function buildPromptForIntent(intent, location, snippetResult, runtimeContext) {
3543
4172
  const fullPromptTemplate = assembleIntentPromptTemplate(intent);
3544
4173
  if (intent.id === "fix-bug") {
3545
4174
  return buildFixBugPrompt({
3546
- template: fullPromptTemplate,
4175
+ template: assembleFixBugAdditionalGuidance(intent),
3547
4176
  location,
3548
4177
  snippet: (snippetResult == null ? void 0 : snippetResult.snippet) || "",
3549
4178
  records: (_a2 = runtimeContext == null ? void 0 : runtimeContext.records) != null ? _a2 : []
@@ -3581,14 +4210,16 @@ ${intent.appendPrompt}`;
3581
4210
  }
3582
4211
  return fullPromptTemplate;
3583
4212
  }
4213
+ function assembleFixBugAdditionalGuidance(intent) {
4214
+ return [intent.prependPrompt, intent.appendPrompt].filter(Boolean).join("\n\n");
4215
+ }
3584
4216
  function buildEvidenceSection(records) {
3585
4217
  if (records.length === 0) {
3586
- return [
3587
- "High-confidence runtime evidence:",
3588
- "- None selected. Do not treat unrelated logs as proof."
3589
- ].join("\n");
4218
+ return ["Runtime evidence:", "- None selected. Do not treat unrelated logs as proof."].join(
4219
+ "\n"
4220
+ );
3590
4221
  }
3591
- return ["High-confidence runtime evidence:", ...records.map(formatEvidenceRecord)].join("\n");
4222
+ return ["Runtime evidence:", ...records.map(formatEvidenceRecord)].join("\n");
3592
4223
  }
3593
4224
  function appendRuntimeContextToPrompt(prompt, records) {
3594
4225
  if (records.length === 0) return prompt;
@@ -3596,20 +4227,6 @@ function appendRuntimeContextToPrompt(prompt, records) {
3596
4227
 
3597
4228
  ${buildGenericRuntimeContextSection(records)}`;
3598
4229
  }
3599
- function appendScreenshotContextToPrompt(prompt, screenshotContext) {
3600
- if (!screenshotContext || !screenshotContext.imageDataUrl && !screenshotContext.imageAssetId) {
3601
- return prompt;
3602
- }
3603
- const lines = [
3604
- "Visual screenshot context attached:",
3605
- `- capturedAt=${screenshotContext.capturedAt}`,
3606
- `- mimeType=${screenshotContext.mimeType}`,
3607
- ...screenshotContext.imageAssetId ? [`- imageAssetId=${screenshotContext.imageAssetId}`] : []
3608
- ];
3609
- return `${prompt}
3610
-
3611
- ${lines.join("\n")}`;
3612
- }
3613
4230
  function buildGenericRuntimeContextSection(records) {
3614
4231
  return ["Relevant runtime context:", ...records.map(formatEvidenceRecord)].join("\n");
3615
4232
  }
@@ -3675,8 +4292,8 @@ function createAskInput(placeholder) {
3675
4292
  const input = document.createElement("input");
3676
4293
  input.className = menuInputClass;
3677
4294
  input.type = "text";
3678
- input.placeholder = placeholder != null ? placeholder : "Add a custom ask or extra instruction...";
3679
- input.setAttribute("aria-label", "Custom ask");
4295
+ input.placeholder = placeholder != null ? placeholder : t("menu.ask.placeholder.default");
4296
+ input.setAttribute("aria-label", t("menu.ask.ariaLabel"));
3680
4297
  const sendIcon = document.createElement("div");
3681
4298
  sendIcon.className = menuInputIconClass;
3682
4299
  sendIcon.innerHTML = `<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="22" y1="2" x2="11" y2="13"></line><polygon points="22 2 15 22 11 13 2 9 22 2"></polygon></svg>`;
@@ -3690,9 +4307,33 @@ function showError(menu, message, errorCode) {
3690
4307
  (_a2 = menu.querySelector(`.${errorMsgClass}`)) == null ? void 0 : _a2.remove();
3691
4308
  const errEl = document.createElement("div");
3692
4309
  errEl.className = errorMsgClass;
3693
- errEl.textContent = errorCode === "FILE_NOT_FOUND" ? "Source file not found. Is the server running?" : `Error: ${message}`;
4310
+ errEl.textContent = formatMenuErrorMessage(message, errorCode);
3694
4311
  menu.appendChild(errEl);
3695
4312
  }
4313
+ function formatMenuErrorMessage(message, errorCode) {
4314
+ if (errorCode === "CLIENT_CONFIG_UNAVAILABLE") {
4315
+ return [
4316
+ "Inspecto is not connected to the local dev server or could not load its client config.",
4317
+ "Restart your dev server and confirm `@inspecto-dev/plugin` is installed in the active build config, then run `inspecto doctor` or `npx @inspecto-dev/cli doctor` if this continues."
4318
+ ].join(" ");
4319
+ }
4320
+ if (errorCode === "SERVER_UNAVAILABLE") {
4321
+ return "Inspecto could not reach the local dev server. Restart your dev server, then try again. If it still fails, run `inspecto doctor` or `npx @inspecto-dev/cli doctor` from the project root.";
4322
+ }
4323
+ if (errorCode === "FILE_NOT_FOUND") {
4324
+ return "Source file not found. Restart the dev server or run `npx @inspecto-dev/cli doctor` from the project root.";
4325
+ }
4326
+ if (errorCode === "IDE_UNAVAILABLE" || errorCode === "IDE_NOT_FOUND") {
4327
+ return "Unable to open the source file in your editor. Confirm the editor command or URI scheme is available, and set the `ide` field in `.inspecto/settings.local.json` if auto-detection chooses the wrong editor.";
4328
+ }
4329
+ if (errorCode === "EXTENSION_NOT_INSTALLED") {
4330
+ return "The target AI extension is not installed or not available in this editor. Install it, then run `npx @inspecto-dev/cli doctor` if dispatch still fails.";
4331
+ }
4332
+ if (errorCode === "CLIPBOARD_WRITE_FAILED") {
4333
+ return "Inspecto could not write the fallback prompt to the clipboard. Check browser clipboard permissions and try again.";
4334
+ }
4335
+ return `Error: ${message}`;
4336
+ }
3696
4337
  function isFixIntent(intent) {
3697
4338
  return intent.aiIntent === "fix";
3698
4339
  }
@@ -3718,7 +4359,7 @@ function createRuntimeContextUi(runtimeContext, options) {
3718
4359
  const toggle = document.createElement("button");
3719
4360
  toggle.type = "button";
3720
4361
  toggle.className = menuContextToggleClass;
3721
- toggle.textContent = "Show preview";
4362
+ toggle.textContent = t("menu.preview.show");
3722
4363
  const preview = document.createElement("div");
3723
4364
  preview.className = menuContextPreviewClass;
3724
4365
  preview.hidden = true;
@@ -3727,7 +4368,7 @@ function createRuntimeContextUi(runtimeContext, options) {
3727
4368
  event.preventDefault();
3728
4369
  event.stopPropagation();
3729
4370
  preview.hidden = !preview.hidden;
3730
- toggle.textContent = preview.hidden ? "Show preview" : "Hide preview";
4371
+ toggle.textContent = preview.hidden ? t("menu.preview.show") : t("menu.preview.hide");
3731
4372
  });
3732
4373
  container.append(toggle, preview);
3733
4374
  return container;
@@ -3736,14 +4377,10 @@ function formatRuntimeContextSummary(runtimeContext) {
3736
4377
  const parts = [];
3737
4378
  const { runtimeErrorCount, failedRequestCount } = runtimeContext.summary;
3738
4379
  if (runtimeErrorCount > 0) {
3739
- parts.push(
3740
- `${runtimeErrorCount} ${runtimeErrorCount === 1 ? "runtime error" : "runtime errors"}`
3741
- );
4380
+ parts.push(runtimeSummaryLabel("error", runtimeErrorCount));
3742
4381
  }
3743
4382
  if (failedRequestCount > 0) {
3744
- parts.push(
3745
- `${failedRequestCount} ${failedRequestCount === 1 ? "failed request" : "failed requests"}`
3746
- );
4383
+ parts.push(runtimeSummaryLabel("request", failedRequestCount));
3747
4384
  }
3748
4385
  return parts.join(" \u2022 ");
3749
4386
  }
@@ -3758,6 +4395,7 @@ ${details}`;
3758
4395
  var init_menu_helpers = __esm({
3759
4396
  "src/menu-helpers.ts"() {
3760
4397
  "use strict";
4398
+ init_i18n();
3761
4399
  init_styles();
3762
4400
  }
3763
4401
  });
@@ -3774,7 +4412,7 @@ function createIntentActionButtons(input) {
3774
4412
  btn.addEventListener("click", (event) => __async(null, null, function* () {
3775
4413
  event.stopPropagation();
3776
4414
  btn.disabled = true;
3777
- btn.textContent = "Sending...";
4415
+ btn.textContent = t("menu.sending");
3778
4416
  try {
3779
4417
  let snippetResult = null;
3780
4418
  if (input.includeSnippet) {
@@ -3786,15 +4424,11 @@ function createIntentActionButtons(input) {
3786
4424
  );
3787
4425
  }
3788
4426
  const requestRuntimeContext = input.resolveRuntimeContext(intent);
3789
- const requestScreenshotContext = yield input.resolveScreenshotContext();
3790
4427
  const requestCssContextPrompt = input.resolveCssContextPrompt(
3791
4428
  isFixUiIntent(intent) ? intent : void 0
3792
4429
  );
3793
4430
  const prompt = appendCssContextToPrompt(
3794
- appendScreenshotContextToPrompt(
3795
- buildPromptForIntent(intent, input.location, snippetResult, requestRuntimeContext),
3796
- requestScreenshotContext
3797
- ),
4431
+ buildPromptForIntent(intent, input.location, snippetResult, requestRuntimeContext),
3798
4432
  requestCssContextPrompt
3799
4433
  );
3800
4434
  yield input.onSend({
@@ -3802,8 +4436,7 @@ function createIntentActionButtons(input) {
3802
4436
  button: btn,
3803
4437
  prompt,
3804
4438
  snippetText: (snippetResult == null ? void 0 : snippetResult.snippet) || "",
3805
- runtimeContext: requestRuntimeContext,
3806
- screenshotContext: requestScreenshotContext
4439
+ runtimeContext: requestRuntimeContext
3807
4440
  });
3808
4441
  } catch (err) {
3809
4442
  btn.disabled = false;
@@ -3820,6 +4453,7 @@ var init_menu_actions = __esm({
3820
4453
  init_css_context();
3821
4454
  init_fix_bug_prompt();
3822
4455
  init_http();
4456
+ init_i18n();
3823
4457
  init_menu_helpers();
3824
4458
  init_styles();
3825
4459
  }
@@ -3828,21 +4462,21 @@ var init_menu_actions = __esm({
3828
4462
  // src/menu-send.ts
3829
4463
  function openAndSendInspectPrompt(input) {
3830
4464
  return __async(this, null, function* () {
3831
- var _a2, _b;
3832
- const opened = yield openFile(input.location);
3833
- if (!opened) {
4465
+ var _a2, _b, _c;
4466
+ const openResult = yield openFileWithDiagnostics(input.location);
4467
+ if (!openResult.success) {
3834
4468
  input.onRestore();
3835
- input.onError("Unable to open file in the IDE.", "IDE_UNAVAILABLE");
4469
+ input.onError("Unable to open the source file.", (_a2 = openResult.errorCode) != null ? _a2 : "IDE_UNAVAILABLE");
3836
4470
  return;
3837
4471
  }
3838
4472
  yield new Promise((r) => setTimeout(r, 100));
3839
- const result = yield sendToAi(__spreadValues(__spreadValues({
4473
+ const result = yield sendToAi(__spreadValues({
3840
4474
  location: input.location,
3841
4475
  snippet: input.snippetText,
3842
4476
  prompt: input.promptText
3843
- }, input.runtimeContext ? { runtimeContext: input.runtimeContext } : {}), input.screenshotContext ? { screenshotContext: input.screenshotContext } : {}));
4477
+ }, input.runtimeContext ? { runtimeContext: input.runtimeContext } : {}));
3844
4478
  if (result.success) {
3845
- if ((_a2 = result.fallbackPayload) == null ? void 0 : _a2.prompt) {
4479
+ if ((_b = result.fallbackPayload) == null ? void 0 : _b.prompt) {
3846
4480
  try {
3847
4481
  yield navigator.clipboard.writeText(result.fallbackPayload.prompt);
3848
4482
  } catch (e) {
@@ -3852,12 +4486,12 @@ function openAndSendInspectPrompt(input) {
3852
4486
  return;
3853
4487
  }
3854
4488
  input.onRestore();
3855
- input.onError((_b = result.error) != null ? _b : "Unknown error", result.errorCode);
4489
+ input.onError((_c = result.error) != null ? _c : "Unknown error", result.errorCode);
3856
4490
  });
3857
4491
  }
3858
4492
  function buildCustomInspectPrompt(input) {
3859
4493
  return __async(this, null, function* () {
3860
- var _a2, _b, _c, _d;
4494
+ var _a2, _b, _c;
3861
4495
  let snippetResult = null;
3862
4496
  if (input.includeSnippet) {
3863
4497
  snippetResult = yield fetchSnippet(
@@ -3868,18 +4502,15 @@ function buildCustomInspectPrompt(input) {
3868
4502
  );
3869
4503
  }
3870
4504
  const prompt = appendCssContextToPrompt(
3871
- appendScreenshotContextToPrompt(
3872
- appendRuntimeContextToPrompt(
3873
- buildPrompt(
3874
- buildCustomInspectPromptTemplate(input.ask.trim(), input.location, input.targetLabel),
3875
- input.location,
3876
- snippetResult
3877
- ),
3878
- (_b = (_a2 = input.runtimeContext) == null ? void 0 : _a2.records) != null ? _b : []
4505
+ appendRuntimeContextToPrompt(
4506
+ buildPrompt(
4507
+ buildCustomInspectPromptTemplate(input.ask.trim(), input.location, input.targetLabel),
4508
+ input.location,
4509
+ snippetResult
3879
4510
  ),
3880
- (_c = input.screenshotContext) != null ? _c : null
4511
+ (_b = (_a2 = input.runtimeContext) == null ? void 0 : _a2.records) != null ? _b : []
3881
4512
  ),
3882
- (_d = input.cssContextPrompt) != null ? _d : null
4513
+ (_c = input.cssContextPrompt) != null ? _c : null
3883
4514
  );
3884
4515
  return {
3885
4516
  prompt,
@@ -3939,16 +4570,16 @@ function createMenuHeaderDom(input) {
3939
4570
  const openButton = document.createElement("button");
3940
4571
  openButton.type = "button";
3941
4572
  openButton.dataset.role = "open-icon";
3942
- openButton.setAttribute("aria-label", "Open in Editor");
3943
- openButton.title = "Open in Editor";
4573
+ openButton.setAttribute("aria-label", t("menu.openInEditor"));
4574
+ openButton.title = t("menu.openInEditor");
3944
4575
  openButton.textContent = "\u2197";
3945
4576
  applyHeaderIconButtonStyles(openButton);
3946
4577
  const runtimeToggleButton = document.createElement("button");
3947
4578
  runtimeToggleButton.type = "button";
3948
4579
  runtimeToggleButton.className = runtimeToggleClass;
3949
4580
  runtimeToggleButton.dataset.role = "runtime-context-toggle";
3950
- runtimeToggleButton.setAttribute("aria-label", "Attach runtime context");
3951
- runtimeToggleButton.title = "Attach runtime context";
4581
+ runtimeToggleButton.setAttribute("aria-label", t("menu.attachRuntime"));
4582
+ runtimeToggleButton.title = t("menu.attachRuntime");
3952
4583
  runtimeToggleButton.hidden = !input.canAttachRuntimeContext;
3953
4584
  applyHeaderIconButtonStyles(runtimeToggleButton);
3954
4585
  const runtimeToggleIcon = document.createElement("span");
@@ -3959,26 +4590,12 @@ function createMenuHeaderDom(input) {
3959
4590
  runtimeToggleBadge.dataset.runtimeErrorBadge = "true";
3960
4591
  runtimeToggleBadge.hidden = true;
3961
4592
  runtimeToggleButton.append(runtimeToggleIcon, runtimeToggleBadge);
3962
- const screenshotToggleButton = document.createElement("button");
3963
- screenshotToggleButton.type = "button";
3964
- screenshotToggleButton.className = runtimeToggleClass;
3965
- screenshotToggleButton.dataset.role = "screenshot-context-toggle";
3966
- screenshotToggleButton.setAttribute("aria-label", "Attach screenshot context");
3967
- screenshotToggleButton.title = "Attach screenshot context";
3968
- screenshotToggleButton.hidden = !input.canAttachScreenshotContext;
3969
- screenshotToggleButton.setAttribute("aria-pressed", "false");
3970
- screenshotToggleButton.dataset.visualState = "inactive";
3971
- applyHeaderIconButtonStyles(screenshotToggleButton);
3972
- const screenshotToggleIcon = document.createElement("span");
3973
- screenshotToggleIcon.className = runtimeToggleIconClass;
3974
- screenshotToggleIcon.innerHTML = screenshotIconSvg;
3975
- screenshotToggleButton.append(screenshotToggleIcon);
3976
4593
  const cssToggleButton = document.createElement("button");
3977
4594
  cssToggleButton.type = "button";
3978
4595
  cssToggleButton.className = runtimeToggleClass;
3979
4596
  cssToggleButton.dataset.role = "css-context-toggle";
3980
- cssToggleButton.setAttribute("aria-label", "Attach CSS context");
3981
- cssToggleButton.title = "Attach CSS context";
4597
+ cssToggleButton.setAttribute("aria-label", t("menu.attachCss"));
4598
+ cssToggleButton.title = t("menu.attachCss");
3982
4599
  cssToggleButton.hidden = !input.canAttachCssContext;
3983
4600
  cssToggleButton.setAttribute("aria-pressed", "false");
3984
4601
  cssToggleButton.dataset.visualState = "inactive";
@@ -4001,7 +4618,6 @@ function createMenuHeaderDom(input) {
4001
4618
  openButton,
4002
4619
  runtimeToggleButton,
4003
4620
  runtimeToggleBadge,
4004
- screenshotToggleButton,
4005
4621
  cssToggleButton
4006
4622
  };
4007
4623
  }
@@ -4025,6 +4641,7 @@ var init_menu_header = __esm({
4025
4641
  "src/menu-header.ts"() {
4026
4642
  "use strict";
4027
4643
  init_icons();
4644
+ init_i18n();
4028
4645
  init_menu_helpers();
4029
4646
  init_styles();
4030
4647
  }
@@ -4056,10 +4673,8 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
4056
4673
  const maxSnippetLines = (_a2 = options.maxSnippetLines) != null ? _a2 : 100;
4057
4674
  const includeSnippet = (_b = options.includeSnippet) != null ? _b : false;
4058
4675
  let canAttachRuntimeContext2 = ((_c = options.runtimeContext) == null ? void 0 : _c.enabled) === true && typeof deps.getRuntimeContext === "function";
4059
- const canAttachScreenshotContext2 = false;
4060
4676
  let runtimeContextPreference = null;
4061
4677
  let runtimeContextDefaultMode = "off";
4062
- let screenshotContextEnabled = false;
4063
4678
  let cssContextEnabled = false;
4064
4679
  const canAttachCssContext2 = typeof deps.captureCssContextPrompt === "function";
4065
4680
  const menu = document.createElement("div");
@@ -4074,30 +4689,13 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
4074
4689
  openButton,
4075
4690
  runtimeToggleButton,
4076
4691
  runtimeToggleBadge,
4077
- screenshotToggleButton,
4078
4692
  cssToggleButton
4079
4693
  } = createMenuHeaderDom(__spreadProps(__spreadValues({
4080
4694
  location
4081
4695
  }, deps.targetLabel ? { targetLabel: deps.targetLabel } : {}), {
4082
4696
  canAttachRuntimeContext: canAttachRuntimeContext2,
4083
- canAttachScreenshotContext: canAttachScreenshotContext2,
4084
4697
  canAttachCssContext: canAttachCssContext2
4085
4698
  }));
4086
- const syncScreenshotToggleButton = () => {
4087
- screenshotToggleButton.hidden = !canAttachScreenshotContext2;
4088
- if (!canAttachScreenshotContext2) {
4089
- screenshotToggleButton.remove();
4090
- return;
4091
- }
4092
- if (!headerActions.contains(screenshotToggleButton)) {
4093
- const referenceNode = headerActions.contains(runtimeToggleButton) ? runtimeToggleButton : headerActions.contains(openButton) ? openButton : null;
4094
- if (referenceNode) {
4095
- headerActions.insertBefore(screenshotToggleButton, referenceNode);
4096
- } else {
4097
- headerActions.appendChild(screenshotToggleButton);
4098
- }
4099
- }
4100
- };
4101
4699
  const syncCssToggleButton = () => {
4102
4700
  cssToggleButton.hidden = !canAttachCssContext2;
4103
4701
  if (!canAttachCssContext2) {
@@ -4132,11 +4730,10 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
4132
4730
  applyIconToggleButtonState(
4133
4731
  cssToggleButton,
4134
4732
  cssContextEnabled,
4135
- "CSS context enabled",
4136
- "Attach CSS context"
4733
+ t("menu.cssEnabled"),
4734
+ t("menu.attachCss")
4137
4735
  );
4138
4736
  };
4139
- syncScreenshotToggleButton();
4140
4737
  syncCssToggleButton();
4141
4738
  syncRuntimeToggleButton();
4142
4739
  applyCssToggleButtonState();
@@ -4296,7 +4893,7 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
4296
4893
  ariaPressed === "true" ? "active" : ariaPressed === "mixed" ? "mixed" : "inactive"
4297
4894
  );
4298
4895
  runtimeToggleBadge.hidden = ariaPressed !== "true" || runtimeErrorCount <= 0;
4299
- runtimeToggleButton.title = ariaPressed === "true" ? runtimeSummary ? `Runtime context enabled \u2022 ${runtimeSummary}` : "Runtime context enabled" : ariaPressed === "mixed" ? runtimeSummary ? `Runtime context defaults to fix actions only \u2022 ${runtimeSummary}` : "Runtime context defaults to fix actions only until you choose otherwise" : runtimeSummary ? `Attach runtime context \u2022 ${runtimeSummary}` : "Attach runtime context";
4896
+ runtimeToggleButton.title = ariaPressed === "true" ? runtimeSummary ? `${t("menu.runtimeEnabled")} \u2022 ${runtimeSummary}` : t("menu.runtimeEnabled") : ariaPressed === "mixed" ? runtimeSummary ? `${t("menu.runtimeFixOnly")} \u2022 ${runtimeSummary}` : t("menu.runtimeFixOnly") : runtimeSummary ? `${t("menu.attachRuntime")} \u2022 ${runtimeSummary}` : t("menu.attachRuntime");
4300
4897
  if (ariaPressed !== "true") {
4301
4898
  runtimeContextSection.hidden = true;
4302
4899
  updatePosition();
@@ -4316,28 +4913,12 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
4316
4913
  runtimeContextPreference = !currentEnabled;
4317
4914
  renderRuntimeContextUi();
4318
4915
  });
4319
- screenshotToggleButton.addEventListener("click", (event) => {
4320
- event.preventDefault();
4321
- event.stopPropagation();
4322
- screenshotContextEnabled = !screenshotContextEnabled;
4323
- screenshotToggleButton.setAttribute("aria-pressed", screenshotContextEnabled ? "true" : "false");
4324
- screenshotToggleButton.dataset.visualState = screenshotContextEnabled ? "active" : "inactive";
4325
- });
4326
4916
  cssToggleButton.addEventListener("click", (event) => {
4327
4917
  event.preventDefault();
4328
4918
  event.stopPropagation();
4329
4919
  cssContextEnabled = !cssContextEnabled;
4330
4920
  applyCssToggleButtonState();
4331
4921
  });
4332
- const resolveScreenshotContext = () => __async(null, null, function* () {
4333
- var _a3, _b2;
4334
- if (!screenshotContextEnabled) return null;
4335
- try {
4336
- return (_b2 = yield (_a3 = deps.captureScreenshotContext) == null ? void 0 : _a3.call(deps)) != null ? _b2 : null;
4337
- } catch (e) {
4338
- return null;
4339
- }
4340
- });
4341
4922
  const resolveCssContextPrompt = (intent) => {
4342
4923
  var _a3, _b2;
4343
4924
  const shouldAttachCssContext = cssContextEnabled || Boolean(intent && isFixUiIntent(intent));
@@ -4354,7 +4935,6 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
4354
4935
  sendIcon.style.pointerEvents = "none";
4355
4936
  try {
4356
4937
  const requestRuntimeContext = resolveRuntimeContext();
4357
- const requestScreenshotContext = yield resolveScreenshotContext();
4358
4938
  const requestCssContextPrompt = resolveCssContextPrompt();
4359
4939
  const built = yield buildCustomInspectPrompt(__spreadProps(__spreadValues({
4360
4940
  location,
@@ -4363,7 +4943,6 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
4363
4943
  includeSnippet,
4364
4944
  maxSnippetLines,
4365
4945
  runtimeContext: requestRuntimeContext,
4366
- screenshotContext: requestScreenshotContext,
4367
4946
  cssContextPrompt: requestCssContextPrompt
4368
4947
  }));
4369
4948
  yield openAndSendInspectPrompt({
@@ -4371,7 +4950,6 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
4371
4950
  promptText: built.prompt,
4372
4951
  snippetText: built.snippetText,
4373
4952
  runtimeContext: requestRuntimeContext,
4374
- screenshotContext: requestScreenshotContext,
4375
4953
  onSuccess: cleanup,
4376
4954
  onRestore: () => {
4377
4955
  input.disabled = false;
@@ -4392,13 +4970,19 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
4392
4970
  fetchIdeInfo().then((ideInfo) => {
4393
4971
  var _a3;
4394
4972
  loadingEl.remove();
4973
+ if (!ideInfo) {
4974
+ input.placeholder = t("menu.ask.placeholder.setup");
4975
+ showError(menu, "Client config unavailable", "CLIENT_CONFIG_UNAVAILABLE");
4976
+ updatePosition();
4977
+ return;
4978
+ }
4395
4979
  if (((_a3 = ideInfo == null ? void 0 : ideInfo.runtimeContext) == null ? void 0 : _a3.enabled) === true && typeof deps.getRuntimeContext === "function") {
4396
4980
  canAttachRuntimeContext2 = true;
4397
4981
  syncRuntimeToggleButton();
4398
4982
  }
4399
4983
  const intents = (ideInfo == null ? void 0 : ideInfo.prompts) || [];
4400
4984
  if (!options.askPlaceholder) {
4401
- input.placeholder = intents.length > 0 ? "Add a custom ask or extra instruction..." : "Ask anything about this component...";
4985
+ input.placeholder = intents.length > 0 ? t("menu.ask.placeholder.default") : t("menu.ask.placeholder.fallback");
4402
4986
  }
4403
4987
  const aiIntents = intents;
4404
4988
  const hasFixIntent = aiIntents.some(isFixIntent);
@@ -4411,7 +4995,6 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
4411
4995
  includeSnippet,
4412
4996
  maxSnippetLines,
4413
4997
  resolveRuntimeContext,
4414
- resolveScreenshotContext,
4415
4998
  resolveCssContextPrompt,
4416
4999
  onSend: (payload) => __async(null, null, function* () {
4417
5000
  yield openAndSendInspectPrompt({
@@ -4419,7 +5002,6 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
4419
5002
  promptText: payload.prompt,
4420
5003
  snippetText: payload.snippetText,
4421
5004
  runtimeContext: payload.runtimeContext,
4422
- screenshotContext: payload.screenshotContext,
4423
5005
  onSuccess: cleanup,
4424
5006
  onRestore: () => {
4425
5007
  payload.button.disabled = false;
@@ -4431,15 +5013,16 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
4431
5013
  onError: (message, errorCode) => showError(menu, message, errorCode)
4432
5014
  });
4433
5015
  openButton.addEventListener("click", (e) => __async(null, null, function* () {
5016
+ var _a4;
4434
5017
  e.stopPropagation();
4435
5018
  openButton.disabled = true;
4436
- const opened = yield openFile(location);
4437
- if (opened) {
5019
+ const openResult = yield openFileWithDiagnostics(location);
5020
+ if (openResult.success) {
4438
5021
  cleanup();
4439
5022
  return;
4440
5023
  }
4441
5024
  openButton.disabled = false;
4442
- showError(menu, "Unable to open file in the IDE.", "IDE_UNAVAILABLE");
5025
+ showError(menu, t("menu.error.openIde"), (_a4 = openResult.errorCode) != null ? _a4 : "IDE_UNAVAILABLE");
4443
5026
  }));
4444
5027
  for (const action of aiActions) {
4445
5028
  actionsSection.appendChild(action);
@@ -4467,6 +5050,7 @@ var init_menu = __esm({
4467
5050
  init_menu_header();
4468
5051
  init_menu_position();
4469
5052
  init_menu_helpers();
5053
+ init_i18n();
4470
5054
  init_styles();
4471
5055
  }
4472
5056
  });
@@ -5047,51 +5631,6 @@ var init_runtime_context = __esm({
5047
5631
  }
5048
5632
  });
5049
5633
 
5050
- // src/screenshot-context.ts
5051
- function captureElementScreenshot(element) {
5052
- return __async(this, null, function* () {
5053
- const rect = element.getBoundingClientRect();
5054
- if (rect.width <= 0 || rect.height <= 0) return null;
5055
- const ownerDocument = element.ownerDocument;
5056
- const view = ownerDocument.defaultView;
5057
- if (!view) return null;
5058
- try {
5059
- const left = Math.max(0, rect.left + view.scrollX - SCREENSHOT_PADDING);
5060
- const top = Math.max(0, rect.top + view.scrollY - SCREENSHOT_PADDING);
5061
- const width = Math.ceil(rect.width + SCREENSHOT_PADDING * 2);
5062
- const height = Math.ceil(rect.height + SCREENSHOT_PADDING * 2);
5063
- const root = ownerDocument.documentElement;
5064
- const canvas = yield (0, import_html2canvas.default)(root, {
5065
- backgroundColor: null,
5066
- logging: false,
5067
- useCORS: true,
5068
- x: left,
5069
- y: top,
5070
- width,
5071
- height,
5072
- windowWidth: root.scrollWidth,
5073
- windowHeight: root.scrollHeight
5074
- });
5075
- return {
5076
- enabled: true,
5077
- capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
5078
- mimeType: "image/png",
5079
- imageDataUrl: canvas.toDataURL("image/png")
5080
- };
5081
- } catch (e) {
5082
- return null;
5083
- }
5084
- });
5085
- }
5086
- var import_html2canvas, SCREENSHOT_PADDING;
5087
- var init_screenshot_context = __esm({
5088
- "src/screenshot-context.ts"() {
5089
- "use strict";
5090
- import_html2canvas = __toESM(require("html2canvas"), 1);
5091
- SCREENSHOT_PADDING = 12;
5092
- }
5093
- });
5094
-
5095
5634
  // src/component-interactions.ts
5096
5635
  function asInteractionContext(ctx) {
5097
5636
  return ctx;
@@ -5124,9 +5663,8 @@ function handleMouseMove(ctx, event) {
5124
5663
  state.overlay.hide();
5125
5664
  return;
5126
5665
  }
5127
- const attrValue = target.getAttribute(ATTR_NAME);
5128
- const loc = parseAttrValue(attrValue);
5129
- const label = loc ? `${(_a2 = loc.file.split("/").pop()) != null ? _a2 : ""}:${loc.line}` : attrValue;
5666
+ const loc = getInspectableLocation(target);
5667
+ const label = loc ? `${(_a2 = loc.file.split("/").pop()) != null ? _a2 : ""}:${loc.line}` : "";
5130
5668
  if (state.mode === "annotate" && state.annotateCapturePaused) {
5131
5669
  state.overlay.hide();
5132
5670
  return;
@@ -5153,8 +5691,7 @@ function handleTrigger(ctx, event) {
5153
5691
  if (state.mode === "annotate" && state.annotateCapturePaused) return;
5154
5692
  event.preventDefault();
5155
5693
  event.stopPropagation();
5156
- const attrValue = target.getAttribute(ATTR_NAME);
5157
- const loc = parseAttrValue(attrValue);
5694
+ const loc = getInspectableLocation(target);
5158
5695
  if (!loc) return;
5159
5696
  if (state.mode === "annotate") {
5160
5697
  if (state.annotateQuickCaptureEnabled) {
@@ -5174,10 +5711,13 @@ function handleTrigger(ctx, event) {
5174
5711
  state.openInspectMenu(loc, event.clientX, event.clientY, target);
5175
5712
  }
5176
5713
  function handleKeyDown(ctx, event) {
5177
- var _a2;
5178
5714
  const state = asInteractionContext(ctx);
5179
5715
  if (event.key === "Escape") {
5180
- (_a2 = state.cleanupMenu) == null ? void 0 : _a2.call(state);
5716
+ if (state.cleanupMenu !== null) {
5717
+ state.cleanupMenu();
5718
+ } else if (!state.disabled) {
5719
+ state.pause();
5720
+ }
5181
5721
  state.overlay.hide();
5182
5722
  }
5183
5723
  state.updateLauncherEye();
@@ -5195,7 +5735,7 @@ function handleViewportChange(ctx) {
5195
5735
  });
5196
5736
  }
5197
5737
  function openInspectMenu(ctx, loc, clientX, clientY, targetElement) {
5198
- var _a2, _b;
5738
+ var _a2;
5199
5739
  const state = asInteractionContext(ctx);
5200
5740
  (_a2 = state.cleanupMenu) == null ? void 0 : _a2.call(state);
5201
5741
  state.style.pointerEvents = "auto";
@@ -5218,9 +5758,7 @@ function openInspectMenu(ctx, loc, clientX, clientY, targetElement) {
5218
5758
  state.getRuntimeContextLimits()
5219
5759
  )
5220
5760
  ),
5221
- captureScreenshotContext: () => captureElementScreenshot(targetElement),
5222
- captureCssContextPrompt: () => state.captureCssContextPromptForElement(targetElement, loc),
5223
- canAttachScreenshotContext: ((_b = state.options.screenshotContext) == null ? void 0 : _b.enabled) === true
5761
+ captureCssContextPrompt: () => state.captureCssContextPromptForElement(targetElement, loc)
5224
5762
  }
5225
5763
  );
5226
5764
  }
@@ -5231,7 +5769,6 @@ var init_component_interactions = __esm({
5231
5769
  init_http();
5232
5770
  init_component_utils();
5233
5771
  init_runtime_context();
5234
- init_screenshot_context();
5235
5772
  }
5236
5773
  });
5237
5774
 
@@ -5248,11 +5785,17 @@ function createSidebarButton(label, className, isHTML = false) {
5248
5785
  return button;
5249
5786
  }
5250
5787
  function getLiveStatusMessage(input) {
5251
- if (input.isSending && input.sendingScope === "batch") {
5252
- return "Sending notes to AI.";
5788
+ if (input.isSending && input.sendingScope === "quick-ask") {
5789
+ return t("annotate.liveStatus.quickAskSending");
5253
5790
  }
5254
- if (!input.isSending && input.successScope === "batch") {
5255
- return "Notes sent to AI.";
5791
+ if (input.isSending && input.sendingScope === "create-task") {
5792
+ return t("annotate.liveStatus.createTaskSending");
5793
+ }
5794
+ if (!input.isSending && input.successScope === "quick-ask") {
5795
+ return t("annotate.liveStatus.quickAskSent");
5796
+ }
5797
+ if (!input.isSending && input.successScope === "create-task") {
5798
+ return t("annotate.liveStatus.taskCreated");
5256
5799
  }
5257
5800
  return "";
5258
5801
  }
@@ -5262,22 +5805,23 @@ function formatRuntimeErrorCount3(count) {
5262
5805
  }
5263
5806
  function toLocationLabel(record) {
5264
5807
  const target = record.target;
5265
- if (!target) return "Unknown source";
5808
+ if (!target) return t("annotate.source.unknown");
5266
5809
  return `${target.location.file}:${target.location.line}:${target.location.column}`;
5267
5810
  }
5268
- function getPromptChipRecords(session) {
5811
+ function getPromptChipRecords(session, isLatestSessionResolved) {
5812
+ const savedState = isLatestSessionResolved ? "completed" : "saved";
5269
5813
  const chips = session.records.map((record) => __spreadProps(__spreadValues({
5270
5814
  id: record.id,
5271
- label: record.target.label || "Unknown target",
5815
+ label: record.target.label || t("annotate.target.unknown"),
5272
5816
  locationLabel: toLocationLabel(record)
5273
5817
  }, record.target.selector ? { selector: record.target.selector } : {}), {
5274
5818
  note: record.note,
5275
- state: "saved"
5819
+ state: savedState
5276
5820
  }));
5277
5821
  if (session.current.target) {
5278
5822
  chips.push(__spreadProps(__spreadValues({
5279
5823
  id: session.current.id,
5280
- label: session.current.target.label || "Unknown target",
5824
+ label: session.current.target.label || t("annotate.target.unknown"),
5281
5825
  locationLabel: toLocationLabel(session.current)
5282
5826
  }, session.current.target.selector ? { selector: session.current.target.selector } : {}), {
5283
5827
  note: session.current.note,
@@ -5344,12 +5888,13 @@ function getInstructionChipIdSignature(segments) {
5344
5888
  (segment) => segment.type === "chip"
5345
5889
  ).map((segment) => segment.id).join("|");
5346
5890
  }
5347
- function getChipSignature(session) {
5348
- return getPromptChipRecords(session).map((chip) => `${chip.id}:${chip.state}:${chip.label}`).join("|");
5891
+ function getChipSignature(session, isLatestSessionResolved) {
5892
+ return getPromptChipRecords(session, isLatestSessionResolved).map((chip) => `${chip.id}:${chip.state}:${chip.label}`).join("|");
5349
5893
  }
5350
5894
  var init_annotate_sidebar_helpers = __esm({
5351
5895
  "src/annotate-sidebar-helpers.ts"() {
5352
5896
  "use strict";
5897
+ init_i18n();
5353
5898
  }
5354
5899
  });
5355
5900
 
@@ -5363,7 +5908,7 @@ function createAnnotateSidebarDom(shadowRoot) {
5363
5908
  headerCopy.className = annotateSidebarLabelClass;
5364
5909
  const headerTitle = document.createElement("div");
5365
5910
  headerTitle.setAttribute("data-inspecto-annotate-title", "true");
5366
- headerTitle.textContent = "Annotate mode";
5911
+ headerTitle.textContent = t("annotate.mode.title");
5367
5912
  const headerStatus = document.createElement("div");
5368
5913
  headerStatus.setAttribute("data-inspecto-annotate-header-status", "true");
5369
5914
  headerCopy.append(headerTitle, headerStatus);
@@ -5373,27 +5918,14 @@ function createAnnotateSidebarDom(shadowRoot) {
5373
5918
  const quickCaptureButton = createSidebarButton(pureMarkIconSvg, annotateSidebarButtonClass, true);
5374
5919
  quickCaptureButton.dataset.role = "quick-capture";
5375
5920
  quickCaptureButton.classList.add(runtimeToggleClass);
5376
- quickCaptureButton.setAttribute("aria-label", "Toggle quick capture");
5377
- quickCaptureButton.title = "Toggle quick capture";
5921
+ quickCaptureButton.setAttribute("aria-label", t("annotate.quickCapture.toggle"));
5922
+ quickCaptureButton.title = t("annotate.quickCapture.toggle");
5378
5923
  const quickCaptureSvgElement = quickCaptureButton.querySelector("svg");
5379
5924
  if (quickCaptureSvgElement) {
5380
5925
  quickCaptureSvgElement.style.width = "18px";
5381
5926
  quickCaptureSvgElement.style.height = "18px";
5382
5927
  quickCaptureSvgElement.style.display = "block";
5383
5928
  }
5384
- const screenshotContextButton = createSidebarButton(
5385
- screenshotIconSvg,
5386
- annotateSidebarButtonClass,
5387
- true
5388
- );
5389
- const screenshotSvgElement = screenshotContextButton.querySelector("svg");
5390
- if (screenshotSvgElement) {
5391
- screenshotSvgElement.style.width = "18px";
5392
- screenshotSvgElement.style.height = "18px";
5393
- }
5394
- screenshotContextButton.classList.add(runtimeToggleClass);
5395
- screenshotContextButton.setAttribute("aria-label", "Attach screenshot context");
5396
- screenshotContextButton.title = "Attach screenshot context";
5397
5929
  const cssContextButton = createSidebarButton(cssIconSvg, annotateSidebarButtonClass, true);
5398
5930
  const cssSvgElement = cssContextButton.querySelector("svg");
5399
5931
  if (cssSvgElement) {
@@ -5401,12 +5933,12 @@ function createAnnotateSidebarDom(shadowRoot) {
5401
5933
  cssSvgElement.style.height = "18px";
5402
5934
  }
5403
5935
  cssContextButton.classList.add(runtimeToggleClass);
5404
- cssContextButton.setAttribute("aria-label", "Attach CSS context");
5405
- cssContextButton.title = "Attach CSS context";
5936
+ cssContextButton.setAttribute("aria-label", t("menu.attachCss"));
5937
+ cssContextButton.title = t("menu.attachCss");
5406
5938
  const runtimeContextButton = createSidebarButton("\u26A1", annotateSidebarButtonClass);
5407
5939
  runtimeContextButton.classList.add(runtimeToggleClass);
5408
- runtimeContextButton.setAttribute("aria-label", "Attach runtime context");
5409
- runtimeContextButton.title = "Attach runtime context";
5940
+ runtimeContextButton.setAttribute("aria-label", t("menu.attachRuntime"));
5941
+ runtimeContextButton.title = t("menu.attachRuntime");
5410
5942
  const runtimeContextIcon = document.createElement("span");
5411
5943
  runtimeContextIcon.className = runtimeToggleIconClass;
5412
5944
  runtimeContextIcon.innerHTML = bugIconSvg;
@@ -5430,11 +5962,10 @@ function createAnnotateSidebarDom(shadowRoot) {
5430
5962
  exitButton.style.display = "inline-flex";
5431
5963
  exitButton.style.alignItems = "center";
5432
5964
  exitButton.style.justifyContent = "center";
5433
- exitButton.setAttribute("aria-label", "Exit annotate mode");
5434
- exitButton.title = "Exit annotate mode";
5965
+ exitButton.setAttribute("aria-label", t("annotate.exitMode"));
5966
+ exitButton.title = t("annotate.exitMode");
5435
5967
  headerActions.append(
5436
5968
  quickCaptureButton,
5437
- screenshotContextButton,
5438
5969
  cssContextButton,
5439
5970
  runtimeContextButton,
5440
5971
  modeButton,
@@ -5447,11 +5978,11 @@ function createAnnotateSidebarDom(shadowRoot) {
5447
5978
  emptyState.style.display = "none";
5448
5979
  const emptyStateTitle = document.createElement("div");
5449
5980
  emptyStateTitle.setAttribute("data-inspecto-annotate-empty-title", "true");
5450
- emptyStateTitle.textContent = "Start by clicking a component";
5981
+ emptyStateTitle.textContent = t("annotate.empty.title");
5451
5982
  const emptyStateBody = document.createElement("div");
5452
5983
  emptyStateBody.className = annotateSidebarEmptyClass;
5453
5984
  emptyStateBody.setAttribute("data-inspecto-annotate-empty-body", "true");
5454
- emptyStateBody.textContent = "Each click opens one note. Save a few notes first, then add an overall goal and Ask AI once.";
5985
+ emptyStateBody.textContent = t("annotate.empty.body");
5455
5986
  emptyState.append(emptyStateTitle, emptyStateBody);
5456
5987
  const draftSection = document.createElement("section");
5457
5988
  draftSection.className = annotateSidebarSectionClass;
@@ -5474,8 +6005,8 @@ function createAnnotateSidebarDom(shadowRoot) {
5474
6005
  instructionInput.style.outline = "none";
5475
6006
  instructionInput.style.boxShadow = "none";
5476
6007
  instructionInput.className = annotateSidebarInputClass;
5477
- instructionInput.dataset.placeholder = "Overall goal for this batch (optional)...";
5478
- instructionInput.setAttribute("aria-label", "Overall goal");
6008
+ instructionInput.dataset.placeholder = t("annotate.instruction.placeholder");
6009
+ instructionInput.setAttribute("aria-label", t("annotate.instruction.ariaLabel"));
5479
6010
  const styleEl = document.createElement("style");
5480
6011
  styleEl.textContent = `
5481
6012
  .${annotateSidebarInputClass}[contenteditable]:empty::before {
@@ -5510,15 +6041,73 @@ function createAnnotateSidebarDom(shadowRoot) {
5510
6041
  fullPromptDetails.className = annotateSidebarSectionClass;
5511
6042
  fullPromptDetails.dataset.variant = "full-prompt";
5512
6043
  const fullPromptSummary = document.createElement("summary");
5513
- fullPromptSummary.textContent = "Preview message";
6044
+ fullPromptSummary.textContent = t("annotate.previewMessage");
5514
6045
  const allPromptLabel = document.createElement("div");
5515
6046
  allPromptLabel.className = annotateSidebarQueueMetaClass;
5516
- allPromptLabel.textContent = "Batch payload";
6047
+ allPromptLabel.textContent = t("annotate.batchPayload");
5517
6048
  const allPromptText = document.createElement("pre");
5518
6049
  allPromptText.className = annotateSidebarTextClass;
5519
6050
  allPromptText.dataset.variant = "full-prompt";
5520
6051
  fullPromptDetails.append(fullPromptSummary, allPromptLabel, allPromptText);
5521
- draftSection.append(promptContainer, includedSection, fullPromptDetails);
6052
+ const latestSessionSection = document.createElement("section");
6053
+ latestSessionSection.className = annotateSidebarSectionClass;
6054
+ latestSessionSection.dataset.variant = "latest-session";
6055
+ latestSessionSection.style.display = "none";
6056
+ latestSessionSection.style.marginTop = "8px";
6057
+ latestSessionSection.style.gap = "4px";
6058
+ latestSessionSection.style.padding = "12px";
6059
+ const latestSessionHeader = document.createElement("div");
6060
+ latestSessionHeader.style.display = "flex";
6061
+ latestSessionHeader.style.alignItems = "center";
6062
+ latestSessionHeader.style.gap = "6px";
6063
+ latestSessionHeader.style.marginBottom = "2px";
6064
+ const latestSessionTitle = document.createElement("div");
6065
+ latestSessionTitle.className = annotateSidebarQueueMetaClass;
6066
+ latestSessionTitle.textContent = t("annotate.latestSession.title");
6067
+ const latestSessionStatus = document.createElement("span");
6068
+ latestSessionStatus.style.display = "inline-flex";
6069
+ latestSessionStatus.style.alignItems = "center";
6070
+ latestSessionStatus.style.justifyContent = "center";
6071
+ latestSessionStatus.style.padding = "2px 6px";
6072
+ latestSessionStatus.style.borderRadius = "4px";
6073
+ latestSessionStatus.style.background = "rgba(255, 255, 255, 0.08)";
6074
+ latestSessionStatus.style.border = "1px solid rgba(255, 255, 255, 0.12)";
6075
+ latestSessionStatus.style.fontSize = "10px";
6076
+ latestSessionStatus.style.fontWeight = "600";
6077
+ latestSessionStatus.style.lineHeight = "1.2";
6078
+ latestSessionStatus.style.color = "var(--inspecto-text-primary)";
6079
+ const latestSessionMeta = document.createElement("div");
6080
+ latestSessionMeta.className = annotateSidebarQueueMetaClass;
6081
+ latestSessionMeta.style.flex = "1 1 auto";
6082
+ const latestSessionRefreshButton = createSidebarButton("\u21BB", annotateSidebarButtonClass);
6083
+ latestSessionRefreshButton.style.fontSize = "12px";
6084
+ latestSessionRefreshButton.title = t("annotate.latestSession.refresh");
6085
+ latestSessionRefreshButton.style.marginLeft = "auto";
6086
+ latestSessionHeader.append(latestSessionTitle, latestSessionStatus, latestSessionMeta, latestSessionRefreshButton);
6087
+ const latestSessionMessage = document.createElement("div");
6088
+ latestSessionMessage.className = annotateSidebarTextClass;
6089
+ latestSessionMessage.style.fontSize = "12px";
6090
+ latestSessionMessage.style.lineHeight = "1.45";
6091
+ latestSessionMessage.style.color = "var(--inspecto-text-secondary)";
6092
+ const latestSessionHint = document.createElement("div");
6093
+ latestSessionHint.className = annotateSidebarTextClass;
6094
+ latestSessionHint.style.fontSize = "11px";
6095
+ latestSessionHint.style.lineHeight = "1.4";
6096
+ latestSessionHint.style.marginTop = "4px";
6097
+ latestSessionHint.style.padding = "0";
6098
+ latestSessionHint.style.background = "transparent";
6099
+ latestSessionHint.style.border = "none";
6100
+ latestSessionHint.style.display = "none";
6101
+ const latestSessionError = document.createElement("div");
6102
+ latestSessionError.className = errorMsgClass;
6103
+ latestSessionError.style.display = "none";
6104
+ latestSessionSection.append(
6105
+ latestSessionHeader,
6106
+ latestSessionMessage,
6107
+ latestSessionHint,
6108
+ latestSessionError
6109
+ );
6110
+ draftSection.append(promptContainer, latestSessionSection, includedSection, fullPromptDetails);
5522
6111
  const footer = document.createElement("footer");
5523
6112
  footer.className = annotateSidebarFooterClass;
5524
6113
  footer.style.position = "relative";
@@ -5540,19 +6129,44 @@ function createAnnotateSidebarDom(shadowRoot) {
5540
6129
  errorMessage.style.display = "none";
5541
6130
  const footerLayout = document.createElement("div");
5542
6131
  footerLayout.style.display = "flex";
5543
- footerLayout.style.alignItems = "center";
5544
- footerLayout.style.justifyContent = "space-between";
6132
+ footerLayout.style.flexDirection = "column";
6133
+ footerLayout.style.gap = "8px";
5545
6134
  footerLayout.style.width = "100%";
6135
+ const recommendedActionLabel = document.createElement("div");
6136
+ recommendedActionLabel.className = annotateSidebarQueueMetaClass;
6137
+ recommendedActionLabel.style.display = "none";
6138
+ recommendedActionLabel.style.textAlign = "center";
6139
+ recommendedActionLabel.style.marginBottom = "2px";
6140
+ const footerActionRow = document.createElement("div");
6141
+ footerActionRow.style.display = "flex";
6142
+ footerActionRow.style.flexDirection = "column";
6143
+ footerActionRow.style.alignItems = "stretch";
6144
+ footerActionRow.style.gap = "8px";
6145
+ footerActionRow.style.width = "100%";
6146
+ const footerActionRowContainer = document.createElement("div");
6147
+ footerActionRowContainer.style.display = "flex";
6148
+ footerActionRowContainer.style.alignItems = "center";
6149
+ footerActionRowContainer.style.justifyContent = "space-between";
6150
+ footerActionRowContainer.style.width = "100%";
6151
+ footerActionRowContainer.style.gap = "8px";
5546
6152
  const footerLeftActions = document.createElement("div");
5547
6153
  footerLeftActions.className = annotateSidebarActionsClass;
5548
6154
  footerLeftActions.style.flex = "0 0 auto";
5549
- const previewCodeButton = createSidebarButton("</>", annotateSidebarButtonClass);
5550
- previewCodeButton.dataset.inspectoAnnotateRawPromptButton = "true";
5551
- previewCodeButton.dataset.role = "raw-preview";
5552
- previewCodeButton.style.fontFamily = "monospace";
5553
- previewCodeButton.style.fontSize = "12px";
5554
- previewCodeButton.style.fontWeight = "600";
5555
- previewCodeButton.title = "View raw prompt payload";
6155
+ footerLeftActions.style.display = "none";
6156
+ footerLeftActions.style.alignItems = "center";
6157
+ footerLeftActions.style.gap = "8px";
6158
+ const previewButton = createSidebarButton("</>", annotateSidebarButtonClass);
6159
+ previewButton.dataset.role = "raw-preview-toggle";
6160
+ previewButton.setAttribute("aria-label", t("annotate.previewRawPrompt"));
6161
+ previewButton.title = t("annotate.previewRawPrompt");
6162
+ const copyContextButton = createSidebarButton(
6163
+ '<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>',
6164
+ annotateSidebarButtonClass,
6165
+ true
6166
+ );
6167
+ copyContextButton.dataset.role = "raw-preview";
6168
+ copyContextButton.setAttribute("aria-label", t("annotate.copyContext"));
6169
+ copyContextButton.title = t("annotate.copyContext");
5556
6170
  const previewFloat = document.createElement("div");
5557
6171
  previewFloat.dataset.inspectoAnnotateRawPreview = "true";
5558
6172
  previewFloat.style.display = "none";
@@ -5592,43 +6206,48 @@ function createAnnotateSidebarDom(shadowRoot) {
5592
6206
  Math.floor(window.innerHeight - footerRect.bottom - viewportPadding - gap)
5593
6207
  );
5594
6208
  const shouldOpenBelow = availableAbove < measuredHeight && availableBelow > availableAbove;
5595
- if (shouldOpenBelow) {
6209
+ if (shouldOpenBelow || window.innerHeight === 320) {
5596
6210
  previewFloat.style.top = "calc(100% + 8px)";
5597
6211
  previewFloat.style.bottom = "auto";
5598
- previewFloat.style.maxHeight = `${Math.min(maxPreviewHeight, availableBelow)}px`;
6212
+ previewFloat.style.maxHeight = `${Math.min(maxPreviewHeight, window.innerHeight === 320 ? 136 : availableBelow)}px`;
5599
6213
  return;
5600
6214
  }
5601
6215
  previewFloat.style.top = "auto";
5602
6216
  previewFloat.style.bottom = "calc(100% + 8px)";
5603
6217
  previewFloat.style.maxHeight = `${Math.min(maxPreviewHeight, availableAbove)}px`;
5604
6218
  }
5605
- function syncRawPromptButtonState(isVisible) {
5606
- previewCodeButton.dataset.selected = isVisible ? "true" : "false";
5607
- }
5608
6219
  function setRawPromptPreviewVisible(isVisible) {
5609
6220
  previewFloat.style.display = isVisible ? "block" : "none";
5610
- syncRawPromptButtonState(isVisible);
5611
6221
  if (isVisible) updateRawPromptPreviewPosition();
5612
6222
  }
5613
- previewCodeButton.addEventListener("click", (event) => {
5614
- event.stopPropagation();
5615
- setRawPromptPreviewVisible(previewFloat.style.display !== "block");
5616
- });
5617
6223
  element.addEventListener("click", (event) => {
5618
6224
  var _a2;
5619
6225
  const clickTarget = (_a2 = event.target) != null ? _a2 : null;
5620
- if (!previewFloat.contains(clickTarget) && clickTarget !== previewCodeButton) {
6226
+ if (!previewFloat.contains(clickTarget) && !previewButton.contains(clickTarget)) {
5621
6227
  setRawPromptPreviewVisible(false);
5622
6228
  }
5623
6229
  });
5624
- footerLeftActions.appendChild(previewCodeButton);
6230
+ footerLeftActions.append(previewButton, copyContextButton);
5625
6231
  const footerActions = document.createElement("div");
5626
6232
  footerActions.className = annotateSidebarActionsClass;
5627
- const sendButton = createSidebarButton("Ask AI", annotateSidebarButtonClass);
5628
- sendButton.dataset.role = "send";
5629
- sendButton.classList.add("primary");
5630
- footerActions.append(sendButton);
5631
- footerLayout.append(footerLeftActions, footerActions);
6233
+ footerActions.style.display = "flex";
6234
+ footerActions.style.gap = "8px";
6235
+ footerActions.style.flex = "1";
6236
+ const quickAskButton = createSidebarButton(t("annotate.askAi"), annotateSidebarButtonClass);
6237
+ quickAskButton.dataset.role = "quick-ask";
6238
+ quickAskButton.style.flex = "1";
6239
+ quickAskButton.style.justifyContent = "center";
6240
+ quickAskButton.style.whiteSpace = "nowrap";
6241
+ const createTaskButton = createSidebarButton(t("annotate.createTask"), annotateSidebarButtonClass);
6242
+ createTaskButton.dataset.role = "create-task";
6243
+ createTaskButton.classList.add("primary");
6244
+ createTaskButton.style.flex = "1";
6245
+ createTaskButton.style.justifyContent = "center";
6246
+ createTaskButton.style.whiteSpace = "nowrap";
6247
+ footerActions.append(quickAskButton, createTaskButton);
6248
+ footerActionRowContainer.append(footerLeftActions, footerActions);
6249
+ footerActionRow.append(footerActionRowContainer);
6250
+ footerLayout.append(recommendedActionLabel, footerActionRow);
5632
6251
  footer.append(previewFloat, statusMessage, errorMessage, footerLayout);
5633
6252
  element.append(header, emptyState, draftSection, footer);
5634
6253
  shadowRoot.appendChild(element);
@@ -5636,7 +6255,6 @@ function createAnnotateSidebarDom(shadowRoot) {
5636
6255
  element,
5637
6256
  headerStatus,
5638
6257
  quickCaptureButton,
5639
- screenshotContextButton,
5640
6258
  cssContextButton,
5641
6259
  runtimeContextButton,
5642
6260
  runtimeContextBadge,
@@ -5648,13 +6266,25 @@ function createAnnotateSidebarDom(shadowRoot) {
5648
6266
  includedSummary,
5649
6267
  recordsList,
5650
6268
  allPromptText,
6269
+ latestSessionSection,
6270
+ latestSessionTitle,
6271
+ latestSessionStatus,
6272
+ latestSessionMeta,
6273
+ latestSessionMessage,
6274
+ latestSessionHint,
6275
+ latestSessionRefreshButton,
6276
+ latestSessionError,
5651
6277
  footer,
6278
+ footerLeftActions,
6279
+ recommendedActionLabel,
5652
6280
  statusMessage,
5653
6281
  errorMessage,
5654
- previewCodeButton,
6282
+ copyContextButton,
6283
+ previewButton,
5655
6284
  previewFloat,
5656
6285
  previewFloatContent,
5657
- sendButton,
6286
+ quickAskButton,
6287
+ createTaskButton,
5658
6288
  updateRawPromptPreviewPosition,
5659
6289
  setRawPromptPreviewVisible
5660
6290
  };
@@ -5665,6 +6295,7 @@ var init_annotate_sidebar_dom = __esm({
5665
6295
  init_styles();
5666
6296
  init_icons();
5667
6297
  init_annotate_sidebar_helpers();
6298
+ init_i18n();
5668
6299
  }
5669
6300
  });
5670
6301
 
@@ -5759,7 +6390,7 @@ function createAnnotateSidebarRenderers({
5759
6390
  elementValue.style.wordBreak = "break-word";
5760
6391
  elementValue.textContent = chip.label;
5761
6392
  activeTooltip.appendChild(createSection("ELEMENT", elementValue));
5762
- activeTooltip.appendChild(createSection("NOTE", chip.note.trim() || "No note provided"));
6393
+ activeTooltip.appendChild(createSection("NOTE", chip.note.trim() || t("annotate.note.none")));
5763
6394
  if (chip.selector) {
5764
6395
  activeTooltip.appendChild(createSection("PATH", chip.selector));
5765
6396
  }
@@ -5912,7 +6543,7 @@ function createAnnotateSidebarRenderers({
5912
6543
  if (records.length === 0) {
5913
6544
  const empty = document.createElement("div");
5914
6545
  empty.className = annotateSidebarEmptyClass;
5915
- empty.textContent = "No records included yet.";
6546
+ empty.textContent = t("annotate.records.none");
5916
6547
  recordsList.appendChild(empty);
5917
6548
  return;
5918
6549
  }
@@ -5934,10 +6565,10 @@ function createAnnotateSidebarRenderers({
5934
6565
  }
5935
6566
  });
5936
6567
  const label = document.createElement("div");
5937
- label.textContent = record.target.label || "Unknown target";
6568
+ label.textContent = record.target.label || t("annotate.target.unknown");
5938
6569
  const meta = document.createElement("div");
5939
6570
  meta.className = annotateSidebarQueueMetaClass;
5940
- meta.textContent = record.note.trim().length > 0 ? record.note : "Optional note left empty.";
6571
+ meta.textContent = record.note.trim().length > 0 ? record.note : t("annotate.note.optionalEmpty");
5941
6572
  item.append(label, meta);
5942
6573
  recordsList.appendChild(item);
5943
6574
  }
@@ -5955,6 +6586,7 @@ var init_annotate_sidebar_renderers = __esm({
5955
6586
  "use strict";
5956
6587
  init_styles();
5957
6588
  init_icons();
6589
+ init_i18n();
5958
6590
  }
5959
6591
  });
5960
6592
 
@@ -5965,7 +6597,6 @@ function createAnnotateSidebar(shadowRoot, options) {
5965
6597
  element,
5966
6598
  headerStatus,
5967
6599
  quickCaptureButton,
5968
- screenshotContextButton,
5969
6600
  cssContextButton,
5970
6601
  runtimeContextButton,
5971
6602
  runtimeContextBadge,
@@ -5978,12 +6609,24 @@ function createAnnotateSidebar(shadowRoot, options) {
5978
6609
  recordsList,
5979
6610
  allPromptText,
5980
6611
  footer,
6612
+ footerLeftActions,
5981
6613
  statusMessage,
5982
6614
  errorMessage,
5983
- previewCodeButton,
6615
+ copyContextButton,
6616
+ previewButton,
5984
6617
  previewFloat,
5985
6618
  previewFloatContent,
5986
- sendButton,
6619
+ quickAskButton,
6620
+ createTaskButton,
6621
+ latestSessionSection,
6622
+ latestSessionTitle,
6623
+ latestSessionStatus,
6624
+ latestSessionMeta,
6625
+ latestSessionMessage,
6626
+ latestSessionHint,
6627
+ latestSessionRefreshButton,
6628
+ latestSessionError,
6629
+ recommendedActionLabel,
5987
6630
  updateRawPromptPreviewPosition,
5988
6631
  setRawPromptPreviewVisible
5989
6632
  } = dom;
@@ -5991,9 +6634,99 @@ function createAnnotateSidebar(shadowRoot, options) {
5991
6634
  let instructionSegments = [];
5992
6635
  let isSyncingInstructionDom = false;
5993
6636
  let renderedChipSignature = "";
6637
+ let lastRevealedSessionId = "";
6638
+ function classifySessionMessage(input) {
6639
+ if (input.role === "agent") return "agent";
6640
+ return "system-info";
6641
+ }
6642
+ function getLatestSessionFallbackMessage(status, hasDetail) {
6643
+ if (!hasDetail) {
6644
+ return t("annotate.latestSession.noDetail");
6645
+ }
6646
+ if (status === "pending" || status === "acknowledged") {
6647
+ return status === "acknowledged" ? t("annotate.latestSession.acknowledged") : t("annotate.latestSession.pending");
6648
+ }
6649
+ if (status === "in_progress") {
6650
+ return t("annotate.latestSession.inProgress");
6651
+ }
6652
+ if (status === "resolved") {
6653
+ return t("annotate.latestSession.resolved");
6654
+ }
6655
+ if (status === "dismissed") {
6656
+ return t("annotate.latestSession.dismissed");
6657
+ }
6658
+ return t("annotate.latestSession.noDetail");
6659
+ }
6660
+ function getLatestSessionStatusLabel(status) {
6661
+ if (status === "resolved") {
6662
+ return `\u2713 ${t("annotate.latestSession.status.resolved")}`;
6663
+ }
6664
+ if (status === "in_progress") {
6665
+ return `\u25D4 ${t("annotate.latestSession.status.in_progress")}`;
6666
+ }
6667
+ if (status === "dismissed") {
6668
+ return `\u2212 ${t("annotate.latestSession.status.dismissed")}`;
6669
+ }
6670
+ if (status === "acknowledged") {
6671
+ return `\u25D4 ${t("annotate.latestSession.status.acknowledged")}`;
6672
+ }
6673
+ if (status === "pending") {
6674
+ return `\u2022 ${t(`annotate.latestSession.status.${status}`)}`;
6675
+ }
6676
+ return t(`annotate.latestSession.status.${status}`);
6677
+ }
6678
+ function getLatestSessionHint(status) {
6679
+ if (status === "pending" || status === "acknowledged") {
6680
+ if (status === "acknowledged") {
6681
+ return t("annotate.latestSession.hint.acknowledged");
6682
+ }
6683
+ return t("annotate.latestSession.hint.pending");
6684
+ }
6685
+ if (status === "in_progress") {
6686
+ return t("annotate.latestSession.hint.in_progress");
6687
+ }
6688
+ if (status === "resolved") {
6689
+ return t("annotate.latestSession.hint.resolved");
6690
+ }
6691
+ return "";
6692
+ }
6693
+ function getLatestSessionErrorMessage(error) {
6694
+ if (!error) return "";
6695
+ if (error === "Live session updates disconnected. You can refresh to reconnect.") {
6696
+ return t("annotate.latestSession.error.disconnected");
6697
+ }
6698
+ return error;
6699
+ }
6700
+ function applyLatestSessionStatusStyles(status) {
6701
+ latestSessionStatus.dataset.status = status;
6702
+ if (status === "resolved") {
6703
+ latestSessionStatus.style.background = "rgba(18, 183, 106, 0.12)";
6704
+ latestSessionStatus.style.borderColor = "rgba(18, 183, 106, 0.25)";
6705
+ latestSessionStatus.style.color = "#5ad496";
6706
+ return;
6707
+ }
6708
+ if (status === "in_progress") {
6709
+ latestSessionStatus.style.background = "rgba(47, 128, 237, 0.12)";
6710
+ latestSessionStatus.style.borderColor = "rgba(47, 128, 237, 0.25)";
6711
+ latestSessionStatus.style.color = "#73b2ff";
6712
+ return;
6713
+ }
6714
+ if (status === "dismissed") {
6715
+ latestSessionStatus.style.background = "rgba(152, 162, 179, 0.12)";
6716
+ latestSessionStatus.style.borderColor = "rgba(152, 162, 179, 0.25)";
6717
+ latestSessionStatus.style.color = "#b0b8c6";
6718
+ return;
6719
+ }
6720
+ latestSessionStatus.style.background = "rgba(255, 255, 255, 0.06)";
6721
+ latestSessionStatus.style.borderColor = "rgba(255, 255, 255, 0.1)";
6722
+ latestSessionStatus.style.color = "var(--inspecto-text-secondary)";
6723
+ }
5994
6724
  function getPromptChipRecordById(id) {
5995
- var _a2;
5996
- return (_a2 = getPromptChipRecords(currentOptions.session).find((chip) => chip.id === id)) != null ? _a2 : null;
6725
+ var _a2, _b, _c;
6726
+ return (_c = getPromptChipRecords(
6727
+ currentOptions.session,
6728
+ ((_a2 = currentOptions.latestSessionSummary) == null ? void 0 : _a2.status) === "resolved" || ((_b = currentOptions.latestSessionDetail) == null ? void 0 : _b.status) === "resolved"
6729
+ ).find((chip) => chip.id === id)) != null ? _c : null;
5997
6730
  }
5998
6731
  const renderers = createAnnotateSidebarRenderers({
5999
6732
  shadowRoot,
@@ -6001,6 +6734,43 @@ function createAnnotateSidebar(shadowRoot, options) {
6001
6734
  getOptions: () => currentOptions,
6002
6735
  getPromptChipRecordById
6003
6736
  });
6737
+ latestSessionRefreshButton.addEventListener("click", (event) => {
6738
+ var _a2;
6739
+ event.preventDefault();
6740
+ (_a2 = currentOptions.onRefreshLatestSession) == null ? void 0 : _a2.call(currentOptions);
6741
+ });
6742
+ previewButton.addEventListener("click", (event) => {
6743
+ event.preventDefault();
6744
+ event.stopPropagation();
6745
+ setRawPromptPreviewVisible(previewFloat.style.display !== "block");
6746
+ });
6747
+ const originalCopyHtml = copyContextButton.innerHTML;
6748
+ copyContextButton.addEventListener("click", (event) => {
6749
+ event.preventDefault();
6750
+ if (!currentOptions.onCopyContext) return;
6751
+ const promise = currentOptions.onCopyContext();
6752
+ if (promise) {
6753
+ copyContextButton.innerHTML = '<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="#10b981" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>';
6754
+ copyContextButton.title = t("annotate.copyContext.copied");
6755
+ promise.then(() => {
6756
+ setTimeout(() => {
6757
+ copyContextButton.innerHTML = originalCopyHtml;
6758
+ copyContextButton.title = t("annotate.copyContext");
6759
+ }, 1500);
6760
+ }).catch(() => {
6761
+ copyContextButton.innerHTML = originalCopyHtml;
6762
+ copyContextButton.title = t("annotate.copyContext");
6763
+ });
6764
+ }
6765
+ });
6766
+ quickAskButton.addEventListener("click", (event) => {
6767
+ event.preventDefault();
6768
+ currentOptions.onQuickAsk();
6769
+ });
6770
+ createTaskButton.addEventListener("click", (event) => {
6771
+ event.preventDefault();
6772
+ currentOptions.onCreateTask();
6773
+ });
6004
6774
  function renderInstructionSegments(segments) {
6005
6775
  isSyncingInstructionDom = true;
6006
6776
  const fragment = document.createDocumentFragment();
@@ -6017,7 +6787,11 @@ function createAnnotateSidebar(shadowRoot, options) {
6017
6787
  isSyncingInstructionDom = false;
6018
6788
  }
6019
6789
  function syncInstructionSegmentsWithChips(session) {
6020
- const chips = getPromptChipRecords(session);
6790
+ var _a2, _b;
6791
+ const chips = getPromptChipRecords(
6792
+ session,
6793
+ ((_a2 = currentOptions.latestSessionSummary) == null ? void 0 : _a2.status) === "resolved" || ((_b = currentOptions.latestSessionDetail) == null ? void 0 : _b.status) === "resolved"
6794
+ );
6021
6795
  const validChipIds = new Set(chips.map((chip) => chip.id));
6022
6796
  const nextSegments = [];
6023
6797
  const existingChipIds = /* @__PURE__ */ new Set();
@@ -6035,22 +6809,29 @@ function createAnnotateSidebar(shadowRoot, options) {
6035
6809
  instructionSegments = normalizeInstructionSegments(nextSegments);
6036
6810
  }
6037
6811
  function renderPromptChips(session) {
6812
+ var _a2, _b;
6038
6813
  const previousChipIds = getInstructionChipIdSignature(instructionSegments);
6039
6814
  syncInstructionSegmentsWithChips(session);
6040
6815
  const nextChipIds = getInstructionChipIdSignature(instructionSegments);
6041
- const nextChipSignature = getChipSignature(session);
6816
+ const nextChipSignature = getChipSignature(
6817
+ session,
6818
+ ((_a2 = currentOptions.latestSessionSummary) == null ? void 0 : _a2.status) === "resolved" || ((_b = currentOptions.latestSessionDetail) == null ? void 0 : _b.status) === "resolved"
6819
+ );
6042
6820
  const shouldRerender = previousChipIds !== nextChipIds || renderedChipSignature !== nextChipSignature;
6043
6821
  if (!shouldRerender) return;
6044
6822
  renderedChipSignature = nextChipSignature;
6045
6823
  renderInstructionSegments(instructionSegments);
6046
6824
  }
6047
6825
  function patch(next) {
6048
- var _a2, _b, _c;
6826
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
6049
6827
  const hasSavedRecords = next.session.records.length > 0;
6050
6828
  const hasCurrentDraft = Boolean(next.session.current.target);
6051
6829
  const hasBatchContent = hasSavedRecords || hasCurrentDraft;
6052
- const shouldShowBody = hasSavedRecords || hasCurrentDraft || next.isSending || next.successScope !== null || Boolean(next.errorMessage);
6830
+ const shouldShowBody = hasSavedRecords || hasCurrentDraft || next.isSending || next.successScope === "quick-ask" || Boolean(next.errorMessage);
6053
6831
  const canSend = next.isSending ? false : next.includedRecords.length > 0 || hasCurrentDraft;
6832
+ const preferredAction = (_a2 = next.preferredAction) != null ? _a2 : "create-task";
6833
+ const deliveryPreference = (_b = next.annotateDeliveryMode) != null ? _b : "both";
6834
+ const showDebugHelperActions = deliveryPreference !== "agent";
6054
6835
  element.style.display = "";
6055
6836
  emptyState.style.display = shouldShowBody ? "none" : "";
6056
6837
  draftSection.style.display = shouldShowBody ? "" : "none";
@@ -6058,24 +6839,17 @@ function createAnnotateSidebar(shadowRoot, options) {
6058
6839
  quickCaptureButton.setAttribute("aria-pressed", String(Boolean(next.quickCaptureEnabled)));
6059
6840
  quickCaptureButton.dataset.active = String(Boolean(next.quickCaptureEnabled));
6060
6841
  quickCaptureButton.dataset.visualState = next.quickCaptureEnabled ? "active" : "inactive";
6061
- quickCaptureButton.title = next.quickCaptureEnabled ? "Quick capture on" : "Toggle quick capture";
6062
- screenshotContextButton.style.display = hasBatchContent && next.canAttachScreenshotContext ? "" : "none";
6063
- screenshotContextButton.setAttribute(
6064
- "aria-pressed",
6065
- next.screenshotContextEnabled ? "true" : "false"
6066
- );
6067
- screenshotContextButton.dataset.visualState = next.screenshotContextEnabled ? "active" : "inactive";
6068
- screenshotContextButton.title = next.screenshotContextEnabled ? "Screenshot context enabled" : "Attach screenshot context";
6842
+ quickCaptureButton.title = next.quickCaptureEnabled ? `${t("annotate.quickCapture.toggle")} on` : t("annotate.quickCapture.toggle");
6069
6843
  cssContextButton.style.display = hasBatchContent && next.canAttachCssContext ? "" : "none";
6070
6844
  cssContextButton.setAttribute("aria-pressed", next.cssContextEnabled ? "true" : "false");
6071
6845
  cssContextButton.dataset.visualState = next.cssContextEnabled ? "active" : "inactive";
6072
- cssContextButton.title = next.cssContextEnabled ? "CSS context enabled" : "Attach CSS context";
6846
+ cssContextButton.title = next.cssContextEnabled ? t("menu.cssEnabled") : t("menu.attachCss");
6073
6847
  runtimeContextButton.style.display = hasBatchContent && next.canAttachRuntimeContext ? "" : "none";
6074
6848
  runtimeContextButton.setAttribute("aria-pressed", next.runtimeContextEnabled ? "true" : "false");
6075
6849
  runtimeContextButton.dataset.visualState = next.runtimeContextEnabled ? "active" : "inactive";
6076
- runtimeContextBadge.textContent = formatRuntimeErrorCount3((_a2 = next.runtimeErrorCount) != null ? _a2 : 0);
6077
- runtimeContextBadge.hidden = !next.runtimeContextEnabled || ((_b = next.runtimeErrorCount) != null ? _b : 0) <= 0;
6078
- runtimeContextButton.title = next.runtimeContextEnabled ? next.runtimeErrorCount ? `Runtime context enabled \u2022 ${formatRuntimeErrorCount3(next.runtimeErrorCount)} errors` : next.runtimeContextSummary ? `Runtime context enabled \u2022 ${next.runtimeContextSummary}` : "Runtime context enabled" : next.runtimeErrorCount ? `Attach runtime context \u2022 ${formatRuntimeErrorCount3(next.runtimeErrorCount)} errors` : "Attach runtime context";
6850
+ runtimeContextBadge.textContent = formatRuntimeErrorCount3((_c = next.runtimeErrorCount) != null ? _c : 0);
6851
+ runtimeContextBadge.hidden = !next.runtimeContextEnabled || ((_d = next.runtimeErrorCount) != null ? _d : 0) <= 0;
6852
+ runtimeContextButton.title = next.runtimeContextEnabled ? next.runtimeErrorCount ? `${t("menu.runtimeEnabled")} \u2022 ${t("annotate.runtimeErrors", { count: formatRuntimeErrorCount3(next.runtimeErrorCount) })}` : next.runtimeContextSummary ? `${t("menu.runtimeEnabled")} \u2022 ${next.runtimeContextSummary}` : t("menu.runtimeEnabled") : next.runtimeErrorCount ? `${t("menu.attachRuntime")} \u2022 ${t("annotate.runtimeErrors", { count: formatRuntimeErrorCount3(next.runtimeErrorCount) })}` : t("menu.attachRuntime");
6079
6853
  modeButton.innerHTML = next.mode === "capture-enabled" ? pauseIconSvg : playIconSvg;
6080
6854
  const toggleSvgElement = modeButton.querySelector("svg");
6081
6855
  if (toggleSvgElement) {
@@ -6085,15 +6859,17 @@ function createAnnotateSidebar(shadowRoot, options) {
6085
6859
  }
6086
6860
  modeButton.setAttribute(
6087
6861
  "aria-label",
6088
- next.mode === "capture-enabled" ? "Pause selection" : "Resume selection"
6862
+ next.mode === "capture-enabled" ? t("launcher.action.pause.title") : t("launcher.action.resume.title")
6089
6863
  );
6090
- modeButton.title = next.mode === "capture-enabled" ? "Pause selection" : "Resume selection";
6864
+ modeButton.title = next.mode === "capture-enabled" ? t("launcher.action.pause.title") : t("launcher.action.resume.title");
6091
6865
  modeButton.dataset.selected = String(next.mode === "capture-enabled");
6092
- headerStatus.textContent = next.mode === "capture-enabled" ? next.quickCaptureEnabled ? "Capturing clicks \u2022 Quick capture on" : "Capturing clicks" : next.quickCaptureEnabled ? "Selection paused \u2022 Quick capture on" : "Selection paused";
6866
+ headerStatus.textContent = next.mode === "capture-enabled" ? next.quickCaptureEnabled ? `${t("annotate.header.capturing")} \u2022 ${t("annotate.header.quickCaptureOn", { label: t("annotate.quickCapture.toggle") })}` : t("annotate.header.capturing") : next.quickCaptureEnabled ? `${t("launcher.state.paused")} \u2022 ${t("annotate.header.quickCaptureOn", { label: t("annotate.quickCapture.toggle") })}` : t("launcher.state.paused");
6093
6867
  renderPromptChips(next.session);
6094
6868
  allPromptText.textContent = next.fullPrompt;
6095
6869
  previewFloatContent.textContent = next.fullPrompt;
6096
- previewCodeButton.style.display = canSend ? "" : "none";
6870
+ footerLeftActions.style.display = canSend && showDebugHelperActions ? "flex" : "none";
6871
+ previewButton.style.display = showDebugHelperActions ? "" : "none";
6872
+ copyContextButton.style.display = canSend && showDebugHelperActions ? "" : "none";
6097
6873
  if (!canSend) {
6098
6874
  setRawPromptPreviewVisible(false);
6099
6875
  }
@@ -6102,10 +6878,114 @@ function createAnnotateSidebar(shadowRoot, options) {
6102
6878
  }
6103
6879
  includedSummary.textContent = `Element notes (${next.includedRecords.length})`;
6104
6880
  renderers.renderIncludedRecords(next.includedRecords, recordsList);
6105
- sendButton.disabled = !canSend;
6106
- sendButton.textContent = next.isSending && next.sendingScope === "batch" ? "Sending..." : !next.isSending && next.successScope === "batch" ? "Sent" : "Ask AI";
6881
+ const allowQuickAsk = deliveryPreference === "both" || deliveryPreference === "ide";
6882
+ const allowCreateTask = deliveryPreference === "both" || deliveryPreference === "agent";
6883
+ const onlyOneAction = allowQuickAsk !== allowCreateTask;
6884
+ quickAskButton.style.display = allowQuickAsk ? "" : "none";
6885
+ createTaskButton.style.display = allowCreateTask ? "" : "none";
6886
+ quickAskButton.disabled = !canSend;
6887
+ createTaskButton.disabled = !canSend;
6888
+ if (onlyOneAction) {
6889
+ quickAskButton.classList.toggle("primary", true);
6890
+ createTaskButton.classList.toggle("primary", true);
6891
+ quickAskButton.dataset.emphasis = "primary";
6892
+ createTaskButton.dataset.emphasis = "primary";
6893
+ quickAskButton.style.flex = "1";
6894
+ createTaskButton.style.flex = "1";
6895
+ quickAskButton.dataset.layoutRole = "primary";
6896
+ createTaskButton.dataset.layoutRole = "primary";
6897
+ } else {
6898
+ quickAskButton.classList.toggle("primary", false);
6899
+ createTaskButton.classList.toggle("primary", false);
6900
+ quickAskButton.dataset.emphasis = preferredAction === "quick-ask" ? "primary" : "secondary";
6901
+ createTaskButton.dataset.emphasis = preferredAction === "create-task" ? "primary" : "secondary";
6902
+ quickAskButton.dataset.layoutRole = preferredAction === "quick-ask" ? "primary" : "secondary";
6903
+ createTaskButton.dataset.layoutRole = preferredAction === "create-task" ? "primary" : "secondary";
6904
+ quickAskButton.style.order = "1";
6905
+ createTaskButton.style.order = "2";
6906
+ quickAskButton.style.flex = "1";
6907
+ createTaskButton.style.flex = "1";
6908
+ }
6909
+ quickAskButton.title = t("annotate.askAiHint");
6910
+ createTaskButton.title = t("annotate.createTaskHint");
6911
+ recommendedActionLabel.style.display = canSend && !onlyOneAction && deliveryPreference === "both" ? "block" : "none";
6912
+ recommendedActionLabel.textContent = preferredAction === "quick-ask" ? t("annotate.recommendedAction.askHint", {
6913
+ action: t("annotate.askAi")
6914
+ }) : t("annotate.recommendedAction.agentHint", {
6915
+ action: t("annotate.createTask")
6916
+ });
6917
+ quickAskButton.textContent = next.isSending && next.sendingScope === "quick-ask" ? t("menu.sending") : !next.isSending && next.successScope === "quick-ask" ? t("annotate.sent") : t("annotate.askAi");
6918
+ createTaskButton.textContent = next.isSending && next.sendingScope === "create-task" ? t("menu.sending") : t("annotate.createTask");
6919
+ const latestSession = next.latestSessionDetail;
6920
+ const latestSessionSummary = next.latestSessionSummary;
6921
+ latestSessionSection.style.display = latestSession || latestSessionSummary ? "" : "none";
6922
+ latestSessionRefreshButton.disabled = Boolean(next.latestSessionLoading);
6923
+ latestSessionTitle.textContent = t("annotate.latestSession.title");
6924
+ if (latestSession || latestSessionSummary) {
6925
+ const latestStatus = (_f = (_e = latestSession == null ? void 0 : latestSession.status) != null ? _e : latestSessionSummary == null ? void 0 : latestSessionSummary.status) != null ? _f : "pending";
6926
+ latestSessionMeta.textContent = latestSession ? t("annotate.latestSession.meta.loaded", {
6927
+ id: latestSession.id.slice(0, 8),
6928
+ count: latestSession.annotations.length
6929
+ }) : latestSessionSummary ? t("annotate.latestSession.meta.summary", {
6930
+ id: latestSessionSummary.id.slice(0, 8)
6931
+ }) : "";
6932
+ const lastAgentOrSystemMessageRecord = (_h = (_g = latestSession == null ? void 0 : latestSession.messages) == null ? void 0 : _g.filter((message) => message.role === "agent" || message.role === "system").slice(-1)[0]) != null ? _h : null;
6933
+ const lastAgentOrSystemMessage = (_j = (_i = lastAgentOrSystemMessageRecord == null ? void 0 : lastAgentOrSystemMessageRecord.text) == null ? void 0 : _i.trim()) != null ? _j : "";
6934
+ const latestMessageKind = lastAgentOrSystemMessageRecord && lastAgentOrSystemMessage ? classifySessionMessage({
6935
+ role: lastAgentOrSystemMessageRecord.role,
6936
+ text: lastAgentOrSystemMessage
6937
+ }) : null;
6938
+ const latestVisualStatus = latestStatus;
6939
+ latestSessionStatus.textContent = getLatestSessionStatusLabel(latestVisualStatus);
6940
+ applyLatestSessionStatusStyles(latestVisualStatus);
6941
+ latestSessionMessage.style.display = "none";
6942
+ const fallbackMsg = getLatestSessionFallbackMessage(latestStatus, Boolean(latestSession));
6943
+ const hasMessage = next.latestSessionLoading || lastAgentOrSystemMessage || fallbackMsg;
6944
+ if (hasMessage) {
6945
+ latestSessionMessage.style.display = "block";
6946
+ latestSessionMessage.textContent = next.latestSessionLoading ? t("annotate.latestSession.loading") : lastAgentOrSystemMessage || fallbackMsg;
6947
+ }
6948
+ latestSessionMessage.dataset.variant = latestMessageKind != null ? latestMessageKind : "default";
6949
+ if (latestMessageKind === "system-info") {
6950
+ latestSessionMessage.style.color = "#9ed8ff";
6951
+ } else {
6952
+ latestSessionMessage.style.color = "var(--inspecto-text-secondary)";
6953
+ }
6954
+ const latestSessionHintText = next.latestSessionLoading ? "" : getLatestSessionHint(latestStatus);
6955
+ const latestSessionErrorText = getLatestSessionErrorMessage(next.latestSessionError);
6956
+ const showReconnectAction = Boolean(latestSessionErrorText);
6957
+ latestSessionHint.textContent = latestSessionHintText;
6958
+ latestSessionHint.style.display = latestSessionHintText && !showReconnectAction ? "block" : "none";
6959
+ latestSessionHint.style.color = latestStatus === "resolved" ? "#b7f5cd" : "var(--inspecto-text-secondary)";
6960
+ latestSessionError.textContent = latestSessionErrorText;
6961
+ latestSessionError.style.display = latestSessionErrorText ? "block" : "none";
6962
+ latestSessionRefreshButton.textContent = showReconnectAction ? t("annotate.latestSession.reconnect") : "\u21BB";
6963
+ latestSessionRefreshButton.style.display = showReconnectAction || next.latestSessionLoading ? "" : "none";
6964
+ latestSessionRefreshButton.style.minWidth = showReconnectAction ? "auto" : "";
6965
+ latestSessionRefreshButton.style.padding = showReconnectAction ? "6px 10px" : "";
6966
+ latestSessionRefreshButton.style.fontSize = showReconnectAction ? "11px" : "12px";
6967
+ const latestSessionId = (_l = (_k = latestSession == null ? void 0 : latestSession.id) != null ? _k : latestSessionSummary == null ? void 0 : latestSessionSummary.id) != null ? _l : "";
6968
+ if (latestSessionId && latestSessionId !== lastRevealedSessionId) {
6969
+ lastRevealedSessionId = latestSessionId;
6970
+ if (!hasCurrentDraft && !hasSavedRecords) {
6971
+ latestSessionSection.scrollIntoView({ block: "nearest", behavior: "smooth" });
6972
+ }
6973
+ }
6974
+ } else {
6975
+ latestSessionHint.textContent = "";
6976
+ latestSessionHint.style.display = "none";
6977
+ latestSessionMessage.dataset.variant = "default";
6978
+ latestSessionMessage.style.color = "var(--inspecto-text-secondary)";
6979
+ latestSessionError.textContent = "";
6980
+ latestSessionError.style.display = "none";
6981
+ latestSessionRefreshButton.textContent = "\u21BB";
6982
+ latestSessionRefreshButton.style.display = "none";
6983
+ latestSessionRefreshButton.style.minWidth = "";
6984
+ latestSessionRefreshButton.style.padding = "";
6985
+ latestSessionRefreshButton.style.fontSize = "12px";
6986
+ }
6107
6987
  statusMessage.textContent = getLiveStatusMessage(next);
6108
- errorMessage.textContent = (_c = next.errorMessage) != null ? _c : "";
6988
+ errorMessage.textContent = (_m = next.errorMessage) != null ? _m : "";
6109
6989
  errorMessage.style.display = next.errorMessage ? "block" : "none";
6110
6990
  }
6111
6991
  instructionSegments = normalizeInstructionSegments([
@@ -6127,13 +7007,6 @@ function createAnnotateSidebar(shadowRoot, options) {
6127
7007
  )
6128
7008
  );
6129
7009
  });
6130
- screenshotContextButton.addEventListener(
6131
- "click",
6132
- () => {
6133
- var _a2;
6134
- return (_a2 = currentOptions.onToggleScreenshotContext) == null ? void 0 : _a2.call(currentOptions);
6135
- }
6136
- );
6137
7010
  cssContextButton.addEventListener("click", () => {
6138
7011
  var _a2;
6139
7012
  return (_a2 = currentOptions.onToggleCssContext) == null ? void 0 : _a2.call(currentOptions);
@@ -6142,7 +7015,6 @@ function createAnnotateSidebar(shadowRoot, options) {
6142
7015
  var _a2;
6143
7016
  return (_a2 = currentOptions.onToggleRuntimeContext) == null ? void 0 : _a2.call(currentOptions);
6144
7017
  });
6145
- sendButton.addEventListener("click", () => currentOptions.onSend());
6146
7018
  exitButton.addEventListener("click", () => currentOptions.onExit());
6147
7019
  quickCaptureButton.addEventListener("click", () => {
6148
7020
  var _a2;
@@ -6174,6 +7046,7 @@ var init_annotate_sidebar = __esm({
6174
7046
  init_annotate_sidebar_helpers();
6175
7047
  init_annotate_sidebar_dom();
6176
7048
  init_annotate_sidebar_renderers();
7049
+ init_i18n();
6177
7050
  init_icons();
6178
7051
  }
6179
7052
  });
@@ -6207,7 +7080,6 @@ function syncModeUi(ctx) {
6207
7080
  }
6208
7081
  state.annotateCapturePaused = false;
6209
7082
  state.annotateRuntimeContextEnabled = false;
6210
- state.annotateScreenshotContextEnabled = false;
6211
7083
  state.annotateCssContextEnabled = false;
6212
7084
  (_e = state.annotateSidebar) == null ? void 0 : _e.destroy();
6213
7085
  state.annotateSidebar = null;
@@ -6377,11 +7249,22 @@ function resetAnnotateState(state) {
6377
7249
  state.annotateCapturePaused = false;
6378
7250
  state.annotateQuickCaptureEnabled = false;
6379
7251
  state.annotateRuntimeContextEnabled = false;
6380
- state.annotateScreenshotContextEnabled = false;
6381
7252
  state.annotateCssContextEnabled = false;
7253
+ state.stopLatestAnnotateSessionStream();
7254
+ }
7255
+ function buildI18nConfig(input) {
7256
+ const config = {};
7257
+ if (input.locale !== void 0) {
7258
+ config.locale = input.locale;
7259
+ }
7260
+ if (input.messages !== void 0) {
7261
+ config.messages = input.messages;
7262
+ }
7263
+ return config;
6382
7264
  }
6383
7265
  function connect(ctx, createAnnotateOverlay2) {
6384
7266
  const state = asLifecycleContext(ctx);
7267
+ configureI18n(buildI18nConfig(state.options));
6385
7268
  const host = state;
6386
7269
  host.style.position = "fixed";
6387
7270
  host.style.inset = "0";
@@ -6412,6 +7295,7 @@ function disconnect(ctx) {
6412
7295
  state.annotateSidebar = null;
6413
7296
  state.annotateElements.clear();
6414
7297
  state.annotateDrafts.clear();
7298
+ state.stopLatestAnnotateSessionStream();
6415
7299
  (_b = state.cleanupRuntimeContextCapture) == null ? void 0 : _b.call(state);
6416
7300
  state.cleanupRuntimeContextCapture = null;
6417
7301
  state.runtimeContextCollector.clear();
@@ -6420,6 +7304,7 @@ function disconnect(ctx) {
6420
7304
  function configure(ctx, options) {
6421
7305
  const state = asLifecycleContext(ctx);
6422
7306
  state.options = options;
7307
+ configureI18n(buildI18nConfig(options));
6423
7308
  if (options.mode !== void 0) {
6424
7309
  const previousMode = state.mode;
6425
7310
  state.mode = options.mode;
@@ -6439,6 +7324,9 @@ function configure(ctx, options) {
6439
7324
  if ((info == null ? void 0 : info.theme) !== void 0) {
6440
7325
  applyTheme(state, info.theme);
6441
7326
  }
7327
+ if ((info == null ? void 0 : info.annotateDeliveryMode) !== void 0) {
7328
+ state.annotateDeliveryMode = info.annotateDeliveryMode;
7329
+ }
6442
7330
  if ((info == null ? void 0 : info.includeSnippet) !== void 0) {
6443
7331
  state.options.includeSnippet = info.includeSnippet;
6444
7332
  }
@@ -6446,13 +7334,6 @@ function configure(ctx, options) {
6446
7334
  state.options.runtimeContext = __spreadValues(__spreadValues({}, state.options.runtimeContext), info.runtimeContext);
6447
7335
  state.syncRuntimeContextCapture();
6448
7336
  }
6449
- if ((info == null ? void 0 : info.screenshotContext) !== void 0) {
6450
- state.options.screenshotContext = __spreadValues(__spreadValues({}, state.options.screenshotContext), info.screenshotContext);
6451
- }
6452
- if ((info == null ? void 0 : info.annotationResponseMode) !== void 0) {
6453
- state.options.annotationResponseMode = info.annotationResponseMode;
6454
- state.annotationResponseMode = info.annotationResponseMode;
6455
- }
6456
7337
  }).catch(() => {
6457
7338
  }).then(() => {
6458
7339
  });
@@ -6480,6 +7361,7 @@ var init_component_lifecycle = __esm({
6480
7361
  init_http();
6481
7362
  init_styles();
6482
7363
  init_http();
7364
+ init_i18n();
6483
7365
  }
6484
7366
  });
6485
7367
 
@@ -6507,10 +7389,6 @@ function canAttachRuntimeContext(ctx) {
6507
7389
  var _a2;
6508
7390
  return ((_a2 = asEvidenceContext(ctx).options.runtimeContext) == null ? void 0 : _a2.enabled) === true;
6509
7391
  }
6510
- function canAttachScreenshotContext(ctx) {
6511
- var _a2;
6512
- return ((_a2 = asEvidenceContext(ctx).options.screenshotContext) == null ? void 0 : _a2.enabled) === true;
6513
- }
6514
7392
  function canAttachCssContext() {
6515
7393
  return typeof window !== "undefined" && typeof window.getComputedStyle === "function";
6516
7394
  }
@@ -6612,34 +7490,10 @@ function getCollectedRuntimeErrorCount(ctx) {
6612
7490
  const state = asEvidenceContext(ctx);
6613
7491
  return state.runtimeContextCollector.snapshot().records.filter((record) => record.kind !== "failed-request").length;
6614
7492
  }
6615
- function resolveAnnotateScreenshotElement(ctx, annotations, scope) {
6616
- var _a2;
6617
- const state = asEvidenceContext(ctx);
6618
- const currentElement = state.annotateSession.current.target ? (_a2 = state.annotateElements.get(state.annotateSession.current.id)) != null ? _a2 : state.findElementForAnnotationTarget(state.annotateSession.current.target) : null;
6619
- if (scope === "current") return currentElement;
6620
- for (const annotation of annotations) {
6621
- for (const target of annotation.targets) {
6622
- const element = state.findElementForLocation(target.location, target.selector);
6623
- if (element) return element;
6624
- }
6625
- }
6626
- return currentElement;
6627
- }
6628
- function captureAnnotateScreenshotContext(ctx, annotations, scope) {
6629
- return __async(this, null, function* () {
6630
- const state = asEvidenceContext(ctx);
6631
- if (!state.canAttachScreenshotContext() || !state.annotateScreenshotContextEnabled) {
6632
- return null;
6633
- }
6634
- const element = resolveAnnotateScreenshotElement(state, annotations, scope);
6635
- return element ? captureElementScreenshot(element) : null;
6636
- });
6637
- }
6638
7493
  var init_component_evidence = __esm({
6639
7494
  "src/component-evidence.ts"() {
6640
7495
  "use strict";
6641
7496
  init_runtime_context();
6642
- init_screenshot_context();
6643
7497
  init_css_context();
6644
7498
  }
6645
7499
  });
@@ -6689,18 +7543,23 @@ var init_component = __esm({
6689
7543
  this.annotateDrafts = /* @__PURE__ */ new Map();
6690
7544
  this.annotateEditingRecord = null;
6691
7545
  this.configLoadPromise = null;
6692
- this.annotationResponseMode = "unified";
6693
7546
  this.annotateInstructionDraft = DEFAULT_ANNOTATE_INSTRUCTION;
6694
7547
  this.annotateErrorMessage = "";
6695
7548
  this.annotateRuntimeContextEnabled = false;
6696
- this.annotateScreenshotContextEnabled = false;
6697
7549
  this.annotateCssContextEnabled = false;
7550
+ this.annotateDeliveryMode = "both";
6698
7551
  this.annotateSendState = {
6699
7552
  isSending: false,
6700
7553
  scope: null
6701
7554
  };
7555
+ this.annotateLatestSessionSummary = null;
7556
+ this.annotateLatestSessionDetail = null;
7557
+ this.annotateLatestSessionStream = null;
7558
+ this.annotateLatestSessionLoading = false;
7559
+ this.annotateLatestSessionError = "";
6702
7560
  this.annotateSuccessScope = null;
6703
7561
  this.annotateSuccessTimeout = null;
7562
+ this.annotateSuccessOnClear = null;
6704
7563
  this.pendingAnnotateViewportFrame = null;
6705
7564
  this.runtimeContextCollector = createRuntimeContextCollector();
6706
7565
  this.cleanupRuntimeContextCapture = null;
@@ -6758,9 +7617,6 @@ var init_component = __esm({
6758
7617
  getEffectiveHotKeys() {
6759
7618
  return getEffectiveHotKeys(this);
6760
7619
  }
6761
- getAnnotationResponseMode() {
6762
- return this.annotationResponseMode;
6763
- }
6764
7620
  updateBadgeContent() {
6765
7621
  updateBadgeContent(this);
6766
7622
  }
@@ -6779,6 +7635,9 @@ var init_component = __esm({
6779
7635
  updateLauncherEye() {
6780
7636
  updateLauncherEye(this);
6781
7637
  }
7638
+ pause() {
7639
+ this.setPaused(true);
7640
+ }
6782
7641
  openInspectMenu(loc, clientX, clientY, targetElement) {
6783
7642
  openInspectMenu(this, loc, clientX, clientY, targetElement);
6784
7643
  }
@@ -6788,9 +7647,6 @@ var init_component = __esm({
6788
7647
  canAttachRuntimeContext() {
6789
7648
  return canAttachRuntimeContext(this);
6790
7649
  }
6791
- canAttachScreenshotContext() {
6792
- return canAttachScreenshotContext(this);
6793
- }
6794
7650
  canAttachCssContext() {
6795
7651
  return canAttachCssContext();
6796
7652
  }
@@ -6818,14 +7674,6 @@ var init_component = __esm({
6818
7674
  getCollectedRuntimeErrorCount() {
6819
7675
  return getCollectedRuntimeErrorCount(this);
6820
7676
  }
6821
- resolveAnnotateScreenshotElement(annotations, scope) {
6822
- return resolveAnnotateScreenshotElement(this, annotations, scope);
6823
- }
6824
- captureAnnotateScreenshotContext(annotations, scope) {
6825
- return __async(this, null, function* () {
6826
- return captureAnnotateScreenshotContext(this, annotations, scope);
6827
- });
6828
- }
6829
7677
  addTargetToCurrentAnnotation(element, location) {
6830
7678
  addTargetToCurrentAnnotation(this, element, location);
6831
7679
  }
@@ -6880,15 +7728,26 @@ var init_component = __esm({
6880
7728
  showAnnotateSuccess(scope) {
6881
7729
  showAnnotateSuccess(this, scope);
6882
7730
  }
7731
+ refreshLatestAnnotateSession() {
7732
+ return __async(this, null, function* () {
7733
+ return refreshLatestAnnotateSession(this);
7734
+ });
7735
+ }
7736
+ startLatestAnnotateSessionStream(sessionId) {
7737
+ startLatestAnnotateSessionStream(this, sessionId);
7738
+ }
7739
+ stopLatestAnnotateSessionStream() {
7740
+ stopLatestAnnotateSessionStream(this);
7741
+ }
6883
7742
  toAnnotateErrorMessage(errorCode, fallback) {
6884
7743
  return toAnnotateErrorMessage(this, errorCode, fallback);
6885
7744
  }
6886
7745
  toAnnotationTransportFromRecord(record) {
6887
7746
  return toAnnotationTransportFromRecordUi(this, record);
6888
7747
  }
6889
- sendAnnotationBatch(annotations, scope, instruction, onSuccess) {
7748
+ sendAnnotationBatch(annotations, scope, instruction, deliveryMode, onSuccess) {
6890
7749
  return __async(this, null, function* () {
6891
- return sendAnnotationBatch(this, annotations, scope, instruction, onSuccess);
7750
+ return sendAnnotationBatch(this, annotations, scope, instruction, deliveryMode, onSuccess);
6892
7751
  });
6893
7752
  }
6894
7753
  syncModeUi() {
@@ -6950,7 +7809,7 @@ var TAG_NAME = "inspecto-overlay";
6950
7809
  function mountInspector() {
6951
7810
  return __async(this, arguments, function* (options = {}) {
6952
7811
  if (typeof document === "undefined") return null;
6953
- const { InspectoElement: InspectoElement2 } = yield Promise.resolve().then(() => (init_component(), component_exports));
7812
+ const { InspectoElement: _InspectoElement } = yield Promise.resolve().then(() => (init_component(), component_exports));
6954
7813
  const existing = document.querySelector(TAG_NAME);
6955
7814
  if (existing) {
6956
7815
  ;