@spotpatch/runtime 1.13.0 → 1.14.0
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/chunk-KIDHJQRG.js +14 -0
- package/dist/chunk-KIDHJQRG.js.map +1 -0
- package/dist/contextual-ask-panel.cjs +1637 -0
- package/dist/contextual-ask-panel.cjs.map +1 -0
- package/dist/contextual-ask-panel.d.cts +163 -0
- package/dist/contextual-ask-panel.d.ts +163 -0
- package/dist/contextual-ask-panel.js +1593 -0
- package/dist/contextual-ask-panel.js.map +1 -0
- package/dist/index.cjs +93 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +90 -5
- package/dist/index.js.map +1 -1
- package/dist/motion-extension-contract-B3m26CML.d.cts +72 -0
- package/dist/motion-extension-contract-B3m26CML.d.ts +72 -0
- package/dist/motion.d.cts +3 -71
- package/dist/motion.d.ts +3 -71
- package/package.json +15 -2
package/dist/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getContextualAskExtension
|
|
3
|
+
} from "./chunk-KIDHJQRG.js";
|
|
1
4
|
import {
|
|
2
5
|
getDataFlowExtension
|
|
3
6
|
} from "./chunk-NII5OBAN.js";
|
|
@@ -435,7 +438,7 @@ function omitBrowserCodeContext(request) {
|
|
|
435
438
|
};
|
|
436
439
|
}
|
|
437
440
|
function runtimeApiErrorCode(error) {
|
|
438
|
-
return error instanceof RuntimeApiError ? error.code : void 0;
|
|
441
|
+
return error instanceof RuntimeApiError && isAgentErrorCode(error.code) ? error.code : void 0;
|
|
439
442
|
}
|
|
440
443
|
function createRuntimeApi(options) {
|
|
441
444
|
const pendingRequests = /* @__PURE__ */ new Set();
|
|
@@ -4226,7 +4229,7 @@ function createUnavailableDataFlowPanel(document, changesRoot, diagnosticsRoot)
|
|
|
4226
4229
|
resetView: () => void 0
|
|
4227
4230
|
});
|
|
4228
4231
|
}
|
|
4229
|
-
function createRuntimeView(document, shortcut, ai = Object.freeze({ enabled: false }), localePreference = "auto", dataFlowEnabled = false, externalAgentEnabled = false, framework = "vite", sessionId = "") {
|
|
4232
|
+
function createRuntimeView(document, shortcut, ai = Object.freeze({ enabled: false }), localePreference = "auto", dataFlowEnabled = false, externalAgentEnabled = false, framework = "vite", sessionId = "", contextualAskEnabled = false) {
|
|
4230
4233
|
const localizer = createUiLocalizer(document, localePreference);
|
|
4231
4234
|
const associatedWindow = document.defaultView;
|
|
4232
4235
|
if (associatedWindow === null) {
|
|
@@ -4240,6 +4243,9 @@ function createRuntimeView(document, shortcut, ai = Object.freeze({ enabled: fal
|
|
|
4240
4243
|
);
|
|
4241
4244
|
let messages = localizer.messages();
|
|
4242
4245
|
let currentStatus = "idle";
|
|
4246
|
+
let contextualAskMode = "change";
|
|
4247
|
+
let contextualAskTitle = "";
|
|
4248
|
+
let contextualAskSubtitle = "";
|
|
4243
4249
|
let plannerVisible = false;
|
|
4244
4250
|
let executionSuppressed = false;
|
|
4245
4251
|
let executionProjection;
|
|
@@ -4449,6 +4455,29 @@ function createRuntimeView(document, shortcut, ai = Object.freeze({ enabled: fal
|
|
|
4449
4455
|
backButton
|
|
4450
4456
|
);
|
|
4451
4457
|
actions.append(editorFeedback, secondaryActions, primaryActions);
|
|
4458
|
+
const contextualAskPanel = contextualAskEnabled ? getContextualAskExtension()?.createPanel({
|
|
4459
|
+
document,
|
|
4460
|
+
locale: localizer.locale,
|
|
4461
|
+
subscribeLocale: localizer.subscribe,
|
|
4462
|
+
changeRoot: dataFlowPanel.root,
|
|
4463
|
+
changeActions: actions,
|
|
4464
|
+
announce,
|
|
4465
|
+
onModeChange(mode, askTitle, askSubtitle) {
|
|
4466
|
+
contextualAskMode = mode;
|
|
4467
|
+
contextualAskTitle = askTitle;
|
|
4468
|
+
contextualAskSubtitle = askSubtitle;
|
|
4469
|
+
if (host.isConnected) renderPanelStatus(currentStatus);
|
|
4470
|
+
},
|
|
4471
|
+
onExecutionChange(projection) {
|
|
4472
|
+
executionProjection = projection;
|
|
4473
|
+
executionSuppressed = false;
|
|
4474
|
+
renderFloatingSurfaceMotion();
|
|
4475
|
+
},
|
|
4476
|
+
onViewChange: requestFloatingSurfaceLayout
|
|
4477
|
+
}) : void 0;
|
|
4478
|
+
if (contextualAskPanel !== void 0) {
|
|
4479
|
+
selectionPanel.prepend(contextualAskPanel.root);
|
|
4480
|
+
}
|
|
4452
4481
|
shell.append(header, body, actions);
|
|
4453
4482
|
dialog.append(shell);
|
|
4454
4483
|
const liveRegion = createMarkedElement(document, "div");
|
|
@@ -4459,6 +4488,7 @@ function createRuntimeView(document, shortcut, ai = Object.freeze({ enabled: fal
|
|
|
4459
4488
|
createStyles(document),
|
|
4460
4489
|
...motionExtension === void 0 ? [] : [motionExtension.createStyles(document)],
|
|
4461
4490
|
dataFlowPanel.styles,
|
|
4491
|
+
...contextualAskPanel === void 0 ? [] : [contextualAskPanel.styles],
|
|
4462
4492
|
...externalHandoffPanel === void 0 ? [] : [externalHandoffPanel.styles]
|
|
4463
4493
|
];
|
|
4464
4494
|
const styleNonce = resolveStyleNonce(document);
|
|
@@ -5011,6 +5041,11 @@ function createRuntimeView(document, shortcut, ai = Object.freeze({ enabled: fal
|
|
|
5011
5041
|
previewButton.disabled = !canPreview;
|
|
5012
5042
|
agentPanel.setContextReady(canPreview);
|
|
5013
5043
|
externalHandoffPanel?.setContextReady(canPreview);
|
|
5044
|
+
contextualAskPanel?.setSelectionPreview({
|
|
5045
|
+
contextReady: currentTargets.every((target2) => target2.status !== "loading"),
|
|
5046
|
+
targetCount: currentTargets.length,
|
|
5047
|
+
sourceCount: currentTargets.filter((target2) => target2.canOpenEditor).length
|
|
5048
|
+
});
|
|
5014
5049
|
updateContextOverview(summaryText);
|
|
5015
5050
|
requestFloatingSurfaceLayout();
|
|
5016
5051
|
}
|
|
@@ -5027,10 +5062,11 @@ function createRuntimeView(document, shortcut, ai = Object.freeze({ enabled: fal
|
|
|
5027
5062
|
secondaryActions.hidden = !selected;
|
|
5028
5063
|
agentPanel.setSelectionVisible(selected);
|
|
5029
5064
|
externalHandoffPanel?.setSelectionVisible(selected);
|
|
5065
|
+
contextualAskPanel?.setSelectionVisible(selected);
|
|
5030
5066
|
copyButton.hidden = !previewing;
|
|
5031
5067
|
backButton.hidden = !previewing;
|
|
5032
|
-
title.textContent = previewing ? messages.dialog.previewTitle : messages.dialog.editTitle;
|
|
5033
|
-
subtitle.textContent = previewing ? messages.dialog.previewSubtitle : messages.dialog.editSubtitle;
|
|
5068
|
+
title.textContent = previewing ? messages.dialog.previewTitle : contextualAskMode === "ask" && contextualAskTitle.length > 0 ? contextualAskTitle : messages.dialog.editTitle;
|
|
5069
|
+
subtitle.textContent = previewing ? messages.dialog.previewSubtitle : contextualAskMode === "ask" && contextualAskSubtitle.length > 0 ? contextualAskSubtitle : messages.dialog.editSubtitle;
|
|
5034
5070
|
renderFloatingSurfaceMotion();
|
|
5035
5071
|
}
|
|
5036
5072
|
function applyMessages() {
|
|
@@ -5165,6 +5201,7 @@ function createRuntimeView(document, shortcut, ai = Object.freeze({ enabled: fal
|
|
|
5165
5201
|
agentRevertButton: agentPanel.revertButton,
|
|
5166
5202
|
agentResetButton: agentPanel.resetButton,
|
|
5167
5203
|
...externalHandoffPanel === void 0 ? {} : { externalHandoffPanel },
|
|
5204
|
+
...contextualAskPanel === void 0 ? {} : { contextualAskPanel },
|
|
5168
5205
|
renderStatus(status) {
|
|
5169
5206
|
const inspecting = status === "inspecting";
|
|
5170
5207
|
if (status === "idle" || inspecting) {
|
|
@@ -5238,6 +5275,7 @@ function createRuntimeView(document, shortcut, ai = Object.freeze({ enabled: fal
|
|
|
5238
5275
|
agentPanel.setSelectionVisible(false);
|
|
5239
5276
|
externalHandoffPanel?.setContextReady(false);
|
|
5240
5277
|
externalHandoffPanel?.setSelectionVisible(false);
|
|
5278
|
+
contextualAskPanel?.setSelectionVisible(false);
|
|
5241
5279
|
agentPanel.setEditingEnabled(true);
|
|
5242
5280
|
agentPanel.resetJob();
|
|
5243
5281
|
dataFlowPanel.resetView();
|
|
@@ -5378,6 +5416,7 @@ function createRuntimeView(document, shortcut, ai = Object.freeze({ enabled: fal
|
|
|
5378
5416
|
unsubscribeLocale();
|
|
5379
5417
|
dataFlowPanel.dispose();
|
|
5380
5418
|
externalHandoffPanel?.dispose();
|
|
5419
|
+
contextualAskPanel?.dispose();
|
|
5381
5420
|
agentPanel.dispose();
|
|
5382
5421
|
motionController?.dispose();
|
|
5383
5422
|
executionIslandView.dispose();
|
|
@@ -5898,7 +5937,8 @@ function createController(config, dependencies = {}) {
|
|
|
5898
5937
|
config.dataFlow.enabled,
|
|
5899
5938
|
config.externalAgent.enabled,
|
|
5900
5939
|
config.framework,
|
|
5901
|
-
config.sessionId
|
|
5940
|
+
config.sessionId,
|
|
5941
|
+
config.contextualAsk.enabled
|
|
5902
5942
|
);
|
|
5903
5943
|
const api = dependencies.api ?? createRuntimeApi({
|
|
5904
5944
|
apiBase: config.apiBase,
|
|
@@ -6101,6 +6141,19 @@ function createController(config, dependencies = {}) {
|
|
|
6101
6141
|
(target2) => target2.instruction.trim().length > 0 && target2.elementContext !== void 0 && target2.styles !== void 0 && target2.apiStatus !== "loading"
|
|
6102
6142
|
);
|
|
6103
6143
|
}
|
|
6144
|
+
function selectedAskSelection() {
|
|
6145
|
+
const snapshots = targets.flatMap((target2) => {
|
|
6146
|
+
const snapshot = snapshotTarget(target2);
|
|
6147
|
+
return snapshot === void 0 ? [] : [snapshot];
|
|
6148
|
+
});
|
|
6149
|
+
if (snapshots.length === 0 || snapshots.length !== targets.length) {
|
|
6150
|
+
return void 0;
|
|
6151
|
+
}
|
|
6152
|
+
return Object.freeze({
|
|
6153
|
+
locale: view.locale(),
|
|
6154
|
+
targets: snapshots
|
|
6155
|
+
});
|
|
6156
|
+
}
|
|
6104
6157
|
function selectionSummary() {
|
|
6105
6158
|
const messages = view.messages().summary;
|
|
6106
6159
|
return targets.map((target2, index) => {
|
|
@@ -6222,6 +6275,7 @@ ${summary}`;
|
|
|
6222
6275
|
api.cancelPending();
|
|
6223
6276
|
agentWorkflow.disposeSelection();
|
|
6224
6277
|
externalHandoffWorkflow?.cancelPending();
|
|
6278
|
+
contextualAskWorkflow?.cancelPending();
|
|
6225
6279
|
clearCollectionTimers();
|
|
6226
6280
|
resizeObserver?.disconnect();
|
|
6227
6281
|
targets = [];
|
|
@@ -6347,6 +6401,27 @@ ${summary}`;
|
|
|
6347
6401
|
config.sessionToken,
|
|
6348
6402
|
browser.window
|
|
6349
6403
|
) : void 0;
|
|
6404
|
+
const contextualAskWorkflow = config.contextualAsk.enabled && view.contextualAskPanel !== void 0 ? getContextualAskExtension()?.createWorkflow({
|
|
6405
|
+
...clipboard === void 0 ? {} : { clipboard },
|
|
6406
|
+
createId,
|
|
6407
|
+
fetch: browser.window.fetch.bind(browser.window),
|
|
6408
|
+
getSelection: selectedAskSelection,
|
|
6409
|
+
onBusyChange(busy) {
|
|
6410
|
+
view.setAgentEditingEnabled(!busy);
|
|
6411
|
+
},
|
|
6412
|
+
onConvert() {
|
|
6413
|
+
view.focusTargetInstruction(activeTargetId);
|
|
6414
|
+
},
|
|
6415
|
+
async onOpenSource(source2) {
|
|
6416
|
+
await api.openEditor({
|
|
6417
|
+
fileId: source2.fileId,
|
|
6418
|
+
line: source2.startLine,
|
|
6419
|
+
column: 1
|
|
6420
|
+
});
|
|
6421
|
+
},
|
|
6422
|
+
panel: view.contextualAskPanel,
|
|
6423
|
+
sessionToken: config.sessionToken
|
|
6424
|
+
}) : void 0;
|
|
6350
6425
|
async function loadSourceContext(target2, revision) {
|
|
6351
6426
|
const marker = target2.marker;
|
|
6352
6427
|
if (marker === void 0) {
|
|
@@ -6460,6 +6535,7 @@ ${summary}`;
|
|
|
6460
6535
|
previewPrompt = "";
|
|
6461
6536
|
agentWorkflow.beginSelection();
|
|
6462
6537
|
workflowSelectionActive = true;
|
|
6538
|
+
contextualAskWorkflow?.beginSelection();
|
|
6463
6539
|
}
|
|
6464
6540
|
targetSequence += 1;
|
|
6465
6541
|
const target2 = {
|
|
@@ -6478,6 +6554,9 @@ ${summary}`;
|
|
|
6478
6554
|
dataFlowStatus: "idle"
|
|
6479
6555
|
};
|
|
6480
6556
|
targets.push(target2);
|
|
6557
|
+
if (!initialSelection) {
|
|
6558
|
+
contextualAskWorkflow?.selectionChanged();
|
|
6559
|
+
}
|
|
6481
6560
|
activeTargetId = target2.id;
|
|
6482
6561
|
addingTarget = false;
|
|
6483
6562
|
const revision = sessionRevision;
|
|
@@ -6594,10 +6673,12 @@ ${summary}`;
|
|
|
6594
6673
|
pageDataFlowStatus = "idle";
|
|
6595
6674
|
renderDataFlowView();
|
|
6596
6675
|
selectionSession.clear();
|
|
6676
|
+
contextualAskWorkflow?.selectionChanged();
|
|
6597
6677
|
view.announce(view.messages().announcements.allTargetsRemoved);
|
|
6598
6678
|
return;
|
|
6599
6679
|
}
|
|
6600
6680
|
refreshSelectionView();
|
|
6681
|
+
contextualAskWorkflow?.selectionChanged();
|
|
6601
6682
|
void loadDataFlowReports();
|
|
6602
6683
|
persistSelection();
|
|
6603
6684
|
view.announce(view.messages().announcements.targetRemoved);
|
|
@@ -6776,6 +6857,7 @@ ${summary}`;
|
|
|
6776
6857
|
}
|
|
6777
6858
|
mounted = true;
|
|
6778
6859
|
externalHandoffWorkflow?.mount();
|
|
6860
|
+
contextualAskWorkflow?.mount();
|
|
6779
6861
|
view.renderStatus(state.status);
|
|
6780
6862
|
browser.document.addEventListener("pointermove", handlePointerMove, true);
|
|
6781
6863
|
browser.document.addEventListener("click", handleClick, true);
|
|
@@ -6827,6 +6909,7 @@ ${summary}`;
|
|
|
6827
6909
|
if (selectionOpen && targets.length > 0) {
|
|
6828
6910
|
transition({ type: "RESTORE" });
|
|
6829
6911
|
agentWorkflow.beginSelection();
|
|
6912
|
+
contextualAskWorkflow?.beginSelection();
|
|
6830
6913
|
workflowSelectionActive = true;
|
|
6831
6914
|
refreshSelectionView(true);
|
|
6832
6915
|
}
|
|
@@ -6843,6 +6926,7 @@ ${summary}`;
|
|
|
6843
6926
|
api.dispose();
|
|
6844
6927
|
agentWorkflow.disposeSelection();
|
|
6845
6928
|
externalHandoffWorkflow?.dispose();
|
|
6929
|
+
contextualAskWorkflow?.dispose();
|
|
6846
6930
|
sourceResolver.dispose();
|
|
6847
6931
|
return;
|
|
6848
6932
|
}
|
|
@@ -6907,6 +6991,7 @@ ${summary}`;
|
|
|
6907
6991
|
api.dispose();
|
|
6908
6992
|
agentWorkflow.disposeSelection();
|
|
6909
6993
|
externalHandoffWorkflow?.dispose();
|
|
6994
|
+
contextualAskWorkflow?.dispose();
|
|
6910
6995
|
sourceResolver.dispose();
|
|
6911
6996
|
view.dispose();
|
|
6912
6997
|
state = INITIAL_RUNTIME_STATE;
|