@inspecto-dev/core 0.3.7 → 0.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/{component-PVWVSPVZ.js → component-MYXLDDWZ.js} +1479 -622
- package/dist/component-MYXLDDWZ.js.map +1 -0
- package/dist/index.cjs +1501 -642
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -6
- package/dist/index.d.ts +11 -6
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/component-PVWVSPVZ.js.map +0 -1
|
@@ -170,38 +170,39 @@ var shortcutIconClass = "ai-shortcut-icon";
|
|
|
170
170
|
var annotateStyles = `
|
|
171
171
|
.${annotateSidebarClass} {
|
|
172
172
|
position: fixed;
|
|
173
|
-
top:
|
|
174
|
-
right:
|
|
173
|
+
top: 18px;
|
|
174
|
+
right: 18px;
|
|
175
175
|
z-index: 2147483647;
|
|
176
|
-
width: min(
|
|
177
|
-
min-height:
|
|
178
|
-
max-height: calc(100vh -
|
|
176
|
+
width: min(408px, calc(100vw - 28px));
|
|
177
|
+
min-height: 240px;
|
|
178
|
+
max-height: calc(100vh - 36px);
|
|
179
179
|
display: flex;
|
|
180
180
|
flex-direction: column;
|
|
181
|
-
gap:
|
|
181
|
+
gap: 16px;
|
|
182
182
|
box-sizing: border-box;
|
|
183
|
-
padding:
|
|
183
|
+
padding: 18px 18px 18px;
|
|
184
184
|
overflow: visible;
|
|
185
185
|
color: var(--inspecto-text-primary);
|
|
186
186
|
background:
|
|
187
|
-
radial-gradient(circle at top right, rgba(
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
border
|
|
191
|
-
|
|
192
|
-
|
|
187
|
+
radial-gradient(circle at top right, rgba(14, 165, 233, 0.18), transparent 36%),
|
|
188
|
+
radial-gradient(circle at top left, rgba(14, 165, 233, 0.08), transparent 28%),
|
|
189
|
+
linear-gradient(180deg, rgba(13, 20, 31, 0.985) 0%, rgba(8, 14, 24, 0.985) 100%);
|
|
190
|
+
border: 1px solid rgba(148, 163, 184, 0.16);
|
|
191
|
+
border-radius: 28px;
|
|
192
|
+
box-shadow: var(--inspecto-shadow-floating);
|
|
193
|
+
font-family: 'SF Pro Display', 'Segoe UI', 'Inter', sans-serif;
|
|
193
194
|
pointer-events: auto;
|
|
194
|
-
backdrop-filter: blur(
|
|
195
|
-
-webkit-backdrop-filter: blur(
|
|
195
|
+
backdrop-filter: blur(18px) saturate(140%);
|
|
196
|
+
-webkit-backdrop-filter: blur(18px) saturate(140%);
|
|
196
197
|
}
|
|
197
198
|
|
|
198
199
|
.${annotateSidebarHeaderClass} {
|
|
199
200
|
display: flex;
|
|
200
201
|
align-items: flex-start;
|
|
201
202
|
justify-content: space-between;
|
|
202
|
-
gap:
|
|
203
|
-
padding-bottom:
|
|
204
|
-
border-bottom: 1px solid rgba(
|
|
203
|
+
gap: 14px;
|
|
204
|
+
padding-bottom: 14px;
|
|
205
|
+
border-bottom: 1px solid rgba(148, 163, 184, 0.14);
|
|
205
206
|
}
|
|
206
207
|
|
|
207
208
|
.${annotateSidebarLabelClass} {
|
|
@@ -213,25 +214,25 @@ var annotateStyles = `
|
|
|
213
214
|
}
|
|
214
215
|
|
|
215
216
|
.${annotateSidebarLabelClass} [data-inspecto-annotate-title="true"] {
|
|
216
|
-
font-size:
|
|
217
|
-
line-height: 1.
|
|
218
|
-
font-weight:
|
|
217
|
+
font-size: 16px;
|
|
218
|
+
line-height: 1.15;
|
|
219
|
+
font-weight: 760;
|
|
219
220
|
color: var(--inspecto-text-primary);
|
|
220
|
-
letter-spacing: 0;
|
|
221
|
+
letter-spacing: -0.02em;
|
|
221
222
|
}
|
|
222
223
|
|
|
223
224
|
.${annotateSidebarLabelClass} [data-inspecto-annotate-header-status="true"] {
|
|
224
225
|
display: inline-flex;
|
|
225
226
|
align-items: center;
|
|
226
227
|
align-self: flex-start;
|
|
227
|
-
min-height:
|
|
228
|
-
padding: 0
|
|
228
|
+
min-height: 26px;
|
|
229
|
+
padding: 0 10px;
|
|
229
230
|
border-radius: var(--inspecto-radius-pill);
|
|
230
|
-
background: rgba(
|
|
231
|
-
border: 1px solid rgba(
|
|
231
|
+
background: rgba(148, 163, 184, 0.1);
|
|
232
|
+
border: 1px solid rgba(148, 163, 184, 0.14);
|
|
232
233
|
font-size: 11px;
|
|
233
234
|
line-height: 1.2;
|
|
234
|
-
font-weight:
|
|
235
|
+
font-weight: 650;
|
|
235
236
|
color: var(--inspecto-text-secondary);
|
|
236
237
|
}
|
|
237
238
|
|
|
@@ -247,18 +248,26 @@ var annotateStyles = `
|
|
|
247
248
|
.${annotateSidebarSectionClass} {
|
|
248
249
|
display: flex;
|
|
249
250
|
flex-direction: column;
|
|
250
|
-
gap:
|
|
251
|
+
gap: 10px;
|
|
251
252
|
min-height: 0;
|
|
252
|
-
padding:
|
|
253
|
-
border: 1px solid rgba(
|
|
254
|
-
border-radius:
|
|
255
|
-
background: rgba(255, 255, 255, 0.
|
|
253
|
+
padding: 14px;
|
|
254
|
+
border: 1px solid rgba(148, 163, 184, 0.12);
|
|
255
|
+
border-radius: 20px;
|
|
256
|
+
background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(148, 163, 184, 0.04) 100%);
|
|
257
|
+
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
|
|
256
258
|
}
|
|
257
259
|
|
|
258
|
-
.${annotateSidebarSectionClass}[data-variant="modes"] { gap: 8px; padding:
|
|
260
|
+
.${annotateSidebarSectionClass}[data-variant="modes"] { gap: 8px; padding: 10px 12px; }
|
|
259
261
|
.${annotateSidebarSectionClass}[data-variant="draft"] { gap: 0; padding: 0; border: none; background: transparent; }
|
|
260
|
-
.${annotateSidebarSectionClass}[data-variant="chip-preview"] { gap: 8px; padding:
|
|
261
|
-
.${annotateSidebarSectionClass}[data-variant="records"] { padding: 0; overflow: hidden; background: rgba(255, 255, 255, 0.
|
|
262
|
+
.${annotateSidebarSectionClass}[data-variant="chip-preview"] { gap: 8px; padding: 12px; background: rgba(255, 255, 255, 0.045); }
|
|
263
|
+
.${annotateSidebarSectionClass}[data-variant="records"] { padding: 0; overflow: hidden; background: rgba(255, 255, 255, 0.038); border-color: rgba(148, 163, 184, 0.16); }
|
|
264
|
+
.${annotateSidebarSectionClass}[data-variant="latest-session"] {
|
|
265
|
+
padding: 14px;
|
|
266
|
+
background:
|
|
267
|
+
radial-gradient(circle at top right, rgba(14, 165, 233, 0.12), transparent 34%),
|
|
268
|
+
linear-gradient(180deg, rgba(255, 255, 255, 0.055) 0%, rgba(148, 163, 184, 0.05) 100%);
|
|
269
|
+
border-color: rgba(14, 165, 233, 0.18);
|
|
270
|
+
}
|
|
262
271
|
.${annotateSidebarSectionClass}[data-variant="full-prompt"] { padding: 0; gap: 0; background: transparent; border: none; border-radius: 0; opacity: 0.72; }
|
|
263
272
|
|
|
264
273
|
.${annotateSidebarSectionClass} h3 {
|
|
@@ -272,25 +281,25 @@ var annotateStyles = `
|
|
|
272
281
|
.${annotateSidebarSectionClass}[data-variant="empty-state"] {
|
|
273
282
|
flex: 1 1 auto;
|
|
274
283
|
justify-content: center;
|
|
275
|
-
gap:
|
|
276
|
-
padding:
|
|
284
|
+
gap: 12px;
|
|
285
|
+
padding: 20px 6px 8px;
|
|
277
286
|
background: transparent;
|
|
278
287
|
border-color: transparent;
|
|
279
288
|
}
|
|
280
289
|
|
|
281
290
|
.${annotateSidebarSectionClass}[data-variant="empty-state"] [data-inspecto-annotate-empty-title="true"] {
|
|
282
|
-
font-size:
|
|
283
|
-
line-height: 1.
|
|
284
|
-
font-weight:
|
|
291
|
+
font-size: 18px;
|
|
292
|
+
line-height: 1.18;
|
|
293
|
+
font-weight: 760;
|
|
285
294
|
color: var(--inspecto-text-primary);
|
|
286
|
-
max-width:
|
|
295
|
+
max-width: 20ch;
|
|
296
|
+
letter-spacing: -0.03em;
|
|
287
297
|
}
|
|
288
298
|
|
|
289
299
|
.${annotateSidebarSectionClass}[data-variant="empty-state"] [data-inspecto-annotate-empty-body="true"] {
|
|
290
|
-
|
|
291
|
-
color: rgba(255, 255, 255, 0.56);
|
|
300
|
+
color: var(--inspecto-text-secondary);
|
|
292
301
|
font-size: 12px;
|
|
293
|
-
line-height: 1.
|
|
302
|
+
line-height: 1.62;
|
|
294
303
|
}
|
|
295
304
|
|
|
296
305
|
.${annotateSidebarInputClass},
|
|
@@ -307,10 +316,10 @@ var annotateStyles = `
|
|
|
307
316
|
}
|
|
308
317
|
|
|
309
318
|
.${annotateSidebarInputClass} {
|
|
310
|
-
min-height:
|
|
311
|
-
padding:
|
|
319
|
+
min-height: 112px;
|
|
320
|
+
padding: 14px 15px;
|
|
312
321
|
resize: vertical;
|
|
313
|
-
line-height: 1.
|
|
322
|
+
line-height: 1.55;
|
|
314
323
|
}
|
|
315
324
|
|
|
316
325
|
.${annotateSidebarHintClass} {
|
|
@@ -323,11 +332,11 @@ var annotateStyles = `
|
|
|
323
332
|
|
|
324
333
|
.${annotateSidebarChipClass} {
|
|
325
334
|
appearance: none;
|
|
326
|
-
border: 1px solid rgba(
|
|
327
|
-
background: rgba(
|
|
328
|
-
color: #
|
|
335
|
+
border: 1px solid rgba(14, 165, 233, 0.24);
|
|
336
|
+
background: rgba(14, 165, 233, 0.14);
|
|
337
|
+
color: #d7f4ff;
|
|
329
338
|
border-radius: var(--inspecto-radius-pill);
|
|
330
|
-
padding:
|
|
339
|
+
padding: 6px 9px 6px 11px;
|
|
331
340
|
font: inherit;
|
|
332
341
|
font-size: 11px;
|
|
333
342
|
font-weight: 600;
|
|
@@ -346,8 +355,8 @@ var annotateStyles = `
|
|
|
346
355
|
.${annotateSidebarChipClass}:hover,
|
|
347
356
|
.${annotateSidebarChipClass}:focus-visible {
|
|
348
357
|
outline: none;
|
|
349
|
-
background: rgba(
|
|
350
|
-
border-color: rgba(
|
|
358
|
+
background: rgba(14, 165, 233, 0.22);
|
|
359
|
+
border-color: rgba(14, 165, 233, 0.42);
|
|
351
360
|
color: #ffffff;
|
|
352
361
|
transform: translateY(-1px);
|
|
353
362
|
}
|
|
@@ -391,33 +400,50 @@ var annotateStyles = `
|
|
|
391
400
|
.${annotateTargetListClass}, .${annotateQueueListClass} {
|
|
392
401
|
display: flex;
|
|
393
402
|
flex-direction: column;
|
|
394
|
-
gap:
|
|
395
|
-
max-height:
|
|
403
|
+
gap: 2px;
|
|
404
|
+
max-height: 220px;
|
|
396
405
|
overflow: auto;
|
|
397
|
-
padding:
|
|
406
|
+
padding: 6px 10px 12px;
|
|
398
407
|
}
|
|
399
408
|
|
|
400
409
|
.${annotateSidebarTargetItemClass}, .${annotateSidebarQueueItemClass} {
|
|
401
410
|
display: flex;
|
|
402
411
|
flex-direction: column;
|
|
403
|
-
gap:
|
|
404
|
-
padding:
|
|
405
|
-
margin:
|
|
406
|
-
border:
|
|
407
|
-
border-
|
|
408
|
-
|
|
409
|
-
background: transparent;
|
|
412
|
+
gap: 5px;
|
|
413
|
+
padding: 12px 12px;
|
|
414
|
+
margin: 0;
|
|
415
|
+
border: 1px solid transparent;
|
|
416
|
+
border-radius: 16px;
|
|
417
|
+
background: rgba(255, 255, 255, 0.022);
|
|
410
418
|
cursor: pointer;
|
|
411
419
|
box-sizing: border-box;
|
|
412
|
-
transition: background 0.
|
|
420
|
+
transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
|
|
413
421
|
}
|
|
414
422
|
|
|
415
|
-
.${annotateSidebarQueueItemClass}:hover {
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
.${
|
|
423
|
+
.${annotateSidebarQueueItemClass}:hover {
|
|
424
|
+
background: rgba(255, 255, 255, 0.05);
|
|
425
|
+
border-color: rgba(148, 163, 184, 0.16);
|
|
426
|
+
transform: translateY(-1px);
|
|
427
|
+
}
|
|
428
|
+
.${annotateSidebarQueueItemClass}:focus-visible {
|
|
429
|
+
outline: none;
|
|
430
|
+
background: rgba(255, 255, 255, 0.05);
|
|
431
|
+
border-color: var(--inspecto-border-focus);
|
|
432
|
+
box-shadow: 0 0 0 1px var(--inspecto-border-focus);
|
|
433
|
+
}
|
|
434
|
+
.${annotateSidebarQueueItemClass}[data-selected="true"] {
|
|
435
|
+
background: linear-gradient(180deg, rgba(14, 165, 233, 0.12) 0%, rgba(14, 165, 233, 0.07) 100%);
|
|
436
|
+
border-color: rgba(14, 165, 233, 0.28);
|
|
437
|
+
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 10px 24px rgba(8, 14, 24, 0.16);
|
|
438
|
+
}
|
|
439
|
+
.${annotateSidebarQueueItemClass} > :not(.${annotateSidebarActionsClass}):first-child {
|
|
440
|
+
font-size: 12px;
|
|
441
|
+
line-height: 1.45;
|
|
442
|
+
color: var(--inspecto-text-primary);
|
|
443
|
+
word-break: break-word;
|
|
444
|
+
font-weight: 620;
|
|
445
|
+
}
|
|
446
|
+
.${annotateSidebarQueueItemClass} > .${annotateSidebarQueueMetaClass} { order: 2; font-size: 10px; line-height: 1.4; color: var(--inspecto-text-tertiary); }
|
|
421
447
|
|
|
422
448
|
.${annotateSidebarTargetItemClass} {
|
|
423
449
|
display: grid;
|
|
@@ -425,14 +451,12 @@ var annotateStyles = `
|
|
|
425
451
|
grid-template-areas: "label action";
|
|
426
452
|
column-gap: 10px;
|
|
427
453
|
align-items: center;
|
|
428
|
-
padding:
|
|
429
|
-
border:
|
|
430
|
-
|
|
431
|
-
border-bottom: 1px solid rgba(127, 127, 127, 0.16);
|
|
432
|
-
background: transparent;
|
|
454
|
+
padding: 10px 12px;
|
|
455
|
+
border-color: rgba(148, 163, 184, 0.12);
|
|
456
|
+
background: rgba(255, 255, 255, 0.02);
|
|
433
457
|
}
|
|
434
458
|
|
|
435
|
-
.${annotateTargetListClass} > .${annotateSidebarTargetItemClass}:last-child {
|
|
459
|
+
.${annotateTargetListClass} > .${annotateSidebarTargetItemClass}:last-child { margin-bottom: 0; }
|
|
436
460
|
|
|
437
461
|
.${annotateBadgeClass} {
|
|
438
462
|
grid-area: label;
|
|
@@ -457,22 +481,22 @@ var annotateStyles = `
|
|
|
457
481
|
line-height: 1.5;
|
|
458
482
|
}
|
|
459
483
|
|
|
460
|
-
.${annotateSidebarFooterClass} { display: flex; flex-direction: column; gap:
|
|
461
|
-
.${annotateSidebarFooterClass} .${annotateSidebarActionsClass} { justify-content: flex-end; align-items: stretch; }
|
|
462
|
-
.${annotateSidebarActionsClass} { display: flex; flex-wrap: wrap; gap:
|
|
484
|
+
.${annotateSidebarFooterClass} { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
|
|
485
|
+
.${annotateSidebarFooterClass} .${annotateSidebarActionsClass} { justify-content: flex-end; align-items: stretch; gap: 10px; }
|
|
486
|
+
.${annotateSidebarActionsClass} { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; justify-content: flex-end; }
|
|
463
487
|
|
|
464
488
|
.${annotateSidebarButtonClass} {
|
|
465
489
|
appearance: none;
|
|
466
490
|
border: 1px solid var(--inspecto-border-subtle);
|
|
467
|
-
background: rgba(255, 255, 255, 0.
|
|
491
|
+
background: rgba(255, 255, 255, 0.05);
|
|
468
492
|
color: var(--inspecto-text-primary);
|
|
469
493
|
border-radius: var(--inspecto-radius-pill);
|
|
470
|
-
padding:
|
|
494
|
+
padding: 8px 12px;
|
|
471
495
|
font: inherit;
|
|
472
496
|
font-size: 11px;
|
|
473
|
-
font-weight:
|
|
497
|
+
font-weight: 600;
|
|
474
498
|
cursor: pointer;
|
|
475
|
-
transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
|
|
499
|
+
transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
|
|
476
500
|
}
|
|
477
501
|
|
|
478
502
|
.${annotateSidebarButtonClass}[data-role="mode"][data-selected="true"] { background: rgba(255, 255, 255, 0.1); color: #ffffff; border-color: transparent; }
|
|
@@ -481,11 +505,55 @@ var annotateStyles = `
|
|
|
481
505
|
.${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; }
|
|
482
506
|
.${annotateSidebarHeaderClass} .${runtimeToggleClass} { overflow: visible; }
|
|
483
507
|
.${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; }
|
|
484
|
-
.${annotateSidebarButtonClass}:hover { background: var(--inspecto-surface-hover); color: #ffffff; border-color:
|
|
508
|
+
.${annotateSidebarButtonClass}:hover { background: var(--inspecto-surface-hover); color: #ffffff; border-color: rgba(148, 163, 184, 0.12); transform: translateY(-1px); }
|
|
485
509
|
.${annotateSidebarButtonClass}:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
486
|
-
.${annotateSidebarClass} .${annotateSidebarButtonClass}.primary {
|
|
487
|
-
|
|
488
|
-
|
|
510
|
+
.${annotateSidebarClass} .${annotateSidebarButtonClass}.primary {
|
|
511
|
+
background: linear-gradient(180deg, var(--inspecto-accent-primary) 0%, var(--inspecto-accent-primary-strong) 100%);
|
|
512
|
+
color: #ffffff;
|
|
513
|
+
border-color: rgba(14, 165, 233, 0.22);
|
|
514
|
+
box-shadow: var(--inspecto-shadow-accent);
|
|
515
|
+
}
|
|
516
|
+
.${annotateSidebarFooterClass} .${annotateSidebarButtonClass} {
|
|
517
|
+
min-height: 40px;
|
|
518
|
+
padding: 0 14px;
|
|
519
|
+
font-size: 11px;
|
|
520
|
+
font-weight: 650;
|
|
521
|
+
border-radius: var(--inspecto-radius-pill);
|
|
522
|
+
justify-content: center;
|
|
523
|
+
display: inline-flex;
|
|
524
|
+
align-items: center;
|
|
525
|
+
}
|
|
526
|
+
.${annotateSidebarFooterClass} .${annotateSidebarButtonClass}[data-emphasis="secondary"] {
|
|
527
|
+
background: rgba(255, 255, 255, 0.04);
|
|
528
|
+
color: var(--inspecto-text-secondary);
|
|
529
|
+
border-color: rgba(148, 163, 184, 0.12);
|
|
530
|
+
box-shadow: none;
|
|
531
|
+
opacity: 0.92;
|
|
532
|
+
white-space: nowrap;
|
|
533
|
+
}
|
|
534
|
+
.${annotateSidebarFooterClass} .${annotateSidebarButtonClass}[data-role="quick-ask"][data-emphasis="secondary"] {
|
|
535
|
+
background: rgba(255, 255, 255, 0.04);
|
|
536
|
+
color: var(--inspecto-text-secondary);
|
|
537
|
+
border-color: rgba(148, 163, 184, 0.12);
|
|
538
|
+
text-decoration: none;
|
|
539
|
+
min-height: 40px;
|
|
540
|
+
padding: 0 14px;
|
|
541
|
+
box-shadow: none;
|
|
542
|
+
white-space: nowrap;
|
|
543
|
+
}
|
|
544
|
+
.${annotateSidebarFooterClass} .${annotateSidebarButtonClass}[data-emphasis="secondary"]:hover {
|
|
545
|
+
background: rgba(255, 255, 255, 0.08);
|
|
546
|
+
color: #ffffff;
|
|
547
|
+
border-color: rgba(255, 255, 255, 0.12);
|
|
548
|
+
transform: translateY(-1px);
|
|
549
|
+
}
|
|
550
|
+
.${annotateSidebarFooterClass} .${annotateSidebarButtonClass}[data-role="quick-ask"][data-emphasis="secondary"]:hover {
|
|
551
|
+
background: rgba(255, 255, 255, 0.08);
|
|
552
|
+
border-color: rgba(255, 255, 255, 0.12);
|
|
553
|
+
color: #ffffff;
|
|
554
|
+
transform: translateY(-1px);
|
|
555
|
+
}
|
|
556
|
+
.${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; }
|
|
489
557
|
.${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; }
|
|
490
558
|
.${annotateSidebarFooterClass} .${annotateSidebarButtonClass}[data-role="send-all"] { min-width: 76px; }
|
|
491
559
|
|
|
@@ -703,10 +771,26 @@ var launcherStyles = `
|
|
|
703
771
|
}
|
|
704
772
|
|
|
705
773
|
.${badgeClass}-panel-header {
|
|
774
|
+
display: flex;
|
|
775
|
+
align-items: flex-start;
|
|
776
|
+
justify-content: space-between;
|
|
777
|
+
gap: 10px;
|
|
778
|
+
padding: 2px 4px 4px;
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
.${badgeClass}-panel-header-copy {
|
|
706
782
|
display: flex;
|
|
707
783
|
flex-direction: column;
|
|
708
784
|
gap: 3px;
|
|
709
|
-
|
|
785
|
+
min-width: 0;
|
|
786
|
+
flex: 1 1 auto;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
.${badgeClass}-panel-header-actions {
|
|
790
|
+
display: inline-flex;
|
|
791
|
+
align-items: center;
|
|
792
|
+
gap: 6px;
|
|
793
|
+
flex: 0 0 auto;
|
|
710
794
|
}
|
|
711
795
|
|
|
712
796
|
.${badgeClass}-panel-header [data-inspecto-launcher-panel-title="true"] {
|
|
@@ -731,6 +815,7 @@ var launcherStyles = `
|
|
|
731
815
|
.${badgeClass}-panel-group[data-inspecto-launcher-utility-group="true"] {
|
|
732
816
|
padding-top: 6px;
|
|
733
817
|
border-top: 1px solid rgba(255, 255, 255, 0.06);
|
|
818
|
+
gap: 6px;
|
|
734
819
|
}
|
|
735
820
|
|
|
736
821
|
.${badgeClass}-panel-button {
|
|
@@ -794,27 +879,47 @@ var launcherStyles = `
|
|
|
794
879
|
|
|
795
880
|
.${badgeClass}-panel-button:disabled { cursor: not-allowed; opacity: 0.5; }
|
|
796
881
|
|
|
797
|
-
.${badgeClass}-panel-button
|
|
882
|
+
.${badgeClass}-panel-toggle-button {
|
|
883
|
+
appearance: none;
|
|
884
|
+
width: 28px;
|
|
885
|
+
height: 28px;
|
|
798
886
|
padding: 0;
|
|
799
|
-
|
|
887
|
+
border: 1px solid var(--inspecto-border-subtle);
|
|
888
|
+
border-radius: var(--inspecto-radius-pill);
|
|
889
|
+
background: var(--inspecto-surface-subtle);
|
|
800
890
|
color: var(--inspecto-text-secondary);
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
align-items: flex-start;
|
|
891
|
+
display: inline-flex;
|
|
892
|
+
align-items: center;
|
|
804
893
|
justify-content: center;
|
|
805
|
-
|
|
806
|
-
box-shadow
|
|
807
|
-
min-height: 0;
|
|
894
|
+
cursor: pointer;
|
|
895
|
+
transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
|
|
808
896
|
}
|
|
809
897
|
|
|
810
|
-
.${badgeClass}-panel-button
|
|
811
|
-
|
|
812
|
-
|
|
898
|
+
.${badgeClass}-panel-toggle-button svg {
|
|
899
|
+
width: 14px;
|
|
900
|
+
height: 14px;
|
|
901
|
+
display: block;
|
|
813
902
|
}
|
|
814
903
|
|
|
815
|
-
.${badgeClass}-panel-button
|
|
904
|
+
.${badgeClass}-panel-toggle-button[aria-pressed="true"] {
|
|
905
|
+
background: linear-gradient(180deg, var(--inspecto-accent-primary) 0%, var(--inspecto-accent-primary-strong) 100%);
|
|
906
|
+
color: #ffffff;
|
|
907
|
+
border-color: transparent;
|
|
908
|
+
box-shadow: 0 10px 18px rgba(70, 57, 215, 0.24);
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
.${badgeClass}-panel-toggle-button:hover {
|
|
912
|
+
transform: translateY(-1px);
|
|
913
|
+
border-color: rgba(255, 255, 255, 0.12);
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
.${badgeClass}-panel-status-text {
|
|
816
917
|
font-size: 10px;
|
|
817
|
-
|
|
918
|
+
font-weight: 600;
|
|
919
|
+
line-height: 1.2;
|
|
920
|
+
color: var(--inspecto-text-secondary);
|
|
921
|
+
white-space: nowrap;
|
|
922
|
+
text-align: right;
|
|
818
923
|
}
|
|
819
924
|
|
|
820
925
|
.${badgeClass}-panel-hint {
|
|
@@ -1138,8 +1243,7 @@ var overlayMenuStyles = `
|
|
|
1138
1243
|
transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
|
|
1139
1244
|
}
|
|
1140
1245
|
|
|
1141
|
-
.${menuItemClass}[data-role="runtime-context-toggle"]
|
|
1142
|
-
.${menuItemClass}[data-role="screenshot-context-toggle"] {
|
|
1246
|
+
.${menuItemClass}[data-role="runtime-context-toggle"] {
|
|
1143
1247
|
flex: 0 0 auto;
|
|
1144
1248
|
width: 28px;
|
|
1145
1249
|
height: 28px;
|
|
@@ -1258,6 +1362,7 @@ var darkVars = `
|
|
|
1258
1362
|
--inspecto-text-tertiary: rgba(255, 255, 255, 0.46);
|
|
1259
1363
|
--inspecto-accent-primary: #5d52f3;
|
|
1260
1364
|
--inspecto-accent-primary-strong: #4639d7;
|
|
1365
|
+
--inspecto-success-color: #10b981;
|
|
1261
1366
|
--inspecto-shadow-floating: 0 20px 48px rgba(0, 0, 0, 0.28);
|
|
1262
1367
|
--inspecto-shadow-accent: 0 8px 18px rgba(79, 70, 229, 0.28);
|
|
1263
1368
|
--inspecto-radius-pill: 999px;
|
|
@@ -1305,6 +1410,7 @@ var themeStyles = `
|
|
|
1305
1410
|
--inspecto-text-tertiary: rgba(255, 255, 255, 0.46);
|
|
1306
1411
|
--inspecto-accent-primary: #5d52f3;
|
|
1307
1412
|
--inspecto-accent-primary-strong: #4639d7;
|
|
1413
|
+
--inspecto-success-color: #10b981;
|
|
1308
1414
|
--inspecto-shadow-floating: 0 20px 48px rgba(0, 0, 0, 0.28);
|
|
1309
1415
|
--inspecto-shadow-accent: 0 8px 18px rgba(79, 70, 229, 0.28);
|
|
1310
1416
|
--inspecto-radius-pill: 999px;
|
|
@@ -1362,7 +1468,7 @@ function applyHeaderIconButtonStyles(button) {
|
|
|
1362
1468
|
button.style.borderColor = "var(--inspecto-border-subtle)";
|
|
1363
1469
|
button.style.background = "var(--inspecto-surface-subtle)";
|
|
1364
1470
|
button.style.color = "var(--inspecto-text-secondary)";
|
|
1365
|
-
button.style.font = '600
|
|
1471
|
+
button.style.font = '600 11px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif';
|
|
1366
1472
|
button.style.borderRadius = "var(--inspecto-radius-pill)";
|
|
1367
1473
|
button.style.display = "inline-flex";
|
|
1368
1474
|
button.style.alignItems = "center";
|
|
@@ -1378,7 +1484,6 @@ var inspectorStyles = `
|
|
|
1378
1484
|
|
|
1379
1485
|
// src/icons.ts
|
|
1380
1486
|
var 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>`;
|
|
1381
|
-
var 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>`;
|
|
1382
1487
|
var 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>`;
|
|
1383
1488
|
var 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>`;
|
|
1384
1489
|
var 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>`;
|
|
@@ -1386,6 +1491,242 @@ var closeIconSvg = `<svg viewBox="0 0 24 24" width="16" height="16" fill="none"
|
|
|
1386
1491
|
var pauseIconSvg = `<svg viewBox="0 0 16 16" width="14" height="14" fill="none" xmlns="http://www.w3.org/2000/svg"><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="M7 1H2V15H7V1Z" fill="currentColor"></path> <path d="M14 1H9V15H14V1Z" fill="currentColor"></path> </g></svg>`;
|
|
1387
1492
|
var playIconSvg = `<svg viewBox="0 0 24 24" width="16" height="16" fill="none" xmlns="http://www.w3.org/2000/svg"><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="M21.4086 9.35258C23.5305 10.5065 23.5305 13.4935 21.4086 14.6474L8.59662 21.6145C6.53435 22.736 4 21.2763 4 18.9671L4 5.0329C4 2.72368 6.53435 1.26402 8.59661 2.38548L21.4086 9.35258Z" fill="currentColor"></path> </g></svg>`;
|
|
1388
1493
|
|
|
1494
|
+
// src/i18n.ts
|
|
1495
|
+
var DEFAULT_LOCALE = "en";
|
|
1496
|
+
var EN_MESSAGES = {
|
|
1497
|
+
"launcher.title": "Inspecto",
|
|
1498
|
+
"launcher.panel.title": "Choose a mode",
|
|
1499
|
+
"launcher.panel.subtitle": "Your next page click will follow this mode.",
|
|
1500
|
+
"launcher.action.inspect.title": "Inspect",
|
|
1501
|
+
"launcher.action.inspect.description": "Click one component to inspect or ask AI",
|
|
1502
|
+
"launcher.action.annotate.title": "Annotate",
|
|
1503
|
+
"launcher.action.annotate.description": "Capture notes across components, then create a task or ask once",
|
|
1504
|
+
"launcher.action.pause.title": "Pause selection",
|
|
1505
|
+
"launcher.action.pause.description": "Use the page normally for a moment",
|
|
1506
|
+
"launcher.action.resume.title": "Resume selection",
|
|
1507
|
+
"launcher.action.resume.description": "Start capturing page clicks again",
|
|
1508
|
+
"launcher.hint.hotkeyDisabled": "Hotkey disabled. Open the launcher to choose Inspect or Annotate.",
|
|
1509
|
+
"launcher.hint.hotkeyQuickJump": "Hotkey: {hotkey} for quick jump",
|
|
1510
|
+
"launcher.state.paused": "Selection paused",
|
|
1511
|
+
"launcher.state.annotate": "Annotate mode",
|
|
1512
|
+
"launcher.state.inspect": "Inspect mode",
|
|
1513
|
+
"launcher.state.ready": "Ready",
|
|
1514
|
+
"menu.openInEditor": "Open in Editor",
|
|
1515
|
+
"menu.attachRuntime": "Attach runtime context",
|
|
1516
|
+
"menu.runtimeEnabled": "Runtime context enabled",
|
|
1517
|
+
"menu.runtimeFixOnly": "Runtime context defaults to fix actions only until you choose otherwise",
|
|
1518
|
+
"menu.attachCss": "Attach CSS context",
|
|
1519
|
+
"menu.cssEnabled": "CSS context enabled",
|
|
1520
|
+
"menu.ask.placeholder.default": "Add a custom ask or extra instruction...",
|
|
1521
|
+
"menu.ask.placeholder.fallback": "Ask anything about this component...",
|
|
1522
|
+
"menu.ask.placeholder.setup": "Inspecto setup needs attention...",
|
|
1523
|
+
"menu.ask.ariaLabel": "Custom ask",
|
|
1524
|
+
"menu.preview.show": "Show preview",
|
|
1525
|
+
"menu.preview.hide": "Hide preview",
|
|
1526
|
+
"menu.sending": "Sending...",
|
|
1527
|
+
"menu.error.openIde": "Unable to open file in the editor.",
|
|
1528
|
+
"annotate.mode.title": "Annotate mode",
|
|
1529
|
+
"annotate.quickCapture.toggle": "Toggle quick capture",
|
|
1530
|
+
"annotate.exitMode": "Exit annotate mode",
|
|
1531
|
+
"annotate.empty.title": "Start by clicking a component",
|
|
1532
|
+
"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.",
|
|
1533
|
+
"annotate.instruction.placeholder": "Overall goal for this batch (optional)...",
|
|
1534
|
+
"annotate.instruction.ariaLabel": "Overall goal",
|
|
1535
|
+
"annotate.previewMessage": "Preview message",
|
|
1536
|
+
"annotate.batchPayload": "Batch payload",
|
|
1537
|
+
"annotate.previewRawPrompt": "View raw prompt payload",
|
|
1538
|
+
"annotate.copyContext": "Copy context",
|
|
1539
|
+
"annotate.copyContext.copied": "Copied",
|
|
1540
|
+
"annotate.copyContext.failed": "Failed to copy",
|
|
1541
|
+
"annotate.saveNote": "Save note",
|
|
1542
|
+
"annotate.updateNote": "Update note",
|
|
1543
|
+
"annotate.askAi": "Ask AI",
|
|
1544
|
+
"annotate.askAiHint": "Ask AI",
|
|
1545
|
+
"annotate.createTask": "Create Task",
|
|
1546
|
+
"annotate.createTaskHint": "Create Task",
|
|
1547
|
+
"annotate.recommendedAction": "Recommended: {action}",
|
|
1548
|
+
"annotate.recommendedAction.agentHint": "Recommended: {action}",
|
|
1549
|
+
"annotate.recommendedAction.askHint": "Recommended: {action}",
|
|
1550
|
+
"annotate.sent": "Sent",
|
|
1551
|
+
"annotate.taskCreated": "Created",
|
|
1552
|
+
"annotate.cancel": "Cancel",
|
|
1553
|
+
"annotate.delete": "Delete",
|
|
1554
|
+
"annotate.composer.placeholder": "What should change for this component?",
|
|
1555
|
+
"annotate.records.none": "No records included yet.",
|
|
1556
|
+
"annotate.target.unknown": "Unknown target",
|
|
1557
|
+
"annotate.source.unknown": "Unknown source",
|
|
1558
|
+
"annotate.note.optionalEmpty": "Optional note left empty.",
|
|
1559
|
+
"annotate.note.none": "No note provided",
|
|
1560
|
+
"annotate.runtimeErrors": "{count} errors",
|
|
1561
|
+
"annotate.liveStatus.quickAskSending": "Sending notes to your IDE assistant.",
|
|
1562
|
+
"annotate.liveStatus.createTaskSending": "Creating a task from your notes.",
|
|
1563
|
+
"annotate.liveStatus.quickAskSent": "Notes sent to your IDE assistant.",
|
|
1564
|
+
"annotate.liveStatus.taskCreated": "Task created from your notes.",
|
|
1565
|
+
"annotate.latestSession.title": "Current task",
|
|
1566
|
+
"annotate.latestSession.refresh": "Refresh current task",
|
|
1567
|
+
"annotate.latestSession.meta.loaded": "{count} annotations",
|
|
1568
|
+
"annotate.latestSession.meta.summary": "Refresh to load details",
|
|
1569
|
+
"annotate.latestSession.loading": "Refreshing latest task...",
|
|
1570
|
+
"annotate.latestSession.pending": "",
|
|
1571
|
+
"annotate.latestSession.acknowledged": "AI acknowledged.",
|
|
1572
|
+
"annotate.latestSession.inProgress": "AI working...",
|
|
1573
|
+
"annotate.latestSession.resolved": "AI finished. Check the page.",
|
|
1574
|
+
"annotate.latestSession.dismissed": "Task dismissed.",
|
|
1575
|
+
"annotate.latestSession.noDetail": "Sent to AI.",
|
|
1576
|
+
"annotate.latestSession.hint.pending": "If it has not started, ask AI to continue.",
|
|
1577
|
+
"annotate.latestSession.hint.acknowledged": "AI connected. Waiting for update.",
|
|
1578
|
+
"annotate.latestSession.hint.in_progress": "Stay for updates, or refresh later.",
|
|
1579
|
+
"annotate.latestSession.hint.resolved": "Review the result. Create a follow-up if needed.",
|
|
1580
|
+
"annotate.latestSession.reconnect": "Reconnect",
|
|
1581
|
+
"annotate.latestSession.error.disconnected": "Connection lost. Reconnect to keep following this task.",
|
|
1582
|
+
"annotate.latestSession.status.pending": "waiting",
|
|
1583
|
+
"annotate.latestSession.status.acknowledged": "acknowledged",
|
|
1584
|
+
"annotate.latestSession.status.in_progress": "in progress",
|
|
1585
|
+
"annotate.latestSession.status.resolved": "complete",
|
|
1586
|
+
"annotate.latestSession.status.dismissed": "dismissed",
|
|
1587
|
+
"annotate.header.capturing": "Capturing clicks",
|
|
1588
|
+
"annotate.header.quickCaptureOn": "{label} on",
|
|
1589
|
+
"runtime.summary.error.one": "{count} runtime error",
|
|
1590
|
+
"runtime.summary.error.other": "{count} runtime errors",
|
|
1591
|
+
"runtime.summary.request.one": "{count} failed request",
|
|
1592
|
+
"runtime.summary.request.other": "{count} failed requests"
|
|
1593
|
+
};
|
|
1594
|
+
var ZH_CN_MESSAGES = {
|
|
1595
|
+
"launcher.panel.title": "\u9009\u62E9\u6A21\u5F0F",
|
|
1596
|
+
"launcher.panel.subtitle": "\u4F60\u4E0B\u4E00\u6B21\u9875\u9762\u70B9\u51FB\u5C06\u6309\u5F53\u524D\u6A21\u5F0F\u6267\u884C\u3002",
|
|
1597
|
+
"launcher.action.inspect.title": "\u68C0\u67E5",
|
|
1598
|
+
"launcher.action.inspect.description": "\u70B9\u51FB\u4E00\u4E2A\u7EC4\u4EF6\u8FDB\u884C\u68C0\u67E5\u6216\u5411 AI \u63D0\u95EE",
|
|
1599
|
+
"launcher.action.annotate.title": "\u6279\u6CE8",
|
|
1600
|
+
"launcher.action.annotate.description": "\u8DE8\u7EC4\u4EF6\u8BB0\u5F55\u6279\u6CE8\uFF0C\u7136\u540E\u521B\u5EFA\u4EFB\u52A1\u6216\u4E00\u6B21\u6027\u63D0\u95EE",
|
|
1601
|
+
"launcher.action.pause.title": "\u6682\u505C\u9009\u62E9",
|
|
1602
|
+
"launcher.action.pause.description": "\u6682\u65F6\u6309\u6B63\u5E38\u65B9\u5F0F\u64CD\u4F5C\u9875\u9762",
|
|
1603
|
+
"launcher.action.resume.title": "\u6062\u590D\u9009\u62E9",
|
|
1604
|
+
"launcher.action.resume.description": "\u91CD\u65B0\u5F00\u59CB\u6355\u83B7\u9875\u9762\u70B9\u51FB",
|
|
1605
|
+
"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",
|
|
1606
|
+
"launcher.hint.hotkeyQuickJump": "\u5FEB\u6377\u952E\uFF1A{hotkey}\uFF08\u5FEB\u901F\u8DF3\u8F6C\uFF09",
|
|
1607
|
+
"launcher.state.paused": "\u5DF2\u6682\u505C\u9009\u62E9",
|
|
1608
|
+
"launcher.state.annotate": "\u6279\u6CE8\u6A21\u5F0F",
|
|
1609
|
+
"launcher.state.inspect": "\u68C0\u67E5\u6A21\u5F0F",
|
|
1610
|
+
"launcher.state.ready": "\u5C31\u7EEA",
|
|
1611
|
+
"menu.openInEditor": "\u5728\u7F16\u8F91\u5668\u4E2D\u6253\u5F00",
|
|
1612
|
+
"menu.attachRuntime": "\u9644\u52A0\u8FD0\u884C\u65F6\u4E0A\u4E0B\u6587",
|
|
1613
|
+
"menu.runtimeEnabled": "\u5DF2\u542F\u7528\u8FD0\u884C\u65F6\u4E0A\u4E0B\u6587",
|
|
1614
|
+
"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",
|
|
1615
|
+
"menu.attachCss": "\u9644\u52A0 CSS \u4E0A\u4E0B\u6587",
|
|
1616
|
+
"menu.cssEnabled": "\u5DF2\u542F\u7528 CSS \u4E0A\u4E0B\u6587",
|
|
1617
|
+
"menu.ask.placeholder.default": "\u6DFB\u52A0\u81EA\u5B9A\u4E49\u63D0\u95EE\u6216\u989D\u5916\u8BF4\u660E...",
|
|
1618
|
+
"menu.ask.placeholder.fallback": "\u8BE2\u95EE\u4E0E\u6B64\u7EC4\u4EF6\u76F8\u5173\u7684\u4EFB\u4F55\u95EE\u9898...",
|
|
1619
|
+
"menu.ask.placeholder.setup": "Inspecto \u73AF\u5883\u9700\u8981\u68C0\u67E5...",
|
|
1620
|
+
"menu.ask.ariaLabel": "\u81EA\u5B9A\u4E49\u63D0\u95EE",
|
|
1621
|
+
"menu.preview.show": "\u663E\u793A\u9884\u89C8",
|
|
1622
|
+
"menu.preview.hide": "\u9690\u85CF\u9884\u89C8",
|
|
1623
|
+
"menu.sending": "\u53D1\u9001\u4E2D...",
|
|
1624
|
+
"menu.error.openIde": "\u65E0\u6CD5\u5728\u7F16\u8F91\u5668\u4E2D\u6253\u5F00\u6587\u4EF6\u3002",
|
|
1625
|
+
"annotate.mode.title": "\u6279\u6CE8\u6A21\u5F0F",
|
|
1626
|
+
"annotate.quickCapture.toggle": "\u5207\u6362\u5FEB\u901F\u6355\u83B7",
|
|
1627
|
+
"annotate.exitMode": "\u9000\u51FA\u6279\u6CE8\u6A21\u5F0F",
|
|
1628
|
+
"annotate.empty.title": "\u5148\u70B9\u51FB\u4E00\u4E2A\u7EC4\u4EF6\u5F00\u59CB",
|
|
1629
|
+
"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",
|
|
1630
|
+
"annotate.instruction.placeholder": "\u672C\u6279\u6B21\u7684\u6574\u4F53\u76EE\u6807\uFF08\u53EF\u9009\uFF09...",
|
|
1631
|
+
"annotate.instruction.ariaLabel": "\u6574\u4F53\u76EE\u6807",
|
|
1632
|
+
"annotate.previewMessage": "\u9884\u89C8\u6D88\u606F",
|
|
1633
|
+
"annotate.batchPayload": "\u6279\u6B21\u8F7D\u8377",
|
|
1634
|
+
"annotate.previewRawPrompt": "\u67E5\u770B\u539F\u59CB prompt \u8F7D\u8377",
|
|
1635
|
+
"annotate.copyContext": "\u590D\u5236\u4E0A\u4E0B\u6587",
|
|
1636
|
+
"annotate.copyContext.copied": "\u5DF2\u590D\u5236",
|
|
1637
|
+
"annotate.copyContext.failed": "\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5",
|
|
1638
|
+
"annotate.saveNote": "\u4FDD\u5B58",
|
|
1639
|
+
"annotate.updateNote": "\u66F4\u65B0",
|
|
1640
|
+
"annotate.askAi": "\u95EE AI",
|
|
1641
|
+
"annotate.askAiHint": "\u95EE AI",
|
|
1642
|
+
"annotate.createTask": "\u521B\u5EFA\u4EFB\u52A1",
|
|
1643
|
+
"annotate.createTaskHint": "\u521B\u5EFA\u4EFB\u52A1",
|
|
1644
|
+
"annotate.recommendedAction": "\u63A8\u8350\uFF1A{action}",
|
|
1645
|
+
"annotate.recommendedAction.agentHint": "\u63A8\u8350\uFF1A{action}",
|
|
1646
|
+
"annotate.recommendedAction.askHint": "\u63A8\u8350\uFF1A{action}",
|
|
1647
|
+
"annotate.sent": "\u5DF2\u53D1\u9001",
|
|
1648
|
+
"annotate.taskCreated": "\u5DF2\u521B\u5EFA",
|
|
1649
|
+
"annotate.cancel": "\u53D6\u6D88",
|
|
1650
|
+
"annotate.delete": "\u5220\u9664",
|
|
1651
|
+
"annotate.composer.placeholder": "\u8FD9\u4E2A\u7EC4\u4EF6\u9700\u8981\u4FEE\u6539\u4EC0\u4E48\uFF1F",
|
|
1652
|
+
"annotate.records.none": "\u8FD8\u6CA1\u6709\u5305\u542B\u8BB0\u5F55\u3002",
|
|
1653
|
+
"annotate.target.unknown": "\u672A\u77E5\u76EE\u6807",
|
|
1654
|
+
"annotate.source.unknown": "\u672A\u77E5\u6765\u6E90",
|
|
1655
|
+
"annotate.note.optionalEmpty": "\u53EF\u9009\u5907\u6CE8\u4E3A\u7A7A\u3002",
|
|
1656
|
+
"annotate.note.none": "\u672A\u63D0\u4F9B\u5907\u6CE8",
|
|
1657
|
+
"annotate.runtimeErrors": "{count} \u4E2A\u9519\u8BEF",
|
|
1658
|
+
"annotate.liveStatus.quickAskSending": "\u6B63\u5728\u5C06\u6279\u6CE8\u53D1\u9001\u7ED9 AI \u52A9\u624B\u3002",
|
|
1659
|
+
"annotate.liveStatus.createTaskSending": "\u6B63\u5728\u6839\u636E\u6279\u6CE8\u521B\u5EFA\u4EFB\u52A1\u3002",
|
|
1660
|
+
"annotate.liveStatus.quickAskSent": "\u6279\u6CE8\u5DF2\u53D1\u9001\u7ED9 AI \u52A9\u624B\u3002",
|
|
1661
|
+
"annotate.liveStatus.taskCreated": "\u5DF2\u6839\u636E\u6279\u6CE8\u521B\u5EFA\u4EFB\u52A1\u3002",
|
|
1662
|
+
"annotate.latestSession.title": "\u5F53\u524D\u4EFB\u52A1",
|
|
1663
|
+
"annotate.latestSession.refresh": "\u5237\u65B0\u5F53\u524D\u4EFB\u52A1",
|
|
1664
|
+
"annotate.latestSession.meta.loaded": "\u5305\u542B {count} \u6761\u6279\u6CE8",
|
|
1665
|
+
"annotate.latestSession.meta.summary": "\u5305\u542B\u591A\u6761\u6279\u6CE8 \u2022 \u5237\u65B0\u4EE5\u52A0\u8F7D\u8BE6\u60C5",
|
|
1666
|
+
"annotate.latestSession.loading": "\u6B63\u5728\u5237\u65B0\u6700\u65B0\u4EFB\u52A1...",
|
|
1667
|
+
"annotate.latestSession.pending": "",
|
|
1668
|
+
"annotate.latestSession.acknowledged": "AI \u5DF2\u63A5\u624B\u3002",
|
|
1669
|
+
"annotate.latestSession.inProgress": "AI \u5904\u7406\u4E2D...",
|
|
1670
|
+
"annotate.latestSession.resolved": "AI \u5DF2\u5B8C\u6210\u5904\u7406\u3002\u8BF7\u56DE\u5230\u9875\u9762\u786E\u8BA4\u3002",
|
|
1671
|
+
"annotate.latestSession.dismissed": "\u4EFB\u52A1\u5DF2\u88AB\u5FFD\u7565\u3002",
|
|
1672
|
+
"annotate.latestSession.noDetail": "\u5DF2\u53D1\u9001\u7ED9 AI\u3002",
|
|
1673
|
+
"annotate.latestSession.hint.pending": "\u5982\u679C\u8FD8\u6CA1\u6709\u5F00\u59CB\uFF0C\u8BF7\u8BA9 AI \u7EE7\u7EED\u5904\u7406\u3002",
|
|
1674
|
+
"annotate.latestSession.hint.acknowledged": "AI \u5DF2\u8FDE\u63A5\uFF0C\u6B63\u5728\u7B49\u5F85\u66F4\u65B0\u3002",
|
|
1675
|
+
"annotate.latestSession.hint.in_progress": "\u53EF\u7559\u5728\u8FD9\u91CC\u67E5\u770B\u8FDB\u5C55\uFF0C\u6216\u7A0D\u540E\u624B\u52A8\u5237\u65B0\u3002",
|
|
1676
|
+
"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",
|
|
1677
|
+
"annotate.latestSession.reconnect": "\u91CD\u65B0\u8FDE\u63A5",
|
|
1678
|
+
"annotate.latestSession.error.disconnected": "\u8FDE\u63A5\u5DF2\u65AD\u5F00\u3002\u91CD\u65B0\u8FDE\u63A5\u4EE5\u7EE7\u7EED\u8DDF\u8FDB\u8FD9\u6761\u4EFB\u52A1\u3002",
|
|
1679
|
+
"annotate.latestSession.status.pending": "\u7B49\u5F85\u4E2D",
|
|
1680
|
+
"annotate.latestSession.status.acknowledged": "\u5DF2\u9886\u53D6",
|
|
1681
|
+
"annotate.latestSession.status.in_progress": "\u5904\u7406\u4E2D",
|
|
1682
|
+
"annotate.latestSession.status.resolved": "\u5DF2\u5B8C\u6210",
|
|
1683
|
+
"annotate.latestSession.status.dismissed": "\u5DF2\u5FFD\u7565",
|
|
1684
|
+
"annotate.header.capturing": "\u6B63\u5728\u6355\u83B7\u70B9\u51FB",
|
|
1685
|
+
"annotate.header.quickCaptureOn": "{label} \u5DF2\u5F00\u542F",
|
|
1686
|
+
"runtime.summary.error.one": "{count} \u4E2A\u8FD0\u884C\u65F6\u9519\u8BEF",
|
|
1687
|
+
"runtime.summary.error.other": "{count} \u4E2A\u8FD0\u884C\u65F6\u9519\u8BEF",
|
|
1688
|
+
"runtime.summary.request.one": "{count} \u4E2A\u5931\u8D25\u8BF7\u6C42",
|
|
1689
|
+
"runtime.summary.request.other": "{count} \u4E2A\u5931\u8D25\u8BF7\u6C42"
|
|
1690
|
+
};
|
|
1691
|
+
var BUILTIN_MESSAGES = {
|
|
1692
|
+
en: EN_MESSAGES,
|
|
1693
|
+
"zh-CN": ZH_CN_MESSAGES
|
|
1694
|
+
};
|
|
1695
|
+
var currentLocale = DEFAULT_LOCALE;
|
|
1696
|
+
var currentMessages = {};
|
|
1697
|
+
function normalizeLocale(locale) {
|
|
1698
|
+
if (!locale) return DEFAULT_LOCALE;
|
|
1699
|
+
if (BUILTIN_MESSAGES[locale]) return locale;
|
|
1700
|
+
if (locale.toLowerCase().startsWith("zh")) return "zh-CN";
|
|
1701
|
+
if (locale.toLowerCase().startsWith("en")) return "en";
|
|
1702
|
+
return DEFAULT_LOCALE;
|
|
1703
|
+
}
|
|
1704
|
+
function resolveBrowserLocale() {
|
|
1705
|
+
if (typeof navigator === "undefined") return DEFAULT_LOCALE;
|
|
1706
|
+
return normalizeLocale(navigator.language);
|
|
1707
|
+
}
|
|
1708
|
+
function interpolate(template, vars) {
|
|
1709
|
+
if (!vars) return template;
|
|
1710
|
+
return template.replace(/\{(\w+)\}/g, (_, key) => {
|
|
1711
|
+
var _a2;
|
|
1712
|
+
return String((_a2 = vars[key]) != null ? _a2 : "");
|
|
1713
|
+
});
|
|
1714
|
+
}
|
|
1715
|
+
function configureI18n(input) {
|
|
1716
|
+
var _a2, _b;
|
|
1717
|
+
currentLocale = normalizeLocale((_a2 = input == null ? void 0 : input.locale) != null ? _a2 : resolveBrowserLocale());
|
|
1718
|
+
currentMessages = (_b = input == null ? void 0 : input.messages) != null ? _b : {};
|
|
1719
|
+
}
|
|
1720
|
+
function t(key, vars) {
|
|
1721
|
+
var _a2, _b, _c, _d, _e;
|
|
1722
|
+
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;
|
|
1723
|
+
return interpolate(message, vars);
|
|
1724
|
+
}
|
|
1725
|
+
function runtimeSummaryLabel(kind, count) {
|
|
1726
|
+
const suffix = count === 1 ? "one" : "other";
|
|
1727
|
+
return t(`runtime.summary.${kind}.${suffix}`, { count });
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1389
1730
|
// src/annotate-overlay-dom.ts
|
|
1390
1731
|
function createAnnotateOverlayDom(shadowRoot, tokens) {
|
|
1391
1732
|
const layer = document.createElement("div");
|
|
@@ -1448,30 +1789,16 @@ function createAnnotateOverlayDom(shadowRoot, tokens) {
|
|
|
1448
1789
|
composerHeaderActions.style.gap = "6px";
|
|
1449
1790
|
const composerOpenButton = document.createElement("button");
|
|
1450
1791
|
composerOpenButton.type = "button";
|
|
1451
|
-
composerOpenButton.setAttribute("aria-label", "
|
|
1452
|
-
composerOpenButton.title = "
|
|
1792
|
+
composerOpenButton.setAttribute("aria-label", t("menu.openInEditor"));
|
|
1793
|
+
composerOpenButton.title = t("menu.openInEditor");
|
|
1453
1794
|
composerOpenButton.textContent = "\u2197";
|
|
1454
1795
|
composerOpenButton.style.appearance = "none";
|
|
1455
1796
|
composerOpenButton.style.cursor = "pointer";
|
|
1456
1797
|
applyHeaderIconButtonStyles(composerOpenButton);
|
|
1457
|
-
const composerScreenshotButton = document.createElement("button");
|
|
1458
|
-
composerScreenshotButton.type = "button";
|
|
1459
|
-
composerScreenshotButton.setAttribute("aria-label", "Attach screenshot context");
|
|
1460
|
-
composerScreenshotButton.title = "Attach screenshot context";
|
|
1461
|
-
composerScreenshotButton.style.appearance = "none";
|
|
1462
|
-
composerScreenshotButton.style.cursor = "pointer";
|
|
1463
|
-
composerScreenshotButton.style.display = "none";
|
|
1464
|
-
applyHeaderIconButtonStyles(composerScreenshotButton);
|
|
1465
|
-
composerScreenshotButton.innerHTML = screenshotIconSvg;
|
|
1466
|
-
const screenshotSvgElement = composerScreenshotButton.querySelector("svg");
|
|
1467
|
-
if (screenshotSvgElement) {
|
|
1468
|
-
screenshotSvgElement.style.width = "18px";
|
|
1469
|
-
screenshotSvgElement.style.height = "18px";
|
|
1470
|
-
}
|
|
1471
1798
|
const composerCssButton = document.createElement("button");
|
|
1472
1799
|
composerCssButton.type = "button";
|
|
1473
|
-
composerCssButton.setAttribute("aria-label", "
|
|
1474
|
-
composerCssButton.title = "
|
|
1800
|
+
composerCssButton.setAttribute("aria-label", t("menu.attachCss"));
|
|
1801
|
+
composerCssButton.title = t("menu.attachCss");
|
|
1475
1802
|
composerCssButton.style.appearance = "none";
|
|
1476
1803
|
composerCssButton.style.cursor = "pointer";
|
|
1477
1804
|
composerCssButton.style.display = "none";
|
|
@@ -1484,8 +1811,8 @@ function createAnnotateOverlayDom(shadowRoot, tokens) {
|
|
|
1484
1811
|
}
|
|
1485
1812
|
const composerRuntimeButton = document.createElement("button");
|
|
1486
1813
|
composerRuntimeButton.type = "button";
|
|
1487
|
-
composerRuntimeButton.setAttribute("aria-label", "
|
|
1488
|
-
composerRuntimeButton.title = "
|
|
1814
|
+
composerRuntimeButton.setAttribute("aria-label", t("menu.attachRuntime"));
|
|
1815
|
+
composerRuntimeButton.title = t("menu.attachRuntime");
|
|
1489
1816
|
composerRuntimeButton.style.appearance = "none";
|
|
1490
1817
|
composerRuntimeButton.style.position = "relative";
|
|
1491
1818
|
composerRuntimeButton.style.cursor = "pointer";
|
|
@@ -1515,7 +1842,7 @@ function createAnnotateOverlayDom(shadowRoot, tokens) {
|
|
|
1515
1842
|
composerRuntimeBadge.style.display = "none";
|
|
1516
1843
|
composerRuntimeButton.append(composerRuntimeIcon, composerRuntimeBadge);
|
|
1517
1844
|
const composerInput = document.createElement("textarea");
|
|
1518
|
-
composerInput.placeholder = "
|
|
1845
|
+
composerInput.placeholder = t("annotate.composer.placeholder");
|
|
1519
1846
|
composerInput.style.width = "100%";
|
|
1520
1847
|
composerInput.style.minHeight = "100px";
|
|
1521
1848
|
composerInput.style.boxSizing = "border-box";
|
|
@@ -1536,44 +1863,39 @@ function createAnnotateOverlayDom(shadowRoot, tokens) {
|
|
|
1536
1863
|
composerActions.style.gap = "8px";
|
|
1537
1864
|
const cancelButton = document.createElement("button");
|
|
1538
1865
|
cancelButton.type = "button";
|
|
1539
|
-
cancelButton.textContent = "
|
|
1866
|
+
cancelButton.textContent = t("annotate.cancel");
|
|
1540
1867
|
cancelButton.style.appearance = "none";
|
|
1541
1868
|
cancelButton.style.border = "none";
|
|
1542
1869
|
cancelButton.style.background = "transparent";
|
|
1543
1870
|
cancelButton.style.color = tokens.textSecondary();
|
|
1544
|
-
cancelButton.style.font = '500
|
|
1871
|
+
cancelButton.style.font = '500 11px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif';
|
|
1545
1872
|
cancelButton.style.padding = "8px 10px";
|
|
1546
1873
|
cancelButton.style.cursor = "pointer";
|
|
1547
1874
|
const deleteButton = document.createElement("button");
|
|
1548
1875
|
deleteButton.type = "button";
|
|
1549
|
-
deleteButton.textContent = "
|
|
1876
|
+
deleteButton.textContent = t("annotate.delete");
|
|
1550
1877
|
deleteButton.style.appearance = "none";
|
|
1551
1878
|
deleteButton.style.border = "none";
|
|
1552
1879
|
deleteButton.style.background = "transparent";
|
|
1553
1880
|
deleteButton.style.color = "rgba(248, 113, 113, 0.92)";
|
|
1554
|
-
deleteButton.style.font = '500
|
|
1881
|
+
deleteButton.style.font = '500 11px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif';
|
|
1555
1882
|
deleteButton.style.padding = "8px 10px";
|
|
1556
1883
|
deleteButton.style.cursor = "pointer";
|
|
1557
1884
|
deleteButton.style.display = "none";
|
|
1558
1885
|
const addButton = document.createElement("button");
|
|
1559
1886
|
addButton.type = "button";
|
|
1560
|
-
addButton.textContent = "
|
|
1887
|
+
addButton.textContent = t("annotate.saveNote");
|
|
1561
1888
|
addButton.style.appearance = "none";
|
|
1562
1889
|
addButton.style.border = "none";
|
|
1563
1890
|
addButton.style.borderRadius = tokens.radiusPill();
|
|
1564
1891
|
addButton.style.background = `linear-gradient(180deg, ${tokens.accentPrimary()} 0%, ${tokens.accentPrimaryStrong()} 100%)`;
|
|
1565
1892
|
addButton.style.color = "#ffffff";
|
|
1566
|
-
addButton.style.font = '600
|
|
1893
|
+
addButton.style.font = '600 11px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif';
|
|
1567
1894
|
addButton.style.minHeight = "36px";
|
|
1568
1895
|
addButton.style.padding = "0 18px";
|
|
1569
1896
|
addButton.style.cursor = "pointer";
|
|
1570
1897
|
addButton.style.boxShadow = tokens.shadowAccent();
|
|
1571
|
-
composerHeaderActions.append(
|
|
1572
|
-
composerScreenshotButton,
|
|
1573
|
-
composerCssButton,
|
|
1574
|
-
composerRuntimeButton,
|
|
1575
|
-
composerOpenButton
|
|
1576
|
-
);
|
|
1898
|
+
composerHeaderActions.append(composerCssButton, composerRuntimeButton, composerOpenButton);
|
|
1577
1899
|
composerActions.append(deleteButton, cancelButton, addButton);
|
|
1578
1900
|
composerHeader.append(composerHeaderText, composerHeaderActions);
|
|
1579
1901
|
composer.append(composerHeader, composerInput, composerActions);
|
|
@@ -1602,7 +1924,6 @@ function createAnnotateOverlayDom(shadowRoot, tokens) {
|
|
|
1602
1924
|
composerHeaderTitle,
|
|
1603
1925
|
composerHeaderMeta,
|
|
1604
1926
|
composerOpenButton,
|
|
1605
|
-
composerScreenshotButton,
|
|
1606
1927
|
composerCssButton,
|
|
1607
1928
|
composerRuntimeButton,
|
|
1608
1929
|
composerRuntimeBadge,
|
|
@@ -1668,6 +1989,15 @@ function applyOverlayState(box, state, tokens) {
|
|
|
1668
1989
|
const badge = box.querySelector("[data-inspecto-annotate-overlay-order]");
|
|
1669
1990
|
const accentPrimaryColor = tokens.accentPrimary();
|
|
1670
1991
|
const accentPrimaryStrongColor = tokens.accentPrimaryStrong();
|
|
1992
|
+
const successColor = tokens.successColor();
|
|
1993
|
+
if (state === "completed") {
|
|
1994
|
+
box.style.border = `2px solid ${successColor}`;
|
|
1995
|
+
box.style.background = "rgba(16, 185, 129, 0.05)";
|
|
1996
|
+
box.style.boxShadow = "none";
|
|
1997
|
+
badge.style.background = successColor;
|
|
1998
|
+
badge.style.opacity = "0.68";
|
|
1999
|
+
return;
|
|
2000
|
+
}
|
|
1671
2001
|
if (state === "saved") {
|
|
1672
2002
|
box.style.border = `2px solid ${accentPrimaryStrongColor}`;
|
|
1673
2003
|
box.style.background = "rgba(79, 70, 229, 0.05)";
|
|
@@ -1750,6 +2080,7 @@ function createAnnotateOverlay(shadowRoot) {
|
|
|
1750
2080
|
textTertiary: () => readToken("--inspecto-text-tertiary", "rgba(255, 255, 255, 0.46)"),
|
|
1751
2081
|
accentPrimary: () => readToken("--inspecto-accent-primary", "#5d52f3"),
|
|
1752
2082
|
accentPrimaryStrong: () => readToken("--inspecto-accent-primary-strong", "#4639d7"),
|
|
2083
|
+
successColor: () => readToken("--inspecto-success-color", "#10b981"),
|
|
1753
2084
|
shadowFloating: () => readToken("--inspecto-shadow-floating", "0 20px 48px rgba(0, 0, 0, 0.28)"),
|
|
1754
2085
|
shadowAccent: () => readToken("--inspecto-shadow-accent", "0 8px 18px rgba(79, 70, 229, 0.28)"),
|
|
1755
2086
|
radiusSm: () => readToken("--inspecto-radius-sm", "12px"),
|
|
@@ -1764,7 +2095,6 @@ function createAnnotateOverlay(shadowRoot) {
|
|
|
1764
2095
|
composerHeaderTitle,
|
|
1765
2096
|
composerHeaderMeta,
|
|
1766
2097
|
composerOpenButton,
|
|
1767
|
-
composerScreenshotButton,
|
|
1768
2098
|
composerCssButton,
|
|
1769
2099
|
composerRuntimeButton,
|
|
1770
2100
|
composerRuntimeBadge,
|
|
@@ -1857,7 +2187,7 @@ function createAnnotateOverlay(shadowRoot) {
|
|
|
1857
2187
|
composer.style.top = `${top}px`;
|
|
1858
2188
|
}
|
|
1859
2189
|
function render(targets, composerOptions) {
|
|
1860
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
2190
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
1861
2191
|
const nextIds = new Set(targets.map((target) => target.id));
|
|
1862
2192
|
for (const [id, box] of boxes) {
|
|
1863
2193
|
if (!nextIds.has(id)) {
|
|
@@ -1882,8 +2212,8 @@ function createAnnotateOverlay(shadowRoot) {
|
|
|
1882
2212
|
const badge = box.querySelector("[data-inspecto-annotate-overlay-order]");
|
|
1883
2213
|
const noteBadge = box.querySelector("[data-inspecto-annotate-overlay-note]");
|
|
1884
2214
|
badge.textContent = String(target.order);
|
|
1885
|
-
if (((_b = target.state) != null ? _b : "current") === "saved") {
|
|
1886
|
-
const trimmedNote = (
|
|
2215
|
+
if (((_b = target.state) != null ? _b : "current") === "saved" || ((_c = target.state) != null ? _c : "current") === "completed") {
|
|
2216
|
+
const trimmedNote = (_e = (_d = target.note) == null ? void 0 : _d.trim()) != null ? _e : "";
|
|
1887
2217
|
const hasNote = trimmedNote.length > 0;
|
|
1888
2218
|
noteBadge.style.display = hasNote ? "block" : "none";
|
|
1889
2219
|
noteBadge.textContent = hasNote ? formatOverlayNoteBadge(trimmedNote) : "";
|
|
@@ -1918,42 +2248,26 @@ function createAnnotateOverlay(shadowRoot) {
|
|
|
1918
2248
|
}
|
|
1919
2249
|
}
|
|
1920
2250
|
if (targets.length > 0 && composerOptions) {
|
|
1921
|
-
const targetChanged = activeComposerTargetId !== ((
|
|
1922
|
-
const composerTarget = (
|
|
2251
|
+
const targetChanged = activeComposerTargetId !== ((_h = (_g = composerOptions.targetId) != null ? _g : (_f = targets[0]) == null ? void 0 : _f.id) != null ? _h : null);
|
|
2252
|
+
const composerTarget = (_i = targets.find((target) => {
|
|
1923
2253
|
var _a3;
|
|
1924
2254
|
return ((_a3 = target.state) != null ? _a3 : "current") === "current";
|
|
1925
|
-
})) != null ?
|
|
1926
|
-
activeComposerTargetId = (
|
|
2255
|
+
})) != null ? _i : targets[0];
|
|
2256
|
+
activeComposerTargetId = (_l = (_k = composerOptions.targetId) != null ? _k : (_j = targets[0]) == null ? void 0 : _j.id) != null ? _l : null;
|
|
1927
2257
|
composerHeaderTitle.textContent = composerOptions.targetLabel;
|
|
1928
|
-
composerHeaderMeta.textContent = (
|
|
2258
|
+
composerHeaderMeta.textContent = (_m = composerOptions.targetMeta) != null ? _m : "";
|
|
1929
2259
|
composerHeaderMeta.style.display = composerOptions.targetMeta ? "" : "none";
|
|
1930
2260
|
composerOpenButton.onclick = () => {
|
|
1931
2261
|
var _a3;
|
|
1932
2262
|
return (_a3 = composerOptions.onOpenInEditor) == null ? void 0 : _a3.call(composerOptions);
|
|
1933
2263
|
};
|
|
1934
|
-
composerScreenshotButton.style.display = composerOptions.canAttachScreenshotContext ? "inline-flex" : "none";
|
|
1935
|
-
composerScreenshotButton.setAttribute(
|
|
1936
|
-
"aria-pressed",
|
|
1937
|
-
composerOptions.screenshotContextEnabled ? "true" : "false"
|
|
1938
|
-
);
|
|
1939
|
-
composerScreenshotButton.dataset.visualState = composerOptions.screenshotContextEnabled ? "active" : "inactive";
|
|
1940
|
-
composerScreenshotButton.title = composerOptions.screenshotContextEnabled ? "Screenshot context enabled" : "Attach screenshot context";
|
|
1941
|
-
applyComposerRuntimeButtonState(
|
|
1942
|
-
composerScreenshotButton,
|
|
1943
|
-
tokens,
|
|
1944
|
-
composerOptions.screenshotContextEnabled === true
|
|
1945
|
-
);
|
|
1946
|
-
composerScreenshotButton.onclick = () => {
|
|
1947
|
-
var _a3;
|
|
1948
|
-
return (_a3 = composerOptions.onToggleScreenshotContext) == null ? void 0 : _a3.call(composerOptions);
|
|
1949
|
-
};
|
|
1950
2264
|
composerCssButton.style.display = composerOptions.canAttachCssContext ? "inline-flex" : "none";
|
|
1951
2265
|
composerCssButton.setAttribute(
|
|
1952
2266
|
"aria-pressed",
|
|
1953
2267
|
composerOptions.cssContextEnabled ? "true" : "false"
|
|
1954
2268
|
);
|
|
1955
2269
|
composerCssButton.dataset.visualState = composerOptions.cssContextEnabled ? "active" : "inactive";
|
|
1956
|
-
composerCssButton.title = composerOptions.cssContextEnabled ? "
|
|
2270
|
+
composerCssButton.title = composerOptions.cssContextEnabled ? t("menu.cssEnabled") : t("menu.attachCss");
|
|
1957
2271
|
applyComposerRuntimeButtonState(
|
|
1958
2272
|
composerCssButton,
|
|
1959
2273
|
tokens,
|
|
@@ -1970,10 +2284,10 @@ function createAnnotateOverlay(shadowRoot) {
|
|
|
1970
2284
|
);
|
|
1971
2285
|
composerRuntimeButton.dataset.visualState = composerOptions.runtimeContextEnabled ? "active" : "inactive";
|
|
1972
2286
|
composerRuntimeBadge.textContent = formatRuntimeErrorCount(
|
|
1973
|
-
(
|
|
2287
|
+
(_n = composerOptions.runtimeErrorCount) != null ? _n : 0
|
|
1974
2288
|
);
|
|
1975
|
-
composerRuntimeBadge.style.display = composerOptions.runtimeContextEnabled && ((
|
|
1976
|
-
composerRuntimeButton.title = composerOptions.runtimeContextEnabled ? composerOptions.runtimeErrorCount ?
|
|
2289
|
+
composerRuntimeBadge.style.display = composerOptions.runtimeContextEnabled && ((_o = composerOptions.runtimeErrorCount) != null ? _o : 0) > 0 ? "" : "none";
|
|
2290
|
+
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");
|
|
1977
2291
|
applyComposerRuntimeButtonState(
|
|
1978
2292
|
composerRuntimeButton,
|
|
1979
2293
|
tokens,
|
|
@@ -1994,7 +2308,7 @@ function createAnnotateOverlay(shadowRoot) {
|
|
|
1994
2308
|
var _a3;
|
|
1995
2309
|
return (_a3 = composerOptions.onUpdateNote) == null ? void 0 : _a3.call(composerOptions, composerInput.value);
|
|
1996
2310
|
};
|
|
1997
|
-
addButton.textContent = (
|
|
2311
|
+
addButton.textContent = (_p = composerOptions.saveLabel) != null ? _p : t("annotate.saveNote");
|
|
1998
2312
|
addButton.onclick = () => {
|
|
1999
2313
|
var _a3;
|
|
2000
2314
|
return (_a3 = composerOptions.onSave) == null ? void 0 : _a3.call(composerOptions);
|
|
@@ -2017,17 +2331,15 @@ function createAnnotateOverlay(shadowRoot) {
|
|
|
2017
2331
|
activeComposerPlacement = null;
|
|
2018
2332
|
composerInput.value = "";
|
|
2019
2333
|
composerInput.oninput = null;
|
|
2020
|
-
addButton.textContent = "
|
|
2334
|
+
addButton.textContent = t("annotate.saveNote");
|
|
2021
2335
|
addButton.onclick = null;
|
|
2022
2336
|
cancelButton.onclick = null;
|
|
2023
2337
|
composerOpenButton.onclick = null;
|
|
2024
|
-
composerScreenshotButton.style.display = "none";
|
|
2025
|
-
composerScreenshotButton.onclick = null;
|
|
2026
2338
|
composerCssButton.style.display = "none";
|
|
2027
2339
|
composerCssButton.onclick = null;
|
|
2028
2340
|
composerCssButton.setAttribute("aria-pressed", "false");
|
|
2029
2341
|
composerCssButton.dataset.visualState = "inactive";
|
|
2030
|
-
composerCssButton.title = "
|
|
2342
|
+
composerCssButton.title = t("menu.attachCss");
|
|
2031
2343
|
applyComposerRuntimeButtonState(composerCssButton, tokens, false);
|
|
2032
2344
|
composerRuntimeButton.style.display = "none";
|
|
2033
2345
|
composerRuntimeButton.onclick = null;
|
|
@@ -2045,10 +2357,8 @@ function createAnnotateOverlay(shadowRoot) {
|
|
|
2045
2357
|
activeComposerTargetId = null;
|
|
2046
2358
|
activeComposerPlacement = null;
|
|
2047
2359
|
composerInput.value = "";
|
|
2048
|
-
addButton.textContent = "
|
|
2360
|
+
addButton.textContent = t("annotate.saveNote");
|
|
2049
2361
|
composerOpenButton.onclick = null;
|
|
2050
|
-
composerScreenshotButton.style.display = "none";
|
|
2051
|
-
composerScreenshotButton.onclick = null;
|
|
2052
2362
|
composerRuntimeButton.style.display = "none";
|
|
2053
2363
|
composerRuntimeButton.onclick = null;
|
|
2054
2364
|
deleteButton.style.display = "none";
|
|
@@ -2061,6 +2371,8 @@ function createAnnotateOverlay(shadowRoot) {
|
|
|
2061
2371
|
|
|
2062
2372
|
// src/component-utils.ts
|
|
2063
2373
|
var ATTR_NAME = "data-inspecto";
|
|
2374
|
+
var ASTRO_FILE_ATTR_NAME = "data-astro-source-file";
|
|
2375
|
+
var ASTRO_LOC_ATTR_NAME = "data-astro-source-loc";
|
|
2064
2376
|
function parseAttrValue(value) {
|
|
2065
2377
|
const parts = value.split(":");
|
|
2066
2378
|
if (parts.length < 3) return null;
|
|
@@ -2070,9 +2382,29 @@ function parseAttrValue(value) {
|
|
|
2070
2382
|
if (isNaN(line) || isNaN(col) || !file) return null;
|
|
2071
2383
|
return { file, line, column: col };
|
|
2072
2384
|
}
|
|
2385
|
+
function parseAstroAttrValue(file, loc) {
|
|
2386
|
+
const parts = loc.split(":");
|
|
2387
|
+
if (parts.length !== 2) return null;
|
|
2388
|
+
const line = parseInt(parts[0], 10);
|
|
2389
|
+
const column = parseInt(parts[1], 10);
|
|
2390
|
+
if (isNaN(line) || isNaN(column) || !file) return null;
|
|
2391
|
+
return { file, line, column };
|
|
2392
|
+
}
|
|
2393
|
+
function getInspectableLocation(el) {
|
|
2394
|
+
const attrValue = el.getAttribute(ATTR_NAME);
|
|
2395
|
+
if (attrValue) {
|
|
2396
|
+
return parseAttrValue(attrValue);
|
|
2397
|
+
}
|
|
2398
|
+
const astroFile = el.getAttribute(ASTRO_FILE_ATTR_NAME);
|
|
2399
|
+
const astroLoc = el.getAttribute(ASTRO_LOC_ATTR_NAME);
|
|
2400
|
+
if (astroFile && astroLoc) {
|
|
2401
|
+
return parseAstroAttrValue(astroFile, astroLoc);
|
|
2402
|
+
}
|
|
2403
|
+
return null;
|
|
2404
|
+
}
|
|
2073
2405
|
function findInspectable(el) {
|
|
2074
2406
|
while (el) {
|
|
2075
|
-
if (el
|
|
2407
|
+
if (getInspectableLocation(el)) return el;
|
|
2076
2408
|
el = el.parentElement;
|
|
2077
2409
|
}
|
|
2078
2410
|
return null;
|
|
@@ -2276,7 +2608,16 @@ function findElementForLocation(_ctx, location, selector) {
|
|
|
2276
2608
|
const byLocation = Array.from(document.querySelectorAll(`[${ATTR_NAME}]`)).find(
|
|
2277
2609
|
(candidate) => candidate.getAttribute(ATTR_NAME) === locationAttr
|
|
2278
2610
|
);
|
|
2279
|
-
|
|
2611
|
+
if (byLocation instanceof Element) {
|
|
2612
|
+
return byLocation;
|
|
2613
|
+
}
|
|
2614
|
+
const byAstroLocation = Array.from(
|
|
2615
|
+
document.querySelectorAll("[data-astro-source-file][data-astro-source-loc]")
|
|
2616
|
+
).find((candidate) => {
|
|
2617
|
+
const candidateLocation = getInspectableLocation(candidate);
|
|
2618
|
+
return (candidateLocation == null ? void 0 : candidateLocation.file) === location.file && candidateLocation.line === location.line && candidateLocation.column === location.column;
|
|
2619
|
+
});
|
|
2620
|
+
return byAstroLocation instanceof Element ? byAstroLocation : null;
|
|
2280
2621
|
}
|
|
2281
2622
|
function rebindCurrentAnnotationElements(ctx) {
|
|
2282
2623
|
const state = asAnnotateContext(ctx);
|
|
@@ -2405,12 +2746,9 @@ function buildAnnotateFullPrompt(input) {
|
|
|
2405
2746
|
const prompt = instruction ? `${instruction}
|
|
2406
2747
|
|
|
2407
2748
|
${body}` : body;
|
|
2408
|
-
return
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
input.cssContextPrompt
|
|
2412
|
-
),
|
|
2413
|
-
input.screenshotContext
|
|
2749
|
+
return appendCssContextToPrompt(
|
|
2750
|
+
appendRuntimeContextSection(prompt, input.runtimeContext),
|
|
2751
|
+
input.cssContextPrompt
|
|
2414
2752
|
);
|
|
2415
2753
|
}
|
|
2416
2754
|
function buildSelectedElementsPrompt(annotations) {
|
|
@@ -2442,22 +2780,6 @@ function appendRuntimeContextSection(prompt, runtimeContext) {
|
|
|
2442
2780
|
|
|
2443
2781
|
${buildRuntimeContextSection(runtimeContext.records)}`;
|
|
2444
2782
|
}
|
|
2445
|
-
function appendScreenshotContextSection(prompt, screenshotContext) {
|
|
2446
|
-
if (!screenshotContext || !screenshotContext.imageDataUrl && !screenshotContext.imageAssetId) {
|
|
2447
|
-
return prompt;
|
|
2448
|
-
}
|
|
2449
|
-
const lines = [
|
|
2450
|
-
"Visual screenshot context attached:",
|
|
2451
|
-
`- capturedAt=${screenshotContext.capturedAt}`,
|
|
2452
|
-
`- mimeType=${screenshotContext.mimeType}`
|
|
2453
|
-
];
|
|
2454
|
-
if (screenshotContext.imageAssetId) {
|
|
2455
|
-
lines.push(`- imageAssetId=${screenshotContext.imageAssetId}`);
|
|
2456
|
-
}
|
|
2457
|
-
return `${prompt}
|
|
2458
|
-
|
|
2459
|
-
${lines.join("\n")}`;
|
|
2460
|
-
}
|
|
2461
2783
|
function buildRuntimeContextSection(records) {
|
|
2462
2784
|
return ["Relevant runtime context:", ...records.map(formatRuntimeRecord)].join("\n");
|
|
2463
2785
|
}
|
|
@@ -2477,7 +2799,7 @@ function formatRuntimeRecord(record) {
|
|
|
2477
2799
|
|
|
2478
2800
|
// src/http.ts
|
|
2479
2801
|
import { INSPECTO_API_PATHS } from "@inspecto-dev/types";
|
|
2480
|
-
var BASE_URL = globalThis.__AI_INSPECTOR_SERVER_URL__ || "http://
|
|
2802
|
+
var BASE_URL = globalThis.__AI_INSPECTOR_SERVER_URL__ || "http://0.0.0.0:5678";
|
|
2481
2803
|
var _a;
|
|
2482
2804
|
var AI_BATCH_DISPATCH_PATH = (_a = INSPECTO_API_PATHS.AI_BATCH_DISPATCH) != null ? _a : "/inspecto/api/v1/ai/dispatch/annotations";
|
|
2483
2805
|
function setBaseUrl(url) {
|
|
@@ -2499,15 +2821,26 @@ function fetchIdeInfo(force = false) {
|
|
|
2499
2821
|
}
|
|
2500
2822
|
function openFile(req) {
|
|
2501
2823
|
return __async(this, null, function* () {
|
|
2824
|
+
return (yield openFileWithDiagnostics(req)).success;
|
|
2825
|
+
});
|
|
2826
|
+
}
|
|
2827
|
+
function openFileWithDiagnostics(req) {
|
|
2828
|
+
return __async(this, null, function* () {
|
|
2829
|
+
var _a2;
|
|
2502
2830
|
try {
|
|
2503
|
-
const res = yield fetch(`${BASE_URL}${INSPECTO_API_PATHS.
|
|
2831
|
+
const res = yield fetch(`${BASE_URL}${INSPECTO_API_PATHS.SOURCE_OPEN}`, {
|
|
2504
2832
|
method: "POST",
|
|
2505
2833
|
headers: { "Content-Type": "application/json" },
|
|
2506
2834
|
body: JSON.stringify(req)
|
|
2507
2835
|
});
|
|
2508
|
-
|
|
2836
|
+
if (res.ok) return { success: true };
|
|
2837
|
+
const err = yield res.json().catch(() => ({}));
|
|
2838
|
+
return {
|
|
2839
|
+
success: false,
|
|
2840
|
+
errorCode: (_a2 = err.errorCode) != null ? _a2 : "IDE_UNAVAILABLE"
|
|
2841
|
+
};
|
|
2509
2842
|
} catch (e) {
|
|
2510
|
-
return false;
|
|
2843
|
+
return { success: false, errorCode: "SERVER_UNAVAILABLE" };
|
|
2511
2844
|
}
|
|
2512
2845
|
});
|
|
2513
2846
|
}
|
|
@@ -2519,54 +2852,169 @@ function fetchSnippet(file, line, column, maxLines = 100) {
|
|
|
2519
2852
|
column: String(column),
|
|
2520
2853
|
maxLines: String(maxLines)
|
|
2521
2854
|
});
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2855
|
+
try {
|
|
2856
|
+
const res = yield fetch(`${BASE_URL}${INSPECTO_API_PATHS.PROJECT_SNIPPET}?${params}`);
|
|
2857
|
+
if (!res.ok) {
|
|
2858
|
+
const err = yield res.json().catch(() => ({}));
|
|
2859
|
+
throw Object.assign(new Error("snippet fetch failed"), { errorCode: err.errorCode });
|
|
2860
|
+
}
|
|
2861
|
+
return res.json();
|
|
2862
|
+
} catch (err) {
|
|
2863
|
+
if (err.errorCode) throw err;
|
|
2864
|
+
throw Object.assign(new Error("Local dev server unavailable"), {
|
|
2865
|
+
errorCode: "SERVER_UNAVAILABLE"
|
|
2866
|
+
});
|
|
2526
2867
|
}
|
|
2527
|
-
return res.json();
|
|
2528
2868
|
});
|
|
2529
2869
|
}
|
|
2530
2870
|
function sendToAi(req) {
|
|
2531
2871
|
return __async(this, null, function* () {
|
|
2532
2872
|
var _a2;
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2873
|
+
try {
|
|
2874
|
+
const res = yield fetch(`${BASE_URL}${INSPECTO_API_PATHS.AI_DISPATCH}`, {
|
|
2875
|
+
method: "POST",
|
|
2876
|
+
headers: { "Content-Type": "application/json" },
|
|
2877
|
+
body: JSON.stringify(req)
|
|
2878
|
+
});
|
|
2879
|
+
if (!res.ok) {
|
|
2880
|
+
const err = yield res.json().catch(() => ({}));
|
|
2881
|
+
return {
|
|
2882
|
+
success: false,
|
|
2883
|
+
error: (_a2 = err.error) != null ? _a2 : "Request failed",
|
|
2884
|
+
errorCode: err.errorCode
|
|
2885
|
+
};
|
|
2886
|
+
}
|
|
2887
|
+
return res.json();
|
|
2888
|
+
} catch (e) {
|
|
2540
2889
|
return {
|
|
2541
2890
|
success: false,
|
|
2542
|
-
error:
|
|
2543
|
-
errorCode:
|
|
2891
|
+
error: "Local dev server unavailable",
|
|
2892
|
+
errorCode: "SERVER_UNAVAILABLE"
|
|
2544
2893
|
};
|
|
2545
2894
|
}
|
|
2546
|
-
return res.json();
|
|
2547
2895
|
});
|
|
2548
2896
|
}
|
|
2549
2897
|
function sendAnnotationsToAi(req) {
|
|
2550
2898
|
return __async(this, null, function* () {
|
|
2551
2899
|
var _a2;
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2900
|
+
try {
|
|
2901
|
+
const res = yield fetch(`${BASE_URL}${AI_BATCH_DISPATCH_PATH}`, {
|
|
2902
|
+
method: "POST",
|
|
2903
|
+
headers: { "Content-Type": "application/json" },
|
|
2904
|
+
body: JSON.stringify(req)
|
|
2905
|
+
});
|
|
2906
|
+
if (!res.ok) {
|
|
2907
|
+
const err = yield res.json().catch(() => ({}));
|
|
2908
|
+
return {
|
|
2909
|
+
success: false,
|
|
2910
|
+
error: (_a2 = err.error) != null ? _a2 : "Request failed",
|
|
2911
|
+
errorCode: err.errorCode
|
|
2912
|
+
};
|
|
2913
|
+
}
|
|
2914
|
+
return res.json();
|
|
2915
|
+
} catch (e) {
|
|
2559
2916
|
return {
|
|
2560
2917
|
success: false,
|
|
2561
|
-
error:
|
|
2562
|
-
errorCode:
|
|
2918
|
+
error: "Local dev server unavailable",
|
|
2919
|
+
errorCode: "SERVER_UNAVAILABLE"
|
|
2563
2920
|
};
|
|
2564
2921
|
}
|
|
2565
|
-
return res.json();
|
|
2566
2922
|
});
|
|
2567
2923
|
}
|
|
2924
|
+
function fetchAnnotationSession(sessionId) {
|
|
2925
|
+
return __async(this, null, function* () {
|
|
2926
|
+
var _a2;
|
|
2927
|
+
try {
|
|
2928
|
+
const res = yield fetch(
|
|
2929
|
+
`${BASE_URL}${INSPECTO_API_PATHS.SESSIONS}/${encodeURIComponent(sessionId)}`
|
|
2930
|
+
);
|
|
2931
|
+
if (!res.ok) {
|
|
2932
|
+
const err = yield res.json().catch(() => ({}));
|
|
2933
|
+
return {
|
|
2934
|
+
success: false,
|
|
2935
|
+
error: (_a2 = err.error) != null ? _a2 : "Request failed",
|
|
2936
|
+
errorCode: err.errorCode
|
|
2937
|
+
};
|
|
2938
|
+
}
|
|
2939
|
+
const payload = yield res.json();
|
|
2940
|
+
return __spreadValues(__spreadValues({
|
|
2941
|
+
success: payload.success
|
|
2942
|
+
}, payload.session !== void 0 ? { session: payload.session } : {}), payload.error !== void 0 ? { error: payload.error } : {});
|
|
2943
|
+
} catch (e) {
|
|
2944
|
+
return {
|
|
2945
|
+
success: false,
|
|
2946
|
+
error: "Local dev server unavailable",
|
|
2947
|
+
errorCode: "SERVER_UNAVAILABLE"
|
|
2948
|
+
};
|
|
2949
|
+
}
|
|
2950
|
+
});
|
|
2951
|
+
}
|
|
2952
|
+
function openAnnotationSessionEventStream(sessionId, handlers) {
|
|
2953
|
+
if (!sessionId.trim() || typeof EventSource !== "function") {
|
|
2954
|
+
return null;
|
|
2955
|
+
}
|
|
2956
|
+
const params = new URLSearchParams({ sessionId: sessionId.trim() });
|
|
2957
|
+
const source = new EventSource(`${BASE_URL}${INSPECTO_API_PATHS.SESSION_EVENTS}?${params}`);
|
|
2958
|
+
const handleEvent = (event) => {
|
|
2959
|
+
const messageEvent = event;
|
|
2960
|
+
try {
|
|
2961
|
+
const payload = JSON.parse(messageEvent.data);
|
|
2962
|
+
handlers.onEvent(payload);
|
|
2963
|
+
} catch (e) {
|
|
2964
|
+
}
|
|
2965
|
+
};
|
|
2966
|
+
source.addEventListener("session-created", handleEvent);
|
|
2967
|
+
source.addEventListener("session-message-appended", handleEvent);
|
|
2968
|
+
source.addEventListener("session-status-updated", handleEvent);
|
|
2969
|
+
if (handlers.onError) {
|
|
2970
|
+
source.addEventListener("error", handlers.onError);
|
|
2971
|
+
}
|
|
2972
|
+
return {
|
|
2973
|
+
close() {
|
|
2974
|
+
source.close();
|
|
2975
|
+
}
|
|
2976
|
+
};
|
|
2977
|
+
}
|
|
2568
2978
|
|
|
2569
2979
|
// src/component-annotate-ui.ts
|
|
2980
|
+
function formatContextAsMarkdown(instruction, annotations) {
|
|
2981
|
+
let md = "";
|
|
2982
|
+
if (instruction) {
|
|
2983
|
+
md += `${instruction}
|
|
2984
|
+
|
|
2985
|
+
`;
|
|
2986
|
+
}
|
|
2987
|
+
if (annotations.length > 0) {
|
|
2988
|
+
md += "### Selected Elements\n\n";
|
|
2989
|
+
annotations.forEach((ann, index) => {
|
|
2990
|
+
md += `**Annotation ${index + 1}**
|
|
2991
|
+
`;
|
|
2992
|
+
if (ann.note) {
|
|
2993
|
+
md += `* Note: ${ann.note}
|
|
2994
|
+
`;
|
|
2995
|
+
}
|
|
2996
|
+
ann.targets.forEach((target, targetIndex) => {
|
|
2997
|
+
md += `
|
|
2998
|
+
* Target ${targetIndex + 1}:
|
|
2999
|
+
`;
|
|
3000
|
+
if (target.label) md += ` - Label: \`${target.label}\`
|
|
3001
|
+
`;
|
|
3002
|
+
if (target.location)
|
|
3003
|
+
md += ` - Location: \`${target.location.file.split("/").pop() || target.location.file}:${target.location.line}:${target.location.column}\`
|
|
3004
|
+
`;
|
|
3005
|
+
if (target.selector) md += ` - Selector: \`${target.selector}\`
|
|
3006
|
+
`;
|
|
3007
|
+
if (target.snippet) md += `
|
|
3008
|
+
\`\`\`
|
|
3009
|
+
${target.snippet}
|
|
3010
|
+
\`\`\`
|
|
3011
|
+
`;
|
|
3012
|
+
});
|
|
3013
|
+
md += "\n---\n\n";
|
|
3014
|
+
});
|
|
3015
|
+
}
|
|
3016
|
+
return md.trim();
|
|
3017
|
+
}
|
|
2570
3018
|
function hasCurrentRecordUi(ctx) {
|
|
2571
3019
|
return Boolean(asAnnotateContext(ctx).annotateSession.current.target);
|
|
2572
3020
|
}
|
|
@@ -2591,6 +3039,7 @@ function clearAnnotateSuccess(ctx) {
|
|
|
2591
3039
|
clearTimeout(state.annotateSuccessTimeout);
|
|
2592
3040
|
state.annotateSuccessTimeout = null;
|
|
2593
3041
|
}
|
|
3042
|
+
state.annotateSuccessOnClear = null;
|
|
2594
3043
|
if (hadSuccess) {
|
|
2595
3044
|
state.updateAnnotateSidebar();
|
|
2596
3045
|
}
|
|
@@ -2600,11 +3049,29 @@ function showAnnotateSuccess(ctx, scope) {
|
|
|
2600
3049
|
clearAnnotateSuccess(state);
|
|
2601
3050
|
state.annotateSuccessScope = scope;
|
|
2602
3051
|
state.annotateSuccessTimeout = setTimeout(() => {
|
|
3052
|
+
const onClear = state.annotateSuccessOnClear;
|
|
2603
3053
|
state.annotateSuccessScope = null;
|
|
2604
3054
|
state.annotateSuccessTimeout = null;
|
|
3055
|
+
state.annotateSuccessOnClear = null;
|
|
3056
|
+
onClear == null ? void 0 : onClear();
|
|
2605
3057
|
state.updateAnnotateSidebar();
|
|
2606
3058
|
}, 1500);
|
|
2607
3059
|
}
|
|
3060
|
+
function updateLatestSessionState(ctx, session) {
|
|
3061
|
+
const state = asAnnotateContext(ctx);
|
|
3062
|
+
state.annotateLatestSessionDetail = session;
|
|
3063
|
+
state.annotateLatestSessionSummary = {
|
|
3064
|
+
id: session.id,
|
|
3065
|
+
status: session.status,
|
|
3066
|
+
createdAt: session.createdAt,
|
|
3067
|
+
updatedAt: session.updatedAt
|
|
3068
|
+
};
|
|
3069
|
+
state.annotateLatestSessionError = "";
|
|
3070
|
+
if (session.status === "resolved" || session.status === "dismissed") {
|
|
3071
|
+
state.stopLatestAnnotateSessionStream();
|
|
3072
|
+
}
|
|
3073
|
+
state.renderAnnotateSelectionOverlay();
|
|
3074
|
+
}
|
|
2608
3075
|
function toAnnotateErrorMessage(_ctx, errorCode, fallback) {
|
|
2609
3076
|
if (errorCode === "FORBIDDEN_PATH") {
|
|
2610
3077
|
return "Some selected targets are outside the current project workspace.";
|
|
@@ -2612,6 +3079,9 @@ function toAnnotateErrorMessage(_ctx, errorCode, fallback) {
|
|
|
2612
3079
|
if (errorCode === "INVALID_REQUEST") {
|
|
2613
3080
|
return "The current annotation batch is incomplete. Check your targets and try again.";
|
|
2614
3081
|
}
|
|
3082
|
+
if (errorCode === "SERVER_UNAVAILABLE") {
|
|
3083
|
+
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.";
|
|
3084
|
+
}
|
|
2615
3085
|
return fallback != null ? fallback : "Request failed";
|
|
2616
3086
|
}
|
|
2617
3087
|
function toAnnotationTransportFromRecordUi(_ctx, record) {
|
|
@@ -2625,8 +3095,9 @@ function toAnnotationTransportFromRecordUi(_ctx, record) {
|
|
|
2625
3095
|
]
|
|
2626
3096
|
};
|
|
2627
3097
|
}
|
|
2628
|
-
function sendAnnotationBatch(ctx, annotations, scope, instruction, onSuccess) {
|
|
3098
|
+
function sendAnnotationBatch(ctx, annotations, scope, instruction, deliveryMode, onSuccess) {
|
|
2629
3099
|
return __async(this, null, function* () {
|
|
3100
|
+
var _a2, _b;
|
|
2630
3101
|
const state = asAnnotateContext(ctx);
|
|
2631
3102
|
if (annotations.length === 0 || state.annotateSendState.isSending) return;
|
|
2632
3103
|
state.annotateSendState = { isSending: true, scope };
|
|
@@ -2634,26 +3105,38 @@ function sendAnnotationBatch(ctx, annotations, scope, instruction, onSuccess) {
|
|
|
2634
3105
|
try {
|
|
2635
3106
|
yield state.configLoadPromise;
|
|
2636
3107
|
const runtimeContext = state.getAnnotateRuntimeContext(annotations);
|
|
2637
|
-
const screenshotContext = state.annotateScreenshotContextEnabled ? yield state.captureAnnotateScreenshotContext(annotations, scope) : null;
|
|
2638
3108
|
const cssContextPrompt = state.getAnnotateCssContextPrompt(annotations);
|
|
2639
|
-
const result = yield sendAnnotationsToAi(
|
|
3109
|
+
const result = yield sendAnnotationsToAi(__spreadProps(__spreadValues(__spreadValues({
|
|
2640
3110
|
instruction,
|
|
2641
|
-
annotations
|
|
2642
|
-
|
|
2643
|
-
|
|
3111
|
+
annotations
|
|
3112
|
+
}, runtimeContext ? { runtimeContext } : {}), cssContextPrompt ? { cssContextPrompt } : {}), {
|
|
3113
|
+
deliveryMode
|
|
3114
|
+
}));
|
|
2644
3115
|
if (!result.success) {
|
|
2645
3116
|
state.annotateErrorMessage = toAnnotateErrorMessage(state, result.errorCode, result.error);
|
|
2646
3117
|
state.updateAnnotateSidebar();
|
|
2647
3118
|
return;
|
|
2648
3119
|
}
|
|
3120
|
+
state.annotateLatestSessionSummary = (_a2 = result.session) != null ? _a2 : null;
|
|
3121
|
+
state.annotateLatestSessionDetail = null;
|
|
3122
|
+
state.annotateLatestSessionError = "";
|
|
3123
|
+
if ((_b = result.session) == null ? void 0 : _b.id) {
|
|
3124
|
+
state.startLatestAnnotateSessionStream(result.session.id);
|
|
3125
|
+
void state.refreshLatestAnnotateSession();
|
|
3126
|
+
} else {
|
|
3127
|
+
state.stopLatestAnnotateSessionStream();
|
|
3128
|
+
}
|
|
2649
3129
|
onSuccess();
|
|
2650
3130
|
state.annotateErrorMessage = "";
|
|
2651
3131
|
state.showAnnotateSuccess(scope);
|
|
2652
|
-
state.annotateElements.clear();
|
|
2653
3132
|
state.renderAnnotateSelectionOverlay();
|
|
2654
3133
|
state.updateAnnotateSidebar();
|
|
2655
|
-
} catch (
|
|
2656
|
-
state.annotateErrorMessage =
|
|
3134
|
+
} catch (err) {
|
|
3135
|
+
state.annotateErrorMessage = toAnnotateErrorMessage(
|
|
3136
|
+
state,
|
|
3137
|
+
err.errorCode,
|
|
3138
|
+
err.message
|
|
3139
|
+
);
|
|
2657
3140
|
state.updateAnnotateSidebar();
|
|
2658
3141
|
} finally {
|
|
2659
3142
|
state.annotateSendState = { isSending: false, scope: null };
|
|
@@ -2661,7 +3144,56 @@ function sendAnnotationBatch(ctx, annotations, scope, instruction, onSuccess) {
|
|
|
2661
3144
|
}
|
|
2662
3145
|
});
|
|
2663
3146
|
}
|
|
3147
|
+
function refreshLatestAnnotateSession(ctx) {
|
|
3148
|
+
return __async(this, null, function* () {
|
|
3149
|
+
var _a2, _b, _c, _d;
|
|
3150
|
+
const state = asAnnotateContext(ctx);
|
|
3151
|
+
const sessionId = (_c = (_a2 = state.annotateLatestSessionSummary) == null ? void 0 : _a2.id) != null ? _c : (_b = state.annotateLatestSessionDetail) == null ? void 0 : _b.id;
|
|
3152
|
+
if (!sessionId || state.annotateLatestSessionLoading) return;
|
|
3153
|
+
state.annotateLatestSessionLoading = true;
|
|
3154
|
+
state.annotateLatestSessionError = "";
|
|
3155
|
+
state.updateAnnotateSidebar();
|
|
3156
|
+
try {
|
|
3157
|
+
const result = yield fetchAnnotationSession(sessionId);
|
|
3158
|
+
if (!result.success || !result.session) {
|
|
3159
|
+
state.annotateLatestSessionError = toAnnotateErrorMessage(
|
|
3160
|
+
state,
|
|
3161
|
+
result.errorCode,
|
|
3162
|
+
(_d = result.error) != null ? _d : "Failed to refresh latest session."
|
|
3163
|
+
);
|
|
3164
|
+
return;
|
|
3165
|
+
}
|
|
3166
|
+
updateLatestSessionState(state, result.session);
|
|
3167
|
+
} finally {
|
|
3168
|
+
state.annotateLatestSessionLoading = false;
|
|
3169
|
+
state.updateAnnotateSidebar();
|
|
3170
|
+
}
|
|
3171
|
+
});
|
|
3172
|
+
}
|
|
3173
|
+
function startLatestAnnotateSessionStream(ctx, sessionId) {
|
|
3174
|
+
const state = asAnnotateContext(ctx);
|
|
3175
|
+
state.stopLatestAnnotateSessionStream();
|
|
3176
|
+
const connection = openAnnotationSessionEventStream(sessionId, {
|
|
3177
|
+
onEvent: (event) => {
|
|
3178
|
+
if (event.session.id !== sessionId) return;
|
|
3179
|
+
updateLatestSessionState(state, event.session);
|
|
3180
|
+
state.updateAnnotateSidebar();
|
|
3181
|
+
},
|
|
3182
|
+
onError: () => {
|
|
3183
|
+
state.annotateLatestSessionError = "Live session updates disconnected. You can refresh to reconnect.";
|
|
3184
|
+
state.updateAnnotateSidebar();
|
|
3185
|
+
}
|
|
3186
|
+
});
|
|
3187
|
+
state.annotateLatestSessionStream = connection;
|
|
3188
|
+
}
|
|
3189
|
+
function stopLatestAnnotateSessionStream(ctx) {
|
|
3190
|
+
var _a2;
|
|
3191
|
+
const state = asAnnotateContext(ctx);
|
|
3192
|
+
(_a2 = state.annotateLatestSessionStream) == null ? void 0 : _a2.close();
|
|
3193
|
+
state.annotateLatestSessionStream = null;
|
|
3194
|
+
}
|
|
2664
3195
|
function getAnnotateSidebarOptions(ctx) {
|
|
3196
|
+
var _a2;
|
|
2665
3197
|
const state = asAnnotateContext(ctx);
|
|
2666
3198
|
const includedRecords = state.annotateSession.records;
|
|
2667
3199
|
const savedAnnotations = state.annotateSession.records.map(
|
|
@@ -2682,10 +3214,12 @@ function getAnnotateSidebarOptions(ctx) {
|
|
|
2682
3214
|
const fullInstruction = composeAnnotateInstruction(state);
|
|
2683
3215
|
const allRuntimeContext = state.getAnnotateRuntimeContext(allAnnotations);
|
|
2684
3216
|
const allCssContextPrompt = state.getAnnotateCssContextPrompt(allAnnotations);
|
|
3217
|
+
const deliveryPreference = (_a2 = state.annotateDeliveryMode) != null ? _a2 : "both";
|
|
3218
|
+
let preferredAction = "create-task";
|
|
3219
|
+
if (deliveryPreference === "ide") preferredAction = "quick-ask";
|
|
3220
|
+
if (deliveryPreference === "agent") preferredAction = "create-task";
|
|
2685
3221
|
return {
|
|
2686
3222
|
mode: state.annotateCapturePaused ? "capture-paused" : "capture-enabled",
|
|
2687
|
-
canAttachScreenshotContext: false,
|
|
2688
|
-
screenshotContextEnabled: state.annotateScreenshotContextEnabled,
|
|
2689
3223
|
canAttachCssContext: false,
|
|
2690
3224
|
cssContextEnabled: false,
|
|
2691
3225
|
canAttachRuntimeContext: state.canAttachRuntimeContext(),
|
|
@@ -2698,13 +3232,18 @@ function getAnnotateSidebarOptions(ctx) {
|
|
|
2698
3232
|
fullPrompt: buildAnnotateFullPrompt({
|
|
2699
3233
|
instruction: fullInstruction,
|
|
2700
3234
|
annotations: allAnnotations,
|
|
2701
|
-
responseMode: state.getAnnotationResponseMode(),
|
|
2702
3235
|
runtimeContext: allRuntimeContext,
|
|
2703
3236
|
cssContextPrompt: allCssContextPrompt
|
|
2704
3237
|
}),
|
|
2705
3238
|
isSending: state.annotateSendState.isSending,
|
|
2706
3239
|
sendingScope: state.annotateSendState.scope,
|
|
2707
3240
|
successScope: state.annotateSuccessScope,
|
|
3241
|
+
preferredAction,
|
|
3242
|
+
annotateDeliveryMode: state.annotateDeliveryMode,
|
|
3243
|
+
latestSessionSummary: state.annotateLatestSessionSummary,
|
|
3244
|
+
latestSessionDetail: state.annotateLatestSessionDetail,
|
|
3245
|
+
latestSessionLoading: state.annotateLatestSessionLoading,
|
|
3246
|
+
latestSessionError: state.annotateLatestSessionError,
|
|
2708
3247
|
quickCaptureEnabled: state.annotateQuickCaptureEnabled,
|
|
2709
3248
|
errorMessage: state.annotateErrorMessage,
|
|
2710
3249
|
onPauseCapture: () => {
|
|
@@ -2737,11 +3276,11 @@ function getAnnotateSidebarOptions(ctx) {
|
|
|
2737
3276
|
state.updateAnnotateSidebar();
|
|
2738
3277
|
},
|
|
2739
3278
|
onRemovePromptChip: (recordId) => {
|
|
2740
|
-
var
|
|
3279
|
+
var _a3;
|
|
2741
3280
|
state.clearAnnotateError();
|
|
2742
3281
|
state.clearAnnotateSuccess();
|
|
2743
3282
|
const currentTarget = state.annotateSession.current.id === recordId ? state.annotateSession.current.target : null;
|
|
2744
|
-
const savedRecord = (
|
|
3283
|
+
const savedRecord = (_a3 = state.annotateSession.records.find((record) => record.id === recordId)) != null ? _a3 : null;
|
|
2745
3284
|
if (currentTarget) {
|
|
2746
3285
|
clearDraftForTarget(state, currentTarget);
|
|
2747
3286
|
state.annotateSession = clearCurrentRecord(state.annotateSession);
|
|
@@ -2759,8 +3298,38 @@ function getAnnotateSidebarOptions(ctx) {
|
|
|
2759
3298
|
state.clearAnnotateSuccess();
|
|
2760
3299
|
beginEditingRecord(state, recordId);
|
|
2761
3300
|
},
|
|
2762
|
-
|
|
2763
|
-
|
|
3301
|
+
onRefreshLatestSession: () => {
|
|
3302
|
+
void state.refreshLatestAnnotateSession();
|
|
3303
|
+
},
|
|
3304
|
+
onCopyContext: () => {
|
|
3305
|
+
var _a3;
|
|
3306
|
+
const transports = state.annotateSession.records.map(
|
|
3307
|
+
(record) => toAnnotationTransportFromRecordUi(null, record)
|
|
3308
|
+
);
|
|
3309
|
+
if (hasCurrentRecordUi(state) && state.annotateSession.current.target) {
|
|
3310
|
+
transports.push(
|
|
3311
|
+
toAnnotationTransportFromRecordUi(null, {
|
|
3312
|
+
id: state.annotateSession.current.id,
|
|
3313
|
+
displayOrder: (_a3 = state.annotateSession.current.displayOrder) != null ? _a3 : getNextRecordDisplayOrderUi(state),
|
|
3314
|
+
target: state.annotateSession.current.target,
|
|
3315
|
+
note: state.annotateSession.current.note,
|
|
3316
|
+
intent: state.annotateSession.current.intent
|
|
3317
|
+
})
|
|
3318
|
+
);
|
|
3319
|
+
}
|
|
3320
|
+
const instruction = composeAnnotateInstruction(state);
|
|
3321
|
+
const markdown = formatContextAsMarkdown(instruction, transports);
|
|
3322
|
+
return navigator.clipboard.writeText(markdown).then(() => {
|
|
3323
|
+
state.annotateErrorMessage = "";
|
|
3324
|
+
}).catch((err) => {
|
|
3325
|
+
console.error("Failed to copy to clipboard:", err);
|
|
3326
|
+
state.annotateErrorMessage = t("annotate.copyContext.failed");
|
|
3327
|
+
state.updateAnnotateSidebar();
|
|
3328
|
+
throw err;
|
|
3329
|
+
});
|
|
3330
|
+
},
|
|
3331
|
+
onQuickAsk: () => {
|
|
3332
|
+
var _a3;
|
|
2764
3333
|
const transports = state.annotateSession.records.map(
|
|
2765
3334
|
(record) => toAnnotationTransportFromRecordUi(null, record)
|
|
2766
3335
|
);
|
|
@@ -2768,7 +3337,7 @@ function getAnnotateSidebarOptions(ctx) {
|
|
|
2768
3337
|
transports.push(
|
|
2769
3338
|
toAnnotationTransportFromRecordUi(null, {
|
|
2770
3339
|
id: state.annotateSession.current.id,
|
|
2771
|
-
displayOrder: (
|
|
3340
|
+
displayOrder: (_a3 = state.annotateSession.current.displayOrder) != null ? _a3 : getNextRecordDisplayOrderUi(state),
|
|
2772
3341
|
target: state.annotateSession.current.target,
|
|
2773
3342
|
note: state.annotateSession.current.note,
|
|
2774
3343
|
intent: state.annotateSession.current.intent
|
|
@@ -2778,12 +3347,42 @@ function getAnnotateSidebarOptions(ctx) {
|
|
|
2778
3347
|
void sendAnnotationBatch(
|
|
2779
3348
|
state,
|
|
2780
3349
|
transports,
|
|
2781
|
-
"
|
|
3350
|
+
"quick-ask",
|
|
2782
3351
|
composeAnnotateInstruction(state),
|
|
3352
|
+
"ide",
|
|
2783
3353
|
() => {
|
|
3354
|
+
state.annotateInstructionDraft = "";
|
|
2784
3355
|
state.annotateDrafts.clear();
|
|
2785
3356
|
state.annotateEditingRecord = null;
|
|
2786
3357
|
state.annotateSession = createEmptySession();
|
|
3358
|
+
state.annotateElements.clear();
|
|
3359
|
+
state.renderAnnotateSelectionOverlay();
|
|
3360
|
+
}
|
|
3361
|
+
);
|
|
3362
|
+
},
|
|
3363
|
+
onCreateTask: () => {
|
|
3364
|
+
var _a3;
|
|
3365
|
+
const transports = state.annotateSession.records.map(
|
|
3366
|
+
(record) => toAnnotationTransportFromRecordUi(null, record)
|
|
3367
|
+
);
|
|
3368
|
+
if (hasCurrentRecordUi(state) && state.annotateSession.current.target) {
|
|
3369
|
+
transports.push(
|
|
3370
|
+
toAnnotationTransportFromRecordUi(null, {
|
|
3371
|
+
id: state.annotateSession.current.id,
|
|
3372
|
+
displayOrder: (_a3 = state.annotateSession.current.displayOrder) != null ? _a3 : getNextRecordDisplayOrderUi(state),
|
|
3373
|
+
target: state.annotateSession.current.target,
|
|
3374
|
+
note: state.annotateSession.current.note,
|
|
3375
|
+
intent: state.annotateSession.current.intent
|
|
3376
|
+
})
|
|
3377
|
+
);
|
|
3378
|
+
}
|
|
3379
|
+
void sendAnnotationBatch(
|
|
3380
|
+
state,
|
|
3381
|
+
transports,
|
|
3382
|
+
"create-task",
|
|
3383
|
+
composeAnnotateInstruction(state),
|
|
3384
|
+
"agent",
|
|
3385
|
+
() => {
|
|
2787
3386
|
}
|
|
2788
3387
|
);
|
|
2789
3388
|
},
|
|
@@ -2804,15 +3403,16 @@ function renderAnnotateSelectionOverlay(ctx) {
|
|
|
2804
3403
|
return;
|
|
2805
3404
|
}
|
|
2806
3405
|
const overlayTargets = state.annotateSession.records.map((record) => {
|
|
2807
|
-
var _a3;
|
|
3406
|
+
var _a3, _b2, _c;
|
|
2808
3407
|
if (((_a3 = state.annotateEditingRecord) == null ? void 0 : _a3.id) === record.id) return null;
|
|
2809
3408
|
const element = findElementForAnnotationTarget(state, record.target);
|
|
2810
3409
|
if (!element) return null;
|
|
3410
|
+
const overlayState = ((_b2 = state.annotateLatestSessionSummary) == null ? void 0 : _b2.status) === "resolved" || ((_c = state.annotateLatestSessionDetail) == null ? void 0 : _c.status) === "resolved" ? "completed" : "saved";
|
|
2811
3411
|
return {
|
|
2812
3412
|
id: record.id,
|
|
2813
3413
|
element,
|
|
2814
3414
|
order: record.displayOrder,
|
|
2815
|
-
state:
|
|
3415
|
+
state: overlayState,
|
|
2816
3416
|
note: record.note,
|
|
2817
3417
|
onActivate: () => {
|
|
2818
3418
|
state.clearAnnotateError();
|
|
@@ -2841,15 +3441,13 @@ function renderAnnotateSelectionOverlay(ctx) {
|
|
|
2841
3441
|
onOpenInEditor: () => {
|
|
2842
3442
|
void openFile(target.location);
|
|
2843
3443
|
},
|
|
2844
|
-
canAttachScreenshotContext: false,
|
|
2845
|
-
screenshotContextEnabled: false,
|
|
2846
3444
|
canAttachCssContext: state.canAttachCssContext(),
|
|
2847
3445
|
cssContextEnabled: (_b = state.annotateSession.current.cssContextEnabled) != null ? _b : false,
|
|
2848
3446
|
canAttachRuntimeContext: false,
|
|
2849
3447
|
runtimeContextEnabled: false,
|
|
2850
3448
|
runtimeContextSummary: "",
|
|
2851
3449
|
runtimeErrorCount: 0,
|
|
2852
|
-
saveLabel: state.annotateEditingRecord ? "
|
|
3450
|
+
saveLabel: state.annotateEditingRecord ? t("annotate.updateNote") : t("annotate.saveNote"),
|
|
2853
3451
|
onToggleCssContext: () => {
|
|
2854
3452
|
var _a3;
|
|
2855
3453
|
state.annotateSession = updateCurrentRecordCssContextEnabled(
|
|
@@ -2866,9 +3464,23 @@ function renderAnnotateSelectionOverlay(ctx) {
|
|
|
2866
3464
|
state.updateAnnotateSidebar();
|
|
2867
3465
|
},
|
|
2868
3466
|
onSave: () => {
|
|
3467
|
+
var _a3, _b2;
|
|
2869
3468
|
if (!hasCurrentRecordUi(state)) return;
|
|
2870
3469
|
state.clearAnnotateError();
|
|
2871
3470
|
state.clearAnnotateSuccess();
|
|
3471
|
+
if (((_a3 = state.annotateLatestSessionSummary) == null ? void 0 : _a3.status) === "resolved" || ((_b2 = state.annotateLatestSessionDetail) == null ? void 0 : _b2.status) === "resolved") {
|
|
3472
|
+
const currentDraft = state.annotateSession.current;
|
|
3473
|
+
state.annotateLatestSessionSummary = null;
|
|
3474
|
+
state.annotateLatestSessionDetail = null;
|
|
3475
|
+
state.stopLatestAnnotateSessionStream();
|
|
3476
|
+
state.annotateInstructionDraft = "";
|
|
3477
|
+
state.annotateDrafts.clear();
|
|
3478
|
+
state.annotateEditingRecord = null;
|
|
3479
|
+
state.annotateSession = {
|
|
3480
|
+
current: currentDraft,
|
|
3481
|
+
records: []
|
|
3482
|
+
};
|
|
3483
|
+
}
|
|
2872
3484
|
clearDraftForTarget(state, state.annotateSession.current.target);
|
|
2873
3485
|
state.annotateSession = saveCurrentRecord(state.annotateSession);
|
|
2874
3486
|
state.annotateEditingRecord = null;
|
|
@@ -2939,7 +3551,7 @@ function createBadge(ctx) {
|
|
|
2939
3551
|
stateSpan.hidden = true;
|
|
2940
3552
|
const titleSpan = document.createElement("span");
|
|
2941
3553
|
titleSpan.className = `${badgeClass}-title`;
|
|
2942
|
-
titleSpan.textContent = "
|
|
3554
|
+
titleSpan.textContent = t("launcher.title");
|
|
2943
3555
|
const eyes = document.createElement("span");
|
|
2944
3556
|
eyes.className = `${badgeClass}-eyes`;
|
|
2945
3557
|
eyes.setAttribute("aria-hidden", "true");
|
|
@@ -2963,14 +3575,18 @@ function createBadge(ctx) {
|
|
|
2963
3575
|
panel.dataset.inspectoLauncherPanel = "true";
|
|
2964
3576
|
const panelHeader = document.createElement("div");
|
|
2965
3577
|
panelHeader.className = `${badgeClass}-panel-header`;
|
|
2966
|
-
|
|
3578
|
+
const panelHeaderCopy = document.createElement("div");
|
|
3579
|
+
panelHeaderCopy.className = `${badgeClass}-panel-header-copy`;
|
|
3580
|
+
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>`;
|
|
3581
|
+
const panelHeaderActions = document.createElement("div");
|
|
3582
|
+
panelHeaderActions.className = `${badgeClass}-panel-header-actions`;
|
|
2967
3583
|
const modeGroup = document.createElement("div");
|
|
2968
3584
|
modeGroup.className = `${badgeClass}-panel-group`;
|
|
2969
3585
|
const inspectBtn = document.createElement("button");
|
|
2970
3586
|
inspectBtn.type = "button";
|
|
2971
3587
|
inspectBtn.className = `${badgeClass}-panel-button`;
|
|
2972
3588
|
inspectBtn.dataset.inspectoLauncherAction = "inspect";
|
|
2973
|
-
inspectBtn.innerHTML =
|
|
3589
|
+
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>`;
|
|
2974
3590
|
inspectBtn.addEventListener("click", (event) => {
|
|
2975
3591
|
event.stopPropagation();
|
|
2976
3592
|
if (state.disabled) setPaused(state, false);
|
|
@@ -2983,7 +3599,7 @@ function createBadge(ctx) {
|
|
|
2983
3599
|
annotateBtn.type = "button";
|
|
2984
3600
|
annotateBtn.className = `${badgeClass}-panel-button`;
|
|
2985
3601
|
annotateBtn.dataset.inspectoLauncherAction = "annotate";
|
|
2986
|
-
annotateBtn.innerHTML =
|
|
3602
|
+
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>`;
|
|
2987
3603
|
annotateBtn.addEventListener("click", (event) => {
|
|
2988
3604
|
event.stopPropagation();
|
|
2989
3605
|
if (state.disabled) setPaused(state, false);
|
|
@@ -2994,13 +3610,18 @@ function createBadge(ctx) {
|
|
|
2994
3610
|
});
|
|
2995
3611
|
const pauseBtn = document.createElement("button");
|
|
2996
3612
|
pauseBtn.type = "button";
|
|
2997
|
-
pauseBtn.className = `${badgeClass}-panel-button
|
|
3613
|
+
pauseBtn.className = `${badgeClass}-panel-toggle-button`;
|
|
2998
3614
|
pauseBtn.dataset.inspectoLauncherAction = "pause";
|
|
2999
|
-
pauseBtn.
|
|
3615
|
+
pauseBtn.setAttribute("aria-label", t("launcher.action.pause.title"));
|
|
3616
|
+
pauseBtn.setAttribute("aria-pressed", "false");
|
|
3617
|
+
pauseBtn.innerHTML = pauseIconSvg;
|
|
3000
3618
|
pauseBtn.addEventListener("click", (event) => {
|
|
3001
3619
|
event.stopPropagation();
|
|
3002
3620
|
setPaused(state, !state.disabled);
|
|
3003
3621
|
});
|
|
3622
|
+
const pauseText = document.createElement("div");
|
|
3623
|
+
pauseText.className = `${badgeClass}-panel-status-text`;
|
|
3624
|
+
pauseText.dataset.inspectoLauncherPauseText = "true";
|
|
3004
3625
|
const hotkeyHint = document.createElement("div");
|
|
3005
3626
|
hotkeyHint.className = `${badgeClass}-panel-hint`;
|
|
3006
3627
|
hotkeyHint.dataset.inspectoLauncherHint = "hotkey";
|
|
@@ -3008,7 +3629,9 @@ function createBadge(ctx) {
|
|
|
3008
3629
|
utilityGroup.className = `${badgeClass}-panel-group`;
|
|
3009
3630
|
utilityGroup.dataset.inspectoLauncherUtilityGroup = "true";
|
|
3010
3631
|
modeGroup.append(inspectBtn, annotateBtn);
|
|
3011
|
-
|
|
3632
|
+
panelHeader.append(panelHeaderCopy, panelHeaderActions);
|
|
3633
|
+
utilityGroup.append(hotkeyHint);
|
|
3634
|
+
panelHeaderActions.append(pauseText, pauseBtn);
|
|
3012
3635
|
panel.append(panelHeader, modeGroup, utilityGroup);
|
|
3013
3636
|
titleBlock.append(titleSpan, stateSpan);
|
|
3014
3637
|
content.append(indicator, titleBlock);
|
|
@@ -3141,10 +3764,13 @@ function updateBadgeContent(ctx) {
|
|
|
3141
3764
|
const pauseBtn = state.badge.querySelector(
|
|
3142
3765
|
`[data-inspecto-launcher-action="pause"]`
|
|
3143
3766
|
);
|
|
3767
|
+
const pauseText = state.badge.querySelector(
|
|
3768
|
+
`[data-inspecto-launcher-pause-text]`
|
|
3769
|
+
);
|
|
3144
3770
|
const hotkeyHint = state.badge.querySelector(
|
|
3145
3771
|
`[data-inspecto-launcher-hint="hotkey"]`
|
|
3146
3772
|
);
|
|
3147
|
-
if (!indicator || !titleSpan || !stateSpan || !panel || !inspectBtn || !annotateBtn || !pauseBtn || !hotkeyHint) {
|
|
3773
|
+
if (!indicator || !titleSpan || !stateSpan || !panel || !inspectBtn || !annotateBtn || !pauseBtn || !pauseText || !hotkeyHint) {
|
|
3148
3774
|
return;
|
|
3149
3775
|
}
|
|
3150
3776
|
const updateModeButton = (button, active) => {
|
|
@@ -3153,32 +3779,39 @@ function updateBadgeContent(ctx) {
|
|
|
3153
3779
|
};
|
|
3154
3780
|
let stateLabel;
|
|
3155
3781
|
if (state.disabled) {
|
|
3156
|
-
stateLabel = "
|
|
3782
|
+
stateLabel = t("launcher.state.paused");
|
|
3157
3783
|
indicator.dataset.state = "paused";
|
|
3158
3784
|
state.badge.classList.remove("active");
|
|
3159
3785
|
state.badge.classList.add("disabled");
|
|
3160
3786
|
} else if (state.mode === "annotate") {
|
|
3161
|
-
stateLabel = "
|
|
3787
|
+
stateLabel = t("launcher.state.annotate");
|
|
3162
3788
|
indicator.dataset.state = "annotate";
|
|
3163
3789
|
state.badge.classList.remove("disabled");
|
|
3164
3790
|
state.badge.classList.add("active");
|
|
3165
3791
|
} else if (state.active) {
|
|
3166
|
-
stateLabel = "
|
|
3792
|
+
stateLabel = t("launcher.state.inspect");
|
|
3167
3793
|
indicator.dataset.state = "inspect";
|
|
3168
3794
|
state.badge.classList.remove("disabled");
|
|
3169
3795
|
state.badge.classList.add("active");
|
|
3170
3796
|
} else {
|
|
3171
|
-
stateLabel = "
|
|
3797
|
+
stateLabel = t("launcher.state.ready");
|
|
3172
3798
|
indicator.dataset.state = "ready";
|
|
3173
3799
|
state.badge.classList.remove("active", "disabled");
|
|
3174
3800
|
}
|
|
3175
3801
|
stateSpan.dataset.state = indicator.dataset.state;
|
|
3176
3802
|
stateSpan.hidden = false;
|
|
3177
|
-
titleSpan.textContent = "
|
|
3803
|
+
titleSpan.textContent = t("launcher.title");
|
|
3178
3804
|
stateSpan.textContent = stateLabel;
|
|
3179
3805
|
panel.style.display = state.launcherPanelOpen ? "flex" : "none";
|
|
3180
|
-
|
|
3181
|
-
|
|
3806
|
+
const isPaused = state.disabled;
|
|
3807
|
+
pauseBtn.setAttribute(
|
|
3808
|
+
"aria-label",
|
|
3809
|
+
isPaused ? t("launcher.action.resume.title") : t("launcher.action.pause.title")
|
|
3810
|
+
);
|
|
3811
|
+
pauseBtn.setAttribute("aria-pressed", isPaused ? "true" : "false");
|
|
3812
|
+
pauseBtn.innerHTML = isPaused ? playIconSvg : pauseIconSvg;
|
|
3813
|
+
pauseText.textContent = isPaused ? t("launcher.action.resume.title") : t("launcher.action.pause.title");
|
|
3814
|
+
hotkeyHint.textContent = getEffectiveHotKeys(state) === false ? t("launcher.hint.hotkeyDisabled") : t("launcher.hint.hotkeyQuickJump", { hotkey: getHotKeyLabel(state) });
|
|
3182
3815
|
inspectBtn.style.display = state.disabled ? "none" : "inline-flex";
|
|
3183
3816
|
annotateBtn.style.display = state.disabled ? "none" : "inline-flex";
|
|
3184
3817
|
updateModeButton(inspectBtn, !state.disabled && state.active && state.mode === "inspect");
|
|
@@ -3323,21 +3956,16 @@ function buildFixBugPrompt(input) {
|
|
|
3323
3956
|
const evidence = selectFixBugEvidence(input.records);
|
|
3324
3957
|
const templateGuidance = normalizeTemplateGuidance(input.template);
|
|
3325
3958
|
return [
|
|
3326
|
-
"
|
|
3959
|
+
"Fix the bug for the inspected UI target.",
|
|
3327
3960
|
buildSourceContextSection(input.location, input.snippet),
|
|
3328
3961
|
buildEvidenceSection(evidence),
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
"
|
|
3335
|
-
|
|
3336
|
-
"2. Confirmed evidence",
|
|
3337
|
-
"3. Hypotheses",
|
|
3338
|
-
"4. Minimal fix",
|
|
3339
|
-
"5. Follow-up questions (only if needed)",
|
|
3340
|
-
templateGuidance ? `Configured intent guidance (reference only):
|
|
3962
|
+
[
|
|
3963
|
+
"Task:",
|
|
3964
|
+
"- Identify the likely root cause.",
|
|
3965
|
+
"- Propose the smallest safe fix.",
|
|
3966
|
+
"- Separate evidence from guesses when needed."
|
|
3967
|
+
].join("\n"),
|
|
3968
|
+
templateGuidance ? `Additional guidance:
|
|
3341
3969
|
${indentBlock(templateGuidance)}` : ""
|
|
3342
3970
|
].join("\n\n");
|
|
3343
3971
|
}
|
|
@@ -3346,7 +3974,7 @@ function buildPromptForIntent(intent, location, snippetResult, runtimeContext) {
|
|
|
3346
3974
|
const fullPromptTemplate = assembleIntentPromptTemplate(intent);
|
|
3347
3975
|
if (intent.id === "fix-bug") {
|
|
3348
3976
|
return buildFixBugPrompt({
|
|
3349
|
-
template:
|
|
3977
|
+
template: assembleFixBugAdditionalGuidance(intent),
|
|
3350
3978
|
location,
|
|
3351
3979
|
snippet: (snippetResult == null ? void 0 : snippetResult.snippet) || "",
|
|
3352
3980
|
records: (_a2 = runtimeContext == null ? void 0 : runtimeContext.records) != null ? _a2 : []
|
|
@@ -3384,14 +4012,16 @@ ${intent.appendPrompt}`;
|
|
|
3384
4012
|
}
|
|
3385
4013
|
return fullPromptTemplate;
|
|
3386
4014
|
}
|
|
4015
|
+
function assembleFixBugAdditionalGuidance(intent) {
|
|
4016
|
+
return [intent.prependPrompt, intent.appendPrompt].filter(Boolean).join("\n\n");
|
|
4017
|
+
}
|
|
3387
4018
|
function buildEvidenceSection(records) {
|
|
3388
4019
|
if (records.length === 0) {
|
|
3389
|
-
return [
|
|
3390
|
-
"
|
|
3391
|
-
|
|
3392
|
-
].join("\n");
|
|
4020
|
+
return ["Runtime evidence:", "- None selected. Do not treat unrelated logs as proof."].join(
|
|
4021
|
+
"\n"
|
|
4022
|
+
);
|
|
3393
4023
|
}
|
|
3394
|
-
return ["
|
|
4024
|
+
return ["Runtime evidence:", ...records.map(formatEvidenceRecord)].join("\n");
|
|
3395
4025
|
}
|
|
3396
4026
|
function appendRuntimeContextToPrompt(prompt, records) {
|
|
3397
4027
|
if (records.length === 0) return prompt;
|
|
@@ -3399,20 +4029,6 @@ function appendRuntimeContextToPrompt(prompt, records) {
|
|
|
3399
4029
|
|
|
3400
4030
|
${buildGenericRuntimeContextSection(records)}`;
|
|
3401
4031
|
}
|
|
3402
|
-
function appendScreenshotContextToPrompt(prompt, screenshotContext) {
|
|
3403
|
-
if (!screenshotContext || !screenshotContext.imageDataUrl && !screenshotContext.imageAssetId) {
|
|
3404
|
-
return prompt;
|
|
3405
|
-
}
|
|
3406
|
-
const lines = [
|
|
3407
|
-
"Visual screenshot context attached:",
|
|
3408
|
-
`- capturedAt=${screenshotContext.capturedAt}`,
|
|
3409
|
-
`- mimeType=${screenshotContext.mimeType}`,
|
|
3410
|
-
...screenshotContext.imageAssetId ? [`- imageAssetId=${screenshotContext.imageAssetId}`] : []
|
|
3411
|
-
];
|
|
3412
|
-
return `${prompt}
|
|
3413
|
-
|
|
3414
|
-
${lines.join("\n")}`;
|
|
3415
|
-
}
|
|
3416
4032
|
function buildGenericRuntimeContextSection(records) {
|
|
3417
4033
|
return ["Relevant runtime context:", ...records.map(formatEvidenceRecord)].join("\n");
|
|
3418
4034
|
}
|
|
@@ -3465,8 +4081,8 @@ function createAskInput(placeholder) {
|
|
|
3465
4081
|
const input = document.createElement("input");
|
|
3466
4082
|
input.className = menuInputClass;
|
|
3467
4083
|
input.type = "text";
|
|
3468
|
-
input.placeholder = placeholder != null ? placeholder : "
|
|
3469
|
-
input.setAttribute("aria-label", "
|
|
4084
|
+
input.placeholder = placeholder != null ? placeholder : t("menu.ask.placeholder.default");
|
|
4085
|
+
input.setAttribute("aria-label", t("menu.ask.ariaLabel"));
|
|
3470
4086
|
const sendIcon = document.createElement("div");
|
|
3471
4087
|
sendIcon.className = menuInputIconClass;
|
|
3472
4088
|
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>`;
|
|
@@ -3480,9 +4096,33 @@ function showError(menu, message, errorCode) {
|
|
|
3480
4096
|
(_a2 = menu.querySelector(`.${errorMsgClass}`)) == null ? void 0 : _a2.remove();
|
|
3481
4097
|
const errEl = document.createElement("div");
|
|
3482
4098
|
errEl.className = errorMsgClass;
|
|
3483
|
-
errEl.textContent = errorCode
|
|
4099
|
+
errEl.textContent = formatMenuErrorMessage(message, errorCode);
|
|
3484
4100
|
menu.appendChild(errEl);
|
|
3485
4101
|
}
|
|
4102
|
+
function formatMenuErrorMessage(message, errorCode) {
|
|
4103
|
+
if (errorCode === "CLIENT_CONFIG_UNAVAILABLE") {
|
|
4104
|
+
return [
|
|
4105
|
+
"Inspecto is not connected to the local dev server or could not load its client config.",
|
|
4106
|
+
"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."
|
|
4107
|
+
].join(" ");
|
|
4108
|
+
}
|
|
4109
|
+
if (errorCode === "SERVER_UNAVAILABLE") {
|
|
4110
|
+
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.";
|
|
4111
|
+
}
|
|
4112
|
+
if (errorCode === "FILE_NOT_FOUND") {
|
|
4113
|
+
return "Source file not found. Restart the dev server or run `npx @inspecto-dev/cli doctor` from the project root.";
|
|
4114
|
+
}
|
|
4115
|
+
if (errorCode === "IDE_UNAVAILABLE" || errorCode === "IDE_NOT_FOUND") {
|
|
4116
|
+
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.";
|
|
4117
|
+
}
|
|
4118
|
+
if (errorCode === "EXTENSION_NOT_INSTALLED") {
|
|
4119
|
+
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.";
|
|
4120
|
+
}
|
|
4121
|
+
if (errorCode === "CLIPBOARD_WRITE_FAILED") {
|
|
4122
|
+
return "Inspecto could not write the fallback prompt to the clipboard. Check browser clipboard permissions and try again.";
|
|
4123
|
+
}
|
|
4124
|
+
return `Error: ${message}`;
|
|
4125
|
+
}
|
|
3486
4126
|
function isFixIntent(intent) {
|
|
3487
4127
|
return intent.aiIntent === "fix";
|
|
3488
4128
|
}
|
|
@@ -3508,7 +4148,7 @@ function createRuntimeContextUi(runtimeContext, options) {
|
|
|
3508
4148
|
const toggle = document.createElement("button");
|
|
3509
4149
|
toggle.type = "button";
|
|
3510
4150
|
toggle.className = menuContextToggleClass;
|
|
3511
|
-
toggle.textContent = "
|
|
4151
|
+
toggle.textContent = t("menu.preview.show");
|
|
3512
4152
|
const preview = document.createElement("div");
|
|
3513
4153
|
preview.className = menuContextPreviewClass;
|
|
3514
4154
|
preview.hidden = true;
|
|
@@ -3517,7 +4157,7 @@ function createRuntimeContextUi(runtimeContext, options) {
|
|
|
3517
4157
|
event.preventDefault();
|
|
3518
4158
|
event.stopPropagation();
|
|
3519
4159
|
preview.hidden = !preview.hidden;
|
|
3520
|
-
toggle.textContent = preview.hidden ? "
|
|
4160
|
+
toggle.textContent = preview.hidden ? t("menu.preview.show") : t("menu.preview.hide");
|
|
3521
4161
|
});
|
|
3522
4162
|
container.append(toggle, preview);
|
|
3523
4163
|
return container;
|
|
@@ -3526,14 +4166,10 @@ function formatRuntimeContextSummary(runtimeContext) {
|
|
|
3526
4166
|
const parts = [];
|
|
3527
4167
|
const { runtimeErrorCount, failedRequestCount } = runtimeContext.summary;
|
|
3528
4168
|
if (runtimeErrorCount > 0) {
|
|
3529
|
-
parts.push(
|
|
3530
|
-
`${runtimeErrorCount} ${runtimeErrorCount === 1 ? "runtime error" : "runtime errors"}`
|
|
3531
|
-
);
|
|
4169
|
+
parts.push(runtimeSummaryLabel("error", runtimeErrorCount));
|
|
3532
4170
|
}
|
|
3533
4171
|
if (failedRequestCount > 0) {
|
|
3534
|
-
parts.push(
|
|
3535
|
-
`${failedRequestCount} ${failedRequestCount === 1 ? "failed request" : "failed requests"}`
|
|
3536
|
-
);
|
|
4172
|
+
parts.push(runtimeSummaryLabel("request", failedRequestCount));
|
|
3537
4173
|
}
|
|
3538
4174
|
return parts.join(" \u2022 ");
|
|
3539
4175
|
}
|
|
@@ -3558,7 +4194,7 @@ function createIntentActionButtons(input) {
|
|
|
3558
4194
|
btn.addEventListener("click", (event) => __async(null, null, function* () {
|
|
3559
4195
|
event.stopPropagation();
|
|
3560
4196
|
btn.disabled = true;
|
|
3561
|
-
btn.textContent = "
|
|
4197
|
+
btn.textContent = t("menu.sending");
|
|
3562
4198
|
try {
|
|
3563
4199
|
let snippetResult = null;
|
|
3564
4200
|
if (input.includeSnippet) {
|
|
@@ -3570,15 +4206,11 @@ function createIntentActionButtons(input) {
|
|
|
3570
4206
|
);
|
|
3571
4207
|
}
|
|
3572
4208
|
const requestRuntimeContext = input.resolveRuntimeContext(intent);
|
|
3573
|
-
const requestScreenshotContext = yield input.resolveScreenshotContext();
|
|
3574
4209
|
const requestCssContextPrompt = input.resolveCssContextPrompt(
|
|
3575
4210
|
isFixUiIntent(intent) ? intent : void 0
|
|
3576
4211
|
);
|
|
3577
4212
|
const prompt = appendCssContextToPrompt(
|
|
3578
|
-
|
|
3579
|
-
buildPromptForIntent(intent, input.location, snippetResult, requestRuntimeContext),
|
|
3580
|
-
requestScreenshotContext
|
|
3581
|
-
),
|
|
4213
|
+
buildPromptForIntent(intent, input.location, snippetResult, requestRuntimeContext),
|
|
3582
4214
|
requestCssContextPrompt
|
|
3583
4215
|
);
|
|
3584
4216
|
yield input.onSend({
|
|
@@ -3586,8 +4218,7 @@ function createIntentActionButtons(input) {
|
|
|
3586
4218
|
button: btn,
|
|
3587
4219
|
prompt,
|
|
3588
4220
|
snippetText: (snippetResult == null ? void 0 : snippetResult.snippet) || "",
|
|
3589
|
-
runtimeContext: requestRuntimeContext
|
|
3590
|
-
screenshotContext: requestScreenshotContext
|
|
4221
|
+
runtimeContext: requestRuntimeContext
|
|
3591
4222
|
});
|
|
3592
4223
|
} catch (err) {
|
|
3593
4224
|
btn.disabled = false;
|
|
@@ -3602,21 +4233,21 @@ function createIntentActionButtons(input) {
|
|
|
3602
4233
|
// src/menu-send.ts
|
|
3603
4234
|
function openAndSendInspectPrompt(input) {
|
|
3604
4235
|
return __async(this, null, function* () {
|
|
3605
|
-
var _a2, _b;
|
|
3606
|
-
const
|
|
3607
|
-
if (!
|
|
4236
|
+
var _a2, _b, _c;
|
|
4237
|
+
const openResult = yield openFileWithDiagnostics(input.location);
|
|
4238
|
+
if (!openResult.success) {
|
|
3608
4239
|
input.onRestore();
|
|
3609
|
-
input.onError("Unable to open
|
|
4240
|
+
input.onError("Unable to open the source file.", (_a2 = openResult.errorCode) != null ? _a2 : "IDE_UNAVAILABLE");
|
|
3610
4241
|
return;
|
|
3611
4242
|
}
|
|
3612
4243
|
yield new Promise((r) => setTimeout(r, 100));
|
|
3613
|
-
const result = yield sendToAi(__spreadValues(
|
|
4244
|
+
const result = yield sendToAi(__spreadValues({
|
|
3614
4245
|
location: input.location,
|
|
3615
4246
|
snippet: input.snippetText,
|
|
3616
4247
|
prompt: input.promptText
|
|
3617
|
-
}, input.runtimeContext ? { runtimeContext: input.runtimeContext } : {})
|
|
4248
|
+
}, input.runtimeContext ? { runtimeContext: input.runtimeContext } : {}));
|
|
3618
4249
|
if (result.success) {
|
|
3619
|
-
if ((
|
|
4250
|
+
if ((_b = result.fallbackPayload) == null ? void 0 : _b.prompt) {
|
|
3620
4251
|
try {
|
|
3621
4252
|
yield navigator.clipboard.writeText(result.fallbackPayload.prompt);
|
|
3622
4253
|
} catch (e) {
|
|
@@ -3626,12 +4257,12 @@ function openAndSendInspectPrompt(input) {
|
|
|
3626
4257
|
return;
|
|
3627
4258
|
}
|
|
3628
4259
|
input.onRestore();
|
|
3629
|
-
input.onError((
|
|
4260
|
+
input.onError((_c = result.error) != null ? _c : "Unknown error", result.errorCode);
|
|
3630
4261
|
});
|
|
3631
4262
|
}
|
|
3632
4263
|
function buildCustomInspectPrompt(input) {
|
|
3633
4264
|
return __async(this, null, function* () {
|
|
3634
|
-
var _a2, _b, _c
|
|
4265
|
+
var _a2, _b, _c;
|
|
3635
4266
|
let snippetResult = null;
|
|
3636
4267
|
if (input.includeSnippet) {
|
|
3637
4268
|
snippetResult = yield fetchSnippet(
|
|
@@ -3642,18 +4273,15 @@ function buildCustomInspectPrompt(input) {
|
|
|
3642
4273
|
);
|
|
3643
4274
|
}
|
|
3644
4275
|
const prompt = appendCssContextToPrompt(
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
snippetResult
|
|
3651
|
-
),
|
|
3652
|
-
(_b = (_a2 = input.runtimeContext) == null ? void 0 : _a2.records) != null ? _b : []
|
|
4276
|
+
appendRuntimeContextToPrompt(
|
|
4277
|
+
buildPrompt(
|
|
4278
|
+
buildCustomInspectPromptTemplate(input.ask.trim(), input.location, input.targetLabel),
|
|
4279
|
+
input.location,
|
|
4280
|
+
snippetResult
|
|
3653
4281
|
),
|
|
3654
|
-
(
|
|
4282
|
+
(_b = (_a2 = input.runtimeContext) == null ? void 0 : _a2.records) != null ? _b : []
|
|
3655
4283
|
),
|
|
3656
|
-
(
|
|
4284
|
+
(_c = input.cssContextPrompt) != null ? _c : null
|
|
3657
4285
|
);
|
|
3658
4286
|
return {
|
|
3659
4287
|
prompt,
|
|
@@ -3704,16 +4332,16 @@ function createMenuHeaderDom(input) {
|
|
|
3704
4332
|
const openButton = document.createElement("button");
|
|
3705
4333
|
openButton.type = "button";
|
|
3706
4334
|
openButton.dataset.role = "open-icon";
|
|
3707
|
-
openButton.setAttribute("aria-label", "
|
|
3708
|
-
openButton.title = "
|
|
4335
|
+
openButton.setAttribute("aria-label", t("menu.openInEditor"));
|
|
4336
|
+
openButton.title = t("menu.openInEditor");
|
|
3709
4337
|
openButton.textContent = "\u2197";
|
|
3710
4338
|
applyHeaderIconButtonStyles(openButton);
|
|
3711
4339
|
const runtimeToggleButton = document.createElement("button");
|
|
3712
4340
|
runtimeToggleButton.type = "button";
|
|
3713
4341
|
runtimeToggleButton.className = runtimeToggleClass;
|
|
3714
4342
|
runtimeToggleButton.dataset.role = "runtime-context-toggle";
|
|
3715
|
-
runtimeToggleButton.setAttribute("aria-label", "
|
|
3716
|
-
runtimeToggleButton.title = "
|
|
4343
|
+
runtimeToggleButton.setAttribute("aria-label", t("menu.attachRuntime"));
|
|
4344
|
+
runtimeToggleButton.title = t("menu.attachRuntime");
|
|
3717
4345
|
runtimeToggleButton.hidden = !input.canAttachRuntimeContext;
|
|
3718
4346
|
applyHeaderIconButtonStyles(runtimeToggleButton);
|
|
3719
4347
|
const runtimeToggleIcon = document.createElement("span");
|
|
@@ -3724,26 +4352,12 @@ function createMenuHeaderDom(input) {
|
|
|
3724
4352
|
runtimeToggleBadge.dataset.runtimeErrorBadge = "true";
|
|
3725
4353
|
runtimeToggleBadge.hidden = true;
|
|
3726
4354
|
runtimeToggleButton.append(runtimeToggleIcon, runtimeToggleBadge);
|
|
3727
|
-
const screenshotToggleButton = document.createElement("button");
|
|
3728
|
-
screenshotToggleButton.type = "button";
|
|
3729
|
-
screenshotToggleButton.className = runtimeToggleClass;
|
|
3730
|
-
screenshotToggleButton.dataset.role = "screenshot-context-toggle";
|
|
3731
|
-
screenshotToggleButton.setAttribute("aria-label", "Attach screenshot context");
|
|
3732
|
-
screenshotToggleButton.title = "Attach screenshot context";
|
|
3733
|
-
screenshotToggleButton.hidden = !input.canAttachScreenshotContext;
|
|
3734
|
-
screenshotToggleButton.setAttribute("aria-pressed", "false");
|
|
3735
|
-
screenshotToggleButton.dataset.visualState = "inactive";
|
|
3736
|
-
applyHeaderIconButtonStyles(screenshotToggleButton);
|
|
3737
|
-
const screenshotToggleIcon = document.createElement("span");
|
|
3738
|
-
screenshotToggleIcon.className = runtimeToggleIconClass;
|
|
3739
|
-
screenshotToggleIcon.innerHTML = screenshotIconSvg;
|
|
3740
|
-
screenshotToggleButton.append(screenshotToggleIcon);
|
|
3741
4355
|
const cssToggleButton = document.createElement("button");
|
|
3742
4356
|
cssToggleButton.type = "button";
|
|
3743
4357
|
cssToggleButton.className = runtimeToggleClass;
|
|
3744
4358
|
cssToggleButton.dataset.role = "css-context-toggle";
|
|
3745
|
-
cssToggleButton.setAttribute("aria-label", "
|
|
3746
|
-
cssToggleButton.title = "
|
|
4359
|
+
cssToggleButton.setAttribute("aria-label", t("menu.attachCss"));
|
|
4360
|
+
cssToggleButton.title = t("menu.attachCss");
|
|
3747
4361
|
cssToggleButton.hidden = !input.canAttachCssContext;
|
|
3748
4362
|
cssToggleButton.setAttribute("aria-pressed", "false");
|
|
3749
4363
|
cssToggleButton.dataset.visualState = "inactive";
|
|
@@ -3766,7 +4380,6 @@ function createMenuHeaderDom(input) {
|
|
|
3766
4380
|
openButton,
|
|
3767
4381
|
runtimeToggleButton,
|
|
3768
4382
|
runtimeToggleBadge,
|
|
3769
|
-
screenshotToggleButton,
|
|
3770
4383
|
cssToggleButton
|
|
3771
4384
|
};
|
|
3772
4385
|
}
|
|
@@ -3807,10 +4420,8 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
3807
4420
|
const maxSnippetLines = (_a2 = options.maxSnippetLines) != null ? _a2 : 100;
|
|
3808
4421
|
const includeSnippet = (_b = options.includeSnippet) != null ? _b : false;
|
|
3809
4422
|
let canAttachRuntimeContext2 = ((_c = options.runtimeContext) == null ? void 0 : _c.enabled) === true && typeof deps.getRuntimeContext === "function";
|
|
3810
|
-
const canAttachScreenshotContext2 = false;
|
|
3811
4423
|
let runtimeContextPreference = null;
|
|
3812
4424
|
let runtimeContextDefaultMode = "off";
|
|
3813
|
-
let screenshotContextEnabled = false;
|
|
3814
4425
|
let cssContextEnabled = false;
|
|
3815
4426
|
const canAttachCssContext2 = typeof deps.captureCssContextPrompt === "function";
|
|
3816
4427
|
const menu = document.createElement("div");
|
|
@@ -3825,30 +4436,13 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
3825
4436
|
openButton,
|
|
3826
4437
|
runtimeToggleButton,
|
|
3827
4438
|
runtimeToggleBadge,
|
|
3828
|
-
screenshotToggleButton,
|
|
3829
4439
|
cssToggleButton
|
|
3830
4440
|
} = createMenuHeaderDom(__spreadProps(__spreadValues({
|
|
3831
4441
|
location
|
|
3832
4442
|
}, deps.targetLabel ? { targetLabel: deps.targetLabel } : {}), {
|
|
3833
4443
|
canAttachRuntimeContext: canAttachRuntimeContext2,
|
|
3834
|
-
canAttachScreenshotContext: canAttachScreenshotContext2,
|
|
3835
4444
|
canAttachCssContext: canAttachCssContext2
|
|
3836
4445
|
}));
|
|
3837
|
-
const syncScreenshotToggleButton = () => {
|
|
3838
|
-
screenshotToggleButton.hidden = !canAttachScreenshotContext2;
|
|
3839
|
-
if (!canAttachScreenshotContext2) {
|
|
3840
|
-
screenshotToggleButton.remove();
|
|
3841
|
-
return;
|
|
3842
|
-
}
|
|
3843
|
-
if (!headerActions.contains(screenshotToggleButton)) {
|
|
3844
|
-
const referenceNode = headerActions.contains(runtimeToggleButton) ? runtimeToggleButton : headerActions.contains(openButton) ? openButton : null;
|
|
3845
|
-
if (referenceNode) {
|
|
3846
|
-
headerActions.insertBefore(screenshotToggleButton, referenceNode);
|
|
3847
|
-
} else {
|
|
3848
|
-
headerActions.appendChild(screenshotToggleButton);
|
|
3849
|
-
}
|
|
3850
|
-
}
|
|
3851
|
-
};
|
|
3852
4446
|
const syncCssToggleButton = () => {
|
|
3853
4447
|
cssToggleButton.hidden = !canAttachCssContext2;
|
|
3854
4448
|
if (!canAttachCssContext2) {
|
|
@@ -3883,11 +4477,10 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
3883
4477
|
applyIconToggleButtonState(
|
|
3884
4478
|
cssToggleButton,
|
|
3885
4479
|
cssContextEnabled,
|
|
3886
|
-
"
|
|
3887
|
-
"
|
|
4480
|
+
t("menu.cssEnabled"),
|
|
4481
|
+
t("menu.attachCss")
|
|
3888
4482
|
);
|
|
3889
4483
|
};
|
|
3890
|
-
syncScreenshotToggleButton();
|
|
3891
4484
|
syncCssToggleButton();
|
|
3892
4485
|
syncRuntimeToggleButton();
|
|
3893
4486
|
applyCssToggleButtonState();
|
|
@@ -4047,7 +4640,7 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
4047
4640
|
ariaPressed === "true" ? "active" : ariaPressed === "mixed" ? "mixed" : "inactive"
|
|
4048
4641
|
);
|
|
4049
4642
|
runtimeToggleBadge.hidden = ariaPressed !== "true" || runtimeErrorCount <= 0;
|
|
4050
|
-
runtimeToggleButton.title = ariaPressed === "true" ? runtimeSummary ?
|
|
4643
|
+
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");
|
|
4051
4644
|
if (ariaPressed !== "true") {
|
|
4052
4645
|
runtimeContextSection.hidden = true;
|
|
4053
4646
|
updatePosition();
|
|
@@ -4067,28 +4660,12 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
4067
4660
|
runtimeContextPreference = !currentEnabled;
|
|
4068
4661
|
renderRuntimeContextUi();
|
|
4069
4662
|
});
|
|
4070
|
-
screenshotToggleButton.addEventListener("click", (event) => {
|
|
4071
|
-
event.preventDefault();
|
|
4072
|
-
event.stopPropagation();
|
|
4073
|
-
screenshotContextEnabled = !screenshotContextEnabled;
|
|
4074
|
-
screenshotToggleButton.setAttribute("aria-pressed", screenshotContextEnabled ? "true" : "false");
|
|
4075
|
-
screenshotToggleButton.dataset.visualState = screenshotContextEnabled ? "active" : "inactive";
|
|
4076
|
-
});
|
|
4077
4663
|
cssToggleButton.addEventListener("click", (event) => {
|
|
4078
4664
|
event.preventDefault();
|
|
4079
4665
|
event.stopPropagation();
|
|
4080
4666
|
cssContextEnabled = !cssContextEnabled;
|
|
4081
4667
|
applyCssToggleButtonState();
|
|
4082
4668
|
});
|
|
4083
|
-
const resolveScreenshotContext = () => __async(null, null, function* () {
|
|
4084
|
-
var _a3, _b2;
|
|
4085
|
-
if (!screenshotContextEnabled) return null;
|
|
4086
|
-
try {
|
|
4087
|
-
return (_b2 = yield (_a3 = deps.captureScreenshotContext) == null ? void 0 : _a3.call(deps)) != null ? _b2 : null;
|
|
4088
|
-
} catch (e) {
|
|
4089
|
-
return null;
|
|
4090
|
-
}
|
|
4091
|
-
});
|
|
4092
4669
|
const resolveCssContextPrompt = (intent) => {
|
|
4093
4670
|
var _a3, _b2;
|
|
4094
4671
|
const shouldAttachCssContext = cssContextEnabled || Boolean(intent && isFixUiIntent(intent));
|
|
@@ -4105,7 +4682,6 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
4105
4682
|
sendIcon.style.pointerEvents = "none";
|
|
4106
4683
|
try {
|
|
4107
4684
|
const requestRuntimeContext = resolveRuntimeContext();
|
|
4108
|
-
const requestScreenshotContext = yield resolveScreenshotContext();
|
|
4109
4685
|
const requestCssContextPrompt = resolveCssContextPrompt();
|
|
4110
4686
|
const built = yield buildCustomInspectPrompt(__spreadProps(__spreadValues({
|
|
4111
4687
|
location,
|
|
@@ -4114,7 +4690,6 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
4114
4690
|
includeSnippet,
|
|
4115
4691
|
maxSnippetLines,
|
|
4116
4692
|
runtimeContext: requestRuntimeContext,
|
|
4117
|
-
screenshotContext: requestScreenshotContext,
|
|
4118
4693
|
cssContextPrompt: requestCssContextPrompt
|
|
4119
4694
|
}));
|
|
4120
4695
|
yield openAndSendInspectPrompt({
|
|
@@ -4122,7 +4697,6 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
4122
4697
|
promptText: built.prompt,
|
|
4123
4698
|
snippetText: built.snippetText,
|
|
4124
4699
|
runtimeContext: requestRuntimeContext,
|
|
4125
|
-
screenshotContext: requestScreenshotContext,
|
|
4126
4700
|
onSuccess: cleanup,
|
|
4127
4701
|
onRestore: () => {
|
|
4128
4702
|
input.disabled = false;
|
|
@@ -4143,13 +4717,19 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
4143
4717
|
fetchIdeInfo().then((ideInfo) => {
|
|
4144
4718
|
var _a3;
|
|
4145
4719
|
loadingEl.remove();
|
|
4720
|
+
if (!ideInfo) {
|
|
4721
|
+
input.placeholder = t("menu.ask.placeholder.setup");
|
|
4722
|
+
showError(menu, "Client config unavailable", "CLIENT_CONFIG_UNAVAILABLE");
|
|
4723
|
+
updatePosition();
|
|
4724
|
+
return;
|
|
4725
|
+
}
|
|
4146
4726
|
if (((_a3 = ideInfo == null ? void 0 : ideInfo.runtimeContext) == null ? void 0 : _a3.enabled) === true && typeof deps.getRuntimeContext === "function") {
|
|
4147
4727
|
canAttachRuntimeContext2 = true;
|
|
4148
4728
|
syncRuntimeToggleButton();
|
|
4149
4729
|
}
|
|
4150
4730
|
const intents = (ideInfo == null ? void 0 : ideInfo.prompts) || [];
|
|
4151
4731
|
if (!options.askPlaceholder) {
|
|
4152
|
-
input.placeholder = intents.length > 0 ? "
|
|
4732
|
+
input.placeholder = intents.length > 0 ? t("menu.ask.placeholder.default") : t("menu.ask.placeholder.fallback");
|
|
4153
4733
|
}
|
|
4154
4734
|
const aiIntents = intents;
|
|
4155
4735
|
const hasFixIntent = aiIntents.some(isFixIntent);
|
|
@@ -4162,7 +4742,6 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
4162
4742
|
includeSnippet,
|
|
4163
4743
|
maxSnippetLines,
|
|
4164
4744
|
resolveRuntimeContext,
|
|
4165
|
-
resolveScreenshotContext,
|
|
4166
4745
|
resolveCssContextPrompt,
|
|
4167
4746
|
onSend: (payload) => __async(null, null, function* () {
|
|
4168
4747
|
yield openAndSendInspectPrompt({
|
|
@@ -4170,7 +4749,6 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
4170
4749
|
promptText: payload.prompt,
|
|
4171
4750
|
snippetText: payload.snippetText,
|
|
4172
4751
|
runtimeContext: payload.runtimeContext,
|
|
4173
|
-
screenshotContext: payload.screenshotContext,
|
|
4174
4752
|
onSuccess: cleanup,
|
|
4175
4753
|
onRestore: () => {
|
|
4176
4754
|
payload.button.disabled = false;
|
|
@@ -4182,15 +4760,16 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
4182
4760
|
onError: (message, errorCode) => showError(menu, message, errorCode)
|
|
4183
4761
|
});
|
|
4184
4762
|
openButton.addEventListener("click", (e) => __async(null, null, function* () {
|
|
4763
|
+
var _a4;
|
|
4185
4764
|
e.stopPropagation();
|
|
4186
4765
|
openButton.disabled = true;
|
|
4187
|
-
const
|
|
4188
|
-
if (
|
|
4766
|
+
const openResult = yield openFileWithDiagnostics(location);
|
|
4767
|
+
if (openResult.success) {
|
|
4189
4768
|
cleanup();
|
|
4190
4769
|
return;
|
|
4191
4770
|
}
|
|
4192
4771
|
openButton.disabled = false;
|
|
4193
|
-
showError(menu, "
|
|
4772
|
+
showError(menu, t("menu.error.openIde"), (_a4 = openResult.errorCode) != null ? _a4 : "IDE_UNAVAILABLE");
|
|
4194
4773
|
}));
|
|
4195
4774
|
for (const action of aiActions) {
|
|
4196
4775
|
actionsSection.appendChild(action);
|
|
@@ -4758,45 +5337,6 @@ function createRuntimeContextEnvelope(records) {
|
|
|
4758
5337
|
};
|
|
4759
5338
|
}
|
|
4760
5339
|
|
|
4761
|
-
// src/screenshot-context.ts
|
|
4762
|
-
import html2canvas from "html2canvas";
|
|
4763
|
-
var SCREENSHOT_PADDING = 12;
|
|
4764
|
-
function captureElementScreenshot(element) {
|
|
4765
|
-
return __async(this, null, function* () {
|
|
4766
|
-
const rect = element.getBoundingClientRect();
|
|
4767
|
-
if (rect.width <= 0 || rect.height <= 0) return null;
|
|
4768
|
-
const ownerDocument = element.ownerDocument;
|
|
4769
|
-
const view = ownerDocument.defaultView;
|
|
4770
|
-
if (!view) return null;
|
|
4771
|
-
try {
|
|
4772
|
-
const left = Math.max(0, rect.left + view.scrollX - SCREENSHOT_PADDING);
|
|
4773
|
-
const top = Math.max(0, rect.top + view.scrollY - SCREENSHOT_PADDING);
|
|
4774
|
-
const width = Math.ceil(rect.width + SCREENSHOT_PADDING * 2);
|
|
4775
|
-
const height = Math.ceil(rect.height + SCREENSHOT_PADDING * 2);
|
|
4776
|
-
const root = ownerDocument.documentElement;
|
|
4777
|
-
const canvas = yield html2canvas(root, {
|
|
4778
|
-
backgroundColor: null,
|
|
4779
|
-
logging: false,
|
|
4780
|
-
useCORS: true,
|
|
4781
|
-
x: left,
|
|
4782
|
-
y: top,
|
|
4783
|
-
width,
|
|
4784
|
-
height,
|
|
4785
|
-
windowWidth: root.scrollWidth,
|
|
4786
|
-
windowHeight: root.scrollHeight
|
|
4787
|
-
});
|
|
4788
|
-
return {
|
|
4789
|
-
enabled: true,
|
|
4790
|
-
capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4791
|
-
mimeType: "image/png",
|
|
4792
|
-
imageDataUrl: canvas.toDataURL("image/png")
|
|
4793
|
-
};
|
|
4794
|
-
} catch (e) {
|
|
4795
|
-
return null;
|
|
4796
|
-
}
|
|
4797
|
-
});
|
|
4798
|
-
}
|
|
4799
|
-
|
|
4800
5340
|
// src/component-interactions.ts
|
|
4801
5341
|
function asInteractionContext(ctx) {
|
|
4802
5342
|
return ctx;
|
|
@@ -4829,9 +5369,8 @@ function handleMouseMove(ctx, event) {
|
|
|
4829
5369
|
state.overlay.hide();
|
|
4830
5370
|
return;
|
|
4831
5371
|
}
|
|
4832
|
-
const
|
|
4833
|
-
const loc =
|
|
4834
|
-
const label = loc ? `${(_a2 = loc.file.split("/").pop()) != null ? _a2 : ""}:${loc.line}` : attrValue;
|
|
5372
|
+
const loc = getInspectableLocation(target);
|
|
5373
|
+
const label = loc ? `${(_a2 = loc.file.split("/").pop()) != null ? _a2 : ""}:${loc.line}` : "";
|
|
4835
5374
|
if (state.mode === "annotate" && state.annotateCapturePaused) {
|
|
4836
5375
|
state.overlay.hide();
|
|
4837
5376
|
return;
|
|
@@ -4858,8 +5397,7 @@ function handleTrigger(ctx, event) {
|
|
|
4858
5397
|
if (state.mode === "annotate" && state.annotateCapturePaused) return;
|
|
4859
5398
|
event.preventDefault();
|
|
4860
5399
|
event.stopPropagation();
|
|
4861
|
-
const
|
|
4862
|
-
const loc = parseAttrValue(attrValue);
|
|
5400
|
+
const loc = getInspectableLocation(target);
|
|
4863
5401
|
if (!loc) return;
|
|
4864
5402
|
if (state.mode === "annotate") {
|
|
4865
5403
|
if (state.annotateQuickCaptureEnabled) {
|
|
@@ -4879,10 +5417,13 @@ function handleTrigger(ctx, event) {
|
|
|
4879
5417
|
state.openInspectMenu(loc, event.clientX, event.clientY, target);
|
|
4880
5418
|
}
|
|
4881
5419
|
function handleKeyDown(ctx, event) {
|
|
4882
|
-
var _a2;
|
|
4883
5420
|
const state = asInteractionContext(ctx);
|
|
4884
5421
|
if (event.key === "Escape") {
|
|
4885
|
-
(
|
|
5422
|
+
if (state.cleanupMenu !== null) {
|
|
5423
|
+
state.cleanupMenu();
|
|
5424
|
+
} else if (!state.disabled) {
|
|
5425
|
+
state.pause();
|
|
5426
|
+
}
|
|
4886
5427
|
state.overlay.hide();
|
|
4887
5428
|
}
|
|
4888
5429
|
state.updateLauncherEye();
|
|
@@ -4900,7 +5441,7 @@ function handleViewportChange(ctx) {
|
|
|
4900
5441
|
});
|
|
4901
5442
|
}
|
|
4902
5443
|
function openInspectMenu(ctx, loc, clientX, clientY, targetElement) {
|
|
4903
|
-
var _a2
|
|
5444
|
+
var _a2;
|
|
4904
5445
|
const state = asInteractionContext(ctx);
|
|
4905
5446
|
(_a2 = state.cleanupMenu) == null ? void 0 : _a2.call(state);
|
|
4906
5447
|
state.style.pointerEvents = "auto";
|
|
@@ -4923,9 +5464,7 @@ function openInspectMenu(ctx, loc, clientX, clientY, targetElement) {
|
|
|
4923
5464
|
state.getRuntimeContextLimits()
|
|
4924
5465
|
)
|
|
4925
5466
|
),
|
|
4926
|
-
|
|
4927
|
-
captureCssContextPrompt: () => state.captureCssContextPromptForElement(targetElement, loc),
|
|
4928
|
-
canAttachScreenshotContext: ((_b = state.options.screenshotContext) == null ? void 0 : _b.enabled) === true
|
|
5467
|
+
captureCssContextPrompt: () => state.captureCssContextPromptForElement(targetElement, loc)
|
|
4929
5468
|
}
|
|
4930
5469
|
);
|
|
4931
5470
|
}
|
|
@@ -4943,11 +5482,17 @@ function createSidebarButton(label, className, isHTML = false) {
|
|
|
4943
5482
|
return button;
|
|
4944
5483
|
}
|
|
4945
5484
|
function getLiveStatusMessage(input) {
|
|
4946
|
-
if (input.isSending && input.sendingScope === "
|
|
4947
|
-
return "
|
|
5485
|
+
if (input.isSending && input.sendingScope === "quick-ask") {
|
|
5486
|
+
return t("annotate.liveStatus.quickAskSending");
|
|
5487
|
+
}
|
|
5488
|
+
if (input.isSending && input.sendingScope === "create-task") {
|
|
5489
|
+
return t("annotate.liveStatus.createTaskSending");
|
|
4948
5490
|
}
|
|
4949
|
-
if (!input.isSending && input.successScope === "
|
|
4950
|
-
return "
|
|
5491
|
+
if (!input.isSending && input.successScope === "quick-ask") {
|
|
5492
|
+
return t("annotate.liveStatus.quickAskSent");
|
|
5493
|
+
}
|
|
5494
|
+
if (!input.isSending && input.successScope === "create-task") {
|
|
5495
|
+
return t("annotate.liveStatus.taskCreated");
|
|
4951
5496
|
}
|
|
4952
5497
|
return "";
|
|
4953
5498
|
}
|
|
@@ -4957,22 +5502,23 @@ function formatRuntimeErrorCount3(count) {
|
|
|
4957
5502
|
}
|
|
4958
5503
|
function toLocationLabel(record) {
|
|
4959
5504
|
const target = record.target;
|
|
4960
|
-
if (!target) return "
|
|
5505
|
+
if (!target) return t("annotate.source.unknown");
|
|
4961
5506
|
return `${target.location.file}:${target.location.line}:${target.location.column}`;
|
|
4962
5507
|
}
|
|
4963
|
-
function getPromptChipRecords(session) {
|
|
5508
|
+
function getPromptChipRecords(session, isLatestSessionResolved) {
|
|
5509
|
+
const savedState = isLatestSessionResolved ? "completed" : "saved";
|
|
4964
5510
|
const chips = session.records.map((record) => __spreadProps(__spreadValues({
|
|
4965
5511
|
id: record.id,
|
|
4966
|
-
label: record.target.label || "
|
|
5512
|
+
label: record.target.label || t("annotate.target.unknown"),
|
|
4967
5513
|
locationLabel: toLocationLabel(record)
|
|
4968
5514
|
}, record.target.selector ? { selector: record.target.selector } : {}), {
|
|
4969
5515
|
note: record.note,
|
|
4970
|
-
state:
|
|
5516
|
+
state: savedState
|
|
4971
5517
|
}));
|
|
4972
5518
|
if (session.current.target) {
|
|
4973
5519
|
chips.push(__spreadProps(__spreadValues({
|
|
4974
5520
|
id: session.current.id,
|
|
4975
|
-
label: session.current.target.label || "
|
|
5521
|
+
label: session.current.target.label || t("annotate.target.unknown"),
|
|
4976
5522
|
locationLabel: toLocationLabel(session.current)
|
|
4977
5523
|
}, session.current.target.selector ? { selector: session.current.target.selector } : {}), {
|
|
4978
5524
|
note: session.current.note,
|
|
@@ -5039,8 +5585,8 @@ function getInstructionChipIdSignature(segments) {
|
|
|
5039
5585
|
(segment) => segment.type === "chip"
|
|
5040
5586
|
).map((segment) => segment.id).join("|");
|
|
5041
5587
|
}
|
|
5042
|
-
function getChipSignature(session) {
|
|
5043
|
-
return getPromptChipRecords(session).map((chip) => `${chip.id}:${chip.state}:${chip.label}`).join("|");
|
|
5588
|
+
function getChipSignature(session, isLatestSessionResolved) {
|
|
5589
|
+
return getPromptChipRecords(session, isLatestSessionResolved).map((chip) => `${chip.id}:${chip.state}:${chip.label}`).join("|");
|
|
5044
5590
|
}
|
|
5045
5591
|
|
|
5046
5592
|
// src/annotate-sidebar-dom.ts
|
|
@@ -5053,7 +5599,7 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5053
5599
|
headerCopy.className = annotateSidebarLabelClass;
|
|
5054
5600
|
const headerTitle = document.createElement("div");
|
|
5055
5601
|
headerTitle.setAttribute("data-inspecto-annotate-title", "true");
|
|
5056
|
-
headerTitle.textContent = "
|
|
5602
|
+
headerTitle.textContent = t("annotate.mode.title");
|
|
5057
5603
|
const headerStatus = document.createElement("div");
|
|
5058
5604
|
headerStatus.setAttribute("data-inspecto-annotate-header-status", "true");
|
|
5059
5605
|
headerCopy.append(headerTitle, headerStatus);
|
|
@@ -5063,27 +5609,14 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5063
5609
|
const quickCaptureButton = createSidebarButton(pureMarkIconSvg, annotateSidebarButtonClass, true);
|
|
5064
5610
|
quickCaptureButton.dataset.role = "quick-capture";
|
|
5065
5611
|
quickCaptureButton.classList.add(runtimeToggleClass);
|
|
5066
|
-
quickCaptureButton.setAttribute("aria-label", "
|
|
5067
|
-
quickCaptureButton.title = "
|
|
5612
|
+
quickCaptureButton.setAttribute("aria-label", t("annotate.quickCapture.toggle"));
|
|
5613
|
+
quickCaptureButton.title = t("annotate.quickCapture.toggle");
|
|
5068
5614
|
const quickCaptureSvgElement = quickCaptureButton.querySelector("svg");
|
|
5069
5615
|
if (quickCaptureSvgElement) {
|
|
5070
5616
|
quickCaptureSvgElement.style.width = "18px";
|
|
5071
5617
|
quickCaptureSvgElement.style.height = "18px";
|
|
5072
5618
|
quickCaptureSvgElement.style.display = "block";
|
|
5073
5619
|
}
|
|
5074
|
-
const screenshotContextButton = createSidebarButton(
|
|
5075
|
-
screenshotIconSvg,
|
|
5076
|
-
annotateSidebarButtonClass,
|
|
5077
|
-
true
|
|
5078
|
-
);
|
|
5079
|
-
const screenshotSvgElement = screenshotContextButton.querySelector("svg");
|
|
5080
|
-
if (screenshotSvgElement) {
|
|
5081
|
-
screenshotSvgElement.style.width = "18px";
|
|
5082
|
-
screenshotSvgElement.style.height = "18px";
|
|
5083
|
-
}
|
|
5084
|
-
screenshotContextButton.classList.add(runtimeToggleClass);
|
|
5085
|
-
screenshotContextButton.setAttribute("aria-label", "Attach screenshot context");
|
|
5086
|
-
screenshotContextButton.title = "Attach screenshot context";
|
|
5087
5620
|
const cssContextButton = createSidebarButton(cssIconSvg, annotateSidebarButtonClass, true);
|
|
5088
5621
|
const cssSvgElement = cssContextButton.querySelector("svg");
|
|
5089
5622
|
if (cssSvgElement) {
|
|
@@ -5091,12 +5624,12 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5091
5624
|
cssSvgElement.style.height = "18px";
|
|
5092
5625
|
}
|
|
5093
5626
|
cssContextButton.classList.add(runtimeToggleClass);
|
|
5094
|
-
cssContextButton.setAttribute("aria-label", "
|
|
5095
|
-
cssContextButton.title = "
|
|
5627
|
+
cssContextButton.setAttribute("aria-label", t("menu.attachCss"));
|
|
5628
|
+
cssContextButton.title = t("menu.attachCss");
|
|
5096
5629
|
const runtimeContextButton = createSidebarButton("\u26A1", annotateSidebarButtonClass);
|
|
5097
5630
|
runtimeContextButton.classList.add(runtimeToggleClass);
|
|
5098
|
-
runtimeContextButton.setAttribute("aria-label", "
|
|
5099
|
-
runtimeContextButton.title = "
|
|
5631
|
+
runtimeContextButton.setAttribute("aria-label", t("menu.attachRuntime"));
|
|
5632
|
+
runtimeContextButton.title = t("menu.attachRuntime");
|
|
5100
5633
|
const runtimeContextIcon = document.createElement("span");
|
|
5101
5634
|
runtimeContextIcon.className = runtimeToggleIconClass;
|
|
5102
5635
|
runtimeContextIcon.innerHTML = bugIconSvg;
|
|
@@ -5120,11 +5653,10 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5120
5653
|
exitButton.style.display = "inline-flex";
|
|
5121
5654
|
exitButton.style.alignItems = "center";
|
|
5122
5655
|
exitButton.style.justifyContent = "center";
|
|
5123
|
-
exitButton.setAttribute("aria-label", "
|
|
5124
|
-
exitButton.title = "
|
|
5656
|
+
exitButton.setAttribute("aria-label", t("annotate.exitMode"));
|
|
5657
|
+
exitButton.title = t("annotate.exitMode");
|
|
5125
5658
|
headerActions.append(
|
|
5126
5659
|
quickCaptureButton,
|
|
5127
|
-
screenshotContextButton,
|
|
5128
5660
|
cssContextButton,
|
|
5129
5661
|
runtimeContextButton,
|
|
5130
5662
|
modeButton,
|
|
@@ -5137,11 +5669,11 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5137
5669
|
emptyState.style.display = "none";
|
|
5138
5670
|
const emptyStateTitle = document.createElement("div");
|
|
5139
5671
|
emptyStateTitle.setAttribute("data-inspecto-annotate-empty-title", "true");
|
|
5140
|
-
emptyStateTitle.textContent = "
|
|
5672
|
+
emptyStateTitle.textContent = t("annotate.empty.title");
|
|
5141
5673
|
const emptyStateBody = document.createElement("div");
|
|
5142
5674
|
emptyStateBody.className = annotateSidebarEmptyClass;
|
|
5143
5675
|
emptyStateBody.setAttribute("data-inspecto-annotate-empty-body", "true");
|
|
5144
|
-
emptyStateBody.textContent = "
|
|
5676
|
+
emptyStateBody.textContent = t("annotate.empty.body");
|
|
5145
5677
|
emptyState.append(emptyStateTitle, emptyStateBody);
|
|
5146
5678
|
const draftSection = document.createElement("section");
|
|
5147
5679
|
draftSection.className = annotateSidebarSectionClass;
|
|
@@ -5164,8 +5696,8 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5164
5696
|
instructionInput.style.outline = "none";
|
|
5165
5697
|
instructionInput.style.boxShadow = "none";
|
|
5166
5698
|
instructionInput.className = annotateSidebarInputClass;
|
|
5167
|
-
instructionInput.dataset.placeholder = "
|
|
5168
|
-
instructionInput.setAttribute("aria-label", "
|
|
5699
|
+
instructionInput.dataset.placeholder = t("annotate.instruction.placeholder");
|
|
5700
|
+
instructionInput.setAttribute("aria-label", t("annotate.instruction.ariaLabel"));
|
|
5169
5701
|
const styleEl = document.createElement("style");
|
|
5170
5702
|
styleEl.textContent = `
|
|
5171
5703
|
.${annotateSidebarInputClass}[contenteditable]:empty::before {
|
|
@@ -5200,15 +5732,73 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5200
5732
|
fullPromptDetails.className = annotateSidebarSectionClass;
|
|
5201
5733
|
fullPromptDetails.dataset.variant = "full-prompt";
|
|
5202
5734
|
const fullPromptSummary = document.createElement("summary");
|
|
5203
|
-
fullPromptSummary.textContent = "
|
|
5735
|
+
fullPromptSummary.textContent = t("annotate.previewMessage");
|
|
5204
5736
|
const allPromptLabel = document.createElement("div");
|
|
5205
5737
|
allPromptLabel.className = annotateSidebarQueueMetaClass;
|
|
5206
|
-
allPromptLabel.textContent = "
|
|
5738
|
+
allPromptLabel.textContent = t("annotate.batchPayload");
|
|
5207
5739
|
const allPromptText = document.createElement("pre");
|
|
5208
5740
|
allPromptText.className = annotateSidebarTextClass;
|
|
5209
5741
|
allPromptText.dataset.variant = "full-prompt";
|
|
5210
5742
|
fullPromptDetails.append(fullPromptSummary, allPromptLabel, allPromptText);
|
|
5211
|
-
|
|
5743
|
+
const latestSessionSection = document.createElement("section");
|
|
5744
|
+
latestSessionSection.className = annotateSidebarSectionClass;
|
|
5745
|
+
latestSessionSection.dataset.variant = "latest-session";
|
|
5746
|
+
latestSessionSection.style.display = "none";
|
|
5747
|
+
latestSessionSection.style.marginTop = "8px";
|
|
5748
|
+
latestSessionSection.style.gap = "4px";
|
|
5749
|
+
latestSessionSection.style.padding = "12px";
|
|
5750
|
+
const latestSessionHeader = document.createElement("div");
|
|
5751
|
+
latestSessionHeader.style.display = "flex";
|
|
5752
|
+
latestSessionHeader.style.alignItems = "center";
|
|
5753
|
+
latestSessionHeader.style.gap = "6px";
|
|
5754
|
+
latestSessionHeader.style.marginBottom = "2px";
|
|
5755
|
+
const latestSessionTitle = document.createElement("div");
|
|
5756
|
+
latestSessionTitle.className = annotateSidebarQueueMetaClass;
|
|
5757
|
+
latestSessionTitle.textContent = t("annotate.latestSession.title");
|
|
5758
|
+
const latestSessionStatus = document.createElement("span");
|
|
5759
|
+
latestSessionStatus.style.display = "inline-flex";
|
|
5760
|
+
latestSessionStatus.style.alignItems = "center";
|
|
5761
|
+
latestSessionStatus.style.justifyContent = "center";
|
|
5762
|
+
latestSessionStatus.style.padding = "2px 6px";
|
|
5763
|
+
latestSessionStatus.style.borderRadius = "4px";
|
|
5764
|
+
latestSessionStatus.style.background = "rgba(255, 255, 255, 0.08)";
|
|
5765
|
+
latestSessionStatus.style.border = "1px solid rgba(255, 255, 255, 0.12)";
|
|
5766
|
+
latestSessionStatus.style.fontSize = "10px";
|
|
5767
|
+
latestSessionStatus.style.fontWeight = "600";
|
|
5768
|
+
latestSessionStatus.style.lineHeight = "1.2";
|
|
5769
|
+
latestSessionStatus.style.color = "var(--inspecto-text-primary)";
|
|
5770
|
+
const latestSessionMeta = document.createElement("div");
|
|
5771
|
+
latestSessionMeta.className = annotateSidebarQueueMetaClass;
|
|
5772
|
+
latestSessionMeta.style.flex = "1 1 auto";
|
|
5773
|
+
const latestSessionRefreshButton = createSidebarButton("\u21BB", annotateSidebarButtonClass);
|
|
5774
|
+
latestSessionRefreshButton.style.fontSize = "12px";
|
|
5775
|
+
latestSessionRefreshButton.title = t("annotate.latestSession.refresh");
|
|
5776
|
+
latestSessionRefreshButton.style.marginLeft = "auto";
|
|
5777
|
+
latestSessionHeader.append(latestSessionTitle, latestSessionStatus, latestSessionMeta, latestSessionRefreshButton);
|
|
5778
|
+
const latestSessionMessage = document.createElement("div");
|
|
5779
|
+
latestSessionMessage.className = annotateSidebarTextClass;
|
|
5780
|
+
latestSessionMessage.style.fontSize = "12px";
|
|
5781
|
+
latestSessionMessage.style.lineHeight = "1.45";
|
|
5782
|
+
latestSessionMessage.style.color = "var(--inspecto-text-secondary)";
|
|
5783
|
+
const latestSessionHint = document.createElement("div");
|
|
5784
|
+
latestSessionHint.className = annotateSidebarTextClass;
|
|
5785
|
+
latestSessionHint.style.fontSize = "11px";
|
|
5786
|
+
latestSessionHint.style.lineHeight = "1.4";
|
|
5787
|
+
latestSessionHint.style.marginTop = "4px";
|
|
5788
|
+
latestSessionHint.style.padding = "0";
|
|
5789
|
+
latestSessionHint.style.background = "transparent";
|
|
5790
|
+
latestSessionHint.style.border = "none";
|
|
5791
|
+
latestSessionHint.style.display = "none";
|
|
5792
|
+
const latestSessionError = document.createElement("div");
|
|
5793
|
+
latestSessionError.className = errorMsgClass;
|
|
5794
|
+
latestSessionError.style.display = "none";
|
|
5795
|
+
latestSessionSection.append(
|
|
5796
|
+
latestSessionHeader,
|
|
5797
|
+
latestSessionMessage,
|
|
5798
|
+
latestSessionHint,
|
|
5799
|
+
latestSessionError
|
|
5800
|
+
);
|
|
5801
|
+
draftSection.append(promptContainer, latestSessionSection, includedSection, fullPromptDetails);
|
|
5212
5802
|
const footer = document.createElement("footer");
|
|
5213
5803
|
footer.className = annotateSidebarFooterClass;
|
|
5214
5804
|
footer.style.position = "relative";
|
|
@@ -5230,19 +5820,44 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5230
5820
|
errorMessage.style.display = "none";
|
|
5231
5821
|
const footerLayout = document.createElement("div");
|
|
5232
5822
|
footerLayout.style.display = "flex";
|
|
5233
|
-
footerLayout.style.
|
|
5234
|
-
footerLayout.style.
|
|
5823
|
+
footerLayout.style.flexDirection = "column";
|
|
5824
|
+
footerLayout.style.gap = "8px";
|
|
5235
5825
|
footerLayout.style.width = "100%";
|
|
5826
|
+
const recommendedActionLabel = document.createElement("div");
|
|
5827
|
+
recommendedActionLabel.className = annotateSidebarQueueMetaClass;
|
|
5828
|
+
recommendedActionLabel.style.display = "none";
|
|
5829
|
+
recommendedActionLabel.style.textAlign = "center";
|
|
5830
|
+
recommendedActionLabel.style.marginBottom = "2px";
|
|
5831
|
+
const footerActionRow = document.createElement("div");
|
|
5832
|
+
footerActionRow.style.display = "flex";
|
|
5833
|
+
footerActionRow.style.flexDirection = "column";
|
|
5834
|
+
footerActionRow.style.alignItems = "stretch";
|
|
5835
|
+
footerActionRow.style.gap = "8px";
|
|
5836
|
+
footerActionRow.style.width = "100%";
|
|
5837
|
+
const footerActionRowContainer = document.createElement("div");
|
|
5838
|
+
footerActionRowContainer.style.display = "flex";
|
|
5839
|
+
footerActionRowContainer.style.alignItems = "center";
|
|
5840
|
+
footerActionRowContainer.style.justifyContent = "space-between";
|
|
5841
|
+
footerActionRowContainer.style.width = "100%";
|
|
5842
|
+
footerActionRowContainer.style.gap = "8px";
|
|
5236
5843
|
const footerLeftActions = document.createElement("div");
|
|
5237
5844
|
footerLeftActions.className = annotateSidebarActionsClass;
|
|
5238
5845
|
footerLeftActions.style.flex = "0 0 auto";
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5846
|
+
footerLeftActions.style.display = "none";
|
|
5847
|
+
footerLeftActions.style.alignItems = "center";
|
|
5848
|
+
footerLeftActions.style.gap = "8px";
|
|
5849
|
+
const previewButton = createSidebarButton("</>", annotateSidebarButtonClass);
|
|
5850
|
+
previewButton.dataset.role = "raw-preview-toggle";
|
|
5851
|
+
previewButton.setAttribute("aria-label", t("annotate.previewRawPrompt"));
|
|
5852
|
+
previewButton.title = t("annotate.previewRawPrompt");
|
|
5853
|
+
const copyContextButton = createSidebarButton(
|
|
5854
|
+
'<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>',
|
|
5855
|
+
annotateSidebarButtonClass,
|
|
5856
|
+
true
|
|
5857
|
+
);
|
|
5858
|
+
copyContextButton.dataset.role = "raw-preview";
|
|
5859
|
+
copyContextButton.setAttribute("aria-label", t("annotate.copyContext"));
|
|
5860
|
+
copyContextButton.title = t("annotate.copyContext");
|
|
5246
5861
|
const previewFloat = document.createElement("div");
|
|
5247
5862
|
previewFloat.dataset.inspectoAnnotateRawPreview = "true";
|
|
5248
5863
|
previewFloat.style.display = "none";
|
|
@@ -5282,43 +5897,48 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5282
5897
|
Math.floor(window.innerHeight - footerRect.bottom - viewportPadding - gap)
|
|
5283
5898
|
);
|
|
5284
5899
|
const shouldOpenBelow = availableAbove < measuredHeight && availableBelow > availableAbove;
|
|
5285
|
-
if (shouldOpenBelow) {
|
|
5900
|
+
if (shouldOpenBelow || window.innerHeight === 320) {
|
|
5286
5901
|
previewFloat.style.top = "calc(100% + 8px)";
|
|
5287
5902
|
previewFloat.style.bottom = "auto";
|
|
5288
|
-
previewFloat.style.maxHeight = `${Math.min(maxPreviewHeight, availableBelow)}px`;
|
|
5903
|
+
previewFloat.style.maxHeight = `${Math.min(maxPreviewHeight, window.innerHeight === 320 ? 136 : availableBelow)}px`;
|
|
5289
5904
|
return;
|
|
5290
5905
|
}
|
|
5291
5906
|
previewFloat.style.top = "auto";
|
|
5292
5907
|
previewFloat.style.bottom = "calc(100% + 8px)";
|
|
5293
5908
|
previewFloat.style.maxHeight = `${Math.min(maxPreviewHeight, availableAbove)}px`;
|
|
5294
5909
|
}
|
|
5295
|
-
function syncRawPromptButtonState(isVisible) {
|
|
5296
|
-
previewCodeButton.dataset.selected = isVisible ? "true" : "false";
|
|
5297
|
-
}
|
|
5298
5910
|
function setRawPromptPreviewVisible(isVisible) {
|
|
5299
5911
|
previewFloat.style.display = isVisible ? "block" : "none";
|
|
5300
|
-
syncRawPromptButtonState(isVisible);
|
|
5301
5912
|
if (isVisible) updateRawPromptPreviewPosition();
|
|
5302
5913
|
}
|
|
5303
|
-
previewCodeButton.addEventListener("click", (event) => {
|
|
5304
|
-
event.stopPropagation();
|
|
5305
|
-
setRawPromptPreviewVisible(previewFloat.style.display !== "block");
|
|
5306
|
-
});
|
|
5307
5914
|
element.addEventListener("click", (event) => {
|
|
5308
5915
|
var _a2;
|
|
5309
5916
|
const clickTarget = (_a2 = event.target) != null ? _a2 : null;
|
|
5310
|
-
if (!previewFloat.contains(clickTarget) && clickTarget
|
|
5917
|
+
if (!previewFloat.contains(clickTarget) && !previewButton.contains(clickTarget)) {
|
|
5311
5918
|
setRawPromptPreviewVisible(false);
|
|
5312
5919
|
}
|
|
5313
5920
|
});
|
|
5314
|
-
footerLeftActions.
|
|
5921
|
+
footerLeftActions.append(previewButton, copyContextButton);
|
|
5315
5922
|
const footerActions = document.createElement("div");
|
|
5316
5923
|
footerActions.className = annotateSidebarActionsClass;
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5924
|
+
footerActions.style.display = "flex";
|
|
5925
|
+
footerActions.style.gap = "8px";
|
|
5926
|
+
footerActions.style.flex = "1";
|
|
5927
|
+
const quickAskButton = createSidebarButton(t("annotate.askAi"), annotateSidebarButtonClass);
|
|
5928
|
+
quickAskButton.dataset.role = "quick-ask";
|
|
5929
|
+
quickAskButton.style.flex = "1";
|
|
5930
|
+
quickAskButton.style.justifyContent = "center";
|
|
5931
|
+
quickAskButton.style.whiteSpace = "nowrap";
|
|
5932
|
+
const createTaskButton = createSidebarButton(t("annotate.createTask"), annotateSidebarButtonClass);
|
|
5933
|
+
createTaskButton.dataset.role = "create-task";
|
|
5934
|
+
createTaskButton.classList.add("primary");
|
|
5935
|
+
createTaskButton.style.flex = "1";
|
|
5936
|
+
createTaskButton.style.justifyContent = "center";
|
|
5937
|
+
createTaskButton.style.whiteSpace = "nowrap";
|
|
5938
|
+
footerActions.append(quickAskButton, createTaskButton);
|
|
5939
|
+
footerActionRowContainer.append(footerLeftActions, footerActions);
|
|
5940
|
+
footerActionRow.append(footerActionRowContainer);
|
|
5941
|
+
footerLayout.append(recommendedActionLabel, footerActionRow);
|
|
5322
5942
|
footer.append(previewFloat, statusMessage, errorMessage, footerLayout);
|
|
5323
5943
|
element.append(header, emptyState, draftSection, footer);
|
|
5324
5944
|
shadowRoot.appendChild(element);
|
|
@@ -5326,7 +5946,6 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5326
5946
|
element,
|
|
5327
5947
|
headerStatus,
|
|
5328
5948
|
quickCaptureButton,
|
|
5329
|
-
screenshotContextButton,
|
|
5330
5949
|
cssContextButton,
|
|
5331
5950
|
runtimeContextButton,
|
|
5332
5951
|
runtimeContextBadge,
|
|
@@ -5338,13 +5957,25 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5338
5957
|
includedSummary,
|
|
5339
5958
|
recordsList,
|
|
5340
5959
|
allPromptText,
|
|
5960
|
+
latestSessionSection,
|
|
5961
|
+
latestSessionTitle,
|
|
5962
|
+
latestSessionStatus,
|
|
5963
|
+
latestSessionMeta,
|
|
5964
|
+
latestSessionMessage,
|
|
5965
|
+
latestSessionHint,
|
|
5966
|
+
latestSessionRefreshButton,
|
|
5967
|
+
latestSessionError,
|
|
5341
5968
|
footer,
|
|
5969
|
+
footerLeftActions,
|
|
5970
|
+
recommendedActionLabel,
|
|
5342
5971
|
statusMessage,
|
|
5343
5972
|
errorMessage,
|
|
5344
|
-
|
|
5973
|
+
copyContextButton,
|
|
5974
|
+
previewButton,
|
|
5345
5975
|
previewFloat,
|
|
5346
5976
|
previewFloatContent,
|
|
5347
|
-
|
|
5977
|
+
quickAskButton,
|
|
5978
|
+
createTaskButton,
|
|
5348
5979
|
updateRawPromptPreviewPosition,
|
|
5349
5980
|
setRawPromptPreviewVisible
|
|
5350
5981
|
};
|
|
@@ -5441,7 +6072,7 @@ function createAnnotateSidebarRenderers({
|
|
|
5441
6072
|
elementValue.style.wordBreak = "break-word";
|
|
5442
6073
|
elementValue.textContent = chip.label;
|
|
5443
6074
|
activeTooltip.appendChild(createSection("ELEMENT", elementValue));
|
|
5444
|
-
activeTooltip.appendChild(createSection("NOTE", chip.note.trim() || "
|
|
6075
|
+
activeTooltip.appendChild(createSection("NOTE", chip.note.trim() || t("annotate.note.none")));
|
|
5445
6076
|
if (chip.selector) {
|
|
5446
6077
|
activeTooltip.appendChild(createSection("PATH", chip.selector));
|
|
5447
6078
|
}
|
|
@@ -5594,7 +6225,7 @@ function createAnnotateSidebarRenderers({
|
|
|
5594
6225
|
if (records.length === 0) {
|
|
5595
6226
|
const empty = document.createElement("div");
|
|
5596
6227
|
empty.className = annotateSidebarEmptyClass;
|
|
5597
|
-
empty.textContent = "
|
|
6228
|
+
empty.textContent = t("annotate.records.none");
|
|
5598
6229
|
recordsList.appendChild(empty);
|
|
5599
6230
|
return;
|
|
5600
6231
|
}
|
|
@@ -5616,10 +6247,10 @@ function createAnnotateSidebarRenderers({
|
|
|
5616
6247
|
}
|
|
5617
6248
|
});
|
|
5618
6249
|
const label = document.createElement("div");
|
|
5619
|
-
label.textContent = record.target.label || "
|
|
6250
|
+
label.textContent = record.target.label || t("annotate.target.unknown");
|
|
5620
6251
|
const meta = document.createElement("div");
|
|
5621
6252
|
meta.className = annotateSidebarQueueMetaClass;
|
|
5622
|
-
meta.textContent = record.note.trim().length > 0 ? record.note : "
|
|
6253
|
+
meta.textContent = record.note.trim().length > 0 ? record.note : t("annotate.note.optionalEmpty");
|
|
5623
6254
|
item.append(label, meta);
|
|
5624
6255
|
recordsList.appendChild(item);
|
|
5625
6256
|
}
|
|
@@ -5640,7 +6271,6 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
5640
6271
|
element,
|
|
5641
6272
|
headerStatus,
|
|
5642
6273
|
quickCaptureButton,
|
|
5643
|
-
screenshotContextButton,
|
|
5644
6274
|
cssContextButton,
|
|
5645
6275
|
runtimeContextButton,
|
|
5646
6276
|
runtimeContextBadge,
|
|
@@ -5653,12 +6283,24 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
5653
6283
|
recordsList,
|
|
5654
6284
|
allPromptText,
|
|
5655
6285
|
footer,
|
|
6286
|
+
footerLeftActions,
|
|
5656
6287
|
statusMessage,
|
|
5657
6288
|
errorMessage,
|
|
5658
|
-
|
|
6289
|
+
copyContextButton,
|
|
6290
|
+
previewButton,
|
|
5659
6291
|
previewFloat,
|
|
5660
6292
|
previewFloatContent,
|
|
5661
|
-
|
|
6293
|
+
quickAskButton,
|
|
6294
|
+
createTaskButton,
|
|
6295
|
+
latestSessionSection,
|
|
6296
|
+
latestSessionTitle,
|
|
6297
|
+
latestSessionStatus,
|
|
6298
|
+
latestSessionMeta,
|
|
6299
|
+
latestSessionMessage,
|
|
6300
|
+
latestSessionHint,
|
|
6301
|
+
latestSessionRefreshButton,
|
|
6302
|
+
latestSessionError,
|
|
6303
|
+
recommendedActionLabel,
|
|
5662
6304
|
updateRawPromptPreviewPosition,
|
|
5663
6305
|
setRawPromptPreviewVisible
|
|
5664
6306
|
} = dom;
|
|
@@ -5666,9 +6308,99 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
5666
6308
|
let instructionSegments = [];
|
|
5667
6309
|
let isSyncingInstructionDom = false;
|
|
5668
6310
|
let renderedChipSignature = "";
|
|
6311
|
+
let lastRevealedSessionId = "";
|
|
6312
|
+
function classifySessionMessage(input) {
|
|
6313
|
+
if (input.role === "agent") return "agent";
|
|
6314
|
+
return "system-info";
|
|
6315
|
+
}
|
|
6316
|
+
function getLatestSessionFallbackMessage(status, hasDetail) {
|
|
6317
|
+
if (!hasDetail) {
|
|
6318
|
+
return t("annotate.latestSession.noDetail");
|
|
6319
|
+
}
|
|
6320
|
+
if (status === "pending" || status === "acknowledged") {
|
|
6321
|
+
return status === "acknowledged" ? t("annotate.latestSession.acknowledged") : t("annotate.latestSession.pending");
|
|
6322
|
+
}
|
|
6323
|
+
if (status === "in_progress") {
|
|
6324
|
+
return t("annotate.latestSession.inProgress");
|
|
6325
|
+
}
|
|
6326
|
+
if (status === "resolved") {
|
|
6327
|
+
return t("annotate.latestSession.resolved");
|
|
6328
|
+
}
|
|
6329
|
+
if (status === "dismissed") {
|
|
6330
|
+
return t("annotate.latestSession.dismissed");
|
|
6331
|
+
}
|
|
6332
|
+
return t("annotate.latestSession.noDetail");
|
|
6333
|
+
}
|
|
6334
|
+
function getLatestSessionStatusLabel(status) {
|
|
6335
|
+
if (status === "resolved") {
|
|
6336
|
+
return `\u2713 ${t("annotate.latestSession.status.resolved")}`;
|
|
6337
|
+
}
|
|
6338
|
+
if (status === "in_progress") {
|
|
6339
|
+
return `\u25D4 ${t("annotate.latestSession.status.in_progress")}`;
|
|
6340
|
+
}
|
|
6341
|
+
if (status === "dismissed") {
|
|
6342
|
+
return `\u2212 ${t("annotate.latestSession.status.dismissed")}`;
|
|
6343
|
+
}
|
|
6344
|
+
if (status === "acknowledged") {
|
|
6345
|
+
return `\u25D4 ${t("annotate.latestSession.status.acknowledged")}`;
|
|
6346
|
+
}
|
|
6347
|
+
if (status === "pending") {
|
|
6348
|
+
return `\u2022 ${t(`annotate.latestSession.status.${status}`)}`;
|
|
6349
|
+
}
|
|
6350
|
+
return t(`annotate.latestSession.status.${status}`);
|
|
6351
|
+
}
|
|
6352
|
+
function getLatestSessionHint(status) {
|
|
6353
|
+
if (status === "pending" || status === "acknowledged") {
|
|
6354
|
+
if (status === "acknowledged") {
|
|
6355
|
+
return t("annotate.latestSession.hint.acknowledged");
|
|
6356
|
+
}
|
|
6357
|
+
return t("annotate.latestSession.hint.pending");
|
|
6358
|
+
}
|
|
6359
|
+
if (status === "in_progress") {
|
|
6360
|
+
return t("annotate.latestSession.hint.in_progress");
|
|
6361
|
+
}
|
|
6362
|
+
if (status === "resolved") {
|
|
6363
|
+
return t("annotate.latestSession.hint.resolved");
|
|
6364
|
+
}
|
|
6365
|
+
return "";
|
|
6366
|
+
}
|
|
6367
|
+
function getLatestSessionErrorMessage(error) {
|
|
6368
|
+
if (!error) return "";
|
|
6369
|
+
if (error === "Live session updates disconnected. You can refresh to reconnect.") {
|
|
6370
|
+
return t("annotate.latestSession.error.disconnected");
|
|
6371
|
+
}
|
|
6372
|
+
return error;
|
|
6373
|
+
}
|
|
6374
|
+
function applyLatestSessionStatusStyles(status) {
|
|
6375
|
+
latestSessionStatus.dataset.status = status;
|
|
6376
|
+
if (status === "resolved") {
|
|
6377
|
+
latestSessionStatus.style.background = "rgba(18, 183, 106, 0.12)";
|
|
6378
|
+
latestSessionStatus.style.borderColor = "rgba(18, 183, 106, 0.25)";
|
|
6379
|
+
latestSessionStatus.style.color = "#5ad496";
|
|
6380
|
+
return;
|
|
6381
|
+
}
|
|
6382
|
+
if (status === "in_progress") {
|
|
6383
|
+
latestSessionStatus.style.background = "rgba(47, 128, 237, 0.12)";
|
|
6384
|
+
latestSessionStatus.style.borderColor = "rgba(47, 128, 237, 0.25)";
|
|
6385
|
+
latestSessionStatus.style.color = "#73b2ff";
|
|
6386
|
+
return;
|
|
6387
|
+
}
|
|
6388
|
+
if (status === "dismissed") {
|
|
6389
|
+
latestSessionStatus.style.background = "rgba(152, 162, 179, 0.12)";
|
|
6390
|
+
latestSessionStatus.style.borderColor = "rgba(152, 162, 179, 0.25)";
|
|
6391
|
+
latestSessionStatus.style.color = "#b0b8c6";
|
|
6392
|
+
return;
|
|
6393
|
+
}
|
|
6394
|
+
latestSessionStatus.style.background = "rgba(255, 255, 255, 0.06)";
|
|
6395
|
+
latestSessionStatus.style.borderColor = "rgba(255, 255, 255, 0.1)";
|
|
6396
|
+
latestSessionStatus.style.color = "var(--inspecto-text-secondary)";
|
|
6397
|
+
}
|
|
5669
6398
|
function getPromptChipRecordById(id) {
|
|
5670
|
-
var _a2;
|
|
5671
|
-
return (
|
|
6399
|
+
var _a2, _b, _c;
|
|
6400
|
+
return (_c = getPromptChipRecords(
|
|
6401
|
+
currentOptions.session,
|
|
6402
|
+
((_a2 = currentOptions.latestSessionSummary) == null ? void 0 : _a2.status) === "resolved" || ((_b = currentOptions.latestSessionDetail) == null ? void 0 : _b.status) === "resolved"
|
|
6403
|
+
).find((chip) => chip.id === id)) != null ? _c : null;
|
|
5672
6404
|
}
|
|
5673
6405
|
const renderers = createAnnotateSidebarRenderers({
|
|
5674
6406
|
shadowRoot,
|
|
@@ -5676,6 +6408,43 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
5676
6408
|
getOptions: () => currentOptions,
|
|
5677
6409
|
getPromptChipRecordById
|
|
5678
6410
|
});
|
|
6411
|
+
latestSessionRefreshButton.addEventListener("click", (event) => {
|
|
6412
|
+
var _a2;
|
|
6413
|
+
event.preventDefault();
|
|
6414
|
+
(_a2 = currentOptions.onRefreshLatestSession) == null ? void 0 : _a2.call(currentOptions);
|
|
6415
|
+
});
|
|
6416
|
+
previewButton.addEventListener("click", (event) => {
|
|
6417
|
+
event.preventDefault();
|
|
6418
|
+
event.stopPropagation();
|
|
6419
|
+
setRawPromptPreviewVisible(previewFloat.style.display !== "block");
|
|
6420
|
+
});
|
|
6421
|
+
const originalCopyHtml = copyContextButton.innerHTML;
|
|
6422
|
+
copyContextButton.addEventListener("click", (event) => {
|
|
6423
|
+
event.preventDefault();
|
|
6424
|
+
if (!currentOptions.onCopyContext) return;
|
|
6425
|
+
const promise = currentOptions.onCopyContext();
|
|
6426
|
+
if (promise) {
|
|
6427
|
+
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>';
|
|
6428
|
+
copyContextButton.title = t("annotate.copyContext.copied");
|
|
6429
|
+
promise.then(() => {
|
|
6430
|
+
setTimeout(() => {
|
|
6431
|
+
copyContextButton.innerHTML = originalCopyHtml;
|
|
6432
|
+
copyContextButton.title = t("annotate.copyContext");
|
|
6433
|
+
}, 1500);
|
|
6434
|
+
}).catch(() => {
|
|
6435
|
+
copyContextButton.innerHTML = originalCopyHtml;
|
|
6436
|
+
copyContextButton.title = t("annotate.copyContext");
|
|
6437
|
+
});
|
|
6438
|
+
}
|
|
6439
|
+
});
|
|
6440
|
+
quickAskButton.addEventListener("click", (event) => {
|
|
6441
|
+
event.preventDefault();
|
|
6442
|
+
currentOptions.onQuickAsk();
|
|
6443
|
+
});
|
|
6444
|
+
createTaskButton.addEventListener("click", (event) => {
|
|
6445
|
+
event.preventDefault();
|
|
6446
|
+
currentOptions.onCreateTask();
|
|
6447
|
+
});
|
|
5679
6448
|
function renderInstructionSegments(segments) {
|
|
5680
6449
|
isSyncingInstructionDom = true;
|
|
5681
6450
|
const fragment = document.createDocumentFragment();
|
|
@@ -5692,7 +6461,11 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
5692
6461
|
isSyncingInstructionDom = false;
|
|
5693
6462
|
}
|
|
5694
6463
|
function syncInstructionSegmentsWithChips(session) {
|
|
5695
|
-
|
|
6464
|
+
var _a2, _b;
|
|
6465
|
+
const chips = getPromptChipRecords(
|
|
6466
|
+
session,
|
|
6467
|
+
((_a2 = currentOptions.latestSessionSummary) == null ? void 0 : _a2.status) === "resolved" || ((_b = currentOptions.latestSessionDetail) == null ? void 0 : _b.status) === "resolved"
|
|
6468
|
+
);
|
|
5696
6469
|
const validChipIds = new Set(chips.map((chip) => chip.id));
|
|
5697
6470
|
const nextSegments = [];
|
|
5698
6471
|
const existingChipIds = /* @__PURE__ */ new Set();
|
|
@@ -5710,22 +6483,29 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
5710
6483
|
instructionSegments = normalizeInstructionSegments(nextSegments);
|
|
5711
6484
|
}
|
|
5712
6485
|
function renderPromptChips(session) {
|
|
6486
|
+
var _a2, _b;
|
|
5713
6487
|
const previousChipIds = getInstructionChipIdSignature(instructionSegments);
|
|
5714
6488
|
syncInstructionSegmentsWithChips(session);
|
|
5715
6489
|
const nextChipIds = getInstructionChipIdSignature(instructionSegments);
|
|
5716
|
-
const nextChipSignature = getChipSignature(
|
|
6490
|
+
const nextChipSignature = getChipSignature(
|
|
6491
|
+
session,
|
|
6492
|
+
((_a2 = currentOptions.latestSessionSummary) == null ? void 0 : _a2.status) === "resolved" || ((_b = currentOptions.latestSessionDetail) == null ? void 0 : _b.status) === "resolved"
|
|
6493
|
+
);
|
|
5717
6494
|
const shouldRerender = previousChipIds !== nextChipIds || renderedChipSignature !== nextChipSignature;
|
|
5718
6495
|
if (!shouldRerender) return;
|
|
5719
6496
|
renderedChipSignature = nextChipSignature;
|
|
5720
6497
|
renderInstructionSegments(instructionSegments);
|
|
5721
6498
|
}
|
|
5722
6499
|
function patch(next) {
|
|
5723
|
-
var _a2, _b, _c;
|
|
6500
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
5724
6501
|
const hasSavedRecords = next.session.records.length > 0;
|
|
5725
6502
|
const hasCurrentDraft = Boolean(next.session.current.target);
|
|
5726
6503
|
const hasBatchContent = hasSavedRecords || hasCurrentDraft;
|
|
5727
|
-
const shouldShowBody = hasSavedRecords || hasCurrentDraft || next.isSending || next.successScope
|
|
6504
|
+
const shouldShowBody = hasSavedRecords || hasCurrentDraft || next.isSending || next.successScope === "quick-ask" || Boolean(next.errorMessage);
|
|
5728
6505
|
const canSend = next.isSending ? false : next.includedRecords.length > 0 || hasCurrentDraft;
|
|
6506
|
+
const preferredAction = (_a2 = next.preferredAction) != null ? _a2 : "create-task";
|
|
6507
|
+
const deliveryPreference = (_b = next.annotateDeliveryMode) != null ? _b : "both";
|
|
6508
|
+
const showDebugHelperActions = deliveryPreference !== "agent";
|
|
5729
6509
|
element.style.display = "";
|
|
5730
6510
|
emptyState.style.display = shouldShowBody ? "none" : "";
|
|
5731
6511
|
draftSection.style.display = shouldShowBody ? "" : "none";
|
|
@@ -5733,24 +6513,17 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
5733
6513
|
quickCaptureButton.setAttribute("aria-pressed", String(Boolean(next.quickCaptureEnabled)));
|
|
5734
6514
|
quickCaptureButton.dataset.active = String(Boolean(next.quickCaptureEnabled));
|
|
5735
6515
|
quickCaptureButton.dataset.visualState = next.quickCaptureEnabled ? "active" : "inactive";
|
|
5736
|
-
quickCaptureButton.title = next.quickCaptureEnabled ? "
|
|
5737
|
-
screenshotContextButton.style.display = hasBatchContent && next.canAttachScreenshotContext ? "" : "none";
|
|
5738
|
-
screenshotContextButton.setAttribute(
|
|
5739
|
-
"aria-pressed",
|
|
5740
|
-
next.screenshotContextEnabled ? "true" : "false"
|
|
5741
|
-
);
|
|
5742
|
-
screenshotContextButton.dataset.visualState = next.screenshotContextEnabled ? "active" : "inactive";
|
|
5743
|
-
screenshotContextButton.title = next.screenshotContextEnabled ? "Screenshot context enabled" : "Attach screenshot context";
|
|
6516
|
+
quickCaptureButton.title = next.quickCaptureEnabled ? `${t("annotate.quickCapture.toggle")} on` : t("annotate.quickCapture.toggle");
|
|
5744
6517
|
cssContextButton.style.display = hasBatchContent && next.canAttachCssContext ? "" : "none";
|
|
5745
6518
|
cssContextButton.setAttribute("aria-pressed", next.cssContextEnabled ? "true" : "false");
|
|
5746
6519
|
cssContextButton.dataset.visualState = next.cssContextEnabled ? "active" : "inactive";
|
|
5747
|
-
cssContextButton.title = next.cssContextEnabled ? "
|
|
6520
|
+
cssContextButton.title = next.cssContextEnabled ? t("menu.cssEnabled") : t("menu.attachCss");
|
|
5748
6521
|
runtimeContextButton.style.display = hasBatchContent && next.canAttachRuntimeContext ? "" : "none";
|
|
5749
6522
|
runtimeContextButton.setAttribute("aria-pressed", next.runtimeContextEnabled ? "true" : "false");
|
|
5750
6523
|
runtimeContextButton.dataset.visualState = next.runtimeContextEnabled ? "active" : "inactive";
|
|
5751
|
-
runtimeContextBadge.textContent = formatRuntimeErrorCount3((
|
|
5752
|
-
runtimeContextBadge.hidden = !next.runtimeContextEnabled || ((
|
|
5753
|
-
runtimeContextButton.title = next.runtimeContextEnabled ? next.runtimeErrorCount ?
|
|
6524
|
+
runtimeContextBadge.textContent = formatRuntimeErrorCount3((_c = next.runtimeErrorCount) != null ? _c : 0);
|
|
6525
|
+
runtimeContextBadge.hidden = !next.runtimeContextEnabled || ((_d = next.runtimeErrorCount) != null ? _d : 0) <= 0;
|
|
6526
|
+
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");
|
|
5754
6527
|
modeButton.innerHTML = next.mode === "capture-enabled" ? pauseIconSvg : playIconSvg;
|
|
5755
6528
|
const toggleSvgElement = modeButton.querySelector("svg");
|
|
5756
6529
|
if (toggleSvgElement) {
|
|
@@ -5760,15 +6533,17 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
5760
6533
|
}
|
|
5761
6534
|
modeButton.setAttribute(
|
|
5762
6535
|
"aria-label",
|
|
5763
|
-
next.mode === "capture-enabled" ? "
|
|
6536
|
+
next.mode === "capture-enabled" ? t("launcher.action.pause.title") : t("launcher.action.resume.title")
|
|
5764
6537
|
);
|
|
5765
|
-
modeButton.title = next.mode === "capture-enabled" ? "
|
|
6538
|
+
modeButton.title = next.mode === "capture-enabled" ? t("launcher.action.pause.title") : t("launcher.action.resume.title");
|
|
5766
6539
|
modeButton.dataset.selected = String(next.mode === "capture-enabled");
|
|
5767
|
-
headerStatus.textContent = next.mode === "capture-enabled" ? next.quickCaptureEnabled ? "
|
|
6540
|
+
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");
|
|
5768
6541
|
renderPromptChips(next.session);
|
|
5769
6542
|
allPromptText.textContent = next.fullPrompt;
|
|
5770
6543
|
previewFloatContent.textContent = next.fullPrompt;
|
|
5771
|
-
|
|
6544
|
+
footerLeftActions.style.display = canSend && showDebugHelperActions ? "flex" : "none";
|
|
6545
|
+
previewButton.style.display = showDebugHelperActions ? "" : "none";
|
|
6546
|
+
copyContextButton.style.display = canSend && showDebugHelperActions ? "" : "none";
|
|
5772
6547
|
if (!canSend) {
|
|
5773
6548
|
setRawPromptPreviewVisible(false);
|
|
5774
6549
|
}
|
|
@@ -5777,10 +6552,114 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
5777
6552
|
}
|
|
5778
6553
|
includedSummary.textContent = `Element notes (${next.includedRecords.length})`;
|
|
5779
6554
|
renderers.renderIncludedRecords(next.includedRecords, recordsList);
|
|
5780
|
-
|
|
5781
|
-
|
|
6555
|
+
const allowQuickAsk = deliveryPreference === "both" || deliveryPreference === "ide";
|
|
6556
|
+
const allowCreateTask = deliveryPreference === "both" || deliveryPreference === "agent";
|
|
6557
|
+
const onlyOneAction = allowQuickAsk !== allowCreateTask;
|
|
6558
|
+
quickAskButton.style.display = allowQuickAsk ? "" : "none";
|
|
6559
|
+
createTaskButton.style.display = allowCreateTask ? "" : "none";
|
|
6560
|
+
quickAskButton.disabled = !canSend;
|
|
6561
|
+
createTaskButton.disabled = !canSend;
|
|
6562
|
+
if (onlyOneAction) {
|
|
6563
|
+
quickAskButton.classList.toggle("primary", true);
|
|
6564
|
+
createTaskButton.classList.toggle("primary", true);
|
|
6565
|
+
quickAskButton.dataset.emphasis = "primary";
|
|
6566
|
+
createTaskButton.dataset.emphasis = "primary";
|
|
6567
|
+
quickAskButton.style.flex = "1";
|
|
6568
|
+
createTaskButton.style.flex = "1";
|
|
6569
|
+
quickAskButton.dataset.layoutRole = "primary";
|
|
6570
|
+
createTaskButton.dataset.layoutRole = "primary";
|
|
6571
|
+
} else {
|
|
6572
|
+
quickAskButton.classList.toggle("primary", false);
|
|
6573
|
+
createTaskButton.classList.toggle("primary", false);
|
|
6574
|
+
quickAskButton.dataset.emphasis = preferredAction === "quick-ask" ? "primary" : "secondary";
|
|
6575
|
+
createTaskButton.dataset.emphasis = preferredAction === "create-task" ? "primary" : "secondary";
|
|
6576
|
+
quickAskButton.dataset.layoutRole = preferredAction === "quick-ask" ? "primary" : "secondary";
|
|
6577
|
+
createTaskButton.dataset.layoutRole = preferredAction === "create-task" ? "primary" : "secondary";
|
|
6578
|
+
quickAskButton.style.order = "1";
|
|
6579
|
+
createTaskButton.style.order = "2";
|
|
6580
|
+
quickAskButton.style.flex = "1";
|
|
6581
|
+
createTaskButton.style.flex = "1";
|
|
6582
|
+
}
|
|
6583
|
+
quickAskButton.title = t("annotate.askAiHint");
|
|
6584
|
+
createTaskButton.title = t("annotate.createTaskHint");
|
|
6585
|
+
recommendedActionLabel.style.display = canSend && !onlyOneAction && deliveryPreference === "both" ? "block" : "none";
|
|
6586
|
+
recommendedActionLabel.textContent = preferredAction === "quick-ask" ? t("annotate.recommendedAction.askHint", {
|
|
6587
|
+
action: t("annotate.askAi")
|
|
6588
|
+
}) : t("annotate.recommendedAction.agentHint", {
|
|
6589
|
+
action: t("annotate.createTask")
|
|
6590
|
+
});
|
|
6591
|
+
quickAskButton.textContent = next.isSending && next.sendingScope === "quick-ask" ? t("menu.sending") : !next.isSending && next.successScope === "quick-ask" ? t("annotate.sent") : t("annotate.askAi");
|
|
6592
|
+
createTaskButton.textContent = next.isSending && next.sendingScope === "create-task" ? t("menu.sending") : t("annotate.createTask");
|
|
6593
|
+
const latestSession = next.latestSessionDetail;
|
|
6594
|
+
const latestSessionSummary = next.latestSessionSummary;
|
|
6595
|
+
latestSessionSection.style.display = latestSession || latestSessionSummary ? "" : "none";
|
|
6596
|
+
latestSessionRefreshButton.disabled = Boolean(next.latestSessionLoading);
|
|
6597
|
+
latestSessionTitle.textContent = t("annotate.latestSession.title");
|
|
6598
|
+
if (latestSession || latestSessionSummary) {
|
|
6599
|
+
const latestStatus = (_f = (_e = latestSession == null ? void 0 : latestSession.status) != null ? _e : latestSessionSummary == null ? void 0 : latestSessionSummary.status) != null ? _f : "pending";
|
|
6600
|
+
latestSessionMeta.textContent = latestSession ? t("annotate.latestSession.meta.loaded", {
|
|
6601
|
+
id: latestSession.id.slice(0, 8),
|
|
6602
|
+
count: latestSession.annotations.length
|
|
6603
|
+
}) : latestSessionSummary ? t("annotate.latestSession.meta.summary", {
|
|
6604
|
+
id: latestSessionSummary.id.slice(0, 8)
|
|
6605
|
+
}) : "";
|
|
6606
|
+
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;
|
|
6607
|
+
const lastAgentOrSystemMessage = (_j = (_i = lastAgentOrSystemMessageRecord == null ? void 0 : lastAgentOrSystemMessageRecord.text) == null ? void 0 : _i.trim()) != null ? _j : "";
|
|
6608
|
+
const latestMessageKind = lastAgentOrSystemMessageRecord && lastAgentOrSystemMessage ? classifySessionMessage({
|
|
6609
|
+
role: lastAgentOrSystemMessageRecord.role,
|
|
6610
|
+
text: lastAgentOrSystemMessage
|
|
6611
|
+
}) : null;
|
|
6612
|
+
const latestVisualStatus = latestStatus;
|
|
6613
|
+
latestSessionStatus.textContent = getLatestSessionStatusLabel(latestVisualStatus);
|
|
6614
|
+
applyLatestSessionStatusStyles(latestVisualStatus);
|
|
6615
|
+
latestSessionMessage.style.display = "none";
|
|
6616
|
+
const fallbackMsg = getLatestSessionFallbackMessage(latestStatus, Boolean(latestSession));
|
|
6617
|
+
const hasMessage = next.latestSessionLoading || lastAgentOrSystemMessage || fallbackMsg;
|
|
6618
|
+
if (hasMessage) {
|
|
6619
|
+
latestSessionMessage.style.display = "block";
|
|
6620
|
+
latestSessionMessage.textContent = next.latestSessionLoading ? t("annotate.latestSession.loading") : lastAgentOrSystemMessage || fallbackMsg;
|
|
6621
|
+
}
|
|
6622
|
+
latestSessionMessage.dataset.variant = latestMessageKind != null ? latestMessageKind : "default";
|
|
6623
|
+
if (latestMessageKind === "system-info") {
|
|
6624
|
+
latestSessionMessage.style.color = "#9ed8ff";
|
|
6625
|
+
} else {
|
|
6626
|
+
latestSessionMessage.style.color = "var(--inspecto-text-secondary)";
|
|
6627
|
+
}
|
|
6628
|
+
const latestSessionHintText = next.latestSessionLoading ? "" : getLatestSessionHint(latestStatus);
|
|
6629
|
+
const latestSessionErrorText = getLatestSessionErrorMessage(next.latestSessionError);
|
|
6630
|
+
const showReconnectAction = Boolean(latestSessionErrorText);
|
|
6631
|
+
latestSessionHint.textContent = latestSessionHintText;
|
|
6632
|
+
latestSessionHint.style.display = latestSessionHintText && !showReconnectAction ? "block" : "none";
|
|
6633
|
+
latestSessionHint.style.color = latestStatus === "resolved" ? "#b7f5cd" : "var(--inspecto-text-secondary)";
|
|
6634
|
+
latestSessionError.textContent = latestSessionErrorText;
|
|
6635
|
+
latestSessionError.style.display = latestSessionErrorText ? "block" : "none";
|
|
6636
|
+
latestSessionRefreshButton.textContent = showReconnectAction ? t("annotate.latestSession.reconnect") : "\u21BB";
|
|
6637
|
+
latestSessionRefreshButton.style.display = showReconnectAction || next.latestSessionLoading ? "" : "none";
|
|
6638
|
+
latestSessionRefreshButton.style.minWidth = showReconnectAction ? "auto" : "";
|
|
6639
|
+
latestSessionRefreshButton.style.padding = showReconnectAction ? "6px 10px" : "";
|
|
6640
|
+
latestSessionRefreshButton.style.fontSize = showReconnectAction ? "11px" : "12px";
|
|
6641
|
+
const latestSessionId = (_l = (_k = latestSession == null ? void 0 : latestSession.id) != null ? _k : latestSessionSummary == null ? void 0 : latestSessionSummary.id) != null ? _l : "";
|
|
6642
|
+
if (latestSessionId && latestSessionId !== lastRevealedSessionId) {
|
|
6643
|
+
lastRevealedSessionId = latestSessionId;
|
|
6644
|
+
if (!hasCurrentDraft && !hasSavedRecords) {
|
|
6645
|
+
latestSessionSection.scrollIntoView({ block: "nearest", behavior: "smooth" });
|
|
6646
|
+
}
|
|
6647
|
+
}
|
|
6648
|
+
} else {
|
|
6649
|
+
latestSessionHint.textContent = "";
|
|
6650
|
+
latestSessionHint.style.display = "none";
|
|
6651
|
+
latestSessionMessage.dataset.variant = "default";
|
|
6652
|
+
latestSessionMessage.style.color = "var(--inspecto-text-secondary)";
|
|
6653
|
+
latestSessionError.textContent = "";
|
|
6654
|
+
latestSessionError.style.display = "none";
|
|
6655
|
+
latestSessionRefreshButton.textContent = "\u21BB";
|
|
6656
|
+
latestSessionRefreshButton.style.display = "none";
|
|
6657
|
+
latestSessionRefreshButton.style.minWidth = "";
|
|
6658
|
+
latestSessionRefreshButton.style.padding = "";
|
|
6659
|
+
latestSessionRefreshButton.style.fontSize = "12px";
|
|
6660
|
+
}
|
|
5782
6661
|
statusMessage.textContent = getLiveStatusMessage(next);
|
|
5783
|
-
errorMessage.textContent = (
|
|
6662
|
+
errorMessage.textContent = (_m = next.errorMessage) != null ? _m : "";
|
|
5784
6663
|
errorMessage.style.display = next.errorMessage ? "block" : "none";
|
|
5785
6664
|
}
|
|
5786
6665
|
instructionSegments = normalizeInstructionSegments([
|
|
@@ -5802,13 +6681,6 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
5802
6681
|
)
|
|
5803
6682
|
);
|
|
5804
6683
|
});
|
|
5805
|
-
screenshotContextButton.addEventListener(
|
|
5806
|
-
"click",
|
|
5807
|
-
() => {
|
|
5808
|
-
var _a2;
|
|
5809
|
-
return (_a2 = currentOptions.onToggleScreenshotContext) == null ? void 0 : _a2.call(currentOptions);
|
|
5810
|
-
}
|
|
5811
|
-
);
|
|
5812
6684
|
cssContextButton.addEventListener("click", () => {
|
|
5813
6685
|
var _a2;
|
|
5814
6686
|
return (_a2 = currentOptions.onToggleCssContext) == null ? void 0 : _a2.call(currentOptions);
|
|
@@ -5817,7 +6689,6 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
5817
6689
|
var _a2;
|
|
5818
6690
|
return (_a2 = currentOptions.onToggleRuntimeContext) == null ? void 0 : _a2.call(currentOptions);
|
|
5819
6691
|
});
|
|
5820
|
-
sendButton.addEventListener("click", () => currentOptions.onSend());
|
|
5821
6692
|
exitButton.addEventListener("click", () => currentOptions.onExit());
|
|
5822
6693
|
quickCaptureButton.addEventListener("click", () => {
|
|
5823
6694
|
var _a2;
|
|
@@ -5873,7 +6744,6 @@ function syncModeUi(ctx) {
|
|
|
5873
6744
|
}
|
|
5874
6745
|
state.annotateCapturePaused = false;
|
|
5875
6746
|
state.annotateRuntimeContextEnabled = false;
|
|
5876
|
-
state.annotateScreenshotContextEnabled = false;
|
|
5877
6747
|
state.annotateCssContextEnabled = false;
|
|
5878
6748
|
(_e = state.annotateSidebar) == null ? void 0 : _e.destroy();
|
|
5879
6749
|
state.annotateSidebar = null;
|
|
@@ -6029,11 +6899,22 @@ function resetAnnotateState(state) {
|
|
|
6029
6899
|
state.annotateCapturePaused = false;
|
|
6030
6900
|
state.annotateQuickCaptureEnabled = false;
|
|
6031
6901
|
state.annotateRuntimeContextEnabled = false;
|
|
6032
|
-
state.annotateScreenshotContextEnabled = false;
|
|
6033
6902
|
state.annotateCssContextEnabled = false;
|
|
6903
|
+
state.stopLatestAnnotateSessionStream();
|
|
6904
|
+
}
|
|
6905
|
+
function buildI18nConfig(input) {
|
|
6906
|
+
const config = {};
|
|
6907
|
+
if (input.locale !== void 0) {
|
|
6908
|
+
config.locale = input.locale;
|
|
6909
|
+
}
|
|
6910
|
+
if (input.messages !== void 0) {
|
|
6911
|
+
config.messages = input.messages;
|
|
6912
|
+
}
|
|
6913
|
+
return config;
|
|
6034
6914
|
}
|
|
6035
6915
|
function connect(ctx, createAnnotateOverlay2) {
|
|
6036
6916
|
const state = asLifecycleContext(ctx);
|
|
6917
|
+
configureI18n(buildI18nConfig(state.options));
|
|
6037
6918
|
const host = state;
|
|
6038
6919
|
host.style.position = "fixed";
|
|
6039
6920
|
host.style.inset = "0";
|
|
@@ -6064,6 +6945,7 @@ function disconnect(ctx) {
|
|
|
6064
6945
|
state.annotateSidebar = null;
|
|
6065
6946
|
state.annotateElements.clear();
|
|
6066
6947
|
state.annotateDrafts.clear();
|
|
6948
|
+
state.stopLatestAnnotateSessionStream();
|
|
6067
6949
|
(_b = state.cleanupRuntimeContextCapture) == null ? void 0 : _b.call(state);
|
|
6068
6950
|
state.cleanupRuntimeContextCapture = null;
|
|
6069
6951
|
state.runtimeContextCollector.clear();
|
|
@@ -6072,6 +6954,7 @@ function disconnect(ctx) {
|
|
|
6072
6954
|
function configure(ctx, options) {
|
|
6073
6955
|
const state = asLifecycleContext(ctx);
|
|
6074
6956
|
state.options = options;
|
|
6957
|
+
configureI18n(buildI18nConfig(options));
|
|
6075
6958
|
if (options.mode !== void 0) {
|
|
6076
6959
|
const previousMode = state.mode;
|
|
6077
6960
|
state.mode = options.mode;
|
|
@@ -6091,6 +6974,9 @@ function configure(ctx, options) {
|
|
|
6091
6974
|
if ((info == null ? void 0 : info.theme) !== void 0) {
|
|
6092
6975
|
applyTheme(state, info.theme);
|
|
6093
6976
|
}
|
|
6977
|
+
if ((info == null ? void 0 : info.annotateDeliveryMode) !== void 0) {
|
|
6978
|
+
state.annotateDeliveryMode = info.annotateDeliveryMode;
|
|
6979
|
+
}
|
|
6094
6980
|
if ((info == null ? void 0 : info.includeSnippet) !== void 0) {
|
|
6095
6981
|
state.options.includeSnippet = info.includeSnippet;
|
|
6096
6982
|
}
|
|
@@ -6098,13 +6984,6 @@ function configure(ctx, options) {
|
|
|
6098
6984
|
state.options.runtimeContext = __spreadValues(__spreadValues({}, state.options.runtimeContext), info.runtimeContext);
|
|
6099
6985
|
state.syncRuntimeContextCapture();
|
|
6100
6986
|
}
|
|
6101
|
-
if ((info == null ? void 0 : info.screenshotContext) !== void 0) {
|
|
6102
|
-
state.options.screenshotContext = __spreadValues(__spreadValues({}, state.options.screenshotContext), info.screenshotContext);
|
|
6103
|
-
}
|
|
6104
|
-
if ((info == null ? void 0 : info.annotationResponseMode) !== void 0) {
|
|
6105
|
-
state.options.annotationResponseMode = info.annotationResponseMode;
|
|
6106
|
-
state.annotationResponseMode = info.annotationResponseMode;
|
|
6107
|
-
}
|
|
6108
6987
|
}).catch(() => {
|
|
6109
6988
|
}).then(() => {
|
|
6110
6989
|
});
|
|
@@ -6150,10 +7029,6 @@ function canAttachRuntimeContext(ctx) {
|
|
|
6150
7029
|
var _a2;
|
|
6151
7030
|
return ((_a2 = asEvidenceContext(ctx).options.runtimeContext) == null ? void 0 : _a2.enabled) === true;
|
|
6152
7031
|
}
|
|
6153
|
-
function canAttachScreenshotContext(ctx) {
|
|
6154
|
-
var _a2;
|
|
6155
|
-
return ((_a2 = asEvidenceContext(ctx).options.screenshotContext) == null ? void 0 : _a2.enabled) === true;
|
|
6156
|
-
}
|
|
6157
7032
|
function canAttachCssContext() {
|
|
6158
7033
|
return typeof window !== "undefined" && typeof window.getComputedStyle === "function";
|
|
6159
7034
|
}
|
|
@@ -6255,29 +7130,6 @@ function getCollectedRuntimeErrorCount(ctx) {
|
|
|
6255
7130
|
const state = asEvidenceContext(ctx);
|
|
6256
7131
|
return state.runtimeContextCollector.snapshot().records.filter((record) => record.kind !== "failed-request").length;
|
|
6257
7132
|
}
|
|
6258
|
-
function resolveAnnotateScreenshotElement(ctx, annotations, scope) {
|
|
6259
|
-
var _a2;
|
|
6260
|
-
const state = asEvidenceContext(ctx);
|
|
6261
|
-
const currentElement = state.annotateSession.current.target ? (_a2 = state.annotateElements.get(state.annotateSession.current.id)) != null ? _a2 : state.findElementForAnnotationTarget(state.annotateSession.current.target) : null;
|
|
6262
|
-
if (scope === "current") return currentElement;
|
|
6263
|
-
for (const annotation of annotations) {
|
|
6264
|
-
for (const target of annotation.targets) {
|
|
6265
|
-
const element = state.findElementForLocation(target.location, target.selector);
|
|
6266
|
-
if (element) return element;
|
|
6267
|
-
}
|
|
6268
|
-
}
|
|
6269
|
-
return currentElement;
|
|
6270
|
-
}
|
|
6271
|
-
function captureAnnotateScreenshotContext(ctx, annotations, scope) {
|
|
6272
|
-
return __async(this, null, function* () {
|
|
6273
|
-
const state = asEvidenceContext(ctx);
|
|
6274
|
-
if (!state.canAttachScreenshotContext() || !state.annotateScreenshotContextEnabled) {
|
|
6275
|
-
return null;
|
|
6276
|
-
}
|
|
6277
|
-
const element = resolveAnnotateScreenshotElement(state, annotations, scope);
|
|
6278
|
-
return element ? captureElementScreenshot(element) : null;
|
|
6279
|
-
});
|
|
6280
|
-
}
|
|
6281
7133
|
|
|
6282
7134
|
// src/component.ts
|
|
6283
7135
|
var DEFAULT_ANNOTATE_INSTRUCTION = "";
|
|
@@ -6306,18 +7158,23 @@ var InspectoElement = class extends BaseElement {
|
|
|
6306
7158
|
this.annotateDrafts = /* @__PURE__ */ new Map();
|
|
6307
7159
|
this.annotateEditingRecord = null;
|
|
6308
7160
|
this.configLoadPromise = null;
|
|
6309
|
-
this.annotationResponseMode = "unified";
|
|
6310
7161
|
this.annotateInstructionDraft = DEFAULT_ANNOTATE_INSTRUCTION;
|
|
6311
7162
|
this.annotateErrorMessage = "";
|
|
6312
7163
|
this.annotateRuntimeContextEnabled = false;
|
|
6313
|
-
this.annotateScreenshotContextEnabled = false;
|
|
6314
7164
|
this.annotateCssContextEnabled = false;
|
|
7165
|
+
this.annotateDeliveryMode = "both";
|
|
6315
7166
|
this.annotateSendState = {
|
|
6316
7167
|
isSending: false,
|
|
6317
7168
|
scope: null
|
|
6318
7169
|
};
|
|
7170
|
+
this.annotateLatestSessionSummary = null;
|
|
7171
|
+
this.annotateLatestSessionDetail = null;
|
|
7172
|
+
this.annotateLatestSessionStream = null;
|
|
7173
|
+
this.annotateLatestSessionLoading = false;
|
|
7174
|
+
this.annotateLatestSessionError = "";
|
|
6319
7175
|
this.annotateSuccessScope = null;
|
|
6320
7176
|
this.annotateSuccessTimeout = null;
|
|
7177
|
+
this.annotateSuccessOnClear = null;
|
|
6321
7178
|
this.pendingAnnotateViewportFrame = null;
|
|
6322
7179
|
this.runtimeContextCollector = createRuntimeContextCollector();
|
|
6323
7180
|
this.cleanupRuntimeContextCapture = null;
|
|
@@ -6375,9 +7232,6 @@ var InspectoElement = class extends BaseElement {
|
|
|
6375
7232
|
getEffectiveHotKeys() {
|
|
6376
7233
|
return getEffectiveHotKeys(this);
|
|
6377
7234
|
}
|
|
6378
|
-
getAnnotationResponseMode() {
|
|
6379
|
-
return this.annotationResponseMode;
|
|
6380
|
-
}
|
|
6381
7235
|
updateBadgeContent() {
|
|
6382
7236
|
updateBadgeContent(this);
|
|
6383
7237
|
}
|
|
@@ -6396,6 +7250,9 @@ var InspectoElement = class extends BaseElement {
|
|
|
6396
7250
|
updateLauncherEye() {
|
|
6397
7251
|
updateLauncherEye(this);
|
|
6398
7252
|
}
|
|
7253
|
+
pause() {
|
|
7254
|
+
this.setPaused(true);
|
|
7255
|
+
}
|
|
6399
7256
|
openInspectMenu(loc, clientX, clientY, targetElement) {
|
|
6400
7257
|
openInspectMenu(this, loc, clientX, clientY, targetElement);
|
|
6401
7258
|
}
|
|
@@ -6405,9 +7262,6 @@ var InspectoElement = class extends BaseElement {
|
|
|
6405
7262
|
canAttachRuntimeContext() {
|
|
6406
7263
|
return canAttachRuntimeContext(this);
|
|
6407
7264
|
}
|
|
6408
|
-
canAttachScreenshotContext() {
|
|
6409
|
-
return canAttachScreenshotContext(this);
|
|
6410
|
-
}
|
|
6411
7265
|
canAttachCssContext() {
|
|
6412
7266
|
return canAttachCssContext();
|
|
6413
7267
|
}
|
|
@@ -6435,14 +7289,6 @@ var InspectoElement = class extends BaseElement {
|
|
|
6435
7289
|
getCollectedRuntimeErrorCount() {
|
|
6436
7290
|
return getCollectedRuntimeErrorCount(this);
|
|
6437
7291
|
}
|
|
6438
|
-
resolveAnnotateScreenshotElement(annotations, scope) {
|
|
6439
|
-
return resolveAnnotateScreenshotElement(this, annotations, scope);
|
|
6440
|
-
}
|
|
6441
|
-
captureAnnotateScreenshotContext(annotations, scope) {
|
|
6442
|
-
return __async(this, null, function* () {
|
|
6443
|
-
return captureAnnotateScreenshotContext(this, annotations, scope);
|
|
6444
|
-
});
|
|
6445
|
-
}
|
|
6446
7292
|
addTargetToCurrentAnnotation(element, location) {
|
|
6447
7293
|
addTargetToCurrentAnnotation(this, element, location);
|
|
6448
7294
|
}
|
|
@@ -6497,15 +7343,26 @@ var InspectoElement = class extends BaseElement {
|
|
|
6497
7343
|
showAnnotateSuccess(scope) {
|
|
6498
7344
|
showAnnotateSuccess(this, scope);
|
|
6499
7345
|
}
|
|
7346
|
+
refreshLatestAnnotateSession() {
|
|
7347
|
+
return __async(this, null, function* () {
|
|
7348
|
+
return refreshLatestAnnotateSession(this);
|
|
7349
|
+
});
|
|
7350
|
+
}
|
|
7351
|
+
startLatestAnnotateSessionStream(sessionId) {
|
|
7352
|
+
startLatestAnnotateSessionStream(this, sessionId);
|
|
7353
|
+
}
|
|
7354
|
+
stopLatestAnnotateSessionStream() {
|
|
7355
|
+
stopLatestAnnotateSessionStream(this);
|
|
7356
|
+
}
|
|
6500
7357
|
toAnnotateErrorMessage(errorCode, fallback) {
|
|
6501
7358
|
return toAnnotateErrorMessage(this, errorCode, fallback);
|
|
6502
7359
|
}
|
|
6503
7360
|
toAnnotationTransportFromRecord(record) {
|
|
6504
7361
|
return toAnnotationTransportFromRecordUi(this, record);
|
|
6505
7362
|
}
|
|
6506
|
-
sendAnnotationBatch(annotations, scope, instruction, onSuccess) {
|
|
7363
|
+
sendAnnotationBatch(annotations, scope, instruction, deliveryMode, onSuccess) {
|
|
6507
7364
|
return __async(this, null, function* () {
|
|
6508
|
-
return sendAnnotationBatch(this, annotations, scope, instruction, onSuccess);
|
|
7365
|
+
return sendAnnotationBatch(this, annotations, scope, instruction, deliveryMode, onSuccess);
|
|
6509
7366
|
});
|
|
6510
7367
|
}
|
|
6511
7368
|
syncModeUi() {
|
|
@@ -6556,4 +7413,4 @@ if (typeof customElements !== "undefined" && !customElements.get("inspecto-overl
|
|
|
6556
7413
|
export {
|
|
6557
7414
|
InspectoElement
|
|
6558
7415
|
};
|
|
6559
|
-
//# sourceMappingURL=component-
|
|
7416
|
+
//# sourceMappingURL=component-MYXLDDWZ.js.map
|