@inspecto-dev/core 0.3.8 → 0.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/{component-BLZBHHON.js → component-MYXLDDWZ.js} +1435 -613
- package/dist/component-MYXLDDWZ.js.map +1 -0
- package/dist/index.cjs +1455 -631
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -6
- package/dist/index.d.ts +10 -6
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/dist/component-BLZBHHON.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;
|
|
902
|
+
}
|
|
903
|
+
|
|
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);
|
|
813
909
|
}
|
|
814
910
|
|
|
815
|
-
.${badgeClass}-panel-button
|
|
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";
|
|
@@ -2436,12 +2746,9 @@ function buildAnnotateFullPrompt(input) {
|
|
|
2436
2746
|
const prompt = instruction ? `${instruction}
|
|
2437
2747
|
|
|
2438
2748
|
${body}` : body;
|
|
2439
|
-
return
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
input.cssContextPrompt
|
|
2443
|
-
),
|
|
2444
|
-
input.screenshotContext
|
|
2749
|
+
return appendCssContextToPrompt(
|
|
2750
|
+
appendRuntimeContextSection(prompt, input.runtimeContext),
|
|
2751
|
+
input.cssContextPrompt
|
|
2445
2752
|
);
|
|
2446
2753
|
}
|
|
2447
2754
|
function buildSelectedElementsPrompt(annotations) {
|
|
@@ -2473,22 +2780,6 @@ function appendRuntimeContextSection(prompt, runtimeContext) {
|
|
|
2473
2780
|
|
|
2474
2781
|
${buildRuntimeContextSection(runtimeContext.records)}`;
|
|
2475
2782
|
}
|
|
2476
|
-
function appendScreenshotContextSection(prompt, screenshotContext) {
|
|
2477
|
-
if (!screenshotContext || !screenshotContext.imageDataUrl && !screenshotContext.imageAssetId) {
|
|
2478
|
-
return prompt;
|
|
2479
|
-
}
|
|
2480
|
-
const lines = [
|
|
2481
|
-
"Visual screenshot context attached:",
|
|
2482
|
-
`- capturedAt=${screenshotContext.capturedAt}`,
|
|
2483
|
-
`- mimeType=${screenshotContext.mimeType}`
|
|
2484
|
-
];
|
|
2485
|
-
if (screenshotContext.imageAssetId) {
|
|
2486
|
-
lines.push(`- imageAssetId=${screenshotContext.imageAssetId}`);
|
|
2487
|
-
}
|
|
2488
|
-
return `${prompt}
|
|
2489
|
-
|
|
2490
|
-
${lines.join("\n")}`;
|
|
2491
|
-
}
|
|
2492
2783
|
function buildRuntimeContextSection(records) {
|
|
2493
2784
|
return ["Relevant runtime context:", ...records.map(formatRuntimeRecord)].join("\n");
|
|
2494
2785
|
}
|
|
@@ -2508,7 +2799,7 @@ function formatRuntimeRecord(record) {
|
|
|
2508
2799
|
|
|
2509
2800
|
// src/http.ts
|
|
2510
2801
|
import { INSPECTO_API_PATHS } from "@inspecto-dev/types";
|
|
2511
|
-
var BASE_URL = globalThis.__AI_INSPECTOR_SERVER_URL__ || "http://
|
|
2802
|
+
var BASE_URL = globalThis.__AI_INSPECTOR_SERVER_URL__ || "http://0.0.0.0:5678";
|
|
2512
2803
|
var _a;
|
|
2513
2804
|
var AI_BATCH_DISPATCH_PATH = (_a = INSPECTO_API_PATHS.AI_BATCH_DISPATCH) != null ? _a : "/inspecto/api/v1/ai/dispatch/annotations";
|
|
2514
2805
|
function setBaseUrl(url) {
|
|
@@ -2530,15 +2821,26 @@ function fetchIdeInfo(force = false) {
|
|
|
2530
2821
|
}
|
|
2531
2822
|
function openFile(req) {
|
|
2532
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;
|
|
2533
2830
|
try {
|
|
2534
|
-
const res = yield fetch(`${BASE_URL}${INSPECTO_API_PATHS.
|
|
2831
|
+
const res = yield fetch(`${BASE_URL}${INSPECTO_API_PATHS.SOURCE_OPEN}`, {
|
|
2535
2832
|
method: "POST",
|
|
2536
2833
|
headers: { "Content-Type": "application/json" },
|
|
2537
2834
|
body: JSON.stringify(req)
|
|
2538
2835
|
});
|
|
2539
|
-
|
|
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
|
+
};
|
|
2540
2842
|
} catch (e) {
|
|
2541
|
-
return false;
|
|
2843
|
+
return { success: false, errorCode: "SERVER_UNAVAILABLE" };
|
|
2542
2844
|
}
|
|
2543
2845
|
});
|
|
2544
2846
|
}
|
|
@@ -2550,54 +2852,169 @@ function fetchSnippet(file, line, column, maxLines = 100) {
|
|
|
2550
2852
|
column: String(column),
|
|
2551
2853
|
maxLines: String(maxLines)
|
|
2552
2854
|
});
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
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
|
+
});
|
|
2557
2867
|
}
|
|
2558
|
-
return res.json();
|
|
2559
2868
|
});
|
|
2560
2869
|
}
|
|
2561
2870
|
function sendToAi(req) {
|
|
2562
2871
|
return __async(this, null, function* () {
|
|
2563
2872
|
var _a2;
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
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) {
|
|
2571
2889
|
return {
|
|
2572
2890
|
success: false,
|
|
2573
|
-
error:
|
|
2574
|
-
errorCode:
|
|
2891
|
+
error: "Local dev server unavailable",
|
|
2892
|
+
errorCode: "SERVER_UNAVAILABLE"
|
|
2575
2893
|
};
|
|
2576
2894
|
}
|
|
2577
|
-
return res.json();
|
|
2578
2895
|
});
|
|
2579
2896
|
}
|
|
2580
2897
|
function sendAnnotationsToAi(req) {
|
|
2581
2898
|
return __async(this, null, function* () {
|
|
2582
2899
|
var _a2;
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
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) {
|
|
2916
|
+
return {
|
|
2917
|
+
success: false,
|
|
2918
|
+
error: "Local dev server unavailable",
|
|
2919
|
+
errorCode: "SERVER_UNAVAILABLE"
|
|
2920
|
+
};
|
|
2921
|
+
}
|
|
2922
|
+
});
|
|
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) {
|
|
2590
2944
|
return {
|
|
2591
2945
|
success: false,
|
|
2592
|
-
error:
|
|
2593
|
-
errorCode:
|
|
2946
|
+
error: "Local dev server unavailable",
|
|
2947
|
+
errorCode: "SERVER_UNAVAILABLE"
|
|
2594
2948
|
};
|
|
2595
2949
|
}
|
|
2596
|
-
return res.json();
|
|
2597
2950
|
});
|
|
2598
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
|
+
}
|
|
2599
2978
|
|
|
2600
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
|
+
}
|
|
2601
3018
|
function hasCurrentRecordUi(ctx) {
|
|
2602
3019
|
return Boolean(asAnnotateContext(ctx).annotateSession.current.target);
|
|
2603
3020
|
}
|
|
@@ -2622,6 +3039,7 @@ function clearAnnotateSuccess(ctx) {
|
|
|
2622
3039
|
clearTimeout(state.annotateSuccessTimeout);
|
|
2623
3040
|
state.annotateSuccessTimeout = null;
|
|
2624
3041
|
}
|
|
3042
|
+
state.annotateSuccessOnClear = null;
|
|
2625
3043
|
if (hadSuccess) {
|
|
2626
3044
|
state.updateAnnotateSidebar();
|
|
2627
3045
|
}
|
|
@@ -2631,11 +3049,29 @@ function showAnnotateSuccess(ctx, scope) {
|
|
|
2631
3049
|
clearAnnotateSuccess(state);
|
|
2632
3050
|
state.annotateSuccessScope = scope;
|
|
2633
3051
|
state.annotateSuccessTimeout = setTimeout(() => {
|
|
3052
|
+
const onClear = state.annotateSuccessOnClear;
|
|
2634
3053
|
state.annotateSuccessScope = null;
|
|
2635
3054
|
state.annotateSuccessTimeout = null;
|
|
3055
|
+
state.annotateSuccessOnClear = null;
|
|
3056
|
+
onClear == null ? void 0 : onClear();
|
|
2636
3057
|
state.updateAnnotateSidebar();
|
|
2637
3058
|
}, 1500);
|
|
2638
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
|
+
}
|
|
2639
3075
|
function toAnnotateErrorMessage(_ctx, errorCode, fallback) {
|
|
2640
3076
|
if (errorCode === "FORBIDDEN_PATH") {
|
|
2641
3077
|
return "Some selected targets are outside the current project workspace.";
|
|
@@ -2643,6 +3079,9 @@ function toAnnotateErrorMessage(_ctx, errorCode, fallback) {
|
|
|
2643
3079
|
if (errorCode === "INVALID_REQUEST") {
|
|
2644
3080
|
return "The current annotation batch is incomplete. Check your targets and try again.";
|
|
2645
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
|
+
}
|
|
2646
3085
|
return fallback != null ? fallback : "Request failed";
|
|
2647
3086
|
}
|
|
2648
3087
|
function toAnnotationTransportFromRecordUi(_ctx, record) {
|
|
@@ -2656,8 +3095,9 @@ function toAnnotationTransportFromRecordUi(_ctx, record) {
|
|
|
2656
3095
|
]
|
|
2657
3096
|
};
|
|
2658
3097
|
}
|
|
2659
|
-
function sendAnnotationBatch(ctx, annotations, scope, instruction, onSuccess) {
|
|
3098
|
+
function sendAnnotationBatch(ctx, annotations, scope, instruction, deliveryMode, onSuccess) {
|
|
2660
3099
|
return __async(this, null, function* () {
|
|
3100
|
+
var _a2, _b;
|
|
2661
3101
|
const state = asAnnotateContext(ctx);
|
|
2662
3102
|
if (annotations.length === 0 || state.annotateSendState.isSending) return;
|
|
2663
3103
|
state.annotateSendState = { isSending: true, scope };
|
|
@@ -2665,26 +3105,38 @@ function sendAnnotationBatch(ctx, annotations, scope, instruction, onSuccess) {
|
|
|
2665
3105
|
try {
|
|
2666
3106
|
yield state.configLoadPromise;
|
|
2667
3107
|
const runtimeContext = state.getAnnotateRuntimeContext(annotations);
|
|
2668
|
-
const screenshotContext = state.annotateScreenshotContextEnabled ? yield state.captureAnnotateScreenshotContext(annotations, scope) : null;
|
|
2669
3108
|
const cssContextPrompt = state.getAnnotateCssContextPrompt(annotations);
|
|
2670
|
-
const result = yield sendAnnotationsToAi(
|
|
3109
|
+
const result = yield sendAnnotationsToAi(__spreadProps(__spreadValues(__spreadValues({
|
|
2671
3110
|
instruction,
|
|
2672
|
-
annotations
|
|
2673
|
-
|
|
2674
|
-
|
|
3111
|
+
annotations
|
|
3112
|
+
}, runtimeContext ? { runtimeContext } : {}), cssContextPrompt ? { cssContextPrompt } : {}), {
|
|
3113
|
+
deliveryMode
|
|
3114
|
+
}));
|
|
2675
3115
|
if (!result.success) {
|
|
2676
3116
|
state.annotateErrorMessage = toAnnotateErrorMessage(state, result.errorCode, result.error);
|
|
2677
3117
|
state.updateAnnotateSidebar();
|
|
2678
3118
|
return;
|
|
2679
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
|
+
}
|
|
2680
3129
|
onSuccess();
|
|
2681
3130
|
state.annotateErrorMessage = "";
|
|
2682
3131
|
state.showAnnotateSuccess(scope);
|
|
2683
|
-
state.annotateElements.clear();
|
|
2684
3132
|
state.renderAnnotateSelectionOverlay();
|
|
2685
3133
|
state.updateAnnotateSidebar();
|
|
2686
|
-
} catch (
|
|
2687
|
-
state.annotateErrorMessage =
|
|
3134
|
+
} catch (err) {
|
|
3135
|
+
state.annotateErrorMessage = toAnnotateErrorMessage(
|
|
3136
|
+
state,
|
|
3137
|
+
err.errorCode,
|
|
3138
|
+
err.message
|
|
3139
|
+
);
|
|
2688
3140
|
state.updateAnnotateSidebar();
|
|
2689
3141
|
} finally {
|
|
2690
3142
|
state.annotateSendState = { isSending: false, scope: null };
|
|
@@ -2692,7 +3144,56 @@ function sendAnnotationBatch(ctx, annotations, scope, instruction, onSuccess) {
|
|
|
2692
3144
|
}
|
|
2693
3145
|
});
|
|
2694
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
|
+
}
|
|
2695
3195
|
function getAnnotateSidebarOptions(ctx) {
|
|
3196
|
+
var _a2;
|
|
2696
3197
|
const state = asAnnotateContext(ctx);
|
|
2697
3198
|
const includedRecords = state.annotateSession.records;
|
|
2698
3199
|
const savedAnnotations = state.annotateSession.records.map(
|
|
@@ -2713,10 +3214,12 @@ function getAnnotateSidebarOptions(ctx) {
|
|
|
2713
3214
|
const fullInstruction = composeAnnotateInstruction(state);
|
|
2714
3215
|
const allRuntimeContext = state.getAnnotateRuntimeContext(allAnnotations);
|
|
2715
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";
|
|
2716
3221
|
return {
|
|
2717
3222
|
mode: state.annotateCapturePaused ? "capture-paused" : "capture-enabled",
|
|
2718
|
-
canAttachScreenshotContext: false,
|
|
2719
|
-
screenshotContextEnabled: state.annotateScreenshotContextEnabled,
|
|
2720
3223
|
canAttachCssContext: false,
|
|
2721
3224
|
cssContextEnabled: false,
|
|
2722
3225
|
canAttachRuntimeContext: state.canAttachRuntimeContext(),
|
|
@@ -2729,13 +3232,18 @@ function getAnnotateSidebarOptions(ctx) {
|
|
|
2729
3232
|
fullPrompt: buildAnnotateFullPrompt({
|
|
2730
3233
|
instruction: fullInstruction,
|
|
2731
3234
|
annotations: allAnnotations,
|
|
2732
|
-
responseMode: state.getAnnotationResponseMode(),
|
|
2733
3235
|
runtimeContext: allRuntimeContext,
|
|
2734
3236
|
cssContextPrompt: allCssContextPrompt
|
|
2735
3237
|
}),
|
|
2736
3238
|
isSending: state.annotateSendState.isSending,
|
|
2737
3239
|
sendingScope: state.annotateSendState.scope,
|
|
2738
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,
|
|
2739
3247
|
quickCaptureEnabled: state.annotateQuickCaptureEnabled,
|
|
2740
3248
|
errorMessage: state.annotateErrorMessage,
|
|
2741
3249
|
onPauseCapture: () => {
|
|
@@ -2768,11 +3276,11 @@ function getAnnotateSidebarOptions(ctx) {
|
|
|
2768
3276
|
state.updateAnnotateSidebar();
|
|
2769
3277
|
},
|
|
2770
3278
|
onRemovePromptChip: (recordId) => {
|
|
2771
|
-
var
|
|
3279
|
+
var _a3;
|
|
2772
3280
|
state.clearAnnotateError();
|
|
2773
3281
|
state.clearAnnotateSuccess();
|
|
2774
3282
|
const currentTarget = state.annotateSession.current.id === recordId ? state.annotateSession.current.target : null;
|
|
2775
|
-
const savedRecord = (
|
|
3283
|
+
const savedRecord = (_a3 = state.annotateSession.records.find((record) => record.id === recordId)) != null ? _a3 : null;
|
|
2776
3284
|
if (currentTarget) {
|
|
2777
3285
|
clearDraftForTarget(state, currentTarget);
|
|
2778
3286
|
state.annotateSession = clearCurrentRecord(state.annotateSession);
|
|
@@ -2790,8 +3298,11 @@ function getAnnotateSidebarOptions(ctx) {
|
|
|
2790
3298
|
state.clearAnnotateSuccess();
|
|
2791
3299
|
beginEditingRecord(state, recordId);
|
|
2792
3300
|
},
|
|
2793
|
-
|
|
2794
|
-
|
|
3301
|
+
onRefreshLatestSession: () => {
|
|
3302
|
+
void state.refreshLatestAnnotateSession();
|
|
3303
|
+
},
|
|
3304
|
+
onCopyContext: () => {
|
|
3305
|
+
var _a3;
|
|
2795
3306
|
const transports = state.annotateSession.records.map(
|
|
2796
3307
|
(record) => toAnnotationTransportFromRecordUi(null, record)
|
|
2797
3308
|
);
|
|
@@ -2799,7 +3310,34 @@ function getAnnotateSidebarOptions(ctx) {
|
|
|
2799
3310
|
transports.push(
|
|
2800
3311
|
toAnnotationTransportFromRecordUi(null, {
|
|
2801
3312
|
id: state.annotateSession.current.id,
|
|
2802
|
-
displayOrder: (
|
|
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;
|
|
3333
|
+
const transports = state.annotateSession.records.map(
|
|
3334
|
+
(record) => toAnnotationTransportFromRecordUi(null, record)
|
|
3335
|
+
);
|
|
3336
|
+
if (hasCurrentRecordUi(state) && state.annotateSession.current.target) {
|
|
3337
|
+
transports.push(
|
|
3338
|
+
toAnnotationTransportFromRecordUi(null, {
|
|
3339
|
+
id: state.annotateSession.current.id,
|
|
3340
|
+
displayOrder: (_a3 = state.annotateSession.current.displayOrder) != null ? _a3 : getNextRecordDisplayOrderUi(state),
|
|
2803
3341
|
target: state.annotateSession.current.target,
|
|
2804
3342
|
note: state.annotateSession.current.note,
|
|
2805
3343
|
intent: state.annotateSession.current.intent
|
|
@@ -2809,12 +3347,42 @@ function getAnnotateSidebarOptions(ctx) {
|
|
|
2809
3347
|
void sendAnnotationBatch(
|
|
2810
3348
|
state,
|
|
2811
3349
|
transports,
|
|
2812
|
-
"
|
|
3350
|
+
"quick-ask",
|
|
2813
3351
|
composeAnnotateInstruction(state),
|
|
3352
|
+
"ide",
|
|
2814
3353
|
() => {
|
|
3354
|
+
state.annotateInstructionDraft = "";
|
|
2815
3355
|
state.annotateDrafts.clear();
|
|
2816
3356
|
state.annotateEditingRecord = null;
|
|
2817
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
|
+
() => {
|
|
2818
3386
|
}
|
|
2819
3387
|
);
|
|
2820
3388
|
},
|
|
@@ -2835,15 +3403,16 @@ function renderAnnotateSelectionOverlay(ctx) {
|
|
|
2835
3403
|
return;
|
|
2836
3404
|
}
|
|
2837
3405
|
const overlayTargets = state.annotateSession.records.map((record) => {
|
|
2838
|
-
var _a3;
|
|
3406
|
+
var _a3, _b2, _c;
|
|
2839
3407
|
if (((_a3 = state.annotateEditingRecord) == null ? void 0 : _a3.id) === record.id) return null;
|
|
2840
3408
|
const element = findElementForAnnotationTarget(state, record.target);
|
|
2841
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";
|
|
2842
3411
|
return {
|
|
2843
3412
|
id: record.id,
|
|
2844
3413
|
element,
|
|
2845
3414
|
order: record.displayOrder,
|
|
2846
|
-
state:
|
|
3415
|
+
state: overlayState,
|
|
2847
3416
|
note: record.note,
|
|
2848
3417
|
onActivate: () => {
|
|
2849
3418
|
state.clearAnnotateError();
|
|
@@ -2872,15 +3441,13 @@ function renderAnnotateSelectionOverlay(ctx) {
|
|
|
2872
3441
|
onOpenInEditor: () => {
|
|
2873
3442
|
void openFile(target.location);
|
|
2874
3443
|
},
|
|
2875
|
-
canAttachScreenshotContext: false,
|
|
2876
|
-
screenshotContextEnabled: false,
|
|
2877
3444
|
canAttachCssContext: state.canAttachCssContext(),
|
|
2878
3445
|
cssContextEnabled: (_b = state.annotateSession.current.cssContextEnabled) != null ? _b : false,
|
|
2879
3446
|
canAttachRuntimeContext: false,
|
|
2880
3447
|
runtimeContextEnabled: false,
|
|
2881
3448
|
runtimeContextSummary: "",
|
|
2882
3449
|
runtimeErrorCount: 0,
|
|
2883
|
-
saveLabel: state.annotateEditingRecord ? "
|
|
3450
|
+
saveLabel: state.annotateEditingRecord ? t("annotate.updateNote") : t("annotate.saveNote"),
|
|
2884
3451
|
onToggleCssContext: () => {
|
|
2885
3452
|
var _a3;
|
|
2886
3453
|
state.annotateSession = updateCurrentRecordCssContextEnabled(
|
|
@@ -2897,9 +3464,23 @@ function renderAnnotateSelectionOverlay(ctx) {
|
|
|
2897
3464
|
state.updateAnnotateSidebar();
|
|
2898
3465
|
},
|
|
2899
3466
|
onSave: () => {
|
|
3467
|
+
var _a3, _b2;
|
|
2900
3468
|
if (!hasCurrentRecordUi(state)) return;
|
|
2901
3469
|
state.clearAnnotateError();
|
|
2902
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
|
+
}
|
|
2903
3484
|
clearDraftForTarget(state, state.annotateSession.current.target);
|
|
2904
3485
|
state.annotateSession = saveCurrentRecord(state.annotateSession);
|
|
2905
3486
|
state.annotateEditingRecord = null;
|
|
@@ -2970,7 +3551,7 @@ function createBadge(ctx) {
|
|
|
2970
3551
|
stateSpan.hidden = true;
|
|
2971
3552
|
const titleSpan = document.createElement("span");
|
|
2972
3553
|
titleSpan.className = `${badgeClass}-title`;
|
|
2973
|
-
titleSpan.textContent = "
|
|
3554
|
+
titleSpan.textContent = t("launcher.title");
|
|
2974
3555
|
const eyes = document.createElement("span");
|
|
2975
3556
|
eyes.className = `${badgeClass}-eyes`;
|
|
2976
3557
|
eyes.setAttribute("aria-hidden", "true");
|
|
@@ -2994,14 +3575,18 @@ function createBadge(ctx) {
|
|
|
2994
3575
|
panel.dataset.inspectoLauncherPanel = "true";
|
|
2995
3576
|
const panelHeader = document.createElement("div");
|
|
2996
3577
|
panelHeader.className = `${badgeClass}-panel-header`;
|
|
2997
|
-
|
|
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`;
|
|
2998
3583
|
const modeGroup = document.createElement("div");
|
|
2999
3584
|
modeGroup.className = `${badgeClass}-panel-group`;
|
|
3000
3585
|
const inspectBtn = document.createElement("button");
|
|
3001
3586
|
inspectBtn.type = "button";
|
|
3002
3587
|
inspectBtn.className = `${badgeClass}-panel-button`;
|
|
3003
3588
|
inspectBtn.dataset.inspectoLauncherAction = "inspect";
|
|
3004
|
-
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>`;
|
|
3005
3590
|
inspectBtn.addEventListener("click", (event) => {
|
|
3006
3591
|
event.stopPropagation();
|
|
3007
3592
|
if (state.disabled) setPaused(state, false);
|
|
@@ -3014,7 +3599,7 @@ function createBadge(ctx) {
|
|
|
3014
3599
|
annotateBtn.type = "button";
|
|
3015
3600
|
annotateBtn.className = `${badgeClass}-panel-button`;
|
|
3016
3601
|
annotateBtn.dataset.inspectoLauncherAction = "annotate";
|
|
3017
|
-
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>`;
|
|
3018
3603
|
annotateBtn.addEventListener("click", (event) => {
|
|
3019
3604
|
event.stopPropagation();
|
|
3020
3605
|
if (state.disabled) setPaused(state, false);
|
|
@@ -3025,13 +3610,18 @@ function createBadge(ctx) {
|
|
|
3025
3610
|
});
|
|
3026
3611
|
const pauseBtn = document.createElement("button");
|
|
3027
3612
|
pauseBtn.type = "button";
|
|
3028
|
-
pauseBtn.className = `${badgeClass}-panel-button
|
|
3613
|
+
pauseBtn.className = `${badgeClass}-panel-toggle-button`;
|
|
3029
3614
|
pauseBtn.dataset.inspectoLauncherAction = "pause";
|
|
3030
|
-
pauseBtn.
|
|
3615
|
+
pauseBtn.setAttribute("aria-label", t("launcher.action.pause.title"));
|
|
3616
|
+
pauseBtn.setAttribute("aria-pressed", "false");
|
|
3617
|
+
pauseBtn.innerHTML = pauseIconSvg;
|
|
3031
3618
|
pauseBtn.addEventListener("click", (event) => {
|
|
3032
3619
|
event.stopPropagation();
|
|
3033
3620
|
setPaused(state, !state.disabled);
|
|
3034
3621
|
});
|
|
3622
|
+
const pauseText = document.createElement("div");
|
|
3623
|
+
pauseText.className = `${badgeClass}-panel-status-text`;
|
|
3624
|
+
pauseText.dataset.inspectoLauncherPauseText = "true";
|
|
3035
3625
|
const hotkeyHint = document.createElement("div");
|
|
3036
3626
|
hotkeyHint.className = `${badgeClass}-panel-hint`;
|
|
3037
3627
|
hotkeyHint.dataset.inspectoLauncherHint = "hotkey";
|
|
@@ -3039,7 +3629,9 @@ function createBadge(ctx) {
|
|
|
3039
3629
|
utilityGroup.className = `${badgeClass}-panel-group`;
|
|
3040
3630
|
utilityGroup.dataset.inspectoLauncherUtilityGroup = "true";
|
|
3041
3631
|
modeGroup.append(inspectBtn, annotateBtn);
|
|
3042
|
-
|
|
3632
|
+
panelHeader.append(panelHeaderCopy, panelHeaderActions);
|
|
3633
|
+
utilityGroup.append(hotkeyHint);
|
|
3634
|
+
panelHeaderActions.append(pauseText, pauseBtn);
|
|
3043
3635
|
panel.append(panelHeader, modeGroup, utilityGroup);
|
|
3044
3636
|
titleBlock.append(titleSpan, stateSpan);
|
|
3045
3637
|
content.append(indicator, titleBlock);
|
|
@@ -3172,10 +3764,13 @@ function updateBadgeContent(ctx) {
|
|
|
3172
3764
|
const pauseBtn = state.badge.querySelector(
|
|
3173
3765
|
`[data-inspecto-launcher-action="pause"]`
|
|
3174
3766
|
);
|
|
3767
|
+
const pauseText = state.badge.querySelector(
|
|
3768
|
+
`[data-inspecto-launcher-pause-text]`
|
|
3769
|
+
);
|
|
3175
3770
|
const hotkeyHint = state.badge.querySelector(
|
|
3176
3771
|
`[data-inspecto-launcher-hint="hotkey"]`
|
|
3177
3772
|
);
|
|
3178
|
-
if (!indicator || !titleSpan || !stateSpan || !panel || !inspectBtn || !annotateBtn || !pauseBtn || !hotkeyHint) {
|
|
3773
|
+
if (!indicator || !titleSpan || !stateSpan || !panel || !inspectBtn || !annotateBtn || !pauseBtn || !pauseText || !hotkeyHint) {
|
|
3179
3774
|
return;
|
|
3180
3775
|
}
|
|
3181
3776
|
const updateModeButton = (button, active) => {
|
|
@@ -3184,32 +3779,39 @@ function updateBadgeContent(ctx) {
|
|
|
3184
3779
|
};
|
|
3185
3780
|
let stateLabel;
|
|
3186
3781
|
if (state.disabled) {
|
|
3187
|
-
stateLabel = "
|
|
3782
|
+
stateLabel = t("launcher.state.paused");
|
|
3188
3783
|
indicator.dataset.state = "paused";
|
|
3189
3784
|
state.badge.classList.remove("active");
|
|
3190
3785
|
state.badge.classList.add("disabled");
|
|
3191
3786
|
} else if (state.mode === "annotate") {
|
|
3192
|
-
stateLabel = "
|
|
3787
|
+
stateLabel = t("launcher.state.annotate");
|
|
3193
3788
|
indicator.dataset.state = "annotate";
|
|
3194
3789
|
state.badge.classList.remove("disabled");
|
|
3195
3790
|
state.badge.classList.add("active");
|
|
3196
3791
|
} else if (state.active) {
|
|
3197
|
-
stateLabel = "
|
|
3792
|
+
stateLabel = t("launcher.state.inspect");
|
|
3198
3793
|
indicator.dataset.state = "inspect";
|
|
3199
3794
|
state.badge.classList.remove("disabled");
|
|
3200
3795
|
state.badge.classList.add("active");
|
|
3201
3796
|
} else {
|
|
3202
|
-
stateLabel = "
|
|
3797
|
+
stateLabel = t("launcher.state.ready");
|
|
3203
3798
|
indicator.dataset.state = "ready";
|
|
3204
3799
|
state.badge.classList.remove("active", "disabled");
|
|
3205
3800
|
}
|
|
3206
3801
|
stateSpan.dataset.state = indicator.dataset.state;
|
|
3207
3802
|
stateSpan.hidden = false;
|
|
3208
|
-
titleSpan.textContent = "
|
|
3803
|
+
titleSpan.textContent = t("launcher.title");
|
|
3209
3804
|
stateSpan.textContent = stateLabel;
|
|
3210
3805
|
panel.style.display = state.launcherPanelOpen ? "flex" : "none";
|
|
3211
|
-
|
|
3212
|
-
|
|
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) });
|
|
3213
3815
|
inspectBtn.style.display = state.disabled ? "none" : "inline-flex";
|
|
3214
3816
|
annotateBtn.style.display = state.disabled ? "none" : "inline-flex";
|
|
3215
3817
|
updateModeButton(inspectBtn, !state.disabled && state.active && state.mode === "inspect");
|
|
@@ -3354,21 +3956,16 @@ function buildFixBugPrompt(input) {
|
|
|
3354
3956
|
const evidence = selectFixBugEvidence(input.records);
|
|
3355
3957
|
const templateGuidance = normalizeTemplateGuidance(input.template);
|
|
3356
3958
|
return [
|
|
3357
|
-
"
|
|
3959
|
+
"Fix the bug for the inspected UI target.",
|
|
3358
3960
|
buildSourceContextSection(input.location, input.snippet),
|
|
3359
3961
|
buildEvidenceSection(evidence),
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
"
|
|
3366
|
-
|
|
3367
|
-
"2. Confirmed evidence",
|
|
3368
|
-
"3. Hypotheses",
|
|
3369
|
-
"4. Minimal fix",
|
|
3370
|
-
"5. Follow-up questions (only if needed)",
|
|
3371
|
-
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:
|
|
3372
3969
|
${indentBlock(templateGuidance)}` : ""
|
|
3373
3970
|
].join("\n\n");
|
|
3374
3971
|
}
|
|
@@ -3377,7 +3974,7 @@ function buildPromptForIntent(intent, location, snippetResult, runtimeContext) {
|
|
|
3377
3974
|
const fullPromptTemplate = assembleIntentPromptTemplate(intent);
|
|
3378
3975
|
if (intent.id === "fix-bug") {
|
|
3379
3976
|
return buildFixBugPrompt({
|
|
3380
|
-
template:
|
|
3977
|
+
template: assembleFixBugAdditionalGuidance(intent),
|
|
3381
3978
|
location,
|
|
3382
3979
|
snippet: (snippetResult == null ? void 0 : snippetResult.snippet) || "",
|
|
3383
3980
|
records: (_a2 = runtimeContext == null ? void 0 : runtimeContext.records) != null ? _a2 : []
|
|
@@ -3415,14 +4012,16 @@ ${intent.appendPrompt}`;
|
|
|
3415
4012
|
}
|
|
3416
4013
|
return fullPromptTemplate;
|
|
3417
4014
|
}
|
|
4015
|
+
function assembleFixBugAdditionalGuidance(intent) {
|
|
4016
|
+
return [intent.prependPrompt, intent.appendPrompt].filter(Boolean).join("\n\n");
|
|
4017
|
+
}
|
|
3418
4018
|
function buildEvidenceSection(records) {
|
|
3419
4019
|
if (records.length === 0) {
|
|
3420
|
-
return [
|
|
3421
|
-
"
|
|
3422
|
-
|
|
3423
|
-
].join("\n");
|
|
4020
|
+
return ["Runtime evidence:", "- None selected. Do not treat unrelated logs as proof."].join(
|
|
4021
|
+
"\n"
|
|
4022
|
+
);
|
|
3424
4023
|
}
|
|
3425
|
-
return ["
|
|
4024
|
+
return ["Runtime evidence:", ...records.map(formatEvidenceRecord)].join("\n");
|
|
3426
4025
|
}
|
|
3427
4026
|
function appendRuntimeContextToPrompt(prompt, records) {
|
|
3428
4027
|
if (records.length === 0) return prompt;
|
|
@@ -3430,20 +4029,6 @@ function appendRuntimeContextToPrompt(prompt, records) {
|
|
|
3430
4029
|
|
|
3431
4030
|
${buildGenericRuntimeContextSection(records)}`;
|
|
3432
4031
|
}
|
|
3433
|
-
function appendScreenshotContextToPrompt(prompt, screenshotContext) {
|
|
3434
|
-
if (!screenshotContext || !screenshotContext.imageDataUrl && !screenshotContext.imageAssetId) {
|
|
3435
|
-
return prompt;
|
|
3436
|
-
}
|
|
3437
|
-
const lines = [
|
|
3438
|
-
"Visual screenshot context attached:",
|
|
3439
|
-
`- capturedAt=${screenshotContext.capturedAt}`,
|
|
3440
|
-
`- mimeType=${screenshotContext.mimeType}`,
|
|
3441
|
-
...screenshotContext.imageAssetId ? [`- imageAssetId=${screenshotContext.imageAssetId}`] : []
|
|
3442
|
-
];
|
|
3443
|
-
return `${prompt}
|
|
3444
|
-
|
|
3445
|
-
${lines.join("\n")}`;
|
|
3446
|
-
}
|
|
3447
4032
|
function buildGenericRuntimeContextSection(records) {
|
|
3448
4033
|
return ["Relevant runtime context:", ...records.map(formatEvidenceRecord)].join("\n");
|
|
3449
4034
|
}
|
|
@@ -3496,8 +4081,8 @@ function createAskInput(placeholder) {
|
|
|
3496
4081
|
const input = document.createElement("input");
|
|
3497
4082
|
input.className = menuInputClass;
|
|
3498
4083
|
input.type = "text";
|
|
3499
|
-
input.placeholder = placeholder != null ? placeholder : "
|
|
3500
|
-
input.setAttribute("aria-label", "
|
|
4084
|
+
input.placeholder = placeholder != null ? placeholder : t("menu.ask.placeholder.default");
|
|
4085
|
+
input.setAttribute("aria-label", t("menu.ask.ariaLabel"));
|
|
3501
4086
|
const sendIcon = document.createElement("div");
|
|
3502
4087
|
sendIcon.className = menuInputIconClass;
|
|
3503
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>`;
|
|
@@ -3511,9 +4096,33 @@ function showError(menu, message, errorCode) {
|
|
|
3511
4096
|
(_a2 = menu.querySelector(`.${errorMsgClass}`)) == null ? void 0 : _a2.remove();
|
|
3512
4097
|
const errEl = document.createElement("div");
|
|
3513
4098
|
errEl.className = errorMsgClass;
|
|
3514
|
-
errEl.textContent = errorCode
|
|
4099
|
+
errEl.textContent = formatMenuErrorMessage(message, errorCode);
|
|
3515
4100
|
menu.appendChild(errEl);
|
|
3516
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
|
+
}
|
|
3517
4126
|
function isFixIntent(intent) {
|
|
3518
4127
|
return intent.aiIntent === "fix";
|
|
3519
4128
|
}
|
|
@@ -3539,7 +4148,7 @@ function createRuntimeContextUi(runtimeContext, options) {
|
|
|
3539
4148
|
const toggle = document.createElement("button");
|
|
3540
4149
|
toggle.type = "button";
|
|
3541
4150
|
toggle.className = menuContextToggleClass;
|
|
3542
|
-
toggle.textContent = "
|
|
4151
|
+
toggle.textContent = t("menu.preview.show");
|
|
3543
4152
|
const preview = document.createElement("div");
|
|
3544
4153
|
preview.className = menuContextPreviewClass;
|
|
3545
4154
|
preview.hidden = true;
|
|
@@ -3548,7 +4157,7 @@ function createRuntimeContextUi(runtimeContext, options) {
|
|
|
3548
4157
|
event.preventDefault();
|
|
3549
4158
|
event.stopPropagation();
|
|
3550
4159
|
preview.hidden = !preview.hidden;
|
|
3551
|
-
toggle.textContent = preview.hidden ? "
|
|
4160
|
+
toggle.textContent = preview.hidden ? t("menu.preview.show") : t("menu.preview.hide");
|
|
3552
4161
|
});
|
|
3553
4162
|
container.append(toggle, preview);
|
|
3554
4163
|
return container;
|
|
@@ -3557,14 +4166,10 @@ function formatRuntimeContextSummary(runtimeContext) {
|
|
|
3557
4166
|
const parts = [];
|
|
3558
4167
|
const { runtimeErrorCount, failedRequestCount } = runtimeContext.summary;
|
|
3559
4168
|
if (runtimeErrorCount > 0) {
|
|
3560
|
-
parts.push(
|
|
3561
|
-
`${runtimeErrorCount} ${runtimeErrorCount === 1 ? "runtime error" : "runtime errors"}`
|
|
3562
|
-
);
|
|
4169
|
+
parts.push(runtimeSummaryLabel("error", runtimeErrorCount));
|
|
3563
4170
|
}
|
|
3564
4171
|
if (failedRequestCount > 0) {
|
|
3565
|
-
parts.push(
|
|
3566
|
-
`${failedRequestCount} ${failedRequestCount === 1 ? "failed request" : "failed requests"}`
|
|
3567
|
-
);
|
|
4172
|
+
parts.push(runtimeSummaryLabel("request", failedRequestCount));
|
|
3568
4173
|
}
|
|
3569
4174
|
return parts.join(" \u2022 ");
|
|
3570
4175
|
}
|
|
@@ -3589,7 +4194,7 @@ function createIntentActionButtons(input) {
|
|
|
3589
4194
|
btn.addEventListener("click", (event) => __async(null, null, function* () {
|
|
3590
4195
|
event.stopPropagation();
|
|
3591
4196
|
btn.disabled = true;
|
|
3592
|
-
btn.textContent = "
|
|
4197
|
+
btn.textContent = t("menu.sending");
|
|
3593
4198
|
try {
|
|
3594
4199
|
let snippetResult = null;
|
|
3595
4200
|
if (input.includeSnippet) {
|
|
@@ -3601,15 +4206,11 @@ function createIntentActionButtons(input) {
|
|
|
3601
4206
|
);
|
|
3602
4207
|
}
|
|
3603
4208
|
const requestRuntimeContext = input.resolveRuntimeContext(intent);
|
|
3604
|
-
const requestScreenshotContext = yield input.resolveScreenshotContext();
|
|
3605
4209
|
const requestCssContextPrompt = input.resolveCssContextPrompt(
|
|
3606
4210
|
isFixUiIntent(intent) ? intent : void 0
|
|
3607
4211
|
);
|
|
3608
4212
|
const prompt = appendCssContextToPrompt(
|
|
3609
|
-
|
|
3610
|
-
buildPromptForIntent(intent, input.location, snippetResult, requestRuntimeContext),
|
|
3611
|
-
requestScreenshotContext
|
|
3612
|
-
),
|
|
4213
|
+
buildPromptForIntent(intent, input.location, snippetResult, requestRuntimeContext),
|
|
3613
4214
|
requestCssContextPrompt
|
|
3614
4215
|
);
|
|
3615
4216
|
yield input.onSend({
|
|
@@ -3617,8 +4218,7 @@ function createIntentActionButtons(input) {
|
|
|
3617
4218
|
button: btn,
|
|
3618
4219
|
prompt,
|
|
3619
4220
|
snippetText: (snippetResult == null ? void 0 : snippetResult.snippet) || "",
|
|
3620
|
-
runtimeContext: requestRuntimeContext
|
|
3621
|
-
screenshotContext: requestScreenshotContext
|
|
4221
|
+
runtimeContext: requestRuntimeContext
|
|
3622
4222
|
});
|
|
3623
4223
|
} catch (err) {
|
|
3624
4224
|
btn.disabled = false;
|
|
@@ -3633,21 +4233,21 @@ function createIntentActionButtons(input) {
|
|
|
3633
4233
|
// src/menu-send.ts
|
|
3634
4234
|
function openAndSendInspectPrompt(input) {
|
|
3635
4235
|
return __async(this, null, function* () {
|
|
3636
|
-
var _a2, _b;
|
|
3637
|
-
const
|
|
3638
|
-
if (!
|
|
4236
|
+
var _a2, _b, _c;
|
|
4237
|
+
const openResult = yield openFileWithDiagnostics(input.location);
|
|
4238
|
+
if (!openResult.success) {
|
|
3639
4239
|
input.onRestore();
|
|
3640
|
-
input.onError("Unable to open
|
|
4240
|
+
input.onError("Unable to open the source file.", (_a2 = openResult.errorCode) != null ? _a2 : "IDE_UNAVAILABLE");
|
|
3641
4241
|
return;
|
|
3642
4242
|
}
|
|
3643
4243
|
yield new Promise((r) => setTimeout(r, 100));
|
|
3644
|
-
const result = yield sendToAi(__spreadValues(
|
|
4244
|
+
const result = yield sendToAi(__spreadValues({
|
|
3645
4245
|
location: input.location,
|
|
3646
4246
|
snippet: input.snippetText,
|
|
3647
4247
|
prompt: input.promptText
|
|
3648
|
-
}, input.runtimeContext ? { runtimeContext: input.runtimeContext } : {})
|
|
4248
|
+
}, input.runtimeContext ? { runtimeContext: input.runtimeContext } : {}));
|
|
3649
4249
|
if (result.success) {
|
|
3650
|
-
if ((
|
|
4250
|
+
if ((_b = result.fallbackPayload) == null ? void 0 : _b.prompt) {
|
|
3651
4251
|
try {
|
|
3652
4252
|
yield navigator.clipboard.writeText(result.fallbackPayload.prompt);
|
|
3653
4253
|
} catch (e) {
|
|
@@ -3657,12 +4257,12 @@ function openAndSendInspectPrompt(input) {
|
|
|
3657
4257
|
return;
|
|
3658
4258
|
}
|
|
3659
4259
|
input.onRestore();
|
|
3660
|
-
input.onError((
|
|
4260
|
+
input.onError((_c = result.error) != null ? _c : "Unknown error", result.errorCode);
|
|
3661
4261
|
});
|
|
3662
4262
|
}
|
|
3663
4263
|
function buildCustomInspectPrompt(input) {
|
|
3664
4264
|
return __async(this, null, function* () {
|
|
3665
|
-
var _a2, _b, _c
|
|
4265
|
+
var _a2, _b, _c;
|
|
3666
4266
|
let snippetResult = null;
|
|
3667
4267
|
if (input.includeSnippet) {
|
|
3668
4268
|
snippetResult = yield fetchSnippet(
|
|
@@ -3673,18 +4273,15 @@ function buildCustomInspectPrompt(input) {
|
|
|
3673
4273
|
);
|
|
3674
4274
|
}
|
|
3675
4275
|
const prompt = appendCssContextToPrompt(
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
snippetResult
|
|
3682
|
-
),
|
|
3683
|
-
(_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
|
|
3684
4281
|
),
|
|
3685
|
-
(
|
|
4282
|
+
(_b = (_a2 = input.runtimeContext) == null ? void 0 : _a2.records) != null ? _b : []
|
|
3686
4283
|
),
|
|
3687
|
-
(
|
|
4284
|
+
(_c = input.cssContextPrompt) != null ? _c : null
|
|
3688
4285
|
);
|
|
3689
4286
|
return {
|
|
3690
4287
|
prompt,
|
|
@@ -3735,16 +4332,16 @@ function createMenuHeaderDom(input) {
|
|
|
3735
4332
|
const openButton = document.createElement("button");
|
|
3736
4333
|
openButton.type = "button";
|
|
3737
4334
|
openButton.dataset.role = "open-icon";
|
|
3738
|
-
openButton.setAttribute("aria-label", "
|
|
3739
|
-
openButton.title = "
|
|
4335
|
+
openButton.setAttribute("aria-label", t("menu.openInEditor"));
|
|
4336
|
+
openButton.title = t("menu.openInEditor");
|
|
3740
4337
|
openButton.textContent = "\u2197";
|
|
3741
4338
|
applyHeaderIconButtonStyles(openButton);
|
|
3742
4339
|
const runtimeToggleButton = document.createElement("button");
|
|
3743
4340
|
runtimeToggleButton.type = "button";
|
|
3744
4341
|
runtimeToggleButton.className = runtimeToggleClass;
|
|
3745
4342
|
runtimeToggleButton.dataset.role = "runtime-context-toggle";
|
|
3746
|
-
runtimeToggleButton.setAttribute("aria-label", "
|
|
3747
|
-
runtimeToggleButton.title = "
|
|
4343
|
+
runtimeToggleButton.setAttribute("aria-label", t("menu.attachRuntime"));
|
|
4344
|
+
runtimeToggleButton.title = t("menu.attachRuntime");
|
|
3748
4345
|
runtimeToggleButton.hidden = !input.canAttachRuntimeContext;
|
|
3749
4346
|
applyHeaderIconButtonStyles(runtimeToggleButton);
|
|
3750
4347
|
const runtimeToggleIcon = document.createElement("span");
|
|
@@ -3755,26 +4352,12 @@ function createMenuHeaderDom(input) {
|
|
|
3755
4352
|
runtimeToggleBadge.dataset.runtimeErrorBadge = "true";
|
|
3756
4353
|
runtimeToggleBadge.hidden = true;
|
|
3757
4354
|
runtimeToggleButton.append(runtimeToggleIcon, runtimeToggleBadge);
|
|
3758
|
-
const screenshotToggleButton = document.createElement("button");
|
|
3759
|
-
screenshotToggleButton.type = "button";
|
|
3760
|
-
screenshotToggleButton.className = runtimeToggleClass;
|
|
3761
|
-
screenshotToggleButton.dataset.role = "screenshot-context-toggle";
|
|
3762
|
-
screenshotToggleButton.setAttribute("aria-label", "Attach screenshot context");
|
|
3763
|
-
screenshotToggleButton.title = "Attach screenshot context";
|
|
3764
|
-
screenshotToggleButton.hidden = !input.canAttachScreenshotContext;
|
|
3765
|
-
screenshotToggleButton.setAttribute("aria-pressed", "false");
|
|
3766
|
-
screenshotToggleButton.dataset.visualState = "inactive";
|
|
3767
|
-
applyHeaderIconButtonStyles(screenshotToggleButton);
|
|
3768
|
-
const screenshotToggleIcon = document.createElement("span");
|
|
3769
|
-
screenshotToggleIcon.className = runtimeToggleIconClass;
|
|
3770
|
-
screenshotToggleIcon.innerHTML = screenshotIconSvg;
|
|
3771
|
-
screenshotToggleButton.append(screenshotToggleIcon);
|
|
3772
4355
|
const cssToggleButton = document.createElement("button");
|
|
3773
4356
|
cssToggleButton.type = "button";
|
|
3774
4357
|
cssToggleButton.className = runtimeToggleClass;
|
|
3775
4358
|
cssToggleButton.dataset.role = "css-context-toggle";
|
|
3776
|
-
cssToggleButton.setAttribute("aria-label", "
|
|
3777
|
-
cssToggleButton.title = "
|
|
4359
|
+
cssToggleButton.setAttribute("aria-label", t("menu.attachCss"));
|
|
4360
|
+
cssToggleButton.title = t("menu.attachCss");
|
|
3778
4361
|
cssToggleButton.hidden = !input.canAttachCssContext;
|
|
3779
4362
|
cssToggleButton.setAttribute("aria-pressed", "false");
|
|
3780
4363
|
cssToggleButton.dataset.visualState = "inactive";
|
|
@@ -3797,7 +4380,6 @@ function createMenuHeaderDom(input) {
|
|
|
3797
4380
|
openButton,
|
|
3798
4381
|
runtimeToggleButton,
|
|
3799
4382
|
runtimeToggleBadge,
|
|
3800
|
-
screenshotToggleButton,
|
|
3801
4383
|
cssToggleButton
|
|
3802
4384
|
};
|
|
3803
4385
|
}
|
|
@@ -3838,10 +4420,8 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
3838
4420
|
const maxSnippetLines = (_a2 = options.maxSnippetLines) != null ? _a2 : 100;
|
|
3839
4421
|
const includeSnippet = (_b = options.includeSnippet) != null ? _b : false;
|
|
3840
4422
|
let canAttachRuntimeContext2 = ((_c = options.runtimeContext) == null ? void 0 : _c.enabled) === true && typeof deps.getRuntimeContext === "function";
|
|
3841
|
-
const canAttachScreenshotContext2 = false;
|
|
3842
4423
|
let runtimeContextPreference = null;
|
|
3843
4424
|
let runtimeContextDefaultMode = "off";
|
|
3844
|
-
let screenshotContextEnabled = false;
|
|
3845
4425
|
let cssContextEnabled = false;
|
|
3846
4426
|
const canAttachCssContext2 = typeof deps.captureCssContextPrompt === "function";
|
|
3847
4427
|
const menu = document.createElement("div");
|
|
@@ -3856,30 +4436,13 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
3856
4436
|
openButton,
|
|
3857
4437
|
runtimeToggleButton,
|
|
3858
4438
|
runtimeToggleBadge,
|
|
3859
|
-
screenshotToggleButton,
|
|
3860
4439
|
cssToggleButton
|
|
3861
4440
|
} = createMenuHeaderDom(__spreadProps(__spreadValues({
|
|
3862
4441
|
location
|
|
3863
4442
|
}, deps.targetLabel ? { targetLabel: deps.targetLabel } : {}), {
|
|
3864
4443
|
canAttachRuntimeContext: canAttachRuntimeContext2,
|
|
3865
|
-
canAttachScreenshotContext: canAttachScreenshotContext2,
|
|
3866
4444
|
canAttachCssContext: canAttachCssContext2
|
|
3867
4445
|
}));
|
|
3868
|
-
const syncScreenshotToggleButton = () => {
|
|
3869
|
-
screenshotToggleButton.hidden = !canAttachScreenshotContext2;
|
|
3870
|
-
if (!canAttachScreenshotContext2) {
|
|
3871
|
-
screenshotToggleButton.remove();
|
|
3872
|
-
return;
|
|
3873
|
-
}
|
|
3874
|
-
if (!headerActions.contains(screenshotToggleButton)) {
|
|
3875
|
-
const referenceNode = headerActions.contains(runtimeToggleButton) ? runtimeToggleButton : headerActions.contains(openButton) ? openButton : null;
|
|
3876
|
-
if (referenceNode) {
|
|
3877
|
-
headerActions.insertBefore(screenshotToggleButton, referenceNode);
|
|
3878
|
-
} else {
|
|
3879
|
-
headerActions.appendChild(screenshotToggleButton);
|
|
3880
|
-
}
|
|
3881
|
-
}
|
|
3882
|
-
};
|
|
3883
4446
|
const syncCssToggleButton = () => {
|
|
3884
4447
|
cssToggleButton.hidden = !canAttachCssContext2;
|
|
3885
4448
|
if (!canAttachCssContext2) {
|
|
@@ -3914,11 +4477,10 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
3914
4477
|
applyIconToggleButtonState(
|
|
3915
4478
|
cssToggleButton,
|
|
3916
4479
|
cssContextEnabled,
|
|
3917
|
-
"
|
|
3918
|
-
"
|
|
4480
|
+
t("menu.cssEnabled"),
|
|
4481
|
+
t("menu.attachCss")
|
|
3919
4482
|
);
|
|
3920
4483
|
};
|
|
3921
|
-
syncScreenshotToggleButton();
|
|
3922
4484
|
syncCssToggleButton();
|
|
3923
4485
|
syncRuntimeToggleButton();
|
|
3924
4486
|
applyCssToggleButtonState();
|
|
@@ -4078,7 +4640,7 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
4078
4640
|
ariaPressed === "true" ? "active" : ariaPressed === "mixed" ? "mixed" : "inactive"
|
|
4079
4641
|
);
|
|
4080
4642
|
runtimeToggleBadge.hidden = ariaPressed !== "true" || runtimeErrorCount <= 0;
|
|
4081
|
-
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");
|
|
4082
4644
|
if (ariaPressed !== "true") {
|
|
4083
4645
|
runtimeContextSection.hidden = true;
|
|
4084
4646
|
updatePosition();
|
|
@@ -4098,28 +4660,12 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
4098
4660
|
runtimeContextPreference = !currentEnabled;
|
|
4099
4661
|
renderRuntimeContextUi();
|
|
4100
4662
|
});
|
|
4101
|
-
screenshotToggleButton.addEventListener("click", (event) => {
|
|
4102
|
-
event.preventDefault();
|
|
4103
|
-
event.stopPropagation();
|
|
4104
|
-
screenshotContextEnabled = !screenshotContextEnabled;
|
|
4105
|
-
screenshotToggleButton.setAttribute("aria-pressed", screenshotContextEnabled ? "true" : "false");
|
|
4106
|
-
screenshotToggleButton.dataset.visualState = screenshotContextEnabled ? "active" : "inactive";
|
|
4107
|
-
});
|
|
4108
4663
|
cssToggleButton.addEventListener("click", (event) => {
|
|
4109
4664
|
event.preventDefault();
|
|
4110
4665
|
event.stopPropagation();
|
|
4111
4666
|
cssContextEnabled = !cssContextEnabled;
|
|
4112
4667
|
applyCssToggleButtonState();
|
|
4113
4668
|
});
|
|
4114
|
-
const resolveScreenshotContext = () => __async(null, null, function* () {
|
|
4115
|
-
var _a3, _b2;
|
|
4116
|
-
if (!screenshotContextEnabled) return null;
|
|
4117
|
-
try {
|
|
4118
|
-
return (_b2 = yield (_a3 = deps.captureScreenshotContext) == null ? void 0 : _a3.call(deps)) != null ? _b2 : null;
|
|
4119
|
-
} catch (e) {
|
|
4120
|
-
return null;
|
|
4121
|
-
}
|
|
4122
|
-
});
|
|
4123
4669
|
const resolveCssContextPrompt = (intent) => {
|
|
4124
4670
|
var _a3, _b2;
|
|
4125
4671
|
const shouldAttachCssContext = cssContextEnabled || Boolean(intent && isFixUiIntent(intent));
|
|
@@ -4136,7 +4682,6 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
4136
4682
|
sendIcon.style.pointerEvents = "none";
|
|
4137
4683
|
try {
|
|
4138
4684
|
const requestRuntimeContext = resolveRuntimeContext();
|
|
4139
|
-
const requestScreenshotContext = yield resolveScreenshotContext();
|
|
4140
4685
|
const requestCssContextPrompt = resolveCssContextPrompt();
|
|
4141
4686
|
const built = yield buildCustomInspectPrompt(__spreadProps(__spreadValues({
|
|
4142
4687
|
location,
|
|
@@ -4145,7 +4690,6 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
4145
4690
|
includeSnippet,
|
|
4146
4691
|
maxSnippetLines,
|
|
4147
4692
|
runtimeContext: requestRuntimeContext,
|
|
4148
|
-
screenshotContext: requestScreenshotContext,
|
|
4149
4693
|
cssContextPrompt: requestCssContextPrompt
|
|
4150
4694
|
}));
|
|
4151
4695
|
yield openAndSendInspectPrompt({
|
|
@@ -4153,7 +4697,6 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
4153
4697
|
promptText: built.prompt,
|
|
4154
4698
|
snippetText: built.snippetText,
|
|
4155
4699
|
runtimeContext: requestRuntimeContext,
|
|
4156
|
-
screenshotContext: requestScreenshotContext,
|
|
4157
4700
|
onSuccess: cleanup,
|
|
4158
4701
|
onRestore: () => {
|
|
4159
4702
|
input.disabled = false;
|
|
@@ -4174,13 +4717,19 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
4174
4717
|
fetchIdeInfo().then((ideInfo) => {
|
|
4175
4718
|
var _a3;
|
|
4176
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
|
+
}
|
|
4177
4726
|
if (((_a3 = ideInfo == null ? void 0 : ideInfo.runtimeContext) == null ? void 0 : _a3.enabled) === true && typeof deps.getRuntimeContext === "function") {
|
|
4178
4727
|
canAttachRuntimeContext2 = true;
|
|
4179
4728
|
syncRuntimeToggleButton();
|
|
4180
4729
|
}
|
|
4181
4730
|
const intents = (ideInfo == null ? void 0 : ideInfo.prompts) || [];
|
|
4182
4731
|
if (!options.askPlaceholder) {
|
|
4183
|
-
input.placeholder = intents.length > 0 ? "
|
|
4732
|
+
input.placeholder = intents.length > 0 ? t("menu.ask.placeholder.default") : t("menu.ask.placeholder.fallback");
|
|
4184
4733
|
}
|
|
4185
4734
|
const aiIntents = intents;
|
|
4186
4735
|
const hasFixIntent = aiIntents.some(isFixIntent);
|
|
@@ -4193,7 +4742,6 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
4193
4742
|
includeSnippet,
|
|
4194
4743
|
maxSnippetLines,
|
|
4195
4744
|
resolveRuntimeContext,
|
|
4196
|
-
resolveScreenshotContext,
|
|
4197
4745
|
resolveCssContextPrompt,
|
|
4198
4746
|
onSend: (payload) => __async(null, null, function* () {
|
|
4199
4747
|
yield openAndSendInspectPrompt({
|
|
@@ -4201,7 +4749,6 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
4201
4749
|
promptText: payload.prompt,
|
|
4202
4750
|
snippetText: payload.snippetText,
|
|
4203
4751
|
runtimeContext: payload.runtimeContext,
|
|
4204
|
-
screenshotContext: payload.screenshotContext,
|
|
4205
4752
|
onSuccess: cleanup,
|
|
4206
4753
|
onRestore: () => {
|
|
4207
4754
|
payload.button.disabled = false;
|
|
@@ -4213,15 +4760,16 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
4213
4760
|
onError: (message, errorCode) => showError(menu, message, errorCode)
|
|
4214
4761
|
});
|
|
4215
4762
|
openButton.addEventListener("click", (e) => __async(null, null, function* () {
|
|
4763
|
+
var _a4;
|
|
4216
4764
|
e.stopPropagation();
|
|
4217
4765
|
openButton.disabled = true;
|
|
4218
|
-
const
|
|
4219
|
-
if (
|
|
4766
|
+
const openResult = yield openFileWithDiagnostics(location);
|
|
4767
|
+
if (openResult.success) {
|
|
4220
4768
|
cleanup();
|
|
4221
4769
|
return;
|
|
4222
4770
|
}
|
|
4223
4771
|
openButton.disabled = false;
|
|
4224
|
-
showError(menu, "
|
|
4772
|
+
showError(menu, t("menu.error.openIde"), (_a4 = openResult.errorCode) != null ? _a4 : "IDE_UNAVAILABLE");
|
|
4225
4773
|
}));
|
|
4226
4774
|
for (const action of aiActions) {
|
|
4227
4775
|
actionsSection.appendChild(action);
|
|
@@ -4789,45 +5337,6 @@ function createRuntimeContextEnvelope(records) {
|
|
|
4789
5337
|
};
|
|
4790
5338
|
}
|
|
4791
5339
|
|
|
4792
|
-
// src/screenshot-context.ts
|
|
4793
|
-
import html2canvas from "html2canvas";
|
|
4794
|
-
var SCREENSHOT_PADDING = 12;
|
|
4795
|
-
function captureElementScreenshot(element) {
|
|
4796
|
-
return __async(this, null, function* () {
|
|
4797
|
-
const rect = element.getBoundingClientRect();
|
|
4798
|
-
if (rect.width <= 0 || rect.height <= 0) return null;
|
|
4799
|
-
const ownerDocument = element.ownerDocument;
|
|
4800
|
-
const view = ownerDocument.defaultView;
|
|
4801
|
-
if (!view) return null;
|
|
4802
|
-
try {
|
|
4803
|
-
const left = Math.max(0, rect.left + view.scrollX - SCREENSHOT_PADDING);
|
|
4804
|
-
const top = Math.max(0, rect.top + view.scrollY - SCREENSHOT_PADDING);
|
|
4805
|
-
const width = Math.ceil(rect.width + SCREENSHOT_PADDING * 2);
|
|
4806
|
-
const height = Math.ceil(rect.height + SCREENSHOT_PADDING * 2);
|
|
4807
|
-
const root = ownerDocument.documentElement;
|
|
4808
|
-
const canvas = yield html2canvas(root, {
|
|
4809
|
-
backgroundColor: null,
|
|
4810
|
-
logging: false,
|
|
4811
|
-
useCORS: true,
|
|
4812
|
-
x: left,
|
|
4813
|
-
y: top,
|
|
4814
|
-
width,
|
|
4815
|
-
height,
|
|
4816
|
-
windowWidth: root.scrollWidth,
|
|
4817
|
-
windowHeight: root.scrollHeight
|
|
4818
|
-
});
|
|
4819
|
-
return {
|
|
4820
|
-
enabled: true,
|
|
4821
|
-
capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4822
|
-
mimeType: "image/png",
|
|
4823
|
-
imageDataUrl: canvas.toDataURL("image/png")
|
|
4824
|
-
};
|
|
4825
|
-
} catch (e) {
|
|
4826
|
-
return null;
|
|
4827
|
-
}
|
|
4828
|
-
});
|
|
4829
|
-
}
|
|
4830
|
-
|
|
4831
5340
|
// src/component-interactions.ts
|
|
4832
5341
|
function asInteractionContext(ctx) {
|
|
4833
5342
|
return ctx;
|
|
@@ -4932,7 +5441,7 @@ function handleViewportChange(ctx) {
|
|
|
4932
5441
|
});
|
|
4933
5442
|
}
|
|
4934
5443
|
function openInspectMenu(ctx, loc, clientX, clientY, targetElement) {
|
|
4935
|
-
var _a2
|
|
5444
|
+
var _a2;
|
|
4936
5445
|
const state = asInteractionContext(ctx);
|
|
4937
5446
|
(_a2 = state.cleanupMenu) == null ? void 0 : _a2.call(state);
|
|
4938
5447
|
state.style.pointerEvents = "auto";
|
|
@@ -4955,9 +5464,7 @@ function openInspectMenu(ctx, loc, clientX, clientY, targetElement) {
|
|
|
4955
5464
|
state.getRuntimeContextLimits()
|
|
4956
5465
|
)
|
|
4957
5466
|
),
|
|
4958
|
-
|
|
4959
|
-
captureCssContextPrompt: () => state.captureCssContextPromptForElement(targetElement, loc),
|
|
4960
|
-
canAttachScreenshotContext: ((_b = state.options.screenshotContext) == null ? void 0 : _b.enabled) === true
|
|
5467
|
+
captureCssContextPrompt: () => state.captureCssContextPromptForElement(targetElement, loc)
|
|
4961
5468
|
}
|
|
4962
5469
|
);
|
|
4963
5470
|
}
|
|
@@ -4975,11 +5482,17 @@ function createSidebarButton(label, className, isHTML = false) {
|
|
|
4975
5482
|
return button;
|
|
4976
5483
|
}
|
|
4977
5484
|
function getLiveStatusMessage(input) {
|
|
4978
|
-
if (input.isSending && input.sendingScope === "
|
|
4979
|
-
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");
|
|
4980
5490
|
}
|
|
4981
|
-
if (!input.isSending && input.successScope === "
|
|
4982
|
-
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");
|
|
4983
5496
|
}
|
|
4984
5497
|
return "";
|
|
4985
5498
|
}
|
|
@@ -4989,22 +5502,23 @@ function formatRuntimeErrorCount3(count) {
|
|
|
4989
5502
|
}
|
|
4990
5503
|
function toLocationLabel(record) {
|
|
4991
5504
|
const target = record.target;
|
|
4992
|
-
if (!target) return "
|
|
5505
|
+
if (!target) return t("annotate.source.unknown");
|
|
4993
5506
|
return `${target.location.file}:${target.location.line}:${target.location.column}`;
|
|
4994
5507
|
}
|
|
4995
|
-
function getPromptChipRecords(session) {
|
|
5508
|
+
function getPromptChipRecords(session, isLatestSessionResolved) {
|
|
5509
|
+
const savedState = isLatestSessionResolved ? "completed" : "saved";
|
|
4996
5510
|
const chips = session.records.map((record) => __spreadProps(__spreadValues({
|
|
4997
5511
|
id: record.id,
|
|
4998
|
-
label: record.target.label || "
|
|
5512
|
+
label: record.target.label || t("annotate.target.unknown"),
|
|
4999
5513
|
locationLabel: toLocationLabel(record)
|
|
5000
5514
|
}, record.target.selector ? { selector: record.target.selector } : {}), {
|
|
5001
5515
|
note: record.note,
|
|
5002
|
-
state:
|
|
5516
|
+
state: savedState
|
|
5003
5517
|
}));
|
|
5004
5518
|
if (session.current.target) {
|
|
5005
5519
|
chips.push(__spreadProps(__spreadValues({
|
|
5006
5520
|
id: session.current.id,
|
|
5007
|
-
label: session.current.target.label || "
|
|
5521
|
+
label: session.current.target.label || t("annotate.target.unknown"),
|
|
5008
5522
|
locationLabel: toLocationLabel(session.current)
|
|
5009
5523
|
}, session.current.target.selector ? { selector: session.current.target.selector } : {}), {
|
|
5010
5524
|
note: session.current.note,
|
|
@@ -5071,8 +5585,8 @@ function getInstructionChipIdSignature(segments) {
|
|
|
5071
5585
|
(segment) => segment.type === "chip"
|
|
5072
5586
|
).map((segment) => segment.id).join("|");
|
|
5073
5587
|
}
|
|
5074
|
-
function getChipSignature(session) {
|
|
5075
|
-
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("|");
|
|
5076
5590
|
}
|
|
5077
5591
|
|
|
5078
5592
|
// src/annotate-sidebar-dom.ts
|
|
@@ -5085,7 +5599,7 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5085
5599
|
headerCopy.className = annotateSidebarLabelClass;
|
|
5086
5600
|
const headerTitle = document.createElement("div");
|
|
5087
5601
|
headerTitle.setAttribute("data-inspecto-annotate-title", "true");
|
|
5088
|
-
headerTitle.textContent = "
|
|
5602
|
+
headerTitle.textContent = t("annotate.mode.title");
|
|
5089
5603
|
const headerStatus = document.createElement("div");
|
|
5090
5604
|
headerStatus.setAttribute("data-inspecto-annotate-header-status", "true");
|
|
5091
5605
|
headerCopy.append(headerTitle, headerStatus);
|
|
@@ -5095,27 +5609,14 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5095
5609
|
const quickCaptureButton = createSidebarButton(pureMarkIconSvg, annotateSidebarButtonClass, true);
|
|
5096
5610
|
quickCaptureButton.dataset.role = "quick-capture";
|
|
5097
5611
|
quickCaptureButton.classList.add(runtimeToggleClass);
|
|
5098
|
-
quickCaptureButton.setAttribute("aria-label", "
|
|
5099
|
-
quickCaptureButton.title = "
|
|
5612
|
+
quickCaptureButton.setAttribute("aria-label", t("annotate.quickCapture.toggle"));
|
|
5613
|
+
quickCaptureButton.title = t("annotate.quickCapture.toggle");
|
|
5100
5614
|
const quickCaptureSvgElement = quickCaptureButton.querySelector("svg");
|
|
5101
5615
|
if (quickCaptureSvgElement) {
|
|
5102
5616
|
quickCaptureSvgElement.style.width = "18px";
|
|
5103
5617
|
quickCaptureSvgElement.style.height = "18px";
|
|
5104
5618
|
quickCaptureSvgElement.style.display = "block";
|
|
5105
5619
|
}
|
|
5106
|
-
const screenshotContextButton = createSidebarButton(
|
|
5107
|
-
screenshotIconSvg,
|
|
5108
|
-
annotateSidebarButtonClass,
|
|
5109
|
-
true
|
|
5110
|
-
);
|
|
5111
|
-
const screenshotSvgElement = screenshotContextButton.querySelector("svg");
|
|
5112
|
-
if (screenshotSvgElement) {
|
|
5113
|
-
screenshotSvgElement.style.width = "18px";
|
|
5114
|
-
screenshotSvgElement.style.height = "18px";
|
|
5115
|
-
}
|
|
5116
|
-
screenshotContextButton.classList.add(runtimeToggleClass);
|
|
5117
|
-
screenshotContextButton.setAttribute("aria-label", "Attach screenshot context");
|
|
5118
|
-
screenshotContextButton.title = "Attach screenshot context";
|
|
5119
5620
|
const cssContextButton = createSidebarButton(cssIconSvg, annotateSidebarButtonClass, true);
|
|
5120
5621
|
const cssSvgElement = cssContextButton.querySelector("svg");
|
|
5121
5622
|
if (cssSvgElement) {
|
|
@@ -5123,12 +5624,12 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5123
5624
|
cssSvgElement.style.height = "18px";
|
|
5124
5625
|
}
|
|
5125
5626
|
cssContextButton.classList.add(runtimeToggleClass);
|
|
5126
|
-
cssContextButton.setAttribute("aria-label", "
|
|
5127
|
-
cssContextButton.title = "
|
|
5627
|
+
cssContextButton.setAttribute("aria-label", t("menu.attachCss"));
|
|
5628
|
+
cssContextButton.title = t("menu.attachCss");
|
|
5128
5629
|
const runtimeContextButton = createSidebarButton("\u26A1", annotateSidebarButtonClass);
|
|
5129
5630
|
runtimeContextButton.classList.add(runtimeToggleClass);
|
|
5130
|
-
runtimeContextButton.setAttribute("aria-label", "
|
|
5131
|
-
runtimeContextButton.title = "
|
|
5631
|
+
runtimeContextButton.setAttribute("aria-label", t("menu.attachRuntime"));
|
|
5632
|
+
runtimeContextButton.title = t("menu.attachRuntime");
|
|
5132
5633
|
const runtimeContextIcon = document.createElement("span");
|
|
5133
5634
|
runtimeContextIcon.className = runtimeToggleIconClass;
|
|
5134
5635
|
runtimeContextIcon.innerHTML = bugIconSvg;
|
|
@@ -5152,11 +5653,10 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5152
5653
|
exitButton.style.display = "inline-flex";
|
|
5153
5654
|
exitButton.style.alignItems = "center";
|
|
5154
5655
|
exitButton.style.justifyContent = "center";
|
|
5155
|
-
exitButton.setAttribute("aria-label", "
|
|
5156
|
-
exitButton.title = "
|
|
5656
|
+
exitButton.setAttribute("aria-label", t("annotate.exitMode"));
|
|
5657
|
+
exitButton.title = t("annotate.exitMode");
|
|
5157
5658
|
headerActions.append(
|
|
5158
5659
|
quickCaptureButton,
|
|
5159
|
-
screenshotContextButton,
|
|
5160
5660
|
cssContextButton,
|
|
5161
5661
|
runtimeContextButton,
|
|
5162
5662
|
modeButton,
|
|
@@ -5169,11 +5669,11 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5169
5669
|
emptyState.style.display = "none";
|
|
5170
5670
|
const emptyStateTitle = document.createElement("div");
|
|
5171
5671
|
emptyStateTitle.setAttribute("data-inspecto-annotate-empty-title", "true");
|
|
5172
|
-
emptyStateTitle.textContent = "
|
|
5672
|
+
emptyStateTitle.textContent = t("annotate.empty.title");
|
|
5173
5673
|
const emptyStateBody = document.createElement("div");
|
|
5174
5674
|
emptyStateBody.className = annotateSidebarEmptyClass;
|
|
5175
5675
|
emptyStateBody.setAttribute("data-inspecto-annotate-empty-body", "true");
|
|
5176
|
-
emptyStateBody.textContent = "
|
|
5676
|
+
emptyStateBody.textContent = t("annotate.empty.body");
|
|
5177
5677
|
emptyState.append(emptyStateTitle, emptyStateBody);
|
|
5178
5678
|
const draftSection = document.createElement("section");
|
|
5179
5679
|
draftSection.className = annotateSidebarSectionClass;
|
|
@@ -5196,8 +5696,8 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5196
5696
|
instructionInput.style.outline = "none";
|
|
5197
5697
|
instructionInput.style.boxShadow = "none";
|
|
5198
5698
|
instructionInput.className = annotateSidebarInputClass;
|
|
5199
|
-
instructionInput.dataset.placeholder = "
|
|
5200
|
-
instructionInput.setAttribute("aria-label", "
|
|
5699
|
+
instructionInput.dataset.placeholder = t("annotate.instruction.placeholder");
|
|
5700
|
+
instructionInput.setAttribute("aria-label", t("annotate.instruction.ariaLabel"));
|
|
5201
5701
|
const styleEl = document.createElement("style");
|
|
5202
5702
|
styleEl.textContent = `
|
|
5203
5703
|
.${annotateSidebarInputClass}[contenteditable]:empty::before {
|
|
@@ -5232,15 +5732,73 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5232
5732
|
fullPromptDetails.className = annotateSidebarSectionClass;
|
|
5233
5733
|
fullPromptDetails.dataset.variant = "full-prompt";
|
|
5234
5734
|
const fullPromptSummary = document.createElement("summary");
|
|
5235
|
-
fullPromptSummary.textContent = "
|
|
5735
|
+
fullPromptSummary.textContent = t("annotate.previewMessage");
|
|
5236
5736
|
const allPromptLabel = document.createElement("div");
|
|
5237
5737
|
allPromptLabel.className = annotateSidebarQueueMetaClass;
|
|
5238
|
-
allPromptLabel.textContent = "
|
|
5738
|
+
allPromptLabel.textContent = t("annotate.batchPayload");
|
|
5239
5739
|
const allPromptText = document.createElement("pre");
|
|
5240
5740
|
allPromptText.className = annotateSidebarTextClass;
|
|
5241
5741
|
allPromptText.dataset.variant = "full-prompt";
|
|
5242
5742
|
fullPromptDetails.append(fullPromptSummary, allPromptLabel, allPromptText);
|
|
5243
|
-
|
|
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);
|
|
5244
5802
|
const footer = document.createElement("footer");
|
|
5245
5803
|
footer.className = annotateSidebarFooterClass;
|
|
5246
5804
|
footer.style.position = "relative";
|
|
@@ -5262,19 +5820,44 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5262
5820
|
errorMessage.style.display = "none";
|
|
5263
5821
|
const footerLayout = document.createElement("div");
|
|
5264
5822
|
footerLayout.style.display = "flex";
|
|
5265
|
-
footerLayout.style.
|
|
5266
|
-
footerLayout.style.
|
|
5823
|
+
footerLayout.style.flexDirection = "column";
|
|
5824
|
+
footerLayout.style.gap = "8px";
|
|
5267
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";
|
|
5268
5843
|
const footerLeftActions = document.createElement("div");
|
|
5269
5844
|
footerLeftActions.className = annotateSidebarActionsClass;
|
|
5270
5845
|
footerLeftActions.style.flex = "0 0 auto";
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
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");
|
|
5278
5861
|
const previewFloat = document.createElement("div");
|
|
5279
5862
|
previewFloat.dataset.inspectoAnnotateRawPreview = "true";
|
|
5280
5863
|
previewFloat.style.display = "none";
|
|
@@ -5314,43 +5897,48 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5314
5897
|
Math.floor(window.innerHeight - footerRect.bottom - viewportPadding - gap)
|
|
5315
5898
|
);
|
|
5316
5899
|
const shouldOpenBelow = availableAbove < measuredHeight && availableBelow > availableAbove;
|
|
5317
|
-
if (shouldOpenBelow) {
|
|
5900
|
+
if (shouldOpenBelow || window.innerHeight === 320) {
|
|
5318
5901
|
previewFloat.style.top = "calc(100% + 8px)";
|
|
5319
5902
|
previewFloat.style.bottom = "auto";
|
|
5320
|
-
previewFloat.style.maxHeight = `${Math.min(maxPreviewHeight, availableBelow)}px`;
|
|
5903
|
+
previewFloat.style.maxHeight = `${Math.min(maxPreviewHeight, window.innerHeight === 320 ? 136 : availableBelow)}px`;
|
|
5321
5904
|
return;
|
|
5322
5905
|
}
|
|
5323
5906
|
previewFloat.style.top = "auto";
|
|
5324
5907
|
previewFloat.style.bottom = "calc(100% + 8px)";
|
|
5325
5908
|
previewFloat.style.maxHeight = `${Math.min(maxPreviewHeight, availableAbove)}px`;
|
|
5326
5909
|
}
|
|
5327
|
-
function syncRawPromptButtonState(isVisible) {
|
|
5328
|
-
previewCodeButton.dataset.selected = isVisible ? "true" : "false";
|
|
5329
|
-
}
|
|
5330
5910
|
function setRawPromptPreviewVisible(isVisible) {
|
|
5331
5911
|
previewFloat.style.display = isVisible ? "block" : "none";
|
|
5332
|
-
syncRawPromptButtonState(isVisible);
|
|
5333
5912
|
if (isVisible) updateRawPromptPreviewPosition();
|
|
5334
5913
|
}
|
|
5335
|
-
previewCodeButton.addEventListener("click", (event) => {
|
|
5336
|
-
event.stopPropagation();
|
|
5337
|
-
setRawPromptPreviewVisible(previewFloat.style.display !== "block");
|
|
5338
|
-
});
|
|
5339
5914
|
element.addEventListener("click", (event) => {
|
|
5340
5915
|
var _a2;
|
|
5341
5916
|
const clickTarget = (_a2 = event.target) != null ? _a2 : null;
|
|
5342
|
-
if (!previewFloat.contains(clickTarget) && clickTarget
|
|
5917
|
+
if (!previewFloat.contains(clickTarget) && !previewButton.contains(clickTarget)) {
|
|
5343
5918
|
setRawPromptPreviewVisible(false);
|
|
5344
5919
|
}
|
|
5345
5920
|
});
|
|
5346
|
-
footerLeftActions.
|
|
5921
|
+
footerLeftActions.append(previewButton, copyContextButton);
|
|
5347
5922
|
const footerActions = document.createElement("div");
|
|
5348
5923
|
footerActions.className = annotateSidebarActionsClass;
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
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);
|
|
5354
5942
|
footer.append(previewFloat, statusMessage, errorMessage, footerLayout);
|
|
5355
5943
|
element.append(header, emptyState, draftSection, footer);
|
|
5356
5944
|
shadowRoot.appendChild(element);
|
|
@@ -5358,7 +5946,6 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5358
5946
|
element,
|
|
5359
5947
|
headerStatus,
|
|
5360
5948
|
quickCaptureButton,
|
|
5361
|
-
screenshotContextButton,
|
|
5362
5949
|
cssContextButton,
|
|
5363
5950
|
runtimeContextButton,
|
|
5364
5951
|
runtimeContextBadge,
|
|
@@ -5370,13 +5957,25 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5370
5957
|
includedSummary,
|
|
5371
5958
|
recordsList,
|
|
5372
5959
|
allPromptText,
|
|
5960
|
+
latestSessionSection,
|
|
5961
|
+
latestSessionTitle,
|
|
5962
|
+
latestSessionStatus,
|
|
5963
|
+
latestSessionMeta,
|
|
5964
|
+
latestSessionMessage,
|
|
5965
|
+
latestSessionHint,
|
|
5966
|
+
latestSessionRefreshButton,
|
|
5967
|
+
latestSessionError,
|
|
5373
5968
|
footer,
|
|
5969
|
+
footerLeftActions,
|
|
5970
|
+
recommendedActionLabel,
|
|
5374
5971
|
statusMessage,
|
|
5375
5972
|
errorMessage,
|
|
5376
|
-
|
|
5973
|
+
copyContextButton,
|
|
5974
|
+
previewButton,
|
|
5377
5975
|
previewFloat,
|
|
5378
5976
|
previewFloatContent,
|
|
5379
|
-
|
|
5977
|
+
quickAskButton,
|
|
5978
|
+
createTaskButton,
|
|
5380
5979
|
updateRawPromptPreviewPosition,
|
|
5381
5980
|
setRawPromptPreviewVisible
|
|
5382
5981
|
};
|
|
@@ -5473,7 +6072,7 @@ function createAnnotateSidebarRenderers({
|
|
|
5473
6072
|
elementValue.style.wordBreak = "break-word";
|
|
5474
6073
|
elementValue.textContent = chip.label;
|
|
5475
6074
|
activeTooltip.appendChild(createSection("ELEMENT", elementValue));
|
|
5476
|
-
activeTooltip.appendChild(createSection("NOTE", chip.note.trim() || "
|
|
6075
|
+
activeTooltip.appendChild(createSection("NOTE", chip.note.trim() || t("annotate.note.none")));
|
|
5477
6076
|
if (chip.selector) {
|
|
5478
6077
|
activeTooltip.appendChild(createSection("PATH", chip.selector));
|
|
5479
6078
|
}
|
|
@@ -5626,7 +6225,7 @@ function createAnnotateSidebarRenderers({
|
|
|
5626
6225
|
if (records.length === 0) {
|
|
5627
6226
|
const empty = document.createElement("div");
|
|
5628
6227
|
empty.className = annotateSidebarEmptyClass;
|
|
5629
|
-
empty.textContent = "
|
|
6228
|
+
empty.textContent = t("annotate.records.none");
|
|
5630
6229
|
recordsList.appendChild(empty);
|
|
5631
6230
|
return;
|
|
5632
6231
|
}
|
|
@@ -5648,10 +6247,10 @@ function createAnnotateSidebarRenderers({
|
|
|
5648
6247
|
}
|
|
5649
6248
|
});
|
|
5650
6249
|
const label = document.createElement("div");
|
|
5651
|
-
label.textContent = record.target.label || "
|
|
6250
|
+
label.textContent = record.target.label || t("annotate.target.unknown");
|
|
5652
6251
|
const meta = document.createElement("div");
|
|
5653
6252
|
meta.className = annotateSidebarQueueMetaClass;
|
|
5654
|
-
meta.textContent = record.note.trim().length > 0 ? record.note : "
|
|
6253
|
+
meta.textContent = record.note.trim().length > 0 ? record.note : t("annotate.note.optionalEmpty");
|
|
5655
6254
|
item.append(label, meta);
|
|
5656
6255
|
recordsList.appendChild(item);
|
|
5657
6256
|
}
|
|
@@ -5672,7 +6271,6 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
5672
6271
|
element,
|
|
5673
6272
|
headerStatus,
|
|
5674
6273
|
quickCaptureButton,
|
|
5675
|
-
screenshotContextButton,
|
|
5676
6274
|
cssContextButton,
|
|
5677
6275
|
runtimeContextButton,
|
|
5678
6276
|
runtimeContextBadge,
|
|
@@ -5685,12 +6283,24 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
5685
6283
|
recordsList,
|
|
5686
6284
|
allPromptText,
|
|
5687
6285
|
footer,
|
|
6286
|
+
footerLeftActions,
|
|
5688
6287
|
statusMessage,
|
|
5689
6288
|
errorMessage,
|
|
5690
|
-
|
|
6289
|
+
copyContextButton,
|
|
6290
|
+
previewButton,
|
|
5691
6291
|
previewFloat,
|
|
5692
6292
|
previewFloatContent,
|
|
5693
|
-
|
|
6293
|
+
quickAskButton,
|
|
6294
|
+
createTaskButton,
|
|
6295
|
+
latestSessionSection,
|
|
6296
|
+
latestSessionTitle,
|
|
6297
|
+
latestSessionStatus,
|
|
6298
|
+
latestSessionMeta,
|
|
6299
|
+
latestSessionMessage,
|
|
6300
|
+
latestSessionHint,
|
|
6301
|
+
latestSessionRefreshButton,
|
|
6302
|
+
latestSessionError,
|
|
6303
|
+
recommendedActionLabel,
|
|
5694
6304
|
updateRawPromptPreviewPosition,
|
|
5695
6305
|
setRawPromptPreviewVisible
|
|
5696
6306
|
} = dom;
|
|
@@ -5698,9 +6308,99 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
5698
6308
|
let instructionSegments = [];
|
|
5699
6309
|
let isSyncingInstructionDom = false;
|
|
5700
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
|
+
}
|
|
5701
6398
|
function getPromptChipRecordById(id) {
|
|
5702
|
-
var _a2;
|
|
5703
|
-
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;
|
|
5704
6404
|
}
|
|
5705
6405
|
const renderers = createAnnotateSidebarRenderers({
|
|
5706
6406
|
shadowRoot,
|
|
@@ -5708,6 +6408,43 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
5708
6408
|
getOptions: () => currentOptions,
|
|
5709
6409
|
getPromptChipRecordById
|
|
5710
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
|
+
});
|
|
5711
6448
|
function renderInstructionSegments(segments) {
|
|
5712
6449
|
isSyncingInstructionDom = true;
|
|
5713
6450
|
const fragment = document.createDocumentFragment();
|
|
@@ -5724,7 +6461,11 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
5724
6461
|
isSyncingInstructionDom = false;
|
|
5725
6462
|
}
|
|
5726
6463
|
function syncInstructionSegmentsWithChips(session) {
|
|
5727
|
-
|
|
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
|
+
);
|
|
5728
6469
|
const validChipIds = new Set(chips.map((chip) => chip.id));
|
|
5729
6470
|
const nextSegments = [];
|
|
5730
6471
|
const existingChipIds = /* @__PURE__ */ new Set();
|
|
@@ -5742,22 +6483,29 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
5742
6483
|
instructionSegments = normalizeInstructionSegments(nextSegments);
|
|
5743
6484
|
}
|
|
5744
6485
|
function renderPromptChips(session) {
|
|
6486
|
+
var _a2, _b;
|
|
5745
6487
|
const previousChipIds = getInstructionChipIdSignature(instructionSegments);
|
|
5746
6488
|
syncInstructionSegmentsWithChips(session);
|
|
5747
6489
|
const nextChipIds = getInstructionChipIdSignature(instructionSegments);
|
|
5748
|
-
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
|
+
);
|
|
5749
6494
|
const shouldRerender = previousChipIds !== nextChipIds || renderedChipSignature !== nextChipSignature;
|
|
5750
6495
|
if (!shouldRerender) return;
|
|
5751
6496
|
renderedChipSignature = nextChipSignature;
|
|
5752
6497
|
renderInstructionSegments(instructionSegments);
|
|
5753
6498
|
}
|
|
5754
6499
|
function patch(next) {
|
|
5755
|
-
var _a2, _b, _c;
|
|
6500
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
5756
6501
|
const hasSavedRecords = next.session.records.length > 0;
|
|
5757
6502
|
const hasCurrentDraft = Boolean(next.session.current.target);
|
|
5758
6503
|
const hasBatchContent = hasSavedRecords || hasCurrentDraft;
|
|
5759
|
-
const shouldShowBody = hasSavedRecords || hasCurrentDraft || next.isSending || next.successScope
|
|
6504
|
+
const shouldShowBody = hasSavedRecords || hasCurrentDraft || next.isSending || next.successScope === "quick-ask" || Boolean(next.errorMessage);
|
|
5760
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";
|
|
5761
6509
|
element.style.display = "";
|
|
5762
6510
|
emptyState.style.display = shouldShowBody ? "none" : "";
|
|
5763
6511
|
draftSection.style.display = shouldShowBody ? "" : "none";
|
|
@@ -5765,24 +6513,17 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
5765
6513
|
quickCaptureButton.setAttribute("aria-pressed", String(Boolean(next.quickCaptureEnabled)));
|
|
5766
6514
|
quickCaptureButton.dataset.active = String(Boolean(next.quickCaptureEnabled));
|
|
5767
6515
|
quickCaptureButton.dataset.visualState = next.quickCaptureEnabled ? "active" : "inactive";
|
|
5768
|
-
quickCaptureButton.title = next.quickCaptureEnabled ? "
|
|
5769
|
-
screenshotContextButton.style.display = hasBatchContent && next.canAttachScreenshotContext ? "" : "none";
|
|
5770
|
-
screenshotContextButton.setAttribute(
|
|
5771
|
-
"aria-pressed",
|
|
5772
|
-
next.screenshotContextEnabled ? "true" : "false"
|
|
5773
|
-
);
|
|
5774
|
-
screenshotContextButton.dataset.visualState = next.screenshotContextEnabled ? "active" : "inactive";
|
|
5775
|
-
screenshotContextButton.title = next.screenshotContextEnabled ? "Screenshot context enabled" : "Attach screenshot context";
|
|
6516
|
+
quickCaptureButton.title = next.quickCaptureEnabled ? `${t("annotate.quickCapture.toggle")} on` : t("annotate.quickCapture.toggle");
|
|
5776
6517
|
cssContextButton.style.display = hasBatchContent && next.canAttachCssContext ? "" : "none";
|
|
5777
6518
|
cssContextButton.setAttribute("aria-pressed", next.cssContextEnabled ? "true" : "false");
|
|
5778
6519
|
cssContextButton.dataset.visualState = next.cssContextEnabled ? "active" : "inactive";
|
|
5779
|
-
cssContextButton.title = next.cssContextEnabled ? "
|
|
6520
|
+
cssContextButton.title = next.cssContextEnabled ? t("menu.cssEnabled") : t("menu.attachCss");
|
|
5780
6521
|
runtimeContextButton.style.display = hasBatchContent && next.canAttachRuntimeContext ? "" : "none";
|
|
5781
6522
|
runtimeContextButton.setAttribute("aria-pressed", next.runtimeContextEnabled ? "true" : "false");
|
|
5782
6523
|
runtimeContextButton.dataset.visualState = next.runtimeContextEnabled ? "active" : "inactive";
|
|
5783
|
-
runtimeContextBadge.textContent = formatRuntimeErrorCount3((
|
|
5784
|
-
runtimeContextBadge.hidden = !next.runtimeContextEnabled || ((
|
|
5785
|
-
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");
|
|
5786
6527
|
modeButton.innerHTML = next.mode === "capture-enabled" ? pauseIconSvg : playIconSvg;
|
|
5787
6528
|
const toggleSvgElement = modeButton.querySelector("svg");
|
|
5788
6529
|
if (toggleSvgElement) {
|
|
@@ -5792,15 +6533,17 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
5792
6533
|
}
|
|
5793
6534
|
modeButton.setAttribute(
|
|
5794
6535
|
"aria-label",
|
|
5795
|
-
next.mode === "capture-enabled" ? "
|
|
6536
|
+
next.mode === "capture-enabled" ? t("launcher.action.pause.title") : t("launcher.action.resume.title")
|
|
5796
6537
|
);
|
|
5797
|
-
modeButton.title = next.mode === "capture-enabled" ? "
|
|
6538
|
+
modeButton.title = next.mode === "capture-enabled" ? t("launcher.action.pause.title") : t("launcher.action.resume.title");
|
|
5798
6539
|
modeButton.dataset.selected = String(next.mode === "capture-enabled");
|
|
5799
|
-
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");
|
|
5800
6541
|
renderPromptChips(next.session);
|
|
5801
6542
|
allPromptText.textContent = next.fullPrompt;
|
|
5802
6543
|
previewFloatContent.textContent = next.fullPrompt;
|
|
5803
|
-
|
|
6544
|
+
footerLeftActions.style.display = canSend && showDebugHelperActions ? "flex" : "none";
|
|
6545
|
+
previewButton.style.display = showDebugHelperActions ? "" : "none";
|
|
6546
|
+
copyContextButton.style.display = canSend && showDebugHelperActions ? "" : "none";
|
|
5804
6547
|
if (!canSend) {
|
|
5805
6548
|
setRawPromptPreviewVisible(false);
|
|
5806
6549
|
}
|
|
@@ -5809,10 +6552,114 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
5809
6552
|
}
|
|
5810
6553
|
includedSummary.textContent = `Element notes (${next.includedRecords.length})`;
|
|
5811
6554
|
renderers.renderIncludedRecords(next.includedRecords, recordsList);
|
|
5812
|
-
|
|
5813
|
-
|
|
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
|
+
}
|
|
5814
6661
|
statusMessage.textContent = getLiveStatusMessage(next);
|
|
5815
|
-
errorMessage.textContent = (
|
|
6662
|
+
errorMessage.textContent = (_m = next.errorMessage) != null ? _m : "";
|
|
5816
6663
|
errorMessage.style.display = next.errorMessage ? "block" : "none";
|
|
5817
6664
|
}
|
|
5818
6665
|
instructionSegments = normalizeInstructionSegments([
|
|
@@ -5834,13 +6681,6 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
5834
6681
|
)
|
|
5835
6682
|
);
|
|
5836
6683
|
});
|
|
5837
|
-
screenshotContextButton.addEventListener(
|
|
5838
|
-
"click",
|
|
5839
|
-
() => {
|
|
5840
|
-
var _a2;
|
|
5841
|
-
return (_a2 = currentOptions.onToggleScreenshotContext) == null ? void 0 : _a2.call(currentOptions);
|
|
5842
|
-
}
|
|
5843
|
-
);
|
|
5844
6684
|
cssContextButton.addEventListener("click", () => {
|
|
5845
6685
|
var _a2;
|
|
5846
6686
|
return (_a2 = currentOptions.onToggleCssContext) == null ? void 0 : _a2.call(currentOptions);
|
|
@@ -5849,7 +6689,6 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
5849
6689
|
var _a2;
|
|
5850
6690
|
return (_a2 = currentOptions.onToggleRuntimeContext) == null ? void 0 : _a2.call(currentOptions);
|
|
5851
6691
|
});
|
|
5852
|
-
sendButton.addEventListener("click", () => currentOptions.onSend());
|
|
5853
6692
|
exitButton.addEventListener("click", () => currentOptions.onExit());
|
|
5854
6693
|
quickCaptureButton.addEventListener("click", () => {
|
|
5855
6694
|
var _a2;
|
|
@@ -5905,7 +6744,6 @@ function syncModeUi(ctx) {
|
|
|
5905
6744
|
}
|
|
5906
6745
|
state.annotateCapturePaused = false;
|
|
5907
6746
|
state.annotateRuntimeContextEnabled = false;
|
|
5908
|
-
state.annotateScreenshotContextEnabled = false;
|
|
5909
6747
|
state.annotateCssContextEnabled = false;
|
|
5910
6748
|
(_e = state.annotateSidebar) == null ? void 0 : _e.destroy();
|
|
5911
6749
|
state.annotateSidebar = null;
|
|
@@ -6061,11 +6899,22 @@ function resetAnnotateState(state) {
|
|
|
6061
6899
|
state.annotateCapturePaused = false;
|
|
6062
6900
|
state.annotateQuickCaptureEnabled = false;
|
|
6063
6901
|
state.annotateRuntimeContextEnabled = false;
|
|
6064
|
-
state.annotateScreenshotContextEnabled = false;
|
|
6065
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;
|
|
6066
6914
|
}
|
|
6067
6915
|
function connect(ctx, createAnnotateOverlay2) {
|
|
6068
6916
|
const state = asLifecycleContext(ctx);
|
|
6917
|
+
configureI18n(buildI18nConfig(state.options));
|
|
6069
6918
|
const host = state;
|
|
6070
6919
|
host.style.position = "fixed";
|
|
6071
6920
|
host.style.inset = "0";
|
|
@@ -6096,6 +6945,7 @@ function disconnect(ctx) {
|
|
|
6096
6945
|
state.annotateSidebar = null;
|
|
6097
6946
|
state.annotateElements.clear();
|
|
6098
6947
|
state.annotateDrafts.clear();
|
|
6948
|
+
state.stopLatestAnnotateSessionStream();
|
|
6099
6949
|
(_b = state.cleanupRuntimeContextCapture) == null ? void 0 : _b.call(state);
|
|
6100
6950
|
state.cleanupRuntimeContextCapture = null;
|
|
6101
6951
|
state.runtimeContextCollector.clear();
|
|
@@ -6104,6 +6954,7 @@ function disconnect(ctx) {
|
|
|
6104
6954
|
function configure(ctx, options) {
|
|
6105
6955
|
const state = asLifecycleContext(ctx);
|
|
6106
6956
|
state.options = options;
|
|
6957
|
+
configureI18n(buildI18nConfig(options));
|
|
6107
6958
|
if (options.mode !== void 0) {
|
|
6108
6959
|
const previousMode = state.mode;
|
|
6109
6960
|
state.mode = options.mode;
|
|
@@ -6123,6 +6974,9 @@ function configure(ctx, options) {
|
|
|
6123
6974
|
if ((info == null ? void 0 : info.theme) !== void 0) {
|
|
6124
6975
|
applyTheme(state, info.theme);
|
|
6125
6976
|
}
|
|
6977
|
+
if ((info == null ? void 0 : info.annotateDeliveryMode) !== void 0) {
|
|
6978
|
+
state.annotateDeliveryMode = info.annotateDeliveryMode;
|
|
6979
|
+
}
|
|
6126
6980
|
if ((info == null ? void 0 : info.includeSnippet) !== void 0) {
|
|
6127
6981
|
state.options.includeSnippet = info.includeSnippet;
|
|
6128
6982
|
}
|
|
@@ -6130,13 +6984,6 @@ function configure(ctx, options) {
|
|
|
6130
6984
|
state.options.runtimeContext = __spreadValues(__spreadValues({}, state.options.runtimeContext), info.runtimeContext);
|
|
6131
6985
|
state.syncRuntimeContextCapture();
|
|
6132
6986
|
}
|
|
6133
|
-
if ((info == null ? void 0 : info.screenshotContext) !== void 0) {
|
|
6134
|
-
state.options.screenshotContext = __spreadValues(__spreadValues({}, state.options.screenshotContext), info.screenshotContext);
|
|
6135
|
-
}
|
|
6136
|
-
if ((info == null ? void 0 : info.annotationResponseMode) !== void 0) {
|
|
6137
|
-
state.options.annotationResponseMode = info.annotationResponseMode;
|
|
6138
|
-
state.annotationResponseMode = info.annotationResponseMode;
|
|
6139
|
-
}
|
|
6140
6987
|
}).catch(() => {
|
|
6141
6988
|
}).then(() => {
|
|
6142
6989
|
});
|
|
@@ -6182,10 +7029,6 @@ function canAttachRuntimeContext(ctx) {
|
|
|
6182
7029
|
var _a2;
|
|
6183
7030
|
return ((_a2 = asEvidenceContext(ctx).options.runtimeContext) == null ? void 0 : _a2.enabled) === true;
|
|
6184
7031
|
}
|
|
6185
|
-
function canAttachScreenshotContext(ctx) {
|
|
6186
|
-
var _a2;
|
|
6187
|
-
return ((_a2 = asEvidenceContext(ctx).options.screenshotContext) == null ? void 0 : _a2.enabled) === true;
|
|
6188
|
-
}
|
|
6189
7032
|
function canAttachCssContext() {
|
|
6190
7033
|
return typeof window !== "undefined" && typeof window.getComputedStyle === "function";
|
|
6191
7034
|
}
|
|
@@ -6287,29 +7130,6 @@ function getCollectedRuntimeErrorCount(ctx) {
|
|
|
6287
7130
|
const state = asEvidenceContext(ctx);
|
|
6288
7131
|
return state.runtimeContextCollector.snapshot().records.filter((record) => record.kind !== "failed-request").length;
|
|
6289
7132
|
}
|
|
6290
|
-
function resolveAnnotateScreenshotElement(ctx, annotations, scope) {
|
|
6291
|
-
var _a2;
|
|
6292
|
-
const state = asEvidenceContext(ctx);
|
|
6293
|
-
const currentElement = state.annotateSession.current.target ? (_a2 = state.annotateElements.get(state.annotateSession.current.id)) != null ? _a2 : state.findElementForAnnotationTarget(state.annotateSession.current.target) : null;
|
|
6294
|
-
if (scope === "current") return currentElement;
|
|
6295
|
-
for (const annotation of annotations) {
|
|
6296
|
-
for (const target of annotation.targets) {
|
|
6297
|
-
const element = state.findElementForLocation(target.location, target.selector);
|
|
6298
|
-
if (element) return element;
|
|
6299
|
-
}
|
|
6300
|
-
}
|
|
6301
|
-
return currentElement;
|
|
6302
|
-
}
|
|
6303
|
-
function captureAnnotateScreenshotContext(ctx, annotations, scope) {
|
|
6304
|
-
return __async(this, null, function* () {
|
|
6305
|
-
const state = asEvidenceContext(ctx);
|
|
6306
|
-
if (!state.canAttachScreenshotContext() || !state.annotateScreenshotContextEnabled) {
|
|
6307
|
-
return null;
|
|
6308
|
-
}
|
|
6309
|
-
const element = resolveAnnotateScreenshotElement(state, annotations, scope);
|
|
6310
|
-
return element ? captureElementScreenshot(element) : null;
|
|
6311
|
-
});
|
|
6312
|
-
}
|
|
6313
7133
|
|
|
6314
7134
|
// src/component.ts
|
|
6315
7135
|
var DEFAULT_ANNOTATE_INSTRUCTION = "";
|
|
@@ -6338,18 +7158,23 @@ var InspectoElement = class extends BaseElement {
|
|
|
6338
7158
|
this.annotateDrafts = /* @__PURE__ */ new Map();
|
|
6339
7159
|
this.annotateEditingRecord = null;
|
|
6340
7160
|
this.configLoadPromise = null;
|
|
6341
|
-
this.annotationResponseMode = "unified";
|
|
6342
7161
|
this.annotateInstructionDraft = DEFAULT_ANNOTATE_INSTRUCTION;
|
|
6343
7162
|
this.annotateErrorMessage = "";
|
|
6344
7163
|
this.annotateRuntimeContextEnabled = false;
|
|
6345
|
-
this.annotateScreenshotContextEnabled = false;
|
|
6346
7164
|
this.annotateCssContextEnabled = false;
|
|
7165
|
+
this.annotateDeliveryMode = "both";
|
|
6347
7166
|
this.annotateSendState = {
|
|
6348
7167
|
isSending: false,
|
|
6349
7168
|
scope: null
|
|
6350
7169
|
};
|
|
7170
|
+
this.annotateLatestSessionSummary = null;
|
|
7171
|
+
this.annotateLatestSessionDetail = null;
|
|
7172
|
+
this.annotateLatestSessionStream = null;
|
|
7173
|
+
this.annotateLatestSessionLoading = false;
|
|
7174
|
+
this.annotateLatestSessionError = "";
|
|
6351
7175
|
this.annotateSuccessScope = null;
|
|
6352
7176
|
this.annotateSuccessTimeout = null;
|
|
7177
|
+
this.annotateSuccessOnClear = null;
|
|
6353
7178
|
this.pendingAnnotateViewportFrame = null;
|
|
6354
7179
|
this.runtimeContextCollector = createRuntimeContextCollector();
|
|
6355
7180
|
this.cleanupRuntimeContextCapture = null;
|
|
@@ -6407,9 +7232,6 @@ var InspectoElement = class extends BaseElement {
|
|
|
6407
7232
|
getEffectiveHotKeys() {
|
|
6408
7233
|
return getEffectiveHotKeys(this);
|
|
6409
7234
|
}
|
|
6410
|
-
getAnnotationResponseMode() {
|
|
6411
|
-
return this.annotationResponseMode;
|
|
6412
|
-
}
|
|
6413
7235
|
updateBadgeContent() {
|
|
6414
7236
|
updateBadgeContent(this);
|
|
6415
7237
|
}
|
|
@@ -6440,9 +7262,6 @@ var InspectoElement = class extends BaseElement {
|
|
|
6440
7262
|
canAttachRuntimeContext() {
|
|
6441
7263
|
return canAttachRuntimeContext(this);
|
|
6442
7264
|
}
|
|
6443
|
-
canAttachScreenshotContext() {
|
|
6444
|
-
return canAttachScreenshotContext(this);
|
|
6445
|
-
}
|
|
6446
7265
|
canAttachCssContext() {
|
|
6447
7266
|
return canAttachCssContext();
|
|
6448
7267
|
}
|
|
@@ -6470,14 +7289,6 @@ var InspectoElement = class extends BaseElement {
|
|
|
6470
7289
|
getCollectedRuntimeErrorCount() {
|
|
6471
7290
|
return getCollectedRuntimeErrorCount(this);
|
|
6472
7291
|
}
|
|
6473
|
-
resolveAnnotateScreenshotElement(annotations, scope) {
|
|
6474
|
-
return resolveAnnotateScreenshotElement(this, annotations, scope);
|
|
6475
|
-
}
|
|
6476
|
-
captureAnnotateScreenshotContext(annotations, scope) {
|
|
6477
|
-
return __async(this, null, function* () {
|
|
6478
|
-
return captureAnnotateScreenshotContext(this, annotations, scope);
|
|
6479
|
-
});
|
|
6480
|
-
}
|
|
6481
7292
|
addTargetToCurrentAnnotation(element, location) {
|
|
6482
7293
|
addTargetToCurrentAnnotation(this, element, location);
|
|
6483
7294
|
}
|
|
@@ -6532,15 +7343,26 @@ var InspectoElement = class extends BaseElement {
|
|
|
6532
7343
|
showAnnotateSuccess(scope) {
|
|
6533
7344
|
showAnnotateSuccess(this, scope);
|
|
6534
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
|
+
}
|
|
6535
7357
|
toAnnotateErrorMessage(errorCode, fallback) {
|
|
6536
7358
|
return toAnnotateErrorMessage(this, errorCode, fallback);
|
|
6537
7359
|
}
|
|
6538
7360
|
toAnnotationTransportFromRecord(record) {
|
|
6539
7361
|
return toAnnotationTransportFromRecordUi(this, record);
|
|
6540
7362
|
}
|
|
6541
|
-
sendAnnotationBatch(annotations, scope, instruction, onSuccess) {
|
|
7363
|
+
sendAnnotationBatch(annotations, scope, instruction, deliveryMode, onSuccess) {
|
|
6542
7364
|
return __async(this, null, function* () {
|
|
6543
|
-
return sendAnnotationBatch(this, annotations, scope, instruction, onSuccess);
|
|
7365
|
+
return sendAnnotationBatch(this, annotations, scope, instruction, deliveryMode, onSuccess);
|
|
6544
7366
|
});
|
|
6545
7367
|
}
|
|
6546
7368
|
syncModeUi() {
|
|
@@ -6591,4 +7413,4 @@ if (typeof customElements !== "undefined" && !customElements.get("inspecto-overl
|
|
|
6591
7413
|
export {
|
|
6592
7414
|
InspectoElement
|
|
6593
7415
|
};
|
|
6594
|
-
//# sourceMappingURL=component-
|
|
7416
|
+
//# sourceMappingURL=component-MYXLDDWZ.js.map
|