@narumitw/pi-plan-mode 0.54.0 → 0.55.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.ts CHANGED
@@ -16,7 +16,6 @@ import {
16
16
  configuredImplementationPlanRetention,
17
17
  configuredPlanExportPath,
18
18
  configuredPlanModeToggleShortcut,
19
- configuredPlanModeToolVisibility,
20
19
  configuredThinkingLevel,
21
20
  createImplementationRetentionCoordinator,
22
21
  exportStoredPlan,
@@ -43,7 +42,7 @@ import {
43
42
  toolPolicyLabel,
44
43
  unique,
45
44
  updatePlanModeSettings
46
- } from "./chunks/chunk-U5CQ7RQX.js";
45
+ } from "./chunks/chunk-KSGLZ4S2.js";
47
46
 
48
47
  // src/plan-mode.ts
49
48
  import { randomUUID as randomUUID2 } from "node:crypto";
@@ -443,114 +442,6 @@ function safeErrorDetail(error) {
443
442
  return characters.length > 500 ? `${characters.slice(0, 499).join("")}\u2026` : normalized;
444
443
  }
445
444
 
446
- // src/helper-tool-visibility.ts
447
- var PLAN_MODE_HELPER_TOOL_NAMES = [
448
- PLAN_MODE_QUESTION_TOOL_NAME,
449
- PLAN_MODE_COMPLETE_TOOL_NAME
450
- ];
451
- var PlanModeHelperVisibilityPolicy = class {
452
- constructor(pi) {
453
- this.pi = pi;
454
- }
455
- pi;
456
- unlocked = false;
457
- hiddenByPolicy = /* @__PURE__ */ new Set();
458
- isUnlocked() {
459
- return this.unlocked;
460
- }
461
- hasHiddenTools() {
462
- return this.hiddenByPolicy.size > 0;
463
- }
464
- toolsAvailable() {
465
- const active = new Set(this.pi.getActiveTools());
466
- return PLAN_MODE_HELPER_TOOL_NAMES.every((name) => active.has(name));
467
- }
468
- prepareSessionStart(visibility, previous) {
469
- if (visibility === "after-first-plan" && previous === "always") this.lock();
470
- if (visibility === "always") this.reveal();
471
- }
472
- reconcileInactiveState(visibility) {
473
- if (visibility === "after-first-plan" && !this.unlocked) this.hideIfLocked();
474
- }
475
- deferVisibilityChange(visibility) {
476
- if (visibility === "after-first-plan") this.lock();
477
- }
478
- prepareActivation(ctx) {
479
- if (!this.toolsAvailable() && ctx.isIdle?.() !== true) {
480
- throw new Error("wait until Pi is idle before revealing the Plan tools");
481
- }
482
- this.reveal();
483
- }
484
- applyVisibilityChange(previous, next, ctx) {
485
- if (previous === next) return;
486
- if (next === "always") {
487
- if (!this.toolsAvailable() && ctx.isIdle?.() !== true) {
488
- throw new Error("Wait for Pi to become idle before revealing Plan tools.");
489
- }
490
- this.reveal();
491
- return;
492
- }
493
- if (ctx.isIdle?.() !== true) {
494
- throw new Error("Wait for Pi to become idle before hiding Plan tools.");
495
- }
496
- this.lock();
497
- this.hideIfLocked();
498
- }
499
- hideIfLocked() {
500
- if (this.unlocked) return;
501
- const active = this.pi.getActiveTools();
502
- const hidden = active.filter((name) => this.isHelperTool(name));
503
- if (hidden.length === 0) return;
504
- this.pi.setActiveTools(active.filter((name) => !this.isHelperTool(name)));
505
- for (const name of hidden) this.hiddenByPolicy.add(name);
506
- }
507
- snapshot() {
508
- return {
509
- activeTools: this.pi.getActiveTools(),
510
- helperToolsUnlocked: this.unlocked,
511
- helperToolsHiddenByPolicy: [...this.hiddenByPolicy]
512
- };
513
- }
514
- restore(snapshot) {
515
- this.pi.setActiveTools(snapshot.activeTools);
516
- this.unlocked = snapshot.helperToolsUnlocked;
517
- this.hiddenByPolicy.clear();
518
- for (const name of snapshot.helperToolsHiddenByPolicy) this.hiddenByPolicy.add(name);
519
- }
520
- reveal() {
521
- const snapshot = this.snapshot();
522
- try {
523
- const active = this.pi.getActiveTools();
524
- const canonical = [
525
- ...active.filter((name) => !this.isHelperTool(name)),
526
- ...PLAN_MODE_HELPER_TOOL_NAMES
527
- ];
528
- if (canonical.length !== active.length || canonical.some((name, index) => name !== active[index])) {
529
- this.pi.setActiveTools(canonical);
530
- }
531
- if (!this.toolsAvailable()) {
532
- throw new Error(
533
- "plan_mode_question and plan_mode_complete are unavailable; leave the restrictive tool mode before starting Plan mode"
534
- );
535
- }
536
- this.unlockAndForgetHidden();
537
- } catch (error) {
538
- this.restore(snapshot);
539
- throw error;
540
- }
541
- }
542
- lock() {
543
- this.unlocked = false;
544
- }
545
- unlockAndForgetHidden() {
546
- this.unlocked = true;
547
- this.hiddenByPolicy.clear();
548
- }
549
- isHelperTool(name) {
550
- return PLAN_MODE_HELPER_TOOL_NAMES.includes(name);
551
- }
552
- };
553
-
554
445
  // src/plan-action-controller.ts
