@inspecto-dev/core 0.3.10 → 0.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{component-SDAMNKDH.js → component-X56HVYBS.js} +262 -60
- package/dist/component-X56HVYBS.js.map +1 -0
- package/dist/index.cjs +265 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/dist/component-SDAMNKDH.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -172,7 +172,7 @@ var init_annotate_session = __esm({
|
|
|
172
172
|
});
|
|
173
173
|
|
|
174
174
|
// src/styles-classes.ts
|
|
175
|
-
var overlayClass, menuClass, menuTitleClass, menuMetaClass, menuSectionClass, menuItemClass, loadingSpinnerClass, errorMsgClass, badgeClass, menuInputClass, menuInputWrapperClass, menuInputIconClass, menuContextSummaryClass, menuContextPreviewClass, menuContextToggleClass, runtimeToggleClass, runtimeToggleIconClass, runtimeToggleBadgeClass, annotateSidebarClass, annotateSidebarHeaderClass, annotateSidebarSectionClass, annotateTargetListClass, annotateQueueListClass, annotateBadgeClass, annotateSidebarFooterClass, annotateSidebarActionsClass, annotateSidebarButtonClass, annotateSidebarInputClass, annotateSidebarSelectClass, annotateSidebarTextClass, annotateSidebarEmptyClass, annotateSidebarQueueMetaClass, annotateSidebarQueueItemClass, annotateSidebarTargetItemClass, annotateSidebarLabelClass, annotateSidebarInlineActionClass, annotateSidebarChipListClass, annotateSidebarChipClass, annotateSidebarChipPanelClass, annotateSidebarChipFieldClass, annotateSidebarHintClass, tooltipClass, tooltipTopClass, tooltipBottomClass, tagClass, idClass, classClass, dimClass, separatorClass, sourceClass, shortcutIconClass;
|
|
175
|
+
var overlayClass, menuClass, menuTitleClass, menuMetaClass, menuSectionClass, menuItemClass, loadingSpinnerClass, errorMsgClass, badgeClass, menuInputClass, menuInputWrapperClass, menuInputIconClass, menuContextSummaryClass, menuContextPreviewClass, menuContextToggleClass, runtimeToggleClass, runtimeToggleIconClass, runtimeToggleBadgeClass, annotateSidebarClass, annotateSidebarHeaderClass, annotateSidebarSectionClass, annotateTargetListClass, annotateQueueListClass, annotateBadgeClass, annotateSidebarFooterClass, annotateSidebarActionsClass, annotateSidebarButtonClass, annotateSidebarInputClass, annotateSidebarSelectClass, annotateSidebarTextClass, annotateSidebarEmptyClass, annotateSidebarQueueMetaClass, annotateSidebarQueueItemClass, annotateSidebarTargetItemClass, annotateSidebarLabelClass, annotateSidebarInlineActionClass, annotateSidebarChipListClass, annotateSidebarChipClass, annotateSidebarChipPanelClass, annotateSidebarChipFieldClass, annotateSidebarHintClass, annotateConfirmDialogClass, tooltipClass, tooltipTopClass, tooltipBottomClass, tagClass, idClass, classClass, dimClass, separatorClass, sourceClass, shortcutIconClass;
|
|
176
176
|
var init_styles_classes = __esm({
|
|
177
177
|
"src/styles-classes.ts"() {
|
|
178
178
|
"use strict";
|
|
@@ -217,6 +217,7 @@ var init_styles_classes = __esm({
|
|
|
217
217
|
annotateSidebarChipPanelClass = "inspecto-annotate-sidebar-chip-panel";
|
|
218
218
|
annotateSidebarChipFieldClass = "inspecto-annotate-sidebar-chip-field";
|
|
219
219
|
annotateSidebarHintClass = "inspecto-annotate-sidebar-hint";
|
|
220
|
+
annotateConfirmDialogClass = "inspecto-annotate-confirm-dialog";
|
|
220
221
|
tooltipClass = "inspecto-tooltip";
|
|
221
222
|
tooltipTopClass = "inspecto-tooltip-top";
|
|
222
223
|
tooltipBottomClass = "inspecto-tooltip-bottom";
|
|
@@ -573,7 +574,7 @@ var init_styles_annotate = __esm({
|
|
|
573
574
|
.${annotateSidebarSectionClass}[data-variant="modes"] .${annotateSidebarButtonClass}[data-role="mode"] { flex: 1 1 0; justify-content: center; padding: 8px 10px; background: transparent; border-color: transparent; color: var(--inspecto-text-secondary); }
|
|
574
575
|
.${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; }
|
|
575
576
|
.${annotateSidebarHeaderClass} .${runtimeToggleClass} { overflow: visible; }
|
|
576
|
-
.${annotateSidebarHeaderClass} [data-inspecto-annotate-header-actions="true"] { padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.025); border: 1px solid rgba(255, 255, 255, 0.05); gap: 4px; flex-wrap: nowrap; flex: 0 0 auto; margin-top: 1px; }
|
|
577
|
+
.${annotateSidebarHeaderClass} [data-inspecto-annotate-header-actions-left="true"], .${annotateSidebarHeaderClass} [data-inspecto-annotate-header-actions-right="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; }
|
|
577
578
|
.${annotateSidebarButtonClass}:hover { background: var(--inspecto-surface-hover); color: #ffffff; border-color: rgba(148, 163, 184, 0.12); transform: translateY(-1px); }
|
|
578
579
|
.${annotateSidebarButtonClass}:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
579
580
|
.${annotateSidebarClass} .${annotateSidebarButtonClass}.primary {
|
|
@@ -653,6 +654,73 @@ var init_styles_annotate = __esm({
|
|
|
653
654
|
.${annotateSidebarSectionClass}[data-variant="full-prompt"] > summary { list-style: none; cursor: pointer; font-size: 10px; font-weight: 600; color: var(--inspecto-text-tertiary); text-transform: none; letter-spacing: 0.01em; }
|
|
654
655
|
.${annotateSidebarSectionClass}[data-variant="full-prompt"] > summary::-webkit-details-marker { display: none; }
|
|
655
656
|
.${annotateSidebarTextClass}[data-variant="full-prompt"] { margin: 6px 0 0; padding: 9px 10px; border: 1px solid var(--inspecto-border-muted); border-radius: var(--inspecto-radius-sm); background: rgba(255, 255, 255, 0.02); color: var(--inspecto-text-secondary); font-family: 'SF Mono', 'Fira Code', ui-monospace, monospace; font-size: 10px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow: auto; }
|
|
657
|
+
|
|
658
|
+
.${annotateConfirmDialogClass} {
|
|
659
|
+
position: absolute;
|
|
660
|
+
inset: 0;
|
|
661
|
+
z-index: 100;
|
|
662
|
+
display: flex;
|
|
663
|
+
align-items: center;
|
|
664
|
+
justify-content: center;
|
|
665
|
+
background: rgba(13, 20, 31, 0.5);
|
|
666
|
+
backdrop-filter: blur(4px);
|
|
667
|
+
-webkit-backdrop-filter: blur(4px);
|
|
668
|
+
border-radius: 28px;
|
|
669
|
+
}
|
|
670
|
+
.${annotateConfirmDialogClass} .content {
|
|
671
|
+
width: calc(100% - 48px);
|
|
672
|
+
background: rgba(30, 35, 45, 0.95);
|
|
673
|
+
border: 1px solid rgba(255, 255, 255, 0.12);
|
|
674
|
+
border-radius: 20px;
|
|
675
|
+
box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
|
|
676
|
+
padding: 18px;
|
|
677
|
+
display: flex;
|
|
678
|
+
flex-direction: column;
|
|
679
|
+
gap: 18px;
|
|
680
|
+
}
|
|
681
|
+
.${annotateConfirmDialogClass} p {
|
|
682
|
+
margin: 0;
|
|
683
|
+
font-size: 13px;
|
|
684
|
+
line-height: 1.5;
|
|
685
|
+
color: rgba(255, 255, 255, 0.9);
|
|
686
|
+
}
|
|
687
|
+
.${annotateConfirmDialogClass} .actions {
|
|
688
|
+
display: flex;
|
|
689
|
+
gap: 8px;
|
|
690
|
+
justify-content: flex-end;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
@keyframes inspecto-fade-out {
|
|
694
|
+
0% { opacity: 1; transform: translateY(0); }
|
|
695
|
+
100% { opacity: 0; transform: translateY(-4px); pointer-events: none; }
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
.inspecto-workflow-toast {
|
|
699
|
+
position: absolute;
|
|
700
|
+
bottom: calc(100% + 8px);
|
|
701
|
+
left: 50%;
|
|
702
|
+
transform: translateX(-50%);
|
|
703
|
+
background: rgba(28, 28, 28, 0.95);
|
|
704
|
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
705
|
+
border-radius: var(--inspecto-radius-pill);
|
|
706
|
+
box-shadow: var(--inspecto-shadow-floating);
|
|
707
|
+
backdrop-filter: blur(16px);
|
|
708
|
+
-webkit-backdrop-filter: blur(16px);
|
|
709
|
+
padding: 6px 14px;
|
|
710
|
+
z-index: 100;
|
|
711
|
+
font-size: 11px;
|
|
712
|
+
font-weight: 600;
|
|
713
|
+
color: #5ad496;
|
|
714
|
+
display: flex;
|
|
715
|
+
align-items: center;
|
|
716
|
+
gap: 6px;
|
|
717
|
+
pointer-events: none;
|
|
718
|
+
animation: inspecto-fade-out 0.3s ease 1.7s forwards;
|
|
719
|
+
}
|
|
720
|
+
.inspecto-workflow-toast::before {
|
|
721
|
+
content: '\u2713';
|
|
722
|
+
font-size: 12px;
|
|
723
|
+
}
|
|
656
724
|
`;
|
|
657
725
|
}
|
|
658
726
|
});
|
|
@@ -1733,7 +1801,10 @@ var init_i18n = __esm({
|
|
|
1733
1801
|
"runtime.summary.error.one": "{count} runtime error",
|
|
1734
1802
|
"runtime.summary.error.other": "{count} runtime errors",
|
|
1735
1803
|
"runtime.summary.request.one": "{count} failed request",
|
|
1736
|
-
"runtime.summary.request.other": "{count} failed requests"
|
|
1804
|
+
"runtime.summary.request.other": "{count} failed requests",
|
|
1805
|
+
"workflow.confirm": 'Confirm to execute "{label}"?',
|
|
1806
|
+
"workflow.confirm.ok": "Confirm",
|
|
1807
|
+
"workflow.feedback.executed": "Execution started"
|
|
1737
1808
|
};
|
|
1738
1809
|
ZH_CN_MESSAGES = {
|
|
1739
1810
|
"launcher.panel.title": "\u9009\u62E9\u6A21\u5F0F",
|
|
@@ -1830,7 +1901,10 @@ var init_i18n = __esm({
|
|
|
1830
1901
|
"runtime.summary.error.one": "{count} \u4E2A\u8FD0\u884C\u65F6\u9519\u8BEF",
|
|
1831
1902
|
"runtime.summary.error.other": "{count} \u4E2A\u8FD0\u884C\u65F6\u9519\u8BEF",
|
|
1832
1903
|
"runtime.summary.request.one": "{count} \u4E2A\u5931\u8D25\u8BF7\u6C42",
|
|
1833
|
-
"runtime.summary.request.other": "{count} \u4E2A\u5931\u8D25\u8BF7\u6C42"
|
|
1904
|
+
"runtime.summary.request.other": "{count} \u4E2A\u5931\u8D25\u8BF7\u6C42",
|
|
1905
|
+
"workflow.confirm": "\u786E\u8BA4\u6267\u884C\u300C{label}\u300D\uFF1F",
|
|
1906
|
+
"workflow.confirm.ok": "\u786E\u8BA4\u6267\u884C",
|
|
1907
|
+
"workflow.feedback.executed": "\u6267\u884C\u5DF2\u542F\u52A8"
|
|
1834
1908
|
};
|
|
1835
1909
|
BUILTIN_MESSAGES = {
|
|
1836
1910
|
en: EN_MESSAGES,
|
|
@@ -3265,23 +3339,24 @@ function toAnnotationTransportFromRecordUi(_ctx, record) {
|
|
|
3265
3339
|
]
|
|
3266
3340
|
};
|
|
3267
3341
|
}
|
|
3268
|
-
function sendAnnotationBatch(ctx, annotations, scope, instruction, deliveryMode, onSuccess) {
|
|
3342
|
+
function sendAnnotationBatch(ctx, annotations, scope, instruction, deliveryMode, onSuccess, extraPayload) {
|
|
3269
3343
|
return __async(this, null, function* () {
|
|
3270
3344
|
var _a2, _b;
|
|
3271
3345
|
const state = asAnnotateContext(ctx);
|
|
3272
|
-
if (
|
|
3346
|
+
if (state.annotateSendState.isSending) return;
|
|
3347
|
+
if (annotations.length === 0 && (extraPayload == null ? void 0 : extraPayload.source) !== "workflow") return;
|
|
3273
3348
|
state.annotateSendState = { isSending: true, scope };
|
|
3274
3349
|
state.updateAnnotateSidebar();
|
|
3275
3350
|
try {
|
|
3276
3351
|
yield state.configLoadPromise;
|
|
3277
3352
|
const runtimeContext = state.getAnnotateRuntimeContext(annotations);
|
|
3278
3353
|
const cssContextPrompt = state.getAnnotateCssContextPrompt(annotations);
|
|
3279
|
-
const result = yield sendAnnotationsToAi(__spreadProps(__spreadValues(__spreadValues({
|
|
3354
|
+
const result = yield sendAnnotationsToAi(__spreadValues(__spreadProps(__spreadValues(__spreadValues({
|
|
3280
3355
|
instruction,
|
|
3281
3356
|
annotations
|
|
3282
3357
|
}, runtimeContext ? { runtimeContext } : {}), cssContextPrompt ? { cssContextPrompt } : {}), {
|
|
3283
3358
|
deliveryMode
|
|
3284
|
-
}));
|
|
3359
|
+
}), extraPayload || {}));
|
|
3285
3360
|
if (!result.success) {
|
|
3286
3361
|
state.annotateErrorMessage = toAnnotateErrorMessage(state, result.errorCode, result.error);
|
|
3287
3362
|
state.updateAnnotateSidebar();
|
|
@@ -3314,6 +3389,47 @@ function sendAnnotationBatch(ctx, annotations, scope, instruction, deliveryMode,
|
|
|
3314
3389
|
}
|
|
3315
3390
|
});
|
|
3316
3391
|
}
|
|
3392
|
+
function triggerWorkflow(ctx, workflowId) {
|
|
3393
|
+
return __async(this, null, function* () {
|
|
3394
|
+
var _a2;
|
|
3395
|
+
const state = asAnnotateContext(ctx);
|
|
3396
|
+
if (state.annotateSendState.isSending) return;
|
|
3397
|
+
const workflowPrompt = ((_a2 = state.annotateWorkflows.find((w) => w.id === workflowId)) == null ? void 0 : _a2.prompt) || "";
|
|
3398
|
+
if (!workflowPrompt.trim()) return;
|
|
3399
|
+
const scope = state.annotateDeliveryMode === "ide" ? "quick-ask" : "create-task";
|
|
3400
|
+
state.annotateSendState = { isSending: true, scope };
|
|
3401
|
+
state.updateAnnotateSidebar();
|
|
3402
|
+
try {
|
|
3403
|
+
yield state.configLoadPromise;
|
|
3404
|
+
const result = yield sendToAi({
|
|
3405
|
+
prompt: workflowPrompt
|
|
3406
|
+
});
|
|
3407
|
+
if (!result.success) {
|
|
3408
|
+
state.annotateErrorMessage = toAnnotateErrorMessage(state, result.errorCode, result.error);
|
|
3409
|
+
state.updateAnnotateSidebar();
|
|
3410
|
+
return;
|
|
3411
|
+
}
|
|
3412
|
+
state.annotateInstructionDraft = "";
|
|
3413
|
+
state.annotateSession = createEmptySession();
|
|
3414
|
+
state.annotateEditingRecord = null;
|
|
3415
|
+
state.annotateElements.clear();
|
|
3416
|
+
state.annotateErrorMessage = "";
|
|
3417
|
+
state.showAnnotateSuccess(scope);
|
|
3418
|
+
state.renderAnnotateSelectionOverlay();
|
|
3419
|
+
state.updateAnnotateSidebar();
|
|
3420
|
+
} catch (err) {
|
|
3421
|
+
state.annotateErrorMessage = toAnnotateErrorMessage(
|
|
3422
|
+
state,
|
|
3423
|
+
err.errorCode,
|
|
3424
|
+
err.message
|
|
3425
|
+
);
|
|
3426
|
+
state.updateAnnotateSidebar();
|
|
3427
|
+
} finally {
|
|
3428
|
+
state.annotateSendState = { isSending: false, scope: null };
|
|
3429
|
+
state.updateAnnotateSidebar();
|
|
3430
|
+
}
|
|
3431
|
+
});
|
|
3432
|
+
}
|
|
3317
3433
|
function refreshLatestAnnotateSession(ctx) {
|
|
3318
3434
|
return __async(this, null, function* () {
|
|
3319
3435
|
var _a2, _b, _c, _d;
|
|
@@ -3384,7 +3500,7 @@ function getAnnotateSidebarOptions(ctx) {
|
|
|
3384
3500
|
const fullInstruction = composeAnnotateInstruction(state);
|
|
3385
3501
|
const allRuntimeContext = state.getAnnotateRuntimeContext(allAnnotations);
|
|
3386
3502
|
const allCssContextPrompt = state.getAnnotateCssContextPrompt(allAnnotations);
|
|
3387
|
-
const deliveryPreference = (_a2 = state.annotateDeliveryMode) != null ? _a2 : "
|
|
3503
|
+
const deliveryPreference = (_a2 = state.annotateDeliveryMode) != null ? _a2 : "agent";
|
|
3388
3504
|
let preferredAction = "create-task";
|
|
3389
3505
|
if (deliveryPreference === "ide") preferredAction = "quick-ask";
|
|
3390
3506
|
if (deliveryPreference === "agent") preferredAction = "create-task";
|
|
@@ -3410,6 +3526,7 @@ function getAnnotateSidebarOptions(ctx) {
|
|
|
3410
3526
|
successScope: state.annotateSuccessScope,
|
|
3411
3527
|
preferredAction,
|
|
3412
3528
|
annotateDeliveryMode: state.annotateDeliveryMode,
|
|
3529
|
+
workflows: state.annotateWorkflows,
|
|
3413
3530
|
latestSessionSummary: state.annotateLatestSessionSummary,
|
|
3414
3531
|
latestSessionDetail: state.annotateLatestSessionDetail,
|
|
3415
3532
|
latestSessionLoading: state.annotateLatestSessionLoading,
|
|
@@ -3556,6 +3673,9 @@ function getAnnotateSidebarOptions(ctx) {
|
|
|
3556
3673
|
}
|
|
3557
3674
|
);
|
|
3558
3675
|
},
|
|
3676
|
+
onWorkflow: (workflowId) => {
|
|
3677
|
+
void triggerWorkflow(state, workflowId);
|
|
3678
|
+
},
|
|
3559
3679
|
onExit: () => {
|
|
3560
3680
|
state.setMode("inspect");
|
|
3561
3681
|
}
|
|
@@ -4984,13 +5104,13 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
4984
5104
|
if (!options.askPlaceholder) {
|
|
4985
5105
|
input.placeholder = intents.length > 0 ? t("menu.ask.placeholder.default") : t("menu.ask.placeholder.fallback");
|
|
4986
5106
|
}
|
|
4987
|
-
const aiIntents = intents;
|
|
5107
|
+
const aiIntents = intents.filter(import_types2.isAiIntentConfig);
|
|
4988
5108
|
const hasFixIntent = aiIntents.some(isFixIntent);
|
|
4989
5109
|
const hasNonFixIntent = aiIntents.some((intent) => !isFixIntent(intent));
|
|
4990
5110
|
runtimeContextDefaultMode = hasFixIntent ? hasNonFixIntent ? "mixed" : "all-on" : "off";
|
|
4991
5111
|
renderRuntimeContextUi();
|
|
4992
5112
|
const aiActions = createIntentActionButtons({
|
|
4993
|
-
intents,
|
|
5113
|
+
intents: aiIntents,
|
|
4994
5114
|
location,
|
|
4995
5115
|
includeSnippet,
|
|
4996
5116
|
maxSnippetLines,
|
|
@@ -5041,6 +5161,7 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
5041
5161
|
});
|
|
5042
5162
|
return cleanup;
|
|
5043
5163
|
}
|
|
5164
|
+
var import_types2;
|
|
5044
5165
|
var init_menu = __esm({
|
|
5045
5166
|
"src/menu.ts"() {
|
|
5046
5167
|
"use strict";
|
|
@@ -5052,6 +5173,7 @@ var init_menu = __esm({
|
|
|
5052
5173
|
init_menu_helpers();
|
|
5053
5174
|
init_i18n();
|
|
5054
5175
|
init_styles();
|
|
5176
|
+
import_types2 = require("@inspecto-dev/types");
|
|
5055
5177
|
}
|
|
5056
5178
|
});
|
|
5057
5179
|
|
|
@@ -5912,9 +6034,29 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5912
6034
|
const headerStatus = document.createElement("div");
|
|
5913
6035
|
headerStatus.setAttribute("data-inspecto-annotate-header-status", "true");
|
|
5914
6036
|
headerCopy.append(headerTitle, headerStatus);
|
|
5915
|
-
const
|
|
5916
|
-
|
|
5917
|
-
|
|
6037
|
+
const headerActionsLeft = document.createElement("div");
|
|
6038
|
+
headerActionsLeft.className = annotateSidebarActionsClass;
|
|
6039
|
+
headerActionsLeft.setAttribute("data-inspecto-annotate-header-actions-left", "true");
|
|
6040
|
+
const previewButton = createSidebarButton("</>", annotateSidebarButtonClass);
|
|
6041
|
+
previewButton.dataset.role = "raw-preview-toggle";
|
|
6042
|
+
previewButton.setAttribute("aria-label", t("annotate.previewRawPrompt"));
|
|
6043
|
+
previewButton.title = t("annotate.previewRawPrompt");
|
|
6044
|
+
const copyContextButton = createSidebarButton(
|
|
6045
|
+
'<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>',
|
|
6046
|
+
annotateSidebarButtonClass,
|
|
6047
|
+
true
|
|
6048
|
+
);
|
|
6049
|
+
copyContextButton.dataset.role = "raw-preview";
|
|
6050
|
+
copyContextButton.setAttribute("aria-label", t("annotate.copyContext"));
|
|
6051
|
+
copyContextButton.title = t("annotate.copyContext");
|
|
6052
|
+
headerActionsLeft.append(previewButton, copyContextButton);
|
|
6053
|
+
const headerActionsRight = document.createElement("div");
|
|
6054
|
+
headerActionsRight.className = annotateSidebarActionsClass;
|
|
6055
|
+
headerActionsRight.setAttribute("data-inspecto-annotate-header-actions-right", "true");
|
|
6056
|
+
const headerActionsContainer = document.createElement("div");
|
|
6057
|
+
headerActionsContainer.style.display = "flex";
|
|
6058
|
+
headerActionsContainer.style.gap = "8px";
|
|
6059
|
+
headerActionsContainer.style.alignItems = "center";
|
|
5918
6060
|
const quickCaptureButton = createSidebarButton(pureMarkIconSvg, annotateSidebarButtonClass, true);
|
|
5919
6061
|
quickCaptureButton.dataset.role = "quick-capture";
|
|
5920
6062
|
quickCaptureButton.classList.add(runtimeToggleClass);
|
|
@@ -5964,14 +6106,15 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5964
6106
|
exitButton.style.justifyContent = "center";
|
|
5965
6107
|
exitButton.setAttribute("aria-label", t("annotate.exitMode"));
|
|
5966
6108
|
exitButton.title = t("annotate.exitMode");
|
|
5967
|
-
|
|
6109
|
+
headerActionsRight.append(
|
|
5968
6110
|
quickCaptureButton,
|
|
5969
6111
|
cssContextButton,
|
|
5970
6112
|
runtimeContextButton,
|
|
5971
6113
|
modeButton,
|
|
5972
6114
|
exitButton
|
|
5973
6115
|
);
|
|
5974
|
-
|
|
6116
|
+
headerActionsContainer.append(headerActionsLeft, headerActionsRight);
|
|
6117
|
+
header.append(headerCopy, headerActionsContainer);
|
|
5975
6118
|
const emptyState = document.createElement("section");
|
|
5976
6119
|
emptyState.className = annotateSidebarSectionClass;
|
|
5977
6120
|
emptyState.dataset.variant = "empty-state";
|
|
@@ -6154,24 +6297,17 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
6154
6297
|
footerActionRowContainer.style.justifyContent = "space-between";
|
|
6155
6298
|
footerActionRowContainer.style.width = "100%";
|
|
6156
6299
|
footerActionRowContainer.style.gap = "8px";
|
|
6300
|
+
const workflowRow = document.createElement("div");
|
|
6301
|
+
workflowRow.className = annotateSidebarActionsClass;
|
|
6302
|
+
workflowRow.style.display = "none";
|
|
6303
|
+
workflowRow.style.gap = "8px";
|
|
6304
|
+
workflowRow.style.width = "100%";
|
|
6157
6305
|
const footerLeftActions = document.createElement("div");
|
|
6158
6306
|
footerLeftActions.className = annotateSidebarActionsClass;
|
|
6159
6307
|
footerLeftActions.style.flex = "0 0 auto";
|
|
6160
6308
|
footerLeftActions.style.display = "none";
|
|
6161
6309
|
footerLeftActions.style.alignItems = "center";
|
|
6162
6310
|
footerLeftActions.style.gap = "8px";
|
|
6163
|
-
const previewButton = createSidebarButton("</>", annotateSidebarButtonClass);
|
|
6164
|
-
previewButton.dataset.role = "raw-preview-toggle";
|
|
6165
|
-
previewButton.setAttribute("aria-label", t("annotate.previewRawPrompt"));
|
|
6166
|
-
previewButton.title = t("annotate.previewRawPrompt");
|
|
6167
|
-
const copyContextButton = createSidebarButton(
|
|
6168
|
-
'<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>',
|
|
6169
|
-
annotateSidebarButtonClass,
|
|
6170
|
-
true
|
|
6171
|
-
);
|
|
6172
|
-
copyContextButton.dataset.role = "raw-preview";
|
|
6173
|
-
copyContextButton.setAttribute("aria-label", t("annotate.copyContext"));
|
|
6174
|
-
copyContextButton.title = t("annotate.copyContext");
|
|
6175
6311
|
const previewFloat = document.createElement("div");
|
|
6176
6312
|
previewFloat.dataset.inspectoAnnotateRawPreview = "true";
|
|
6177
6313
|
previewFloat.style.display = "none";
|
|
@@ -6198,6 +6334,50 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
6198
6334
|
previewFloatContent.style.lineHeight = "1.4";
|
|
6199
6335
|
previewFloatContent.style.color = "rgba(255, 255, 255, 0.7)";
|
|
6200
6336
|
previewFloat.appendChild(previewFloatContent);
|
|
6337
|
+
const confirmDialog = document.createElement("div");
|
|
6338
|
+
confirmDialog.className = annotateConfirmDialogClass;
|
|
6339
|
+
confirmDialog.style.display = "none";
|
|
6340
|
+
const confirmContent = document.createElement("div");
|
|
6341
|
+
confirmContent.className = "content";
|
|
6342
|
+
const confirmMessage = document.createElement("p");
|
|
6343
|
+
const confirmActions = document.createElement("div");
|
|
6344
|
+
confirmActions.className = "actions";
|
|
6345
|
+
const confirmCancelBtn = createSidebarButton(t("annotate.cancel"), annotateSidebarButtonClass);
|
|
6346
|
+
confirmCancelBtn.dataset.emphasis = "secondary";
|
|
6347
|
+
const confirmOkBtn = createSidebarButton(t("workflow.confirm.ok"), annotateSidebarButtonClass);
|
|
6348
|
+
confirmOkBtn.classList.add("primary");
|
|
6349
|
+
confirmActions.append(confirmCancelBtn, confirmOkBtn);
|
|
6350
|
+
confirmContent.append(confirmMessage, confirmActions);
|
|
6351
|
+
confirmDialog.append(confirmContent);
|
|
6352
|
+
let currentConfirmCallback = null;
|
|
6353
|
+
confirmCancelBtn.addEventListener("click", (event) => {
|
|
6354
|
+
event.preventDefault();
|
|
6355
|
+
event.stopPropagation();
|
|
6356
|
+
confirmDialog.style.display = "none";
|
|
6357
|
+
currentConfirmCallback = null;
|
|
6358
|
+
});
|
|
6359
|
+
confirmOkBtn.addEventListener("click", (event) => {
|
|
6360
|
+
event.preventDefault();
|
|
6361
|
+
event.stopPropagation();
|
|
6362
|
+
confirmDialog.style.display = "none";
|
|
6363
|
+
if (currentConfirmCallback) {
|
|
6364
|
+
currentConfirmCallback();
|
|
6365
|
+
currentConfirmCallback = null;
|
|
6366
|
+
}
|
|
6367
|
+
const toast = document.createElement("div");
|
|
6368
|
+
toast.className = "inspecto-workflow-toast";
|
|
6369
|
+
toast.textContent = t("workflow.feedback.executed");
|
|
6370
|
+
workflowRow.style.position = "relative";
|
|
6371
|
+
workflowRow.appendChild(toast);
|
|
6372
|
+
setTimeout(() => {
|
|
6373
|
+
toast.remove();
|
|
6374
|
+
}, 2e3);
|
|
6375
|
+
});
|
|
6376
|
+
function showConfirmDialog(message, onConfirm) {
|
|
6377
|
+
confirmMessage.textContent = message;
|
|
6378
|
+
currentConfirmCallback = onConfirm;
|
|
6379
|
+
confirmDialog.style.display = "flex";
|
|
6380
|
+
}
|
|
6201
6381
|
function updateRawPromptPreviewPosition() {
|
|
6202
6382
|
const viewportPadding = 12;
|
|
6203
6383
|
const gap = 8;
|
|
@@ -6231,8 +6411,11 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
6231
6411
|
if (!previewFloat.contains(clickTarget) && !previewButton.contains(clickTarget)) {
|
|
6232
6412
|
setRawPromptPreviewVisible(false);
|
|
6233
6413
|
}
|
|
6414
|
+
if (!confirmContent.contains(clickTarget) && !workflowRow.contains(clickTarget)) {
|
|
6415
|
+
confirmDialog.style.display = "none";
|
|
6416
|
+
currentConfirmCallback = null;
|
|
6417
|
+
}
|
|
6234
6418
|
});
|
|
6235
|
-
footerLeftActions.append(previewButton, copyContextButton);
|
|
6236
6419
|
const footerActions = document.createElement("div");
|
|
6237
6420
|
footerActions.className = annotateSidebarActionsClass;
|
|
6238
6421
|
footerActions.style.display = "flex";
|
|
@@ -6251,10 +6434,10 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
6251
6434
|
createTaskButton.style.whiteSpace = "nowrap";
|
|
6252
6435
|
footerActions.append(quickAskButton, createTaskButton);
|
|
6253
6436
|
footerActionRowContainer.append(footerLeftActions, footerActions);
|
|
6254
|
-
footerActionRow.append(footerActionRowContainer);
|
|
6437
|
+
footerActionRow.append(footerActionRowContainer, workflowRow);
|
|
6255
6438
|
footerLayout.append(recommendedActionLabel, footerActionRow);
|
|
6256
6439
|
footer.append(previewFloat, statusMessage, errorMessage, footerLayout);
|
|
6257
|
-
element.append(header, emptyState, draftSection, footer);
|
|
6440
|
+
element.append(header, emptyState, draftSection, footer, confirmDialog);
|
|
6258
6441
|
shadowRoot.appendChild(element);
|
|
6259
6442
|
return {
|
|
6260
6443
|
element,
|
|
@@ -6267,6 +6450,7 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
6267
6450
|
exitButton,
|
|
6268
6451
|
emptyState,
|
|
6269
6452
|
draftSection,
|
|
6453
|
+
workflowRow,
|
|
6270
6454
|
instructionInput,
|
|
6271
6455
|
includedSummary,
|
|
6272
6456
|
recordsList,
|
|
@@ -6291,7 +6475,8 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
6291
6475
|
quickAskButton,
|
|
6292
6476
|
createTaskButton,
|
|
6293
6477
|
updateRawPromptPreviewPosition,
|
|
6294
|
-
setRawPromptPreviewVisible
|
|
6478
|
+
setRawPromptPreviewVisible,
|
|
6479
|
+
showConfirmDialog
|
|
6295
6480
|
};
|
|
6296
6481
|
}
|
|
6297
6482
|
var init_annotate_sidebar_dom = __esm({
|
|
@@ -6609,6 +6794,7 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
6609
6794
|
exitButton,
|
|
6610
6795
|
emptyState,
|
|
6611
6796
|
draftSection,
|
|
6797
|
+
workflowRow,
|
|
6612
6798
|
instructionInput,
|
|
6613
6799
|
includedSummary,
|
|
6614
6800
|
recordsList,
|
|
@@ -6835,7 +7021,7 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
6835
7021
|
const shouldShowBody = hasSavedRecords || hasCurrentDraft || next.isSending || next.successScope === "quick-ask" || Boolean(next.errorMessage);
|
|
6836
7022
|
const canSend = next.isSending ? false : next.includedRecords.length > 0 || hasCurrentDraft;
|
|
6837
7023
|
const preferredAction = (_a2 = next.preferredAction) != null ? _a2 : "create-task";
|
|
6838
|
-
const deliveryPreference = (_b = next.annotateDeliveryMode) != null ? _b : "
|
|
7024
|
+
const deliveryPreference = (_b = next.annotateDeliveryMode) != null ? _b : "agent";
|
|
6839
7025
|
const showDebugHelperActions = deliveryPreference !== "agent";
|
|
6840
7026
|
element.style.display = "";
|
|
6841
7027
|
emptyState.style.display = shouldShowBody ? "none" : "";
|
|
@@ -6883,37 +7069,23 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
6883
7069
|
}
|
|
6884
7070
|
includedSummary.textContent = `Element notes (${next.includedRecords.length})`;
|
|
6885
7071
|
renderers.renderIncludedRecords(next.includedRecords, recordsList);
|
|
6886
|
-
const allowQuickAsk = deliveryPreference === "
|
|
6887
|
-
const allowCreateTask = deliveryPreference === "
|
|
6888
|
-
const onlyOneAction = allowQuickAsk !== allowCreateTask;
|
|
7072
|
+
const allowQuickAsk = deliveryPreference === "ide";
|
|
7073
|
+
const allowCreateTask = deliveryPreference === "agent";
|
|
6889
7074
|
quickAskButton.style.display = allowQuickAsk ? "" : "none";
|
|
6890
7075
|
createTaskButton.style.display = allowCreateTask ? "" : "none";
|
|
6891
7076
|
quickAskButton.disabled = !canSend;
|
|
6892
7077
|
createTaskButton.disabled = !canSend;
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6901
|
-
createTaskButton.dataset.layoutRole = "primary";
|
|
6902
|
-
} else {
|
|
6903
|
-
quickAskButton.classList.toggle("primary", false);
|
|
6904
|
-
createTaskButton.classList.toggle("primary", false);
|
|
6905
|
-
quickAskButton.dataset.emphasis = preferredAction === "quick-ask" ? "primary" : "secondary";
|
|
6906
|
-
createTaskButton.dataset.emphasis = preferredAction === "create-task" ? "primary" : "secondary";
|
|
6907
|
-
quickAskButton.dataset.layoutRole = preferredAction === "quick-ask" ? "primary" : "secondary";
|
|
6908
|
-
createTaskButton.dataset.layoutRole = preferredAction === "create-task" ? "primary" : "secondary";
|
|
6909
|
-
quickAskButton.style.order = "1";
|
|
6910
|
-
createTaskButton.style.order = "2";
|
|
6911
|
-
quickAskButton.style.flex = "1";
|
|
6912
|
-
createTaskButton.style.flex = "1";
|
|
6913
|
-
}
|
|
7078
|
+
quickAskButton.classList.toggle("primary", true);
|
|
7079
|
+
createTaskButton.classList.toggle("primary", true);
|
|
7080
|
+
quickAskButton.dataset.emphasis = "primary";
|
|
7081
|
+
createTaskButton.dataset.emphasis = "primary";
|
|
7082
|
+
quickAskButton.style.flex = "1";
|
|
7083
|
+
createTaskButton.style.flex = "1";
|
|
7084
|
+
quickAskButton.dataset.layoutRole = "primary";
|
|
7085
|
+
createTaskButton.dataset.layoutRole = "primary";
|
|
6914
7086
|
quickAskButton.title = t("annotate.askAiHint");
|
|
6915
7087
|
createTaskButton.title = t("annotate.createTaskHint");
|
|
6916
|
-
recommendedActionLabel.style.display =
|
|
7088
|
+
recommendedActionLabel.style.display = "none";
|
|
6917
7089
|
recommendedActionLabel.textContent = preferredAction === "quick-ask" ? t("annotate.recommendedAction.askHint", {
|
|
6918
7090
|
action: t("annotate.askAi")
|
|
6919
7091
|
}) : t("annotate.recommendedAction.agentHint", {
|
|
@@ -6921,6 +7093,31 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
6921
7093
|
});
|
|
6922
7094
|
quickAskButton.textContent = next.isSending && next.sendingScope === "quick-ask" ? t("menu.sending") : !next.isSending && next.successScope === "quick-ask" ? t("annotate.sent") : t("annotate.askAi");
|
|
6923
7095
|
createTaskButton.textContent = next.isSending && next.sendingScope === "create-task" ? t("menu.sending") : t("annotate.createTask");
|
|
7096
|
+
const workflows = next.workflows || [];
|
|
7097
|
+
workflowRow.style.display = workflows.length > 0 ? "flex" : "none";
|
|
7098
|
+
workflowRow.innerHTML = "";
|
|
7099
|
+
for (const wf of workflows) {
|
|
7100
|
+
const btn = createSidebarButton(wf.label, annotateSidebarButtonClass);
|
|
7101
|
+
btn.dataset.workflowId = wf.id;
|
|
7102
|
+
btn.style.flex = "1";
|
|
7103
|
+
btn.style.justifyContent = "center";
|
|
7104
|
+
btn.style.whiteSpace = "nowrap";
|
|
7105
|
+
const isSendingWorkflow = next.isSending && next.sendingScope === `workflow:${wf.id}`;
|
|
7106
|
+
btn.disabled = next.isSending;
|
|
7107
|
+
btn.textContent = isSendingWorkflow ? t("menu.sending") : wf.label;
|
|
7108
|
+
btn.addEventListener("click", () => {
|
|
7109
|
+
var _a3;
|
|
7110
|
+
if (wf.confirm) {
|
|
7111
|
+
dom.showConfirmDialog(t("workflow.confirm", { label: wf.label }), () => {
|
|
7112
|
+
var _a4;
|
|
7113
|
+
(_a4 = next.onWorkflow) == null ? void 0 : _a4.call(next, wf.id);
|
|
7114
|
+
});
|
|
7115
|
+
return;
|
|
7116
|
+
}
|
|
7117
|
+
(_a3 = next.onWorkflow) == null ? void 0 : _a3.call(next, wf.id);
|
|
7118
|
+
});
|
|
7119
|
+
workflowRow.appendChild(btn);
|
|
7120
|
+
}
|
|
6924
7121
|
const latestSession = next.latestSessionDetail;
|
|
6925
7122
|
const latestSessionSummary = next.latestSessionSummary;
|
|
6926
7123
|
latestSessionSection.style.display = latestSession || latestSessionSummary ? "" : "none";
|
|
@@ -7051,6 +7248,8 @@ var init_annotate_sidebar = __esm({
|
|
|
7051
7248
|
init_annotate_sidebar_helpers();
|
|
7052
7249
|
init_annotate_sidebar_dom();
|
|
7053
7250
|
init_annotate_sidebar_renderers();
|
|
7251
|
+
init_annotate_sidebar_helpers();
|
|
7252
|
+
init_styles();
|
|
7054
7253
|
init_i18n();
|
|
7055
7254
|
init_icons();
|
|
7056
7255
|
}
|
|
@@ -7324,7 +7523,6 @@ function configure(ctx, options) {
|
|
|
7324
7523
|
state.configLoadPromise = fetchIdeInfo(true).then((info) => {
|
|
7325
7524
|
if ((info == null ? void 0 : info.hotKeys) !== void 0) {
|
|
7326
7525
|
state.serverHotKeys = info.hotKeys;
|
|
7327
|
-
state.syncModeUi();
|
|
7328
7526
|
}
|
|
7329
7527
|
if ((info == null ? void 0 : info.theme) !== void 0) {
|
|
7330
7528
|
applyTheme(state, info.theme);
|
|
@@ -7332,6 +7530,9 @@ function configure(ctx, options) {
|
|
|
7332
7530
|
if ((info == null ? void 0 : info.annotateDeliveryMode) !== void 0) {
|
|
7333
7531
|
state.annotateDeliveryMode = info.annotateDeliveryMode;
|
|
7334
7532
|
}
|
|
7533
|
+
if ((info == null ? void 0 : info.workflows) !== void 0) {
|
|
7534
|
+
state.annotateWorkflows = info.workflows;
|
|
7535
|
+
}
|
|
7335
7536
|
if ((info == null ? void 0 : info.includeSnippet) !== void 0) {
|
|
7336
7537
|
state.options.includeSnippet = info.includeSnippet;
|
|
7337
7538
|
}
|
|
@@ -7339,6 +7540,9 @@ function configure(ctx, options) {
|
|
|
7339
7540
|
state.options.runtimeContext = __spreadValues(__spreadValues({}, state.options.runtimeContext), info.runtimeContext);
|
|
7340
7541
|
state.syncRuntimeContextCapture();
|
|
7341
7542
|
}
|
|
7543
|
+
if (state.mode === "annotate" && state.annotateSidebar) {
|
|
7544
|
+
state.updateAnnotateSidebar();
|
|
7545
|
+
}
|
|
7342
7546
|
}).catch(() => {
|
|
7343
7547
|
}).then(() => {
|
|
7344
7548
|
});
|
|
@@ -7552,7 +7756,8 @@ var init_component = __esm({
|
|
|
7552
7756
|
this.annotateErrorMessage = "";
|
|
7553
7757
|
this.annotateRuntimeContextEnabled = false;
|
|
7554
7758
|
this.annotateCssContextEnabled = false;
|
|
7555
|
-
this.annotateDeliveryMode = "
|
|
7759
|
+
this.annotateDeliveryMode = "agent";
|
|
7760
|
+
this.annotateWorkflows = [];
|
|
7556
7761
|
this.annotateSendState = {
|
|
7557
7762
|
isSending: false,
|
|
7558
7763
|
scope: null
|