@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 CHANGED
@@ -1810,6 +1810,13 @@ var AGENT_PANEL_STYLES = `
1810
1810
  line-height: 1.5;
1811
1811
  }
1812
1812
  .spotpatch-consent input { width: 14px; height: 14px; flex: none; margin: 2px 0 0; accent-color: var(--spotpatch-accent); }
1813
+ .spotpatch-trusted-consent {
1814
+ border: 1px solid rgb(251 191 36 / 20%);
1815
+ border-radius: 10px;
1816
+ padding: 9px 10px;
1817
+ color: #e5e7eb;
1818
+ background: rgb(120 53 15 / 10%);
1819
+ }
1813
1820
  .spotpatch-workspace-consent {
1814
1821
  margin-top: 9px;
1815
1822
  border: 1px solid rgb(251 191 36 / 18%);
@@ -2005,6 +2012,8 @@ function createAgentPanel(document, ai, localizer) {
2005
2012
  const revertButton = createButton(document, messages.agent.revert);
2006
2013
  const resetButton = createButton(document, messages.agent.revise);
2007
2014
  const providers = ai.enabled ? ai.providers : [];
2015
+ const trustedFastMode = ai.enabled && ai.applyMode === "trusted-auto";
2016
+ consent.classList.toggle("spotpatch-trusted-consent", trustedFastMode);
2008
2017
  const providerById = new Map(providers.map((provider) => [provider.id, provider]));
2009
2018
  let contextReady = false;
2010
2019
  let editingEnabled = true;
@@ -2029,18 +2038,25 @@ function createAgentPanel(document, ai, localizer) {
2029
2038
  providerSelect.value = ai.defaultProvider;
2030
2039
  }
2031
2040
  const selectedProvider = () => providerById.get(providerSelect.value);
2041
+ const consentMessage = (provider) => {
2042
+ if (provider === void 0) {
2043
+ return messages.agent.providerUnavailable;
2044
+ }
2045
+ return trustedFastMode ? messages.agent.trustedFastConsent(provider.label) : messages.agent.consent(provider.label);
2046
+ };
2047
+ const localChangesConsentGranted = () => trustedFastMode ? consentCheckbox.checked : workspaceConsentCheckbox.checked;
2032
2048
  const populateModels = () => {
2033
2049
  const provider = selectedProvider();
2034
2050
  modelSelect.replaceChildren();
2035
2051
  if (provider === void 0) {
2036
- consentText.textContent = messages.agent.providerUnavailable;
2052
+ consentText.textContent = consentMessage(provider);
2037
2053
  return;
2038
2054
  }
2039
2055
  for (const model of provider.models) {
2040
2056
  addOption(document, modelSelect, model.id, model.label);
2041
2057
  }
2042
2058
  modelSelect.value = provider.defaultModel;
2043
- consentText.textContent = messages.agent.consent(provider.label);
2059
+ consentText.textContent = consentMessage(provider);
2044
2060
  };
2045
2061
  const refreshActions = () => {
2046
2062
  const setupVisible = ai.enabled && selectionVisible && !jobPresented;
@@ -2049,7 +2065,7 @@ function createAgentPanel(document, ai, localizer) {
2049
2065
  testButton.hidden = !setupVisible;
2050
2066
  runButton.hidden = !setupVisible;
2051
2067
  testButton.disabled = !editingEnabled || capabilityProbing || selectedProvider() === void 0;
2052
- runButton.disabled = !editingEnabled || capabilityProbing || !contextReady || !consentCheckbox.checked || latestWorkspaceState === "idle" || latestWorkspaceState === "checking" || latestWorkspaceState === "blocked" || latestWorkspaceState === "consent-required" && !workspaceConsentCheckbox.checked || selectedProvider() === void 0 || modelSelect.value.length === 0;
2068
+ runButton.disabled = !editingEnabled || capabilityProbing || !contextReady || !consentCheckbox.checked || latestWorkspaceState === "idle" || latestWorkspaceState === "checking" || latestWorkspaceState === "blocked" || latestWorkspaceState === "consent-required" && !localChangesConsentGranted() || selectedProvider() === void 0 || modelSelect.value.length === 0;
2053
2069
  if (!jobPresented || !selectionVisible) {
2054
2070
  cancelButton.hidden = true;
2055
2071
  applyButton.hidden = true;
@@ -2149,7 +2165,7 @@ function createAgentPanel(document, ai, localizer) {
2149
2165
  function applyMessages() {
2150
2166
  messages = localizer.messages();
2151
2167
  title.textContent = messages.agent.title;
2152
- badge.textContent = ai.enabled && ai.applyMode === "auto" ? messages.agent.autoGated : messages.agent.review;
2168
+ badge.textContent = trustedFastMode ? messages.agent.trustedFast : ai.enabled && ai.applyMode === "auto" ? messages.agent.autoGated : messages.agent.review;
2153
2169
  providerText.textContent = messages.agent.provider;
2154
2170
  modelText.textContent = messages.agent.model;
2155
2171
  providerSelect.setAttribute("aria-label", messages.agent.providerAriaLabel);
@@ -2162,7 +2178,7 @@ function createAgentPanel(document, ai, localizer) {
2162
2178
  revertButton.textContent = messages.agent.revert;
2163
2179
  resetButton.textContent = messages.agent.revise;
2164
2180
  const provider = selectedProvider();
2165
- consentText.textContent = provider === void 0 ? messages.agent.providerUnavailable : messages.agent.consent(provider.label);
2181
+ consentText.textContent = consentMessage(provider);
2166
2182
  if (latestCapabilityState === "idle") {
2167
2183
  capability.textContent = messages.agent.connectionNotTested;
2168
2184
  } else if (latestCapabilityState === "probing") {
@@ -2198,7 +2214,7 @@ function createAgentPanel(document, ai, localizer) {
2198
2214
  return consentCheckbox.checked;
2199
2215
  },
2200
2216
  workspaceConsentGranted() {
2201
- return workspaceConsentCheckbox.checked;
2217
+ return localChangesConsentGranted();
2202
2218
  },
2203
2219
  readSelection() {
2204
2220
  const provider = selectedProvider();
@@ -2226,7 +2242,7 @@ function createAgentPanel(document, ai, localizer) {
2226
2242
  latestWorkspaceErrorCode = errorCode ?? snapshot?.errorCode;
2227
2243
  workspace.dataset.state = state;
2228
2244
  if (state !== "checking") {
2229
- workspaceConsent.hidden = state !== "consent-required";
2245
+ workspaceConsent.hidden = trustedFastMode || state !== "consent-required";
2230
2246
  }
2231
2247
  if (state === "idle" || state === "ready" || state === "blocked") {
2232
2248
  workspaceConsentCheckbox.checked = false;
@@ -2703,12 +2719,14 @@ var UI_MESSAGES = Object.freeze({
2703
2719
  title: "AI code agent",
2704
2720
  review: "Review",
2705
2721
  autoGated: "Auto gated",
2722
+ trustedFast: "Trusted fast",
2706
2723
  provider: "Provider",
2707
2724
  model: "Model",
2708
2725
  providerAriaLabel: "AI provider",
2709
2726
  modelAriaLabel: "AI model",
2710
2727
  providerUnavailable: "Provider configuration is unavailable.",
2711
2728
  consent: (provider) => `I understand selected context and allowed source may be sent to ${provider}; its data policy is my responsibility.`,
2729
+ 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.`,
2712
2730
  connectionNotTested: "Optional connection check not run",
