@funnycode/myclaude 0.1.200 → 0.1.267

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 +1683 -659
  3. package/dist/myclaude.mjs +1683 -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.267",
8
+ BUILD_TIME: "2026-08-17T03:07:47.420Z",
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.267",
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,34 +280223,143 @@ 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++;
280294
+ }
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++;
280241
280357
  }
280358
+ } else if (char === "]" || char === "[" || char === "," || char === ":" || `
280359
+ \r`.includes(char)) {
280360
+ i3++;
280361
+ } else {
280362
+ i3++;
280242
280363
  }
280243
280364
  }
280244
280365
  return warnings;
@@ -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);
407120
- } catch {
407121
- isWorkspaceDirEmpty = true;
407122
- }
407123
- const claudeMdPath = join105(cwd2, "CLAUDE.md");
407124
- try {
407125
- cachedClaudeMdMtime = hasClaudeMd ? getFileModificationTime(claudeMdPath) : -1;
407247
+ isWorkspaceDirEmpty = isDirEmptySync(cwd2);
407126
407248
  } catch {
407127
- cachedClaudeMdMtime = -1;
407249
+ isWorkspaceDirEmpty = false;
407128
407250
  }
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,363 @@ 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
+ console.log(`Executing command: ${command6}`);
468805
+ throw new Error("executeCommand is not implemented yet. Please connect it to the bridge API.");
468806
+ }
468807
+ async function executeFileOperation(file2, context2) {
468808
+ console.log(`Executing file operation: ${file2}`);
468809
+ throw new Error("executeFileOperation is not implemented yet. Please connect it to the bridge API.");
468810
+ }
468811
+ async function shouldContinueOnError(error49, step) {
468812
+ const errorMessages2 = [
468813
+ "EACCES",
468814
+ "ENOENT",
468815
+ "ETIMEDOUT"
468816
+ ];
468817
+ return errorMessages2.some((msg) => error49.message.includes(msg));
468818
+ }
468819
+
468820
+ // src/commands/flow.ts
468821
+ function getPromptContent3(args) {
468822
+ const { flow: flowAttribution } = getAttributionTexts();
468823
+ const flows = getAllFlows();
468824
+ if (!args.trim()) {
468825
+ return `## Available Flows
468826
+
468827
+ ${flows.map((flow2) => `- **${flow2.name}**: ${flow2.description}`).join(`
468828
+ `)}
468829
+
468830
+ Please specify a flow name to execute, e.g., "/flow docker-setup"`;
468831
+ }
468832
+ const flow = getFlowByName(args.trim());
468833
+ if (!flow) {
468834
+ return `## Flow Not Found
468835
+
468836
+ Could not find a flow named "${args.trim()}".
468837
+
468838
+ Available flows:
468839
+ ${flows.map((f) => `- ${f.name}: ${f.description}`).join(`
468840
+ `)}`;
468841
+ }
468842
+ return `## Flow: ${flow.name}
468843
+
468844
+ **Description**: ${flow.description}
468845
+
468846
+ ## Execution Plan
468847
+
468848
+ ${flow.steps.map((step, index) => `${index + 1}. **${step.id}**: ${step.description}${step.reasoning ? ` - ${step.reasoning}` : ""}`).join(`
468849
+ `)}
468850
+
468851
+ ## Your Task
468852
+
468853
+ Execute the flow step by step:
468854
+
468855
+ 1. Start with step 1 and work through all steps sequentially
468856
+ 2. For each step, follow the description and reasoning provided
468857
+ 3. Use the available tools (Edit, Run commands, etc.) to complete each step
468858
+ 4. Report progress after each step
468859
+ 5. If a step fails, analyze the error and determine if it's recoverable
468860
+ 6. Continue to the next step unless the error is critical
468861
+
468862
+ ## Important Rules
468863
+
468864
+ - Execute steps in order
468865
+ - Report progress after each step
468866
+ - Handle errors gracefully
468867
+ - Verify each step completes successfully before moving to the next
468868
+ ${flowAttribution ? `
468869
+
468870
+ ${flowAttribution}` : ""}`;
468871
+ }
468872
+ var ALLOWED_TOOLS3, command6, flow_default;
468873
+ var init_flow = __esm(() => {
468874
+ init_attribution();
468875
+ init_definitions();
468876
+ ALLOWED_TOOLS3 = [
468877
+ "Bash(*)",
468878
+ "Edit(*)",
468879
+ "Read(*)",
468880
+ "List(*)",
468881
+ "Create(*)"
468882
+ ];
468883
+ command6 = {
468884
+ type: "prompt",
468885
+ name: "flow",
468886
+ description: "Execute pre-built workflows (flows)",
468887
+ allowedTools: ALLOWED_TOOLS3,
468888
+ contentLength: 0,
468889
+ progressMessage: "executing flow",
468890
+ source: "builtin",
468891
+ async getPromptForCommand(args, context2) {
468892
+ return getPromptContent3(args);
468893
+ },
468894
+ async executeFlow(args, context2) {
468895
+ const flow = getFlowByName(args.trim());
468896
+ if (!flow) {
468897
+ throw new Error(`Flow not found: ${args}`);
468898
+ }
468899
+ const state = await executeFlow(flow, context2, async (step, state2) => {
468900
+ console.log(`
468901
+ ▶️ Starting step ${state2.currentStepIndex + 1}/${state2.totalSteps}: ${step.description}`);
468902
+ }, async (step, state2) => {
468903
+ console.log(`✅ Step ${state2.currentStepIndex}/${state2.totalSteps} completed: ${step.description}`);
468904
+ }, async (step, state2, error49) => {
468905
+ console.error(`❌ Step ${state2.currentStepIndex}/${state2.totalSteps} failed: ${step.description}`);
468906
+ console.error(`Error: ${error49.message}`);
468907
+ }, async (state2) => {
468908
+ console.log(`
468909
+ \uD83C\uDF89 Flow execution complete!`);
468910
+ console.log(`Completed: ${state2.completedSteps.length}/${state2.totalSteps}`);
468911
+ console.log(`Failed: ${state2.failedSteps.length}/${state2.totalSteps}`);
468912
+ });
468913
+ return state;
468914
+ }
468915
+ };
468916
+ flow_default = command6;
468917
+ });
468918
+
468408
468919
  // src/commands/thinkback/thinkback.tsx
468409
468920
  var exports_thinkback = {};
