@funnycode/myclaude 0.1.200 → 0.1.268

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.
Files changed (4) hide show
  1. package/README.md +317 -308
  2. package/dist/myclaude.js +1689 -659
  3. package/dist/myclaude.mjs +1689 -659
  4. package/package.json +131 -131
package/dist/myclaude.js CHANGED
@@ -4,13 +4,16 @@
4
4
  // MACRO - build-time constants (injected by build.ts)
5
5
  // MACRO injected by build script
6
6
  globalThis.MACRO = {
7
- VERSION: "0.1.200",
8
- BUILD_TIME: "2026-08-16T02:15:29.761Z",
7
+ VERSION: "0.1.268",
8
+ BUILD_TIME: "2026-08-17T03:36:55.543Z",
9
9
  PACKAGE_URL: "@funnycode/myclaude",
10
10
  NATIVE_PACKAGE_URL: "@funnycode/myclaude",
11
11
  VERSION_CHANGELOG: '',
12
12
  ISSUES_EXPLAINER: 'file an issue at ' + "https://github.com/thomaslwq/myclaude/issues",
13
13
  FEEDBACK_CHANNEL: 'github',
14
+ DEV_BRIDGE_OVERRIDES_ENABLED: false,
15
+ BRIDGE_OVERRIDE_TOKEN: "",
16
+ BRIDGE_OVERRIDE_BASE_URL: "",
14
17
  };
15
18
  // Polyfill for bun:bundle feature() — all features default to false
16
19
  // when running outside of Bun's compile-time macro system.
@@ -1955,6 +1958,7 @@ function resetSettingsCache() {
1955
1958
  sessionSettingsCache = null;
1956
1959
  perSourceCache.clear();
1957
1960
  parseFileCache.clear();
1961
+ pluginSettingsBase = undefined;
1958
1962
  }
