@spotpatch/runtime 1.5.2 → 1.6.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/index.cjs +29 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1806,6 +1806,13 @@ var AGENT_PANEL_STYLES = `
|
|
|
1806
1806
|
line-height: 1.5;
|
|
1807
1807
|
}
|
|
1808
1808
|
.spotpatch-consent input { width: 14px; height: 14px; flex: none; margin: 2px 0 0; accent-color: var(--spotpatch-accent); }
|
|
1809
|
+
.spotpatch-trusted-consent {
|
|
1810
|
+
border: 1px solid rgb(251 191 36 / 20%);
|
|
1811
|
+
border-radius: 10px;
|
|
1812
|
+
padding: 9px 10px;
|
|
1813
|
+
color: #e5e7eb;
|
|
1814
|
+
background: rgb(120 53 15 / 10%);
|
|
1815
|
+
}
|
|
1809
1816
|
.spotpatch-workspace-consent {
|
|
1810
1817
|
margin-top: 9px;
|
|
1811
1818
|
border: 1px solid rgb(251 191 36 / 18%);
|
|
@@ -2001,6 +2008,8 @@ function createAgentPanel(document, ai, localizer) {
|
|
|
2001
2008
|
const revertButton = createButton(document, messages.agent.revert);
|
|
2002
2009
|
const resetButton = createButton(document, messages.agent.revise);
|
|
2003
2010
|
const providers = ai.enabled ? ai.providers : [];
|
|
2011
|
+
const trustedFastMode = ai.enabled && ai.applyMode === "trusted-auto";
|
|
2012
|
+
consent.classList.toggle("spotpatch-trusted-consent", trustedFastMode);
|
|
2004
2013
|
const providerById = new Map(providers.map((provider) => [provider.id, provider]));
|
|
2005
2014
|
let contextReady = false;
|
|
2006
2015
|
let editingEnabled = true;
|
|
@@ -2025,18 +2034,25 @@ function createAgentPanel(document, ai, localizer) {
|
|
|
2025
2034
|
providerSelect.value = ai.defaultProvider;
|
|
2026
2035
|
}
|
|
2027
2036
|
const selectedProvider = () => providerById.get(providerSelect.value);
|
|
2037
|
+
const consentMessage = (provider) => {
|
|
2038
|
+
if (provider === void 0) {
|
|
2039
|
+
return messages.agent.providerUnavailable;
|
|
2040
|
+
}
|
|
2041
|
+
return trustedFastMode ? messages.agent.trustedFastConsent(provider.label) : messages.agent.consent(provider.label);
|
|
2042
|
+
};
|
|
2043
|
+
const localChangesConsentGranted = () => trustedFastMode ? consentCheckbox.checked : workspaceConsentCheckbox.checked;
|
|
2028
2044
|
const populateModels = () => {
|
|
2029
2045
|
const provider = selectedProvider();
|
|
2030
2046
|
modelSelect.replaceChildren();
|
|
2031
2047
|
if (provider === void 0) {
|
|
2032
|
-
consentText.textContent =
|
|
2048
|
+
consentText.textContent = consentMessage(provider);
|
|
2033
2049
|
return;
|
|
2034
2050
|
}
|
|
2035
2051
|
for (const model of provider.models) {
|
|
2036
2052
|
addOption(document, modelSelect, model.id, model.label);
|
|
2037
2053
|
}
|
|
2038
2054
|
modelSelect.value = provider.defaultModel;
|
|
2039
|
-
consentText.textContent =
|
|
2055
|
+
consentText.textContent = consentMessage(provider);
|
|
2040
2056
|
};
|
|
2041
2057
|
const refreshActions = () => {
|
|
2042
2058
|
const setupVisible = ai.enabled && selectionVisible && !jobPresented;
|
|
@@ -2045,7 +2061,7 @@ function createAgentPanel(document, ai, localizer) {
|
|
|
2045
2061
|
testButton.hidden = !setupVisible;
|
|
2046
2062
|
runButton.hidden = !setupVisible;
|
|
2047
2063
|
testButton.disabled = !editingEnabled || capabilityProbing || selectedProvider() === void 0;
|
|
2048
|
-
runButton.disabled = !editingEnabled || capabilityProbing || !contextReady || !consentCheckbox.checked || latestWorkspaceState === "idle" || latestWorkspaceState === "checking" || latestWorkspaceState === "blocked" || latestWorkspaceState === "consent-required" && !
|
|
2064
|
+
runButton.disabled = !editingEnabled || capabilityProbing || !contextReady || !consentCheckbox.checked || latestWorkspaceState === "idle" || latestWorkspaceState === "checking" || latestWorkspaceState === "blocked" || latestWorkspaceState === "consent-required" && !localChangesConsentGranted() || selectedProvider() === void 0 || modelSelect.value.length === 0;
|
|
2049
2065
|
if (!jobPresented || !selectionVisible) {
|
|
2050
2066
|
cancelButton.hidden = true;
|
|
2051
2067
|
applyButton.hidden = true;
|
|
@@ -2145,7 +2161,7 @@ function createAgentPanel(document, ai, localizer) {
|
|
|
2145
2161
|
function applyMessages() {
|
|
2146
2162
|
messages = localizer.messages();
|
|
2147
2163
|
title.textContent = messages.agent.title;
|
|
2148
|
-
badge.textContent = ai.enabled && ai.applyMode === "auto" ? messages.agent.autoGated : messages.agent.review;
|
|
2164
|
+
badge.textContent = trustedFastMode ? messages.agent.trustedFast : ai.enabled && ai.applyMode === "auto" ? messages.agent.autoGated : messages.agent.review;
|
|
2149
2165
|
providerText.textContent = messages.agent.provider;
|
|
2150
2166
|
modelText.textContent = messages.agent.model;
|
|
2151
2167
|
providerSelect.setAttribute("aria-label", messages.agent.providerAriaLabel);
|
|
@@ -2158,7 +2174,7 @@ function createAgentPanel(document, ai, localizer) {
|
|
|
2158
2174
|
revertButton.textContent = messages.agent.revert;
|
|
2159
2175
|
resetButton.textContent = messages.agent.revise;
|
|
2160
2176
|
const provider = selectedProvider();
|
|
2161
|
-
consentText.textContent =
|
|
2177
|
+
consentText.textContent = consentMessage(provider);
|
|
2162
2178
|
if (latestCapabilityState === "idle") {
|
|
2163
2179
|
capability.textContent = messages.agent.connectionNotTested;
|
|
2164
2180
|
} else if (latestCapabilityState === "probing") {
|
|
@@ -2194,7 +2210,7 @@ function createAgentPanel(document, ai, localizer) {
|
|
|
2194
2210
|
return consentCheckbox.checked;
|
|
2195
2211
|
},
|
|
2196
2212
|
workspaceConsentGranted() {
|
|
2197
|
-
return
|
|
2213
|
+
return localChangesConsentGranted();
|
|
2198
2214
|
},
|
|
2199
2215
|
readSelection() {
|
|
2200
2216
|
const provider = selectedProvider();
|
|
@@ -2222,7 +2238,7 @@ function createAgentPanel(document, ai, localizer) {
|
|
|
2222
2238
|
latestWorkspaceErrorCode = errorCode ?? snapshot?.errorCode;
|
|
2223
2239
|
workspace.dataset.state = state;
|
|
2224
2240
|
if (state !== "checking") {
|
|
2225
|
-
workspaceConsent.hidden = state !== "consent-required";
|
|
2241
|
+
workspaceConsent.hidden = trustedFastMode || state !== "consent-required";
|
|
2226
2242
|
}
|
|
2227
2243
|
if (state === "idle" || state === "ready" || state === "blocked") {
|
|
2228
2244
|
workspaceConsentCheckbox.checked = false;
|
|
@@ -2701,12 +2717,14 @@ var UI_MESSAGES = Object.freeze({
|
|
|
2701
2717
|
title: "AI code agent",
|
|
2702
2718
|
review: "Review",
|
|
2703
2719
|
autoGated: "Auto gated",
|
|
2720
|
+
trustedFast: "Trusted fast",
|
|
2704
2721
|
provider: "Provider",
|
|
2705
2722
|
model: "Model",
|
|
2706
2723
|
providerAriaLabel: "AI provider",
|
|
2707
2724
|
modelAriaLabel: "AI model",
|
|
2708
2725
|
providerUnavailable: "Provider configuration is unavailable.",
|
|
2709
2726
|
consent: (provider) => `I understand selected context and allowed source may be sent to ${provider}; its data policy is my responsibility.`,
|
|
2727
|
+
trustedFastConsent: (provider) => `Enable trusted fast mode for ${provider}: send allowed project context, include current local changes, and directly apply AI changes after required checks, including file deletions and configuration changes.`,
|
|
2710
2728
|
connectionNotTested: "Optional connection check not run",
|
|
2711
2729
|
workspaceNotChecked: "Local workspace not checked",
|
|
2712
2730
|
checkingWorkspace: "Checking Git workspace and isolated execution\u2026",
|
|
@@ -2836,12 +2854,14 @@ var UI_MESSAGES = Object.freeze({
|
|
|
2836
2854
|
title: "AI \u4EE3\u7801 Agent",
|
|
2837
2855
|
review: "\u5BA1\u9605\u6A21\u5F0F",
|
|
2838
2856
|
autoGated: "\u53D7\u63A7\u81EA\u52A8\u6A21\u5F0F",
|
|
2857
|
+
trustedFast: "\u53EF\u4FE1\u5FEB\u901F\u6A21\u5F0F",
|
|
2839
2858
|
provider: "\u6A21\u578B\u670D\u52A1",
|
|
2840
2859
|
model: "\u6A21\u578B",
|
|
2841
2860
|
providerAriaLabel: "AI \u6A21\u578B\u670D\u52A1",
|
|
2842
2861
|
modelAriaLabel: "AI \u6A21\u578B",
|
|
2843
2862
|
providerUnavailable: "\u6A21\u578B\u670D\u52A1\u914D\u7F6E\u4E0D\u53EF\u7528\u3002",
|
|
2844
2863
|
consent: (provider) => `\u6211\u4E86\u89E3\u9009\u4E2D\u4E0A\u4E0B\u6587\u4E0E\u83B7\u51C6\u6E90\u7801\u53EF\u80FD\u53D1\u9001\u5230 ${provider}\uFF0C\u5E76\u81EA\u884C\u8D1F\u8D23\u5176\u6570\u636E\u7B56\u7565\u3002`,
|
|
2864
|
+
trustedFastConsent: (provider) => `\u4E3A ${provider} \u542F\u7528\u53EF\u4FE1\u5FEB\u901F\u6A21\u5F0F\uFF1A\u53D1\u9001\u83B7\u51C6\u7684\u9879\u76EE\u4E0A\u4E0B\u6587\u3001\u7EB3\u5165\u5F53\u524D\u672C\u5730\u4FEE\u6539\uFF0C\u5E76\u5728\u5FC5\u9700\u68C0\u67E5\u901A\u8FC7\u540E\u76F4\u63A5\u5E94\u7528 AI \u53D8\u66F4\uFF0C\u5305\u62EC\u5220\u9664\u6587\u4EF6\u4E0E\u914D\u7F6E\u53D8\u66F4\u3002`,
|
|
2845
2865
|
connectionNotTested: "\u5C1A\u672A\u6267\u884C\u53EF\u9009\u8FDE\u63A5\u68C0\u67E5",
|
|
2846
2866
|
workspaceNotChecked: "\u5C1A\u672A\u68C0\u67E5\u672C\u5730\u5DE5\u4F5C\u533A",
|
|
2847
2867
|
checkingWorkspace: "\u6B63\u5728\u68C0\u67E5 Git \u5DE5\u4F5C\u533A\u4E0E\u9694\u79BB\u6267\u884C\u73AF\u5883\u2026\u2026",
|
|
@@ -4688,6 +4708,7 @@ function createAgentWorkflow(options) {
|
|
|
4688
4708
|
if (!options.ai.enabled || snapshot !== void 0) {
|
|
4689
4709
|
return;
|
|
4690
4710
|
}
|
|
4711
|
+
const trustedFastMode = options.ai.applyMode === "trusted-auto";
|
|
4691
4712
|
const selection = selectedProfiles();
|
|
4692
4713
|
const annotation = options.getAnnotation();
|
|
4693
4714
|
if (selection === void 0 || annotation === void 0) {
|
|
@@ -4720,6 +4741,7 @@ function createAgentWorkflow(options) {
|
|
|
4720
4741
|
providerProfileId: selection.providerProfileId,
|
|
4721
4742
|
modelProfileId: selection.modelProfileId,
|
|
4722
4743
|
providerDataConsent: true,
|
|
4744
|
+
...trustedFastMode ? { trustedFastModeConsent: true } : {},
|
|
4723
4745
|
workingTreeMode: health.state === "consent-required" ? "include-local-changes" : "require-clean"
|
|
4724
4746
|
});
|
|
4725
4747
|
if (workflowRevision !== revision) {
|