555
446
  function createPlanActionController(options) {
556
447
  const freshAction = (ctx, lifecycle, signal) => options.implementFresh(ctx, () => lifecycle.isCurrent() && !signal.aborted);
@@ -759,6 +650,20 @@ function formatStatus(state) {
759
650
  }
760
651
 
761
652
  // src/required-tools.ts
653
+ var REQUIRED_PLAN_MODE_TOOL_NAMES = [
654
+ PLAN_MODE_QUESTION_TOOL_NAME,
655
+ PLAN_MODE_COMPLETE_TOOL_NAME
656
+ ];
657
+ function planModeHelperToolsAvailable(toolNames) {
658
+ const active = new Set(toolNames);
659
+ return REQUIRED_PLAN_MODE_TOOL_NAMES.every((name) => active.has(name));
660
+ }
661
+ function assertPlanModeHelperToolsAvailable(toolNames) {
662
+ if (planModeHelperToolsAvailable(toolNames)) return;
663
+ throw new Error(
664
+ "plan_mode_question and plan_mode_complete are unavailable; include them in the active tool allowlist or leave the restrictive tool mode before starting Plan mode"
665
+ );
666
+ }
762
667
  function withRequiredPlanModeTools(toolNames) {
763
668
  return unique([
764
669
  ...withoutRequiredPlanModeTools(toolNames),
@@ -957,7 +862,6 @@ var BLOCKED_MUTATING_TOOLS = /* @__PURE__ */ new Set(["edit", "write", "update_p
957
862
  var DEFAULT_TOOLS = ["read", "bash", "edit", "write"];
958
863
  function planMode(pi, dependencies = {}) {
959
864
  const workflowMutex = new WorkflowMutex(pi);
960
- const helperVisibility = new PlanModeHelperVisibilityPolicy(pi);
961
865
  let workflowOwner;
962
866
  let currentSession;
963
867
  let currentSessionContext;
@@ -965,7 +869,7 @@ function planMode(pi, dependencies = {}) {
965
869
  const loadInteractiveUi = () => {
966
870
  if (dependencies.loadInteractiveUi) return dependencies.loadInteractiveUi();
967
871
  if (!interactiveUiPromise) {
968
- interactiveUiPromise = import("./chunks/interactive-ui-W3VYAJIQ.js").catch((error) => {
872
+ interactiveUiPromise = import("./chunks/interactive-ui-PSDKEVVG.js").catch((error) => {
969
873
  interactiveUiPromise = void 0;
970
874
  throw error;
971
875
  });
@@ -1028,11 +932,7 @@ function planMode(pi, dependencies = {}) {
1028
932
  pi.registerTool({
1029
933
  name: PLAN_MODE_QUESTION_TOOL_NAME,
1030
934
  label: "Plan question",
1031
- description: "Ask the user one to three Plan-mode clarification questions with meaningful options, then wait for the answer. Only available while Plan mode is active.",
1032
- promptSnippet: "Ask user decision questions while Plan mode is active",
1033
- promptGuidelines: [
1034
- "In Plan mode, use plan_mode_question for important preferences, tradeoffs, or assumptions that cannot be discovered from read-only exploration."
1035
- ],
935
+ description: "Ask one to three structured questions only when the latest effective Plan contract explicitly says /plan mode is active. Tool visibility alone does not activate Plan mode. Never call for ordinary planning requests, the writing-plans skill, roadmaps, checklists, or plan-file work.",
1036
936
  parameters: PLAN_MODE_QUESTION_PARAMS,
1037
937
  async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
1038
938
  if (!state.enabled || !workflowMutex.isOwner(workflowOwner)) {
@@ -1066,11 +966,7 @@ function planMode(pi, dependencies = {}) {
1066
966
  pi.registerTool({
1067
967
  name: PLAN_MODE_COMPLETE_TOOL_NAME,
1068
968
  label: "Complete plan",
1069
- description: "Submit the complete decision-ready implementation plan for user review. Only available while Plan mode is active, and must be the final standalone action.",
1070
- promptSnippet: "Submit the final Plan-mode implementation plan",
1071
- promptGuidelines: [
1072
- "Call plan_mode_complete alone as the final action only after the implementation plan is decision-complete."
1073
- ],
969
+ description: "Submit a decision-ready plan only when the latest effective Plan contract explicitly says /plan mode is active, and call it alone as the final action. Tool visibility alone does not activate Plan mode. Never call for ordinary planning requests, the writing-plans skill, roadmaps, checklists, or plan-file work.",
1074
970
  parameters: PLAN_MODE_COMPLETE_PARAMS,
1075
971
  renderResult: renderPlanModeCompletion,
1076
972
  async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
@@ -1199,17 +1095,12 @@ function planMode(pi, dependencies = {}) {
1199
1095
  const readPlanModeRuntimeSettings = async () => {
1200
1096
  return dependencies.readSettings?.() ?? readPlanModeSettings(explicitPlanModeSettingsPath);
1201
1097
  };
1202
- const applyPlanModeSettings = async (generation, ctx, showWarnings, applyWatchedVisibility = false) => {
1098
+ const applyPlanModeSettings = async (generation, ctx, showWarnings) => {
1203
1099
  const loadedSettings = await readPlanModeRuntimeSettings();
1204
1100
  if (generation !== menuGeneration || menuController.signal.aborted) {
1205
1101
  return void 0;
1206
1102
  }
1207
- const previousSettings = settings;
1208
- const nextSettings = loadedSettings.kind === "loaded" ? loadedSettings.settings : { thinkingLevel: "inherit" };
1209
- if (applyWatchedVisibility && ctx) {
1210
- applyWatchedHelperVisibility(previousSettings, nextSettings, ctx);
1211
- }
1212
- settings = nextSettings;
1103
+ settings = loadedSettings.kind === "loaded" ? loadedSettings.settings : { thinkingLevel: "inherit" };
1213
1104
  applyPlanModeShortcut(configuredPlanModeToggleShortcut(settings));
1214
1105
  if (!ctx || !showWarnings) return loadedSettings;
1215
1106
  if (loadedSettings.kind === "invalid") {
@@ -1235,7 +1126,7 @@ function planMode(pi, dependencies = {}) {
1235
1126
  }
1236
1127
  settingsReloadTimer = setTimeout(() => {
1237
1128
  settingsReloadTimer = void 0;
1238
- void applyPlanModeSettings(generation, currentSessionContext, false, true);
1129
+ void applyPlanModeSettings(generation, currentSessionContext, false);
1239
1130
  }, 75);
1240
1131
  };
1241
1132
  const startPlanModeSettingsWatch = (generation) => {
@@ -1260,7 +1151,6 @@ function planMode(pi, dependencies = {}) {
1260
1151
  };
1261
1152
  pi.on("session_start", async (event, ctx) => {
1262
1153
  const generation = ++menuGeneration;
1263
- const previousToolVisibility = configuredPlanModeToolVisibility(settings);
1264
1154
  finalizationRequest.reset();
1265
1155
  currentSession = ctx.sessionManager;
1266
1156
  currentSessionContext = ctx;
@@ -1282,12 +1172,7 @@ function planMode(pi, dependencies = {}) {
1282
1172
  await applyPlanModeSettings(generation, ctx, true);
1283
1173
  if (generation !== menuGeneration || menuController.signal.aborted) return;
1284
1174
  startPlanModeSettingsWatch(generation);
1285
- if (restoredState.enabled) {
1286
- if (!installRestoredState(restoredState, ctx, previousToolVisibility)) return;
1287
- } else {
1288
- reconcileInactiveHelperVisibility(previousToolVisibility, ctx);
1289
- if (!installRestoredState(restoredState, ctx)) return;
1290
- }
1175
+ if (!installRestoredState(restoredState, ctx)) return;
1291
1176
  implementationRetention.restore(state.activeImplementation);
1292
1177
  updateUi(ctx);
1293
1178
  });
@@ -1521,16 +1406,13 @@ ${intent.plan}`,
1521
1406
  if (!owner) return reportWorkflowBusy(ctx);
1522
1407
  workflowOwner = owner;
1523
1408
  const previousState = state;
1524
- const previousHelperVisibility = helperVisibility.snapshot();
1525
1409
  try {
1526
- helperVisibility.prepareActivation(ctx);
1410
+ assertPlanModeHelperToolsAvailable(safeGetActiveTools());
1527
1411
  if (!publishModeContract("plan", ctx)) {
1528
- helperVisibility.restore(previousHelperVisibility);
1529
1412
  releaseWorkflowOwner();
1530
1413
  return false;
1531
1414
  }
1532
1415
  } catch (error) {
1533
- helperVisibility.restore(previousHelperVisibility);
1534
1416
  releaseWorkflowOwner();
1535
1417
  return reportHelperActivationFailure(ctx, error);
1536
1418
  }
@@ -1552,14 +1434,13 @@ ${intent.plan}`,
1552
1434
  updateUi(ctx);
1553
1435
  return true;
1554
1436
  } catch (error) {
1555
- rollbackNewActivation(previousState, ctx, void 0, previousHelperVisibility);
1437
+ rollbackNewActivation(previousState, ctx);
1556
1438
  throw error;
1557
1439
  }
1558
1440
  }
1559
1441
  function enterPlanModeWithPrompt(prompt, ctx) {
1560
1442
  const previousState = state;
1561
1443
  const previousOwner = workflowOwner;
1562
- const previousHelperVisibility = helperVisibility.snapshot();
1563
1444
  const wasEnabled = state.enabled;
1564
1445
  if (!enterPlanMode(ctx)) return;
1565
1446
  if (!wasEnabled) {
@@ -1567,7 +1448,7 @@ ${intent.plan}`,
1567
1448
  }
1568
1449
  if (sendPlanModeUserMessage(prompt, ctx)) return;
1569
1450
  if (wasEnabled) return;
1570
- rollbackNewActivation(previousState, ctx, previousOwner, previousHelperVisibility);
1451
+ rollbackNewActivation(previousState, ctx, previousOwner);
1571
1452
  }
1572
1453
  function exitPlanMode(ctx) {
1573
1454
  if (!allowModeTransition(ctx, "leave or clear Plan mode")) return false;
@@ -1810,7 +1691,7 @@ ${intent.plan}`,
1810
1691
  if (!lifecycle.isCurrent() || lifecycle.signal.aborted) return;
1811
1692
  const tools = selectableTools();
1812
1693
  await ui.showPlanLaunchMenu(ctx, {
1813
- statusText: helperVisibility.toolsAvailable() ? "Status: Off \u2014 Plan helper tools are visible for this runtime." : "Status: Off \u2014 Plan helper tools load on the first Plan start.",
1694
+ statusText: planModeHelperToolsAvailable(safeGetActiveTools()) ? "Status: Off \u2014 visible Plan helpers stay inactive until /plan starts." : "Status: Off \u2014 required Plan helpers are unavailable under the active tool policy.",
1814
1695
  initialScreen,
1815
1696
  getSelectedNames: () => snapshotPlanModeSelectedNames(tools, toolSelectionSnapshot()),
1816
1697
  toolSummary: (selectedNames) => {
@@ -1892,7 +1773,7 @@ ${intent.plan}`,
1892
1773
  signal,
1893
1774
  isCurrent,
1894
1775
  settingsPath: dependencies.settingsPath,
1895
- updateSettings: (patch, options) => updateSettingsWithRuntime(patch, options, ctx, isCurrent),
1776
+ updateSettings: dependencies.updateSettings ?? updatePlanModeSettings,
1896
1777
  onSaved: (saved) => {
1897
1778
  if (!isCurrent()) return;
1898
1779
  settings = saved;
@@ -1902,54 +1783,6 @@ ${intent.plan}`,
1902
1783
  });
1903
1784
  return result.kind === "closed" && "reason" in result && result.reason === "close";
1904
1785
  }
1905
- async function updateSettingsWithRuntime(patch, options, ctx, isCurrent) {
1906
- const previousVisibility = configuredPlanModeToolVisibility(settings);
1907
- const nextVisibility = patch.toolVisibility ?? previousVisibility;
1908
- const persistSettings = dependencies.updateSettings ?? updatePlanModeSettings;
1909
- if (nextVisibility === previousVisibility) {
1910
- return persistSettings(patch, options);
1911
- }
1912
- if (!ctx.isIdle()) {
1913
- throw new Error("Wait for Pi to become idle before changing Plan tool visibility.");
1914
- }
1915
- bindWorkflowSessionIfNeeded(ctx);
1916
- const applicationSession = ctx.sessionManager;
1917
- const applicationGeneration = menuGeneration;
1918
- const applicationIsCurrent = () => currentSession === applicationSession && menuGeneration === applicationGeneration && isCurrent();
1919
- const retainedOwner = workflowMutex.isOwner(workflowOwner);
1920
- const temporaryOwner = retainedOwner ? workflowOwner : workflowMutex.acquire();
1921
- if (!temporaryOwner) {
1922
- throw new Error(
1923
- "Another workflow is active in this session. Plan tool visibility was not changed."
1924
- );
1925
- }
1926
- const visibilitySnapshot = helperVisibility.snapshot();
1927
- try {
1928
- helperVisibility.applyVisibilityChange(previousVisibility, nextVisibility, ctx);
1929
- const saved = await persistSettings(patch, options);
1930
- if (!applicationIsCurrent()) {
1931
- throw new DOMException("Plan settings session replaced", "AbortError");
1932
- }
1933
- settings = saved;
1934
- applyPlanModeShortcut(configuredPlanModeToggleShortcut(saved));
1935
- return saved;
1936
- } catch (error) {
1937
- if (applicationIsCurrent()) {
1938
- try {
1939
- helperVisibility.restore(visibilitySnapshot);
1940
- } catch (rollbackError) {
1941
- throw new AggregateError(
1942
- [error, rollbackError],
1943
- "Plan tool visibility settings failed and runtime rollback was incomplete."
1944
- );
1945
- }
1946
- }
1947
- throw error;
1948
- } finally {
1949
- if (!retainedOwner) workflowMutex.release(temporaryOwner);
1950
- if (!isCurrent()) latestCommandContext = void 0;
1951
- }
1952
- }
1953
1786
  function allowModeTransition(ctx, action) {
1954
1787
  if (ctx.isIdle()) return true;
1955
1788
  const message = `Cannot ${action} while an agent run is active. Wait for the run to settle, then retry.`;
@@ -1980,73 +1813,6 @@ ${intent.plan}`,
1980
1813
  function captureToolBaseline() {
1981
1814
  activeToolBaseline = withRequiredPlanModeTools(safeGetActiveTools());
1982
1815
  }
1983
- function applyWatchedHelperVisibility(previousSettings, nextSettings, ctx) {
1984
- const previousVisibility = configuredPlanModeToolVisibility(previousSettings);
1985
- const nextVisibility = configuredPlanModeToolVisibility(nextSettings);
1986
- if (previousVisibility === nextVisibility) return;
1987
- if (state.enabled) {
1988
- helperVisibility.deferVisibilityChange(nextVisibility);
1989
- return;
1990
- }
1991
- try {
1992
- if (!ctx.isIdle()) {
1993
- helperVisibility.deferVisibilityChange(nextVisibility);
1994
- return;
1995
- }
1996
- } catch {
1997
- helperVisibility.deferVisibilityChange(nextVisibility);
1998
- return;
1999
- }
2000
- const owner = workflowMutex.acquire();
2001
- if (!owner) {
2002
- helperVisibility.deferVisibilityChange(nextVisibility);
2003
- return;
2004
- }
2005
- const snapshot = helperVisibility.snapshot();
2006
- try {
2007
- helperVisibility.applyVisibilityChange(previousVisibility, nextVisibility, ctx);
2008
- } catch (error) {
2009
- helperVisibility.restore(snapshot);
2010
- helperVisibility.deferVisibilityChange(nextVisibility);
2011
- if (ctx.hasUI) {
2012
- const detail = safeTerminalText(error instanceof Error ? error.message : String(error));
2013
- ctx.ui.notify(
2014
- `Could not apply reloaded Plan tool visibility; the current tool envelope remains unchanged until a later safe boundary: ${detail}`,
2015
- "warning"
2016
- );
2017
- }
2018
- } finally {
2019
- workflowMutex.release(owner);
2020
- }
2021
- }
2022
- function reconcileInactiveHelperVisibility(previousVisibility, ctx) {
2023
- const owner = workflowMutex.acquire();
2024
- if (!owner) {
2025
- if (ctx.hasUI) {
2026
- ctx.ui.notify(
2027
- "Plan tool visibility was deferred because another workflow is active in this session.",
2028
- "warning"
2029
- );
2030
- }
2031
- return false;
2032
- }
2033
- const snapshot = helperVisibility.snapshot();
2034
- try {
2035
- const visibility = configuredPlanModeToolVisibility(settings);
2036
- helperVisibility.prepareSessionStart(visibility, previousVisibility);
2037
- helperVisibility.reconcileInactiveState(visibility);
2038
- return true;
2039
- } catch (error) {
2040
- helperVisibility.restore(snapshot);
2041
- if (ctx.hasUI) {
2042
- const detail = safeTerminalText(error instanceof Error ? error.message : String(error));
2043
- ctx.ui.notify(`Could not apply Plan tool visibility: ${detail}`, "error");
2044
- }
2045
- return false;
2046
- } finally {
2047
- workflowMutex.release(owner);
2048
- }
2049
- }
2050
1816
  function planModePolicyToolNames() {
2051
1817
  return workflowAllowedToolNames ?? computePlanModePolicyToolNames();
2052
1818
  }
@@ -2128,11 +1894,10 @@ ${intent.plan}`,
2128
1894
  return DEFAULT_TOOLS;
2129
1895
  }
2130
1896
  }
2131
- function installRestoredState(candidate, ctx, previousToolVisibility) {
1897
+ function installRestoredState(candidate, ctx) {
2132
1898
  const previousState = state;
2133
1899
  const previousWorkflowAllowedToolNames = workflowAllowedToolNames;
2134
1900
  const previousOwner = workflowOwner;
2135
- const previousHelperVisibility = helperVisibility.snapshot();
2136
1901
  const wasEnabled = state.enabled;
2137
1902
  if (candidate.enabled && !workflowMutex.isOwner(workflowOwner)) {
2138
1903
  const owner = workflowMutex.acquire();
@@ -2146,24 +1911,17 @@ ${intent.plan}`,
2146
1911
  }
2147
1912
  try {
2148
1913
  if (candidate.enabled) {
2149
- const visibility = configuredPlanModeToolVisibility(settings);
2150
- if (previousToolVisibility === void 0) {
2151
- helperVisibility.prepareActivation(ctx);
2152
- } else {
2153
- try {
2154
- helperVisibility.prepareSessionStart(visibility, previousToolVisibility);
2155
- helperVisibility.prepareActivation(ctx);
2156
- } catch {
2157
- helperVisibility.restore(previousHelperVisibility);
2158
- state = { enabled: false, awaitingAction: false };
2159
- workflowAllowedToolNames = void 0;
2160
- if (workflowOwner !== previousOwner) {
2161
- workflowMutex.release(workflowOwner);
2162
- workflowOwner = previousOwner;
2163
- }
2164
- reportRestoredHelpersUnavailable(ctx);
2165
- return false;
1914
+ try {
1915
+ assertPlanModeHelperToolsAvailable(safeGetActiveTools());
1916
+ } catch {
1917
+ state = { enabled: false, awaitingAction: false };
1918
+ workflowAllowedToolNames = void 0;
1919
+ if (workflowOwner !== previousOwner) {
1920
+ workflowMutex.release(workflowOwner);
1921
+ workflowOwner = previousOwner;
2166
1922
  }
1923
+ reportRestoredHelpersUnavailable(ctx);
1924
+ return false;
2167
1925
  }
2168
1926
  }
2169
1927
  if (wasEnabled && !candidate.enabled) {
@@ -2181,7 +1939,6 @@ ${intent.plan}`,
2181
1939
  } finally {
2182
1940
  state = previousState;
2183
1941
  workflowAllowedToolNames = previousWorkflowAllowedToolNames;
2184
- helperVisibility.restore(previousHelperVisibility);
2185
1942
  if (workflowOwner !== previousOwner) {
2186
1943
  workflowMutex.release(workflowOwner);
2187
1944
  workflowOwner = previousOwner;
@@ -2190,7 +1947,7 @@ ${intent.plan}`,
2190
1947
  throw error;
2191
1948
  }
2192
1949
  }
2193
- function rollbackNewActivation(previousState, ctx, previousOwner, previousHelperVisibility) {
1950
+ function rollbackNewActivation(previousState, ctx, previousOwner) {
2194
1951
  const activatedOwner = workflowOwner;
2195
1952
  readyPresentationIntent = void 0;
2196
1953
  try {
@@ -2202,7 +1959,6 @@ ${intent.plan}`,
2202
1959
  state = previousState;
2203
1960
  workflowAllowedToolNames = void 0;
2204
1961
  try {
2205
- if (previousHelperVisibility) helperVisibility.restore(previousHelperVisibility);
2206
1962
  persistState();
2207
1963
  updateUi(ctx);
2208
1964
  } finally {