2713
2731
  workspaceNotChecked: "Local workspace not checked",
2714
2732
  checkingWorkspace: "Checking Git workspace and isolated execution\u2026",
@@ -2838,12 +2856,14 @@ var UI_MESSAGES = Object.freeze({
2838
2856
  title: "AI \u4EE3\u7801 Agent",
2839
2857
  review: "\u5BA1\u9605\u6A21\u5F0F",
2840
2858
  autoGated: "\u53D7\u63A7\u81EA\u52A8\u6A21\u5F0F",
2859
+ trustedFast: "\u53EF\u4FE1\u5FEB\u901F\u6A21\u5F0F",
2841
2860
  provider: "\u6A21\u578B\u670D\u52A1",
2842
2861
  model: "\u6A21\u578B",
2843
2862
  providerAriaLabel: "AI \u6A21\u578B\u670D\u52A1",
2844
2863
  modelAriaLabel: "AI \u6A21\u578B",
2845
2864
  providerUnavailable: "\u6A21\u578B\u670D\u52A1\u914D\u7F6E\u4E0D\u53EF\u7528\u3002",
2846
2865
  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`,
2866
+ 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`,
2847
2867
  connectionNotTested: "\u5C1A\u672A\u6267\u884C\u53EF\u9009\u8FDE\u63A5\u68C0\u67E5",
2848
2868
  workspaceNotChecked: "\u5C1A\u672A\u68C0\u67E5\u672C\u5730\u5DE5\u4F5C\u533A",
2849
2869
  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) {