@inspecto-dev/core 0.3.8 → 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);
985
+ }
986
+
987
+ .${badgeClass}-panel-toggle-button:hover {
988
+ transform: translateY(-1px);
989
+ border-color: rgba(255, 255, 255, 0.12);
899
990
  }
900
991
 
901
- .${badgeClass}-panel-button.secondary [data-inspecto-launcher-description="true"] {
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
  });
@@ -2597,12 +2905,9 @@ function buildAnnotateFullPrompt(input) {
2597
2905
  const prompt = instruction ? `${instruction}
2598
2906
 
2599
2907
  ${body}` : body;
2600
- return appendScreenshotContextSection(
2601
- appendCssContextToPrompt(
2602
- appendRuntimeContextSection(prompt, input.runtimeContext),
2603
- input.cssContextPrompt
2604
- ),
2605
- input.screenshotContext
2908
+ return appendCssContextToPrompt(
2909
+ appendRuntimeContextSection(prompt, input.runtimeContext),
2910
+ input.cssContextPrompt
2606
2911
  );
2607
2912
  }
2608
2913
  function buildSelectedElementsPrompt(annotations) {
@@ -2634,22 +2939,6 @@ function appendRuntimeContextSection(prompt, runtimeContext) {
2634
2939
 
2635
2940
  ${buildRuntimeContextSection(runtimeContext.records)}`;
2636
2941
  }
2637
- function appendScreenshotContextSection(prompt, screenshotContext) {
2638
- if (!screenshotContext || !screenshotContext.imageDataUrl && !screenshotContext.imageAssetId) {
2639
- return prompt;
2640
- }
2641
- const lines = [
2642
- "Visual screenshot context attached:",
2643
- `- capturedAt=${screenshotContext.capturedAt}`,
2644
- `- mimeType=${screenshotContext.mimeType}`
2645
- ];
2646
- if (screenshotContext.imageAssetId) {
2647
- lines.push(`- imageAssetId=${screenshotContext.imageAssetId}`);
2648
- }
2649
- return `${prompt}
2650
-
2651
- ${lines.join("\n")}`;
2652
- }
2653
2942
  function buildRuntimeContextSection(records) {
2654
2943
  return ["Relevant runtime context:", ...records.map(formatRuntimeRecord)].join("\n");
2655
2944
  }
@@ -2692,15 +2981,26 @@ function fetchIdeInfo(force = false) {
2692
2981
  }
2693
2982
  function openFile(req) {
2694
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;
2695
2990
  try {
2696
- 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}`, {
2697
2992
  method: "POST",
2698
2993
  headers: { "Content-Type": "application/json" },
2699
2994
  body: JSON.stringify(req)
2700
2995
  });
2701
- 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
+ };
2702
3002
  } catch (e) {
2703
- return false;
3003
+ return { success: false, errorCode: "SERVER_UNAVAILABLE" };
2704
3004
  }
2705
3005
  });
2706
3006
  }
@@ -2712,64 +3012,179 @@ function fetchSnippet(file, line, column, maxLines = 100) {
2712
3012
  column: String(column),
2713
3013
  maxLines: String(maxLines)
2714
3014
  });
2715
- const res = yield fetch(`${BASE_URL}${import_types.INSPECTO_API_PATHS.PROJECT_SNIPPET}?${params}`);
2716
- if (!res.ok) {
2717
- const err = yield res.json().catch(() => ({}));
2718
- 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
+ });
2719
3027
  }
2720
- return res.json();
2721
3028
  });
2722
3029
  }
2723
3030
  function sendToAi(req) {
2724
3031
  return __async(this, null, function* () {
2725
3032
  var _a2;
2726
- const res = yield fetch(`${BASE_URL}${import_types.INSPECTO_API_PATHS.AI_DISPATCH}`, {
2727
- method: "POST",
2728
- headers: { "Content-Type": "application/json" },
2729
- body: JSON.stringify(req)
2730
- });
2731
- if (!res.ok) {
2732
- 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) {
2733
3049
  return {
2734
3050
  success: false,
2735
- error: (_a2 = err.error) != null ? _a2 : "Request failed",
2736
- errorCode: err.errorCode
3051
+ error: "Local dev server unavailable",
3052
+ errorCode: "SERVER_UNAVAILABLE"
2737
3053
  };
2738
3054
  }
2739
- return res.json();
2740
3055
  });
2741
3056
  }
2742
3057
  function sendAnnotationsToAi(req) {
2743
3058
  return __async(this, null, function* () {
2744
3059
  var _a2;
2745
- const res = yield fetch(`${BASE_URL}${AI_BATCH_DISPATCH_PATH}`, {
2746
- method: "POST",
2747
- headers: { "Content-Type": "application/json" },
2748
- body: JSON.stringify(req)
2749
- });
2750
- if (!res.ok) {
2751
- 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) {
2752
3076
  return {
2753
3077
  success: false,
2754
- error: (_a2 = err.error) != null ? _a2 : "Request failed",
2755
- errorCode: err.errorCode
3078
+ error: "Local dev server unavailable",
3079
+ errorCode: "SERVER_UNAVAILABLE"
2756
3080
  };
2757
3081
  }
2758
- return res.json();
2759
3082
  });
2760
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
+ }
2761
3138
  var import_types, BASE_URL, _a, AI_BATCH_DISPATCH_PATH, cachedConfig;
2762
3139
  var init_http = __esm({
2763
3140
  "src/http.ts"() {
2764
3141
  "use strict";
2765
3142
  import_types = require("@inspecto-dev/types");
2766
- 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";
2767
3144
  AI_BATCH_DISPATCH_PATH = (_a = import_types.INSPECTO_API_PATHS.AI_BATCH_DISPATCH) != null ? _a : "/inspecto/api/v1/ai/dispatch/annotations";
2768
3145
  cachedConfig = null;
2769
3146
  }
2770
3147
  });
2771
3148
 
2772
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
+ }
2773
3188
  function hasCurrentRecordUi(ctx) {
2774
3189
  return Boolean(asAnnotateContext(ctx).annotateSession.current.target);
2775
3190
  }
@@ -2794,6 +3209,7 @@ function clearAnnotateSuccess(ctx) {
2794
3209
  clearTimeout(state.annotateSuccessTimeout);
2795
3210
  state.annotateSuccessTimeout = null;
2796
3211
  }
3212
+ state.annotateSuccessOnClear = null;
2797
3213
  if (hadSuccess) {
2798
3214
  state.updateAnnotateSidebar();
2799
3215
  }
