@inspecto-dev/core 0.3.9 → 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-MYXLDDWZ.js → component-X56HVYBS.js} +269 -62
- package/dist/component-X56HVYBS.js.map +1 -0
- package/dist/index.cjs +272 -62
- 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-MYXLDDWZ.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,
|
|
@@ -2799,7 +2873,7 @@ function formatRuntimeRecord(record) {
|
|
|
2799
2873
|
|
|
2800
2874
|
// src/http.ts
|
|
2801
2875
|
import { INSPECTO_API_PATHS } from "@inspecto-dev/types";
|
|
2802
|
-
var BASE_URL = globalThis.__AI_INSPECTOR_SERVER_URL__ || "http://
|
|
2876
|
+
var BASE_URL = globalThis.__AI_INSPECTOR_SERVER_URL__ || "http://127.0.0.1:5678";
|
|
2803
2877
|
var _a;
|
|
2804
2878
|
var AI_BATCH_DISPATCH_PATH = (_a = INSPECTO_API_PATHS.AI_BATCH_DISPATCH) != null ? _a : "/inspecto/api/v1/ai/dispatch/annotations";
|
|
2805
2879
|
function setBaseUrl(url) {
|
|
@@ -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";
|
|
@@ -5774,7 +5916,12 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5774
5916
|
latestSessionRefreshButton.style.fontSize = "12px";
|
|
5775
5917
|
latestSessionRefreshButton.title = t("annotate.latestSession.refresh");
|
|
5776
5918
|
latestSessionRefreshButton.style.marginLeft = "auto";
|
|
5777
|
-
latestSessionHeader.append(
|
|
5919
|
+
latestSessionHeader.append(
|
|
5920
|
+
latestSessionTitle,
|
|
5921
|
+
latestSessionStatus,
|
|
5922
|
+
latestSessionMeta,
|
|
5923
|
+
latestSessionRefreshButton
|
|
5924
|
+
);
|
|
5778
5925
|
const latestSessionMessage = document.createElement("div");
|
|
5779
5926
|
latestSessionMessage.className = annotateSidebarTextClass;
|
|
5780
5927
|
latestSessionMessage.style.fontSize = "12px";
|
|
@@ -5840,24 +5987,17 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5840
5987
|
footerActionRowContainer.style.justifyContent = "space-between";
|
|
5841
5988
|
footerActionRowContainer.style.width = "100%";
|
|
5842
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%";
|
|
5843
5995
|
const footerLeftActions = document.createElement("div");
|
|
5844
5996
|
footerLeftActions.className = annotateSidebarActionsClass;
|
|
5845
5997
|
footerLeftActions.style.flex = "0 0 auto";
|
|
5846
5998
|
footerLeftActions.style.display = "none";
|
|
5847
5999
|
footerLeftActions.style.alignItems = "center";
|
|
5848
6000
|
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");
|
|
5861
6001
|
const previewFloat = document.createElement("div");
|
|
5862
6002
|
previewFloat.dataset.inspectoAnnotateRawPreview = "true";
|
|
5863
6003
|
previewFloat.style.display = "none";
|
|
@@ -5884,6 +6024,50 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5884
6024
|
previewFloatContent.style.lineHeight = "1.4";
|
|
5885
6025
|
previewFloatContent.style.color = "rgba(255, 255, 255, 0.7)";
|
|
5886
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
|
+
}
|
|
5887
6071
|
function updateRawPromptPreviewPosition() {
|
|
5888
6072
|
const viewportPadding = 12;
|
|
5889
6073
|
const gap = 8;
|
|
@@ -5917,8 +6101,11 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5917
6101
|
if (!previewFloat.contains(clickTarget) && !previewButton.contains(clickTarget)) {
|
|
5918
6102
|
setRawPromptPreviewVisible(false);
|
|
5919
6103
|
}
|
|
6104
|
+
if (!confirmContent.contains(clickTarget) && !workflowRow.contains(clickTarget)) {
|
|
6105
|
+
confirmDialog.style.display = "none";
|
|
6106
|
+
currentConfirmCallback = null;
|
|
6107
|
+
}
|
|
5920
6108
|
});
|
|
5921
|
-
footerLeftActions.append(previewButton, copyContextButton);
|
|
5922
6109
|
const footerActions = document.createElement("div");
|
|
5923
6110
|
footerActions.className = annotateSidebarActionsClass;
|
|
5924
6111
|
footerActions.style.display = "flex";
|
|
@@ -5937,10 +6124,10 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5937
6124
|
createTaskButton.style.whiteSpace = "nowrap";
|
|
5938
6125
|
footerActions.append(quickAskButton, createTaskButton);
|
|
5939
6126
|
footerActionRowContainer.append(footerLeftActions, footerActions);
|
|
5940
|
-
footerActionRow.append(footerActionRowContainer);
|
|
6127
|
+
footerActionRow.append(footerActionRowContainer, workflowRow);
|
|
5941
6128
|
footerLayout.append(recommendedActionLabel, footerActionRow);
|
|
5942
6129
|
footer.append(previewFloat, statusMessage, errorMessage, footerLayout);
|
|
5943
|
-
element.append(header, emptyState, draftSection, footer);
|
|
6130
|
+
element.append(header, emptyState, draftSection, footer, confirmDialog);
|
|
5944
6131
|
shadowRoot.appendChild(element);
|
|
5945
6132
|
return {
|
|
5946
6133
|
element,
|
|
@@ -5953,6 +6140,7 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5953
6140
|
exitButton,
|
|
5954
6141
|
emptyState,
|
|
5955
6142
|
draftSection,
|
|
6143
|
+
workflowRow,
|
|
5956
6144
|
instructionInput,
|
|
5957
6145
|
includedSummary,
|
|
5958
6146
|
recordsList,
|
|
@@ -5977,7 +6165,8 @@ function createAnnotateSidebarDom(shadowRoot) {
|
|
|
5977
6165
|
quickAskButton,
|
|
5978
6166
|
createTaskButton,
|
|
5979
6167
|
updateRawPromptPreviewPosition,
|
|
5980
|
-
setRawPromptPreviewVisible
|
|
6168
|
+
setRawPromptPreviewVisible,
|
|
6169
|
+
showConfirmDialog
|
|
5981
6170
|
};
|
|
5982
6171
|
}
|
|
5983
6172
|
|
|
@@ -6278,6 +6467,7 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
6278
6467
|
exitButton,
|
|
6279
6468
|
emptyState,
|
|
6280
6469
|
draftSection,
|
|
6470
|
+
workflowRow,
|
|
6281
6471
|
instructionInput,
|
|
6282
6472
|
includedSummary,
|
|
6283
6473
|
recordsList,
|
|
@@ -6504,7 +6694,7 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
6504
6694
|
const shouldShowBody = hasSavedRecords || hasCurrentDraft || next.isSending || next.successScope === "quick-ask" || Boolean(next.errorMessage);
|
|
6505
6695
|
const canSend = next.isSending ? false : next.includedRecords.length > 0 || hasCurrentDraft;
|
|
6506
6696
|
const preferredAction = (_a2 = next.preferredAction) != null ? _a2 : "create-task";
|
|
6507
|
-
const deliveryPreference = (_b = next.annotateDeliveryMode) != null ? _b : "
|
|
6697
|
+
const deliveryPreference = (_b = next.annotateDeliveryMode) != null ? _b : "agent";
|
|
6508
6698
|
const showDebugHelperActions = deliveryPreference !== "agent";
|
|
6509
6699
|
element.style.display = "";
|
|
6510
6700
|
emptyState.style.display = shouldShowBody ? "none" : "";
|
|
@@ -6552,37 +6742,23 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
6552
6742
|
}
|
|
6553
6743
|
includedSummary.textContent = `Element notes (${next.includedRecords.length})`;
|
|
6554
6744
|
renderers.renderIncludedRecords(next.includedRecords, recordsList);
|
|
6555
|
-
const allowQuickAsk = deliveryPreference === "
|
|
6556
|
-
const allowCreateTask = deliveryPreference === "
|
|
6557
|
-
const onlyOneAction = allowQuickAsk !== allowCreateTask;
|
|
6745
|
+
const allowQuickAsk = deliveryPreference === "ide";
|
|
6746
|
+
const allowCreateTask = deliveryPreference === "agent";
|
|
6558
6747
|
quickAskButton.style.display = allowQuickAsk ? "" : "none";
|
|
6559
6748
|
createTaskButton.style.display = allowCreateTask ? "" : "none";
|
|
6560
6749
|
quickAskButton.disabled = !canSend;
|
|
6561
6750
|
createTaskButton.disabled = !canSend;
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
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
|
-
}
|
|
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";
|
|
6583
6759
|
quickAskButton.title = t("annotate.askAiHint");
|
|
6584
6760
|
createTaskButton.title = t("annotate.createTaskHint");
|
|
6585
|
-
recommendedActionLabel.style.display =
|
|
6761
|
+
recommendedActionLabel.style.display = "none";
|
|
6586
6762
|
recommendedActionLabel.textContent = preferredAction === "quick-ask" ? t("annotate.recommendedAction.askHint", {
|
|
6587
6763
|
action: t("annotate.askAi")
|
|
6588
6764
|
}) : t("annotate.recommendedAction.agentHint", {
|
|
@@ -6590,6 +6766,31 @@ function createAnnotateSidebar(shadowRoot, options) {
|
|
|
6590
6766
|
});
|
|
6591
6767
|
quickAskButton.textContent = next.isSending && next.sendingScope === "quick-ask" ? t("menu.sending") : !next.isSending && next.successScope === "quick-ask" ? t("annotate.sent") : t("annotate.askAi");
|
|
6592
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
|
+
}
|
|
6593
6794
|
const latestSession = next.latestSessionDetail;
|
|
6594
6795
|
const latestSessionSummary = next.latestSessionSummary;
|
|
6595
6796
|
latestSessionSection.style.display = latestSession || latestSessionSummary ? "" : "none";
|
|
@@ -6969,7 +7170,6 @@ function configure(ctx, options) {
|
|
|
6969
7170
|
state.configLoadPromise = fetchIdeInfo(true).then((info) => {
|
|
6970
7171
|
if ((info == null ? void 0 : info.hotKeys) !== void 0) {
|
|
6971
7172
|
state.serverHotKeys = info.hotKeys;
|
|
6972
|
-
state.syncModeUi();
|
|
6973
7173
|
}
|
|
6974
7174
|
if ((info == null ? void 0 : info.theme) !== void 0) {
|
|
6975
7175
|
applyTheme(state, info.theme);
|
|
@@ -6977,6 +7177,9 @@ function configure(ctx, options) {
|
|
|
6977
7177
|
if ((info == null ? void 0 : info.annotateDeliveryMode) !== void 0) {
|
|
6978
7178
|
state.annotateDeliveryMode = info.annotateDeliveryMode;
|
|
6979
7179
|
}
|
|
7180
|
+
if ((info == null ? void 0 : info.workflows) !== void 0) {
|
|
7181
|
+
state.annotateWorkflows = info.workflows;
|
|
7182
|
+
}
|
|
6980
7183
|
if ((info == null ? void 0 : info.includeSnippet) !== void 0) {
|
|
6981
7184
|
state.options.includeSnippet = info.includeSnippet;
|
|
6982
7185
|
}
|
|
@@ -6984,6 +7187,9 @@ function configure(ctx, options) {
|
|
|
6984
7187
|
state.options.runtimeContext = __spreadValues(__spreadValues({}, state.options.runtimeContext), info.runtimeContext);
|
|
6985
7188
|
state.syncRuntimeContextCapture();
|
|
6986
7189
|
}
|
|
7190
|
+
if (state.mode === "annotate" && state.annotateSidebar) {
|
|
7191
|
+
state.updateAnnotateSidebar();
|
|
7192
|
+
}
|
|
6987
7193
|
}).catch(() => {
|
|
6988
7194
|
}).then(() => {
|
|
6989
7195
|
});
|
|
@@ -7162,7 +7368,8 @@ var InspectoElement = class extends BaseElement {
|
|
|
7162
7368
|
this.annotateErrorMessage = "";
|
|
7163
7369
|
this.annotateRuntimeContextEnabled = false;
|
|
7164
7370
|
this.annotateCssContextEnabled = false;
|
|
7165
|
-
this.annotateDeliveryMode = "
|
|
7371
|
+
this.annotateDeliveryMode = "agent";
|
|
7372
|
+
this.annotateWorkflows = [];
|
|
7166
7373
|
this.annotateSendState = {
|
|
7167
7374
|
isSending: false,
|
|
7168
7375
|
scope: null
|
|
@@ -7413,4 +7620,4 @@ if (typeof customElements !== "undefined" && !customElements.get("inspecto-overl
|
|
|
7413
7620
|
export {
|
|
7414
7621
|
InspectoElement
|
|
7415
7622
|
};
|
|
7416
|
-
//# sourceMappingURL=component-
|
|
7623
|
+
//# sourceMappingURL=component-X56HVYBS.js.map
|