1959
1963
  function getPluginSettingsBase() {
1960
1964
  return pluginSettingsBase;
@@ -40562,7 +40566,7 @@ function stripLineNumberPrefix(line) {
40562
40566
  const match = line.match(/^\s*\d+[\u2192\t](.*)$/);
40563
40567
  return match?.[1] ?? line;
40564
40568
  }
40565
- function isDirEmpty(dirPath) {
40569
+ function isDirEmptySync(dirPath) {
40566
40570
  try {
40567
40571
  return getFsImplementation().isDirEmptySync(dirPath);
40568
40572
  } catch (e) {
@@ -40625,21 +40629,7 @@ function writeFileSyncAndFlush_DEPRECATED(filePath, content, options = { encodin
40625
40629
  } catch (cleanupError) {
40626
40630
  logForDebugging(`Failed to clean up temp file: ${cleanupError}`);
40627
40631
  }
40628
- logForDebugging(`Falling back to non-atomic write for ${targetPath}`);
40629
- try {
40630
- const fallbackOptions = {
40631
- encoding: options.encoding,
40632
- flush: true
40633
- };
40634
- if (!targetExists && options.mode !== undefined) {
40635
- fallbackOptions.mode = options.mode;
40636
- }
40637
- fsWriteFileSync2(targetPath, content, fallbackOptions);
40638
- logForDebugging(`File ${targetPath} written successfully with non-atomic fallback`);
40639
- } catch (fallbackError) {
40640
- logForDebugging(`Non-atomic write also failed: ${fallbackError}`);
40641
- throw fallbackError;
40642
- }
40632
+ throw atomicError;
40643
40633
  }
40644
40634
  }
40645
40635
  function getDesktopPath() {
@@ -117157,7 +117147,7 @@ var package_default;
117157
117147
  var init_package = __esm(() => {
117158
117148
  package_default = {
117159
117149
  name: "@funnycode/myclaude",
117160
- version: "0.1.200",
117150
+ version: "0.1.268",
117161
117151
  private: false,
117162
117152
  description: "An open-source AI coding assistant in your terminal - powered by Claude",
117163
117153
  license: "MIT",
@@ -117173,7 +117163,7 @@ var init_package = __esm(() => {
117173
117163
  homepage: "https://github.com/thomaslwq/myclaude",
117174
117164
  engines: {
117175
117165
  bun: ">=1.3.5",
117176
- node: ">=18.0.0"
117166
+ node: ">=18.17.0"
117177
117167
  },
117178
117168
  scripts: {
117179
117169
  dev: "bun run ./src/dev-entry.ts",
@@ -117213,13 +117203,13 @@ var init_package = __esm(() => {
117213
117203
  "@growthbook/growthbook": "1.6.5",
117214
117204
  "@modelcontextprotocol/sdk": "1.29.0",
117215
117205
  "@opentelemetry/api": "1.9.1",
117216
- "@opentelemetry/api-logs": "0.214.0",
117217
- "@opentelemetry/core": "2.6.1",
117218
- "@opentelemetry/resources": "2.6.1",
117219
- "@opentelemetry/sdk-logs": "0.214.0",
117220
- "@opentelemetry/sdk-metrics": "2.6.1",
117221
- "@opentelemetry/sdk-trace-base": "2.6.1",
117222
- "@opentelemetry/semantic-conventions": "1.40.0",
117206
+ "@opentelemetry/api-logs": "0.221.0",
117207
+ "@opentelemetry/core": "1.28.0",
117208
+ "@opentelemetry/resources": "1.28.0",
117209
+ "@opentelemetry/sdk-logs": "0.52.0",
117210
+ "@opentelemetry/sdk-metrics": "1.28.0",
117211
+ "@opentelemetry/sdk-trace-base": "1.28.0",
117212
+ "@opentelemetry/semantic-conventions": "1.43.0",
117223
117213
  ajv: "8.18.0",
117224
117214
  asciichart: "1.5.25",
117225
117215
  "async-mutex": "^0.5.0",
@@ -117245,8 +117235,8 @@ var init_package = __esm(() => {
117245
117235
  ink: "6.8.0",
117246
117236
  "jsonc-parser": "3.3.1",
117247
117237
  "lodash-es": "4.17.23",
117248
- "lru-cache": "11.2.7",
117249
- marked: "17.0.5",
117238
+ "lru-cache": "11.5.2",
117239
+ marked: "18.0.9",
117250
117240
  "p-map": "7.0.4",
117251
117241
  picomatch: "4.0.4",
117252
117242
  "proper-lockfile": "4.1.2",
@@ -209693,6 +209683,26 @@ var init_dumpPrompts = __esm(() => {
209693
209683
 
209694
209684
  // src/utils/abortController.ts
209695
209685
  import { setMaxListeners as setMaxListeners2 } from "events";
209686
+ function combineAbortSignals(signals2) {
209687
+ if (typeof AbortSignal.any === "function") {
209688
+ return AbortSignal.any(signals2);
209689
+ }
209690
+ const controller = new AbortController;
209691
+ const abort = () => controller.abort();
209692
+ for (const signal of signals2) {
209693
+ if (signal.aborted) {
209694
+ controller.abort();
209695
+ return controller.signal;
209696
+ }
209697
+ signal.addEventListener("abort", abort, { once: true });
209698
+ }
209699
+ controller.signal.addEventListener("abort", () => {
209700
+ for (const signal of signals2) {
209701
+ signal.removeEventListener("abort", abort);
209702
+ }
209703
+ });
209704
+ return controller.signal;
209705
+ }
209696
209706
  function createAbortController(maxListeners = DEFAULT_MAX_LISTENERS) {
209697
209707
  const controller = new AbortController;
209698
209708
  setMaxListeners2(maxListeners, controller.signal);
@@ -279592,13 +279602,15 @@ function resetCseShimGateForTesting() {
279592
279602
  function toCompatSessionId(id) {
279593
279603
  if (!id.startsWith("cse_"))
279594
279604
  return id;
279595
- if (_isCseShimEnabled && !_isCseShimEnabled())
279605
+ if (_isCseShimEnabled !== undefined && !_isCseShimEnabled())
279596
279606
  return id;
279597
279607
  return "session_" + id.slice("cse_".length);
279598
279608
  }
279599
279609
  function toInfraSessionId(id) {
279600
279610
  if (!id.startsWith("session_"))
279601
279611
  return id;
279612
+ if (_isCseShimEnabled && !_isCseShimEnabled())
279613
+ return id;
279602
279614
  return "cse_" + id.slice("session_".length);
279603
279615
  }
279604
279616
  var _isCseShimEnabled;
@@ -280211,35 +280223,144 @@ function validateBlock(block, blockIndex) {
280211
280223
  }
280212
280224
  function checkDuplicateKeysInJson(jsonString) {
280213
280225
  const warnings = [];
280214
- const bindingsBlockPattern = /"bindings"\s*:\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g;
280215
- let blockMatch;
280216
- while ((blockMatch = bindingsBlockPattern.exec(jsonString)) !== null) {
280217
- const blockContent = blockMatch[1];
280218
- if (!blockContent)
280219
- continue;
280220
- const textBeforeBlock = jsonString.slice(0, blockMatch.index);
280221
- const contextMatch = textBeforeBlock.match(/"context"\s*:\s*"([^"]+)"[^{]*$/);
280222
- const context = contextMatch?.[1] ?? "unknown";
280223
- const keyPattern = /"([^"]+)"\s*:/g;
280224
- const keysByName = new Map;
280225
- let keyMatch;
280226
- while ((keyMatch = keyPattern.exec(blockContent)) !== null) {
280227
- const key2 = keyMatch[1];
280228
- if (!key2)
280229
- continue;
280230
- const count3 = (keysByName.get(key2) ?? 0) + 1;
280231
- keysByName.set(key2, count3);
280232
- if (count3 === 2) {
280233
- warnings.push({
280234
- type: "duplicate",
280235
- severity: "warning",
280236
- message: `Duplicate key "${key2}" in ${context} bindings`,
280237
- key: key2,
280238
- context,
280239
- suggestion: `This key appears multiple times in the same context. JSON uses the last value, earlier values are ignored.`
280240
- });
280226
+ let i3 = 0;
280227
+ const len = jsonString.length;
280228
+ let depth = 0;
280229
+ let inBindings = false;
280230
+ let currentContext = "unknown";
280231
+ const bindingsKeyMaps = [];
280232
+ function parseString(pos) {
280233
+ if (pos >= len || jsonString[pos] !== '"')
280234
+ return null;
280235
+ let end = pos + 1;
280236
+ while (end < len) {
280237
+ if (jsonString[end] === "\\") {
280238
+ end += 2;
280239
+ } else if (jsonString[end] === '"') {
280240
+ let decoded = "";
280241
+ for (let k2 = pos + 1;k2 < end; k2++) {
280242
+ if (jsonString[k2] === "\\" && k2 + 1 < end) {
280243
+ const esc2 = jsonString[k2 + 1];
280244
+ switch (esc2) {
280245
+ case '"':
280246
+ decoded += '"';
280247
+ break;
280248
+ case "\\":
280249
+ decoded += "\\";
280250
+ break;
280251
+ case "/":
280252
+ decoded += "/";
280253
+ break;
280254
+ case "b":
280255
+ decoded += "\b";
280256
+ break;
280257
+ case "f":
280258
+ decoded += "\f";
280259
+ break;
280260
+ case "n":
280261
+ decoded += `
280262
+ `;
280263
+ break;
280264
+ case "r":
280265
+ decoded += "\r";
280266
+ break;
280267
+ case "t":
280268
+ decoded += "\t";
280269
+ break;
280270
+ case "u": {
280271
+ if (k2 + 5 < end) {
280272
+ const hex3 = jsonString.slice(k2 + 2, k2 + 6);
280273
+ const cp2 = parseInt(hex3, 16);
280274
+ decoded += isNaN(cp2) ? jsonString.slice(k2, k2 + 6) : String.fromCharCode(cp2);
280275
+ k2 += 4;
280276
+ } else {
280277
+ decoded += "u";
280278
+ k2++;
280279
+ }
280280
+ break;
280281
+ }
280282
+ default:
280283
+ decoded += esc2;
280284
+ break;
280285
+ }
280286
+ k2++;
280287
+ } else {
280288
+ decoded += jsonString[k2];
280289
+ }
280290
+ }
280291
+ return { str: decoded, nextPos: end + 1 };
280292
+ } else {
280293
+ end++;
280241
280294
  }
280242
280295
  }
280296
+ return null;
280297
+ }
280298
+ function skipWhitespace(pos) {
280299
+ while (pos < len && (jsonString[pos] === " " || jsonString[pos] === `
280300
+ ` || jsonString[pos] === "\t" || jsonString[pos] === "\r")) {
280301
+ pos++;
280302
+ }
280303
+ return pos;
280304
+ }
280305
+ while (i3 < len) {
280306
+ const char = jsonString[i3];
280307
+ if (char === "{") {
280308
+ depth++;
280309
+ if (depth === 2 && inBindings) {
280310
+ bindingsKeyMaps.push(new Map);
280311
+ }
280312
+ i3++;
280313
+ } else if (char === "}") {
280314
+ if (depth === 2 && inBindings) {
280315
+ bindingsKeyMaps.pop();
280316
+ }
280317
+ depth--;
280318
+ i3++;
280319
+ } else if (char === '"') {
280320
+ const result = parseString(i3);
280321
+ if (result) {
280322
+ const str = result.str;
280323
+ i3 = result.nextPos;
280324
+ const after = skipWhitespace(i3);
280325
+ if (after < len && jsonString[after] === ":") {
280326
+ if (depth === 1) {
280327
+ if (str === "context") {
280328
+ const afterColon = skipWhitespace(after + 1);
280329
+ const valResult = parseString(afterColon);
280330
+ if (valResult) {
280331
+ currentContext = valResult.str;
280332
+ i3 = valResult.nextPos;
280333
+ }
280334
+ } else if (str === "bindings") {
280335
+ inBindings = true;
280336
+ }
280337
+ } else if (depth === 2 && inBindings) {
280338
+ if (bindingsKeyMaps.length > 0) {
280339
+ const keysMap = bindingsKeyMaps[bindingsKeyMaps.length - 1];
280340
+ const count3 = (keysMap.get(str) ?? 0) + 1;
280341
+ keysMap.set(str, count3);
280342
+ if (count3 === 2) {
280343
+ warnings.push({
280344
+ type: "duplicate",
280345
+ severity: "warning",
280346
+ message: `Duplicate key "${str}" in ${currentContext} bindings`,
280347
+ key: str,
280348
+ context: currentContext,
280349
+ suggestion: `This key appears multiple times in the same context. JSON uses the last value, earlier values are ignored.`
280350
+ });
280351
+ }
280352
+ }
280353
+ }
280354
+ }
280355
+ } else {
280356
+ i3++;
280357
+ }
280358
+ } else if (char === "]" || char === "[" || char === "," || char === ":" || `
280359
+ \r`.includes(char)) {
280360
+ i3++;
280361
+ } else {
280362
+ i3++;
280363
+ }
280243
280364
  }
280244
280365
  return warnings;
280245
280366
  }
@@ -281053,15 +281174,19 @@ function useKeybinding(action, handler, options = {}) {
281053
281174
  return;
281054
281175
  return keybindingContext.registerHandler({ action, context, handler });
281055
281176
  }, [action, context, handler, keybindingContext, isActive]);
281056
- const handleInput = import_react33.useCallback((input, key2, event) => {
281177
+ const uniqueContexts = import_react33.useMemo(() => {
281057
281178
  if (!keybindingContext)
281058
- return;
281179
+ return [];
281059
281180
  const contextsToCheck = [
281060
281181
  ...keybindingContext.activeContexts,
281061
281182
  context,
281062
281183
  "Global"
281063
281184
  ];
281064
- const uniqueContexts = [...new Set(contextsToCheck)];
281185
+ return [...new Set(contextsToCheck)];
281186
+ }, [keybindingContext?.activeContexts, context]);
281187
+ const handleInput = import_react33.useCallback((input, key2, event) => {
281188
+ if (!keybindingContext)
281189
+ return;
281065
281190
  const result = keybindingContext.resolve(input, key2, uniqueContexts);
281066
281191
  switch (result.type) {
281067
281192
  case "match":
@@ -281092,11 +281217,13 @@ function useKeybinding(action, handler, options = {}) {
281092
281217
  function useKeybindings(handlers, options = {}) {
281093
281218
  const { context = "Global", isActive = true } = options;
281094
281219
  const keybindingContext = useOptionalKeybindingContext();
281220
+ const handlersRef = import_react33.useRef(handlers);
281221
+ handlersRef.current = handlers;
281095
281222
  import_react33.useEffect(() => {
281096
281223
  if (!keybindingContext || !isActive)
281097
281224
  return;
281098
281225
  const unregisterFns = [];
281099
- for (const [action, handler] of Object.entries(handlers)) {
281226
+ for (const [action, handler] of Object.entries(handlersRef.current)) {
281100
281227
  unregisterFns.push(keybindingContext.registerHandler({ action, context, handler }));
281101
281228
  }
281102
281229
  return () => {
@@ -281118,8 +281245,8 @@ function useKeybindings(handlers, options = {}) {
281118
281245
  switch (result.type) {
281119
281246
  case "match":
281120
281247
  keybindingContext.setPendingChord(null);
281121
- if (result.action in handlers) {
281122
- const handler = handlers[result.action];
281248
+ if (result.action in handlersRef.current) {
281249
+ const handler = handlersRef.current[result.action];
281123
281250
  if (handler && handler() !== false) {
281124
281251
  event.stopImmediatePropagation();
281125
281252
  }
@@ -281139,7 +281266,7 @@ function useKeybindings(handlers, options = {}) {
281139
281266
  case "none":
281140
281267
  break;
281141
281268
  }
281142
- }, [context, handlers, keybindingContext]);
281269
+ }, [context, keybindingContext]);
281143
281270
  use_input_default(handleInput, { isActive });
281144
281271
  }
281145
281272
  var import_react33;
@@ -286010,7 +286137,7 @@ var init_utils6 = __esm(() => {
286010
286137
  function makeXaaFetch(abortSignal) {
286011
286138
  return (url3, init2) => {
286012
286139
  const timeout = AbortSignal.timeout(XAA_REQUEST_TIMEOUT_MS);
286013
- const signal = abortSignal ? AbortSignal.any([timeout, abortSignal]) : timeout;
286140
+ const signal = abortSignal ? combineAbortSignals([timeout, abortSignal]) : timeout;
286014
286141
  return fetch(url3, { ...init2, signal });
286015
286142
  };
286016
286143
  }
@@ -286213,6 +286340,7 @@ var init_xaa = __esm(() => {
286213
286340
  init_v4();
286214
286341
  init_log3();
286215
286342
  init_slowOperations();
286343
+ init_abortController();
286216
286344
  defaultFetch = makeXaaFetch();
286217
286345
  XaaTokenExchangeError = class XaaTokenExchangeError extends Error {
286218
286346
  shouldClearIdToken;
@@ -319466,10 +319594,6 @@ var init_select = __esm(() => {
319466
319594
  });
319467
319595
 
319468
319596
  // src/bridge/bridgeStatusUtil.ts
319469
- function buildBridgeConnectUrl(environmentId, ingressUrl) {
319470
- const baseUrl = getClaudeAiBaseUrl(undefined, ingressUrl);
319471
- return `${baseUrl}/code?bridge=${environmentId}`;
319472
- }
319473
319597
  function getBridgeStatus({
319474
319598
  error: error49,
319475
319599
  connected,
@@ -407070,69 +407194,68 @@ function isInputModeCharacter(input) {
407070
407194
  }
407071
407195
 
407072
407196
  // src/projectOnboardingState.ts
407073
- import { join as join105, resolve as resolve44, basename as basename37, sep as pathSep2 } from "path";
407197
+ import { join as join105 } from "path";
407074
407198
  function clearCachedSteps() {
407075
- cachedSteps = null;
407076
- cachedClaudeMdMtime = -1;
407077
- cachedRootMtime = -1;
407078
- cachedAt = null;
407199
+ cache3 = null;
407079
407200
  }
407080
- function isCacheValid() {
407081
- if (!cachedSteps)
407201
+ function isCacheValid(cached2) {
407202
+ const now2 = performance.now();
407203
+ if (now2 - cached2.timestamp > CACHE_TTL_MS4) {
407082
407204
  return false;
407205
+ }
407083
407206
  const cwd2 = getCwd();
407084
- const claudeMdPath = join105(cwd2, "CLAUDE.md");
407085
407207
  const fs13 = getFsImplementation();
407086
- try {
407087
- const currentClaudeMdMtime = fs13.existsSync(claudeMdPath) ? getFileModificationTime(claudeMdPath) ?? -1 : -1;
407088
- if (currentClaudeMdMtime !== cachedClaudeMdMtime)
407208
+ const hasClaudeMd = fs13.existsSync(join105(cwd2, "CLAUDE.md"));
407209
+ if (hasClaudeMd) {
407210
+ try {
407211
+ const currentMtime = fs13.statSync(join105(cwd2, "CLAUDE.md"))?.mtimeMs ?? null;
407212
+ if (currentMtime !== cached2.claudeMdMtime) {
407213
+ return false;
407214
+ }
407215
+ } catch {
407089
407216
  return false;
407090
- } catch {
407217
+ }
407218
+ } else if (cached2.claudeMdMtime !== null) {
407091
407219
  return false;
407092
407220
  }
407221
+ let currentIsWorkspaceDirEmpty;
407093
407222
  try {
407094
- const currentRootMtime = fs13.statSync(cwd2).mtimeMs;
407095
- if (Math.abs(currentRootMtime - cachedRootMtime) > 0.5)
407096
- return false;
407223
+ currentIsWorkspaceDirEmpty = isDirEmptySync(cwd2);
407097
407224
  } catch {
407098
- return false;
407225
+ currentIsWorkspaceDirEmpty = false;
407099
407226
  }
407100
- if (cachedAt !== null && Date.now() - cachedAt > CACHE_MAX_AGE_MS) {
407227
+ if (currentIsWorkspaceDirEmpty !== cached2.isWorkspaceDirEmpty) {
407101
407228
  return false;
407102
407229
  }
407103
407230
  return true;
407104
407231
  }
407105
407232
  function getSteps() {
407106
- if (isCacheValid()) {
407107
- return cachedSteps;
407233
+ if (cache3 && isCacheValid(cache3)) {
407234
+ return cache3.steps;
407108
407235
  }
407109
407236
  const cwd2 = getCwd();
407110
407237
  const fs13 = getFsImplementation();
407111
- let hasClaudeMd = false;
407112
- let isWorkspaceDirEmpty = true;
407238
+ let hasClaudeMd;
407239
+ let isWorkspaceDirEmpty;
407240
+ let claudeMdMtime = null;
407113
407241
  try {
407114
407242
  hasClaudeMd = fs13.existsSync(join105(cwd2, "CLAUDE.md"));
407115
407243
  } catch {
407116
407244
  hasClaudeMd = false;
407117
407245
  }
407118
407246
  try {
407119
- isWorkspaceDirEmpty = isDirEmpty(cwd2);
407247
+ isWorkspaceDirEmpty = isDirEmptySync(cwd2);
407120
407248
  } catch {
407121
- isWorkspaceDirEmpty = true;
407249
+ isWorkspaceDirEmpty = false;
407122
407250
  }
407123
- const claudeMdPath = join105(cwd2, "CLAUDE.md");
407124
- try {
407125
- cachedClaudeMdMtime = hasClaudeMd ? getFileModificationTime(claudeMdPath) : -1;
407126
- } catch {
407127
- cachedClaudeMdMtime = -1;
407128
- }
407129
- try {
407130
- cachedRootMtime = fs13.statSync(cwd2).mtimeMs;
407131
- } catch {
407132
- cachedRootMtime = -1;
407251
+ if (hasClaudeMd) {
407252
+ try {
407253
+ claudeMdMtime = fs13.statSync(join105(cwd2, "CLAUDE.md"))?.mtimeMs ?? null;
407254
+ } catch {
407255
+ hasClaudeMd = false;
407256
+ }
407133
407257
  }
407134
- cachedAt = Date.now();
407135
- cachedSteps = [
407258
+ const steps = [
407136
407259
  {
407137
407260
  key: "workspace",
407138
407261
  text: "Ask Claude to create a new app or clone a repository",
@@ -407148,7 +407271,14 @@ function getSteps() {
407148
407271
  isEnabled: !isWorkspaceDirEmpty
407149
407272
  }
407150
407273
  ];
407151
- return cachedSteps;
407274
+ const newCache = {
407275
+ steps,
407276
+ timestamp: performance.now(),
407277
+ claudeMdMtime,
407278
+ isWorkspaceDirEmpty
407279
+ };
407280
+ cache3 = newCache;
407281
+ return steps;
407152
407282
  }
407153
407283
  function isProjectOnboardingComplete() {
407154
407284
  return getSteps().filter(({ isCompletable, isEnabled: isEnabled2 }) => isCompletable && isEnabled2).every(({ isComplete }) => isComplete);
@@ -407166,7 +407296,7 @@ function maybeMarkProjectOnboardingComplete() {
407166
407296
  }
407167
407297
  function shouldShowProjectOnboarding() {
407168
407298
  const projectConfig = getCurrentProjectConfig();
407169
- if (projectConfig.hasCompletedProjectOnboarding || projectConfig.projectOnboardingSeenCount >= 4 || process.env.IS_DEMO) {
407299
+ if (projectConfig.hasCompletedProjectOnboarding || projectConfig.hasDismissedProjectOnboarding) {
407170
407300
  return false;
407171
407301
  }
407172
407302
  return !isProjectOnboardingComplete();
@@ -407177,7 +407307,7 @@ function incrementProjectOnboardingSeenCount() {
407177
407307
  projectOnboardingSeenCount: current.projectOnboardingSeenCount + 1
407178
407308
  }));
407179
407309
  }
407180
- var cachedSteps = null, cachedClaudeMdMtime = -1, cachedRootMtime = -1, cachedAt = null, CACHE_MAX_AGE_MS = 60000;
407310
+ var CACHE_TTL_MS4 = 5000, cache3 = null;
407181
407311
  var init_projectOnboardingState = __esm(() => {
407182
407312
  init_config();
407183
407313
  init_cwd2();
@@ -409547,7 +409677,7 @@ var init_renderPlaceholder = __esm(() => {
409547
409677
  });
409548
409678
 
409549
409679
  // src/hooks/usePasteHandler.ts
409550
- import { basename as basename38 } from "path";
409680
+ import { basename as basename37 } from "path";
409551
409681
  function usePasteHandler({
409552
409682
  onPaste,
409553
409683
  onInput,
@@ -409598,7 +409728,7 @@ function usePasteHandler({
409598
409728
  const validImages = results.filter((r) => r !== null);
409599
409729
  if (validImages.length > 0) {
409600
409730
  for (const imageData of validImages) {
409601
- const filename = basename38(imageData.path);
409731
+ const filename = basename37(imageData.path);
409602
409732
  onImagePaste2(imageData.base64, imageData.mediaType, filename, imageData.dimensions, imageData.path);
409603
409733
  }
409604
409734
  const nonImageLines = lines2.filter((line) => !isImageFilePath(line));
@@ -410203,7 +410333,7 @@ var init_TextInput = __esm(() => {
410203
410333
  });
410204
410334
 
410205
410335
  // src/utils/suggestions/directoryCompletion.ts
410206
- import { basename as basename39, dirname as dirname53, join as join112, sep as sep31 } from "path";
410336
+ import { basename as basename38, dirname as dirname53, join as join112, sep as sep31 } from "path";
410207
410337
  function parsePartialPath(partialPath, basePath) {
410208
410338
  if (!partialPath) {
410209
410339
  const directory2 = basePath || getCwd();
@@ -410214,7 +410344,7 @@ function parsePartialPath(partialPath, basePath) {
410214
410344
  return { directory: resolved, prefix: "" };
410215
410345
  }
410216
410346
  const directory = dirname53(resolved);
410217
- const prefix = basename39(partialPath);
410347
+ const prefix = basename38(partialPath);
410218
410348
  return { directory, prefix };
410219
410349
  }
410220
410350
  async function scanDirectory(dirPath) {
@@ -412351,8 +412481,8 @@ class FileIndex {
412351
412481
  }
412352
412482
  loadFromFileListAsync(fileList) {
412353
412483
  let markQueryable = () => {};
412354
- const queryable = new Promise((resolve45) => {
412355
- markQueryable = resolve45;
412484
+ const queryable = new Promise((resolve44) => {
412485
+ markQueryable = resolve44;
412356
412486
  });
412357
412487
  const done = this.buildAsync(fileList, markQueryable);
412358
412488
  return { queryable, done };
@@ -412533,7 +412663,7 @@ function isUpper(code) {
412533
412663
  return code >= 65 && code <= 90;
412534
412664
  }
412535
412665
  function yieldToEventLoop() {
412536
- return new Promise((resolve45) => setImmediate(resolve45));
412666
+ return new Promise((resolve44) => setImmediate(resolve44));
412537
412667
  }
412538
412668
  function computeTopLevelEntries(paths2, limit2) {
412539
412669
  const topLevel = new Set;
@@ -421895,7 +422025,7 @@ function extractFirstFrame(output) {
421895
422025
  return output.slice(contentStart, endIndex);
421896
422026
  }
421897
422027
  function renderToAnsiString(node, columns) {
421898
- return new Promise(async (resolve45) => {
422028
+ return new Promise(async (resolve44) => {
421899
422029
  let output = "";
421900
422030
  const stream4 = new PassThrough3;
421901
422031
  if (columns !== undefined) {
@@ -421911,7 +422041,7 @@ function renderToAnsiString(node, columns) {
421911
422041
  patchConsole: false
421912
422042
  });
421913
422043
  await instance.waitUntilExit();
421914
- await resolve45(extractFirstFrame(output));
422044
+ await resolve44(extractFirstFrame(output));
421915
422045
  });
421916
422046
  }
421917
422047
  async function renderToString(node, columns) {
@@ -422419,14 +422549,14 @@ function computeTurnStats(turn) {
422419
422549
  };
422420
422550
  }
422421
422551
  function useTurnDiffs(messages) {
422422
- const cache3 = import_react111.useRef({
422552
+ const cache4 = import_react111.useRef({
422423
422553
  completedTurns: [],
422424
422554
  currentTurn: null,
422425
422555
  lastProcessedIndex: 0,
422426
422556
  lastTurnIndex: 0
422427
422557
  });
422428
422558
  return import_react111.useMemo(() => {
422429
- const c6 = cache3.current;
422559
+ const c6 = cache4.current;
422430
422560
  if (messages.length < c6.lastProcessedIndex) {
422431
422561
  c6.completedTurns = [];
422432
422562
  c6.currentTurn = null;
@@ -422507,7 +422637,7 @@ var init_useTurnDiffs = __esm(() => {
422507
422637
  });
422508
422638
 
422509
422639
  // src/components/diff/DiffDetailView.tsx
422510
- import { resolve as resolve45 } from "path";
422640
+ import { resolve as resolve44 } from "path";
422511
422641
  function DiffDetailView(t0) {
422512
422642
  const $3 = import_compiler_runtime146.c(53);
422513
422643
  const {
@@ -422540,7 +422670,7 @@ function DiffDetailView(t0) {
422540
422670
  let content;
422541
422671
  let t22;
422542
422672
  if ($3[1] !== filePath) {
422543
- const fullPath = resolve45(getCwd(), filePath);
422673
+ const fullPath = resolve44(getCwd(), filePath);
422544
422674
  content = readFileSafe(fullPath);
422545
422675
  t22 = content?.split(`
422546
422676
  `)[0] ?? null;
@@ -426495,12 +426625,12 @@ import {
426495
426625
  spawn as spawn10,
426496
426626
  spawnSync as spawnSync4
426497
426627
  } from "child_process";
426498
- import { basename as basename40 } from "path";
426628
+ import { basename as basename39 } from "path";
426499
426629
  function isCommandAvailable3(command3) {
426500
426630
  return !!whichSync(command3);
426501
426631
  }
426502
426632
  function classifyGuiEditor(editor) {
426503
- const base2 = basename40(editor.split(" ")[0] ?? "");
426633
+ const base2 = basename39(editor.split(" ")[0] ?? "");
426504
426634
  return GUI_EDITORS.find((g2) => base2.includes(g2));
426505
426635
  }
426506
426636
  function guiGotoArgv(guiFamily, filePath, line) {
@@ -426537,7 +426667,7 @@ function openFileInExternalEditor(filePath, line) {
426537
426667
  const inkInstance = instances_default.get(process.stdout);
426538
426668
  if (!inkInstance)
426539
426669
  return false;
426540
- const useGotoLine = line && PLUS_N_EDITORS.test(basename40(base2));
426670
+ const useGotoLine = line && PLUS_N_EDITORS.test(basename39(base2));
426541
426671
  inkInstance.enterAlternateScreen();
426542
426672
  try {
426543
426673
  const syncOpts = { stdio: "inherit" };
@@ -433717,7 +433847,7 @@ var init_channelPermissions = __esm(() => {
433717
433847
  });
433718
433848
 
433719
433849
  // src/services/mcp/useManageMCPConnections.ts
433720
- import { basename as basename41 } from "path";
433850
+ import { basename as basename40 } from "path";
433721
433851
  function getErrorKey(error49) {
433722
433852
  const plugin = "plugin" in error49 ? error49.plugin : "no-plugin";
433723
433853
  return `${error49.type}:${error49.source}:${plugin}`;
@@ -433872,8 +434002,8 @@ function useManageMCPConnections(dynamicMcpConfig, isStrictMcpConfig = false) {
433872
434002
  }
433873
434003
  const backoffMs = Math.min(INITIAL_BACKOFF_MS * Math.pow(2, attempt - 1), MAX_BACKOFF_MS);
433874
434004
  logMCPDebug(client.name, `Scheduling reconnection attempt ${attempt + 1} in ${backoffMs}ms`);
433875
- await new Promise((resolve46) => {
433876
- const timer = setTimeout(resolve46, backoffMs);
434005
+ await new Promise((resolve45) => {
434006
+ const timer = setTimeout(resolve45, backoffMs);
433877
434007
  reconnectTimersRef.current.set(client.name, timer);
433878
434008
  });
433879
434009
  }
@@ -434094,7 +434224,7 @@ function useManageMCPConnections(dynamicMcpConfig, isStrictMcpConfig = false) {
434094
434224
  else if (serverConfig.scope === "claudeai")
434095
434225
  counts.claudeai++;
434096
434226
  if (process.env.USER_TYPE === "ant" && !isMcpServerDisabled(name) && (serverConfig.type === undefined || serverConfig.type === "stdio") && "command" in serverConfig) {
434097
- stdioCommands.push(basename41(serverConfig.command));
434227
+ stdioCommands.push(basename40(serverConfig.command));
434098
434228
  }
434099
434229
  }
434100
434230
  logEvent("tengu_mcp_servers", {
@@ -436896,7 +437026,7 @@ var init_pluginStartupCheck = __esm(() => {
436896
437026
 
436897
437027
  // src/utils/plugins/parseMarketplaceInput.ts
436898
437028
  import { homedir as homedir30 } from "os";
436899
- import { resolve as resolve46 } from "path";
437029
+ import { resolve as resolve45 } from "path";
436900
437030
  async function parseMarketplaceInput(input) {
436901
437031
  const trimmed = input.trim();
436902
437032
  const fs13 = getFsImplementation();
@@ -436931,7 +437061,7 @@ async function parseMarketplaceInput(input) {
436931
437061
  const isWindows2 = process.platform === "win32";
436932
437062
  const isWindowsPath = isWindows2 && (trimmed.startsWith(".\\") || trimmed.startsWith("..\\") || /^[a-zA-Z]:[/\\]/.test(trimmed));
436933
437063
  if (trimmed.startsWith("./") || trimmed.startsWith("../") || trimmed.startsWith("/") || trimmed.startsWith("~") || isWindowsPath) {
436934
- const resolvedPath = resolve46(trimmed.startsWith("~") ? trimmed.replace(/^~/, homedir30()) : trimmed);
437064
+ const resolvedPath = resolve45(trimmed.startsWith("~") ? trimmed.replace(/^~/, homedir30()) : trimmed);
436935
437065
  let stats;
436936
437066
  try {
436937
437067
  stats = await fs13.stat(resolvedPath);
@@ -437196,34 +437326,34 @@ async function loadInstallCountsCache() {
437196
437326
  logForDebugging("Install counts cache has invalid structure");
437197
437327
  return null;
437198
437328
  }
437199
- const cache3 = parsed;
437200
- if (cache3.version !== INSTALL_COUNTS_CACHE_VERSION) {
437201
- logForDebugging(`Install counts cache version mismatch (got ${cache3.version}, expected ${INSTALL_COUNTS_CACHE_VERSION})`);
437329
+ const cache4 = parsed;
437330
+ if (cache4.version !== INSTALL_COUNTS_CACHE_VERSION) {
437331
+ logForDebugging(`Install counts cache version mismatch (got ${cache4.version}, expected ${INSTALL_COUNTS_CACHE_VERSION})`);
437202
437332
  return null;
437203
437333
  }
437204
- if (typeof cache3.fetchedAt !== "string" || !Array.isArray(cache3.counts)) {
437334
+ if (typeof cache4.fetchedAt !== "string" || !Array.isArray(cache4.counts)) {
437205
437335
  logForDebugging("Install counts cache has invalid structure");
437206
437336
  return null;
437207
437337
  }
437208
- const fetchedAt = new Date(cache3.fetchedAt).getTime();
437338
+ const fetchedAt = new Date(cache4.fetchedAt).getTime();
437209
437339
  if (Number.isNaN(fetchedAt)) {
437210
437340
  logForDebugging("Install counts cache has invalid fetchedAt timestamp");
437211
437341
  return null;
437212
437342
  }
437213
- const validCounts = cache3.counts.every((entry) => typeof entry === "object" && entry !== null && typeof entry.plugin === "string" && typeof entry.unique_installs === "number");
437343
+ const validCounts = cache4.counts.every((entry) => typeof entry === "object" && entry !== null && typeof entry.plugin === "string" && typeof entry.unique_installs === "number");
437214
437344
  if (!validCounts) {
437215
437345
  logForDebugging("Install counts cache has malformed entries");
437216
437346
  return null;
437217
437347
  }
437218
437348
  const now2 = Date.now();
437219
- if (now2 - fetchedAt > CACHE_TTL_MS4) {
437349
+ if (now2 - fetchedAt > CACHE_TTL_MS5) {
437220
437350
  logForDebugging("Install counts cache is stale (>24h old)");
437221
437351
  return null;
437222
437352
  }
437223
437353
  return {
437224
- version: cache3.version,
437225
- fetchedAt: cache3.fetchedAt,
437226
- counts: cache3.counts
437354
+ version: cache4.version,
437355
+ fetchedAt: cache4.fetchedAt,
437356
+ counts: cache4.counts
437227
437357
  };
437228
437358
  } catch (error49) {
437229
437359
  const code = getErrnoCode(error49);
@@ -437233,13 +437363,13 @@ async function loadInstallCountsCache() {
437233
437363
  return null;
437234
437364
  }
437235
437365
  }
437236
- async function saveInstallCountsCache(cache3) {
437366
+ async function saveInstallCountsCache(cache4) {
437237
437367
  const cachePath = getInstallCountsCachePath();
437238
437368
  const tempPath = `${cachePath}.${randomBytes16(8).toString("hex")}.tmp`;
437239
437369
  try {
437240
437370
  const pluginsDir = getPluginsDirectory();
437241
437371
  await getFsImplementation().mkdir(pluginsDir);
437242
- const content = jsonStringify(cache3, null, 2);
437372
+ const content = jsonStringify(cache4, null, 2);
437243
437373
  await writeFile33(tempPath, content, {
437244
437374
  encoding: "utf-8",
437245
437375
  mode: 384
@@ -437271,12 +437401,12 @@ async function fetchInstallCountsFromGitHub() {
437271
437401
  }
437272
437402
  }
437273
437403
  async function getInstallCounts() {
437274
- const cache3 = await loadInstallCountsCache();
437275
- if (cache3) {
437404
+ const cache4 = await loadInstallCountsCache();
437405
+ if (cache4) {
437276
437406
  logForDebugging("Using cached install counts");
437277
437407
  logPluginFetch("install_counts", INSTALL_COUNTS_URL, "cache_hit", 0);
437278
437408
  const map3 = new Map;
437279
- for (const entry of cache3.counts) {
437409
+ for (const entry of cache4.counts) {
437280
437410
  map3.set(entry.plugin, entry.unique_installs);
437281
437411
  }
437282
437412
  return map3;
@@ -437313,7 +437443,7 @@ function formatInstallCount(count4) {
437313
437443
  const formatted = m2.toFixed(1);
437314
437444
  return formatted.endsWith(".0") ? `${formatted.slice(0, -2)}M` : `${formatted}M`;
437315
437445
  }
437316
- var INSTALL_COUNTS_CACHE_VERSION = 1, INSTALL_COUNTS_CACHE_FILENAME = "install-counts-cache.json", INSTALL_COUNTS_URL = "https://raw.githubusercontent.com/anthropics/claude-plugins-official/refs/heads/stats/stats/plugin-installs.json", CACHE_TTL_MS4;
437446
+ var INSTALL_COUNTS_CACHE_VERSION = 1, INSTALL_COUNTS_CACHE_FILENAME = "install-counts-cache.json", INSTALL_COUNTS_URL = "https://raw.githubusercontent.com/anthropics/claude-plugins-official/refs/heads/stats/stats/plugin-installs.json", CACHE_TTL_MS5;
437317
437447
  var init_installCounts = __esm(() => {
437318
437448
  init_axios2();
437319
437449
  init_debug();
@@ -437323,7 +437453,7 @@ var init_installCounts = __esm(() => {
437323
437453
  init_slowOperations();
437324
437454
  init_fetchTelemetry();
437325
437455
  init_pluginDirectories();
437326
- CACHE_TTL_MS4 = 24 * 60 * 60 * 1000;
437456
+ CACHE_TTL_MS5 = 24 * 60 * 60 * 1000;
437327
437457
  });
437328
437458
 
437329
437459
  // src/commands/plugin/PluginOptionsDialog.tsx
@@ -441693,7 +441823,7 @@ async function writeToDisk(plugins) {
441693
441823
  mode: 384
441694
441824
  });
441695
441825
  await rename10(tempPath, filePath);
441696
- cache3 = plugins;
441826
+ cache4 = plugins;
441697
441827
  } catch (error49) {
441698
441828
  logError2(error49);
441699
441829
  try {
@@ -441711,20 +441841,20 @@ async function loadFlaggedPlugins() {
441711
441841
  changed = true;
441712
441842
  }
441713
441843
  }
441714
- cache3 = all4;
441844
+ cache4 = all4;
441715
441845
  if (changed) {
441716
441846
  await writeToDisk(all4);
441717
441847
  }
441718
441848
  }
441719
441849
  function getFlaggedPlugins() {
441720
- return cache3 ?? {};
441850
+ return cache4 ?? {};
441721
441851
  }
441722
441852
  async function addFlaggedPlugin(pluginId) {
441723
- if (cache3 === null) {
441724
- cache3 = await readFromDisk();
441853
+ if (cache4 === null) {
441854
+ cache4 = await readFromDisk();
441725
441855
  }
441726
441856
  const updated = {
441727
- ...cache3,
441857
+ ...cache4,
441728
441858
  [pluginId]: {
441729
441859
  flaggedAt: new Date().toISOString()
441730
441860
  }
@@ -441733,12 +441863,12 @@ async function addFlaggedPlugin(pluginId) {
441733
441863
  logForDebugging(`Flagged plugin: ${pluginId}`);
441734
441864
  }
441735
441865
  async function markFlaggedPluginsSeen(pluginIds) {
441736
- if (cache3 === null) {
441737
- cache3 = await readFromDisk();
441866
+ if (cache4 === null) {
441867
+ cache4 = await readFromDisk();
441738
441868
  }
441739
441869
  const now2 = new Date().toISOString();
441740
441870
  let changed = false;
441741
- const updated = { ...cache3 };
441871
+ const updated = { ...cache4 };
441742
441872
  for (const id of pluginIds) {
441743
441873
  const entry = updated[id];
441744
441874
  if (entry && !entry.seenAt) {
@@ -441751,16 +441881,16 @@ async function markFlaggedPluginsSeen(pluginIds) {
441751
441881
  }
441752
441882
  }
441753
441883
  async function removeFlaggedPlugin(pluginId) {
441754
- if (cache3 === null) {
441755
- cache3 = await readFromDisk();
441884
+ if (cache4 === null) {
441885
+ cache4 = await readFromDisk();
441756
441886
  }
441757
- if (!(pluginId in cache3))
441887
+ if (!(pluginId in cache4))
441758
441888
  return;
441759
- const { [pluginId]: _2, ...rest } = cache3;
441760
- cache3 = rest;
441889
+ const { [pluginId]: _2, ...rest } = cache4;
441890
+ cache4 = rest;
441761
441891
  await writeToDisk(rest);
441762
441892
  }
441763
- var FLAGGED_PLUGINS_FILENAME = "flagged-plugins.json", SEEN_EXPIRY_MS, cache3 = null;
441893
+ var FLAGGED_PLUGINS_FILENAME = "flagged-plugins.json", SEEN_EXPIRY_MS, cache4 = null;
441764
441894
  var init_pluginFlagging = __esm(() => {
441765
441895
  init_debug();
441766
441896
  init_fsOperations();
@@ -451209,10 +451339,10 @@ var require_browser2 = __commonJS((exports) => {
451209
451339
  text2 = canvas;
451210
451340
  canvas = undefined;
451211
451341
  }
451212
- return new Promise(function(resolve48, reject2) {
451342
+ return new Promise(function(resolve47, reject2) {
451213
451343
  try {
451214
451344
  const data = QRCode.create(text2, opts);
451215
- resolve48(renderFunc(data, canvas, opts));
451345
+ resolve47(renderFunc(data, canvas, opts));
451216
451346
  } catch (e) {
451217
451347
  reject2(e);
451218
451348
  }
@@ -451268,11 +451398,11 @@ function getStringRendererFromType(type) {
451268
451398
  }
451269
451399
  function render2(renderFunc, text2, params) {
451270
451400
  if (!params.cb) {
451271
- return new Promise(function(resolve48, reject2) {
451401
+ return new Promise(function(resolve47, reject2) {
451272
451402
  try {
451273
451403
  const data = QRCode.create(text2, params.opts);
451274
451404
  return renderFunc(data, params.opts, function(err2, data2) {
451275
- return err2 ? reject2(err2) : resolve48(data2);
451405
+ return err2 ? reject2(err2) : resolve47(data2);
451276
451406
  });
451277
451407
  } catch (e) {
451278
451408
  reject2(e);
@@ -451987,21 +452117,45 @@ var init_release_notes2 = __esm(() => {
451987
452117
  });
451988
452118
 
451989
452119
  // src/bridge/bridgeConfig.ts
452120
+ function createBridgeOverrideResolver(macro) {
452121
+ const devEnabled = macro?.DEV_BRIDGE_OVERRIDES_ENABLED === true;
452122
+ const token = macro?.BRIDGE_OVERRIDE_TOKEN || "";
452123
+ const baseUrl = macro?.BRIDGE_OVERRIDE_BASE_URL || "";
452124
+ return {
452125
+ getBridgeTokenOverride() {
452126
+ if (!devEnabled) {
452127
+ return;
452128
+ }
452129
+ return token || undefined;
452130
+ },
452131
+ getBridgeBaseUrlOverride() {
452132
+ if (!devEnabled) {
452133
+ return;
452134
+ }
452135
+ return baseUrl || undefined;
452136
+ }
452137
+ };
452138
+ }
452139
+ function getResolver() {
452140
+ return _resolver;
452141
+ }
451990
452142
  function getBridgeTokenOverride() {
451991
- return process.env.USER_TYPE === "ant" && process.env.CLAUDE_BRIDGE_OAUTH_TOKEN || undefined;
452143
+ return getResolver().getBridgeTokenOverride();
451992
452144
  }
451993
452145
  function getBridgeBaseUrlOverride() {
451994
- return process.env.USER_TYPE === "ant" && process.env.CLAUDE_BRIDGE_BASE_URL || undefined;
452146
+ return getResolver().getBridgeBaseUrlOverride();
451995
452147
  }
451996
452148
  function getBridgeAccessToken() {
451997
- return getBridgeTokenOverride() ?? getClaudeAIOAuthTokens()?.accessToken;
452149
+ return getClaudeAIOAuthTokens()?.accessToken;
451998
452150
  }
451999
452151
  function getBridgeBaseUrl() {
452000
- return getBridgeBaseUrlOverride() ?? getOauthConfig().BASE_API_URL;
452152
+ return getOauthConfig().bridgeUrl;
452001
452153
  }
452154
+ var _resolver;
452002
452155
  var init_bridgeConfig = __esm(() => {
452003
452156
  init_oauth();
452004
452157
  init_auth();
452158
+ _resolver = createBridgeOverrideResolver(globalThis.MACRO);
452005
452159
  });
452006
452160
 
452007
452161
  // src/utils/sessionTitle.ts
@@ -453666,8 +453820,8 @@ async function fetchReferralEligibility(campaign = "claude_code_guest_pass") {
453666
453820
  const url3 = `${getOauthConfig().BASE_API_URL}/api/oauth/organizations/${orgUUID}/referral/eligibility`;
453667
453821
  let resolvePromise;
453668
453822
  let rejectPromise;
453669
- const promise3 = new Promise((resolve48, reject2) => {
453670
- resolvePromise = resolve48;
453823
+ const promise3 = new Promise((resolve47, reject2) => {
453824
+ resolvePromise = resolve47;
453671
453825
  rejectPromise = reject2;
453672
453826
  });
453673
453827
  fetchInProgressMap.set(orgUUID, promise3);
@@ -468405,6 +468559,369 @@ var init_vim2 = __esm(() => {
468405
468559
  vim_default = command5;
468406
468560
  });
468407
468561
 
468562
+ // src/flows/definitions.ts
468563
+ function getFlowByName(name) {
468564
+ return DEFAULT_FLOWS.find((flow) => flow.name === name);
468565
+ }
468566
+ function getAllFlows() {
468567
+ return DEFAULT_FLOWS;
468568
+ }
468569
+ var DEFAULT_FLOWS;
468570
+ var init_definitions = __esm(() => {
468571
+ DEFAULT_FLOWS = [
468572
+ {
468573
+ name: "docker-setup",
468574
+ description: "Set up a Docker Compose environment with a web application",
468575
+ steps: [
468576
+ {
468577
+ id: "1",
468578
+ description: "Create Dockerfile for the application",
468579
+ files: ["Dockerfile"],
468580
+ reasoning: "Define how the application should be containerized"
468581
+ },
468582
+ {
468583
+ id: "2",
468584
+ description: "Create docker-compose.yml with services",
468585
+ files: ["docker-compose.yml"],
468586
+ reasoning: "Define the services and their configuration"
468587
+ },
468588
+ {
468589
+ id: "3",
468590
+ description: "Create .dockerignore file",
468591
+ files: [".dockerignore"],
468592
+ reasoning: "Exclude unnecessary files from the Docker build context"
468593
+ },
468594
+ {
468595
+ id: "4",
468596
+ description: "Create .env.example file",
468597
+ files: [".env.example"],
468598
+ reasoning: "Document required environment variables"
468599
+ },
468600
+ {
468601
+ id: "5",
468602
+ description: "Create README with Docker setup instructions",
468603
+ files: ["README.md"],
468604
+ reasoning: "Provide clear instructions for users"
468605
+ }
468606
+ ]
468607
+ },
468608
+ {
468609
+ name: "rest-api-setup",
468610
+ description: "Create a REST API with authentication",
468611
+ steps: [
468612
+ {
468613
+ id: "1",
468614
+ description: "Initialize Node.js project with package.json",
468615
+ files: ["package.json"],
468616
+ reasoning: "Set up the project structure"
468617
+ },
468618
+ {
468619
+ id: "2",
468620
+ description: "Install dependencies (express, jsonwebtoken, bcrypt)",
468621
+ command: "npm install express jsonwebtoken bcrypt",
468622
+ reasoning: "Add necessary packages for the API"
468623
+ },
468624
+ {
468625
+ id: "3",
468626
+ description: "Create server.js with Express setup",
468627
+ files: ["server.js"],
468628
+ reasoning: "Set up the HTTP server"
468629
+ },
468630
+ {
468631
+ id: "4",
468632
+ description: "Create routes directory and user routes",
468633
+ files: ["routes/userRoutes.js"],
468634
+ reasoning: "Define API endpoints"
468635
+ },
468636
+ {
468637
+ id: "5",
468638
+ description: "Create middleware for authentication",
468639
+ files: ["middleware/auth.js"],
468640
+ reasoning: "Add security to protected routes"
468641
+ },
468642
+ {
468643
+ id: "6",
468644
+ description: "Create .env.example file",
468645
+ files: [".env.example"],
468646
+ reasoning: "Document required environment variables"
468647
+ },
468648
+ {
468649
+ id: "7",
468650
+ description: "Create README with API documentation",
468651
+ files: ["README.md"],
468652
+ reasoning: "Provide clear usage instructions"
468653
+ }
468654
+ ]
468655
+ },
468656
+ {
468657
+ name: "react-app-setup",
468658
+ description: "Set up a modern React application with TypeScript",
468659
+ steps: [
468660
+ {
468661
+ id: "1",
468662
+ description: "Create package.json with React dependencies",
468663
+ files: ["package.json"],
468664
+ reasoning: "Define project dependencies"
468665
+ },
468666
+ {
468667
+ id: "2",
468668
+ description: "Create tsconfig.json",
468669
+ files: ["tsconfig.json"],
468670
+ reasoning: "Configure TypeScript"
468671
+ },
468672
+ {
468673
+ id: "3",
468674
+ description: "Create vite.config.ts",
468675
+ files: ["vite.config.ts"],
468676
+ reasoning: "Configure Vite build tool"
468677
+ },
468678
+ {
468679
+ id: "4",
468680
+ description: "Create index.html entry point",
468681
+ files: ["index.html"],
468682
+ reasoning: "Define the HTML structure"
468683
+ },
468684
+ {
468685
+ id: "5",
468686
+ description: "Create src/main.tsx",
468687
+ files: ["src/main.tsx"],
468688
+ reasoning: "Set up the React entry point"
468689
+ },
468690
+ {
468691
+ id: "6",
468692
+ description: "Create src/App.tsx",
468693
+ files: ["src/App.tsx"],
468694
+ reasoning: "Create the main application component"
468695
+ },
468696
+ {
468697
+ id: "7",
468698
+ description: "Create .gitignore",
468699
+ files: [".gitignore"],
468700
+ reasoning: "Exclude build artifacts and node_modules"
468701
+ },
468702
+ {
468703
+ id: "8",
468704
+ description: "Create README with setup instructions",
468705
+ files: ["README.md"],
468706
+ reasoning: "Provide clear setup instructions"
468707
+ }
468708
+ ]
468709
+ },
468710
+ {
468711
+ name: "testing-setup",
468712
+ description: "Set up a comprehensive testing suite",
468713
+ steps: [
468714
+ {
468715
+ id: "1",
468716
+ description: "Install testing dependencies (vitest, @testing-library/react)",
468717
+ command: "npm install -D vitest @testing-library/react @testing-library/jest-dom",
468718
+ reasoning: "Add testing tools"
468719
+ },
468720
+ {
468721
+ id: "2",
468722
+ description: "Create vitest.config.ts",
468723
+ files: ["vitest.config.ts"],
468724
+ reasoning: "Configure Vitest"
468725
+ },
468726
+ {
468727
+ id: "3",
468728
+ description: "Create test setup file",
468729
+ files: ["src/setupTests.ts"],
468730
+ reasoning: "Set up testing environment"
468731
+ },
468732
+ {
468733
+ id: "4",
468734
+ description: "Create example test file",
468735
+ files: ["src/__tests__/example.test.ts"],
468736
+ reasoning: "Provide a template for writing tests"
468737
+ },
468738
+ {
468739
+ id: "5",
468740
+ description: "Update package.json scripts",
468741
+ files: ["package.json"],
468742
+ reasoning: "Add test scripts"
468743
+ },
468744
+ {
468745
+ id: "6",
468746
+ description: "Create README with testing guide",
468747
+ files: ["README.md"],
468748
+ reasoning: "Document testing practices"
468749
+ }
468750
+ ]
468751
+ }
468752
+ ];
468753
+ });
468754
+
468755
+ // src/flows/executor.ts
468756
+ async function executeFlow(flow, context2, onStepStart, onStepComplete, onStepFail, onComplete) {
468757
+ const state = {
468758
+ currentStepIndex: 0,
468759
+ completedSteps: [],
468760
+ failedSteps: [],
468761
+ totalSteps: flow.steps.length,
468762
+ startTime: Date.now()
468763
+ };
468764
+ for (let i3 = 0;i3 < flow.steps.length; i3++) {
468765
+ const step = flow.steps[i3];
468766
+ state.currentStepIndex = i3;
468767
+ try {
468768
+ if (onStepStart) {
468769
+ await onStepStart(step, state);
468770
+ }
468771
+ if (step.command) {
468772
+ await executeCommand(step.command, context2);
468773
+ }
468774
+ if (step.files && step.files.length > 0) {
468775
+ for (const file2 of step.files) {
468776
+ await executeFileOperation(file2, context2);
468777
+ }
468778
+ }
468779
+ state.completedSteps.push(step.id);
468780
+ if (onStepComplete) {
468781
+ try {
468782
+ await onStepComplete(step, state);
468783
+ } catch (callbackError) {
468784
+ console.error(`onStepComplete callback failed for step "${step.id}":`, callbackError);
468785
+ }
468786
+ }
468787
+ } catch (error49) {
468788
+ state.failedSteps.push(step.id);
468789
+ if (onStepFail) {
468790
+ await onStepFail(step, state, error49);
468791
+ }
468792
+ const shouldContinue = await shouldContinueOnError(error49, step);
468793
+ if (!shouldContinue) {
468794
+ break;
468795
+ }
468796
+ }
468797
+ }
468798
+ if (onComplete) {
468799
+ await onComplete(state);
468800
+ }
468801
+ return state;
468802
+ }
468803
+ async function executeCommand(command6, context2) {
468804
+ if (context2?.bridge?.runCommand) {
468805
+ await context2.bridge.runCommand(command6);
468806
+ return;
468807
+ }
468808
+ throw new Error("No bridge.runCommand available to execute: " + command6);
468809
+ }
468810
+ async function executeFileOperation(file2, context2) {
468811
+ if (context2?.bridge?.editFile) {
468812
+ await context2.bridge.editFile(file2);
468813
+ return;
468814
+ }
468815
+ throw new Error("No bridge.editFile available to edit: " + file2);
468816
+ }
468817
+ async function shouldContinueOnError(error49, step) {
468818
+ const errorMessages2 = [
468819
+ "EACCES",
468820
+ "ENOENT",
468821
+ "ETIMEDOUT"
468822
+ ];
468823
+ return errorMessages2.some((msg) => error49.message.includes(msg));
468824
+ }
468825
+
468826
+ // src/commands/flow.ts
468827
+ function getPromptContent3(args) {
468828
+ const { flow: flowAttribution } = getAttributionTexts();
468829
+ const flows = getAllFlows();
468830
+ if (!args.trim()) {
468831
+ return `## Available Flows
468832
+
468833
+ ${flows.map((flow2) => `- **${flow2.name}**: ${flow2.description}`).join(`
468834
+ `)}
468835
+
468836
+ Please specify a flow name to execute, e.g., "/flow docker-setup"`;
468837
+ }
468838
+ const flow = getFlowByName(args.trim());
468839
+ if (!flow) {
468840
+ return `## Flow Not Found
468841
+
468842
+ Could not find a flow named "${args.trim()}".
468843
+
468844
+ Available flows:
468845
+ ${flows.map((f) => `- ${f.name}: ${f.description}`).join(`
468846
+ `)}`;
468847
+ }
468848
+ return `## Flow: ${flow.name}
468849
+
468850
+ **Description**: ${flow.description}
468851
+
468852
+ ## Execution Plan
468853
+
468854
+ ${flow.steps.map((step, index) => `${index + 1}. **${step.id}**: ${step.description}${step.reasoning ? ` - ${step.reasoning}` : ""}`).join(`
468855
+ `)}
468856
+
468857
+ ## Your Task
468858
+
468859
+ Execute the flow step by step:
468860
+
468861
+ 1. Start with step 1 and work through all steps sequentially
468862
+ 2. For each step, follow the description and reasoning provided
468863
+ 3. Use the available tools (Edit, Run commands, etc.) to complete each step
468864
+ 4. Report progress after each step
468865
+ 5. If a step fails, analyze the error and determine if it's recoverable
468866
+ 6. Continue to the next step unless the error is critical
468867
+
468868
+ ## Important Rules
468869
+
468870
+ - Execute steps in order
468871
+ - Report progress after each step
468872
+ - Handle errors gracefully
468873
+ - Verify each step completes successfully before moving to the next
468874
+ ${flowAttribution ? `
468875
+
468876
+ ${flowAttribution}` : ""}`;
468877
+ }
468878
+ var ALLOWED_TOOLS3, command6, flow_default;
468879
+ var init_flow = __esm(() => {
468880
+ init_attribution();
468881
+ init_definitions();
468882
+ ALLOWED_TOOLS3 = [
468883
+ "Bash(*)",
468884
+ "Edit(*)",
468885
+ "Read(*)",
468886
+ "List(*)",
468887
+ "Create(*)"
468888
+ ];
468889
+ command6 = {
468890
+ type: "prompt",
468891
+ name: "flow",
468892
+ description: "Execute pre-built workflows (flows)",
468893
+ allowedTools: ALLOWED_TOOLS3,
468894
+ contentLength: 0,
468895
+ progressMessage: "executing flow",
468896
+ source: "builtin",
468897
+ async getPromptForCommand(args, context2) {
468898
+ return getPromptContent3(args);
468899
+ },
468900
+ async executeFlow(args, context2) {
468901
+ const flow = getFlowByName(args.trim());
468902
+ if (!flow) {
468903
+ throw new Error(`Flow not found: ${args}`);
468904
+ }
468905
+ const state = await executeFlow(flow, context2, async (step, state2) => {
468906
+ console.log(`
468907
+ ▶️ Starting step ${state2.currentStepIndex + 1}/${state2.totalSteps}: ${step.description}`);
468908
+ }, async (step, state2) => {
468909
+ console.log(`✅ Step ${state2.currentStepIndex}/${state2.totalSteps} completed: ${step.description}`);
468910
+ }, async (step, state2, error49) => {
468911
+ console.error(`❌ Step ${state2.currentStepIndex}/${state2.totalSteps} failed: ${step.description}`);
468912
+ console.error(`Error: ${error49.message}`);
468913
+ }, async (state2) => {
468914
+ console.log(`
468915
+ \uD83C\uDF89 Flow execution complete!`);
468916
+ console.log(`Completed: ${state2.completedSteps.length}/${state2.totalSteps}`);
468917
+ console.log(`Failed: ${state2.failedSteps.length}/${state2.totalSteps}`);
468918
+ });
468919
+ return state;
468920
+ }
468921
+ };
468922
+ flow_default = command6;
468923
+ });
468924
+
468408
468925
  // src/commands/thinkback/thinkback.tsx
468409
468926
  var exports_thinkback = {};
468410
468927
  __export(exports_thinkback, {
@@ -483906,11 +484423,11 @@ var init_sandbox_toggle = __esm(() => {
483906
484423
  });
483907
484424
 
483908
484425
  // src/commands/sandbox-toggle/index.ts
483909
- var command6, sandbox_toggle_default;
484426
+ var command7, sandbox_toggle_default;
483910
484427
  var init_sandbox_toggle2 = __esm(() => {
483911
484428
  init_figures();
483912
484429
  init_sandbox_adapter();
483913
- command6 = {
484430
+ command7 = {
483914
484431
  name: "sandbox",
483915
484432
  get description() {
483916
484433
  const currentlyEnabled = SandboxManager2.isSandboxingEnabled();
@@ -483942,7 +484459,7 @@ var init_sandbox_toggle2 = __esm(() => {
483942
484459
  type: "local-jsx",
483943
484460
  load: () => Promise.resolve().then(() => (init_sandbox_toggle(), exports_sandbox_toggle))
483944
484461
  };
483945
- sandbox_toggle_default = command6;
484462
+ sandbox_toggle_default = command7;
483946
484463
  });
483947
484464
 
483948
484465
  // src/utils/claudeInChrome/setupPortable.ts
@@ -484155,18 +484672,18 @@ function registerWindowsNativeHosts(manifestPath) {
484155
484672
  });
484156
484673
  }
484157
484674
  }
484158
- async function createWrapperScript(command7) {
484675
+ async function createWrapperScript(command8) {
484159
484676
  const platform5 = getPlatform();
484160
484677
  const chromeDir = join131(getClaudeConfigHomeDir(), "chrome");
484161
484678
  const wrapperPath = platform5 === "windows" ? join131(chromeDir, "chrome-native-host.bat") : join131(chromeDir, "chrome-native-host");
484162
484679
  const scriptContent = platform5 === "windows" ? `@echo off
484163
484680
  REM Chrome native host wrapper script
484164
484681
  REM Generated by Claude Code - do not edit manually
484165
- ${command7}
484682
+ ${command8}
484166
484683
  ` : `#!/bin/sh
484167
484684
  # Chrome native host wrapper script
484168
484685
  # Generated by Claude Code - do not edit manually
484169
- exec ${command7}
484686
+ exec ${command8}
484170
484687
  `;
484171
484688
  const existingContent = await readFile46(wrapperPath, "utf-8").catch(() => null);
484172
484689
  if (existingContent === scriptContent) {
@@ -484621,10 +485138,10 @@ var init_chrome = __esm(() => {
484621
485138
  });
484622
485139
 
484623
485140
  // src/commands/chrome/index.ts
484624
- var command7, chrome_default;
485141
+ var command8, chrome_default;
484625
485142
  var init_chrome2 = __esm(() => {
484626
485143
  init_state();
484627
- command7 = {
485144
+ command8 = {
484628
485145
  name: "chrome",
484629
485146
  description: "Claude in Chrome (Beta) settings",
484630
485147
  availability: ["claude-ai"],
@@ -484632,7 +485149,7 @@ var init_chrome2 = __esm(() => {
484632
485149
  type: "local-jsx",
484633
485150
  load: () => Promise.resolve().then(() => (init_chrome(), exports_chrome))
484634
485151
  };
484635
- chrome_default = command7;
485152
+ chrome_default = command8;
484636
485153
  });
484637
485154
 
484638
485155
  // src/commands/stickers/stickers.ts
@@ -485116,6 +485633,206 @@ var init_frontend_tdd = __esm(() => {
485116
485633
  frontend_tdd_default = frontendTdd;
485117
485634
  });
485118
485635
 
485636
+ // src/commands/agentic-tdd.ts
485637
+ function getPrompt11(args) {
485638
+ const featureDesc = args.trim() || "(no description provided)";
485639
+ return `You are practicing **Agentic TDD (Test-Driven Development) with automated test-fix-rerun loop**.
485640
+
485641
+ ## User's Request
485642
+
485643
+ ${featureDesc}
485644
+
485645
+ ## Agentic TDD Workflow
485646
+
485647
+ You are in full autonomous mode. Follow the **Red-Green-Refactor** cycle strictly, and execute tests automatically after each change.
485648
+
485649
+ ### Phase 1: Baseline
485650
+ 1. First, run the existing test suite to establish a baseline: \`bun test\`
485651
+ 2. Note which tests pass and fail before you start
485652
+
485653
+ ### Phase 2: \uD83D\uDD34 Red — Write the Failing Test First
485654
+ 1. Understand the requirement and identify the expected behavior
485655
+ 2. Write a test that captures the requirement — this test MUST fail initially
485656
+ 3. The test should cover:
485657
+ - Normal expected behavior (happy path)
485658
+ - Edge cases (empty state, error state, boundary values)
485659
+ - User interactions (click, input, submit, navigation)
485660
+ - Accessibility (ARIA labels, keyboard navigation, focus management)
485661
+ 4. Use the project's existing test framework and conventions (Bun test, Vitest, Jest, etc.)
485662
+ 5. Run the test to verify it fails: \`bun test\`
485663
+ 6. If the test passes unexpectedly, it's a buggy test — fix the test
485664
+
485665
+ ### Phase 3: \uD83D\uDFE2 Green — Minimum Code to Pass
485666
+ 1. Write ONLY the code needed to make the failing test pass
485667
+ 2. No speculative features, no future-proofing, no "while I'm here" additions
485668
+ 3. After writing code, run the tests: \`bun test\`
485669
+ 4. If tests fail, analyze the error output and iterate:
485670
+ - Read the error message and stack trace
485671
+ - Identify what's broken
485672
+ - Fix the implementation
485673
+ - Re-run tests
485674
+ - Repeat until all tests pass (up to 5 iterations)
485675
+
485676
+ ### Phase 4: \uD83D\uDD35 Refactor — Clean Up Safely
485677
+ 1. Once the test is green, refactor for clarity and maintainability
485678
+ 2. Run tests after each refactor step: \`bun test\`
485679
+ 3. The test MUST stay green after every refactor step
485680
+ 4. If the test turns red during refactor, the refactor broke something — revert
485681
+
485682
+ ### Phase 5: Final Verification
485683
+ 1. Run the full test suite one final time: \`bun test\`
485684
+ 2. Report the results to the user
485685
+
485686
+ ## Automated Test-Fix-Rerun Loop Rules
485687
+
485688
+ - After EVERY code change, run \`bun test\` immediately
485689
+ - If tests fail, parse the error output and fix the code
485690
+ - Do NOT modify tests to make them pass — fix the implementation instead
485691
+ - Maximum 5 fix iterations per Red or Green phase
485692
+ - If after 5 iterations the tests still fail, report the failure to the user with the error details
485693
+
485694
+ ## Testing Guidelines
485695
+
485696
+ - **Component tests**: Test behavior, not implementation details
485697
+ - **User interactions**: Use \`@testing-library/user-event\` over \`fireEvent\`
485698
+ - **Accessibility**: Prefer queries by role (\`getByRole\`) over test IDs
485699
+ - **Async**: Use \`waitFor\` or \`findBy*\` queries for async operations
485700
+ - **Mocking**: Mock external APIs at the network level (MSW) or module level (vi.mock)
485701
+ - **Style**: Test visual outcomes (is the element visible/disabled?), not CSS class names
485702
+ - **Snapshots**: Use sparingly — prefer assertion-based tests
485703
+
485704
+ ## Project Context
485705
+
485706
+ - Test framework: Bun test (\`bun test\`)
485707
+ - Check \`package.json\` for test framework and scripts
485708
+ - Check existing test files in \`__tests__/\`, \`*.test.tsx\`, \`*.spec.tsx\` for conventions
485709
+
485710
+ ## Important Rules
485711
+
485712
+ - NEVER skip the Red phase — a passing test without implementation is a buggy test
485713
+ - NEVER modify a test to make it pass — fix the implementation instead
485714
+ - Run the test suite after each change to ensure nothing is broken
485715
+ - If multiple test files exist, run only the relevant test file during development for speed, but run the full suite for final verification
485716
+ - Report each phase completion to the user`;
485717
+ }
485718
+ var agenticTdd, agentic_tdd_default;
485719
+ var init_agentic_tdd = __esm(() => {
485720
+ agenticTdd = {
485721
+ type: "prompt",
485722
+ name: "agentic-tdd",
485723
+ description: "Agentic TDD with automated test-fix-rerun loop — write tests, run, fix, repeat autonomously",
485724
+ argumentHint: "<feature description or bug fix description>",
485725
+ progressMessage: "running agentic TDD loop",
485726
+ contentLength: 0,
485727
+ source: "builtin",
485728
+ async getPromptForCommand(args) {
485729
+ return [{ type: "text", text: getPrompt11(args) }];
485730
+ }
485731
+ };
485732
+ agentic_tdd_default = agenticTdd;
485733
+ });
485734
+
485735
+ // src/commands/agent.ts
485736
+ function getPlanPrompt(args) {
485737
+ const taskDesc = args.trim() || "(no description provided)";
485738
+ return `You are an autonomous coding agent. Your goal is to complete the user's request by breaking it down into concrete steps and executing them.
485739
+
485740
+ ## User's Request
485741
+
485742
+ ${taskDesc}
485743
+
485744
+ ## Your Task
485745
+
485746
+ 1. **Analyze the request** and understand what needs to be done
485747
+ 2. **Create a plan** with 3-7 concrete steps. Each step should be:
485748
+ - Specific and actionable
485749
+ - Can be executed using available tools (edit files, run commands, etc.)
485750
+ - Logical order (start with setup, then core changes, then verification)
485751
+ 3. **For each step**, provide:
485752
+ - A clear description of what to do
485753
+ - The specific command or file changes needed
485754
+ - Brief reasoning for why this step is important
485755
+ - How to verify the step was successful (run tests, check output, etc.)
485756
+
485757
+ ## Planning Guidelines
485758
+
485759
+ - Break down complex tasks into smaller, manageable steps
485760
+ - Include setup steps (install dependencies, create files, etc.)
485761
+ - Include verification steps (run tests, build, check output)
485762
+ - Consider edge cases and potential issues
485763
+ - Keep the plan realistic and achievable
485764
+
485765
+ ## Example Plan Structure
485766
+
485767
+ 1. **Setup**: Install dependencies, set up environment
485768
+ 2. **Create files**: Generate necessary files based on requirements
485769
+ 3. **Implement core logic**: Write the main functionality
485770
+ 4. **Add tests**: Write tests to verify the implementation
485771
+ 5. **Run verification**: Execute tests and build to ensure everything works
485772
+ 6. **Cleanup**: Remove temporary files or unnecessary changes
485773
+
485774
+ ## Important Rules
485775
+
485776
+ - Always provide a clear, numbered plan
485777
+ - Each step should be independent and executable
485778
+ - Include verification steps to ensure the task is complete
485779
+ - Be realistic about what can be done in a single step
485780
+ - If the request is too vague, ask for clarification before planning
485781
+
485782
+ After creating the plan, ask the user to confirm it before proceeding to execution.`;
485783
+ }
485784
+ var agent, agent_default;
485785
+ var init_agent2 = __esm(() => {
485786
+ agent = {
485787
+ type: "prompt",
485788
+ name: "agent",
485789
+ description: "Autonomous agent mode - plan and execute tasks step-by-step",
485790
+ argumentHint: "<task description>",
485791
+ progressMessage: "agent mode executing",
485792
+ contentLength: 0,
485793
+ source: "builtin",
485794
+ async getPromptForCommand(args, context2) {
485795
+ const taskDesc = args.trim() || "(no description provided)";
485796
+ return [
485797
+ { type: "text", text: getPlanPrompt(taskDesc) },
485798
+ {
485799
+ type: "text",
485800
+ text: `
485801
+ ## Execution Instructions
485802
+
485803
+ After you receive this plan, you will execute each step one by one. For each step:
485804
+ 1. Read the step description carefully
485805
+ 2. Use the available tools to execute it
485806
+ 3. Verify the step completed successfully (run tests, check output, etc.)
485807
+ 4. Report the results
485808
+ 5. Only move to the next step after completing the current one
485809
+
485810
+ ## Self-Correction
485811
+
485812
+ If a step fails:
485813
+ 1. Analyze the error message
485814
+ 2. Determine the root cause
485815
+ 3. Apply a fix (revert changes, re-edit, or try alternative approach)
485816
+ 4. Re-verify the step
485817
+ 5. If it still fails after 3 attempts, report the failure and move on
485818
+
485819
+ ## User Approval
485820
+
485821
+ Before starting execution, present the plan to the user and ask for confirmation:
485822
+ - "Here is my plan for completing this task:"
485823
+ - List the steps
485824
+ - "Shall I proceed with this plan?"
485825
+
485826
+ Wait for user confirmation before executing the first step.
485827
+
485828
+ **Important**: You are in autonomous mode. Execute the plan step-by-step. Report progress after each step and a summary at the end.`
485829
+ }
485830
+ ];
485831
+ }
485832
+ };
485833
+ agent_default = agent;
485834
+ });
485835
+
485119
485836
  // src/commands/remember.ts
485120
485837
  import { appendFile as appendFile5, mkdir as mkdir36 } from "fs/promises";
485121
485838
  import { join as join133 } from "path";
@@ -485176,7 +485893,7 @@ var init_remember = __esm(() => {
485176
485893
  // src/skills/bundledSkills.ts
485177
485894
  import { constants as fsConstants5 } from "fs";
485178
485895
  import { mkdir as mkdir37, open as open14 } from "fs/promises";
485179
- import { dirname as dirname59, isAbsolute as isAbsolute28, join as join134, normalize as normalize13, sep as pathSep3 } from "path";
485896
+ import { dirname as dirname59, isAbsolute as isAbsolute28, join as join134, normalize as normalize13, sep as pathSep2 } from "path";
485180
485897
  function registerBundledSkill(definition) {
485181
485898
  const { files: files3 } = definition;
485182
485899
  let skillRoot;
@@ -485194,7 +485911,7 @@ function registerBundledSkill(definition) {
485194
485911
  return prependBaseDir(blocks, extractedDir);
485195
485912
  };
485196
485913
  }
485197
- const command8 = {
485914
+ const command9 = {
485198
485915
  type: "prompt",
485199
485916
  name: definition.name,
485200
485917
  description: definition.description,
@@ -485218,7 +485935,7 @@ function registerBundledSkill(definition) {
485218
485935
  progressMessage: "running",
485219
485936
  getPromptForCommand
485220
485937
  };
485221
- bundledSkills.push(command8);
485938
+ bundledSkills.push(command9);
485222
485939
  }
485223
485940
  function getBundledSkills() {
485224
485941
  return [...bundledSkills];
@@ -485263,7 +485980,7 @@ async function safeWriteFile(p, content) {
485263
485980
  }
485264
485981
  function resolveSkillFilePath(baseDir, relPath) {
485265
485982
  const normalized = normalize13(relPath);
485266
- if (isAbsolute28(normalized) || normalized.split(pathSep3).includes("..") || normalized.split("/").includes("..")) {
485983
+ if (isAbsolute28(normalized) || normalized.split(pathSep2).includes("..") || normalized.split("/").includes("..")) {
485267
485984
  throw new Error(`bundled skill file path escapes skill dir: ${relPath}`);
485268
485985
  }
485269
485986
  return join134(baseDir, normalized);
@@ -487764,8 +488481,8 @@ async function withStatsCacheLock(fn) {
487764
488481
  await statsCacheLockPromise;
487765
488482
  }
487766
488483
  let releaseLock2;
487767
- statsCacheLockPromise = new Promise((resolve48) => {
487768
- releaseLock2 = resolve48;
488484
+ statsCacheLockPromise = new Promise((resolve47) => {
488485
+ releaseLock2 = resolve47;
487769
488486
  });
487770
488487
  try {
487771
488488
  return await fn();
@@ -487843,7 +488560,7 @@ async function loadStatsCache() {
487843
488560
  return getEmptyCache();
487844
488561
  }
487845
488562
  }
487846
- async function saveStatsCache(cache4) {
488563
+ async function saveStatsCache(cache5) {
487847
488564
  const fs14 = getFsImplementation();
487848
488565
  const cachePath = getStatsCachePath();
487849
488566
  const tempPath = `${cachePath}.${randomBytes18(8).toString("hex")}.tmp`;
@@ -487852,7 +488569,7 @@ async function saveStatsCache(cache4) {
487852
488569
  try {
487853
488570
  await fs14.mkdir(configDir);
487854
488571
  } catch {}
487855
- const content = jsonStringify(cache4, null, 2);
488572
+ const content = jsonStringify(cache5, null, 2);
487856
488573
  const handle = await open15(tempPath, "w", 384);
487857
488574
  try {
487858
488575
  await handle.writeFile(content, { encoding: "utf-8" });
@@ -487861,7 +488578,7 @@ async function saveStatsCache(cache4) {
487861
488578
  await handle.close();
487862
488579
  }
487863
488580
  await fs14.rename(tempPath, cachePath);
487864
- logForDebugging(`Stats cache saved successfully (lastComputedDate: ${cache4.lastComputedDate})`);
488581
+ logForDebugging(`Stats cache saved successfully (lastComputedDate: ${cache5.lastComputedDate})`);
487865
488582
  } catch (error49) {
487866
488583
  logError2(error49);
487867
488584
  try {
@@ -488519,7 +489236,7 @@ var init_screenshotClipboard = __esm(() => {
488519
489236
 
488520
489237
  // src/utils/stats.ts
488521
489238
  import { open as open16 } from "fs/promises";
488522
- import { basename as basename44, join as join139, sep as sep36 } from "path";
489239
+ import { basename as basename43, join as join139, sep as sep36 } from "path";
488523
489240
  async function processSessionFiles(sessionFiles, options = {}) {
488524
489241
  const { fromDate, toDate } = options;
488525
489242
  const fs14 = getFsImplementation();
@@ -488577,7 +489294,7 @@ async function processSessionFiles(sessionFiles, options = {}) {
488577
489294
  logForDebugging(`Failed to read session file ${sessionFile}: ${errorMessage(error49)}`);
488578
489295
  continue;
488579
489296
  }
488580
- const sessionId = basename44(sessionFile, ".jsonl");
489297
+ const sessionId = basename43(sessionFile, ".jsonl");
488581
489298
  const messages = [];
488582
489299
  for (const entry of entries) {
488583
489300
  if (isTranscriptMessage(entry)) {
@@ -488720,9 +489437,9 @@ async function getAllSessionFiles() {
488720
489437
  }));
488721
489438
  return projectResults.flat();
488722
489439
  }
488723
- function cacheToStats(cache4, todayStats) {
489440
+ function cacheToStats(cache5, todayStats) {
488724
489441
  const dailyActivityMap = new Map;
488725
- for (const day of cache4.dailyActivity) {
489442
+ for (const day of cache5.dailyActivity) {
488726
489443
  dailyActivityMap.set(day.date, { ...day });
488727
489444
  }
488728
489445
  if (todayStats) {
@@ -488738,7 +489455,7 @@ function cacheToStats(cache4, todayStats) {
488738
489455
  }
488739
489456
  }
488740
489457
  const dailyModelTokensMap = new Map;
488741
- for (const day of cache4.dailyModelTokens) {
489458
+ for (const day of cache5.dailyModelTokens) {
488742
489459
  dailyModelTokensMap.set(day.date, { ...day.tokensByModel });
488743
489460
  }
488744
489461
  if (todayStats) {
@@ -488753,7 +489470,7 @@ function cacheToStats(cache4, todayStats) {
488753
489470
  }
488754
489471
  }
488755
489472
  }
488756
- const modelUsage = { ...cache4.modelUsage };
489473
+ const modelUsage = { ...cache5.modelUsage };
488757
489474
  if (todayStats) {
488758
489475
  for (const [model, usage] of Object.entries(todayStats.modelUsage)) {
488759
489476
  if (modelUsage[model]) {
@@ -488773,7 +489490,7 @@ function cacheToStats(cache4, todayStats) {
488773
489490
  }
488774
489491
  }
488775
489492
  const hourCountsMap = new Map;
488776
- for (const [hour, count4] of Object.entries(cache4.hourCounts)) {
489493
+ for (const [hour, count4] of Object.entries(cache5.hourCounts)) {
488777
489494
  hourCountsMap.set(parseInt(hour, 10), count4);
488778
489495
  }
488779
489496
  if (todayStats) {
@@ -488785,9 +489502,9 @@ function cacheToStats(cache4, todayStats) {
488785
489502
  const dailyActivityArray = Array.from(dailyActivityMap.values()).sort((a2, b3) => a2.date.localeCompare(b3.date));
488786
489503
  const streaks = calculateStreaks(dailyActivityArray);
488787
489504
  const dailyModelTokens = Array.from(dailyModelTokensMap.entries()).map(([date6, tokensByModel]) => ({ date: date6, tokensByModel })).sort((a2, b3) => a2.date.localeCompare(b3.date));
488788
- const totalSessions = cache4.totalSessions + (todayStats?.sessionStats.length || 0);
488789
- const totalMessages = cache4.totalMessages + (todayStats?.totalMessages || 0);
488790
- let longestSession = cache4.longestSession;
489505
+ const totalSessions = cache5.totalSessions + (todayStats?.sessionStats.length || 0);
489506
+ const totalMessages = cache5.totalMessages + (todayStats?.totalMessages || 0);
489507
+ let longestSession = cache5.longestSession;
488791
489508
  if (todayStats) {
488792
489509
  for (const session2 of todayStats.sessionStats) {
488793
489510
  if (!longestSession || session2.duration > longestSession.duration) {
@@ -488795,7 +489512,7 @@ function cacheToStats(cache4, todayStats) {
488795
489512
  }
488796
489513
  }
488797
489514
  }
488798
- let firstSessionDate = cache4.firstSessionDate;
489515
+ let firstSessionDate = cache5.firstSessionDate;
488799
489516
  let lastSessionDate = null;
488800
489517
  if (todayStats) {
488801
489518
  for (const session2 of todayStats.sessionStats) {
@@ -488813,7 +489530,7 @@ function cacheToStats(cache4, todayStats) {
488813
489530
  const peakActivityDay = dailyActivityArray.length > 0 ? dailyActivityArray.reduce((max2, d) => d.messageCount > max2.messageCount ? d : max2).date : null;
488814
489531
  const peakActivityHour = hourCountsMap.size > 0 ? Array.from(hourCountsMap.entries()).reduce((max2, [hour, count4]) => count4 > max2[1] ? [hour, count4] : max2)[0] : null;
488815
489532
  const totalDays = firstSessionDate && lastSessionDate ? Math.ceil((new Date(lastSessionDate).getTime() - new Date(firstSessionDate).getTime()) / (1000 * 60 * 60 * 24)) + 1 : 0;
488816
- const totalSpeculationTimeSavedMs = cache4.totalSpeculationTimeSavedMs + (todayStats?.totalSpeculationTimeSavedMs || 0);
489533
+ const totalSpeculationTimeSavedMs = cache5.totalSpeculationTimeSavedMs + (todayStats?.totalSpeculationTimeSavedMs || 0);
488817
489534
  const result = {
488818
489535
  totalSessions,
488819
489536
  totalMessages,
@@ -488839,30 +489556,30 @@ async function aggregateClaudeCodeStats() {
488839
489556
  return getEmptyStats();
488840
489557
  }
488841
489558
  const updatedCache = await withStatsCacheLock(async () => {
488842
- const cache4 = await loadStatsCache();
489559
+ const cache5 = await loadStatsCache();
488843
489560
  const yesterday = getYesterdayDateString();
488844
- let result = cache4;
488845
- if (!cache4.lastComputedDate) {
489561
+ let result = cache5;
489562
+ if (!cache5.lastComputedDate) {
488846
489563
  logForDebugging("Stats cache empty, processing all historical data");
488847
489564
  const historicalStats = await processSessionFiles(allSessionFiles, {
488848
489565
  toDate: yesterday
488849
489566
  });
488850
489567
  if (historicalStats.sessionStats.length > 0 || historicalStats.dailyActivity.length > 0) {
488851
- result = mergeCacheWithNewStats(cache4, historicalStats, yesterday);
489568
+ result = mergeCacheWithNewStats(cache5, historicalStats, yesterday);
488852
489569
  await saveStatsCache(result);
488853
489570
  }
488854
- } else if (isDateBefore(cache4.lastComputedDate, yesterday)) {
488855
- const nextDay = getNextDay(cache4.lastComputedDate);
488856
- logForDebugging(`Stats cache stale (${cache4.lastComputedDate}), processing ${nextDay} to ${yesterday}`);
489571
+ } else if (isDateBefore(cache5.lastComputedDate, yesterday)) {
489572
+ const nextDay = getNextDay(cache5.lastComputedDate);
489573
+ logForDebugging(`Stats cache stale (${cache5.lastComputedDate}), processing ${nextDay} to ${yesterday}`);
488857
489574
  const newStats = await processSessionFiles(allSessionFiles, {
488858
489575
  fromDate: nextDay,
488859
489576
  toDate: yesterday
488860
489577
  });
488861
489578
  if (newStats.sessionStats.length > 0 || newStats.dailyActivity.length > 0) {
488862
- result = mergeCacheWithNewStats(cache4, newStats, yesterday);
489579
+ result = mergeCacheWithNewStats(cache5, newStats, yesterday);
488863
489580
  await saveStatsCache(result);
488864
489581
  } else {
488865
- result = { ...cache4, lastComputedDate: yesterday };
489582
+ result = { ...cache5, lastComputedDate: yesterday };
488866
489583
  await saveStatsCache(result);
488867
489584
  }
488868
489585
  }
@@ -491502,10 +492219,10 @@ function extractToolStats(log2) {
491502
492219
  `) + 1;
491503
492220
  }
491504
492221
  }
491505
- const command8 = input.command || "";
491506
- if (command8.includes("git commit"))
492222
+ const command9 = input.command || "";
492223
+ if (command9.includes("git commit"))
491507
492224
  gitCommits++;
491508
- if (command8.includes("git push"))
492225
+ if (command9.includes("git push"))
491509
492226
  gitPushes++;
491510
492227
  }
491511
492228
  }
@@ -492925,7 +493642,7 @@ async function scanAllSessions() {
492925
493642
  });
492926
493643
  }
492927
493644
  if (i3 % 10 === 9) {
492928
- await new Promise((resolve48) => setImmediate(resolve48));
493645
+ await new Promise((resolve47) => setImmediate(resolve47));
492929
493646
  }
492930
493647
  }
492931
493648
  allSessions.sort((a2, b3) => b3.mtime - a2.mtime);
@@ -493710,14 +494427,14 @@ function hasCommand(commandName, commands) {
493710
494427
  return findCommand(commandName, commands) !== undefined;
493711
494428
  }
493712
494429
  function getCommand(commandName, commands) {
493713
- const command8 = findCommand(commandName, commands);
493714
- if (!command8) {
494430
+ const command9 = findCommand(commandName, commands);
494431
+ if (!command9) {
493715
494432
  throw ReferenceError(`Command ${commandName} not found. Available commands: ${commands.map((_2) => {
493716
494433
  const name = getCommandName(_2);
493717
494434
  return _2.aliases ? `${name} (aliases: ${_2.aliases.join(", ")})` : name;
493718
494435
  }).sort((a2, b3) => a2.localeCompare(b3)).join(", ")}`);
493719
494436
  }
493720
- return command8;
494437
+ return command9;
493721
494438
  }
493722
494439
  function formatDescriptionWithSource(cmd) {
493723
494440
  if (cmd.type !== "prompt") {
@@ -493794,6 +494511,7 @@ var init_commands2 = __esm(() => {
493794
494511
  init_usage3();
493795
494512
  init_theme4();
493796
494513
  init_vim2();
494514
+ init_flow();
493797
494515
  init_thinkback2();
493798
494516
  init_thinkback_play2();
493799
494517
  init_permissions4();
@@ -493826,6 +494544,8 @@ var init_commands2 = __esm(() => {
493826
494544
  init_artifact();
493827
494545
  init_git_flow();
493828
494546
  init_frontend_tdd();
494547
+ init_agentic_tdd();
494548
+ init_agent2();
493829
494549
  init_remember();
493830
494550
  init_log3();
493831
494551
  init_errors();
@@ -493957,6 +494677,8 @@ var init_commands2 = __esm(() => {
493957
494677
  newHotfixCmd,
493958
494678
  finishHotfixCmd,
493959
494679
  frontend_tdd_default,
494680
+ agentic_tdd_default,
494681
+ agent_default,
493960
494682
  tag_default,
493961
494683
  theme_default,
493962
494684
  feedback_default,
@@ -493990,6 +494712,7 @@ var init_commands2 = __esm(() => {
493990
494712
  hooks_default,
493991
494713
  export_default,
493992
494714
  sandbox_toggle_default,
494715
+ flow_default,
493993
494716
  ...!isUsing3PServices() ? [logout_default, login_default()] : [],
493994
494717
  passes_default,
493995
494718
  ...peersCmd ? [peersCmd] : [],
@@ -494167,7 +494890,7 @@ import {
494167
494890
  unlink as unlink19,
494168
494891
  writeFile as writeFile41
494169
494892
  } from "fs/promises";
494170
- import { basename as basename45, dirname as dirname61, join as join141 } from "path";
494893
+ import { basename as basename44, dirname as dirname61, join as join141 } from "path";
494171
494894
  function isTranscriptMessage(entry) {
494172
494895
  return entry.type === "user" || entry.type === "assistant" || entry.type === "attachment" || entry.type === "system";
494173
494896
  }
@@ -494381,8 +495104,8 @@ class Project {
494381
495104
  decrementPendingWrites() {
494382
495105
  this.pendingWriteCount--;
494383
495106
  if (this.pendingWriteCount === 0) {
494384
- for (const resolve48 of this.flushResolvers) {
494385
- resolve48();
495107
+ for (const resolve47 of this.flushResolvers) {
495108
+ resolve47();
494386
495109
  }
494387
495110
  this.flushResolvers = [];
494388
495111
  }
@@ -494396,13 +495119,13 @@ class Project {
494396
495119
  }
494397
495120
  }
494398
495121
  enqueueWrite(filePath, entry) {
494399
- return new Promise((resolve48) => {
495122
+ return new Promise((resolve47) => {
494400
495123
  let queue2 = this.writeQueues.get(filePath);
494401
495124
  if (!queue2) {
494402
495125
  queue2 = [];
494403
495126
  this.writeQueues.set(filePath, queue2);
494404
495127
  }
494405
- queue2.push({ entry, resolve: resolve48 });
495128
+ queue2.push({ entry, resolve: resolve47 });
494406
495129
  this.scheduleDrain();
494407
495130
  });
494408
495131
  }
@@ -494436,7 +495159,7 @@ class Project {
494436
495159
  const batch = queue2.splice(0);
494437
495160
  let content = "";
494438
495161
  const resolvers3 = [];
494439
- for (const { entry, resolve: resolve48 } of batch) {
495162
+ for (const { entry, resolve: resolve47 } of batch) {
494440
495163
  const line = jsonStringify(entry) + `
494441
495164
  `;
494442
495165
  if (content.length + line.length >= this.MAX_CHUNK_BYTES) {
@@ -494448,7 +495171,7 @@ class Project {
494448
495171
  content = "";
494449
495172
  }
494450
495173
  content += line;
494451
- resolvers3.push(resolve48);
495174
+ resolvers3.push(resolve47);
494452
495175
  }
494453
495176
  if (content.length > 0) {
494454
495177
  await this.appendToFile(filePath, content);
@@ -494571,8 +495294,8 @@ class Project {
494571
495294
  if (this.pendingWriteCount === 0) {
494572
495295
  return;
494573
495296
  }
494574
- return new Promise((resolve48) => {
494575
- this.flushResolvers.push(resolve48);
495297
+ return new Promise((resolve47) => {
495298
+ this.flushResolvers.push(resolve47);
494576
495299
  });
494577
495300
  }
494578
495301
  async removeMessageByUuid(targetUuid) {
@@ -495222,7 +495945,7 @@ function applySnipRemovals(messages) {
495222
495945
  messages.delete(uuid5);
495223
495946
  removedCount++;
495224
495947
  }
495225
- const resolve48 = (start) => {
495948
+ const resolve47 = (start) => {
495226
495949
  const path25 = [];
495227
495950
  let cur = start;
495228
495951
  while (cur && toDelete.has(cur)) {
@@ -495241,7 +495964,7 @@ function applySnipRemovals(messages) {
495241
495964
  for (const [uuid5, msg] of messages) {
495242
495965
  if (!msg.parentUuid || !toDelete.has(msg.parentUuid))
495243
495966
  continue;
495244
- messages.set(uuid5, { ...msg, parentUuid: resolve48(msg.parentUuid) });
495967
+ messages.set(uuid5, { ...msg, parentUuid: resolve47(msg.parentUuid) });
495245
495968
  relinkedCount++;
495246
495969
  }
495247
495970
  logEvent("tengu_snip_resume_filtered", {
@@ -496601,7 +497324,7 @@ async function getSessionFilesWithMtime(projectDir) {
496601
497324
  for (const dirent of dirents) {
496602
497325
  if (!dirent.isFile() || !dirent.name.endsWith(".jsonl"))
496603
497326
  continue;
496604
- const sessionId = validateUuid2(basename45(dirent.name, ".jsonl"));
497327
+ const sessionId = validateUuid2(basename44(dirent.name, ".jsonl"));
496605
497328
  if (!sessionId)
496606
497329
  continue;
496607
497330
  candidates.push({ sessionId, filePath: join141(projectDir, dirent.name) });
@@ -498253,8 +498976,8 @@ class DiskTaskOutput {
498253
498976
  this.#queue.push(content);
498254
498977
  }
498255
498978
  if (!this.#flushPromise) {
498256
- this.#flushPromise = new Promise((resolve48) => {
498257
- this.#flushResolve = resolve48;
498979
+ this.#flushPromise = new Promise((resolve47) => {
498980
+ this.#flushResolve = resolve47;
498258
498981
  });
498259
498982
  track(this.#drain());
498260
498983
  }
@@ -498320,10 +499043,10 @@ class DiskTaskOutput {
498320
499043
  }
498321
499044
  }
498322
499045
  } finally {
498323
- const resolve48 = this.#flushResolve;
499046
+ const resolve47 = this.#flushResolve;
498324
499047
  this.#flushPromise = null;
498325
499048
  this.#flushResolve = null;
498326
- resolve48();
499049
+ resolve47();
498327
499050
  }
498328
499051
  }
498329
499052
  }
@@ -498611,11 +499334,11 @@ class ShellCommandImpl {
498611
499334
  this.#childProcess.once("exit", this.#exitHandler.bind(this));
498612
499335
  this.#childProcess.once("error", this.#errorHandler.bind(this));
498613
499336
  this.#timeoutId = setTimeout(ShellCommandImpl.#handleTimeout, this.#timeout, this);
498614
- const exitPromise = new Promise((resolve48) => {
498615
- this.#exitCodeResolver = resolve48;
499337
+ const exitPromise = new Promise((resolve47) => {
499338
+ this.#exitCodeResolver = resolve47;
498616
499339
  });
498617
- return new Promise((resolve48) => {
498618
- this.#resultResolver = resolve48;
499340
+ return new Promise((resolve47) => {
499341
+ this.#resultResolver = resolve47;
498619
499342
  exitPromise.then(this.#handleExit.bind(this));
498620
499343
  });
498621
499344
  }
@@ -499640,7 +500363,7 @@ __export(exports_hooks2, {
499640
500363
  executeConfigChangeHooks: () => executeConfigChangeHooks,
499641
500364
  createBaseHookInput: () => createBaseHookInput
499642
500365
  });
499643
- import { basename as basename46 } from "path";
500366
+ import { basename as basename45 } from "path";
499644
500367
  import { spawn as spawn11 } from "child_process";
499645
500368
  import { randomUUID as randomUUID30 } from "crypto";
499646
500369
  function getSessionEndHookTimeoutMs() {
@@ -499655,13 +500378,13 @@ function executeInBackground({
499655
500378
  asyncResponse,
499656
500379
  hookEvent,
499657
500380
  hookName,
499658
- command: command8,
500381
+ command: command9,
499659
500382
  asyncRewake,
499660
500383
  pluginId
499661
500384
  }) {
499662
500385
  if (asyncRewake) {
499663
500386
  shellCommand.result.then(async (result) => {
499664
- await new Promise((resolve48) => setImmediate(resolve48));
500387
+ await new Promise((resolve47) => setImmediate(resolve47));
499665
500388
  const stdout = await shellCommand.taskOutput.getStdout();
499666
500389
  const stderr = shellCommand.taskOutput.getStderr();
499667
500390
  shellCommand.cleanup();
@@ -499693,7 +500416,7 @@ function executeInBackground({
499693
500416
  asyncResponse,
499694
500417
  hookEvent,
499695
500418
  hookName,
499696
- command: command8,
500419
+ command: command9,
499697
500420
  shellCommand,
499698
500421
  pluginId
499699
500422
  });
@@ -499810,7 +500533,7 @@ function parseHttpHookOutput(body) {
499810
500533
  }
499811
500534
  function processHookJSONOutput({
499812
500535
  json: json2,
499813
- command: command8,
500536
+ command: command9,
499814
500537
  hookName,
499815
500538
  toolUseID,
499816
500539
  hookEvent,
@@ -499837,7 +500560,7 @@ function processHookJSONOutput({
499837
500560
  result.permissionBehavior = "deny";
499838
500561
  result.blockingError = {
499839
500562
  blockingError: json2.reason || "Blocked by hook",
499840
- command: command8
500563
+ command: command9
499841
500564
  };
499842
500565
  break;
499843
500566
  default:
@@ -499856,7 +500579,7 @@ function processHookJSONOutput({
499856
500579
  result.permissionBehavior = "deny";
499857
500580
  result.blockingError = {
499858
500581
  blockingError: json2.reason || "Blocked by hook",
499859
- command: command8
500582
+ command: command9
499860
500583
  };
499861
500584
  break;
499862
500585
  case "ask":
@@ -499884,7 +500607,7 @@ function processHookJSONOutput({
499884
500607
  result.permissionBehavior = "deny";
499885
500608
  result.blockingError = {
499886
500609
  blockingError: json2.hookSpecificOutput.permissionDecisionReason || json2.reason || "Blocked by hook",
499887
- command: command8
500610
+ command: command9
499888
500611
  };
499889
500612
  break;
499890
500613
  case "ask":
@@ -499944,7 +500667,7 @@ function processHookJSONOutput({
499944
500667
  if (json2.hookSpecificOutput.action === "decline") {
499945
500668
  result.blockingError = {
499946
500669
  blockingError: json2.reason || "Elicitation denied by hook",
499947
- command: command8
500670
+ command: command9
499948
500671
  };
499949
500672
  }
499950
500673
  }
@@ -499958,7 +500681,7 @@ function processHookJSONOutput({
499958
500681
  if (json2.hookSpecificOutput.action === "decline") {
499959
500682
  result.blockingError = {
499960
500683
  blockingError: json2.reason || "Elicitation result blocked by hook",
499961
- command: command8
500684
+ command: command9
499962
500685
  };
499963
500686
  }
499964
500687
  }
@@ -499982,7 +500705,7 @@ function processHookJSONOutput({
499982
500705
  stdout,
499983
500706
  stderr,
499984
500707
  exitCode,
499985
- command: command8,
500708
+ command: command9,
499986
500709
  durationMs
499987
500710
  })
499988
500711
  };
@@ -499997,29 +500720,29 @@ async function execCommandHook(hook, hookEvent, hookName, jsonInput, signal, hoo
499997
500720
  const isPowerShell = shellType === "powershell";
499998
500721
  const toHookPath = isWindows2 && !isPowerShell ? (p) => windowsPathToPosixPath(p) : (p) => p;
499999
500722
  const projectDir = getProjectRoot();
500000
- let command8 = hook.command;
500723
+ let command9 = hook.command;
500001
500724
  let pluginOpts;
500002
500725
  if (pluginRoot) {
500003
500726
  if (!await pathExists(pluginRoot)) {
500004
500727
  throw new Error(`Plugin directory does not exist: ${pluginRoot}` + (pluginId ? ` (${pluginId} — run /plugin to reinstall)` : ""));
500005
500728
  }
500006
500729
  const rootPath = toHookPath(pluginRoot);
500007
- command8 = command8.replace(/\$\{CLAUDE_PLUGIN_ROOT\}/g, () => rootPath);
500730
+ command9 = command9.replace(/\$\{CLAUDE_PLUGIN_ROOT\}/g, () => rootPath);
500008
500731
  if (pluginId) {
500009
500732
  const dataPath = toHookPath(getPluginDataDir(pluginId));
500010
- command8 = command8.replace(/\$\{CLAUDE_PLUGIN_DATA\}/g, () => dataPath);
500733
+ command9 = command9.replace(/\$\{CLAUDE_PLUGIN_DATA\}/g, () => dataPath);
500011
500734
  }
500012
500735
  if (pluginId) {
500013
500736
  pluginOpts = loadPluginOptions(pluginId);
500014
- command8 = substituteUserConfigVariables(command8, pluginOpts);
500737
+ command9 = substituteUserConfigVariables(command9, pluginOpts);
500015
500738
  }
500016
500739
  }
500017
- if (isWindows2 && !isPowerShell && command8.trim().match(/\.sh(\s|$|")/)) {
500018
- if (!command8.trim().startsWith("bash ")) {
500019
- command8 = `bash ${command8}`;
500740
+ if (isWindows2 && !isPowerShell && command9.trim().match(/\.sh(\s|$|")/)) {
500741
+ if (!command9.trim().startsWith("bash ")) {
500742
+ command9 = `bash ${command9}`;
500020
500743
  }
500021
500744
  }
500022
- const finalCommand = !isPowerShell && process.env.CLAUDE_CODE_SHELL_PREFIX ? formatShellPrefixCommand(process.env.CLAUDE_CODE_SHELL_PREFIX, command8) : command8;
500745
+ const finalCommand = !isPowerShell && process.env.CLAUDE_CODE_SHELL_PREFIX ? formatShellPrefixCommand(process.env.CLAUDE_CODE_SHELL_PREFIX, command9) : command9;
500023
500746
  const hookTimeoutMs = hook.timeout ? hook.timeout * 1000 : TOOL_HOOK_EXECUTION_TIMEOUT_MS;
500024
500747
  const envVars = {
500025
500748
  ...subprocessEnv(),
@@ -500107,8 +500830,8 @@ async function execCommandHook(hook, hookEvent, hookName, jsonInput, signal, hoo
500107
500830
  child.stderr.setEncoding("utf8");
500108
500831
  let initialResponseChecked = false;
500109
500832
  let asyncResolve = null;
500110
- const childIsAsyncPromise = new Promise((resolve48) => {
500111
- asyncResolve = resolve48;
500833
+ const childIsAsyncPromise = new Promise((resolve47) => {
500834
+ asyncResolve = resolve47;
500112
500835
  });
500113
500836
  const processedPromptLines = new Set;
500114
500837
  let promptChain = Promise.resolve();
@@ -500199,13 +500922,13 @@ async function execCommandHook(hook, hookEvent, hookName, jsonInput, signal, hoo
500199
500922
  hookEvent,
500200
500923
  getOutput: async () => ({ stdout, stderr, output })
500201
500924
  });
500202
- const stdoutEndPromise = new Promise((resolve48) => {
500203
- child.stdout.on("end", () => resolve48());
500925
+ const stdoutEndPromise = new Promise((resolve47) => {
500926
+ child.stdout.on("end", () => resolve47());
500204
500927
  });
500205
- const stderrEndPromise = new Promise((resolve48) => {
500206
- child.stderr.on("end", () => resolve48());
500928
+ const stderrEndPromise = new Promise((resolve47) => {
500929
+ child.stderr.on("end", () => resolve47());
500207
500930
  });
500208
- const stdinWritePromise = stdinWritten ? Promise.resolve() : new Promise((resolve48, reject2) => {
500931
+ const stdinWritePromise = stdinWritten ? Promise.resolve() : new Promise((resolve47, reject2) => {
500209
500932
  child.stdin.on("error", (err2) => {
500210
500933
  if (!requestPrompt) {
500211
500934
  reject2(err2);
@@ -500218,12 +500941,12 @@ async function execCommandHook(hook, hookEvent, hookName, jsonInput, signal, hoo
500218
500941
  if (!requestPrompt) {
500219
500942
  child.stdin.end();
500220
500943
  }
500221
- resolve48();
500944
+ resolve47();
500222
500945
  });
500223
500946
  const childErrorPromise = new Promise((_2, reject2) => {
500224
500947
  child.on("error", reject2);
500225
500948
  });
500226
- const childClosePromise = new Promise((resolve48) => {
500949
+ const childClosePromise = new Promise((resolve47) => {
500227
500950
  let exitCode = null;
500228
500951
  child.on("close", (code) => {
500229
500952
  exitCode = code ?? 1;
@@ -500231,7 +500954,7 @@ async function execCommandHook(hook, hookEvent, hookName, jsonInput, signal, hoo
500231
500954
  const finalStdout = processedPromptLines.size === 0 ? stdout : stdout.split(`
500232
500955
  `).filter((line) => !processedPromptLines.has(line.trim())).join(`
500233
500956
  `);
500234
- resolve48({
500957
+ resolve47({
500235
500958
  stdout: finalStdout,
500236
500959
  stderr,
500237
500960
  output,
@@ -500471,7 +501194,7 @@ async function getMatchingHooks(appState, sessionId, hookEvent, hookInput, tools
500471
501194
  matchQuery = hookInput.load_reason;
500472
501195
  break;
500473
501196
  case "FileChanged":
500474
- matchQuery = basename46(hookInput.file_path);
501197
+ matchQuery = basename45(hookInput.file_path);
500475
501198
  break;
500476
501199
  default:
500477
501200
  break;
@@ -502262,12 +502985,12 @@ async function executeFunctionHook({
502262
502985
  hook
502263
502986
  };
502264
502987
  }
502265
- const passed = await new Promise((resolve48, reject2) => {
502988
+ const passed = await new Promise((resolve47, reject2) => {
502266
502989
  const onAbort = () => reject2(new Error("Function hook cancelled"));
502267
502990
  abortSignal.addEventListener("abort", onAbort);
502268
502991
  Promise.resolve(hook.callback(messages, abortSignal)).then((result) => {
502269
502992
  abortSignal.removeEventListener("abort", onAbort);
502270
- resolve48(result);
502993
+ resolve47(result);
502271
502994
  }).catch((error49) => {
502272
502995
  abortSignal.removeEventListener("abort", onAbort);
502273
502996
  reject2(error49);
@@ -502502,7 +503225,7 @@ import {
502502
503225
  symlink as symlink5,
502503
503226
  utimes as utimes2
502504
503227
  } from "fs/promises";
502505
- import { basename as basename47, dirname as dirname62, join as join145 } from "path";
503228
+ import { basename as basename46, dirname as dirname62, join as join145 } from "path";
502506
503229
  function validateWorktreeSlug(slug) {
502507
503230
  if (slug.length > MAX_WORKTREE_SLUG_LENGTH) {
502508
503231
  throw new Error(`Invalid worktree name: must be ${MAX_WORKTREE_SLUG_LENGTH} characters or fewer (got ${slug.length})`);
@@ -502545,7 +503268,7 @@ function restoreWorktreeSession(session2) {
502545
503268
  currentWorktreeSession = session2;
502546
503269
  }
502547
503270
  function generateTmuxSessionName(repoPath, branch2) {
502548
- const repoName = basename47(repoPath);
503271
+ const repoName = basename46(repoPath);
502549
503272
  const combined = `${repoName}_${branch2}`;
502550
503273
  return combined.replace(/[/.]/g, "_");
502551
503274
  }
@@ -503121,7 +503844,7 @@ async function execIntoTmuxWorktree(args) {
503121
503844
  error: `Error: ${errorMessage(error49)}`
503122
503845
  };
503123
503846
  }
503124
- repoName = basename47(findCanonicalGitRoot(getCwd()) ?? getCwd());
503847
+ repoName = basename46(findCanonicalGitRoot(getCwd()) ?? getCwd());
503125
503848
  console.log(`Using worktree via hook: ${worktreeDir}`);
503126
503849
  } else {
503127
503850
  const repoRoot = findCanonicalGitRoot(getCwd());
@@ -503131,7 +503854,7 @@ async function execIntoTmuxWorktree(args) {
503131
503854
  error: "Error: --worktree requires a git repository"
503132
503855
  };
503133
503856
  }
503134
- repoName = basename47(repoRoot);
503857
+ repoName = basename46(repoRoot);
503135
503858
  worktreeDir = worktreePathFor(repoRoot, worktreeName);
503136
503859
  try {
503137
503860
  const result = await getOrCreateWorktree(repoRoot, worktreeName, prNumber !== null ? { prNumber } : undefined);
@@ -503792,8 +504515,8 @@ function filterSwarmFieldsFromSchema(toolName2, schema) {
503792
504515
  }
503793
504516
  async function toolToAPISchema(tool, options) {
503794
504517
  const cacheKey = "inputJSONSchema" in tool && tool.inputJSONSchema ? `${tool.name}:${jsonStringify(tool.inputJSONSchema)}` : tool.name;
503795
- const cache4 = getToolSchemaCache();
503796
- let base2 = cache4.get(cacheKey);
504518
+ const cache5 = getToolSchemaCache();
504519
+ let base2 = cache5.get(cacheKey);
503797
504520
  if (!base2) {
503798
504521
  const strictToolsEnabled = checkStatsigFeatureGate_CACHED_MAY_BE_STALE("tengu_tool_pear");
503799
504522
  let input_schema = "inputJSONSchema" in tool && tool.inputJSONSchema ? tool.inputJSONSchema : zodToJsonSchema3(tool.inputSchema);
@@ -503816,7 +504539,7 @@ async function toolToAPISchema(tool, options) {
503816
504539
  if (getAPIProvider() === "firstParty" && isFirstPartyAnthropicBaseUrl() && (getFeatureValue_CACHED_MAY_BE_STALE("tengu_fgts", false) || isEnvTruthy(process.env.CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING))) {
503817
504540
  base2.eager_input_streaming = true;
503818
504541
  }
503819
- cache4.set(cacheKey, base2);
504542
+ cache5.set(cacheKey, base2);
503820
504543
  }
503821
504544
  const schema = {
503822
504545
  name: base2.name,
@@ -504068,9 +504791,9 @@ function normalizeToolInput(tool, input, agentId) {
504068
504791
  }
504069
504792
  case BashTool.name: {
504070
504793
  const parsed = BashTool.inputSchema.parse(input);
504071
- const { command: command8, timeout, description } = parsed;
504794
+ const { command: command9, timeout, description } = parsed;
504072
504795
  const cwd2 = getCwd();
504073
- let normalizedCommand = command8.replace(`cd ${cwd2} && `, "");
504796
+ let normalizedCommand = command9.replace(`cd ${cwd2} && `, "");
504074
504797
  if (getPlatform() === "windows") {
504075
504798
  normalizedCommand = normalizedCommand.replace(`cd ${windowsPathToPosixPath(cwd2)} && `, "");
504076
504799
  }
@@ -506435,11 +507158,11 @@ class ChromeNativeHost {
506435
507158
  }
506436
507159
  log2(`Creating socket listener: ${this.socketPath}`);
506437
507160
  this.server = createServer7((socket) => this.handleMcpClient(socket));
506438
- await new Promise((resolve48, reject2) => {
507161
+ await new Promise((resolve47, reject2) => {
506439
507162
  this.server.listen(this.socketPath, () => {
506440
507163
  log2("Socket server listening for connections");
506441
507164
  this.running = true;
506442
- resolve48();
507165
+ resolve47();
506443
507166
  });
506444
507167
  this.server.on("error", (err2) => {
506445
507168
  log2("Socket server error:", err2);
@@ -506464,8 +507187,8 @@ class ChromeNativeHost {
506464
507187
  }
506465
507188
  this.mcpClients.clear();
506466
507189
  if (this.server) {
506467
- await new Promise((resolve48) => {
506468
- this.server.close(() => resolve48());
507190
+ await new Promise((resolve47) => {
507191
+ this.server.close(() => resolve47());
506469
507192
  });
506470
507193
  this.server = null;
506471
507194
  }
@@ -506686,8 +507409,8 @@ class ChromeMessageReader {
506686
507409
  return messageBytes.toString("utf-8");
506687
507410
  }
506688
507411
  }
506689
- return new Promise((resolve48) => {
506690
- this.pendingResolve = resolve48;
507412
+ return new Promise((resolve47) => {
507413
+ this.pendingResolve = resolve47;
506691
507414
  this.tryProcessMessage();
506692
507415
  });
506693
507416
  }
@@ -506895,8 +507618,8 @@ var require_help = __commonJS((exports) => {
506895
507618
  return argument.name();
506896
507619
  }
506897
507620
  longestSubcommandTermLength(cmd, helper) {
506898
- return helper.visibleCommands(cmd).reduce((max2, command8) => {
506899
- return Math.max(max2, this.displayWidth(helper.styleSubcommandTerm(helper.subcommandTerm(command8))));
507621
+ return helper.visibleCommands(cmd).reduce((max2, command9) => {
507622
+ return Math.max(max2, this.displayWidth(helper.styleSubcommandTerm(helper.subcommandTerm(command9))));
506900
507623
  }, 0);
506901
507624
  }
506902
507625
  longestOptionTermLength(cmd, helper) {
@@ -507488,8 +508211,8 @@ var require_command = __commonJS((exports) => {
507488
508211
  }
507489
508212
  _getCommandAndAncestors() {
507490
508213
  const result = [];
507491
- for (let command8 = this;command8; command8 = command8.parent) {
507492
- result.push(command8);
508214
+ for (let command9 = this;command9; command9 = command9.parent) {
508215
+ result.push(command9);
507493
508216
  }
507494
508217
  return result;
507495
508218
  }
@@ -507699,17 +508422,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
507699
508422
  }
507700
508423
  this.options.push(option);
507701
508424
  }
507702
- _registerCommand(command8) {
508425
+ _registerCommand(command9) {
507703
508426
  const knownBy = (cmd) => {
507704
508427
  return [cmd.name()].concat(cmd.aliases());
507705
508428
  };
507706
- const alreadyUsed = knownBy(command8).find((name) => this._findCommand(name));
508429
+ const alreadyUsed = knownBy(command9).find((name) => this._findCommand(name));
507707
508430
  if (alreadyUsed) {
507708
508431
  const existingCmd = knownBy(this._findCommand(alreadyUsed)).join("|");
507709
- const newCmd = knownBy(command8).join("|");
508432
+ const newCmd = knownBy(command9).join("|");
507710
508433
  throw new Error(`cannot add command '${newCmd}' as already have command '${existingCmd}'`);
507711
508434
  }
507712
- this.commands.push(command8);
508435
+ this.commands.push(command9);
507713
508436
  }
507714
508437
  addOption(option) {
507715
508438
  this._registerOption(option);
@@ -508436,12 +509159,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
508436
509159
  let suggestion = "";
508437
509160
  if (flag.startsWith("--") && this._showSuggestionAfterError) {
508438
509161
  let candidateFlags = [];
508439
- let command8 = this;
509162
+ let command9 = this;
508440
509163
  do {
508441
- const moreFlags = command8.createHelp().visibleOptions(command8).filter((option) => option.long).map((option) => option.long);
509164
+ const moreFlags = command9.createHelp().visibleOptions(command9).filter((option) => option.long).map((option) => option.long);
508442
509165
  candidateFlags = candidateFlags.concat(moreFlags);
508443
- command8 = command8.parent;
508444
- } while (command8 && !command8._enablePositionalOptions);
509166
+ command9 = command9.parent;
509167
+ } while (command9 && !command9._enablePositionalOptions);
508445
509168
  suggestion = suggestSimilar(flag, candidateFlags);
508446
509169
  }
508447
509170
  const message = `error: unknown option '${flag}'${suggestion}`;
@@ -508461,10 +509184,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
508461
509184
  let suggestion = "";
508462
509185
  if (this._showSuggestionAfterError) {
508463
509186
  const candidateNames = [];
508464
- this.createHelp().visibleCommands(this).forEach((command8) => {
508465
- candidateNames.push(command8.name());
508466
- if (command8.alias())
508467
- candidateNames.push(command8.alias());
509187
+ this.createHelp().visibleCommands(this).forEach((command9) => {
509188
+ candidateNames.push(command9.name());
509189
+ if (command9.alias())
509190
+ candidateNames.push(command9.alias());
508468
509191
  });
508469
509192
  suggestion = suggestSimilar(unknownName, candidateNames);
508470
509193
  }
@@ -508505,18 +509228,18 @@ Expecting one of '${allowedValues.join("', '")}'`);
508505
509228
  alias(alias) {
508506
509229
  if (alias === undefined)
508507
509230
  return this._aliases[0];
508508
- let command8 = this;
509231
+ let command9 = this;
508509
509232
  if (this.commands.length !== 0 && this.commands[this.commands.length - 1]._executableHandler) {
508510
- command8 = this.commands[this.commands.length - 1];
509233
+ command9 = this.commands[this.commands.length - 1];
508511
509234
  }
508512
- if (alias === command8._name)
509235
+ if (alias === command9._name)
508513
509236
  throw new Error("Command alias can't be the same as its name");
508514
509237
  const matchingCommand = this.parent?._findCommand(alias);
508515
509238
  if (matchingCommand) {
508516
509239
  const existingCmd = [matchingCommand.name()].concat(matchingCommand.aliases()).join("|");
508517
509240
  throw new Error(`cannot add alias '${alias}' to command '${this.name()}' as already have command '${existingCmd}'`);
508518
509241
  }
508519
- command8._aliases.push(alias);
509242
+ command9._aliases.push(alias);
508520
509243
  return this;
508521
509244
  }
508522
509245
  aliases(aliases) {
@@ -508600,7 +509323,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
508600
509323
  write: outputContext.write,
508601
509324
  command: this
508602
509325
  };
508603
- this._getCommandAndAncestors().reverse().forEach((command8) => command8.emit("beforeAllHelp", eventContext));
509326
+ this._getCommandAndAncestors().reverse().forEach((command9) => command9.emit("beforeAllHelp", eventContext));
508604
509327
  this.emit("beforeHelp", eventContext);
508605
509328
  let helpInformation = this.helpInformation({ error: outputContext.error });
508606
509329
  if (deprecatedCallback) {
@@ -508614,7 +509337,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
508614
509337
  this.emit(this._getHelpOption().long);
508615
509338
  }
508616
509339
  this.emit("afterHelp", eventContext);
508617
- this._getCommandAndAncestors().forEach((command8) => command8.emit("afterAllHelp", eventContext));
509340
+ this._getCommandAndAncestors().forEach((command9) => command9.emit("afterAllHelp", eventContext));
508618
509341
  }
508619
509342
  helpOption(flags, description) {
508620
509343
  if (typeof flags === "boolean") {
@@ -509217,7 +509940,7 @@ async function startNodeRelay(wsUrl, authHeader, wsAuthHeader) {
509217
509940
  cleanupConn(states.get(sock));
509218
509941
  });
509219
509942
  });
509220
- return new Promise((resolve48, reject2) => {
509943
+ return new Promise((resolve47, reject2) => {
509221
509944
  server.once("error", reject2);
509222
509945
  server.listen(0, "127.0.0.1", () => {
509223
509946
  const addr = server.address();
@@ -509225,7 +509948,7 @@ async function startNodeRelay(wsUrl, authHeader, wsAuthHeader) {
509225
509948
  reject2(new Error("upstreamproxy: server has no TCP address"));
509226
509949
  return;
509227
509950
  }
509228
- resolve48({
509951
+ resolve47({
509229
509952
  port: addr.port,
509230
509953
  stop: () => server.close()
509231
509954
  });
@@ -509730,7 +510453,7 @@ async function showInvalidConfigDialog({
509730
510453
  ...getBaseRenderOptions(false),
509731
510454
  theme: SAFE_ERROR_THEME_NAME
509732
510455
  };
509733
- await new Promise(async (resolve48) => {
510456
+ await new Promise(async (resolve47) => {
509734
510457
  const {
509735
510458
  unmount
509736
510459
  } = await render(/* @__PURE__ */ jsx_dev_runtime356.jsxDEV(AppStateProvider, {
@@ -509740,7 +510463,7 @@ async function showInvalidConfigDialog({
509740
510463
  errorDescription: error49.message,
509741
510464
  onExit: () => {
509742
510465
  unmount();
509743
- resolve48();
510466
+ resolve47();
509744
510467
  process.exit(1);
509745
510468
  },
509746
510469
  onReset: () => {
@@ -509749,7 +510472,7 @@ async function showInvalidConfigDialog({
509749
510472
  encoding: "utf8"
509750
510473
  });
509751
510474
  unmount();
509752
- resolve48();
510475
+ resolve47();
509753
510476
  process.exit(0);
509754
510477
  }
509755
510478
  }, undefined, false, undefined, this)
@@ -511034,6 +511757,13 @@ var init_useLogMessages = __esm(() => {
511034
511757
  // src/bridge/bridgePermissionCallbacks.ts
511035
511758
  var init_bridgePermissionCallbacks = () => {};
511036
511759
 
511760
+ // src/bridge/bridgeUrlBuilder.ts
511761
+ function buildBridgeConnectUrl(environmentId, ingressUrl) {
511762
+ const baseUrl = getClaudeAiBaseUrl(undefined, ingressUrl);
511763
+ return `${baseUrl}/code?bridge=${environmentId}`;
511764
+ }
511765
+ var init_bridgeUrlBuilder = () => {};
511766
+
511037
511767
  // src/bridge/inboundMessages.ts
511038
511768
  function extractInboundMessageFields(msg) {
511039
511769
  if (msg.type !== "user")
@@ -511101,7 +511831,7 @@ function buildSystemInitMessage(inputs) {
511101
511831
  betas: getSdkBetas(),
511102
511832
  claude_code_version: MACRO.VERSION,
511103
511833
  output_style: outputStyle2,
511104
- agents: inputs.agents.map((agent) => agent.agentType),
511834
+ agents: inputs.agents.map((agent2) => agent2.agentType),
511105
511835
  skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
511106
511836
  plugins: inputs.plugins.map((plugin2) => ({
511107
511837
  name: plugin2.name,
@@ -511166,7 +511896,7 @@ var import_react199, jsx_dev_runtime364;
511166
511896
  var init_useReplBridge = __esm(() => {
511167
511897
  init_state();
511168
511898
  init_bridgePermissionCallbacks();
511169
- init_bridgeStatusUtil();
511899
+ init_bridgeUrlBuilder();
511170
511900
  init_inboundMessages();
511171
511901
  init_replBridgeHandle();
511172
511902
  init_commands2();
@@ -515056,9 +515786,9 @@ function findFirstSubcommand(args, spec) {
515056
515786
  }
515057
515787
  return;
515058
515788
  }
515059
- async function buildPrefix(command8, args, spec) {
515060
- const maxDepth = await calculateDepth(command8, args, spec);
515061
- const parts = [command8];
515789
+ async function buildPrefix(command9, args, spec) {
515790
+ const maxDepth = await calculateDepth(command9, args, spec);
515791
+ const parts = [command9];
515062
515792
  const hasSubcommands = !!spec?.subcommands?.length;
515063
515793
  let foundSubcommand = false;
515064
515794
  for (let i3 = 0;i3 < args.length; i3++) {
@@ -515066,7 +515796,7 @@ async function buildPrefix(command8, args, spec) {
515066
515796
  if (!arg || parts.length >= maxDepth)
515067
515797
  break;
515068
515798
  if (arg.startsWith("-")) {
515069
- if (arg === "-c" && ["python", "python3"].includes(command8.toLowerCase()))
515799
+ if (arg === "-c" && ["python", "python3"].includes(command9.toLowerCase()))
515070
515800
  break;
515071
515801
  if (spec?.options) {
515072
515802
  const option = spec.options.find((opt) => Array.isArray(opt.name) ? opt.name.includes(arg) : opt.name === arg);
@@ -515091,9 +515821,9 @@ async function buildPrefix(command8, args, spec) {
515091
515821
  }
515092
515822
  return parts.join(" ");
515093
515823
  }
515094
- async function calculateDepth(command8, args, spec) {
515824
+ async function calculateDepth(command9, args, spec) {
515095
515825
  const firstSubcommand = findFirstSubcommand(args, spec);
515096
- const commandLower = command8.toLowerCase();
515826
+ const commandLower = command9.toLowerCase();
515097
515827
  const key2 = firstSubcommand ? `${commandLower} ${firstSubcommand.toLowerCase()}` : commandLower;
515098
515828
  if (DEPTH_RULES[key2])
515099
515829
  return DEPTH_RULES[key2];
@@ -515408,15 +516138,15 @@ var init_specs = __esm(() => {
515408
516138
  });
515409
516139
 
515410
516140
  // src/utils/bash/registry.ts
515411
- async function loadFigSpec(command8) {
515412
- if (!command8 || command8.includes("/") || command8.includes("\\"))
516141
+ async function loadFigSpec(command9) {
516142
+ if (!command9 || command9.includes("/") || command9.includes("\\"))
515413
516143
  return null;
515414
- if (command8.includes(".."))
516144
+ if (command9.includes(".."))
515415
516145
  return null;
515416
- if (command8.startsWith("-") && command8 !== "-")
516146
+ if (command9.startsWith("-") && command9 !== "-")
515417
516147
  return null;
515418
516148
  try {
515419
- const module = await import(`@withfig/autocomplete/build/${command8}.js`);
516149
+ const module = await import(`@withfig/autocomplete/build/${command9}.js`);
515420
516150
  return module.default || module;
515421
516151
  } catch {
515422
516152
  return null;
@@ -515426,10 +516156,10 @@ var getCommandSpec;
515426
516156
  var init_registry2 = __esm(() => {
515427
516157
  init_memoize2();
515428
516158
  init_specs();
515429
- getCommandSpec = memoizeWithLRU(async (command8) => {
515430
- const spec = specs_default.find((s) => s.name === command8) || await loadFigSpec(command8) || null;
516159
+ getCommandSpec = memoizeWithLRU(async (command9) => {
516160
+ const spec = specs_default.find((s) => s.name === command9) || await loadFigSpec(command9) || null;
515431
516161
  return spec;
515432
- }, (command8) => command8);
516162
+ }, (command9) => command9);
515433
516163
  });
515434
516164
 
515435
516165
  // src/utils/bash/prefix.ts
@@ -515438,10 +516168,10 @@ function isKnownSubcommand2(arg, spec) {
515438
516168
  return false;
515439
516169
  return spec.subcommands.some((sub) => Array.isArray(sub.name) ? sub.name.includes(arg) : sub.name === arg);
515440
516170
  }
515441
- async function getCommandPrefixStatic(command8, recursionDepth = 0, wrapperCount = 0) {
516171
+ async function getCommandPrefixStatic(command9, recursionDepth = 0, wrapperCount = 0) {
515442
516172
  if (wrapperCount > 2 || recursionDepth > 10)
515443
516173
  return null;
515444
- const parsed = await parseCommand2(command8);
516174
+ const parsed = await parseCommand2(command9);
515445
516175
  if (!parsed)
515446
516176
  return null;
515447
516177
  if (!parsed.commandNode) {
@@ -515464,12 +516194,12 @@ async function getCommandPrefixStatic(command8, recursionDepth = 0, wrapperCount
515464
516194
  const envPrefix = envVars.length ? `${envVars.join(" ")} ` : "";
515465
516195
  return { commandPrefix: prefix ? envPrefix + prefix : null };
515466
516196
  }
515467
- async function handleWrapper(command8, args, recursionDepth, wrapperCount) {
515468
- const spec = await getCommandSpec(command8);
516197
+ async function handleWrapper(command9, args, recursionDepth, wrapperCount) {
516198
+ const spec = await getCommandSpec(command9);
515469
516199
  if (spec?.args) {
515470
516200
  const commandArgIndex = toArray4(spec.args).findIndex((arg) => arg?.isCommand);
515471
516201
  if (commandArgIndex !== -1) {
515472
- const parts = [command8];
516202
+ const parts = [command9];
515473
516203
  for (let i3 = 0;i3 < args.length && i3 <= commandArgIndex; i3++) {
515474
516204
  if (i3 === commandArgIndex) {
515475
516205
  const result2 = await getCommandPrefixStatic(args.slice(i3).join(" "), recursionDepth + 1, wrapperCount + 1);
@@ -515486,14 +516216,14 @@ async function handleWrapper(command8, args, recursionDepth, wrapperCount) {
515486
516216
  }
515487
516217
  const wrapped = args.find((arg) => !arg.startsWith("-") && !NUMERIC.test(arg) && !ENV_VAR.test(arg));
515488
516218
  if (!wrapped)
515489
- return command8;
516219
+ return command9;
515490
516220
  const result = await getCommandPrefixStatic(args.slice(args.indexOf(wrapped)).join(" "), recursionDepth + 1, wrapperCount + 1);
515491
- return !result?.commandPrefix ? null : `${command8} ${result.commandPrefix}`;
516221
+ return !result?.commandPrefix ? null : `${command9} ${result.commandPrefix}`;
515492
516222
  }
515493
- async function getCompoundCommandPrefixesStatic(command8, excludeSubcommand) {
515494
- const subcommands = splitCommand_DEPRECATED(command8);
516223
+ async function getCompoundCommandPrefixesStatic(command9, excludeSubcommand) {
516224
+ const subcommands = splitCommand_DEPRECATED(command9);
515495
516225
  if (subcommands.length <= 1) {
515496
- const result = await getCommandPrefixStatic(command8);
516226
+ const result = await getCommandPrefixStatic(command9);
515497
516227
  return result?.commandPrefix ? [result.commandPrefix] : [];
515498
516228
  }
515499
516229
  const prefixes = [];
@@ -517174,7 +517904,7 @@ var init_FileEditToolDiff = __esm(() => {
517174
517904
 
517175
517905
  // src/hooks/useDiffInIDE.ts
517176
517906
  import { randomUUID as randomUUID34 } from "crypto";
517177
- import { basename as basename49 } from "path";
517907
+ import { basename as basename48 } from "path";
517178
517908
  function useDiffInIDE({
517179
517909
  onChange,
517180
517910
  toolUseContext,
@@ -517185,7 +517915,7 @@ function useDiffInIDE({
517185
517915
  const isUnmounted = import_react211.useRef(false);
517186
517916
  const [hasError, setHasError] = import_react211.useState(false);
517187
517917
  const sha = import_react211.useMemo(() => randomUUID34().slice(0, 6), []);
517188
- const tabName = import_react211.useMemo(() => `✻ [Claude Code] ${basename49(filePath)} (${sha}) ⧉`, [filePath, sha]);
517918
+ const tabName = import_react211.useMemo(() => `✻ [Claude Code] ${basename48(filePath)} (${sha}) ⧉`, [filePath, sha]);
517189
517919
  const shouldShowDiffInIDE = hasAccessToIDEExtensionDiffFeature(toolUseContext.options.mcpClients) && getGlobalConfig().diffTool === "auto" && !filePath.endsWith(".ipynb");
517190
517920
  const ideName = getConnectedIdeName(toolUseContext.options.mcpClients) ?? "IDE";
517191
517921
  async function showDiff() {
@@ -517367,7 +518097,7 @@ var init_useDiffInIDE = __esm(() => {
517367
518097
  });
517368
518098
 
517369
518099
  // src/components/ShowInIDEPrompt.tsx
517370
- import { basename as basename50, relative as relative30 } from "path";
518100
+ import { basename as basename49, relative as relative30 } from "path";
517371
518101
  function ShowInIDEPrompt(t0) {
517372
518102
  const $3 = import_compiler_runtime295.c(36);
517373
518103
  const {
@@ -517424,7 +518154,7 @@ function ShowInIDEPrompt(t0) {
517424
518154
  }
517425
518155
  let t4;
517426
518156
  if ($3[5] !== filePath) {
517427
- t4 = basename50(filePath);
518157
+ t4 = basename49(filePath);
517428
518158
  $3[5] = filePath;
517429
518159
  $3[6] = t4;
517430
518160
  } else {
@@ -517585,7 +518315,7 @@ var init_ShowInIDEPrompt = __esm(() => {
517585
518315
 
517586
518316
  // src/components/permissions/FilePermissionDialog/permissionOptions.tsx
517587
518317
  import { homedir as homedir36 } from "os";
517588
- import { basename as basename51, join as join148, sep as sep39 } from "path";
518318
+ import { basename as basename50, join as join148, sep as sep39 } from "path";
517589
518319
  function isInClaudeFolder(filePath) {
517590
518320
  const absolutePath = expandPath(filePath);
517591
518321
  const claudeFolderPath = expandPath(`${getOriginalCwd()}/.claude`);
@@ -517667,7 +518397,7 @@ function getFilePermissionOptions({
517667
518397
  }
517668
518398
  } else {
517669
518399
  const dirPath = getDirectoryForPath(filePath);
517670
- const dirName = basename51(dirPath) || "this directory";
518400
+ const dirName = basename50(dirPath) || "this directory";
517671
518401
  if (operationType === "read") {
517672
518402
  sessionLabel = /* @__PURE__ */ jsx_dev_runtime379.jsxDEV(ThemedText, {
517673
518403
  children: [
@@ -518166,7 +518896,7 @@ var init_FilePermissionDialog = __esm(() => {
518166
518896
  });
518167
518897
 
518168
518898
  // src/components/permissions/SedEditPermissionRequest/SedEditPermissionRequest.tsx
518169
- import { basename as basename52, relative as relative32 } from "path";
518899
+ import { basename as basename51, relative as relative32 } from "path";
518170
518900
  function SedEditPermissionRequest(t0) {
518171
518901
  const $3 = import_compiler_runtime296.c(9);
518172
518902
  let props;
@@ -518342,7 +519072,7 @@ function SedEditPermissionRequestInner(t0) {
518342
519072
  }
518343
519073
  let t10;
518344
519074
  if ($3[16] !== filePath) {
518345
- t10 = basename52(filePath);
519075
+ t10 = basename51(filePath);
518346
519076
  $3[16] = filePath;
518347
519077
  $3[17] = t10;
518348
519078
  } else {
@@ -518554,7 +519284,7 @@ var init_useShellPermissionFeedback = __esm(() => {
518554
519284
  });
518555
519285
 
518556
519286
  // src/components/permissions/shellPermissionHelpers.tsx
518557
- import { basename as basename53, sep as sep40 } from "path";
519287
+ import { basename as basename52, sep as sep40 } from "path";
518558
519288
  function commandListDisplay(commands) {
518559
519289
  switch (commands.length) {
518560
519290
  case 0:
@@ -518605,7 +519335,7 @@ function commandListDisplayTruncated(commands) {
518605
519335
  function formatPathList(paths2) {
518606
519336
  if (paths2.length === 0)
518607
519337
  return "";
518608
- const names = paths2.map((p) => basename53(p) || p);
519338
+ const names = paths2.map((p) => basename52(p) || p);
518609
519339
  if (names.length === 1) {
518610
519340
  return /* @__PURE__ */ jsx_dev_runtime382.jsxDEV(ThemedText, {
518611
519341
  children: [
@@ -518662,8 +519392,8 @@ function generateShellSuggestionsLabel(suggestions, shellToolName, commandTransf
518662
519392
  const shellCommands = [...new Set(shellRules.flatMap((rule) => {
518663
519393
  if (!rule.ruleContent)
518664
519394
  return [];
518665
- const command8 = permissionRuleExtractPrefix2(rule.ruleContent) ?? rule.ruleContent;
518666
- return commandTransform ? commandTransform(command8) : command8;
519395
+ const command9 = permissionRuleExtractPrefix2(rule.ruleContent) ?? rule.ruleContent;
519396
+ return commandTransform ? commandTransform(command9) : command9;
518667
519397
  }))];
518668
519398
  const hasDirectories = directories.length > 0;
518669
519399
  const hasReadPaths = readPaths.length > 0;
@@ -518671,7 +519401,7 @@ function generateShellSuggestionsLabel(suggestions, shellToolName, commandTransf
518671
519401
  if (hasReadPaths && !hasDirectories && !hasCommands) {
518672
519402
  if (readPaths.length === 1) {
518673
519403
  const firstPath = readPaths[0];
518674
- const dirName = basename53(firstPath) || firstPath;
519404
+ const dirName = basename52(firstPath) || firstPath;
518675
519405
  return /* @__PURE__ */ jsx_dev_runtime382.jsxDEV(ThemedText, {
518676
519406
  children: [
518677
519407
  "Yes, allow reading from ",
@@ -518695,7 +519425,7 @@ function generateShellSuggestionsLabel(suggestions, shellToolName, commandTransf
518695
519425
  if (hasDirectories && !hasReadPaths && !hasCommands) {
518696
519426
  if (directories.length === 1) {
518697
519427
  const firstDir = directories[0];
518698
- const dirName = basename53(firstDir) || firstDir;
519428
+ const dirName = basename52(firstDir) || firstDir;
518699
519429
  return /* @__PURE__ */ jsx_dev_runtime382.jsxDEV(ThemedText, {
518700
519430
  children: [
518701
519431
  "Yes, and always allow access to ",
@@ -518778,12 +519508,12 @@ var init_shellPermissionHelpers = __esm(() => {
518778
519508
  });
518779
519509
 
518780
519510
  // src/components/permissions/BashPermissionRequest/bashToolUseOptions.tsx
518781
- function stripBashRedirections(command8) {
519511
+ function stripBashRedirections(command9) {
518782
519512
  const {
518783
519513
  commandWithoutRedirections,
518784
519514
  redirections
518785
- } = extractOutputRedirections(command8);
518786
- return redirections.length > 0 ? commandWithoutRedirections : command8;
519515
+ } = extractOutputRedirections(command9);
519516
+ return redirections.length > 0 ? commandWithoutRedirections : command9;
518787
519517
  }
518788
519518
  function bashToolUseOptions({
518789
519519
  suggestions = [],
@@ -518876,21 +519606,21 @@ function BashPermissionRequest(props) {
518876
519606
  verbose,
518877
519607
  workerBadge
518878
519608
  } = props;
518879
- let command8;
519609
+ let command9;
518880
519610
  let description;
518881
519611
  let t0;
518882
519612
  if ($3[0] !== toolUseConfirm.input) {
518883
519613
  ({
518884
- command: command8,
519614
+ command: command9,
518885
519615
  description
518886
519616
  } = BashTool.inputSchema.parse(toolUseConfirm.input));
518887
- t0 = parseSedEditCommand(command8);
519617
+ t0 = parseSedEditCommand(command9);
518888
519618
  $3[0] = toolUseConfirm.input;
518889
- $3[1] = command8;
519619
+ $3[1] = command9;
518890
519620
  $3[2] = description;
518891
519621
  $3[3] = t0;
518892
519622
  } else {
518893
- command8 = $3[1];
519623
+ command9 = $3[1];
518894
519624
  description = $3[2];
518895
519625
  t0 = $3[3];
518896
519626
  }
@@ -518921,7 +519651,7 @@ function BashPermissionRequest(props) {
518921
519651
  return t12;
518922
519652
  }
518923
519653
  let t1;
518924
- if ($3[12] !== command8 || $3[13] !== description || $3[14] !== onDone || $3[15] !== onReject || $3[16] !== toolUseConfirm || $3[17] !== toolUseContext || $3[18] !== verbose || $3[19] !== workerBadge) {
519654
+ if ($3[12] !== command9 || $3[13] !== description || $3[14] !== onDone || $3[15] !== onReject || $3[16] !== toolUseConfirm || $3[17] !== toolUseContext || $3[18] !== verbose || $3[19] !== workerBadge) {
518925
519655
  t1 = /* @__PURE__ */ jsx_dev_runtime383.jsxDEV(BashPermissionRequestInner, {
518926
519656
  toolUseConfirm,
518927
519657
  toolUseContext,
@@ -518929,10 +519659,10 @@ function BashPermissionRequest(props) {
518929
519659
  onReject,
518930
519660
  verbose,
518931
519661
  workerBadge,
518932
- command: command8,
519662
+ command: command9,
518933
519663
  description
518934
519664
  }, undefined, false, undefined, this);
518935
- $3[12] = command8;
519665
+ $3[12] = command9;
518936
519666
  $3[13] = description;
518937
519667
  $3[14] = onDone;
518938
519668
  $3[15] = onReject;
@@ -518953,7 +519683,7 @@ function BashPermissionRequestInner({
518953
519683
  onReject,
518954
519684
  verbose: _verbose,
518955
519685
  workerBadge,
518956
- command: command8,
519686
+ command: command9,
518957
519687
  description
518958
519688
  }) {
518959
519689
  const [theme2] = useTheme();
@@ -518990,27 +519720,27 @@ function BashPermissionRequestInner({
518990
519720
  if (!isClassifierPermissionsEnabled())
518991
519721
  return;
518992
519722
  const abortController = new AbortController;
518993
- generateGenericDescription(command8, description, abortController.signal).then((generic) => {
519723
+ generateGenericDescription(command9, description, abortController.signal).then((generic) => {
518994
519724
  if (generic && !abortController.signal.aborted) {
518995
519725
  setClassifierDescription(generic);
518996
519726
  setInitialClassifierDescriptionEmpty(false);
518997
519727
  }
518998
519728
  }).catch(() => {});
518999
519729
  return () => abortController.abort();
519000
- }, [command8, description]);
519730
+ }, [command9, description]);
519001
519731
  const isCompound = toolUseConfirm.permissionResult.decisionReason?.type === "subcommandResults";
519002
519732
  const [editablePrefix, setEditablePrefix] = import_react216.useState(() => {
519003
519733
  if (isCompound) {
519004
519734
  const backendBashRules = extractRules("suggestions" in toolUseConfirm.permissionResult ? toolUseConfirm.permissionResult.suggestions : undefined).filter((r) => r.toolName === BashTool.name && r.ruleContent);
519005
519735
  return backendBashRules.length === 1 ? backendBashRules[0].ruleContent : undefined;
519006
519736
  }
519007
- const two = getSimpleCommandPrefix(command8);
519737
+ const two = getSimpleCommandPrefix(command9);
519008
519738
  if (two)
519009
519739
  return `${two}:*`;
519010
- const one = getFirstWordPrefix(command8);
519740
+ const one = getFirstWordPrefix(command9);
519011
519741
  if (one)
519012
519742
  return `${one}:*`;
519013
- return command8;
519743
+ return command9;
519014
519744
  });
519015
519745
  const hasUserEditedPrefix = import_react216.useRef(false);
519016
519746
  const onEditablePrefixChange = import_react216.useCallback((value) => {
@@ -519021,7 +519751,7 @@ function BashPermissionRequestInner({
519021
519751
  if (isCompound)
519022
519752
  return;
519023
519753
  let cancelled = false;
519024
- getCompoundCommandPrefixesStatic(command8, (subcmd) => BashTool.isReadOnly({
519754
+ getCompoundCommandPrefixesStatic(command9, (subcmd) => BashTool.isReadOnly({
519025
519755
  command: subcmd
519026
519756
  })).then((prefixes) => {
519027
519757
  if (cancelled || hasUserEditedPrefix.current)
@@ -519033,14 +519763,14 @@ function BashPermissionRequestInner({
519033
519763
  return () => {
519034
519764
  cancelled = true;
519035
519765
  };
519036
- }, [command8, isCompound]);
519766
+ }, [command9, isCompound]);
519037
519767
  const [classifierWasChecking] = import_react216.useState(false);
519038
519768
  const {
519039
519769
  destructiveWarning: destructiveWarning_0,
519040
519770
  sandboxingEnabled: sandboxingEnabled_0,
519041
519771
  isSandboxed: isSandboxed_0
519042
519772
  } = import_react216.useMemo(() => {
519043
- const destructiveWarning = getFeatureValue_CACHED_MAY_BE_STALE("tengu_destructive_command_warning", false) ? getDestructiveCommandWarning(command8) : null;
519773
+ const destructiveWarning = getFeatureValue_CACHED_MAY_BE_STALE("tengu_destructive_command_warning", false) ? getDestructiveCommandWarning(command9) : null;
519044
519774
  const sandboxingEnabled = SandboxManager2.isSandboxingEnabled();
519045
519775
  const isSandboxed = sandboxingEnabled && shouldUseSandbox(toolUseConfirm.input);
519046
519776
  return {
@@ -519048,7 +519778,7 @@ function BashPermissionRequestInner({
519048
519778
  sandboxingEnabled,
519049
519779
  isSandboxed
519050
519780
  };
519051
- }, [command8, toolUseConfirm.input]);
519781
+ }, [command9, toolUseConfirm.input]);
519052
519782
  const unaryEvent = import_react216.useMemo(() => ({
519053
519783
  completion_type: "tool_use_single",
519054
519784
  language_name: "none"
@@ -519166,7 +519896,7 @@ function BashPermissionRequestInner({
519166
519896
  /* @__PURE__ */ jsx_dev_runtime383.jsxDEV(ThemedText, {
519167
519897
  dimColor: explainerState.visible,
519168
519898
  children: BashTool.renderToolUseMessage({
519169
- command: command8,
519899
+ command: command9,
519170
519900
  description
519171
519901
  }, {
519172
519902
  theme: theme2,
@@ -520935,7 +521665,7 @@ function createSingleEditDiffConfig(filePath, oldString, newString, replaceAll)
520935
521665
  }
520936
521666
 
520937
521667
  // src/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.tsx
520938
- import { basename as basename54, relative as relative33 } from "path";
521668
+ import { basename as basename53, relative as relative33 } from "path";
520939
521669
  function FileEditPermissionRequest(props) {
520940
521670
  const $3 = import_compiler_runtime301.c(51);
520941
521671
  const parseInput = _temp178;
@@ -520978,7 +521708,7 @@ function FileEditPermissionRequest(props) {
520978
521708
  t3 = " ";
520979
521709
  T0 = ThemedText;
520980
521710
  t0 = true;
520981
- t1 = basename54(file_path);
521711
+ t1 = basename53(file_path);
520982
521712
  $3[0] = props.onDone;
520983
521713
  $3[1] = props.onReject;
520984
521714
  $3[2] = props.toolUseConfirm;
@@ -521405,7 +522135,7 @@ var init_FileWriteToolDiff = __esm(() => {
521405
522135
  });
521406
522136
 
521407
522137
  // src/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.tsx
521408
- import { basename as basename55, relative as relative34 } from "path";
522138
+ import { basename as basename54, relative as relative34 } from "path";
521409
522139
  function FileWritePermissionRequest(props) {
521410
522140
  const $3 = import_compiler_runtime304.c(30);
521411
522141
  const parseInput = _temp181;
@@ -521472,7 +522202,7 @@ function FileWritePermissionRequest(props) {
521472
522202
  }
521473
522203
  let t9;
521474
522204
  if ($3[7] !== file_path) {
521475
- t9 = basename55(file_path);
522205
+ t9 = basename54(file_path);
521476
522206
  $3[7] = file_path;
521477
522207
  $3[8] = t9;
521478
522208
  } else {
@@ -521877,7 +522607,7 @@ var init_NotebookEditToolDiff = __esm(() => {
521877
522607
  });
521878
522608
 
521879
522609
  // src/components/permissions/NotebookEditPermissionRequest/NotebookEditPermissionRequest.tsx
521880
- import { basename as basename56 } from "path";
522610
+ import { basename as basename55 } from "path";
521881
522611
  function NotebookEditPermissionRequest(props) {
521882
522612
  const $3 = import_compiler_runtime306.c(52);
521883
522613
  const parseInput = _temp185;
@@ -521921,7 +522651,7 @@ function NotebookEditPermissionRequest(props) {
521921
522651
  t4 = " ";
521922
522652
  T0 = ThemedText;
521923
522653
  t0 = true;
521924
- t1 = basename56(notebook_path);
522654
+ t1 = basename55(notebook_path);
521925
522655
  $3[0] = props.onDone;
521926
522656
  $3[1] = props.onReject;
521927
522657
  $3[2] = props.toolUseConfirm;
@@ -522076,9 +522806,9 @@ var init_NotebookEditPermissionRequest = __esm(() => {
522076
522806
  });
522077
522807
 
522078
522808
  // src/tools/PowerShellTool/destructiveCommandWarning.ts
522079
- function getDestructiveCommandWarning2(command8) {
522809
+ function getDestructiveCommandWarning2(command9) {
522080
522810
  for (const { pattern, warning } of DESTRUCTIVE_PATTERNS2) {
522081
- if (pattern.test(command8)) {
522811
+ if (pattern.test(command9)) {
522082
522812
  return warning;
522083
522813
  }
522084
522814
  }
@@ -522207,8 +522937,8 @@ async function extractPrefixFromElement(cmd) {
522207
522937
  }
522208
522938
  return prefix;
522209
522939
  }
522210
- async function getCompoundCommandPrefixesStatic2(command8, excludeSubcommand) {
522211
- const parsed = await parsePowerShellCommandCached(command8);
522940
+ async function getCompoundCommandPrefixesStatic2(command9, excludeSubcommand) {
522941
+ const parsed = await parsePowerShellCommandCached(command9);
522212
522942
  if (!parsed.valid) {
522213
522943
  return [];
522214
522944
  }
@@ -522365,7 +523095,7 @@ function PowerShellPermissionRequest(props) {
522365
523095
  workerBadge
522366
523096
  } = props;
522367
523097
  const {
522368
- command: command8,
523098
+ command: command9,
522369
523099
  description
522370
523100
  } = PowerShellTool.inputSchema.parse(toolUseConfirm.input);
522371
523101
  const [theme2] = useTheme();
@@ -522394,14 +523124,14 @@ function PowerShellPermissionRequest(props) {
522394
523124
  onReject,
522395
523125
  explainerVisible: explainerState.visible
522396
523126
  });
522397
- const destructiveWarning = getFeatureValue_CACHED_MAY_BE_STALE("tengu_destructive_command_warning", false) ? getDestructiveCommandWarning2(command8) : null;
523127
+ const destructiveWarning = getFeatureValue_CACHED_MAY_BE_STALE("tengu_destructive_command_warning", false) ? getDestructiveCommandWarning2(command9) : null;
522398
523128
  const [showPermissionDebug, setShowPermissionDebug] = import_react220.useState(false);
522399
- const [editablePrefix, setEditablePrefix] = import_react220.useState(command8.includes(`
522400
- `) ? undefined : command8);
523129
+ const [editablePrefix, setEditablePrefix] = import_react220.useState(command9.includes(`
523130
+ `) ? undefined : command9);
522401
523131
  const hasUserEditedPrefix = import_react220.useRef(false);
522402
523132
  import_react220.useEffect(() => {
522403
523133
  let cancelled = false;
522404
- getCompoundCommandPrefixesStatic2(command8, (element) => isAllowlistedCommand(element, element.text)).then((prefixes) => {
523134
+ getCompoundCommandPrefixesStatic2(command9, (element) => isAllowlistedCommand(element, element.text)).then((prefixes) => {
522405
523135
  if (cancelled || hasUserEditedPrefix.current)
522406
523136
  return;
522407
523137
  if (prefixes.length > 0) {
@@ -522411,7 +523141,7 @@ function PowerShellPermissionRequest(props) {
522411
523141
  return () => {
522412
523142
  cancelled = true;
522413
523143
  };
522414
- }, [command8]);
523144
+ }, [command9]);
522415
523145
  const onEditablePrefixChange = import_react220.useCallback((value) => {
522416
523146
  hasUserEditedPrefix.current = true;
522417
523147
  setEditablePrefix(value);
@@ -522516,7 +523246,7 @@ function PowerShellPermissionRequest(props) {
522516
523246
  /* @__PURE__ */ jsx_dev_runtime394.jsxDEV(ThemedText, {
522517
523247
  dimColor: explainerState.visible,
522518
523248
  children: PowerShellTool.renderToolUseMessage({
522519
- command: command8,
523249
+ command: command9,
522520
523250
  description
522521
523251
  }, {
522522
523252
  theme: theme2,
@@ -526399,7 +527129,7 @@ var init_AutoUpdaterWrapper = __esm(() => {
526399
527129
  });
526400
527130
 
526401
527131
  // src/components/IdeStatusIndicator.tsx
526402
- import { basename as basename57 } from "path";
527132
+ import { basename as basename56 } from "path";
526403
527133
  function IdeStatusIndicator(t0) {
526404
527134
  const $3 = import_compiler_runtime316.c(7);
526405
527135
  const {
@@ -526439,7 +527169,7 @@ function IdeStatusIndicator(t0) {
526439
527169
  if (ideSelection.filePath) {
526440
527170
  let t1;
526441
527171
  if ($3[3] !== ideSelection.filePath) {
526442
- t1 = basename57(ideSelection.filePath);
527172
+ t1 = basename56(ideSelection.filePath);
526443
527173
  $3[3] = ideSelection.filePath;
526444
527174
  $3[4] = t1;
526445
527175
  } else {
@@ -527736,15 +528466,15 @@ function getZshCompletionCommand(prefix, completionType) {
527736
528466
  }
527737
528467
  }
527738
528468
  async function getCompletionsForShell(shellType, prefix, completionType, abortSignal) {
527739
- let command8;
528469
+ let command9;
527740
528470
  if (shellType === "bash") {
527741
- command8 = getBashCompletionCommand(prefix, completionType);
528471
+ command9 = getBashCompletionCommand(prefix, completionType);
527742
528472
  } else if (shellType === "zsh") {
527743
- command8 = getZshCompletionCommand(prefix, completionType);
528473
+ command9 = getZshCompletionCommand(prefix, completionType);
527744
528474
  } else {
527745
528475
  return [];
527746
528476
  }
527747
- const shellCommand = await exec3(command8, abortSignal, "bash", {
528477
+ const shellCommand = await exec3(command9, abortSignal, "bash", {
527748
528478
  timeout: SHELL_COMPLETION_TIMEOUT_MS
527749
528479
  });
527750
528480
  const result = await shellCommand.result;
@@ -527917,21 +528647,21 @@ function get2(obj, path26) {
527917
528647
  return arr ? list : list[0];
527918
528648
  }
527919
528649
  function norm(weight = 1, mantissa = 3) {
527920
- const cache4 = new Map;
528650
+ const cache5 = new Map;
527921
528651
  const m2 = Math.pow(10, mantissa);
527922
528652
  return {
527923
528653
  get(value) {
527924
528654
  const numTokens = value.match(SPACE).length;
527925
- if (cache4.has(numTokens)) {
527926
- return cache4.get(numTokens);
528655
+ if (cache5.has(numTokens)) {
528656
+ return cache5.get(numTokens);
527927
528657
  }
527928
528658
  const norm2 = 1 / Math.pow(numTokens, 0.5 * weight);
527929
528659
  const n3 = parseFloat(Math.round(norm2 * m2) / m2);
527930
- cache4.set(numTokens, n3);
528660
+ cache5.set(numTokens, n3);
527931
528661
  return n3;
527932
528662
  },
527933
528663
  clear() {
527934
- cache4.clear();
528664
+ cache5.clear();
527935
528665
  }
527936
528666
  };
527937
528667
  }
@@ -529168,8 +529898,8 @@ function hasCommandArgs(input) {
529168
529898
  return false;
529169
529899
  return true;
529170
529900
  }
529171
- function formatCommand(command8) {
529172
- return `/${command8} `;
529901
+ function formatCommand(command9) {
529902
+ return `/${command9} `;
529173
529903
  }
529174
529904
  function getCommandId2(cmd) {
529175
529905
  const commandName = getCommandName(cmd);
@@ -529369,7 +530099,7 @@ var init_commandSuggestions = __esm(() => {
529369
530099
  // src/utils/suggestions/shellHistoryCompletion.ts
529370
530100
  async function getShellHistoryCommands() {
529371
530101
  const now2 = Date.now();
529372
- if (shellHistoryCache && now2 - shellHistoryCacheTimestamp < CACHE_TTL_MS5) {
530102
+ if (shellHistoryCache && now2 - shellHistoryCacheTimestamp < CACHE_TTL_MS6) {
529373
530103
  return shellHistoryCache;
529374
530104
  }
529375
530105
  const commands = [];
@@ -529377,10 +530107,10 @@ async function getShellHistoryCommands() {
529377
530107
  try {
529378
530108
  for await (const entry of getHistory()) {
529379
530109
  if (entry.display && entry.display.startsWith("!")) {
529380
- const command8 = entry.display.slice(1).trim();
529381
- if (command8 && !seen.has(command8)) {
529382
- seen.add(command8);
529383
- commands.push(command8);
530110
+ const command9 = entry.display.slice(1).trim();
530111
+ if (command9 && !seen.has(command9)) {
530112
+ seen.add(command9);
530113
+ commands.push(command9);
529384
530114
  }
529385
530115
  }
529386
530116
  if (commands.length >= 50) {
@@ -529394,15 +530124,15 @@ async function getShellHistoryCommands() {
529394
530124
  shellHistoryCacheTimestamp = now2;
529395
530125
  return commands;
529396
530126
  }
529397
- function prependToShellHistoryCache(command8) {
530127
+ function prependToShellHistoryCache(command9) {
529398
530128
  if (!shellHistoryCache) {
529399
530129
  return;
529400
530130
  }
529401
- const idx = shellHistoryCache.indexOf(command8);
530131
+ const idx = shellHistoryCache.indexOf(command9);
529402
530132
  if (idx !== -1) {
529403
530133
  shellHistoryCache.splice(idx, 1);
529404
530134
  }
529405
- shellHistoryCache.unshift(command8);
530135
+ shellHistoryCache.unshift(command9);
529406
530136
  }
529407
530137
  async function getShellHistoryCompletion(input) {
529408
530138
  if (!input || input.length < 2) {
@@ -529413,17 +530143,17 @@ async function getShellHistoryCompletion(input) {
529413
530143
  return null;
529414
530144
  }
529415
530145
  const commands = await getShellHistoryCommands();
529416
- for (const command8 of commands) {
529417
- if (command8.startsWith(input) && command8 !== input) {
530146
+ for (const command9 of commands) {
530147
+ if (command9.startsWith(input) && command9 !== input) {
529418
530148
  return {
529419
- fullCommand: command8,
529420
- suffix: command8.slice(input.length)
530149
+ fullCommand: command9,
530150
+ suffix: command9.slice(input.length)
529421
530151
  };
529422
530152
  }
529423
530153
  }
529424
530154
  return null;
529425
530155
  }
529426
- var shellHistoryCache = null, shellHistoryCacheTimestamp = 0, CACHE_TTL_MS5 = 60000;
530156
+ var shellHistoryCache = null, shellHistoryCacheTimestamp = 0, CACHE_TTL_MS6 = 60000;
529427
530157
  var init_shellHistoryCompletion = __esm(() => {
529428
530158
  init_history();
529429
530159
  init_debug();
@@ -529507,7 +530237,7 @@ function mcpQueryFor(searchToken) {
529507
530237
  function findReusableCacheEntry(mcpQuery, searchToken) {
529508
530238
  let best;
529509
530239
  let bestLen = 0;
529510
- for (const [key2, channels] of cache4) {
530240
+ for (const [key2, channels] of cache5) {
529511
530241
  if (mcpQuery.startsWith(key2) && key2.length > bestLen && channels.some((c6) => c6.startsWith(searchToken))) {
529512
530242
  best = channels;
529513
530243
  bestLen = key2.length;
@@ -529520,7 +530250,7 @@ async function getSlackChannelSuggestions(clients, searchToken) {
529520
530250
  return [];
529521
530251
  const mcpQuery = mcpQueryFor(searchToken);
529522
530252
  const lower = searchToken.toLowerCase();
529523
- let channels = cache4.get(mcpQuery) ?? findReusableCacheEntry(mcpQuery, lower);
530253
+ let channels = cache5.get(mcpQuery) ?? findReusableCacheEntry(mcpQuery, lower);
529524
530254
  if (!channels) {
529525
530255
  if (inflightQuery === mcpQuery && inflightPromise) {
529526
530256
  channels = await inflightPromise;
@@ -529528,7 +530258,7 @@ async function getSlackChannelSuggestions(clients, searchToken) {
529528
530258
  inflightQuery = mcpQuery;
529529
530259
  inflightPromise = fetchChannels(clients, mcpQuery);
529530
530260
  channels = await inflightPromise;
529531
- cache4.set(mcpQuery, channels);
530261
+ cache5.set(mcpQuery, channels);
529532
530262
  const before = knownChannels.size;
529533
530263
  for (const c6 of channels)
529534
530264
  knownChannels.add(c6);
@@ -529536,8 +530266,8 @@ async function getSlackChannelSuggestions(clients, searchToken) {
529536
530266
  knownChannelsVersion++;
529537
530267
  knownChannelsChanged.emit();
529538
530268
  }
529539
- if (cache4.size > 50) {
529540
- cache4.delete(cache4.keys().next().value);
530269
+ if (cache5.size > 50) {
530270
+ cache5.delete(cache5.keys().next().value);
529541
530271
  }
529542
530272
  if (inflightQuery === mcpQuery) {
529543
530273
  inflightQuery = null;
@@ -529550,12 +530280,12 @@ async function getSlackChannelSuggestions(clients, searchToken) {
529550
530280
  displayText: `#${c6}`
529551
530281
  }));
529552
530282
  }
529553
- var SLACK_SEARCH_TOOL = "slack_search_channels", cache4, knownChannels, knownChannelsVersion = 0, knownChannelsChanged, subscribeKnownChannels, inflightQuery = null, inflightPromise = null, resultsEnvelopeSchema;
530283
+ var SLACK_SEARCH_TOOL = "slack_search_channels", cache5, knownChannels, knownChannelsVersion = 0, knownChannelsChanged, subscribeKnownChannels, inflightQuery = null, inflightPromise = null, resultsEnvelopeSchema;
529554
530284
  var init_slackChannelSuggestions = __esm(() => {
529555
530285
  init_zod3();
529556
530286
  init_debug();
529557
530287
  init_slowOperations();
529558
- cache4 = new Map;
530288
+ cache5 = new Map;
529559
530289
  knownChannels = new Set;
529560
530290
  knownChannelsChanged = createSignal();
529561
530291
  subscribeKnownChannels = knownChannelsChanged.subscribe;
@@ -529563,7 +530293,7 @@ var init_slackChannelSuggestions = __esm(() => {
529563
530293
  });
529564
530294
 
529565
530295
  // src/hooks/unifiedSuggestions.ts
529566
- import { basename as basename58 } from "path";
530296
+ import { basename as basename57 } from "path";
529567
530297
  function createSuggestionFromSource(source) {
529568
530298
  switch (source.type) {
529569
530299
  case "file":
@@ -529595,18 +530325,18 @@ function generateAgentSuggestions(agents2, query3, showOnEmpty = false) {
529595
530325
  return [];
529596
530326
  }
529597
530327
  try {
529598
- const agentSources = agents2.map((agent) => ({
530328
+ const agentSources = agents2.map((agent2) => ({
529599
530329
  type: "agent",
529600
- displayText: `${agent.agentType} (agent)`,
529601
- description: truncateDescription(agent.whenToUse),
529602
- agentType: agent.agentType,
529603
- color: getAgentColor(agent.agentType)
530330
+ displayText: `${agent2.agentType} (agent)`,
530331
+ description: truncateDescription(agent2.whenToUse),
530332
+ agentType: agent2.agentType,
530333
+ color: getAgentColor(agent2.agentType)
529604
530334
  }));
529605
530335
  if (!query3) {
529606
530336
  return agentSources;
529607
530337
  }
529608
530338
  const queryLower = query3.toLowerCase();
529609
- return agentSources.filter((agent) => agent.agentType.toLowerCase().includes(queryLower) || agent.displayText.toLowerCase().includes(queryLower));
530339
+ return agentSources.filter((agent2) => agent2.agentType.toLowerCase().includes(queryLower) || agent2.displayText.toLowerCase().includes(queryLower));
529610
530340
  } catch (error49) {
529611
530341
  logError2(error49);
529612
530342
  return [];
@@ -529625,7 +530355,7 @@ async function generateUnifiedSuggestions(query3, mcpResources, agents2, showOnE
529625
530355
  displayText: suggestion.displayText,
529626
530356
  description: suggestion.description,
529627
530357
  path: suggestion.displayText,
529628
- filename: basename58(suggestion.displayText),
530358
+ filename: basename57(suggestion.displayText),
529629
530359
  score: suggestion.metadata?.score
529630
530360
  }));
529631
530361
  const mcpSources = Object.values(mcpResources).flat().map((resource) => ({
@@ -530839,7 +531569,7 @@ var init_AutoModeOptInDialog = __esm(() => {
530839
531569
  });
530840
531570
 
530841
531571
  // src/components/BridgeDialog.tsx
530842
- import { basename as basename59 } from "path";
531572
+ import { basename as basename58 } from "path";
530843
531573
  function BridgeDialog(t0) {
530844
531574
  const $3 = import_compiler_runtime321.c(87);
530845
531575
  const {
@@ -530862,7 +531592,7 @@ function BridgeDialog(t0) {
530862
531592
  const [branchName, setBranchName] = import_react243.useState("");
530863
531593
  let t1;
530864
531594
  if ($3[0] === Symbol.for("react.memo_cache_sentinel")) {
530865
- t1 = basename59(getOriginalCwd());
531595
+ t1 = basename58(getOriginalCwd());
530866
531596
  $3[0] = t1;
530867
531597
  } else {
530868
531598
  t1 = $3[0];
@@ -536013,7 +536743,7 @@ var init_standaloneAgent = __esm(() => {
536013
536743
  function useSwarmBanner() {
536014
536744
  const teamContext = useAppState((s) => s.teamContext);
536015
536745
  const standaloneAgentContext = useAppState((s) => s.standaloneAgentContext);
536016
- const agent = useAppState((s) => s.agent);
536746
+ const agent2 = useAppState((s) => s.agent);
536017
536747
  useAppState((s) => s.viewingAgentTaskId);
536018
536748
  const store = useAppStateStore();
536019
536749
  const [insideTmux, setInsideTmux] = React141.useState(null);
@@ -536072,10 +536802,10 @@ function useSwarmBanner() {
536072
536802
  bgColor: toThemeColor(standaloneColor)
536073
536803
  };
536074
536804
  }
536075
- if (agent) {
536076
- const agentDef = state2.agentDefinitions.activeAgents.find((a2) => a2.agentType === agent);
536805
+ if (agent2) {
536806
+ const agentDef = state2.agentDefinitions.activeAgents.find((a2) => a2.agentType === agent2);
536077
536807
  return {
536078
- text: agent,
536808
+ text: agent2,
536079
536809
  bgColor: toThemeColor(agentDef?.color, "promptBorder")
536080
536810
  };
536081
536811
  }
@@ -541353,7 +542083,7 @@ var init_coordinatorHandler = __esm(() => {
541353
542083
  });
541354
542084
 
541355
542085
  // src/hooks/toolPermission/PermissionContext.ts
541356
- function createResolveOnce(resolve48) {
542086
+ function createResolveOnce(resolve47) {
541357
542087
  let claimed = false;
541358
542088
  let delivered = false;
541359
542089
  return {
@@ -541362,7 +542092,7 @@ function createResolveOnce(resolve48) {
541362
542092
  return;
541363
542093
  delivered = true;
541364
542094
  claimed = true;
541365
- resolve48(value);
542095
+ resolve47(value);
541366
542096
  },
541367
542097
  isResolved() {
541368
542098
  return claimed;
@@ -541407,11 +542137,11 @@ function createPermissionContext(tool, input, toolUseContext, assistantMessage,
541407
542137
  setToolPermissionContext(applyPermissionUpdates(appState.toolPermissionContext, updates));
541408
542138
  return updates.some((update) => supportsPersistence(update.destination));
541409
542139
  },
541410
- resolveIfAborted(resolve48) {
542140
+ resolveIfAborted(resolve47) {
541411
542141
  if (!toolUseContext.abortController.signal.aborted)
541412
542142
  return false;
541413
542143
  this.logCancelled();
541414
- resolve48(this.cancelAndAbort(undefined, true));
542144
+ resolve47(this.cancelAndAbort(undefined, true));
541415
542145
  return true;
541416
542146
  },
541417
542147
  cancelAndAbort(feedback2, isAbort, contentBlocks) {
@@ -541527,7 +542257,7 @@ var init_PermissionContext = __esm(() => {
541527
542257
 
541528
542258
  // src/hooks/toolPermission/handlers/interactiveHandler.ts
541529
542259
  import { randomUUID as randomUUID40 } from "crypto";
541530
- function handleInteractivePermission(params, resolve48) {
542260
+ function handleInteractivePermission(params, resolve47) {
541531
542261
  const {
541532
542262
  ctx,
541533
542263
  description,
@@ -541536,7 +542266,7 @@ function handleInteractivePermission(params, resolve48) {
541536
542266
  bridgeCallbacks,
541537
542267
  channelCallbacks
541538
542268
  } = params;
541539
- const { resolve: resolveOnce, isResolved, claim } = createResolveOnce(resolve48);
542269
+ const { resolve: resolveOnce, isResolved, claim } = createResolveOnce(resolve47);
541540
542270
  let userInteracted = false;
541541
542271
  let checkmarkTransitionTimer;
541542
542272
  let checkmarkAbortHandler;
@@ -541723,8 +542453,8 @@ async function handleSwarmWorkerPermission(params) {
541723
542453
  ...prev,
541724
542454
  pendingWorkerRequest: null
541725
542455
  }));
541726
- const decision = await new Promise((resolve48) => {
541727
- const { resolve: resolveOnce, claim } = createResolveOnce(resolve48);
542456
+ const decision = await new Promise((resolve47) => {
542457
+ const { resolve: resolveOnce, claim } = createResolveOnce(resolve47);
541728
542458
  const request = createPermissionRequest({
541729
542459
  toolName: ctx.tool.name,
541730
542460
  toolUseId: ctx.toolUseID,
@@ -541790,15 +542520,15 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
541790
542520
  const $3 = import_compiler_runtime339.c(3);
541791
542521
  let t0;
541792
542522
  if ($3[0] !== setToolPermissionContext || $3[1] !== setToolUseConfirmQueue) {
541793
- t0 = async (tool, input, toolUseContext, assistantMessage, toolUseID, forceDecision) => new Promise((resolve48) => {
542523
+ t0 = async (tool, input, toolUseContext, assistantMessage, toolUseID, forceDecision) => new Promise((resolve47) => {
541794
542524
  const ctx = createPermissionContext(tool, input, toolUseContext, assistantMessage, toolUseID, setToolPermissionContext, createPermissionQueueOps(setToolUseConfirmQueue));
541795
- if (ctx.resolveIfAborted(resolve48)) {
542525
+ if (ctx.resolveIfAborted(resolve47)) {
541796
542526
  return;
541797
542527
  }
541798
542528
  const decisionPromise = forceDecision !== undefined ? Promise.resolve(forceDecision) : hasPermissionsToUseTool(tool, input, toolUseContext, assistantMessage, toolUseID);
541799
542529
  return decisionPromise.then(async (result) => {
541800
542530
  if (result.behavior === "allow") {
541801
- if (ctx.resolveIfAborted(resolve48)) {
542531
+ if (ctx.resolveIfAborted(resolve47)) {
541802
542532
  return;
541803
542533
  }
541804
542534
  if (false) {}
@@ -541806,7 +542536,7 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
541806
542536
  decision: "accept",
541807
542537
  source: "config"
541808
542538
  });
541809
- resolve48(ctx.buildAllow(result.updatedInput ?? input, {
542539
+ resolve47(ctx.buildAllow(result.updatedInput ?? input, {
541810
542540
  decisionReason: result.decisionReason
541811
542541
  }));
541812
542542
  return;
@@ -541817,7 +542547,7 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
541817
542547
  toolPermissionContext: appState.toolPermissionContext,
541818
542548
  tools: toolUseContext.options.tools
541819
542549
  });
541820
- if (ctx.resolveIfAborted(resolve48)) {
542550
+ if (ctx.resolveIfAborted(resolve47)) {
541821
542551
  return;
541822
542552
  }
541823
542553
  switch (result.behavior) {
@@ -541833,7 +542563,7 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
541833
542563
  source: "config"
541834
542564
  });
541835
542565
  if (false) {}
541836
- resolve48(result);
542566
+ resolve47(result);
541837
542567
  return;
541838
542568
  }
541839
542569
  case "ask": {
@@ -541846,11 +542576,11 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
541846
542576
  permissionMode: appState.toolPermissionContext.mode
541847
542577
  });
541848
542578
  if (coordinatorDecision) {
541849
- resolve48(coordinatorDecision);
542579
+ resolve47(coordinatorDecision);
541850
542580
  return;
541851
542581
  }
541852
542582
  }
541853
- if (ctx.resolveIfAborted(resolve48)) {
542583
+ if (ctx.resolveIfAborted(resolve47)) {
541854
542584
  return;
541855
542585
  }
541856
542586
  const swarmDecision = await handleSwarmWorkerPermission({
@@ -541861,7 +542591,7 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
541861
542591
  suggestions: result.suggestions
541862
542592
  });
541863
542593
  if (swarmDecision) {
541864
- resolve48(swarmDecision);
542594
+ resolve47(swarmDecision);
541865
542595
  return;
541866
542596
  }
541867
542597
  if (false) {}
@@ -541872,7 +542602,7 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
541872
542602
  awaitAutomatedChecksBeforeDialog: appState.toolPermissionContext.awaitAutomatedChecksBeforeDialog,
541873
542603
  bridgeCallbacks: undefined,
541874
542604
  channelCallbacks: undefined
541875
- }, resolve48);
542605
+ }, resolve47);
541876
542606
  return;
541877
542607
  }
541878
542608
  }
@@ -541880,10 +542610,10 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
541880
542610
  if (error49 instanceof AbortError || error49 instanceof APIUserAbortError) {
541881
542611
  logForDebugging(`Permission check threw ${error49.constructor.name} for tool=${tool.name}: ${error49.message}`);
541882
542612
  ctx.logCancelled();
541883
- resolve48(ctx.cancelAndAbort(undefined, true));
542613
+ resolve47(ctx.cancelAndAbort(undefined, true));
541884
542614
  } else {
541885
542615
  logError2(error49);
541886
- resolve48(ctx.cancelAndAbort(undefined, true));
542616
+ resolve47(ctx.cancelAndAbort(undefined, true));
541887
542617
  }
541888
542618
  }).finally(() => {
541889
542619
  clearClassifierChecking(toolUseID);
@@ -543555,7 +544285,7 @@ __export(exports_asciicast, {
543555
544285
  _resetRecordingStateForTesting: () => _resetRecordingStateForTesting
543556
544286
  });
543557
544287
  import { appendFile as appendFile7, rename as rename12 } from "fs/promises";
543558
- import { basename as basename60, dirname as dirname63, join as join151 } from "path";
544288
+ import { basename as basename59, dirname as dirname63, join as join151 } from "path";
543559
544289
  function getRecordFilePath() {
543560
544290
  if (recordingState.filePath !== null) {
543561
544291
  return recordingState.filePath;
@@ -543601,8 +544331,8 @@ async function renameRecordingForSession() {
543601
544331
  return;
543602
544332
  }
543603
544333
  await recorder?.flush();
543604
- const oldName = basename60(oldPath);
543605
- const newName = basename60(newPath);
544334
+ const oldName = basename59(oldPath);
544335
+ const newName = basename59(newPath);
543606
544336
  try {
543607
544337
  await rename12(oldPath, newPath);
543608
544338
  recordingState.filePath = newPath;
@@ -543763,7 +544493,7 @@ function restoreAgentFromSession(agentSetting, currentAgentDefinition, agentDefi
543763
544493
  setMainThreadAgentType(undefined);
543764
544494
  return { agentDefinition: undefined, agentType: undefined };
543765
544495
  }
543766
- const resumedAgent = agentDefinitions.activeAgents.find((agent) => agent.agentType === agentSetting);
544496
+ const resumedAgent = agentDefinitions.activeAgents.find((agent2) => agent2.agentType === agentSetting);
543767
544497
  if (!resumedAgent) {
543768
544498
  logForDebugging(`Resumed session had agent "${agentSetting}" but it is no longer available. Using default behavior.`);
543769
544499
  setMainThreadAgentType(undefined);
@@ -548359,7 +549089,7 @@ class StructuredIO {
548359
549089
  });
548360
549090
  }
548361
549091
  try {
548362
- return await new Promise((resolve49, reject2) => {
549092
+ return await new Promise((resolve48, reject2) => {
548363
549093
  this.pendingRequests.set(requestId, {
548364
549094
  request: {
548365
549095
  type: "control_request",
@@ -548367,7 +549097,7 @@ class StructuredIO {
548367
549097
  request
548368
549098
  },
548369
549099
  resolve: (result) => {
548370
- resolve49(result);
549100
+ resolve48(result);
548371
549101
  },
548372
549102
  reject: reject2,
548373
549103
  schema
@@ -549278,12 +550008,12 @@ var init_useLspInitializationNotification = __esm(() => {
549278
550008
  });
549279
550009
 
549280
550010
  // src/utils/binaryCheck.ts
549281
- async function isBinaryInstalled(command8) {
549282
- if (!command8 || !command8.trim()) {
550011
+ async function isBinaryInstalled(command9) {
550012
+ if (!command9 || !command9.trim()) {
549283
550013
  logForDebugging("[binaryCheck] Empty command provided, returning false");
549284
550014
  return false;
549285
550015
  }
549286
- const trimmedCommand = command8.trim();
550016
+ const trimmedCommand = command9.trim();
549287
550017
  const cached3 = binaryCache.get(trimmedCommand);
549288
550018
  if (cached3 !== undefined) {
549289
550019
  logForDebugging(`[binaryCheck] Cache hit for '${trimmedCommand}': ${cached3}`);
@@ -549336,13 +550066,13 @@ function isRecord2(value) {
549336
550066
  }
549337
550067
  function extractFromServerConfigRecord(serverConfigs) {
549338
550068
  const extensions = new Set;
549339
- let command8 = null;
550069
+ let command9 = null;
549340
550070
  for (const [_serverName, config5] of Object.entries(serverConfigs)) {
549341
550071
  if (!isRecord2(config5)) {
549342
550072
  continue;
549343
550073
  }
549344
- if (!command8 && typeof config5.command === "string") {
549345
- command8 = config5.command;
550074
+ if (!command9 && typeof config5.command === "string") {
550075
+ command9 = config5.command;
549346
550076
  }
549347
550077
  const extMapping = config5.extensionToLanguage;
549348
550078
  if (isRecord2(extMapping)) {
@@ -549351,10 +550081,10 @@ function extractFromServerConfigRecord(serverConfigs) {
549351
550081
  }
549352
550082
  }
549353
550083
  }
549354
- if (!command8 || extensions.size === 0) {
550084
+ if (!command9 || extensions.size === 0) {
549355
550085
  return null;
549356
550086
  }
549357
- return { extensions, command: command8 };
550087
+ return { extensions, command: command9 };
549358
550088
  }
549359
550089
  async function getLspPluginsFromMarketplaces() {
549360
550090
  const result = new Map;
@@ -549490,7 +550220,7 @@ function usePluginRecommendationBase() {
549490
550220
  const isCheckingRef = React148.useRef(false);
549491
550221
  let t0;
549492
550222
  if ($3[0] !== recommendation) {
549493
- t0 = (resolve49) => {
550223
+ t0 = (resolve48) => {
549494
550224
  if (getIsRemoteMode()) {
549495
550225
  return;
549496
550226
  }
@@ -549501,7 +550231,7 @@ function usePluginRecommendationBase() {
549501
550231
  return;
549502
550232
  }
549503
550233
  isCheckingRef.current = true;
549504
- resolve49().then((rec) => {
550234
+ resolve48().then((rec) => {
549505
550235
  if (rec) {
549506
550236
  setRecommendation(rec);
549507
550237
  }
@@ -550377,7 +551107,7 @@ var init_usePluginAutoupdateNotification = __esm(() => {
550377
551107
  });
550378
551108
 
550379
551109
  // src/utils/plugins/reconciler.ts
550380
- import { isAbsolute as isAbsolute29, resolve as resolve49 } from "path";
551110
+ import { isAbsolute as isAbsolute29, resolve as resolve48 } from "path";
550381
551111
  function diffMarketplaces(declared, materialized, opts) {
550382
551112
  const missing = [];
550383
551113
  const sourceChanged = [];
@@ -550490,7 +551220,7 @@ function normalizeSource(source, projectRoot) {
550490
551220
  const canonicalRoot = findCanonicalGitRoot(base2);
550491
551221
  return {
550492
551222
  ...source,
550493
- path: resolve49(canonicalRoot ?? base2, source.path)
551223
+ path: resolve48(canonicalRoot ?? base2, source.path)
550494
551224
  };
550495
551225
  }
550496
551226
  return source;
@@ -551703,8 +552433,8 @@ function isSessionContainerCompatible(messages) {
551703
552433
  }
551704
552434
  if (toolName2 === BASH_TOOL_NAME) {
551705
552435
  const input = block.input;
551706
- const command8 = input?.command || "";
551707
- if (EXTERNAL_COMMAND_PATTERNS.some((p) => p.test(command8))) {
552436
+ const command9 = input?.command || "";
552437
+ if (EXTERNAL_COMMAND_PATTERNS.some((p) => p.test(command9))) {
551708
552438
  return false;
551709
552439
  }
551710
552440
  }
@@ -553768,12 +554498,12 @@ Error: sandbox required but unavailable: ${reason}
553768
554498
  return () => unregisterLeaderSetToolPermissionContext();
553769
554499
  }, [setToolPermissionContext]);
553770
554500
  const canUseTool = useCanUseTool_default(setToolUseConfirmQueue, setToolPermissionContext);
553771
- const requestPrompt = import_react319.useCallback((title, toolInputSummary) => (request) => new Promise((resolve50, reject2) => {
554501
+ const requestPrompt = import_react319.useCallback((title, toolInputSummary) => (request) => new Promise((resolve49, reject2) => {
553772
554502
  setPromptQueue((prev) => [...prev, {
553773
554503
  request,
553774
554504
  title,
553775
554505
  toolInputSummary,
553776
- resolve: resolve50,
554506
+ resolve: resolve49,
553777
554507
  reject: reject2
553778
554508
  }]);
553779
554509
  }), []);
@@ -554566,22 +555296,22 @@ Error: sandbox required but unavailable: ${reason}
554566
555296
  helpers2.clearBuffer();
554567
555297
  }, [setAppState, setInputValue, getToolUseContext, canUseTool, mainLoopModel, addNotification]);
554568
555298
  const handleAutoRunIssue = import_react319.useCallback(() => {
554569
- const command8 = autoRunIssueReason ? getAutoRunCommand(autoRunIssueReason) : "/issue";
555299
+ const command9 = autoRunIssueReason ? getAutoRunCommand(autoRunIssueReason) : "/issue";
554570
555300
  setAutoRunIssueReason(null);
554571
- onSubmit(command8, {
555301
+ onSubmit(command9, {
554572
555302
  setCursorOffset: () => {},
554573
555303
  clearBuffer: () => {},
554574
555304
  resetHistory: () => {}
554575
555305
  }).catch((err2) => {
554576
- logForDebugging(`Auto-run ${command8} failed: ${errorMessage(err2)}`);
555306
+ logForDebugging(`Auto-run ${command9} failed: ${errorMessage(err2)}`);
554577
555307
  });
554578
555308
  }, [onSubmit, autoRunIssueReason]);
554579
555309
  const handleCancelAutoRunIssue = import_react319.useCallback(() => {
554580
555310
  setAutoRunIssueReason(null);
554581
555311
  }, []);
554582
555312
  const handleSurveyRequestFeedback = import_react319.useCallback(() => {
554583
- const command8 = "/feedback";
554584
- onSubmit(command8, {
555313
+ const command9 = "/feedback";
555314
+ onSubmit(command9, {
554585
555315
  setCursorOffset: () => {},
554586
555316
  clearBuffer: () => {},
554587
555317
  resetHistory: () => {}
@@ -556665,8 +557395,8 @@ async function handleMcpjsonServerApprovals(root2) {
556665
557395
  if (pendingServers.length === 0) {
556666
557396
  return;
556667
557397
  }
556668
- await new Promise((resolve50) => {
556669
- const done = () => void resolve50();
557398
+ await new Promise((resolve49) => {
557399
+ const done = () => void resolve49();
556670
557400
  if (pendingServers.length === 1 && pendingServers[0] !== undefined) {
556671
557401
  const serverName = pendingServers[0];
556672
557402
  root2.render(/* @__PURE__ */ jsx_dev_runtime470.jsxDEV(AppStateProvider, {
@@ -559104,8 +559834,8 @@ function _temp443(command_0) {
559104
559834
  function _temp359(tool_0) {
559105
559835
  return tool_0 === BASH_TOOL_NAME || tool_0.startsWith(BASH_TOOL_NAME + "(");
559106
559836
  }
559107
- function _temp2102(command8) {
559108
- return command8.type === "prompt" && command8.loadedFrom === "commands_DEPRECATED" && (command8.source === "projectSettings" || command8.source === "localSettings") && command8.allowedTools?.some(_temp303);
559837
+ function _temp2102(command9) {
559838
+ return command9.type === "prompt" && command9.loadedFrom === "commands_DEPRECATED" && (command9.source === "projectSettings" || command9.source === "localSettings") && command9.allowedTools?.some(_temp303);
559109
559839
  }
559110
559840
  function _temp303(tool) {
559111
559841
  return tool === BASH_TOOL_NAME || tool.startsWith(BASH_TOOL_NAME + "(");
@@ -559445,8 +560175,8 @@ function completeOnboarding() {
559445
560175
  }));
559446
560176
  }
559447
560177
  function showDialog(root2, renderer) {
559448
- return new Promise((resolve50) => {
559449
- const done = (result) => void resolve50(result);
560178
+ return new Promise((resolve49) => {
560179
+ const done = (result) => void resolve49(result);
559450
560180
  root2.render(renderer(done));
559451
560181
  });
559452
560182
  }
@@ -560901,7 +561631,7 @@ function _temp307() {
560901
561631
  function CrossProjectMessage(t0) {
560902
561632
  const $3 = import_compiler_runtime384.c(8);
560903
561633
  const {
560904
- command: command8
561634
+ command: command9
560905
561635
  } = t0;
560906
561636
  let t1;
560907
561637
  if ($3[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -560930,7 +561660,7 @@ function CrossProjectMessage(t0) {
560930
561660
  t3 = $3[2];
560931
561661
  }
560932
561662
  let t4;
560933
- if ($3[3] !== command8) {
561663
+ if ($3[3] !== command9) {
560934
561664
  t4 = /* @__PURE__ */ jsx_dev_runtime485.jsxDEV(ThemedBox_default, {
560935
561665
  flexDirection: "column",
560936
561666
  children: [
@@ -560938,12 +561668,12 @@ function CrossProjectMessage(t0) {
560938
561668
  /* @__PURE__ */ jsx_dev_runtime485.jsxDEV(ThemedText, {
560939
561669
  children: [
560940
561670
  " ",
560941
- command8
561671
+ command9
560942
561672
  ]
560943
561673
  }, undefined, true, undefined, this)
560944
561674
  ]
560945
561675
  }, undefined, true, undefined, this);
560946
- $3[3] = command8;
561676
+ $3[3] = command9;
560947
561677
  $3[4] = t4;
560948
561678
  } else {
560949
561679
  t4 = $3[4];
@@ -561073,11 +561803,11 @@ async function isCodeGraphInstalled() {
561073
561803
  if (cachedResult !== null)
561074
561804
  return cachedResult;
561075
561805
  if (checkStarted) {
561076
- await new Promise((resolve50) => {
561806
+ await new Promise((resolve49) => {
561077
561807
  const check3 = setInterval(() => {
561078
561808
  if (cachedResult !== null) {
561079
561809
  clearInterval(check3);
561080
- resolve50();
561810
+ resolve49();
561081
561811
  }
561082
561812
  }, 50);
561083
561813
  });
@@ -561103,7 +561833,7 @@ var init_codegraphCheck = __esm(() => {
561103
561833
 
561104
561834
  // src/plugins/bundled/eccBuiltin.ts
561105
561835
  import { readdirSync as readdirSync6, readFileSync as readFileSync18, existsSync as existsSync11 } from "fs";
561106
- import { join as join155, dirname as dirname67, basename as basename61, extname as extname17 } from "path";
561836
+ import { join as join155, dirname as dirname67, basename as basename60, extname as extname17 } from "path";
561107
561837
  import { fileURLToPath as fileURLToPath9 } from "url";
561108
561838
  function resolveSeedDir() {
561109
561839
  if (process.env.CLAUDE_CODE_PLUGIN_SEED_DIR) {
@@ -561161,7 +561891,7 @@ var init_eccBuiltin = __esm(() => {
561161
561891
  for (const file2 of files3) {
561162
561892
  if (extname17(file2) !== ".md")
561163
561893
  continue;
561164
- const name = basename61(file2, ".md");
561894
+ const name = basename60(file2, ".md");
561165
561895
  const content = readFileSync18(join155(ECC_COMMANDS_DIR, file2), "utf-8");
561166
561896
  registerMarkdownSkill(name, join155(ECC_COMMANDS_DIR, file2), content, "Custom command");
561167
561897
  count4++;
@@ -561214,9 +561944,9 @@ var init_bundled = __esm(() => {
561214
561944
  });
561215
561945
 
561216
561946
  // src/services/plugins/pluginCliCommands.ts
561217
- function handlePluginCommandError(error49, command8, plugin2) {
561947
+ function handlePluginCommandError(error49, command9, plugin2) {
561218
561948
  logError2(error49);
561219
- const operation = plugin2 ? `${command8} plugin "${plugin2}"` : command8 === "disable-all" ? "disable all plugins" : `${command8} plugins`;
561949
+ const operation = plugin2 ? `${command9} plugin "${plugin2}"` : command9 === "disable-all" ? "disable all plugins" : `${command9} plugins`;
561220
561950
  console.error(`${figures_default.cross} Failed to ${operation}: ${errorMessage(error49)}`);
561221
561951
  const telemetryFields = plugin2 ? (() => {
561222
561952
  const { name, marketplace } = parsePluginIdentifier(plugin2);
@@ -561229,7 +561959,7 @@ function handlePluginCommandError(error49, command8, plugin2) {
561229
561959
  };
561230
561960
  })() : {};
561231
561961
  logEvent("tengu_plugin_command_failed", {
561232
- command: command8,
561962
+ command: command9,
561233
561963
  error_category: classifyPluginCommandError(error49),
561234
561964
  ...telemetryFields
561235
561965
  });
@@ -563713,23 +564443,25 @@ var init_migrateAutoUpdatesToSettings = __esm(() => {
563713
564443
  });
563714
564444
 
563715
564445
  // src/migrations/migrateBypassPermissionsAcceptedToSettings.ts
563716
- function migrateBypassPermissionsAcceptedToSettings() {
564446
+ async function migrateBypassPermissionsAcceptedToSettings() {
563717
564447
  const globalConfig2 = getGlobalConfig();
563718
564448
  if (!globalConfig2.bypassPermissionsModeAccepted) {
563719
564449
  return;
563720
564450
  }
563721
564451
  try {
563722
564452
  if (!hasSkipDangerousModePermissionPrompt()) {
563723
- const effectiveSkip = ["userSettings", "localSettings"].map((source) => getSettingsForSource(source)?.skipDangerousModePermissionPrompt).find((value) => value !== undefined);
563724
- const userExplicitlyOptedOut = effectiveSkip === false;
564453
+ const userExplicitlyOptedOut = getSettingsForSource("userSettings")?.skipDangerousModePermissionPrompt === false || getSettingsForSource("projectSettings")?.skipDangerousModePermissionPrompt === false || getSettingsForSource("localSettings")?.skipDangerousModePermissionPrompt === false || getSettingsForSource("flagSettings")?.skipDangerousModePermissionPrompt === false || getSettingsForSource("policySettings")?.skipDangerousModePermissionPrompt === false;
563725
564454
  if (!userExplicitlyOptedOut) {
563726
- updateSettingsForSource("userSettings", {
564455
+ const result = await updateSettingsForSource("userSettings", {
563727
564456
  skipDangerousModePermissionPrompt: true
563728
564457
  });
564458
+ if (result.error) {
564459
+ throw result.error;
564460
+ }
563729
564461
  }
563730
564462
  }
563731
564463
  logEvent("tengu_migrate_bypass_permissions_accepted", {});
563732
- saveGlobalConfig((current) => {
564464
+ await saveGlobalConfig((current) => {
563733
564465
  if (!("bypassPermissionsModeAccepted" in current))
563734
564466
  return current;
563735
564467
  const { bypassPermissionsModeAccepted: _2, ...updatedConfig } = current;
@@ -563748,7 +564480,8 @@ var init_migrateBypassPermissionsAcceptedToSettings = __esm(() => {
563748
564480
  });
563749
564481
 
563750
564482
  // src/migrations/migrateEnableAllProjectMcpServersToSettings.ts
563751
- function migrateEnableAllProjectMcpServersToSettings() {
564483
+ import { createHash as createHash21 } from "crypto";
564484
+ async function migrateEnableAllProjectMcpServersToSettings() {
563752
564485
  const globalConfig2 = getGlobalConfig();
563753
564486
  if (globalConfig2.hasCompletedMcpServerMigration) {
563754
564487
  return;
@@ -563758,83 +564491,89 @@ function migrateEnableAllProjectMcpServersToSettings() {
563758
564491
  const hasEnabledServers = Array.isArray(projectConfig.enabledMcpjsonServers);
563759
564492
  const hasDisabledServers = Array.isArray(projectConfig.disabledMcpjsonServers);
563760
564493
  if (!hasEnableAll && !hasEnabledServers && !hasDisabledServers) {
563761
- saveGlobalConfig((c6) => ({ ...c6, hasCompletedMcpServerMigration: true }));
564494
+ await saveGlobalConfig((c6) => ({ ...c6, hasCompletedMcpServerMigration: true }));
563762
564495
  return;
563763
564496
  }
563764
- const updates = {};
563765
564497
  const existingSettings = getSettingsForSource("localSettings") || {};
564498
+ const updates = Object.create(null);
564499
+ for (const key2 of Object.keys(existingSettings)) {
564500
+ updates[key2] = existingSettings[key2];
564501
+ }
563766
564502
  if (hasEnableAll) {
563767
564503
  updates.enableAllProjectMcpServers = projectConfig.enableAllProjectMcpServers;
563768
564504
  }
563769
- const existingEnabledServers = Array.isArray(existingSettings.enabledMcpjsonServers) ? [...existingSettings.enabledMcpjsonServers] : [];
564505
+ let existingEnabledServers = Array.isArray(existingSettings.enabledMcpjsonServers) ? [...existingSettings.enabledMcpjsonServers] : [];
563770
564506
  const existingDisabledServers = Array.isArray(existingSettings.disabledMcpjsonServers) ? [...existingSettings.disabledMcpjsonServers] : [];
563771
- if (hasEnabledServers) {
563772
- if (Array.isArray(projectConfig.enabledMcpjsonServers)) {
563773
- if (projectConfig.enabledMcpjsonServers.length === 0) {
563774
- existingEnabledServers.length = 0;
563775
- } else {
563776
- const seen = new Set(existingEnabledServers);
563777
- for (const server of projectConfig.enabledMcpjsonServers) {
563778
- if (!seen.has(server)) {
563779
- existingEnabledServers.push(server);
563780
- seen.add(server);
563781
- }
563782
- }
564507
+ if (hasEnabledServers && Array.isArray(projectConfig.enabledMcpjsonServers) && projectConfig.enabledMcpjsonServers.length > 0) {
564508
+ const seen = new Set(existingEnabledServers);
564509
+ for (const server of projectConfig.enabledMcpjsonServers) {
564510
+ if (!seen.has(server)) {
564511
+ existingEnabledServers.push(server);
564512
+ seen.add(server);
563783
564513
  }
563784
564514
  }
563785
564515
  }
563786
- if (hasDisabledServers) {
563787
- if (Array.isArray(projectConfig.disabledMcpjsonServers)) {
563788
- if (projectConfig.disabledMcpjsonServers.length === 0) {
563789
- existingDisabledServers.length = 0;
563790
- } else {
563791
- const seen = new Set(existingDisabledServers);
563792
- for (const server of projectConfig.disabledMcpjsonServers) {
563793
- if (!seen.has(server)) {
563794
- existingDisabledServers.push(server);
563795
- seen.add(server);
563796
- }
563797
- }
564516
+ if (hasDisabledServers && Array.isArray(projectConfig.disabledMcpjsonServers) && projectConfig.disabledMcpjsonServers.length > 0) {
564517
+ const seen = new Set(existingDisabledServers);
564518
+ for (const server of projectConfig.disabledMcpjsonServers) {
564519
+ if (!seen.has(server)) {
564520
+ existingDisabledServers.push(server);
564521
+ seen.add(server);
563798
564522
  }
563799
564523
  }
563800
564524
  }
563801
564525
  const overlappingServers = existingEnabledServers.filter((server) => existingDisabledServers.includes(server));
563802
564526
  if (overlappingServers.length > 0) {
563803
- logEvent("tengu_migrate_mcp_server_conflict_resolved", {
563804
- overlappingServerCount: overlappingServers.length,
563805
- conflictResolution: "removed_from_disabled"
563806
- });
564527
+ existingEnabledServers = existingEnabledServers.filter((server) => !existingDisabledServers.includes(server));
564528
+ const existingDisabledServersFromSettings = Array.isArray(existingSettings.disabledMcpjsonServers) ? existingSettings.disabledMcpjsonServers : [];
564529
+ const isDuplicateConflict = overlappingServers.every((server) => existingDisabledServersFromSettings.includes(server));
564530
+ if (!isDuplicateConflict) {
564531
+ const hashedOverlappingServers = overlappingServers.map((server) => createHash21("sha256").update(server).digest("hex"));
564532
+ logEvent("tengu_migrate_mcp_server_conflict_resolved", {
564533
+ overlappingServers: hashedOverlappingServers.join(","),
564534
+ conflictResolution: "removed_from_enabled_list"
564535
+ });
564536
+ }
563807
564537
  }
563808
- const finalDisabledServers = existingDisabledServers.filter((server) => !existingEnabledServers.includes(server));
563809
- if (hasEnabledServers) {
564538
+ if (hasEnabledServers || existingSettings.enabledMcpjsonServers !== undefined) {
563810
564539
  updates.enabledMcpjsonServers = existingEnabledServers;
563811
564540
  }
563812
564541
  if (hasDisabledServers || existingSettings.disabledMcpjsonServers !== undefined) {
563813
- updates.disabledMcpjsonServers = finalDisabledServers;
564542
+ updates.disabledMcpjsonServers = existingDisabledServers;
563814
564543
  }
563815
564544
  try {
563816
- const updateResult = updateSettingsForSource("localSettings", updates);
563817
- if (updateResult?.error) {
563818
- throw updateResult.error;
564545
+ const result = await updateSettingsForSource("localSettings", updates);
564546
+ if (result.error) {
564547
+ throw result.error;
563819
564548
  }
563820
564549
  } catch (error49) {
563821
564550
  logError2(new Error(`Failed to migrate MCP server settings to local config: ${error49}`));
563822
564551
  throw error49;
563823
564552
  }
563824
- saveCurrentProjectConfig((config5) => {
563825
- const updated = { ...config5 };
563826
- delete updated.enableAllProjectMcpServers;
563827
- delete updated.enabledMcpjsonServers;
563828
- delete updated.disabledMcpjsonServers;
563829
- return updated;
563830
- });
563831
- saveGlobalConfig((c6) => ({ ...c6, hasCompletedMcpServerMigration: true }));
564553
+ try {
564554
+ await saveCurrentProjectConfig((config5) => {
564555
+ const updated = { ...config5 };
564556
+ delete updated.enableAllProjectMcpServers;
564557
+ delete updated.enabledMcpjsonServers;
564558
+ delete updated.disabledMcpjsonServers;
564559
+ return updated;
564560
+ });
564561
+ } catch (error49) {
564562
+ logError2(new Error(`Failed to remove migrated MCP server fields from project config: ${error49}`));
564563
+ throw error49;
564564
+ }
564565
+ try {
564566
+ await saveGlobalConfig((c6) => ({ ...c6, hasCompletedMcpServerMigration: true }));
564567
+ } catch (error49) {
564568
+ logError2(new Error(`Failed to mark MCP server migration as completed: ${error49}`));
564569
+ throw error49;
564570
+ }
563832
564571
  logEvent("tengu_migrate_enable_all_project_mcp_servers_to_settings", {
563833
564572
  migration: "enableAllProjectMcpServersToSettings",
563834
564573
  fieldsMigrated: [
563835
- hasEnableAll && "enableAllProjectMcpServers",
563836
- hasEnabledServers && "enabledMcpjsonServers",
563837
- hasDisabledServers && "disabledMcpjsonServers"
564574
+ hasEnableAll ? "enableAllProjectMcpServers" : undefined,
564575
+ hasEnabledServers ? "enabledMcpjsonServers" : undefined,
564576
+ hasDisabledServers ? "disabledMcpjsonServers" : undefined
563838
564577
  ].filter(Boolean).join(",")
563839
564578
  });
563840
564579
  }
@@ -563848,7 +564587,6 @@ var init_migrateEnableAllProjectMcpServersToSettings = __esm(() => {
563848
564587
  // src/migrations/migrateFennecToOpus.ts
563849
564588
  var init_migrateFennecToOpus = __esm(() => {
563850
564589
  init_log3();
563851
- init_config();
563852
564590
  init_providers();
563853
564591
  init_settings2();
563854
564592
  });
@@ -563903,21 +564641,41 @@ var init_migrateOpusToOpus1m = __esm(() => {
563903
564641
  });
563904
564642
 
563905
564643
  // src/migrations/migrateReplBridgeEnabledToRemoteControlAtStartup.ts
563906
- function migrateReplBridgeEnabledToRemoteControlAtStartup() {
563907
- saveGlobalConfig((prev) => {
563908
- const oldValue = prev["replBridgeEnabled"];
564644
+ async function migrateReplBridgeEnabledToRemoteControlAtStartup() {
564645
+ await saveGlobalConfig((prev) => {
564646
+ const legacy = prev;
564647
+ const oldValue = legacy.replBridgeEnabled;
563909
564648
  if (oldValue === undefined)
563910
564649
  return prev;
563911
564650
  if (prev.remoteControlAtStartup !== undefined)
563912
564651
  return prev;
563913
- const newValue = typeof oldValue === "string" ? !["false", "0", "no", ""].includes(oldValue.toLowerCase().trim()) : Boolean(oldValue);
563914
- const next = { ...prev, remoteControlAtStartup: newValue };
563915
- delete next.replBridgeEnabled;
564652
+ const truthyValues = ["true", "1", "yes", "on", "enabled"];
564653
+ const falsyValues = ["false", "0", "no", "off", "disabled", ""];
564654
+ const normalizedString = typeof oldValue === "string" ? oldValue.toLowerCase().trim() : "";
564655
+ let newValue;
564656
+ if (typeof oldValue === "boolean") {
564657
+ newValue = oldValue;
564658
+ } else if (typeof oldValue === "string") {
564659
+ if (truthyValues.includes(normalizedString)) {
564660
+ newValue = true;
564661
+ } else if (falsyValues.includes(normalizedString)) {
564662
+ newValue = false;
564663
+ } else {
564664
+ logForDebugging(`Unknown replBridgeEnabled value "${oldValue}" during migration to remoteControlAtStartup; defaulting to false. Please review this value manually.`, { level: "warn" });
564665
+ newValue = false;
564666
+ }
564667
+ } else {
564668
+ logForDebugging(`Unknown replBridgeEnabled value of type "${typeof oldValue}" during migration to remoteControlAtStartup; defaulting to false. Please review this value manually.`, { level: "warn" });
564669
+ newValue = false;
564670
+ }
564671
+ const { replBridgeEnabled: _unused, ...rest } = legacy;
564672
+ const next = { ...rest, remoteControlAtStartup: newValue };
563916
564673
  return next;
563917
564674
  });
563918
564675
  }
563919
564676
  var init_migrateReplBridgeEnabledToRemoteControlAtStartup = __esm(() => {
563920
564677
  init_config();
564678
+ init_debug();
563921
564679
  });
563922
564680
 
563923
564681
  // src/migrations/migrateSonnet1mToSonnet45.ts
@@ -563926,6 +564684,8 @@ function migrateSonnet1mToSonnet45() {
563926
564684
  if (config5.sonnet1m45MigrationComplete) {
563927
564685
  return;
563928
564686
  }
564687
+ const sonnet45Model = CLAUDE_SONNET_4_5_CONFIG.firstParty;
564688
+ const sonnet45Model1m = `${sonnet45Model}[1m]`;
563929
564689
  try {
563930
564690
  const sources = ["userSettings", "projectSettings", "localSettings"];
563931
564691
  let anyMigrated = false;
@@ -563933,21 +564693,21 @@ function migrateSonnet1mToSonnet45() {
563933
564693
  const model = getSettingsForSource(source)?.model;
563934
564694
  if (model === "sonnet[1m]") {
563935
564695
  updateSettingsForSource(source, {
563936
- model: "sonnet-4-5-20250929[1m]"
564696
+ model: sonnet45Model1m
563937
564697
  });
563938
564698
  anyMigrated = true;
563939
564699
  }
563940
564700
  }
563941
564701
  const override = getMainLoopModelOverride();
563942
564702
  if (override === "sonnet[1m]") {
563943
- setMainLoopModelOverride("sonnet-4-5-20250929[1m]");
564703
+ setMainLoopModelOverride(sonnet45Model1m);
563944
564704
  }
563945
564705
  saveGlobalConfig((current) => ({
563946
564706
  ...current,
563947
564707
  sonnet1m45MigrationComplete: true
563948
564708
  }));
563949
564709
  } catch (error49) {
563950
- logError2(new Error(`Failed to migrate sonnet[1m] to sonnet-4-5-20250929[1m]: ${error49}`));
564710
+ logError2(new Error(`Failed to migrate sonnet[1m] to ${sonnet45Model1m}: ${error49}`));
563951
564711
  }
563952
564712
  }
563953
564713
  var init_migrateSonnet1mToSonnet45 = __esm(() => {
@@ -563955,6 +564715,7 @@ var init_migrateSonnet1mToSonnet45 = __esm(() => {
563955
564715
  init_state();
563956
564716
  init_config();
563957
564717
  init_settings2();
564718
+ init_configs();
563958
564719
  });
563959
564720
 
563960
564721
  // src/migrations/migrateSonnet45ToSonnet46.ts
@@ -564005,6 +564766,7 @@ var init_resetAutoModeOptInForDefaultOffer = __esm(() => {
564005
564766
  init_log3();
564006
564767
  init_permissionSetup();
564007
564768
  init_settings2();
564769
+ init_settingsCache();
564008
564770
  });
564009
564771
 
564010
564772
  // src/migrations/resetProToOpusDefault.ts
@@ -564053,6 +564815,248 @@ var init_resetProToOpusDefault = __esm(() => {
564053
564815
  init_settings2();
564054
564816
  });
564055
564817
 
564818
+ // src/migrations/migrationRunner.ts
564819
+ function topologicalSort(migrations) {
564820
+ const nameToMigration = new Map;
564821
+ for (const m2 of migrations) {
564822
+ if (nameToMigration.has(m2.name)) {
564823
+ throw new Error(`Duplicate migration name '${m2.name}'. Migration names must be unique.`);
564824
+ }
564825
+ nameToMigration.set(m2.name, m2);
564826
+ }
564827
+ for (const m2 of migrations) {
564828
+ if (m2.dependsOn?.includes(m2.name)) {
564829
+ throw new Error(`Self-dependency detected in migration '${m2.name}'. ` + `A migration cannot depend on itself.`);
564830
+ }
564831
+ }
564832
+ const dependsOnMap = new Map;
564833
+ for (const m2 of migrations) {
564834
+ if (m2.dependsOn) {
564835
+ const deps = new Set;
564836
+ for (const dep of m2.dependsOn) {
564837
+ if (!nameToMigration.has(dep)) {
564838
+ throw new Error(`Unknown dependency '${dep}' in migration '${m2.name}'. ` + `Dependency must be included in the migration list.`);
564839
+ }
564840
+ deps.add(dep);
564841
+ }
564842
+ dependsOnMap.set(m2.name, deps);
564843
+ }
564844
+ }
564845
+ const inDegree = new Map;
564846
+ const adjacency = new Map;
564847
+ for (const m2 of migrations) {
564848
+ inDegree.set(m2.name, 0);
564849
+ adjacency.set(m2.name, []);
564850
+ }
564851
+ for (const m2 of migrations) {
564852
+ const deps = dependsOnMap.get(m2.name);
564853
+ if (deps) {
564854
+ for (const dep of deps) {
564855
+ adjacency.get(dep).push(m2.name);
564856
+ inDegree.set(m2.name, (inDegree.get(m2.name) || 0) + 1);
564857
+ }
564858
+ }
564859
+ }
564860
+ const queue2 = [];
564861
+ for (const m2 of migrations) {
564862
+ if (inDegree.get(m2.name) === 0) {
564863
+ queue2.push(m2.name);
564864
+ }
564865
+ }
564866
+ const sorted = [];
564867
+ let queueIndex = 0;
564868
+ while (queueIndex < queue2.length) {
564869
+ const name = queue2[queueIndex];
564870
+ queueIndex++;
564871
+ const migration = nameToMigration.get(name);
564872
+ sorted.push(migration);
564873
+ for (const neighbour of adjacency.get(name) || []) {
564874
+ const newDegree = (inDegree.get(neighbour) || 1) - 1;
564875
+ inDegree.set(neighbour, newDegree);
564876
+ if (newDegree === 0) {
564877
+ queue2.push(neighbour);
564878
+ }
564879
+ }
564880
+ }
564881
+ if (sorted.length !== migrations.length) {
564882
+ const unsorted = new Set(migrations.map((m2) => m2.name));
564883
+ for (const name of sorted) {
564884
+ unsorted.delete(name);
564885
+ }
564886
+ const hasIndirectSelfDependency = () => {
564887
+ for (const node of unsorted) {
564888
+ const visited = new Set;
564889
+ const stack = [node];
564890
+ while (stack.length > 0) {
564891
+ const current = stack.pop();
564892
+ if (current === node && visited.size > 0) {
564893
+ return true;
564894
+ }
564895
+ if (visited.has(current))
564896
+ continue;
564897
+ visited.add(current);
564898
+ const deps = dependsOnMap.get(current);
564899
+ if (deps) {
564900
+ for (const dep of deps) {
564901
+ if (dep === node) {
564902
+ return true;
564903
+ }
564904
+ if (!visited.has(dep)) {
564905
+ stack.push(dep);
564906
+ }
564907
+ }
564908
+ }
564909
+ }
564910
+ }
564911
+ return false;
564912
+ };
564913
+ if (hasIndirectSelfDependency()) {
564914
+ const selfDepNames = Array.from(unsorted).join(", ");
564915
+ throw new Error(`Self-dependency detected in migration(s): ${selfDepNames}. ` + `A migration cannot depend on itself, directly or indirectly.`);
564916
+ }
564917
+ const cycleNames = Array.from(unsorted).join(", ");
564918
+ throw new Error(`Circular dependency detected in migrations: ${cycleNames}. ` + `Each migration must have a valid dependency chain.`);
564919
+ }
564920
+ return sorted;
564921
+ }
564922
+ async function runMigrationsSafe(migrations, completedMigrationNames) {
564923
+ const completedSet = new Set(completedMigrationNames);
564924
+ const allMigrationNames = new Set(migrations.map((m2) => m2.name));
564925
+ const missingDepMigrations = [];
564926
+ const missingDepNames = new Set;
564927
+ for (const m2 of migrations) {
564928
+ const missingDeps = [];
564929
+ if (m2.dependsOn) {
564930
+ for (const dep of m2.dependsOn) {
564931
+ if (!allMigrationNames.has(dep) && !completedSet.has(dep)) {
564932
+ missingDeps.push(dep);
564933
+ }
564934
+ }
564935
+ }
564936
+ if (missingDeps.length > 0) {
564937
+ missingDepMigrations.push({ migration: m2, missingDeps });
564938
+ missingDepNames.add(m2.name);
564939
+ }
564940
+ }
564941
+ const sanitizedMigrations = migrations.map((m2) => {
564942
+ const sanitizedDeps = m2.dependsOn?.filter((dep) => allMigrationNames.has(dep) && !completedSet.has(dep));
564943
+ return {
564944
+ ...m2,
564945
+ dependsOn: sanitizedDeps && sanitizedDeps.length > 0 ? sanitizedDeps : undefined
564946
+ };
564947
+ });
564948
+ let sortedMigrations;
564949
+ try {
564950
+ sortedMigrations = topologicalSort(sanitizedMigrations);
564951
+ } catch (error49) {
564952
+ const errorMessage4 = error49 instanceof Error ? error49.message : String(error49);
564953
+ const results2 = migrations.map((m2) => {
564954
+ const missingDep = missingDepMigrations.find((md) => md.migration.name === m2.name);
564955
+ if (missingDep) {
564956
+ return {
564957
+ success: false,
564958
+ error: `Missing dependency${missingDep.missingDeps.length > 1 ? "ies" : ""}: ${missingDep.missingDeps.join(", ")}. ` + `Dependency must be included in the migration list or already completed.`,
564959
+ migrationName: m2.name
564960
+ };
564961
+ }
564962
+ return {
564963
+ success: false,
564964
+ error: errorMessage4,
564965
+ migrationName: m2.name
564966
+ };
564967
+ });
564968
+ return {
564969
+ total: migrations.length,
564970
+ successful: 0,
564971
+ failed: migrations.length,
564972
+ skipped: 0,
564973
+ results: results2,
564974
+ newlyCompleted: []
564975
+ };
564976
+ }
564977
+ const results = [];
564978
+ let successful = 0;
564979
+ let failed = 0;
564980
+ let skipped = 0;
564981
+ const newlyCompleted = [];
564982
+ const succeededSet = new Set(completedSet);
564983
+ const failedMigrationNames = new Set;
564984
+ for (const { migration: m2, missingDeps } of missingDepMigrations) {
564985
+ const errorMessage4 = `Missing dependency${missingDeps.length > 1 ? "ies" : ""}: ${missingDeps.join(", ")}. ` + `Dependency must be included in the migration list or already completed.`;
564986
+ results.push({
564987
+ success: false,
564988
+ error: errorMessage4,
564989
+ migrationName: m2.name
564990
+ });
564991
+ failed++;
564992
+ failedMigrationNames.add(m2.name);
564993
+ }
564994
+ for (const { name, migration, dependsOn } of sortedMigrations) {
564995
+ if (missingDepNames.has(name)) {
564996
+ continue;
564997
+ }
564998
+ if (completedSet.has(name)) {
564999
+ results.push({
565000
+ success: true,
565001
+ migrationName: name,
565002
+ skipped: true
565003
+ });
565004
+ skipped++;
565005
+ continue;
565006
+ }
565007
+ let dependencyFailed = false;
565008
+ let dependencyError = "";
565009
+ if (dependsOn) {
565010
+ for (const dep of dependsOn) {
565011
+ if (!succeededSet.has(dep) || failedMigrationNames.has(dep)) {
565012
+ dependencyFailed = true;
565013
+ dependencyError = `Dependency ${dep} failed or was skipped`;
565014
+ break;
565015
+ }
565016
+ }
565017
+ }
565018
+ if (dependencyFailed) {
565019
+ results.push({
565020
+ success: false,
565021
+ error: dependencyError,
565022
+ migrationName: name
565023
+ });
565024
+ failed++;
565025
+ continue;
565026
+ }
565027
+ try {
565028
+ const result = migration();
565029
+ await Promise.resolve(result);
565030
+ results.push({ success: true, migrationName: name });
565031
+ successful++;
565032
+ newlyCompleted.push(name);
565033
+ succeededSet.add(name);
565034
+ } catch (error49) {
565035
+ const errorMessage4 = error49 instanceof Error ? error49.message : String(error49);
565036
+ logError2(new Error(`Migration '${name}' failed: ${errorMessage4}`));
565037
+ logEvent("tengu_migration_failed", { migration: name, error: errorMessage4 });
565038
+ results.push({
565039
+ success: false,
565040
+ error: errorMessage4,
565041
+ migrationName: name
565042
+ });
565043
+ failed++;
565044
+ }
565045
+ }
565046
+ return {
565047
+ total: migrations.length,
565048
+ successful,
565049
+ failed,
565050
+ skipped,
565051
+ results,
565052
+ newlyCompleted
565053
+ };
565054
+ }
565055
+ var init_migrationRunner = __esm(() => {
565056
+ init_log3();
565057
+ init_analytics();
565058
+ });
565059
+
564056
565060
  // src/server/types.ts
564057
565061
  var connectResponseSchema;
564058
565062
  var init_types17 = __esm(() => {
@@ -564894,8 +565898,8 @@ class SerialBatchEventUploader {
564894
565898
  if (items.length === 0)
564895
565899
  return;
564896
565900
  while (this.pending.length + items.length > this.config.maxQueueSize && !this.closed) {
564897
- await new Promise((resolve50) => {
564898
- this.backpressureResolvers.push(resolve50);
565901
+ await new Promise((resolve49) => {
565902
+ this.backpressureResolvers.push(resolve49);
564899
565903
  });
564900
565904
  }
564901
565905
  if (this.closed)
@@ -564908,8 +565912,8 @@ class SerialBatchEventUploader {
564908
565912
  return Promise.resolve();
564909
565913
  }
564910
565914
  this.drain();
564911
- return new Promise((resolve50) => {
564912
- this.flushResolvers.push(resolve50);
565915
+ return new Promise((resolve49) => {
565916
+ this.flushResolvers.push(resolve49);
564913
565917
  });
564914
565918
  }
564915
565919
  close() {
@@ -564920,11 +565924,11 @@ class SerialBatchEventUploader {
564920
565924
  this.pending = [];
564921
565925
  this.sleepResolve?.();
564922
565926
  this.sleepResolve = null;
564923
- for (const resolve50 of this.backpressureResolvers)
564924
- resolve50();
565927
+ for (const resolve49 of this.backpressureResolvers)
565928
+ resolve49();
564925
565929
  this.backpressureResolvers = [];
564926
- for (const resolve50 of this.flushResolvers)
564927
- resolve50();
565930
+ for (const resolve49 of this.flushResolvers)
565931
+ resolve49();
564928
565932
  this.flushResolvers = [];
564929
565933
  }
564930
565934
  async drain() {
@@ -564959,8 +565963,8 @@ class SerialBatchEventUploader {
564959
565963
  } finally {
564960
565964
  this.draining = false;
564961
565965
  if (this.pending.length === 0) {
564962
- for (const resolve50 of this.flushResolvers)
564963
- resolve50();
565966
+ for (const resolve49 of this.flushResolvers)
565967
+ resolve49();
564964
565968
  this.flushResolvers = [];
564965
565969
  }
564966
565970
  }
@@ -564999,16 +566003,16 @@ class SerialBatchEventUploader {
564999
566003
  releaseBackpressure() {
565000
566004
  const resolvers3 = this.backpressureResolvers;
565001
566005
  this.backpressureResolvers = [];
565002
- for (const resolve50 of resolvers3)
565003
- resolve50();
566006
+ for (const resolve49 of resolvers3)
566007
+ resolve49();
565004
566008
  }
565005
566009
  sleep(ms) {
565006
- return new Promise((resolve50) => {
565007
- this.sleepResolve = resolve50;
565008
- setTimeout((self2, resolve51) => {
566010
+ return new Promise((resolve49) => {
566011
+ this.sleepResolve = resolve49;
566012
+ setTimeout((self2, resolve50) => {
565009
566013
  self2.sleepResolve = null;
565010
- resolve51();
565011
- }, ms, this, resolve50);
566014
+ resolve50();
566015
+ }, ms, this, resolve49);
565012
566016
  });
565013
566017
  }
565014
566018
  }
@@ -567800,7 +568804,7 @@ var init_idleTimeout = __esm(() => {
567800
568804
  // src/bridge/inboundAttachments.ts
567801
568805
  import { randomUUID as randomUUID50 } from "crypto";
567802
568806
  import { mkdir as mkdir45, writeFile as writeFile46 } from "fs/promises";
567803
- import { basename as basename62, join as join158 } from "path";
568807
+ import { basename as basename61, join as join158 } from "path";
567804
568808
  function debug3(msg) {
567805
568809
  logForDebugging(`[bridge:inbound-attach] ${msg}`);
567806
568810
  }
@@ -567812,7 +568816,7 @@ function extractInboundAttachments(msg) {
567812
568816
  return parsed.success ? parsed.data : [];
567813
568817
  }
567814
568818
  function sanitizeFileName(name) {
567815
- const base2 = basename62(name).replace(/[^a-zA-Z0-9._-]/g, "_");
568819
+ const base2 = basename61(name).replace(/[^a-zA-Z0-9._-]/g, "_");
567816
568820
  return base2 || "attachment";
567817
568821
  }
567818
568822
  function uploadsDir() {
@@ -570221,7 +571225,13 @@ async function initReplBridge(options) {
570221
571225
  logForDebugging(`[bridge:repl] Skipping: cross-process backoff (dead token seen ${cfg.bridgeOauthDeadFailCount} times)`);
570222
571226
  return null;
570223
571227
  }
570224
- await checkAndRefreshOAuthTokenIfNeeded();
571228
+ try {
571229
+ await checkAndRefreshOAuthTokenIfNeeded();
571230
+ } catch (error49) {
571231
+ logBridgeSkip("oauth_refresh_failed", `[bridge:repl] Skipping: OAuth token refresh failed - ${errorMessage(error49)}`);
571232
+ onStateChange?.("failed", errorMessage(error49));
571233
+ return null;
571234
+ }
570225
571235
  const tokens = getClaudeAIOAuthTokens();
570226
571236
  if (tokens && tokens.expiresAt !== null && tokens.expiresAt <= Date.now()) {
570227
571237
  logBridgeSkip("oauth_expired_unrefreshable", "[bridge:repl] Skipping: OAuth token expired and refresh failed (re-login required)");
@@ -570310,7 +571320,14 @@ async function initReplBridge(options) {
570310
571320
  return userMessageCount >= 3;
570311
571321
  };
570312
571322
  const initialHistoryCap = getFeatureValue_CACHED_WITH_REFRESH("tengu_bridge_initial_history_cap", 200, 5 * 60 * 1000);
570313
- const orgUUID = await getOrganizationUUID();
571323
+ let orgUUID;
571324
+ try {
571325
+ orgUUID = await getOrganizationUUID();
571326
+ } catch (error49) {
571327
+ logBridgeSkip("get_org_uuid_failed", `[bridge:repl] Skipping: failed to get organization UUID - ${errorMessage(error49)}`);
571328
+ onStateChange?.("failed", errorMessage(error49));
571329
+ return null;
571330
+ }
570314
571331
  if (!orgUUID) {
570315
571332
  logBridgeSkip("no_org_uuid", "[bridge:repl] Skipping: no org UUID");
570316
571333
  onStateChange?.("failed", "/login");
@@ -571200,30 +572217,30 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initial
571200
572217
  }
571201
572218
  const isMainThread = (cmd) => cmd.agentId === undefined;
571202
572219
  try {
571203
- let command8;
572220
+ let command9;
571204
572221
  let waitingForAgents = false;
571205
572222
  const drainCommandQueue = async () => {
571206
- while (command8 = dequeue(isMainThread)) {
571207
- if (command8.mode !== "prompt" && command8.mode !== "orphaned-permission" && command8.mode !== "task-notification") {
572223
+ while (command9 = dequeue(isMainThread)) {
572224
+ if (command9.mode !== "prompt" && command9.mode !== "orphaned-permission" && command9.mode !== "task-notification") {
571208
572225
  throw new Error("only prompt commands are supported in streaming mode");
571209
572226
  }
571210
- const batch = [command8];
571211
- if (command8.mode === "prompt") {
571212
- while (canBatchWith(command8, peek(isMainThread))) {
572227
+ const batch = [command9];
572228
+ if (command9.mode === "prompt") {
572229
+ while (canBatchWith(command9, peek(isMainThread))) {
571213
572230
  batch.push(dequeue(isMainThread));
571214
572231
  }
571215
572232
  if (batch.length > 1) {
571216
- command8 = {
571217
- ...command8,
572233
+ command9 = {
572234
+ ...command9,
571218
572235
  value: joinPromptValues(batch.map((c6) => c6.value)),
571219
- uuid: batch.findLast((c6) => c6.uuid)?.uuid ?? command8.uuid
572236
+ uuid: batch.findLast((c6) => c6.uuid)?.uuid ?? command9.uuid
571220
572237
  };
571221
572238
  }
571222
572239
  }
571223
572240
  const batchUuids = batch.map((c6) => c6.uuid).filter((u4) => u4 !== undefined);
571224
572241
  if (options.replayUserMessages && batch.length > 1) {
571225
572242
  for (const c6 of batch) {
571226
- if (c6.uuid && c6.uuid !== command8.uuid) {
572243
+ if (c6.uuid && c6.uuid !== command9.uuid) {
571227
572244
  output.enqueue({
571228
572245
  type: "user",
571229
572246
  message: { role: "user", content: c6.value },
@@ -571249,8 +572266,8 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initial
571249
572266
  for (const uuid5 of batchUuids) {
571250
572267
  notifyCommandLifecycle(uuid5, "started");
571251
572268
  }
571252
- if (command8.mode === "task-notification") {
571253
- const notificationText = typeof command8.value === "string" ? command8.value : "";
572269
+ if (command9.mode === "task-notification") {
572270
+ const notificationText = typeof command9.value === "string" ? command9.value : "";
571254
572271
  const taskIdMatch = notificationText.match(/<task-id>([^<]+)<\/task-id>/);
571255
572272
  const toolUseIdMatch = notificationText.match(/<tool-use-id>([^<]+)<\/tool-use-id>/);
571256
572273
  const outputFileMatch = notificationText.match(/<output-file>([^<]+)<\/output-file>/);
@@ -571283,8 +572300,8 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initial
571283
572300
  });
571284
572301
  }
571285
572302
  }
571286
- const input = command8.value;
571287
- if (structuredIO instanceof RemoteIO && command8.mode === "prompt") {
572303
+ const input = command9.value;
572304
+ if (structuredIO instanceof RemoteIO && command9.mode === "prompt") {
571288
572305
  logEvent("tengu_bridge_message_received", {
571289
572306
  is_repl: false
571290
572307
  });
@@ -571294,7 +572311,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initial
571294
572311
  suggestionState.pendingSuggestion = null;
571295
572312
  suggestionState.pendingLastEmittedEntry = null;
571296
572313
  if (suggestionState.lastEmitted) {
571297
- if (command8.mode === "prompt") {
572314
+ if (command9.mode === "prompt") {
571298
572315
  const inputText = typeof input === "string" ? input : input.find((b3) => b3.type === "text")?.text;
571299
572316
  if (typeof inputText === "string") {
571300
572317
  logSuggestionOutcome(suggestionState.lastEmitted.text, inputText, suggestionState.lastEmitted.emittedAt, suggestionState.lastEmitted.promptId, suggestionState.lastEmitted.generationRequestId);
@@ -571306,7 +572323,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initial
571306
572323
  const turnStartTime = undefined;
571307
572324
  headlessProfilerCheckpoint("before_ask");
571308
572325
  startQueryProfile();
571309
- const cmd = command8;
572326
+ const cmd = command9;
571310
572327
  await runWithWorkload(cmd.workload ?? options.workload, async () => {
571311
572328
  for await (const message of ask({
571312
572329
  commands: uniqBy_default([...currentCommands, ...appState.mcp.commands], "name"),
@@ -571327,8 +572344,8 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initial
571327
572344
  jsonSchema: getInitJsonSchema() ?? options.jsonSchema,
571328
572345
  mutableMessages,
571329
572346
  getReadFileCache: () => pendingSeeds.size === 0 ? readFileState : mergeFileStateCaches(readFileState, pendingSeeds),
571330
- setReadFileCache: (cache5) => {
571331
- readFileState = cache5;
572347
+ setReadFileCache: (cache6) => {
572348
+ readFileState = cache6;
571332
572349
  for (const [path27, seed] of pendingSeeds.entries()) {
571333
572350
  const existing = readFileState.get(path27);
571334
572351
  if (!existing || seed.timestamp > existing.timestamp) {
@@ -571987,8 +573004,8 @@ ${m2.text}
571987
573004
  const controller = new AbortController;
571988
573005
  activeOAuthFlows.set(serverName, controller);
571989
573006
  let resolveAuthUrl;
571990
- const authUrlPromise = new Promise((resolve50) => {
571991
- resolveAuthUrl = resolve50;
573007
+ const authUrlPromise = new Promise((resolve49) => {
573008
+ resolveAuthUrl = resolve49;
571992
573009
  });
571993
573010
  const oauthPromise = performMCPOAuthFlow(serverName, config5, (url3) => resolveAuthUrl(url3), controller.signal, {
571994
573011
  skipBrowserOpen: true,
@@ -572101,8 +573118,8 @@ ${m2.text}
572101
573118
  });
572102
573119
  const service = new OAuthService;
572103
573120
  let urlResolver;
572104
- const urlPromise = new Promise((resolve50) => {
572105
- urlResolver = resolve50;
573121
+ const urlPromise = new Promise((resolve49) => {
573122
+ urlResolver = resolve49;
572106
573123
  });
572107
573124
  const flow = service.startOAuthFlow(async (manualUrl, automaticUrl) => {
572108
573125
  urlResolver({ manualUrl, automaticUrl });
@@ -572490,8 +573507,8 @@ function createCanUseToolWithPermissionPrompt(permissionPromptTool) {
572490
573507
  }
572491
573508
  };
572492
573509
  }
572493
- const abortPromise = new Promise((resolve50) => {
572494
- combinedSignal.addEventListener("abort", () => resolve50("aborted"), {
573510
+ const abortPromise = new Promise((resolve49) => {
573511
+ combinedSignal.addEventListener("abort", () => resolve49("aborted"), {
572495
573512
  once: true
572496
573513
  });
572497
573514
  });
@@ -572629,10 +573646,10 @@ async function handleInitializeRequest(request, requestId, initialized5, output,
572629
573646
  description: formatDescriptionWithSource(cmd),
572630
573647
  argumentHint: cmd.argumentHint || ""
572631
573648
  })),
572632
- agents: agents2.map((agent) => ({
572633
- name: agent.agentType,
572634
- description: agent.whenToUse,
572635
- model: agent.model === "inherit" ? undefined : agent.model
573649
+ agents: agents2.map((agent2) => ({
573650
+ name: agent2.agentType,
573651
+ description: agent2.whenToUse,
573652
+ model: agent2.model === "inherit" ? undefined : agent2.model
572636
573653
  })),
572637
573654
  output_style: outputStyle2,
572638
573655
  available_output_styles: Object.keys(availableOutputStyles),
@@ -573290,7 +574307,7 @@ var init_print = __esm(() => {
573290
574307
  init_cwd2();
573291
574308
  init_omit();
573292
574309
  init_reject2();
573293
- init_bridgeStatusUtil();
574310
+ init_bridgeUrlBuilder();
573294
574311
  init_inboundMessages();
573295
574312
  init_inboundAttachments();
573296
574313
  init_permissions2();
@@ -574798,7 +575815,7 @@ __export(exports_plugins, {
574798
575815
  VALID_UPDATE_SCOPES: () => VALID_UPDATE_SCOPES,
574799
575816
  VALID_INSTALLABLE_SCOPES: () => VALID_INSTALLABLE_SCOPES
574800
575817
  });
574801
- import { basename as basename63, dirname as dirname71 } from "path";
575818
+ import { basename as basename62, dirname as dirname71 } from "path";
574802
575819
  function handleMarketplaceError(error49, action2) {
574803
575820
  logError2(error49);
574804
575821
  cliError(`${figures_default.cross} Failed to ${action2}: ${errorMessage(error49)}`);
@@ -574832,7 +575849,7 @@ async function pluginValidateHandler(manifestPath, options) {
574832
575849
  let contentResults = [];
574833
575850
  if (result.fileType === "plugin") {
574834
575851
  const manifestDir = dirname71(result.filePath);
574835
- if (basename63(manifestDir) === ".claude-plugin") {
575852
+ if (basename62(manifestDir) === ".claude-plugin") {
574836
575853
  contentResults = await validatePluginContents(dirname71(manifestDir));
574837
575854
  for (const r of contentResults) {
574838
575855
  console.log(`Validating ${r.fileType}: ${r.filePath}
@@ -575677,7 +576694,7 @@ async function setupTokenHandler(root2) {
575677
576694
  const {
575678
576695
  ConsoleOAuthFlow: ConsoleOAuthFlow2
575679
576696
  } = await Promise.resolve().then(() => (init_ConsoleOAuthFlow(), exports_ConsoleOAuthFlow));
575680
- await new Promise((resolve50) => {
576697
+ await new Promise((resolve49) => {
575681
576698
  root2.render(/* @__PURE__ */ jsx_dev_runtime491.jsxDEV(AppStateProvider, {
575682
576699
  onChangeAppState,
575683
576700
  children: /* @__PURE__ */ jsx_dev_runtime491.jsxDEV(KeybindingSetup, {
@@ -575701,7 +576718,7 @@ async function setupTokenHandler(root2) {
575701
576718
  }, undefined, true, undefined, this),
575702
576719
  /* @__PURE__ */ jsx_dev_runtime491.jsxDEV(ConsoleOAuthFlow2, {
575703
576720
  onDone: () => {
575704
- resolve50();
576721
+ resolve49();
575705
576722
  },
575706
576723
  mode: "setup-token",
575707
576724
  startingMessage: "This will guide you through long-lived (1-year) auth token setup for your Claude account. Claude subscription required."
@@ -575737,7 +576754,7 @@ function DoctorWithPlugins(t0) {
575737
576754
  }
575738
576755
  async function doctorHandler(root2) {
575739
576756
  logEvent("tengu_doctor_command", {});
575740
- await new Promise((resolve50) => {
576757
+ await new Promise((resolve49) => {
575741
576758
  root2.render(/* @__PURE__ */ jsx_dev_runtime491.jsxDEV(AppStateProvider, {
575742
576759
  children: /* @__PURE__ */ jsx_dev_runtime491.jsxDEV(KeybindingSetup, {
575743
576760
  children: /* @__PURE__ */ jsx_dev_runtime491.jsxDEV(MCPConnectionManager, {
@@ -575745,7 +576762,7 @@ async function doctorHandler(root2) {
575745
576762
  isStrictMcpConfig: false,
575746
576763
  children: /* @__PURE__ */ jsx_dev_runtime491.jsxDEV(DoctorWithPlugins, {
575747
576764
  onDone: () => {
575748
- resolve50();
576765
+ resolve49();
575749
576766
  }
575750
576767
  }, undefined, false, undefined, this)
575751
576768
  }, undefined, false, undefined, this)
@@ -575763,14 +576780,14 @@ async function installHandler(target, options) {
575763
576780
  const {
575764
576781
  install: install2
575765
576782
  } = await Promise.resolve().then(() => (init_install(), exports_install));
575766
- await new Promise((resolve50) => {
576783
+ await new Promise((resolve49) => {
575767
576784
  const args = [];
575768
576785
  if (target)
575769
576786
  args.push(target);
575770
576787
  if (options.force)
575771
576788
  args.push("--force");
575772
576789
  install2.call((result) => {
575773
- resolve50();
576790
+ resolve49();
575774
576791
  process.exit(result.includes("failed") ? 1 : 0);
575775
576792
  }, {}, args);
575776
576793
  });
@@ -575799,14 +576816,14 @@ var exports_agents3 = {};
575799
576816
  __export(exports_agents3, {
575800
576817
  agentsHandler: () => agentsHandler
575801
576818
  });
575802
- function formatAgent(agent) {
575803
- const model = resolveAgentModelDisplay(agent);
575804
- const parts = [agent.agentType];
576819
+ function formatAgent(agent2) {
576820
+ const model = resolveAgentModelDisplay(agent2);
576821
+ const parts = [agent2.agentType];
575805
576822
  if (model) {
575806
576823
  parts.push(model);
575807
576824
  }
575808
- if (agent.memory) {
575809
- parts.push(`${agent.memory} memory`);
576825
+ if (agent2.memory) {
576826
+ parts.push(`${agent2.memory} memory`);
575810
576827
  }
575811
576828
  return parts.join(" · ");
575812
576829
  }
@@ -575822,12 +576839,12 @@ async function agentsHandler() {
575822
576839
  if (groupAgents.length === 0)
575823
576840
  continue;
575824
576841
  lines2.push(`${label}:`);
575825
- for (const agent of groupAgents) {
575826
- if (agent.overriddenBy) {
575827
- const winnerSource = getOverrideSourceLabel(agent.overriddenBy);
575828
- lines2.push(` (shadowed by ${winnerSource}) ${formatAgent(agent)}`);
576842
+ for (const agent2 of groupAgents) {
576843
+ if (agent2.overriddenBy) {
576844
+ const winnerSource = getOverrideSourceLabel(agent2.overriddenBy);
576845
+ lines2.push(` (shadowed by ${winnerSource}) ${formatAgent(agent2)}`);
575829
576846
  } else {
575830
- lines2.push(` ${formatAgent(agent)}`);
576847
+ lines2.push(` ${formatAgent(agent2)}`);
575831
576848
  totalActive++;
575832
576849
  }
575833
576850
  }
@@ -576210,7 +577227,7 @@ __export(exports_main, {
576210
577227
  main: () => main
576211
577228
  });
576212
577229
  import { readFileSync as readFileSync19 } from "fs";
576213
- import { resolve as resolve50, join as join163, dirname as dirname72 } from "path";
577230
+ import { resolve as resolve49, join as join163, dirname as dirname72 } from "path";
576214
577231
  import { fileURLToPath as fileURLToPath10 } from "url";
576215
577232
  import { existsSync as existsSync12 } from "fs";
576216
577233
  function logManagedSettings() {
@@ -576287,22 +577304,34 @@ async function logStartupTelemetry() {
576287
577304
  ...getCertEnvVarTelemetry()
576288
577305
  });
576289
577306
  }
576290
- function runMigrations() {
576291
- if (getGlobalConfig().migrationVersion !== CURRENT_MIGRATION_VERSION) {
576292
- migrateAutoUpdatesToSettings();
576293
- migrateBypassPermissionsAcceptedToSettings();
576294
- migrateEnableAllProjectMcpServersToSettings();
576295
- resetProToOpusDefault();
576296
- migrateSonnet1mToSonnet45();
576297
- migrateLegacyOpusToCurrent();
576298
- migrateSonnet45ToSonnet46();
576299
- migrateOpusToOpus1m();
576300
- migrateReplBridgeEnabledToRemoteControlAtStartup();
577307
+ async function runMigrations() {
577308
+ const globalConfig2 = getGlobalConfig();
577309
+ const needsRun = globalConfig2.migrationVersion !== CURRENT_MIGRATION_VERSION || !Array.isArray(globalConfig2.completedMigrations);
577310
+ if (needsRun) {
577311
+ const migrations = [
577312
+ { name: "migrateAutoUpdatesToSettings", migration: migrateAutoUpdatesToSettings },
577313
+ { name: "migrateBypassPermissionsAcceptedToSettings", migration: migrateBypassPermissionsAcceptedToSettings },
577314
+ { name: "migrateEnableAllProjectMcpServersToSettings", migration: migrateEnableAllProjectMcpServersToSettings, dependsOn: ["migrateReplBridgeEnabledToRemoteControlAtStartup"] },
577315
+ { name: "resetProToOpusDefault", migration: resetProToOpusDefault },
577316
+ { name: "migrateSonnet1mToSonnet45", migration: migrateSonnet1mToSonnet45 },
577317
+ { name: "migrateLegacyOpusToCurrent", migration: migrateLegacyOpusToCurrent },
577318
+ { name: "migrateSonnet45ToSonnet46", migration: migrateSonnet45ToSonnet46 },
577319
+ { name: "migrateOpusToOpus1m", migration: migrateOpusToOpus1m },
577320
+ { name: "migrateReplBridgeEnabledToRemoteControlAtStartup", migration: migrateReplBridgeEnabledToRemoteControlAtStartup }
577321
+ ];
576301
577322
  if (false) {}
576302
577323
  if (false) {}
576303
- saveGlobalConfig((prev) => prev.migrationVersion === CURRENT_MIGRATION_VERSION ? prev : {
576304
- ...prev,
576305
- migrationVersion: CURRENT_MIGRATION_VERSION
577324
+ const result = await runMigrationsSafe(migrations, globalConfig2.completedMigrations ?? []);
577325
+ saveGlobalConfig((prev) => {
577326
+ const completed = new Set(prev.completedMigrations ?? []);
577327
+ for (const name of result.newlyCompleted) {
577328
+ completed.add(name);
577329
+ }
577330
+ return {
577331
+ ...prev,
577332
+ migrationVersion: CURRENT_MIGRATION_VERSION,
577333
+ completedMigrations: [...completed]
577334
+ };
576306
577335
  });
576307
577336
  }
576308
577337
  migrateChangelogFromConfig().catch(() => {});
@@ -576554,7 +577583,7 @@ async function run() {
576554
577583
  setInlinePlugins(pluginDir);
576555
577584
  clearPluginCache("preAction: --plugin-dir inline plugins");
576556
577585
  }
576557
- runMigrations();
577586
+ await runMigrations();
576558
577587
  profileCheckpoint("preAction_after_migrations");
576559
577588
  loadRemoteManagedSettings();
576560
577589
  loadPolicyLimits();
@@ -576774,12 +577803,12 @@ ${getTmuxInstallInstructions2()}
576774
577803
  process.exit(1);
576775
577804
  }
576776
577805
  try {
576777
- const filePath = resolve50(options.systemPromptFile);
577806
+ const filePath = resolve49(options.systemPromptFile);
576778
577807
  systemPrompt = readFileSync19(filePath, "utf8");
576779
577808
  } catch (error49) {
576780
577809
  const code = getErrnoCode(error49);
576781
577810
  if (code === "ENOENT") {
576782
- process.stderr.write(source_default.red(`Error: System prompt file not found: ${resolve50(options.systemPromptFile)}
577811
+ process.stderr.write(source_default.red(`Error: System prompt file not found: ${resolve49(options.systemPromptFile)}
576783
577812
  `));
576784
577813
  process.exit(1);
576785
577814
  }
@@ -576796,12 +577825,12 @@ ${getTmuxInstallInstructions2()}
576796
577825
  process.exit(1);
576797
577826
  }
576798
577827
  try {
576799
- const filePath = resolve50(options.appendSystemPromptFile);
577828
+ const filePath = resolve49(options.appendSystemPromptFile);
576800
577829
  appendSystemPrompt = readFileSync19(filePath, "utf8");
576801
577830
  } catch (error49) {
576802
577831
  const code = getErrnoCode(error49);
576803
577832
  if (code === "ENOENT") {
576804
- process.stderr.write(source_default.red(`Error: Append system prompt file not found: ${resolve50(options.appendSystemPromptFile)}
577833
+ process.stderr.write(source_default.red(`Error: Append system prompt file not found: ${resolve49(options.appendSystemPromptFile)}
576805
577834
  `));
576806
577835
  process.exit(1);
576807
577836
  }
@@ -576847,7 +577876,7 @@ ${addendum}` : addendum;
576847
577876
  errors6 = result.errors;
576848
577877
  }
576849
577878
  } else {
576850
- const configPath = resolve50(configItem);
577879
+ const configPath = resolve49(configItem);
576851
577880
  const result = parseMcpConfigFromFilePath({
576852
577881
  filePath: configPath,
576853
577882
  expandVars: true,
@@ -577137,7 +578166,7 @@ ${hint}` : hint;
577137
578166
  const agentSetting = agentCli ?? getInitialSettings().agent;
577138
578167
  let mainThreadAgentDefinition;
577139
578168
  if (agentSetting) {
577140
- mainThreadAgentDefinition = agentDefinitions.activeAgents.find((agent) => agent.agentType === agentSetting);
578169
+ mainThreadAgentDefinition = agentDefinitions.activeAgents.find((agent2) => agent2.agentType === agentSetting);
577141
578170
  if (!mainThreadAgentDefinition) {
577142
578171
  logForDebugging(`Warning: agent "${agentSetting}" not found. Available agents: ${agentDefinitions.activeAgents.map((a2) => a2.agentType).join(", ")}. Using default behavior.`);
577143
578172
  }
@@ -577481,7 +578510,7 @@ ${customInstructions}` : customInstructions;
577481
578510
  `);
577482
578511
  process.exit(1);
577483
578512
  }
577484
- const commandsHeadless = disableSlashCommands ? [] : commands.filter((command8) => command8.type === "prompt" && !command8.disableNonInteractive || command8.type === "local" && command8.supportsNonInteractive);
578513
+ const commandsHeadless = disableSlashCommands ? [] : commands.filter((command9) => command9.type === "prompt" && !command9.disableNonInteractive || command9.type === "local" && command9.supportsNonInteractive);
577485
578514
  const defaultState = getDefaultAppState();
577486
578515
  const headlessInitialState = {
577487
578516
  ...defaultState,
@@ -577601,8 +578630,8 @@ ${customInstructions}` : customInstructions;
577601
578630
  return connectMcpBatch(dedupedClaudeAi, "claudeai");
577602
578631
  });
577603
578632
  let claudeaiTimer;
577604
- const claudeaiTimedOut = await Promise.race([claudeaiConnect.then(() => false), new Promise((resolve51) => {
577605
- claudeaiTimer = setTimeout((r) => r(true), CLAUDE_AI_MCP_TIMEOUT_MS, resolve51);
578633
+ const claudeaiTimedOut = await Promise.race([claudeaiConnect.then(() => false), new Promise((resolve50) => {
578634
+ claudeaiTimer = setTimeout((r) => r(true), CLAUDE_AI_MCP_TIMEOUT_MS, resolve50);
577606
578635
  })]);
577607
578636
  if (claudeaiTimer)
577608
578637
  clearTimeout(claudeaiTimer);
@@ -578530,7 +579559,7 @@ function extractTeammateOptions(options) {
578530
579559
  agentType: typeof opts.agentType === "string" ? opts.agentType : undefined
578531
579560
  };
578532
579561
  }
578533
- var getTeammateUtils = () => (init_teammate(), __toCommonJS(exports_teammate)), getTeammatePromptAddendum = () => __toCommonJS(exports_teammatePromptAddendum), getTeammateModeSnapshot = () => (init_teammateModeSnapshot(), __toCommonJS(exports_teammateModeSnapshot)), coordinatorModeModule = null, CURRENT_MIGRATION_VERSION = 11;
579562
+ var getTeammateUtils = () => (init_teammate(), __toCommonJS(exports_teammate)), getTeammatePromptAddendum = () => __toCommonJS(exports_teammatePromptAddendum), getTeammateModeSnapshot = () => (init_teammateModeSnapshot(), __toCommonJS(exports_teammateModeSnapshot)), coordinatorModeModule = null, CURRENT_MIGRATION_VERSION = 12;
578534
579563
  var init_main3 = __esm(() => {
578535
579564
  init_startupProfiler();
578536
579565
  init_rawRead();
@@ -578655,6 +579684,7 @@ var init_main3 = __esm(() => {
578655
579684
  init_migrateSonnet45ToSonnet46();
578656
579685
  init_resetAutoModeOptInForDefaultOffer();
578657
579686
  init_resetProToOpusDefault();
579687
+ init_migrationRunner();
578658
579688
  init_RemoteSessionManager();
578659
579689
  init_createDirectConnectSession();
578660
579690
  init_manager();