@@ -2803,11 +3219,29 @@ function showAnnotateSuccess(ctx, scope) {
2803
3219
  clearAnnotateSuccess(state);
2804
3220
  state.annotateSuccessScope = scope;
2805
3221
  state.annotateSuccessTimeout = setTimeout(() => {
3222
+ const onClear = state.annotateSuccessOnClear;
2806
3223
  state.annotateSuccessScope = null;
2807
3224
  state.annotateSuccessTimeout = null;
3225
+ state.annotateSuccessOnClear = null;
3226
+ onClear == null ? void 0 : onClear();
2808
3227
  state.updateAnnotateSidebar();
2809
3228
  }, 1500);
2810
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
+ }
2811
3245
  function toAnnotateErrorMessage(_ctx, errorCode, fallback) {
2812
3246
  if (errorCode === "FORBIDDEN_PATH") {
2813
3247
  return "Some selected targets are outside the current project workspace.";
@@ -2815,6 +3249,9 @@ function toAnnotateErrorMessage(_ctx, errorCode, fallback) {
2815
3249
  if (errorCode === "INVALID_REQUEST") {
2816
3250
  return "The current annotation batch is incomplete. Check your targets and try again.";
2817
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
+ }
2818
3255
  return fallback != null ? fallback : "Request failed";
2819
3256
  }
2820
3257
  function toAnnotationTransportFromRecordUi(_ctx, record) {
@@ -2828,8 +3265,9 @@ function toAnnotationTransportFromRecordUi(_ctx, record) {
2828
3265
  ]
2829
3266
  };
2830
3267
  }
2831
- function sendAnnotationBatch(ctx, annotations, scope, instruction, onSuccess) {
3268
+ function sendAnnotationBatch(ctx, annotations, scope, instruction, deliveryMode, onSuccess) {
2832
3269
  return __async(this, null, function* () {
3270
+ var _a2, _b;
2833
3271
  const state = asAnnotateContext(ctx);
2834
3272
  if (annotations.length === 0 || state.annotateSendState.isSending) return;
2835
3273
  state.annotateSendState = { isSending: true, scope };
@@ -2837,26 +3275,38 @@ function sendAnnotationBatch(ctx, annotations, scope, instruction, onSuccess) {
2837
3275
  try {
2838
3276
  yield state.configLoadPromise;
2839
3277
  const runtimeContext = state.getAnnotateRuntimeContext(annotations);
2840
- const screenshotContext = state.annotateScreenshotContextEnabled ? yield state.captureAnnotateScreenshotContext(annotations, scope) : null;
2841
3278
  const cssContextPrompt = state.getAnnotateCssContextPrompt(annotations);
2842
- const result = yield sendAnnotationsToAi(__spreadValues(__spreadValues(__spreadValues({
3279
+ const result = yield sendAnnotationsToAi(__spreadProps(__spreadValues(__spreadValues({
2843
3280
  instruction,
2844
- annotations,
2845
- responseMode: state.getAnnotationResponseMode()
2846
- }, runtimeContext ? { runtimeContext } : {}), screenshotContext ? { screenshotContext } : {}), cssContextPrompt ? { cssContextPrompt } : {}));
3281
+ annotations
3282
+ }, runtimeContext ? { runtimeContext } : {}), cssContextPrompt ? { cssContextPrompt } : {}), {
3283
+ deliveryMode
3284
+ }));
2847
3285
  if (!result.success) {
2848
3286
  state.annotateErrorMessage = toAnnotateErrorMessage(state, result.errorCode, result.error);
2849
3287
  state.updateAnnotateSidebar();
2850
3288
  return;
2851
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
+ }
2852
3299
  onSuccess();
2853
3300
  state.annotateErrorMessage = "";
2854
3301
  state.showAnnotateSuccess(scope);
2855
- state.annotateElements.clear();
2856
3302
  state.renderAnnotateSelectionOverlay();
2857
3303
  state.updateAnnotateSidebar();
2858
- } catch (e) {
2859
- state.annotateErrorMessage = "Request failed";
3304
+ } catch (err) {
3305
+ state.annotateErrorMessage = toAnnotateErrorMessage(
3306
+ state,
3307
+ err.errorCode,
3308
+ err.message
3309
+ );
2860
3310
  state.updateAnnotateSidebar();
2861
3311
  } finally {
2862
3312
  state.annotateSendState = { isSending: false, scope: null };
@@ -2864,7 +3314,56 @@ function sendAnnotationBatch(ctx, annotations, scope, instruction, onSuccess) {
2864
3314
  }
2865
3315
  });
2866
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
+ }
2867
3365
  function getAnnotateSidebarOptions(ctx) {
3366
+ var _a2;
2868
3367
  const state = asAnnotateContext(ctx);
2869
3368
  const includedRecords = state.annotateSession.records;
2870
3369
  const savedAnnotations = state.annotateSession.records.map(
@@ -2885,10 +3384,12 @@ function getAnnotateSidebarOptions(ctx) {
2885
3384
  const fullInstruction = composeAnnotateInstruction(state);
2886
3385
  const allRuntimeContext = state.getAnnotateRuntimeContext(allAnnotations);
2887
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";
2888
3391
  return {
2889
3392
  mode: state.annotateCapturePaused ? "capture-paused" : "capture-enabled",
2890
- canAttachScreenshotContext: false,
2891
- screenshotContextEnabled: state.annotateScreenshotContextEnabled,
2892
3393
  canAttachCssContext: false,
2893
3394
  cssContextEnabled: false,
2894
3395
  canAttachRuntimeContext: state.canAttachRuntimeContext(),
@@ -2901,13 +3402,18 @@ function getAnnotateSidebarOptions(ctx) {
2901
3402
  fullPrompt: buildAnnotateFullPrompt({
2902
3403
  instruction: fullInstruction,
2903
3404
  annotations: allAnnotations,
2904
- responseMode: state.getAnnotationResponseMode(),
2905
3405
  runtimeContext: allRuntimeContext,
2906
3406
  cssContextPrompt: allCssContextPrompt
2907
3407
  }),
2908
3408
  isSending: state.annotateSendState.isSending,
2909
3409
  sendingScope: state.annotateSendState.scope,
2910
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,
2911
3417
  quickCaptureEnabled: state.annotateQuickCaptureEnabled,
2912
3418
  errorMessage: state.annotateErrorMessage,
2913
3419
  onPauseCapture: () => {
@@ -2940,11 +3446,11 @@ function getAnnotateSidebarOptions(ctx) {
2940
3446
  state.updateAnnotateSidebar();
2941
3447
  },
2942
3448
  onRemovePromptChip: (recordId) => {
2943
- var _a2;
3449
+ var _a3;
2944
3450
  state.clearAnnotateError();
2945
3451
  state.clearAnnotateSuccess();
2946
3452
  const currentTarget = state.annotateSession.current.id === recordId ? state.annotateSession.current.target : null;
2947
- 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;
2948
3454
  if (currentTarget) {
2949
3455
  clearDraftForTarget(state, currentTarget);
2950
3456
  state.annotateSession = clearCurrentRecord(state.annotateSession);
@@ -2962,8 +3468,38 @@ function getAnnotateSidebarOptions(ctx) {
2962
3468
  state.clearAnnotateSuccess();
2963
3469
  beginEditingRecord(state, recordId);
2964
3470
  },
2965
- onSend: () => {
2966
- 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;
2967
3503
  const transports = state.annotateSession.records.map(
2968
3504
  (record) => toAnnotationTransportFromRecordUi(null, record)
2969
3505
  );
@@ -2971,7 +3507,7 @@ function getAnnotateSidebarOptions(ctx) {
2971
3507
  transports.push(
2972
3508
  toAnnotationTransportFromRecordUi(null, {
2973
3509
  id: state.annotateSession.current.id,
2974
- displayOrder: (_a2 = state.annotateSession.current.displayOrder) != null ? _a2 : getNextRecordDisplayOrderUi(state),
3510
+ displayOrder: (_a3 = state.annotateSession.current.displayOrder) != null ? _a3 : getNextRecordDisplayOrderUi(state),
2975
3511
  target: state.annotateSession.current.target,
2976
3512
  note: state.annotateSession.current.note,
2977
3513
  intent: state.annotateSession.current.intent
@@ -2981,12 +3517,42 @@ function getAnnotateSidebarOptions(ctx) {
2981
3517
  void sendAnnotationBatch(
2982
3518
  state,
2983
3519
  transports,
2984
- "batch",
3520
+ "quick-ask",
2985
3521
  composeAnnotateInstruction(state),
3522
+ "ide",
2986
3523
  () => {
3524
+ state.annotateInstructionDraft = "";
2987
3525
  state.annotateDrafts.clear();
2988
3526
  state.annotateEditingRecord = null;
2989
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
+ () => {
2990
3556
  }
2991
3557
  );
2992
3558
  },
@@ -3007,15 +3573,16 @@ function renderAnnotateSelectionOverlay(ctx) {
3007
3573
  return;
3008
3574
  }
3009
3575
  const overlayTargets = state.annotateSession.records.map((record) => {
3010
- var _a3;
3576
+ var _a3, _b2, _c;
3011
3577
  if (((_a3 = state.annotateEditingRecord) == null ? void 0 : _a3.id) === record.id) return null;
3012
3578
  const element = findElementForAnnotationTarget(state, record.target);
3013
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";
3014
3581
  return {
3015
3582
  id: record.id,
3016
3583
  element,
3017
3584
  order: record.displayOrder,
3018
- state: "saved",
3585
+ state: overlayState,
3019
3586
  note: record.note,
3020
3587
  onActivate: () => {
3021
3588
  state.clearAnnotateError();
@@ -3044,15 +3611,13 @@ function renderAnnotateSelectionOverlay(ctx) {
3044
3611
  onOpenInEditor: () => {
3045
3612
  void openFile(target.location);
3046
3613
  },
3047
- canAttachScreenshotContext: false,
3048
- screenshotContextEnabled: false,
3049
3614
  canAttachCssContext: state.canAttachCssContext(),
3050
3615
  cssContextEnabled: (_b = state.annotateSession.current.cssContextEnabled) != null ? _b : false,
3051
3616
  canAttachRuntimeContext: false,
3052
3617
  runtimeContextEnabled: false,
3053
3618
  runtimeContextSummary: "",
3054
3619
  runtimeErrorCount: 0,
3055
- saveLabel: state.annotateEditingRecord ? "Update note" : "Save note",
3620
+ saveLabel: state.annotateEditingRecord ? t("annotate.updateNote") : t("annotate.saveNote"),
3056
3621
  onToggleCssContext: () => {
3057
3622
  var _a3;
3058
3623
  state.annotateSession = updateCurrentRecordCssContextEnabled(
@@ -3069,9 +3634,23 @@ function renderAnnotateSelectionOverlay(ctx) {
3069
3634
  state.updateAnnotateSidebar();
3070
3635
  },
3071
3636
  onSave: () => {
3637
+ var _a3, _b2;
3072
3638
  if (!hasCurrentRecordUi(state)) return;
3073
3639
  state.clearAnnotateError();
3074
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
+ }
3075
3654
  clearDraftForTarget(state, state.annotateSession.current.target);
3076
3655
  state.annotateSession = saveCurrentRecord(state.annotateSession);
3077
3656
  state.annotateEditingRecord = null;
@@ -3110,6 +3689,7 @@ var init_component_annotate_ui = __esm({
3110
3689
  init_http();
3111
3690
  init_component_annotate_shared();
3112
3691
  init_component_annotate_targets();
3692
+ init_i18n();
3113
3693
  }
3114
3694
  });
3115
3695
 
@@ -3161,7 +3741,7 @@ function createBadge(ctx) {
3161
3741
  stateSpan.hidden = true;
3162
3742
  const titleSpan = document.createElement("span");
3163
3743
  titleSpan.className = `${badgeClass}-title`;
3164
- titleSpan.textContent = "Inspecto";
3744
+ titleSpan.textContent = t("launcher.title");
3165
3745
  const eyes = document.createElement("span");
3166
3746
  eyes.className = `${badgeClass}-eyes`;
3167
3747
  eyes.setAttribute("aria-hidden", "true");
@@ -3185,14 +3765,18 @@ function createBadge(ctx) {
3185
3765
  panel.dataset.inspectoLauncherPanel = "true";
3186
3766
  const panelHeader = document.createElement("div");
3187
3767
  panelHeader.className = `${badgeClass}-panel-header`;
3188
- 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`;
3189
3773
  const modeGroup = document.createElement("div");
3190
3774
  modeGroup.className = `${badgeClass}-panel-group`;
3191
3775
  const inspectBtn = document.createElement("button");
3192
3776
  inspectBtn.type = "button";
3193
3777
  inspectBtn.className = `${badgeClass}-panel-button`;
3194
3778
  inspectBtn.dataset.inspectoLauncherAction = "inspect";
3195
- 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>`;
3196
3780
  inspectBtn.addEventListener("click", (event) => {
3197
3781
  event.stopPropagation();
3198
3782
  if (state.disabled) setPaused(state, false);
@@ -3205,7 +3789,7 @@ function createBadge(ctx) {
3205
3789
  annotateBtn.type = "button";
3206
3790
  annotateBtn.className = `${badgeClass}-panel-button`;
3207
3791
  annotateBtn.dataset.inspectoLauncherAction = "annotate";
3208
- 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>`;
3209
3793
  annotateBtn.addEventListener("click", (event) => {
3210
3794
  event.stopPropagation();
3211
3795
  if (state.disabled) setPaused(state, false);
@@ -3216,13 +3800,18 @@ function createBadge(ctx) {
3216
3800
  });
3217
3801
  const pauseBtn = document.createElement("button");
3218
3802
  pauseBtn.type = "button";
3219
- pauseBtn.className = `${badgeClass}-panel-button secondary`;
3803
+ pauseBtn.className = `${badgeClass}-panel-toggle-button`;
3220
3804
  pauseBtn.dataset.inspectoLauncherAction = "pause";
3221
- 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;
3222
3808
  pauseBtn.addEventListener("click", (event) => {
3223
3809
  event.stopPropagation();
3224
3810
  setPaused(state, !state.disabled);
3225
3811
  });
3812
+ const pauseText = document.createElement("div");
3813
+ pauseText.className = `${badgeClass}-panel-status-text`;
3814
+ pauseText.dataset.inspectoLauncherPauseText = "true";
3226
3815
  const hotkeyHint = document.createElement("div");
3227
3816
  hotkeyHint.className = `${badgeClass}-panel-hint`;
3228
3817
  hotkeyHint.dataset.inspectoLauncherHint = "hotkey";
@@ -3230,7 +3819,9 @@ function createBadge(ctx) {
3230
3819
  utilityGroup.className = `${badgeClass}-panel-group`;
3231
3820
  utilityGroup.dataset.inspectoLauncherUtilityGroup = "true";
3232
3821
  modeGroup.append(inspectBtn, annotateBtn);
3233
- utilityGroup.append(pauseBtn, hotkeyHint);
3822
+ panelHeader.append(panelHeaderCopy, panelHeaderActions);
3823
+ utilityGroup.append(hotkeyHint);
3824
+ panelHeaderActions.append(pauseText, pauseBtn);
3234
3825
  panel.append(panelHeader, modeGroup, utilityGroup);
3235
3826
  titleBlock.append(titleSpan, stateSpan);
3236
3827
  content.append(indicator, titleBlock);
@@ -3363,10 +3954,13 @@ function updateBadgeContent(ctx) {
3363
3954
  const pauseBtn = state.badge.querySelector(
3364
3955
  `[data-inspecto-launcher-action="pause"]`
3365
3956
  );
3957
+ const pauseText = state.badge.querySelector(
3958
+ `[data-inspecto-launcher-pause-text]`
3959
+ );
3366
3960
  const hotkeyHint = state.badge.querySelector(
3367
3961
  `[data-inspecto-launcher-hint="hotkey"]`
3368
3962
  );
3369
- if (!indicator || !titleSpan || !stateSpan || !panel || !inspectBtn || !annotateBtn || !pauseBtn || !hotkeyHint) {
3963
+ if (!indicator || !titleSpan || !stateSpan || !panel || !inspectBtn || !annotateBtn || !pauseBtn || !pauseText || !hotkeyHint) {
3370
3964
  return;
3371
3965
  }
3372
3966
  const updateModeButton = (button, active) => {
@@ -3375,32 +3969,39 @@ function updateBadgeContent(ctx) {
3375
3969
  };
3376
3970
  let stateLabel;
3377
3971
  if (state.disabled) {
3378
- stateLabel = "Selection paused";
3972
+ stateLabel = t("launcher.state.paused");
3379
3973
  indicator.dataset.state = "paused";
3380
3974
  state.badge.classList.remove("active");
3381
3975
  state.badge.classList.add("disabled");
3382
3976
  } else if (state.mode === "annotate") {
3383
- stateLabel = "Annotate mode";
3977
+ stateLabel = t("launcher.state.annotate");
3384
3978
  indicator.dataset.state = "annotate";
3385
3979
  state.badge.classList.remove("disabled");
3386
3980
  state.badge.classList.add("active");
3387
3981
  } else if (state.active) {
3388
- stateLabel = "Inspect mode";
3982
+ stateLabel = t("launcher.state.inspect");
3389
3983
  indicator.dataset.state = "inspect";
3390
3984
  state.badge.classList.remove("disabled");
3391
3985
  state.badge.classList.add("active");
3392
3986
  } else {
3393
- stateLabel = "Ready";
3987
+ stateLabel = t("launcher.state.ready");
3394
3988
  indicator.dataset.state = "ready";
3395
3989
  state.badge.classList.remove("active", "disabled");
3396
3990
  }
3397
3991
  stateSpan.dataset.state = indicator.dataset.state;
3398
3992
  stateSpan.hidden = false;
3399
- titleSpan.textContent = "Inspecto";
3993
+ titleSpan.textContent = t("launcher.title");
3400
3994
  stateSpan.textContent = stateLabel;
3401
3995
  panel.style.display = state.launcherPanelOpen ? "flex" : "none";
3402
- 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>';
3403
- 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) });
3404
4005
  inspectBtn.style.display = state.disabled ? "none" : "inline-flex";
3405
4006
  annotateBtn.style.display = state.disabled ? "none" : "inline-flex";
3406
4007
  updateModeButton(inspectBtn, !state.disabled && state.active && state.mode === "inspect");
@@ -3484,6 +4085,8 @@ var init_component_launcher = __esm({
3484
4085
  "use strict";
3485
4086
  init_styles();
3486
4087
  init_component_utils();
4088
+ init_i18n();
4089
+ init_icons();
3487
4090
  }
3488
4091
  });
3489
4092
 
@@ -3551,21 +4154,16 @@ function buildFixBugPrompt(input) {
3551
4154
  const evidence = selectFixBugEvidence(input.records);
3552
4155
  const templateGuidance = normalizeTemplateGuidance(input.template);
3553
4156
  return [
3554
- "You are fixing a bug for the currently inspected UI target.",
4157
+ "Fix the bug for the inspected UI target.",
3555
4158
  buildSourceContextSection(input.location, input.snippet),
3556
4159
  buildEvidenceSection(evidence),
3557
- "Guardrails:",
3558
- "- Prioritize evidence-backed conclusions.",
3559
- "- Separate confirmed evidence from hypotheses.",
3560
- "- Avoid strong claims when the runtime evidence is weak or unrelated.",
3561
- "- Ask follow-up questions if the evidence is insufficient for a safe fix.",
3562
- "Response contract:",
3563
- "1. Most likely root cause",
3564
- "2. Confirmed evidence",
3565
- "3. Hypotheses",
3566
- "4. Minimal fix",
3567
- "5. Follow-up questions (only if needed)",
3568
- 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:
3569
4167
  ${indentBlock(templateGuidance)}` : ""
3570
4168
  ].join("\n\n");
3571
4169
  }
@@ -3574,7 +4172,7 @@ function buildPromptForIntent(intent, location, snippetResult, runtimeContext) {
3574
4172
  const fullPromptTemplate = assembleIntentPromptTemplate(intent);
3575
4173
  if (intent.id === "fix-bug") {
3576
4174
  return buildFixBugPrompt({
3577
- template: fullPromptTemplate,
4175
+ template: assembleFixBugAdditionalGuidance(intent),
3578
4176
  location,
3579
4177
  snippet: (snippetResult == null ? void 0 : snippetResult.snippet) || "",
3580
4178
  records: (_a2 = runtimeContext == null ? void 0 : runtimeContext.records) != null ? _a2 : []
@@ -3612,14 +4210,16 @@ ${intent.appendPrompt}`;
3612
4210
  }
3613
4211
  return fullPromptTemplate;
3614
4212
  }
4213
+ function assembleFixBugAdditionalGuidance(intent) {
4214
+ return [intent.prependPrompt, intent.appendPrompt].filter(Boolean).join("\n\n");
4215
+ }
3615
4216
  function buildEvidenceSection(records) {
3616
4217
  if (records.length === 0) {
3617
- return [
3618
- "High-confidence runtime evidence:",
3619
- "- None selected. Do not treat unrelated logs as proof."
3620
- ].join("\n");
4218
+ return ["Runtime evidence:", "- None selected. Do not treat unrelated logs as proof."].join(
4219
+ "\n"
4220
+ );
3621
4221
  }
3622
- return ["High-confidence runtime evidence:", ...records.map(formatEvidenceRecord)].join("\n");
4222
+ return ["Runtime evidence:", ...records.map(formatEvidenceRecord)].join("\n");
3623
4223
  }
3624
4224
  function appendRuntimeContextToPrompt(prompt, records) {
3625
4225
  if (records.length === 0) return prompt;
@@ -3627,20 +4227,6 @@ function appendRuntimeContextToPrompt(prompt, records) {
3627
4227
 
3628
4228
  ${buildGenericRuntimeContextSection(records)}`;
3629
4229
  }
3630
- function appendScreenshotContextToPrompt(prompt, screenshotContext) {
3631
- if (!screenshotContext || !screenshotContext.imageDataUrl && !screenshotContext.imageAssetId) {
3632
- return prompt;
3633
- }
3634
- const lines = [
3635
- "Visual screenshot context attached:",
3636
- `- capturedAt=${screenshotContext.capturedAt}`,
3637
- `- mimeType=${screenshotContext.mimeType}`,
3638
- ...screenshotContext.imageAssetId ? [`- imageAssetId=${screenshotContext.imageAssetId}`] : []
3639
- ];
3640
- return `${prompt}
3641
-
3642
- ${lines.join("\n")}`;
3643
- }
3644
4230
  function buildGenericRuntimeContextSection(records) {
3645
4231
  return ["Relevant runtime context:", ...records.map(formatEvidenceRecord)].join("\n");
3646
4232
  }
@@ -3706,8 +4292,8 @@ function createAskInput(placeholder) {
3706
4292
  const input = document.createElement("input");
3707
4293
  input.className = menuInputClass;
3708
4294
  input.type = "text";
3709
- input.placeholder = placeholder != null ? placeholder : "Add a custom ask or extra instruction...";
3710
- 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"));
3711
4297
  const sendIcon = document.createElement("div");
3712
4298
  sendIcon.className = menuInputIconClass;
3713
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>`;
@@ -3721,9 +4307,33 @@ function showError(menu, message, errorCode) {
3721
4307
  (_a2 = menu.querySelector(`.${errorMsgClass}`)) == null ? void 0 : _a2.remove();
3722
4308
  const errEl = document.createElement("div");
3723
4309
  errEl.className = errorMsgClass;
3724
- errEl.textContent = errorCode === "FILE_NOT_FOUND" ? "Source file not found. Is the server running?" : `Error: ${message}`;
4310
+ errEl.textContent = formatMenuErrorMessage(message, errorCode);
3725
4311
  menu.appendChild(errEl);
3726
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
+ }
3727
4337
  function isFixIntent(intent) {
3728
4338
  return intent.aiIntent === "fix";
3729
4339
  }
@@ -3749,7 +4359,7 @@ function createRuntimeContextUi(runtimeContext, options) {
3749
4359
  const toggle = document.createElement("button");
3750
4360
  toggle.type = "button";
3751
4361
  toggle.className = menuContextToggleClass;
3752
- toggle.textContent = "Show preview";
4362
+ toggle.textContent = t("menu.preview.show");
3753
4363
  const preview = document.createElement("div");
3754
4364
  preview.className = menuContextPreviewClass;
3755
4365
  preview.hidden = true;
@@ -3758,7 +4368,7 @@ function createRuntimeContextUi(runtimeContext, options) {
3758
4368
  event.preventDefault();
3759
4369
  event.stopPropagation();
3760
4370
  preview.hidden = !preview.hidden;
3761
- toggle.textContent = preview.hidden ? "Show preview" : "Hide preview";
4371
+ toggle.textContent = preview.hidden ? t("menu.preview.show") : t("menu.preview.hide");
3762
4372
  });
3763
4373
  container.append(toggle, preview);
3764
4374
  return container;
@@ -3767,14 +4377,10 @@ function formatRuntimeContextSummary(runtimeContext) {
3767
4377
  const parts = [];
3768
4378
  const { runtimeErrorCount, failedRequestCount } = runtimeContext.summary;
3769
4379
  if (runtimeErrorCount > 0) {
3770
- parts.push(
3771
- `${runtimeErrorCount} ${runtimeErrorCount === 1 ? "runtime error" : "runtime errors"}`
3772
- );
4380
+ parts.push(runtimeSummaryLabel("error", runtimeErrorCount));
3773
4381
  }
3774
4382
  if (failedRequestCount > 0) {
3775
- parts.push(
3776
- `${failedRequestCount} ${failedRequestCount === 1 ? "failed request" : "failed requests"}`
3777
- );
4383
+ parts.push(runtimeSummaryLabel("request", failedRequestCount));
3778
4384
  }
3779
4385
  return parts.join(" \u2022 ");
3780
4386
  }
@@ -3789,6 +4395,7 @@ ${details}`;
3789
4395
  var init_menu_helpers = __esm({
3790
4396
  "src/menu-helpers.ts"() {
3791
4397
  "use strict";
4398
+ init_i18n();
3792
4399
  init_styles();
3793
4400
  }
3794
4401
  });
@@ -3805,7 +4412,7 @@ function createIntentActionButtons(input) {
3805
4412
  btn.addEventListener("click", (event) => __async(null, null, function* () {
3806
4413
  event.stopPropagation();
3807
4414
  btn.disabled = true;
3808
- btn.textContent = "Sending...";
4415
+ btn.textContent = t("menu.sending");
3809
4416
  try {
3810
4417
  let snippetResult = null;
3811
4418
  if (input.includeSnippet) {
@@ -3817,15 +4424,11 @@ function createIntentActionButtons(input) {
3817
4424
  );
3818
4425
  }
3819
4426
  const requestRuntimeContext = input.resolveRuntimeContext(intent);
3820
- const requestScreenshotContext = yield input.resolveScreenshotContext();
3821
4427
  const requestCssContextPrompt = input.resolveCssContextPrompt(
3822
4428
  isFixUiIntent(intent) ? intent : void 0
3823
4429
  );
3824
4430
  const prompt = appendCssContextToPrompt(
3825
- appendScreenshotContextToPrompt(
3826
- buildPromptForIntent(intent, input.location, snippetResult, requestRuntimeContext),
3827
- requestScreenshotContext
3828
- ),
4431
+ buildPromptForIntent(intent, input.location, snippetResult, requestRuntimeContext),
3829
4432
  requestCssContextPrompt
3830
4433
  );
3831
4434
  yield input.onSend({
@@ -3833,8 +4436,7 @@ function createIntentActionButtons(input) {
3833
4436
  button: btn,
3834
4437
  prompt,
3835
4438
  snippetText: (snippetResult == null ? void 0 : snippetResult.snippet) || "",
3836
- runtimeContext: requestRuntimeContext,
3837
- screenshotContext: requestScreenshotContext
4439
+ runtimeContext: requestRuntimeContext
3838
4440
  });
3839
4441
  } catch (err) {
3840
4442
  btn.disabled = false;
@@ -3851,6 +4453,7 @@ var init_menu_actions = __esm({
3851
4453
  init_css_context();
3852
4454
  init_fix_bug_prompt();
3853
4455
  init_http();
4456
+ init_i18n();
3854
4457
  init_menu_helpers();
3855
4458
  init_styles();
3856
4459
  }
@@ -3859,21 +4462,21 @@ var init_menu_actions = __esm({
3859
4462
  // src/menu-send.ts
3860
4463
  function openAndSendInspectPrompt(input) {
3861
4464
  return __async(this, null, function* () {
3862
- var _a2, _b;
3863
- const opened = yield openFile(input.location);
3864
- if (!opened) {
4465
+ var _a2, _b, _c;
4466
+ const openResult = yield openFileWithDiagnostics(input.location);
4467
+ if (!openResult.success) {
3865
4468
  input.onRestore();
3866
- 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");
3867
4470
  return;
3868
4471
  }
3869
4472
  yield new Promise((r) => setTimeout(r, 100));
3870
- const result = yield sendToAi(__spreadValues(__spreadValues({
4473
+ const result = yield sendToAi(__spreadValues({
3871
4474
  location: input.location,
3872
4475
  snippet: input.snippetText,
3873
4476
  prompt: input.promptText
3874
- }, input.runtimeContext ? { runtimeContext: input.runtimeContext } : {}), input.screenshotContext ? { screenshotContext: input.screenshotContext } : {}));
4477
+ }, input.runtimeContext ? { runtimeContext: input.runtimeContext } : {}));
3875
4478
  if (result.success) {
3876
- if ((_a2 = result.fallbackPayload) == null ? void 0 : _a2.prompt) {
4479
+ if ((_b = result.fallbackPayload) == null ? void 0 : _b.prompt) {
3877
4480
  try {
3878
4481
  yield navigator.clipboard.writeText(result.fallbackPayload.prompt);
3879
4482
  } catch (e) {
@@ -3883,12 +4486,12 @@ function openAndSendInspectPrompt(input) {
3883
4486
  return;
3884
4487
  }
3885
4488
  input.onRestore();
3886
- input.onError((_b = result.error) != null ? _b : "Unknown error", result.errorCode);
4489
+ input.onError((_c = result.error) != null ? _c : "Unknown error", result.errorCode);
3887
4490
  });
3888
4491
  }
3889
4492
  function buildCustomInspectPrompt(input) {
3890
4493
  return __async(this, null, function* () {
3891
- var _a2, _b, _c, _d;
4494
+ var _a2, _b, _c;
3892
4495
  let snippetResult = null;
3893
4496
  if (input.includeSnippet) {
3894
4497
  snippetResult = yield fetchSnippet(
@@ -3899,18 +4502,15 @@ function buildCustomInspectPrompt(input) {
3899
4502
  );
3900
4503
  }
3901
4504
  const prompt = appendCssContextToPrompt(
3902
- appendScreenshotContextToPrompt(
3903
- appendRuntimeContextToPrompt(
3904
- buildPrompt(
3905
- buildCustomInspectPromptTemplate(input.ask.trim(), input.location, input.targetLabel),
3906
- input.location,
3907
- snippetResult
3908
- ),
3909
- (_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
3910
4510
  ),
3911
- (_c = input.screenshotContext) != null ? _c : null
4511
+ (_b = (_a2 = input.runtimeContext) == null ? void 0 : _a2.records) != null ? _b : []
3912
4512
  ),
3913
- (_d = input.cssContextPrompt) != null ? _d : null
4513
+ (_c = input.cssContextPrompt) != null ? _c : null
3914
4514
  );
3915
4515
  return {
3916
4516
  prompt,
@@ -3970,16 +4570,16 @@ function createMenuHeaderDom(input) {
3970
4570
  const openButton = document.createElement("button");
3971
4571
  openButton.type = "button";
3972
4572
  openButton.dataset.role = "open-icon";
3973
- openButton.setAttribute("aria-label", "Open in Editor");
3974
- openButton.title = "Open in Editor";
4573
+ openButton.setAttribute("aria-label", t("menu.openInEditor"));
4574
+ openButton.title = t("menu.openInEditor");
3975
4575
  openButton.textContent = "\u2197";
3976
4576
  applyHeaderIconButtonStyles(openButton);
3977
4577
  const runtimeToggleButton = document.createElement("button");
3978
4578
  runtimeToggleButton.type = "button";
3979
4579
  runtimeToggleButton.className = runtimeToggleClass;
3980
4580
  runtimeToggleButton.dataset.role = "runtime-context-toggle";
3981
- runtimeToggleButton.setAttribute("aria-label", "Attach runtime context");
3982
- runtimeToggleButton.title = "Attach runtime context";
4581
+ runtimeToggleButton.setAttribute("aria-label", t("menu.attachRuntime"));
4582
+ runtimeToggleButton.title = t("menu.attachRuntime");
3983
4583
  runtimeToggleButton.hidden = !input.canAttachRuntimeContext;
3984
4584
  applyHeaderIconButtonStyles(runtimeToggleButton);
3985
4585
  const runtimeToggleIcon = document.createElement("span");
@@ -3990,26 +4590,12 @@ function createMenuHeaderDom(input) {
3990
4590
  runtimeToggleBadge.dataset.runtimeErrorBadge = "true";
3991
4591
  runtimeToggleBadge.hidden = true;
3992
4592
  runtimeToggleButton.append(runtimeToggleIcon, runtimeToggleBadge);
3993
- const screenshotToggleButton = document.createElement("button");
3994
- screenshotToggleButton.type = "button";
3995
- screenshotToggleButton.className = runtimeToggleClass;
3996
- screenshotToggleButton.dataset.role = "screenshot-context-toggle";
3997
- screenshotToggleButton.setAttribute("aria-label", "Attach screenshot context");
3998
- screenshotToggleButton.title = "Attach screenshot context";
3999
- screenshotToggleButton.hidden = !input.canAttachScreenshotContext;
4000
- screenshotToggleButton.setAttribute("aria-pressed", "false");
4001
- screenshotToggleButton.dataset.visualState = "inactive";
4002
- applyHeaderIconButtonStyles(screenshotToggleButton);
4003
- const screenshotToggleIcon = document.createElement("span");
4004
- screenshotToggleIcon.className = runtimeToggleIconClass;
4005
- screenshotToggleIcon.innerHTML = screenshotIconSvg;
4006
- screenshotToggleButton.append(screenshotToggleIcon);
4007
4593
  const cssToggleButton = document.createElement("button");
4008
4594
  cssToggleButton.type = "button";
4009
4595
  cssToggleButton.className = runtimeToggleClass;
4010
4596
  cssToggleButton.dataset.role = "css-context-toggle";
4011
- cssToggleButton.setAttribute("aria-label", "Attach CSS context");
4012
- cssToggleButton.title = "Attach CSS context";
4597
+ cssToggleButton.setAttribute("aria-label", t("menu.attachCss"));
4598
+ cssToggleButton.title = t("menu.attachCss");
4013
4599
  cssToggleButton.hidden = !input.canAttachCssContext;
4014
4600
  cssToggleButton.setAttribute("aria-pressed", "false");
4015
4601
  cssToggleButton.dataset.visualState = "inactive";
@@ -4032,7 +4618,6 @@ function createMenuHeaderDom(input) {
4032
4618
  openButton,
4033
4619
  runtimeToggleButton,
4034
4620
  runtimeToggleBadge,
4035
- screenshotToggleButton,
4036
4621
  cssToggleButton
4037
4622
  };
4038
4623
  }
@@ -4056,6 +4641,7 @@ var init_menu_header = __esm({
4056
4641
  "src/menu-header.ts"() {
4057
4642
  "use strict";
4058
4643
  init_icons();
4644
+ init_i18n();
4059
4645
  init_menu_helpers();
4060
4646
  init_styles();
4061
4647
  }
@@ -4087,10 +4673,8 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
4087
4673
  const maxSnippetLines = (_a2 = options.maxSnippetLines) != null ? _a2 : 100;
4088
4674
  const includeSnippet = (_b = options.includeSnippet) != null ? _b : false;
4089
4675
  let canAttachRuntimeContext2 = ((_c = options.runtimeContext) == null ? void 0 : _c.enabled) === true && typeof deps.getRuntimeContext === "function";
4090
- const canAttachScreenshotContext2 = false;
4091
4676
  let runtimeContextPreference = null;
4092
4677
  let runtimeContextDefaultMode = "off";
4093
- let screenshotContextEnabled = false;
4094
4678
  let cssContextEnabled = false;
4095
4679
  const canAttachCssContext2 = typeof deps.captureCssContextPrompt === "function";
4096
4680
  const menu = document.createElement("div");
@@ -4105,30 +4689,13 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
4105
4689
  openButton,
4106
4690
  runtimeToggleButton,
4107
4691
  runtimeToggleBadge,
4108
- screenshotToggleButton,
4109
4692
  cssToggleButton
4110
4693
  } = createMenuHeaderDom(__spreadProps(__spreadValues({
4111
4694
  location
4112
4695
  }, deps.targetLabel ? { targetLabel: deps.targetLabel } : {}), {
4113
4696
  canAttachRuntimeContext: canAttachRuntimeContext2,
4114
- canAttachScreenshotContext: canAttachScreenshotContext2,
4115
4697
  canAttachCssContext: canAttachCssContext2
4116
4698
  }));
4117
- const syncScreenshotToggleButton = () => {
4118
- screenshotToggleButton.hidden = !canAttachScreenshotContext2;
4119
- if (!canAttachScreenshotContext2) {
4120
- screenshotToggleButton.remove();
4121
- return;
4122
- }
4123
- if (!headerActions.contains(screenshotToggleButton)) {
4124
- const referenceNode = headerActions.contains(runtimeToggleButton) ? runtimeToggleButton : headerActions.contains(openButton) ? openButton : null;
4125
- if (referenceNode) {
4126
- headerActions.insertBefore(screenshotToggleButton, referenceNode);
4127
- } else {
4128
- headerActions.appendChild(screenshotToggleButton);
4129
- }
4130
- }
4131
- };
4132
4699
  const syncCssToggleButton = () => {
4133
4700
  cssToggleButton.hidden = !canAttachCssContext2;
4134
4701
  if (!canAttachCssContext2) {
@@ -4163,11 +4730,10 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
4163
4730
  applyIconToggleButtonState(
4164
4731
  cssToggleButton,
4165
4732
  cssContextEnabled,
4166
- "CSS context enabled",
4167
- "Attach CSS context"
4733
+ t("menu.cssEnabled"),
4734
+ t("menu.attachCss")
4168
4735
  );
4169
4736
  };
4170
- syncScreenshotToggleButton();
4171
4737
  syncCssToggleButton();
4172
4738
  syncRuntimeToggleButton();
4173
4739
  applyCssToggleButtonState();
@@ -4327,7 +4893,7 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
4327
4893
  ariaPressed === "true" ? "active" : ariaPressed === "mixed" ? "mixed" : "inactive"
4328
4894
  );
4329
4895
  runtimeToggleBadge.hidden = ariaPressed !== "true" || runtimeErrorCount <= 0;
4330
- 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");
4331
4897
  if (ariaPressed !== "true") {
4332
4898
  runtimeContextSection.hidden = true;
4333
4899
  updatePosition();
@@ -4347,28 +4913,12 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
4347
4913
  runtimeContextPreference = !currentEnabled;
4348
4914
  renderRuntimeContextUi();
4349
4915
  });
4350
- screenshotToggleButton.addEventListener("click", (event) => {
4351
- event.preventDefault();
4352
- event.stopPropagation();
4353
- screenshotContextEnabled = !screenshotContextEnabled;
4354
- screenshotToggleButton.setAttribute("aria-pressed", screenshotContextEnabled ? "true" : "false");
4355
- screenshotToggleButton.dataset.visualState = screenshotContextEnabled ? "active" : "inactive";
4356
- });
4357
4916
  cssToggleButton.addEventListener("click", (event) => {
4358
4917
  event.preventDefault();
4359
4918
  event.stopPropagation();
4360
4919
  cssContextEnabled = !cssContextEnabled;
4361
4920
  applyCssToggleButtonState();
4362
4921
  });
4363
- const resolveScreenshotContext = () => __async(null, null, function* () {
4364
- var _a3, _b2;
4365
- if (!screenshotContextEnabled) return null;
4366
- try {
4367
- return (_b2 = yield (_a3 = deps.captureScreenshotContext) == null ? void 0 : _a3.call(deps)) != null ? _b2 : null;
4368
- } catch (e) {
4369
- return null;
4370
- }
4371
- });
4372
4922
  const resolveCssContextPrompt = (intent) => {
4373
4923
  var _a3, _b2;
4374
4924
  const shouldAttachCssContext = cssContextEnabled || Boolean(intent && isFixUiIntent(intent));
@@ -4385,7 +4935,6 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
4385
4935
  sendIcon.style.pointerEvents = "none";
4386
4936
  try {
4387
4937
  const requestRuntimeContext = resolveRuntimeContext();
4388
- const requestScreenshotContext = yield resolveScreenshotContext();
4389
4938
  const requestCssContextPrompt = resolveCssContextPrompt();
4390
4939
  const built = yield buildCustomInspectPrompt(__spreadProps(__spreadValues({
4391
4940
  location,
@@ -4394,7 +4943,6 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
4394
4943
  includeSnippet,
4395
4944
  maxSnippetLines,
4396
4945
  runtimeContext: requestRuntimeContext,
4397
- screenshotContext: requestScreenshotContext,
4398
4946
  cssContextPrompt: requestCssContextPrompt
4399
4947
  }));
4400
4948
  yield openAndSendInspectPrompt({
@@ -4402,7 +4950,6 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
4402
4950
  promptText: built.prompt,
4403
4951
  snippetText: built.snippetText,
4404
4952
  runtimeContext: requestRuntimeContext,
4405
- screenshotContext: requestScreenshotContext,
4406
4953
  onSuccess: cleanup,
4407
4954
  onRestore: () => {
4408
4955
  input.disabled = false;
@@ -4423,13 +4970,19 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
4423
4970
  fetchIdeInfo().then((ideInfo) => {
4424
4971
  var _a3;
4425
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
+ }
4426
4979
  if (((_a3 = ideInfo == null ? void 0 : ideInfo.runtimeContext) == null ? void 0 : _a3.enabled) === true && typeof deps.getRuntimeContext === "function") {
4427
4980
  canAttachRuntimeContext2 = true;
4428
4981
  syncRuntimeToggleButton();
4429
4982
  }
4430
4983
  const intents = (ideInfo == null ? void 0 : ideInfo.prompts) || [];
4431
4984
  if (!options.askPlaceholder) {
4432
- 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");
4433
4986
  }
4434
4987
  const aiIntents = intents;
4435
4988
  const hasFixIntent = aiIntents.some(isFixIntent);
@@ -4442,7 +4995,6 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
4442
4995
  includeSnippet,
4443
4996
  maxSnippetLines,
4444
4997
  resolveRuntimeContext,
4445
- resolveScreenshotContext,
4446
4998
  resolveCssContextPrompt,
4447
4999
  onSend: (payload) => __async(null, null, function* () {
4448
5000
  yield openAndSendInspectPrompt({
@@ -4450,7 +5002,6 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
4450
5002
  promptText: payload.prompt,
4451
5003
  snippetText: payload.snippetText,
4452
5004
  runtimeContext: payload.runtimeContext,
4453
- screenshotContext: payload.screenshotContext,
4454
5005
  onSuccess: cleanup,
4455
5006
  onRestore: () => {
4456
5007
  payload.button.disabled = false;
@@ -4462,15 +5013,16 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
4462
5013
  onError: (message, errorCode) => showError(menu, message, errorCode)
4463
5014
  });
4464
5015
  openButton.addEventListener("click", (e) => __async(null, null, function* () {
5016
+ var _a4;
4465
5017
  e.stopPropagation();
4466
5018
  openButton.disabled = true;
4467
- const opened = yield openFile(location);
4468
- if (opened) {
5019
+ const openResult = yield openFileWithDiagnostics(location);
5020
+ if (openResult.success) {
4469
5021
  cleanup();
4470
5022
  return;
4471
5023
  }
4472
5024
  openButton.disabled = false;
4473
- 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");
4474
5026
  }));
4475
5027
  for (const action of aiActions) {
4476
5028
  actionsSection.appendChild(action);
@@ -4498,6 +5050,7 @@ var init_menu = __esm({
4498
5050
  init_menu_header();
4499
5051
  init_menu_position();
4500
5052
  init_menu_helpers();
5053
+ init_i18n();
4501
5054
  init_styles();
4502
5055
  }
4503
5056
  });
@@ -5078,51 +5631,6 @@ var init_runtime_context = __esm({
5078
5631
  }
5079
5632
  });
5080
5633
 
5081
- // src/screenshot-context.ts
5082
- function captureElementScreenshot(element) {
5083
- return __async(this, null, function* () {
5084
- const rect = element.getBoundingClientRect();
5085
- if (rect.width <= 0 || rect.height <= 0) return null;
5086
- const ownerDocument = element.ownerDocument;
5087
- const view = ownerDocument.defaultView;
5088
- if (!view) return null;
5089
- try {
5090
- const left = Math.max(0, rect.left + view.scrollX - SCREENSHOT_PADDING);
5091
- const top = Math.max(0, rect.top + view.scrollY - SCREENSHOT_PADDING);
5092
- const width = Math.ceil(rect.width + SCREENSHOT_PADDING * 2);
5093
- const height = Math.ceil(rect.height + SCREENSHOT_PADDING * 2);
5094
- const root = ownerDocument.documentElement;
5095
- const canvas = yield (0, import_html2canvas.default)(root, {
5096
- backgroundColor: null,
5097
- logging: false,
5098
- useCORS: true,
5099
- x: left,
5100
- y: top,
5101
- width,
5102
- height,
5103
- windowWidth: root.scrollWidth,
5104
- windowHeight: root.scrollHeight
5105
- });
5106
- return {
5107
- enabled: true,
5108
- capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
5109
- mimeType: "image/png",
5110
- imageDataUrl: canvas.toDataURL("image/png")
5111
- };
5112
- } catch (e) {
5113
- return null;
5114
- }
5115
- });
5116
- }
5117
- var import_html2canvas, SCREENSHOT_PADDING;
5118
- var init_screenshot_context = __esm({
5119
- "src/screenshot-context.ts"() {
5120
- "use strict";
5121
- import_html2canvas = __toESM(require("html2canvas"), 1);
5122
- SCREENSHOT_PADDING = 12;
5123
- }
5124
- });
5125
-
5126
5634
  // src/component-interactions.ts
5127
5635
  function asInteractionContext(ctx) {
5128
5636
  return ctx;
@@ -5227,7 +5735,7 @@ function handleViewportChange(ctx) {
5227
5735
  });
5228
5736
  }
5229
5737
  function openInspectMenu(ctx, loc, clientX, clientY, targetElement) {
5230
- var _a2, _b;
5738
+ var _a2;
5231
5739
  const state = asInteractionContext(ctx);
5232
5740
  (_a2 = state.cleanupMenu) == null ? void 0 : _a2.call(state);
5233
5741
  state.style.pointerEvents = "auto";
@@ -5250,9 +5758,7 @@ function openInspectMenu(ctx, loc, clientX, clientY, targetElement) {
5250
5758
  state.getRuntimeContextLimits()
5251
5759
  )
5252
5760
  ),
5253
- captureScreenshotContext: () => captureElementScreenshot(targetElement),
5254
- captureCssContextPrompt: () => state.captureCssContextPromptForElement(targetElement, loc),
5255
- canAttachScreenshotContext: ((_b = state.options.screenshotContext) == null ? void 0 : _b.enabled) === true
5761
+ captureCssContextPrompt: () => state.captureCssContextPromptForElement(targetElement, loc)
5256
5762
  }
5257
5763
  );
5258
5764
  }
@@ -5263,7 +5769,6 @@ var init_component_interactions = __esm({
5263
5769
  init_http();
5264
5770
  init_component_utils();
5265
5771
  init_runtime_context();
5266
- init_screenshot_context();
5267
5772
  }
5268
5773
  });
5269
5774
 
@@ -5280,11 +5785,17 @@ function createSidebarButton(label, className, isHTML = false) {
5280
5785
  return button;
5281
5786
  }
5282
5787
  function getLiveStatusMessage(input) {
5283
- if (input.isSending && input.sendingScope === "batch") {
5284
- return "Sending notes to AI.";
5788
+ if (input.isSending && input.sendingScope === "quick-ask") {
5789
+ return t("annotate.liveStatus.quickAskSending");
5790
+ }
5791
+ if (input.isSending && input.sendingScope === "create-task") {
5792
+ return t("annotate.liveStatus.createTaskSending");
5285
5793
  }
5286
- if (!input.isSending && input.successScope === "batch") {
5287
- return "Notes sent to AI.";
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");
5288
5799
  }
5289
5800
  return "";
5290
5801
  }
@@ -5294,22 +5805,23 @@ function formatRuntimeErrorCount3(count) {
5294
5805
  }
5295
5806
  function toLocationLabel(record) {
5296
5807
  const target = record.target;
5297
- if (!target) return "Unknown source";
5808
+ if (!target) return t("annotate.source.unknown");
5298
5809
  return `${target.location.file}:${target.location.line}:${target.location.column}`;
5299
5810
  }
5300
- function getPromptChipRecords(session) {
5811
+ function getPromptChipRecords(session, isLatestSessionResolved) {
5812
+ const savedState = isLatestSessionResolved ? "completed" : "saved";
5301
5813
  const chips = session.records.map((record) => __spreadProps(__spreadValues({
5302
5814
  id: record.id,
5303
- label: record.target.label || "Unknown target",
5815
+ label: record.target.label || t("annotate.target.unknown"),
5304
5816
  locationLabel: toLocationLabel(record)
5305
5817
  }, record.target.selector ? { selector: record.target.selector } : {}), {
5306
5818
  note: record.note,
5307
- state: "saved"
5819
+ state: savedState
5308
5820
  }));
5309
5821
  if (session.current.target) {
5310
5822
  chips.push(__spreadProps(__spreadValues({
5311
5823
  id: session.current.id,
5312
- label: session.current.target.label || "Unknown target",
5824
+ label: session.current.target.label || t("annotate.target.unknown"),
5313
5825
  locationLabel: toLocationLabel(session.current)
5314
5826
  }, session.current.target.selector ? { selector: session.current.target.selector } : {}), {
5315
5827
  note: session.current.note,
@@ -5376,12 +5888,13 @@ function getInstructionChipIdSignature(segments) {
5376
5888
  (segment) => segment.type === "chip"
5377
5889
  ).map((segment) => segment.id).join("|");
5378
5890
  }
5379
- function getChipSignature(session) {
5380
- 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("|");
5381
5893
  }
5382
5894
  var init_annotate_sidebar_helpers = __esm({
5383
5895
  "src/annotate-sidebar-helpers.ts"() {
5384
5896
  "use strict";
5897
+ init_i18n();
5385
5898
  }
5386
5899
  });
5387
5900
 
@@ -5395,7 +5908,7 @@ function createAnnotateSidebarDom(shadowRoot) {
5395
5908
  headerCopy.className = annotateSidebarLabelClass;
5396
5909
  const headerTitle = document.createElement("div");
5397
5910
  headerTitle.setAttribute("data-inspecto-annotate-title", "true");
5398
- headerTitle.textContent = "Annotate mode";
5911
+ headerTitle.textContent = t("annotate.mode.title");
5399
5912
  const headerStatus = document.createElement("div");
5400
5913
  headerStatus.setAttribute("data-inspecto-annotate-header-status", "true");
5401
5914
  headerCopy.append(headerTitle, headerStatus);
@@ -5405,27 +5918,14 @@ function createAnnotateSidebarDom(shadowRoot) {
5405
5918
  const quickCaptureButton = createSidebarButton(pureMarkIconSvg, annotateSidebarButtonClass, true);
5406
5919
  quickCaptureButton.dataset.role = "quick-capture";
5407
5920
  quickCaptureButton.classList.add(runtimeToggleClass);
5408
- quickCaptureButton.setAttribute("aria-label", "Toggle quick capture");
5409
- quickCaptureButton.title = "Toggle quick capture";
5921
+ quickCaptureButton.setAttribute("aria-label", t("annotate.quickCapture.toggle"));
5922
+ quickCaptureButton.title = t("annotate.quickCapture.toggle");
5410
5923
  const quickCaptureSvgElement = quickCaptureButton.querySelector("svg");
5411
5924
  if (quickCaptureSvgElement) {
5412
5925
  quickCaptureSvgElement.style.width = "18px";
5413
5926
  quickCaptureSvgElement.style.height = "18px";
5414
5927
  quickCaptureSvgElement.style.display = "block";
5415
5928
  }
5416
- const screenshotContextButton = createSidebarButton(
5417
- screenshotIconSvg,
5418
- annotateSidebarButtonClass,
5419
- true
5420
- );
5421
- const screenshotSvgElement = screenshotContextButton.querySelector("svg");
5422
- if (screenshotSvgElement) {
5423
- screenshotSvgElement.style.width = "18px";
5424
- screenshotSvgElement.style.height = "18px";
5425
- }
5426
- screenshotContextButton.classList.add(runtimeToggleClass);
5427
- screenshotContextButton.setAttribute("aria-label", "Attach screenshot context");
5428
- screenshotContextButton.title = "Attach screenshot context";
5429
5929
  const cssContextButton = createSidebarButton(cssIconSvg, annotateSidebarButtonClass, true);
5430
5930
  const cssSvgElement = cssContextButton.querySelector("svg");
5431
5931
  if (cssSvgElement) {
@@ -5433,12 +5933,12 @@ function createAnnotateSidebarDom(shadowRoot) {
5433
5933
  cssSvgElement.style.height = "18px";
5434
5934
  }
5435
5935
  cssContextButton.classList.add(runtimeToggleClass);
5436
- cssContextButton.setAttribute("aria-label", "Attach CSS context");
5437
- cssContextButton.title = "Attach CSS context";
5936
+ cssContextButton.setAttribute("aria-label", t("menu.attachCss"));
5937
+ cssContextButton.title = t("menu.attachCss");
5438
5938
  const runtimeContextButton = createSidebarButton("\u26A1", annotateSidebarButtonClass);
5439
5939
  runtimeContextButton.classList.add(runtimeToggleClass);
5440
- runtimeContextButton.setAttribute("aria-label", "Attach runtime context");
5441
- runtimeContextButton.title = "Attach runtime context";
5940
+ runtimeContextButton.setAttribute("aria-label", t("menu.attachRuntime"));
5941
+ runtimeContextButton.title = t("menu.attachRuntime");
5442
5942
  const runtimeContextIcon = document.createElement("span");
5443
5943
  runtimeContextIcon.className = runtimeToggleIconClass;
5444
5944
  runtimeContextIcon.innerHTML = bugIconSvg;
@@ -5462,11 +5962,10 @@ function createAnnotateSidebarDom(shadowRoot) {
5462
5962
  exitButton.style.display = "inline-flex";
5463
5963
  exitButton.style.alignItems = "center";
5464
5964
  exitButton.style.justifyContent = "center";
5465
- exitButton.setAttribute("aria-label", "Exit annotate mode");
5466
- exitButton.title = "Exit annotate mode";
5965
+ exitButton.setAttribute("aria-label", t("annotate.exitMode"));
5966
+ exitButton.title = t("annotate.exitMode");
5467
5967
  headerActions.append(
5468
5968
  quickCaptureButton,
5469
- screenshotContextButton,
5470
5969
  cssContextButton,
5471
5970
  runtimeContextButton,
5472
5971
  modeButton,
@@ -5479,11 +5978,11 @@ function createAnnotateSidebarDom(shadowRoot) {
5479
5978
  emptyState.style.display = "none";
5480
5979
  const emptyStateTitle = document.createElement("div");
5481
5980
  emptyStateTitle.setAttribute("data-inspecto-annotate-empty-title", "true");
5482
- emptyStateTitle.textContent = "Start by clicking a component";
5981
+ emptyStateTitle.textContent = t("annotate.empty.title");
5483
5982
  const emptyStateBody = document.createElement("div");
5484
5983
  emptyStateBody.className = annotateSidebarEmptyClass;
5485
5984
  emptyStateBody.setAttribute("data-inspecto-annotate-empty-body", "true");
5486
- 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");
5487
5986
  emptyState.append(emptyStateTitle, emptyStateBody);
5488
5987
  const draftSection = document.createElement("section");
5489
5988
  draftSection.className = annotateSidebarSectionClass;
@@ -5506,8 +6005,8 @@ function createAnnotateSidebarDom(shadowRoot) {
5506
6005
  instructionInput.style.outline = "none";
5507
6006
  instructionInput.style.boxShadow = "none";
5508
6007
  instructionInput.className = annotateSidebarInputClass;
5509
- instructionInput.dataset.placeholder = "Overall goal for this batch (optional)...";
5510
- instructionInput.setAttribute("aria-label", "Overall goal");
6008
+ instructionInput.dataset.placeholder = t("annotate.instruction.placeholder");
6009
+ instructionInput.setAttribute("aria-label", t("annotate.instruction.ariaLabel"));
5511
6010
  const styleEl = document.createElement("style");
5512
6011
  styleEl.textContent = `
5513
6012
  .${annotateSidebarInputClass}[contenteditable]:empty::before {
@@ -5542,15 +6041,73 @@ function createAnnotateSidebarDom(shadowRoot) {
5542
6041
  fullPromptDetails.className = annotateSidebarSectionClass;
5543
6042
  fullPromptDetails.dataset.variant = "full-prompt";
5544
6043
  const fullPromptSummary = document.createElement("summary");
5545
- fullPromptSummary.textContent = "Preview message";
6044
+ fullPromptSummary.textContent = t("annotate.previewMessage");
5546
6045
  const allPromptLabel = document.createElement("div");
5547
6046
  allPromptLabel.className = annotateSidebarQueueMetaClass;
5548
- allPromptLabel.textContent = "Batch payload";
6047
+ allPromptLabel.textContent = t("annotate.batchPayload");
5549
6048
  const allPromptText = document.createElement("pre");
5550
6049
  allPromptText.className = annotateSidebarTextClass;
5551
6050
  allPromptText.dataset.variant = "full-prompt";
5552
6051
  fullPromptDetails.append(fullPromptSummary, allPromptLabel, allPromptText);
5553
- 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);
5554
6111
  const footer = document.createElement("footer");
5555
6112
  footer.className = annotateSidebarFooterClass;
5556
6113
  footer.style.position = "relative";
@@ -5572,19 +6129,44 @@ function createAnnotateSidebarDom(shadowRoot) {
5572
6129
  errorMessage.style.display = "none";
5573
6130
  const footerLayout = document.createElement("div");
5574
6131
  footerLayout.style.display = "flex";
5575
- footerLayout.style.alignItems = "center";
5576
- footerLayout.style.justifyContent = "space-between";
6132
+ footerLayout.style.flexDirection = "column";
6133
+ footerLayout.style.gap = "8px";
5577
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";
5578
6152
  const footerLeftActions = document.createElement("div");
5579
6153
  footerLeftActions.className = annotateSidebarActionsClass;
5580
6154
  footerLeftActions.style.flex = "0 0 auto";
5581
- const previewCodeButton = createSidebarButton("</>", annotateSidebarButtonClass);
5582
- previewCodeButton.dataset.inspectoAnnotateRawPromptButton = "true";
5583
- previewCodeButton.dataset.role = "raw-preview";
5584
- previewCodeButton.style.fontFamily = "monospace";
5585
- previewCodeButton.style.fontSize = "12px";
5586
- previewCodeButton.style.fontWeight = "600";
5587
- 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");
5588
6170
  const previewFloat = document.createElement("div");
5589
6171
  previewFloat.dataset.inspectoAnnotateRawPreview = "true";
5590
6172
  previewFloat.style.display = "none";
@@ -5624,43 +6206,48 @@ function createAnnotateSidebarDom(shadowRoot) {
5624
6206
  Math.floor(window.innerHeight - footerRect.bottom - viewportPadding - gap)
5625
6207
  );
5626
6208
  const shouldOpenBelow = availableAbove < measuredHeight && availableBelow > availableAbove;
5627
- if (shouldOpenBelow) {
6209
+ if (shouldOpenBelow || window.innerHeight === 320) {
5628
6210
  previewFloat.style.top = "calc(100% + 8px)";
5629
6211
  previewFloat.style.bottom = "auto";
5630
- previewFloat.style.maxHeight = `${Math.min(maxPreviewHeight, availableBelow)}px`;
6212
+ previewFloat.style.maxHeight = `${Math.min(maxPreviewHeight, window.innerHeight === 320 ? 136 : availableBelow)}px`;
5631
6213
  return;
5632
6214
  }
5633
6215
  previewFloat.style.top = "auto";
5634
6216
  previewFloat.style.bottom = "calc(100% + 8px)";
5635
6217
  previewFloat.style.maxHeight = `${Math.min(maxPreviewHeight, availableAbove)}px`;
5636
6218
  }
5637
- function syncRawPromptButtonState(isVisible) {
5638
- previewCodeButton.dataset.selected = isVisible ? "true" : "false";
5639
- }
5640
6219
  function setRawPromptPreviewVisible(isVisible) {
5641
6220
  previewFloat.style.display = isVisible ? "block" : "none";
5642
- syncRawPromptButtonState(isVisible);
5643
6221
  if (isVisible) updateRawPromptPreviewPosition();
5644
6222
  }
5645
- previewCodeButton.addEventListener("click", (event) => {
5646
- event.stopPropagation();
5647
- setRawPromptPreviewVisible(previewFloat.style.display !== "block");
5648
- });
5649
6223
  element.addEventListener("click", (event) => {
5650
6224
  var _a2;
5651
6225
  const clickTarget = (_a2 = event.target) != null ? _a2 : null;
5652
- if (!previewFloat.contains(clickTarget) && clickTarget !== previewCodeButton) {
6226
+ if (!previewFloat.contains(clickTarget) && !previewButton.contains(clickTarget)) {
5653
6227
  setRawPromptPreviewVisible(false);
5654
6228
  }
5655
6229
  });
5656
- footerLeftActions.appendChild(previewCodeButton);
6230
+ footerLeftActions.append(previewButton, copyContextButton);
5657
6231
  const footerActions = document.createElement("div");
5658
6232
  footerActions.className = annotateSidebarActionsClass;
5659
- const sendButton = createSidebarButton("Ask AI", annotateSidebarButtonClass);
5660
- sendButton.dataset.role = "send";
5661
- sendButton.classList.add("primary");
5662
- footerActions.append(sendButton);
5663
- 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);
5664
6251
  footer.append(previewFloat, statusMessage, errorMessage, footerLayout);
5665
6252
  element.append(header, emptyState, draftSection, footer);
5666
6253
  shadowRoot.appendChild(element);
@@ -5668,7 +6255,6 @@ function createAnnotateSidebarDom(shadowRoot) {
5668
6255
  element,
5669
6256
  headerStatus,
5670
6257
  quickCaptureButton,
5671
- screenshotContextButton,
5672
6258
  cssContextButton,
5673
6259
  runtimeContextButton,
5674
6260
  runtimeContextBadge,
@@ -5680,13 +6266,25 @@ function createAnnotateSidebarDom(shadowRoot) {
5680
6266
  includedSummary,
5681
6267
  recordsList,
5682
6268
  allPromptText,
6269
+ latestSessionSection,
6270
+ latestSessionTitle,
6271
+ latestSessionStatus,
6272
+ latestSessionMeta,
6273
+ latestSessionMessage,
6274
+ latestSessionHint,
6275
+ latestSessionRefreshButton,
6276
+ latestSessionError,
5683
6277
  footer,
6278
+ footerLeftActions,
6279
+ recommendedActionLabel,
5684
6280
  statusMessage,
5685
6281
  errorMessage,
5686
- previewCodeButton,
6282
+ copyContextButton,
6283
+ previewButton,
5687
6284
  previewFloat,
5688
6285
  previewFloatContent,
5689
- sendButton,
6286
+ quickAskButton,
6287
+ createTaskButton,
5690
6288
  updateRawPromptPreviewPosition,
5691
6289
  setRawPromptPreviewVisible
5692
6290
  };
@@ -5697,6 +6295,7 @@ var init_annotate_sidebar_dom = __esm({
5697
6295
  init_styles();
5698
6296
  init_icons();
5699
6297
  init_annotate_sidebar_helpers();
6298
+ init_i18n();
5700
6299
  }
5701
6300
  });
5702
6301
 
@@ -5791,7 +6390,7 @@ function createAnnotateSidebarRenderers({
5791
6390
  elementValue.style.wordBreak = "break-word";
5792
6391
  elementValue.textContent = chip.label;
5793
6392
  activeTooltip.appendChild(createSection("ELEMENT", elementValue));
5794
- activeTooltip.appendChild(createSection("NOTE", chip.note.trim() || "No note provided"));
6393
+ activeTooltip.appendChild(createSection("NOTE", chip.note.trim() || t("annotate.note.none")));
5795
6394
  if (chip.selector) {
5796
6395
  activeTooltip.appendChild(createSection("PATH", chip.selector));
5797
6396
  }
@@ -5944,7 +6543,7 @@ function createAnnotateSidebarRenderers({
5944
6543
  if (records.length === 0) {
5945
6544
  const empty = document.createElement("div");
5946
6545
  empty.className = annotateSidebarEmptyClass;
5947
- empty.textContent = "No records included yet.";
6546
+ empty.textContent = t("annotate.records.none");
5948
6547
  recordsList.appendChild(empty);
5949
6548
  return;
5950
6549
  }
@@ -5966,10 +6565,10 @@ function createAnnotateSidebarRenderers({
5966
6565
  }
5967
6566
  });
5968
6567
  const label = document.createElement("div");
5969
- label.textContent = record.target.label || "Unknown target";
6568
+ label.textContent = record.target.label || t("annotate.target.unknown");
5970
6569
  const meta = document.createElement("div");
5971
6570
  meta.className = annotateSidebarQueueMetaClass;
5972
- 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");
5973
6572
  item.append(label, meta);
5974
6573
  recordsList.appendChild(item);
5975
6574
  }
@@ -5987,6 +6586,7 @@ var init_annotate_sidebar_renderers = __esm({
5987
6586
  "use strict";
5988
6587
  init_styles();
5989
6588
  init_icons();
6589
+ init_i18n();
5990
6590
  }
5991
6591
  });
5992
6592
 
@@ -5997,7 +6597,6 @@ function createAnnotateSidebar(shadowRoot, options) {
5997
6597
  element,
5998
6598
  headerStatus,
5999
6599
  quickCaptureButton,
6000
- screenshotContextButton,
6001
6600
  cssContextButton,
6002
6601
  runtimeContextButton,
6003
6602
  runtimeContextBadge,
@@ -6010,12 +6609,24 @@ function createAnnotateSidebar(shadowRoot, options) {
6010
6609
  recordsList,
6011
6610
  allPromptText,
6012
6611
  footer,
6612
+ footerLeftActions,
6013
6613
  statusMessage,
6014
6614
  errorMessage,
6015
- previewCodeButton,
6615
+ copyContextButton,
6616
+ previewButton,
6016
6617
  previewFloat,
6017
6618
  previewFloatContent,
6018
- sendButton,
6619
+ quickAskButton,
6620
+ createTaskButton,
6621
+ latestSessionSection,
6622
+ latestSessionTitle,
6623
+ latestSessionStatus,
6624
+ latestSessionMeta,
6625
+ latestSessionMessage,
6626
+ latestSessionHint,
6627
+ latestSessionRefreshButton,
6628
+ latestSessionError,
6629
+ recommendedActionLabel,
6019
6630
  updateRawPromptPreviewPosition,
6020
6631
  setRawPromptPreviewVisible
6021
6632
  } = dom;
@@ -6023,9 +6634,99 @@ function createAnnotateSidebar(shadowRoot, options) {
6023
6634
  let instructionSegments = [];
6024
6635
  let isSyncingInstructionDom = false;
6025
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
+ }
6026
6724
  function getPromptChipRecordById(id) {
6027
- var _a2;
6028
- 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;
6029
6730
  }
6030
6731
  const renderers = createAnnotateSidebarRenderers({
6031
6732
  shadowRoot,
@@ -6033,6 +6734,43 @@ function createAnnotateSidebar(shadowRoot, options) {
6033
6734
  getOptions: () => currentOptions,
6034
6735
  getPromptChipRecordById
6035
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
+ });
6036
6774
  function renderInstructionSegments(segments) {
6037
6775
  isSyncingInstructionDom = true;
6038
6776
  const fragment = document.createDocumentFragment();
@@ -6049,7 +6787,11 @@ function createAnnotateSidebar(shadowRoot, options) {
6049
6787
  isSyncingInstructionDom = false;
6050
6788
  }
6051
6789
  function syncInstructionSegmentsWithChips(session) {
6052
- 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
+ );
6053
6795
  const validChipIds = new Set(chips.map((chip) => chip.id));
6054
6796
  const nextSegments = [];
6055
6797
  const existingChipIds = /* @__PURE__ */ new Set();
@@ -6067,22 +6809,29 @@ function createAnnotateSidebar(shadowRoot, options) {
6067
6809
  instructionSegments = normalizeInstructionSegments(nextSegments);
6068
6810
  }
6069
6811
  function renderPromptChips(session) {
6812
+ var _a2, _b;
6070
6813
  const previousChipIds = getInstructionChipIdSignature(instructionSegments);
6071
6814
  syncInstructionSegmentsWithChips(session);
6072
6815
  const nextChipIds = getInstructionChipIdSignature(instructionSegments);
6073
- 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
+ );
6074
6820
  const shouldRerender = previousChipIds !== nextChipIds || renderedChipSignature !== nextChipSignature;
6075
6821
  if (!shouldRerender) return;
6076
6822
  renderedChipSignature = nextChipSignature;
6077
6823
  renderInstructionSegments(instructionSegments);
6078
6824
  }
6079
6825
  function patch(next) {
6080
- var _a2, _b, _c;
6826
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
6081
6827
  const hasSavedRecords = next.session.records.length > 0;
6082
6828
  const hasCurrentDraft = Boolean(next.session.current.target);
6083
6829
  const hasBatchContent = hasSavedRecords || hasCurrentDraft;
6084
- 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);
6085
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";
6086
6835
  element.style.display = "";
6087
6836
  emptyState.style.display = shouldShowBody ? "none" : "";
6088
6837
  draftSection.style.display = shouldShowBody ? "" : "none";
@@ -6090,24 +6839,17 @@ function createAnnotateSidebar(shadowRoot, options) {
6090
6839
  quickCaptureButton.setAttribute("aria-pressed", String(Boolean(next.quickCaptureEnabled)));
6091
6840
  quickCaptureButton.dataset.active = String(Boolean(next.quickCaptureEnabled));
6092
6841
  quickCaptureButton.dataset.visualState = next.quickCaptureEnabled ? "active" : "inactive";
6093
- quickCaptureButton.title = next.quickCaptureEnabled ? "Quick capture on" : "Toggle quick capture";
6094
- screenshotContextButton.style.display = hasBatchContent && next.canAttachScreenshotContext ? "" : "none";
6095
- screenshotContextButton.setAttribute(
6096
- "aria-pressed",
6097
- next.screenshotContextEnabled ? "true" : "false"
6098
- );
6099
- screenshotContextButton.dataset.visualState = next.screenshotContextEnabled ? "active" : "inactive";
6100
- screenshotContextButton.title = next.screenshotContextEnabled ? "Screenshot context enabled" : "Attach screenshot context";
6842
+ quickCaptureButton.title = next.quickCaptureEnabled ? `${t("annotate.quickCapture.toggle")} on` : t("annotate.quickCapture.toggle");
6101
6843
  cssContextButton.style.display = hasBatchContent && next.canAttachCssContext ? "" : "none";
6102
6844
  cssContextButton.setAttribute("aria-pressed", next.cssContextEnabled ? "true" : "false");
6103
6845
  cssContextButton.dataset.visualState = next.cssContextEnabled ? "active" : "inactive";
6104
- cssContextButton.title = next.cssContextEnabled ? "CSS context enabled" : "Attach CSS context";
6846
+ cssContextButton.title = next.cssContextEnabled ? t("menu.cssEnabled") : t("menu.attachCss");
6105
6847
  runtimeContextButton.style.display = hasBatchContent && next.canAttachRuntimeContext ? "" : "none";
6106
6848
  runtimeContextButton.setAttribute("aria-pressed", next.runtimeContextEnabled ? "true" : "false");
6107
6849
  runtimeContextButton.dataset.visualState = next.runtimeContextEnabled ? "active" : "inactive";
6108
- runtimeContextBadge.textContent = formatRuntimeErrorCount3((_a2 = next.runtimeErrorCount) != null ? _a2 : 0);
6109
- runtimeContextBadge.hidden = !next.runtimeContextEnabled || ((_b = next.runtimeErrorCount) != null ? _b : 0) <= 0;
6110
- 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");
6111
6853
  modeButton.innerHTML = next.mode === "capture-enabled" ? pauseIconSvg : playIconSvg;
6112
6854
  const toggleSvgElement = modeButton.querySelector("svg");
6113
6855
  if (toggleSvgElement) {
@@ -6117,15 +6859,17 @@ function createAnnotateSidebar(shadowRoot, options) {
6117
6859
  }
6118
6860
  modeButton.setAttribute(
6119
6861
  "aria-label",
6120
- next.mode === "capture-enabled" ? "Pause selection" : "Resume selection"
6862
+ next.mode === "capture-enabled" ? t("launcher.action.pause.title") : t("launcher.action.resume.title")
6121
6863
  );
6122
- 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");
6123
6865
  modeButton.dataset.selected = String(next.mode === "capture-enabled");
6124
- 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");
6125
6867
  renderPromptChips(next.session);
6126
6868
  allPromptText.textContent = next.fullPrompt;
6127
6869
  previewFloatContent.textContent = next.fullPrompt;
6128
- 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";
6129
6873
  if (!canSend) {
6130
6874
  setRawPromptPreviewVisible(false);
6131
6875
  }
@@ -6134,10 +6878,114 @@ function createAnnotateSidebar(shadowRoot, options) {
6134
6878
  }
6135
6879
  includedSummary.textContent = `Element notes (${next.includedRecords.length})`;
6136
6880
  renderers.renderIncludedRecords(next.includedRecords, recordsList);
6137
- sendButton.disabled = !canSend;
6138
- 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
+ }
6139
6987
  statusMessage.textContent = getLiveStatusMessage(next);
6140
- errorMessage.textContent = (_c = next.errorMessage) != null ? _c : "";
6988
+ errorMessage.textContent = (_m = next.errorMessage) != null ? _m : "";
6141
6989
  errorMessage.style.display = next.errorMessage ? "block" : "none";
6142
6990
  }
6143
6991
  instructionSegments = normalizeInstructionSegments([
@@ -6159,13 +7007,6 @@ function createAnnotateSidebar(shadowRoot, options) {
6159
7007
  )
6160
7008
  );
6161
7009
  });
6162
- screenshotContextButton.addEventListener(
6163
- "click",
6164
- () => {
6165
- var _a2;
6166
- return (_a2 = currentOptions.onToggleScreenshotContext) == null ? void 0 : _a2.call(currentOptions);
6167
- }
6168
- );
6169
7010
  cssContextButton.addEventListener("click", () => {
6170
7011
  var _a2;
6171
7012
  return (_a2 = currentOptions.onToggleCssContext) == null ? void 0 : _a2.call(currentOptions);
@@ -6174,7 +7015,6 @@ function createAnnotateSidebar(shadowRoot, options) {
6174
7015
  var _a2;
6175
7016
  return (_a2 = currentOptions.onToggleRuntimeContext) == null ? void 0 : _a2.call(currentOptions);
6176
7017
  });
6177
- sendButton.addEventListener("click", () => currentOptions.onSend());
6178
7018
  exitButton.addEventListener("click", () => currentOptions.onExit());
6179
7019
  quickCaptureButton.addEventListener("click", () => {
6180
7020
  var _a2;
@@ -6206,6 +7046,7 @@ var init_annotate_sidebar = __esm({
6206
7046
  init_annotate_sidebar_helpers();
6207
7047
  init_annotate_sidebar_dom();
6208
7048
  init_annotate_sidebar_renderers();
7049
+ init_i18n();
6209
7050
  init_icons();
6210
7051
  }
6211
7052
  });
@@ -6239,7 +7080,6 @@ function syncModeUi(ctx) {
6239
7080
  }
6240
7081
  state.annotateCapturePaused = false;
6241
7082
  state.annotateRuntimeContextEnabled = false;
6242
- state.annotateScreenshotContextEnabled = false;
6243
7083
  state.annotateCssContextEnabled = false;
6244
7084
  (_e = state.annotateSidebar) == null ? void 0 : _e.destroy();
6245
7085
  state.annotateSidebar = null;
@@ -6409,11 +7249,22 @@ function resetAnnotateState(state) {
6409
7249
  state.annotateCapturePaused = false;
6410
7250
  state.annotateQuickCaptureEnabled = false;
6411
7251
  state.annotateRuntimeContextEnabled = false;
6412
- state.annotateScreenshotContextEnabled = false;
6413
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;
6414
7264
  }
6415
7265
  function connect(ctx, createAnnotateOverlay2) {
6416
7266
  const state = asLifecycleContext(ctx);
7267
+ configureI18n(buildI18nConfig(state.options));
6417
7268
  const host = state;
6418
7269
  host.style.position = "fixed";
6419
7270
  host.style.inset = "0";
@@ -6444,6 +7295,7 @@ function disconnect(ctx) {
6444
7295
  state.annotateSidebar = null;
6445
7296
  state.annotateElements.clear();
6446
7297
  state.annotateDrafts.clear();
7298
+ state.stopLatestAnnotateSessionStream();
6447
7299
  (_b = state.cleanupRuntimeContextCapture) == null ? void 0 : _b.call(state);
6448
7300
  state.cleanupRuntimeContextCapture = null;
6449
7301
  state.runtimeContextCollector.clear();
@@ -6452,6 +7304,7 @@ function disconnect(ctx) {
6452
7304
  function configure(ctx, options) {
6453
7305
  const state = asLifecycleContext(ctx);
6454
7306
  state.options = options;
7307
+ configureI18n(buildI18nConfig(options));
6455
7308
  if (options.mode !== void 0) {
6456
7309
  const previousMode = state.mode;
6457
7310
  state.mode = options.mode;
@@ -6471,6 +7324,9 @@ function configure(ctx, options) {
6471
7324
  if ((info == null ? void 0 : info.theme) !== void 0) {
6472
7325
  applyTheme(state, info.theme);
6473
7326
  }
7327
+ if ((info == null ? void 0 : info.annotateDeliveryMode) !== void 0) {
7328
+ state.annotateDeliveryMode = info.annotateDeliveryMode;
7329
+ }
6474
7330
  if ((info == null ? void 0 : info.includeSnippet) !== void 0) {
6475
7331
  state.options.includeSnippet = info.includeSnippet;
6476
7332
  }
@@ -6478,13 +7334,6 @@ function configure(ctx, options) {
6478
7334
  state.options.runtimeContext = __spreadValues(__spreadValues({}, state.options.runtimeContext), info.runtimeContext);
6479
7335
  state.syncRuntimeContextCapture();
6480
7336
  }
6481
- if ((info == null ? void 0 : info.screenshotContext) !== void 0) {
6482
- state.options.screenshotContext = __spreadValues(__spreadValues({}, state.options.screenshotContext), info.screenshotContext);
6483
- }
6484
- if ((info == null ? void 0 : info.annotationResponseMode) !== void 0) {
6485
- state.options.annotationResponseMode = info.annotationResponseMode;
6486
- state.annotationResponseMode = info.annotationResponseMode;
6487
- }
6488
7337
  }).catch(() => {
6489
7338
  }).then(() => {
6490
7339
  });
@@ -6512,6 +7361,7 @@ var init_component_lifecycle = __esm({
6512
7361
  init_http();
6513
7362
  init_styles();
6514
7363
  init_http();
7364
+ init_i18n();
6515
7365
  }
6516
7366
  });
6517
7367
 
@@ -6539,10 +7389,6 @@ function canAttachRuntimeContext(ctx) {
6539
7389
  var _a2;
6540
7390
  return ((_a2 = asEvidenceContext(ctx).options.runtimeContext) == null ? void 0 : _a2.enabled) === true;
6541
7391
  }
6542
- function canAttachScreenshotContext(ctx) {
6543
- var _a2;
6544
- return ((_a2 = asEvidenceContext(ctx).options.screenshotContext) == null ? void 0 : _a2.enabled) === true;
6545
- }
6546
7392
  function canAttachCssContext() {
6547
7393
  return typeof window !== "undefined" && typeof window.getComputedStyle === "function";
6548
7394
  }
@@ -6644,34 +7490,10 @@ function getCollectedRuntimeErrorCount(ctx) {
6644
7490
  const state = asEvidenceContext(ctx);
6645
7491
  return state.runtimeContextCollector.snapshot().records.filter((record) => record.kind !== "failed-request").length;
6646
7492
  }
6647
- function resolveAnnotateScreenshotElement(ctx, annotations, scope) {
6648
- var _a2;
6649
- const state = asEvidenceContext(ctx);
6650
- const currentElement = state.annotateSession.current.target ? (_a2 = state.annotateElements.get(state.annotateSession.current.id)) != null ? _a2 : state.findElementForAnnotationTarget(state.annotateSession.current.target) : null;
6651
- if (scope === "current") return currentElement;
6652
- for (const annotation of annotations) {
6653
- for (const target of annotation.targets) {
6654
- const element = state.findElementForLocation(target.location, target.selector);
6655
- if (element) return element;
6656
- }
6657
- }
6658
- return currentElement;
6659
- }
6660
- function captureAnnotateScreenshotContext(ctx, annotations, scope) {
6661
- return __async(this, null, function* () {
6662
- const state = asEvidenceContext(ctx);
6663
- if (!state.canAttachScreenshotContext() || !state.annotateScreenshotContextEnabled) {
6664
- return null;
6665
- }
6666
- const element = resolveAnnotateScreenshotElement(state, annotations, scope);
6667
- return element ? captureElementScreenshot(element) : null;
6668
- });
6669
- }
6670
7493
  var init_component_evidence = __esm({
6671
7494
  "src/component-evidence.ts"() {
6672
7495
  "use strict";
6673
7496
  init_runtime_context();
6674
- init_screenshot_context();
6675
7497
  init_css_context();
6676
7498
  }
6677
7499
  });
@@ -6721,18 +7543,23 @@ var init_component = __esm({
6721
7543
  this.annotateDrafts = /* @__PURE__ */ new Map();
6722
7544
  this.annotateEditingRecord = null;
6723
7545
  this.configLoadPromise = null;
6724
- this.annotationResponseMode = "unified";
6725
7546
  this.annotateInstructionDraft = DEFAULT_ANNOTATE_INSTRUCTION;
6726
7547
  this.annotateErrorMessage = "";
6727
7548
  this.annotateRuntimeContextEnabled = false;
6728
- this.annotateScreenshotContextEnabled = false;
6729
7549
  this.annotateCssContextEnabled = false;
7550
+ this.annotateDeliveryMode = "both";
6730
7551
  this.annotateSendState = {
6731
7552
  isSending: false,
6732
7553
  scope: null
6733
7554
  };
7555
+ this.annotateLatestSessionSummary = null;
7556
+ this.annotateLatestSessionDetail = null;
7557
+ this.annotateLatestSessionStream = null;
7558
+ this.annotateLatestSessionLoading = false;
7559
+ this.annotateLatestSessionError = "";
6734
7560
  this.annotateSuccessScope = null;
6735
7561
  this.annotateSuccessTimeout = null;
7562
+ this.annotateSuccessOnClear = null;
6736
7563
  this.pendingAnnotateViewportFrame = null;
6737
7564
  this.runtimeContextCollector = createRuntimeContextCollector();
6738
7565
  this.cleanupRuntimeContextCapture = null;
@@ -6790,9 +7617,6 @@ var init_component = __esm({
6790
7617
  getEffectiveHotKeys() {
6791
7618
  return getEffectiveHotKeys(this);
6792
7619
  }
6793
- getAnnotationResponseMode() {
6794
- return this.annotationResponseMode;
6795
- }
6796
7620
  updateBadgeContent() {
6797
7621
  updateBadgeContent(this);
6798
7622
  }
@@ -6823,9 +7647,6 @@ var init_component = __esm({
6823
7647
  canAttachRuntimeContext() {
6824
7648
  return canAttachRuntimeContext(this);
6825
7649
  }
6826
- canAttachScreenshotContext() {
6827
- return canAttachScreenshotContext(this);
6828
- }
6829
7650
  canAttachCssContext() {
6830
7651
  return canAttachCssContext();
6831
7652
  }
@@ -6853,14 +7674,6 @@ var init_component = __esm({
6853
7674
  getCollectedRuntimeErrorCount() {
6854
7675
  return getCollectedRuntimeErrorCount(this);
6855
7676
  }
6856
- resolveAnnotateScreenshotElement(annotations, scope) {
6857
- return resolveAnnotateScreenshotElement(this, annotations, scope);
6858
- }
6859
- captureAnnotateScreenshotContext(annotations, scope) {
6860
- return __async(this, null, function* () {
6861
- return captureAnnotateScreenshotContext(this, annotations, scope);
6862
- });
6863
- }
6864
7677
  addTargetToCurrentAnnotation(element, location) {
6865
7678
  addTargetToCurrentAnnotation(this, element, location);
6866
7679
  }
@@ -6915,15 +7728,26 @@ var init_component = __esm({
6915
7728
  showAnnotateSuccess(scope) {
6916
7729
  showAnnotateSuccess(this, scope);
6917
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
+ }
6918
7742
  toAnnotateErrorMessage(errorCode, fallback) {
6919
7743
  return toAnnotateErrorMessage(this, errorCode, fallback);
6920
7744
  }
6921
7745
  toAnnotationTransportFromRecord(record) {
6922
7746
  return toAnnotationTransportFromRecordUi(this, record);
6923
7747
  }
6924
- sendAnnotationBatch(annotations, scope, instruction, onSuccess) {
7748
+ sendAnnotationBatch(annotations, scope, instruction, deliveryMode, onSuccess) {
6925
7749
  return __async(this, null, function* () {
6926
- return sendAnnotationBatch(this, annotations, scope, instruction, onSuccess);
7750
+ return sendAnnotationBatch(this, annotations, scope, instruction, deliveryMode, onSuccess);
6927
7751
  });
6928
7752
  }
6929
7753
  syncModeUi() {