468410
468921
  __export(exports_thinkback, {
@@ -483906,11 +484417,11 @@ var init_sandbox_toggle = __esm(() => {
483906
484417
  });
483907
484418
 
483908
484419
  // src/commands/sandbox-toggle/index.ts
483909
- var command6, sandbox_toggle_default;
484420
+ var command7, sandbox_toggle_default;
483910
484421
  var init_sandbox_toggle2 = __esm(() => {
483911
484422
  init_figures();
483912
484423
  init_sandbox_adapter();
483913
- command6 = {
484424
+ command7 = {
483914
484425
  name: "sandbox",
483915
484426
  get description() {
483916
484427
  const currentlyEnabled = SandboxManager2.isSandboxingEnabled();
@@ -483942,7 +484453,7 @@ var init_sandbox_toggle2 = __esm(() => {
483942
484453
  type: "local-jsx",
483943
484454
  load: () => Promise.resolve().then(() => (init_sandbox_toggle(), exports_sandbox_toggle))
483944
484455
  };
483945
- sandbox_toggle_default = command6;
484456
+ sandbox_toggle_default = command7;
483946
484457
  });
483947
484458
 
483948
484459
  // src/utils/claudeInChrome/setupPortable.ts
@@ -484155,18 +484666,18 @@ function registerWindowsNativeHosts(manifestPath) {
484155
484666
  });
484156
484667
  }
484157
484668
  }
484158
- async function createWrapperScript(command7) {
484669
+ async function createWrapperScript(command8) {
484159
484670
  const platform5 = getPlatform();
484160
484671
  const chromeDir = join131(getClaudeConfigHomeDir(), "chrome");
484161
484672
  const wrapperPath = platform5 === "windows" ? join131(chromeDir, "chrome-native-host.bat") : join131(chromeDir, "chrome-native-host");
484162
484673
  const scriptContent = platform5 === "windows" ? `@echo off
484163
484674
  REM Chrome native host wrapper script
484164
484675
  REM Generated by Claude Code - do not edit manually
484165
- ${command7}
484676
+ ${command8}
484166
484677
  ` : `#!/bin/sh
484167
484678
  # Chrome native host wrapper script
484168
484679
  # Generated by Claude Code - do not edit manually
484169
- exec ${command7}
484680
+ exec ${command8}
484170
484681
  `;
484171
484682
  const existingContent = await readFile46(wrapperPath, "utf-8").catch(() => null);
484172
484683
  if (existingContent === scriptContent) {
@@ -484621,10 +485132,10 @@ var init_chrome = __esm(() => {
484621
485132
  });
484622
485133
 
484623
485134
  // src/commands/chrome/index.ts
484624
- var command7, chrome_default;
485135
+ var command8, chrome_default;
484625
485136
  var init_chrome2 = __esm(() => {
484626
485137
  init_state();
484627
- command7 = {
485138
+ command8 = {
484628
485139
  name: "chrome",
484629
485140
  description: "Claude in Chrome (Beta) settings",
484630
485141
  availability: ["claude-ai"],
@@ -484632,7 +485143,7 @@ var init_chrome2 = __esm(() => {
484632
485143
  type: "local-jsx",
484633
485144
  load: () => Promise.resolve().then(() => (init_chrome(), exports_chrome))
484634
485145
  };
484635
- chrome_default = command7;
485146
+ chrome_default = command8;
484636
485147
  });
484637
485148
 
484638
485149
  // src/commands/stickers/stickers.ts
@@ -485116,6 +485627,206 @@ var init_frontend_tdd = __esm(() => {
485116
485627
  frontend_tdd_default = frontendTdd;
485117
485628
  });
485118
485629
 
485630
+ // src/commands/agentic-tdd.ts
485631
+ function getPrompt11(args) {
485632
+ const featureDesc = args.trim() || "(no description provided)";
485633
+ return `You are practicing **Agentic TDD (Test-Driven Development) with automated test-fix-rerun loop**.
485634
+
485635
+ ## User's Request
485636
+
485637
+ ${featureDesc}
485638
+
485639
+ ## Agentic TDD Workflow
485640
+
485641
+ You are in full autonomous mode. Follow the **Red-Green-Refactor** cycle strictly, and execute tests automatically after each change.
485642
+
485643
+ ### Phase 1: Baseline
485644
+ 1. First, run the existing test suite to establish a baseline: \`bun test\`
485645
+ 2. Note which tests pass and fail before you start
485646
+
485647
+ ### Phase 2: \uD83D\uDD34 Red — Write the Failing Test First
485648
+ 1. Understand the requirement and identify the expected behavior
485649
+ 2. Write a test that captures the requirement — this test MUST fail initially
485650
+ 3. The test should cover:
485651
+ - Normal expected behavior (happy path)
485652
+ - Edge cases (empty state, error state, boundary values)
485653
+ - User interactions (click, input, submit, navigation)
485654
+ - Accessibility (ARIA labels, keyboard navigation, focus management)
485655
+ 4. Use the project's existing test framework and conventions (Bun test, Vitest, Jest, etc.)
485656
+ 5. Run the test to verify it fails: \`bun test\`
485657
+ 6. If the test passes unexpectedly, it's a buggy test — fix the test
485658
+
485659
+ ### Phase 3: \uD83D\uDFE2 Green — Minimum Code to Pass
485660
+ 1. Write ONLY the code needed to make the failing test pass
485661
+ 2. No speculative features, no future-proofing, no "while I'm here" additions
485662
+ 3. After writing code, run the tests: \`bun test\`
485663
+ 4. If tests fail, analyze the error output and iterate:
485664
+ - Read the error message and stack trace
485665
+ - Identify what's broken
485666
+ - Fix the implementation
485667
+ - Re-run tests
485668
+ - Repeat until all tests pass (up to 5 iterations)
485669
+
485670
+ ### Phase 4: \uD83D\uDD35 Refactor — Clean Up Safely
485671
+ 1. Once the test is green, refactor for clarity and maintainability
485672
+ 2. Run tests after each refactor step: \`bun test\`
485673
+ 3. The test MUST stay green after every refactor step
485674
+ 4. If the test turns red during refactor, the refactor broke something — revert
485675
+
485676
+ ### Phase 5: Final Verification
485677
+ 1. Run the full test suite one final time: \`bun test\`
485678
+ 2. Report the results to the user
485679
+
485680
+ ## Automated Test-Fix-Rerun Loop Rules
485681
+
485682
+ - After EVERY code change, run \`bun test\` immediately
485683
+ - If tests fail, parse the error output and fix the code
485684
+ - Do NOT modify tests to make them pass — fix the implementation instead
485685
+ - Maximum 5 fix iterations per Red or Green phase
485686
+ - If after 5 iterations the tests still fail, report the failure to the user with the error details
485687
+
485688
+ ## Testing Guidelines
485689
+
485690
+ - **Component tests**: Test behavior, not implementation details
485691
+ - **User interactions**: Use \`@testing-library/user-event\` over \`fireEvent\`
485692
+ - **Accessibility**: Prefer queries by role (\`getByRole\`) over test IDs
485693
+ - **Async**: Use \`waitFor\` or \`findBy*\` queries for async operations
485694
+ - **Mocking**: Mock external APIs at the network level (MSW) or module level (vi.mock)
485695
+ - **Style**: Test visual outcomes (is the element visible/disabled?), not CSS class names
485696
+ - **Snapshots**: Use sparingly — prefer assertion-based tests
485697
+
485698
+ ## Project Context
485699
+
485700
+ - Test framework: Bun test (\`bun test\`)
485701
+ - Check \`package.json\` for test framework and scripts
485702
+ - Check existing test files in \`__tests__/\`, \`*.test.tsx\`, \`*.spec.tsx\` for conventions
485703
+
485704
+ ## Important Rules
485705
+
485706
+ - NEVER skip the Red phase — a passing test without implementation is a buggy test
485707
+ - NEVER modify a test to make it pass — fix the implementation instead
485708
+ - Run the test suite after each change to ensure nothing is broken
485709
+ - If multiple test files exist, run only the relevant test file during development for speed, but run the full suite for final verification
485710
+ - Report each phase completion to the user`;
485711
+ }
485712
+ var agenticTdd, agentic_tdd_default;
485713
+ var init_agentic_tdd = __esm(() => {
485714
+ agenticTdd = {
485715
+ type: "prompt",
485716
+ name: "agentic-tdd",
485717
+ description: "Agentic TDD with automated test-fix-rerun loop — write tests, run, fix, repeat autonomously",
485718
+ argumentHint: "<feature description or bug fix description>",
485719
+ progressMessage: "running agentic TDD loop",
485720
+ contentLength: 0,
485721
+ source: "builtin",
485722
+ async getPromptForCommand(args) {
485723
+ return [{ type: "text", text: getPrompt11(args) }];
485724
+ }
485725
+ };
485726
+ agentic_tdd_default = agenticTdd;
485727
+ });
485728
+
485729
+ // src/commands/agent.ts
485730
+ function getPlanPrompt(args) {
485731
+ const taskDesc = args.trim() || "(no description provided)";
485732
+ 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.
485733
+
485734
+ ## User's Request
485735
+
485736
+ ${taskDesc}
485737
+
485738
+ ## Your Task
485739
+
485740
+ 1. **Analyze the request** and understand what needs to be done
485741
+ 2. **Create a plan** with 3-7 concrete steps. Each step should be:
485742
+ - Specific and actionable
485743
+ - Can be executed using available tools (edit files, run commands, etc.)
485744
+ - Logical order (start with setup, then core changes, then verification)
485745
+ 3. **For each step**, provide:
485746
+ - A clear description of what to do
485747
+ - The specific command or file changes needed
485748
+ - Brief reasoning for why this step is important
485749
+ - How to verify the step was successful (run tests, check output, etc.)
485750
+
485751
+ ## Planning Guidelines
485752
+
485753
+ - Break down complex tasks into smaller, manageable steps
485754
+ - Include setup steps (install dependencies, create files, etc.)
485755
+ - Include verification steps (run tests, build, check output)
485756
+ - Consider edge cases and potential issues
485757
+ - Keep the plan realistic and achievable
485758
+
485759
+ ## Example Plan Structure
485760
+
485761
+ 1. **Setup**: Install dependencies, set up environment
485762
+ 2. **Create files**: Generate necessary files based on requirements
485763
+ 3. **Implement core logic**: Write the main functionality
485764
+ 4. **Add tests**: Write tests to verify the implementation
485765
+ 5. **Run verification**: Execute tests and build to ensure everything works
485766
+ 6. **Cleanup**: Remove temporary files or unnecessary changes
485767
+
485768
+ ## Important Rules
485769
+
485770
+ - Always provide a clear, numbered plan
485771
+ - Each step should be independent and executable
485772
+ - Include verification steps to ensure the task is complete
485773
+ - Be realistic about what can be done in a single step
485774
+ - If the request is too vague, ask for clarification before planning
485775
+
485776
+ After creating the plan, ask the user to confirm it before proceeding to execution.`;
485777
+ }
485778
+ var agent, agent_default;
485779
+ var init_agent2 = __esm(() => {
485780
+ agent = {
485781
+ type: "prompt",
485782
+ name: "agent",
485783
+ description: "Autonomous agent mode - plan and execute tasks step-by-step",
485784
+ argumentHint: "<task description>",
485785
+ progressMessage: "agent mode executing",
485786
+ contentLength: 0,
485787
+ source: "builtin",
485788
+ async getPromptForCommand(args, context2) {
485789
+ const taskDesc = args.trim() || "(no description provided)";
485790
+ return [
485791
+ { type: "text", text: getPlanPrompt(taskDesc) },
485792
+ {
485793
+ type: "text",
485794
+ text: `
485795
+ ## Execution Instructions
485796
+
485797
+ After you receive this plan, you will execute each step one by one. For each step:
485798
+ 1. Read the step description carefully
485799
+ 2. Use the available tools to execute it
485800
+ 3. Verify the step completed successfully (run tests, check output, etc.)
485801
+ 4. Report the results
485802
+ 5. Only move to the next step after completing the current one
485803
+
485804
+ ## Self-Correction
485805
+
485806
+ If a step fails:
485807
+ 1. Analyze the error message
485808
+ 2. Determine the root cause
485809
+ 3. Apply a fix (revert changes, re-edit, or try alternative approach)
485810
+ 4. Re-verify the step
485811
+ 5. If it still fails after 3 attempts, report the failure and move on
485812
+
485813
+ ## User Approval
485814
+
485815
+ Before starting execution, present the plan to the user and ask for confirmation:
485816
+ - "Here is my plan for completing this task:"
485817
+ - List the steps
485818
+ - "Shall I proceed with this plan?"
485819
+
485820
+ Wait for user confirmation before executing the first step.
485821
+
485822
+ **Important**: You are in autonomous mode. Execute the plan step-by-step. Report progress after each step and a summary at the end.`
485823
+ }
485824
+ ];
485825
+ }
485826
+ };
485827
+ agent_default = agent;
485828
+ });
485829
+
485119
485830
  // src/commands/remember.ts
485120
485831
  import { appendFile as appendFile5, mkdir as mkdir36 } from "fs/promises";
485121
485832
  import { join as join133 } from "path";
@@ -485176,7 +485887,7 @@ var init_remember = __esm(() => {
485176
485887
  // src/skills/bundledSkills.ts
485177
485888
  import { constants as fsConstants5 } from "fs";
485178
485889
  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";
485890
+ import { dirname as dirname59, isAbsolute as isAbsolute28, join as join134, normalize as normalize13, sep as pathSep2 } from "path";
485180
485891
  function registerBundledSkill(definition) {
485181
485892
  const { files: files3 } = definition;
485182
485893
  let skillRoot;
@@ -485194,7 +485905,7 @@ function registerBundledSkill(definition) {
485194
485905
  return prependBaseDir(blocks, extractedDir);
485195
485906
  };
485196
485907
  }
485197
- const command8 = {
485908
+ const command9 = {
485198
485909
  type: "prompt",
485199
485910
  name: definition.name,
485200
485911
  description: definition.description,
@@ -485218,7 +485929,7 @@ function registerBundledSkill(definition) {
485218
485929
  progressMessage: "running",
485219
485930
  getPromptForCommand
485220
485931
  };
485221
- bundledSkills.push(command8);
485932
+ bundledSkills.push(command9);
485222
485933
  }
485223
485934
  function getBundledSkills() {
485224
485935
  return [...bundledSkills];
@@ -485263,7 +485974,7 @@ async function safeWriteFile(p, content) {
485263
485974
  }
485264
485975
  function resolveSkillFilePath(baseDir, relPath) {
485265
485976
  const normalized = normalize13(relPath);
485266
- if (isAbsolute28(normalized) || normalized.split(pathSep3).includes("..") || normalized.split("/").includes("..")) {
485977
+ if (isAbsolute28(normalized) || normalized.split(pathSep2).includes("..") || normalized.split("/").includes("..")) {
485267
485978
  throw new Error(`bundled skill file path escapes skill dir: ${relPath}`);
485268
485979
  }
485269
485980
  return join134(baseDir, normalized);
@@ -487764,8 +488475,8 @@ async function withStatsCacheLock(fn) {
487764
488475
  await statsCacheLockPromise;
487765
488476
  }
487766
488477
  let releaseLock2;
487767
- statsCacheLockPromise = new Promise((resolve48) => {
487768
- releaseLock2 = resolve48;
488478
+ statsCacheLockPromise = new Promise((resolve47) => {
488479
+ releaseLock2 = resolve47;
487769
488480
  });
487770
488481
  try {
487771
488482
  return await fn();
@@ -487843,7 +488554,7 @@ async function loadStatsCache() {
487843
488554
  return getEmptyCache();
487844
488555
  }
487845
488556
  }
487846
- async function saveStatsCache(cache4) {
488557
+ async function saveStatsCache(cache5) {
487847
488558
  const fs14 = getFsImplementation();
487848
488559
  const cachePath = getStatsCachePath();
487849
488560
  const tempPath = `${cachePath}.${randomBytes18(8).toString("hex")}.tmp`;
@@ -487852,7 +488563,7 @@ async function saveStatsCache(cache4) {
487852
488563
  try {
487853
488564
  await fs14.mkdir(configDir);
487854
488565
  } catch {}
487855
- const content = jsonStringify(cache4, null, 2);
488566
+ const content = jsonStringify(cache5, null, 2);
487856
488567
  const handle = await open15(tempPath, "w", 384);
487857
488568
  try {
487858
488569
  await handle.writeFile(content, { encoding: "utf-8" });
@@ -487861,7 +488572,7 @@ async function saveStatsCache(cache4) {
487861
488572
  await handle.close();
487862
488573
  }
487863
488574
  await fs14.rename(tempPath, cachePath);
487864
- logForDebugging(`Stats cache saved successfully (lastComputedDate: ${cache4.lastComputedDate})`);
488575
+ logForDebugging(`Stats cache saved successfully (lastComputedDate: ${cache5.lastComputedDate})`);
487865
488576
  } catch (error49) {
487866
488577
  logError2(error49);
487867
488578
  try {
@@ -488519,7 +489230,7 @@ var init_screenshotClipboard = __esm(() => {
488519
489230
 
488520
489231
  // src/utils/stats.ts
488521
489232
  import { open as open16 } from "fs/promises";
488522
- import { basename as basename44, join as join139, sep as sep36 } from "path";
489233
+ import { basename as basename43, join as join139, sep as sep36 } from "path";
488523
489234
  async function processSessionFiles(sessionFiles, options = {}) {
488524
489235
  const { fromDate, toDate } = options;
488525
489236
  const fs14 = getFsImplementation();
@@ -488577,7 +489288,7 @@ async function processSessionFiles(sessionFiles, options = {}) {
488577
489288
  logForDebugging(`Failed to read session file ${sessionFile}: ${errorMessage(error49)}`);
488578
489289
  continue;
488579
489290
  }
488580
- const sessionId = basename44(sessionFile, ".jsonl");
489291
+ const sessionId = basename43(sessionFile, ".jsonl");
488581
489292
  const messages = [];
488582
489293
  for (const entry of entries) {
488583
489294
  if (isTranscriptMessage(entry)) {
@@ -488720,9 +489431,9 @@ async function getAllSessionFiles() {
488720
489431
  }));
488721
489432
  return projectResults.flat();
488722
489433
  }
488723
- function cacheToStats(cache4, todayStats) {
489434
+ function cacheToStats(cache5, todayStats) {
488724
489435
  const dailyActivityMap = new Map;
488725
- for (const day of cache4.dailyActivity) {
489436
+ for (const day of cache5.dailyActivity) {
488726
489437
  dailyActivityMap.set(day.date, { ...day });
488727
489438
  }
488728
489439
  if (todayStats) {
@@ -488738,7 +489449,7 @@ function cacheToStats(cache4, todayStats) {
488738
489449
  }
488739
489450
  }
488740
489451
  const dailyModelTokensMap = new Map;
488741
- for (const day of cache4.dailyModelTokens) {
489452
+ for (const day of cache5.dailyModelTokens) {
488742
489453
  dailyModelTokensMap.set(day.date, { ...day.tokensByModel });
488743
489454
  }
488744
489455
  if (todayStats) {
@@ -488753,7 +489464,7 @@ function cacheToStats(cache4, todayStats) {
488753
489464
  }
488754
489465
  }
488755
489466
  }
488756
- const modelUsage = { ...cache4.modelUsage };
489467
+ const modelUsage = { ...cache5.modelUsage };
488757
489468
  if (todayStats) {
488758
489469
  for (const [model, usage] of Object.entries(todayStats.modelUsage)) {
488759
489470
  if (modelUsage[model]) {
@@ -488773,7 +489484,7 @@ function cacheToStats(cache4, todayStats) {
488773
489484
  }
488774
489485
  }
488775
489486
  const hourCountsMap = new Map;
488776
- for (const [hour, count4] of Object.entries(cache4.hourCounts)) {
489487
+ for (const [hour, count4] of Object.entries(cache5.hourCounts)) {
488777
489488
  hourCountsMap.set(parseInt(hour, 10), count4);
488778
489489
  }
488779
489490
  if (todayStats) {
@@ -488785,9 +489496,9 @@ function cacheToStats(cache4, todayStats) {
488785
489496
  const dailyActivityArray = Array.from(dailyActivityMap.values()).sort((a2, b3) => a2.date.localeCompare(b3.date));
488786
489497
  const streaks = calculateStreaks(dailyActivityArray);
488787
489498
  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;
489499
+ const totalSessions = cache5.totalSessions + (todayStats?.sessionStats.length || 0);
489500
+ const totalMessages = cache5.totalMessages + (todayStats?.totalMessages || 0);
489501
+ let longestSession = cache5.longestSession;
488791
489502
  if (todayStats) {
488792
489503
  for (const session2 of todayStats.sessionStats) {
488793
489504
  if (!longestSession || session2.duration > longestSession.duration) {
@@ -488795,7 +489506,7 @@ function cacheToStats(cache4, todayStats) {
488795
489506
  }
488796
489507
  }
488797
489508
  }
488798
- let firstSessionDate = cache4.firstSessionDate;
489509
+ let firstSessionDate = cache5.firstSessionDate;
488799
489510
  let lastSessionDate = null;
488800
489511
  if (todayStats) {
488801
489512
  for (const session2 of todayStats.sessionStats) {
@@ -488813,7 +489524,7 @@ function cacheToStats(cache4, todayStats) {
488813
489524
  const peakActivityDay = dailyActivityArray.length > 0 ? dailyActivityArray.reduce((max2, d) => d.messageCount > max2.messageCount ? d : max2).date : null;
488814
489525
  const peakActivityHour = hourCountsMap.size > 0 ? Array.from(hourCountsMap.entries()).reduce((max2, [hour, count4]) => count4 > max2[1] ? [hour, count4] : max2)[0] : null;
488815
489526
  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);
489527
+ const totalSpeculationTimeSavedMs = cache5.totalSpeculationTimeSavedMs + (todayStats?.totalSpeculationTimeSavedMs || 0);
488817
489528
  const result = {
488818
489529
  totalSessions,
488819
489530
  totalMessages,
@@ -488839,30 +489550,30 @@ async function aggregateClaudeCodeStats() {
488839
489550
  return getEmptyStats();
488840
489551
  }
488841
489552
  const updatedCache = await withStatsCacheLock(async () => {
488842
- const cache4 = await loadStatsCache();
489553
+ const cache5 = await loadStatsCache();
488843
489554
  const yesterday = getYesterdayDateString();
488844
- let result = cache4;
488845
- if (!cache4.lastComputedDate) {
489555
+ let result = cache5;
489556
+ if (!cache5.lastComputedDate) {
488846
489557
  logForDebugging("Stats cache empty, processing all historical data");
488847
489558
  const historicalStats = await processSessionFiles(allSessionFiles, {
488848
489559
  toDate: yesterday
488849
489560
  });
488850
489561
  if (historicalStats.sessionStats.length > 0 || historicalStats.dailyActivity.length > 0) {
488851
- result = mergeCacheWithNewStats(cache4, historicalStats, yesterday);
489562
+ result = mergeCacheWithNewStats(cache5, historicalStats, yesterday);
488852
489563
  await saveStatsCache(result);
488853
489564
  }
488854
- } else if (isDateBefore(cache4.lastComputedDate, yesterday)) {
488855
- const nextDay = getNextDay(cache4.lastComputedDate);
488856
- logForDebugging(`Stats cache stale (${cache4.lastComputedDate}), processing ${nextDay} to ${yesterday}`);
489565
+ } else if (isDateBefore(cache5.lastComputedDate, yesterday)) {
489566
+ const nextDay = getNextDay(cache5.lastComputedDate);
489567
+ logForDebugging(`Stats cache stale (${cache5.lastComputedDate}), processing ${nextDay} to ${yesterday}`);
488857
489568
  const newStats = await processSessionFiles(allSessionFiles, {
488858
489569
  fromDate: nextDay,
488859
489570
  toDate: yesterday
488860
489571
  });
488861
489572
  if (newStats.sessionStats.length > 0 || newStats.dailyActivity.length > 0) {
488862
- result = mergeCacheWithNewStats(cache4, newStats, yesterday);
489573
+ result = mergeCacheWithNewStats(cache5, newStats, yesterday);
488863
489574
  await saveStatsCache(result);
488864
489575
  } else {
488865
- result = { ...cache4, lastComputedDate: yesterday };
489576
+ result = { ...cache5, lastComputedDate: yesterday };
488866
489577
  await saveStatsCache(result);
488867
489578
  }
488868
489579
  }
@@ -491502,10 +492213,10 @@ function extractToolStats(log2) {
491502
492213
  `) + 1;
491503
492214
  }
491504
492215
  }
491505
- const command8 = input.command || "";
491506
- if (command8.includes("git commit"))
492216
+ const command9 = input.command || "";
492217
+ if (command9.includes("git commit"))
491507
492218
  gitCommits++;
491508
- if (command8.includes("git push"))
492219
+ if (command9.includes("git push"))
491509
492220
  gitPushes++;
491510
492221
  }
491511
492222
  }
@@ -492925,7 +493636,7 @@ async function scanAllSessions() {
492925
493636
  });
492926
493637
  }
492927
493638
  if (i3 % 10 === 9) {
492928
- await new Promise((resolve48) => setImmediate(resolve48));
493639
+ await new Promise((resolve47) => setImmediate(resolve47));
492929
493640
  }
492930
493641
  }
492931
493642
  allSessions.sort((a2, b3) => b3.mtime - a2.mtime);
@@ -493710,14 +494421,14 @@ function hasCommand(commandName, commands) {
493710
494421
  return findCommand(commandName, commands) !== undefined;
493711
494422
  }
493712
494423
  function getCommand(commandName, commands) {
493713
- const command8 = findCommand(commandName, commands);
493714
- if (!command8) {
494424
+ const command9 = findCommand(commandName, commands);
494425
+ if (!command9) {
493715
494426
  throw ReferenceError(`Command ${commandName} not found. Available commands: ${commands.map((_2) => {
493716
494427
  const name = getCommandName(_2);
493717
494428
  return _2.aliases ? `${name} (aliases: ${_2.aliases.join(", ")})` : name;
493718
494429
  }).sort((a2, b3) => a2.localeCompare(b3)).join(", ")}`);
493719
494430
  }
493720
- return command8;
494431
+ return command9;
493721
494432
  }
493722
494433
  function formatDescriptionWithSource(cmd) {
493723
494434
  if (cmd.type !== "prompt") {
@@ -493794,6 +494505,7 @@ var init_commands2 = __esm(() => {
493794
494505
  init_usage3();
493795
494506
  init_theme4();
493796
494507
  init_vim2();
494508
+ init_flow();
493797
494509
  init_thinkback2();
493798
494510
  init_thinkback_play2();
493799
494511
  init_permissions4();
@@ -493826,6 +494538,8 @@ var init_commands2 = __esm(() => {
493826
494538
  init_artifact();
493827
494539
  init_git_flow();
493828
494540
  init_frontend_tdd();
494541
+ init_agentic_tdd();
494542
+ init_agent2();
493829
494543
  init_remember();
493830
494544
  init_log3();
493831
494545
  init_errors();
@@ -493957,6 +494671,8 @@ var init_commands2 = __esm(() => {
493957
494671
  newHotfixCmd,
493958
494672
  finishHotfixCmd,
493959
494673
  frontend_tdd_default,
494674
+ agentic_tdd_default,
494675
+ agent_default,
493960
494676
  tag_default,
493961
494677
  theme_default,
493962
494678
  feedback_default,
@@ -493990,6 +494706,7 @@ var init_commands2 = __esm(() => {
493990
494706
  hooks_default,
493991
494707
  export_default,
493992
494708
  sandbox_toggle_default,
494709
+ flow_default,
493993
494710
  ...!isUsing3PServices() ? [logout_default, login_default()] : [],
493994
494711
  passes_default,
493995
494712
  ...peersCmd ? [peersCmd] : [],
@@ -494167,7 +494884,7 @@ import {
494167
494884
  unlink as unlink19,
494168
494885
  writeFile as writeFile41
494169
494886
  } from "fs/promises";
494170
- import { basename as basename45, dirname as dirname61, join as join141 } from "path";
494887
+ import { basename as basename44, dirname as dirname61, join as join141 } from "path";
494171
494888
  function isTranscriptMessage(entry) {
494172
494889
  return entry.type === "user" || entry.type === "assistant" || entry.type === "attachment" || entry.type === "system";
494173
494890
  }
@@ -494381,8 +495098,8 @@ class Project {
494381
495098
  decrementPendingWrites() {
494382
495099
  this.pendingWriteCount--;
494383
495100
  if (this.pendingWriteCount === 0) {
494384
- for (const resolve48 of this.flushResolvers) {
494385
- resolve48();
495101
+ for (const resolve47 of this.flushResolvers) {
495102
+ resolve47();
494386
495103
  }
494387
495104
  this.flushResolvers = [];
494388
495105
  }
@@ -494396,13 +495113,13 @@ class Project {
494396
495113
  }
494397
495114
  }
494398
495115
  enqueueWrite(filePath, entry) {
494399
- return new Promise((resolve48) => {
495116
+ return new Promise((resolve47) => {
494400
495117
  let queue2 = this.writeQueues.get(filePath);
494401
495118
  if (!queue2) {
494402
495119
  queue2 = [];
494403
495120
  this.writeQueues.set(filePath, queue2);
494404
495121
  }
494405
- queue2.push({ entry, resolve: resolve48 });
495122
+ queue2.push({ entry, resolve: resolve47 });
494406
495123
  this.scheduleDrain();
494407
495124
  });
494408
495125
  }
@@ -494436,7 +495153,7 @@ class Project {
494436
495153
  const batch = queue2.splice(0);
494437
495154
  let content = "";
494438
495155
  const resolvers3 = [];
494439
- for (const { entry, resolve: resolve48 } of batch) {
495156
+ for (const { entry, resolve: resolve47 } of batch) {
494440
495157
  const line = jsonStringify(entry) + `
494441
495158
  `;
494442
495159
  if (content.length + line.length >= this.MAX_CHUNK_BYTES) {
@@ -494448,7 +495165,7 @@ class Project {
494448
495165
  content = "";
494449
495166
  }
494450
495167
  content += line;
494451
- resolvers3.push(resolve48);
495168
+ resolvers3.push(resolve47);
494452
495169
  }
494453
495170
  if (content.length > 0) {
494454
495171
  await this.appendToFile(filePath, content);
@@ -494571,8 +495288,8 @@ class Project {
494571
495288
  if (this.pendingWriteCount === 0) {
494572
495289
  return;
494573
495290
  }
494574
- return new Promise((resolve48) => {
494575
- this.flushResolvers.push(resolve48);
495291
+ return new Promise((resolve47) => {
495292
+ this.flushResolvers.push(resolve47);
494576
495293
  });
494577
495294
  }
494578
495295
  async removeMessageByUuid(targetUuid) {
@@ -495222,7 +495939,7 @@ function applySnipRemovals(messages) {
495222
495939
  messages.delete(uuid5);
495223
495940
  removedCount++;
495224
495941
  }
495225
- const resolve48 = (start) => {
495942
+ const resolve47 = (start) => {
495226
495943
  const path25 = [];
495227
495944
  let cur = start;
495228
495945
  while (cur && toDelete.has(cur)) {
@@ -495241,7 +495958,7 @@ function applySnipRemovals(messages) {
495241
495958
  for (const [uuid5, msg] of messages) {
495242
495959
  if (!msg.parentUuid || !toDelete.has(msg.parentUuid))
495243
495960
  continue;
495244
- messages.set(uuid5, { ...msg, parentUuid: resolve48(msg.parentUuid) });
495961
+ messages.set(uuid5, { ...msg, parentUuid: resolve47(msg.parentUuid) });
495245
495962
  relinkedCount++;
495246
495963
  }
495247
495964
  logEvent("tengu_snip_resume_filtered", {
@@ -496601,7 +497318,7 @@ async function getSessionFilesWithMtime(projectDir) {
496601
497318
  for (const dirent of dirents) {
496602
497319
  if (!dirent.isFile() || !dirent.name.endsWith(".jsonl"))
496603
497320
  continue;
496604
- const sessionId = validateUuid2(basename45(dirent.name, ".jsonl"));
497321
+ const sessionId = validateUuid2(basename44(dirent.name, ".jsonl"));
496605
497322
  if (!sessionId)
496606
497323
  continue;
496607
497324
  candidates.push({ sessionId, filePath: join141(projectDir, dirent.name) });
@@ -498253,8 +498970,8 @@ class DiskTaskOutput {
498253
498970
  this.#queue.push(content);
498254
498971
  }
498255
498972
  if (!this.#flushPromise) {
498256
- this.#flushPromise = new Promise((resolve48) => {
498257
- this.#flushResolve = resolve48;
498973
+ this.#flushPromise = new Promise((resolve47) => {
498974
+ this.#flushResolve = resolve47;
498258
498975
  });
498259
498976
  track(this.#drain());
498260
498977
  }
@@ -498320,10 +499037,10 @@ class DiskTaskOutput {
498320
499037
  }
498321
499038
  }
498322
499039
  } finally {
498323
- const resolve48 = this.#flushResolve;
499040
+ const resolve47 = this.#flushResolve;
498324
499041
  this.#flushPromise = null;
498325
499042
  this.#flushResolve = null;
498326
- resolve48();
499043
+ resolve47();
498327
499044
  }
498328
499045
  }
498329
499046
  }
@@ -498611,11 +499328,11 @@ class ShellCommandImpl {
498611
499328
  this.#childProcess.once("exit", this.#exitHandler.bind(this));
498612
499329
  this.#childProcess.once("error", this.#errorHandler.bind(this));
498613
499330
  this.#timeoutId = setTimeout(ShellCommandImpl.#handleTimeout, this.#timeout, this);
498614
- const exitPromise = new Promise((resolve48) => {
498615
- this.#exitCodeResolver = resolve48;
499331
+ const exitPromise = new Promise((resolve47) => {
499332
+ this.#exitCodeResolver = resolve47;
498616
499333
  });
498617
- return new Promise((resolve48) => {
498618
- this.#resultResolver = resolve48;
499334
+ return new Promise((resolve47) => {
499335
+ this.#resultResolver = resolve47;
498619
499336
  exitPromise.then(this.#handleExit.bind(this));
498620
499337
  });
498621
499338
  }
@@ -499640,7 +500357,7 @@ __export(exports_hooks2, {
499640
500357
  executeConfigChangeHooks: () => executeConfigChangeHooks,
499641
500358
  createBaseHookInput: () => createBaseHookInput
499642
500359
  });
499643
- import { basename as basename46 } from "path";
500360
+ import { basename as basename45 } from "path";
499644
500361
  import { spawn as spawn11 } from "child_process";
499645
500362
  import { randomUUID as randomUUID30 } from "crypto";
499646
500363
  function getSessionEndHookTimeoutMs() {
@@ -499655,13 +500372,13 @@ function executeInBackground({
499655
500372
  asyncResponse,
499656
500373
  hookEvent,
499657
500374
  hookName,
499658
- command: command8,
500375
+ command: command9,
499659
500376
  asyncRewake,
499660
500377
  pluginId
499661
500378
  }) {
499662
500379
  if (asyncRewake) {
499663
500380
  shellCommand.result.then(async (result) => {
499664
- await new Promise((resolve48) => setImmediate(resolve48));
500381
+ await new Promise((resolve47) => setImmediate(resolve47));
499665
500382
  const stdout = await shellCommand.taskOutput.getStdout();
499666
500383
  const stderr = shellCommand.taskOutput.getStderr();
499667
500384
  shellCommand.cleanup();
@@ -499693,7 +500410,7 @@ function executeInBackground({
499693
500410
  asyncResponse,
499694
500411
  hookEvent,
499695
500412
  hookName,
499696
- command: command8,
500413
+ command: command9,
499697
500414
  shellCommand,
499698
500415
  pluginId
499699
500416
  });
@@ -499810,7 +500527,7 @@ function parseHttpHookOutput(body) {
499810
500527
  }
499811
500528
  function processHookJSONOutput({
499812
500529
  json: json2,
499813
- command: command8,
500530
+ command: command9,
499814
500531
  hookName,
499815
500532
  toolUseID,
499816
500533
  hookEvent,
@@ -499837,7 +500554,7 @@ function processHookJSONOutput({
499837
500554
  result.permissionBehavior = "deny";
499838
500555
  result.blockingError = {
499839
500556
  blockingError: json2.reason || "Blocked by hook",
499840
- command: command8
500557
+ command: command9
499841
500558
  };
499842
500559
  break;
499843
500560
  default:
@@ -499856,7 +500573,7 @@ function processHookJSONOutput({
499856
500573
  result.permissionBehavior = "deny";
499857
500574
  result.blockingError = {
499858
500575
  blockingError: json2.reason || "Blocked by hook",
499859
- command: command8
500576
+ command: command9
499860
500577
  };
499861
500578
  break;
499862
500579
  case "ask":
@@ -499884,7 +500601,7 @@ function processHookJSONOutput({
499884
500601
  result.permissionBehavior = "deny";
499885
500602
  result.blockingError = {
499886
500603
  blockingError: json2.hookSpecificOutput.permissionDecisionReason || json2.reason || "Blocked by hook",
499887
- command: command8
500604
+ command: command9
499888
500605
  };
499889
500606
  break;
499890
500607
  case "ask":
@@ -499944,7 +500661,7 @@ function processHookJSONOutput({
499944
500661
  if (json2.hookSpecificOutput.action === "decline") {
499945
500662
  result.blockingError = {
499946
500663
  blockingError: json2.reason || "Elicitation denied by hook",
499947
- command: command8
500664
+ command: command9
499948
500665
  };
499949
500666
  }
499950
500667
  }
@@ -499958,7 +500675,7 @@ function processHookJSONOutput({
499958
500675
  if (json2.hookSpecificOutput.action === "decline") {
499959
500676
  result.blockingError = {
499960
500677
  blockingError: json2.reason || "Elicitation result blocked by hook",
499961
- command: command8
500678
+ command: command9
499962
500679
  };
499963
500680
  }
499964
500681
  }
@@ -499982,7 +500699,7 @@ function processHookJSONOutput({
499982
500699
  stdout,
499983
500700
  stderr,
499984
500701
  exitCode,
499985
- command: command8,
500702
+ command: command9,
499986
500703
  durationMs
499987
500704
  })
499988
500705
  };
@@ -499997,29 +500714,29 @@ async function execCommandHook(hook, hookEvent, hookName, jsonInput, signal, hoo
499997
500714
  const isPowerShell = shellType === "powershell";
499998
500715
  const toHookPath = isWindows2 && !isPowerShell ? (p) => windowsPathToPosixPath(p) : (p) => p;
499999
500716
  const projectDir = getProjectRoot();
500000
- let command8 = hook.command;
500717
+ let command9 = hook.command;
500001
500718
  let pluginOpts;
500002
500719
  if (pluginRoot) {
500003
500720
  if (!await pathExists(pluginRoot)) {
500004
500721
  throw new Error(`Plugin directory does not exist: ${pluginRoot}` + (pluginId ? ` (${pluginId} — run /plugin to reinstall)` : ""));
500005
500722
  }
500006
500723
  const rootPath = toHookPath(pluginRoot);
500007
- command8 = command8.replace(/\$\{CLAUDE_PLUGIN_ROOT\}/g, () => rootPath);
500724
+ command9 = command9.replace(/\$\{CLAUDE_PLUGIN_ROOT\}/g, () => rootPath);
500008
500725
  if (pluginId) {
500009
500726
  const dataPath = toHookPath(getPluginDataDir(pluginId));
500010
- command8 = command8.replace(/\$\{CLAUDE_PLUGIN_DATA\}/g, () => dataPath);
500727
+ command9 = command9.replace(/\$\{CLAUDE_PLUGIN_DATA\}/g, () => dataPath);
500011
500728
  }
500012
500729
  if (pluginId) {
500013
500730
  pluginOpts = loadPluginOptions(pluginId);
500014
- command8 = substituteUserConfigVariables(command8, pluginOpts);
500731
+ command9 = substituteUserConfigVariables(command9, pluginOpts);
500015
500732
  }
500016
500733
  }
500017
- if (isWindows2 && !isPowerShell && command8.trim().match(/\.sh(\s|$|")/)) {
500018
- if (!command8.trim().startsWith("bash ")) {
500019
- command8 = `bash ${command8}`;
500734
+ if (isWindows2 && !isPowerShell && command9.trim().match(/\.sh(\s|$|")/)) {
500735
+ if (!command9.trim().startsWith("bash ")) {
500736
+ command9 = `bash ${command9}`;
500020
500737
  }
500021
500738
  }
500022
- const finalCommand = !isPowerShell && process.env.CLAUDE_CODE_SHELL_PREFIX ? formatShellPrefixCommand(process.env.CLAUDE_CODE_SHELL_PREFIX, command8) : command8;
500739
+ const finalCommand = !isPowerShell && process.env.CLAUDE_CODE_SHELL_PREFIX ? formatShellPrefixCommand(process.env.CLAUDE_CODE_SHELL_PREFIX, command9) : command9;
500023
500740
  const hookTimeoutMs = hook.timeout ? hook.timeout * 1000 : TOOL_HOOK_EXECUTION_TIMEOUT_MS;
500024
500741
  const envVars = {
500025
500742
  ...subprocessEnv(),
@@ -500107,8 +500824,8 @@ async function execCommandHook(hook, hookEvent, hookName, jsonInput, signal, hoo
500107
500824
  child.stderr.setEncoding("utf8");
500108
500825
  let initialResponseChecked = false;
500109
500826
  let asyncResolve = null;
500110
- const childIsAsyncPromise = new Promise((resolve48) => {
500111
- asyncResolve = resolve48;
500827
+ const childIsAsyncPromise = new Promise((resolve47) => {
500828
+ asyncResolve = resolve47;
500112
500829
  });
500113
500830
  const processedPromptLines = new Set;
500114
500831
  let promptChain = Promise.resolve();
@@ -500199,13 +500916,13 @@ async function execCommandHook(hook, hookEvent, hookName, jsonInput, signal, hoo
500199
500916
  hookEvent,
500200
500917
  getOutput: async () => ({ stdout, stderr, output })
500201
500918
  });
500202
- const stdoutEndPromise = new Promise((resolve48) => {
500203
- child.stdout.on("end", () => resolve48());
500919
+ const stdoutEndPromise = new Promise((resolve47) => {
500920
+ child.stdout.on("end", () => resolve47());
500204
500921
  });
500205
- const stderrEndPromise = new Promise((resolve48) => {
500206
- child.stderr.on("end", () => resolve48());
500922
+ const stderrEndPromise = new Promise((resolve47) => {
500923
+ child.stderr.on("end", () => resolve47());
500207
500924
  });
500208
- const stdinWritePromise = stdinWritten ? Promise.resolve() : new Promise((resolve48, reject2) => {
500925
+ const stdinWritePromise = stdinWritten ? Promise.resolve() : new Promise((resolve47, reject2) => {
500209
500926
  child.stdin.on("error", (err2) => {
500210
500927
  if (!requestPrompt) {
500211
500928
  reject2(err2);
@@ -500218,12 +500935,12 @@ async function execCommandHook(hook, hookEvent, hookName, jsonInput, signal, hoo
500218
500935
  if (!requestPrompt) {
500219
500936
  child.stdin.end();
500220
500937
  }
500221
- resolve48();
500938
+ resolve47();
500222
500939
  });
500223
500940
  const childErrorPromise = new Promise((_2, reject2) => {
500224
500941
  child.on("error", reject2);
500225
500942
  });
500226
- const childClosePromise = new Promise((resolve48) => {
500943
+ const childClosePromise = new Promise((resolve47) => {
500227
500944
  let exitCode = null;
500228
500945
  child.on("close", (code) => {
500229
500946
  exitCode = code ?? 1;
@@ -500231,7 +500948,7 @@ async function execCommandHook(hook, hookEvent, hookName, jsonInput, signal, hoo
500231
500948
  const finalStdout = processedPromptLines.size === 0 ? stdout : stdout.split(`
500232
500949
  `).filter((line) => !processedPromptLines.has(line.trim())).join(`
500233
500950
  `);
500234
- resolve48({
500951
+ resolve47({
500235
500952
  stdout: finalStdout,
500236
500953
  stderr,
500237
500954
  output,
@@ -500471,7 +501188,7 @@ async function getMatchingHooks(appState, sessionId, hookEvent, hookInput, tools
500471
501188
  matchQuery = hookInput.load_reason;
500472
501189
  break;
500473
501190
  case "FileChanged":
500474
- matchQuery = basename46(hookInput.file_path);
501191
+ matchQuery = basename45(hookInput.file_path);
500475
501192
  break;
500476
501193
  default:
500477
501194
  break;
@@ -502262,12 +502979,12 @@ async function executeFunctionHook({
502262
502979
  hook
502263
502980
  };
502264
502981
  }
502265
- const passed = await new Promise((resolve48, reject2) => {
502982
+ const passed = await new Promise((resolve47, reject2) => {
502266
502983
  const onAbort = () => reject2(new Error("Function hook cancelled"));
502267
502984
  abortSignal.addEventListener("abort", onAbort);
502268
502985
  Promise.resolve(hook.callback(messages, abortSignal)).then((result) => {
502269
502986
  abortSignal.removeEventListener("abort", onAbort);
502270
- resolve48(result);
502987
+ resolve47(result);
502271
502988
  }).catch((error49) => {
502272
502989
  abortSignal.removeEventListener("abort", onAbort);
502273
502990
  reject2(error49);
@@ -502502,7 +503219,7 @@ import {
502502
503219
  symlink as symlink5,
502503
503220
  utimes as utimes2
502504
503221
  } from "fs/promises";
502505
- import { basename as basename47, dirname as dirname62, join as join145 } from "path";
503222
+ import { basename as basename46, dirname as dirname62, join as join145 } from "path";
502506
503223
  function validateWorktreeSlug(slug) {
502507
503224
  if (slug.length > MAX_WORKTREE_SLUG_LENGTH) {
502508
503225
  throw new Error(`Invalid worktree name: must be ${MAX_WORKTREE_SLUG_LENGTH} characters or fewer (got ${slug.length})`);
@@ -502545,7 +503262,7 @@ function restoreWorktreeSession(session2) {
502545
503262
  currentWorktreeSession = session2;
502546
503263
  }
502547
503264
  function generateTmuxSessionName(repoPath, branch2) {
502548
- const repoName = basename47(repoPath);
503265
+ const repoName = basename46(repoPath);
502549
503266
  const combined = `${repoName}_${branch2}`;
502550
503267
  return combined.replace(/[/.]/g, "_");
502551
503268
  }
@@ -503121,7 +503838,7 @@ async function execIntoTmuxWorktree(args) {
503121
503838
  error: `Error: ${errorMessage(error49)}`
503122
503839
  };
503123
503840
  }
503124
- repoName = basename47(findCanonicalGitRoot(getCwd()) ?? getCwd());
503841
+ repoName = basename46(findCanonicalGitRoot(getCwd()) ?? getCwd());
503125
503842
  console.log(`Using worktree via hook: ${worktreeDir}`);
503126
503843
  } else {
503127
503844
  const repoRoot = findCanonicalGitRoot(getCwd());
@@ -503131,7 +503848,7 @@ async function execIntoTmuxWorktree(args) {
503131
503848
  error: "Error: --worktree requires a git repository"
503132
503849
  };
503133
503850
  }
503134
- repoName = basename47(repoRoot);
503851
+ repoName = basename46(repoRoot);
503135
503852
  worktreeDir = worktreePathFor(repoRoot, worktreeName);
503136
503853
  try {
503137
503854
  const result = await getOrCreateWorktree(repoRoot, worktreeName, prNumber !== null ? { prNumber } : undefined);
@@ -503792,8 +504509,8 @@ function filterSwarmFieldsFromSchema(toolName2, schema) {
503792
504509
  }
503793
504510
  async function toolToAPISchema(tool, options) {
503794
504511
  const cacheKey = "inputJSONSchema" in tool && tool.inputJSONSchema ? `${tool.name}:${jsonStringify(tool.inputJSONSchema)}` : tool.name;
503795
- const cache4 = getToolSchemaCache();
503796
- let base2 = cache4.get(cacheKey);
504512
+ const cache5 = getToolSchemaCache();
504513
+ let base2 = cache5.get(cacheKey);
503797
504514
  if (!base2) {
503798
504515
  const strictToolsEnabled = checkStatsigFeatureGate_CACHED_MAY_BE_STALE("tengu_tool_pear");
503799
504516
  let input_schema = "inputJSONSchema" in tool && tool.inputJSONSchema ? tool.inputJSONSchema : zodToJsonSchema3(tool.inputSchema);
@@ -503816,7 +504533,7 @@ async function toolToAPISchema(tool, options) {
503816
504533
  if (getAPIProvider() === "firstParty" && isFirstPartyAnthropicBaseUrl() && (getFeatureValue_CACHED_MAY_BE_STALE("tengu_fgts", false) || isEnvTruthy(process.env.CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING))) {
503817
504534
  base2.eager_input_streaming = true;
503818
504535
  }
503819
- cache4.set(cacheKey, base2);
504536
+ cache5.set(cacheKey, base2);
503820
504537
  }
503821
504538
  const schema = {
503822
504539
  name: base2.name,
@@ -504068,9 +504785,9 @@ function normalizeToolInput(tool, input, agentId) {
504068
504785
  }
504069
504786
  case BashTool.name: {
504070
504787
  const parsed = BashTool.inputSchema.parse(input);
504071
- const { command: command8, timeout, description } = parsed;
504788
+ const { command: command9, timeout, description } = parsed;
504072
504789
  const cwd2 = getCwd();
504073
- let normalizedCommand = command8.replace(`cd ${cwd2} && `, "");
504790
+ let normalizedCommand = command9.replace(`cd ${cwd2} && `, "");
504074
504791
  if (getPlatform() === "windows") {
504075
504792
  normalizedCommand = normalizedCommand.replace(`cd ${windowsPathToPosixPath(cwd2)} && `, "");
504076
504793
  }
@@ -506435,11 +507152,11 @@ class ChromeNativeHost {
506435
507152
  }
506436
507153
  log2(`Creating socket listener: ${this.socketPath}`);
506437
507154
  this.server = createServer7((socket) => this.handleMcpClient(socket));
506438
- await new Promise((resolve48, reject2) => {
507155
+ await new Promise((resolve47, reject2) => {
506439
507156
  this.server.listen(this.socketPath, () => {
506440
507157
  log2("Socket server listening for connections");
506441
507158
  this.running = true;
506442
- resolve48();
507159
+ resolve47();
506443
507160
  });
506444
507161
  this.server.on("error", (err2) => {
506445
507162
  log2("Socket server error:", err2);
@@ -506464,8 +507181,8 @@ class ChromeNativeHost {
506464
507181
  }
506465
507182
  this.mcpClients.clear();
506466
507183
  if (this.server) {
506467
- await new Promise((resolve48) => {
506468
- this.server.close(() => resolve48());
507184
+ await new Promise((resolve47) => {
507185
+ this.server.close(() => resolve47());
506469
507186
  });
506470
507187
  this.server = null;
506471
507188
  }
@@ -506686,8 +507403,8 @@ class ChromeMessageReader {
506686
507403
  return messageBytes.toString("utf-8");
506687
507404
  }
506688
507405
  }
506689
- return new Promise((resolve48) => {
506690
- this.pendingResolve = resolve48;
507406
+ return new Promise((resolve47) => {
507407
+ this.pendingResolve = resolve47;
506691
507408
  this.tryProcessMessage();
506692
507409
  });
506693
507410
  }
@@ -506895,8 +507612,8 @@ var require_help = __commonJS((exports) => {
506895
507612
  return argument.name();
506896
507613
  }
506897
507614
  longestSubcommandTermLength(cmd, helper) {
506898
- return helper.visibleCommands(cmd).reduce((max2, command8) => {
506899
- return Math.max(max2, this.displayWidth(helper.styleSubcommandTerm(helper.subcommandTerm(command8))));
507615
+ return helper.visibleCommands(cmd).reduce((max2, command9) => {
507616
+ return Math.max(max2, this.displayWidth(helper.styleSubcommandTerm(helper.subcommandTerm(command9))));
506900
507617
  }, 0);
506901
507618
  }
506902
507619
  longestOptionTermLength(cmd, helper) {
@@ -507488,8 +508205,8 @@ var require_command = __commonJS((exports) => {
507488
508205
  }
507489
508206
  _getCommandAndAncestors() {
507490
508207
  const result = [];
507491
- for (let command8 = this;command8; command8 = command8.parent) {
507492
- result.push(command8);
508208
+ for (let command9 = this;command9; command9 = command9.parent) {
508209
+ result.push(command9);
507493
508210
  }
507494
508211
  return result;
507495
508212
  }
@@ -507699,17 +508416,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
507699
508416
  }
507700
508417
  this.options.push(option);
507701
508418
  }
507702
- _registerCommand(command8) {
508419
+ _registerCommand(command9) {
507703
508420
  const knownBy = (cmd) => {
507704
508421
  return [cmd.name()].concat(cmd.aliases());
507705
508422
  };
507706
- const alreadyUsed = knownBy(command8).find((name) => this._findCommand(name));
508423
+ const alreadyUsed = knownBy(command9).find((name) => this._findCommand(name));
507707
508424
  if (alreadyUsed) {
507708
508425
  const existingCmd = knownBy(this._findCommand(alreadyUsed)).join("|");
507709
- const newCmd = knownBy(command8).join("|");
508426
+ const newCmd = knownBy(command9).join("|");
507710
508427
  throw new Error(`cannot add command '${newCmd}' as already have command '${existingCmd}'`);
507711
508428
  }
507712
- this.commands.push(command8);
508429
+ this.commands.push(command9);
507713
508430
  }
507714
508431
  addOption(option) {
507715
508432
  this._registerOption(option);
@@ -508436,12 +509153,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
508436
509153
  let suggestion = "";
508437
509154
  if (flag.startsWith("--") && this._showSuggestionAfterError) {
508438
509155
  let candidateFlags = [];
508439
- let command8 = this;
509156
+ let command9 = this;
508440
509157
  do {
508441
- const moreFlags = command8.createHelp().visibleOptions(command8).filter((option) => option.long).map((option) => option.long);
509158
+ const moreFlags = command9.createHelp().visibleOptions(command9).filter((option) => option.long).map((option) => option.long);
508442
509159
  candidateFlags = candidateFlags.concat(moreFlags);
508443
- command8 = command8.parent;
508444
- } while (command8 && !command8._enablePositionalOptions);
509160
+ command9 = command9.parent;
509161
+ } while (command9 && !command9._enablePositionalOptions);
508445
509162
  suggestion = suggestSimilar(flag, candidateFlags);
508446
509163
  }
508447
509164
  const message = `error: unknown option '${flag}'${suggestion}`;
@@ -508461,10 +509178,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
508461
509178
  let suggestion = "";
508462
509179
  if (this._showSuggestionAfterError) {
508463
509180
  const candidateNames = [];
508464
- this.createHelp().visibleCommands(this).forEach((command8) => {
508465
- candidateNames.push(command8.name());
508466
- if (command8.alias())
508467
- candidateNames.push(command8.alias());
509181
+ this.createHelp().visibleCommands(this).forEach((command9) => {
509182
+ candidateNames.push(command9.name());
509183
+ if (command9.alias())
509184
+ candidateNames.push(command9.alias());
508468
509185
  });
508469
509186
  suggestion = suggestSimilar(unknownName, candidateNames);
508470
509187
  }
@@ -508505,18 +509222,18 @@ Expecting one of '${allowedValues.join("', '")}'`);
508505
509222
  alias(alias) {
508506
509223
  if (alias === undefined)
508507
509224
  return this._aliases[0];
508508
- let command8 = this;
509225
+ let command9 = this;
508509
509226
  if (this.commands.length !== 0 && this.commands[this.commands.length - 1]._executableHandler) {
508510
- command8 = this.commands[this.commands.length - 1];
509227
+ command9 = this.commands[this.commands.length - 1];
508511
509228
  }
508512
- if (alias === command8._name)
509229
+ if (alias === command9._name)
508513
509230
  throw new Error("Command alias can't be the same as its name");
508514
509231
  const matchingCommand = this.parent?._findCommand(alias);
508515
509232
  if (matchingCommand) {
508516
509233
  const existingCmd = [matchingCommand.name()].concat(matchingCommand.aliases()).join("|");
508517
509234
  throw new Error(`cannot add alias '${alias}' to command '${this.name()}' as already have command '${existingCmd}'`);
508518
509235
  }
508519
- command8._aliases.push(alias);
509236
+ command9._aliases.push(alias);
508520
509237
  return this;
508521
509238
  }
508522
509239
  aliases(aliases) {
@@ -508600,7 +509317,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
508600
509317
  write: outputContext.write,
508601
509318
  command: this
508602
509319
  };
508603
- this._getCommandAndAncestors().reverse().forEach((command8) => command8.emit("beforeAllHelp", eventContext));
509320
+ this._getCommandAndAncestors().reverse().forEach((command9) => command9.emit("beforeAllHelp", eventContext));
508604
509321
  this.emit("beforeHelp", eventContext);
508605
509322
  let helpInformation = this.helpInformation({ error: outputContext.error });
508606
509323
  if (deprecatedCallback) {
@@ -508614,7 +509331,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
508614
509331
  this.emit(this._getHelpOption().long);
508615
509332
  }
508616
509333
  this.emit("afterHelp", eventContext);
508617
- this._getCommandAndAncestors().forEach((command8) => command8.emit("afterAllHelp", eventContext));
509334
+ this._getCommandAndAncestors().forEach((command9) => command9.emit("afterAllHelp", eventContext));
508618
509335
  }
508619
509336
  helpOption(flags, description) {
508620
509337
  if (typeof flags === "boolean") {
@@ -509217,7 +509934,7 @@ async function startNodeRelay(wsUrl, authHeader, wsAuthHeader) {
509217
509934
  cleanupConn(states.get(sock));
509218
509935
  });
509219
509936
  });
509220
- return new Promise((resolve48, reject2) => {
509937
+ return new Promise((resolve47, reject2) => {
509221
509938
  server.once("error", reject2);
509222
509939
  server.listen(0, "127.0.0.1", () => {
509223
509940
  const addr = server.address();
@@ -509225,7 +509942,7 @@ async function startNodeRelay(wsUrl, authHeader, wsAuthHeader) {
509225
509942
  reject2(new Error("upstreamproxy: server has no TCP address"));
509226
509943
  return;
509227
509944
  }
509228
- resolve48({
509945
+ resolve47({
509229
509946
  port: addr.port,
509230
509947
  stop: () => server.close()
509231
509948
  });
@@ -509730,7 +510447,7 @@ async function showInvalidConfigDialog({
509730
510447
  ...getBaseRenderOptions(false),
509731
510448
  theme: SAFE_ERROR_THEME_NAME
509732
510449
  };
509733
- await new Promise(async (resolve48) => {
510450
+ await new Promise(async (resolve47) => {
509734
510451
  const {
509735
510452
  unmount
509736
510453
  } = await render(/* @__PURE__ */ jsx_dev_runtime356.jsxDEV(AppStateProvider, {
@@ -509740,7 +510457,7 @@ async function showInvalidConfigDialog({
509740
510457
  errorDescription: error49.message,
509741
510458
  onExit: () => {
509742
510459
  unmount();
509743
- resolve48();
510460
+ resolve47();
509744
510461
  process.exit(1);
509745
510462
  },
509746
510463
  onReset: () => {
@@ -509749,7 +510466,7 @@ async function showInvalidConfigDialog({
509749
510466
  encoding: "utf8"
509750
510467
  });
509751
510468
  unmount();
509752
- resolve48();
510469
+ resolve47();
509753
510470
  process.exit(0);
509754
510471
  }
509755
510472
  }, undefined, false, undefined, this)
@@ -511034,6 +511751,13 @@ var init_useLogMessages = __esm(() => {
511034
511751
  // src/bridge/bridgePermissionCallbacks.ts
511035
511752
  var init_bridgePermissionCallbacks = () => {};
511036
511753
 
511754
+ // src/bridge/bridgeUrlBuilder.ts
511755
+ function buildBridgeConnectUrl(environmentId, ingressUrl) {
511756
+ const baseUrl = getClaudeAiBaseUrl(undefined, ingressUrl);
511757
+ return `${baseUrl}/code?bridge=${environmentId}`;
511758
+ }
511759
+ var init_bridgeUrlBuilder = () => {};
511760
+
511037
511761
  // src/bridge/inboundMessages.ts
511038
511762
  function extractInboundMessageFields(msg) {
511039
511763
  if (msg.type !== "user")
@@ -511101,7 +511825,7 @@ function buildSystemInitMessage(inputs) {
511101
511825
  betas: getSdkBetas(),
511102
511826
  claude_code_version: MACRO.VERSION,
511103
511827
  output_style: outputStyle2,
511104
- agents: inputs.agents.map((agent) => agent.agentType),
511828
+ agents: inputs.agents.map((agent2) => agent2.agentType),
511105
511829
  skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
511106
511830
  plugins: inputs.plugins.map((plugin2) => ({
511107
511831
  name: plugin2.name,
@@ -511166,7 +511890,7 @@ var import_react199, jsx_dev_runtime364;
511166
511890
  var init_useReplBridge = __esm(() => {
511167
511891
  init_state();
511168
511892
  init_bridgePermissionCallbacks();
511169
- init_bridgeStatusUtil();
511893
+ init_bridgeUrlBuilder();
511170
511894
  init_inboundMessages();
511171
511895
  init_replBridgeHandle();
511172
511896
  init_commands2();
@@ -515056,9 +515780,9 @@ function findFirstSubcommand(args, spec) {
515056
515780
  }
515057
515781
  return;
515058
515782
  }
515059
- async function buildPrefix(command8, args, spec) {
515060
- const maxDepth = await calculateDepth(command8, args, spec);
515061
- const parts = [command8];
515783
+ async function buildPrefix(command9, args, spec) {
515784
+ const maxDepth = await calculateDepth(command9, args, spec);
515785
+ const parts = [command9];
515062
515786
  const hasSubcommands = !!spec?.subcommands?.length;
515063
515787
  let foundSubcommand = false;
515064
515788
  for (let i3 = 0;i3 < args.length; i3++) {
@@ -515066,7 +515790,7 @@ async function buildPrefix(command8, args, spec) {
515066
515790
  if (!arg || parts.length >= maxDepth)
515067
515791
  break;
515068
515792
  if (arg.startsWith("-")) {
515069
- if (arg === "-c" && ["python", "python3"].includes(command8.toLowerCase()))
515793
+ if (arg === "-c" && ["python", "python3"].includes(command9.toLowerCase()))
515070
515794
  break;
515071
515795
  if (spec?.options) {
515072
515796
  const option = spec.options.find((opt) => Array.isArray(opt.name) ? opt.name.includes(arg) : opt.name === arg);
@@ -515091,9 +515815,9 @@ async function buildPrefix(command8, args, spec) {
515091
515815
  }
515092
515816
  return parts.join(" ");
515093
515817
  }
515094
- async function calculateDepth(command8, args, spec) {
515818
+ async function calculateDepth(command9, args, spec) {
515095
515819
  const firstSubcommand = findFirstSubcommand(args, spec);
515096
- const commandLower = command8.toLowerCase();
515820
+ const commandLower = command9.toLowerCase();
515097
515821
  const key2 = firstSubcommand ? `${commandLower} ${firstSubcommand.toLowerCase()}` : commandLower;
515098
515822
  if (DEPTH_RULES[key2])
515099
515823
  return DEPTH_RULES[key2];
@@ -515408,15 +516132,15 @@ var init_specs = __esm(() => {
515408
516132
  });
515409
516133
 
515410
516134
  // src/utils/bash/registry.ts
515411
- async function loadFigSpec(command8) {
515412
- if (!command8 || command8.includes("/") || command8.includes("\\"))
516135
+ async function loadFigSpec(command9) {
516136
+ if (!command9 || command9.includes("/") || command9.includes("\\"))
515413
516137
  return null;
515414
- if (command8.includes(".."))
516138
+ if (command9.includes(".."))
515415
516139
  return null;
515416
- if (command8.startsWith("-") && command8 !== "-")
516140
+ if (command9.startsWith("-") && command9 !== "-")
515417
516141
  return null;
515418
516142
  try {
515419
- const module = await import(`@withfig/autocomplete/build/${command8}.js`);
516143
+ const module = await import(`@withfig/autocomplete/build/${command9}.js`);
515420
516144
  return module.default || module;
515421
516145
  } catch {
515422
516146
  return null;
@@ -515426,10 +516150,10 @@ var getCommandSpec;
515426
516150
  var init_registry2 = __esm(() => {
515427
516151
  init_memoize2();
515428
516152
  init_specs();
515429
- getCommandSpec = memoizeWithLRU(async (command8) => {
515430
- const spec = specs_default.find((s) => s.name === command8) || await loadFigSpec(command8) || null;
516153
+ getCommandSpec = memoizeWithLRU(async (command9) => {
516154
+ const spec = specs_default.find((s) => s.name === command9) || await loadFigSpec(command9) || null;
515431
516155
  return spec;
515432
- }, (command8) => command8);
516156
+ }, (command9) => command9);
515433
516157
  });
515434
516158
 
515435
516159
  // src/utils/bash/prefix.ts
@@ -515438,10 +516162,10 @@ function isKnownSubcommand2(arg, spec) {
515438
516162
  return false;
515439
516163
  return spec.subcommands.some((sub) => Array.isArray(sub.name) ? sub.name.includes(arg) : sub.name === arg);
515440
516164
  }
515441
- async function getCommandPrefixStatic(command8, recursionDepth = 0, wrapperCount = 0) {
516165
+ async function getCommandPrefixStatic(command9, recursionDepth = 0, wrapperCount = 0) {
515442
516166
  if (wrapperCount > 2 || recursionDepth > 10)
515443
516167
  return null;
515444
- const parsed = await parseCommand2(command8);
516168
+ const parsed = await parseCommand2(command9);
515445
516169
  if (!parsed)
515446
516170
  return null;
515447
516171
  if (!parsed.commandNode) {
@@ -515464,12 +516188,12 @@ async function getCommandPrefixStatic(command8, recursionDepth = 0, wrapperCount
515464
516188
  const envPrefix = envVars.length ? `${envVars.join(" ")} ` : "";
515465
516189
  return { commandPrefix: prefix ? envPrefix + prefix : null };
515466
516190
  }
515467
- async function handleWrapper(command8, args, recursionDepth, wrapperCount) {
515468
- const spec = await getCommandSpec(command8);
516191
+ async function handleWrapper(command9, args, recursionDepth, wrapperCount) {
516192
+ const spec = await getCommandSpec(command9);
515469
516193
  if (spec?.args) {
515470
516194
  const commandArgIndex = toArray4(spec.args).findIndex((arg) => arg?.isCommand);
515471
516195
  if (commandArgIndex !== -1) {
515472
- const parts = [command8];
516196
+ const parts = [command9];
515473
516197
  for (let i3 = 0;i3 < args.length && i3 <= commandArgIndex; i3++) {
515474
516198
  if (i3 === commandArgIndex) {
515475
516199
  const result2 = await getCommandPrefixStatic(args.slice(i3).join(" "), recursionDepth + 1, wrapperCount + 1);
@@ -515486,14 +516210,14 @@ async function handleWrapper(command8, args, recursionDepth, wrapperCount) {
515486
516210
  }
515487
516211
  const wrapped = args.find((arg) => !arg.startsWith("-") && !NUMERIC.test(arg) && !ENV_VAR.test(arg));
515488
516212
  if (!wrapped)
515489
- return command8;
516213
+ return command9;
515490
516214
  const result = await getCommandPrefixStatic(args.slice(args.indexOf(wrapped)).join(" "), recursionDepth + 1, wrapperCount + 1);
515491
- return !result?.commandPrefix ? null : `${command8} ${result.commandPrefix}`;
516215
+ return !result?.commandPrefix ? null : `${command9} ${result.commandPrefix}`;
515492
516216
  }
515493
- async function getCompoundCommandPrefixesStatic(command8, excludeSubcommand) {
515494
- const subcommands = splitCommand_DEPRECATED(command8);
516217
+ async function getCompoundCommandPrefixesStatic(command9, excludeSubcommand) {
516218
+ const subcommands = splitCommand_DEPRECATED(command9);
515495
516219
  if (subcommands.length <= 1) {
515496
- const result = await getCommandPrefixStatic(command8);
516220
+ const result = await getCommandPrefixStatic(command9);
515497
516221
  return result?.commandPrefix ? [result.commandPrefix] : [];
515498
516222
  }
515499
516223
  const prefixes = [];
@@ -517174,7 +517898,7 @@ var init_FileEditToolDiff = __esm(() => {
517174
517898
 
517175
517899
  // src/hooks/useDiffInIDE.ts
517176
517900
  import { randomUUID as randomUUID34 } from "crypto";
517177
- import { basename as basename49 } from "path";
517901
+ import { basename as basename48 } from "path";
517178
517902
  function useDiffInIDE({
517179
517903
  onChange,
517180
517904
  toolUseContext,
@@ -517185,7 +517909,7 @@ function useDiffInIDE({
517185
517909
  const isUnmounted = import_react211.useRef(false);
517186
517910
  const [hasError, setHasError] = import_react211.useState(false);
517187
517911
  const sha = import_react211.useMemo(() => randomUUID34().slice(0, 6), []);
517188
- const tabName = import_react211.useMemo(() => `✻ [Claude Code] ${basename49(filePath)} (${sha}) ⧉`, [filePath, sha]);
517912
+ const tabName = import_react211.useMemo(() => `✻ [Claude Code] ${basename48(filePath)} (${sha}) ⧉`, [filePath, sha]);
517189
517913
  const shouldShowDiffInIDE = hasAccessToIDEExtensionDiffFeature(toolUseContext.options.mcpClients) && getGlobalConfig().diffTool === "auto" && !filePath.endsWith(".ipynb");
517190
517914
  const ideName = getConnectedIdeName(toolUseContext.options.mcpClients) ?? "IDE";
517191
517915
  async function showDiff() {
@@ -517367,7 +518091,7 @@ var init_useDiffInIDE = __esm(() => {
517367
518091
  });
517368
518092
 
517369
518093
  // src/components/ShowInIDEPrompt.tsx
517370
- import { basename as basename50, relative as relative30 } from "path";
518094
+ import { basename as basename49, relative as relative30 } from "path";
517371
518095
  function ShowInIDEPrompt(t0) {
517372
518096
  const $3 = import_compiler_runtime295.c(36);
517373
518097
  const {
@@ -517424,7 +518148,7 @@ function ShowInIDEPrompt(t0) {
517424
518148
  }
517425
518149
  let t4;
517426
518150
  if ($3[5] !== filePath) {
517427
- t4 = basename50(filePath);
518151
+ t4 = basename49(filePath);
517428
518152
  $3[5] = filePath;
517429
518153
  $3[6] = t4;
517430
518154
  } else {
@@ -517585,7 +518309,7 @@ var init_ShowInIDEPrompt = __esm(() => {
517585
518309
 
517586
518310
  // src/components/permissions/FilePermissionDialog/permissionOptions.tsx
517587
518311
  import { homedir as homedir36 } from "os";
517588
- import { basename as basename51, join as join148, sep as sep39 } from "path";
518312
+ import { basename as basename50, join as join148, sep as sep39 } from "path";
517589
518313
  function isInClaudeFolder(filePath) {
517590
518314
  const absolutePath = expandPath(filePath);
517591
518315
  const claudeFolderPath = expandPath(`${getOriginalCwd()}/.claude`);
@@ -517667,7 +518391,7 @@ function getFilePermissionOptions({
517667
518391
  }
517668
518392
  } else {
517669
518393
  const dirPath = getDirectoryForPath(filePath);
517670
- const dirName = basename51(dirPath) || "this directory";
518394
+ const dirName = basename50(dirPath) || "this directory";
517671
518395
  if (operationType === "read") {
517672
518396
  sessionLabel = /* @__PURE__ */ jsx_dev_runtime379.jsxDEV(ThemedText, {
517673
518397
  children: [
@@ -518166,7 +518890,7 @@ var init_FilePermissionDialog = __esm(() => {
518166
518890
  });
518167
518891
 
518168
518892
  // src/components/permissions/SedEditPermissionRequest/SedEditPermissionRequest.tsx
518169
- import { basename as basename52, relative as relative32 } from "path";
518893
+ import { basename as basename51, relative as relative32 } from "path";
518170
518894
  function SedEditPermissionRequest(t0) {
518171
518895
  const $3 = import_compiler_runtime296.c(9);
518172
518896
  let props;
@@ -518342,7 +519066,7 @@ function SedEditPermissionRequestInner(t0) {
518342
519066
  }
518343
519067
  let t10;
518344
519068
  if ($3[16] !== filePath) {
518345
- t10 = basename52(filePath);
519069
+ t10 = basename51(filePath);
518346
519070
  $3[16] = filePath;
518347
519071
  $3[17] = t10;
518348
519072
  } else {
@@ -518554,7 +519278,7 @@ var init_useShellPermissionFeedback = __esm(() => {
518554
519278
  });
518555
519279
 
518556
519280
  // src/components/permissions/shellPermissionHelpers.tsx
518557
- import { basename as basename53, sep as sep40 } from "path";
519281
+ import { basename as basename52, sep as sep40 } from "path";
518558
519282
  function commandListDisplay(commands) {
518559
519283
  switch (commands.length) {
518560
519284
  case 0:
@@ -518605,7 +519329,7 @@ function commandListDisplayTruncated(commands) {
518605
519329
  function formatPathList(paths2) {
518606
519330
  if (paths2.length === 0)
518607
519331
  return "";
518608
- const names = paths2.map((p) => basename53(p) || p);
519332
+ const names = paths2.map((p) => basename52(p) || p);
518609
519333
  if (names.length === 1) {
518610
519334
  return /* @__PURE__ */ jsx_dev_runtime382.jsxDEV(ThemedText, {
518611
519335
  children: [
@@ -518662,8 +519386,8 @@ function generateShellSuggestionsLabel(suggestions, shellToolName, commandTransf
518662
519386
  const shellCommands = [...new Set(shellRules.flatMap((rule) => {
518663
519387
  if (!rule.ruleContent)
518664
519388
  return [];
518665
- const command8 = permissionRuleExtractPrefix2(rule.ruleContent) ?? rule.ruleContent;
518666
- return commandTransform ? commandTransform(command8) : command8;
519389
+ const command9 = permissionRuleExtractPrefix2(rule.ruleContent) ?? rule.ruleContent;
519390
+ return commandTransform ? commandTransform(command9) : command9;
518667
519391
  }))];
518668
519392
  const hasDirectories = directories.length > 0;
518669
519393
  const hasReadPaths = readPaths.length > 0;
@@ -518671,7 +519395,7 @@ function generateShellSuggestionsLabel(suggestions, shellToolName, commandTransf
518671
519395
  if (hasReadPaths && !hasDirectories && !hasCommands) {
518672
519396
  if (readPaths.length === 1) {
518673
519397
  const firstPath = readPaths[0];
518674
- const dirName = basename53(firstPath) || firstPath;
519398
+ const dirName = basename52(firstPath) || firstPath;
518675
519399
  return /* @__PURE__ */ jsx_dev_runtime382.jsxDEV(ThemedText, {
518676
519400
  children: [
518677
519401
  "Yes, allow reading from ",
@@ -518695,7 +519419,7 @@ function generateShellSuggestionsLabel(suggestions, shellToolName, commandTransf
518695
519419
  if (hasDirectories && !hasReadPaths && !hasCommands) {
518696
519420
  if (directories.length === 1) {
518697
519421
  const firstDir = directories[0];
518698
- const dirName = basename53(firstDir) || firstDir;
519422
+ const dirName = basename52(firstDir) || firstDir;
518699
519423
  return /* @__PURE__ */ jsx_dev_runtime382.jsxDEV(ThemedText, {
518700
519424
  children: [
518701
519425
  "Yes, and always allow access to ",
@@ -518778,12 +519502,12 @@ var init_shellPermissionHelpers = __esm(() => {
518778
519502
  });
518779
519503
 
518780
519504
  // src/components/permissions/BashPermissionRequest/bashToolUseOptions.tsx
518781
- function stripBashRedirections(command8) {
519505
+ function stripBashRedirections(command9) {
518782
519506
  const {
518783
519507
  commandWithoutRedirections,
518784
519508
  redirections
518785
- } = extractOutputRedirections(command8);
518786
- return redirections.length > 0 ? commandWithoutRedirections : command8;
519509
+ } = extractOutputRedirections(command9);
519510
+ return redirections.length > 0 ? commandWithoutRedirections : command9;
518787
519511
  }
518788
519512
  function bashToolUseOptions({
518789
519513
  suggestions = [],
@@ -518876,21 +519600,21 @@ function BashPermissionRequest(props) {
518876
519600
  verbose,
518877
519601
  workerBadge
518878
519602
  } = props;
518879
- let command8;
519603
+ let command9;
518880
519604
  let description;
518881
519605
  let t0;
518882
519606
  if ($3[0] !== toolUseConfirm.input) {
518883
519607
  ({
518884
- command: command8,
519608
+ command: command9,
518885
519609
  description
518886
519610
  } = BashTool.inputSchema.parse(toolUseConfirm.input));
518887
- t0 = parseSedEditCommand(command8);
519611
+ t0 = parseSedEditCommand(command9);
518888
519612
  $3[0] = toolUseConfirm.input;
518889
- $3[1] = command8;
519613
+ $3[1] = command9;
518890
519614
  $3[2] = description;
518891
519615
  $3[3] = t0;
518892
519616
  } else {
518893
- command8 = $3[1];
519617
+ command9 = $3[1];
518894
519618
  description = $3[2];
518895
519619
  t0 = $3[3];
518896
519620
  }
@@ -518921,7 +519645,7 @@ function BashPermissionRequest(props) {
518921
519645
  return t12;
518922
519646
  }
518923
519647
  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) {
519648
+ 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
519649
  t1 = /* @__PURE__ */ jsx_dev_runtime383.jsxDEV(BashPermissionRequestInner, {
518926
519650
  toolUseConfirm,
518927
519651
  toolUseContext,
@@ -518929,10 +519653,10 @@ function BashPermissionRequest(props) {
518929
519653
  onReject,
518930
519654
  verbose,
518931
519655
  workerBadge,
518932
- command: command8,
519656
+ command: command9,
518933
519657
  description
518934
519658
  }, undefined, false, undefined, this);
518935
- $3[12] = command8;
519659
+ $3[12] = command9;
518936
519660
  $3[13] = description;
518937
519661
  $3[14] = onDone;
518938
519662
  $3[15] = onReject;
@@ -518953,7 +519677,7 @@ function BashPermissionRequestInner({
518953
519677
  onReject,
518954
519678
  verbose: _verbose,
518955
519679
  workerBadge,
518956
- command: command8,
519680
+ command: command9,
518957
519681
  description
518958
519682
  }) {
518959
519683
  const [theme2] = useTheme();
@@ -518990,27 +519714,27 @@ function BashPermissionRequestInner({
518990
519714
  if (!isClassifierPermissionsEnabled())
518991
519715
  return;
518992
519716
  const abortController = new AbortController;
518993
- generateGenericDescription(command8, description, abortController.signal).then((generic) => {
519717
+ generateGenericDescription(command9, description, abortController.signal).then((generic) => {
518994
519718
  if (generic && !abortController.signal.aborted) {
518995
519719
  setClassifierDescription(generic);
518996
519720
  setInitialClassifierDescriptionEmpty(false);
518997
519721
  }
518998
519722
  }).catch(() => {});
518999
519723
  return () => abortController.abort();
519000
- }, [command8, description]);
519724
+ }, [command9, description]);
519001
519725
  const isCompound = toolUseConfirm.permissionResult.decisionReason?.type === "subcommandResults";
519002
519726
  const [editablePrefix, setEditablePrefix] = import_react216.useState(() => {
519003
519727
  if (isCompound) {
519004
519728
  const backendBashRules = extractRules("suggestions" in toolUseConfirm.permissionResult ? toolUseConfirm.permissionResult.suggestions : undefined).filter((r) => r.toolName === BashTool.name && r.ruleContent);
519005
519729
  return backendBashRules.length === 1 ? backendBashRules[0].ruleContent : undefined;
519006
519730
  }
519007
- const two = getSimpleCommandPrefix(command8);
519731
+ const two = getSimpleCommandPrefix(command9);
519008
519732
  if (two)
519009
519733
  return `${two}:*`;
519010
- const one = getFirstWordPrefix(command8);
519734
+ const one = getFirstWordPrefix(command9);
519011
519735
  if (one)
519012
519736
  return `${one}:*`;
519013
- return command8;
519737
+ return command9;
519014
519738
  });
519015
519739
  const hasUserEditedPrefix = import_react216.useRef(false);
519016
519740
  const onEditablePrefixChange = import_react216.useCallback((value) => {
@@ -519021,7 +519745,7 @@ function BashPermissionRequestInner({
519021
519745
  if (isCompound)
519022
519746
  return;
519023
519747
  let cancelled = false;
519024
- getCompoundCommandPrefixesStatic(command8, (subcmd) => BashTool.isReadOnly({
519748
+ getCompoundCommandPrefixesStatic(command9, (subcmd) => BashTool.isReadOnly({
519025
519749
  command: subcmd
519026
519750
  })).then((prefixes) => {
519027
519751
  if (cancelled || hasUserEditedPrefix.current)
@@ -519033,14 +519757,14 @@ function BashPermissionRequestInner({
519033
519757
  return () => {
519034
519758
  cancelled = true;
519035
519759
  };
519036
- }, [command8, isCompound]);
519760
+ }, [command9, isCompound]);
519037
519761
  const [classifierWasChecking] = import_react216.useState(false);
519038
519762
  const {
519039
519763
  destructiveWarning: destructiveWarning_0,
519040
519764
  sandboxingEnabled: sandboxingEnabled_0,
519041
519765
  isSandboxed: isSandboxed_0
519042
519766
  } = import_react216.useMemo(() => {
519043
- const destructiveWarning = getFeatureValue_CACHED_MAY_BE_STALE("tengu_destructive_command_warning", false) ? getDestructiveCommandWarning(command8) : null;
519767
+ const destructiveWarning = getFeatureValue_CACHED_MAY_BE_STALE("tengu_destructive_command_warning", false) ? getDestructiveCommandWarning(command9) : null;
519044
519768
  const sandboxingEnabled = SandboxManager2.isSandboxingEnabled();
519045
519769
  const isSandboxed = sandboxingEnabled && shouldUseSandbox(toolUseConfirm.input);
519046
519770
  return {
@@ -519048,7 +519772,7 @@ function BashPermissionRequestInner({
519048
519772
  sandboxingEnabled,
519049
519773
  isSandboxed
519050
519774
  };
519051
- }, [command8, toolUseConfirm.input]);
519775
+ }, [command9, toolUseConfirm.input]);
519052
519776
  const unaryEvent = import_react216.useMemo(() => ({
519053
519777
  completion_type: "tool_use_single",
519054
519778
  language_name: "none"
@@ -519166,7 +519890,7 @@ function BashPermissionRequestInner({
519166
519890
  /* @__PURE__ */ jsx_dev_runtime383.jsxDEV(ThemedText, {
519167
519891
  dimColor: explainerState.visible,
519168
519892
  children: BashTool.renderToolUseMessage({
519169
- command: command8,
519893
+ command: command9,
519170
519894
  description
519171
519895
  }, {
519172
519896
  theme: theme2,
@@ -520935,7 +521659,7 @@ function createSingleEditDiffConfig(filePath, oldString, newString, replaceAll)
520935
521659
  }
520936
521660
 
520937
521661
  // src/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.tsx
520938
- import { basename as basename54, relative as relative33 } from "path";
521662
+ import { basename as basename53, relative as relative33 } from "path";
520939
521663
  function FileEditPermissionRequest(props) {
520940
521664
  const $3 = import_compiler_runtime301.c(51);
520941
521665
  const parseInput = _temp178;
@@ -520978,7 +521702,7 @@ function FileEditPermissionRequest(props) {
520978
521702
  t3 = " ";
520979
521703
  T0 = ThemedText;
520980
521704
  t0 = true;
520981
- t1 = basename54(file_path);
521705
+ t1 = basename53(file_path);
520982
521706
  $3[0] = props.onDone;
520983
521707
  $3[1] = props.onReject;
520984
521708
  $3[2] = props.toolUseConfirm;
@@ -521405,7 +522129,7 @@ var init_FileWriteToolDiff = __esm(() => {
521405
522129
  });
521406
522130
 
521407
522131
  // src/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.tsx
521408
- import { basename as basename55, relative as relative34 } from "path";
522132
+ import { basename as basename54, relative as relative34 } from "path";
521409
522133
  function FileWritePermissionRequest(props) {
521410
522134
  const $3 = import_compiler_runtime304.c(30);
521411
522135
  const parseInput = _temp181;
@@ -521472,7 +522196,7 @@ function FileWritePermissionRequest(props) {
521472
522196
  }
521473
522197
  let t9;
521474
522198
  if ($3[7] !== file_path) {
521475
- t9 = basename55(file_path);
522199
+ t9 = basename54(file_path);
521476
522200
  $3[7] = file_path;
521477
522201
  $3[8] = t9;
521478
522202
  } else {
@@ -521877,7 +522601,7 @@ var init_NotebookEditToolDiff = __esm(() => {
521877
522601
  });
521878
522602
 
521879
522603
  // src/components/permissions/NotebookEditPermissionRequest/NotebookEditPermissionRequest.tsx
521880
- import { basename as basename56 } from "path";
522604
+ import { basename as basename55 } from "path";
521881
522605
  function NotebookEditPermissionRequest(props) {
521882
522606
  const $3 = import_compiler_runtime306.c(52);
521883
522607
  const parseInput = _temp185;
@@ -521921,7 +522645,7 @@ function NotebookEditPermissionRequest(props) {
521921
522645
  t4 = " ";
521922
522646
  T0 = ThemedText;
521923
522647
  t0 = true;
521924
- t1 = basename56(notebook_path);
522648
+ t1 = basename55(notebook_path);
521925
522649
  $3[0] = props.onDone;
521926
522650
  $3[1] = props.onReject;
521927
522651
  $3[2] = props.toolUseConfirm;
@@ -522076,9 +522800,9 @@ var init_NotebookEditPermissionRequest = __esm(() => {
522076
522800
  });
522077
522801
 
522078
522802
  // src/tools/PowerShellTool/destructiveCommandWarning.ts
522079
- function getDestructiveCommandWarning2(command8) {
522803
+ function getDestructiveCommandWarning2(command9) {
522080
522804
  for (const { pattern, warning } of DESTRUCTIVE_PATTERNS2) {
522081
- if (pattern.test(command8)) {
522805
+ if (pattern.test(command9)) {
522082
522806
  return warning;
522083
522807
  }
522084
522808
  }
@@ -522207,8 +522931,8 @@ async function extractPrefixFromElement(cmd) {
522207
522931
  }
522208
522932
  return prefix;
522209
522933
  }
522210
- async function getCompoundCommandPrefixesStatic2(command8, excludeSubcommand) {
522211
- const parsed = await parsePowerShellCommandCached(command8);
522934
+ async function getCompoundCommandPrefixesStatic2(command9, excludeSubcommand) {
522935
+ const parsed = await parsePowerShellCommandCached(command9);
522212
522936
  if (!parsed.valid) {
522213
522937
  return [];
522214
522938
  }
@@ -522365,7 +523089,7 @@ function PowerShellPermissionRequest(props) {
522365
523089
  workerBadge
522366
523090
  } = props;
522367
523091
  const {
522368
- command: command8,
523092
+ command: command9,
522369
523093
  description
522370
523094
  } = PowerShellTool.inputSchema.parse(toolUseConfirm.input);
522371
523095
  const [theme2] = useTheme();
@@ -522394,14 +523118,14 @@ function PowerShellPermissionRequest(props) {
522394
523118
  onReject,
522395
523119
  explainerVisible: explainerState.visible
522396
523120
  });
522397
- const destructiveWarning = getFeatureValue_CACHED_MAY_BE_STALE("tengu_destructive_command_warning", false) ? getDestructiveCommandWarning2(command8) : null;
523121
+ const destructiveWarning = getFeatureValue_CACHED_MAY_BE_STALE("tengu_destructive_command_warning", false) ? getDestructiveCommandWarning2(command9) : null;
522398
523122
  const [showPermissionDebug, setShowPermissionDebug] = import_react220.useState(false);
522399
- const [editablePrefix, setEditablePrefix] = import_react220.useState(command8.includes(`
522400
- `) ? undefined : command8);
523123
+ const [editablePrefix, setEditablePrefix] = import_react220.useState(command9.includes(`
523124
+ `) ? undefined : command9);
522401
523125
  const hasUserEditedPrefix = import_react220.useRef(false);
522402
523126
  import_react220.useEffect(() => {
522403
523127
  let cancelled = false;
522404
- getCompoundCommandPrefixesStatic2(command8, (element) => isAllowlistedCommand(element, element.text)).then((prefixes) => {
523128
+ getCompoundCommandPrefixesStatic2(command9, (element) => isAllowlistedCommand(element, element.text)).then((prefixes) => {
522405
523129
  if (cancelled || hasUserEditedPrefix.current)
522406
523130
  return;
522407
523131
  if (prefixes.length > 0) {
@@ -522411,7 +523135,7 @@ function PowerShellPermissionRequest(props) {
522411
523135
  return () => {
522412
523136
  cancelled = true;
522413
523137
  };
522414
- }, [command8]);
523138
+ }, [command9]);
522415
523139
  const onEditablePrefixChange = import_react220.useCallback((value) => {
522416
523140
  hasUserEditedPrefix.current = true;
522417
523141
  setEditablePrefix(value);
@@ -522516,7 +523240,7 @@ function PowerShellPermissionRequest(props) {
522516
523240
  /* @__PURE__ */ jsx_dev_runtime394.jsxDEV(ThemedText, {
522517
523241
  dimColor: explainerState.visible,
522518
523242
  children: PowerShellTool.renderToolUseMessage({
522519
- command: command8,
523243
+ command: command9,
522520
523244
  description
522521
523245
  }, {
522522
523246
  theme: theme2,
@@ -526399,7 +527123,7 @@ var init_AutoUpdaterWrapper = __esm(() => {
526399
527123
  });
526400
527124
 
526401
527125
  // src/components/IdeStatusIndicator.tsx
526402
- import { basename as basename57 } from "path";
527126
+ import { basename as basename56 } from "path";
526403
527127
  function IdeStatusIndicator(t0) {
526404
527128
  const $3 = import_compiler_runtime316.c(7);
526405
527129
  const {
@@ -526439,7 +527163,7 @@ function IdeStatusIndicator(t0) {
526439
527163
  if (ideSelection.filePath) {
526440
527164
  let t1;
526441
527165
  if ($3[3] !== ideSelection.filePath) {
526442
- t1 = basename57(ideSelection.filePath);
527166
+ t1 = basename56(ideSelection.filePath);
526443
527167
  $3[3] = ideSelection.filePath;
526444
527168
  $3[4] = t1;
526445
527169
  } else {
@@ -527736,15 +528460,15 @@ function getZshCompletionCommand(prefix, completionType) {
527736
528460
  }
527737
528461
  }
527738
528462
  async function getCompletionsForShell(shellType, prefix, completionType, abortSignal) {
527739
- let command8;
528463
+ let command9;
527740
528464
  if (shellType === "bash") {
527741
- command8 = getBashCompletionCommand(prefix, completionType);
528465
+ command9 = getBashCompletionCommand(prefix, completionType);
527742
528466
  } else if (shellType === "zsh") {
527743
- command8 = getZshCompletionCommand(prefix, completionType);
528467
+ command9 = getZshCompletionCommand(prefix, completionType);
527744
528468
  } else {
527745
528469
  return [];
527746
528470
  }
527747
- const shellCommand = await exec3(command8, abortSignal, "bash", {
528471
+ const shellCommand = await exec3(command9, abortSignal, "bash", {
527748
528472
  timeout: SHELL_COMPLETION_TIMEOUT_MS
527749
528473
  });
527750
528474
  const result = await shellCommand.result;
@@ -527917,21 +528641,21 @@ function get2(obj, path26) {
527917
528641
  return arr ? list : list[0];
527918
528642
  }
527919
528643
  function norm(weight = 1, mantissa = 3) {
527920
- const cache4 = new Map;
528644
+ const cache5 = new Map;
527921
528645
  const m2 = Math.pow(10, mantissa);
527922
528646
  return {
527923
528647
  get(value) {
527924
528648
  const numTokens = value.match(SPACE).length;
527925
- if (cache4.has(numTokens)) {
527926
- return cache4.get(numTokens);
528649
+ if (cache5.has(numTokens)) {
528650
+ return cache5.get(numTokens);
527927
528651
  }
527928
528652
  const norm2 = 1 / Math.pow(numTokens, 0.5 * weight);
527929
528653
  const n3 = parseFloat(Math.round(norm2 * m2) / m2);
527930
- cache4.set(numTokens, n3);
528654
+ cache5.set(numTokens, n3);
527931
528655
  return n3;
527932
528656
  },
527933
528657
  clear() {
527934
- cache4.clear();
528658
+ cache5.clear();
527935
528659
  }
527936
528660
  };
527937
528661
  }
@@ -529168,8 +529892,8 @@ function hasCommandArgs(input) {
529168
529892
  return false;
529169
529893
  return true;
529170
529894
  }
529171
- function formatCommand(command8) {
529172
- return `/${command8} `;
529895
+ function formatCommand(command9) {
529896
+ return `/${command9} `;
529173
529897
  }
529174
529898
  function getCommandId2(cmd) {
529175
529899
  const commandName = getCommandName(cmd);
@@ -529369,7 +530093,7 @@ var init_commandSuggestions = __esm(() => {
529369
530093
  // src/utils/suggestions/shellHistoryCompletion.ts
529370
530094
  async function getShellHistoryCommands() {
529371
530095
  const now2 = Date.now();
529372
- if (shellHistoryCache && now2 - shellHistoryCacheTimestamp < CACHE_TTL_MS5) {
530096
+ if (shellHistoryCache && now2 - shellHistoryCacheTimestamp < CACHE_TTL_MS6) {
529373
530097
  return shellHistoryCache;
529374
530098
  }
529375
530099
  const commands = [];
@@ -529377,10 +530101,10 @@ async function getShellHistoryCommands() {
529377
530101
  try {
529378
530102
  for await (const entry of getHistory()) {
529379
530103
  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);
530104
+ const command9 = entry.display.slice(1).trim();
530105
+ if (command9 && !seen.has(command9)) {
530106
+ seen.add(command9);
530107
+ commands.push(command9);
529384
530108
  }
529385
530109
  }
529386
530110
  if (commands.length >= 50) {
@@ -529394,15 +530118,15 @@ async function getShellHistoryCommands() {
529394
530118
  shellHistoryCacheTimestamp = now2;
529395
530119
  return commands;
529396
530120
  }
529397
- function prependToShellHistoryCache(command8) {
530121
+ function prependToShellHistoryCache(command9) {
529398
530122
  if (!shellHistoryCache) {
529399
530123
  return;
529400
530124
  }
529401
- const idx = shellHistoryCache.indexOf(command8);
530125
+ const idx = shellHistoryCache.indexOf(command9);
529402
530126
  if (idx !== -1) {
529403
530127
  shellHistoryCache.splice(idx, 1);
529404
530128
  }
529405
- shellHistoryCache.unshift(command8);
530129
+ shellHistoryCache.unshift(command9);
529406
530130
  }
529407
530131
  async function getShellHistoryCompletion(input) {
529408
530132
  if (!input || input.length < 2) {
@@ -529413,17 +530137,17 @@ async function getShellHistoryCompletion(input) {
529413
530137
  return null;
529414
530138
  }
529415
530139
  const commands = await getShellHistoryCommands();
529416
- for (const command8 of commands) {
529417
- if (command8.startsWith(input) && command8 !== input) {
530140
+ for (const command9 of commands) {
530141
+ if (command9.startsWith(input) && command9 !== input) {
529418
530142
  return {
529419
- fullCommand: command8,
529420
- suffix: command8.slice(input.length)
530143
+ fullCommand: command9,
530144
+ suffix: command9.slice(input.length)
529421
530145
  };
529422
530146
  }
529423
530147
  }
529424
530148
  return null;
529425
530149
  }
529426
- var shellHistoryCache = null, shellHistoryCacheTimestamp = 0, CACHE_TTL_MS5 = 60000;
530150
+ var shellHistoryCache = null, shellHistoryCacheTimestamp = 0, CACHE_TTL_MS6 = 60000;
529427
530151
  var init_shellHistoryCompletion = __esm(() => {
529428
530152
  init_history();
529429
530153
  init_debug();
@@ -529507,7 +530231,7 @@ function mcpQueryFor(searchToken) {
529507
530231
  function findReusableCacheEntry(mcpQuery, searchToken) {
529508
530232
  let best;
529509
530233
  let bestLen = 0;
529510
- for (const [key2, channels] of cache4) {
530234
+ for (const [key2, channels] of cache5) {
529511
530235
  if (mcpQuery.startsWith(key2) && key2.length > bestLen && channels.some((c6) => c6.startsWith(searchToken))) {
529512
530236
  best = channels;
529513
530237
  bestLen = key2.length;
@@ -529520,7 +530244,7 @@ async function getSlackChannelSuggestions(clients, searchToken) {
529520
530244
  return [];
529521
530245
  const mcpQuery = mcpQueryFor(searchToken);
529522
530246
  const lower = searchToken.toLowerCase();
529523
- let channels = cache4.get(mcpQuery) ?? findReusableCacheEntry(mcpQuery, lower);
530247
+ let channels = cache5.get(mcpQuery) ?? findReusableCacheEntry(mcpQuery, lower);
529524
530248
  if (!channels) {
529525
530249
  if (inflightQuery === mcpQuery && inflightPromise) {
529526
530250
  channels = await inflightPromise;
@@ -529528,7 +530252,7 @@ async function getSlackChannelSuggestions(clients, searchToken) {
529528
530252
  inflightQuery = mcpQuery;
529529
530253
  inflightPromise = fetchChannels(clients, mcpQuery);
529530
530254
  channels = await inflightPromise;
529531
- cache4.set(mcpQuery, channels);
530255
+ cache5.set(mcpQuery, channels);
529532
530256
  const before = knownChannels.size;
529533
530257
  for (const c6 of channels)
529534
530258
  knownChannels.add(c6);
@@ -529536,8 +530260,8 @@ async function getSlackChannelSuggestions(clients, searchToken) {
529536
530260
  knownChannelsVersion++;
529537
530261
  knownChannelsChanged.emit();
529538
530262
  }
529539
- if (cache4.size > 50) {
529540
- cache4.delete(cache4.keys().next().value);
530263
+ if (cache5.size > 50) {
530264
+ cache5.delete(cache5.keys().next().value);
529541
530265
  }
529542
530266
  if (inflightQuery === mcpQuery) {
529543
530267
  inflightQuery = null;
@@ -529550,12 +530274,12 @@ async function getSlackChannelSuggestions(clients, searchToken) {
529550
530274
  displayText: `#${c6}`
529551
530275
  }));
529552
530276
  }
529553
- var SLACK_SEARCH_TOOL = "slack_search_channels", cache4, knownChannels, knownChannelsVersion = 0, knownChannelsChanged, subscribeKnownChannels, inflightQuery = null, inflightPromise = null, resultsEnvelopeSchema;
530277
+ var SLACK_SEARCH_TOOL = "slack_search_channels", cache5, knownChannels, knownChannelsVersion = 0, knownChannelsChanged, subscribeKnownChannels, inflightQuery = null, inflightPromise = null, resultsEnvelopeSchema;
529554
530278
  var init_slackChannelSuggestions = __esm(() => {
529555
530279
  init_zod3();
529556
530280
  init_debug();
529557
530281
  init_slowOperations();
529558
- cache4 = new Map;
530282
+ cache5 = new Map;
529559
530283
  knownChannels = new Set;
529560
530284
  knownChannelsChanged = createSignal();
529561
530285
  subscribeKnownChannels = knownChannelsChanged.subscribe;
@@ -529563,7 +530287,7 @@ var init_slackChannelSuggestions = __esm(() => {
529563
530287
  });
529564
530288
 
529565
530289
  // src/hooks/unifiedSuggestions.ts
529566
- import { basename as basename58 } from "path";
530290
+ import { basename as basename57 } from "path";
529567
530291
  function createSuggestionFromSource(source) {
529568
530292
  switch (source.type) {
529569
530293
  case "file":
@@ -529595,18 +530319,18 @@ function generateAgentSuggestions(agents2, query3, showOnEmpty = false) {
529595
530319
  return [];
529596
530320
  }
529597
530321
  try {
529598
- const agentSources = agents2.map((agent) => ({
530322
+ const agentSources = agents2.map((agent2) => ({
529599
530323
  type: "agent",
529600
- displayText: `${agent.agentType} (agent)`,
529601
- description: truncateDescription(agent.whenToUse),
529602
- agentType: agent.agentType,
529603
- color: getAgentColor(agent.agentType)
530324
+ displayText: `${agent2.agentType} (agent)`,
530325
+ description: truncateDescription(agent2.whenToUse),
530326
+ agentType: agent2.agentType,
530327
+ color: getAgentColor(agent2.agentType)
529604
530328
  }));
529605
530329
  if (!query3) {
529606
530330
  return agentSources;
529607
530331
  }
529608
530332
  const queryLower = query3.toLowerCase();
529609
- return agentSources.filter((agent) => agent.agentType.toLowerCase().includes(queryLower) || agent.displayText.toLowerCase().includes(queryLower));
530333
+ return agentSources.filter((agent2) => agent2.agentType.toLowerCase().includes(queryLower) || agent2.displayText.toLowerCase().includes(queryLower));
529610
530334
  } catch (error49) {
529611
530335
  logError2(error49);
529612
530336
  return [];
@@ -529625,7 +530349,7 @@ async function generateUnifiedSuggestions(query3, mcpResources, agents2, showOnE
529625
530349
  displayText: suggestion.displayText,
529626
530350
  description: suggestion.description,
529627
530351
  path: suggestion.displayText,
529628
- filename: basename58(suggestion.displayText),
530352
+ filename: basename57(suggestion.displayText),
529629
530353
  score: suggestion.metadata?.score
529630
530354
  }));
529631
530355
  const mcpSources = Object.values(mcpResources).flat().map((resource) => ({
@@ -530839,7 +531563,7 @@ var init_AutoModeOptInDialog = __esm(() => {
530839
531563
  });
530840
531564
 
530841
531565
  // src/components/BridgeDialog.tsx
530842
- import { basename as basename59 } from "path";
531566
+ import { basename as basename58 } from "path";
530843
531567
  function BridgeDialog(t0) {
530844
531568
  const $3 = import_compiler_runtime321.c(87);
530845
531569
  const {
@@ -530862,7 +531586,7 @@ function BridgeDialog(t0) {
530862
531586
  const [branchName, setBranchName] = import_react243.useState("");
530863
531587
  let t1;
530864
531588
  if ($3[0] === Symbol.for("react.memo_cache_sentinel")) {
530865
- t1 = basename59(getOriginalCwd());
531589
+ t1 = basename58(getOriginalCwd());
530866
531590
  $3[0] = t1;
530867
531591
  } else {
530868
531592
  t1 = $3[0];
@@ -536013,7 +536737,7 @@ var init_standaloneAgent = __esm(() => {
536013
536737
  function useSwarmBanner() {
536014
536738
  const teamContext = useAppState((s) => s.teamContext);
536015
536739
  const standaloneAgentContext = useAppState((s) => s.standaloneAgentContext);
536016
- const agent = useAppState((s) => s.agent);
536740
+ const agent2 = useAppState((s) => s.agent);
536017
536741
  useAppState((s) => s.viewingAgentTaskId);
536018
536742
  const store = useAppStateStore();
536019
536743
  const [insideTmux, setInsideTmux] = React141.useState(null);
@@ -536072,10 +536796,10 @@ function useSwarmBanner() {
536072
536796
  bgColor: toThemeColor(standaloneColor)
536073
536797
  };
536074
536798
  }
536075
- if (agent) {
536076
- const agentDef = state2.agentDefinitions.activeAgents.find((a2) => a2.agentType === agent);
536799
+ if (agent2) {
536800
+ const agentDef = state2.agentDefinitions.activeAgents.find((a2) => a2.agentType === agent2);
536077
536801
  return {
536078
- text: agent,
536802
+ text: agent2,
536079
536803
  bgColor: toThemeColor(agentDef?.color, "promptBorder")
536080
536804
  };
536081
536805
  }
@@ -541353,7 +542077,7 @@ var init_coordinatorHandler = __esm(() => {
541353
542077
  });
541354
542078
 
541355
542079
  // src/hooks/toolPermission/PermissionContext.ts
541356
- function createResolveOnce(resolve48) {
542080
+ function createResolveOnce(resolve47) {
541357
542081
  let claimed = false;
541358
542082
  let delivered = false;
541359
542083
  return {
@@ -541362,7 +542086,7 @@ function createResolveOnce(resolve48) {
541362
542086
  return;
541363
542087
  delivered = true;
541364
542088
  claimed = true;
541365
- resolve48(value);
542089
+ resolve47(value);
541366
542090
  },
541367
542091
  isResolved() {
541368
542092
  return claimed;
@@ -541407,11 +542131,11 @@ function createPermissionContext(tool, input, toolUseContext, assistantMessage,
541407
542131
  setToolPermissionContext(applyPermissionUpdates(appState.toolPermissionContext, updates));
541408
542132
  return updates.some((update) => supportsPersistence(update.destination));
541409
542133
  },
541410
- resolveIfAborted(resolve48) {
542134
+ resolveIfAborted(resolve47) {
541411
542135
  if (!toolUseContext.abortController.signal.aborted)
541412
542136
  return false;
541413
542137
  this.logCancelled();
541414
- resolve48(this.cancelAndAbort(undefined, true));
542138
+ resolve47(this.cancelAndAbort(undefined, true));
541415
542139
  return true;
541416
542140
  },
541417
542141
  cancelAndAbort(feedback2, isAbort, contentBlocks) {
@@ -541527,7 +542251,7 @@ var init_PermissionContext = __esm(() => {
541527
542251
 
541528
542252
  // src/hooks/toolPermission/handlers/interactiveHandler.ts
541529
542253
  import { randomUUID as randomUUID40 } from "crypto";
541530
- function handleInteractivePermission(params, resolve48) {
542254
+ function handleInteractivePermission(params, resolve47) {
541531
542255
  const {
541532
542256
  ctx,
541533
542257
  description,
@@ -541536,7 +542260,7 @@ function handleInteractivePermission(params, resolve48) {
541536
542260
  bridgeCallbacks,
541537
542261
  channelCallbacks
541538
542262
  } = params;
541539
- const { resolve: resolveOnce, isResolved, claim } = createResolveOnce(resolve48);
542263
+ const { resolve: resolveOnce, isResolved, claim } = createResolveOnce(resolve47);
541540
542264
  let userInteracted = false;
541541
542265
  let checkmarkTransitionTimer;
541542
542266
  let checkmarkAbortHandler;
@@ -541723,8 +542447,8 @@ async function handleSwarmWorkerPermission(params) {
541723
542447
  ...prev,
541724
542448
  pendingWorkerRequest: null
541725
542449
  }));
541726
- const decision = await new Promise((resolve48) => {
541727
- const { resolve: resolveOnce, claim } = createResolveOnce(resolve48);
542450
+ const decision = await new Promise((resolve47) => {
542451
+ const { resolve: resolveOnce, claim } = createResolveOnce(resolve47);
541728
542452
  const request = createPermissionRequest({
541729
542453
  toolName: ctx.tool.name,
541730
542454
  toolUseId: ctx.toolUseID,
@@ -541790,15 +542514,15 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
541790
542514
  const $3 = import_compiler_runtime339.c(3);
541791
542515
  let t0;
541792
542516
  if ($3[0] !== setToolPermissionContext || $3[1] !== setToolUseConfirmQueue) {
541793
- t0 = async (tool, input, toolUseContext, assistantMessage, toolUseID, forceDecision) => new Promise((resolve48) => {
542517
+ t0 = async (tool, input, toolUseContext, assistantMessage, toolUseID, forceDecision) => new Promise((resolve47) => {
541794
542518
  const ctx = createPermissionContext(tool, input, toolUseContext, assistantMessage, toolUseID, setToolPermissionContext, createPermissionQueueOps(setToolUseConfirmQueue));
541795
- if (ctx.resolveIfAborted(resolve48)) {
542519
+ if (ctx.resolveIfAborted(resolve47)) {
541796
542520
  return;
541797
542521
  }
541798
542522
  const decisionPromise = forceDecision !== undefined ? Promise.resolve(forceDecision) : hasPermissionsToUseTool(tool, input, toolUseContext, assistantMessage, toolUseID);
541799
542523
  return decisionPromise.then(async (result) => {
541800
542524
  if (result.behavior === "allow") {
541801
- if (ctx.resolveIfAborted(resolve48)) {
542525
+ if (ctx.resolveIfAborted(resolve47)) {
541802
542526
  return;
541803
542527
  }
541804
542528
  if (false) {}
@@ -541806,7 +542530,7 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
541806
542530
  decision: "accept",
541807
542531
  source: "config"
541808
542532
  });
541809
- resolve48(ctx.buildAllow(result.updatedInput ?? input, {
542533
+ resolve47(ctx.buildAllow(result.updatedInput ?? input, {
541810
542534
  decisionReason: result.decisionReason
541811
542535
  }));
541812
542536
  return;
@@ -541817,7 +542541,7 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
541817
542541
  toolPermissionContext: appState.toolPermissionContext,
541818
542542
  tools: toolUseContext.options.tools
541819
542543
  });
541820
- if (ctx.resolveIfAborted(resolve48)) {
542544
+ if (ctx.resolveIfAborted(resolve47)) {
541821
542545
  return;
541822
542546
  }
541823
542547
  switch (result.behavior) {
@@ -541833,7 +542557,7 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
541833
542557
  source: "config"
541834
542558
  });
541835
542559
  if (false) {}
541836
- resolve48(result);
542560
+ resolve47(result);
541837
542561
  return;
541838
542562
  }
541839
542563
  case "ask": {
@@ -541846,11 +542570,11 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
541846
542570
  permissionMode: appState.toolPermissionContext.mode
541847
542571
  });
541848
542572
  if (coordinatorDecision) {
541849
- resolve48(coordinatorDecision);
542573
+ resolve47(coordinatorDecision);
541850
542574
  return;
541851
542575
  }
541852
542576
  }
541853
- if (ctx.resolveIfAborted(resolve48)) {
542577
+ if (ctx.resolveIfAborted(resolve47)) {
541854
542578
  return;
541855
542579
  }
541856
542580
  const swarmDecision = await handleSwarmWorkerPermission({
@@ -541861,7 +542585,7 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
541861
542585
  suggestions: result.suggestions
541862
542586
  });
541863
542587
  if (swarmDecision) {
541864
- resolve48(swarmDecision);
542588
+ resolve47(swarmDecision);
541865
542589
  return;
541866
542590
  }
541867
542591
  if (false) {}
@@ -541872,7 +542596,7 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
541872
542596
  awaitAutomatedChecksBeforeDialog: appState.toolPermissionContext.awaitAutomatedChecksBeforeDialog,
541873
542597
  bridgeCallbacks: undefined,
541874
542598
  channelCallbacks: undefined
541875
- }, resolve48);
542599
+ }, resolve47);
541876
542600
  return;
541877
542601
  }
541878
542602
  }
@@ -541880,10 +542604,10 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
541880
542604
  if (error49 instanceof AbortError || error49 instanceof APIUserAbortError) {
541881
542605
  logForDebugging(`Permission check threw ${error49.constructor.name} for tool=${tool.name}: ${error49.message}`);
541882
542606
  ctx.logCancelled();
541883
- resolve48(ctx.cancelAndAbort(undefined, true));
542607
+ resolve47(ctx.cancelAndAbort(undefined, true));
541884
542608
  } else {
541885
542609
  logError2(error49);
541886
- resolve48(ctx.cancelAndAbort(undefined, true));
542610
+ resolve47(ctx.cancelAndAbort(undefined, true));
541887
542611
  }
541888
542612
  }).finally(() => {
541889
542613
  clearClassifierChecking(toolUseID);
@@ -543555,7 +544279,7 @@ __export(exports_asciicast, {
543555
544279
  _resetRecordingStateForTesting: () => _resetRecordingStateForTesting
543556
544280
  });
543557
544281
  import { appendFile as appendFile7, rename as rename12 } from "fs/promises";
543558
- import { basename as basename60, dirname as dirname63, join as join151 } from "path";
544282
+ import { basename as basename59, dirname as dirname63, join as join151 } from "path";
543559
544283
  function getRecordFilePath() {
543560
544284
  if (recordingState.filePath !== null) {
543561
544285
  return recordingState.filePath;
@@ -543601,8 +544325,8 @@ async function renameRecordingForSession() {
543601
544325
  return;
543602
544326
  }
543603
544327
  await recorder?.flush();
543604
- const oldName = basename60(oldPath);
543605
- const newName = basename60(newPath);
544328
+ const oldName = basename59(oldPath);
544329
+ const newName = basename59(newPath);
543606
544330
  try {
543607
544331
  await rename12(oldPath, newPath);
543608
544332
  recordingState.filePath = newPath;
@@ -543763,7 +544487,7 @@ function restoreAgentFromSession(agentSetting, currentAgentDefinition, agentDefi
543763
544487
  setMainThreadAgentType(undefined);
543764
544488
  return { agentDefinition: undefined, agentType: undefined };
543765
544489
  }
543766
- const resumedAgent = agentDefinitions.activeAgents.find((agent) => agent.agentType === agentSetting);
544490
+ const resumedAgent = agentDefinitions.activeAgents.find((agent2) => agent2.agentType === agentSetting);
543767
544491
  if (!resumedAgent) {
543768
544492
  logForDebugging(`Resumed session had agent "${agentSetting}" but it is no longer available. Using default behavior.`);
543769
544493
  setMainThreadAgentType(undefined);
@@ -548359,7 +549083,7 @@ class StructuredIO {
548359
549083
  });
548360
549084
  }
548361
549085
  try {
548362
- return await new Promise((resolve49, reject2) => {
549086
+ return await new Promise((resolve48, reject2) => {
548363
549087
  this.pendingRequests.set(requestId, {
548364
549088
  request: {
548365
549089
  type: "control_request",
@@ -548367,7 +549091,7 @@ class StructuredIO {
548367
549091
  request
548368
549092
  },
548369
549093
  resolve: (result) => {
548370
- resolve49(result);
549094
+ resolve48(result);
548371
549095
  },
548372
549096
  reject: reject2,
548373
549097
  schema
@@ -549278,12 +550002,12 @@ var init_useLspInitializationNotification = __esm(() => {
549278
550002
  });
549279
550003
 
549280
550004
  // src/utils/binaryCheck.ts
549281
- async function isBinaryInstalled(command8) {
549282
- if (!command8 || !command8.trim()) {
550005
+ async function isBinaryInstalled(command9) {
550006
+ if (!command9 || !command9.trim()) {
549283
550007
  logForDebugging("[binaryCheck] Empty command provided, returning false");
549284
550008
  return false;
549285
550009
  }
549286
- const trimmedCommand = command8.trim();
550010
+ const trimmedCommand = command9.trim();
549287
550011
  const cached3 = binaryCache.get(trimmedCommand);
549288
550012
  if (cached3 !== undefined) {
549289
550013
  logForDebugging(`[binaryCheck] Cache hit for '${trimmedCommand}': ${cached3}`);
@@ -549336,13 +550060,13 @@ function isRecord2(value) {
549336
550060
  }
549337
550061
  function extractFromServerConfigRecord(serverConfigs) {
549338
550062
  const extensions = new Set;
549339
- let command8 = null;
550063
+ let command9 = null;
549340
550064
  for (const [_serverName, config5] of Object.entries(serverConfigs)) {
549341
550065
  if (!isRecord2(config5)) {
549342
550066
  continue;
549343
550067
  }
549344
- if (!command8 && typeof config5.command === "string") {
549345
- command8 = config5.command;
550068
+ if (!command9 && typeof config5.command === "string") {
550069
+ command9 = config5.command;
549346
550070
  }
549347
550071
  const extMapping = config5.extensionToLanguage;
549348
550072
  if (isRecord2(extMapping)) {
@@ -549351,10 +550075,10 @@ function extractFromServerConfigRecord(serverConfigs) {
549351
550075
  }
549352
550076
  }
549353
550077
  }
549354
- if (!command8 || extensions.size === 0) {
550078
+ if (!command9 || extensions.size === 0) {
549355
550079
  return null;
549356
550080
  }
549357
- return { extensions, command: command8 };
550081
+ return { extensions, command: command9 };
549358
550082
  }
549359
550083
  async function getLspPluginsFromMarketplaces() {
549360
550084
  const result = new Map;
@@ -549490,7 +550214,7 @@ function usePluginRecommendationBase() {
549490
550214
  const isCheckingRef = React148.useRef(false);
549491
550215
  let t0;
549492
550216
  if ($3[0] !== recommendation) {
549493
- t0 = (resolve49) => {
550217
+ t0 = (resolve48) => {
549494
550218
  if (getIsRemoteMode()) {
549495
550219
  return;
549496
550220
  }
@@ -549501,7 +550225,7 @@ function usePluginRecommendationBase() {
549501
550225
  return;
549502
550226
  }
549503
550227
  isCheckingRef.current = true;
549504
- resolve49().then((rec) => {
550228
+ resolve48().then((rec) => {
549505
550229
  if (rec) {
549506
550230
  setRecommendation(rec);
549507
550231
  }
@@ -550377,7 +551101,7 @@ var init_usePluginAutoupdateNotification = __esm(() => {
550377
551101
  });
550378
551102
 
550379
551103
  // src/utils/plugins/reconciler.ts
550380
- import { isAbsolute as isAbsolute29, resolve as resolve49 } from "path";
551104
+ import { isAbsolute as isAbsolute29, resolve as resolve48 } from "path";
550381
551105
  function diffMarketplaces(declared, materialized, opts) {
550382
551106
  const missing = [];
550383
551107
  const sourceChanged = [];
@@ -550490,7 +551214,7 @@ function normalizeSource(source, projectRoot) {
550490
551214
  const canonicalRoot = findCanonicalGitRoot(base2);
550491
551215
  return {
550492
551216
  ...source,
550493
- path: resolve49(canonicalRoot ?? base2, source.path)
551217
+ path: resolve48(canonicalRoot ?? base2, source.path)
550494
551218
  };
550495
551219
  }
550496
551220
  return source;
@@ -551703,8 +552427,8 @@ function isSessionContainerCompatible(messages) {
551703
552427
  }
551704
552428
  if (toolName2 === BASH_TOOL_NAME) {
551705
552429
  const input = block.input;
551706
- const command8 = input?.command || "";
551707
- if (EXTERNAL_COMMAND_PATTERNS.some((p) => p.test(command8))) {
552430
+ const command9 = input?.command || "";
552431
+ if (EXTERNAL_COMMAND_PATTERNS.some((p) => p.test(command9))) {
551708
552432
  return false;
551709
552433
  }
551710
552434
  }
@@ -553768,12 +554492,12 @@ Error: sandbox required but unavailable: ${reason}
553768
554492
  return () => unregisterLeaderSetToolPermissionContext();
553769
554493
  }, [setToolPermissionContext]);
553770
554494
  const canUseTool = useCanUseTool_default(setToolUseConfirmQueue, setToolPermissionContext);
553771
- const requestPrompt = import_react319.useCallback((title, toolInputSummary) => (request) => new Promise((resolve50, reject2) => {
554495
+ const requestPrompt = import_react319.useCallback((title, toolInputSummary) => (request) => new Promise((resolve49, reject2) => {
553772
554496
  setPromptQueue((prev) => [...prev, {
553773
554497
  request,
553774
554498
  title,
553775
554499
  toolInputSummary,
553776
- resolve: resolve50,
554500
+ resolve: resolve49,
553777
554501
  reject: reject2
553778
554502
  }]);
553779
554503
  }), []);
@@ -554566,22 +555290,22 @@ Error: sandbox required but unavailable: ${reason}
554566
555290
  helpers2.clearBuffer();
554567
555291
  }, [setAppState, setInputValue, getToolUseContext, canUseTool, mainLoopModel, addNotification]);
554568
555292
  const handleAutoRunIssue = import_react319.useCallback(() => {
554569
- const command8 = autoRunIssueReason ? getAutoRunCommand(autoRunIssueReason) : "/issue";
555293
+ const command9 = autoRunIssueReason ? getAutoRunCommand(autoRunIssueReason) : "/issue";
554570
555294
  setAutoRunIssueReason(null);
554571
- onSubmit(command8, {
555295
+ onSubmit(command9, {
554572
555296
  setCursorOffset: () => {},
554573
555297
  clearBuffer: () => {},
554574
555298
  resetHistory: () => {}
554575
555299
  }).catch((err2) => {
554576
- logForDebugging(`Auto-run ${command8} failed: ${errorMessage(err2)}`);
555300
+ logForDebugging(`Auto-run ${command9} failed: ${errorMessage(err2)}`);
554577
555301
  });
554578
555302
  }, [onSubmit, autoRunIssueReason]);
554579
555303
  const handleCancelAutoRunIssue = import_react319.useCallback(() => {
554580
555304
  setAutoRunIssueReason(null);
554581
555305
  }, []);
554582
555306
  const handleSurveyRequestFeedback = import_react319.useCallback(() => {
554583
- const command8 = "/feedback";
554584
- onSubmit(command8, {
555307
+ const command9 = "/feedback";
555308
+ onSubmit(command9, {
554585
555309
  setCursorOffset: () => {},
554586
555310
  clearBuffer: () => {},
554587
555311
  resetHistory: () => {}
@@ -556665,8 +557389,8 @@ async function handleMcpjsonServerApprovals(root2) {
556665
557389
  if (pendingServers.length === 0) {
556666
557390
  return;
556667
557391
  }
556668
- await new Promise((resolve50) => {
556669
- const done = () => void resolve50();
557392
+ await new Promise((resolve49) => {
557393
+ const done = () => void resolve49();
556670
557394
  if (pendingServers.length === 1 && pendingServers[0] !== undefined) {
556671
557395
  const serverName = pendingServers[0];
556672
557396
  root2.render(/* @__PURE__ */ jsx_dev_runtime470.jsxDEV(AppStateProvider, {
@@ -559104,8 +559828,8 @@ function _temp443(command_0) {
559104
559828
  function _temp359(tool_0) {
559105
559829
  return tool_0 === BASH_TOOL_NAME || tool_0.startsWith(BASH_TOOL_NAME + "(");
559106
559830
  }
559107
- function _temp2102(command8) {
559108
- return command8.type === "prompt" && command8.loadedFrom === "commands_DEPRECATED" && (command8.source === "projectSettings" || command8.source === "localSettings") && command8.allowedTools?.some(_temp303);
559831
+ function _temp2102(command9) {
559832
+ return command9.type === "prompt" && command9.loadedFrom === "commands_DEPRECATED" && (command9.source === "projectSettings" || command9.source === "localSettings") && command9.allowedTools?.some(_temp303);
559109
559833
  }
559110
559834
  function _temp303(tool) {
559111
559835
  return tool === BASH_TOOL_NAME || tool.startsWith(BASH_TOOL_NAME + "(");
@@ -559445,8 +560169,8 @@ function completeOnboarding() {
559445
560169
  }));
559446
560170
  }
559447
560171
  function showDialog(root2, renderer) {
559448
- return new Promise((resolve50) => {
559449
- const done = (result) => void resolve50(result);
560172
+ return new Promise((resolve49) => {
560173
+ const done = (result) => void resolve49(result);
559450
560174
  root2.render(renderer(done));
559451
560175
  });
559452
560176
  }
@@ -560901,7 +561625,7 @@ function _temp307() {
560901
561625
  function CrossProjectMessage(t0) {
560902
561626
  const $3 = import_compiler_runtime384.c(8);
560903
561627
  const {
560904
- command: command8
561628
+ command: command9
560905
561629
  } = t0;
560906
561630
  let t1;
560907
561631
  if ($3[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -560930,7 +561654,7 @@ function CrossProjectMessage(t0) {
560930
561654
  t3 = $3[2];
560931
561655
  }
560932
561656
  let t4;
560933
- if ($3[3] !== command8) {
561657
+ if ($3[3] !== command9) {
560934
561658
  t4 = /* @__PURE__ */ jsx_dev_runtime485.jsxDEV(ThemedBox_default, {
560935
561659
  flexDirection: "column",
560936
561660
  children: [
@@ -560938,12 +561662,12 @@ function CrossProjectMessage(t0) {
560938
561662
  /* @__PURE__ */ jsx_dev_runtime485.jsxDEV(ThemedText, {
560939
561663
  children: [
560940
561664
  " ",
560941
- command8
561665
+ command9
560942
561666
  ]
560943
561667
  }, undefined, true, undefined, this)
560944
561668
  ]
560945
561669
  }, undefined, true, undefined, this);
560946
- $3[3] = command8;
561670
+ $3[3] = command9;
560947
561671
  $3[4] = t4;
560948
561672
  } else {
560949
561673
  t4 = $3[4];
@@ -561073,11 +561797,11 @@ async function isCodeGraphInstalled() {
561073
561797
  if (cachedResult !== null)
561074
561798
  return cachedResult;
561075
561799
  if (checkStarted) {
561076
- await new Promise((resolve50) => {
561800
+ await new Promise((resolve49) => {
561077
561801
  const check3 = setInterval(() => {
561078
561802
  if (cachedResult !== null) {
561079
561803
  clearInterval(check3);
561080
- resolve50();
561804
+ resolve49();
561081
561805
  }
561082
561806
  }, 50);
561083
561807
  });
@@ -561103,7 +561827,7 @@ var init_codegraphCheck = __esm(() => {
561103
561827
 
561104
561828
  // src/plugins/bundled/eccBuiltin.ts
561105
561829
  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";
561830
+ import { join as join155, dirname as dirname67, basename as basename60, extname as extname17 } from "path";
561107
561831
  import { fileURLToPath as fileURLToPath9 } from "url";
561108
561832
  function resolveSeedDir() {
561109
561833
  if (process.env.CLAUDE_CODE_PLUGIN_SEED_DIR) {
@@ -561161,7 +561885,7 @@ var init_eccBuiltin = __esm(() => {
561161
561885
  for (const file2 of files3) {
561162
561886
  if (extname17(file2) !== ".md")
561163
561887
  continue;
561164
- const name = basename61(file2, ".md");
561888
+ const name = basename60(file2, ".md");
561165
561889
  const content = readFileSync18(join155(ECC_COMMANDS_DIR, file2), "utf-8");
561166
561890
  registerMarkdownSkill(name, join155(ECC_COMMANDS_DIR, file2), content, "Custom command");
561167
561891
  count4++;
@@ -561214,9 +561938,9 @@ var init_bundled = __esm(() => {
561214
561938
  });
561215
561939
 
561216
561940
  // src/services/plugins/pluginCliCommands.ts
561217
- function handlePluginCommandError(error49, command8, plugin2) {
561941
+ function handlePluginCommandError(error49, command9, plugin2) {
561218
561942
  logError2(error49);
561219
- const operation = plugin2 ? `${command8} plugin "${plugin2}"` : command8 === "disable-all" ? "disable all plugins" : `${command8} plugins`;
561943
+ const operation = plugin2 ? `${command9} plugin "${plugin2}"` : command9 === "disable-all" ? "disable all plugins" : `${command9} plugins`;
561220
561944
  console.error(`${figures_default.cross} Failed to ${operation}: ${errorMessage(error49)}`);
561221
561945
  const telemetryFields = plugin2 ? (() => {
561222
561946
  const { name, marketplace } = parsePluginIdentifier(plugin2);
@@ -561229,7 +561953,7 @@ function handlePluginCommandError(error49, command8, plugin2) {
561229
561953
  };
561230
561954
  })() : {};
561231
561955
  logEvent("tengu_plugin_command_failed", {
561232
- command: command8,
561956
+ command: command9,
561233
561957
  error_category: classifyPluginCommandError(error49),
561234
561958
  ...telemetryFields
561235
561959
  });
@@ -563713,23 +564437,25 @@ var init_migrateAutoUpdatesToSettings = __esm(() => {
563713
564437
  });
563714
564438
 
563715
564439
  // src/migrations/migrateBypassPermissionsAcceptedToSettings.ts
563716
- function migrateBypassPermissionsAcceptedToSettings() {
564440
+ async function migrateBypassPermissionsAcceptedToSettings() {
563717
564441
  const globalConfig2 = getGlobalConfig();
563718
564442
  if (!globalConfig2.bypassPermissionsModeAccepted) {
563719
564443
  return;
563720
564444
  }
563721
564445
  try {
563722
564446
  if (!hasSkipDangerousModePermissionPrompt()) {
563723
- const effectiveSkip = ["userSettings", "localSettings"].map((source) => getSettingsForSource(source)?.skipDangerousModePermissionPrompt).find((value) => value !== undefined);
563724
- const userExplicitlyOptedOut = effectiveSkip === false;
564447
+ const userExplicitlyOptedOut = getSettingsForSource("userSettings")?.skipDangerousModePermissionPrompt === false || getSettingsForSource("projectSettings")?.skipDangerousModePermissionPrompt === false || getSettingsForSource("localSettings")?.skipDangerousModePermissionPrompt === false || getSettingsForSource("flagSettings")?.skipDangerousModePermissionPrompt === false || getSettingsForSource("policySettings")?.skipDangerousModePermissionPrompt === false;
563725
564448
  if (!userExplicitlyOptedOut) {
563726
- updateSettingsForSource("userSettings", {
564449
+ const result = await updateSettingsForSource("userSettings", {
563727
564450
  skipDangerousModePermissionPrompt: true
563728
564451
  });
564452
+ if (result.error) {
564453
+ throw result.error;
564454
+ }
563729
564455
  }
563730
564456
  }
563731
564457
  logEvent("tengu_migrate_bypass_permissions_accepted", {});
563732
- saveGlobalConfig((current) => {
564458
+ await saveGlobalConfig((current) => {
563733
564459
  if (!("bypassPermissionsModeAccepted" in current))
563734
564460
  return current;
563735
564461
  const { bypassPermissionsModeAccepted: _2, ...updatedConfig } = current;
@@ -563748,7 +564474,8 @@ var init_migrateBypassPermissionsAcceptedToSettings = __esm(() => {
563748
564474
  });
563749
564475
 
563750
564476
  // src/migrations/migrateEnableAllProjectMcpServersToSettings.ts
563751
- function migrateEnableAllProjectMcpServersToSettings() {
564477
+ import { createHash as createHash21 } from "crypto";
564478
+ async function migrateEnableAllProjectMcpServersToSettings() {
563752
564479
  const globalConfig2 = getGlobalConfig();
563753
564480
  if (globalConfig2.hasCompletedMcpServerMigration) {
563754
564481
  return;
@@ -563758,83 +564485,89 @@ function migrateEnableAllProjectMcpServersToSettings() {
563758
564485
  const hasEnabledServers = Array.isArray(projectConfig.enabledMcpjsonServers);
563759
564486
  const hasDisabledServers = Array.isArray(projectConfig.disabledMcpjsonServers);
563760
564487
  if (!hasEnableAll && !hasEnabledServers && !hasDisabledServers) {
563761
- saveGlobalConfig((c6) => ({ ...c6, hasCompletedMcpServerMigration: true }));
564488
+ await saveGlobalConfig((c6) => ({ ...c6, hasCompletedMcpServerMigration: true }));
563762
564489
  return;
563763
564490
  }
563764
- const updates = {};
563765
564491
  const existingSettings = getSettingsForSource("localSettings") || {};
564492
+ const updates = Object.create(null);
564493
+ for (const key2 of Object.keys(existingSettings)) {
564494
+ updates[key2] = existingSettings[key2];
564495
+ }
563766
564496
  if (hasEnableAll) {
563767
564497
  updates.enableAllProjectMcpServers = projectConfig.enableAllProjectMcpServers;
563768
564498
  }
563769
- const existingEnabledServers = Array.isArray(existingSettings.enabledMcpjsonServers) ? [...existingSettings.enabledMcpjsonServers] : [];
564499
+ let existingEnabledServers = Array.isArray(existingSettings.enabledMcpjsonServers) ? [...existingSettings.enabledMcpjsonServers] : [];
563770
564500
  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
- }
564501
+ if (hasEnabledServers && Array.isArray(projectConfig.enabledMcpjsonServers) && projectConfig.enabledMcpjsonServers.length > 0) {
564502
+ const seen = new Set(existingEnabledServers);
564503
+ for (const server of projectConfig.enabledMcpjsonServers) {
564504
+ if (!seen.has(server)) {
564505
+ existingEnabledServers.push(server);
564506
+ seen.add(server);
563783
564507
  }
563784
564508
  }
563785
564509
  }
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
- }
564510
+ if (hasDisabledServers && Array.isArray(projectConfig.disabledMcpjsonServers) && projectConfig.disabledMcpjsonServers.length > 0) {
564511
+ const seen = new Set(existingDisabledServers);
564512
+ for (const server of projectConfig.disabledMcpjsonServers) {
564513
+ if (!seen.has(server)) {
564514
+ existingDisabledServers.push(server);
564515
+ seen.add(server);
563798
564516
  }
563799
564517
  }
563800
564518
  }
563801
564519
  const overlappingServers = existingEnabledServers.filter((server) => existingDisabledServers.includes(server));
563802
564520
  if (overlappingServers.length > 0) {
563803
- logEvent("tengu_migrate_mcp_server_conflict_resolved", {
563804
- overlappingServerCount: overlappingServers.length,
563805
- conflictResolution: "removed_from_disabled"
563806
- });
564521
+ existingEnabledServers = existingEnabledServers.filter((server) => !existingDisabledServers.includes(server));
564522
+ const existingDisabledServersFromSettings = Array.isArray(existingSettings.disabledMcpjsonServers) ? existingSettings.disabledMcpjsonServers : [];
564523
+ const isDuplicateConflict = overlappingServers.every((server) => existingDisabledServersFromSettings.includes(server));
564524
+ if (!isDuplicateConflict) {
564525
+ const hashedOverlappingServers = overlappingServers.map((server) => createHash21("sha256").update(server).digest("hex"));
564526
+ logEvent("tengu_migrate_mcp_server_conflict_resolved", {
564527
+ overlappingServers: hashedOverlappingServers.join(","),
564528
+ conflictResolution: "removed_from_enabled_list"
564529
+ });
564530
+ }
563807
564531
  }
563808
- const finalDisabledServers = existingDisabledServers.filter((server) => !existingEnabledServers.includes(server));
563809
- if (hasEnabledServers) {
564532
+ if (hasEnabledServers || existingSettings.enabledMcpjsonServers !== undefined) {
563810
564533
  updates.enabledMcpjsonServers = existingEnabledServers;
563811
564534
  }
563812
564535
  if (hasDisabledServers || existingSettings.disabledMcpjsonServers !== undefined) {
563813
- updates.disabledMcpjsonServers = finalDisabledServers;
564536
+ updates.disabledMcpjsonServers = existingDisabledServers;
563814
564537
  }
563815
564538
  try {
563816
- const updateResult = updateSettingsForSource("localSettings", updates);
563817
- if (updateResult?.error) {
563818
- throw updateResult.error;
564539
+ const result = await updateSettingsForSource("localSettings", updates);
564540
+ if (result.error) {
564541
+ throw result.error;
563819
564542
  }
563820
564543
  } catch (error49) {
563821
564544
  logError2(new Error(`Failed to migrate MCP server settings to local config: ${error49}`));
563822
564545
  throw error49;
563823
564546
  }
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 }));
564547
+ try {
564548
+ await saveCurrentProjectConfig((config5) => {
564549
+ const updated = { ...config5 };
564550
+ delete updated.enableAllProjectMcpServers;
564551
+ delete updated.enabledMcpjsonServers;
564552
+ delete updated.disabledMcpjsonServers;
564553
+ return updated;
564554
+ });
564555
+ } catch (error49) {
564556
+ logError2(new Error(`Failed to remove migrated MCP server fields from project config: ${error49}`));
564557
+ throw error49;
564558
+ }
564559
+ try {
564560
+ await saveGlobalConfig((c6) => ({ ...c6, hasCompletedMcpServerMigration: true }));
564561
+ } catch (error49) {
564562
+ logError2(new Error(`Failed to mark MCP server migration as completed: ${error49}`));
564563
+ throw error49;
564564
+ }
563832
564565
  logEvent("tengu_migrate_enable_all_project_mcp_servers_to_settings", {
563833
564566
  migration: "enableAllProjectMcpServersToSettings",
563834
564567
  fieldsMigrated: [
563835
- hasEnableAll && "enableAllProjectMcpServers",
563836
- hasEnabledServers && "enabledMcpjsonServers",
563837
- hasDisabledServers && "disabledMcpjsonServers"
564568
+ hasEnableAll ? "enableAllProjectMcpServers" : undefined,
564569
+ hasEnabledServers ? "enabledMcpjsonServers" : undefined,
564570
+ hasDisabledServers ? "disabledMcpjsonServers" : undefined
563838
564571
  ].filter(Boolean).join(",")
563839
564572
  });
563840
564573
  }
@@ -563848,7 +564581,6 @@ var init_migrateEnableAllProjectMcpServersToSettings = __esm(() => {
563848
564581
  // src/migrations/migrateFennecToOpus.ts
563849
564582
  var init_migrateFennecToOpus = __esm(() => {
563850
564583
  init_log3();
563851
- init_config();
563852
564584
  init_providers();
563853
564585
  init_settings2();
563854
564586
  });
@@ -563903,21 +564635,41 @@ var init_migrateOpusToOpus1m = __esm(() => {
563903
564635
  });
563904
564636
 
563905
564637
  // src/migrations/migrateReplBridgeEnabledToRemoteControlAtStartup.ts
563906
- function migrateReplBridgeEnabledToRemoteControlAtStartup() {
563907
- saveGlobalConfig((prev) => {
563908
- const oldValue = prev["replBridgeEnabled"];
564638
+ async function migrateReplBridgeEnabledToRemoteControlAtStartup() {
564639
+ await saveGlobalConfig((prev) => {
564640
+ const legacy = prev;
564641
+ const oldValue = legacy.replBridgeEnabled;
563909
564642
  if (oldValue === undefined)
563910
564643
  return prev;
563911
564644
  if (prev.remoteControlAtStartup !== undefined)
563912
564645
  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;
564646
+ const truthyValues = ["true", "1", "yes", "on", "enabled"];
564647
+ const falsyValues = ["false", "0", "no", "off", "disabled", ""];
564648
+ const normalizedString = typeof oldValue === "string" ? oldValue.toLowerCase().trim() : "";
564649
+ let newValue;
564650
+ if (typeof oldValue === "boolean") {
564651
+ newValue = oldValue;
564652
+ } else if (typeof oldValue === "string") {
564653
+ if (truthyValues.includes(normalizedString)) {
564654
+ newValue = true;
564655
+ } else if (falsyValues.includes(normalizedString)) {
564656
+ newValue = false;
564657
+ } else {
564658
+ logForDebugging(`Unknown replBridgeEnabled value "${oldValue}" during migration to remoteControlAtStartup; defaulting to false. Please review this value manually.`, { level: "warn" });
564659
+ newValue = false;
564660
+ }
564661
+ } else {
564662
+ logForDebugging(`Unknown replBridgeEnabled value of type "${typeof oldValue}" during migration to remoteControlAtStartup; defaulting to false. Please review this value manually.`, { level: "warn" });
564663
+ newValue = false;
564664
+ }
564665
+ const { replBridgeEnabled: _unused, ...rest } = legacy;
564666
+ const next = { ...rest, remoteControlAtStartup: newValue };
563916
564667
  return next;
563917
564668
  });
563918
564669
  }
563919
564670
  var init_migrateReplBridgeEnabledToRemoteControlAtStartup = __esm(() => {
563920
564671
  init_config();
564672
+ init_debug();
563921
564673
  });
563922
564674
 
563923
564675
  // src/migrations/migrateSonnet1mToSonnet45.ts
@@ -563926,6 +564678,8 @@ function migrateSonnet1mToSonnet45() {
563926
564678
  if (config5.sonnet1m45MigrationComplete) {
563927
564679
  return;
563928
564680
  }
564681
+ const sonnet45Model = CLAUDE_SONNET_4_5_CONFIG.firstParty;
564682
+ const sonnet45Model1m = `${sonnet45Model}[1m]`;
563929
564683
  try {
563930
564684
  const sources = ["userSettings", "projectSettings", "localSettings"];
563931
564685
  let anyMigrated = false;
@@ -563933,21 +564687,21 @@ function migrateSonnet1mToSonnet45() {
563933
564687
  const model = getSettingsForSource(source)?.model;
563934
564688
  if (model === "sonnet[1m]") {
563935
564689
  updateSettingsForSource(source, {
563936
- model: "sonnet-4-5-20250929[1m]"
564690
+ model: sonnet45Model1m
563937
564691
  });
563938
564692
  anyMigrated = true;
563939
564693
  }
563940
564694
  }
563941
564695
  const override = getMainLoopModelOverride();
563942
564696
  if (override === "sonnet[1m]") {
563943
- setMainLoopModelOverride("sonnet-4-5-20250929[1m]");
564697
+ setMainLoopModelOverride(sonnet45Model1m);
563944
564698
  }
563945
564699
  saveGlobalConfig((current) => ({
563946
564700
  ...current,
563947
564701
  sonnet1m45MigrationComplete: true
563948
564702
  }));
563949
564703
  } catch (error49) {
563950
- logError2(new Error(`Failed to migrate sonnet[1m] to sonnet-4-5-20250929[1m]: ${error49}`));
564704
+ logError2(new Error(`Failed to migrate sonnet[1m] to ${sonnet45Model1m}: ${error49}`));
563951
564705
  }
563952
564706
  }
563953
564707
  var init_migrateSonnet1mToSonnet45 = __esm(() => {
@@ -563955,6 +564709,7 @@ var init_migrateSonnet1mToSonnet45 = __esm(() => {
563955
564709
  init_state();
563956
564710
  init_config();
563957
564711
  init_settings2();
564712
+ init_configs();
563958
564713
  });
563959
564714
 
563960
564715
  // src/migrations/migrateSonnet45ToSonnet46.ts
@@ -564005,6 +564760,7 @@ var init_resetAutoModeOptInForDefaultOffer = __esm(() => {
564005
564760
  init_log3();
564006
564761
  init_permissionSetup();
564007
564762
  init_settings2();
564763
+ init_settingsCache();
564008
564764
  });
564009
564765
 
564010
564766
  // src/migrations/resetProToOpusDefault.ts
@@ -564053,6 +564809,248 @@ var init_resetProToOpusDefault = __esm(() => {
564053
564809
  init_settings2();
564054
564810
  });
564055
564811
 
564812
+ // src/migrations/migrationRunner.ts
564813
+ function topologicalSort(migrations) {
564814
+ const nameToMigration = new Map;
564815
+ for (const m2 of migrations) {
564816
+ if (nameToMigration.has(m2.name)) {
564817
+ throw new Error(`Duplicate migration name '${m2.name}'. Migration names must be unique.`);
564818
+ }
564819
+ nameToMigration.set(m2.name, m2);
564820
+ }
564821
+ for (const m2 of migrations) {
564822
+ if (m2.dependsOn?.includes(m2.name)) {
564823
+ throw new Error(`Self-dependency detected in migration '${m2.name}'. ` + `A migration cannot depend on itself.`);
564824
+ }
564825
+ }
564826
+ const dependsOnMap = new Map;
564827
+ for (const m2 of migrations) {
564828
+ if (m2.dependsOn) {
564829
+ const deps = new Set;
564830
+ for (const dep of m2.dependsOn) {
564831
+ if (!nameToMigration.has(dep)) {
564832
+ throw new Error(`Unknown dependency '${dep}' in migration '${m2.name}'. ` + `Dependency must be included in the migration list.`);
564833
+ }
564834
+ deps.add(dep);
564835
+ }
564836
+ dependsOnMap.set(m2.name, deps);
564837
+ }
564838
+ }
564839
+ const inDegree = new Map;
564840
+ const adjacency = new Map;
564841
+ for (const m2 of migrations) {
564842
+ inDegree.set(m2.name, 0);
564843
+ adjacency.set(m2.name, []);
564844
+ }
564845
+ for (const m2 of migrations) {
564846
+ const deps = dependsOnMap.get(m2.name);
564847
+ if (deps) {
564848
+ for (const dep of deps) {
564849
+ adjacency.get(dep).push(m2.name);
564850
+ inDegree.set(m2.name, (inDegree.get(m2.name) || 0) + 1);
564851
+ }
564852
+ }
564853
+ }
564854
+ const queue2 = [];
564855
+ for (const m2 of migrations) {
564856
+ if (inDegree.get(m2.name) === 0) {
564857
+ queue2.push(m2.name);
564858
+ }
564859
+ }
564860
+ const sorted = [];
564861
+ let queueIndex = 0;
564862
+ while (queueIndex < queue2.length) {
564863
+ const name = queue2[queueIndex];
564864
+ queueIndex++;
564865
+ const migration = nameToMigration.get(name);
564866
+ sorted.push(migration);
564867
+ for (const neighbour of adjacency.get(name) || []) {
564868
+ const newDegree = (inDegree.get(neighbour) || 1) - 1;
564869
+ inDegree.set(neighbour, newDegree);
564870
+ if (newDegree === 0) {
564871
+ queue2.push(neighbour);
564872
+ }
564873
+ }
564874
+ }
564875
+ if (sorted.length !== migrations.length) {
564876
+ const unsorted = new Set(migrations.map((m2) => m2.name));
564877
+ for (const name of sorted) {
564878
+ unsorted.delete(name);
564879
+ }
564880
+ const hasIndirectSelfDependency = () => {
564881
+ for (const node of unsorted) {
564882
+ const visited = new Set;
564883
+ const stack = [node];
564884
+ while (stack.length > 0) {
564885
+ const current = stack.pop();
564886
+ if (current === node && visited.size > 0) {
564887
+ return true;
564888
+ }
564889
+ if (visited.has(current))
564890
+ continue;
564891
+ visited.add(current);
564892
+ const deps = dependsOnMap.get(current);
564893
+ if (deps) {
564894
+ for (const dep of deps) {
564895
+ if (dep === node) {
564896
+ return true;
564897
+ }
564898
+ if (!visited.has(dep)) {
564899
+ stack.push(dep);
564900
+ }
564901
+ }
564902
+ }
564903
+ }
564904
+ }
564905
+ return false;
564906
+ };
564907
+ if (hasIndirectSelfDependency()) {
564908
+ const selfDepNames = Array.from(unsorted).join(", ");
564909
+ throw new Error(`Self-dependency detected in migration(s): ${selfDepNames}. ` + `A migration cannot depend on itself, directly or indirectly.`);
564910
+ }
564911
+ const cycleNames = Array.from(unsorted).join(", ");
564912
+ throw new Error(`Circular dependency detected in migrations: ${cycleNames}. ` + `Each migration must have a valid dependency chain.`);
564913
+ }
564914
+ return sorted;
564915
+ }
564916
+ async function runMigrationsSafe(migrations, completedMigrationNames) {
564917
+ const completedSet = new Set(completedMigrationNames);
564918
+ const allMigrationNames = new Set(migrations.map((m2) => m2.name));
564919
+ const missingDepMigrations = [];
564920
+ const missingDepNames = new Set;
564921
+ for (const m2 of migrations) {
564922
+ const missingDeps = [];
564923
+ if (m2.dependsOn) {
564924
+ for (const dep of m2.dependsOn) {
564925
+ if (!allMigrationNames.has(dep) && !completedSet.has(dep)) {
564926
+ missingDeps.push(dep);
564927
+ }
564928
+ }
564929
+ }
564930
+ if (missingDeps.length > 0) {
564931
+ missingDepMigrations.push({ migration: m2, missingDeps });
564932
+ missingDepNames.add(m2.name);
564933
+ }
564934
+ }
564935
+ const sanitizedMigrations = migrations.map((m2) => {
564936
+ const sanitizedDeps = m2.dependsOn?.filter((dep) => allMigrationNames.has(dep) && !completedSet.has(dep));
564937
+ return {
564938
+ ...m2,
564939
+ dependsOn: sanitizedDeps && sanitizedDeps.length > 0 ? sanitizedDeps : undefined
564940
+ };
564941
+ });
564942
+ let sortedMigrations;
564943
+ try {
564944
+ sortedMigrations = topologicalSort(sanitizedMigrations);
564945
+ } catch (error49) {
564946
+ const errorMessage4 = error49 instanceof Error ? error49.message : String(error49);
564947
+ const results2 = migrations.map((m2) => {
564948
+ const missingDep = missingDepMigrations.find((md) => md.migration.name === m2.name);
564949
+ if (missingDep) {
564950
+ return {
564951
+ success: false,
564952
+ error: `Missing dependency${missingDep.missingDeps.length > 1 ? "ies" : ""}: ${missingDep.missingDeps.join(", ")}. ` + `Dependency must be included in the migration list or already completed.`,
564953
+ migrationName: m2.name
564954
+ };
564955
+ }
564956
+ return {
564957
+ success: false,
564958
+ error: errorMessage4,
564959
+ migrationName: m2.name
564960
+ };
564961
+ });
564962
+ return {
564963
+ total: migrations.length,
564964
+ successful: 0,
564965
+ failed: migrations.length,
564966
+ skipped: 0,
564967
+ results: results2,
564968
+ newlyCompleted: []
564969
+ };
564970
+ }
564971
+ const results = [];
564972
+ let successful = 0;
564973
+ let failed = 0;
564974
+ let skipped = 0;
564975
+ const newlyCompleted = [];
564976
+ const succeededSet = new Set(completedSet);
564977
+ const failedMigrationNames = new Set;
564978
+ for (const { migration: m2, missingDeps } of missingDepMigrations) {
564979
+ const errorMessage4 = `Missing dependency${missingDeps.length > 1 ? "ies" : ""}: ${missingDeps.join(", ")}. ` + `Dependency must be included in the migration list or already completed.`;
564980
+ results.push({
564981
+ success: false,
564982
+ error: errorMessage4,
564983
+ migrationName: m2.name
564984
+ });
564985
+ failed++;
564986
+ failedMigrationNames.add(m2.name);
564987
+ }
564988
+ for (const { name, migration, dependsOn } of sortedMigrations) {
564989
+ if (missingDepNames.has(name)) {
564990
+ continue;
564991
+ }
564992
+ if (completedSet.has(name)) {
564993
+ results.push({
564994
+ success: true,
564995
+ migrationName: name,
564996
+ skipped: true
564997
+ });
564998
+ skipped++;
564999
+ continue;
565000
+ }
565001
+ let dependencyFailed = false;
565002
+ let dependencyError = "";
565003
+ if (dependsOn) {
565004
+ for (const dep of dependsOn) {
565005
+ if (!succeededSet.has(dep) || failedMigrationNames.has(dep)) {
565006
+ dependencyFailed = true;
565007
+ dependencyError = `Dependency ${dep} failed or was skipped`;
565008
+ break;
565009
+ }
565010
+ }
565011
+ }
565012
+ if (dependencyFailed) {
565013
+ results.push({
565014
+ success: false,
565015
+ error: dependencyError,
565016
+ migrationName: name
565017
+ });
565018
+ failed++;
565019
+ continue;
565020
+ }
565021
+ try {
565022
+ const result = migration();
565023
+ await Promise.resolve(result);
565024
+ results.push({ success: true, migrationName: name });
565025
+ successful++;
565026
+ newlyCompleted.push(name);
565027
+ succeededSet.add(name);
565028
+ } catch (error49) {
565029
+ const errorMessage4 = error49 instanceof Error ? error49.message : String(error49);
565030
+ logError2(new Error(`Migration '${name}' failed: ${errorMessage4}`));
565031
+ logEvent("tengu_migration_failed", { migration: name, error: errorMessage4 });
565032
+ results.push({
565033
+ success: false,
565034
+ error: errorMessage4,
565035
+ migrationName: name
565036
+ });
565037
+ failed++;
565038
+ }
565039
+ }
565040
+ return {
565041
+ total: migrations.length,
565042
+ successful,
565043
+ failed,
565044
+ skipped,
565045
+ results,
565046
+ newlyCompleted
565047
+ };
565048
+ }
565049
+ var init_migrationRunner = __esm(() => {
565050
+ init_log3();
565051
+ init_analytics();
565052
+ });
565053
+
564056
565054
  // src/server/types.ts
564057
565055
  var connectResponseSchema;
564058
565056
  var init_types17 = __esm(() => {
@@ -564894,8 +565892,8 @@ class SerialBatchEventUploader {
564894
565892
  if (items.length === 0)
564895
565893
  return;
564896
565894
  while (this.pending.length + items.length > this.config.maxQueueSize && !this.closed) {
564897
- await new Promise((resolve50) => {
564898
- this.backpressureResolvers.push(resolve50);
565895
+ await new Promise((resolve49) => {
565896
+ this.backpressureResolvers.push(resolve49);
564899
565897
  });
564900
565898
  }
564901
565899
  if (this.closed)
@@ -564908,8 +565906,8 @@ class SerialBatchEventUploader {
564908
565906
  return Promise.resolve();
564909
565907
  }
564910
565908
  this.drain();
564911
- return new Promise((resolve50) => {
564912
- this.flushResolvers.push(resolve50);
565909
+ return new Promise((resolve49) => {
565910
+ this.flushResolvers.push(resolve49);
564913
565911
  });
564914
565912
  }
564915
565913
  close() {
@@ -564920,11 +565918,11 @@ class SerialBatchEventUploader {
564920
565918
  this.pending = [];
564921
565919
  this.sleepResolve?.();
564922
565920
  this.sleepResolve = null;
564923
- for (const resolve50 of this.backpressureResolvers)
564924
- resolve50();
565921
+ for (const resolve49 of this.backpressureResolvers)
565922
+ resolve49();
564925
565923
  this.backpressureResolvers = [];
564926
- for (const resolve50 of this.flushResolvers)
564927
- resolve50();
565924
+ for (const resolve49 of this.flushResolvers)
565925
+ resolve49();
564928
565926
  this.flushResolvers = [];
564929
565927
  }
564930
565928
  async drain() {
@@ -564959,8 +565957,8 @@ class SerialBatchEventUploader {
564959
565957
  } finally {
564960
565958
  this.draining = false;
564961
565959
  if (this.pending.length === 0) {
564962
- for (const resolve50 of this.flushResolvers)
564963
- resolve50();
565960
+ for (const resolve49 of this.flushResolvers)
565961
+ resolve49();
564964
565962
  this.flushResolvers = [];
564965
565963
  }
564966
565964
  }
@@ -564999,16 +565997,16 @@ class SerialBatchEventUploader {
564999
565997
  releaseBackpressure() {
565000
565998
  const resolvers3 = this.backpressureResolvers;
565001
565999
  this.backpressureResolvers = [];
565002
- for (const resolve50 of resolvers3)
565003
- resolve50();
566000
+ for (const resolve49 of resolvers3)
566001
+ resolve49();
565004
566002
  }
565005
566003
  sleep(ms) {
565006
- return new Promise((resolve50) => {
565007
- this.sleepResolve = resolve50;
565008
- setTimeout((self2, resolve51) => {
566004
+ return new Promise((resolve49) => {
566005
+ this.sleepResolve = resolve49;
566006
+ setTimeout((self2, resolve50) => {
565009
566007
  self2.sleepResolve = null;
565010
- resolve51();
565011
- }, ms, this, resolve50);
566008
+ resolve50();
566009
+ }, ms, this, resolve49);
565012
566010
  });
565013
566011
  }
565014
566012
  }
@@ -567800,7 +568798,7 @@ var init_idleTimeout = __esm(() => {
567800
568798
  // src/bridge/inboundAttachments.ts
567801
568799
  import { randomUUID as randomUUID50 } from "crypto";
567802
568800
  import { mkdir as mkdir45, writeFile as writeFile46 } from "fs/promises";
567803
- import { basename as basename62, join as join158 } from "path";
568801
+ import { basename as basename61, join as join158 } from "path";
567804
568802
  function debug3(msg) {
567805
568803
  logForDebugging(`[bridge:inbound-attach] ${msg}`);
567806
568804
  }
@@ -567812,7 +568810,7 @@ function extractInboundAttachments(msg) {
567812
568810
  return parsed.success ? parsed.data : [];
567813
568811
  }
567814
568812
  function sanitizeFileName(name) {
567815
- const base2 = basename62(name).replace(/[^a-zA-Z0-9._-]/g, "_");
568813
+ const base2 = basename61(name).replace(/[^a-zA-Z0-9._-]/g, "_");
567816
568814
  return base2 || "attachment";
567817
568815
  }
567818
568816
  function uploadsDir() {
@@ -570221,7 +571219,13 @@ async function initReplBridge(options) {
570221
571219
  logForDebugging(`[bridge:repl] Skipping: cross-process backoff (dead token seen ${cfg.bridgeOauthDeadFailCount} times)`);
570222
571220
  return null;
570223
571221
  }
570224
- await checkAndRefreshOAuthTokenIfNeeded();
571222
+ try {
571223
+ await checkAndRefreshOAuthTokenIfNeeded();
571224
+ } catch (error49) {
571225
+ logBridgeSkip("oauth_refresh_failed", `[bridge:repl] Skipping: OAuth token refresh failed - ${errorMessage(error49)}`);
571226
+ onStateChange?.("failed", errorMessage(error49));
571227
+ return null;
571228
+ }
570225
571229
  const tokens = getClaudeAIOAuthTokens();
570226
571230
  if (tokens && tokens.expiresAt !== null && tokens.expiresAt <= Date.now()) {
570227
571231
  logBridgeSkip("oauth_expired_unrefreshable", "[bridge:repl] Skipping: OAuth token expired and refresh failed (re-login required)");
@@ -570310,7 +571314,14 @@ async function initReplBridge(options) {
570310
571314
  return userMessageCount >= 3;
570311
571315
  };
570312
571316
  const initialHistoryCap = getFeatureValue_CACHED_WITH_REFRESH("tengu_bridge_initial_history_cap", 200, 5 * 60 * 1000);
570313
- const orgUUID = await getOrganizationUUID();
571317
+ let orgUUID;
571318
+ try {
571319
+ orgUUID = await getOrganizationUUID();
571320
+ } catch (error49) {
571321
+ logBridgeSkip("get_org_uuid_failed", `[bridge:repl] Skipping: failed to get organization UUID - ${errorMessage(error49)}`);
571322
+ onStateChange?.("failed", errorMessage(error49));
571323
+ return null;
571324
+ }
570314
571325
  if (!orgUUID) {
570315
571326
  logBridgeSkip("no_org_uuid", "[bridge:repl] Skipping: no org UUID");
570316
571327
  onStateChange?.("failed", "/login");
@@ -571200,30 +572211,30 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initial
571200
572211
  }
571201
572212
  const isMainThread = (cmd) => cmd.agentId === undefined;
571202
572213
  try {
571203
- let command8;
572214
+ let command9;
571204
572215
  let waitingForAgents = false;
571205
572216
  const drainCommandQueue = async () => {
571206
- while (command8 = dequeue(isMainThread)) {
571207
- if (command8.mode !== "prompt" && command8.mode !== "orphaned-permission" && command8.mode !== "task-notification") {
572217
+ while (command9 = dequeue(isMainThread)) {
572218
+ if (command9.mode !== "prompt" && command9.mode !== "orphaned-permission" && command9.mode !== "task-notification") {
571208
572219
  throw new Error("only prompt commands are supported in streaming mode");
571209
572220
  }
571210
- const batch = [command8];
571211
- if (command8.mode === "prompt") {
571212
- while (canBatchWith(command8, peek(isMainThread))) {
572221
+ const batch = [command9];
572222
+ if (command9.mode === "prompt") {
572223
+ while (canBatchWith(command9, peek(isMainThread))) {
571213
572224
  batch.push(dequeue(isMainThread));
571214
572225
  }
571215
572226
  if (batch.length > 1) {
571216
- command8 = {
571217
- ...command8,
572227
+ command9 = {
572228
+ ...command9,
571218
572229
  value: joinPromptValues(batch.map((c6) => c6.value)),
571219
- uuid: batch.findLast((c6) => c6.uuid)?.uuid ?? command8.uuid
572230
+ uuid: batch.findLast((c6) => c6.uuid)?.uuid ?? command9.uuid
571220
572231
  };
571221
572232
  }
571222
572233
  }
571223
572234
  const batchUuids = batch.map((c6) => c6.uuid).filter((u4) => u4 !== undefined);
571224
572235
  if (options.replayUserMessages && batch.length > 1) {
571225
572236
  for (const c6 of batch) {
571226
- if (c6.uuid && c6.uuid !== command8.uuid) {
572237
+ if (c6.uuid && c6.uuid !== command9.uuid) {
571227
572238
  output.enqueue({
571228
572239
  type: "user",
571229
572240
  message: { role: "user", content: c6.value },
@@ -571249,8 +572260,8 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initial
571249
572260
  for (const uuid5 of batchUuids) {
571250
572261
  notifyCommandLifecycle(uuid5, "started");
571251
572262
  }
571252
- if (command8.mode === "task-notification") {
571253
- const notificationText = typeof command8.value === "string" ? command8.value : "";
572263
+ if (command9.mode === "task-notification") {
572264
+ const notificationText = typeof command9.value === "string" ? command9.value : "";
571254
572265
  const taskIdMatch = notificationText.match(/<task-id>([^<]+)<\/task-id>/);
571255
572266
  const toolUseIdMatch = notificationText.match(/<tool-use-id>([^<]+)<\/tool-use-id>/);
571256
572267
  const outputFileMatch = notificationText.match(/<output-file>([^<]+)<\/output-file>/);
@@ -571283,8 +572294,8 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initial
571283
572294
  });
571284
572295
  }
571285
572296
  }
571286
- const input = command8.value;
571287
- if (structuredIO instanceof RemoteIO && command8.mode === "prompt") {
572297
+ const input = command9.value;
572298
+ if (structuredIO instanceof RemoteIO && command9.mode === "prompt") {
571288
572299
  logEvent("tengu_bridge_message_received", {
571289
572300
  is_repl: false
571290
572301
  });
@@ -571294,7 +572305,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initial
571294
572305
  suggestionState.pendingSuggestion = null;
571295
572306
  suggestionState.pendingLastEmittedEntry = null;
571296
572307
  if (suggestionState.lastEmitted) {
571297
- if (command8.mode === "prompt") {
572308
+ if (command9.mode === "prompt") {
571298
572309
  const inputText = typeof input === "string" ? input : input.find((b3) => b3.type === "text")?.text;
571299
572310
  if (typeof inputText === "string") {
571300
572311
  logSuggestionOutcome(suggestionState.lastEmitted.text, inputText, suggestionState.lastEmitted.emittedAt, suggestionState.lastEmitted.promptId, suggestionState.lastEmitted.generationRequestId);
@@ -571306,7 +572317,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initial
571306
572317
  const turnStartTime = undefined;
571307
572318
  headlessProfilerCheckpoint("before_ask");
571308
572319
  startQueryProfile();
571309
- const cmd = command8;
572320
+ const cmd = command9;
571310
572321
  await runWithWorkload(cmd.workload ?? options.workload, async () => {
571311
572322
  for await (const message of ask({
571312
572323
  commands: uniqBy_default([...currentCommands, ...appState.mcp.commands], "name"),
@@ -571327,8 +572338,8 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initial
571327
572338
  jsonSchema: getInitJsonSchema() ?? options.jsonSchema,
571328
572339
  mutableMessages,
571329
572340
  getReadFileCache: () => pendingSeeds.size === 0 ? readFileState : mergeFileStateCaches(readFileState, pendingSeeds),
571330
- setReadFileCache: (cache5) => {
571331
- readFileState = cache5;
572341
+ setReadFileCache: (cache6) => {
572342
+ readFileState = cache6;
571332
572343
  for (const [path27, seed] of pendingSeeds.entries()) {
571333
572344
  const existing = readFileState.get(path27);
571334
572345
  if (!existing || seed.timestamp > existing.timestamp) {
@@ -571987,8 +572998,8 @@ ${m2.text}
571987
572998
  const controller = new AbortController;
571988
572999
  activeOAuthFlows.set(serverName, controller);
571989
573000
  let resolveAuthUrl;
571990
- const authUrlPromise = new Promise((resolve50) => {
571991
- resolveAuthUrl = resolve50;
573001
+ const authUrlPromise = new Promise((resolve49) => {
573002
+ resolveAuthUrl = resolve49;
571992
573003
  });
571993
573004
  const oauthPromise = performMCPOAuthFlow(serverName, config5, (url3) => resolveAuthUrl(url3), controller.signal, {
571994
573005
  skipBrowserOpen: true,
@@ -572101,8 +573112,8 @@ ${m2.text}
572101
573112
  });
572102
573113
  const service = new OAuthService;
572103
573114
  let urlResolver;
572104
- const urlPromise = new Promise((resolve50) => {
572105
- urlResolver = resolve50;
573115
+ const urlPromise = new Promise((resolve49) => {
573116
+ urlResolver = resolve49;
572106
573117
  });
572107
573118
  const flow = service.startOAuthFlow(async (manualUrl, automaticUrl) => {
572108
573119
  urlResolver({ manualUrl, automaticUrl });
@@ -572490,8 +573501,8 @@ function createCanUseToolWithPermissionPrompt(permissionPromptTool) {
572490
573501
  }
572491
573502
  };
572492
573503
  }
572493
- const abortPromise = new Promise((resolve50) => {
572494
- combinedSignal.addEventListener("abort", () => resolve50("aborted"), {
573504
+ const abortPromise = new Promise((resolve49) => {
573505
+ combinedSignal.addEventListener("abort", () => resolve49("aborted"), {
572495
573506
  once: true
572496
573507
  });
572497
573508
  });
@@ -572629,10 +573640,10 @@ async function handleInitializeRequest(request, requestId, initialized5, output,
572629
573640
  description: formatDescriptionWithSource(cmd),
572630
573641
  argumentHint: cmd.argumentHint || ""
572631
573642
  })),
572632
- agents: agents2.map((agent) => ({
572633
- name: agent.agentType,
572634
- description: agent.whenToUse,
572635
- model: agent.model === "inherit" ? undefined : agent.model
573643
+ agents: agents2.map((agent2) => ({
573644
+ name: agent2.agentType,
573645
+ description: agent2.whenToUse,
573646
+ model: agent2.model === "inherit" ? undefined : agent2.model
572636
573647
  })),
572637
573648
  output_style: outputStyle2,
572638
573649
  available_output_styles: Object.keys(availableOutputStyles),
@@ -573290,7 +574301,7 @@ var init_print = __esm(() => {
573290
574301
  init_cwd2();
573291
574302
  init_omit();
573292
574303
  init_reject2();
573293
- init_bridgeStatusUtil();
574304
+ init_bridgeUrlBuilder();
573294
574305
  init_inboundMessages();
573295
574306
  init_inboundAttachments();
573296
574307
  init_permissions2();
@@ -574798,7 +575809,7 @@ __export(exports_plugins, {
574798
575809
  VALID_UPDATE_SCOPES: () => VALID_UPDATE_SCOPES,
574799
575810
  VALID_INSTALLABLE_SCOPES: () => VALID_INSTALLABLE_SCOPES
574800
575811
  });
574801
- import { basename as basename63, dirname as dirname71 } from "path";
575812
+ import { basename as basename62, dirname as dirname71 } from "path";
574802
575813
  function handleMarketplaceError(error49, action2) {
574803
575814
  logError2(error49);
574804
575815
  cliError(`${figures_default.cross} Failed to ${action2}: ${errorMessage(error49)}`);
@@ -574832,7 +575843,7 @@ async function pluginValidateHandler(manifestPath, options) {
574832
575843
  let contentResults = [];
574833
575844
  if (result.fileType === "plugin") {
574834
575845
  const manifestDir = dirname71(result.filePath);
574835
- if (basename63(manifestDir) === ".claude-plugin") {
575846
+ if (basename62(manifestDir) === ".claude-plugin") {
574836
575847
  contentResults = await validatePluginContents(dirname71(manifestDir));
574837
575848
  for (const r of contentResults) {
574838
575849
  console.log(`Validating ${r.fileType}: ${r.filePath}
@@ -575677,7 +576688,7 @@ async function setupTokenHandler(root2) {
575677
576688
  const {
575678
576689
  ConsoleOAuthFlow: ConsoleOAuthFlow2
575679
576690
  } = await Promise.resolve().then(() => (init_ConsoleOAuthFlow(), exports_ConsoleOAuthFlow));
575680
- await new Promise((resolve50) => {
576691
+ await new Promise((resolve49) => {
575681
576692
  root2.render(/* @__PURE__ */ jsx_dev_runtime491.jsxDEV(AppStateProvider, {
575682
576693
  onChangeAppState,
575683
576694
  children: /* @__PURE__ */ jsx_dev_runtime491.jsxDEV(KeybindingSetup, {
@@ -575701,7 +576712,7 @@ async function setupTokenHandler(root2) {
575701
576712
  }, undefined, true, undefined, this),
575702
576713
  /* @__PURE__ */ jsx_dev_runtime491.jsxDEV(ConsoleOAuthFlow2, {
575703
576714
  onDone: () => {
575704
- resolve50();
576715
+ resolve49();
575705
576716
  },
575706
576717
  mode: "setup-token",
575707
576718
  startingMessage: "This will guide you through long-lived (1-year) auth token setup for your Claude account. Claude subscription required."
@@ -575737,7 +576748,7 @@ function DoctorWithPlugins(t0) {
575737
576748
  }
575738
576749
  async function doctorHandler(root2) {
575739
576750
  logEvent("tengu_doctor_command", {});
575740
- await new Promise((resolve50) => {
576751
+ await new Promise((resolve49) => {
575741
576752
  root2.render(/* @__PURE__ */ jsx_dev_runtime491.jsxDEV(AppStateProvider, {
575742
576753
  children: /* @__PURE__ */ jsx_dev_runtime491.jsxDEV(KeybindingSetup, {
575743
576754
  children: /* @__PURE__ */ jsx_dev_runtime491.jsxDEV(MCPConnectionManager, {
@@ -575745,7 +576756,7 @@ async function doctorHandler(root2) {
575745
576756
  isStrictMcpConfig: false,
575746
576757
  children: /* @__PURE__ */ jsx_dev_runtime491.jsxDEV(DoctorWithPlugins, {
575747
576758
  onDone: () => {
575748
- resolve50();
576759
+ resolve49();
575749
576760
  }
575750
576761
  }, undefined, false, undefined, this)
575751
576762
  }, undefined, false, undefined, this)
@@ -575763,14 +576774,14 @@ async function installHandler(target, options) {
575763
576774
  const {
575764
576775
  install: install2
575765
576776
  } = await Promise.resolve().then(() => (init_install(), exports_install));
575766
- await new Promise((resolve50) => {
576777
+ await new Promise((resolve49) => {
575767
576778
  const args = [];
575768
576779
  if (target)
575769
576780
  args.push(target);
575770
576781
  if (options.force)
575771
576782
  args.push("--force");
575772
576783
  install2.call((result) => {
575773
- resolve50();
576784
+ resolve49();
575774
576785
  process.exit(result.includes("failed") ? 1 : 0);
575775
576786
  }, {}, args);
575776
576787
  });
@@ -575799,14 +576810,14 @@ var exports_agents3 = {};
575799
576810
  __export(exports_agents3, {
575800
576811
  agentsHandler: () => agentsHandler
575801
576812
  });
575802
- function formatAgent(agent) {
575803
- const model = resolveAgentModelDisplay(agent);
575804
- const parts = [agent.agentType];
576813
+ function formatAgent(agent2) {
576814
+ const model = resolveAgentModelDisplay(agent2);
576815
+ const parts = [agent2.agentType];
575805
576816
  if (model) {
575806
576817
  parts.push(model);
575807
576818
  }
575808
- if (agent.memory) {
575809
- parts.push(`${agent.memory} memory`);
576819
+ if (agent2.memory) {
576820
+ parts.push(`${agent2.memory} memory`);
575810
576821
  }
575811
576822
  return parts.join(" · ");
575812
576823
  }
@@ -575822,12 +576833,12 @@ async function agentsHandler() {
575822
576833
  if (groupAgents.length === 0)
575823
576834
  continue;
575824
576835
  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)}`);
576836
+ for (const agent2 of groupAgents) {
576837
+ if (agent2.overriddenBy) {
576838
+ const winnerSource = getOverrideSourceLabel(agent2.overriddenBy);
576839
+ lines2.push(` (shadowed by ${winnerSource}) ${formatAgent(agent2)}`);
575829
576840
  } else {
575830
- lines2.push(` ${formatAgent(agent)}`);
576841
+ lines2.push(` ${formatAgent(agent2)}`);
575831
576842
  totalActive++;
575832
576843
  }
575833
576844
  }
@@ -576210,7 +577221,7 @@ __export(exports_main, {
576210
577221
  main: () => main
576211
577222
  });
576212
577223
  import { readFileSync as readFileSync19 } from "fs";
576213
- import { resolve as resolve50, join as join163, dirname as dirname72 } from "path";
577224
+ import { resolve as resolve49, join as join163, dirname as dirname72 } from "path";
576214
577225
  import { fileURLToPath as fileURLToPath10 } from "url";
576215
577226
  import { existsSync as existsSync12 } from "fs";
576216
577227
  function logManagedSettings() {
@@ -576287,22 +577298,34 @@ async function logStartupTelemetry() {
576287
577298
  ...getCertEnvVarTelemetry()
576288
577299
  });
576289
577300
  }
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();
577301
+ async function runMigrations() {
577302
+ const globalConfig2 = getGlobalConfig();
577303
+ const needsRun = globalConfig2.migrationVersion !== CURRENT_MIGRATION_VERSION || !Array.isArray(globalConfig2.completedMigrations);
577304
+ if (needsRun) {
577305
+ const migrations = [
577306
+ { name: "migrateAutoUpdatesToSettings", migration: migrateAutoUpdatesToSettings },
577307
+ { name: "migrateBypassPermissionsAcceptedToSettings", migration: migrateBypassPermissionsAcceptedToSettings },
577308
+ { name: "migrateEnableAllProjectMcpServersToSettings", migration: migrateEnableAllProjectMcpServersToSettings, dependsOn: ["migrateReplBridgeEnabledToRemoteControlAtStartup"] },
577309
+ { name: "resetProToOpusDefault", migration: resetProToOpusDefault },
577310
+ { name: "migrateSonnet1mToSonnet45", migration: migrateSonnet1mToSonnet45 },
577311
+ { name: "migrateLegacyOpusToCurrent", migration: migrateLegacyOpusToCurrent },
577312
+ { name: "migrateSonnet45ToSonnet46", migration: migrateSonnet45ToSonnet46 },
577313
+ { name: "migrateOpusToOpus1m", migration: migrateOpusToOpus1m },
577314
+ { name: "migrateReplBridgeEnabledToRemoteControlAtStartup", migration: migrateReplBridgeEnabledToRemoteControlAtStartup }
577315
+ ];
576301
577316
  if (false) {}
576302
577317
  if (false) {}
576303
- saveGlobalConfig((prev) => prev.migrationVersion === CURRENT_MIGRATION_VERSION ? prev : {
576304
- ...prev,
576305
- migrationVersion: CURRENT_MIGRATION_VERSION
577318
+ const result = await runMigrationsSafe(migrations, globalConfig2.completedMigrations ?? []);
577319
+ saveGlobalConfig((prev) => {
577320
+ const completed = new Set(prev.completedMigrations ?? []);
577321
+ for (const name of result.newlyCompleted) {
577322
+ completed.add(name);
577323
+ }
577324
+ return {
577325
+ ...prev,
577326
+ migrationVersion: CURRENT_MIGRATION_VERSION,
577327
+ completedMigrations: [...completed]
577328
+ };
576306
577329
  });
576307
577330
  }
576308
577331
  migrateChangelogFromConfig().catch(() => {});
@@ -576554,7 +577577,7 @@ async function run() {
576554
577577
  setInlinePlugins(pluginDir);
576555
577578
  clearPluginCache("preAction: --plugin-dir inline plugins");
576556
577579
  }
576557
- runMigrations();
577580
+ await runMigrations();
576558
577581
  profileCheckpoint("preAction_after_migrations");
576559
577582
  loadRemoteManagedSettings();
576560
577583
  loadPolicyLimits();
@@ -576774,12 +577797,12 @@ ${getTmuxInstallInstructions2()}
576774
577797
  process.exit(1);
576775
577798
  }
576776
577799
  try {
576777
- const filePath = resolve50(options.systemPromptFile);
577800
+ const filePath = resolve49(options.systemPromptFile);
576778
577801
  systemPrompt = readFileSync19(filePath, "utf8");
576779
577802
  } catch (error49) {
576780
577803
  const code = getErrnoCode(error49);
576781
577804
  if (code === "ENOENT") {
576782
- process.stderr.write(source_default.red(`Error: System prompt file not found: ${resolve50(options.systemPromptFile)}
577805
+ process.stderr.write(source_default.red(`Error: System prompt file not found: ${resolve49(options.systemPromptFile)}
576783
577806
  `));
576784
577807
  process.exit(1);
576785
577808
  }
@@ -576796,12 +577819,12 @@ ${getTmuxInstallInstructions2()}
576796
577819
  process.exit(1);
576797
577820
  }
576798
577821
  try {
576799
- const filePath = resolve50(options.appendSystemPromptFile);
577822
+ const filePath = resolve49(options.appendSystemPromptFile);
576800
577823
  appendSystemPrompt = readFileSync19(filePath, "utf8");
576801
577824
  } catch (error49) {
576802
577825
  const code = getErrnoCode(error49);
576803
577826
  if (code === "ENOENT") {
576804
- process.stderr.write(source_default.red(`Error: Append system prompt file not found: ${resolve50(options.appendSystemPromptFile)}
577827
+ process.stderr.write(source_default.red(`Error: Append system prompt file not found: ${resolve49(options.appendSystemPromptFile)}
576805
577828
  `));
576806
577829
  process.exit(1);
576807
577830
  }
@@ -576847,7 +577870,7 @@ ${addendum}` : addendum;
576847
577870
  errors6 = result.errors;
576848
577871
  }
576849
577872
  } else {
576850
- const configPath = resolve50(configItem);
577873
+ const configPath = resolve49(configItem);
576851
577874
  const result = parseMcpConfigFromFilePath({
576852
577875
  filePath: configPath,
576853
577876
  expandVars: true,
@@ -577137,7 +578160,7 @@ ${hint}` : hint;
577137
578160
  const agentSetting = agentCli ?? getInitialSettings().agent;
577138
578161
  let mainThreadAgentDefinition;
577139
578162
  if (agentSetting) {
577140
- mainThreadAgentDefinition = agentDefinitions.activeAgents.find((agent) => agent.agentType === agentSetting);
578163
+ mainThreadAgentDefinition = agentDefinitions.activeAgents.find((agent2) => agent2.agentType === agentSetting);
577141
578164
  if (!mainThreadAgentDefinition) {
577142
578165
  logForDebugging(`Warning: agent "${agentSetting}" not found. Available agents: ${agentDefinitions.activeAgents.map((a2) => a2.agentType).join(", ")}. Using default behavior.`);
577143
578166
  }
@@ -577481,7 +578504,7 @@ ${customInstructions}` : customInstructions;
577481
578504
  `);
577482
578505
  process.exit(1);
577483
578506
  }
577484
- const commandsHeadless = disableSlashCommands ? [] : commands.filter((command8) => command8.type === "prompt" && !command8.disableNonInteractive || command8.type === "local" && command8.supportsNonInteractive);
578507
+ const commandsHeadless = disableSlashCommands ? [] : commands.filter((command9) => command9.type === "prompt" && !command9.disableNonInteractive || command9.type === "local" && command9.supportsNonInteractive);
577485
578508
  const defaultState = getDefaultAppState();
577486
578509
  const headlessInitialState = {
577487
578510
  ...defaultState,
@@ -577601,8 +578624,8 @@ ${customInstructions}` : customInstructions;
577601
578624
  return connectMcpBatch(dedupedClaudeAi, "claudeai");
577602
578625
  });
577603
578626
  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);
578627
+ const claudeaiTimedOut = await Promise.race([claudeaiConnect.then(() => false), new Promise((resolve50) => {
578628
+ claudeaiTimer = setTimeout((r) => r(true), CLAUDE_AI_MCP_TIMEOUT_MS, resolve50);
577606
578629
  })]);
577607
578630
  if (claudeaiTimer)
577608
578631
  clearTimeout(claudeaiTimer);
@@ -578530,7 +579553,7 @@ function extractTeammateOptions(options) {
578530
579553
  agentType: typeof opts.agentType === "string" ? opts.agentType : undefined
578531
579554
  };
578532
579555
  }
578533
- var getTeammateUtils = () => (init_teammate(), __toCommonJS(exports_teammate)), getTeammatePromptAddendum = () => __toCommonJS(exports_teammatePromptAddendum), getTeammateModeSnapshot = () => (init_teammateModeSnapshot(), __toCommonJS(exports_teammateModeSnapshot)), coordinatorModeModule = null, CURRENT_MIGRATION_VERSION = 11;
579556
+ var getTeammateUtils = () => (init_teammate(), __toCommonJS(exports_teammate)), getTeammatePromptAddendum = () => __toCommonJS(exports_teammatePromptAddendum), getTeammateModeSnapshot = () => (init_teammateModeSnapshot(), __toCommonJS(exports_teammateModeSnapshot)), coordinatorModeModule = null, CURRENT_MIGRATION_VERSION = 12;
578534
579557
  var init_main3 = __esm(() => {
578535
579558
  init_startupProfiler();
578536
579559
  init_rawRead();
@@ -578655,6 +579678,7 @@ var init_main3 = __esm(() => {
578655
579678
  init_migrateSonnet45ToSonnet46();
578656
579679
  init_resetAutoModeOptInForDefaultOffer();
578657
579680
  init_resetProToOpusDefault();
579681
+ init_migrationRunner();
578658
579682
  init_RemoteSessionManager();
578659
579683
  init_createDirectConnectSession();
578660
579684
  init_manager();