@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
|
@@ -155,6 +155,7 @@ var annotateSidebarChipClass = "inspecto-annotate-sidebar-chip";
|
|
|
155
155
|
var annotateSidebarChipPanelClass = "inspecto-annotate-sidebar-chip-panel";
|
|
156
156
|
var annotateSidebarChipFieldClass = "inspecto-annotate-sidebar-chip-field";
|
|
157
157
|
var annotateSidebarHintClass = "inspecto-annotate-sidebar-hint";
|
|
158
|
+
var annotateConfirmDialogClass = "inspecto-annotate-confirm-dialog";
|
|
158
159
|
var tooltipClass = "inspecto-tooltip";
|
|
159
160
|
var tooltipTopClass = "inspecto-tooltip-top";
|
|
160
161
|
var tooltipBottomClass = "inspecto-tooltip-bottom";
|
|
@@ -504,7 +505,7 @@ var annotateStyles = `
|
|
|
504
505
|
.${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); }
|
|
505
506
|
.${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; }
|
|
506
507
|
.${annotateSidebarHeaderClass} .${runtimeToggleClass} { overflow: visible; }
|
|
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; }
|
|
508
|
+
.${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; }
|
|
508
509
|
.${annotateSidebarButtonClass}:hover { background: var(--inspecto-surface-hover); color: #ffffff; border-color: rgba(148, 163, 184, 0.12); transform: translateY(-1px); }
|
|
509
510
|
.${annotateSidebarButtonClass}:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
510
511
|
.${annotateSidebarClass} .${annotateSidebarButtonClass}.primary {
|
|
@@ -584,6 +585,73 @@ var annotateStyles = `
|
|
|
584
585
|
.${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; }
|
|
585
586
|
.${annotateSidebarSectionClass}[data-variant="full-prompt"] > summary::-webkit-details-marker { display: none; }
|
|
586
587
|
.${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; }
|
|
588
|
+
|
|
589
|
+
.${annotateConfirmDialogClass} {
|
|
590
|
+
position: absolute;
|
|
591
|
+
inset: 0;
|
|
592
|
+
z-index: 100;
|
|
593
|
+
display: flex;
|
|
594
|
+
align-items: center;
|
|
595
|
+
justify-content: center;
|
|
596
|
+
background: rgba(13, 20, 31, 0.5);
|
|
597
|
+
backdrop-filter: blur(4px);
|
|
598
|
+
-webkit-backdrop-filter: blur(4px);
|
|
599
|
+
border-radius: 28px;
|
|
600
|
+
}
|
|
601
|
+
.${annotateConfirmDialogClass} .content {
|
|
602
|
+
width: calc(100% - 48px);
|
|
603
|
+
background: rgba(30, 35, 45, 0.95);
|
|
604
|
+
border: 1px solid rgba(255, 255, 255, 0.12);
|
|
605
|
+
border-radius: 20px;
|
|
606
|
+
box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
|
|
607
|
+
padding: 18px;
|
|
608
|
+
display: flex;
|
|
609
|
+
flex-direction: column;
|
|
610
|
+
gap: 18px;
|
|
611
|
+
}
|
|
612
|
+
.${annotateConfirmDialogClass} p {
|
|
613
|
+
margin: 0;
|
|
614
|
+
font-size: 13px;
|
|
615
|
+
line-height: 1.5;
|
|
616
|
+
color: rgba(255, 255, 255, 0.9);
|
|
617
|
+
}
|
|
618
|
+
.${annotateConfirmDialogClass} .actions {
|
|
619
|
+
display: flex;
|
|
620
|
+
gap: 8px;
|
|
621
|
+
justify-content: flex-end;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
@keyframes inspecto-fade-out {
|
|
625
|
+
0% { opacity: 1; transform: translateY(0); }
|
|
626
|
+
100% { opacity: 0; transform: translateY(-4px); pointer-events: none; }
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
.inspecto-workflow-toast {
|
|
630
|
+
position: absolute;
|
|
631
|
+
bottom: calc(100% + 8px);
|
|
632
|
+
left: 50%;
|
|
633
|
+
transform: translateX(-50%);
|
|
634
|
+
background: rgba(28, 28, 28, 0.95);
|
|
635
|
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
636
|
+
border-radius: var(--inspecto-radius-pill);
|
|
637
|
+
box-shadow: var(--inspecto-shadow-floating);
|
|
638
|
+
backdrop-filter: blur(16px);
|
|
639
|
+
-webkit-backdrop-filter: blur(16px);
|
|
640
|
+
padding: 6px 14px;
|
|
641
|
+
z-index: 100;
|
|
642
|
+
font-size: 11px;
|
|
643
|
+
font-weight: 600;
|
|
644
|
+
color: #5ad496;
|
|
645
|
+
display: flex;
|
|
646
|
+
align-items: center;
|
|
647
|
+
gap: 6px;
|
|
648
|
+
pointer-events: none;
|
|
649
|
+
animation: inspecto-fade-out 0.3s ease 1.7s forwards;
|
|
650
|
+
}
|
|
651
|
+
.inspecto-workflow-toast::before {
|
|
652
|
+
content: '\u2713';
|
|
653
|
+
font-size: 12px;
|
|
654
|
+
}
|
|
587
655
|
`;
|
|
588
656
|
|
|
589
657
|
// src/styles-launcher.ts
|
|
@@ -1589,7 +1657,10 @@ var EN_MESSAGES = {
|
|
|
1589
1657
|
"runtime.summary.error.one": "{count} runtime error",
|
|
1590
1658
|
"runtime.summary.error.other": "{count} runtime errors",
|
|
1591
1659
|
"runtime.summary.request.one": "{count} failed request",
|
|
1592
|
-
"runtime.summary.request.other": "{count} failed requests"
|
|
1660
|
+
"runtime.summary.request.other": "{count} failed requests",
|
|
1661
|
+
"workflow.confirm": 'Confirm to execute "{label}"?',
|
|
1662
|
+
"workflow.confirm.ok": "Confirm",
|
|
1663
|
+
"workflow.feedback.executed": "Execution started"
|
|
1593
1664
|
};
|
|
1594
1665
|
var ZH_CN_MESSAGES = {
|
|
1595
1666
|
"launcher.panel.title": "\u9009\u62E9\u6A21\u5F0F",
|
|
@@ -1686,7 +1757,10 @@ var ZH_CN_MESSAGES = {
|
|
|
1686
1757
|
"runtime.summary.error.one": "{count} \u4E2A\u8FD0\u884C\u65F6\u9519\u8BEF",
|
|
1687
1758
|
"runtime.summary.error.other": "{count} \u4E2A\u8FD0\u884C\u65F6\u9519\u8BEF",
|
|
1688
1759
|
"runtime.summary.request.one": "{count} \u4E2A\u5931\u8D25\u8BF7\u6C42",
|
|
1689
|
-
"runtime.summary.request.other": "{count} \u4E2A\u5931\u8D25\u8BF7\u6C42"
|
|
1760
|
+
"runtime.summary.request.other": "{count} \u4E2A\u5931\u8D25\u8BF7\u6C42",
|
|
1761
|
+
"workflow.confirm": "\u786E\u8BA4\u6267\u884C\u300C{label}\u300D\uFF1F",
|
|
1762
|
+
"workflow.confirm.ok": "\u786E\u8BA4\u6267\u884C",
|
|
1763
|
+
"workflow.feedback.executed": "\u6267\u884C\u5DF2\u542F\u52A8"
|
|
1690
1764
|
};
|
|
1691
1765
|
var BUILTIN_MESSAGES = {
|
|
1692
1766
|
en: EN_MESSAGES,
|
|
@@ -3095,23 +3169,24 @@ function toAnnotationTransportFromRecordUi(_ctx, record) {
|
|
|
3095
3169
|
]
|
|
3096
3170
|
};
|
|
3097
3171
|
}
|
|
3098
|
-
function sendAnnotationBatch(ctx, annotations, scope, instruction, deliveryMode, onSuccess) {
|
|
3172
|
+
function sendAnnotationBatch(ctx, annotations, scope, instruction, deliveryMode, onSuccess, extraPayload) {
|
|
3099
3173
|
return __async(this, null, function* () {
|
|
3100
3174
|
var _a2, _b;
|
|
3101
3175
|
const state = asAnnotateContext(ctx);
|
|
3102
|
-
if (
|
|
3176
|
+
if (state.annotateSendState.isSending) return;
|
|
3177
|
+
if (annotations.length === 0 && (extraPayload == null ? void 0 : extraPayload.source) !== "workflow") return;
|
|
3103
3178
|
state.annotateSendState = { isSending: true, scope };
|
|
3104
3179
|
state.updateAnnotateSidebar();
|
|
3105
3180
|
try {
|
|
3106
3181
|
yield state.configLoadPromise;
|
|
3107
3182
|
const runtimeContext = state.getAnnotateRuntimeContext(annotations);
|
|
3108
3183
|
const cssContextPrompt = state.getAnnotateCssContextPrompt(annotations);
|
|
3109
|
-
const result = yield sendAnnotationsToAi(__spreadProps(__spreadValues(__spreadValues({
|
|
3184
|
+
const result = yield sendAnnotationsToAi(__spreadValues(__spreadProps(__spreadValues(__spreadValues({
|
|
3110
3185
|
instruction,
|
|
3111
3186
|
annotations
|
|
3112
3187
|
}, runtimeContext ? { runtimeContext } : {}), cssContextPrompt ? { cssContextPrompt } : {}), {
|
|
3113
3188
|
deliveryMode
|
|
3114
|
-
}));
|
|
3189
|
+
}), extraPayload || {}));
|
|
3115
3190
|
if (!result.success) {
|
|
3116
3191
|
state.annotateErrorMessage = toAnnotateErrorMessage(state, result.errorCode, result.error);
|
|
3117
3192
|
state.updateAnnotateSidebar();
|
|
@@ -3144,6 +3219,47 @@ function sendAnnotationBatch(ctx, annotations, scope, instruction, deliveryMode,
|
|
|
3144
3219
|
}
|
|
3145
3220
|
});
|
|
3146
3221
|
}
|
|
3222
|
+
function triggerWorkflow(ctx, workflowId) {
|
|
3223
|
+
return __async(this, null, function* () {
|
|
3224
|
+
var _a2;
|
|
3225
|
+
const state = asAnnotateContext(ctx);
|
|
3226
|
+
if (state.annotateSendState.isSending) return;
|
|
3227
|
+
const workflowPrompt = ((_a2 = state.annotateWorkflows.find((w) => w.id === workflowId)) == null ? void 0 : _a2.prompt) || "";
|
|
3228
|
+
if (!workflowPrompt.trim()) return;
|
|
3229
|
+
const scope = state.annotateDeliveryMode === "ide" ? "quick-ask" : "create-task";
|
|
3230
|
+
state.annotateSendState = { isSending: true, scope };
|
|
3231
|
+
state.updateAnnotateSidebar();
|
|
3232
|
+
try {
|
|
3233
|
+
yield state.configLoadPromise;
|
|
3234
|
+
const result = yield sendToAi({
|
|
3235
|
+
prompt: workflowPrompt
|
|
3236
|
+
});
|
|
3237
|
+
if (!result.success) {
|
|
3238
|
+
state.annotateErrorMessage = toAnnotateErrorMessage(state, result.errorCode, result.error);
|
|
3239
|
+
state.updateAnnotateSidebar();
|
|
3240
|
+
return;
|
|
3241
|
+
}
|
|
3242
|
+
state.annotateInstructionDraft = "";
|
|
3243
|
+
state.annotateSession = createEmptySession();
|
|
3244
|
+
state.annotateEditingRecord = null;
|
|
3245
|
+
state.annotateElements.clear();
|
|
3246
|
+
state.annotateErrorMessage = "";
|
|
3247
|
+
state.showAnnotateSuccess(scope);
|
|
3248
|
+
state.renderAnnotateSelectionOverlay();
|
|
3249
|
+
state.updateAnnotateSidebar();
|
|
3250
|
+
} catch (err) {
|
|
3251
|
+
state.annotateErrorMessage = toAnnotateErrorMessage(
|
|
3252
|
+
state,
|
|
3253
|
+
err.errorCode,
|
|
3254
|
+
err.message
|
|
3255
|
+
);
|
|
3256
|
+
state.updateAnnotateSidebar();
|
|
3257
|
+
} finally {
|
|
3258
|
+
state.annotateSendState = { isSending: false, scope: null };
|
|
3259
|
+
state.updateAnnotateSidebar();
|
|
3260
|
+
}
|
|
3261
|
+
});
|
|
3262
|
+
}
|
|
3147
3263
|
function refreshLatestAnnotateSession(ctx) {
|
|
3148
3264
|
return __async(this, null, function* () {
|
|
3149
3265
|
var _a2, _b, _c, _d;
|
|
@@ -3214,7 +3330,7 @@ function getAnnotateSidebarOptions(ctx) {
|
|
|
3214
3330
|
const fullInstruction = composeAnnotateInstruction(state);
|
|
3215
3331
|
const allRuntimeContext = state.getAnnotateRuntimeContext(allAnnotations);
|
|
3216
3332
|
const allCssContextPrompt = state.getAnnotateCssContextPrompt(allAnnotations);
|
|
3217
|
-
const deliveryPreference = (_a2 = state.annotateDeliveryMode) != null ? _a2 : "
|
|
3333
|
+
const deliveryPreference = (_a2 = state.annotateDeliveryMode) != null ? _a2 : "agent";
|
|
3218
3334
|
let preferredAction = "create-task";
|
|
3219
3335
|
if (deliveryPreference === "ide") preferredAction = "quick-ask";
|
|
3220
3336
|
if (deliveryPreference === "agent") preferredAction = "create-task";
|
|
@@ -3240,6 +3356,7 @@ function getAnnotateSidebarOptions(ctx) {
|
|
|
3240
3356
|
successScope: state.annotateSuccessScope,
|
|
3241
3357
|
preferredAction,
|
|
3242
3358
|
annotateDeliveryMode: state.annotateDeliveryMode,
|
|
3359
|
+
workflows: state.annotateWorkflows,
|
|
3243
3360
|
latestSessionSummary: state.annotateLatestSessionSummary,
|
|
3244
3361
|
latestSessionDetail: state.annotateLatestSessionDetail,
|
|
3245
3362
|
latestSessionLoading: state.annotateLatestSessionLoading,
|
|
@@ -3386,6 +3503,9 @@ function getAnnotateSidebarOptions(ctx) {
|
|
|
3386
3503
|
}
|
|
3387
3504
|
);
|
|
3388
3505
|
},
|
|
3506
|
+
onWorkflow: (workflowId) => {
|
|
3507
|
+
void triggerWorkflow(state, workflowId);
|
|
3508
|
+
},
|
|
3389
3509
|
onExit: () => {
|
|
3390
3510
|
state.setMode("inspect");
|
|
3391
3511
|
}
|
|
@@ -4415,6 +4535,7 @@ function resolveMenuPosition(input) {
|
|
|
4415
4535
|
}
|
|
4416
4536
|
|
|
4417
4537
|
// src/menu.ts
|
|
4538
|
+
import { isAiIntentConfig } from "@inspecto-dev/types";
|
|
4418
4539
|
function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose, deps = {}) {
|
|
4419
4540
|
var _a2, _b, _c;
|
|
4420
4541
|
const maxSnippetLines = (_a2 = options.maxSnippetLines) != null ? _a2 : 100;
|
|
@@ -4731,13 +4852,13 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
|
|
|
4731
4852
|
if (!options.askPlaceholder) {
|
|
4732
4853
|
input.placeholder = intents.length > 0 ? t("menu.ask.placeholder.default") : t("menu.ask.placeholder.fallback");
|
|
4733
4854
|
}
|
|
4734
|
-
const aiIntents = intents;
|
|
4855
|
+
const aiIntents = intents.filter(isAiIntentConfig);
|
|
4735
4856
|
const hasFixIntent = aiIntents.some(isFixIntent);
|
|
4736
4857
|
const hasNonFixIntent = aiIntents.some((intent) => !isFixIntent(intent));
|
|
4737
4858
|
runtimeContextDefaultMode = hasFixIntent ? hasNonFixIntent ? "mixed" : "all-on" : "off";
|
|
4738
4859
|
renderRuntimeContextUi();
|
|
4739
4860
|
const aiActions = createIntentActionButtons({
|
|
4740
|
-
intents,
|
|
4861
|
+
intents: aiIntents,
|
|
4741
4862
|
location,
|
|
4742
4863
|
includeSnippet,
|
|
4743
4864
|
maxSnippetLines,
|
|
@@ -5603,9 +5724,29 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5603
5724
|
const headerStatus = document.createElement("div");
|
|
5604
5725
|
headerStatus.setAttribute("data-inspecto-annotate-header-status", "true");
|
|
5605
5726
|
headerCopy.append(headerTitle, headerStatus);
|
|
5606
|
-
const
|
|
5607
|
-
|
|
5608
|
-
|
|
5727
|
+
const headerActionsLeft = document.createElement("div");
|
|
5728
|
+
headerActionsLeft.className = annotateSidebarActionsClass;
|
|
5729
|
+
headerActionsLeft.setAttribute("data-inspecto-annotate-header-actions-left", "true");
|
|
5730
|
+
const previewButton = createSidebarButton("</>", annotateSidebarButtonClass);
|
|
5731
|
+
previewButton.dataset.role = "raw-preview-toggle";
|
|
5732
|
+
previewButton.setAttribute("aria-label", t("annotate.previewRawPrompt"));
|
|
5733
|
+
previewButton.title = t("annotate.previewRawPrompt");
|
|
5734
|
+
const copyContextButton = createSidebarButton(
|
|
5735
|
+
'<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>',
|
|
5736
|
+
annotateSidebarButtonClass,
|
|
5737
|
+
true
|
|
5738
|
+
);
|
|
5739
|
+
copyContextButton.dataset.role = "raw-preview";
|
|
5740
|
+
copyContextButton.setAttribute("aria-label", t("annotate.copyContext"));
|
|
5741
|
+
copyContextButton.title = t("annotate.copyContext");
|
|
5742
|
+
headerActionsLeft.append(previewButton, copyContextButton);
|
|
5743
|
+
const headerActionsRight = document.createElement("div");
|
|
5744
|
+
headerActionsRight.className = annotateSidebarActionsClass;
|
|
5745
|
+
headerActionsRight.setAttribute("data-inspecto-annotate-header-actions-right", "true");
|
|
5746
|
+
const headerActionsContainer = document.createElement("div");
|
|
5747
|
+
headerActionsContainer.style.display = "flex";
|
|
5748
|
+
headerActionsContainer.style.gap = "8px";
|
|
5749
|
+
headerActionsContainer.style.alignItems = "center";
|
|
5609
5750
|
const quickCaptureButton = createSidebarButton(pureMarkIconSvg, annotateSidebarButtonClass, true);
|
|
5610
5751
|
quickCaptureButton.dataset.role = "quick-capture";
|
|
5611
5752
|
quickCaptureButton.classList.add(runtimeToggleClass);
|
|
@@ -5655,14 +5796,15 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5655
5796
|
exitButton.style.justifyContent = "center";
|
|
5656
5797
|
exitButton.setAttribute("aria-label", t("annotate.exitMode"));
|
|
5657
5798
|
exitButton.title = t("annotate.exitMode");
|
|
5658
|
-
|
|
5799
|
+
headerActionsRight.append(
|
|
5659
5800
|
quickCaptureButton,
|
|
5660
5801
|
cssContextButton,
|
|
5661
5802
|
runtimeContextButton,
|
|
5662
5803
|
modeButton,
|
|
5663
5804
|
exitButton
|
|
5664
5805
|
);
|
|
5665
|
-
|
|
5806
|
+
headerActionsContainer.append(headerActionsLeft, headerActionsRight);
|
|
5807
|
+
header.append(headerCopy, headerActionsContainer);
|
|
5666
5808
|
const emptyState = document.createElement("section");
|
|
5667
5809
|
emptyState.className = annotateSidebarSectionClass;
|
|
5668
5810
|
emptyState.dataset.variant = "empty-state";
|
|
@@ -5845,24 +5987,17 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5845
5987
|
footerActionRowContainer.style.justifyContent = "space-between";
|
|
5846
5988
|
footerActionRowContainer.style.width = "100%";
|
|
5847
5989
|
footerActionRowContainer.style.gap = "8px";
|
|
5990
|
+
const workflowRow = document.createElement("div");
|
|
5991
|
+
workflowRow.className = annotateSidebarActionsClass;
|
|
5992
|
+
workflowRow.style.display = "none";
|
|
5993
|
+
workflowRow.style.gap = "8px";
|
|
5994
|
+
workflowRow.style.width = "100%";
|
|
5848
5995
|
const footerLeftActions = document.createElement("div");
|
|
5849
5996
|
footerLeftActions.className = annotateSidebarActionsClass;
|
|
5850
5997
|
footerLeftActions.style.flex = "0 0 auto";
|
|
5851
5998
|
footerLeftActions.style.display = "none";
|
|
5852
5999
|
footerLeftActions.style.alignItems = "center";
|
|
5853
6000
|
footerLeftActions.style.gap = "8px";
|
|
5854
|
-
const previewButton = createSidebarButton("</>", annotateSidebarButtonClass);
|
|
5855
|
-
previewButton.dataset.role = "raw-preview-toggle";
|
|
5856
|
-
previewButton.setAttribute("aria-label", t("annotate.previewRawPrompt"));
|
|
5857
|
-
previewButton.title = t("annotate.previewRawPrompt");
|
|
5858
|
-
const copyContextButton = createSidebarButton(
|
|
5859
|
-
'<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>',
|
|
5860
|
-
annotateSidebarButtonClass,
|
|
5861
|
-
true
|
|
5862
|
-
);
|
|
5863
|
-
copyContextButton.dataset.role = "raw-preview";
|
|
5864
|
-
copyContextButton.setAttribute("aria-label", t("annotate.copyContext"));
|
|
5865
|
-
copyContextButton.title = t("annotate.copyContext");
|
|
5866
6001
|
const previewFloat = document.createElement("div");
|
|
5867
6002
|
previewFloat.dataset.inspectoAnnotateRawPreview = "true";
|
|
5868
6003
|
previewFloat.style.display = "none";
|
|
@@ -5889,6 +6024,50 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5889
6024
|
previewFloatContent.style.lineHeight = "1.4";
|
|
5890
6025
|
previewFloatContent.style.color = "rgba(255, 255, 255, 0.7)";
|
|
5891
6026
|
previewFloat.appendChild(previewFloatContent);
|
|
6027
|
+
const confirmDialog = document.createElement("div");
|
|
6028
|
+
confirmDialog.className = annotateConfirmDialogClass;
|
|
6029
|
+
confirmDialog.style.display = "none";
|
|
6030
|
+
const confirmContent = document.createElement("div");
|
|
6031
|
+
confirmContent.className = "content";
|
|
6032
|
+
const confirmMessage = document.createElement("p");
|
|
6033
|
+
const confirmActions = document.createElement("div");
|
|
6034
|
+
confirmActions.className = "actions";
|
|
6035
|
+
const confirmCancelBtn = createSidebarButton(t("annotate.cancel"), annotateSidebarButtonClass);
|
|
6036
|
+
confirmCancelBtn.dataset.emphasis = "secondary";
|
|
6037
|
+
const confirmOkBtn = createSidebarButton(t("workflow.confirm.ok"), annotateSidebarButtonClass);
|
|
6038
|
+
confirmOkBtn.classList.add("primary");
|
|
6039
|
+
confirmActions.append(confirmCancelBtn, confirmOkBtn);
|
|
6040
|
+
confirmContent.append(confirmMessage, confirmActions);
|
|
6041
|
+
confirmDialog.append(confirmContent);
|
|
6042
|
+
let currentConfirmCallback = null;
|
|
6043
|
+
confirmCancelBtn.addEventListener("click", (event) => {
|
|
6044
|
+
event.preventDefault();
|
|
6045
|
+
event.stopPropagation();
|
|
6046
|
+
confirmDialog.style.display = "none";
|
|
6047
|
+
currentConfirmCallback = null;
|
|
6048
|
+
});
|
|
6049
|
+
confirmOkBtn.addEventListener("click", (event) => {
|
|
6050
|
+
event.preventDefault();
|
|
6051
|
+
event.stopPropagation();
|
|
6052
|
+
confirmDialog.style.display = "none";
|
|
6053
|
+
if (currentConfirmCallback) {
|
|
6054
|
+
currentConfirmCallback();
|
|
6055
|
+
currentConfirmCallback = null;
|
|
6056
|
+
}
|
|
6057
|
+
const toast = document.createElement("div");
|
|
6058
|
+
toast.className = "inspecto-workflow-toast";
|
|
6059
|
+
toast.textContent = t("workflow.feedback.executed");
|
|
6060
|
+
workflowRow.style.position = "relative";
|
|
6061
|
+
workflowRow.appendChild(toast);
|
|
6062
|
+
setTimeout(() => {
|
|
6063
|
+
toast.remove();
|
|
6064
|
+
}, 2e3);
|
|
6065
|
+
});
|
|
6066
|
+
function showConfirmDialog(message, onConfirm) {
|
|
6067
|
+
confirmMessage.textContent = message;
|
|
6068
|
+
currentConfirmCallback = onConfirm;
|
|
6069
|
+
confirmDialog.style.display = "flex";
|
|
6070
|
+
}
|
|
5892
6071
|
function updateRawPromptPreviewPosition() {
|
|
5893
6072
|
const viewportPadding = 12;
|
|
5894
6073
|
const gap = 8;
|
|
@@ -5922,8 +6101,11 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5922
6101
|
if (!previewFloat.contains(clickTarget) && !previewButton.contains(clickTarget)) {
|
|
5923
6102
|
setRawPromptPreviewVisible(false);
|
|
5924
6103
|
}
|
|
6104
|
+
if (!confirmContent.contains(clickTarget) && !workflowRow.contains(clickTarget)) {
|
|
6105
|
+
confirmDialog.style.display = "none";
|
|
6106
|
+
currentConfirmCallback = null;
|
|
6107
|
+
}
|
|
5925
6108
|
});
|
|
5926
|
-
footerLeftActions.append(previewButton, copyContextButton);
|
|
5927
6109
|
const footerActions = document.createElement("div");
|
|
5928
6110
|
footerActions.className = annotateSidebarActionsClass;
|
|
5929
6111
|
footerActions.style.display = "flex";
|
|
@@ -5942,10 +6124,10 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5942
6124
|
createTaskButton.style.whiteSpace = "nowrap";
|
|
5943
6125
|
footerActions.append(quickAskButton, createTaskButton);
|
|
5944
6126
|
footerActionRowContainer.append(footerLeftActions, footerActions);
|
|
5945
|
-
footerActionRow.append(footerActionRowContainer);
|
|
6127
|
+
footerActionRow.append(footerActionRowContainer, workflowRow);
|
|
5946
6128
|
footerLayout.append(recommendedActionLabel, footerActionRow);
|
|
5947
6129
|
footer.append(previewFloat, statusMessage, errorMessage, footerLayout);
|
|
5948
|
-
element.append(header, emptyState, draftSection, footer);
|
|
6130
|
+
element.append(header, emptyState, draftSection, footer, confirmDialog);
|
|
5949
6131
|
shadowRoot.appendChild(element);
|
|
5950
6132
|
return {
|
|
5951
6133
|
element,
|
|
@@ -5958,6 +6140,7 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5958
6140
|
exitButton,
|
|
5959
6141
|
emptyState,
|
|
5960
6142
|
draftSection,
|
|
6143
|
+
workflowRow,
|
|
5961
6144
|
instructionInput,
|
|
5962
6145
|
includedSummary,
|
|
5963
6146
|
recordsList,
|
|
@@ -5982,7 +6165,8 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5982
6165
|
quickAskButton,
|
|
5983
6166
|
createTaskButton,
|
|
5984
6167
|
updateRawPromptPreviewPosition,
|
|
5985
|
-
setRawPromptPreviewVisible
|
|
6168
|
+
setRawPromptPreviewVisible,
|
|
6169
|
+
showConfirmDialog
|
|
5986
6170
|
};
|
|
5987
6171
|
}
|
|
5988
6172
|
|
|
@@ -6283,6 +6467,7 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
6283
6467
|
exitButton,
|
|
6284
6468
|
emptyState,
|
|
6285
6469
|
draftSection,
|
|
6470
|
+
workflowRow,
|
|
6286
6471
|
instructionInput,
|
|
6287
6472
|
includedSummary,
|
|
6288
6473
|
recordsList,
|
|
@@ -6509,7 +6694,7 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
6509
6694
|
const shouldShowBody = hasSavedRecords || hasCurrentDraft || next.isSending || next.successScope === "quick-ask" || Boolean(next.errorMessage);
|
|
6510
6695
|
const canSend = next.isSending ? false : next.includedRecords.length > 0 || hasCurrentDraft;
|
|
6511
6696
|
const preferredAction = (_a2 = next.preferredAction) != null ? _a2 : "create-task";
|
|
6512
|
-
const deliveryPreference = (_b = next.annotateDeliveryMode) != null ? _b : "
|
|
6697
|
+
const deliveryPreference = (_b = next.annotateDeliveryMode) != null ? _b : "agent";
|
|
6513
6698
|
const showDebugHelperActions = deliveryPreference !== "agent";
|
|
6514
6699
|
element.style.display = "";
|
|
6515
6700
|
emptyState.style.display = shouldShowBody ? "none" : "";
|
|
@@ -6557,37 +6742,23 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
6557
6742
|
}
|
|
6558
6743
|
includedSummary.textContent = `Element notes (${next.includedRecords.length})`;
|
|
6559
6744
|
renderers.renderIncludedRecords(next.includedRecords, recordsList);
|
|
6560
|
-
const allowQuickAsk = deliveryPreference === "
|
|
6561
|
-
const allowCreateTask = deliveryPreference === "
|
|
6562
|
-
const onlyOneAction = allowQuickAsk !== allowCreateTask;
|
|
6745
|
+
const allowQuickAsk = deliveryPreference === "ide";
|
|
6746
|
+
const allowCreateTask = deliveryPreference === "agent";
|
|
6563
6747
|
quickAskButton.style.display = allowQuickAsk ? "" : "none";
|
|
6564
6748
|
createTaskButton.style.display = allowCreateTask ? "" : "none";
|
|
6565
6749
|
quickAskButton.disabled = !canSend;
|
|
6566
6750
|
createTaskButton.disabled = !canSend;
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
createTaskButton.dataset.layoutRole = "primary";
|
|
6576
|
-
} else {
|
|
6577
|
-
quickAskButton.classList.toggle("primary", false);
|
|
6578
|
-
createTaskButton.classList.toggle("primary", false);
|
|
6579
|
-
quickAskButton.dataset.emphasis = preferredAction === "quick-ask" ? "primary" : "secondary";
|
|
6580
|
-
createTaskButton.dataset.emphasis = preferredAction === "create-task" ? "primary" : "secondary";
|
|
6581
|
-
quickAskButton.dataset.layoutRole = preferredAction === "quick-ask" ? "primary" : "secondary";
|
|
6582
|
-
createTaskButton.dataset.layoutRole = preferredAction === "create-task" ? "primary" : "secondary";
|
|
6583
|
-
quickAskButton.style.order = "1";
|
|
6584
|
-
createTaskButton.style.order = "2";
|
|
6585
|
-
quickAskButton.style.flex = "1";
|
|
6586
|
-
createTaskButton.style.flex = "1";
|
|
6587
|
-
}
|
|
6751
|
+
quickAskButton.classList.toggle("primary", true);
|
|
6752
|
+
createTaskButton.classList.toggle("primary", true);
|
|
6753
|
+
quickAskButton.dataset.emphasis = "primary";
|
|
6754
|
+
createTaskButton.dataset.emphasis = "primary";
|
|
6755
|
+
quickAskButton.style.flex = "1";
|
|
6756
|
+
createTaskButton.style.flex = "1";
|
|
6757
|
+
quickAskButton.dataset.layoutRole = "primary";
|
|
6758
|
+
createTaskButton.dataset.layoutRole = "primary";
|
|
6588
6759
|
quickAskButton.title = t("annotate.askAiHint");
|
|
6589
6760
|
createTaskButton.title = t("annotate.createTaskHint");
|
|
6590
|
-
recommendedActionLabel.style.display =
|
|
6761
|
+
recommendedActionLabel.style.display = "none";
|
|
6591
6762
|
recommendedActionLabel.textContent = preferredAction === "quick-ask" ? t("annotate.recommendedAction.askHint", {
|
|
6592
6763
|
action: t("annotate.askAi")
|
|
6593
6764
|
}) : t("annotate.recommendedAction.agentHint", {
|
|
@@ -6595,6 +6766,31 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
6595
6766
|
});
|
|
6596
6767
|
quickAskButton.textContent = next.isSending && next.sendingScope === "quick-ask" ? t("menu.sending") : !next.isSending && next.successScope === "quick-ask" ? t("annotate.sent") : t("annotate.askAi");
|
|
6597
6768
|
createTaskButton.textContent = next.isSending && next.sendingScope === "create-task" ? t("menu.sending") : t("annotate.createTask");
|
|
6769
|
+
const workflows = next.workflows || [];
|
|
6770
|
+
workflowRow.style.display = workflows.length > 0 ? "flex" : "none";
|
|
6771
|
+
workflowRow.innerHTML = "";
|
|
6772
|
+
for (const wf of workflows) {
|
|
6773
|
+
const btn = createSidebarButton(wf.label, annotateSidebarButtonClass);
|
|
6774
|
+
btn.dataset.workflowId = wf.id;
|
|
6775
|
+
btn.style.flex = "1";
|
|
6776
|
+
btn.style.justifyContent = "center";
|
|
6777
|
+
btn.style.whiteSpace = "nowrap";
|
|
6778
|
+
const isSendingWorkflow = next.isSending && next.sendingScope === `workflow:${wf.id}`;
|
|
6779
|
+
btn.disabled = next.isSending;
|
|
6780
|
+
btn.textContent = isSendingWorkflow ? t("menu.sending") : wf.label;
|
|
6781
|
+
btn.addEventListener("click", () => {
|
|
6782
|
+
var _a3;
|
|
6783
|
+
if (wf.confirm) {
|
|
6784
|
+
dom.showConfirmDialog(t("workflow.confirm", { label: wf.label }), () => {
|
|
6785
|
+
var _a4;
|
|
6786
|
+
(_a4 = next.onWorkflow) == null ? void 0 : _a4.call(next, wf.id);
|
|
6787
|
+
});
|
|
6788
|
+
return;
|
|
6789
|
+
}
|
|
6790
|
+
(_a3 = next.onWorkflow) == null ? void 0 : _a3.call(next, wf.id);
|
|
6791
|
+
});
|
|
6792
|
+
workflowRow.appendChild(btn);
|
|
6793
|
+
}
|
|
6598
6794
|
const latestSession = next.latestSessionDetail;
|
|
6599
6795
|
const latestSessionSummary = next.latestSessionSummary;
|
|
6600
6796
|
latestSessionSection.style.display = latestSession || latestSessionSummary ? "" : "none";
|
|
@@ -6974,7 +7170,6 @@ function configure(ctx, options) {
|
|
|
6974
7170
|
state.configLoadPromise = fetchIdeInfo(true).then((info) => {
|
|
6975
7171
|
if ((info == null ? void 0 : info.hotKeys) !== void 0) {
|
|
6976
7172
|
state.serverHotKeys = info.hotKeys;
|
|
6977
|
-
state.syncModeUi();
|
|
6978
7173
|
}
|
|
6979
7174
|
if ((info == null ? void 0 : info.theme) !== void 0) {
|
|
6980
7175
|
applyTheme(state, info.theme);
|
|
@@ -6982,6 +7177,9 @@ function configure(ctx, options) {
|
|
|
6982
7177
|
if ((info == null ? void 0 : info.annotateDeliveryMode) !== void 0) {
|
|
6983
7178
|
state.annotateDeliveryMode = info.annotateDeliveryMode;
|
|
6984
7179
|
}
|
|
7180
|
+
if ((info == null ? void 0 : info.workflows) !== void 0) {
|
|
7181
|
+
state.annotateWorkflows = info.workflows;
|
|
7182
|
+
}
|
|
6985
7183
|
if ((info == null ? void 0 : info.includeSnippet) !== void 0) {
|
|
6986
7184
|
state.options.includeSnippet = info.includeSnippet;
|
|
6987
7185
|
}
|
|
@@ -6989,6 +7187,9 @@ function configure(ctx, options) {
|
|
|
6989
7187
|
state.options.runtimeContext = __spreadValues(__spreadValues({}, state.options.runtimeContext), info.runtimeContext);
|
|
6990
7188
|
state.syncRuntimeContextCapture();
|
|
6991
7189
|
}
|
|
7190
|
+
if (state.mode === "annotate" && state.annotateSidebar) {
|
|
7191
|
+
state.updateAnnotateSidebar();
|
|
7192
|
+
}
|
|
6992
7193
|
}).catch(() => {
|
|
6993
7194
|
}).then(() => {
|
|
6994
7195
|
});
|
|
@@ -7167,7 +7368,8 @@ var InspectoElement = class extends BaseElement {
|
|
|
7167
7368
|
this.annotateErrorMessage = "";
|
|
7168
7369
|
this.annotateRuntimeContextEnabled = false;
|
|
7169
7370
|
this.annotateCssContextEnabled = false;
|
|
7170
|
-
this.annotateDeliveryMode = "
|
|
7371
|
+
this.annotateDeliveryMode = "agent";
|
|
7372
|
+
this.annotateWorkflows = [];
|
|
7171
7373
|
this.annotateSendState = {
|
|
7172
7374
|
isSending: false,
|
|
7173
7375
|
scope: null
|
|
@@ -7418,4 +7620,4 @@ if (typeof customElements !== "undefined" && !customElements.get("inspecto-overl
|
|
|
7418
7620
|
export {
|
|
7419
7621
|
InspectoElement
|
|
7420
7622
|
};
|
|
7421
|
-
//# sourceMappingURL=component-
|
|
7623
|
+
//# sourceMappingURL=component-X56HVYBS.js.map
|