ur-agent 1.22.3 → 1.22.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -16939,7 +16939,7 @@ function formatAgentTrendReport(report = buildAgentTrendReport()) {
16939
16939
  function formatA2AAgentCard(options = {}, pretty = true) {
16940
16940
  return JSON.stringify(buildA2AAgentCard(options), null, pretty ? 2 : 0);
16941
16941
  }
16942
- var urVersion = "1.22.3", coverage, priorityRoadmap;
16942
+ var urVersion = "1.22.4", coverage, priorityRoadmap;
16943
16943
  var init_trends = __esm(() => {
16944
16944
  coverage = [
16945
16945
  {
@@ -70955,7 +70955,7 @@ var init_auth = __esm(() => {
70955
70955
 
70956
70956
  // src/utils/userAgent.ts
70957
70957
  function getURCodeUserAgent() {
70958
- return `ur/${"1.22.3"}`;
70958
+ return `ur/${"1.22.4"}`;
70959
70959
  }
70960
70960
 
70961
70961
  // src/utils/workloadContext.ts
@@ -70977,7 +70977,7 @@ function getUserAgent() {
70977
70977
  const clientApp = process.env.UR_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.UR_AGENT_SDK_CLIENT_APP}` : "";
70978
70978
  const workload = getWorkload();
70979
70979
  const workloadSuffix = workload ? `, workload/${workload}` : "";
70980
- return `ur-cli/${"1.22.3"} (${process.env.USER_TYPE}, ${process.env.UR_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
70980
+ return `ur-cli/${"1.22.4"} (${process.env.USER_TYPE}, ${process.env.UR_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
70981
70981
  }
70982
70982
  function getMCPUserAgent() {
70983
70983
  const parts = [];
@@ -70991,7 +70991,7 @@ function getMCPUserAgent() {
70991
70991
  parts.push(`client-app/${process.env.UR_AGENT_SDK_CLIENT_APP}`);
70992
70992
  }
70993
70993
  const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
70994
- return `ur/${"1.22.3"}${suffix}`;
70994
+ return `ur/${"1.22.4"}${suffix}`;
70995
70995
  }
70996
70996
  function getWebFetchUserAgent() {
70997
70997
  return `UR-User (${getURCodeUserAgent()})`;
@@ -71426,7 +71426,7 @@ var init_user = __esm(() => {
71426
71426
  deviceId,
71427
71427
  sessionId: getSessionId(),
71428
71428
  email: getEmail(),
71429
- appVersion: "1.22.3",
71429
+ appVersion: "1.22.4",
71430
71430
  platform: getHostPlatformForAnalytics(),
71431
71431
  organizationUuid,
71432
71432
  accountUuid,
@@ -77203,7 +77203,7 @@ var init_metadata = __esm(() => {
77203
77203
  COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
77204
77204
  WHITESPACE_REGEX = /\s+/;
77205
77205
  getVersionBase = memoize_default(() => {
77206
- const match = "1.22.3".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
77206
+ const match = "1.22.4".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
77207
77207
  return match ? match[0] : undefined;
77208
77208
  });
77209
77209
  buildEnvContext = memoize_default(async () => {
@@ -77243,7 +77243,7 @@ var init_metadata = __esm(() => {
77243
77243
  isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
77244
77244
  isURCodeAction: isEnvTruthy(process.env.UR_CODE_ACTION),
77245
77245
  isURAiAuth: isURAISubscriber2(),
77246
- version: "1.22.3",
77246
+ version: "1.22.4",
77247
77247
  versionBase: getVersionBase(),
77248
77248
  buildTime: "",
77249
77249
  deploymentEnvironment: env3.detectDeploymentEnvironment(),
@@ -77913,7 +77913,7 @@ function initialize1PEventLogging() {
77913
77913
  const platform2 = getPlatform();
77914
77914
  const attributes = {
77915
77915
  [import_semantic_conventions4.ATTR_SERVICE_NAME]: "ur",
77916
- [import_semantic_conventions4.ATTR_SERVICE_VERSION]: "1.22.3"
77916
+ [import_semantic_conventions4.ATTR_SERVICE_VERSION]: "1.22.4"
77917
77917
  };
77918
77918
  if (platform2 === "wsl") {
77919
77919
  const wslVersion = getWslVersion();
@@ -77940,7 +77940,7 @@ function initialize1PEventLogging() {
77940
77940
  })
77941
77941
  ]
77942
77942
  });
77943
- firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.urhq.ur.events", "1.22.3");
77943
+ firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.urhq.ur.events", "1.22.4");
77944
77944
  }
77945
77945
  async function reinitialize1PEventLoggingIfConfigChanged() {
77946
77946
  if (!is1PEventLoggingEnabled() || !firstPartyEventLoggerProvider) {
@@ -79808,7 +79808,7 @@ function getAttributionHeader(fingerprint) {
79808
79808
  if (!isAttributionHeaderEnabled()) {
79809
79809
  return "";
79810
79810
  }
79811
- const version2 = `${"1.22.3"}.${fingerprint}`;
79811
+ const version2 = `${"1.22.4"}.${fingerprint}`;
79812
79812
  const entrypoint = process.env.UR_CODE_ENTRYPOINT ?? "unknown";
79813
79813
  const cch = "";
79814
79814
  const workload = getWorkload();
@@ -187298,7 +187298,7 @@ function getTelemetryAttributes() {
187298
187298
  attributes["session.id"] = sessionId;
187299
187299
  }
187300
187300
  if (shouldIncludeAttribute("OTEL_METRICS_INCLUDE_VERSION")) {
187301
- attributes["app.version"] = "1.22.3";
187301
+ attributes["app.version"] = "1.22.4";
187302
187302
  }
187303
187303
  const oauthAccount = getOauthAccountInfo();
187304
187304
  if (oauthAccount) {
@@ -223087,7 +223087,7 @@ function getInstallationEnv() {
223087
223087
  return;
223088
223088
  }
223089
223089
  function getURCodeVersion() {
223090
- return "1.22.3";
223090
+ return "1.22.4";
223091
223091
  }
223092
223092
  async function getInstalledVSCodeExtensionVersion(command) {
223093
223093
  const { stdout } = await execFileNoThrow(command, ["--list-extensions", "--show-versions"], {
@@ -225815,7 +225815,7 @@ async function setupSdkMcpClients(sdkMcpConfigs, sendMcpMessage) {
225815
225815
  const client2 = new Client({
225816
225816
  name: "ur",
225817
225817
  title: "UR",
225818
- version: "1.22.3",
225818
+ version: "1.22.4",
225819
225819
  description: "URHQ's agentic coding tool",
225820
225820
  websiteUrl: PRODUCT_URL
225821
225821
  }, {
@@ -226169,7 +226169,7 @@ var init_client5 = __esm(() => {
226169
226169
  const client2 = new Client({
226170
226170
  name: "ur",
226171
226171
  title: "UR",
226172
- version: "1.22.3",
226172
+ version: "1.22.4",
226173
226173
  description: "URHQ's agentic coding tool",
226174
226174
  websiteUrl: PRODUCT_URL
226175
226175
  }, {
@@ -235982,9 +235982,9 @@ async function assertMinVersion() {
235982
235982
  if (false) {}
235983
235983
  try {
235984
235984
  const versionConfig = await getDynamicConfig_BLOCKS_ON_INIT("tengu_version_config", { minVersion: "0.0.0" });
235985
- if (versionConfig.minVersion && lt("1.22.3", versionConfig.minVersion)) {
235985
+ if (versionConfig.minVersion && lt("1.22.4", versionConfig.minVersion)) {
235986
235986
  console.error(`
235987
- It looks like your version of UR (${"1.22.3"}) needs an update.
235987
+ It looks like your version of UR (${"1.22.4"}) needs an update.
235988
235988
  A newer version (${versionConfig.minVersion} or higher) is required to continue.
235989
235989
 
235990
235990
  To update, please run:
@@ -236200,7 +236200,7 @@ async function installGlobalPackage(specificVersion) {
236200
236200
  logError2(new AutoUpdaterError("Another process is currently installing an update"));
236201
236201
  logEvent("tengu_auto_updater_lock_contention", {
236202
236202
  pid: process.pid,
236203
- currentVersion: "1.22.3"
236203
+ currentVersion: "1.22.4"
236204
236204
  });
236205
236205
  return "in_progress";
236206
236206
  }
@@ -236209,7 +236209,7 @@ async function installGlobalPackage(specificVersion) {
236209
236209
  if (!env3.isRunningWithBun() && env3.isNpmFromWindowsPath()) {
236210
236210
  logError2(new Error("Windows NPM detected in WSL environment"));
236211
236211
  logEvent("tengu_auto_updater_windows_npm_in_wsl", {
236212
- currentVersion: "1.22.3"
236212
+ currentVersion: "1.22.4"
236213
236213
  });
236214
236214
  console.error(`
236215
236215
  Error: Windows NPM detected in WSL
@@ -236744,7 +236744,7 @@ function detectLinuxGlobPatternWarnings() {
236744
236744
  }
236745
236745
  async function getDoctorDiagnostic() {
236746
236746
  const installationType = await getCurrentInstallationType();
236747
- const version2 = typeof MACRO !== "undefined" ? "1.22.3" : "unknown";
236747
+ const version2 = typeof MACRO !== "undefined" ? "1.22.4" : "unknown";
236748
236748
  const installationPath = await getInstallationPath();
236749
236749
  const invokedBinary = getInvokedBinary();
236750
236750
  const multipleInstallations = await detectMultipleInstallations();
@@ -237679,8 +237679,8 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
237679
237679
  const maxVersion = await getMaxVersion();
237680
237680
  if (maxVersion && gt(version2, maxVersion)) {
237681
237681
  logForDebugging(`Native installer: maxVersion ${maxVersion} is set, capping update from ${version2} to ${maxVersion}`);
237682
- if (gte("1.22.3", maxVersion)) {
237683
- logForDebugging(`Native installer: current version ${"1.22.3"} is already at or above maxVersion ${maxVersion}, skipping update`);
237682
+ if (gte("1.22.4", maxVersion)) {
237683
+ logForDebugging(`Native installer: current version ${"1.22.4"} is already at or above maxVersion ${maxVersion}, skipping update`);
237684
237684
  logEvent("tengu_native_update_skipped_max_version", {
237685
237685
  latency_ms: Date.now() - startTime,
237686
237686
  max_version: maxVersion,
@@ -237691,7 +237691,7 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
237691
237691
  version2 = maxVersion;
237692
237692
  }
237693
237693
  }
237694
- if (!forceReinstall && version2 === "1.22.3" && await versionIsAvailable(version2) && await isPossibleURBinary(executablePath)) {
237694
+ if (!forceReinstall && version2 === "1.22.4" && await versionIsAvailable(version2) && await isPossibleURBinary(executablePath)) {
237695
237695
  logForDebugging(`Found ${version2} at ${executablePath}, skipping install`);
237696
237696
  logEvent("tengu_native_update_complete", {
237697
237697
  latency_ms: Date.now() - startTime,
@@ -270267,7 +270267,8 @@ function createLSPServerInstance(name, config2) {
270267
270267
  capabilities: {
270268
270268
  workspace: {
270269
270269
  configuration: false,
270270
- workspaceFolders: false
270270
+ workspaceFolders: false,
270271
+ applyEdit: true
270271
270272
  },
270272
270273
  textDocument: {
270273
270274
  synchronization: {
@@ -270293,6 +270294,11 @@ function createLSPServerInstance(name, config2) {
270293
270294
  dynamicRegistration: false,
270294
270295
  linkSupport: true
270295
270296
  },
270297
+ rename: {
270298
+ dynamicRegistration: false,
270299
+ prepareSupport: true,
270300
+ prepareSupportDefaultBehavior: 1
270301
+ },
270296
270302
  references: {
270297
270303
  dynamicRegistration: false
270298
270304
  },
@@ -270500,6 +270506,10 @@ function createLSPServerManager() {
270500
270506
  logForDebugging(`LSP: Received workspace/configuration request from ${serverName}`);
270501
270507
  return params.items.map(() => null);
270502
270508
  });
270509
+ instance.onRequest("workspace/applyEdit", (params) => {
270510
+ logForDebugging(`LSP: Received workspace/applyEdit request from ${serverName}`);
270511
+ return { applied: true };
270512
+ });
270503
270513
  } catch (error40) {
270504
270514
  const err2 = error40;
270505
270515
  logError2(new Error(`Failed to initialize LSP server ${serverName}: ${err2.message}`));
@@ -270654,6 +270664,11 @@ function createLSPServerManager() {
270654
270664
  const fileUri = pathToFileURL5(path12.resolve(filePath)).href;
270655
270665
  return openedFiles.has(fileUri);
270656
270666
  }
270667
+ function onRequest(method, handler) {
270668
+ for (const server2 of servers.values()) {
270669
+ server2.onRequest(method, handler);
270670
+ }
270671
+ }
270657
270672
  return {
270658
270673
  initialize: initialize3,
270659
270674
  shutdown,
@@ -270665,7 +270680,8 @@ function createLSPServerManager() {
270665
270680
  changeFile,
270666
270681
  saveFile,
270667
270682
  closeFile,
270668
- isFileOpen
270683
+ isFileOpen,
270684
+ onRequest
270669
270685
  };
270670
270686
  }
270671
270687
  var init_LSPServerManager = __esm(() => {
@@ -334278,7 +334294,7 @@ function Feedback({
334278
334294
  platform: env3.platform,
334279
334295
  gitRepo: envInfo.isGit,
334280
334296
  terminal: env3.terminal,
334281
- version: "1.22.3",
334297
+ version: "1.22.4",
334282
334298
  transcript: normalizeMessagesForAPI(messages),
334283
334299
  errors: sanitizedErrors,
334284
334300
  lastApiRequest: getLastAPIRequest(),
@@ -334470,7 +334486,7 @@ function Feedback({
334470
334486
  ", ",
334471
334487
  env3.terminal,
334472
334488
  ", v",
334473
- "1.22.3"
334489
+ "1.22.4"
334474
334490
  ]
334475
334491
  }, undefined, true, undefined, this)
334476
334492
  ]
@@ -334576,7 +334592,7 @@ ${sanitizedDescription}
334576
334592
  ` + `**Environment Info**
334577
334593
  ` + `- Platform: ${env3.platform}
334578
334594
  ` + `- Terminal: ${env3.terminal}
334579
- ` + `- Version: ${"1.22.3"}
334595
+ ` + `- Version: ${"1.22.4"}
334580
334596
  ` + `- Feedback ID: ${feedbackId}
334581
334597
  ` + `
334582
334598
  **Errors**
@@ -337686,7 +337702,7 @@ function buildPrimarySection() {
337686
337702
  }, undefined, false, undefined, this);
337687
337703
  return [{
337688
337704
  label: "Version",
337689
- value: "1.22.3"
337705
+ value: "1.22.4"
337690
337706
  }, {
337691
337707
  label: "Session name",
337692
337708
  value: nameValue
@@ -340964,7 +340980,7 @@ function Config({
340964
340980
  }
340965
340981
  }, undefined, false, undefined, this)
340966
340982
  }, undefined, false, undefined, this) : showSubmenu === "ChannelDowngrade" ? /* @__PURE__ */ jsx_dev_runtime177.jsxDEV(ChannelDowngradeDialog, {
340967
- currentVersion: "1.22.3",
340983
+ currentVersion: "1.22.4",
340968
340984
  onChoice: (choice) => {
340969
340985
  setShowSubmenu(null);
340970
340986
  setTabsHidden(false);
@@ -340976,7 +340992,7 @@ function Config({
340976
340992
  autoUpdatesChannel: "stable"
340977
340993
  };
340978
340994
  if (choice === "stay") {
340979
- newSettings.minimumVersion = "1.22.3";
340995
+ newSettings.minimumVersion = "1.22.4";
340980
340996
  }
340981
340997
  updateSettingsForSource("userSettings", newSettings);
340982
340998
  setSettingsData((prev_27) => ({
@@ -349046,7 +349062,7 @@ function HelpV2(t0) {
349046
349062
  let t6;
349047
349063
  if ($3[31] !== tabs) {
349048
349064
  t6 = /* @__PURE__ */ jsx_dev_runtime204.jsxDEV(Tabs, {
349049
- title: `UR v${"1.22.3"}`,
349065
+ title: `UR v${"1.22.4"}`,
349050
349066
  color: "professionalBlue",
349051
349067
  defaultTab: "general",
349052
349068
  children: tabs
@@ -369010,7 +369026,7 @@ function getAllReleaseNotes(changelogContent = getStoredChangelogFromMemory()) {
369010
369026
  return [];
369011
369027
  }
369012
369028
  }
369013
- async function checkForReleaseNotes(lastSeenVersion, currentVersion = "1.22.3") {
369029
+ async function checkForReleaseNotes(lastSeenVersion, currentVersion = "1.22.4") {
369014
369030
  if (process.env.USER_TYPE === "ant") {
369015
369031
  const changelog = "";
369016
369032
  if (changelog) {
@@ -369037,7 +369053,7 @@ async function checkForReleaseNotes(lastSeenVersion, currentVersion = "1.22.3")
369037
369053
  releaseNotes
369038
369054
  };
369039
369055
  }
369040
- function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "1.22.3") {
369056
+ function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "1.22.4") {
369041
369057
  if (process.env.USER_TYPE === "ant") {
369042
369058
  const changelog = "";
369043
369059
  if (changelog) {
@@ -370207,7 +370223,7 @@ function getRecentActivitySync() {
370207
370223
  return cachedActivity;
370208
370224
  }
370209
370225
  function getLogoDisplayData() {
370210
- const version2 = process.env.DEMO_VERSION ?? "1.22.3";
370226
+ const version2 = process.env.DEMO_VERSION ?? "1.22.4";
370211
370227
  const serverUrl = getDirectConnectServerUrl();
370212
370228
  const displayPath = process.env.DEMO_VERSION ? "/code/ur" : getDisplayPath(getCwd2());
370213
370229
  const cwd2 = serverUrl ? `${displayPath} in ${serverUrl.replace(/^https?:\/\//, "")}` : displayPath;
@@ -370996,7 +371012,7 @@ function LogoV2() {
370996
371012
  if ($3[2] === Symbol.for("react.memo_cache_sentinel")) {
370997
371013
  t2 = () => {
370998
371014
  const currentConfig = getGlobalConfig();
370999
- if (currentConfig.lastReleaseNotesSeen === "1.22.3") {
371015
+ if (currentConfig.lastReleaseNotesSeen === "1.22.4") {
371000
371016
  return;
371001
371017
  }
371002
371018
  saveGlobalConfig(_temp326);
@@ -371681,12 +371697,12 @@ function LogoV2() {
371681
371697
  return t41;
371682
371698
  }
371683
371699
  function _temp326(current) {
371684
- if (current.lastReleaseNotesSeen === "1.22.3") {
371700
+ if (current.lastReleaseNotesSeen === "1.22.4") {
371685
371701
  return current;
371686
371702
  }
371687
371703
  return {
371688
371704
  ...current,
371689
- lastReleaseNotesSeen: "1.22.3"
371705
+ lastReleaseNotesSeen: "1.22.4"
371690
371706
  };
371691
371707
  }
371692
371708
  function _temp243(s_0) {
@@ -388639,7 +388655,7 @@ function buildToolUseContext(tools, readFileStateCache) {
388639
388655
  async function handleInitialize() {
388640
388656
  return {
388641
388657
  name: "ur-agent",
388642
- version: "1.22.3",
388658
+ version: "1.22.4",
388643
388659
  protocolVersion: "0.1.0"
388644
388660
  };
388645
388661
  }
@@ -569614,6 +569630,19 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
569614
569630
  });
569615
569631
 
569616
569632
  // src/services/repoEditing/reliableRepoEdit.ts
569633
+ var exports_reliableRepoEdit = {};
569634
+ __export(exports_reliableRepoEdit, {
569635
+ searchRepoEditIndex: () => searchRepoEditIndex,
569636
+ resolveRepoPath: () => resolveRepoPath,
569637
+ repoEditIndexPath: () => repoEditIndexPath,
569638
+ planRename: () => planRename,
569639
+ loadRepoEditIndex: () => loadRepoEditIndex,
569640
+ listRepoFiles: () => listRepoFiles,
569641
+ formatSearchHits: () => formatSearchHits,
569642
+ formatRenamePlan: () => formatRenamePlan,
569643
+ buildRepoEditIndex: () => buildRepoEditIndex,
569644
+ applyRename: () => applyRename
569645
+ });
569617
569646
  import { exec as exec6 } from "child_process";
569618
569647
  import {
569619
569648
  existsSync as existsSync48,
@@ -570015,6 +570044,14 @@ function formatSearchHits(hits) {
570015
570044
 
570016
570045
  `);
570017
570046
  }
570047
+ function resolveRepoPath(root2, maybePath) {
570048
+ const resolved = isAbsolute27(maybePath) ? maybePath : resolve44(root2, maybePath);
570049
+ const rel = relative36(root2, resolved);
570050
+ if (rel.startsWith("..")) {
570051
+ throw new Error(`Path escapes repository root: ${maybePath}`);
570052
+ }
570053
+ return resolved;
570054
+ }
570018
570055
  var import_typescript, execAsync, SKIP_DIRS, TEXT_EXTENSIONS, CODE_EXTENSIONS;
570019
570056
  var init_reliableRepoEdit = __esm(() => {
570020
570057
  init_lib();
@@ -570074,6 +570111,1054 @@ var init_reliableRepoEdit = __esm(() => {
570074
570111
  ]);
570075
570112
  });
570076
570113
 
570114
+ // src/services/repoEditing/ast/diagnostics.ts
570115
+ import { exec as exec7 } from "child_process";
570116
+ import { join as join169 } from "path";
570117
+ import { promisify as promisify5 } from "util";
570118
+ function emptySnapshot(source = "none") {
570119
+ return { files: {}, collectedAt: new Date().toISOString(), source };
570120
+ }
570121
+ async function collectDiagnostics(root2, files, options2 = {}) {
570122
+ if (options2.source === "none")
570123
+ return emptySnapshot("none");
570124
+ if (options2.externalCommand) {
570125
+ return runExternalCommand(root2, files, options2.externalCommand);
570126
+ }
570127
+ const tsFiles = files.filter(isTypeScriptPath);
570128
+ if (tsFiles.length > 0) {
570129
+ return collectTsDiagnostics(root2, tsFiles);
570130
+ }
570131
+ return emptySnapshot("none");
570132
+ }
570133
+ function diagnosticsDiff(before, after) {
570134
+ const key = (d) => `${d.file}:${d.line}:${d.column}:${d.severity}:${d.message}`;
570135
+ const beforeKeys = new Set((before.files ? Object.values(before.files).flat() : []).map(key));
570136
+ const afterFiles = after.files ? Object.values(after.files).flat() : [];
570137
+ return afterFiles.filter((d) => !beforeKeys.has(key(d)));
570138
+ }
570139
+ function isTypeScriptPath(file2) {
570140
+ const ext = file2.toLowerCase();
570141
+ return ext.endsWith(".ts") || ext.endsWith(".tsx") || ext.endsWith(".js") || ext.endsWith(".jsx");
570142
+ }
570143
+ function loadTsConfig(root2) {
570144
+ const configPath2 = import_typescript2.default.findConfigFile(root2, import_typescript2.default.sys.fileExists, "tsconfig.json");
570145
+ if (!configPath2)
570146
+ return {};
570147
+ const read = import_typescript2.default.readConfigFile(configPath2, import_typescript2.default.sys.readFile);
570148
+ if (read.error) {
570149
+ return { error: import_typescript2.default.flattenDiagnosticMessageText(read.error.messageText, `
570150
+ `) };
570151
+ }
570152
+ const parsed = import_typescript2.default.parseJsonConfigFileContent(read.config, import_typescript2.default.sys, root2);
570153
+ return { config: parsed };
570154
+ }
570155
+ function createSyntheticProgram(root2, files) {
570156
+ const compilerOptions = {
570157
+ target: import_typescript2.default.ScriptTarget.Latest,
570158
+ module: import_typescript2.default.ModuleKind.CommonJS,
570159
+ allowJs: true,
570160
+ checkJs: true,
570161
+ noEmit: true,
570162
+ strict: false
570163
+ };
570164
+ const host = import_typescript2.default.createCompilerHost(compilerOptions);
570165
+ const fileNames = files.map((f) => join169(root2, f));
570166
+ return import_typescript2.default.createProgram(fileNames, compilerOptions, host);
570167
+ }
570168
+ function collectTsDiagnostics(root2, files) {
570169
+ const tsConfig = loadTsConfig(root2);
570170
+ let program;
570171
+ if (tsConfig.config?.fileNames?.length) {
570172
+ const host = import_typescript2.default.createCompilerHost(tsConfig.config.options);
570173
+ program = import_typescript2.default.createProgram(tsConfig.config.fileNames, tsConfig.config.options, host);
570174
+ } else {
570175
+ program = createSyntheticProgram(root2, files);
570176
+ }
570177
+ const diagnostics = import_typescript2.default.getPreEmitDiagnostics(program);
570178
+ const snapshot2 = {
570179
+ files: {},
570180
+ collectedAt: new Date().toISOString(),
570181
+ source: "tsc"
570182
+ };
570183
+ for (const diagnostic of diagnostics) {
570184
+ if (!diagnostic.file || diagnostic.start === undefined)
570185
+ continue;
570186
+ const fileName = diagnostic.file.fileName;
570187
+ const rel = fileName.startsWith(root2) ? fileName.slice(root2.length + 1) : fileName;
570188
+ const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
570189
+ const entry = {
570190
+ file: rel,
570191
+ line: line + 1,
570192
+ column: character + 1,
570193
+ severity: diagnostic.category === import_typescript2.default.DiagnosticCategory.Error ? "error" : "warning",
570194
+ message: import_typescript2.default.flattenDiagnosticMessageText(diagnostic.messageText, `
570195
+ `),
570196
+ code: typeof diagnostic.code === "number" ? diagnostic.code : undefined
570197
+ };
570198
+ snapshot2.files[rel] = snapshot2.files[rel] ?? [];
570199
+ snapshot2.files[rel].push(entry);
570200
+ }
570201
+ return snapshot2;
570202
+ }
570203
+ async function runExternalCommand(root2, _files, command5) {
570204
+ try {
570205
+ const { stdout } = await execAsync2(command5, {
570206
+ cwd: root2,
570207
+ timeout: 10 * 60 * 1000,
570208
+ maxBuffer: 10 * 1024 * 1024
570209
+ });
570210
+ const parsed = parseExternalOutput(stdout);
570211
+ return {
570212
+ files: parsed,
570213
+ collectedAt: new Date().toISOString(),
570214
+ source: "external"
570215
+ };
570216
+ } catch (error40) {
570217
+ const e = error40;
570218
+ const parsed = parseExternalOutput(e.stdout ?? "");
570219
+ return {
570220
+ files: parsed,
570221
+ collectedAt: new Date().toISOString(),
570222
+ source: "external"
570223
+ };
570224
+ }
570225
+ }
570226
+ function parseExternalOutput(stdout) {
570227
+ const files = {};
570228
+ for (const line of stdout.split(`
570229
+ `)) {
570230
+ if (!line.trim())
570231
+ continue;
570232
+ let parsed;
570233
+ try {
570234
+ parsed = JSON.parse(line);
570235
+ } catch {
570236
+ continue;
570237
+ }
570238
+ if (!parsed || typeof parsed !== "object")
570239
+ continue;
570240
+ const asRecord2 = parsed;
570241
+ const file2 = typeof asRecord2.file === "string" ? asRecord2.file : typeof asRecord2.fileName === "string" ? asRecord2.fileName : undefined;
570242
+ const message = typeof asRecord2.message === "string" ? asRecord2.message : typeof asRecord2.messageText === "string" ? asRecord2.messageText : undefined;
570243
+ if (!file2 || !message)
570244
+ continue;
570245
+ const lineNum = Number(asRecord2.line ?? 0);
570246
+ const columnNum = Number(asRecord2.column ?? 0);
570247
+ const severity = asRecord2.severity === "error" ? "error" : asRecord2.severity === "warning" ? "warning" : "error";
570248
+ const entry = {
570249
+ file: file2,
570250
+ line: lineNum || 1,
570251
+ column: columnNum || 1,
570252
+ severity,
570253
+ message,
570254
+ code: typeof asRecord2.code === "string" || typeof asRecord2.code === "number" ? asRecord2.code : undefined
570255
+ };
570256
+ files[file2] = files[file2] ?? [];
570257
+ files[file2].push(entry);
570258
+ }
570259
+ return files;
570260
+ }
570261
+ var import_typescript2, execAsync2;
570262
+ var init_diagnostics = __esm(() => {
570263
+ import_typescript2 = __toESM(require_typescript2(), 1);
570264
+ execAsync2 = promisify5(exec7);
570265
+ });
570266
+
570267
+ // src/services/repoEditing/ast/engineRouter.ts
570268
+ function resolveEngine(language, options2) {
570269
+ if (options2.preferTreeSitter) {
570270
+ return { engine: "treesitter", reason: "explicit --treesitter flag" };
570271
+ }
570272
+ if (options2.preferLsp) {
570273
+ return { engine: "lsp", reason: "explicit --lsp flag" };
570274
+ }
570275
+ if (language === "ts" || language === "js" || language === "tsx" || language === "jsx") {
570276
+ return { engine: "typescript", reason: "TypeScript compiler API is primary for TS/JS" };
570277
+ }
570278
+ return { engine: "lsp", reason: "LSP is primary for Python/Rust/Go" };
570279
+ }
570280
+ function languageFromPath(file2) {
570281
+ const ext = file2.toLowerCase();
570282
+ if (ext.endsWith(".ts"))
570283
+ return "ts";
570284
+ if (ext.endsWith(".tsx"))
570285
+ return "tsx";
570286
+ if (ext.endsWith(".js"))
570287
+ return "js";
570288
+ if (ext.endsWith(".jsx"))
570289
+ return "jsx";
570290
+ if (ext.endsWith(".py"))
570291
+ return "python";
570292
+ if (ext.endsWith(".rs"))
570293
+ return "rust";
570294
+ if (ext.endsWith(".go"))
570295
+ return "go";
570296
+ return;
570297
+ }
570298
+
570299
+ // src/services/repoEditing/ast/workspaceEdit.ts
570300
+ import { dirname as dirname62, join as join170 } from "path";
570301
+ import { existsSync as existsSync49, mkdirSync as mkdirSync45, readFileSync as readFileSync55, writeFileSync as writeFileSync43 } from "fs";
570302
+ function groupByFile2(edits) {
570303
+ const groups = new Map;
570304
+ for (const edit2 of edits) {
570305
+ const list2 = groups.get(edit2.file) ?? [];
570306
+ list2.push(edit2);
570307
+ groups.set(edit2.file, list2);
570308
+ }
570309
+ return groups;
570310
+ }
570311
+ function normalizeFileEdits(file2, edits) {
570312
+ const sorted = [...edits].sort((a2, b) => b.start - a2.start);
570313
+ for (let i3 = 1;i3 < sorted.length; i3++) {
570314
+ const prev = sorted[i3 - 1];
570315
+ const curr = sorted[i3];
570316
+ if (curr.end > prev.start) {
570317
+ throw new OverlappingEditError(file2);
570318
+ }
570319
+ }
570320
+ return sorted;
570321
+ }
570322
+ function applyFileEdits(content, edits) {
570323
+ let result = content;
570324
+ for (const edit2 of edits) {
570325
+ result = `${result.slice(0, edit2.start)}${edit2.newText}${result.slice(edit2.end)}`;
570326
+ }
570327
+ return result;
570328
+ }
570329
+ function applyWorkspaceEdit(root2, edit2) {
570330
+ const snapshots = new Map;
570331
+ const writtenFiles = [];
570332
+ const byFile = groupByFile2(edit2.edits);
570333
+ for (const [file2, rawEdits] of byFile) {
570334
+ const edits = normalizeFileEdits(file2, rawEdits);
570335
+ const abs = join170(root2, file2);
570336
+ const oldContent = existsSync49(abs) ? readFileSync55(abs, "utf-8") : "";
570337
+ const newContent = applyFileEdits(oldContent, edits);
570338
+ snapshots.set(file2, oldContent);
570339
+ if (!existsSync49(abs)) {
570340
+ mkdirSync45(dirname62(abs), { recursive: true });
570341
+ }
570342
+ writeFileSync43(abs, newContent);
570343
+ writtenFiles.push(file2);
570344
+ }
570345
+ return { writtenFiles, snapshots };
570346
+ }
570347
+ function rollbackWorkspaceEdit(root2, snapshots) {
570348
+ for (const [file2, content] of snapshots) {
570349
+ writeFileSync43(join170(root2, file2), content);
570350
+ }
570351
+ }
570352
+ function formatWorkspaceEditAsPatch(root2, edit2) {
570353
+ const byFile = groupByFile2(edit2.edits);
570354
+ const pieces = [];
570355
+ for (const [file2] of byFile) {
570356
+ const abs = join170(root2, file2);
570357
+ const oldContent = readFileSync55(abs, "utf-8");
570358
+ const sorted = [...byFile.get(file2) ?? []].sort((a2, b) => b.start - a2.start);
570359
+ const newContent = applyFileEdits(oldContent, sorted);
570360
+ pieces.push(createTwoFilesPatch(`a/${file2}`, `b/${file2}`, oldContent, newContent, undefined, undefined, { context: 3 }));
570361
+ }
570362
+ return pieces.join(`
570363
+ `);
570364
+ }
570365
+ function workspaceEditFromLsp(root2, lspEdit) {
570366
+ if (!lspEdit || typeof lspEdit !== "object")
570367
+ return { edits: [] };
570368
+ const edits = [];
570369
+ const docChanges = "documentChanges" in lspEdit && Array.isArray(lspEdit.documentChanges) ? lspEdit.documentChanges : [];
570370
+ const changes = "changes" in lspEdit && lspEdit.changes && typeof lspEdit.changes === "object" ? lspEdit.changes : {};
570371
+ for (const [uri, textEdits] of Object.entries(changes)) {
570372
+ const abs = uriToAbsolutePath(root2, uri);
570373
+ const content = readFileSync55(abs, "utf-8");
570374
+ const file2 = absoluteToRelative(root2, abs);
570375
+ for (const raw of Array.isArray(textEdits) ? textEdits : []) {
570376
+ const converted = lspTextEditToEdit(file2, content, raw);
570377
+ if (converted)
570378
+ edits.push(converted);
570379
+ }
570380
+ }
570381
+ for (const change of docChanges) {
570382
+ if (!change || typeof change !== "object")
570383
+ continue;
570384
+ const uri = "textDocument" in change && change.textDocument && typeof change.textDocument === "object" ? change.textDocument.uri : undefined;
570385
+ if (!uri)
570386
+ continue;
570387
+ const abs = uriToAbsolutePath(root2, uri);
570388
+ const content = readFileSync55(abs, "utf-8");
570389
+ const file2 = absoluteToRelative(root2, abs);
570390
+ const textEdits = "edits" in change && Array.isArray(change.edits) ? change.edits : [];
570391
+ for (const raw of textEdits) {
570392
+ const converted = lspTextEditToEdit(file2, content, raw);
570393
+ if (converted)
570394
+ edits.push(converted);
570395
+ }
570396
+ }
570397
+ return { edits };
570398
+ }
570399
+ function uriToAbsolutePath(root2, uri) {
570400
+ let path22 = uri.replace(/^file:\/\//, "");
570401
+ if (/^\/[A-Za-z]:/.test(path22))
570402
+ path22 = path22.slice(1);
570403
+ try {
570404
+ path22 = decodeURIComponent(path22);
570405
+ } catch {}
570406
+ return path22.startsWith("/") ? path22 : join170(root2, path22);
570407
+ }
570408
+ function absoluteToRelative(root2, abs) {
570409
+ return abs.replace(root2, "").replace(/^\//, "");
570410
+ }
570411
+ function lspTextEditToEdit(file2, content, raw) {
570412
+ if (!raw || typeof raw !== "object")
570413
+ return null;
570414
+ const range = "range" in raw ? raw.range : undefined;
570415
+ if (!range || typeof range !== "object")
570416
+ return null;
570417
+ const start = range.start;
570418
+ const end = range.end;
570419
+ if (!start || !end)
570420
+ return null;
570421
+ const newText = "newText" in raw ? String(raw.newText) : "";
570422
+ return {
570423
+ file: file2,
570424
+ start: lineCharToOffset(content, start.line ?? 0, start.character ?? 0),
570425
+ end: lineCharToOffset(content, end.line ?? 0, end.character ?? 0),
570426
+ newText
570427
+ };
570428
+ }
570429
+ function lineCharToOffset(content, line, character) {
570430
+ const lines = content.split(`
570431
+ `);
570432
+ let offset = 0;
570433
+ for (let i3 = 0;i3 < line && i3 < lines.length; i3++) {
570434
+ offset += lines[i3].length + 1;
570435
+ }
570436
+ const targetLine = lines[line];
570437
+ if (!targetLine)
570438
+ return offset;
570439
+ return offset + Math.min(character, targetLine.length);
570440
+ }
570441
+ var OverlappingEditError;
570442
+ var init_workspaceEdit = __esm(() => {
570443
+ init_lib();
570444
+ OverlappingEditError = class OverlappingEditError extends Error {
570445
+ constructor(file2) {
570446
+ super(`Overlapping edits detected in ${file2}`);
570447
+ this.name = "OverlappingEditError";
570448
+ }
570449
+ };
570450
+ });
570451
+
570452
+ // src/services/repoEditing/ast/lspEditEngine.ts
570453
+ import { readFileSync as readFileSync56 } from "fs";
570454
+ import { pathToFileURL as pathToFileURL8 } from "url";
570455
+ async function getManager() {
570456
+ if (!manager) {
570457
+ manager = createLSPServerManager();
570458
+ await manager.initialize();
570459
+ }
570460
+ return manager;
570461
+ }
570462
+ async function shutdownLspManager() {
570463
+ if (manager) {
570464
+ await manager.shutdown();
570465
+ manager = undefined;
570466
+ }
570467
+ }
570468
+ async function lspRename(root2, file2, line, column, newName) {
570469
+ const mgr = await getManager();
570470
+ const abs = file2.startsWith("/") ? file2 : `${root2}/${file2}`;
570471
+ const content = readFileSync56(abs, "utf-8");
570472
+ await mgr.openFile(abs, content);
570473
+ const prepare = await mgr.sendRequest(abs, "textDocument/prepareRename", {
570474
+ textDocument: { uri: pathToFileURL8(abs).href },
570475
+ position: { line: line - 1, character: column - 1 }
570476
+ });
570477
+ if (!prepare)
570478
+ return null;
570479
+ const result = await mgr.sendRequest(abs, "textDocument/rename", {
570480
+ textDocument: { uri: pathToFileURL8(abs).href },
570481
+ position: { line: line - 1, character: column - 1 },
570482
+ newName
570483
+ });
570484
+ if (!result)
570485
+ return null;
570486
+ return workspaceEditFromLsp(root2, result);
570487
+ }
570488
+ var manager;
570489
+ var init_lspEditEngine = __esm(() => {
570490
+ init_LSPServerManager();
570491
+ init_workspaceEdit();
570492
+ });
570493
+
570494
+ // src/services/repoEditing/ast/typescriptEngine.ts
570495
+ import { join as join171 } from "path";
570496
+ function loadProgram(root2, files) {
570497
+ const configPath2 = import_typescript3.default.findConfigFile(root2, import_typescript3.default.sys.fileExists, "tsconfig.json");
570498
+ let program;
570499
+ if (configPath2) {
570500
+ const read = import_typescript3.default.readConfigFile(configPath2, import_typescript3.default.sys.readFile);
570501
+ if (read.error)
570502
+ throw new Error(import_typescript3.default.flattenDiagnosticMessageText(read.error.messageText, `
570503
+ `));
570504
+ const parsed = import_typescript3.default.parseJsonConfigFileContent(read.config, import_typescript3.default.sys, root2);
570505
+ const host = import_typescript3.default.createCompilerHost(parsed.options);
570506
+ program = import_typescript3.default.createProgram(parsed.fileNames, parsed.options, host);
570507
+ } else {
570508
+ const compilerOptions = {
570509
+ target: import_typescript3.default.ScriptTarget.Latest,
570510
+ module: import_typescript3.default.ModuleKind.CommonJS,
570511
+ allowJs: true,
570512
+ checkJs: true,
570513
+ noEmit: true,
570514
+ strict: false,
570515
+ jsx: import_typescript3.default.JsxEmit.React
570516
+ };
570517
+ const host = import_typescript3.default.createCompilerHost(compilerOptions);
570518
+ const fileNames = files?.length ? files.map((f) => join171(root2, f)) : [];
570519
+ program = import_typescript3.default.createProgram(fileNames, compilerOptions, host);
570520
+ }
570521
+ return { program, checker: program.getTypeChecker() };
570522
+ }
570523
+ function nodeAtPosition(sourceFile, line, column) {
570524
+ const pos = sourceFile.getPositionOfLineAndCharacter(line - 1, column - 1);
570525
+ return findNodeAtPosition(sourceFile, pos);
570526
+ }
570527
+ function findNodeAtPosition(sourceFile, pos) {
570528
+ function visit2(node) {
570529
+ if (pos >= node.getStart(sourceFile) && pos < node.getEnd()) {
570530
+ let deepest = node;
570531
+ import_typescript3.default.forEachChild(node, (child) => {
570532
+ const result = visit2(child);
570533
+ if (result)
570534
+ deepest = result;
570535
+ });
570536
+ return deepest;
570537
+ }
570538
+ return;
570539
+ }
570540
+ return visit2(sourceFile);
570541
+ }
570542
+ function symbolAtPosition(ctx, file2, line, column) {
570543
+ const abs = join171(ctx.program.getCurrentDirectory(), file2);
570544
+ const sourceFile = ctx.program.getSourceFile(abs);
570545
+ if (!sourceFile)
570546
+ return;
570547
+ const node = nodeAtPosition(sourceFile, line, column);
570548
+ if (!node)
570549
+ return;
570550
+ return ctx.checker.getSymbolAtLocation(node);
570551
+ }
570552
+ function allSourceFiles(ctx, root2) {
570553
+ const result = [];
570554
+ for (const sf of ctx.program.getSourceFiles()) {
570555
+ if (sf.isDeclarationFile)
570556
+ continue;
570557
+ result.push(sf);
570558
+ }
570559
+ return result;
570560
+ }
570561
+ function relativePath(fileName, root2) {
570562
+ return fileName.startsWith(root2) ? fileName.slice(root2.length + 1) : fileName;
570563
+ }
570564
+ function collectRelatedSymbols(ctx, symbol2) {
570565
+ const result = new Set([symbol2]);
570566
+ if (symbol2.flags & import_typescript3.default.SymbolFlags.Alias) {
570567
+ const aliased = ctx.checker.getAliasedSymbol(symbol2);
570568
+ if (aliased)
570569
+ result.add(aliased);
570570
+ }
570571
+ return result;
570572
+ }
570573
+ function dedupeEdits(edits) {
570574
+ const seen = new Set;
570575
+ return edits.filter((edit2) => {
570576
+ const key = `${edit2.file}:${edit2.start}:${edit2.end}`;
570577
+ if (seen.has(key))
570578
+ return false;
570579
+ seen.add(key);
570580
+ return true;
570581
+ });
570582
+ }
570583
+ function tsRenameSymbol(ctx, options2) {
570584
+ const { root: root2, from, to, file: maybeFile, line, column } = options2;
570585
+ const targetFile = maybeFile ? join171(root2, maybeFile) : undefined;
570586
+ let targetSymbols;
570587
+ if (maybeFile && line !== undefined && column !== undefined) {
570588
+ const symbol2 = symbolAtPosition(ctx, maybeFile, line, column);
570589
+ if (symbol2)
570590
+ targetSymbols = collectRelatedSymbols(ctx, symbol2);
570591
+ }
570592
+ if (!targetSymbols) {
570593
+ targetSymbols = undefined;
570594
+ }
570595
+ const edits = [];
570596
+ for (const sourceFile of allSourceFiles(ctx, root2)) {
570597
+ if (targetFile && sourceFile.fileName !== targetFile)
570598
+ continue;
570599
+ const rel = relativePath(sourceFile.fileName, root2);
570600
+ import_typescript3.default.forEachChild(sourceFile, function visit2(node) {
570601
+ if (!import_typescript3.default.isIdentifier(node)) {
570602
+ import_typescript3.default.forEachChild(node, visit2);
570603
+ return;
570604
+ }
570605
+ if (node.text !== from) {
570606
+ import_typescript3.default.forEachChild(node, visit2);
570607
+ return;
570608
+ }
570609
+ if (targetSymbols) {
570610
+ const symbol2 = ctx.checker.getSymbolAtLocation(node);
570611
+ if (!symbol2 || !targetSymbols.has(symbol2)) {
570612
+ import_typescript3.default.forEachChild(node, visit2);
570613
+ return;
570614
+ }
570615
+ }
570616
+ const start = node.getStart(sourceFile);
570617
+ const end = node.getEnd();
570618
+ edits.push({ file: rel, start, end, newText: to, oldText: node.text });
570619
+ import_typescript3.default.forEachChild(node, visit2);
570620
+ });
570621
+ }
570622
+ return { edits: dedupeEdits(edits) };
570623
+ }
570624
+ function tsRenameSymbolAtPosition(ctx, options2) {
570625
+ return tsRenameSymbol(ctx, options2);
570626
+ }
570627
+ function tsMoveFunction(ctx, options2) {
570628
+ const { root: root2, symbol: symbolName, targetFile: targetFileRel, file: sourceFileRel } = options2;
570629
+ if (!sourceFileRel) {
570630
+ throw new Error("TS move requires --file to identify the source file");
570631
+ }
570632
+ const sourceAbs = join171(root2, sourceFileRel);
570633
+ const targetAbs = join171(root2, targetFileRel);
570634
+ const sourceSf = ctx.program.getSourceFile(sourceAbs);
570635
+ const targetSf = ctx.program.getSourceFile(targetAbs) ?? ctx.program.getSourceFile(targetFileRel);
570636
+ if (!sourceSf)
570637
+ throw new Error(`Source file not found: ${sourceFileRel}`);
570638
+ const edits = [];
570639
+ let declarationNode;
570640
+ import_typescript3.default.forEachChild(sourceSf, function visit2(node) {
570641
+ if ((import_typescript3.default.isFunctionDeclaration(node) || import_typescript3.default.isClassDeclaration(node)) && node.name?.text === symbolName) {
570642
+ declarationNode = node;
570643
+ return;
570644
+ }
570645
+ import_typescript3.default.forEachChild(node, visit2);
570646
+ });
570647
+ if (!declarationNode)
570648
+ throw new Error(`Symbol ${symbolName} not found in ${sourceFileRel}`);
570649
+ const text = declarationNode.getText(sourceSf);
570650
+ const targetRel = targetAbs.startsWith(root2) ? targetAbs.slice(root2.length + 1) : targetFileRel;
570651
+ const targetExists = !!targetSf;
570652
+ const targetContent = targetSf?.text ?? "";
570653
+ const insertOffset = targetContent.length;
570654
+ const insertText = targetContent.length === 0 ? text + `
570655
+ ` : targetContent.endsWith(`
570656
+ `) ? text + `
570657
+ ` : `
570658
+ ` + text + `
570659
+ `;
570660
+ edits.push({ file: targetRel, start: insertOffset, end: insertOffset, newText: insertText });
570661
+ if (!targetExists) {}
570662
+ const start = declarationNode.getStart(sourceSf);
570663
+ const end = declarationNode.getEnd();
570664
+ let removeStart = start;
570665
+ while (removeStart > 0 && /\s/.test(sourceSf.text[removeStart - 1]))
570666
+ removeStart--;
570667
+ let removeEnd = end;
570668
+ while (removeEnd < sourceSf.text.length && /\s/.test(sourceSf.text[removeEnd]))
570669
+ removeEnd++;
570670
+ edits.push({ file: sourceFileRel, start: removeStart, end: removeEnd, newText: "" });
570671
+ return { edits: dedupeEdits(edits) };
570672
+ }
570673
+ function tsOrganizeImports(_ctx, options2) {
570674
+ const { file: maybeFile, root: root2 } = options2;
570675
+ const files = maybeFile ? [maybeFile] : [];
570676
+ const edits = [];
570677
+ for (const file2 of files) {
570678
+ const abs = join171(root2, file2);
570679
+ const sf = _ctx.program.getSourceFile(abs);
570680
+ if (!sf)
570681
+ continue;
570682
+ const importNodes = [];
570683
+ import_typescript3.default.forEachChild(sf, function visit2(node) {
570684
+ if (import_typescript3.default.isImportDeclaration(node))
570685
+ importNodes.push(node);
570686
+ import_typescript3.default.forEachChild(node, visit2);
570687
+ });
570688
+ if (importNodes.length === 0)
570689
+ continue;
570690
+ importNodes.sort((a2, b) => {
570691
+ const aSpec = a2.moduleSpecifier.getText(sf);
570692
+ const bSpec = b.moduleSpecifier.getText(sf);
570693
+ return aSpec.localeCompare(bSpec);
570694
+ });
570695
+ const first = importNodes[0];
570696
+ const last2 = importNodes[importNodes.length - 1];
570697
+ const start = first.getStart(sf);
570698
+ const end = last2.getEnd();
570699
+ const sortedText = importNodes.map((i3) => i3.getText(sf)).join(`
570700
+ `) + `
570701
+ `;
570702
+ edits.push({ file: file2, start, end, newText: sortedText });
570703
+ }
570704
+ return { edits: dedupeEdits(edits) };
570705
+ }
570706
+ function tsFindUnused(ctx, options2) {
570707
+ const { root: root2, file: maybeFile } = options2;
570708
+ const result = [];
570709
+ for (const sourceFile of allSourceFiles(ctx, root2)) {
570710
+ const rel = relativePath(sourceFile.fileName, root2);
570711
+ if (maybeFile && rel !== maybeFile)
570712
+ continue;
570713
+ import_typescript3.default.forEachChild(sourceFile, function visit2(node) {
570714
+ if (import_typescript3.default.isVariableDeclaration(node) && import_typescript3.default.isIdentifier(node.name)) {
570715
+ const symbol2 = ctx.checker.getSymbolAtLocation(node.name);
570716
+ if (symbol2 && symbol2.declarations?.length === 1) {
570717
+ const references = ctx.checker.findReferences?.(node.name);
570718
+ const refs = references?.[0]?.references ?? [];
570719
+ if (refs.filter((r) => !r.isDefinition).length === 0) {
570720
+ const loc = sourceFile.getLineAndCharacterOfPosition(node.name.getStart(sourceFile));
570721
+ result.push({ file: rel, line: loc.line + 1, column: loc.character + 1, name: node.name.text, kind: "variable" });
570722
+ }
570723
+ }
570724
+ }
570725
+ import_typescript3.default.forEachChild(node, visit2);
570726
+ });
570727
+ }
570728
+ return result;
570729
+ }
570730
+ function tsFindCallers(ctx, options2) {
570731
+ const { root: root2, symbol: symbolName, file: maybeFile } = options2;
570732
+ const result = [];
570733
+ let targetSymbol;
570734
+ for (const sourceFile of allSourceFiles(ctx, root2)) {
570735
+ if (maybeFile && relativePath(sourceFile.fileName, root2) !== maybeFile)
570736
+ continue;
570737
+ import_typescript3.default.forEachChild(sourceFile, function visit2(node) {
570738
+ if (import_typescript3.default.isIdentifier(node) && node.text === symbolName) {
570739
+ const symbol2 = ctx.checker.getSymbolAtLocation(node);
570740
+ if (symbol2 && symbol2.getName() === symbolName) {
570741
+ targetSymbol = symbol2;
570742
+ }
570743
+ }
570744
+ import_typescript3.default.forEachChild(node, visit2);
570745
+ });
570746
+ }
570747
+ if (!targetSymbol)
570748
+ return result;
570749
+ for (const sourceFile of allSourceFiles(ctx, root2)) {
570750
+ const rel = relativePath(sourceFile.fileName, root2);
570751
+ import_typescript3.default.forEachChild(sourceFile, function visit2(node) {
570752
+ let isCall = false;
570753
+ let callName;
570754
+ if (import_typescript3.default.isCallExpression(node)) {
570755
+ isCall = true;
570756
+ callName = node.expression;
570757
+ } else if (import_typescript3.default.isNewExpression(node)) {
570758
+ isCall = true;
570759
+ callName = node.expression;
570760
+ }
570761
+ if (!isCall || !callName) {
570762
+ import_typescript3.default.forEachChild(node, visit2);
570763
+ return;
570764
+ }
570765
+ const symbol2 = ctx.checker.getSymbolAtLocation(callName);
570766
+ if (!symbol2 || !collectRelatedSymbols(ctx, targetSymbol).has(symbol2)) {
570767
+ import_typescript3.default.forEachChild(node, visit2);
570768
+ return;
570769
+ }
570770
+ const loc = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile));
570771
+ result.push({ file: rel, line: loc.line + 1, column: loc.character + 1, name: symbolName, kind: "function" });
570772
+ import_typescript3.default.forEachChild(node, visit2);
570773
+ });
570774
+ }
570775
+ return result;
570776
+ }
570777
+ var import_typescript3;
570778
+ var init_typescriptEngine = __esm(() => {
570779
+ import_typescript3 = __toESM(require_typescript2(), 1);
570780
+ });
570781
+
570782
+ // src/services/repoEditing/ast/treeSitterEngine.ts
570783
+ import { readFileSync as readFileSync57 } from "fs";
570784
+ function tryLoadNativeParser(language) {
570785
+ try {
570786
+ const Parser2 = __require(`@tree-sitter/${language}`);
570787
+ const parse13 = Parser2.default?.parse ?? Parser2.parse;
570788
+ if (!parse13)
570789
+ return;
570790
+ return (_file2, content) => parse13(content);
570791
+ } catch {
570792
+ return;
570793
+ }
570794
+ }
570795
+ function loadNativeParser(language) {
570796
+ if (!nativeParser) {
570797
+ nativeParser = tryLoadNativeParser(language);
570798
+ }
570799
+ return nativeParser;
570800
+ }
570801
+ function pureTsParse(file2, content) {
570802
+ return {
570803
+ type: "program",
570804
+ start: 0,
570805
+ end: content.length,
570806
+ text: content,
570807
+ children: []
570808
+ };
570809
+ }
570810
+ function getAdapter3(language) {
570811
+ const native = loadNativeParser(language);
570812
+ if (native) {
570813
+ return {
570814
+ parse: native,
570815
+ isComment: (node) => node.type.includes("comment"),
570816
+ isString: (node) => node.type.includes("string") || node.type.includes("template_string"),
570817
+ isIdentifier: (node) => node.type === "identifier"
570818
+ };
570819
+ }
570820
+ return {
570821
+ parse: pureTsParse,
570822
+ isComment: () => false,
570823
+ isString: () => false,
570824
+ isIdentifier: () => false
570825
+ };
570826
+ }
570827
+ function collectIdentifiers(root2, name, adapter2) {
570828
+ const result = [];
570829
+ function visit2(node, insideComment, insideString) {
570830
+ const nextComment = insideComment || adapter2.isComment(node);
570831
+ const nextString = insideString || adapter2.isString(node);
570832
+ if (!nextComment && !nextString && adapter2.isIdentifier(node) && node.text === name) {
570833
+ result.push(node);
570834
+ }
570835
+ for (const child of node.children) {
570836
+ visit2(child, nextComment, nextString);
570837
+ }
570838
+ }
570839
+ visit2(root2, false, false);
570840
+ return result;
570841
+ }
570842
+ function treeSitterRename(options2, language) {
570843
+ const { root: root2, from, to, file: maybeFile } = options2;
570844
+ const files = maybeFile ? [maybeFile] : [];
570845
+ const edits = [];
570846
+ const adapter2 = getAdapter3(language);
570847
+ for (const file2 of files) {
570848
+ const abs = file2.startsWith("/") ? file2 : `${root2}/${file2}`;
570849
+ const content = readFileSync57(abs, "utf-8");
570850
+ const tree = adapter2.parse(file2, content);
570851
+ const identifiers = collectIdentifiers(tree, from, adapter2);
570852
+ for (const node of identifiers) {
570853
+ edits.push({ file: file2, start: node.start, end: node.end, newText: to, oldText: from });
570854
+ }
570855
+ }
570856
+ return { edits };
570857
+ }
570858
+ var nativeParser;
570859
+ var init_treeSitterEngine = () => {};
570860
+
570861
+ // src/services/repoEditing/ast/repoEditAst.ts
570862
+ import { exec as exec8 } from "child_process";
570863
+ import { promisify as promisify6 } from "util";
570864
+ async function runCheck2(command5, cwd2) {
570865
+ try {
570866
+ const result = await execAsync3(command5, {
570867
+ cwd: cwd2,
570868
+ timeout: 10 * 60 * 1000,
570869
+ maxBuffer: 10 * 1024 * 1024
570870
+ });
570871
+ return { ok: true, stdout: result.stdout, stderr: result.stderr };
570872
+ } catch (error40) {
570873
+ const e = error40;
570874
+ return {
570875
+ ok: false,
570876
+ stdout: e.stdout ?? "",
570877
+ stderr: e.stderr ?? "",
570878
+ error: e.message
570879
+ };
570880
+ }
570881
+ }
570882
+ function createPlan(kind, description, edit2, diagnosticsBefore) {
570883
+ const affectedFiles = [...new Set(edit2.edits.map((e) => e.file))];
570884
+ return {
570885
+ kind,
570886
+ edits: edit2,
570887
+ affectedFiles,
570888
+ description,
570889
+ diagnosticsBefore
570890
+ };
570891
+ }
570892
+ function createReadPlan(kind, description, refs, diagnosticsBefore) {
570893
+ return {
570894
+ kind,
570895
+ edits: { edits: [] },
570896
+ affectedFiles: [...new Set(refs.map((r) => r.file))],
570897
+ description,
570898
+ diagnosticsBefore
570899
+ };
570900
+ }
570901
+ async function listRepoCodeFiles(root2) {
570902
+ const { listRepoFiles: listRepoFiles2 } = await Promise.resolve().then(() => (init_reliableRepoEdit(), exports_reliableRepoEdit));
570903
+ return listRepoFiles2(root2).filter((f) => /\.(ts|tsx|js|jsx|mjs|cjs|py|rs|go)$/i.test(f));
570904
+ }
570905
+ async function computeRenameEdit(options2, attempt = 0) {
570906
+ const language = options2.file ? languageFromPath(options2.file) : undefined;
570907
+ const selection = resolveEngine(language ?? "ts", {
570908
+ preferLsp: options2.engine === "lsp",
570909
+ preferTreeSitter: options2.engine === "treesitter"
570910
+ });
570911
+ if (selection.engine === "lsp") {
570912
+ if (!options2.file || options2.line === undefined || options2.column === undefined) {
570913
+ throw new Error("LSP rename requires a file and position; use `file.ts:line:column` or pass --file with a position.");
570914
+ }
570915
+ try {
570916
+ const result = await lspRename(options2.root, options2.file, options2.line, options2.column, options2.to);
570917
+ if (result && result.edits.length > 0)
570918
+ return result;
570919
+ if (attempt === 0 && language) {
570920
+ return computeRenameEdit({ ...options2, engine: "treesitter" }, attempt + 1);
570921
+ }
570922
+ return result ?? { edits: [] };
570923
+ } catch (error40) {
570924
+ if (attempt === 0 && language) {
570925
+ return computeRenameEdit({ ...options2, engine: "treesitter" }, attempt + 1);
570926
+ }
570927
+ throw error40;
570928
+ }
570929
+ }
570930
+ if (selection.engine === "treesitter") {
570931
+ if (!language)
570932
+ return { edits: [] };
570933
+ return treeSitterRename(options2, language);
570934
+ }
570935
+ const files = options2.file ? [options2.file] : await listRepoCodeFiles(options2.root);
570936
+ const ctx = loadProgram(options2.root, files);
570937
+ if (options2.file && options2.line !== undefined && options2.column !== undefined) {
570938
+ return tsRenameSymbolAtPosition(ctx, options2);
570939
+ }
570940
+ return tsRenameSymbol(ctx, options2);
570941
+ }
570942
+ async function planRenameAst(options2) {
570943
+ const files = options2.file ? [options2.file] : await listRepoCodeFiles(options2.root);
570944
+ const edit2 = await computeRenameEdit(options2);
570945
+ const diagnosticsBefore = options2.skipDiagnostics ? emptySnapshot("none") : await collectDiagnostics(options2.root, files);
570946
+ return createPlan("rename", `Rename ${options2.from} -> ${options2.to}${options2.file ? ` in ${options2.file}` : ""}`, edit2, diagnosticsBefore);
570947
+ }
570948
+ async function applyRenameAst(options2) {
570949
+ const plan = await planRenameAst(options2);
570950
+ let applyResult;
570951
+ try {
570952
+ applyResult = applyWorkspaceEdit(options2.root, plan.edits);
570953
+ const diagnosticsAfter = options2.skipDiagnostics ? emptySnapshot("none") : await collectDiagnostics(options2.root, applyResult.writtenFiles);
570954
+ plan.diagnosticsAfter = diagnosticsAfter;
570955
+ const newErrors = diagnosticsDiff(plan.diagnosticsBefore, diagnosticsAfter);
570956
+ if (newErrors.length > 0) {
570957
+ rollbackWorkspaceEdit(options2.root, applyResult.snapshots);
570958
+ return {
570959
+ ok: false,
570960
+ plan,
570961
+ writtenFiles: applyResult.writtenFiles,
570962
+ rolledBack: true,
570963
+ error: `New diagnostics after rename:
570964
+ ${newErrors.map((d) => `${d.file}:${d.line}:${d.column} ${d.message}`).join(`
570965
+ `)}`
570966
+ };
570967
+ }
570968
+ if (options2.checkCommand) {
570969
+ const check3 = await runCheck2(options2.checkCommand, options2.root);
570970
+ if (!check3.ok) {
570971
+ rollbackWorkspaceEdit(options2.root, applyResult.snapshots);
570972
+ return {
570973
+ ok: false,
570974
+ plan,
570975
+ writtenFiles: applyResult.writtenFiles,
570976
+ rolledBack: true,
570977
+ error: check3.error ?? `Check failed: ${options2.checkCommand}`
570978
+ };
570979
+ }
570980
+ }
570981
+ return { ok: true, plan, writtenFiles: applyResult.writtenFiles, rolledBack: false };
570982
+ } catch (error40) {
570983
+ if (applyResult) {
570984
+ rollbackWorkspaceEdit(options2.root, applyResult.snapshots);
570985
+ }
570986
+ return {
570987
+ ok: false,
570988
+ plan,
570989
+ writtenFiles: applyResult?.writtenFiles ?? [],
570990
+ rolledBack: true,
570991
+ error: error40 instanceof Error ? error40.message : String(error40)
570992
+ };
570993
+ } finally {
570994
+ await shutdownLspManager().catch(() => {});
570995
+ }
570996
+ }
570997
+ async function planMoveAst(options2) {
570998
+ const files = options2.file ? [options2.file, options2.targetFile] : [options2.targetFile];
570999
+ const ctx = loadProgram(options2.root, files);
571000
+ const edit2 = tsMoveFunction(ctx, options2);
571001
+ const diagnosticsBefore = options2.skipDiagnostics ? emptySnapshot("none") : await collectDiagnostics(options2.root, files);
571002
+ return createPlan("move", `Move ${options2.symbol} -> ${options2.targetFile}${options2.file ? ` from ${options2.file}` : ""}`, edit2, diagnosticsBefore);
571003
+ }
571004
+ async function applyMoveAst(options2) {
571005
+ const plan = await planMoveAst(options2);
571006
+ let applyResult;
571007
+ try {
571008
+ applyResult = applyWorkspaceEdit(options2.root, plan.edits);
571009
+ const diagnosticsAfter = options2.skipDiagnostics ? emptySnapshot("none") : await collectDiagnostics(options2.root, applyResult.writtenFiles);
571010
+ plan.diagnosticsAfter = diagnosticsAfter;
571011
+ const newErrors = diagnosticsDiff(plan.diagnosticsBefore, diagnosticsAfter);
571012
+ if (newErrors.length > 0) {
571013
+ rollbackWorkspaceEdit(options2.root, applyResult.snapshots);
571014
+ return {
571015
+ ok: false,
571016
+ plan,
571017
+ writtenFiles: applyResult.writtenFiles,
571018
+ rolledBack: true,
571019
+ error: `New diagnostics after move:
571020
+ ${newErrors.map((d) => `${d.file}:${d.line}:${d.column} ${d.message}`).join(`
571021
+ `)}`
571022
+ };
571023
+ }
571024
+ if (options2.checkCommand) {
571025
+ const check3 = await runCheck2(options2.checkCommand, options2.root);
571026
+ if (!check3.ok) {
571027
+ rollbackWorkspaceEdit(options2.root, applyResult.snapshots);
571028
+ return {
571029
+ ok: false,
571030
+ plan,
571031
+ writtenFiles: applyResult.writtenFiles,
571032
+ rolledBack: true,
571033
+ error: check3.error ?? `Check failed: ${options2.checkCommand}`
571034
+ };
571035
+ }
571036
+ }
571037
+ return { ok: true, plan, writtenFiles: applyResult.writtenFiles, rolledBack: false };
571038
+ } catch (error40) {
571039
+ if (applyResult)
571040
+ rollbackWorkspaceEdit(options2.root, applyResult.snapshots);
571041
+ return {
571042
+ ok: false,
571043
+ plan,
571044
+ writtenFiles: applyResult?.writtenFiles ?? [],
571045
+ rolledBack: true,
571046
+ error: error40 instanceof Error ? error40.message : String(error40)
571047
+ };
571048
+ }
571049
+ }
571050
+ async function planOrganizeImportsAst(options2) {
571051
+ const files = options2.file ? [options2.file] : await listRepoCodeFiles(options2.root).then((f) => f.filter((p2) => /\.(ts|tsx|js|jsx)$/i.test(p2)));
571052
+ const ctx = loadProgram(options2.root, files);
571053
+ const edit2 = tsOrganizeImports(ctx, options2);
571054
+ const diagnosticsBefore = options2.skipDiagnostics ? emptySnapshot("none") : await collectDiagnostics(options2.root, files);
571055
+ return createPlan("organize-imports", `Organize imports${options2.file ? ` in ${options2.file}` : ""}`, edit2, diagnosticsBefore);
571056
+ }
571057
+ async function applyOrganizeImportsAst(options2) {
571058
+ const plan = await planOrganizeImportsAst(options2);
571059
+ let applyResult;
571060
+ try {
571061
+ applyResult = applyWorkspaceEdit(options2.root, plan.edits);
571062
+ const diagnosticsAfter = options2.skipDiagnostics ? emptySnapshot("none") : await collectDiagnostics(options2.root, applyResult.writtenFiles);
571063
+ plan.diagnosticsAfter = diagnosticsAfter;
571064
+ const newErrors = diagnosticsDiff(plan.diagnosticsBefore, diagnosticsAfter);
571065
+ if (newErrors.length > 0) {
571066
+ rollbackWorkspaceEdit(options2.root, applyResult.snapshots);
571067
+ return {
571068
+ ok: false,
571069
+ plan,
571070
+ writtenFiles: applyResult.writtenFiles,
571071
+ rolledBack: true,
571072
+ error: `New diagnostics after organize imports:
571073
+ ${newErrors.map((d) => `${d.file}:${d.line}:${d.column} ${d.message}`).join(`
571074
+ `)}`
571075
+ };
571076
+ }
571077
+ if (options2.checkCommand) {
571078
+ const check3 = await runCheck2(options2.checkCommand, options2.root);
571079
+ if (!check3.ok) {
571080
+ rollbackWorkspaceEdit(options2.root, applyResult.snapshots);
571081
+ return {
571082
+ ok: false,
571083
+ plan,
571084
+ writtenFiles: applyResult.writtenFiles,
571085
+ rolledBack: true,
571086
+ error: check3.error ?? `Check failed: ${options2.checkCommand}`
571087
+ };
571088
+ }
571089
+ }
571090
+ return { ok: true, plan, writtenFiles: applyResult.writtenFiles, rolledBack: false };
571091
+ } catch (error40) {
571092
+ if (applyResult)
571093
+ rollbackWorkspaceEdit(options2.root, applyResult.snapshots);
571094
+ return {
571095
+ ok: false,
571096
+ plan,
571097
+ writtenFiles: applyResult?.writtenFiles ?? [],
571098
+ rolledBack: true,
571099
+ error: error40 instanceof Error ? error40.message : String(error40)
571100
+ };
571101
+ }
571102
+ }
571103
+ async function findUnusedAst(options2) {
571104
+ const files = options2.file ? [options2.file] : await listRepoCodeFiles(options2.root).then((f) => f.filter((p2) => /\.(ts|tsx|js|jsx)$/i.test(p2)));
571105
+ const ctx = loadProgram(options2.root, files);
571106
+ const refs = tsFindUnused(ctx, options2);
571107
+ const diagnosticsBefore = emptySnapshot("none");
571108
+ return createReadPlan("unused", `Unused symbols${options2.file ? ` in ${options2.file}` : ""}`, refs, diagnosticsBefore);
571109
+ }
571110
+ async function findCallersAst(options2) {
571111
+ const files = options2.file ? [options2.file] : await listRepoCodeFiles(options2.root).then((f) => f.filter((p2) => /\.(ts|tsx|js|jsx)$/i.test(p2)));
571112
+ const ctx = loadProgram(options2.root, files);
571113
+ const refs = tsFindCallers(ctx, options2);
571114
+ const diagnosticsBefore = emptySnapshot("none");
571115
+ return createReadPlan("callers", `Callers of ${options2.symbol}${options2.file ? ` in ${options2.file}` : ""}`, refs, diagnosticsBefore);
571116
+ }
571117
+ function formatRenamePlanAst(plan) {
571118
+ const patch = formatWorkspaceEditAsPatch(".", plan.edits);
571119
+ if (plan.edits.edits.length === 0) {
571120
+ return `No binding-aware rename matches for symbol.`;
571121
+ }
571122
+ const byFile = new Map;
571123
+ for (const edit2 of plan.edits.edits) {
571124
+ byFile.set(edit2.file, (byFile.get(edit2.file) ?? 0) + 1);
571125
+ }
571126
+ const lines = [
571127
+ plan.description,
571128
+ `${plan.edits.edits.length} occurrence(s) across ${byFile.size} file(s).`,
571129
+ ""
571130
+ ];
571131
+ for (const [file2, count4] of byFile) {
571132
+ lines.push(`${file2} (${count4})`);
571133
+ }
571134
+ lines.push("", patch);
571135
+ return lines.join(`
571136
+ `);
571137
+ }
571138
+ function formatMovePlanAst(plan) {
571139
+ const patch = formatWorkspaceEditAsPatch(".", plan.edits);
571140
+ if (plan.edits.edits.length === 0)
571141
+ return "No move edits computed.";
571142
+ return [plan.description, "", patch].join(`
571143
+ `);
571144
+ }
571145
+ function formatOrganizeImportsPlanAst(plan) {
571146
+ const patch = formatWorkspaceEditAsPatch(".", plan.edits);
571147
+ if (plan.edits.edits.length === 0)
571148
+ return "No imports to organize.";
571149
+ return [plan.description, "", patch].join(`
571150
+ `);
571151
+ }
571152
+ var execAsync3;
571153
+ var init_repoEditAst = __esm(() => {
571154
+ init_diagnostics();
571155
+ init_lspEditEngine();
571156
+ init_typescriptEngine();
571157
+ init_treeSitterEngine();
571158
+ init_workspaceEdit();
571159
+ execAsync3 = promisify6(exec8);
571160
+ });
571161
+
570077
571162
  // src/commands/repo-edit/repo-edit.ts
570078
571163
  var exports_repo_edit = {};
570079
571164
  __export(exports_repo_edit, {
@@ -570087,9 +571172,16 @@ function usage19() {
570087
571172
  " ur repo-edit plan rename <from> --to <to> [--json]",
570088
571173
  " ur repo-edit preview rename <from> --to <to> [--json]",
570089
571174
  " ur repo-edit apply rename <from> --to <to> [--check <cmd>] [--json]",
571175
+ " ur repo-edit rename <from> --to <to> [--file <path>] [--engine ts|lsp|treesitter] [--check <cmd>] [--json]",
571176
+ " ur repo-edit move <symbol> --to <target-file> --file <source-file> [--check <cmd>] [--json]",
571177
+ " ur repo-edit organize-imports [--file <path>] [--check <cmd>] [--json]",
571178
+ " ur repo-edit unused [--file <path>] [--json]",
571179
+ " ur repo-edit callers <symbol> [--file <path>] [--json]",
570090
571180
  "",
570091
571181
  "Rename operations are AST-aware for JavaScript and TypeScript files:",
570092
- "identifier nodes are changed, while comments and strings are not."
571182
+ "identifier nodes are changed, while comments and strings are not.",
571183
+ "Use --engine lsp for language-server rename, --engine treesitter for",
571184
+ "best-effort identifier matching."
570093
571185
  ].join(`
570094
571186
  `);
570095
571187
  }
@@ -570099,7 +571191,7 @@ function option20(tokens, name) {
570099
571191
  }
570100
571192
  function positionals13(tokens) {
570101
571193
  const values2 = [];
570102
- const flagsWithValue = new Set(["--to", "--check"]);
571194
+ const flagsWithValue = new Set(["--to", "--check", "--file", "--engine"]);
570103
571195
  for (let i3 = 0;i3 < tokens.length; i3++) {
570104
571196
  const token = tokens[i3];
570105
571197
  if (flagsWithValue.has(token)) {
@@ -570121,6 +571213,47 @@ function renameArgs(tokens) {
570121
571213
  return null;
570122
571214
  return { from: values2[2], to };
570123
571215
  }
571216
+ function moveArgs(tokens) {
571217
+ const values2 = positionals13(tokens);
571218
+ if (values2[1] !== "move" || !values2[2])
571219
+ return null;
571220
+ const target = option20(tokens, "--to");
571221
+ if (!target)
571222
+ return null;
571223
+ return { symbol: values2[2], targetFile: target };
571224
+ }
571225
+ function callersArgs(tokens) {
571226
+ const values2 = positionals13(tokens);
571227
+ return values2[1] === "callers" ? values2[2] : undefined;
571228
+ }
571229
+ function parseSymbolLocation(symbol2) {
571230
+ const match = symbol2.match(/^(.+):(\d+):(\d+)$/);
571231
+ if (!match)
571232
+ return { name: symbol2 };
571233
+ return { name: match[1], line: parseInt(match[2], 10), column: parseInt(match[3], 10) };
571234
+ }
571235
+ function parseEngine(value) {
571236
+ if (value === "ts" || value === "typescript")
571237
+ return "typescript";
571238
+ if (value === "lsp")
571239
+ return "lsp";
571240
+ if (value === "treesitter")
571241
+ return "treesitter";
571242
+ return;
571243
+ }
571244
+ function applyResultToText(result, label) {
571245
+ if (!result.ok) {
571246
+ return `Repo edit failed; rollback ${result.rolledBack ? "completed" : "not needed"}.
571247
+ ` + `${result.error ?? "Unknown error"}
571248
+
571249
+ Patch preview:
571250
+ ${formatWorkspaceEditAsPatch(getCwd2(), result.plan.edits)}`;
571251
+ }
571252
+ return `Applied ${label}.
571253
+
571254
+ Patch preview:
571255
+ ${formatWorkspaceEditAsPatch(getCwd2(), result.plan.edits)}`;
571256
+ }
570124
571257
  var call94 = async (args) => {
570125
571258
  const tokens = parseArguments2(args);
570126
571259
  const json2 = tokens.includes("--json");
@@ -570165,45 +571298,132 @@ var call94 = async (args) => {
570165
571298
  value: json2 ? JSON.stringify({ hits }, null, 2) : formatSearchHits(hits)
570166
571299
  };
570167
571300
  }
570168
- if (action3 === "plan" || action3 === "preview" || action3 === "apply") {
571301
+ if (action3 === "rename") {
570169
571302
  const rename10 = renameArgs(tokens);
570170
571303
  if (!rename10)
570171
571304
  return { type: "text", value: usage19() };
570172
- const plan = planRename(root2, rename10.from, rename10.to);
570173
- if (action3 === "plan") {
570174
- return {
570175
- type: "text",
570176
- value: json2 ? JSON.stringify({ plan }, null, 2) : formatRenamePlan(plan)
570177
- };
571305
+ const file2 = option20(tokens, "--file");
571306
+ const location2 = file2 ? parseSymbolLocation(rename10.from) : { name: rename10.from };
571307
+ const plan = await planRenameAst({
571308
+ root: root2,
571309
+ from: location2.name,
571310
+ to: rename10.to,
571311
+ file: file2,
571312
+ line: location2.line,
571313
+ column: location2.column,
571314
+ engine: parseEngine(option20(tokens, "--engine")),
571315
+ checkCommand: option20(tokens, "--check"),
571316
+ skipDiagnostics: tokens.includes("--skip-diagnostics")
571317
+ });
571318
+ if (json2) {
571319
+ return { type: "text", value: JSON.stringify({ plan }, null, 2) };
570178
571320
  }
570179
- if (action3 === "preview") {
570180
- return {
570181
- type: "text",
570182
- value: json2 ? JSON.stringify({ plan, patch: plan.patch }, null, 2) : plan.patch || formatRenamePlan(plan)
570183
- };
571321
+ return { type: "text", value: formatRenamePlanAst(plan) };
571322
+ }
571323
+ if (action3 === "apply") {
571324
+ const rename10 = renameArgs(tokens);
571325
+ if (!rename10)
571326
+ return { type: "text", value: usage19() };
571327
+ const file2 = option20(tokens, "--file");
571328
+ const location2 = file2 ? parseSymbolLocation(rename10.from) : { name: rename10.from };
571329
+ const result = await applyRenameAst({
571330
+ root: root2,
571331
+ from: location2.name,
571332
+ to: rename10.to,
571333
+ file: file2,
571334
+ line: location2.line,
571335
+ column: location2.column,
571336
+ engine: parseEngine(option20(tokens, "--engine")),
571337
+ checkCommand: option20(tokens, "--check"),
571338
+ skipDiagnostics: tokens.includes("--skip-diagnostics")
571339
+ });
571340
+ if (json2) {
571341
+ return { type: "text", value: JSON.stringify(result, null, 2) };
570184
571342
  }
570185
- const result = await applyRename(root2, rename10.from, rename10.to, {
570186
- checkCommand: option20(tokens, "--check")
571343
+ return { type: "text", value: applyResultToText(result, `rename ${rename10.from} -> ${rename10.to}`) };
571344
+ }
571345
+ if (action3 === "move") {
571346
+ const move = moveArgs(tokens);
571347
+ if (!move)
571348
+ return { type: "text", value: usage19() };
571349
+ const file2 = option20(tokens, "--file");
571350
+ if (!file2)
571351
+ return { type: "text", value: "move requires --file <source-file>" };
571352
+ const location2 = parseSymbolLocation(move.symbol);
571353
+ const plan = await planMoveAst({
571354
+ root: root2,
571355
+ symbol: location2.name,
571356
+ targetFile: move.targetFile,
571357
+ file: file2,
571358
+ checkCommand: option20(tokens, "--check"),
571359
+ skipDiagnostics: tokens.includes("--skip-diagnostics")
571360
+ });
571361
+ if (tokens.includes("--preview") || !tokens.includes("--apply") && !json2) {
571362
+ return { type: "text", value: json2 ? JSON.stringify({ plan }, null, 2) : formatMovePlanAst(plan) };
571363
+ }
571364
+ const result = await applyMoveAst({
571365
+ root: root2,
571366
+ symbol: location2.name,
571367
+ targetFile: move.targetFile,
571368
+ file: file2,
571369
+ checkCommand: option20(tokens, "--check"),
571370
+ skipDiagnostics: tokens.includes("--skip-diagnostics")
570187
571371
  });
570188
571372
  if (json2) {
570189
571373
  return { type: "text", value: JSON.stringify(result, null, 2) };
570190
571374
  }
570191
- if (!result.ok) {
571375
+ return { type: "text", value: applyResultToText(result, `move ${move.symbol} -> ${move.targetFile}`) };
571376
+ }
571377
+ if (action3 === "organize-imports") {
571378
+ const file2 = option20(tokens, "--file");
571379
+ const plan = await planOrganizeImportsAst({
571380
+ root: root2,
571381
+ file: file2,
571382
+ checkCommand: option20(tokens, "--check"),
571383
+ skipDiagnostics: tokens.includes("--skip-diagnostics")
571384
+ });
571385
+ if (tokens.includes("--preview") || !tokens.includes("--apply") && !json2) {
571386
+ return { type: "text", value: json2 ? JSON.stringify({ plan }, null, 2) : formatOrganizeImportsPlanAst(plan) };
571387
+ }
571388
+ const result = await applyOrganizeImportsAst({
571389
+ root: root2,
571390
+ file: file2,
571391
+ checkCommand: option20(tokens, "--check"),
571392
+ skipDiagnostics: tokens.includes("--skip-diagnostics")
571393
+ });
571394
+ if (json2) {
571395
+ return { type: "text", value: JSON.stringify(result, null, 2) };
571396
+ }
571397
+ return { type: "text", value: applyResultToText(result, "organize imports") };
571398
+ }
571399
+ if (action3 === "unused") {
571400
+ const file2 = option20(tokens, "--file");
571401
+ const plan = await findUnusedAst({ root: root2, file: file2 });
571402
+ return { type: "text", value: json2 ? JSON.stringify({ plan }, null, 2) : plan.description };
571403
+ }
571404
+ if (action3 === "callers") {
571405
+ const symbol2 = callersArgs(tokens);
571406
+ if (!symbol2)
571407
+ return { type: "text", value: usage19() };
571408
+ const file2 = option20(tokens, "--file");
571409
+ const location2 = parseSymbolLocation(symbol2);
571410
+ const plan = await findCallersAst({ root: root2, symbol: location2.name, file: file2 });
571411
+ return { type: "text", value: json2 ? JSON.stringify({ plan }, null, 2) : plan.description };
571412
+ }
571413
+ if (action3 === "plan" || action3 === "preview") {
571414
+ const rename10 = renameArgs(tokens);
571415
+ if (!rename10)
571416
+ return { type: "text", value: usage19() };
571417
+ const plan = planRename(root2, rename10.from, rename10.to);
571418
+ if (action3 === "plan") {
570192
571419
  return {
570193
571420
  type: "text",
570194
- value: `Repo edit failed; rollback ${result.rolledBack ? "completed" : "not needed"}.
570195
- ` + `${result.error ?? "Unknown error"}
570196
-
570197
- Patch preview:
570198
- ${result.plan.patch}`
571421
+ value: json2 ? JSON.stringify({ plan }, null, 2) : formatRenamePlan(plan)
570199
571422
  };
570200
571423
  }
570201
571424
  return {
570202
571425
  type: "text",
570203
- value: `Applied AST rename ${rename10.from} -> ${rename10.to} across ${result.writtenFiles.length} file(s).
570204
-
570205
- ` + `Patch preview:
570206
- ${result.plan.patch}`
571426
+ value: json2 ? JSON.stringify({ plan, patch: plan.patch }, null, 2) : plan.patch || formatRenamePlan(plan)
570207
571427
  };
570208
571428
  }
570209
571429
  } catch (error40) {
@@ -570218,6 +571438,8 @@ var init_repo_edit = __esm(() => {
570218
571438
  init_argumentSubstitution();
570219
571439
  init_cwd2();
570220
571440
  init_reliableRepoEdit();
571441
+ init_repoEditAst();
571442
+ init_workspaceEdit();
570221
571443
  });
570222
571444
 
570223
571445
  // src/commands/repo-edit/index.ts
@@ -570227,8 +571449,8 @@ var init_repo_edit2 = __esm(() => {
570227
571449
  type: "local",
570228
571450
  name: "repo-edit",
570229
571451
  aliases: ["repoedit", "reliable-edit"],
570230
- description: "Reliable repo editing: indexed search, AST-aware rename plans, patch previews, and rollback-safe apply",
570231
- argumentHint: "index|search <query>|plan rename <from> --to <to>|preview rename <from> --to <to>|apply rename <from> --to <to> [--check <cmd>] [--json]",
571452
+ description: "Reliable repo editing: indexed search, binding-aware rename via TypeScript compiler API, patch previews, and rollback-safe apply",
571453
+ argumentHint: "index|search <query>|plan/preview/apply rename <from> --to <to>|rename <from> --to <to> [--file <path>] [--engine ts|lsp|treesitter] [--check <cmd>] [--json]|move <symbol> --to <target> --file <source> [--check <cmd>] [--json]|organize-imports [--file <path>] [--check <cmd>] [--json]|unused [--file <path>] [--json]|callers <symbol> [--file <path>] [--json]",
570232
571454
  supportsNonInteractive: true,
570233
571455
  load: () => Promise.resolve().then(() => (init_repo_edit(), exports_repo_edit))
570234
571456
  };
@@ -570369,11 +571591,11 @@ var init_cite2 = __esm(() => {
570369
571591
  });
570370
571592
 
570371
571593
  // src/ur/fileops.ts
570372
- import { existsSync as existsSync49, mkdirSync as mkdirSync45, readdirSync as readdirSync21, readFileSync as readFileSync55, statSync as statSync13, writeFileSync as writeFileSync43 } from "fs";
570373
- import { extname as extname16, isAbsolute as isAbsolute28, join as join169, relative as relative37, resolve as resolve45 } from "path";
571594
+ import { existsSync as existsSync50, mkdirSync as mkdirSync46, readdirSync as readdirSync21, readFileSync as readFileSync58, statSync as statSync13, writeFileSync as writeFileSync44 } from "fs";
571595
+ import { extname as extname16, isAbsolute as isAbsolute28, join as join172, relative as relative37, resolve as resolve45 } from "path";
570374
571596
  function readFileSafe2(cwd2, target, maxBytes = 64000) {
570375
571597
  const abs = isAbsolute28(target) ? target : resolve45(cwd2, target);
570376
- if (!existsSync49(abs))
571598
+ if (!existsSync50(abs))
570377
571599
  return { ok: false, error: `not found: ${target}` };
570378
571600
  const st = statSync13(abs);
570379
571601
  if (st.isDirectory())
@@ -570381,7 +571603,7 @@ function readFileSafe2(cwd2, target, maxBytes = 64000) {
570381
571603
  if (!isTextLike(abs))
570382
571604
  return { ok: false, error: `not a text file (${extname16(abs) || "no ext"}). For images use /image, for video /video, for PDFs/docs ask UR to read it.` };
570383
571605
  try {
570384
- let content = readFileSync55(abs, "utf8");
571606
+ let content = readFileSync58(abs, "utf8");
570385
571607
  if (content.length > maxBytes)
570386
571608
  content = content.slice(0, maxBytes) + `
570387
571609
  \u2026 [truncated at ${maxBytes} bytes]`;
@@ -570404,7 +571626,7 @@ function* walk(dir, root2, budget = { n: 0 }, max2 = 8000) {
570404
571626
  return;
570405
571627
  if (e.name.startsWith(".") && e.name !== ".ur")
570406
571628
  continue;
570407
- const full = join169(dir, e.name);
571629
+ const full = join172(dir, e.name);
570408
571630
  if (e.isDirectory()) {
570409
571631
  if (SKIP_DIRS2.has(e.name))
570410
571632
  continue;
@@ -570423,7 +571645,7 @@ function searchFiles(cwd2, query2, maxResults = 60) {
570423
571645
  continue;
570424
571646
  let lines;
570425
571647
  try {
570426
- lines = readFileSync55(join169(cwd2, rel), "utf8").split(`
571648
+ lines = readFileSync58(join172(cwd2, rel), "utf8").split(`
570427
571649
  `);
570428
571650
  } catch {
570429
571651
  continue;
@@ -570441,8 +571663,8 @@ function searchFiles(cwd2, query2, maxResults = 60) {
570441
571663
  function indexWorkspace(cwd2) {
570442
571664
  const files = [...walk(cwd2, cwd2)];
570443
571665
  try {
570444
- mkdirSync45(join169(cwd2, ".ur", "index"), { recursive: true });
570445
- writeFileSync43(join169(cwd2, ".ur", "index", "files.txt"), files.join(`
571666
+ mkdirSync46(join172(cwd2, ".ur", "index"), { recursive: true });
571667
+ writeFileSync44(join172(cwd2, ".ur", "index", "files.txt"), files.join(`
570446
571668
  `) + `
570447
571669
  `);
570448
571670
  } catch {}
@@ -570710,14 +571932,14 @@ var exports_image = {};
570710
571932
  __export(exports_image, {
570711
571933
  call: () => call105
570712
571934
  });
570713
- import { existsSync as existsSync50, statSync as statSync14 } from "fs";
571935
+ import { existsSync as existsSync51, statSync as statSync14 } from "fs";
570714
571936
  import { extname as extname17, isAbsolute as isAbsolute29, resolve as resolve46 } from "path";
570715
571937
  var call105 = async (args) => {
570716
571938
  const f = (args ?? "").trim().split(/\s+/)[0] ?? "";
570717
571939
  if (!f)
570718
571940
  return { type: "text", value: "usage: /image <file> [task]" };
570719
571941
  const abs = isAbsolute29(f) ? f : resolve46(getCwd2(), f);
570720
- if (!existsSync50(abs))
571942
+ if (!existsSync51(abs))
570721
571943
  return { type: "text", value: `not found: ${f}` };
570722
571944
  const kb = Math.round(statSync14(abs).size / 1024);
570723
571945
  const lines = [`image ${f} \u2014 ${extname17(abs) || "?"}, ${kb} KB`];
@@ -570758,7 +571980,7 @@ var exports_video = {};
570758
571980
  __export(exports_video, {
570759
571981
  call: () => call106
570760
571982
  });
570761
- import { existsSync as existsSync51 } from "fs";
571983
+ import { existsSync as existsSync52 } from "fs";
570762
571984
  import { isAbsolute as isAbsolute30, resolve as resolve47 } from "path";
570763
571985
  var call106 = async (args) => {
570764
571986
  const target = (args ?? "").trim().split(/\s+/)[0] ?? "";
@@ -570771,7 +571993,7 @@ var call106 = async (args) => {
570771
571993
  ${yd}` };
570772
571994
  }
570773
571995
  const abs = isAbsolute30(target) ? target : resolve47(getCwd2(), target);
570774
- if (!existsSync51(abs))
571996
+ if (!existsSync52(abs))
570775
571997
  return { type: "text", value: `not found: ${target}` };
570776
571998
  if (!commandExists("ffprobe")) {
570777
571999
  return { type: "text", value: `local video: ${target}
@@ -570867,13 +572089,13 @@ var exports_mode = {};
570867
572089
  __export(exports_mode, {
570868
572090
  call: () => call108
570869
572091
  });
570870
- import { existsSync as existsSync52, mkdirSync as mkdirSync46, readFileSync as readFileSync56, writeFileSync as writeFileSync44 } from "fs";
570871
- import { join as join170 } from "path";
570872
- var MODES, SECURITY_MODES2, file2 = (cwd2) => join170(cwd2, ".ur", "mode"), call108 = async (args) => {
572092
+ import { existsSync as existsSync53, mkdirSync as mkdirSync47, readFileSync as readFileSync59, writeFileSync as writeFileSync45 } from "fs";
572093
+ import { join as join173 } from "path";
572094
+ var MODES, SECURITY_MODES2, file2 = (cwd2) => join173(cwd2, ".ur", "mode"), call108 = async (args) => {
570873
572095
  const want = (args ?? "").trim().toLowerCase();
570874
572096
  const f = file2(getCwd2());
570875
572097
  if (!want) {
570876
- const cur = existsSync52(f) ? readFileSync56(f, "utf8").trim() : "code";
572098
+ const cur = existsSync53(f) ? readFileSync59(f, "utf8").trim() : "code";
570877
572099
  return { type: "text", value: `mode: ${cur}
570878
572100
  available: ${MODES.join(", ")}
570879
572101
  security: ${SECURITY_MODES2.join(", ")}` };
@@ -570887,8 +572109,8 @@ available: ${MODES.join(", ")}
570887
572109
  security: ${SECURITY_MODES2.join(", ")}` };
570888
572110
  }
570889
572111
  try {
570890
- mkdirSync46(join170(getCwd2(), ".ur"), { recursive: true });
570891
- writeFileSync44(f, want + `
572112
+ mkdirSync47(join173(getCwd2(), ".ur"), { recursive: true });
572113
+ writeFileSync45(f, want + `
570892
572114
  `);
570893
572115
  } catch {}
570894
572116
  return { type: "text", value: `mode \u2192 ${want} (UR will favor ${want}-oriented behavior; persisted to .ur/mode)` };
@@ -571010,8 +572232,8 @@ var exports_role_mode = {};
571010
572232
  __export(exports_role_mode, {
571011
572233
  call: () => call109
571012
572234
  });
571013
- import { existsSync as existsSync53, mkdirSync as mkdirSync47, writeFileSync as writeFileSync45 } from "fs";
571014
- import { join as join171 } from "path";
572235
+ import { existsSync as existsSync54, mkdirSync as mkdirSync48, writeFileSync as writeFileSync46 } from "fs";
572236
+ import { join as join174 } from "path";
571015
572237
  function formatList() {
571016
572238
  const lines = ["Built-in role modes:", ""];
571017
572239
  for (const mode2 of ROLE_MODES) {
@@ -571065,17 +572287,17 @@ var call109 = async (args) => {
571065
572287
  value: `Unknown role mode "${target}". Available: ${listModeNames().join(", ")}, or "all".`
571066
572288
  };
571067
572289
  }
571068
- const agentsDir = join171(getCwd2(), ".ur", "agents");
571069
- mkdirSync47(agentsDir, { recursive: true });
572290
+ const agentsDir = join174(getCwd2(), ".ur", "agents");
572291
+ mkdirSync48(agentsDir, { recursive: true });
571070
572292
  const created = [];
571071
572293
  const skipped = [];
571072
572294
  for (const mode2 of modes) {
571073
- const path22 = join171(agentsDir, `${mode2.name}.md`);
571074
- if (existsSync53(path22) && !force) {
572295
+ const path22 = join174(agentsDir, `${mode2.name}.md`);
572296
+ if (existsSync54(path22) && !force) {
571075
572297
  skipped.push(`${mode2.name} (exists; use --force to overwrite)`);
571076
572298
  continue;
571077
572299
  }
571078
- writeFileSync45(path22, renderModeAgent(mode2), { encoding: "utf-8" });
572300
+ writeFileSync46(path22, renderModeAgent(mode2), { encoding: "utf-8" });
571079
572301
  created.push(path22);
571080
572302
  }
571081
572303
  if (json2) {
@@ -571121,25 +572343,25 @@ var init_role_mode2 = __esm(() => {
571121
572343
  });
571122
572344
 
571123
572345
  // src/ur/researchGraph.ts
571124
- import { appendFileSync as appendFileSync6, existsSync as existsSync54, mkdirSync as mkdirSync48, readFileSync as readFileSync57 } from "fs";
571125
- import { dirname as dirname62, join as join172 } from "path";
572346
+ import { appendFileSync as appendFileSync6, existsSync as existsSync55, mkdirSync as mkdirSync49, readFileSync as readFileSync60 } from "fs";
572347
+ import { dirname as dirname63, join as join175 } from "path";
571126
572348
  function isEntity(s) {
571127
572349
  return ENTITIES.includes(s);
571128
572350
  }
571129
572351
  function addEntity(cwd2, entity, text) {
571130
572352
  try {
571131
572353
  const f = file3(cwd2, entity);
571132
- mkdirSync48(dirname62(f), { recursive: true });
572354
+ mkdirSync49(dirname63(f), { recursive: true });
571133
572355
  appendFileSync6(f, JSON.stringify({ ts: new Date().toISOString(), text }) + `
571134
572356
  `);
571135
572357
  } catch {}
571136
572358
  }
571137
572359
  function listEntity(cwd2, entity) {
571138
572360
  const f = file3(cwd2, entity);
571139
- if (!existsSync54(f))
572361
+ if (!existsSync55(f))
571140
572362
  return [];
571141
572363
  const out = [];
571142
- for (const line of readFileSync57(f, "utf8").split(`
572364
+ for (const line of readFileSync60(f, "utf8").split(`
571143
572365
  `).filter(Boolean)) {
571144
572366
  try {
571145
572367
  out.push(JSON.parse(line));
@@ -571153,7 +572375,7 @@ function graphSummary(cwd2) {
571153
572375
  out[e] = listEntity(cwd2, e).length;
571154
572376
  return out;
571155
572377
  }
571156
- var ENTITIES, file3 = (cwd2, entity) => join172(cwd2, ".ur", "graph", `${entity}.jsonl`);
572378
+ var ENTITIES, file3 = (cwd2, entity) => join175(cwd2, ".ur", "graph", `${entity}.jsonl`);
571157
572379
  var init_researchGraph = __esm(() => {
571158
572380
  ENTITIES = [
571159
572381
  "sources",
@@ -571222,15 +572444,15 @@ var exports_toolsmith = {};
571222
572444
  __export(exports_toolsmith, {
571223
572445
  call: () => call111
571224
572446
  });
571225
- import { existsSync as existsSync55, mkdirSync as mkdirSync49, readdirSync as readdirSync22, writeFileSync as writeFileSync46 } from "fs";
571226
- import { join as join173 } from "path";
572447
+ import { existsSync as existsSync56, mkdirSync as mkdirSync50, readdirSync as readdirSync22, writeFileSync as writeFileSync47 } from "fs";
572448
+ import { join as join176 } from "path";
571227
572449
  var TEMPLATES, call111 = async (args) => {
571228
572450
  const [name, langArg] = (args ?? "").trim().split(/\s+/).filter(Boolean);
571229
572451
  const auto = [["python3", "python"], ["node", "node"], ["bash", "bash"], ["go", "go"], ["cargo", "rust"]].find(([bin]) => commandExists(bin))?.[1] ?? "python";
571230
572452
  const lang = langArg ?? auto;
571231
- const dir = join173(getCwd2(), ".ur", "tools");
572453
+ const dir = join176(getCwd2(), ".ur", "tools");
571232
572454
  if (!name) {
571233
- const files = existsSync55(dir) ? readdirSync22(dir) : [];
572455
+ const files = existsSync56(dir) ? readdirSync22(dir) : [];
571234
572456
  return { type: "text", value: files.length ? `tools:
571235
572457
  ` + files.map((f) => " " + f).join(`
571236
572458
  `) : "no tools yet. usage: /toolsmith <name> <python|bash|node|go|rust>" };
@@ -571238,11 +572460,11 @@ var TEMPLATES, call111 = async (args) => {
571238
572460
  const tpl = TEMPLATES[lang];
571239
572461
  if (!tpl)
571240
572462
  return { type: "text", value: `unknown lang "${lang}". choose: ${Object.keys(TEMPLATES).join(", ")}` };
571241
- mkdirSync49(dir, { recursive: true });
571242
- const file4 = join173(dir, `${name}.${tpl.ext}`);
571243
- if (existsSync55(file4))
572463
+ mkdirSync50(dir, { recursive: true });
572464
+ const file4 = join176(dir, `${name}.${tpl.ext}`);
572465
+ if (existsSync56(file4))
571244
572466
  return { type: "text", value: `already exists: .ur/tools/${name}.${tpl.ext}` };
571245
- writeFileSync46(file4, tpl.body);
572467
+ writeFileSync47(file4, tpl.body);
571246
572468
  return { type: "text", value: `created .ur/tools/${name}.${tpl.ext}
571247
572469
  Ask UR to run it \u2014 it will request approval before executing, and you can keep it as a plugin if useful.` };
571248
572470
  };
@@ -571302,13 +572524,13 @@ var exports_browser = {};
571302
572524
  __export(exports_browser, {
571303
572525
  call: () => call112
571304
572526
  });
571305
- import { existsSync as existsSync56 } from "fs";
571306
- import { join as join174 } from "path";
572527
+ import { existsSync as existsSync57 } from "fs";
572528
+ import { join as join177 } from "path";
571307
572529
  var call112 = async (args) => {
571308
572530
  const task = (args ?? "").trim();
571309
572531
  if (!task)
571310
572532
  return { type: "text", value: "usage: /browser <url|task>" };
571311
- const hasPlaywright = existsSync56(join174(getCwd2(), "node_modules", "playwright")) || existsSync56(join174(getCwd2(), "node_modules", "playwright-core"));
572533
+ const hasPlaywright = existsSync57(join177(getCwd2(), "node_modules", "playwright")) || existsSync57(join177(getCwd2(), "node_modules", "playwright-core"));
571312
572534
  if (hasPlaywright) {
571313
572535
  return { type: "text", value: `Playwright detected \u2014 ask UR to drive the browser for: ${task}
571314
572536
  Risky actions (form submit, downloads, login) require your approval.` };
@@ -571363,22 +572585,22 @@ var init_ur_doctor2 = __esm(() => {
571363
572585
  });
571364
572586
 
571365
572587
  // src/utils/urAssets.ts
571366
- import { existsSync as existsSync57, mkdirSync as mkdirSync50, writeFileSync as writeFileSync47 } from "fs";
571367
- import { join as join175 } from "path";
572588
+ import { existsSync as existsSync58, mkdirSync as mkdirSync51, writeFileSync as writeFileSync48 } from "fs";
572589
+ import { join as join178 } from "path";
571368
572590
  function scaffoldUrAssets(cwd2) {
571369
- const root2 = join175(cwd2, ".ur");
572591
+ const root2 = join178(cwd2, ".ur");
571370
572592
  const created = [];
571371
572593
  const skipped = [];
571372
- mkdirSync50(root2, { recursive: true });
572594
+ mkdirSync51(root2, { recursive: true });
571373
572595
  for (const d of DIRS)
571374
- mkdirSync50(join175(root2, d), { recursive: true });
572596
+ mkdirSync51(join178(root2, d), { recursive: true });
571375
572597
  for (const file4 of SEED_FILES) {
571376
- const full = join175(root2, file4.path);
571377
- if (existsSync57(full)) {
572598
+ const full = join178(root2, file4.path);
572599
+ if (existsSync58(full)) {
571378
572600
  skipped.push(file4.path);
571379
572601
  continue;
571380
572602
  }
571381
- writeFileSync47(full, file4.content);
572603
+ writeFileSync48(full, file4.content);
571382
572604
  created.push(file4.path);
571383
572605
  }
571384
572606
  return { root: root2, created, skipped };
@@ -571671,7 +572893,7 @@ __export(exports_thinkback, {
571671
572893
  call: () => call118
571672
572894
  });
571673
572895
  import { readFile as readFile45 } from "fs/promises";
571674
- import { join as join176 } from "path";
572896
+ import { join as join179 } from "path";
571675
572897
  function getMarketplaceName() {
571676
572898
  return OFFICIAL_MARKETPLACE_NAME;
571677
572899
  }
@@ -571689,15 +572911,15 @@ async function getThinkbackSkillDir() {
571689
572911
  if (!thinkbackPlugin) {
571690
572912
  return null;
571691
572913
  }
571692
- const skillDir = join176(thinkbackPlugin.path, "skills", SKILL_NAME);
572914
+ const skillDir = join179(thinkbackPlugin.path, "skills", SKILL_NAME);
571693
572915
  if (await pathExists(skillDir)) {
571694
572916
  return skillDir;
571695
572917
  }
571696
572918
  return null;
571697
572919
  }
571698
572920
  async function playAnimation(skillDir) {
571699
- const dataPath = join176(skillDir, "year_in_review.js");
571700
- const playerPath = join176(skillDir, "player.js");
572921
+ const dataPath = join179(skillDir, "year_in_review.js");
572922
+ const playerPath = join179(skillDir, "player.js");
571701
572923
  try {
571702
572924
  await readFile45(dataPath);
571703
572925
  } catch (e) {
@@ -571745,7 +572967,7 @@ async function playAnimation(skillDir) {
571745
572967
  } catch {} finally {
571746
572968
  inkInstance.exitAlternateScreen();
571747
572969
  }
571748
- const htmlPath = join176(skillDir, "year_in_review.html");
572970
+ const htmlPath = join179(skillDir, "year_in_review.html");
571749
572971
  if (await pathExists(htmlPath)) {
571750
572972
  const platform6 = getPlatform();
571751
572973
  const openCmd = platform6 === "macos" ? "open" : platform6 === "windows" ? "start" : "xdg-open";
@@ -572081,7 +573303,7 @@ function ThinkbackFlow(t0) {
572081
573303
  if (!skillDir) {
572082
573304
  return;
572083
573305
  }
572084
- const dataPath = join176(skillDir, "year_in_review.js");
573306
+ const dataPath = join179(skillDir, "year_in_review.js");
572085
573307
  pathExists(dataPath).then((exists) => {
572086
573308
  logForDebugging(`Checking for ${dataPath}: ${exists ? "found" : "not found"}`);
572087
573309
  setHasGenerated(exists);
@@ -572255,7 +573477,7 @@ var exports_thinkback_play = {};
572255
573477
  __export(exports_thinkback_play, {
572256
573478
  call: () => call119
572257
573479
  });
572258
- import { join as join177 } from "path";
573480
+ import { join as join180 } from "path";
572259
573481
  function getPluginId2() {
572260
573482
  const marketplaceName = process.env.USER_TYPE === "ant" ? INTERNAL_MARKETPLACE_NAME : OFFICIAL_MARKETPLACE_NAME;
572261
573483
  return `thinkback@${marketplaceName}`;
@@ -572277,7 +573499,7 @@ async function call119() {
572277
573499
  value: "Thinkback plugin installation path not found."
572278
573500
  };
572279
573501
  }
572280
- const skillDir = join177(firstInstall.installPath, "skills", SKILL_NAME2);
573502
+ const skillDir = join180(firstInstall.installPath, "skills", SKILL_NAME2);
572281
573503
  const result = await playAnimation(skillDir);
572282
573504
  return { type: "text", value: result.message };
572283
573505
  }
@@ -578744,7 +579966,7 @@ var init_types13 = __esm(() => {
578744
579966
 
578745
579967
  // src/components/agents/agentFileUtils.ts
578746
579968
  import { mkdir as mkdir35, open as open12, unlink as unlink19 } from "fs/promises";
578747
- import { join as join178 } from "path";
579969
+ import { join as join181 } from "path";
578748
579970
  function formatAgentAsMarkdown(agentType, whenToUse, tools, systemPrompt, color3, model, memory2, effort) {
578749
579971
  const escapedWhenToUse = whenToUse.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\\\n");
578750
579972
  const isAllTools = tools === undefined || tools.length === 1 && tools[0] === "*";
@@ -578771,26 +579993,26 @@ function getAgentDirectoryPath(location2) {
578771
579993
  case "flagSettings":
578772
579994
  throw new Error(`Cannot get directory path for ${location2} agents`);
578773
579995
  case "userSettings":
578774
- return join178(getURConfigHomeDir(), AGENT_PATHS.AGENTS_DIR);
579996
+ return join181(getURConfigHomeDir(), AGENT_PATHS.AGENTS_DIR);
578775
579997
  case "projectSettings":
578776
- return join178(getCwd2(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
579998
+ return join181(getCwd2(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
578777
579999
  case "policySettings":
578778
- return join178(getManagedFilePath(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
580000
+ return join181(getManagedFilePath(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
578779
580001
  case "localSettings":
578780
- return join178(getCwd2(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
580002
+ return join181(getCwd2(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
578781
580003
  }
578782
580004
  }
578783
580005
  function getRelativeAgentDirectoryPath(location2) {
578784
580006
  switch (location2) {
578785
580007
  case "projectSettings":
578786
- return join178(".", AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
580008
+ return join181(".", AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
578787
580009
  default:
578788
580010
  return getAgentDirectoryPath(location2);
578789
580011
  }
578790
580012
  }
578791
580013
  function getNewAgentFilePath(agent) {
578792
580014
  const dirPath = getAgentDirectoryPath(agent.source);
578793
- return join178(dirPath, `${agent.agentType}.md`);
580015
+ return join181(dirPath, `${agent.agentType}.md`);
578794
580016
  }
578795
580017
  function getActualAgentFilePath(agent) {
578796
580018
  if (agent.source === "built-in") {
@@ -578801,14 +580023,14 @@ function getActualAgentFilePath(agent) {
578801
580023
  }
578802
580024
  const dirPath = getAgentDirectoryPath(agent.source);
578803
580025
  const filename = agent.filename || agent.agentType;
578804
- return join178(dirPath, `${filename}.md`);
580026
+ return join181(dirPath, `${filename}.md`);
578805
580027
  }
578806
580028
  function getNewRelativeAgentFilePath(agent) {
578807
580029
  if (agent.source === "built-in") {
578808
580030
  return "Built-in";
578809
580031
  }
578810
580032
  const dirPath = getRelativeAgentDirectoryPath(agent.source);
578811
- return join178(dirPath, `${agent.agentType}.md`);
580033
+ return join181(dirPath, `${agent.agentType}.md`);
578812
580034
  }
578813
580035
  function getActualRelativeAgentFilePath(agent) {
578814
580036
  if (isBuiltInAgent(agent)) {
@@ -578822,7 +580044,7 @@ function getActualRelativeAgentFilePath(agent) {
578822
580044
  }
578823
580045
  const dirPath = getRelativeAgentDirectoryPath(agent.source);
578824
580046
  const filename = agent.filename || agent.agentType;
578825
- return join178(dirPath, `${filename}.md`);
580047
+ return join181(dirPath, `${filename}.md`);
578826
580048
  }
578827
580049
  async function ensureAgentDirectoryExists(source) {
578828
580050
  const dirPath = getAgentDirectoryPath(source);
@@ -584831,9 +586053,9 @@ var init_rewind = __esm(() => {
584831
586053
  });
584832
586054
 
584833
586055
  // src/utils/heapDumpService.ts
584834
- import { createWriteStream as createWriteStream3, writeFileSync as writeFileSync48 } from "fs";
586056
+ import { createWriteStream as createWriteStream3, writeFileSync as writeFileSync49 } from "fs";
584835
586057
  import { readdir as readdir26, readFile as readFile47, writeFile as writeFile40 } from "fs/promises";
584836
- import { join as join179 } from "path";
586058
+ import { join as join182 } from "path";
584837
586059
  import { pipeline as pipeline2 } from "stream/promises";
584838
586060
  import {
584839
586061
  getHeapSnapshot,
@@ -584923,7 +586145,7 @@ async function captureMemoryDiagnostics(trigger2, dumpNumber = 0) {
584923
586145
  smapsRollup,
584924
586146
  platform: process.platform,
584925
586147
  nodeVersion: process.version,
584926
- ccVersion: "1.22.3"
586148
+ ccVersion: "1.22.4"
584927
586149
  };
584928
586150
  }
584929
586151
  async function performHeapDump(trigger2 = "manual", dumpNumber = 0) {
@@ -584941,8 +586163,8 @@ async function performHeapDump(trigger2 = "manual", dumpNumber = 0) {
584941
586163
  const suffix = dumpNumber > 0 ? `-dump${dumpNumber}` : "";
584942
586164
  const heapFilename = `${sessionId}${suffix}.heapsnapshot`;
584943
586165
  const diagFilename = `${sessionId}${suffix}-diagnostics.json`;
584944
- const heapPath = join179(dumpDir, heapFilename);
584945
- const diagPath = join179(dumpDir, diagFilename);
586166
+ const heapPath = join182(dumpDir, heapFilename);
586167
+ const diagPath = join182(dumpDir, diagFilename);
584946
586168
  await writeFile40(diagPath, jsonStringify(diagnostics, null, 2), {
584947
586169
  mode: 384
584948
586170
  });
@@ -584970,7 +586192,7 @@ async function performHeapDump(trigger2 = "manual", dumpNumber = 0) {
584970
586192
  }
584971
586193
  async function writeHeapSnapshot(filepath) {
584972
586194
  if (typeof Bun !== "undefined") {
584973
- writeFileSync48(filepath, Bun.generateHeapSnapshot("v8", "arraybuffer"), {
586195
+ writeFileSync49(filepath, Bun.generateHeapSnapshot("v8", "arraybuffer"), {
584974
586196
  mode: 384
584975
586197
  });
584976
586198
  Bun.gc(true);
@@ -585509,7 +586731,7 @@ var init_bridge_kick = __esm(() => {
585509
586731
  var call134 = async () => {
585510
586732
  return {
585511
586733
  type: "text",
585512
- value: "1.22.3"
586734
+ value: "1.22.4"
585513
586735
  };
585514
586736
  }, version2, version_default;
585515
586737
  var init_version = __esm(() => {
@@ -586716,8 +587938,8 @@ async function call135(onDone, _context, args) {
586716
587938
  const cleanPattern = commandPattern.replace(/^["']|["']$/g, "");
586717
587939
  addToExcludedCommands(cleanPattern);
586718
587940
  const localSettingsPath = getSettingsFilePathForSource("localSettings");
586719
- const relativePath = localSettingsPath ? relative39(getCwdState(), localSettingsPath) : ".ur/settings.local.json";
586720
- const message = color("success", themeName)(`Added "${cleanPattern}" to excluded commands in ${relativePath}`);
587941
+ const relativePath2 = localSettingsPath ? relative39(getCwdState(), localSettingsPath) : ".ur/settings.local.json";
587942
+ const message = color("success", themeName)(`Added "${cleanPattern}" to excluded commands in ${relativePath2}`);
586721
587943
  onDone(message);
586722
587944
  return null;
586723
587945
  } else {
@@ -586781,7 +588003,7 @@ var init_sandbox_toggle2 = __esm(() => {
586781
588003
 
586782
588004
  // src/utils/urInChrome/setupPortable.ts
586783
588005
  import { readdir as readdir27 } from "fs/promises";
586784
- import { join as join180 } from "path";
588006
+ import { join as join183 } from "path";
586785
588007
  function getExtensionIds() {
586786
588008
  return process.env.USER_TYPE === "ant" ? [PROD_EXTENSION_ID, DEV_EXTENSION_ID, ANT_EXTENSION_ID] : [PROD_EXTENSION_ID];
586787
588009
  }
@@ -586808,7 +588030,7 @@ async function detectExtensionInstallationPortable(browserPaths, log) {
586808
588030
  }
586809
588031
  for (const profile of profileDirs) {
586810
588032
  for (const extensionId of extensionIds) {
586811
- const extensionPath = join180(browserBasePath, profile, "Extensions", extensionId);
588033
+ const extensionPath = join183(browserBasePath, profile, "Extensions", extensionId);
586812
588034
  try {
586813
588035
  await readdir27(extensionPath);
586814
588036
  log?.(`[UR in Chrome] Extension ${extensionId} found in ${browser2} ${profile}`);
@@ -586832,7 +588054,7 @@ var init_setupPortable = __esm(() => {
586832
588054
  // src/utils/urInChrome/setup.ts
586833
588055
  import { chmod as chmod10, mkdir as mkdir36, readFile as readFile48, writeFile as writeFile41 } from "fs/promises";
586834
588056
  import { homedir as homedir31 } from "os";
586835
- import { join as join181 } from "path";
588057
+ import { join as join184 } from "path";
586836
588058
  import { fileURLToPath as fileURLToPath6 } from "url";
586837
588059
  function shouldEnableURInChrome(chromeFlag) {
586838
588060
  if (getIsNonInteractiveSession() && chromeFlag !== true) {
@@ -586889,8 +588111,8 @@ function setupURInChrome() {
586889
588111
  };
586890
588112
  } else {
586891
588113
  const __filename3 = fileURLToPath6(import.meta.url);
586892
- const __dirname3 = join181(__filename3, "..");
586893
- const cliPath = join181(__dirname3, "cli.js");
588114
+ const __dirname3 = join184(__filename3, "..");
588115
+ const cliPath = join184(__dirname3, "cli.js");
586894
588116
  createWrapperScript(`"${process.execPath}" "${cliPath}" --chrome-native-host`).then((manifestBinaryPath) => installChromeNativeHostManifest(manifestBinaryPath)).catch((e) => logForDebugging(`[UR in Chrome] Failed to install native host: ${e}`, { level: "error" }));
586895
588117
  const mcpConfig = {
586896
588118
  [UR_IN_CHROME_MCP_SERVER_NAME]: {
@@ -586912,8 +588134,8 @@ function getNativeMessagingHostsDirs() {
586912
588134
  const platform6 = getPlatform();
586913
588135
  if (platform6 === "windows") {
586914
588136
  const home = homedir31();
586915
- const appData = process.env.APPDATA || join181(home, "AppData", "Local");
586916
- return [join181(appData, "UR", "ChromeNativeHost")];
588137
+ const appData = process.env.APPDATA || join184(home, "AppData", "Local");
588138
+ return [join184(appData, "UR", "ChromeNativeHost")];
586917
588139
  }
586918
588140
  return getAllNativeMessagingHostsDirs().map(({ path: path22 }) => path22);
586919
588141
  }
@@ -586938,7 +588160,7 @@ async function installChromeNativeHostManifest(manifestBinaryPath) {
586938
588160
  const manifestContent = jsonStringify(manifest, null, 2);
586939
588161
  let anyManifestUpdated = false;
586940
588162
  for (const manifestDir of manifestDirs) {
586941
- const manifestPath5 = join181(manifestDir, NATIVE_HOST_MANIFEST_NAME);
588163
+ const manifestPath5 = join184(manifestDir, NATIVE_HOST_MANIFEST_NAME);
586942
588164
  const existingContent = await readFile48(manifestPath5, "utf-8").catch(() => null);
586943
588165
  if (existingContent === manifestContent) {
586944
588166
  continue;
@@ -586953,7 +588175,7 @@ async function installChromeNativeHostManifest(manifestBinaryPath) {
586953
588175
  }
586954
588176
  }
586955
588177
  if (getPlatform() === "windows") {
586956
- const manifestPath5 = join181(manifestDirs[0], NATIVE_HOST_MANIFEST_NAME);
588178
+ const manifestPath5 = join184(manifestDirs[0], NATIVE_HOST_MANIFEST_NAME);
586957
588179
  registerWindowsNativeHosts(manifestPath5);
586958
588180
  }
586959
588181
  if (anyManifestUpdated) {
@@ -586991,8 +588213,8 @@ function registerWindowsNativeHosts(manifestPath5) {
586991
588213
  }
586992
588214
  async function createWrapperScript(command7) {
586993
588215
  const platform6 = getPlatform();
586994
- const chromeDir = join181(getURConfigHomeDir(), "chrome");
586995
- const wrapperPath = platform6 === "windows" ? join181(chromeDir, "chrome-native-host.bat") : join181(chromeDir, "chrome-native-host");
588216
+ const chromeDir = join184(getURConfigHomeDir(), "chrome");
588217
+ const wrapperPath = platform6 === "windows" ? join184(chromeDir, "chrome-native-host.bat") : join184(chromeDir, "chrome-native-host");
586996
588218
  const scriptContent = platform6 === "windows" ? `@echo off
586997
588219
  REM Chrome native host wrapper script
586998
588220
  REM Generated by UR - do not edit manually
@@ -587564,7 +588786,7 @@ var init_advisor2 = __esm(() => {
587564
588786
  // src/skills/bundledSkills.ts
587565
588787
  import { constants as fsConstants5 } from "fs";
587566
588788
  import { mkdir as mkdir37, open as open13 } from "fs/promises";
587567
- import { dirname as dirname63, isAbsolute as isAbsolute31, join as join182, normalize as normalize13, sep as pathSep3 } from "path";
588789
+ import { dirname as dirname64, isAbsolute as isAbsolute31, join as join185, normalize as normalize13, sep as pathSep3 } from "path";
587568
588790
  function registerBundledSkill(definition) {
587569
588791
  const { files: files2 } = definition;
587570
588792
  let skillRoot;
@@ -587612,7 +588834,7 @@ function getBundledSkills() {
587612
588834
  return [...bundledSkills];
587613
588835
  }
587614
588836
  function getBundledSkillExtractDir(skillName) {
587615
- return join182(getBundledSkillsRoot(), skillName);
588837
+ return join185(getBundledSkillsRoot(), skillName);
587616
588838
  }
587617
588839
  async function extractBundledSkillFiles(skillName, files2) {
587618
588840
  const dir = getBundledSkillExtractDir(skillName);
@@ -587628,7 +588850,7 @@ async function writeSkillFiles(dir, files2) {
587628
588850
  const byParent = new Map;
587629
588851
  for (const [relPath, content] of Object.entries(files2)) {
587630
588852
  const target = resolveSkillFilePath(dir, relPath);
587631
- const parent2 = dirname63(target);
588853
+ const parent2 = dirname64(target);
587632
588854
  const entry = [target, content];
587633
588855
  const group = byParent.get(parent2);
587634
588856
  if (group)
@@ -587654,7 +588876,7 @@ function resolveSkillFilePath(baseDir, relPath) {
587654
588876
  if (isAbsolute31(normalized) || normalized.split(pathSep3).includes("..") || normalized.split("/").includes("..")) {
587655
588877
  throw new Error(`bundled skill file path escapes skill dir: ${relPath}`);
587656
588878
  }
587657
- return join182(baseDir, normalized);
588879
+ return join185(baseDir, normalized);
587658
588880
  }
587659
588881
  function prependBaseDir(blocks, baseDir) {
587660
588882
  const prefix = `Base directory for this skill: ${baseDir}
@@ -588015,7 +589237,7 @@ var init_exit2 = __esm(() => {
588015
589237
  });
588016
589238
 
588017
589239
  // src/components/ExportDialog.tsx
588018
- import { join as join183 } from "path";
589240
+ import { join as join186 } from "path";
588019
589241
  function ExportDialog({
588020
589242
  content,
588021
589243
  defaultFilename,
@@ -588048,7 +589270,7 @@ function ExportDialog({
588048
589270
  };
588049
589271
  const handleFilenameSubmit = () => {
588050
589272
  const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt";
588051
- const filepath = join183(getCwd2(), finalFilename);
589273
+ const filepath = join186(getCwd2(), finalFilename);
588052
589274
  try {
588053
589275
  writeFileSync_DEPRECATED(filepath, content, {
588054
589276
  encoding: "utf-8",
@@ -588271,7 +589493,7 @@ __export(exports_export, {
588271
589493
  extractFirstPrompt: () => extractFirstPrompt,
588272
589494
  call: () => call139
588273
589495
  });
588274
- import { join as join184 } from "path";
589496
+ import { join as join187 } from "path";
588275
589497
  function formatTimestamp(date6) {
588276
589498
  const year = date6.getFullYear();
588277
589499
  const month = String(date6.getMonth() + 1).padStart(2, "0");
@@ -588315,7 +589537,7 @@ async function call139(onDone, context4, args) {
588315
589537
  const filename = args.trim();
588316
589538
  if (filename) {
588317
589539
  const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt";
588318
- const filepath = join184(getCwd2(), finalFilename);
589540
+ const filepath = join187(getCwd2(), finalFilename);
588319
589541
  try {
588320
589542
  writeFileSync_DEPRECATED(filepath, content, {
588321
589543
  encoding: "utf-8",
@@ -590163,7 +591385,7 @@ var require_asciichart = __commonJS((exports) => {
590163
591385
  // src/utils/statsCache.ts
590164
591386
  import { randomBytes as randomBytes17 } from "crypto";
590165
591387
  import { open as open14 } from "fs/promises";
590166
- import { join as join185 } from "path";
591388
+ import { join as join188 } from "path";
590167
591389
  async function withStatsCacheLock(fn) {
590168
591390
  while (statsCacheLockPromise) {
590169
591391
  await statsCacheLockPromise;
@@ -590180,7 +591402,7 @@ async function withStatsCacheLock(fn) {
590180
591402
  }
590181
591403
  }
590182
591404
  function getStatsCachePath() {
590183
- return join185(getURConfigHomeDir(), STATS_CACHE_FILENAME);
591405
+ return join188(getURConfigHomeDir(), STATS_CACHE_FILENAME);
590184
591406
  }
590185
591407
  function getEmptyCache() {
590186
591408
  return {
@@ -590848,12 +592070,12 @@ var init_ansiToPng = __esm(() => {
590848
592070
  // src/utils/screenshotClipboard.ts
590849
592071
  import { mkdir as mkdir38, unlink as unlink20, writeFile as writeFile42 } from "fs/promises";
590850
592072
  import { tmpdir as tmpdir9 } from "os";
590851
- import { join as join186 } from "path";
592073
+ import { join as join189 } from "path";
590852
592074
  async function copyAnsiToClipboard(ansiText, options2) {
590853
592075
  try {
590854
- const tempDir = join186(tmpdir9(), "ur-screenshots");
592076
+ const tempDir = join189(tmpdir9(), "ur-screenshots");
590855
592077
  await mkdir38(tempDir, { recursive: true });
590856
- const pngPath = join186(tempDir, `screenshot-${Date.now()}.png`);
592078
+ const pngPath = join189(tempDir, `screenshot-${Date.now()}.png`);
590857
592079
  const pngBuffer = ansiToPng(ansiText, options2);
590858
592080
  await writeFile42(pngPath, pngBuffer);
590859
592081
  const result = await copyPngToClipboard(pngPath);
@@ -590924,7 +592146,7 @@ var init_screenshotClipboard = __esm(() => {
590924
592146
 
590925
592147
  // src/utils/stats.ts
590926
592148
  import { open as open15 } from "fs/promises";
590927
- import { basename as basename41, join as join187, sep as sep33 } from "path";
592149
+ import { basename as basename41, join as join190, sep as sep33 } from "path";
590928
592150
  async function processSessionFiles(sessionFiles, options2 = {}) {
590929
592151
  const { fromDate, toDate } = options2;
590930
592152
  const fs12 = getFsImplementation();
@@ -591102,17 +592324,17 @@ async function getAllSessionFiles() {
591102
592324
  return [];
591103
592325
  throw e;
591104
592326
  }
591105
- const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) => join187(projectsDir, dirent.name));
592327
+ const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) => join190(projectsDir, dirent.name));
591106
592328
  const projectResults = await Promise.all(projectDirs.map(async (projectDir) => {
591107
592329
  try {
591108
592330
  const entries = await fs12.readdir(projectDir);
591109
- const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) => join187(projectDir, dirent.name));
592331
+ const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) => join190(projectDir, dirent.name));
591110
592332
  const sessionDirs = entries.filter((dirent) => dirent.isDirectory());
591111
592333
  const subagentResults = await Promise.all(sessionDirs.map(async (sessionDir) => {
591112
- const subagentsDir = join187(projectDir, sessionDir.name, "subagents");
592334
+ const subagentsDir = join190(projectDir, sessionDir.name, "subagents");
591113
592335
  try {
591114
592336
  const subagentEntries = await fs12.readdir(subagentsDir);
591115
- return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) => join187(subagentsDir, dirent.name));
592337
+ return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) => join190(subagentsDir, dirent.name));
591116
592338
  } catch {
591117
592339
  return [];
591118
592340
  }
@@ -593110,7 +594332,7 @@ import {
593110
594332
  writeFile as writeFile43
593111
594333
  } from "fs/promises";
593112
594334
  import { tmpdir as tmpdir10 } from "os";
593113
- import { extname as extname18, join as join188 } from "path";
594335
+ import { extname as extname18, join as join191 } from "path";
593114
594336
  function getAnalysisModel() {
593115
594337
  return getDefaultmodelOModel();
593116
594338
  }
@@ -593118,13 +594340,13 @@ function getInsightsModel() {
593118
594340
  return getDefaultmodelOModel();
593119
594341
  }
593120
594342
  function getDataDir() {
593121
- return join188(getURConfigHomeDir(), "usage-data");
594343
+ return join191(getURConfigHomeDir(), "usage-data");
593122
594344
  }
593123
594345
  function getFacetsDir() {
593124
- return join188(getDataDir(), "facets");
594346
+ return join191(getDataDir(), "facets");
593125
594347
  }
593126
594348
  function getSessionMetaDir() {
593127
- return join188(getDataDir(), "session-meta");
594349
+ return join191(getDataDir(), "session-meta");
593128
594350
  }
593129
594351
  function getLanguageFromPath(filePath) {
593130
594352
  const ext = extname18(filePath).toLowerCase();
@@ -593469,7 +594691,7 @@ async function formatTranscriptWithSummarization(log) {
593469
594691
  `);
593470
594692
  }
593471
594693
  async function loadCachedFacets(sessionId) {
593472
- const facetPath = join188(getFacetsDir(), `${sessionId}.json`);
594694
+ const facetPath = join191(getFacetsDir(), `${sessionId}.json`);
593473
594695
  try {
593474
594696
  const content = await readFile49(facetPath, { encoding: "utf-8" });
593475
594697
  const parsed = jsonParse(content);
@@ -593488,14 +594710,14 @@ async function saveFacets(facets) {
593488
594710
  try {
593489
594711
  await mkdir39(getFacetsDir(), { recursive: true });
593490
594712
  } catch {}
593491
- const facetPath = join188(getFacetsDir(), `${facets.session_id}.json`);
594713
+ const facetPath = join191(getFacetsDir(), `${facets.session_id}.json`);
593492
594714
  await writeFile43(facetPath, jsonStringify(facets, null, 2), {
593493
594715
  encoding: "utf-8",
593494
594716
  mode: 384
593495
594717
  });
593496
594718
  }
593497
594719
  async function loadCachedSessionMeta(sessionId) {
593498
- const metaPath2 = join188(getSessionMetaDir(), `${sessionId}.json`);
594720
+ const metaPath2 = join191(getSessionMetaDir(), `${sessionId}.json`);
593499
594721
  try {
593500
594722
  const content = await readFile49(metaPath2, { encoding: "utf-8" });
593501
594723
  return jsonParse(content);
@@ -593507,7 +594729,7 @@ async function saveSessionMeta(meta) {
593507
594729
  try {
593508
594730
  await mkdir39(getSessionMetaDir(), { recursive: true });
593509
594731
  } catch {}
593510
- const metaPath2 = join188(getSessionMetaDir(), `${meta.session_id}.json`);
594732
+ const metaPath2 = join191(getSessionMetaDir(), `${meta.session_id}.json`);
593511
594733
  await writeFile43(metaPath2, jsonStringify(meta, null, 2), {
593512
594734
  encoding: "utf-8",
593513
594735
  mode: 384
@@ -593565,8 +594787,8 @@ function detectMultiClauding(sessions) {
593565
594787
  for (const session2 of sessions) {
593566
594788
  for (const timestamp2 of session2.user_message_timestamps) {
593567
594789
  try {
593568
- const ts2 = new Date(timestamp2).getTime();
593569
- allSessionMessages.push({ ts: ts2, sessionId: session2.session_id });
594790
+ const ts4 = new Date(timestamp2).getTime();
594791
+ allSessionMessages.push({ ts: ts4, sessionId: session2.session_id });
593570
594792
  } catch {}
593571
594793
  }
593572
594794
  }
@@ -594564,7 +595786,7 @@ function generateHtmlReport(data, insights) {
594564
595786
  </html>`;
594565
595787
  }
594566
595788
  function buildExportData(data, insights, facets, remoteStats) {
594567
- const version3 = typeof MACRO !== "undefined" ? "1.22.3" : "unknown";
595789
+ const version3 = typeof MACRO !== "undefined" ? "1.22.4" : "unknown";
594568
595790
  const remote_hosts_collected = remoteStats?.hosts.filter((h2) => h2.sessionCount > 0).map((h2) => h2.name);
594569
595791
  const facets_summary = {
594570
595792
  total: facets.size,
@@ -594615,7 +595837,7 @@ async function scanAllSessions() {
594615
595837
  } catch {
594616
595838
  return [];
594617
595839
  }
594618
- const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join188(projectsDir, dirent.name));
595840
+ const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join191(projectsDir, dirent.name));
594619
595841
  const allSessions = [];
594620
595842
  for (let i3 = 0;i3 < projectDirs.length; i3++) {
594621
595843
  const sessionFiles = await getSessionFilesWithMtime(projectDirs[i3]);
@@ -594637,7 +595859,7 @@ async function scanAllSessions() {
594637
595859
  async function generateUsageReport(options2) {
594638
595860
  let remoteStats;
594639
595861
  if (process.env.USER_TYPE === "ant" && options2?.collectRemote) {
594640
- const destDir = join188(getURConfigHomeDir(), "projects");
595862
+ const destDir = join191(getURConfigHomeDir(), "projects");
594641
595863
  const { hosts, totalCopied } = await collectAllRemoteHostData(destDir);
594642
595864
  remoteStats = { hosts, totalCopied };
594643
595865
  }
@@ -594776,7 +595998,7 @@ async function generateUsageReport(options2) {
594776
595998
  try {
594777
595999
  await mkdir39(getDataDir(), { recursive: true });
594778
596000
  } catch {}
594779
- const htmlPath = join188(getDataDir(), "report.html");
596001
+ const htmlPath = join191(getDataDir(), "report.html");
594780
596002
  await writeFile43(htmlPath, htmlReport, {
594781
596003
  encoding: "utf-8",
594782
596004
  mode: 384
@@ -594872,13 +596094,13 @@ var init_insights = __esm(() => {
594872
596094
  } : async () => 0;
594873
596095
  collectFromRemoteHost = process.env.USER_TYPE === "ant" ? async (homespace, destDir) => {
594874
596096
  const result = { copied: 0, skipped: 0 };
594875
- const tempDir = await mkdtemp(join188(tmpdir10(), "ur-hs-"));
596097
+ const tempDir = await mkdtemp(join191(tmpdir10(), "ur-hs-"));
594876
596098
  try {
594877
596099
  const scpResult = await execFileNoThrow("scp", ["-rq", `${homespace}.coder:/root/.ur/projects/`, tempDir], { timeout: 300000 });
594878
596100
  if (scpResult.code !== 0) {
594879
596101
  return result;
594880
596102
  }
594881
- const projectsDir = join188(tempDir, "projects");
596103
+ const projectsDir = join191(tempDir, "projects");
594882
596104
  let projectDirents;
594883
596105
  try {
594884
596106
  projectDirents = await readdir28(projectsDir, { withFileTypes: true });
@@ -594887,11 +596109,11 @@ var init_insights = __esm(() => {
594887
596109
  }
594888
596110
  await Promise.all(projectDirents.map(async (dirent) => {
594889
596111
  const projectName = dirent.name;
594890
- const projectPath = join188(projectsDir, projectName);
596112
+ const projectPath = join191(projectsDir, projectName);
594891
596113
  if (!dirent.isDirectory())
594892
596114
  return;
594893
596115
  const destProjectName = `${projectName}__${homespace}`;
594894
- const destProjectPath = join188(destDir, destProjectName);
596116
+ const destProjectPath = join191(destDir, destProjectName);
594895
596117
  try {
594896
596118
  await mkdir39(destProjectPath, { recursive: true });
594897
596119
  } catch {}
@@ -594905,8 +596127,8 @@ var init_insights = __esm(() => {
594905
596127
  const fileName = fileDirent.name;
594906
596128
  if (!fileName.endsWith(".jsonl"))
594907
596129
  return;
594908
- const srcFile = join188(projectPath, fileName);
594909
- const destFile = join188(destProjectPath, fileName);
596130
+ const srcFile = join191(projectPath, fileName);
596131
+ const destFile = join191(destProjectPath, fileName);
594910
596132
  try {
594911
596133
  await copyFile9(srcFile, destFile, fsConstants6.COPYFILE_EXCL);
594912
596134
  result.copied++;
@@ -596004,7 +597226,7 @@ import {
596004
597226
  unlink as unlink22,
596005
597227
  writeFile as writeFile44
596006
597228
  } from "fs/promises";
596007
- import { basename as basename42, dirname as dirname65, join as join189 } from "path";
597229
+ import { basename as basename42, dirname as dirname66, join as join192 } from "path";
596008
597230
  function isTranscriptMessage(entry) {
596009
597231
  const t = entry.type;
596010
597232
  return t === "user" || t === "assistant" || t === "attachment" || t === "system";
@@ -596019,18 +597241,18 @@ function isEphemeralToolProgress(dataType) {
596019
597241
  return typeof dataType === "string" && EPHEMERAL_PROGRESS_TYPES.has(dataType);
596020
597242
  }
596021
597243
  function getProjectsDir2() {
596022
- return join189(getURConfigHomeDir(), "projects");
597244
+ return join192(getURConfigHomeDir(), "projects");
596023
597245
  }
596024
597246
  function getTranscriptPath() {
596025
597247
  const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
596026
- return join189(projectDir, `${getSessionId()}.jsonl`);
597248
+ return join192(projectDir, `${getSessionId()}.jsonl`);
596027
597249
  }
596028
597250
  function getTranscriptPathForSession(sessionId) {
596029
597251
  if (sessionId === getSessionId()) {
596030
597252
  return getTranscriptPath();
596031
597253
  }
596032
597254
  const projectDir = getProjectDir2(getOriginalCwd());
596033
- return join189(projectDir, `${sessionId}.jsonl`);
597255
+ return join192(projectDir, `${sessionId}.jsonl`);
596034
597256
  }
596035
597257
  function setAgentTranscriptSubdir(agentId, subdir) {
596036
597258
  agentTranscriptSubdirs.set(agentId, subdir);
@@ -596042,15 +597264,15 @@ function getAgentTranscriptPath(agentId) {
596042
597264
  const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
596043
597265
  const sessionId = getSessionId();
596044
597266
  const subdir = agentTranscriptSubdirs.get(agentId);
596045
- const base2 = subdir ? join189(projectDir, sessionId, "subagents", subdir) : join189(projectDir, sessionId, "subagents");
596046
- return join189(base2, `agent-${agentId}.jsonl`);
597267
+ const base2 = subdir ? join192(projectDir, sessionId, "subagents", subdir) : join192(projectDir, sessionId, "subagents");
597268
+ return join192(base2, `agent-${agentId}.jsonl`);
596047
597269
  }
596048
597270
  function getAgentMetadataPath(agentId) {
596049
597271
  return getAgentTranscriptPath(agentId).replace(/\.jsonl$/, ".meta.json");
596050
597272
  }
596051
597273
  async function writeAgentMetadata(agentId, metadata) {
596052
597274
  const path22 = getAgentMetadataPath(agentId);
596053
- await mkdir40(dirname65(path22), { recursive: true });
597275
+ await mkdir40(dirname66(path22), { recursive: true });
596054
597276
  await writeFile44(path22, JSON.stringify(metadata));
596055
597277
  }
596056
597278
  async function readAgentMetadata(agentId) {
@@ -596066,14 +597288,14 @@ async function readAgentMetadata(agentId) {
596066
597288
  }
596067
597289
  function getRemoteAgentsDir() {
596068
597290
  const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
596069
- return join189(projectDir, getSessionId(), "remote-agents");
597291
+ return join192(projectDir, getSessionId(), "remote-agents");
596070
597292
  }
596071
597293
  function getRemoteAgentMetadataPath(taskId) {
596072
- return join189(getRemoteAgentsDir(), `remote-agent-${taskId}.meta.json`);
597294
+ return join192(getRemoteAgentsDir(), `remote-agent-${taskId}.meta.json`);
596073
597295
  }
596074
597296
  async function writeRemoteAgentMetadata(taskId, metadata) {
596075
597297
  const path22 = getRemoteAgentMetadataPath(taskId);
596076
- await mkdir40(dirname65(path22), { recursive: true });
597298
+ await mkdir40(dirname66(path22), { recursive: true });
596077
597299
  await writeFile44(path22, JSON.stringify(metadata));
596078
597300
  }
596079
597301
  async function readRemoteAgentMetadata(taskId) {
@@ -596112,7 +597334,7 @@ async function listRemoteAgentMetadata() {
596112
597334
  if (!entry.isFile() || !entry.name.endsWith(".meta.json"))
596113
597335
  continue;
596114
597336
  try {
596115
- const raw = await readFile50(join189(dir, entry.name), "utf-8");
597337
+ const raw = await readFile50(join192(dir, entry.name), "utf-8");
596116
597338
  results.push(JSON.parse(raw));
596117
597339
  } catch (e) {
596118
597340
  logForDebugging(`listRemoteAgentMetadata: skipping ${entry.name}: ${String(e)}`);
@@ -596122,7 +597344,7 @@ async function listRemoteAgentMetadata() {
596122
597344
  }
596123
597345
  function sessionIdExists(sessionId) {
596124
597346
  const projectDir = getProjectDir2(getOriginalCwd());
596125
- const sessionFile = join189(projectDir, `${sessionId}.jsonl`);
597347
+ const sessionFile = join192(projectDir, `${sessionId}.jsonl`);
596126
597348
  const fs12 = getFsImplementation();
596127
597349
  try {
596128
597350
  fs12.statSync(sessionFile);
@@ -596262,7 +597484,7 @@ class Project {
596262
597484
  try {
596263
597485
  await fsAppendFile(filePath, data, { mode: 384 });
596264
597486
  } catch {
596265
- await mkdir40(dirname65(filePath), { recursive: true, mode: 448 });
597487
+ await mkdir40(dirname66(filePath), { recursive: true, mode: 448 });
596266
597488
  await fsAppendFile(filePath, data, { mode: 384 });
596267
597489
  }
596268
597490
  }
@@ -596862,7 +598084,7 @@ async function hydrateFromCCRv2InternalEvents(sessionId) {
596862
598084
  }
596863
598085
  for (const [agentId, entries] of byAgent) {
596864
598086
  const agentFile = getAgentTranscriptPath(asAgentId(agentId));
596865
- await mkdir40(dirname65(agentFile), { recursive: true, mode: 448 });
598087
+ await mkdir40(dirname66(agentFile), { recursive: true, mode: 448 });
596866
598088
  const agentContent = entries.map((p2) => jsonStringify(p2) + `
596867
598089
  `).join("");
596868
598090
  await writeFile44(agentFile, agentContent, {
@@ -597399,7 +598621,7 @@ function appendEntryToFile(fullPath, entry) {
597399
598621
  try {
597400
598622
  fs12.appendFileSync(fullPath, line, { mode: 384 });
597401
598623
  } catch {
597402
- fs12.mkdirSync(dirname65(fullPath), { mode: 448 });
598624
+ fs12.mkdirSync(dirname66(fullPath), { mode: 448 });
597403
598625
  fs12.appendFileSync(fullPath, line, { mode: 384 });
597404
598626
  }
597405
598627
  }
@@ -598096,7 +599318,7 @@ async function loadTranscriptFile(filePath, opts) {
598096
599318
  };
598097
599319
  }
598098
599320
  async function loadSessionFile(sessionId) {
598099
- const sessionFile = join189(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), `${sessionId}.jsonl`);
599321
+ const sessionFile = join192(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), `${sessionId}.jsonl`);
598100
599322
  return loadTranscriptFile(sessionFile);
598101
599323
  }
598102
599324
  function clearSessionMessagesCache() {
@@ -598164,7 +599386,7 @@ async function loadAllProjectsMessageLogsFull(limit) {
598164
599386
  } catch {
598165
599387
  return [];
598166
599388
  }
598167
- const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join189(projectsDir, dirent.name));
599389
+ const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join192(projectsDir, dirent.name));
598168
599390
  const logsPerProject = await Promise.all(projectDirs.map((projectDir) => getLogsWithoutIndex(projectDir, limit)));
598169
599391
  const allLogs = logsPerProject.flat();
598170
599392
  const deduped = new Map;
@@ -598189,7 +599411,7 @@ async function loadAllProjectsMessageLogsProgressive(limit, initialEnrichCount =
598189
599411
  } catch {
598190
599412
  return { logs: [], allStatLogs: [], nextIndex: 0 };
598191
599413
  }
598192
- const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join189(projectsDir, dirent.name));
599414
+ const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join192(projectsDir, dirent.name));
598193
599415
  const rawLogs = [];
598194
599416
  for (const projectDir of projectDirs) {
598195
599417
  rawLogs.push(...await getSessionFilesLite(projectDir, limit));
@@ -598250,7 +599472,7 @@ async function getStatOnlyLogsForWorktrees(worktreePaths, limit) {
598250
599472
  for (const { path: wtPath, prefix } of indexed) {
598251
599473
  if (dirName === prefix || dirName.startsWith(prefix + "-")) {
598252
599474
  seenDirs.add(dirName);
598253
- allLogs.push(...await getSessionFilesLite(join189(projectsDir, dirent.name), undefined, wtPath));
599475
+ allLogs.push(...await getSessionFilesLite(join192(projectsDir, dirent.name), undefined, wtPath));
598254
599476
  break;
598255
599477
  }
598256
599478
  }
@@ -598319,7 +599541,7 @@ async function loadSubagentTranscripts(agentIds) {
598319
599541
  return transcripts;
598320
599542
  }
598321
599543
  async function loadAllSubagentTranscriptsFromDisk() {
598322
- const subagentsDir = join189(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), getSessionId(), "subagents");
599544
+ const subagentsDir = join192(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), getSessionId(), "subagents");
598323
599545
  let entries;
598324
599546
  try {
598325
599547
  entries = await readdir29(subagentsDir, { withFileTypes: true });
@@ -598447,7 +599669,7 @@ async function getSessionFilesWithMtime(projectDir) {
598447
599669
  const sessionId = validateUuid2(basename42(dirent.name, ".jsonl"));
598448
599670
  if (!sessionId)
598449
599671
  continue;
598450
- candidates2.push({ sessionId, filePath: join189(projectDir, dirent.name) });
599672
+ candidates2.push({ sessionId, filePath: join192(projectDir, dirent.name) });
598451
599673
  }
598452
599674
  await Promise.all(candidates2.map(async ({ sessionId, filePath }) => {
598453
599675
  try {
@@ -598833,7 +600055,7 @@ var init_sessionStorage = __esm(() => {
598833
600055
  init_settings2();
598834
600056
  init_slowOperations();
598835
600057
  init_uuid();
598836
- VERSION5 = typeof MACRO !== "undefined" ? "1.22.3" : "unknown";
600058
+ VERSION5 = typeof MACRO !== "undefined" ? "1.22.4" : "unknown";
598837
600059
  MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
598838
600060
  SKIP_FIRST_PROMPT_PATTERN = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
598839
600061
  EPHEMERAL_PROGRESS_TYPES = new Set([
@@ -598845,7 +600067,7 @@ var init_sessionStorage = __esm(() => {
598845
600067
  MAX_TRANSCRIPT_READ_BYTES = 50 * 1024 * 1024;
598846
600068
  agentTranscriptSubdirs = new Map;
598847
600069
  getProjectDir2 = memoize_default((projectDir) => {
598848
- return join189(getProjectsDir2(), sanitizePath2(projectDir));
600070
+ return join192(getProjectsDir2(), sanitizePath2(projectDir));
598849
600071
  });
598850
600072
  METADATA_TYPE_MARKERS = [
598851
600073
  '"type":"summary"',
@@ -599083,41 +600305,41 @@ var init_memdir = __esm(() => {
599083
600305
  });
599084
600306
 
599085
600307
  // src/tools/AgentTool/agentMemory.ts
599086
- import { join as join190, normalize as normalize14, sep as sep34 } from "path";
600308
+ import { join as join193, normalize as normalize14, sep as sep34 } from "path";
599087
600309
  function sanitizeAgentTypeForPath(agentType) {
599088
600310
  return agentType.replace(/:/g, "-");
599089
600311
  }
599090
600312
  function getLocalAgentMemoryDir(dirName) {
599091
600313
  if (process.env.UR_CODE_REMOTE_MEMORY_DIR) {
599092
- return join190(process.env.UR_CODE_REMOTE_MEMORY_DIR, "projects", sanitizePath2(findCanonicalGitRoot(getProjectRoot()) ?? getProjectRoot()), "agent-memory-local", dirName) + sep34;
600314
+ return join193(process.env.UR_CODE_REMOTE_MEMORY_DIR, "projects", sanitizePath2(findCanonicalGitRoot(getProjectRoot()) ?? getProjectRoot()), "agent-memory-local", dirName) + sep34;
599093
600315
  }
599094
- return join190(getCwd2(), ".ur", "agent-memory-local", dirName) + sep34;
600316
+ return join193(getCwd2(), ".ur", "agent-memory-local", dirName) + sep34;
599095
600317
  }
599096
600318
  function getAgentMemoryDir(agentType, scope) {
599097
600319
  const dirName = sanitizeAgentTypeForPath(agentType);
599098
600320
  switch (scope) {
599099
600321
  case "project":
599100
- return join190(getCwd2(), ".ur", "agent-memory", dirName) + sep34;
600322
+ return join193(getCwd2(), ".ur", "agent-memory", dirName) + sep34;
599101
600323
  case "local":
599102
600324
  return getLocalAgentMemoryDir(dirName);
599103
600325
  case "user":
599104
- return join190(getMemoryBaseDir(), "agent-memory", dirName) + sep34;
600326
+ return join193(getMemoryBaseDir(), "agent-memory", dirName) + sep34;
599105
600327
  }
599106
600328
  }
599107
600329
  function isAgentMemoryPath(absolutePath) {
599108
600330
  const normalizedPath = normalize14(absolutePath);
599109
600331
  const memoryBase = getMemoryBaseDir();
599110
- if (normalizedPath.startsWith(join190(memoryBase, "agent-memory") + sep34)) {
600332
+ if (normalizedPath.startsWith(join193(memoryBase, "agent-memory") + sep34)) {
599111
600333
  return true;
599112
600334
  }
599113
- if (normalizedPath.startsWith(join190(getCwd2(), ".ur", "agent-memory") + sep34)) {
600335
+ if (normalizedPath.startsWith(join193(getCwd2(), ".ur", "agent-memory") + sep34)) {
599114
600336
  return true;
599115
600337
  }
599116
600338
  if (process.env.UR_CODE_REMOTE_MEMORY_DIR) {
599117
- if (normalizedPath.includes(sep34 + "agent-memory-local" + sep34) && normalizedPath.startsWith(join190(process.env.UR_CODE_REMOTE_MEMORY_DIR, "projects") + sep34)) {
600339
+ if (normalizedPath.includes(sep34 + "agent-memory-local" + sep34) && normalizedPath.startsWith(join193(process.env.UR_CODE_REMOTE_MEMORY_DIR, "projects") + sep34)) {
599118
600340
  return true;
599119
600341
  }
599120
- } else if (normalizedPath.startsWith(join190(getCwd2(), ".ur", "agent-memory-local") + sep34)) {
600342
+ } else if (normalizedPath.startsWith(join193(getCwd2(), ".ur", "agent-memory-local") + sep34)) {
599121
600343
  return true;
599122
600344
  }
599123
600345
  return false;
@@ -599125,7 +600347,7 @@ function isAgentMemoryPath(absolutePath) {
599125
600347
  function getMemoryScopeDisplay(memory2) {
599126
600348
  switch (memory2) {
599127
600349
  case "user":
599128
- return `User (${join190(getMemoryBaseDir(), "agent-memory")}/)`;
600350
+ return `User (${join193(getMemoryBaseDir(), "agent-memory")}/)`;
599129
600351
  case "project":
599130
600352
  return "Project (.ur/agent-memory/)";
599131
600353
  case "local":
@@ -599168,7 +600390,7 @@ var init_agentMemory = __esm(() => {
599168
600390
  // src/utils/permissions/filesystem.ts
599169
600391
  import { randomBytes as randomBytes18 } from "crypto";
599170
600392
  import { homedir as homedir32, tmpdir as tmpdir11 } from "os";
599171
- import { join as join191, normalize as normalize15, posix as posix10, sep as sep35 } from "path";
600393
+ import { join as join194, normalize as normalize15, posix as posix10, sep as sep35 } from "path";
599172
600394
  function normalizeCaseForComparison(path22) {
599173
600395
  return path22.toLowerCase();
599174
600396
  }
@@ -599177,11 +600399,11 @@ function getURSkillScope(filePath) {
599177
600399
  const absolutePathLower = normalizeCaseForComparison(absolutePath);
599178
600400
  const bases = [
599179
600401
  {
599180
- dir: expandPath(join191(getOriginalCwd(), ".ur", "skills")),
600402
+ dir: expandPath(join194(getOriginalCwd(), ".ur", "skills")),
599181
600403
  prefix: "/.ur/skills/"
599182
600404
  },
599183
600405
  {
599184
- dir: expandPath(join191(homedir32(), ".ur", "skills")),
600406
+ dir: expandPath(join194(homedir32(), ".ur", "skills")),
599185
600407
  prefix: "~/.ur/skills/"
599186
600408
  }
599187
600409
  ];
@@ -599207,7 +600429,7 @@ function getURSkillScope(filePath) {
599207
600429
  }
599208
600430
  return null;
599209
600431
  }
599210
- function relativePath(from, to) {
600432
+ function relativePath2(from, to) {
599211
600433
  if (getPlatform() === "windows") {
599212
600434
  const posixFrom = windowsPathToPosixPath(from);
599213
600435
  const posixTo = windowsPathToPosixPath(to);
@@ -599236,21 +600458,21 @@ function isURConfigFilePath(filePath) {
599236
600458
  if (isURSettingsPath(filePath)) {
599237
600459
  return true;
599238
600460
  }
599239
- const commandsDir = join191(getOriginalCwd(), ".ur", "commands");
599240
- const agentsDir = join191(getOriginalCwd(), ".ur", "agents");
599241
- const skillsDir = join191(getOriginalCwd(), ".ur", "skills");
600461
+ const commandsDir = join194(getOriginalCwd(), ".ur", "commands");
600462
+ const agentsDir = join194(getOriginalCwd(), ".ur", "agents");
600463
+ const skillsDir = join194(getOriginalCwd(), ".ur", "skills");
599242
600464
  return pathInWorkingPath(filePath, commandsDir) || pathInWorkingPath(filePath, agentsDir) || pathInWorkingPath(filePath, skillsDir);
599243
600465
  }
599244
600466
  function isSessionPlanFile(absolutePath) {
599245
- const expectedPrefix = join191(getPlansDirectory(), getPlanSlug());
600467
+ const expectedPrefix = join194(getPlansDirectory(), getPlanSlug());
599246
600468
  const normalizedPath = normalize15(absolutePath);
599247
600469
  return normalizedPath.startsWith(expectedPrefix) && normalizedPath.endsWith(".md");
599248
600470
  }
599249
600471
  function getSessionMemoryDir() {
599250
- return join191(getProjectDir2(getCwd2()), getSessionId(), "session-memory") + sep35;
600472
+ return join194(getProjectDir2(getCwd2()), getSessionId(), "session-memory") + sep35;
599251
600473
  }
599252
600474
  function getSessionMemoryPath() {
599253
- return join191(getSessionMemoryDir(), "summary.md");
600475
+ return join194(getSessionMemoryDir(), "summary.md");
599254
600476
  }
599255
600477
  function isSessionMemoryPath(absolutePath) {
599256
600478
  const normalizedPath = normalize15(absolutePath);
@@ -599272,10 +600494,10 @@ function getURTempDirName() {
599272
600494
  return `ur-${uid}`;
599273
600495
  }
599274
600496
  function getProjectTempDir() {
599275
- return join191(getURTempDir(), sanitizePath2(getOriginalCwd())) + sep35;
600497
+ return join194(getURTempDir(), sanitizePath2(getOriginalCwd())) + sep35;
599276
600498
  }
599277
600499
  function getScratchpadDir() {
599278
- return join191(getProjectTempDir(), getSessionId(), "scratchpad");
600500
+ return join194(getProjectTempDir(), getSessionId(), "scratchpad");
599279
600501
  }
599280
600502
  async function ensureScratchpadDir() {
599281
600503
  if (!isScratchpadEnabled()) {
@@ -599401,7 +600623,7 @@ function pathInWorkingPath(path22, workingPath) {
599401
600623
  const normalizedWorkingPath = absoluteWorkingPath.replace(/^\/private\/var\//, "/var/").replace(/^\/private\/tmp(\/|$)/, "/tmp$1");
599402
600624
  const caseNormalizedPath = normalizeCaseForComparison(normalizedPath);
599403
600625
  const caseNormalizedWorkingPath = normalizeCaseForComparison(normalizedWorkingPath);
599404
- const relative40 = relativePath(caseNormalizedWorkingPath, caseNormalizedPath);
600626
+ const relative40 = relativePath2(caseNormalizedWorkingPath, caseNormalizedPath);
599405
600627
  if (relative40 === "") {
599406
600628
  return true;
599407
600629
  }
@@ -599439,11 +600661,11 @@ function normalizePatternToPath({
599439
600661
  const relativePart = fullPattern.slice(rootPath.length);
599440
600662
  return prependDirSep(relativePart);
599441
600663
  } else {
599442
- const relativePath2 = posix10.relative(rootPath, patternRoot);
599443
- if (!relativePath2 || relativePath2.startsWith(`..${DIR_SEP}`) || relativePath2 === "..") {
600664
+ const relativePath3 = posix10.relative(rootPath, patternRoot);
600665
+ if (!relativePath3 || relativePath3.startsWith(`..${DIR_SEP}`) || relativePath3 === "..") {
599444
600666
  return null;
599445
600667
  } else {
599446
- const relativePattern = posix10.join(relativePath2, pattern2);
600668
+ const relativePattern = posix10.join(relativePath3, pattern2);
599447
600669
  return prependDirSep(relativePattern);
599448
600670
  }
599449
600671
  }
@@ -599549,7 +600771,7 @@ function matchingRuleForInput(path22, toolPermissionContext, toolType, behavior)
599549
600771
  return adjustedPattern;
599550
600772
  });
599551
600773
  const ig = import_ignore4.default().add(patterns);
599552
- const relativePathStr = relativePath(root2 ?? getCwd2(), fileAbsolutePath ?? getCwd2());
600774
+ const relativePathStr = relativePath2(root2 ?? getCwd2(), fileAbsolutePath ?? getCwd2());
599553
600775
  if (relativePathStr.startsWith(`..${DIR_SEP}`)) {
599554
600776
  continue;
599555
600777
  }
@@ -599853,7 +601075,7 @@ function checkEditableInternalPath(absolutePath, input) {
599853
601075
  }
599854
601076
  };
599855
601077
  }
599856
- if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(join191(getOriginalCwd(), ".ur", "launch.json"))) {
601078
+ if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(join194(getOriginalCwd(), ".ur", "launch.json"))) {
599857
601079
  return {
599858
601080
  behavior: "allow",
599859
601081
  updatedInput: input,
@@ -599950,7 +601172,7 @@ function checkReadableInternalPath(absolutePath, input) {
599950
601172
  }
599951
601173
  };
599952
601174
  }
599953
- const tasksDir = join191(getURConfigHomeDir(), "tasks") + sep35;
601175
+ const tasksDir = join194(getURConfigHomeDir(), "tasks") + sep35;
599954
601176
  if (normalizedPath === tasksDir.slice(0, -1) || normalizedPath.startsWith(tasksDir)) {
599955
601177
  return {
599956
601178
  behavior: "allow",
@@ -599961,7 +601183,7 @@ function checkReadableInternalPath(absolutePath, input) {
599961
601183
  }
599962
601184
  };
599963
601185
  }
599964
- const teamsReadDir = join191(getURConfigHomeDir(), "teams") + sep35;
601186
+ const teamsReadDir = join194(getURConfigHomeDir(), "teams") + sep35;
599965
601187
  if (normalizedPath === teamsReadDir.slice(0, -1) || normalizedPath.startsWith(teamsReadDir)) {
599966
601188
  return {
599967
601189
  behavior: "allow",
@@ -600034,11 +601256,11 @@ var init_filesystem = __esm(() => {
600034
601256
  try {
600035
601257
  resolvedBaseTmpDir = fs12.realpathSync(baseTmpDir);
600036
601258
  } catch {}
600037
- return join191(resolvedBaseTmpDir, getURTempDirName()) + sep35;
601259
+ return join194(resolvedBaseTmpDir, getURTempDirName()) + sep35;
600038
601260
  });
600039
601261
  getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
600040
601262
  const nonce = randomBytes18(16).toString("hex");
600041
- return join191(getURTempDir(), "bundled-skills", "1.22.3", nonce);
601263
+ return join194(getURTempDir(), "bundled-skills", "1.22.4", nonce);
600042
601264
  });
600043
601265
  getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
600044
601266
  });
@@ -600052,10 +601274,10 @@ import {
600052
601274
  symlink as symlink4,
600053
601275
  unlink as unlink23
600054
601276
  } from "fs/promises";
600055
- import { join as join192 } from "path";
601277
+ import { join as join195 } from "path";
600056
601278
  function getTaskOutputDir() {
600057
601279
  if (_taskOutputDir === undefined) {
600058
- _taskOutputDir = join192(getProjectTempDir(), getSessionId(), "tasks");
601280
+ _taskOutputDir = join195(getProjectTempDir(), getSessionId(), "tasks");
600059
601281
  }
600060
601282
  return _taskOutputDir;
600061
601283
  }
@@ -600063,7 +601285,7 @@ async function ensureOutputDir() {
600063
601285
  await mkdir41(getTaskOutputDir(), { recursive: true });
600064
601286
  }
600065
601287
  function getTaskOutputPath(taskId) {
600066
- return join192(getTaskOutputDir(), `${taskId}.output`);
601288
+ return join195(getTaskOutputDir(), `${taskId}.output`);
600067
601289
  }
600068
601290
  function track(p2) {
600069
601291
  _pendingOps.add(p2);
@@ -604589,7 +605811,7 @@ import {
604589
605811
  symlink as symlink5,
604590
605812
  utimes as utimes2
604591
605813
  } from "fs/promises";
604592
- import { basename as basename44, dirname as dirname66, join as join193 } from "path";
605814
+ import { basename as basename44, dirname as dirname67, join as join196 } from "path";
604593
605815
  function validateWorktreeSlug(slug4) {
604594
605816
  if (slug4.length > MAX_WORKTREE_SLUG_LENGTH) {
604595
605817
  throw new Error(`Invalid worktree name: must be ${MAX_WORKTREE_SLUG_LENGTH} characters or fewer (got ${slug4.length})`);
@@ -604612,8 +605834,8 @@ async function symlinkDirectories(repoRootPath, worktreePath, dirsToSymlink) {
604612
605834
  logForDebugging(`Skipping symlink for "${dir}": path traversal detected`, { level: "warn" });
604613
605835
  continue;
604614
605836
  }
604615
- const sourcePath = join193(repoRootPath, dir);
604616
- const destPath = join193(worktreePath, dir);
605837
+ const sourcePath = join196(repoRootPath, dir);
605838
+ const destPath = join196(worktreePath, dir);
604617
605839
  try {
604618
605840
  await symlink5(sourcePath, destPath, "dir");
604619
605841
  logForDebugging(`Symlinked ${dir} from main repository to worktree to avoid disk bloat`);
@@ -604637,7 +605859,7 @@ function generateTmuxSessionName(repoPath, branch2) {
604637
605859
  return combined.replace(/[/.]/g, "_");
604638
605860
  }
604639
605861
  function worktreesDir2(repoRoot) {
604640
- return join193(repoRoot, ".ur", "worktrees");
605862
+ return join196(repoRoot, ".ur", "worktrees");
604641
605863
  }
604642
605864
  function flattenSlug(slug4) {
604643
605865
  return slug4.replaceAll("/", "+");
@@ -604646,7 +605868,7 @@ function worktreeBranchName(slug4) {
604646
605868
  return `worktree-${flattenSlug(slug4)}`;
604647
605869
  }
604648
605870
  function worktreePathFor(repoRoot, slug4) {
604649
- return join193(worktreesDir2(repoRoot), flattenSlug(slug4));
605871
+ return join196(worktreesDir2(repoRoot), flattenSlug(slug4));
604650
605872
  }
604651
605873
  async function getOrCreateWorktree(repoRoot, slug4, options2) {
604652
605874
  const worktreePath = worktreePathFor(repoRoot, slug4);
@@ -604727,7 +605949,7 @@ async function getOrCreateWorktree(repoRoot, slug4, options2) {
604727
605949
  async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
604728
605950
  let includeContent;
604729
605951
  try {
604730
- includeContent = await readFile51(join193(repoRoot, ".worktreeinclude"), "utf-8");
605952
+ includeContent = await readFile51(join196(repoRoot, ".worktreeinclude"), "utf-8");
604731
605953
  } catch {
604732
605954
  return [];
604733
605955
  }
@@ -604781,15 +606003,15 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
604781
606003
  }
604782
606004
  }
604783
606005
  const copied = [];
604784
- for (const relativePath2 of files2) {
604785
- const srcPath = join193(repoRoot, relativePath2);
604786
- const destPath = join193(worktreePath, relativePath2);
606006
+ for (const relativePath3 of files2) {
606007
+ const srcPath = join196(repoRoot, relativePath3);
606008
+ const destPath = join196(worktreePath, relativePath3);
604787
606009
  try {
604788
- await mkdir42(dirname66(destPath), { recursive: true });
606010
+ await mkdir42(dirname67(destPath), { recursive: true });
604789
606011
  await copyFile10(srcPath, destPath);
604790
- copied.push(relativePath2);
606012
+ copied.push(relativePath3);
604791
606013
  } catch (e) {
604792
- logForDebugging(`Failed to copy ${relativePath2} to worktree: ${e.message}`, { level: "warn" });
606014
+ logForDebugging(`Failed to copy ${relativePath3} to worktree: ${e.message}`, { level: "warn" });
604793
606015
  }
604794
606016
  }
604795
606017
  if (copied.length > 0) {
@@ -604799,10 +606021,10 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
604799
606021
  }
604800
606022
  async function performPostCreationSetup(repoRoot, worktreePath) {
604801
606023
  const localSettingsRelativePath = getRelativeSettingsFilePathForSource("localSettings");
604802
- const sourceSettingsLocal = join193(repoRoot, localSettingsRelativePath);
606024
+ const sourceSettingsLocal = join196(repoRoot, localSettingsRelativePath);
604803
606025
  try {
604804
- const destSettingsLocal = join193(worktreePath, localSettingsRelativePath);
604805
- await mkdirRecursive(dirname66(destSettingsLocal));
606026
+ const destSettingsLocal = join196(worktreePath, localSettingsRelativePath);
606027
+ await mkdirRecursive(dirname67(destSettingsLocal));
604806
606028
  await copyFile10(sourceSettingsLocal, destSettingsLocal);
604807
606029
  logForDebugging(`Copied settings.local.json to worktree: ${destSettingsLocal}`);
604808
606030
  } catch (e) {
@@ -604811,8 +606033,8 @@ async function performPostCreationSetup(repoRoot, worktreePath) {
604811
606033
  logForDebugging(`Failed to copy settings.local.json: ${e.message}`, { level: "warn" });
604812
606034
  }
604813
606035
  }
604814
- const huskyPath = join193(repoRoot, ".husky");
604815
- const gitHooksPath = join193(repoRoot, ".git", "hooks");
606036
+ const huskyPath = join196(repoRoot, ".husky");
606037
+ const gitHooksPath = join196(repoRoot, ".git", "hooks");
604816
606038
  let hooksPath = null;
604817
606039
  for (const candidatePath of [huskyPath, gitHooksPath]) {
604818
606040
  try {
@@ -605087,7 +606309,7 @@ async function cleanupStaleAgentWorktrees(cutoffDate) {
605087
606309
  if (!EPHEMERAL_WORKTREE_PATTERNS.some((p2) => p2.test(slug4))) {
605088
606310
  continue;
605089
606311
  }
605090
- const worktreePath = join193(dir, slug4);
606312
+ const worktreePath = join196(dir, slug4);
605091
606313
  if (currentPath === worktreePath) {
605092
606314
  continue;
605093
606315
  }
@@ -606328,7 +607550,7 @@ function computeFingerprint(messageText, version3) {
606328
607550
  }
606329
607551
  function computeFingerprintFromMessages(messages) {
606330
607552
  const firstMessageText = extractFirstMessageText(messages);
606331
- return computeFingerprint(firstMessageText, "1.22.3");
607553
+ return computeFingerprint(firstMessageText, "1.22.4");
606332
607554
  }
606333
607555
  var FINGERPRINT_SALT = "59cf53e54c78";
606334
607556
  var init_fingerprint = () => {};
@@ -608194,7 +609416,7 @@ async function sideQuery(opts) {
608194
609416
  betas.push(STRUCTURED_OUTPUTS_BETA_HEADER);
608195
609417
  }
608196
609418
  const messageText = extractFirstUserMessageText(messages);
608197
- const fingerprint = computeFingerprint(messageText, "1.22.3");
609419
+ const fingerprint = computeFingerprint(messageText, "1.22.4");
608198
609420
  const attributionHeader = getAttributionHeader(fingerprint);
608199
609421
  const systemBlocks = [
608200
609422
  attributionHeader ? { type: "text", text: attributionHeader } : null,
@@ -608480,7 +609702,7 @@ import {
608480
609702
  } from "fs/promises";
608481
609703
  import { createServer as createServer5 } from "net";
608482
609704
  import { homedir as homedir33, platform as platform6 } from "os";
608483
- import { join as join194 } from "path";
609705
+ import { join as join197 } from "path";
608484
609706
  function log(message, ...args) {
608485
609707
  if (LOG_FILE) {
608486
609708
  const timestamp2 = new Date().toISOString();
@@ -608547,7 +609769,7 @@ class ChromeNativeHost {
608547
609769
  try {
608548
609770
  process.kill(pid, 0);
608549
609771
  } catch {
608550
- await unlink24(join194(socketDir, file4)).catch(() => {});
609772
+ await unlink24(join197(socketDir, file4)).catch(() => {});
608551
609773
  log(`Removed stale socket for PID ${pid}`);
608552
609774
  }
608553
609775
  }
@@ -608818,7 +610040,7 @@ var init_chromeNativeHost = __esm(() => {
608818
610040
  init_slowOperations();
608819
610041
  init_common2();
608820
610042
  MAX_MESSAGE_SIZE = 1024 * 1024;
608821
- LOG_FILE = process.env.USER_TYPE === "ant" ? join194(homedir33(), ".ur", "debug", "chrome-native-host.txt") : undefined;
610043
+ LOG_FILE = process.env.USER_TYPE === "ant" ? join197(homedir33(), ".ur", "debug", "chrome-native-host.txt") : undefined;
608822
610044
  messageSchema = lazySchema(() => exports_external2.object({
608823
610045
  type: exports_external2.string()
608824
610046
  }).passthrough());
@@ -611328,7 +612550,7 @@ __export(exports_upstreamproxy, {
611328
612550
  });
611329
612551
  import { mkdir as mkdir44, readFile as readFile52, unlink as unlink25, writeFile as writeFile45 } from "fs/promises";
611330
612552
  import { homedir as homedir34 } from "os";
611331
- import { join as join195 } from "path";
612553
+ import { join as join198 } from "path";
611332
612554
  async function initUpstreamProxy(opts) {
611333
612555
  if (!isEnvTruthy(process.env.UR_CODE_REMOTE)) {
611334
612556
  return state;
@@ -611349,7 +612571,7 @@ async function initUpstreamProxy(opts) {
611349
612571
  }
611350
612572
  setNonDumpable();
611351
612573
  const baseUrl = opts?.ccrBaseUrl ?? "";
611352
- const caBundlePath = opts?.caBundlePath ?? join195(homedir34(), ".ccr", "ca-bundle.crt");
612574
+ const caBundlePath = opts?.caBundlePath ?? join198(homedir34(), ".ccr", "ca-bundle.crt");
611353
612575
  const caOk = await downloadCaBundle(baseUrl, opts?.systemCaPath ?? SYSTEM_CA_BUNDLE, caBundlePath);
611354
612576
  if (!caOk)
611355
612577
  return state;
@@ -611449,7 +612671,7 @@ async function downloadCaBundle(baseUrl, systemCaPath, outPath) {
611449
612671
  }
611450
612672
  const ccrCa = await resp.text();
611451
612673
  const systemCa = await readFile52(systemCaPath, "utf8").catch(() => "");
611452
- await mkdir44(join195(outPath, ".."), { recursive: true });
612674
+ await mkdir44(join198(outPath, ".."), { recursive: true });
611453
612675
  await writeFile45(outPath, systemCa + `
611454
612676
  ` + ccrCa, "utf8");
611455
612677
  return true;
@@ -612931,7 +614153,7 @@ function buildSystemInitMessage(inputs) {
612931
614153
  slash_commands: inputs.commands.filter((c4) => c4.userInvocable !== false).map((c4) => c4.name),
612932
614154
  apiKeySource: getURHQApiKeyWithSource().source,
612933
614155
  betas: getSdkBetas(),
612934
- ur_version: "1.22.3",
614156
+ ur_version: "1.22.4",
612935
614157
  output_style: outputStyle2,
612936
614158
  agents: inputs.agents.map((agent) => agent.agentType),
612937
614159
  skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill2) => skill2.name),
@@ -619311,7 +620533,7 @@ var init_ShowInIDEPrompt = __esm(() => {
619311
620533
 
619312
620534
  // src/components/permissions/FilePermissionDialog/permissionOptions.tsx
619313
620535
  import { homedir as homedir35 } from "os";
619314
- import { basename as basename48, join as join196, sep as sep36 } from "path";
620536
+ import { basename as basename48, join as join199, sep as sep36 } from "path";
619315
620537
  function isInURFolder(filePath) {
619316
620538
  const absolutePath = expandPath(filePath);
619317
620539
  const urFolderPath = expandPath(`${getOriginalCwd()}/.ur`);
@@ -619321,7 +620543,7 @@ function isInURFolder(filePath) {
619321
620543
  }
619322
620544
  function isInGlobalURFolder(filePath) {
619323
620545
  const absolutePath = expandPath(filePath);
619324
- const globalURFolderPath = join196(homedir35(), ".ur");
620546
+ const globalURFolderPath = join199(homedir35(), ".ur");
619325
620547
  const normalizedAbsolutePath = normalizeCaseForComparison(absolutePath);
619326
620548
  const normalizedGlobalURFolderPath = normalizeCaseForComparison(globalURFolderPath);
619327
620549
  return normalizedAbsolutePath.startsWith(normalizedGlobalURFolderPath + sep36.toLowerCase()) || normalizedAbsolutePath.startsWith(normalizedGlobalURFolderPath + "/");
@@ -627559,7 +628781,7 @@ var init_useVoiceEnabled = __esm(() => {
627559
628781
  function getSemverPart(version3) {
627560
628782
  return `${import_semver13.major(version3, { loose: true })}.${import_semver13.minor(version3, { loose: true })}.${import_semver13.patch(version3, { loose: true })}`;
627561
628783
  }
627562
- function useUpdateNotification(updatedVersion, initialVersion = "1.22.3") {
628784
+ function useUpdateNotification(updatedVersion, initialVersion = "1.22.4") {
627563
628785
  const [lastNotifiedSemver, setLastNotifiedSemver] = import_react224.useState(() => getSemverPart(initialVersion));
627564
628786
  if (!updatedVersion) {
627565
628787
  return null;
@@ -627608,7 +628830,7 @@ function AutoUpdater({
627608
628830
  return;
627609
628831
  }
627610
628832
  if (false) {}
627611
- const currentVersion = "1.22.3";
628833
+ const currentVersion = "1.22.4";
627612
628834
  const channel = getInitialSettings()?.autoUpdatesChannel ?? "latest";
627613
628835
  let latestVersion = await getLatestVersion(channel);
627614
628836
  const isDisabled = isAutoUpdaterDisabled();
@@ -627837,12 +629059,12 @@ function NativeAutoUpdater({
627837
629059
  logEvent("tengu_native_auto_updater_start", {});
627838
629060
  try {
627839
629061
  const maxVersion = await getMaxVersion();
627840
- if (maxVersion && gt("1.22.3", maxVersion)) {
629062
+ if (maxVersion && gt("1.22.4", maxVersion)) {
627841
629063
  const msg = await getMaxVersionMessage();
627842
629064
  setMaxVersionIssue(msg ?? "affects your version");
627843
629065
  }
627844
629066
  const result = await installLatest(channel);
627845
- const currentVersion = "1.22.3";
629067
+ const currentVersion = "1.22.4";
627846
629068
  const latencyMs = Date.now() - startTime;
627847
629069
  if (result.lockFailed) {
627848
629070
  logEvent("tengu_native_auto_updater_lock_contention", {
@@ -627979,17 +629201,17 @@ function PackageManagerAutoUpdater(t0) {
627979
629201
  const maxVersion = await getMaxVersion();
627980
629202
  if (maxVersion && latest && gt(latest, maxVersion)) {
627981
629203
  logForDebugging(`PackageManagerAutoUpdater: maxVersion ${maxVersion} is set, capping update from ${latest} to ${maxVersion}`);
627982
- if (gte("1.22.3", maxVersion)) {
627983
- logForDebugging(`PackageManagerAutoUpdater: current version ${"1.22.3"} is already at or above maxVersion ${maxVersion}, skipping update`);
629204
+ if (gte("1.22.4", maxVersion)) {
629205
+ logForDebugging(`PackageManagerAutoUpdater: current version ${"1.22.4"} is already at or above maxVersion ${maxVersion}, skipping update`);
627984
629206
  setUpdateAvailable(false);
627985
629207
  return;
627986
629208
  }
627987
629209
  latest = maxVersion;
627988
629210
  }
627989
- const hasUpdate = latest && !gte("1.22.3", latest) && !shouldSkipVersion(latest);
629211
+ const hasUpdate = latest && !gte("1.22.4", latest) && !shouldSkipVersion(latest);
627990
629212
  setUpdateAvailable(!!hasUpdate);
627991
629213
  if (hasUpdate) {
627992
- logForDebugging(`PackageManagerAutoUpdater: Update available ${"1.22.3"} -> ${latest}`);
629214
+ logForDebugging(`PackageManagerAutoUpdater: Update available ${"1.22.4"} -> ${latest}`);
627993
629215
  }
627994
629216
  };
627995
629217
  $3[0] = t1;
@@ -628023,7 +629245,7 @@ function PackageManagerAutoUpdater(t0) {
628023
629245
  wrap: "truncate",
628024
629246
  children: [
628025
629247
  "currentVersion: ",
628026
- "1.22.3"
629248
+ "1.22.4"
628027
629249
  ]
628028
629250
  }, undefined, true, undefined, this);
628029
629251
  $3[3] = verbose;
@@ -640385,7 +641607,7 @@ function buildStatusLineCommandInput(permissionMode, exceeds200kTokens, settings
640385
641607
  project_dir: getOriginalCwd(),
640386
641608
  added_dirs: addedDirs
640387
641609
  },
640388
- version: "1.22.3",
641610
+ version: "1.22.4",
640389
641611
  output_style: {
640390
641612
  name: outputStyleName
640391
641613
  },
@@ -643607,11 +644829,11 @@ function PromptInput({
643607
644829
  const onIdeAtMentioned = function(atMentioned) {
643608
644830
  logEvent("tengu_ext_at_mentioned", {});
643609
644831
  let atMentionedText;
643610
- const relativePath2 = path23.relative(getCwd2(), atMentioned.filePath);
644832
+ const relativePath3 = path23.relative(getCwd2(), atMentioned.filePath);
643611
644833
  if (atMentioned.lineStart && atMentioned.lineEnd) {
643612
- atMentionedText = atMentioned.lineStart === atMentioned.lineEnd ? `@${relativePath2}#L${atMentioned.lineStart} ` : `@${relativePath2}#L${atMentioned.lineStart}-${atMentioned.lineEnd} `;
644834
+ atMentionedText = atMentioned.lineStart === atMentioned.lineEnd ? `@${relativePath3}#L${atMentioned.lineStart} ` : `@${relativePath3}#L${atMentioned.lineStart}-${atMentioned.lineEnd} `;
643613
644835
  } else {
643614
- atMentionedText = `@${relativePath2} `;
644836
+ atMentionedText = `@${relativePath3} `;
643615
644837
  }
643616
644838
  const cursorChar = input[cursorOffset - 1] ?? " ";
643617
644839
  if (!/\s/.test(cursorChar)) {
@@ -645513,7 +646735,7 @@ function useRemoteSession({
645513
646735
  return;
645514
646736
  }
645515
646737
  logForDebugging(`[useRemoteSession] Initializing for session ${config3.sessionId}`);
645516
- const manager = new RemoteSessionManager(config3, {
646738
+ const manager2 = new RemoteSessionManager(config3, {
645517
646739
  onMessage: (sdkMessage) => {
645518
646740
  const parts = [`type=${sdkMessage.type}`];
645519
646741
  if ("subtype" in sdkMessage)
@@ -645632,7 +646854,7 @@ function useRemoteSession({
645632
646854
  behavior: "deny",
645633
646855
  message: "User aborted"
645634
646856
  };
645635
- manager.respondToPermissionRequest(requestId, response);
646857
+ manager2.respondToPermissionRequest(requestId, response);
645636
646858
  setToolUseConfirmQueue((queue2) => queue2.filter((item) => item.toolUseID !== request.tool_use_id));
645637
646859
  },
645638
646860
  onAllow(updatedInput, _permissionUpdates, _feedback) {
@@ -645640,7 +646862,7 @@ function useRemoteSession({
645640
646862
  behavior: "allow",
645641
646863
  updatedInput
645642
646864
  };
645643
- manager.respondToPermissionRequest(requestId, response);
646865
+ manager2.respondToPermissionRequest(requestId, response);
645644
646866
  setToolUseConfirmQueue((queue2) => queue2.filter((item) => item.toolUseID !== request.tool_use_id));
645645
646867
  setIsLoading(true);
645646
646868
  },
@@ -645649,7 +646871,7 @@ function useRemoteSession({
645649
646871
  behavior: "deny",
645650
646872
  message: feedback2 ?? "User denied permission"
645651
646873
  };
645652
- manager.respondToPermissionRequest(requestId, response);
646874
+ manager2.respondToPermissionRequest(requestId, response);
645653
646875
  setToolUseConfirmQueue((queue2) => queue2.filter((item) => item.toolUseID !== request.tool_use_id));
645654
646876
  },
645655
646877
  async recheckPermission() {}
@@ -645686,15 +646908,15 @@ function useRemoteSession({
645686
646908
  logForDebugging(`[useRemoteSession] Error: ${error40.message}`);
645687
646909
  }
645688
646910
  });
645689
- managerRef.current = manager;
645690
- manager.connect();
646911
+ managerRef.current = manager2;
646912
+ manager2.connect();
645691
646913
  return () => {
645692
646914
  logForDebugging("[useRemoteSession] Cleanup - disconnecting");
645693
646915
  if (responseTimeoutRef.current) {
645694
646916
  clearTimeout(responseTimeoutRef.current);
645695
646917
  responseTimeoutRef.current = null;
645696
646918
  }
645697
- manager.disconnect();
646919
+ manager2.disconnect();
645698
646920
  managerRef.current = null;
645699
646921
  };
645700
646922
  }, [
@@ -645710,8 +646932,8 @@ function useRemoteSession({
645710
646932
  writeTaskCount
645711
646933
  ]);
645712
646934
  const sendMessage3 = import_react258.useCallback(async (content, opts) => {
645713
- const manager = managerRef.current;
645714
- if (!manager) {
646935
+ const manager2 = managerRef.current;
646936
+ if (!manager2) {
645715
646937
  logForDebugging("[useRemoteSession] Cannot send - no manager");
645716
646938
  return false;
645717
646939
  }
@@ -645721,7 +646943,7 @@ function useRemoteSession({
645721
646943
  setIsLoading(true);
645722
646944
  if (opts?.uuid)
645723
646945
  sentUUIDsRef.current.add(opts.uuid);
645724
- const success2 = await manager.sendMessage(content, opts);
646946
+ const success2 = await manager2.sendMessage(content, opts);
645725
646947
  if (!success2) {
645726
646948
  setIsLoading(false);
645727
646949
  return false;
@@ -645738,12 +646960,12 @@ function useRemoteSession({
645738
646960
  }
645739
646961
  if (!config3?.viewerOnly) {
645740
646962
  const timeoutMs2 = isCompactingRef.current ? COMPACTION_TIMEOUT_MS : RESPONSE_TIMEOUT_MS;
645741
- responseTimeoutRef.current = setTimeout((setMessages2, manager2) => {
646963
+ responseTimeoutRef.current = setTimeout((setMessages2, manager3) => {
645742
646964
  logForDebugging("[useRemoteSession] Response timeout - attempting reconnect");
645743
646965
  const warningMessage = createSystemMessage("Remote session may be unresponsive. Attempting to reconnect\u2026", "warning");
645744
646966
  setMessages2((prev) => [...prev, warningMessage]);
645745
- manager2.reconnect();
645746
- }, timeoutMs2, setMessages, manager);
646967
+ manager3.reconnect();
646968
+ }, timeoutMs2, setMessages, manager2);
645747
646969
  }
645748
646970
  return success2;
645749
646971
  }, [config3, setIsLoading, setMessages]);
@@ -645940,7 +647162,7 @@ function useDirectConnect({
645940
647162
  }
645941
647163
  hasReceivedInitRef.current = false;
645942
647164
  logForDebugging(`[useDirectConnect] Connecting to ${config3.wsUrl}`);
645943
- const manager = new DirectConnectSessionManager(config3, {
647165
+ const manager2 = new DirectConnectSessionManager(config3, {
645944
647166
  onMessage: (sdkMessage) => {
645945
647167
  if (isSessionEndMessage(sdkMessage)) {
645946
647168
  setIsLoading(false);
@@ -645983,7 +647205,7 @@ function useDirectConnect({
645983
647205
  behavior: "deny",
645984
647206
  message: "User aborted"
645985
647207
  };
645986
- manager.respondToPermissionRequest(requestId, response);
647208
+ manager2.respondToPermissionRequest(requestId, response);
645987
647209
  setToolUseConfirmQueue((queue2) => queue2.filter((item) => item.toolUseID !== request.tool_use_id));
645988
647210
  },
645989
647211
  onAllow(updatedInput, _permissionUpdates, _feedback) {
@@ -645991,7 +647213,7 @@ function useDirectConnect({
645991
647213
  behavior: "allow",
645992
647214
  updatedInput
645993
647215
  };
645994
- manager.respondToPermissionRequest(requestId, response);
647216
+ manager2.respondToPermissionRequest(requestId, response);
645995
647217
  setToolUseConfirmQueue((queue2) => queue2.filter((item) => item.toolUseID !== request.tool_use_id));
645996
647218
  setIsLoading(true);
645997
647219
  },
@@ -646000,7 +647222,7 @@ function useDirectConnect({
646000
647222
  behavior: "deny",
646001
647223
  message: feedback2 ?? "User denied permission"
646002
647224
  };
646003
- manager.respondToPermissionRequest(requestId, response);
647225
+ manager2.respondToPermissionRequest(requestId, response);
646004
647226
  setToolUseConfirmQueue((queue2) => queue2.filter((item) => item.toolUseID !== request.tool_use_id));
646005
647227
  },
646006
647228
  async recheckPermission() {}
@@ -646031,21 +647253,21 @@ Server disconnected.
646031
647253
  logForDebugging(`[useDirectConnect] Error: ${error40.message}`);
646032
647254
  }
646033
647255
  });
646034
- managerRef.current = manager;
646035
- manager.connect();
647256
+ managerRef.current = manager2;
647257
+ manager2.connect();
646036
647258
  return () => {
646037
647259
  logForDebugging("[useDirectConnect] Cleanup - disconnecting");
646038
- manager.disconnect();
647260
+ manager2.disconnect();
646039
647261
  managerRef.current = null;
646040
647262
  };
646041
647263
  }, [config3, setMessages, setIsLoading, setToolUseConfirmQueue]);
646042
647264
  const sendMessage3 = import_react259.useCallback(async (content) => {
646043
- const manager = managerRef.current;
646044
- if (!manager) {
647265
+ const manager2 = managerRef.current;
647266
+ if (!manager2) {
646045
647267
  return false;
646046
647268
  }
646047
647269
  setIsLoading(true);
646048
- return manager.sendMessage(content);
647270
+ return manager2.sendMessage(content);
646049
647271
  }, [setIsLoading]);
646050
647272
  const cancelRequest = import_react259.useCallback(() => {
646051
647273
  managerRef.current?.sendInterrupt();
@@ -646091,7 +647313,7 @@ function useSSHSession({
646091
647313
  return;
646092
647314
  hasReceivedInitRef.current = false;
646093
647315
  logForDebugging("[useSSHSession] wiring SSH session manager");
646094
- const manager = session2.createManager({
647316
+ const manager2 = session2.createManager({
646095
647317
  onMessage: (sdkMessage) => {
646096
647318
  if (isSessionEndMessage(sdkMessage)) {
646097
647319
  setIsLoading(false);
@@ -646129,14 +647351,14 @@ function useSSHSession({
646129
647351
  permissionPromptStartTimeMs: Date.now(),
646130
647352
  onUserInteraction() {},
646131
647353
  onAbort() {
646132
- manager.respondToPermissionRequest(requestId, {
647354
+ manager2.respondToPermissionRequest(requestId, {
646133
647355
  behavior: "deny",
646134
647356
  message: "User aborted"
646135
647357
  });
646136
647358
  setToolUseConfirmQueue((q) => q.filter((i3) => i3.toolUseID !== request.tool_use_id));
646137
647359
  },
646138
647360
  onAllow(updatedInput) {
646139
- manager.respondToPermissionRequest(requestId, {
647361
+ manager2.respondToPermissionRequest(requestId, {
646140
647362
  behavior: "allow",
646141
647363
  updatedInput
646142
647364
  });
@@ -646144,7 +647366,7 @@ function useSSHSession({
646144
647366
  setIsLoading(true);
646145
647367
  },
646146
647368
  onReject(feedback2) {
646147
- manager.respondToPermissionRequest(requestId, {
647369
+ manager2.respondToPermissionRequest(requestId, {
646148
647370
  behavior: "deny",
646149
647371
  message: feedback2 ?? "User denied permission"
646150
647372
  });
@@ -646192,11 +647414,11 @@ ${stderr}`;
646192
647414
  logForDebugging(`[useSSHSession] error: ${error40.message}`);
646193
647415
  }
646194
647416
  });
646195
- managerRef.current = manager;
646196
- manager.connect();
647417
+ managerRef.current = manager2;
647418
+ manager2.connect();
646197
647419
  return () => {
646198
647420
  logForDebugging("[useSSHSession] cleanup");
646199
- manager.disconnect();
647421
+ manager2.disconnect();
646200
647422
  session2.proxy.stop();
646201
647423
  managerRef.current = null;
646202
647424
  };
@@ -646493,9 +647715,9 @@ function initSkillImprovement() {
646493
647715
  async function applySkillImprovement(skillName, updates) {
646494
647716
  if (!skillName)
646495
647717
  return;
646496
- const { join: join197 } = await import("path");
647718
+ const { join: join200 } = await import("path");
646497
647719
  const fs12 = await import("fs/promises");
646498
- const filePath = join197(getCwd2(), ".ur", "skills", skillName, "SKILL.md");
647720
+ const filePath = join200(getCwd2(), ".ur", "skills", skillName, "SKILL.md");
646499
647721
  let currentContent;
646500
647722
  try {
646501
647723
  currentContent = await fs12.readFile(filePath, "utf-8");
@@ -646649,7 +647871,7 @@ function useMoreRight(_args) {
646649
647871
  // src/utils/cleanup.ts
646650
647872
  import * as fs12 from "fs/promises";
646651
647873
  import { homedir as homedir36 } from "os";
646652
- import { join as join197 } from "path";
647874
+ import { join as join200 } from "path";
646653
647875
  function getCutoffDate() {
646654
647876
  const settings = getSettings_DEPRECATED() || {};
646655
647877
  const cleanupPeriodDays = settings.cleanupPeriodDays ?? DEFAULT_CLEANUP_PERIOD_DAYS;
@@ -646674,7 +647896,7 @@ async function cleanupOldFilesInDirectory(dirPath, cutoffDate, isMessagePath) {
646674
647896
  try {
646675
647897
  const timestamp2 = convertFileNameToDate(file4.name);
646676
647898
  if (timestamp2 < cutoffDate) {
646677
- await getFsImplementation().unlink(join197(dirPath, file4.name));
647899
+ await getFsImplementation().unlink(join200(dirPath, file4.name));
646678
647900
  if (isMessagePath) {
646679
647901
  result.messages++;
646680
647902
  } else {
@@ -646705,7 +647927,7 @@ async function cleanupOldMessageFiles() {
646705
647927
  } catch {
646706
647928
  return result;
646707
647929
  }
646708
- const mcpLogDirs = dirents.filter((dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")).map((dirent) => join197(baseCachePath, dirent.name));
647930
+ const mcpLogDirs = dirents.filter((dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")).map((dirent) => join200(baseCachePath, dirent.name));
646709
647931
  for (const mcpLogDir of mcpLogDirs) {
646710
647932
  result = addCleanupResults(result, await cleanupOldFilesInDirectory(mcpLogDir, cutoffDate, true));
646711
647933
  await tryRmdir(mcpLogDir, fsImpl);
@@ -646744,7 +647966,7 @@ async function cleanupOldSessionFiles() {
646744
647966
  for (const projectDirent of projectDirents) {
646745
647967
  if (!projectDirent.isDirectory())
646746
647968
  continue;
646747
- const projectDir = join197(projectsDir, projectDirent.name);
647969
+ const projectDir = join200(projectsDir, projectDirent.name);
646748
647970
  let entries;
646749
647971
  try {
646750
647972
  entries = await fsImpl.readdir(projectDir);
@@ -646758,15 +647980,15 @@ async function cleanupOldSessionFiles() {
646758
647980
  continue;
646759
647981
  }
646760
647982
  try {
646761
- if (await unlinkIfOld(join197(projectDir, entry.name), cutoffDate, fsImpl)) {
647983
+ if (await unlinkIfOld(join200(projectDir, entry.name), cutoffDate, fsImpl)) {
646762
647984
  result.messages++;
646763
647985
  }
646764
647986
  } catch {
646765
647987
  result.errors++;
646766
647988
  }
646767
647989
  } else if (entry.isDirectory()) {
646768
- const sessionDir = join197(projectDir, entry.name);
646769
- const toolResultsDir = join197(sessionDir, TOOL_RESULTS_SUBDIR);
647990
+ const sessionDir = join200(projectDir, entry.name);
647991
+ const toolResultsDir = join200(sessionDir, TOOL_RESULTS_SUBDIR);
646770
647992
  let toolDirs;
646771
647993
  try {
646772
647994
  toolDirs = await fsImpl.readdir(toolResultsDir);
@@ -646777,14 +647999,14 @@ async function cleanupOldSessionFiles() {
646777
647999
  for (const toolEntry of toolDirs) {
646778
648000
  if (toolEntry.isFile()) {
646779
648001
  try {
646780
- if (await unlinkIfOld(join197(toolResultsDir, toolEntry.name), cutoffDate, fsImpl)) {
648002
+ if (await unlinkIfOld(join200(toolResultsDir, toolEntry.name), cutoffDate, fsImpl)) {
646781
648003
  result.messages++;
646782
648004
  }
646783
648005
  } catch {
646784
648006
  result.errors++;
646785
648007
  }
646786
648008
  } else if (toolEntry.isDirectory()) {
646787
- const toolDirPath = join197(toolResultsDir, toolEntry.name);
648009
+ const toolDirPath = join200(toolResultsDir, toolEntry.name);
646788
648010
  let toolFiles;
646789
648011
  try {
646790
648012
  toolFiles = await fsImpl.readdir(toolDirPath);
@@ -646795,7 +648017,7 @@ async function cleanupOldSessionFiles() {
646795
648017
  if (!tf.isFile())
646796
648018
  continue;
646797
648019
  try {
646798
- if (await unlinkIfOld(join197(toolDirPath, tf.name), cutoffDate, fsImpl)) {
648020
+ if (await unlinkIfOld(join200(toolDirPath, tf.name), cutoffDate, fsImpl)) {
646799
648021
  result.messages++;
646800
648022
  }
646801
648023
  } catch {
@@ -646827,7 +648049,7 @@ async function cleanupSingleDirectory(dirPath, extension, removeEmptyDir = true)
646827
648049
  if (!dirent.isFile() || !dirent.name.endsWith(extension))
646828
648050
  continue;
646829
648051
  try {
646830
- if (await unlinkIfOld(join197(dirPath, dirent.name), cutoffDate, fsImpl)) {
648052
+ if (await unlinkIfOld(join200(dirPath, dirent.name), cutoffDate, fsImpl)) {
646831
648053
  result.messages++;
646832
648054
  }
646833
648055
  } catch {
@@ -646840,7 +648062,7 @@ async function cleanupSingleDirectory(dirPath, extension, removeEmptyDir = true)
646840
648062
  return result;
646841
648063
  }
646842
648064
  function cleanupOldPlanFiles() {
646843
- const plansDir = join197(getURConfigHomeDir(), "plans");
648065
+ const plansDir = join200(getURConfigHomeDir(), "plans");
646844
648066
  return cleanupSingleDirectory(plansDir, ".md");
646845
648067
  }
646846
648068
  async function cleanupOldFileHistoryBackups() {
@@ -646849,14 +648071,14 @@ async function cleanupOldFileHistoryBackups() {
646849
648071
  const fsImpl = getFsImplementation();
646850
648072
  try {
646851
648073
  const configDir = getURConfigHomeDir();
646852
- const fileHistoryStorageDir = join197(configDir, "file-history");
648074
+ const fileHistoryStorageDir = join200(configDir, "file-history");
646853
648075
  let dirents;
646854
648076
  try {
646855
648077
  dirents = await fsImpl.readdir(fileHistoryStorageDir);
646856
648078
  } catch {
646857
648079
  return result;
646858
648080
  }
646859
- const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join197(fileHistoryStorageDir, dirent.name));
648081
+ const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join200(fileHistoryStorageDir, dirent.name));
646860
648082
  await Promise.all(fileHistorySessionsDirs.map(async (fileHistorySessionDir) => {
646861
648083
  try {
646862
648084
  const stats2 = await fsImpl.stat(fileHistorySessionDir);
@@ -646883,14 +648105,14 @@ async function cleanupOldSessionEnvDirs() {
646883
648105
  const fsImpl = getFsImplementation();
646884
648106
  try {
646885
648107
  const configDir = getURConfigHomeDir();
646886
- const sessionEnvBaseDir = join197(configDir, "session-env");
648108
+ const sessionEnvBaseDir = join200(configDir, "session-env");
646887
648109
  let dirents;
646888
648110
  try {
646889
648111
  dirents = await fsImpl.readdir(sessionEnvBaseDir);
646890
648112
  } catch {
646891
648113
  return result;
646892
648114
  }
646893
- const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join197(sessionEnvBaseDir, dirent.name));
648115
+ const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join200(sessionEnvBaseDir, dirent.name));
646894
648116
  for (const sessionEnvDir of sessionEnvDirs) {
646895
648117
  try {
646896
648118
  const stats2 = await fsImpl.stat(sessionEnvDir);
@@ -646912,7 +648134,7 @@ async function cleanupOldDebugLogs() {
646912
648134
  const cutoffDate = getCutoffDate();
646913
648135
  const result = { messages: 0, errors: 0 };
646914
648136
  const fsImpl = getFsImplementation();
646915
- const debugDir = join197(getURConfigHomeDir(), "debug");
648137
+ const debugDir = join200(getURConfigHomeDir(), "debug");
646916
648138
  let dirents;
646917
648139
  try {
646918
648140
  dirents = await fsImpl.readdir(debugDir);
@@ -646924,7 +648146,7 @@ async function cleanupOldDebugLogs() {
646924
648146
  continue;
646925
648147
  }
646926
648148
  try {
646927
- if (await unlinkIfOld(join197(debugDir, dirent.name), cutoffDate, fsImpl)) {
648149
+ if (await unlinkIfOld(join200(debugDir, dirent.name), cutoffDate, fsImpl)) {
646928
648150
  result.messages++;
646929
648151
  }
646930
648152
  } catch {
@@ -646934,7 +648156,7 @@ async function cleanupOldDebugLogs() {
646934
648156
  return result;
646935
648157
  }
646936
648158
  async function cleanupNpmCacheForURHQPackages() {
646937
- const markerPath = join197(getURConfigHomeDir(), ".npm-cache-cleanup");
648159
+ const markerPath = join200(getURConfigHomeDir(), ".npm-cache-cleanup");
646938
648160
  try {
646939
648161
  const stat47 = await fs12.stat(markerPath);
646940
648162
  if (Date.now() - stat47.mtimeMs < ONE_DAY_MS) {
@@ -646949,7 +648171,7 @@ async function cleanupNpmCacheForURHQPackages() {
646949
648171
  return;
646950
648172
  }
646951
648173
  logForDebugging("npm cache cleanup: starting");
646952
- const npmCachePath = join197(homedir36(), ".npm", "_cacache");
648174
+ const npmCachePath = join200(homedir36(), ".npm", "_cacache");
646953
648175
  const NPM_CACHE_RETENTION_COUNT = 5;
646954
648176
  const startTime = Date.now();
646955
648177
  try {
@@ -647004,7 +648226,7 @@ async function cleanupNpmCacheForURHQPackages() {
647004
648226
  }
647005
648227
  }
647006
648228
  async function cleanupOldVersionsThrottled() {
647007
- const markerPath = join197(getURConfigHomeDir(), ".version-cleanup");
648229
+ const markerPath = join200(getURConfigHomeDir(), ".version-cleanup");
647008
648230
  try {
647009
648231
  const stat47 = await fs12.stat(markerPath);
647010
648232
  if (Date.now() - stat47.mtimeMs < ONE_DAY_MS) {
@@ -650247,7 +651469,7 @@ __export(exports_asciicast, {
650247
651469
  _resetRecordingStateForTesting: () => _resetRecordingStateForTesting
650248
651470
  });
650249
651471
  import { appendFile as appendFile7, rename as rename10 } from "fs/promises";
650250
- import { basename as basename57, dirname as dirname67, join as join199 } from "path";
651472
+ import { basename as basename57, dirname as dirname68, join as join202 } from "path";
650251
651473
  function getRecordFilePath() {
650252
651474
  if (recordingState.filePath !== null) {
650253
651475
  return recordingState.filePath;
@@ -650258,10 +651480,10 @@ function getRecordFilePath() {
650258
651480
  if (!isEnvTruthy(process.env.UR_CODE_TERMINAL_RECORDING)) {
650259
651481
  return null;
650260
651482
  }
650261
- const projectsDir = join199(getURConfigHomeDir(), "projects");
650262
- const projectDir = join199(projectsDir, sanitizePath2(getOriginalCwd()));
651483
+ const projectsDir = join202(getURConfigHomeDir(), "projects");
651484
+ const projectDir = join202(projectsDir, sanitizePath2(getOriginalCwd()));
650263
651485
  recordingState.timestamp = Date.now();
650264
- recordingState.filePath = join199(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
651486
+ recordingState.filePath = join202(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
650265
651487
  return recordingState.filePath;
650266
651488
  }
650267
651489
  function _resetRecordingStateForTesting() {
@@ -650270,13 +651492,13 @@ function _resetRecordingStateForTesting() {
650270
651492
  }
650271
651493
  function getSessionRecordingPaths() {
650272
651494
  const sessionId = getSessionId();
650273
- const projectsDir = join199(getURConfigHomeDir(), "projects");
650274
- const projectDir = join199(projectsDir, sanitizePath2(getOriginalCwd()));
651495
+ const projectsDir = join202(getURConfigHomeDir(), "projects");
651496
+ const projectDir = join202(projectsDir, sanitizePath2(getOriginalCwd()));
650275
651497
  try {
650276
651498
  const entries = getFsImplementation().readdirSync(projectDir);
650277
651499
  const names = typeof entries[0] === "string" ? entries : entries.map((e) => e.name);
650278
651500
  const files2 = names.filter((f) => f.startsWith(sessionId) && f.endsWith(".cast")).sort();
650279
- return files2.map((f) => join199(projectDir, f));
651501
+ return files2.map((f) => join202(projectDir, f));
650280
651502
  } catch {
650281
651503
  return [];
650282
651504
  }
@@ -650286,9 +651508,9 @@ async function renameRecordingForSession() {
650286
651508
  if (!oldPath || recordingState.timestamp === 0) {
650287
651509
  return;
650288
651510
  }
650289
- const projectsDir = join199(getURConfigHomeDir(), "projects");
650290
- const projectDir = join199(projectsDir, sanitizePath2(getOriginalCwd()));
650291
- const newPath = join199(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
651511
+ const projectsDir = join202(getURConfigHomeDir(), "projects");
651512
+ const projectDir = join202(projectsDir, sanitizePath2(getOriginalCwd()));
651513
+ const newPath = join202(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
650292
651514
  if (oldPath === newPath) {
650293
651515
  return;
650294
651516
  }
@@ -650329,7 +651551,7 @@ function installAsciicastRecorder() {
650329
651551
  }
650330
651552
  });
650331
651553
  try {
650332
- getFsImplementation().mkdirSync(dirname67(filePath));
651554
+ getFsImplementation().mkdirSync(dirname68(filePath));
650333
651555
  } catch {}
650334
651556
  getFsImplementation().appendFileSync(filePath, header + `
650335
651557
  `, { mode: 384 });
@@ -650398,7 +651620,7 @@ var init_asciicast = __esm(() => {
650398
651620
  });
650399
651621
 
650400
651622
  // src/utils/sessionRestore.ts
650401
- import { dirname as dirname68 } from "path";
651623
+ import { dirname as dirname69 } from "path";
650402
651624
  function extractTodosFromTranscript(messages) {
650403
651625
  for (let i3 = messages.length - 1;i3 >= 0; i3--) {
650404
651626
  const msg = messages[i3];
@@ -650523,7 +651745,7 @@ async function processResumedConversation(result, opts, context4) {
650523
651745
  if (!opts.forkSession) {
650524
651746
  const sid = opts.sessionIdOverride ?? result.sessionId;
650525
651747
  if (sid) {
650526
- switchSession(asSessionId(sid), opts.transcriptPath ? dirname68(opts.transcriptPath) : null);
651748
+ switchSession(asSessionId(sid), opts.transcriptPath ? dirname69(opts.transcriptPath) : null);
650527
651749
  await renameRecordingForSession();
650528
651750
  await resetSessionFilePointer();
650529
651751
  restoreCostStateForSession(sid);
@@ -651893,7 +653115,7 @@ async function submitTranscriptShare(messages, trigger2, appearanceId) {
651893
653115
  } catch {}
651894
653116
  const data = {
651895
653117
  trigger: trigger2,
651896
- version: "1.22.3",
653118
+ version: "1.22.4",
651897
653119
  platform: process.platform,
651898
653120
  transcript,
651899
653121
  subagentTranscripts: Object.keys(subagentTranscripts).length > 0 ? subagentTranscripts : undefined,
@@ -653165,7 +654387,7 @@ var init_useChromeExtensionNotification = __esm(() => {
653165
654387
  });
653166
654388
 
653167
654389
  // src/utils/plugins/officialMarketplaceStartupCheck.ts
653168
- import { join as join200 } from "path";
654390
+ import { join as join203 } from "path";
653169
654391
  function isOfficialMarketplaceAutoInstallDisabled() {
653170
654392
  return isEnvTruthy(process.env.UR_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL);
653171
654393
  }
@@ -653249,7 +654471,7 @@ async function checkAndInstallOfficialMarketplace() {
653249
654471
  return { installed: false, skipped: true, reason: "policy_blocked" };
653250
654472
  }
653251
654473
  const cacheDir = getMarketplacesCacheDir();
653252
- const installLocation = join200(cacheDir, OFFICIAL_MARKETPLACE_NAME);
654474
+ const installLocation = join203(cacheDir, OFFICIAL_MARKETPLACE_NAME);
653253
654475
  const gcsSha = await fetchOfficialMarketplaceFromGcs(installLocation, cacheDir);
653254
654476
  if (gcsSha !== null) {
653255
654477
  const known = await loadKnownMarketplacesConfig();
@@ -655892,9 +657114,9 @@ function useLspInitializationNotification() {
655892
657114
  if (status2.status === "pending" || status2.status === "not-started") {
655893
657115
  return;
655894
657116
  }
655895
- const manager = getLspServerManager();
655896
- if (manager) {
655897
- const servers = manager.getAllServers();
657117
+ const manager2 = getLspServerManager();
657118
+ if (manager2) {
657119
+ const servers = manager2.getAllServers();
655898
657120
  for (const [serverName, server2] of servers) {
655899
657121
  if (server2.state === "error" && server2.lastError) {
655900
657122
  addError(serverName, server2.lastError.message);
@@ -656264,7 +657486,7 @@ var init_usePluginRecommendationBase = __esm(() => {
656264
657486
  });
656265
657487
 
656266
657488
  // src/hooks/useLspPluginRecommendation.tsx
656267
- import { extname as extname20, join as join201 } from "path";
657489
+ import { extname as extname20, join as join204 } from "path";
656268
657490
  function useLspPluginRecommendation() {
656269
657491
  const $3 = import_compiler_runtime347.c(12);
656270
657492
  const trackedFiles = useAppState(_temp205);
@@ -656349,7 +657571,7 @@ function useLspPluginRecommendation() {
656349
657571
  case "yes": {
656350
657572
  installPluginAndNotify(pluginId, pluginName, "lsp-plugin", addNotification, async (pluginData) => {
656351
657573
  logForDebugging(`[useLspPluginRecommendation] Installing plugin: ${pluginId}`);
656352
- const localSourcePath = typeof pluginData.entry.source === "string" ? join201(pluginData.marketplaceInstallLocation, pluginData.entry.source) : undefined;
657574
+ const localSourcePath = typeof pluginData.entry.source === "string" ? join204(pluginData.marketplaceInstallLocation, pluginData.entry.source) : undefined;
656353
657575
  await cacheAndRegisterPlugin(pluginId, pluginData.entry, "user", undefined, localSourcePath);
656354
657576
  const settings = getSettingsForSource("userSettings");
656355
657577
  updateSettingsForSource("userSettings", {
@@ -657906,8 +659128,8 @@ function _temp224() {
657906
659128
  }
657907
659129
  return notifs.length > 0 ? notifs : null;
657908
659130
  }
657909
- function recent(ts2) {
657910
- return ts2 !== undefined && Date.now() - ts2 < 3000;
659131
+ function recent(ts4) {
659132
+ return ts4 !== undefined && Date.now() - ts4 < 3000;
657911
659133
  }
657912
659134
  var MIGRATIONS;
657913
659135
  var init_useModelMigrationNotifications = __esm(() => {
@@ -657927,8 +659149,8 @@ var init_useModelMigrationNotifications = __esm(() => {
657927
659149
  },
657928
659150
  (c4) => {
657929
659151
  const isLegacyRemap = Boolean(c4.legacymodelOMigrationTimestamp);
657930
- const ts2 = c4.legacymodelOMigrationTimestamp ?? c4.modelOProMigrationTimestamp;
657931
- if (!recent(ts2))
659152
+ const ts4 = c4.legacymodelOMigrationTimestamp ?? c4.modelOProMigrationTimestamp;
659153
+ if (!recent(ts4))
657932
659154
  return;
657933
659155
  return {
657934
659156
  key: "modelO-pro-update",
@@ -659179,7 +660401,7 @@ var exports_REPL = {};
659179
660401
  __export(exports_REPL, {
659180
660402
  REPL: () => REPL
659181
660403
  });
659182
- import { dirname as dirname69, join as join202 } from "path";
660404
+ import { dirname as dirname70, join as join205 } from "path";
659183
660405
  import { tmpdir as tmpdir12 } from "os";
659184
660406
  import { writeFile as writeFile47 } from "fs/promises";
659185
660407
  import { randomUUID as randomUUID51 } from "crypto";
@@ -660119,7 +661341,7 @@ function REPL({
660119
661341
  const targetSessionCosts = getStoredSessionCosts(sessionId);
660120
661342
  saveCurrentSessionCosts();
660121
661343
  resetCostState();
660122
- switchSession(asSessionId(sessionId), log2.fullPath ? dirname69(log2.fullPath) : null);
661344
+ switchSession(asSessionId(sessionId), log2.fullPath ? dirname70(log2.fullPath) : null);
660123
661345
  const {
660124
661346
  renameRecordingForSession: renameRecordingForSession2
660125
661347
  } = await Promise.resolve().then(() => (init_asciicast(), exports_asciicast));
@@ -661751,7 +662973,7 @@ Note: ctrl + z now suspends UR, ctrl + _ undoes input.
661751
662973
  const w = Math.max(80, (process.stdout.columns ?? 80) - 6);
661752
662974
  const raw = await renderMessagesToPlainText(deferredMessages, tools, w);
661753
662975
  const text = raw.replace(/[ \t]+$/gm, "");
661754
- const path24 = join202(tmpdir12(), `cc-transcript-${Date.now()}.txt`);
662976
+ const path24 = join205(tmpdir12(), `cc-transcript-${Date.now()}.txt`);
661755
662977
  await writeFile47(path24, text);
661756
662978
  const opened = openFileInExternalEditor(path24);
661757
662979
  setStatus2(opened ? `opening ${path24}` : `wrote ${path24} \xB7 no $VISUAL/$EDITOR set`);
@@ -663802,7 +665024,7 @@ function WelcomeV2() {
663802
665024
  dimColor: true,
663803
665025
  children: [
663804
665026
  "v",
663805
- "1.22.3"
665027
+ "1.22.4"
663806
665028
  ]
663807
665029
  }, undefined, true, undefined, this)
663808
665030
  ]
@@ -665062,7 +666284,7 @@ function completeOnboarding() {
665062
666284
  saveGlobalConfig((current) => ({
665063
666285
  ...current,
665064
666286
  hasCompletedOnboarding: true,
665065
- lastOnboardingVersion: "1.22.3"
666287
+ lastOnboardingVersion: "1.22.4"
665066
666288
  }));
665067
666289
  }
665068
666290
  function showDialog(root2, renderer) {
@@ -666206,7 +667428,7 @@ var exports_ResumeConversation = {};
666206
667428
  __export(exports_ResumeConversation, {
666207
667429
  ResumeConversation: () => ResumeConversation
666208
667430
  });
666209
- import { dirname as dirname70 } from "path";
667431
+ import { dirname as dirname71 } from "path";
666210
667432
  function parsePrIdentifier(value) {
666211
667433
  const directNumber = parseInt(value, 10);
666212
667434
  if (!isNaN(directNumber) && directNumber > 0) {
@@ -666338,7 +667560,7 @@ function ResumeConversation({
666338
667560
  }
666339
667561
  if (false) {}
666340
667562
  if (result_3.sessionId && !forkSession) {
666341
- switchSession(asSessionId(result_3.sessionId), log_0.fullPath ? dirname70(log_0.fullPath) : null);
667563
+ switchSession(asSessionId(result_3.sessionId), log_0.fullPath ? dirname71(log_0.fullPath) : null);
666342
667564
  await renameRecordingForSession();
666343
667565
  await resetSessionFilePointer();
666344
667566
  restoreCostStateForSession(result_3.sessionId);
@@ -670114,12 +671336,12 @@ var init_createDirectConnectSession = __esm(() => {
670114
671336
  });
670115
671337
 
670116
671338
  // src/utils/errorLogSink.ts
670117
- import { dirname as dirname71, join as join203 } from "path";
671339
+ import { dirname as dirname72, join as join206 } from "path";
670118
671340
  function getErrorsPath() {
670119
- return join203(CACHE_PATHS.errors(), DATE + ".jsonl");
671341
+ return join206(CACHE_PATHS.errors(), DATE + ".jsonl");
670120
671342
  }
670121
671343
  function getMCPLogsPath(serverName) {
670122
- return join203(CACHE_PATHS.mcpLogs(serverName), DATE + ".jsonl");
671344
+ return join206(CACHE_PATHS.mcpLogs(serverName), DATE + ".jsonl");
670123
671345
  }
670124
671346
  function createJsonlWriter(options2) {
670125
671347
  const writer = createBufferedWriter(options2);
@@ -670135,7 +671357,7 @@ function createJsonlWriter(options2) {
670135
671357
  function getLogWriter(path24) {
670136
671358
  let writer = logWriters.get(path24);
670137
671359
  if (!writer) {
670138
- const dir = dirname71(path24);
671360
+ const dir = dirname72(path24);
670139
671361
  writer = createJsonlWriter({
670140
671362
  writeFn: (content) => {
670141
671363
  try {
@@ -670163,7 +671385,7 @@ function appendToLog(path24, message) {
670163
671385
  cwd: getFsImplementation().cwd(),
670164
671386
  userType: process.env.USER_TYPE,
670165
671387
  sessionId: getSessionId(),
670166
- version: "1.22.3"
671388
+ version: "1.22.4"
670167
671389
  };
670168
671390
  getLogWriter(path24).write(messageWithTimestamp);
670169
671391
  }
@@ -670462,7 +671684,7 @@ var init_sessionMemory = __esm(() => {
670462
671684
  // src/utils/iTermBackup.ts
670463
671685
  import { copyFile as copyFile11, stat as stat49 } from "fs/promises";
670464
671686
  import { homedir as homedir38 } from "os";
670465
- import { join as join204 } from "path";
671687
+ import { join as join207 } from "path";
670466
671688
  function markITerm2SetupComplete() {
670467
671689
  saveGlobalConfig((current) => ({
670468
671690
  ...current,
@@ -670477,7 +671699,7 @@ function getIterm2RecoveryInfo() {
670477
671699
  };
670478
671700
  }
670479
671701
  function getITerm2PlistPath() {
670480
- return join204(homedir38(), "Library", "Preferences", "com.googlecode.iterm2.plist");
671702
+ return join207(homedir38(), "Library", "Preferences", "com.googlecode.iterm2.plist");
670481
671703
  }
670482
671704
  async function checkAndRestoreITerm2Backup() {
670483
671705
  const { inProgress, backupPath } = getIterm2RecoveryInfo();
@@ -673986,7 +675208,7 @@ var init_idleTimeout = __esm(() => {
673986
675208
  // src/bridge/inboundAttachments.ts
673987
675209
  import { randomUUID as randomUUID54 } from "crypto";
673988
675210
  import { mkdir as mkdir45, writeFile as writeFile49 } from "fs/promises";
673989
- import { basename as basename58, join as join205 } from "path";
675211
+ import { basename as basename58, join as join208 } from "path";
673990
675212
  function debug(msg) {
673991
675213
  logForDebugging(`[bridge:inbound-attach] ${msg}`);
673992
675214
  }
@@ -674002,7 +675224,7 @@ function sanitizeFileName(name) {
674002
675224
  return base2 || "attachment";
674003
675225
  }
674004
675226
  function uploadsDir() {
674005
- return join205(getURConfigHomeDir(), "uploads", getSessionId());
675227
+ return join208(getURConfigHomeDir(), "uploads", getSessionId());
674006
675228
  }
674007
675229
  async function resolveOne(att) {
674008
675230
  const token = getBridgeAccessToken();
@@ -674031,7 +675253,7 @@ async function resolveOne(att) {
674031
675253
  const safeName = sanitizeFileName(att.file_name);
674032
675254
  const prefix = (att.file_uuid.slice(0, 8) || randomUUID54().slice(0, 8)).replace(/[^a-zA-Z0-9_-]/g, "_");
674033
675255
  const dir = uploadsDir();
674034
- const outPath = join205(dir, `${prefix}-${safeName}`);
675256
+ const outPath = join208(dir, `${prefix}-${safeName}`);
674035
675257
  try {
674036
675258
  await mkdir45(dir, { recursive: true });
674037
675259
  await writeFile49(outPath, data);
@@ -674131,7 +675353,7 @@ var init_sessionUrl = __esm(() => {
674131
675353
 
674132
675354
  // src/utils/plugins/zipCacheAdapters.ts
674133
675355
  import { readFile as readFile54 } from "fs/promises";
674134
- import { join as join206 } from "path";
675356
+ import { join as join209 } from "path";
674135
675357
  async function readZipCacheKnownMarketplaces() {
674136
675358
  try {
674137
675359
  const content = await readFile54(getZipCacheKnownMarketplacesPath(), "utf-8");
@@ -674156,13 +675378,13 @@ async function saveMarketplaceJsonToZipCache(marketplaceName, installLocation) {
674156
675378
  const content = await readMarketplaceJsonContent(installLocation);
674157
675379
  if (content !== null) {
674158
675380
  const relPath = getMarketplaceJsonRelativePath(marketplaceName);
674159
- await atomicWriteToZipCache(join206(zipCachePath, relPath), content);
675381
+ await atomicWriteToZipCache(join209(zipCachePath, relPath), content);
674160
675382
  }
674161
675383
  }
674162
675384
  async function readMarketplaceJsonContent(dir) {
674163
675385
  const candidates2 = [
674164
- join206(dir, ".ur-plugin", "marketplace.json"),
674165
- join206(dir, "marketplace.json"),
675386
+ join209(dir, ".ur-plugin", "marketplace.json"),
675387
+ join209(dir, "marketplace.json"),
674166
675388
  dir
674167
675389
  ];
674168
675390
  for (const candidate of candidates2) {
@@ -674292,8 +675514,8 @@ async function getEnvLessBridgeConfig() {
674292
675514
  }
674293
675515
  async function checkEnvLessBridgeMinVersion() {
674294
675516
  const cfg = await getEnvLessBridgeConfig();
674295
- if (cfg.min_version && lt("1.22.3", cfg.min_version)) {
674296
- return `Your version of UR (${"1.22.3"}) is too old for Remote Control.
675517
+ if (cfg.min_version && lt("1.22.4", cfg.min_version)) {
675518
+ return `Your version of UR (${"1.22.4"}) is too old for Remote Control.
674297
675519
  Version ${cfg.min_version} or higher is required. Run \`ur update\` to update.`;
674298
675520
  }
674299
675521
  return null;
@@ -674621,14 +675843,14 @@ __export(exports_bridgePointer, {
674621
675843
  BRIDGE_POINTER_TTL_MS: () => BRIDGE_POINTER_TTL_MS
674622
675844
  });
674623
675845
  import { mkdir as mkdir46, readFile as readFile55, stat as stat50, unlink as unlink26, writeFile as writeFile50 } from "fs/promises";
674624
- import { dirname as dirname72, join as join207 } from "path";
675846
+ import { dirname as dirname73, join as join210 } from "path";
674625
675847
  function getBridgePointerPath(dir) {
674626
- return join207(getProjectsDir(), sanitizePath2(dir), "bridge-pointer.json");
675848
+ return join210(getProjectsDir(), sanitizePath2(dir), "bridge-pointer.json");
674627
675849
  }
674628
675850
  async function writeBridgePointer(dir, pointer) {
674629
675851
  const path24 = getBridgePointerPath(dir);
674630
675852
  try {
674631
- await mkdir46(dirname72(path24), { recursive: true });
675853
+ await mkdir46(dirname73(path24), { recursive: true });
674632
675854
  await writeFile50(path24, jsonStringify(pointer), "utf8");
674633
675855
  logForDebugging(`[bridge:pointer] wrote ${path24}`);
674634
675856
  } catch (err2) {
@@ -674767,7 +675989,7 @@ async function initBridgeCore(params) {
674767
675989
  const rawApi = createBridgeApiClient({
674768
675990
  baseUrl,
674769
675991
  getAccessToken,
674770
- runnerVersion: "1.22.3",
675992
+ runnerVersion: "1.22.4",
674771
675993
  onDebug: logForDebugging,
674772
675994
  onAuth401,
674773
675995
  getTrustedDeviceToken
@@ -676632,7 +677854,7 @@ __export(exports_print, {
676632
677854
  canBatchWith: () => canBatchWith
676633
677855
  });
676634
677856
  import { readFile as readFile56, stat as stat51, writeFile as writeFile51 } from "fs/promises";
676635
- import { dirname as dirname73 } from "path";
677857
+ import { dirname as dirname74 } from "path";
676636
677858
  import { cwd as cwd2 } from "process";
676637
677859
  import { randomUUID as randomUUID57 } from "crypto";
676638
677860
  function trackReceivedMessageUuid(uuid3) {
@@ -679085,7 +680307,7 @@ async function loadInitialMessages(setAppState, options2) {
679085
680307
  if (false) {}
679086
680308
  if (!options2.forkSession) {
679087
680309
  if (result.sessionId) {
679088
- switchSession(asSessionId(result.sessionId), result.fullPath ? dirname73(result.fullPath) : null);
680310
+ switchSession(asSessionId(result.sessionId), result.fullPath ? dirname74(result.fullPath) : null);
679089
680311
  if (persistSession) {
679090
680312
  await resetSessionFilePointer();
679091
680313
  }
@@ -679183,7 +680405,7 @@ async function loadInitialMessages(setAppState, options2) {
679183
680405
  }
679184
680406
  if (false) {}
679185
680407
  if (!options2.forkSession && result.sessionId) {
679186
- switchSession(asSessionId(result.sessionId), result.fullPath ? dirname73(result.fullPath) : null);
680408
+ switchSession(asSessionId(result.sessionId), result.fullPath ? dirname74(result.fullPath) : null);
679187
680409
  if (persistSession) {
679188
680410
  await resetSessionFilePointer();
679189
680411
  }
@@ -680448,7 +681670,7 @@ async function startMCPServer(cwd3, debug2, verbose) {
680448
681670
  setCwd(cwd3);
680449
681671
  const server2 = new Server({
680450
681672
  name: "ur/tengu",
680451
- version: "1.22.3"
681673
+ version: "1.22.4"
680452
681674
  }, {
680453
681675
  capabilities: {
680454
681676
  tools: {}
@@ -680580,14 +681802,14 @@ __export(exports_urDesktop, {
680580
681802
  });
680581
681803
  import { readdir as readdir32, readFile as readFile57, stat as stat52 } from "fs/promises";
680582
681804
  import { homedir as homedir39 } from "os";
680583
- import { join as join208 } from "path";
681805
+ import { join as join211 } from "path";
680584
681806
  async function getURDesktopConfigPath() {
680585
681807
  const platform7 = getPlatform();
680586
681808
  if (!SUPPORTED_PLATFORMS.includes(platform7)) {
680587
681809
  throw new Error(`Unsupported platform: ${platform7} - UR Desktop integration only works on macOS and WSL.`);
680588
681810
  }
680589
681811
  if (platform7 === "macos") {
680590
- return join208(homedir39(), "Library", "Application Support", "UR", "ur_desktop_config.json");
681812
+ return join211(homedir39(), "Library", "Application Support", "UR", "ur_desktop_config.json");
680591
681813
  }
680592
681814
  const windowsHome = process.env.USERPROFILE ? process.env.USERPROFILE.replace(/\\/g, "/") : null;
680593
681815
  if (windowsHome) {
@@ -680606,7 +681828,7 @@ async function getURDesktopConfigPath() {
680606
681828
  if (user.name === "Public" || user.name === "Default" || user.name === "Default User" || user.name === "All Users") {
680607
681829
  continue;
680608
681830
  }
680609
- const potentialConfigPath = join208(usersDir, user.name, "AppData", "Roaming", "UR", "ur_desktop_config.json");
681831
+ const potentialConfigPath = join211(usersDir, user.name, "AppData", "Roaming", "UR", "ur_desktop_config.json");
680610
681832
  try {
680611
681833
  await stat52(potentialConfigPath);
680612
681834
  return potentialConfigPath;
@@ -681002,7 +682224,7 @@ __export(exports_plugins, {
681002
682224
  VALID_UPDATE_SCOPES: () => VALID_UPDATE_SCOPES,
681003
682225
  VALID_INSTALLABLE_SCOPES: () => VALID_INSTALLABLE_SCOPES
681004
682226
  });
681005
- import { basename as basename59, dirname as dirname74 } from "path";
682227
+ import { basename as basename59, dirname as dirname75 } from "path";
681006
682228
  function handleMarketplaceError(error40, action3) {
681007
682229
  logError2(error40);
681008
682230
  cliError(`${figures_default.cross} Failed to ${action3}: ${errorMessage2(error40)}`);
@@ -681035,9 +682257,9 @@ async function pluginValidateHandler(manifestPath5, options2) {
681035
682257
  printValidationResult(result);
681036
682258
  let contentResults = [];
681037
682259
  if (result.fileType === "plugin") {
681038
- const manifestDir = dirname74(result.filePath);
682260
+ const manifestDir = dirname75(result.filePath);
681039
682261
  if (basename59(manifestDir) === ".ur-plugin") {
681040
- contentResults = await validatePluginContents(dirname74(manifestDir));
682262
+ contentResults = await validatePluginContents(dirname75(manifestDir));
681041
682263
  for (const r of contentResults) {
681042
682264
  console.log(`Validating ${r.fileType}: ${r.filePath}
681043
682265
  `);
@@ -681515,12 +682737,12 @@ __export(exports_install, {
681515
682737
  install: () => install
681516
682738
  });
681517
682739
  import { homedir as homedir40 } from "os";
681518
- import { join as join209 } from "path";
682740
+ import { join as join212 } from "path";
681519
682741
  function getInstallationPath2() {
681520
682742
  const isWindows2 = env3.platform === "win32";
681521
682743
  const homeDir = homedir40();
681522
682744
  if (isWindows2) {
681523
- const windowsPath = join209(homeDir, ".local", "bin", "ur.exe");
682745
+ const windowsPath = join212(homeDir, ".local", "bin", "ur.exe");
681524
682746
  return windowsPath.replace(/\//g, "\\");
681525
682747
  }
681526
682748
  return "~/.local/bin/ur";
@@ -682059,7 +683281,7 @@ __export(exports_update, {
682059
683281
  });
682060
683282
  async function update() {
682061
683283
  logEvent("tengu_update_check", {});
682062
- writeToStdout(`Current version: ${"1.22.3"}
683284
+ writeToStdout(`Current version: ${"1.22.4"}
682063
683285
  `);
682064
683286
  const channel = getInitialSettings()?.autoUpdatesChannel ?? "latest";
682065
683287
  writeToStdout(`Checking for updates to ${channel} version...
@@ -682134,8 +683356,8 @@ async function update() {
682134
683356
  writeToStdout(`UR is managed by Homebrew.
682135
683357
  `);
682136
683358
  const latest = await getLatestVersion(channel);
682137
- if (latest && !gte("1.22.3", latest)) {
682138
- writeToStdout(`${formatUpdateAvailableMessage("1.22.3", latest)}
683359
+ if (latest && !gte("1.22.4", latest)) {
683360
+ writeToStdout(`${formatUpdateAvailableMessage("1.22.4", latest)}
682139
683361
  `);
682140
683362
  writeToStdout(`
682141
683363
  `);
@@ -682151,8 +683373,8 @@ async function update() {
682151
683373
  writeToStdout(`UR is managed by winget.
682152
683374
  `);
682153
683375
  const latest = await getLatestVersion(channel);
682154
- if (latest && !gte("1.22.3", latest)) {
682155
- writeToStdout(`${formatUpdateAvailableMessage("1.22.3", latest)}
683376
+ if (latest && !gte("1.22.4", latest)) {
683377
+ writeToStdout(`${formatUpdateAvailableMessage("1.22.4", latest)}
682156
683378
  `);
682157
683379
  writeToStdout(`
682158
683380
  `);
@@ -682168,8 +683390,8 @@ async function update() {
682168
683390
  writeToStdout(`UR is managed by apk.
682169
683391
  `);
682170
683392
  const latest = await getLatestVersion(channel);
682171
- if (latest && !gte("1.22.3", latest)) {
682172
- writeToStdout(`${formatUpdateAvailableMessage("1.22.3", latest)}
683393
+ if (latest && !gte("1.22.4", latest)) {
683394
+ writeToStdout(`${formatUpdateAvailableMessage("1.22.4", latest)}
682173
683395
  `);
682174
683396
  writeToStdout(`
682175
683397
  `);
@@ -682234,11 +683456,11 @@ async function update() {
682234
683456
  `);
682235
683457
  await gracefulShutdown(1);
682236
683458
  }
682237
- if (result.latestVersion === "1.22.3") {
682238
- writeToStdout(source_default.green(`UR is up to date (${"1.22.3"})`) + `
683459
+ if (result.latestVersion === "1.22.4") {
683460
+ writeToStdout(source_default.green(`UR is up to date (${"1.22.4"})`) + `
682239
683461
  `);
682240
683462
  } else {
682241
- writeToStdout(source_default.green(`Successfully updated from ${"1.22.3"} to version ${result.latestVersion}`) + `
683463
+ writeToStdout(source_default.green(`Successfully updated from ${"1.22.4"} to version ${result.latestVersion}`) + `
682242
683464
  `);
682243
683465
  await regenerateCompletionCache();
682244
683466
  }
@@ -682298,12 +683520,12 @@ async function update() {
682298
683520
  `);
682299
683521
  await gracefulShutdown(1);
682300
683522
  }
682301
- if (latestVersion === "1.22.3") {
682302
- writeToStdout(source_default.green(`UR is up to date (${"1.22.3"})`) + `
683523
+ if (latestVersion === "1.22.4") {
683524
+ writeToStdout(source_default.green(`UR is up to date (${"1.22.4"})`) + `
682303
683525
  `);
682304
683526
  await gracefulShutdown(0);
682305
683527
  }
682306
- writeToStdout(`${formatUpdateAvailableMessage("1.22.3", latestVersion)}
683528
+ writeToStdout(`${formatUpdateAvailableMessage("1.22.4", latestVersion)}
682307
683529
  `);
682308
683530
  writeToStdout(`Installing update...
682309
683531
  `);
@@ -682348,7 +683570,7 @@ async function update() {
682348
683570
  logForDebugging(`update: Installation status: ${status2}`);
682349
683571
  switch (status2) {
682350
683572
  case "success":
682351
- writeToStdout(source_default.green(`Successfully updated from ${"1.22.3"} to version ${latestVersion}`) + `
683573
+ writeToStdout(source_default.green(`Successfully updated from ${"1.22.4"} to version ${latestVersion}`) + `
682352
683574
  `);
682353
683575
  await regenerateCompletionCache();
682354
683576
  break;
@@ -682414,7 +683636,7 @@ __export(exports_main, {
682414
683636
  startDeferredPrefetches: () => startDeferredPrefetches,
682415
683637
  main: () => main
682416
683638
  });
682417
- import { readFileSync as readFileSync58 } from "fs";
683639
+ import { readFileSync as readFileSync61 } from "fs";
682418
683640
  import { resolve as resolve50 } from "path";
682419
683641
  function logManagedSettings() {
682420
683642
  try {
@@ -682570,7 +683792,7 @@ function loadSettingsFromFlag(settingsFile) {
682570
683792
  resolvedPath: resolvedSettingsPath
682571
683793
  } = safeResolvePath(getFsImplementation(), settingsFile);
682572
683794
  try {
682573
- readFileSync58(resolvedSettingsPath, "utf8");
683795
+ readFileSync61(resolvedSettingsPath, "utf8");
682574
683796
  } catch (e) {
682575
683797
  if (isENOENT(e)) {
682576
683798
  process.stderr.write(source_default.red(`Error: Settings file not found: ${resolvedSettingsPath}
@@ -682975,7 +684197,7 @@ ${getTmuxInstallInstructions2()}
682975
684197
  }
682976
684198
  try {
682977
684199
  const filePath = resolve50(options2.systemPromptFile);
682978
- systemPrompt = readFileSync58(filePath, "utf8");
684200
+ systemPrompt = readFileSync61(filePath, "utf8");
682979
684201
  } catch (error40) {
682980
684202
  const code = getErrnoCode(error40);
682981
684203
  if (code === "ENOENT") {
@@ -682997,7 +684219,7 @@ ${getTmuxInstallInstructions2()}
682997
684219
  }
682998
684220
  try {
682999
684221
  const filePath = resolve50(options2.appendSystemPromptFile);
683000
- appendSystemPrompt = readFileSync58(filePath, "utf8");
684222
+ appendSystemPrompt = readFileSync61(filePath, "utf8");
683001
684223
  } catch (error40) {
683002
684224
  const code = getErrnoCode(error40);
683003
684225
  if (code === "ENOENT") {
@@ -683624,7 +684846,7 @@ ${customInstructions}` : customInstructions;
683624
684846
  }
683625
684847
  }
683626
684848
  logForDiagnosticsNoPII("info", "started", {
683627
- version: "1.22.3",
684849
+ version: "1.22.4",
683628
684850
  is_native_binary: isInBundledMode()
683629
684851
  });
683630
684852
  registerCleanup(async () => {
@@ -684408,7 +685630,7 @@ Usage: ur --remote "your task description"`, () => gracefulShutdown(1));
684408
685630
  pendingHookMessages
684409
685631
  }, renderAndRun);
684410
685632
  }
684411
- }).version("1.22.3 (Ur)", "-v, --version", "Output the version number");
685633
+ }).version("1.22.4 (Ur)", "-v, --version", "Output the version number");
684412
685634
  program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
684413
685635
  program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
684414
685636
  if (canUserConfigureAdvisor()) {
@@ -685209,7 +686431,7 @@ if (false) {}
685209
686431
  async function main2() {
685210
686432
  const args = process.argv.slice(2);
685211
686433
  if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
685212
- console.log(`${"1.22.3"} (Ur)`);
686434
+ console.log(`${"1.22.4"} (Ur)`);
685213
686435
  return;
685214
686436
  }
685215
686437
  if (args[0] === "a2a" && args[1] === "serve" && !args.includes("--help") && !args.includes("-h")) {