adhdev 0.9.43 → 0.9.45

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/index.js CHANGED
@@ -500,18 +500,18 @@ var init_source = __esm({
500
500
  }
501
501
  }
502
502
  });
503
- createStyler = (open3, close, parent) => {
503
+ createStyler = (open2, close, parent) => {
504
504
  let openAll;
505
505
  let closeAll;
506
506
  if (parent === void 0) {
507
- openAll = open3;
507
+ openAll = open2;
508
508
  closeAll = close;
509
509
  } else {
510
- openAll = parent.openAll + open3;
510
+ openAll = parent.openAll + open2;
511
511
  closeAll = close + parent.closeAll;
512
512
  }
513
513
  return {
514
- open: open3,
514
+ open: open2,
515
515
  close,
516
516
  openAll,
517
517
  closeAll,
@@ -1410,17 +1410,17 @@ function checkPathExists(paths) {
1410
1410
  return null;
1411
1411
  }
1412
1412
  async function detectIDEs(providerLoader) {
1413
- const os31 = (0, import_os2.platform)();
1413
+ const os30 = (0, import_os2.platform)();
1414
1414
  const results = [];
1415
1415
  for (const def of getMergedDefinitions()) {
1416
1416
  const cliPath = findCliCommand(providerLoader?.getIdeCliCommand(def.id, def.cli) || def.cli);
1417
- const appPath = checkPathExists(providerLoader?.getIdePathCandidates(def.id, def.paths[os31] || []) || []);
1417
+ const appPath = checkPathExists(providerLoader?.getIdePathCandidates(def.id, def.paths[os30] || []) || []);
1418
1418
  let resolvedCli = cliPath;
1419
- if (!resolvedCli && appPath && os31 === "darwin") {
1419
+ if (!resolvedCli && appPath && os30 === "darwin") {
1420
1420
  const bundledCli = `${appPath}/Contents/Resources/app/bin/${def.cli}`;
1421
1421
  if ((0, import_fs3.existsSync)(bundledCli)) resolvedCli = bundledCli;
1422
1422
  }
1423
- if (!resolvedCli && appPath && os31 === "win32") {
1423
+ if (!resolvedCli && appPath && os30 === "win32") {
1424
1424
  const { dirname: dirname11 } = await import("path");
1425
1425
  const appDir = dirname11(appPath);
1426
1426
  const candidates = [
@@ -1437,7 +1437,7 @@ async function detectIDEs(providerLoader) {
1437
1437
  }
1438
1438
  }
1439
1439
  }
1440
- const installed = os31 === "darwin" ? !!(resolvedCli || appPath) : !!resolvedCli;
1440
+ const installed = os30 === "darwin" ? !!(resolvedCli || appPath) : !!resolvedCli;
1441
1441
  const version2 = resolvedCli ? getIdeVersion(resolvedCli) : null;
1442
1442
  results.push({
1443
1443
  id: def.id,
@@ -1506,8 +1506,8 @@ function execAsync(cmd, timeoutMs = 5e3) {
1506
1506
  });
1507
1507
  }
1508
1508
  async function detectCLIs(providerLoader, options) {
1509
- const platform13 = os3.platform();
1510
- const whichCmd = platform13 === "win32" ? "where" : "which";
1509
+ const platform12 = os3.platform();
1510
+ const whichCmd = platform12 === "win32" ? "where" : "which";
1511
1511
  const includeVersion = options?.includeVersion !== false;
1512
1512
  const cliList = providerLoader ? providerLoader.getCliDetectionList() : [];
1513
1513
  const results = await Promise.all(
@@ -1550,8 +1550,8 @@ async function detectCLI(cliId, providerLoader, options) {
1550
1550
  const cliList = providerLoader.getCliDetectionList();
1551
1551
  const target = cliList.find((c) => c.id === resolvedId);
1552
1552
  if (target) {
1553
- const platform13 = os3.platform();
1554
- const whichCmd = platform13 === "win32" ? "where" : "which";
1553
+ const platform12 = os3.platform();
1554
+ const whichCmd = platform12 === "win32" ? "where" : "which";
1555
1555
  try {
1556
1556
  const explicitPath = resolveCommandPath(target.command);
1557
1557
  const pathResult = explicitPath || await execAsync(`${whichCmd} ${shellQuote(target.command)}`);
@@ -4552,6 +4552,27 @@ function computeSavedHistorySessionSummaries(agentType, dir, files, fileSignatur
4552
4552
  persistedEntries: nextPersistedEntries
4553
4553
  };
4554
4554
  }
4555
+ function pageHistoryRecords(agentType, records, offset = 0, limit = 30, excludeRecentCount = 0, historyBehavior) {
4556
+ const allMessages = records.map((message) => sanitizeHistoryMessage(agentType, message)).filter(Boolean);
4557
+ allMessages.sort((a, b) => a.receivedAt - b.receivedAt);
4558
+ const chronological = [];
4559
+ let lastTurn = null;
4560
+ for (const message of allMessages) {
4561
+ const previous = chronological[chronological.length - 1];
4562
+ if (isAdjacentHistoryDuplicate(agentType, previous, message)) continue;
4563
+ if (message.role !== "system" && isAdjacentHistoryDuplicate(agentType, lastTurn, message)) continue;
4564
+ chronological.push(message);
4565
+ if (message.role !== "system") lastTurn = message;
4566
+ }
4567
+ const collapsed = collapseReplayAssistantTurns(chronological, historyBehavior);
4568
+ const boundedLimit = Math.max(1, limit);
4569
+ const boundedOffset = Math.max(0, offset);
4570
+ const boundedExclude = Math.max(0, Math.min(excludeRecentCount, collapsed.length));
4571
+ const endExclusive = Math.max(0, collapsed.length - boundedExclude - boundedOffset);
4572
+ const startInclusive = Math.max(0, endExclusive - boundedLimit);
4573
+ const sliced = collapsed.slice(startInclusive, endExclusive);
4574
+ return { messages: sliced, hasMore: startInclusive > 0 };
4575
+ }
4555
4576
  function readChatHistory(agentType, offset = 0, limit = 30, historySessionId, excludeRecentCount = 0, historyBehavior) {
4556
4577
  try {
4557
4578
  const sanitized = agentType.replace(/[^a-zA-Z0-9_-]/g, "_");
@@ -4577,25 +4598,7 @@ function readChatHistory(agentType, offset = 0, limit = 30, historySessionId, ex
4577
4598
  }
4578
4599
  }
4579
4600
  }
4580
- allMessages.sort((a, b) => a.receivedAt - b.receivedAt);
4581
- const chronological = [];
4582
- let lastTurn = null;
4583
- for (const message of allMessages) {
4584
- const previous = chronological[chronological.length - 1];
4585
- if (isAdjacentHistoryDuplicate(agentType, previous, message)) continue;
4586
- if (message.role !== "system" && isAdjacentHistoryDuplicate(agentType, lastTurn, message)) continue;
4587
- chronological.push(message);
4588
- if (message.role !== "system") lastTurn = message;
4589
- }
4590
- const collapsed = collapseReplayAssistantTurns(chronological, historyBehavior);
4591
- const boundedLimit = Math.max(1, limit);
4592
- const boundedOffset = Math.max(0, offset);
4593
- const boundedExclude = Math.max(0, Math.min(excludeRecentCount, collapsed.length));
4594
- const endExclusive = Math.max(0, collapsed.length - boundedExclude - boundedOffset);
4595
- const startInclusive = Math.max(0, endExclusive - boundedLimit);
4596
- const sliced = collapsed.slice(startInclusive, endExclusive);
4597
- const hasMore = startInclusive > 0;
4598
- return { messages: sliced, hasMore };
4601
+ return pageHistoryRecords(agentType, allMessages, offset, limit, excludeRecentCount, historyBehavior);
4599
4602
  } catch {
4600
4603
  return { messages: [], hasMore: false };
4601
4604
  }
@@ -4730,6 +4733,52 @@ function rewriteCanonicalSavedHistory(agentType, historySessionId, records) {
4730
4733
  return false;
4731
4734
  }
4732
4735
  }
4736
+ function buildHermesNativeHistoryRecords(historySessionId) {
4737
+ const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId);
4738
+ if (!normalizedSessionId) return null;
4739
+ try {
4740
+ const sessionFilePath = path7.join(os6.homedir(), ".hermes", "sessions", `session_${normalizedSessionId}.json`);
4741
+ if (!fs3.existsSync(sessionFilePath)) return null;
4742
+ const raw = JSON.parse(fs3.readFileSync(sessionFilePath, "utf-8"));
4743
+ const canonicalMessages = Array.isArray(raw.messages) ? raw.messages : [];
4744
+ const records = [];
4745
+ let fallbackTs = Date.parse(raw.session_start || raw.last_updated || "") || Date.now();
4746
+ for (const message of canonicalMessages) {
4747
+ const role = String(message.role || "").trim();
4748
+ const content = normalizeCanonicalHermesMessageContent(message.content);
4749
+ if (!content) continue;
4750
+ const receivedAt = extractCanonicalHermesMessageTimestamp(message, fallbackTs);
4751
+ fallbackTs = receivedAt + 1;
4752
+ if (role === "user" || role === "assistant") {
4753
+ records.push({
4754
+ ts: new Date(receivedAt).toISOString(),
4755
+ receivedAt,
4756
+ role,
4757
+ content,
4758
+ kind: "standard",
4759
+ agent: "hermes-cli",
4760
+ historySessionId: normalizedSessionId
4761
+ });
4762
+ continue;
4763
+ }
4764
+ if (role === "tool") {
4765
+ records.push({
4766
+ ts: new Date(receivedAt).toISOString(),
4767
+ receivedAt,
4768
+ role: "assistant",
4769
+ content,
4770
+ kind: "tool",
4771
+ senderName: "Tool",
4772
+ agent: "hermes-cli",
4773
+ historySessionId: normalizedSessionId
4774
+ });
4775
+ }
4776
+ }
4777
+ return records;
4778
+ } catch {
4779
+ return null;
4780
+ }
4781
+ }
4733
4782
  function rebuildHermesSavedHistoryFromCanonicalSession(historySessionId) {
4734
4783
  const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId);
4735
4784
  if (!normalizedSessionId) return false;
@@ -4879,6 +4928,77 @@ function extractClaudeUserContentParts(content) {
4879
4928
  }
4880
4929
  return parts;
4881
4930
  }
4931
+ function buildClaudeNativeHistoryRecords(historySessionId, workspace) {
4932
+ const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId);
4933
+ if (!normalizedSessionId) return null;
4934
+ try {
4935
+ const transcriptPath = resolveClaudeProjectTranscriptPath(normalizedSessionId, workspace);
4936
+ if (!transcriptPath) return null;
4937
+ const lines = fs3.readFileSync(transcriptPath, "utf-8").split("\n").filter(Boolean);
4938
+ const records = [];
4939
+ let fallbackTs = Date.now();
4940
+ for (const line of lines) {
4941
+ let parsed = null;
4942
+ try {
4943
+ parsed = JSON.parse(line);
4944
+ } catch {
4945
+ parsed = null;
4946
+ }
4947
+ if (!parsed) continue;
4948
+ const parsedSessionId = String(parsed.sessionId || "").trim();
4949
+ if (parsedSessionId && parsedSessionId !== normalizedSessionId) continue;
4950
+ const receivedAt = extractTimestampValue(parsed.timestamp) || fallbackTs;
4951
+ fallbackTs = receivedAt + 1;
4952
+ const parsedWorkspace = String(parsed.cwd || workspace || "").trim();
4953
+ if (records.length === 0 && parsedWorkspace) {
4954
+ records.push({
4955
+ ts: new Date(receivedAt).toISOString(),
4956
+ receivedAt,
4957
+ role: "system",
4958
+ kind: "session_start",
4959
+ content: parsedWorkspace,
4960
+ agent: "claude-cli",
4961
+ historySessionId: normalizedSessionId,
4962
+ workspace: parsedWorkspace
4963
+ });
4964
+ }
4965
+ const type = String(parsed.type || "").trim();
4966
+ const message = parsed.message && typeof parsed.message === "object" ? parsed.message : null;
4967
+ if (type === "user" && message) {
4968
+ for (const part of extractClaudeUserContentParts(message.content)) {
4969
+ records.push({
4970
+ ts: new Date(receivedAt).toISOString(),
4971
+ receivedAt,
4972
+ role: part.role,
4973
+ content: part.content,
4974
+ kind: part.kind,
4975
+ senderName: part.senderName,
4976
+ agent: "claude-cli",
4977
+ historySessionId: normalizedSessionId
4978
+ });
4979
+ }
4980
+ continue;
4981
+ }
4982
+ if (type === "assistant" && message) {
4983
+ for (const part of extractClaudeAssistantContentParts(message.content)) {
4984
+ records.push({
4985
+ ts: new Date(receivedAt).toISOString(),
4986
+ receivedAt,
4987
+ role: "assistant",
4988
+ content: part.content,
4989
+ kind: part.kind,
4990
+ senderName: part.senderName,
4991
+ agent: "claude-cli",
4992
+ historySessionId: normalizedSessionId
4993
+ });
4994
+ }
4995
+ }
4996
+ }
4997
+ return records;
4998
+ } catch {
4999
+ return null;
5000
+ }
5001
+ }
4882
5002
  function rebuildClaudeSavedHistoryFromNativeProject(historySessionId, workspace) {
4883
5003
  const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId);
4884
5004
  if (!normalizedSessionId) return false;
@@ -4957,6 +5077,352 @@ function rebuildClaudeSavedHistoryFromNativeProject(historySessionId, workspace)
4957
5077
  return false;
4958
5078
  }
4959
5079
  }
5080
+ function isUuidLikeSessionId(sessionId) {
5081
+ return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(sessionId);
5082
+ }
5083
+ function readCodexSessionMeta(filePath) {
5084
+ try {
5085
+ const firstLine = fs3.readFileSync(filePath, "utf-8").split("\n").find(Boolean);
5086
+ if (!firstLine) return null;
5087
+ const parsed = JSON.parse(firstLine);
5088
+ if (String(parsed.type || "") !== "session_meta") return null;
5089
+ const payload = parsed.payload && typeof parsed.payload === "object" ? parsed.payload : null;
5090
+ return payload;
5091
+ } catch {
5092
+ return null;
5093
+ }
5094
+ }
5095
+ function resolveCodexSessionTranscriptPath(historySessionId, workspace) {
5096
+ const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId);
5097
+ if (!normalizedSessionId || !isUuidLikeSessionId(normalizedSessionId)) return null;
5098
+ const sessionsDir = path7.join(os6.homedir(), ".codex", "sessions");
5099
+ if (!fs3.existsSync(sessionsDir)) return null;
5100
+ const normalizedWorkspace = typeof workspace === "string" ? workspace.trim() : "";
5101
+ const candidates = [];
5102
+ const stack = [sessionsDir];
5103
+ while (stack.length > 0) {
5104
+ const current = stack.pop();
5105
+ if (!current) continue;
5106
+ let entries = [];
5107
+ try {
5108
+ entries = fs3.readdirSync(current, { withFileTypes: true });
5109
+ } catch {
5110
+ continue;
5111
+ }
5112
+ for (const entry of entries) {
5113
+ const entryPath = path7.join(current, entry.name);
5114
+ if (entry.isDirectory()) {
5115
+ stack.push(entryPath);
5116
+ continue;
5117
+ }
5118
+ if (!entry.isFile() || !entry.name.endsWith(".jsonl") || !entry.name.includes(normalizedSessionId)) continue;
5119
+ const meta3 = readCodexSessionMeta(entryPath);
5120
+ const metaSessionId = String(meta3?.id || "").trim();
5121
+ if (metaSessionId && metaSessionId !== normalizedSessionId) continue;
5122
+ const metaWorkspace = String(meta3?.cwd || "").trim();
5123
+ let mtimeMs = 0;
5124
+ try {
5125
+ mtimeMs = fs3.statSync(entryPath).mtimeMs;
5126
+ } catch {
5127
+ }
5128
+ candidates.push({
5129
+ path: entryPath,
5130
+ mtimeMs,
5131
+ workspaceMatches: !!normalizedWorkspace && metaWorkspace === normalizedWorkspace,
5132
+ metaMatches: metaSessionId === normalizedSessionId
5133
+ });
5134
+ }
5135
+ }
5136
+ candidates.sort((a, b) => Number(b.workspaceMatches) - Number(a.workspaceMatches) || Number(b.metaMatches) - Number(a.metaMatches) || b.mtimeMs - a.mtimeMs);
5137
+ return candidates[0]?.path || null;
5138
+ }
5139
+ function flattenCodexContent(content) {
5140
+ if (typeof content === "string") return content.trim();
5141
+ if (content == null) return "";
5142
+ if (Array.isArray(content)) {
5143
+ return content.map((entry) => flattenCodexContent(entry)).filter(Boolean).join("\n").trim();
5144
+ }
5145
+ if (typeof content === "object") {
5146
+ const record2 = content;
5147
+ if (typeof record2.text === "string") return record2.text.trim();
5148
+ if (typeof record2.content === "string" || Array.isArray(record2.content)) return flattenCodexContent(record2.content);
5149
+ if (typeof record2.output === "string") return record2.output.trim();
5150
+ if (typeof record2.message === "string") return record2.message.trim();
5151
+ }
5152
+ return "";
5153
+ }
5154
+ function summarizeCodexToolCall(payload) {
5155
+ const name = String(payload.name || payload.type || "tool").trim() || "tool";
5156
+ const rawArguments = payload.arguments ?? payload.input;
5157
+ let argumentValue = "";
5158
+ if (typeof rawArguments === "string") {
5159
+ const trimmed = rawArguments.trim();
5160
+ try {
5161
+ const parsed = JSON.parse(trimmed);
5162
+ argumentValue = summarizeCodexToolArguments(parsed);
5163
+ } catch {
5164
+ argumentValue = trimmed;
5165
+ }
5166
+ } else {
5167
+ argumentValue = summarizeCodexToolArguments(rawArguments);
5168
+ }
5169
+ return argumentValue ? `${name}: ${argumentValue}` : name;
5170
+ }
5171
+ function summarizeCodexToolArguments(value) {
5172
+ if (typeof value === "string") return value.trim();
5173
+ if (Array.isArray(value)) return value.map((entry) => String(entry)).join(" ").trim();
5174
+ if (!value || typeof value !== "object") return "";
5175
+ const record2 = value;
5176
+ const direct = record2.command || record2.cmd || record2.query || record2.path || record2.prompt;
5177
+ if (typeof direct === "string") return direct.trim();
5178
+ if (Array.isArray(direct)) return direct.map((entry) => String(entry)).join(" ").trim();
5179
+ try {
5180
+ return JSON.stringify(record2).trim();
5181
+ } catch {
5182
+ return "";
5183
+ }
5184
+ }
5185
+ function codexToolOutputContent(payload) {
5186
+ const output = payload.output ?? payload.result ?? payload.content;
5187
+ const text = flattenCodexContent(output);
5188
+ if (text) return text;
5189
+ if (output && typeof output === "object") {
5190
+ try {
5191
+ return JSON.stringify(output).trim();
5192
+ } catch {
5193
+ return "";
5194
+ }
5195
+ }
5196
+ return "";
5197
+ }
5198
+ function buildCodexNativeHistoryRecords(historySessionId, workspace) {
5199
+ const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId);
5200
+ if (!normalizedSessionId || !isUuidLikeSessionId(normalizedSessionId)) return null;
5201
+ try {
5202
+ const transcriptPath = resolveCodexSessionTranscriptPath(normalizedSessionId, workspace);
5203
+ if (!transcriptPath) return null;
5204
+ const lines = fs3.readFileSync(transcriptPath, "utf-8").split("\n").filter(Boolean);
5205
+ const records = [];
5206
+ let fallbackTs = Date.now();
5207
+ for (const line of lines) {
5208
+ let parsed = null;
5209
+ try {
5210
+ parsed = JSON.parse(line);
5211
+ } catch {
5212
+ parsed = null;
5213
+ }
5214
+ if (!parsed) continue;
5215
+ const receivedAt = extractTimestampValue(parsed.timestamp) || fallbackTs;
5216
+ fallbackTs = receivedAt + 1;
5217
+ const type = String(parsed.type || "").trim();
5218
+ const payload = parsed.payload && typeof parsed.payload === "object" ? parsed.payload : null;
5219
+ if (!payload) continue;
5220
+ if (type === "session_meta") {
5221
+ const parsedSessionId = String(payload.id || "").trim();
5222
+ if (parsedSessionId && parsedSessionId !== normalizedSessionId) return null;
5223
+ const parsedWorkspace = String(payload.cwd || workspace || "").trim();
5224
+ if (records.length === 0 && parsedWorkspace) {
5225
+ records.push({
5226
+ ts: new Date(receivedAt).toISOString(),
5227
+ receivedAt,
5228
+ role: "system",
5229
+ kind: "session_start",
5230
+ content: parsedWorkspace,
5231
+ agent: "codex-cli",
5232
+ historySessionId: normalizedSessionId,
5233
+ workspace: parsedWorkspace
5234
+ });
5235
+ }
5236
+ continue;
5237
+ }
5238
+ if (type !== "response_item") continue;
5239
+ const payloadType = String(payload.type || "").trim();
5240
+ if (payloadType === "message") {
5241
+ const role = String(payload.role || "").trim();
5242
+ if (role !== "user" && role !== "assistant") continue;
5243
+ const content = flattenCodexContent(payload.content);
5244
+ if (!content) continue;
5245
+ records.push({
5246
+ ts: new Date(receivedAt).toISOString(),
5247
+ receivedAt,
5248
+ role,
5249
+ content,
5250
+ kind: "standard",
5251
+ agent: "codex-cli",
5252
+ historySessionId: normalizedSessionId
5253
+ });
5254
+ continue;
5255
+ }
5256
+ if (payloadType === "function_call" || payloadType === "custom_tool_call") {
5257
+ const content = summarizeCodexToolCall(payload);
5258
+ if (!content) continue;
5259
+ records.push({
5260
+ ts: new Date(receivedAt).toISOString(),
5261
+ receivedAt,
5262
+ role: "assistant",
5263
+ content,
5264
+ kind: "tool",
5265
+ senderName: "Tool",
5266
+ agent: "codex-cli",
5267
+ historySessionId: normalizedSessionId
5268
+ });
5269
+ continue;
5270
+ }
5271
+ if (payloadType === "function_call_output" || payloadType === "custom_tool_call_output") {
5272
+ const content = codexToolOutputContent(payload);
5273
+ if (!content) continue;
5274
+ records.push({
5275
+ ts: new Date(receivedAt).toISOString(),
5276
+ receivedAt,
5277
+ role: "assistant",
5278
+ content,
5279
+ kind: "tool",
5280
+ senderName: "Tool",
5281
+ agent: "codex-cli",
5282
+ historySessionId: normalizedSessionId
5283
+ });
5284
+ }
5285
+ }
5286
+ return records;
5287
+ } catch {
5288
+ return null;
5289
+ }
5290
+ }
5291
+ function rebuildCodexSavedHistoryFromNativeSession(historySessionId, workspace) {
5292
+ const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId);
5293
+ if (!normalizedSessionId || !isUuidLikeSessionId(normalizedSessionId)) return false;
5294
+ const records = buildCodexNativeHistoryRecords(normalizedSessionId, workspace);
5295
+ if (!records || records.length === 0) return false;
5296
+ const existingSessionStart = readExistingSessionStartRecord("codex-cli", normalizedSessionId);
5297
+ const recordsToWrite = existingSessionStart && records[0]?.kind !== "session_start" ? [{ ...existingSessionStart, historySessionId: normalizedSessionId }, ...records] : records;
5298
+ return rewriteCanonicalSavedHistory("codex-cli", normalizedSessionId, recordsToWrite);
5299
+ }
5300
+ function isNativeSourceCanonicalHistory(canonicalHistory) {
5301
+ if (!canonicalHistory) return false;
5302
+ if (canonicalHistory.mode === "disabled") return false;
5303
+ if (canonicalHistory.mode === "materialized-mirror") return false;
5304
+ return true;
5305
+ }
5306
+ function buildNativeHistoryRecords(canonicalHistory, historySessionId, workspace) {
5307
+ const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId || "");
5308
+ if (!canonicalHistory || !normalizedSessionId || !isNativeSourceCanonicalHistory(canonicalHistory)) return null;
5309
+ if (canonicalHistory.format === "hermes-json") return buildHermesNativeHistoryRecords(normalizedSessionId);
5310
+ if (canonicalHistory.format === "claude-jsonl") return buildClaudeNativeHistoryRecords(normalizedSessionId, workspace);
5311
+ if (canonicalHistory.format === "codex-jsonl") return buildCodexNativeHistoryRecords(normalizedSessionId, workspace);
5312
+ return null;
5313
+ }
5314
+ function readProviderChatHistory(agentType, options = {}) {
5315
+ if (isNativeSourceCanonicalHistory(options.canonicalHistory) && options.historySessionId) {
5316
+ const records = buildNativeHistoryRecords(options.canonicalHistory, options.historySessionId, options.workspace);
5317
+ if (!records) return { messages: [], hasMore: false, source: "native-unavailable" };
5318
+ return {
5319
+ ...pageHistoryRecords(agentType, records, options.offset || 0, options.limit || 30, options.excludeRecentCount || 0, options.historyBehavior),
5320
+ source: "provider-native"
5321
+ };
5322
+ }
5323
+ return {
5324
+ ...readChatHistory(agentType, options.offset || 0, options.limit || 30, options.historySessionId, options.excludeRecentCount || 0, options.historyBehavior),
5325
+ source: "adhdev-mirror"
5326
+ };
5327
+ }
5328
+ function buildNativeSessionSummary(agentType, historySessionId, records, sourcePath) {
5329
+ const visible = pageHistoryRecords(agentType, records, 0, Number.MAX_SAFE_INTEGER).messages;
5330
+ if (visible.length === 0) return null;
5331
+ let sourceMtimeMs = 0;
5332
+ try {
5333
+ sourceMtimeMs = fs3.statSync(sourcePath).mtimeMs;
5334
+ } catch {
5335
+ }
5336
+ const firstMessageAt = visible[0]?.receivedAt || sourceMtimeMs || Date.now();
5337
+ const lastMessageAt = visible[visible.length - 1]?.receivedAt || firstMessageAt;
5338
+ const lastNonSystem = [...visible].reverse().find((message) => message.role !== "system") || visible[visible.length - 1];
5339
+ const firstSystem = visible.find((message) => message.kind === "session_start");
5340
+ return {
5341
+ historySessionId,
5342
+ sessionTitle: lastNonSystem?.content,
5343
+ messageCount: visible.length,
5344
+ firstMessageAt,
5345
+ lastMessageAt,
5346
+ preview: lastNonSystem?.content,
5347
+ workspace: firstSystem?.workspace || (firstSystem?.kind === "session_start" ? firstSystem.content : void 0),
5348
+ source: "provider-native",
5349
+ sourcePath,
5350
+ sourceMtimeMs
5351
+ };
5352
+ }
5353
+ function listFilesRecursive(root, predicate) {
5354
+ if (!fs3.existsSync(root)) return [];
5355
+ const results = [];
5356
+ const stack = [root];
5357
+ while (stack.length > 0) {
5358
+ const current = stack.pop();
5359
+ if (!current) continue;
5360
+ let entries = [];
5361
+ try {
5362
+ entries = fs3.readdirSync(current, { withFileTypes: true });
5363
+ } catch {
5364
+ continue;
5365
+ }
5366
+ for (const entry of entries) {
5367
+ const entryPath = path7.join(current, entry.name);
5368
+ if (entry.isDirectory()) {
5369
+ stack.push(entryPath);
5370
+ continue;
5371
+ }
5372
+ if (predicate(entryPath, entry)) results.push(entryPath);
5373
+ }
5374
+ }
5375
+ return results;
5376
+ }
5377
+ function collectNativeHistorySessionSummaries(agentType, canonicalHistory) {
5378
+ const summaries = [];
5379
+ if (canonicalHistory.format === "hermes-json") {
5380
+ const root = path7.join(os6.homedir(), ".hermes", "sessions");
5381
+ for (const filePath of listFilesRecursive(root, (_entryPath, entry) => entry.isFile() && /^session_.+\.json$/.test(entry.name))) {
5382
+ const fileName = path7.basename(filePath);
5383
+ const historySessionId = fileName.replace(/^session_/, "").replace(/\.json$/, "");
5384
+ const records = buildHermesNativeHistoryRecords(historySessionId);
5385
+ const summary = records ? buildNativeSessionSummary(agentType, historySessionId, records, filePath) : null;
5386
+ if (summary) summaries.push(summary);
5387
+ }
5388
+ } else if (canonicalHistory.format === "claude-jsonl") {
5389
+ const root = path7.join(os6.homedir(), ".claude", "projects");
5390
+ for (const filePath of listFilesRecursive(root, (_entryPath, entry) => entry.isFile() && entry.name.endsWith(".jsonl"))) {
5391
+ const historySessionId = path7.basename(filePath, ".jsonl");
5392
+ const records = buildClaudeNativeHistoryRecords(historySessionId);
5393
+ const summary = records ? buildNativeSessionSummary(agentType, historySessionId, records, filePath) : null;
5394
+ if (summary) summaries.push(summary);
5395
+ }
5396
+ } else if (canonicalHistory.format === "codex-jsonl") {
5397
+ const root = path7.join(os6.homedir(), ".codex", "sessions");
5398
+ const uuidPattern = /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i;
5399
+ for (const filePath of listFilesRecursive(root, (_entryPath, entry) => entry.isFile() && entry.name.endsWith(".jsonl"))) {
5400
+ const meta3 = readCodexSessionMeta(filePath);
5401
+ const historySessionId = String(meta3?.id || path7.basename(filePath).match(uuidPattern)?.[1] || "").trim();
5402
+ if (!historySessionId) continue;
5403
+ const records = buildCodexNativeHistoryRecords(historySessionId, String(meta3?.cwd || "").trim() || void 0);
5404
+ const summary = records ? buildNativeSessionSummary(agentType, historySessionId, records, filePath) : null;
5405
+ if (summary) summaries.push(summary);
5406
+ }
5407
+ }
5408
+ return sortSavedHistorySessionSummaries(summaries);
5409
+ }
5410
+ function listProviderHistorySessions(agentType, options = {}) {
5411
+ if (isNativeSourceCanonicalHistory(options.canonicalHistory)) {
5412
+ const offset = Math.max(0, options.offset || 0);
5413
+ const limit = Math.max(1, options.limit || 30);
5414
+ const summaries = collectNativeHistorySessionSummaries(agentType, options.canonicalHistory);
5415
+ return {
5416
+ sessions: summaries.slice(offset, offset + limit),
5417
+ hasMore: offset + limit < summaries.length,
5418
+ source: "provider-native"
5419
+ };
5420
+ }
5421
+ return {
5422
+ ...listSavedHistorySessions(agentType, { offset: options.offset, limit: options.limit }, options.historyBehavior),
5423
+ source: "adhdev-mirror"
5424
+ };
5425
+ }
4960
5426
  var fs3, path7, os6, HISTORY_DIR, RETAIN_DAYS, SAVED_HISTORY_INDEX_VERSION, SAVED_HISTORY_INDEX_FILE, SAVED_HISTORY_INDEX_LOCK_SUFFIX, SAVED_HISTORY_INDEX_LOCK_WAIT_MS, SAVED_HISTORY_INDEX_LOCK_STALE_MS, SAVED_HISTORY_INDEX_LOCK_POLL_MS, SAVED_HISTORY_ROLLUP_THRESHOLD_BYTES, savedHistorySessionCache, savedHistoryFileSummaryCache, savedHistoryBackgroundRefresh, savedHistoryRollupInFlight, ChatHistoryWriter;
4961
5427
  var init_chat_history = __esm({
4962
5428
  "../../oss/packages/daemon-core/src/config/chat-history.ts"() {
@@ -5960,6 +6426,8 @@ function validateReadChatResultPayload(raw, source = "read_chat") {
5960
6426
  if (raw.summaryMetadata !== void 0) normalized.summaryMetadata = raw.summaryMetadata;
5961
6427
  if (Array.isArray(raw.effects)) normalized.effects = raw.effects;
5962
6428
  if (typeof raw.providerSessionId === "string") normalized.providerSessionId = raw.providerSessionId;
6429
+ if (raw.transcriptAuthority === "provider" || raw.transcriptAuthority === "daemon") normalized.transcriptAuthority = raw.transcriptAuthority;
6430
+ if (raw.coverage === "full" || raw.coverage === "tail" || raw.coverage === "current-turn") normalized.coverage = raw.coverage;
5963
6431
  return normalized;
5964
6432
  }
5965
6433
  var VALID_STATUSES, VALID_ROLES, VALID_BUBBLE_STATES, VALID_TURN_STATUSES;
@@ -8227,7 +8695,16 @@ async function handleChatHistory(h, args) {
8227
8695
  const visibleCount = Array.isArray(status?.messages) ? status.messages.length : 0;
8228
8696
  if (visibleCount > excludeRecentCount) excludeRecentCount = visibleCount;
8229
8697
  }
8230
- const result = readChatHistory(agentStr, offset || 0, limit || 30, historySessionId, excludeRecentCount);
8698
+ const workspace = typeof args?.workspace === "string" ? args.workspace : typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : void 0;
8699
+ const result = readProviderChatHistory(agentStr, {
8700
+ canonicalHistory: provider?.canonicalHistory,
8701
+ historySessionId,
8702
+ workspace,
8703
+ offset: offset || 0,
8704
+ limit: limit || 30,
8705
+ excludeRecentCount,
8706
+ historyBehavior: provider?.historyBehavior
8707
+ });
8231
8708
  return { success: true, ...result, agent: agentStr };
8232
8709
  } catch (e) {
8233
8710
  return { success: false, error: e.message };
@@ -8252,7 +8729,8 @@ async function handleReadChat(h, args) {
8252
8729
  }
8253
8730
  const parsedRecord = parsedStatus && typeof parsedStatus === "object" ? parsedStatus : null;
8254
8731
  const adapterStatus = adapter.getStatus();
8255
- const shouldPreferAdapterMessages = Array.isArray(adapterStatus.messages) && adapterStatus.messages.length > 0 && Array.isArray(parsedRecord?.messages) && adapterStatus.messages.length > parsedRecord.messages.length;
8732
+ const parsedIsProviderAuthoritative = parsedRecord?.transcriptAuthority === "provider" || parsedRecord?.coverage === "full";
8733
+ const shouldPreferAdapterMessages = !parsedIsProviderAuthoritative && Array.isArray(adapterStatus.messages) && adapterStatus.messages.length > 0 && Array.isArray(parsedRecord?.messages) && adapterStatus.messages.length > parsedRecord.messages.length;
8256
8734
  const parsedShowsApproval = hasNonEmptyModalButtons(parsedRecord?.activeModal) && parsedRecord?.status === "waiting_approval";
8257
8735
  const status = parsedRecord ? {
8258
8736
  ...parsedRecord,
@@ -8262,6 +8740,8 @@ async function handleReadChat(h, args) {
8262
8740
  } : adapterStatus;
8263
8741
  const title = typeof parsedRecord?.title === "string" ? parsedRecord.title : void 0;
8264
8742
  const providerSessionId = typeof parsedRecord?.providerSessionId === "string" ? parsedRecord.providerSessionId : void 0;
8743
+ const transcriptAuthority = parsedRecord?.transcriptAuthority === "provider" || parsedRecord?.transcriptAuthority === "daemon" ? parsedRecord.transcriptAuthority : void 0;
8744
+ const coverage = parsedRecord?.coverage === "full" || parsedRecord?.coverage === "tail" || parsedRecord?.coverage === "current-turn" ? parsedRecord.coverage : void 0;
8265
8745
  if (status) {
8266
8746
  LOG.debug("Command", `[read_chat] cli-like resolved provider=${adapter.cliType} target=${String(args?.targetSessionId || "")} adapterStatus=${String(adapterStatus.status || "")} parsedStatus=${String(parsedRecord?.status || "")} shouldPreferAdapterMessages=${String(shouldPreferAdapterMessages)} adapterMsgCount=${Array.isArray(adapterStatus.messages) ? adapterStatus.messages.length : 0} parsedMsgCount=${Array.isArray(parsedRecord?.messages) ? parsedRecord.messages.length : 0} returnedMsgCount=${Array.isArray(status.messages) ? status.messages.length : 0}`);
8267
8747
  return buildReadChatCommandResult({
@@ -8280,7 +8760,9 @@ async function handleReadChat(h, args) {
8280
8760
  returnedMsgCount: Array.isArray(status.messages) ? status.messages.length : 0
8281
8761
  },
8282
8762
  ...title ? { title } : {},
8283
- ...providerSessionId ? { providerSessionId } : {}
8763
+ ...providerSessionId ? { providerSessionId } : {},
8764
+ ...transcriptAuthority ? { transcriptAuthority } : {},
8765
+ ...coverage ? { coverage } : {}
8284
8766
  }, args);
8285
8767
  }
8286
8768
  }
@@ -11072,18 +11554,18 @@ var init_source2 = __esm({
11072
11554
  }
11073
11555
  }
11074
11556
  });
11075
- createStyler2 = (open3, close, parent) => {
11557
+ createStyler2 = (open2, close, parent) => {
11076
11558
  let openAll;
11077
11559
  let closeAll;
11078
11560
  if (parent === void 0) {
11079
- openAll = open3;
11561
+ openAll = open2;
11080
11562
  closeAll = close;
11081
11563
  } else {
11082
- openAll = parent.openAll + open3;
11564
+ openAll = parent.openAll + open2;
11083
11565
  closeAll = close + parent.closeAll;
11084
11566
  }
11085
11567
  return {
11086
- open: open3,
11568
+ open: open2,
11087
11569
  close,
11088
11570
  openAll,
11089
11571
  closeAll,
@@ -11615,14 +12097,14 @@ function applyTerminalColorEnv(env3) {
11615
12097
  function ensureNodePtySpawnHelperPermissions(logFn) {
11616
12098
  if (os22.platform() === "win32") return;
11617
12099
  try {
11618
- const fs27 = __require("fs");
12100
+ const fs22 = __require("fs");
11619
12101
  const ptyDir = path32.resolve(path32.dirname(__require.resolve("node-pty")), "..");
11620
12102
  const platformArch = `${os22.platform()}-${os22.arch()}`;
11621
12103
  const helper = path32.join(ptyDir, "prebuilds", platformArch, "spawn-helper");
11622
- if (fs27.existsSync(helper)) {
11623
- const stat4 = fs27.statSync(helper);
12104
+ if (fs22.existsSync(helper)) {
12105
+ const stat4 = fs22.statSync(helper);
11624
12106
  if (!(stat4.mode & 73)) {
11625
- fs27.chmodSync(helper, stat4.mode | 493);
12107
+ fs22.chmodSync(helper, stat4.mode | 493);
11626
12108
  logFn?.(`Fixed spawn-helper permissions: ${helper}`);
11627
12109
  }
11628
12110
  }
@@ -12095,8 +12577,8 @@ var init_pty_transport = __esm({
12095
12577
  let cwd = options.cwd;
12096
12578
  if (cwd) {
12097
12579
  try {
12098
- const fs27 = require("fs");
12099
- const stat4 = fs27.statSync(cwd);
12580
+ const fs22 = require("fs");
12581
+ const stat4 = fs22.statSync(cwd);
12100
12582
  if (!stat4.isDirectory()) cwd = os10.homedir();
12101
12583
  } catch {
12102
12584
  cwd = os10.homedir();
@@ -12194,12 +12676,12 @@ function findBinary(name) {
12194
12676
  function isScriptBinary(binaryPath) {
12195
12677
  if (!path10.isAbsolute(binaryPath)) return false;
12196
12678
  try {
12197
- const fs27 = require("fs");
12198
- const resolved = fs27.realpathSync(binaryPath);
12679
+ const fs22 = require("fs");
12680
+ const resolved = fs22.realpathSync(binaryPath);
12199
12681
  const head = Buffer.alloc(8);
12200
- const fd = fs27.openSync(resolved, "r");
12201
- fs27.readSync(fd, head, 0, 8, 0);
12202
- fs27.closeSync(fd);
12682
+ const fd = fs22.openSync(resolved, "r");
12683
+ fs22.readSync(fd, head, 0, 8, 0);
12684
+ fs22.closeSync(fd);
12203
12685
  let i = 0;
12204
12686
  if (head[0] === 239 && head[1] === 187 && head[2] === 191) i = 3;
12205
12687
  return head[i] === 35 && head[i + 1] === 33;
@@ -12210,12 +12692,12 @@ function isScriptBinary(binaryPath) {
12210
12692
  function looksLikeMachOOrElf(filePath) {
12211
12693
  if (!path10.isAbsolute(filePath)) return false;
12212
12694
  try {
12213
- const fs27 = require("fs");
12214
- const resolved = fs27.realpathSync(filePath);
12695
+ const fs22 = require("fs");
12696
+ const resolved = fs22.realpathSync(filePath);
12215
12697
  const buf = Buffer.alloc(8);
12216
- const fd = fs27.openSync(resolved, "r");
12217
- fs27.readSync(fd, buf, 0, 8, 0);
12218
- fs27.closeSync(fd);
12698
+ const fd = fs22.openSync(resolved, "r");
12699
+ fs22.readSync(fd, buf, 0, 8, 0);
12700
+ fs22.closeSync(fd);
12219
12701
  let i = 0;
12220
12702
  if (buf[0] === 239 && buf[1] === 187 && buf[2] === 191) i = 3;
12221
12703
  const b = buf.subarray(i);
@@ -12774,7 +13256,9 @@ var provider_cli_adapter_exports = {};
12774
13256
  __export(provider_cli_adapter_exports, {
12775
13257
  ProviderCliAdapter: () => ProviderCliAdapter,
12776
13258
  appendBoundedText: () => appendBoundedText,
12777
- normalizeCliProviderForRuntime: () => normalizeCliProviderForRuntime
13259
+ normalizeCliProviderForRuntime: () => normalizeCliProviderForRuntime,
13260
+ sanitizeCliStandardMessageContent: () => sanitizeCliStandardMessageContent,
13261
+ trimLastAssistantEchoForCliMessages: () => trimLastAssistantEchoForCliMessages
12778
13262
  });
12779
13263
  function normalizeComparableTranscriptText(value) {
12780
13264
  return sanitizeTerminalText(String(value || "")).replace(/\s+/g, " ").trim();
@@ -12814,7 +13298,76 @@ function appendBoundedText(current, chunk, maxChars) {
12814
13298
  if (current.length <= keepFromCurrent) return current + chunk;
12815
13299
  return current.slice(-keepFromCurrent) + chunk;
12816
13300
  }
12817
- var os13, ProviderCliAdapter;
13301
+ function isLikelyCommittedActivityPrefixContinuation(line) {
13302
+ const trimmed = String(line || "").trim();
13303
+ if (!trimmed) return false;
13304
+ if (COMMITTED_ACTIVITY_PREFIX_BLOCK_RE.test(trimmed)) return false;
13305
+ if (/\s/.test(trimmed)) return false;
13306
+ if (/[가-힣]/.test(trimmed)) return false;
13307
+ if (trimmed.length > 96) return false;
13308
+ return /^[A-Za-z0-9_./:@+%=-]+$/.test(trimmed);
13309
+ }
13310
+ function parseCommittedActivityPrefixBlock(lines, index) {
13311
+ const first = String(lines[index] || "").trim();
13312
+ if (!COMMITTED_ACTIVITY_PREFIX_BLOCK_RE.test(first)) return null;
13313
+ const parts = [first];
13314
+ let nextIndex = index + 1;
13315
+ while (nextIndex < lines.length && isLikelyCommittedActivityPrefixContinuation(lines[nextIndex])) {
13316
+ parts.push(String(lines[nextIndex] || "").trim());
13317
+ nextIndex += 1;
13318
+ }
13319
+ return { label: parts.join(""), nextIndex };
13320
+ }
13321
+ function sanitizeCliStandardMessageContent(content) {
13322
+ const source = String(content || "").trim();
13323
+ if (!source) return "";
13324
+ const lines = source.split(/\r?\n/);
13325
+ if (lines.length < 4) return source;
13326
+ const counts = /* @__PURE__ */ new Map();
13327
+ for (let index = 0; index < lines.length; index += 1) {
13328
+ const block = parseCommittedActivityPrefixBlock(lines, index);
13329
+ if (!block) continue;
13330
+ counts.set(block.label, (counts.get(block.label) || 0) + 1);
13331
+ index = block.nextIndex - 1;
13332
+ }
13333
+ const repeatedLabels = new Set(
13334
+ Array.from(counts.entries()).filter(([, count]) => count >= 3).map(([label]) => label)
13335
+ );
13336
+ if (repeatedLabels.size === 0) return source;
13337
+ const stripped = [];
13338
+ let removed = 0;
13339
+ for (let index = 0; index < lines.length; index += 1) {
13340
+ const block = parseCommittedActivityPrefixBlock(lines, index);
13341
+ if (block && repeatedLabels.has(block.label)) {
13342
+ removed += 1;
13343
+ index = block.nextIndex - 1;
13344
+ continue;
13345
+ }
13346
+ stripped.push(lines[index]);
13347
+ }
13348
+ const next = stripped.join("\n").replace(/\n{3,}/g, "\n\n").trim();
13349
+ return removed >= 3 && next.length >= 80 ? next : source;
13350
+ }
13351
+ function sanitizeCommittedMessageForDisplay(message) {
13352
+ if (!message || message.role !== "assistant" || (message.kind || "standard") !== "standard") return message;
13353
+ const content = sanitizeCliStandardMessageContent(message.content);
13354
+ if (content === message.content) return message;
13355
+ return { ...message, content };
13356
+ }
13357
+ function trimLastAssistantEchoForCliMessages(messages, prompt2) {
13358
+ if (!prompt2) return;
13359
+ for (let index = messages.length - 1; index >= 0; index -= 1) {
13360
+ const message = messages[index];
13361
+ if (!message || message.role !== "assistant" || typeof message.content !== "string") continue;
13362
+ if ((message.kind || "standard") !== "standard") continue;
13363
+ message.content = trimPromptEchoPrefix(message.content, prompt2);
13364
+ if (!message.content.trim()) {
13365
+ messages.splice(index, 1);
13366
+ }
13367
+ return;
13368
+ }
13369
+ }
13370
+ var os13, COMMITTED_ACTIVITY_PREFIX_BLOCK_RE, ProviderCliAdapter;
12818
13371
  var init_provider_cli_adapter = __esm({
12819
13372
  "../../oss/packages/daemon-core/src/cli-adapters/provider-cli-adapter.ts"() {
12820
13373
  "use strict";
@@ -12830,6 +13383,7 @@ var init_provider_cli_adapter = __esm({
12830
13383
  init_provider_cli_config();
12831
13384
  init_provider_cli_runtime();
12832
13385
  init_provider_cli_shared();
13386
+ COMMITTED_ACTIVITY_PREFIX_BLOCK_RE = /^(?:📖|💻|🔎|📚|📋|✏️|📝|🔧|🛠️|⚙️)\s+(.+)$/;
12833
13387
  ProviderCliAdapter = class _ProviderCliAdapter {
12834
13388
  constructor(provider, workingDir, extraArgs = [], transportFactory = new NodePtyTransportFactory()) {
12835
13389
  this.extraArgs = extraArgs;
@@ -13010,7 +13564,14 @@ var init_provider_cli_adapter = __esm({
13010
13564
  }
13011
13565
  return null;
13012
13566
  }
13567
+ providerOwnsTranscript() {
13568
+ return this.provider.transcriptAuthority === "provider";
13569
+ }
13570
+ shouldUseFullProviderTranscriptContext() {
13571
+ return this.providerOwnsTranscript() && this.provider.transcriptContext === "full";
13572
+ }
13013
13573
  selectParseBaseMessages(baseMessages) {
13574
+ if (this.shouldUseFullProviderTranscriptContext()) return baseMessages;
13014
13575
  if (baseMessages.length <= _ProviderCliAdapter.PARSE_MESSAGE_TAIL_LIMIT) return baseMessages;
13015
13576
  return baseMessages.slice(-_ProviderCliAdapter.PARSE_MESSAGE_TAIL_LIMIT);
13016
13577
  }
@@ -13041,7 +13602,10 @@ var init_provider_cli_adapter = __esm({
13041
13602
  const tailFirst = parseBaseMessages[0];
13042
13603
  if (tailFirst && this.messagesComparable(parsedFirst, tailFirst)) {
13043
13604
  const prefixLength = fullBaseMessages.length - parseBaseMessages.length;
13044
- return [...fullBaseMessages.slice(0, prefixLength), ...parsedMessages];
13605
+ const prefix = fullBaseMessages.slice(0, prefixLength);
13606
+ const shouldSanitizePrefix = !!this.currentTurnScope || this.currentStatus !== "idle" || !!this.activeModal;
13607
+ const nextPrefix = shouldSanitizePrefix ? prefix.map((message) => sanitizeCommittedMessageForDisplay(message)) : prefix;
13608
+ return [...nextPrefix, ...parsedMessages];
13045
13609
  }
13046
13610
  return [...fullBaseMessages, ...parsedMessages];
13047
13611
  }
@@ -13490,9 +14054,7 @@ var init_provider_cli_adapter = __esm({
13490
14054
  );
13491
14055
  }
13492
14056
  trimLastAssistantEcho(messages, prompt2) {
13493
- if (!prompt2) return;
13494
- const last = [...messages].reverse().find((m) => m.role === "assistant" && typeof m.content === "string");
13495
- if (last) last.content = trimPromptEchoPrefix(last.content, prompt2);
14057
+ trimLastAssistantEchoForCliMessages(messages, prompt2);
13496
14058
  }
13497
14059
  clearAllTimers() {
13498
14060
  if (this.responseTimeout) {
@@ -14240,10 +14802,12 @@ var init_provider_cli_adapter = __esm({
14240
14802
  }
14241
14803
  buildCommittedChatMessages() {
14242
14804
  return this.committedMessages.map((message, index) => {
14243
- const contentValue = message.content;
14805
+ const rawContentValue = message.content;
14806
+ const rawContent = typeof rawContentValue === "string" ? rawContentValue : String(rawContentValue || "");
14807
+ const content = message.role === "assistant" && (message.kind || "standard") === "standard" ? sanitizeCliStandardMessageContent(rawContent) : rawContent;
14244
14808
  return buildChatMessage({
14245
14809
  role: message.role,
14246
- content: typeof contentValue === "string" ? contentValue : String(contentValue || ""),
14810
+ content,
14247
14811
  timestamp: message.timestamp,
14248
14812
  kind: message.kind,
14249
14813
  meta: message.meta,
@@ -14344,7 +14908,8 @@ var init_provider_cli_adapter = __esm({
14344
14908
  title: parsed.title || this.cliName,
14345
14909
  messages: hydratedMessages,
14346
14910
  activeModal: parsed.activeModal ?? this.activeModal,
14347
- providerSessionId: typeof parsed.providerSessionId === "string" ? parsed.providerSessionId : void 0
14911
+ providerSessionId: typeof parsed.providerSessionId === "string" ? parsed.providerSessionId : void 0,
14912
+ ...this.providerOwnsTranscript() ? { transcriptAuthority: "provider", coverage: this.shouldUseFullProviderTranscriptContext() ? "full" : "tail" } : {}
14348
14913
  };
14349
14914
  } else {
14350
14915
  const messages = [...this.committedMessages];
@@ -15236,6 +15801,8 @@ var init_cli_provider_instance = __esm({
15236
15801
  lastCanonicalHermesWatchPath = void 0;
15237
15802
  lastCanonicalClaudeRebuildMtimeMs = 0;
15238
15803
  lastCanonicalClaudeCheckAt = 0;
15804
+ lastCanonicalCodexRebuildMtimeMs = 0;
15805
+ lastCanonicalCodexCheckAt = 0;
15239
15806
  cachedSqliteDb = null;
15240
15807
  cachedSqliteDbPath = null;
15241
15808
  cachedSqliteDbMissingUntil = 0;
@@ -15935,6 +16502,25 @@ ${effect.notification.body || ""}`.trim();
15935
16502
  if (!this.providerSessionId) return false;
15936
16503
  const canonicalHistory = this.provider.canonicalHistory;
15937
16504
  if (!canonicalHistory) return false;
16505
+ if (isNativeSourceCanonicalHistory(canonicalHistory)) {
16506
+ const restoredHistory = readProviderChatHistory(this.type, {
16507
+ canonicalHistory,
16508
+ historySessionId: this.providerSessionId,
16509
+ workspace: this.workingDir,
16510
+ offset: 0,
16511
+ limit: Number.MAX_SAFE_INTEGER,
16512
+ historyBehavior: this.provider.historyBehavior
16513
+ });
16514
+ if (restoredHistory.source !== "provider-native") return false;
16515
+ this.lastPersistedHistoryMessages = restoredHistory.messages.map((message) => ({
16516
+ role: message.role,
16517
+ content: message.content,
16518
+ kind: message.kind,
16519
+ senderName: message.senderName,
16520
+ receivedAt: message.receivedAt
16521
+ }));
16522
+ return true;
16523
+ }
15938
16524
  try {
15939
16525
  let rebuilt = false;
15940
16526
  if (canonicalHistory.format === "hermes-json") {
@@ -15968,6 +16554,23 @@ ${effect.notification.body || ""}`.trim();
15968
16554
  if (transcriptMtime > 0 && transcriptMtime <= this.lastCanonicalClaudeRebuildMtimeMs) return true;
15969
16555
  rebuilt = rebuildClaudeSavedHistoryFromNativeProject(this.providerSessionId, this.workingDir);
15970
16556
  if (rebuilt) this.lastCanonicalClaudeRebuildMtimeMs = transcriptMtime || Date.now();
16557
+ } else if (canonicalHistory.format === "codex-jsonl") {
16558
+ const now = Date.now();
16559
+ if (now - this.lastCanonicalCodexCheckAt < 2e3 && this.lastCanonicalCodexRebuildMtimeMs !== 0) {
16560
+ return true;
16561
+ }
16562
+ this.lastCanonicalCodexCheckAt = now;
16563
+ const transcriptFile = resolveCodexSessionTranscriptPath(this.providerSessionId, this.workingDir);
16564
+ let transcriptMtime = 0;
16565
+ if (transcriptFile) {
16566
+ try {
16567
+ transcriptMtime = fs5.statSync(transcriptFile).mtimeMs;
16568
+ } catch {
16569
+ }
16570
+ }
16571
+ if (transcriptMtime > 0 && transcriptMtime <= this.lastCanonicalCodexRebuildMtimeMs) return true;
16572
+ rebuilt = rebuildCodexSavedHistoryFromNativeSession(this.providerSessionId, this.workingDir);
16573
+ if (rebuilt) this.lastCanonicalCodexRebuildMtimeMs = transcriptMtime || Date.now();
15971
16574
  }
15972
16575
  if (!rebuilt) return false;
15973
16576
  const restoredHistory = readChatHistory(this.type, 0, Number.MAX_SAFE_INTEGER, this.providerSessionId, 0, this.provider.historyBehavior);
@@ -15986,8 +16589,17 @@ ${effect.notification.body || ""}`.trim();
15986
16589
  restorePersistedHistoryFromCurrentSession() {
15987
16590
  if (!this.providerSessionId) return;
15988
16591
  this.syncCanonicalSavedHistoryIfNeeded();
15989
- this.historyWriter.compactHistorySession(this.type, this.providerSessionId, this.provider.historyBehavior);
15990
- const restoredHistory = readChatHistory(this.type, 0, Number.MAX_SAFE_INTEGER, this.providerSessionId, 0, this.provider.historyBehavior);
16592
+ const restoredHistory = isNativeSourceCanonicalHistory(this.provider.canonicalHistory) ? readProviderChatHistory(this.type, {
16593
+ canonicalHistory: this.provider.canonicalHistory,
16594
+ historySessionId: this.providerSessionId,
16595
+ workspace: this.workingDir,
16596
+ offset: 0,
16597
+ limit: Number.MAX_SAFE_INTEGER,
16598
+ historyBehavior: this.provider.historyBehavior
16599
+ }) : (() => {
16600
+ this.historyWriter.compactHistorySession(this.type, this.providerSessionId, this.provider.historyBehavior);
16601
+ return readChatHistory(this.type, 0, Number.MAX_SAFE_INTEGER, this.providerSessionId, 0, this.provider.historyBehavior);
16602
+ })();
15991
16603
  this.historyWriter.seedSessionHistory(
15992
16604
  this.type,
15993
16605
  restoredHistory.messages,
@@ -16314,10 +16926,10 @@ function mergeDefs(...defs) {
16314
16926
  function cloneDef(schema) {
16315
16927
  return mergeDefs(schema._zod.def);
16316
16928
  }
16317
- function getElementAtPath(obj, path36) {
16318
- if (!path36)
16929
+ function getElementAtPath(obj, path35) {
16930
+ if (!path35)
16319
16931
  return obj;
16320
- return path36.reduce((acc, key) => acc?.[key], obj);
16932
+ return path35.reduce((acc, key) => acc?.[key], obj);
16321
16933
  }
16322
16934
  function promiseAllObject(promisesObj) {
16323
16935
  const keys = Object.keys(promisesObj);
@@ -16629,11 +17241,11 @@ function aborted(x, startIndex = 0) {
16629
17241
  }
16630
17242
  return false;
16631
17243
  }
16632
- function prefixIssues(path36, issues) {
17244
+ function prefixIssues(path35, issues) {
16633
17245
  return issues.map((iss) => {
16634
17246
  var _a2;
16635
17247
  (_a2 = iss).path ?? (_a2.path = []);
16636
- iss.path.unshift(path36);
17248
+ iss.path.unshift(path35);
16637
17249
  return iss;
16638
17250
  });
16639
17251
  }
@@ -16876,7 +17488,7 @@ function formatError(error48, mapper = (issue2) => issue2.message) {
16876
17488
  }
16877
17489
  function treeifyError(error48, mapper = (issue2) => issue2.message) {
16878
17490
  const result = { errors: [] };
16879
- const processError = (error49, path36 = []) => {
17491
+ const processError = (error49, path35 = []) => {
16880
17492
  var _a2, _b;
16881
17493
  for (const issue2 of error49.issues) {
16882
17494
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -16886,7 +17498,7 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
16886
17498
  } else if (issue2.code === "invalid_element") {
16887
17499
  processError({ issues: issue2.issues }, issue2.path);
16888
17500
  } else {
16889
- const fullpath = [...path36, ...issue2.path];
17501
+ const fullpath = [...path35, ...issue2.path];
16890
17502
  if (fullpath.length === 0) {
16891
17503
  result.errors.push(mapper(issue2));
16892
17504
  continue;
@@ -16918,8 +17530,8 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
16918
17530
  }
16919
17531
  function toDotPath(_path) {
16920
17532
  const segs = [];
16921
- const path36 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
16922
- for (const seg of path36) {
17533
+ const path35 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
17534
+ for (const seg of path35) {
16923
17535
  if (typeof seg === "number")
16924
17536
  segs.push(`[${seg}]`);
16925
17537
  else if (typeof seg === "symbol")
@@ -29683,13 +30295,13 @@ function resolveRef(ref, ctx) {
29683
30295
  if (!ref.startsWith("#")) {
29684
30296
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
29685
30297
  }
29686
- const path36 = ref.slice(1).split("/").filter(Boolean);
29687
- if (path36.length === 0) {
30298
+ const path35 = ref.slice(1).split("/").filter(Boolean);
30299
+ if (path35.length === 0) {
29688
30300
  return ctx.rootSchema;
29689
30301
  }
29690
30302
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
29691
- if (path36[0] === defsKey) {
29692
- const key = path36[1];
30303
+ if (path35[0] === defsKey) {
30304
+ const key = path35[1];
29693
30305
  if (!key || !ctx.defs[key]) {
29694
30306
  throw new Error(`Reference not found: ${ref}`);
29695
30307
  }
@@ -34443,7 +35055,7 @@ var init_readdirp = __esm({
34443
35055
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
34444
35056
  const statMethod = opts.lstat ? import_promises.lstat : import_promises.stat;
34445
35057
  if (wantBigintFsStats) {
34446
- this._stat = (path36) => statMethod(path36, { bigint: true });
35058
+ this._stat = (path35) => statMethod(path35, { bigint: true });
34447
35059
  } else {
34448
35060
  this._stat = statMethod;
34449
35061
  }
@@ -34468,8 +35080,8 @@ var init_readdirp = __esm({
34468
35080
  const par = this.parent;
34469
35081
  const fil = par && par.files;
34470
35082
  if (fil && fil.length > 0) {
34471
- const { path: path36, depth } = par;
34472
- const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path36));
35083
+ const { path: path35, depth } = par;
35084
+ const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path35));
34473
35085
  const awaited = await Promise.all(slice);
34474
35086
  for (const entry of awaited) {
34475
35087
  if (!entry)
@@ -34509,21 +35121,21 @@ var init_readdirp = __esm({
34509
35121
  this.reading = false;
34510
35122
  }
34511
35123
  }
34512
- async _exploreDir(path36, depth) {
35124
+ async _exploreDir(path35, depth) {
34513
35125
  let files;
34514
35126
  try {
34515
- files = await (0, import_promises.readdir)(path36, this._rdOptions);
35127
+ files = await (0, import_promises.readdir)(path35, this._rdOptions);
34516
35128
  } catch (error48) {
34517
35129
  this._onError(error48);
34518
35130
  }
34519
- return { files, depth, path: path36 };
35131
+ return { files, depth, path: path35 };
34520
35132
  }
34521
- async _formatEntry(dirent, path36) {
35133
+ async _formatEntry(dirent, path35) {
34522
35134
  let entry;
34523
- const basename10 = this._isDirent ? dirent.name : dirent;
35135
+ const basename11 = this._isDirent ? dirent.name : dirent;
34524
35136
  try {
34525
- const fullPath = (0, import_node_path.resolve)((0, import_node_path.join)(path36, basename10));
34526
- entry = { path: (0, import_node_path.relative)(this._root, fullPath), fullPath, basename: basename10 };
35137
+ const fullPath = (0, import_node_path.resolve)((0, import_node_path.join)(path35, basename11));
35138
+ entry = { path: (0, import_node_path.relative)(this._root, fullPath), fullPath, basename: basename11 };
34527
35139
  entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
34528
35140
  } catch (err) {
34529
35141
  this._onError(err);
@@ -34579,16 +35191,16 @@ var init_readdirp = __esm({
34579
35191
  });
34580
35192
 
34581
35193
  // ../../oss/packages/daemon-core/node_modules/chokidar/handler.js
34582
- function createFsWatchInstance(path36, options, listener, errHandler, emitRaw) {
35194
+ function createFsWatchInstance(path35, options, listener, errHandler, emitRaw) {
34583
35195
  const handleEvent = (rawEvent, evPath) => {
34584
- listener(path36);
34585
- emitRaw(rawEvent, evPath, { watchedPath: path36 });
34586
- if (evPath && path36 !== evPath) {
34587
- fsWatchBroadcast(sp.resolve(path36, evPath), KEY_LISTENERS, sp.join(path36, evPath));
35196
+ listener(path35);
35197
+ emitRaw(rawEvent, evPath, { watchedPath: path35 });
35198
+ if (evPath && path35 !== evPath) {
35199
+ fsWatchBroadcast(sp.resolve(path35, evPath), KEY_LISTENERS, sp.join(path35, evPath));
34588
35200
  }
34589
35201
  };
34590
35202
  try {
34591
- return (0, import_node_fs.watch)(path36, {
35203
+ return (0, import_node_fs.watch)(path35, {
34592
35204
  persistent: options.persistent
34593
35205
  }, handleEvent);
34594
35206
  } catch (error48) {
@@ -34937,12 +35549,12 @@ var init_handler2 = __esm({
34937
35549
  listener(val1, val2, val3);
34938
35550
  });
34939
35551
  };
34940
- setFsWatchListener = (path36, fullPath, options, handlers) => {
35552
+ setFsWatchListener = (path35, fullPath, options, handlers) => {
34941
35553
  const { listener, errHandler, rawEmitter } = handlers;
34942
35554
  let cont = FsWatchInstances.get(fullPath);
34943
35555
  let watcher;
34944
35556
  if (!options.persistent) {
34945
- watcher = createFsWatchInstance(path36, options, listener, errHandler, rawEmitter);
35557
+ watcher = createFsWatchInstance(path35, options, listener, errHandler, rawEmitter);
34946
35558
  if (!watcher)
34947
35559
  return;
34948
35560
  return watcher.close.bind(watcher);
@@ -34953,7 +35565,7 @@ var init_handler2 = __esm({
34953
35565
  addAndConvert(cont, KEY_RAW, rawEmitter);
34954
35566
  } else {
34955
35567
  watcher = createFsWatchInstance(
34956
- path36,
35568
+ path35,
34957
35569
  options,
34958
35570
  fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS),
34959
35571
  errHandler,
@@ -34968,7 +35580,7 @@ var init_handler2 = __esm({
34968
35580
  cont.watcherUnusable = true;
34969
35581
  if (isWindows && error48.code === "EPERM") {
34970
35582
  try {
34971
- const fd = await (0, import_promises2.open)(path36, "r");
35583
+ const fd = await (0, import_promises2.open)(path35, "r");
34972
35584
  await fd.close();
34973
35585
  broadcastErr(error48);
34974
35586
  } catch (err) {
@@ -34999,7 +35611,7 @@ var init_handler2 = __esm({
34999
35611
  };
35000
35612
  };
35001
35613
  FsWatchFileInstances = /* @__PURE__ */ new Map();
35002
- setFsWatchFileListener = (path36, fullPath, options, handlers) => {
35614
+ setFsWatchFileListener = (path35, fullPath, options, handlers) => {
35003
35615
  const { listener, rawEmitter } = handlers;
35004
35616
  let cont = FsWatchFileInstances.get(fullPath);
35005
35617
  const copts = cont && cont.options;
@@ -35021,7 +35633,7 @@ var init_handler2 = __esm({
35021
35633
  });
35022
35634
  const currmtime = curr.mtimeMs;
35023
35635
  if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
35024
- foreach(cont.listeners, (listener2) => listener2(path36, curr));
35636
+ foreach(cont.listeners, (listener2) => listener2(path35, curr));
35025
35637
  }
35026
35638
  })
35027
35639
  };
@@ -35051,13 +35663,13 @@ var init_handler2 = __esm({
35051
35663
  * @param listener on fs change
35052
35664
  * @returns closer for the watcher instance
35053
35665
  */
35054
- _watchWithNodeFs(path36, listener) {
35666
+ _watchWithNodeFs(path35, listener) {
35055
35667
  const opts = this.fsw.options;
35056
- const directory = sp.dirname(path36);
35057
- const basename10 = sp.basename(path36);
35668
+ const directory = sp.dirname(path35);
35669
+ const basename11 = sp.basename(path35);
35058
35670
  const parent = this.fsw._getWatchedDir(directory);
35059
- parent.add(basename10);
35060
- const absolutePath = sp.resolve(path36);
35671
+ parent.add(basename11);
35672
+ const absolutePath = sp.resolve(path35);
35061
35673
  const options = {
35062
35674
  persistent: opts.persistent
35063
35675
  };
@@ -35066,13 +35678,13 @@ var init_handler2 = __esm({
35066
35678
  let closer;
35067
35679
  if (opts.usePolling) {
35068
35680
  const enableBin = opts.interval !== opts.binaryInterval;
35069
- options.interval = enableBin && isBinaryPath(basename10) ? opts.binaryInterval : opts.interval;
35070
- closer = setFsWatchFileListener(path36, absolutePath, options, {
35681
+ options.interval = enableBin && isBinaryPath(basename11) ? opts.binaryInterval : opts.interval;
35682
+ closer = setFsWatchFileListener(path35, absolutePath, options, {
35071
35683
  listener,
35072
35684
  rawEmitter: this.fsw._emitRaw
35073
35685
  });
35074
35686
  } else {
35075
- closer = setFsWatchListener(path36, absolutePath, options, {
35687
+ closer = setFsWatchListener(path35, absolutePath, options, {
35076
35688
  listener,
35077
35689
  errHandler: this._boundHandleError,
35078
35690
  rawEmitter: this.fsw._emitRaw
@@ -35089,12 +35701,12 @@ var init_handler2 = __esm({
35089
35701
  return;
35090
35702
  }
35091
35703
  const dirname11 = sp.dirname(file2);
35092
- const basename10 = sp.basename(file2);
35704
+ const basename11 = sp.basename(file2);
35093
35705
  const parent = this.fsw._getWatchedDir(dirname11);
35094
35706
  let prevStats = stats;
35095
- if (parent.has(basename10))
35707
+ if (parent.has(basename11))
35096
35708
  return;
35097
- const listener = async (path36, newStats) => {
35709
+ const listener = async (path35, newStats) => {
35098
35710
  if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file2, 5))
35099
35711
  return;
35100
35712
  if (!newStats || newStats.mtimeMs === 0) {
@@ -35108,18 +35720,18 @@ var init_handler2 = __esm({
35108
35720
  this.fsw._emit(EV.CHANGE, file2, newStats2);
35109
35721
  }
35110
35722
  if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats2.ino) {
35111
- this.fsw._closeFile(path36);
35723
+ this.fsw._closeFile(path35);
35112
35724
  prevStats = newStats2;
35113
35725
  const closer2 = this._watchWithNodeFs(file2, listener);
35114
35726
  if (closer2)
35115
- this.fsw._addPathCloser(path36, closer2);
35727
+ this.fsw._addPathCloser(path35, closer2);
35116
35728
  } else {
35117
35729
  prevStats = newStats2;
35118
35730
  }
35119
35731
  } catch (error48) {
35120
- this.fsw._remove(dirname11, basename10);
35732
+ this.fsw._remove(dirname11, basename11);
35121
35733
  }
35122
- } else if (parent.has(basename10)) {
35734
+ } else if (parent.has(basename11)) {
35123
35735
  const at = newStats.atimeMs;
35124
35736
  const mt = newStats.mtimeMs;
35125
35737
  if (!at || at <= mt || mt !== prevStats.mtimeMs) {
@@ -35144,7 +35756,7 @@ var init_handler2 = __esm({
35144
35756
  * @param item basename of this item
35145
35757
  * @returns true if no more processing is needed for this entry.
35146
35758
  */
35147
- async _handleSymlink(entry, directory, path36, item) {
35759
+ async _handleSymlink(entry, directory, path35, item) {
35148
35760
  if (this.fsw.closed) {
35149
35761
  return;
35150
35762
  }
@@ -35154,7 +35766,7 @@ var init_handler2 = __esm({
35154
35766
  this.fsw._incrReadyCount();
35155
35767
  let linkPath;
35156
35768
  try {
35157
- linkPath = await (0, import_promises2.realpath)(path36);
35769
+ linkPath = await (0, import_promises2.realpath)(path35);
35158
35770
  } catch (e) {
35159
35771
  this.fsw._emitReady();
35160
35772
  return true;
@@ -35164,12 +35776,12 @@ var init_handler2 = __esm({
35164
35776
  if (dir.has(item)) {
35165
35777
  if (this.fsw._symlinkPaths.get(full) !== linkPath) {
35166
35778
  this.fsw._symlinkPaths.set(full, linkPath);
35167
- this.fsw._emit(EV.CHANGE, path36, entry.stats);
35779
+ this.fsw._emit(EV.CHANGE, path35, entry.stats);
35168
35780
  }
35169
35781
  } else {
35170
35782
  dir.add(item);
35171
35783
  this.fsw._symlinkPaths.set(full, linkPath);
35172
- this.fsw._emit(EV.ADD, path36, entry.stats);
35784
+ this.fsw._emit(EV.ADD, path35, entry.stats);
35173
35785
  }
35174
35786
  this.fsw._emitReady();
35175
35787
  return true;
@@ -35199,9 +35811,9 @@ var init_handler2 = __esm({
35199
35811
  return;
35200
35812
  }
35201
35813
  const item = entry.path;
35202
- let path36 = sp.join(directory, item);
35814
+ let path35 = sp.join(directory, item);
35203
35815
  current.add(item);
35204
- if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path36, item)) {
35816
+ if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path35, item)) {
35205
35817
  return;
35206
35818
  }
35207
35819
  if (this.fsw.closed) {
@@ -35210,8 +35822,8 @@ var init_handler2 = __esm({
35210
35822
  }
35211
35823
  if (item === target || !target && !previous.has(item)) {
35212
35824
  this.fsw._incrReadyCount();
35213
- path36 = sp.join(dir, sp.relative(dir, path36));
35214
- this._addToNodeFs(path36, initialAdd, wh, depth + 1);
35825
+ path35 = sp.join(dir, sp.relative(dir, path35));
35826
+ this._addToNodeFs(path35, initialAdd, wh, depth + 1);
35215
35827
  }
35216
35828
  }).on(EV.ERROR, this._boundHandleError);
35217
35829
  return new Promise((resolve18, reject) => {
@@ -35280,13 +35892,13 @@ var init_handler2 = __esm({
35280
35892
  * @param depth Child path actually targeted for watch
35281
35893
  * @param target Child path actually targeted for watch
35282
35894
  */
35283
- async _addToNodeFs(path36, initialAdd, priorWh, depth, target) {
35895
+ async _addToNodeFs(path35, initialAdd, priorWh, depth, target) {
35284
35896
  const ready = this.fsw._emitReady;
35285
- if (this.fsw._isIgnored(path36) || this.fsw.closed) {
35897
+ if (this.fsw._isIgnored(path35) || this.fsw.closed) {
35286
35898
  ready();
35287
35899
  return false;
35288
35900
  }
35289
- const wh = this.fsw._getWatchHelpers(path36);
35901
+ const wh = this.fsw._getWatchHelpers(path35);
35290
35902
  if (priorWh) {
35291
35903
  wh.filterPath = (entry) => priorWh.filterPath(entry);
35292
35904
  wh.filterDir = (entry) => priorWh.filterDir(entry);
@@ -35302,8 +35914,8 @@ var init_handler2 = __esm({
35302
35914
  const follow = this.fsw.options.followSymlinks;
35303
35915
  let closer;
35304
35916
  if (stats.isDirectory()) {
35305
- const absPath = sp.resolve(path36);
35306
- const targetPath = follow ? await (0, import_promises2.realpath)(path36) : path36;
35917
+ const absPath = sp.resolve(path35);
35918
+ const targetPath = follow ? await (0, import_promises2.realpath)(path35) : path35;
35307
35919
  if (this.fsw.closed)
35308
35920
  return;
35309
35921
  closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
@@ -35313,29 +35925,29 @@ var init_handler2 = __esm({
35313
35925
  this.fsw._symlinkPaths.set(absPath, targetPath);
35314
35926
  }
35315
35927
  } else if (stats.isSymbolicLink()) {
35316
- const targetPath = follow ? await (0, import_promises2.realpath)(path36) : path36;
35928
+ const targetPath = follow ? await (0, import_promises2.realpath)(path35) : path35;
35317
35929
  if (this.fsw.closed)
35318
35930
  return;
35319
35931
  const parent = sp.dirname(wh.watchPath);
35320
35932
  this.fsw._getWatchedDir(parent).add(wh.watchPath);
35321
35933
  this.fsw._emit(EV.ADD, wh.watchPath, stats);
35322
- closer = await this._handleDir(parent, stats, initialAdd, depth, path36, wh, targetPath);
35934
+ closer = await this._handleDir(parent, stats, initialAdd, depth, path35, wh, targetPath);
35323
35935
  if (this.fsw.closed)
35324
35936
  return;
35325
35937
  if (targetPath !== void 0) {
35326
- this.fsw._symlinkPaths.set(sp.resolve(path36), targetPath);
35938
+ this.fsw._symlinkPaths.set(sp.resolve(path35), targetPath);
35327
35939
  }
35328
35940
  } else {
35329
35941
  closer = this._handleFile(wh.watchPath, stats, initialAdd);
35330
35942
  }
35331
35943
  ready();
35332
35944
  if (closer)
35333
- this.fsw._addPathCloser(path36, closer);
35945
+ this.fsw._addPathCloser(path35, closer);
35334
35946
  return false;
35335
35947
  } catch (error48) {
35336
35948
  if (this.fsw._handleError(error48)) {
35337
35949
  ready();
35338
- return path36;
35950
+ return path35;
35339
35951
  }
35340
35952
  }
35341
35953
  }
@@ -35370,24 +35982,24 @@ function createPattern(matcher) {
35370
35982
  }
35371
35983
  return () => false;
35372
35984
  }
35373
- function normalizePath(path36) {
35374
- if (typeof path36 !== "string")
35985
+ function normalizePath(path35) {
35986
+ if (typeof path35 !== "string")
35375
35987
  throw new Error("string expected");
35376
- path36 = sp2.normalize(path36);
35377
- path36 = path36.replace(/\\/g, "/");
35988
+ path35 = sp2.normalize(path35);
35989
+ path35 = path35.replace(/\\/g, "/");
35378
35990
  let prepend = false;
35379
- if (path36.startsWith("//"))
35991
+ if (path35.startsWith("//"))
35380
35992
  prepend = true;
35381
- path36 = path36.replace(DOUBLE_SLASH_RE, "/");
35993
+ path35 = path35.replace(DOUBLE_SLASH_RE, "/");
35382
35994
  if (prepend)
35383
- path36 = "/" + path36;
35384
- return path36;
35995
+ path35 = "/" + path35;
35996
+ return path35;
35385
35997
  }
35386
35998
  function matchPatterns(patterns, testString, stats) {
35387
- const path36 = normalizePath(testString);
35999
+ const path35 = normalizePath(testString);
35388
36000
  for (let index = 0; index < patterns.length; index++) {
35389
36001
  const pattern = patterns[index];
35390
- if (pattern(path36, stats)) {
36002
+ if (pattern(path35, stats)) {
35391
36003
  return true;
35392
36004
  }
35393
36005
  }
@@ -35450,19 +36062,19 @@ var init_chokidar = __esm({
35450
36062
  }
35451
36063
  return str;
35452
36064
  };
35453
- normalizePathToUnix = (path36) => toUnix(sp2.normalize(toUnix(path36)));
35454
- normalizeIgnored = (cwd = "") => (path36) => {
35455
- if (typeof path36 === "string") {
35456
- return normalizePathToUnix(sp2.isAbsolute(path36) ? path36 : sp2.join(cwd, path36));
36065
+ normalizePathToUnix = (path35) => toUnix(sp2.normalize(toUnix(path35)));
36066
+ normalizeIgnored = (cwd = "") => (path35) => {
36067
+ if (typeof path35 === "string") {
36068
+ return normalizePathToUnix(sp2.isAbsolute(path35) ? path35 : sp2.join(cwd, path35));
35457
36069
  } else {
35458
- return path36;
36070
+ return path35;
35459
36071
  }
35460
36072
  };
35461
- getAbsolutePath = (path36, cwd) => {
35462
- if (sp2.isAbsolute(path36)) {
35463
- return path36;
36073
+ getAbsolutePath = (path35, cwd) => {
36074
+ if (sp2.isAbsolute(path35)) {
36075
+ return path35;
35464
36076
  }
35465
- return sp2.join(cwd, path36);
36077
+ return sp2.join(cwd, path35);
35466
36078
  };
35467
36079
  EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
35468
36080
  DirEntry = class {
@@ -35527,10 +36139,10 @@ var init_chokidar = __esm({
35527
36139
  dirParts;
35528
36140
  followSymlinks;
35529
36141
  statMethod;
35530
- constructor(path36, follow, fsw) {
36142
+ constructor(path35, follow, fsw) {
35531
36143
  this.fsw = fsw;
35532
- const watchPath = path36;
35533
- this.path = path36 = path36.replace(REPLACER_RE, "");
36144
+ const watchPath = path35;
36145
+ this.path = path35 = path35.replace(REPLACER_RE, "");
35534
36146
  this.watchPath = watchPath;
35535
36147
  this.fullWatchPath = sp2.resolve(watchPath);
35536
36148
  this.dirParts = [];
@@ -35670,20 +36282,20 @@ var init_chokidar = __esm({
35670
36282
  this._closePromise = void 0;
35671
36283
  let paths = unifyPaths(paths_);
35672
36284
  if (cwd) {
35673
- paths = paths.map((path36) => {
35674
- const absPath = getAbsolutePath(path36, cwd);
36285
+ paths = paths.map((path35) => {
36286
+ const absPath = getAbsolutePath(path35, cwd);
35675
36287
  return absPath;
35676
36288
  });
35677
36289
  }
35678
- paths.forEach((path36) => {
35679
- this._removeIgnoredPath(path36);
36290
+ paths.forEach((path35) => {
36291
+ this._removeIgnoredPath(path35);
35680
36292
  });
35681
36293
  this._userIgnored = void 0;
35682
36294
  if (!this._readyCount)
35683
36295
  this._readyCount = 0;
35684
36296
  this._readyCount += paths.length;
35685
- Promise.all(paths.map(async (path36) => {
35686
- const res = await this._nodeFsHandler._addToNodeFs(path36, !_internal, void 0, 0, _origAdd);
36297
+ Promise.all(paths.map(async (path35) => {
36298
+ const res = await this._nodeFsHandler._addToNodeFs(path35, !_internal, void 0, 0, _origAdd);
35687
36299
  if (res)
35688
36300
  this._emitReady();
35689
36301
  return res;
@@ -35705,17 +36317,17 @@ var init_chokidar = __esm({
35705
36317
  return this;
35706
36318
  const paths = unifyPaths(paths_);
35707
36319
  const { cwd } = this.options;
35708
- paths.forEach((path36) => {
35709
- if (!sp2.isAbsolute(path36) && !this._closers.has(path36)) {
36320
+ paths.forEach((path35) => {
36321
+ if (!sp2.isAbsolute(path35) && !this._closers.has(path35)) {
35710
36322
  if (cwd)
35711
- path36 = sp2.join(cwd, path36);
35712
- path36 = sp2.resolve(path36);
36323
+ path35 = sp2.join(cwd, path35);
36324
+ path35 = sp2.resolve(path35);
35713
36325
  }
35714
- this._closePath(path36);
35715
- this._addIgnoredPath(path36);
35716
- if (this._watched.has(path36)) {
36326
+ this._closePath(path35);
36327
+ this._addIgnoredPath(path35);
36328
+ if (this._watched.has(path35)) {
35717
36329
  this._addIgnoredPath({
35718
- path: path36,
36330
+ path: path35,
35719
36331
  recursive: true
35720
36332
  });
35721
36333
  }
@@ -35779,38 +36391,38 @@ var init_chokidar = __esm({
35779
36391
  * @param stats arguments to be passed with event
35780
36392
  * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
35781
36393
  */
35782
- async _emit(event, path36, stats) {
36394
+ async _emit(event, path35, stats) {
35783
36395
  if (this.closed)
35784
36396
  return;
35785
36397
  const opts = this.options;
35786
36398
  if (isWindows)
35787
- path36 = sp2.normalize(path36);
36399
+ path35 = sp2.normalize(path35);
35788
36400
  if (opts.cwd)
35789
- path36 = sp2.relative(opts.cwd, path36);
35790
- const args = [path36];
36401
+ path35 = sp2.relative(opts.cwd, path35);
36402
+ const args = [path35];
35791
36403
  if (stats != null)
35792
36404
  args.push(stats);
35793
36405
  const awf = opts.awaitWriteFinish;
35794
36406
  let pw;
35795
- if (awf && (pw = this._pendingWrites.get(path36))) {
36407
+ if (awf && (pw = this._pendingWrites.get(path35))) {
35796
36408
  pw.lastChange = /* @__PURE__ */ new Date();
35797
36409
  return this;
35798
36410
  }
35799
36411
  if (opts.atomic) {
35800
36412
  if (event === EVENTS.UNLINK) {
35801
- this._pendingUnlinks.set(path36, [event, ...args]);
36413
+ this._pendingUnlinks.set(path35, [event, ...args]);
35802
36414
  setTimeout(() => {
35803
- this._pendingUnlinks.forEach((entry, path37) => {
36415
+ this._pendingUnlinks.forEach((entry, path36) => {
35804
36416
  this.emit(...entry);
35805
36417
  this.emit(EVENTS.ALL, ...entry);
35806
- this._pendingUnlinks.delete(path37);
36418
+ this._pendingUnlinks.delete(path36);
35807
36419
  });
35808
36420
  }, typeof opts.atomic === "number" ? opts.atomic : 100);
35809
36421
  return this;
35810
36422
  }
35811
- if (event === EVENTS.ADD && this._pendingUnlinks.has(path36)) {
36423
+ if (event === EVENTS.ADD && this._pendingUnlinks.has(path35)) {
35812
36424
  event = EVENTS.CHANGE;
35813
- this._pendingUnlinks.delete(path36);
36425
+ this._pendingUnlinks.delete(path35);
35814
36426
  }
35815
36427
  }
35816
36428
  if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
@@ -35828,16 +36440,16 @@ var init_chokidar = __esm({
35828
36440
  this.emitWithAll(event, args);
35829
36441
  }
35830
36442
  };
35831
- this._awaitWriteFinish(path36, awf.stabilityThreshold, event, awfEmit);
36443
+ this._awaitWriteFinish(path35, awf.stabilityThreshold, event, awfEmit);
35832
36444
  return this;
35833
36445
  }
35834
36446
  if (event === EVENTS.CHANGE) {
35835
- const isThrottled = !this._throttle(EVENTS.CHANGE, path36, 50);
36447
+ const isThrottled = !this._throttle(EVENTS.CHANGE, path35, 50);
35836
36448
  if (isThrottled)
35837
36449
  return this;
35838
36450
  }
35839
36451
  if (opts.alwaysStat && stats === void 0 && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
35840
- const fullPath = opts.cwd ? sp2.join(opts.cwd, path36) : path36;
36452
+ const fullPath = opts.cwd ? sp2.join(opts.cwd, path35) : path35;
35841
36453
  let stats2;
35842
36454
  try {
35843
36455
  stats2 = await (0, import_promises3.stat)(fullPath);
@@ -35868,23 +36480,23 @@ var init_chokidar = __esm({
35868
36480
  * @param timeout duration of time to suppress duplicate actions
35869
36481
  * @returns tracking object or false if action should be suppressed
35870
36482
  */
35871
- _throttle(actionType, path36, timeout) {
36483
+ _throttle(actionType, path35, timeout) {
35872
36484
  if (!this._throttled.has(actionType)) {
35873
36485
  this._throttled.set(actionType, /* @__PURE__ */ new Map());
35874
36486
  }
35875
36487
  const action = this._throttled.get(actionType);
35876
36488
  if (!action)
35877
36489
  throw new Error("invalid throttle");
35878
- const actionPath = action.get(path36);
36490
+ const actionPath = action.get(path35);
35879
36491
  if (actionPath) {
35880
36492
  actionPath.count++;
35881
36493
  return false;
35882
36494
  }
35883
36495
  let timeoutObject;
35884
36496
  const clear = () => {
35885
- const item = action.get(path36);
36497
+ const item = action.get(path35);
35886
36498
  const count = item ? item.count : 0;
35887
- action.delete(path36);
36499
+ action.delete(path35);
35888
36500
  clearTimeout(timeoutObject);
35889
36501
  if (item)
35890
36502
  clearTimeout(item.timeoutObject);
@@ -35892,7 +36504,7 @@ var init_chokidar = __esm({
35892
36504
  };
35893
36505
  timeoutObject = setTimeout(clear, timeout);
35894
36506
  const thr = { timeoutObject, clear, count: 0 };
35895
- action.set(path36, thr);
36507
+ action.set(path35, thr);
35896
36508
  return thr;
35897
36509
  }
35898
36510
  _incrReadyCount() {
@@ -35906,44 +36518,44 @@ var init_chokidar = __esm({
35906
36518
  * @param event
35907
36519
  * @param awfEmit Callback to be called when ready for event to be emitted.
35908
36520
  */
35909
- _awaitWriteFinish(path36, threshold, event, awfEmit) {
36521
+ _awaitWriteFinish(path35, threshold, event, awfEmit) {
35910
36522
  const awf = this.options.awaitWriteFinish;
35911
36523
  if (typeof awf !== "object")
35912
36524
  return;
35913
36525
  const pollInterval = awf.pollInterval;
35914
36526
  let timeoutHandler;
35915
- let fullPath = path36;
35916
- if (this.options.cwd && !sp2.isAbsolute(path36)) {
35917
- fullPath = sp2.join(this.options.cwd, path36);
36527
+ let fullPath = path35;
36528
+ if (this.options.cwd && !sp2.isAbsolute(path35)) {
36529
+ fullPath = sp2.join(this.options.cwd, path35);
35918
36530
  }
35919
36531
  const now = /* @__PURE__ */ new Date();
35920
36532
  const writes = this._pendingWrites;
35921
36533
  function awaitWriteFinishFn(prevStat) {
35922
36534
  (0, import_node_fs2.stat)(fullPath, (err, curStat) => {
35923
- if (err || !writes.has(path36)) {
36535
+ if (err || !writes.has(path35)) {
35924
36536
  if (err && err.code !== "ENOENT")
35925
36537
  awfEmit(err);
35926
36538
  return;
35927
36539
  }
35928
36540
  const now2 = Number(/* @__PURE__ */ new Date());
35929
36541
  if (prevStat && curStat.size !== prevStat.size) {
35930
- writes.get(path36).lastChange = now2;
36542
+ writes.get(path35).lastChange = now2;
35931
36543
  }
35932
- const pw = writes.get(path36);
36544
+ const pw = writes.get(path35);
35933
36545
  const df = now2 - pw.lastChange;
35934
36546
  if (df >= threshold) {
35935
- writes.delete(path36);
36547
+ writes.delete(path35);
35936
36548
  awfEmit(void 0, curStat);
35937
36549
  } else {
35938
36550
  timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
35939
36551
  }
35940
36552
  });
35941
36553
  }
35942
- if (!writes.has(path36)) {
35943
- writes.set(path36, {
36554
+ if (!writes.has(path35)) {
36555
+ writes.set(path35, {
35944
36556
  lastChange: now,
35945
36557
  cancelWait: () => {
35946
- writes.delete(path36);
36558
+ writes.delete(path35);
35947
36559
  clearTimeout(timeoutHandler);
35948
36560
  return event;
35949
36561
  }
@@ -35954,8 +36566,8 @@ var init_chokidar = __esm({
35954
36566
  /**
35955
36567
  * Determines whether user has asked to ignore this path.
35956
36568
  */
35957
- _isIgnored(path36, stats) {
35958
- if (this.options.atomic && DOT_RE.test(path36))
36569
+ _isIgnored(path35, stats) {
36570
+ if (this.options.atomic && DOT_RE.test(path35))
35959
36571
  return true;
35960
36572
  if (!this._userIgnored) {
35961
36573
  const { cwd } = this.options;
@@ -35965,17 +36577,17 @@ var init_chokidar = __esm({
35965
36577
  const list = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored];
35966
36578
  this._userIgnored = anymatch(list, void 0);
35967
36579
  }
35968
- return this._userIgnored(path36, stats);
36580
+ return this._userIgnored(path35, stats);
35969
36581
  }
35970
- _isntIgnored(path36, stat4) {
35971
- return !this._isIgnored(path36, stat4);
36582
+ _isntIgnored(path35, stat4) {
36583
+ return !this._isIgnored(path35, stat4);
35972
36584
  }
35973
36585
  /**
35974
36586
  * Provides a set of common helpers and properties relating to symlink handling.
35975
36587
  * @param path file or directory pattern being watched
35976
36588
  */
35977
- _getWatchHelpers(path36) {
35978
- return new WatchHelper(path36, this.options.followSymlinks, this);
36589
+ _getWatchHelpers(path35) {
36590
+ return new WatchHelper(path35, this.options.followSymlinks, this);
35979
36591
  }
35980
36592
  // Directory helpers
35981
36593
  // -----------------
@@ -36007,63 +36619,63 @@ var init_chokidar = __esm({
36007
36619
  * @param item base path of item/directory
36008
36620
  */
36009
36621
  _remove(directory, item, isDirectory) {
36010
- const path36 = sp2.join(directory, item);
36011
- const fullPath = sp2.resolve(path36);
36012
- isDirectory = isDirectory != null ? isDirectory : this._watched.has(path36) || this._watched.has(fullPath);
36013
- if (!this._throttle("remove", path36, 100))
36622
+ const path35 = sp2.join(directory, item);
36623
+ const fullPath = sp2.resolve(path35);
36624
+ isDirectory = isDirectory != null ? isDirectory : this._watched.has(path35) || this._watched.has(fullPath);
36625
+ if (!this._throttle("remove", path35, 100))
36014
36626
  return;
36015
36627
  if (!isDirectory && this._watched.size === 1) {
36016
36628
  this.add(directory, item, true);
36017
36629
  }
36018
- const wp = this._getWatchedDir(path36);
36630
+ const wp = this._getWatchedDir(path35);
36019
36631
  const nestedDirectoryChildren = wp.getChildren();
36020
- nestedDirectoryChildren.forEach((nested) => this._remove(path36, nested));
36632
+ nestedDirectoryChildren.forEach((nested) => this._remove(path35, nested));
36021
36633
  const parent = this._getWatchedDir(directory);
36022
36634
  const wasTracked = parent.has(item);
36023
36635
  parent.remove(item);
36024
36636
  if (this._symlinkPaths.has(fullPath)) {
36025
36637
  this._symlinkPaths.delete(fullPath);
36026
36638
  }
36027
- let relPath = path36;
36639
+ let relPath = path35;
36028
36640
  if (this.options.cwd)
36029
- relPath = sp2.relative(this.options.cwd, path36);
36641
+ relPath = sp2.relative(this.options.cwd, path35);
36030
36642
  if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
36031
36643
  const event = this._pendingWrites.get(relPath).cancelWait();
36032
36644
  if (event === EVENTS.ADD)
36033
36645
  return;
36034
36646
  }
36035
- this._watched.delete(path36);
36647
+ this._watched.delete(path35);
36036
36648
  this._watched.delete(fullPath);
36037
36649
  const eventName = isDirectory ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
36038
- if (wasTracked && !this._isIgnored(path36))
36039
- this._emit(eventName, path36);
36040
- this._closePath(path36);
36650
+ if (wasTracked && !this._isIgnored(path35))
36651
+ this._emit(eventName, path35);
36652
+ this._closePath(path35);
36041
36653
  }
36042
36654
  /**
36043
36655
  * Closes all watchers for a path
36044
36656
  */
36045
- _closePath(path36) {
36046
- this._closeFile(path36);
36047
- const dir = sp2.dirname(path36);
36048
- this._getWatchedDir(dir).remove(sp2.basename(path36));
36657
+ _closePath(path35) {
36658
+ this._closeFile(path35);
36659
+ const dir = sp2.dirname(path35);
36660
+ this._getWatchedDir(dir).remove(sp2.basename(path35));
36049
36661
  }
36050
36662
  /**
36051
36663
  * Closes only file-specific watchers
36052
36664
  */
36053
- _closeFile(path36) {
36054
- const closers = this._closers.get(path36);
36665
+ _closeFile(path35) {
36666
+ const closers = this._closers.get(path35);
36055
36667
  if (!closers)
36056
36668
  return;
36057
36669
  closers.forEach((closer) => closer());
36058
- this._closers.delete(path36);
36670
+ this._closers.delete(path35);
36059
36671
  }
36060
- _addPathCloser(path36, closer) {
36672
+ _addPathCloser(path35, closer) {
36061
36673
  if (!closer)
36062
36674
  return;
36063
- let list = this._closers.get(path36);
36675
+ let list = this._closers.get(path35);
36064
36676
  if (!list) {
36065
36677
  list = [];
36066
- this._closers.set(path36, list);
36678
+ this._closers.set(path35, list);
36067
36679
  }
36068
36680
  list.push(closer);
36069
36681
  }
@@ -37812,6 +38424,43 @@ var init_provider_loader = __esm({
37812
38424
  }
37813
38425
  });
37814
38426
 
38427
+ // ../../oss/packages/daemon-core/src/launch/macos-app-process.ts
38428
+ function normalizeMacAppPath(appPath) {
38429
+ const trimmed = String(appPath || "").trim();
38430
+ if (!trimmed) return null;
38431
+ return trimmed.replace(/\/+$/, "");
38432
+ }
38433
+ function parsePsLine(line) {
38434
+ const match = line.match(/^\s*(\d+)\s+(.+)$/);
38435
+ if (!match) return null;
38436
+ const pid = Number.parseInt(match[1], 10);
38437
+ if (!Number.isFinite(pid)) return null;
38438
+ return { pid, args: match[2] };
38439
+ }
38440
+ function isMacAppProcessArgs(args, appPath) {
38441
+ const normalized = normalizeMacAppPath(appPath);
38442
+ if (!normalized) return false;
38443
+ return String(args || "").startsWith(`${normalized}/`);
38444
+ }
38445
+ function findMacAppProcessPids(psOutput, appPaths) {
38446
+ const normalizedPaths = appPaths.map(normalizeMacAppPath).filter((value) => !!value);
38447
+ if (normalizedPaths.length === 0) return [];
38448
+ const pids = [];
38449
+ for (const line of String(psOutput || "").split(/\r?\n/)) {
38450
+ const parsed = parsePsLine(line);
38451
+ if (!parsed) continue;
38452
+ if (normalizedPaths.some((appPath) => isMacAppProcessArgs(parsed.args, appPath))) {
38453
+ pids.push(parsed.pid);
38454
+ }
38455
+ }
38456
+ return pids;
38457
+ }
38458
+ var init_macos_app_process = __esm({
38459
+ "../../oss/packages/daemon-core/src/launch/macos-app-process.ts"() {
38460
+ "use strict";
38461
+ }
38462
+ });
38463
+
37815
38464
  // ../../oss/packages/daemon-core/src/launch.ts
37816
38465
  function getProviderLoader() {
37817
38466
  if (!_providerLoader) {
@@ -37834,9 +38483,9 @@ function getWinProcessNames() {
37834
38483
  function getProviderMeta(ideId) {
37835
38484
  return getProviderLoader().getMeta(ideId);
37836
38485
  }
37837
- function getPreferredLaunchMethod(ideId, platform13) {
38486
+ function getPreferredLaunchMethod(ideId, platform12) {
37838
38487
  const prefer = getProviderMeta(ideId)?.launch?.prefer;
37839
- const value = prefer?.[platform13];
38488
+ const value = prefer?.[platform12];
37840
38489
  return value === "cli" || value === "app" || value === "auto" ? value : "auto";
37841
38490
  }
37842
38491
  function getCdpStartupTimeoutMs(ideId) {
@@ -37847,6 +38496,35 @@ function getCdpStartupTimeoutMs(ideId) {
37847
38496
  function escapeForAppleScript(value) {
37848
38497
  return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
37849
38498
  }
38499
+ function getIdePathCandidates(ideId) {
38500
+ return getProviderLoader().getIdePathCandidates(ideId);
38501
+ }
38502
+ function getMacAppProcessPids(ideId) {
38503
+ const appPaths = getIdePathCandidates(ideId);
38504
+ if (appPaths.length === 0) return [];
38505
+ try {
38506
+ const output = (0, import_child_process7.execSync)("ps axww -o pid=,args=", {
38507
+ encoding: "utf-8",
38508
+ timeout: 3e3,
38509
+ stdio: ["pipe", "pipe", "pipe"]
38510
+ });
38511
+ return findMacAppProcessPids(output, appPaths);
38512
+ } catch {
38513
+ return [];
38514
+ }
38515
+ }
38516
+ function killMacAppPathProcesses(ideId, signal) {
38517
+ const pids = getMacAppProcessPids(ideId);
38518
+ let signalled = false;
38519
+ for (const pid of pids) {
38520
+ try {
38521
+ process.kill(pid, signal);
38522
+ signalled = true;
38523
+ } catch {
38524
+ }
38525
+ }
38526
+ return signalled;
38527
+ }
37850
38528
  async function findFreePort(ports) {
37851
38529
  for (const port2 of ports) {
37852
38530
  const free = await checkPortFree(port2);
@@ -37908,6 +38586,7 @@ async function killIdeProcess(ideId) {
37908
38586
  } catch {
37909
38587
  }
37910
38588
  }
38589
+ killMacAppPathProcesses(ideId, "SIGTERM");
37911
38590
  } else if (plat === "win32" && winProcesses) {
37912
38591
  for (const proc of winProcesses) {
37913
38592
  try {
@@ -37937,6 +38616,7 @@ async function killIdeProcess(ideId) {
37937
38616
  (0, import_child_process7.execSync)(`pkill -9 -x "${appName}" 2>/dev/null`, { timeout: 5e3 });
37938
38617
  } catch {
37939
38618
  }
38619
+ killMacAppPathProcesses(ideId, "SIGKILL");
37940
38620
  } else if (plat === "win32" && winProcesses) {
37941
38621
  for (const proc of winProcesses) {
37942
38622
  try {
@@ -37956,14 +38636,16 @@ function isIdeRunning(ideId) {
37956
38636
  try {
37957
38637
  if (plat === "darwin") {
37958
38638
  const appName = getMacAppIdentifiers()[ideId];
37959
- if (!appName) return false;
38639
+ if (!appName) return getMacAppProcessPids(ideId).length > 0;
37960
38640
  try {
37961
38641
  const result = (0, import_child_process7.execSync)(`pgrep -x "${appName}" 2>/dev/null`, {
37962
38642
  encoding: "utf-8",
37963
38643
  timeout: 3e3
37964
38644
  });
37965
- return result.trim().length > 0;
38645
+ if (result.trim().length > 0) return true;
37966
38646
  } catch {
38647
+ }
38648
+ try {
37967
38649
  const result = (0, import_child_process7.execSync)(
37968
38650
  `osascript -e 'tell application "System Events" to count (every process whose name is "${escapeForAppleScript(appName)}")'`,
37969
38651
  {
@@ -37972,8 +38654,10 @@ function isIdeRunning(ideId) {
37972
38654
  stdio: ["pipe", "pipe", "pipe"]
37973
38655
  }
37974
38656
  );
37975
- return Number.parseInt(result.trim() || "0", 10) > 0;
38657
+ if (Number.parseInt(result.trim() || "0", 10) > 0) return true;
38658
+ } catch {
37976
38659
  }
38660
+ return getMacAppProcessPids(ideId).length > 0;
37977
38661
  } else if (plat === "win32") {
37978
38662
  const winProcesses = getWinProcessNames()[ideId];
37979
38663
  if (!winProcesses) return false;
@@ -38018,7 +38702,7 @@ function detectCurrentWorkspace(ideId) {
38018
38702
  }
38019
38703
  } else if (plat === "win32") {
38020
38704
  try {
38021
- const fs27 = require("fs");
38705
+ const fs22 = require("fs");
38022
38706
  const appNameMap = getMacAppIdentifiers();
38023
38707
  const appName = appNameMap[ideId];
38024
38708
  if (appName) {
@@ -38027,8 +38711,8 @@ function detectCurrentWorkspace(ideId) {
38027
38711
  appName,
38028
38712
  "storage.json"
38029
38713
  );
38030
- if (fs27.existsSync(storagePath)) {
38031
- const data = JSON.parse(fs27.readFileSync(storagePath, "utf-8"));
38714
+ if (fs22.existsSync(storagePath)) {
38715
+ const data = JSON.parse(fs22.readFileSync(storagePath, "utf-8"));
38032
38716
  const workspaces = data?.openedPathsList?.workspaces3 || data?.openedPathsList?.entries || [];
38033
38717
  if (workspaces.length > 0) {
38034
38718
  const recent = workspaces[0];
@@ -38045,7 +38729,7 @@ function detectCurrentWorkspace(ideId) {
38045
38729
  return void 0;
38046
38730
  }
38047
38731
  async function launchWithCdp(options = {}) {
38048
- const platform13 = os17.platform();
38732
+ const platform12 = os17.platform();
38049
38733
  let targetIde;
38050
38734
  const ides = await detectIDEs(getProviderLoader());
38051
38735
  if (options.ideId) {
@@ -38114,9 +38798,9 @@ async function launchWithCdp(options = {}) {
38114
38798
  }
38115
38799
  const port = await findFreePort(portPair);
38116
38800
  try {
38117
- if (platform13 === "darwin") {
38801
+ if (platform12 === "darwin") {
38118
38802
  await launchMacOS(targetIde, port, workspace, options.newWindow);
38119
- } else if (platform13 === "win32") {
38803
+ } else if (platform12 === "win32") {
38120
38804
  await launchWindows(targetIde, port, workspace, options.newWindow);
38121
38805
  } else {
38122
38806
  await launchLinux(targetIde, port, workspace, options.newWindow);
@@ -38204,6 +38888,7 @@ var init_launch = __esm({
38204
38888
  path15 = __toESM(require("path"));
38205
38889
  init_ide_detector();
38206
38890
  init_provider_loader();
38891
+ init_macos_app_process();
38207
38892
  _providerLoader = null;
38208
38893
  }
38209
38894
  });
@@ -39396,13 +40081,18 @@ var init_router = __esm({
39396
40081
  const wantsAll = args?.all === true;
39397
40082
  const offset = wantsAll ? 0 : Math.max(0, Number(args?.offset) || 0);
39398
40083
  const limit = wantsAll ? Number.MAX_SAFE_INTEGER : Math.max(1, Math.min(100, Number(args?.limit) || 30));
39399
- const { sessions: historySessions, hasMore } = listSavedHistorySessions(providerType, { offset, limit });
40084
+ const providerMeta = this.deps.providerLoader.getMeta(providerType);
40085
+ const { sessions: historySessions, hasMore, source } = listProviderHistorySessions(providerType, {
40086
+ canonicalHistory: providerMeta?.canonicalHistory,
40087
+ offset,
40088
+ limit,
40089
+ historyBehavior: providerMeta?.historyBehavior
40090
+ });
39400
40091
  const state = loadState();
39401
40092
  const savedSessions = getSavedProviderSessions(state, { providerType, kind });
39402
40093
  const recentSessions = getRecentActivity(state, 200).filter((entry) => entry.providerType === providerType && entry.kind === kind && entry.providerSessionId);
39403
40094
  const savedSessionById = new Map(savedSessions.map((entry) => [entry.providerSessionId, entry]));
39404
40095
  const recentSessionById = new Map(recentSessions.map((entry) => [entry.providerSessionId, entry]));
39405
- const providerMeta = this.deps.providerLoader.getMeta(providerType);
39406
40096
  const canResumeById = supportsExplicitSessionResume(providerMeta?.resume);
39407
40097
  return {
39408
40098
  success: true,
@@ -39425,7 +40115,8 @@ var init_router = __esm({
39425
40115
  canResume: !!(saved?.workspace || recent?.workspace || session.workspace) && canResumeById
39426
40116
  };
39427
40117
  }),
39428
- hasMore
40118
+ hasMore,
40119
+ source
39429
40120
  };
39430
40121
  }
39431
40122
  // ─── restart_session: IDE / CLI / ACP unified ───
@@ -45461,8 +46152,8 @@ var init_dev_server = __esm({
45461
46152
  }
45462
46153
  getEndpointList() {
45463
46154
  return this.routes.map((r) => {
45464
- const path36 = typeof r.pattern === "string" ? r.pattern : r.pattern.source.replace(/\\\//g, "/").replace(/\(\[.*?\]\+\)/g, ":type").replace(/[\^$]/g, "");
45465
- return `${r.method.padEnd(5)} ${path36}`;
46155
+ const path35 = typeof r.pattern === "string" ? r.pattern : r.pattern.source.replace(/\\\//g, "/").replace(/\(\[.*?\]\+\)/g, ":type").replace(/[\^$]/g, "");
46156
+ return `${r.method.padEnd(5)} ${path35}`;
45466
46157
  });
45467
46158
  }
45468
46159
  async start(port = DEV_SERVER_PORT) {
@@ -47404,8 +48095,8 @@ async function installExtension(ide, extension) {
47404
48095
  const res = await fetch(extension.vsixUrl);
47405
48096
  if (res.ok) {
47406
48097
  const buffer = Buffer.from(await res.arrayBuffer());
47407
- const fs27 = await import("fs");
47408
- fs27.writeFileSync(vsixPath, buffer);
48098
+ const fs22 = await import("fs");
48099
+ fs22.writeFileSync(vsixPath, buffer);
47409
48100
  return new Promise((resolve18) => {
47410
48101
  const cmd = `"${ide.cliCommand}" --install-extension "${vsixPath}" --force`;
47411
48102
  (0, import_child_process11.exec)(cmd, { timeout: 6e4 }, (error48, _stdout, stderr) => {
@@ -48356,11 +49047,11 @@ var require_yoctocolors_cjs = __commonJS({
48356
49047
  "use strict";
48357
49048
  var tty3 = require("tty");
48358
49049
  var hasColors = tty3?.WriteStream?.prototype?.hasColors?.() ?? false;
48359
- var format = (open3, close) => {
49050
+ var format = (open2, close) => {
48360
49051
  if (!hasColors) {
48361
49052
  return (input) => input;
48362
49053
  }
48363
- const openCode = `\x1B[${open3}m`;
49054
+ const openCode = `\x1B[${open2}m`;
48364
49055
  const closeCode = `\x1B[${close}m`;
48365
49056
  return (input) => {
48366
49057
  const string4 = input + "";
@@ -51898,7 +52589,7 @@ var require_innerFrom = __commonJS({
51898
52589
  exports2.fromIterable = fromIterable;
51899
52590
  function fromAsyncIterable(asyncIterable) {
51900
52591
  return new Observable_1.Observable(function(subscriber) {
51901
- process19(asyncIterable, subscriber).catch(function(err) {
52592
+ process13(asyncIterable, subscriber).catch(function(err) {
51902
52593
  return subscriber.error(err);
51903
52594
  });
51904
52595
  });
@@ -51908,7 +52599,7 @@ var require_innerFrom = __commonJS({
51908
52599
  return fromAsyncIterable(isReadableStreamLike_1.readableStreamLikeToAsyncGenerator(readableStream));
51909
52600
  }
51910
52601
  exports2.fromReadableStreamLike = fromReadableStreamLike;
51911
- function process19(asyncIterable, subscriber) {
52602
+ function process13(asyncIterable, subscriber) {
51912
52603
  var asyncIterable_1, asyncIterable_1_1;
51913
52604
  var e_2, _a2;
51914
52605
  return __awaiter(this, void 0, void 0, function() {
@@ -59567,15 +60258,15 @@ var require_route = __commonJS({
59567
60258
  };
59568
60259
  }
59569
60260
  function wrapConversion(toModel, graph) {
59570
- const path36 = [graph[toModel].parent, toModel];
60261
+ const path35 = [graph[toModel].parent, toModel];
59571
60262
  let fn = conversions[graph[toModel].parent][toModel];
59572
60263
  let cur = graph[toModel].parent;
59573
60264
  while (graph[cur].parent) {
59574
- path36.unshift(graph[cur].parent);
60265
+ path35.unshift(graph[cur].parent);
59575
60266
  fn = link(conversions[graph[cur].parent][cur], fn);
59576
60267
  cur = graph[cur].parent;
59577
60268
  }
59578
- fn.conversion = path36;
60269
+ fn.conversion = path35;
59579
60270
  return fn;
59580
60271
  }
59581
60272
  module2.exports = function(fromModel) {
@@ -59972,7 +60663,7 @@ var require_has_flag = __commonJS({
59972
60663
  var require_supports_color = __commonJS({
59973
60664
  "../../node_modules/supports-color/index.js"(exports2, module2) {
59974
60665
  "use strict";
59975
- var os31 = require("os");
60666
+ var os30 = require("os");
59976
60667
  var tty3 = require("tty");
59977
60668
  var hasFlag3 = require_has_flag();
59978
60669
  var { env: env3 } = process;
@@ -60020,7 +60711,7 @@ var require_supports_color = __commonJS({
60020
60711
  return min;
60021
60712
  }
60022
60713
  if (process.platform === "win32") {
60023
- const osRelease = os31.release().split(".");
60714
+ const osRelease = os30.release().split(".");
60024
60715
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
60025
60716
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
60026
60717
  }
@@ -60321,18 +61012,18 @@ var require_source = __commonJS({
60321
61012
  }
60322
61013
  }
60323
61014
  });
60324
- var createStyler3 = (open3, close, parent) => {
61015
+ var createStyler3 = (open2, close, parent) => {
60325
61016
  let openAll;
60326
61017
  let closeAll;
60327
61018
  if (parent === void 0) {
60328
- openAll = open3;
61019
+ openAll = open2;
60329
61020
  closeAll = close;
60330
61021
  } else {
60331
- openAll = parent.openAll + open3;
61022
+ openAll = parent.openAll + open2;
60332
61023
  closeAll = close + parent.closeAll;
60333
61024
  }
60334
61025
  return {
60335
- open: open3,
61026
+ open: open2,
60336
61027
  close,
60337
61028
  openAll,
60338
61029
  closeAll,
@@ -60496,11 +61187,11 @@ var require_signals = __commonJS({
60496
61187
  var require_signal_exit = __commonJS({
60497
61188
  "../../node_modules/inquirer/node_modules/signal-exit/index.js"(exports2, module2) {
60498
61189
  "use strict";
60499
- var process19 = global.process;
60500
- var processOk2 = function(process20) {
60501
- return process20 && typeof process20 === "object" && typeof process20.removeListener === "function" && typeof process20.emit === "function" && typeof process20.reallyExit === "function" && typeof process20.listeners === "function" && typeof process20.kill === "function" && typeof process20.pid === "number" && typeof process20.on === "function";
61190
+ var process13 = global.process;
61191
+ var processOk2 = function(process14) {
61192
+ return process14 && typeof process14 === "object" && typeof process14.removeListener === "function" && typeof process14.emit === "function" && typeof process14.reallyExit === "function" && typeof process14.listeners === "function" && typeof process14.kill === "function" && typeof process14.pid === "number" && typeof process14.on === "function";
60502
61193
  };
60503
- if (!processOk2(process19)) {
61194
+ if (!processOk2(process13)) {
60504
61195
  module2.exports = function() {
60505
61196
  return function() {
60506
61197
  };
@@ -60508,15 +61199,15 @@ var require_signal_exit = __commonJS({
60508
61199
  } else {
60509
61200
  assert3 = require("assert");
60510
61201
  signals2 = require_signals();
60511
- isWin = /^win/i.test(process19.platform);
61202
+ isWin = /^win/i.test(process13.platform);
60512
61203
  EE = require("events");
60513
61204
  if (typeof EE !== "function") {
60514
61205
  EE = EE.EventEmitter;
60515
61206
  }
60516
- if (process19.__signal_exit_emitter__) {
60517
- emitter = process19.__signal_exit_emitter__;
61207
+ if (process13.__signal_exit_emitter__) {
61208
+ emitter = process13.__signal_exit_emitter__;
60518
61209
  } else {
60519
- emitter = process19.__signal_exit_emitter__ = new EE();
61210
+ emitter = process13.__signal_exit_emitter__ = new EE();
60520
61211
  emitter.count = 0;
60521
61212
  emitter.emitted = {};
60522
61213
  }
@@ -60553,12 +61244,12 @@ var require_signal_exit = __commonJS({
60553
61244
  loaded = false;
60554
61245
  signals2.forEach(function(sig) {
60555
61246
  try {
60556
- process19.removeListener(sig, sigListeners[sig]);
61247
+ process13.removeListener(sig, sigListeners[sig]);
60557
61248
  } catch (er) {
60558
61249
  }
60559
61250
  });
60560
- process19.emit = originalProcessEmit;
60561
- process19.reallyExit = originalProcessReallyExit;
61251
+ process13.emit = originalProcessEmit;
61252
+ process13.reallyExit = originalProcessReallyExit;
60562
61253
  emitter.count -= 1;
60563
61254
  };
60564
61255
  module2.exports.unload = unload2;
@@ -60575,7 +61266,7 @@ var require_signal_exit = __commonJS({
60575
61266
  if (!processOk2(global.process)) {
60576
61267
  return;
60577
61268
  }
60578
- var listeners = process19.listeners(sig);
61269
+ var listeners = process13.listeners(sig);
60579
61270
  if (listeners.length === emitter.count) {
60580
61271
  unload2();
60581
61272
  emit("exit", null, sig);
@@ -60583,7 +61274,7 @@ var require_signal_exit = __commonJS({
60583
61274
  if (isWin && sig === "SIGHUP") {
60584
61275
  sig = "SIGINT";
60585
61276
  }
60586
- process19.kill(process19.pid, sig);
61277
+ process13.kill(process13.pid, sig);
60587
61278
  }
60588
61279
  };
60589
61280
  });
@@ -60599,36 +61290,36 @@ var require_signal_exit = __commonJS({
60599
61290
  emitter.count += 1;
60600
61291
  signals2 = signals2.filter(function(sig) {
60601
61292
  try {
60602
- process19.on(sig, sigListeners[sig]);
61293
+ process13.on(sig, sigListeners[sig]);
60603
61294
  return true;
60604
61295
  } catch (er) {
60605
61296
  return false;
60606
61297
  }
60607
61298
  });
60608
- process19.emit = processEmit;
60609
- process19.reallyExit = processReallyExit;
61299
+ process13.emit = processEmit;
61300
+ process13.reallyExit = processReallyExit;
60610
61301
  };
60611
61302
  module2.exports.load = load2;
60612
- originalProcessReallyExit = process19.reallyExit;
61303
+ originalProcessReallyExit = process13.reallyExit;
60613
61304
  processReallyExit = function processReallyExit2(code) {
60614
61305
  if (!processOk2(global.process)) {
60615
61306
  return;
60616
61307
  }
60617
- process19.exitCode = code || /* istanbul ignore next */
61308
+ process13.exitCode = code || /* istanbul ignore next */
60618
61309
  0;
60619
- emit("exit", process19.exitCode, null);
60620
- emit("afterexit", process19.exitCode, null);
60621
- originalProcessReallyExit.call(process19, process19.exitCode);
61310
+ emit("exit", process13.exitCode, null);
61311
+ emit("afterexit", process13.exitCode, null);
61312
+ originalProcessReallyExit.call(process13, process13.exitCode);
60622
61313
  };
60623
- originalProcessEmit = process19.emit;
61314
+ originalProcessEmit = process13.emit;
60624
61315
  processEmit = function processEmit2(ev, arg) {
60625
61316
  if (ev === "exit" && processOk2(global.process)) {
60626
61317
  if (arg !== void 0) {
60627
- process19.exitCode = arg;
61318
+ process13.exitCode = arg;
60628
61319
  }
60629
61320
  var ret = originalProcessEmit.apply(this, arguments);
60630
- emit("exit", process19.exitCode, null);
60631
- emit("afterexit", process19.exitCode, null);
61321
+ emit("exit", process13.exitCode, null);
61322
+ emit("afterexit", process13.exitCode, null);
60632
61323
  return ret;
60633
61324
  } else {
60634
61325
  return originalProcessEmit.apply(this, arguments);
@@ -62818,12 +63509,12 @@ var require_buffer_list = __commonJS({
62818
63509
  return (hint === "string" ? String : Number)(input);
62819
63510
  }
62820
63511
  var _require = require("buffer");
62821
- var Buffer3 = _require.Buffer;
63512
+ var Buffer2 = _require.Buffer;
62822
63513
  var _require2 = require("util");
62823
63514
  var inspect = _require2.inspect;
62824
63515
  var custom2 = inspect && inspect.custom || "inspect";
62825
63516
  function copyBuffer(src, target, offset) {
62826
- Buffer3.prototype.copy.call(src, target, offset);
63517
+ Buffer2.prototype.copy.call(src, target, offset);
62827
63518
  }
62828
63519
  module2.exports = /* @__PURE__ */ (function() {
62829
63520
  function BufferList() {
@@ -62883,8 +63574,8 @@ var require_buffer_list = __commonJS({
62883
63574
  }, {
62884
63575
  key: "concat",
62885
63576
  value: function concat(n) {
62886
- if (this.length === 0) return Buffer3.alloc(0);
62887
- var ret = Buffer3.allocUnsafe(n >>> 0);
63577
+ if (this.length === 0) return Buffer2.alloc(0);
63578
+ var ret = Buffer2.allocUnsafe(n >>> 0);
62888
63579
  var p = this.head;
62889
63580
  var i = 0;
62890
63581
  while (p) {
@@ -62948,7 +63639,7 @@ var require_buffer_list = __commonJS({
62948
63639
  }, {
62949
63640
  key: "_getBuffer",
62950
63641
  value: function _getBuffer(n) {
62951
- var ret = Buffer3.allocUnsafe(n);
63642
+ var ret = Buffer2.allocUnsafe(n);
62952
63643
  var p = this.head;
62953
63644
  var c = 1;
62954
63645
  p.data.copy(ret);
@@ -63280,14 +63971,14 @@ var require_stream_writable = __commonJS({
63280
63971
  deprecate: require_node()
63281
63972
  };
63282
63973
  var Stream = require_stream();
63283
- var Buffer3 = require("buffer").Buffer;
63974
+ var Buffer2 = require("buffer").Buffer;
63284
63975
  var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
63285
63976
  };
63286
63977
  function _uint8ArrayToBuffer(chunk) {
63287
- return Buffer3.from(chunk);
63978
+ return Buffer2.from(chunk);
63288
63979
  }
63289
63980
  function _isUint8Array(obj) {
63290
- return Buffer3.isBuffer(obj) || obj instanceof OurUint8Array;
63981
+ return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
63291
63982
  }
63292
63983
  var destroyImpl = require_destroy();
63293
63984
  var _require = require_state();
@@ -63415,7 +64106,7 @@ var require_stream_writable = __commonJS({
63415
64106
  var state = this._writableState;
63416
64107
  var ret = false;
63417
64108
  var isBuf = !state.objectMode && _isUint8Array(chunk);
63418
- if (isBuf && !Buffer3.isBuffer(chunk)) {
64109
+ if (isBuf && !Buffer2.isBuffer(chunk)) {
63419
64110
  chunk = _uint8ArrayToBuffer(chunk);
63420
64111
  }
63421
64112
  if (typeof encoding === "function") {
@@ -63459,7 +64150,7 @@ var require_stream_writable = __commonJS({
63459
64150
  });
63460
64151
  function decodeChunk(state, chunk, encoding) {
63461
64152
  if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") {
63462
- chunk = Buffer3.from(chunk, encoding);
64153
+ chunk = Buffer2.from(chunk, encoding);
63463
64154
  }
63464
64155
  return chunk;
63465
64156
  }
@@ -63830,34 +64521,34 @@ var require_safe_buffer = __commonJS({
63830
64521
  "../../node_modules/safe-buffer/index.js"(exports2, module2) {
63831
64522
  "use strict";
63832
64523
  var buffer = require("buffer");
63833
- var Buffer3 = buffer.Buffer;
64524
+ var Buffer2 = buffer.Buffer;
63834
64525
  function copyProps(src, dst) {
63835
64526
  for (var key in src) {
63836
64527
  dst[key] = src[key];
63837
64528
  }
63838
64529
  }
63839
- if (Buffer3.from && Buffer3.alloc && Buffer3.allocUnsafe && Buffer3.allocUnsafeSlow) {
64530
+ if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
63840
64531
  module2.exports = buffer;
63841
64532
  } else {
63842
64533
  copyProps(buffer, exports2);
63843
64534
  exports2.Buffer = SafeBuffer;
63844
64535
  }
63845
64536
  function SafeBuffer(arg, encodingOrOffset, length) {
63846
- return Buffer3(arg, encodingOrOffset, length);
64537
+ return Buffer2(arg, encodingOrOffset, length);
63847
64538
  }
63848
- SafeBuffer.prototype = Object.create(Buffer3.prototype);
63849
- copyProps(Buffer3, SafeBuffer);
64539
+ SafeBuffer.prototype = Object.create(Buffer2.prototype);
64540
+ copyProps(Buffer2, SafeBuffer);
63850
64541
  SafeBuffer.from = function(arg, encodingOrOffset, length) {
63851
64542
  if (typeof arg === "number") {
63852
64543
  throw new TypeError("Argument must not be a number");
63853
64544
  }
63854
- return Buffer3(arg, encodingOrOffset, length);
64545
+ return Buffer2(arg, encodingOrOffset, length);
63855
64546
  };
63856
64547
  SafeBuffer.alloc = function(size, fill, encoding) {
63857
64548
  if (typeof size !== "number") {
63858
64549
  throw new TypeError("Argument must be a number");
63859
64550
  }
63860
- var buf = Buffer3(size);
64551
+ var buf = Buffer2(size);
63861
64552
  if (fill !== void 0) {
63862
64553
  if (typeof encoding === "string") {
63863
64554
  buf.fill(fill, encoding);
@@ -63873,7 +64564,7 @@ var require_safe_buffer = __commonJS({
63873
64564
  if (typeof size !== "number") {
63874
64565
  throw new TypeError("Argument must be a number");
63875
64566
  }
63876
- return Buffer3(size);
64567
+ return Buffer2(size);
63877
64568
  };
63878
64569
  SafeBuffer.allocUnsafeSlow = function(size) {
63879
64570
  if (typeof size !== "number") {
@@ -63888,8 +64579,8 @@ var require_safe_buffer = __commonJS({
63888
64579
  var require_string_decoder = __commonJS({
63889
64580
  "../../node_modules/string_decoder/lib/string_decoder.js"(exports2) {
63890
64581
  "use strict";
63891
- var Buffer3 = require_safe_buffer().Buffer;
63892
- var isEncoding = Buffer3.isEncoding || function(encoding) {
64582
+ var Buffer2 = require_safe_buffer().Buffer;
64583
+ var isEncoding = Buffer2.isEncoding || function(encoding) {
63893
64584
  encoding = "" + encoding;
63894
64585
  switch (encoding && encoding.toLowerCase()) {
63895
64586
  case "hex":
@@ -63937,7 +64628,7 @@ var require_string_decoder = __commonJS({
63937
64628
  }
63938
64629
  function normalizeEncoding(enc) {
63939
64630
  var nenc = _normalizeEncoding(enc);
63940
- if (typeof nenc !== "string" && (Buffer3.isEncoding === isEncoding || !isEncoding(enc))) throw new Error("Unknown encoding: " + enc);
64631
+ if (typeof nenc !== "string" && (Buffer2.isEncoding === isEncoding || !isEncoding(enc))) throw new Error("Unknown encoding: " + enc);
63941
64632
  return nenc || enc;
63942
64633
  }
63943
64634
  exports2.StringDecoder = StringDecoder;
@@ -63966,7 +64657,7 @@ var require_string_decoder = __commonJS({
63966
64657
  }
63967
64658
  this.lastNeed = 0;
63968
64659
  this.lastTotal = 0;
63969
- this.lastChar = Buffer3.allocUnsafe(nb);
64660
+ this.lastChar = Buffer2.allocUnsafe(nb);
63970
64661
  }
63971
64662
  StringDecoder.prototype.write = function(buf) {
63972
64663
  if (buf.length === 0) return "";
@@ -64527,14 +65218,14 @@ var require_stream_readable = __commonJS({
64527
65218
  return emitter.listeners(type).length;
64528
65219
  };
64529
65220
  var Stream = require_stream();
64530
- var Buffer3 = require("buffer").Buffer;
65221
+ var Buffer2 = require("buffer").Buffer;
64531
65222
  var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
64532
65223
  };
64533
65224
  function _uint8ArrayToBuffer(chunk) {
64534
- return Buffer3.from(chunk);
65225
+ return Buffer2.from(chunk);
64535
65226
  }
64536
65227
  function _isUint8Array(obj) {
64537
- return Buffer3.isBuffer(obj) || obj instanceof OurUint8Array;
65228
+ return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
64538
65229
  }
64539
65230
  var debugUtil = require("util");
64540
65231
  var debug;
@@ -64642,7 +65333,7 @@ var require_stream_readable = __commonJS({
64642
65333
  if (typeof chunk === "string") {
64643
65334
  encoding = encoding || state.defaultEncoding;
64644
65335
  if (encoding !== state.encoding) {
64645
- chunk = Buffer3.from(chunk, encoding);
65336
+ chunk = Buffer2.from(chunk, encoding);
64646
65337
  encoding = "";
64647
65338
  }
64648
65339
  skipChunkCheck = true;
@@ -64667,7 +65358,7 @@ var require_stream_readable = __commonJS({
64667
65358
  if (er) {
64668
65359
  errorOrDestroy(stream, er);
64669
65360
  } else if (state.objectMode || chunk && chunk.length > 0) {
64670
- if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer3.prototype) {
65361
+ if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer2.prototype) {
64671
65362
  chunk = _uint8ArrayToBuffer(chunk);
64672
65363
  }
64673
65364
  if (addToFront) {
@@ -65478,7 +66169,7 @@ var require_readable = __commonJS({
65478
66169
  var require_BufferList = __commonJS({
65479
66170
  "../../node_modules/bl/BufferList.js"(exports2, module2) {
65480
66171
  "use strict";
65481
- var { Buffer: Buffer3 } = require("buffer");
66172
+ var { Buffer: Buffer2 } = require("buffer");
65482
66173
  var symbol2 = /* @__PURE__ */ Symbol.for("BufferList");
65483
66174
  function BufferList(buf) {
65484
66175
  if (!(this instanceof BufferList)) {
@@ -65542,10 +66233,10 @@ var require_BufferList = __commonJS({
65542
66233
  srcEnd = this.length;
65543
66234
  }
65544
66235
  if (srcStart >= this.length) {
65545
- return dst || Buffer3.alloc(0);
66236
+ return dst || Buffer2.alloc(0);
65546
66237
  }
65547
66238
  if (srcEnd <= 0) {
65548
- return dst || Buffer3.alloc(0);
66239
+ return dst || Buffer2.alloc(0);
65549
66240
  }
65550
66241
  const copy2 = !!dst;
65551
66242
  const off = this._offset(srcStart);
@@ -65555,7 +66246,7 @@ var require_BufferList = __commonJS({
65555
66246
  let start = off[1];
65556
66247
  if (srcStart === 0 && srcEnd === this.length) {
65557
66248
  if (!copy2) {
65558
- return this._bufs.length === 1 ? this._bufs[0] : Buffer3.concat(this._bufs, this.length);
66249
+ return this._bufs.length === 1 ? this._bufs[0] : Buffer2.concat(this._bufs, this.length);
65559
66250
  }
65560
66251
  for (let i = 0; i < this._bufs.length; i++) {
65561
66252
  this._bufs[i].copy(dst, bufoff);
@@ -65567,7 +66258,7 @@ var require_BufferList = __commonJS({
65567
66258
  return copy2 ? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes) : this._bufs[off[0]].slice(start, start + bytes);
65568
66259
  }
65569
66260
  if (!copy2) {
65570
- dst = Buffer3.allocUnsafe(len);
66261
+ dst = Buffer2.allocUnsafe(len);
65571
66262
  }
65572
66263
  for (let i = off[0]; i < this._bufs.length; i++) {
65573
66264
  const l = this._bufs[i].length - start;
@@ -65643,7 +66334,7 @@ var require_BufferList = __commonJS({
65643
66334
  return this;
65644
66335
  }
65645
66336
  if (buf.buffer) {
65646
- this._appendBuffer(Buffer3.from(buf.buffer, buf.byteOffset, buf.byteLength));
66337
+ this._appendBuffer(Buffer2.from(buf.buffer, buf.byteOffset, buf.byteLength));
65647
66338
  } else if (Array.isArray(buf)) {
65648
66339
  for (let i = 0; i < buf.length; i++) {
65649
66340
  this.append(buf[i]);
@@ -65656,7 +66347,7 @@ var require_BufferList = __commonJS({
65656
66347
  if (typeof buf === "number") {
65657
66348
  buf = buf.toString();
65658
66349
  }
65659
- this._appendBuffer(Buffer3.from(buf));
66350
+ this._appendBuffer(Buffer2.from(buf));
65660
66351
  }
65661
66352
  return this;
65662
66353
  };
@@ -65672,15 +66363,15 @@ var require_BufferList = __commonJS({
65672
66363
  if (typeof search === "function" || Array.isArray(search)) {
65673
66364
  throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');
65674
66365
  } else if (typeof search === "number") {
65675
- search = Buffer3.from([search]);
66366
+ search = Buffer2.from([search]);
65676
66367
  } else if (typeof search === "string") {
65677
- search = Buffer3.from(search, encoding);
66368
+ search = Buffer2.from(search, encoding);
65678
66369
  } else if (this._isBufferList(search)) {
65679
66370
  search = search.slice();
65680
66371
  } else if (Array.isArray(search.buffer)) {
65681
- search = Buffer3.from(search.buffer, search.byteOffset, search.byteLength);
65682
- } else if (!Buffer3.isBuffer(search)) {
65683
- search = Buffer3.from(search);
66372
+ search = Buffer2.from(search.buffer, search.byteOffset, search.byteLength);
66373
+ } else if (!Buffer2.isBuffer(search)) {
66374
+ search = Buffer2.from(search);
65684
66375
  }
65685
66376
  offset = Number(offset || 0);
65686
66377
  if (isNaN(offset)) {
@@ -72996,10 +73687,10 @@ var require_lib = __commonJS({
72996
73687
  exports2.analyse = analyse;
72997
73688
  var detectFile = (filepath, opts = {}) => new Promise((resolve18, reject) => {
72998
73689
  let fd;
72999
- const fs27 = (0, node_1.default)();
73690
+ const fs22 = (0, node_1.default)();
73000
73691
  const handler = (err, buffer) => {
73001
73692
  if (fd) {
73002
- fs27.closeSync(fd);
73693
+ fs22.closeSync(fd);
73003
73694
  }
73004
73695
  if (err) {
73005
73696
  reject(err);
@@ -73011,9 +73702,9 @@ var require_lib = __commonJS({
73011
73702
  };
73012
73703
  const sampleSize = (opts === null || opts === void 0 ? void 0 : opts.sampleSize) || 0;
73013
73704
  if (sampleSize > 0) {
73014
- fd = fs27.openSync(filepath, "r");
73705
+ fd = fs22.openSync(filepath, "r");
73015
73706
  let sample = Buffer.allocUnsafe(sampleSize);
73016
- fs27.read(fd, sample, 0, sampleSize, opts.offset, (err, bytesRead) => {
73707
+ fs22.read(fd, sample, 0, sampleSize, opts.offset, (err, bytesRead) => {
73017
73708
  if (err) {
73018
73709
  handler(err, null);
73019
73710
  } else {
@@ -73025,22 +73716,22 @@ var require_lib = __commonJS({
73025
73716
  });
73026
73717
  return;
73027
73718
  }
73028
- fs27.readFile(filepath, handler);
73719
+ fs22.readFile(filepath, handler);
73029
73720
  });
73030
73721
  exports2.detectFile = detectFile;
73031
73722
  var detectFileSync = (filepath, opts = {}) => {
73032
- const fs27 = (0, node_1.default)();
73723
+ const fs22 = (0, node_1.default)();
73033
73724
  if (opts && opts.sampleSize) {
73034
- const fd = fs27.openSync(filepath, "r");
73725
+ const fd = fs22.openSync(filepath, "r");
73035
73726
  let sample = Buffer.allocUnsafe(opts.sampleSize);
73036
- const bytesRead = fs27.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
73727
+ const bytesRead = fs22.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
73037
73728
  if (bytesRead < opts.sampleSize) {
73038
73729
  sample = sample.subarray(0, bytesRead);
73039
73730
  }
73040
- fs27.closeSync(fd);
73731
+ fs22.closeSync(fd);
73041
73732
  return (0, exports2.detect)(sample);
73042
73733
  }
73043
- return (0, exports2.detect)(fs27.readFileSync(filepath));
73734
+ return (0, exports2.detect)(fs22.readFileSync(filepath));
73044
73735
  };
73045
73736
  exports2.detectFileSync = detectFileSync;
73046
73737
  exports2.default = {
@@ -73057,7 +73748,7 @@ var require_safer = __commonJS({
73057
73748
  "../../node_modules/safer-buffer/safer.js"(exports2, module2) {
73058
73749
  "use strict";
73059
73750
  var buffer = require("buffer");
73060
- var Buffer3 = buffer.Buffer;
73751
+ var Buffer2 = buffer.Buffer;
73061
73752
  var safer = {};
73062
73753
  var key;
73063
73754
  for (key in buffer) {
@@ -73066,12 +73757,12 @@ var require_safer = __commonJS({
73066
73757
  safer[key] = buffer[key];
73067
73758
  }
73068
73759
  var Safer = safer.Buffer = {};
73069
- for (key in Buffer3) {
73070
- if (!Buffer3.hasOwnProperty(key)) continue;
73760
+ for (key in Buffer2) {
73761
+ if (!Buffer2.hasOwnProperty(key)) continue;
73071
73762
  if (key === "allocUnsafe" || key === "allocUnsafeSlow") continue;
73072
- Safer[key] = Buffer3[key];
73763
+ Safer[key] = Buffer2[key];
73073
73764
  }
73074
- safer.Buffer.prototype = Buffer3.prototype;
73765
+ safer.Buffer.prototype = Buffer2.prototype;
73075
73766
  if (!Safer.from || Safer.from === Uint8Array.from) {
73076
73767
  Safer.from = function(value, encodingOrOffset, length) {
73077
73768
  if (typeof value === "number") {
@@ -73080,7 +73771,7 @@ var require_safer = __commonJS({
73080
73771
  if (value && typeof value.length === "undefined") {
73081
73772
  throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value);
73082
73773
  }
73083
- return Buffer3(value, encodingOrOffset, length);
73774
+ return Buffer2(value, encodingOrOffset, length);
73084
73775
  };
73085
73776
  }
73086
73777
  if (!Safer.alloc) {
@@ -73091,7 +73782,7 @@ var require_safer = __commonJS({
73091
73782
  if (size < 0 || size >= 2 * (1 << 30)) {
73092
73783
  throw new RangeError('The value "' + size + '" is invalid for option "size"');
73093
73784
  }
73094
- var buf = Buffer3(size);
73785
+ var buf = Buffer2(size);
73095
73786
  if (!fill || fill.length === 0) {
73096
73787
  buf.fill(0);
73097
73788
  } else if (typeof encoding === "string") {
@@ -73186,7 +73877,7 @@ var require_merge_exports = __commonJS({
73186
73877
  var require_internal = __commonJS({
73187
73878
  "../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/internal.js"(exports2, module2) {
73188
73879
  "use strict";
73189
- var Buffer3 = require_safer().Buffer;
73880
+ var Buffer2 = require_safer().Buffer;
73190
73881
  module2.exports = {
73191
73882
  // Encodings
73192
73883
  utf8: { type: "_internal", bomAware: true },
@@ -73210,7 +73901,7 @@ var require_internal = __commonJS({
73210
73901
  } else if (this.enc === "cesu8") {
73211
73902
  this.enc = "utf8";
73212
73903
  this.encoder = InternalEncoderCesu8;
73213
- if (Buffer3.from("eda0bdedb2a9", "hex").toString() !== "\u{1F4A9}") {
73904
+ if (Buffer2.from("eda0bdedb2a9", "hex").toString() !== "\u{1F4A9}") {
73214
73905
  this.decoder = InternalDecoderCesu8;
73215
73906
  this.defaultCharUnicode = iconv2.defaultCharUnicode;
73216
73907
  }
@@ -73223,8 +73914,8 @@ var require_internal = __commonJS({
73223
73914
  this.decoder = new StringDecoder(codec2.enc);
73224
73915
  }
73225
73916
  InternalDecoder.prototype.write = function(buf) {
73226
- if (!Buffer3.isBuffer(buf)) {
73227
- buf = Buffer3.from(buf);
73917
+ if (!Buffer2.isBuffer(buf)) {
73918
+ buf = Buffer2.from(buf);
73228
73919
  }
73229
73920
  return this.decoder.write(buf);
73230
73921
  };
@@ -73235,7 +73926,7 @@ var require_internal = __commonJS({
73235
73926
  this.enc = codec2.enc;
73236
73927
  }
73237
73928
  InternalEncoder.prototype.write = function(str) {
73238
- return Buffer3.from(str, this.enc);
73929
+ return Buffer2.from(str, this.enc);
73239
73930
  };
73240
73931
  InternalEncoder.prototype.end = function() {
73241
73932
  };
@@ -73247,15 +73938,15 @@ var require_internal = __commonJS({
73247
73938
  var completeQuads = str.length - str.length % 4;
73248
73939
  this.prevStr = str.slice(completeQuads);
73249
73940
  str = str.slice(0, completeQuads);
73250
- return Buffer3.from(str, "base64");
73941
+ return Buffer2.from(str, "base64");
73251
73942
  };
73252
73943
  InternalEncoderBase64.prototype.end = function() {
73253
- return Buffer3.from(this.prevStr, "base64");
73944
+ return Buffer2.from(this.prevStr, "base64");
73254
73945
  };
73255
73946
  function InternalEncoderCesu8(options, codec2) {
73256
73947
  }
73257
73948
  InternalEncoderCesu8.prototype.write = function(str) {
73258
- var buf = Buffer3.alloc(str.length * 3);
73949
+ var buf = Buffer2.alloc(str.length * 3);
73259
73950
  var bufIdx = 0;
73260
73951
  for (var i = 0; i < str.length; i++) {
73261
73952
  var charCode = str.charCodeAt(i);
@@ -73351,13 +74042,13 @@ var require_internal = __commonJS({
73351
74042
  str = str.slice(0, str.length - 1);
73352
74043
  }
73353
74044
  }
73354
- return Buffer3.from(str, this.enc);
74045
+ return Buffer2.from(str, this.enc);
73355
74046
  };
73356
74047
  InternalEncoderUtf8.prototype.end = function() {
73357
74048
  if (this.highSurrogate) {
73358
74049
  var str = this.highSurrogate;
73359
74050
  this.highSurrogate = "";
73360
- return Buffer3.from(str, this.enc);
74051
+ return Buffer2.from(str, this.enc);
73361
74052
  }
73362
74053
  };
73363
74054
  }
@@ -73367,7 +74058,7 @@ var require_internal = __commonJS({
73367
74058
  var require_utf32 = __commonJS({
73368
74059
  "../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/utf32.js"(exports2) {
73369
74060
  "use strict";
73370
- var Buffer3 = require_safer().Buffer;
74061
+ var Buffer2 = require_safer().Buffer;
73371
74062
  exports2._utf32 = Utf32Codec;
73372
74063
  function Utf32Codec(codecOptions, iconv2) {
73373
74064
  this.iconv = iconv2;
@@ -73385,8 +74076,8 @@ var require_utf32 = __commonJS({
73385
74076
  this.highSurrogate = 0;
73386
74077
  }
73387
74078
  Utf32Encoder.prototype.write = function(str) {
73388
- var src = Buffer3.from(str, "ucs2");
73389
- var dst = Buffer3.alloc(src.length * 2);
74079
+ var src = Buffer2.from(str, "ucs2");
74080
+ var dst = Buffer2.alloc(src.length * 2);
73390
74081
  var write32 = this.isLE ? dst.writeUInt32LE : dst.writeUInt32BE;
73391
74082
  var offset = 0;
73392
74083
  for (var i = 0; i < src.length; i += 2) {
@@ -73422,7 +74113,7 @@ var require_utf32 = __commonJS({
73422
74113
  if (!this.highSurrogate) {
73423
74114
  return;
73424
74115
  }
73425
- var buf = Buffer3.alloc(4);
74116
+ var buf = Buffer2.alloc(4);
73426
74117
  if (this.isLE) {
73427
74118
  buf.writeUInt32LE(this.highSurrogate, 0);
73428
74119
  } else {
@@ -73442,7 +74133,7 @@ var require_utf32 = __commonJS({
73442
74133
  }
73443
74134
  var i = 0;
73444
74135
  var codepoint = 0;
73445
- var dst = Buffer3.alloc(src.length + 4);
74136
+ var dst = Buffer2.alloc(src.length + 4);
73446
74137
  var offset = 0;
73447
74138
  var isLE = this.isLE;
73448
74139
  var overflow = this.overflow;
@@ -73598,7 +74289,7 @@ var require_utf32 = __commonJS({
73598
74289
  var require_utf16 = __commonJS({
73599
74290
  "../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/utf16.js"(exports2) {
73600
74291
  "use strict";
73601
- var Buffer3 = require_safer().Buffer;
74292
+ var Buffer2 = require_safer().Buffer;
73602
74293
  exports2.utf16be = Utf16BECodec;
73603
74294
  function Utf16BECodec() {
73604
74295
  }
@@ -73608,7 +74299,7 @@ var require_utf16 = __commonJS({
73608
74299
  function Utf16BEEncoder() {
73609
74300
  }
73610
74301
  Utf16BEEncoder.prototype.write = function(str) {
73611
- var buf = Buffer3.from(str, "ucs2");
74302
+ var buf = Buffer2.from(str, "ucs2");
73612
74303
  for (var i = 0; i < buf.length; i += 2) {
73613
74304
  var tmp = buf[i];
73614
74305
  buf[i] = buf[i + 1];
@@ -73625,7 +74316,7 @@ var require_utf16 = __commonJS({
73625
74316
  if (buf.length == 0) {
73626
74317
  return "";
73627
74318
  }
73628
- var buf2 = Buffer3.alloc(buf.length + 1);
74319
+ var buf2 = Buffer2.alloc(buf.length + 1);
73629
74320
  var i = 0;
73630
74321
  var j = 0;
73631
74322
  if (this.overflowByte !== -1) {
@@ -73741,7 +74432,7 @@ var require_utf16 = __commonJS({
73741
74432
  var require_utf7 = __commonJS({
73742
74433
  "../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/utf7.js"(exports2) {
73743
74434
  "use strict";
73744
- var Buffer3 = require_safer().Buffer;
74435
+ var Buffer2 = require_safer().Buffer;
73745
74436
  exports2.utf7 = Utf7Codec;
73746
74437
  exports2.unicode11utf7 = "utf7";
73747
74438
  function Utf7Codec(codecOptions, iconv2) {
@@ -73755,7 +74446,7 @@ var require_utf7 = __commonJS({
73755
74446
  this.iconv = codec2.iconv;
73756
74447
  }
73757
74448
  Utf7Encoder.prototype.write = function(str) {
73758
- return Buffer3.from(str.replace(nonDirectChars, function(chunk) {
74449
+ return Buffer2.from(str.replace(nonDirectChars, function(chunk) {
73759
74450
  return "+" + (chunk === "+" ? "" : this.iconv.encode(chunk, "utf16-be").toString("base64").replace(/=+$/, "")) + "-";
73760
74451
  }.bind(this)));
73761
74452
  };
@@ -73793,7 +74484,7 @@ var require_utf7 = __commonJS({
73793
74484
  res += "+";
73794
74485
  } else {
73795
74486
  var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i2), "ascii");
73796
- res += this.iconv.decode(Buffer3.from(b64str, "base64"), "utf16-be");
74487
+ res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
73797
74488
  }
73798
74489
  if (buf[i2] != minusChar) {
73799
74490
  i2--;
@@ -73811,7 +74502,7 @@ var require_utf7 = __commonJS({
73811
74502
  var canBeDecoded = b64str.length - b64str.length % 8;
73812
74503
  base64Accum = b64str.slice(canBeDecoded);
73813
74504
  b64str = b64str.slice(0, canBeDecoded);
73814
- res += this.iconv.decode(Buffer3.from(b64str, "base64"), "utf16-be");
74505
+ res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
73815
74506
  }
73816
74507
  this.inBase64 = inBase64;
73817
74508
  this.base64Accum = base64Accum;
@@ -73820,7 +74511,7 @@ var require_utf7 = __commonJS({
73820
74511
  Utf7Decoder.prototype.end = function() {
73821
74512
  var res = "";
73822
74513
  if (this.inBase64 && this.base64Accum.length > 0) {
73823
- res = this.iconv.decode(Buffer3.from(this.base64Accum, "base64"), "utf16-be");
74514
+ res = this.iconv.decode(Buffer2.from(this.base64Accum, "base64"), "utf16-be");
73824
74515
  }
73825
74516
  this.inBase64 = false;
73826
74517
  this.base64Accum = "";
@@ -73836,14 +74527,14 @@ var require_utf7 = __commonJS({
73836
74527
  function Utf7IMAPEncoder(options, codec2) {
73837
74528
  this.iconv = codec2.iconv;
73838
74529
  this.inBase64 = false;
73839
- this.base64Accum = Buffer3.alloc(6);
74530
+ this.base64Accum = Buffer2.alloc(6);
73840
74531
  this.base64AccumIdx = 0;
73841
74532
  }
73842
74533
  Utf7IMAPEncoder.prototype.write = function(str) {
73843
74534
  var inBase64 = this.inBase64;
73844
74535
  var base64Accum = this.base64Accum;
73845
74536
  var base64AccumIdx = this.base64AccumIdx;
73846
- var buf = Buffer3.alloc(str.length * 5 + 10);
74537
+ var buf = Buffer2.alloc(str.length * 5 + 10);
73847
74538
  var bufIdx = 0;
73848
74539
  for (var i2 = 0; i2 < str.length; i2++) {
73849
74540
  var uChar = str.charCodeAt(i2);
@@ -73882,7 +74573,7 @@ var require_utf7 = __commonJS({
73882
74573
  return buf.slice(0, bufIdx);
73883
74574
  };
73884
74575
  Utf7IMAPEncoder.prototype.end = function() {
73885
- var buf = Buffer3.alloc(10);
74576
+ var buf = Buffer2.alloc(10);
73886
74577
  var bufIdx = 0;
73887
74578
  if (this.inBase64) {
73888
74579
  if (this.base64AccumIdx > 0) {
@@ -73919,7 +74610,7 @@ var require_utf7 = __commonJS({
73919
74610
  res += "&";
73920
74611
  } else {
73921
74612
  var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i2), "ascii").replace(/,/g, "/");
73922
- res += this.iconv.decode(Buffer3.from(b64str, "base64"), "utf16-be");
74613
+ res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
73923
74614
  }
73924
74615
  if (buf[i2] != minusChar) {
73925
74616
  i2--;
@@ -73937,7 +74628,7 @@ var require_utf7 = __commonJS({
73937
74628
  var canBeDecoded = b64str.length - b64str.length % 8;
73938
74629
  base64Accum = b64str.slice(canBeDecoded);
73939
74630
  b64str = b64str.slice(0, canBeDecoded);
73940
- res += this.iconv.decode(Buffer3.from(b64str, "base64"), "utf16-be");
74631
+ res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
73941
74632
  }
73942
74633
  this.inBase64 = inBase64;
73943
74634
  this.base64Accum = base64Accum;
@@ -73946,7 +74637,7 @@ var require_utf7 = __commonJS({
73946
74637
  Utf7IMAPDecoder.prototype.end = function() {
73947
74638
  var res = "";
73948
74639
  if (this.inBase64 && this.base64Accum.length > 0) {
73949
- res = this.iconv.decode(Buffer3.from(this.base64Accum, "base64"), "utf16-be");
74640
+ res = this.iconv.decode(Buffer2.from(this.base64Accum, "base64"), "utf16-be");
73950
74641
  }
73951
74642
  this.inBase64 = false;
73952
74643
  this.base64Accum = "";
@@ -73959,7 +74650,7 @@ var require_utf7 = __commonJS({
73959
74650
  var require_sbcs_codec = __commonJS({
73960
74651
  "../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/sbcs-codec.js"(exports2) {
73961
74652
  "use strict";
73962
- var Buffer3 = require_safer().Buffer;
74653
+ var Buffer2 = require_safer().Buffer;
73963
74654
  exports2._sbcs = SBCSCodec;
73964
74655
  function SBCSCodec(codecOptions, iconv2) {
73965
74656
  if (!codecOptions) {
@@ -73975,8 +74666,8 @@ var require_sbcs_codec = __commonJS({
73975
74666
  }
73976
74667
  codecOptions.chars = asciiString + codecOptions.chars;
73977
74668
  }
73978
- this.decodeBuf = Buffer3.from(codecOptions.chars, "ucs2");
73979
- var encodeBuf = Buffer3.alloc(65536, iconv2.defaultCharSingleByte.charCodeAt(0));
74669
+ this.decodeBuf = Buffer2.from(codecOptions.chars, "ucs2");
74670
+ var encodeBuf = Buffer2.alloc(65536, iconv2.defaultCharSingleByte.charCodeAt(0));
73980
74671
  for (var i = 0; i < codecOptions.chars.length; i++) {
73981
74672
  encodeBuf[codecOptions.chars.charCodeAt(i)] = i;
73982
74673
  }
@@ -73988,7 +74679,7 @@ var require_sbcs_codec = __commonJS({
73988
74679
  this.encodeBuf = codec2.encodeBuf;
73989
74680
  }
73990
74681
  SBCSEncoder.prototype.write = function(str) {
73991
- var buf = Buffer3.alloc(str.length);
74682
+ var buf = Buffer2.alloc(str.length);
73992
74683
  for (var i = 0; i < str.length; i++) {
73993
74684
  buf[i] = this.encodeBuf[str.charCodeAt(i)];
73994
74685
  }
@@ -74001,7 +74692,7 @@ var require_sbcs_codec = __commonJS({
74001
74692
  }
74002
74693
  SBCSDecoder.prototype.write = function(buf) {
74003
74694
  var decodeBuf = this.decodeBuf;
74004
- var newBuf = Buffer3.alloc(buf.length * 2);
74695
+ var newBuf = Buffer2.alloc(buf.length * 2);
74005
74696
  var idx1 = 0;
74006
74697
  var idx2 = 0;
74007
74698
  for (var i = 0; i < buf.length; i++) {
@@ -74629,7 +75320,7 @@ var require_sbcs_data_generated = __commonJS({
74629
75320
  var require_dbcs_codec = __commonJS({
74630
75321
  "../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/dbcs-codec.js"(exports2) {
74631
75322
  "use strict";
74632
- var Buffer3 = require_safer().Buffer;
75323
+ var Buffer2 = require_safer().Buffer;
74633
75324
  exports2._dbcs = DBCSCodec;
74634
75325
  var UNASSIGNED = -1;
74635
75326
  var GB18030_CODE = -2;
@@ -74865,7 +75556,7 @@ var require_dbcs_codec = __commonJS({
74865
75556
  this.gb18030 = codec2.gb18030;
74866
75557
  }
74867
75558
  DBCSEncoder.prototype.write = function(str) {
74868
- var newBuf = Buffer3.alloc(str.length * (this.gb18030 ? 4 : 3));
75559
+ var newBuf = Buffer2.alloc(str.length * (this.gb18030 ? 4 : 3));
74869
75560
  var leadSurrogate = this.leadSurrogate;
74870
75561
  var seqObj = this.seqObj;
74871
75562
  var nextChar = -1;
@@ -74969,7 +75660,7 @@ var require_dbcs_codec = __commonJS({
74969
75660
  if (this.leadSurrogate === -1 && this.seqObj === void 0) {
74970
75661
  return;
74971
75662
  }
74972
- var newBuf = Buffer3.alloc(10);
75663
+ var newBuf = Buffer2.alloc(10);
74973
75664
  var j = 0;
74974
75665
  if (this.seqObj) {
74975
75666
  var dbcsCode = this.seqObj[DEF_CHAR];
@@ -75000,7 +75691,7 @@ var require_dbcs_codec = __commonJS({
75000
75691
  this.gb18030 = codec2.gb18030;
75001
75692
  }
75002
75693
  DBCSDecoder.prototype.write = function(buf) {
75003
- var newBuf = Buffer3.alloc(buf.length * 2);
75694
+ var newBuf = Buffer2.alloc(buf.length * 2);
75004
75695
  var nodeIdx = this.nodeIdx;
75005
75696
  var prevBytes = this.prevBytes;
75006
75697
  var prevOffset = this.prevBytes.length;
@@ -76609,7 +77300,7 @@ var require_encodings = __commonJS({
76609
77300
  var require_streams = __commonJS({
76610
77301
  "../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/lib/streams.js"(exports2, module2) {
76611
77302
  "use strict";
76612
- var Buffer3 = require_safer().Buffer;
77303
+ var Buffer2 = require_safer().Buffer;
76613
77304
  module2.exports = function(streamModule) {
76614
77305
  var Transform = streamModule.Transform;
76615
77306
  function IconvLiteEncoderStream(conv, options) {
@@ -76649,7 +77340,7 @@ var require_streams = __commonJS({
76649
77340
  chunks.push(chunk);
76650
77341
  });
76651
77342
  this.on("end", function() {
76652
- cb(null, Buffer3.concat(chunks));
77343
+ cb(null, Buffer2.concat(chunks));
76653
77344
  });
76654
77345
  return this;
76655
77346
  };
@@ -76663,7 +77354,7 @@ var require_streams = __commonJS({
76663
77354
  constructor: { value: IconvLiteDecoderStream }
76664
77355
  });
76665
77356
  IconvLiteDecoderStream.prototype._transform = function(chunk, encoding, done) {
76666
- if (!Buffer3.isBuffer(chunk) && !(chunk instanceof Uint8Array)) {
77357
+ if (!Buffer2.isBuffer(chunk) && !(chunk instanceof Uint8Array)) {
76667
77358
  return done(new Error("Iconv decoding stream needs buffers as its input."));
76668
77359
  }
76669
77360
  try {
@@ -76706,7 +77397,7 @@ var require_streams = __commonJS({
76706
77397
  var require_lib2 = __commonJS({
76707
77398
  "../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/lib/index.js"(exports2, module2) {
76708
77399
  "use strict";
76709
- var Buffer3 = require_safer().Buffer;
77400
+ var Buffer2 = require_safer().Buffer;
76710
77401
  var bomHandling = require_bom_handling();
76711
77402
  var mergeModules = require_merge_exports();
76712
77403
  module2.exports.encodings = null;
@@ -76717,7 +77408,7 @@ var require_lib2 = __commonJS({
76717
77408
  var encoder = module2.exports.getEncoder(encoding, options);
76718
77409
  var res = encoder.write(str);
76719
77410
  var trail = encoder.end();
76720
- return trail && trail.length > 0 ? Buffer3.concat([res, trail]) : res;
77411
+ return trail && trail.length > 0 ? Buffer2.concat([res, trail]) : res;
76721
77412
  };
76722
77413
  module2.exports.decode = function decode3(buf, encoding, options) {
76723
77414
  if (typeof buf === "string") {
@@ -76725,7 +77416,7 @@ var require_lib2 = __commonJS({
76725
77416
  console.error("Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding");
76726
77417
  module2.exports.skipDecodeWarning = true;
76727
77418
  }
76728
- buf = Buffer3.from("" + (buf || ""), "binary");
77419
+ buf = Buffer2.from("" + (buf || ""), "binary");
76729
77420
  }
76730
77421
  var decoder = module2.exports.getDecoder(encoding, options);
76731
77422
  var res = decoder.write(buf);
@@ -77445,9 +78136,9 @@ var init_prompt = __esm({
77445
78136
  init_utils();
77446
78137
  init_baseUI();
77447
78138
  _ = {
77448
- set: (obj, path36 = "", value) => {
78139
+ set: (obj, path35 = "", value) => {
77449
78140
  let pointer = obj;
77450
- path36.split(".").forEach((key, index, arr) => {
78141
+ path35.split(".").forEach((key, index, arr) => {
77451
78142
  if (key === "__proto__" || key === "constructor") return;
77452
78143
  if (index === arr.length - 1) {
77453
78144
  pointer[key] = value;
@@ -77457,8 +78148,8 @@ var init_prompt = __esm({
77457
78148
  pointer = pointer[key];
77458
78149
  });
77459
78150
  },
77460
- get: (obj, path36 = "", defaultValue) => {
77461
- const travel = (regexp) => String.prototype.split.call(path36, regexp).filter(Boolean).reduce(
78151
+ get: (obj, path35 = "", defaultValue) => {
78152
+ const travel = (regexp) => String.prototype.split.call(path35, regexp).filter(Boolean).reduce(
77462
78153
  // @ts-expect-error implicit any on res[key]
77463
78154
  (res, key) => res !== null && res !== void 0 ? res[key] : res,
77464
78155
  obj
@@ -77774,7 +78465,7 @@ var init_mjs = __esm({
77774
78465
  "../../node_modules/signal-exit/dist/mjs/index.js"() {
77775
78466
  "use strict";
77776
78467
  init_signals();
77777
- processOk = (process19) => !!process19 && typeof process19 === "object" && typeof process19.removeListener === "function" && typeof process19.emit === "function" && typeof process19.reallyExit === "function" && typeof process19.listeners === "function" && typeof process19.kill === "function" && typeof process19.pid === "number" && typeof process19.on === "function";
78468
+ processOk = (process13) => !!process13 && typeof process13 === "object" && typeof process13.removeListener === "function" && typeof process13.emit === "function" && typeof process13.reallyExit === "function" && typeof process13.listeners === "function" && typeof process13.kill === "function" && typeof process13.pid === "number" && typeof process13.on === "function";
77778
78469
  kExitEmitter = /* @__PURE__ */ Symbol.for("signal-exit emitter");
77779
78470
  global2 = globalThis;
77780
78471
  ObjectDefineProperty = Object.defineProperty.bind(Object);
@@ -77867,15 +78558,15 @@ var init_mjs = __esm({
77867
78558
  #originalProcessReallyExit;
77868
78559
  #sigListeners = {};
77869
78560
  #loaded = false;
77870
- constructor(process19) {
78561
+ constructor(process13) {
77871
78562
  super();
77872
- this.#process = process19;
78563
+ this.#process = process13;
77873
78564
  this.#sigListeners = {};
77874
78565
  for (const sig of signals) {
77875
78566
  this.#sigListeners[sig] = () => {
77876
78567
  const listeners = this.#process.listeners(sig);
77877
78568
  let { count } = this.#emitter;
77878
- const p = process19;
78569
+ const p = process13;
77879
78570
  if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
77880
78571
  count += p.__signal_exit_emitter__.count;
77881
78572
  }
@@ -77884,12 +78575,12 @@ var init_mjs = __esm({
77884
78575
  const ret = this.#emitter.emit("exit", null, sig);
77885
78576
  const s = sig === "SIGHUP" ? this.#hupSig : sig;
77886
78577
  if (!ret)
77887
- process19.kill(process19.pid, s);
78578
+ process13.kill(process13.pid, s);
77888
78579
  }
77889
78580
  };
77890
78581
  }
77891
- this.#originalProcessReallyExit = process19.reallyExit;
77892
- this.#originalProcessEmit = process19.emit;
78582
+ this.#originalProcessReallyExit = process13.reallyExit;
78583
+ this.#originalProcessEmit = process13.emit;
77893
78584
  }
77894
78585
  onExit(cb, opts) {
77895
78586
  if (!processOk(this.#process)) {
@@ -78734,585 +79425,6 @@ var init_ora = __esm({
78734
79425
  }
78735
79426
  });
78736
79427
 
78737
- // ../../node_modules/is-docker/index.js
78738
- function hasDockerEnv() {
78739
- try {
78740
- import_node_fs3.default.statSync("/.dockerenv");
78741
- return true;
78742
- } catch {
78743
- return false;
78744
- }
78745
- }
78746
- function hasDockerCGroup() {
78747
- try {
78748
- return import_node_fs3.default.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
78749
- } catch {
78750
- return false;
78751
- }
78752
- }
78753
- function isDocker() {
78754
- if (isDockerCached === void 0) {
78755
- isDockerCached = hasDockerEnv() || hasDockerCGroup();
78756
- }
78757
- return isDockerCached;
78758
- }
78759
- var import_node_fs3, isDockerCached;
78760
- var init_is_docker = __esm({
78761
- "../../node_modules/is-docker/index.js"() {
78762
- "use strict";
78763
- import_node_fs3 = __toESM(require("fs"), 1);
78764
- }
78765
- });
78766
-
78767
- // ../../node_modules/is-inside-container/index.js
78768
- function isInsideContainer() {
78769
- if (cachedResult === void 0) {
78770
- cachedResult = hasContainerEnv() || isDocker();
78771
- }
78772
- return cachedResult;
78773
- }
78774
- var import_node_fs4, cachedResult, hasContainerEnv;
78775
- var init_is_inside_container = __esm({
78776
- "../../node_modules/is-inside-container/index.js"() {
78777
- "use strict";
78778
- import_node_fs4 = __toESM(require("fs"), 1);
78779
- init_is_docker();
78780
- hasContainerEnv = () => {
78781
- try {
78782
- import_node_fs4.default.statSync("/run/.containerenv");
78783
- return true;
78784
- } catch {
78785
- return false;
78786
- }
78787
- };
78788
- }
78789
- });
78790
-
78791
- // ../../node_modules/is-wsl/index.js
78792
- var import_node_process10, import_node_os5, import_node_fs5, isWsl, is_wsl_default;
78793
- var init_is_wsl = __esm({
78794
- "../../node_modules/is-wsl/index.js"() {
78795
- "use strict";
78796
- import_node_process10 = __toESM(require("process"), 1);
78797
- import_node_os5 = __toESM(require("os"), 1);
78798
- import_node_fs5 = __toESM(require("fs"), 1);
78799
- init_is_inside_container();
78800
- isWsl = () => {
78801
- if (import_node_process10.default.platform !== "linux") {
78802
- return false;
78803
- }
78804
- if (import_node_os5.default.release().toLowerCase().includes("microsoft")) {
78805
- if (isInsideContainer()) {
78806
- return false;
78807
- }
78808
- return true;
78809
- }
78810
- try {
78811
- if (import_node_fs5.default.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft")) {
78812
- return !isInsideContainer();
78813
- }
78814
- } catch {
78815
- }
78816
- if (import_node_fs5.default.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || import_node_fs5.default.existsSync("/run/WSL")) {
78817
- return !isInsideContainer();
78818
- }
78819
- return false;
78820
- };
78821
- is_wsl_default = import_node_process10.default.env.__IS_WSL_TEST__ ? isWsl : isWsl();
78822
- }
78823
- });
78824
-
78825
- // ../../node_modules/wsl-utils/index.js
78826
- var import_node_process11, import_promises4, wslDrivesMountPoint, powerShellPathFromWsl, powerShellPath;
78827
- var init_wsl_utils = __esm({
78828
- "../../node_modules/wsl-utils/index.js"() {
78829
- "use strict";
78830
- import_node_process11 = __toESM(require("process"), 1);
78831
- import_promises4 = __toESM(require("fs/promises"), 1);
78832
- init_is_wsl();
78833
- init_is_wsl();
78834
- wslDrivesMountPoint = /* @__PURE__ */ (() => {
78835
- const defaultMountPoint = "/mnt/";
78836
- let mountPoint;
78837
- return async function() {
78838
- if (mountPoint) {
78839
- return mountPoint;
78840
- }
78841
- const configFilePath = "/etc/wsl.conf";
78842
- let isConfigFileExists = false;
78843
- try {
78844
- await import_promises4.default.access(configFilePath, import_promises4.constants.F_OK);
78845
- isConfigFileExists = true;
78846
- } catch {
78847
- }
78848
- if (!isConfigFileExists) {
78849
- return defaultMountPoint;
78850
- }
78851
- const configContent = await import_promises4.default.readFile(configFilePath, { encoding: "utf8" });
78852
- const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
78853
- if (!configMountPoint) {
78854
- return defaultMountPoint;
78855
- }
78856
- mountPoint = configMountPoint.groups.mountPoint.trim();
78857
- mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
78858
- return mountPoint;
78859
- };
78860
- })();
78861
- powerShellPathFromWsl = async () => {
78862
- const mountPoint = await wslDrivesMountPoint();
78863
- return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
78864
- };
78865
- powerShellPath = async () => {
78866
- if (is_wsl_default) {
78867
- return powerShellPathFromWsl();
78868
- }
78869
- return `${import_node_process11.default.env.SYSTEMROOT || import_node_process11.default.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
78870
- };
78871
- }
78872
- });
78873
-
78874
- // ../../node_modules/define-lazy-prop/index.js
78875
- function defineLazyProperty(object2, propertyName, valueGetter) {
78876
- const define = (value) => Object.defineProperty(object2, propertyName, { value, enumerable: true, writable: true });
78877
- Object.defineProperty(object2, propertyName, {
78878
- configurable: true,
78879
- enumerable: true,
78880
- get() {
78881
- const result = valueGetter();
78882
- define(result);
78883
- return result;
78884
- },
78885
- set(value) {
78886
- define(value);
78887
- }
78888
- });
78889
- return object2;
78890
- }
78891
- var init_define_lazy_prop = __esm({
78892
- "../../node_modules/define-lazy-prop/index.js"() {
78893
- "use strict";
78894
- }
78895
- });
78896
-
78897
- // ../../node_modules/default-browser-id/index.js
78898
- async function defaultBrowserId() {
78899
- if (import_node_process12.default.platform !== "darwin") {
78900
- throw new Error("macOS only");
78901
- }
78902
- const { stdout } = await execFileAsync("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
78903
- const match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
78904
- const browserId = match?.groups.id ?? "com.apple.Safari";
78905
- if (browserId === "com.apple.safari") {
78906
- return "com.apple.Safari";
78907
- }
78908
- return browserId;
78909
- }
78910
- var import_node_util, import_node_process12, import_node_child_process, execFileAsync;
78911
- var init_default_browser_id = __esm({
78912
- "../../node_modules/default-browser-id/index.js"() {
78913
- "use strict";
78914
- import_node_util = require("util");
78915
- import_node_process12 = __toESM(require("process"), 1);
78916
- import_node_child_process = require("child_process");
78917
- execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
78918
- }
78919
- });
78920
-
78921
- // ../../node_modules/run-applescript/index.js
78922
- async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
78923
- if (import_node_process13.default.platform !== "darwin") {
78924
- throw new Error("macOS only");
78925
- }
78926
- const outputArguments = humanReadableOutput ? [] : ["-ss"];
78927
- const execOptions = {};
78928
- if (signal) {
78929
- execOptions.signal = signal;
78930
- }
78931
- const { stdout } = await execFileAsync2("osascript", ["-e", script, outputArguments], execOptions);
78932
- return stdout.trim();
78933
- }
78934
- var import_node_process13, import_node_util2, import_node_child_process2, execFileAsync2;
78935
- var init_run_applescript = __esm({
78936
- "../../node_modules/run-applescript/index.js"() {
78937
- "use strict";
78938
- import_node_process13 = __toESM(require("process"), 1);
78939
- import_node_util2 = require("util");
78940
- import_node_child_process2 = require("child_process");
78941
- execFileAsync2 = (0, import_node_util2.promisify)(import_node_child_process2.execFile);
78942
- }
78943
- });
78944
-
78945
- // ../../node_modules/bundle-name/index.js
78946
- async function bundleName(bundleId) {
78947
- return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string
78948
- tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
78949
- }
78950
- var init_bundle_name = __esm({
78951
- "../../node_modules/bundle-name/index.js"() {
78952
- "use strict";
78953
- init_run_applescript();
78954
- }
78955
- });
78956
-
78957
- // ../../node_modules/default-browser/windows.js
78958
- async function defaultBrowser(_execFileAsync = execFileAsync3) {
78959
- const { stdout } = await _execFileAsync("reg", [
78960
- "QUERY",
78961
- " HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
78962
- "/v",
78963
- "ProgId"
78964
- ]);
78965
- const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
78966
- if (!match) {
78967
- throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
78968
- }
78969
- const { id } = match.groups;
78970
- const dotIndex = id.lastIndexOf(".");
78971
- const hyphenIndex = id.lastIndexOf("-");
78972
- const baseIdByDot = dotIndex === -1 ? void 0 : id.slice(0, dotIndex);
78973
- const baseIdByHyphen = hyphenIndex === -1 ? void 0 : id.slice(0, hyphenIndex);
78974
- return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? { name: id, id };
78975
- }
78976
- var import_node_util3, import_node_child_process3, execFileAsync3, windowsBrowserProgIds, _windowsBrowserProgIdMap, UnknownBrowserError;
78977
- var init_windows = __esm({
78978
- "../../node_modules/default-browser/windows.js"() {
78979
- "use strict";
78980
- import_node_util3 = require("util");
78981
- import_node_child_process3 = require("child_process");
78982
- execFileAsync3 = (0, import_node_util3.promisify)(import_node_child_process3.execFile);
78983
- windowsBrowserProgIds = {
78984
- MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
78985
- // The missing `L` is correct.
78986
- MSEdgeBHTML: { name: "Edge Beta", id: "com.microsoft.edge.beta" },
78987
- MSEdgeDHTML: { name: "Edge Dev", id: "com.microsoft.edge.dev" },
78988
- AppXq0fevzme2pys62n3e0fbqa7peapykr8v: { name: "Edge", id: "com.microsoft.edge.old" },
78989
- ChromeHTML: { name: "Chrome", id: "com.google.chrome" },
78990
- ChromeBHTML: { name: "Chrome Beta", id: "com.google.chrome.beta" },
78991
- ChromeDHTML: { name: "Chrome Dev", id: "com.google.chrome.dev" },
78992
- ChromiumHTM: { name: "Chromium", id: "org.chromium.Chromium" },
78993
- BraveHTML: { name: "Brave", id: "com.brave.Browser" },
78994
- BraveBHTML: { name: "Brave Beta", id: "com.brave.Browser.beta" },
78995
- BraveDHTML: { name: "Brave Dev", id: "com.brave.Browser.dev" },
78996
- BraveSSHTM: { name: "Brave Nightly", id: "com.brave.Browser.nightly" },
78997
- FirefoxURL: { name: "Firefox", id: "org.mozilla.firefox" },
78998
- OperaStable: { name: "Opera", id: "com.operasoftware.Opera" },
78999
- VivaldiHTM: { name: "Vivaldi", id: "com.vivaldi.Vivaldi" },
79000
- "IE.HTTP": { name: "Internet Explorer", id: "com.microsoft.ie" }
79001
- };
79002
- _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
79003
- UnknownBrowserError = class extends Error {
79004
- };
79005
- }
79006
- });
79007
-
79008
- // ../../node_modules/default-browser/index.js
79009
- async function defaultBrowser2() {
79010
- if (import_node_process14.default.platform === "darwin") {
79011
- const id = await defaultBrowserId();
79012
- const name = await bundleName(id);
79013
- return { name, id };
79014
- }
79015
- if (import_node_process14.default.platform === "linux") {
79016
- const { stdout } = await execFileAsync4("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
79017
- const id = stdout.trim();
79018
- const name = titleize(id.replace(/.desktop$/, "").replace("-", " "));
79019
- return { name, id };
79020
- }
79021
- if (import_node_process14.default.platform === "win32") {
79022
- return defaultBrowser();
79023
- }
79024
- throw new Error("Only macOS, Linux, and Windows are supported");
79025
- }
79026
- var import_node_util4, import_node_process14, import_node_child_process4, execFileAsync4, titleize;
79027
- var init_default_browser = __esm({
79028
- "../../node_modules/default-browser/index.js"() {
79029
- "use strict";
79030
- import_node_util4 = require("util");
79031
- import_node_process14 = __toESM(require("process"), 1);
79032
- import_node_child_process4 = require("child_process");
79033
- init_default_browser_id();
79034
- init_bundle_name();
79035
- init_windows();
79036
- execFileAsync4 = (0, import_node_util4.promisify)(import_node_child_process4.execFile);
79037
- titleize = (string4) => string4.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
79038
- }
79039
- });
79040
-
79041
- // ../../node_modules/open/index.js
79042
- async function getWindowsDefaultBrowserFromWsl() {
79043
- const powershellPath = await powerShellPath();
79044
- const rawCommand = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
79045
- const encodedCommand = import_node_buffer.Buffer.from(rawCommand, "utf16le").toString("base64");
79046
- const { stdout } = await execFile5(
79047
- powershellPath,
79048
- [
79049
- "-NoProfile",
79050
- "-NonInteractive",
79051
- "-ExecutionPolicy",
79052
- "Bypass",
79053
- "-EncodedCommand",
79054
- encodedCommand
79055
- ],
79056
- { encoding: "utf8" }
79057
- );
79058
- const progId = stdout.trim();
79059
- const browserMap = {
79060
- ChromeHTML: "com.google.chrome",
79061
- BraveHTML: "com.brave.Browser",
79062
- MSEdgeHTM: "com.microsoft.edge",
79063
- FirefoxURL: "org.mozilla.firefox"
79064
- };
79065
- return browserMap[progId] ? { id: browserMap[progId] } : {};
79066
- }
79067
- function detectArchBinary(binary) {
79068
- if (typeof binary === "string" || Array.isArray(binary)) {
79069
- return binary;
79070
- }
79071
- const { [arch3]: archBinary } = binary;
79072
- if (!archBinary) {
79073
- throw new Error(`${arch3} is not supported`);
79074
- }
79075
- return archBinary;
79076
- }
79077
- function detectPlatformBinary({ [platform11]: platformBinary }, { wsl }) {
79078
- if (wsl && is_wsl_default) {
79079
- return detectArchBinary(wsl);
79080
- }
79081
- if (!platformBinary) {
79082
- throw new Error(`${platform11} is not supported`);
79083
- }
79084
- return detectArchBinary(platformBinary);
79085
- }
79086
- var import_node_process15, import_node_buffer, import_node_path3, import_node_url, import_node_util5, import_node_child_process5, import_promises5, import_meta, execFile5, __dirname2, localXdgOpenPath, platform11, arch3, pTryEach, baseOpen, open2, apps, open_default;
79087
- var init_open = __esm({
79088
- "../../node_modules/open/index.js"() {
79089
- "use strict";
79090
- import_node_process15 = __toESM(require("process"), 1);
79091
- import_node_buffer = require("buffer");
79092
- import_node_path3 = __toESM(require("path"), 1);
79093
- import_node_url = require("url");
79094
- import_node_util5 = require("util");
79095
- import_node_child_process5 = __toESM(require("child_process"), 1);
79096
- import_promises5 = __toESM(require("fs/promises"), 1);
79097
- init_wsl_utils();
79098
- init_define_lazy_prop();
79099
- init_default_browser();
79100
- init_is_inside_container();
79101
- import_meta = {};
79102
- execFile5 = (0, import_node_util5.promisify)(import_node_child_process5.default.execFile);
79103
- __dirname2 = import_node_path3.default.dirname((0, import_node_url.fileURLToPath)(import_meta.url));
79104
- localXdgOpenPath = import_node_path3.default.join(__dirname2, "xdg-open");
79105
- ({ platform: platform11, arch: arch3 } = import_node_process15.default);
79106
- pTryEach = async (array2, mapper) => {
79107
- let latestError;
79108
- for (const item of array2) {
79109
- try {
79110
- return await mapper(item);
79111
- } catch (error48) {
79112
- latestError = error48;
79113
- }
79114
- }
79115
- throw latestError;
79116
- };
79117
- baseOpen = async (options) => {
79118
- options = {
79119
- wait: false,
79120
- background: false,
79121
- newInstance: false,
79122
- allowNonzeroExitCode: false,
79123
- ...options
79124
- };
79125
- if (Array.isArray(options.app)) {
79126
- return pTryEach(options.app, (singleApp) => baseOpen({
79127
- ...options,
79128
- app: singleApp
79129
- }));
79130
- }
79131
- let { name: app, arguments: appArguments = [] } = options.app ?? {};
79132
- appArguments = [...appArguments];
79133
- if (Array.isArray(app)) {
79134
- return pTryEach(app, (appName) => baseOpen({
79135
- ...options,
79136
- app: {
79137
- name: appName,
79138
- arguments: appArguments
79139
- }
79140
- }));
79141
- }
79142
- if (app === "browser" || app === "browserPrivate") {
79143
- const ids = {
79144
- "com.google.chrome": "chrome",
79145
- "google-chrome.desktop": "chrome",
79146
- "com.brave.Browser": "brave",
79147
- "org.mozilla.firefox": "firefox",
79148
- "firefox.desktop": "firefox",
79149
- "com.microsoft.msedge": "edge",
79150
- "com.microsoft.edge": "edge",
79151
- "com.microsoft.edgemac": "edge",
79152
- "microsoft-edge.desktop": "edge"
79153
- };
79154
- const flags = {
79155
- chrome: "--incognito",
79156
- brave: "--incognito",
79157
- firefox: "--private-window",
79158
- edge: "--inPrivate"
79159
- };
79160
- const browser = is_wsl_default ? await getWindowsDefaultBrowserFromWsl() : await defaultBrowser2();
79161
- if (browser.id in ids) {
79162
- const browserName = ids[browser.id];
79163
- if (app === "browserPrivate") {
79164
- appArguments.push(flags[browserName]);
79165
- }
79166
- return baseOpen({
79167
- ...options,
79168
- app: {
79169
- name: apps[browserName],
79170
- arguments: appArguments
79171
- }
79172
- });
79173
- }
79174
- throw new Error(`${browser.name} is not supported as a default browser`);
79175
- }
79176
- let command;
79177
- const cliArguments = [];
79178
- const childProcessOptions = {};
79179
- if (platform11 === "darwin") {
79180
- command = "open";
79181
- if (options.wait) {
79182
- cliArguments.push("--wait-apps");
79183
- }
79184
- if (options.background) {
79185
- cliArguments.push("--background");
79186
- }
79187
- if (options.newInstance) {
79188
- cliArguments.push("--new");
79189
- }
79190
- if (app) {
79191
- cliArguments.push("-a", app);
79192
- }
79193
- } else if (platform11 === "win32" || is_wsl_default && !isInsideContainer() && !app) {
79194
- command = await powerShellPath();
79195
- cliArguments.push(
79196
- "-NoProfile",
79197
- "-NonInteractive",
79198
- "-ExecutionPolicy",
79199
- "Bypass",
79200
- "-EncodedCommand"
79201
- );
79202
- if (!is_wsl_default) {
79203
- childProcessOptions.windowsVerbatimArguments = true;
79204
- }
79205
- const encodedArguments = ["Start"];
79206
- if (options.wait) {
79207
- encodedArguments.push("-Wait");
79208
- }
79209
- if (app) {
79210
- encodedArguments.push(`"\`"${app}\`""`);
79211
- if (options.target) {
79212
- appArguments.push(options.target);
79213
- }
79214
- } else if (options.target) {
79215
- encodedArguments.push(`"${options.target}"`);
79216
- }
79217
- if (appArguments.length > 0) {
79218
- appArguments = appArguments.map((argument) => `"\`"${argument}\`""`);
79219
- encodedArguments.push("-ArgumentList", appArguments.join(","));
79220
- }
79221
- options.target = import_node_buffer.Buffer.from(encodedArguments.join(" "), "utf16le").toString("base64");
79222
- } else {
79223
- if (app) {
79224
- command = app;
79225
- } else {
79226
- const isBundled = !__dirname2 || __dirname2 === "/";
79227
- let exeLocalXdgOpen = false;
79228
- try {
79229
- await import_promises5.default.access(localXdgOpenPath, import_promises5.constants.X_OK);
79230
- exeLocalXdgOpen = true;
79231
- } catch {
79232
- }
79233
- const useSystemXdgOpen = import_node_process15.default.versions.electron ?? (platform11 === "android" || isBundled || !exeLocalXdgOpen);
79234
- command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
79235
- }
79236
- if (appArguments.length > 0) {
79237
- cliArguments.push(...appArguments);
79238
- }
79239
- if (!options.wait) {
79240
- childProcessOptions.stdio = "ignore";
79241
- childProcessOptions.detached = true;
79242
- }
79243
- }
79244
- if (platform11 === "darwin" && appArguments.length > 0) {
79245
- cliArguments.push("--args", ...appArguments);
79246
- }
79247
- if (options.target) {
79248
- cliArguments.push(options.target);
79249
- }
79250
- const subprocess = import_node_child_process5.default.spawn(command, cliArguments, childProcessOptions);
79251
- if (options.wait) {
79252
- return new Promise((resolve18, reject) => {
79253
- subprocess.once("error", reject);
79254
- subprocess.once("close", (exitCode) => {
79255
- if (!options.allowNonzeroExitCode && exitCode > 0) {
79256
- reject(new Error(`Exited with code ${exitCode}`));
79257
- return;
79258
- }
79259
- resolve18(subprocess);
79260
- });
79261
- });
79262
- }
79263
- subprocess.unref();
79264
- return subprocess;
79265
- };
79266
- open2 = (target, options) => {
79267
- if (typeof target !== "string") {
79268
- throw new TypeError("Expected a `target`");
79269
- }
79270
- return baseOpen({
79271
- ...options,
79272
- target
79273
- });
79274
- };
79275
- apps = {};
79276
- defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
79277
- darwin: "google chrome",
79278
- win32: "chrome",
79279
- linux: ["google-chrome", "google-chrome-stable", "chromium"]
79280
- }, {
79281
- wsl: {
79282
- ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
79283
- x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
79284
- }
79285
- }));
79286
- defineLazyProperty(apps, "brave", () => detectPlatformBinary({
79287
- darwin: "brave browser",
79288
- win32: "brave",
79289
- linux: ["brave-browser", "brave"]
79290
- }, {
79291
- wsl: {
79292
- ia32: "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",
79293
- x64: ["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe", "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]
79294
- }
79295
- }));
79296
- defineLazyProperty(apps, "firefox", () => detectPlatformBinary({
79297
- darwin: "firefox",
79298
- win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
79299
- linux: "firefox"
79300
- }, {
79301
- wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
79302
- }));
79303
- defineLazyProperty(apps, "edge", () => detectPlatformBinary({
79304
- darwin: "microsoft edge",
79305
- win32: "msedge",
79306
- linux: ["microsoft-edge", "microsoft-edge-dev"]
79307
- }, {
79308
- wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
79309
- }));
79310
- defineLazyProperty(apps, "browser", () => "browser");
79311
- defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
79312
- open_default = open2;
79313
- }
79314
- });
79315
-
79316
79428
  // src/version.ts
79317
79429
  function resolvePackageVersion(options) {
79318
79430
  const injectedVersion = options?.injectedVersion || "unknown";
@@ -80540,12 +80652,12 @@ var init_peer_connection_manager = __esm({
80540
80652
  });
80541
80653
 
80542
80654
  // src/daemon-p2p/index.ts
80543
- var fs20, path26, import_node_module2, esmRequire, DaemonP2PSender;
80655
+ var fs15, path25, import_node_module2, esmRequire, DaemonP2PSender;
80544
80656
  var init_daemon_p2p = __esm({
80545
80657
  "src/daemon-p2p/index.ts"() {
80546
80658
  "use strict";
80547
- fs20 = __toESM(require("fs"));
80548
- path26 = __toESM(require("path"));
80659
+ fs15 = __toESM(require("fs"));
80660
+ path25 = __toESM(require("path"));
80549
80661
  import_node_module2 = require("module");
80550
80662
  init_src();
80551
80663
  init_data_channel_router();
@@ -80619,22 +80731,22 @@ var init_daemon_p2p = __esm({
80619
80731
  log(`node-datachannel not found: ${e?.message}
80620
80732
  ${e?.stack || ""}`);
80621
80733
  }
80622
- const platform13 = process.platform;
80623
- const arch4 = process.arch;
80624
- const prebuildKey = `${platform13}-${arch4}`;
80734
+ const platform12 = process.platform;
80735
+ const arch3 = process.arch;
80736
+ const prebuildKey = `${platform12}-${arch3}`;
80625
80737
  try {
80626
80738
  const candidates = [
80627
- path26.join(__dirname, "node_modules", "node-datachannel"),
80628
- path26.join(__dirname, "..", "node_modules", "node-datachannel"),
80629
- path26.join(__dirname, "..", "..", "node_modules", "node-datachannel")
80739
+ path25.join(__dirname, "node_modules", "node-datachannel"),
80740
+ path25.join(__dirname, "..", "node_modules", "node-datachannel"),
80741
+ path25.join(__dirname, "..", "..", "node_modules", "node-datachannel")
80630
80742
  ];
80631
80743
  for (const candidate of candidates) {
80632
- const prebuildPath = path26.join(candidate, "prebuilds", prebuildKey, "node_datachannel.node");
80633
- if (fs20.existsSync(prebuildPath)) {
80634
- const targetDir = path26.join(candidate, "build", "Release");
80635
- const targetPath = path26.join(targetDir, "node_datachannel.node");
80636
- fs20.mkdirSync(targetDir, { recursive: true });
80637
- fs20.copyFileSync(prebuildPath, targetPath);
80744
+ const prebuildPath = path25.join(candidate, "prebuilds", prebuildKey, "node_datachannel.node");
80745
+ if (fs15.existsSync(prebuildPath)) {
80746
+ const targetDir = path25.join(candidate, "build", "Release");
80747
+ const targetPath = path25.join(targetDir, "node_datachannel.node");
80748
+ fs15.mkdirSync(targetDir, { recursive: true });
80749
+ fs15.copyFileSync(prebuildPath, targetPath);
80638
80750
  try {
80639
80751
  delete esmRequire.cache[esmRequire.resolve("node-datachannel")];
80640
80752
  } catch {
@@ -81001,27 +81113,27 @@ var require_process = __commonJS({
81001
81113
  var require_filesystem = __commonJS({
81002
81114
  "../../node_modules/detect-libc/lib/filesystem.js"(exports2, module2) {
81003
81115
  "use strict";
81004
- var fs27 = require("fs");
81116
+ var fs22 = require("fs");
81005
81117
  var LDD_PATH = "/usr/bin/ldd";
81006
81118
  var SELF_PATH = "/proc/self/exe";
81007
81119
  var MAX_LENGTH = 2048;
81008
- var readFileSync20 = (path36) => {
81009
- const fd = fs27.openSync(path36, "r");
81120
+ var readFileSync20 = (path35) => {
81121
+ const fd = fs22.openSync(path35, "r");
81010
81122
  const buffer = Buffer.alloc(MAX_LENGTH);
81011
- const bytesRead = fs27.readSync(fd, buffer, 0, MAX_LENGTH, 0);
81012
- fs27.close(fd, () => {
81123
+ const bytesRead = fs22.readSync(fd, buffer, 0, MAX_LENGTH, 0);
81124
+ fs22.close(fd, () => {
81013
81125
  });
81014
81126
  return buffer.subarray(0, bytesRead);
81015
81127
  };
81016
- var readFile = (path36) => new Promise((resolve18, reject) => {
81017
- fs27.open(path36, "r", (err, fd) => {
81128
+ var readFile = (path35) => new Promise((resolve18, reject) => {
81129
+ fs22.open(path35, "r", (err, fd) => {
81018
81130
  if (err) {
81019
81131
  reject(err);
81020
81132
  } else {
81021
81133
  const buffer = Buffer.alloc(MAX_LENGTH);
81022
- fs27.read(fd, buffer, 0, MAX_LENGTH, 0, (_2, bytesRead) => {
81134
+ fs22.read(fd, buffer, 0, MAX_LENGTH, 0, (_2, bytesRead) => {
81023
81135
  resolve18(buffer.subarray(0, bytesRead));
81024
- fs27.close(fd, () => {
81136
+ fs22.close(fd, () => {
81025
81137
  });
81026
81138
  });
81027
81139
  }
@@ -81077,7 +81189,7 @@ var require_elf = __commonJS({
81077
81189
  var require_detect_libc = __commonJS({
81078
81190
  "../../node_modules/detect-libc/lib/detect-libc.js"(exports2, module2) {
81079
81191
  "use strict";
81080
- var childProcess2 = require("child_process");
81192
+ var childProcess = require("child_process");
81081
81193
  var { isLinux: isLinux2, getReport } = require_process();
81082
81194
  var { LDD_PATH, SELF_PATH, readFile, readFileSync: readFileSync20 } = require_filesystem();
81083
81195
  var { interpreterPath } = require_elf();
@@ -81089,7 +81201,7 @@ var require_detect_libc = __commonJS({
81089
81201
  var safeCommand = () => {
81090
81202
  if (!commandOut) {
81091
81203
  return new Promise((resolve18) => {
81092
- childProcess2.exec(command, (err, out) => {
81204
+ childProcess.exec(command, (err, out) => {
81093
81205
  commandOut = err ? " " : out;
81094
81206
  resolve18(commandOut);
81095
81207
  });
@@ -81100,7 +81212,7 @@ var require_detect_libc = __commonJS({
81100
81212
  var safeCommandSync = () => {
81101
81213
  if (!commandOut) {
81102
81214
  try {
81103
- commandOut = childProcess2.execSync(command, { encoding: "utf8" });
81215
+ commandOut = childProcess.execSync(command, { encoding: "utf8" });
81104
81216
  } catch (_err) {
81105
81217
  commandOut = " ";
81106
81218
  }
@@ -81133,11 +81245,11 @@ var require_detect_libc = __commonJS({
81133
81245
  }
81134
81246
  return null;
81135
81247
  };
81136
- var familyFromInterpreterPath = (path36) => {
81137
- if (path36) {
81138
- if (path36.includes("/ld-musl-")) {
81248
+ var familyFromInterpreterPath = (path35) => {
81249
+ if (path35) {
81250
+ if (path35.includes("/ld-musl-")) {
81139
81251
  return MUSL;
81140
- } else if (path36.includes("/ld-linux-")) {
81252
+ } else if (path35.includes("/ld-linux-")) {
81141
81253
  return GLIBC;
81142
81254
  }
81143
81255
  }
@@ -81184,8 +81296,8 @@ var require_detect_libc = __commonJS({
81184
81296
  cachedFamilyInterpreter = null;
81185
81297
  try {
81186
81298
  const selfContent = await readFile(SELF_PATH);
81187
- const path36 = interpreterPath(selfContent);
81188
- cachedFamilyInterpreter = familyFromInterpreterPath(path36);
81299
+ const path35 = interpreterPath(selfContent);
81300
+ cachedFamilyInterpreter = familyFromInterpreterPath(path35);
81189
81301
  } catch (e) {
81190
81302
  }
81191
81303
  return cachedFamilyInterpreter;
@@ -81197,8 +81309,8 @@ var require_detect_libc = __commonJS({
81197
81309
  cachedFamilyInterpreter = null;
81198
81310
  try {
81199
81311
  const selfContent = readFileSync20(SELF_PATH);
81200
- const path36 = interpreterPath(selfContent);
81201
- cachedFamilyInterpreter = familyFromInterpreterPath(path36);
81312
+ const path35 = interpreterPath(selfContent);
81313
+ cachedFamilyInterpreter = familyFromInterpreterPath(path35);
81202
81314
  } catch (e) {
81203
81315
  }
81204
81316
  return cachedFamilyInterpreter;
@@ -82917,18 +83029,18 @@ var require_sharp = __commonJS({
82917
83029
  `@img/sharp-${runtimePlatform}/sharp.node`,
82918
83030
  "@img/sharp-wasm32/sharp.node"
82919
83031
  ];
82920
- var path36;
83032
+ var path35;
82921
83033
  var sharp;
82922
83034
  var errors = [];
82923
- for (path36 of paths) {
83035
+ for (path35 of paths) {
82924
83036
  try {
82925
- sharp = require(path36);
83037
+ sharp = require(path35);
82926
83038
  break;
82927
83039
  } catch (err) {
82928
83040
  errors.push(err);
82929
83041
  }
82930
83042
  }
82931
- if (sharp && path36.startsWith("@img/sharp-linux-x64") && !sharp._isUsingX64V2()) {
83043
+ if (sharp && path35.startsWith("@img/sharp-linux-x64") && !sharp._isUsingX64V2()) {
82932
83044
  const err = new Error("Prebuilt binaries for linux-x64 require v2 microarchitecture");
82933
83045
  err.code = "Unsupported CPU";
82934
83046
  errors.push(err);
@@ -82937,7 +83049,7 @@ var require_sharp = __commonJS({
82937
83049
  if (sharp) {
82938
83050
  module2.exports = sharp;
82939
83051
  } else {
82940
- const [isLinux2, isMacOs, isWindows2] = ["linux", "darwin", "win32"].map((os31) => runtimePlatform.startsWith(os31));
83052
+ const [isLinux2, isMacOs, isWindows2] = ["linux", "darwin", "win32"].map((os30) => runtimePlatform.startsWith(os30));
82941
83053
  const help = [`Could not load the "sharp" module using the ${runtimePlatform} runtime`];
82942
83054
  errors.forEach((err) => {
82943
83055
  if (err.code !== "MODULE_NOT_FOUND") {
@@ -82954,15 +83066,15 @@ var require_sharp = __commonJS({
82954
83066
  ` Requires ${expected}`
82955
83067
  );
82956
83068
  } else if (prebuiltPlatforms.includes(runtimePlatform)) {
82957
- const [os31, cpu] = runtimePlatform.split("-");
82958
- const libc = os31.endsWith("musl") ? " --libc=musl" : "";
83069
+ const [os30, cpu] = runtimePlatform.split("-");
83070
+ const libc = os30.endsWith("musl") ? " --libc=musl" : "";
82959
83071
  help.push(
82960
83072
  "- Ensure optional dependencies can be installed:",
82961
83073
  " npm install --include=optional sharp",
82962
83074
  "- Ensure your package manager supports multi-platform installation:",
82963
83075
  " See https://sharp.pixelplumbing.com/install#cross-platform",
82964
83076
  "- Add platform-specific dependencies:",
82965
- ` npm install --os=${os31.replace("musl", "")}${libc} --cpu=${cpu} sharp`
83077
+ ` npm install --os=${os30.replace("musl", "")}${libc} --cpu=${cpu} sharp`
82966
83078
  );
82967
83079
  } else {
82968
83080
  help.push(
@@ -85837,15 +85949,15 @@ var require_color = __commonJS({
85837
85949
  };
85838
85950
  }
85839
85951
  function wrapConversion(toModel, graph) {
85840
- const path36 = [graph[toModel].parent, toModel];
85952
+ const path35 = [graph[toModel].parent, toModel];
85841
85953
  let fn = conversions_default[graph[toModel].parent][toModel];
85842
85954
  let cur = graph[toModel].parent;
85843
85955
  while (graph[cur].parent) {
85844
- path36.unshift(graph[cur].parent);
85956
+ path35.unshift(graph[cur].parent);
85845
85957
  fn = link(conversions_default[graph[cur].parent][cur], fn);
85846
85958
  cur = graph[cur].parent;
85847
85959
  }
85848
- fn.conversion = path36;
85960
+ fn.conversion = path35;
85849
85961
  return fn;
85850
85962
  }
85851
85963
  function route(fromModel) {
@@ -86462,7 +86574,7 @@ var require_channel = __commonJS({
86462
86574
  var require_output = __commonJS({
86463
86575
  "../../node_modules/sharp/lib/output.js"(exports2, module2) {
86464
86576
  "use strict";
86465
- var path36 = require("path");
86577
+ var path35 = require("path");
86466
86578
  var is = require_is();
86467
86579
  var sharp = require_sharp();
86468
86580
  var formats = /* @__PURE__ */ new Map([
@@ -86493,9 +86605,9 @@ var require_output = __commonJS({
86493
86605
  let err;
86494
86606
  if (!is.string(fileOut)) {
86495
86607
  err = new Error("Missing output file path");
86496
- } else if (is.string(this.options.input.file) && path36.resolve(this.options.input.file) === path36.resolve(fileOut)) {
86608
+ } else if (is.string(this.options.input.file) && path35.resolve(this.options.input.file) === path35.resolve(fileOut)) {
86497
86609
  err = new Error("Cannot use same file for input and output");
86498
- } else if (jp2Regex.test(path36.extname(fileOut)) && !this.constructor.format.jp2k.output.file) {
86610
+ } else if (jp2Regex.test(path35.extname(fileOut)) && !this.constructor.format.jp2k.output.file) {
86499
86611
  err = errJp2Save();
86500
86612
  }
86501
86613
  if (err) {
@@ -87769,21 +87881,21 @@ function quarantineLegacyStandaloneSessions(options) {
87769
87881
  if (shouldSkipForExplicitOverride(env3)) {
87770
87882
  return { movedCount: 0, skippedActiveCount: 0, backupDir: null };
87771
87883
  }
87772
- const homeDir = options.homeDir || os26.homedir();
87884
+ const homeDir = options.homeDir || os25.homedir();
87773
87885
  const now = options.now || (() => /* @__PURE__ */ new Date());
87774
87886
  const isPidRunning = options.isPidRunning || defaultPidRunning;
87775
- const runtimesDir = path27.join(homeDir, ".adhdev", "session-host", options.appName, "runtimes");
87776
- if (!fs21.existsSync(runtimesDir)) {
87887
+ const runtimesDir = path26.join(homeDir, ".adhdev", "session-host", options.appName, "runtimes");
87888
+ if (!fs16.existsSync(runtimesDir)) {
87777
87889
  return { movedCount: 0, skippedActiveCount: 0, backupDir: null };
87778
87890
  }
87779
- const candidates = fs21.readdirSync(runtimesDir).filter((name) => name.endsWith(".json")).map((name) => path27.join(runtimesDir, name));
87891
+ const candidates = fs16.readdirSync(runtimesDir).filter((name) => name.endsWith(".json")).map((name) => path26.join(runtimesDir, name));
87780
87892
  let movedCount = 0;
87781
87893
  let skippedActiveCount = 0;
87782
87894
  let backupDir = null;
87783
87895
  for (const sourcePath of candidates) {
87784
87896
  let parsed;
87785
87897
  try {
87786
- parsed = JSON.parse(fs21.readFileSync(sourcePath, "utf8"));
87898
+ parsed = JSON.parse(fs16.readFileSync(sourcePath, "utf8"));
87787
87899
  } catch {
87788
87900
  continue;
87789
87901
  }
@@ -87794,26 +87906,26 @@ function quarantineLegacyStandaloneSessions(options) {
87794
87906
  continue;
87795
87907
  }
87796
87908
  if (!backupDir) {
87797
- backupDir = path27.join(
87909
+ backupDir = path26.join(
87798
87910
  homeDir,
87799
87911
  ".adhdev",
87800
87912
  "session-host-backups",
87801
87913
  `legacy-standalone-${options.appName}-${formatTimestamp(now())}`
87802
87914
  );
87803
- fs21.mkdirSync(path27.join(backupDir, "runtimes"), { recursive: true });
87915
+ fs16.mkdirSync(path26.join(backupDir, "runtimes"), { recursive: true });
87804
87916
  }
87805
- fs21.renameSync(sourcePath, path27.join(backupDir, "runtimes", path27.basename(sourcePath)));
87917
+ fs16.renameSync(sourcePath, path26.join(backupDir, "runtimes", path26.basename(sourcePath)));
87806
87918
  movedCount += 1;
87807
87919
  }
87808
87920
  return { movedCount, skippedActiveCount, backupDir };
87809
87921
  }
87810
- var fs21, os26, path27, LEGACY_STANDALONE_MANAGER_TAG;
87922
+ var fs16, os25, path26, LEGACY_STANDALONE_MANAGER_TAG;
87811
87923
  var init_session_host_hygiene = __esm({
87812
87924
  "src/session-host-hygiene.ts"() {
87813
87925
  "use strict";
87814
- fs21 = __toESM(require("fs"));
87815
- os26 = __toESM(require("os"));
87816
- path27 = __toESM(require("path"));
87926
+ fs16 = __toESM(require("fs"));
87927
+ os25 = __toESM(require("os"));
87928
+ path26 = __toESM(require("path"));
87817
87929
  init_src();
87818
87930
  LEGACY_STANDALONE_MANAGER_TAG = "adhdev-standalone";
87819
87931
  }
@@ -87837,18 +87949,18 @@ function buildSessionHostEnv(baseEnv) {
87837
87949
  }
87838
87950
  function resolveSessionHostEntry() {
87839
87951
  const packagedCandidates = [
87840
- path28.resolve(__dirname, "../vendor/session-host-daemon/index.js"),
87841
- path28.resolve(__dirname, "../../vendor/session-host-daemon/index.js")
87952
+ path27.resolve(__dirname, "../vendor/session-host-daemon/index.js"),
87953
+ path27.resolve(__dirname, "../../vendor/session-host-daemon/index.js")
87842
87954
  ];
87843
87955
  for (const candidate of packagedCandidates) {
87844
- if (fs22.existsSync(candidate)) {
87956
+ if (fs17.existsSync(candidate)) {
87845
87957
  return candidate;
87846
87958
  }
87847
87959
  }
87848
87960
  return require.resolve("@adhdev/session-host-daemon");
87849
87961
  }
87850
87962
  function getSessionHostPidFile() {
87851
- return path28.join(os27.homedir(), ".adhdev", `${SESSION_HOST_APP_NAME}-session-host.pid`);
87963
+ return path27.join(os26.homedir(), ".adhdev", `${SESSION_HOST_APP_NAME}-session-host.pid`);
87852
87964
  }
87853
87965
  function getSessionHostStatusPaths() {
87854
87966
  return {
@@ -87859,8 +87971,8 @@ function getSessionHostStatusPaths() {
87859
87971
  function getSessionHostPid() {
87860
87972
  try {
87861
87973
  const pidFile = getSessionHostPidFile();
87862
- if (!fs22.existsSync(pidFile)) return null;
87863
- const pid = Number.parseInt(fs22.readFileSync(pidFile, "utf8").trim(), 10);
87974
+ if (!fs17.existsSync(pidFile)) return null;
87975
+ const pid = Number.parseInt(fs17.readFileSync(pidFile, "utf8").trim(), 10);
87864
87976
  return Number.isFinite(pid) ? pid : null;
87865
87977
  } catch {
87866
87978
  return null;
@@ -87930,8 +88042,8 @@ function stopManagedSessionHostProcess() {
87930
88042
  let stopped = false;
87931
88043
  const pidFile = getSessionHostPidFile();
87932
88044
  try {
87933
- if (fs22.existsSync(pidFile)) {
87934
- const pid = Number.parseInt(fs22.readFileSync(pidFile, "utf8").trim(), 10);
88045
+ if (fs17.existsSync(pidFile)) {
88046
+ const pid = Number.parseInt(fs17.readFileSync(pidFile, "utf8").trim(), 10);
87935
88047
  if (Number.isFinite(pid) && pid !== process.pid && isManagedSessionHostPid2(pid)) {
87936
88048
  stopped = killPid2(pid) || stopped;
87937
88049
  }
@@ -87939,7 +88051,7 @@ function stopManagedSessionHostProcess() {
87939
88051
  } catch {
87940
88052
  } finally {
87941
88053
  try {
87942
- fs22.unlinkSync(pidFile);
88054
+ fs17.unlinkSync(pidFile);
87943
88055
  } catch {
87944
88056
  }
87945
88057
  }
@@ -87967,9 +88079,9 @@ async function ensureSessionHostReady2() {
87967
88079
  }
87968
88080
  const spawnHost = () => {
87969
88081
  const entry = resolveSessionHostEntry();
87970
- const logDir = path28.join(os27.homedir(), ".adhdev", "logs");
87971
- fs22.mkdirSync(logDir, { recursive: true });
87972
- const logFd = fs22.openSync(path28.join(logDir, "session-host.log"), "a");
88082
+ const logDir = path27.join(os26.homedir(), ".adhdev", "logs");
88083
+ fs17.mkdirSync(logDir, { recursive: true });
88084
+ const logFd = fs17.openSync(path27.join(logDir, "session-host.log"), "a");
87973
88085
  const child = (0, import_child_process13.spawn)(process.execPath, [entry], {
87974
88086
  detached: true,
87975
88087
  stdio: ["ignore", logFd, logFd],
@@ -87978,7 +88090,7 @@ async function ensureSessionHostReady2() {
87978
88090
  });
87979
88091
  child.unref();
87980
88092
  try {
87981
- fs22.closeSync(logFd);
88093
+ fs17.closeSync(logFd);
87982
88094
  } catch {
87983
88095
  }
87984
88096
  };
@@ -88031,14 +88143,14 @@ async function probeSessionHostStatus() {
88031
88143
  };
88032
88144
  }
88033
88145
  }
88034
- var import_child_process13, fs22, os27, path28, SESSION_HOST_APP_NAME, SESSION_HOST_START_TIMEOUT_MS;
88146
+ var import_child_process13, fs17, os26, path27, SESSION_HOST_APP_NAME, SESSION_HOST_START_TIMEOUT_MS;
88035
88147
  var init_session_host = __esm({
88036
88148
  "src/session-host.ts"() {
88037
88149
  "use strict";
88038
88150
  import_child_process13 = require("child_process");
88039
- fs22 = __toESM(require("fs"));
88040
- os27 = __toESM(require("os"));
88041
- path28 = __toESM(require("path"));
88151
+ fs17 = __toESM(require("fs"));
88152
+ os26 = __toESM(require("os"));
88153
+ path27 = __toESM(require("path"));
88042
88154
  init_src();
88043
88155
  init_dist();
88044
88156
  init_session_host_hygiene();
@@ -88266,29 +88378,29 @@ function resolveDaemonPort(ref = {}) {
88266
88378
  return Number.isFinite(ref.port) && Number(ref.port) > 0 ? Number(ref.port) : DEFAULT_DAEMON_PORT;
88267
88379
  }
88268
88380
  function getDaemonPidFile(ref = {}) {
88269
- const dir = path29.join(ref.homeDir || os28.homedir(), ".adhdev");
88270
- if (!fs23.existsSync(dir)) fs23.mkdirSync(dir, { recursive: true });
88381
+ const dir = path28.join(ref.homeDir || os27.homedir(), ".adhdev");
88382
+ if (!fs18.existsSync(dir)) fs18.mkdirSync(dir, { recursive: true });
88271
88383
  const port = resolveDaemonPort(ref);
88272
- return path29.join(dir, port === DEFAULT_DAEMON_PORT ? "daemon.pid" : `daemon-${port}.pid`);
88384
+ return path28.join(dir, port === DEFAULT_DAEMON_PORT ? "daemon.pid" : `daemon-${port}.pid`);
88273
88385
  }
88274
88386
  function writeDaemonPid(pid, ref = {}) {
88275
88387
  const pidFile = getDaemonPidFile(ref);
88276
88388
  try {
88277
- fs23.writeFileSync(pidFile, String(pid), { encoding: "utf-8", flag: "wx" });
88389
+ fs18.writeFileSync(pidFile, String(pid), { encoding: "utf-8", flag: "wx" });
88278
88390
  } catch {
88279
- fs23.writeFileSync(pidFile, String(pid), "utf-8");
88391
+ fs18.writeFileSync(pidFile, String(pid), "utf-8");
88280
88392
  }
88281
88393
  }
88282
88394
  function removeDaemonPid(ref = {}) {
88283
88395
  try {
88284
- fs23.unlinkSync(getDaemonPidFile(ref));
88396
+ fs18.unlinkSync(getDaemonPidFile(ref));
88285
88397
  } catch (e) {
88286
88398
  }
88287
88399
  }
88288
88400
  function isDaemonRunning(ref = {}) {
88289
88401
  const port = resolveDaemonPort(ref);
88290
88402
  try {
88291
- const { execFileSync: execFileSync7 } = require("child_process");
88403
+ const { execFileSync: execFileSync6 } = require("child_process");
88292
88404
  const probe = `
88293
88405
  const http = require('http');
88294
88406
  const req = http.get('http://127.0.0.1:${port}/health', { timeout: 1500 }, (res) => {
@@ -88298,7 +88410,7 @@ function isDaemonRunning(ref = {}) {
88298
88410
  req.on('error', () => process.stdout.write('0'));
88299
88411
  req.on('timeout', () => { req.destroy(); process.stdout.write('0'); });
88300
88412
  `;
88301
- const result = execFileSync7(process.execPath, ["-e", probe], {
88413
+ const result = execFileSync6(process.execPath, ["-e", probe], {
88302
88414
  encoding: "utf-8",
88303
88415
  timeout: 3e3,
88304
88416
  stdio: ["ignore", "pipe", "ignore"]
@@ -88308,8 +88420,8 @@ function isDaemonRunning(ref = {}) {
88308
88420
  }
88309
88421
  const pidFile = getDaemonPidFile(ref);
88310
88422
  try {
88311
- if (!fs23.existsSync(pidFile)) return false;
88312
- const pid = parseInt(fs23.readFileSync(pidFile, "utf-8").trim());
88423
+ if (!fs18.existsSync(pidFile)) return false;
88424
+ const pid = parseInt(fs18.readFileSync(pidFile, "utf-8").trim());
88313
88425
  process.kill(pid, 0);
88314
88426
  if (!isAdhdevProcess(pid)) {
88315
88427
  removeDaemonPid(ref);
@@ -88324,9 +88436,9 @@ function isDaemonRunning(ref = {}) {
88324
88436
  function isAdhdevProcess(pid) {
88325
88437
  try {
88326
88438
  if (process.platform === "win32") {
88327
- const { execFileSync: execFileSync7 } = require("child_process");
88439
+ const { execFileSync: execFileSync6 } = require("child_process");
88328
88440
  try {
88329
- const psOut = execFileSync7("powershell.exe", [
88441
+ const psOut = execFileSync6("powershell.exe", [
88330
88442
  "-NoProfile",
88331
88443
  "-NonInteractive",
88332
88444
  "-ExecutionPolicy",
@@ -88339,8 +88451,8 @@ function isAdhdevProcess(pid) {
88339
88451
  return true;
88340
88452
  }
88341
88453
  } else {
88342
- const { execFileSync: execFileSync7 } = require("child_process");
88343
- const cmdline = execFileSync7("ps", ["-o", "command=", "-p", String(pid)], {
88454
+ const { execFileSync: execFileSync6 } = require("child_process");
88455
+ const cmdline = execFileSync6("ps", ["-o", "command=", "-p", String(pid)], {
88344
88456
  encoding: "utf-8",
88345
88457
  timeout: 2e3,
88346
88458
  stdio: ["ignore", "pipe", "ignore"]
@@ -88354,7 +88466,7 @@ function isAdhdevProcess(pid) {
88354
88466
  function getDaemonHealthPid(ref = {}) {
88355
88467
  const port = resolveDaemonPort(ref);
88356
88468
  try {
88357
- const { execFileSync: execFileSync7 } = require("child_process");
88469
+ const { execFileSync: execFileSync6 } = require("child_process");
88358
88470
  const probe = `
88359
88471
  const http = require('http');
88360
88472
  const req = http.get('http://127.0.0.1:${port}/health', { timeout: 1500 }, (res) => {
@@ -88372,7 +88484,7 @@ function getDaemonHealthPid(ref = {}) {
88372
88484
  req.on('error', () => {});
88373
88485
  req.on('timeout', () => { req.destroy(); });
88374
88486
  `;
88375
- const result = execFileSync7(process.execPath, ["-e", probe], {
88487
+ const result = execFileSync6(process.execPath, ["-e", probe], {
88376
88488
  encoding: "utf-8",
88377
88489
  timeout: 3e3,
88378
88490
  stdio: ["ignore", "pipe", "ignore"]
@@ -88386,8 +88498,8 @@ function getDaemonHealthPid(ref = {}) {
88386
88498
  function getDaemonPid(ref = {}) {
88387
88499
  const pidFile = getDaemonPidFile(ref);
88388
88500
  try {
88389
- if (fs23.existsSync(pidFile)) {
88390
- const pid = parseInt(fs23.readFileSync(pidFile, "utf-8").trim(), 10);
88501
+ if (fs18.existsSync(pidFile)) {
88502
+ const pid = parseInt(fs18.readFileSync(pidFile, "utf-8").trim(), 10);
88391
88503
  if (Number.isFinite(pid)) return pid;
88392
88504
  }
88393
88505
  } catch {
@@ -88398,8 +88510,8 @@ function stopDaemon(ref = {}) {
88398
88510
  const pidFile = getDaemonPidFile(ref);
88399
88511
  let pid = null;
88400
88512
  try {
88401
- if (fs23.existsSync(pidFile)) {
88402
- const pidFromFile = parseInt(fs23.readFileSync(pidFile, "utf-8").trim(), 10);
88513
+ if (fs18.existsSync(pidFile)) {
88514
+ const pidFromFile = parseInt(fs18.readFileSync(pidFile, "utf-8").trim(), 10);
88403
88515
  if (Number.isFinite(pidFromFile)) pid = pidFromFile;
88404
88516
  }
88405
88517
  } catch {
@@ -88418,7 +88530,7 @@ function stopDaemon(ref = {}) {
88418
88530
  return false;
88419
88531
  }
88420
88532
  }
88421
- var os28, fs23, path29, import_http, import_child_process14, import_ws3, pkgVersion, AdhdevDaemon;
88533
+ var os27, fs18, path28, import_http, import_child_process14, import_ws3, pkgVersion, AdhdevDaemon;
88422
88534
  var init_adhdev_daemon = __esm({
88423
88535
  "src/adhdev-daemon.ts"() {
88424
88536
  "use strict";
@@ -88430,9 +88542,9 @@ var init_adhdev_daemon = __esm({
88430
88542
  init_startup_restore_policy();
88431
88543
  init_dist();
88432
88544
  init_session_host_controller();
88433
- os28 = __toESM(require("os"));
88434
- fs23 = __toESM(require("fs"));
88435
- path29 = __toESM(require("path"));
88545
+ os27 = __toESM(require("os"));
88546
+ fs18 = __toESM(require("fs"));
88547
+ path28 = __toESM(require("path"));
88436
88548
  import_http = require("http");
88437
88549
  import_child_process14 = require("child_process");
88438
88550
  import_ws3 = require("ws");
@@ -88440,7 +88552,7 @@ var init_adhdev_daemon = __esm({
88440
88552
  init_version();
88441
88553
  init_src();
88442
88554
  init_runtime_defaults();
88443
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.43" });
88555
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.45" });
88444
88556
  AdhdevDaemon = class _AdhdevDaemon {
88445
88557
  localHttpServer = null;
88446
88558
  localWss = null;
@@ -88964,8 +89076,8 @@ ${err?.stack || ""}`);
88964
89076
  cliInfo: {
88965
89077
  type: "adhdev-daemon",
88966
89078
  version: pkgVersion,
88967
- platform: os28.platform(),
88968
- hostname: os28.hostname(),
89079
+ platform: os27.platform(),
89080
+ hostname: os27.hostname(),
88969
89081
  machineId: config2.machineId,
88970
89082
  instanceId
88971
89083
  }
@@ -89564,6 +89676,10 @@ var wizard_exports = {};
89564
89676
  __export(wizard_exports, {
89565
89677
  runWizard: () => runWizard
89566
89678
  });
89679
+ async function openBrowser(url2) {
89680
+ const mod = await import("open");
89681
+ return mod.default(url2);
89682
+ }
89567
89683
  function hasCloudMachineAuth() {
89568
89684
  const config2 = loadConfig();
89569
89685
  return Boolean(config2.machineSecret && config2.machineSecret.trim());
@@ -89613,9 +89729,9 @@ async function runWizard(options = {}) {
89613
89729
  }
89614
89730
  async function checkForUpdate() {
89615
89731
  try {
89616
- const { execFileSync: execFileSync7 } = await import("child_process");
89732
+ const { execFileSync: execFileSync6 } = await import("child_process");
89617
89733
  const currentVersion = resolvePackageVersion();
89618
- const latestVersion = readLatestPublishedCliVersion(execFileSync7);
89734
+ const latestVersion = readLatestPublishedCliVersion(execFileSync6);
89619
89735
  if (!latestVersion) return;
89620
89736
  if (!currentVersion || !latestVersion || currentVersion === latestVersion) return;
89621
89737
  console.log(source_default.yellow(` Update available: ${currentVersion} \u2192 ${latestVersion}`));
@@ -89632,7 +89748,7 @@ async function checkForUpdate() {
89632
89748
  const spinner = (await Promise.resolve().then(() => (init_ora(), ora_exports))).default("Updating adhdev CLI...").start();
89633
89749
  try {
89634
89750
  const installCommand = buildPinnedGlobalInstallCommand({ packageName: "adhdev", targetVersion: "latest" });
89635
- execFileSync7(installCommand.command, installCommand.args, {
89751
+ execFileSync6(installCommand.command, installCommand.args, {
89636
89752
  encoding: "utf-8",
89637
89753
  timeout: 6e4,
89638
89754
  stdio: ["pipe", "pipe", "pipe"]
@@ -89716,15 +89832,15 @@ async function loginFlow() {
89716
89832
  let verificationUrl;
89717
89833
  try {
89718
89834
  const config2 = loadConfig();
89719
- const os31 = await import("os");
89835
+ const os30 = await import("os");
89720
89836
  const res = await fetch(`${SERVER_URL}/auth/cli/init`, {
89721
89837
  method: "POST",
89722
89838
  headers: { "Content-Type": "application/json" },
89723
89839
  body: JSON.stringify({
89724
89840
  clientMachineId: config2.machineId,
89725
- hostname: os31.hostname(),
89726
- platform: os31.platform(),
89727
- arch: os31.arch()
89841
+ hostname: os30.hostname(),
89842
+ platform: os30.platform(),
89843
+ arch: os30.arch()
89728
89844
  })
89729
89845
  });
89730
89846
  if (!res.ok) {
@@ -89748,7 +89864,7 @@ async function loginFlow() {
89748
89864
  console.log(source_default.gray(` Opening: ${verificationUrl}`));
89749
89865
  console.log();
89750
89866
  try {
89751
- await open_default(verificationUrl);
89867
+ await openBrowser(verificationUrl);
89752
89868
  console.log(source_default.green(" \u2713 Browser opened \u2014 please sign in and approve"));
89753
89869
  } catch {
89754
89870
  console.log(source_default.yellow(` \u26A0 Could not open browser. Visit: ${verificationUrl}`));
@@ -89829,10 +89945,10 @@ async function startDaemonFlow() {
89829
89945
  const { execSync: execSync8 } = await import("child_process");
89830
89946
  const { getCurrentDaemonLogPath: getCurrentDaemonLogPath2 } = await Promise.resolve().then(() => (init_src(), src_exports));
89831
89947
  const logPath = getCurrentDaemonLogPath2();
89832
- const os31 = await import("os");
89833
- const platform13 = os31.platform();
89948
+ const os30 = await import("os");
89949
+ const platform12 = os30.platform();
89834
89950
  try {
89835
- if (platform13 === "win32") {
89951
+ if (platform12 === "win32") {
89836
89952
  execSync8("start /B adhdev daemon >NUL 2>&1", {
89837
89953
  timeout: 3e3,
89838
89954
  stdio: "ignore",
@@ -89945,7 +90061,6 @@ var init_wizard = __esm({
89945
90061
  init_source();
89946
90062
  init_lib();
89947
90063
  init_ora();
89948
- init_open();
89949
90064
  init_src();
89950
90065
  init_version();
89951
90066
  SERVER_URL = process.env.ADHDEV_SERVER_URL || "https://api.adhf.dev";
@@ -90978,7 +91093,7 @@ init_source();
90978
91093
  init_src();
90979
91094
 
90980
91095
  // src/cli/setup-commands.ts
90981
- var import_node_path4 = __toESM(require("path"));
91096
+ var import_node_path3 = __toESM(require("path"));
90982
91097
  init_source();
90983
91098
  init_src();
90984
91099
 
@@ -91131,7 +91246,7 @@ function parsePositiveInteger(value, fallback2) {
91131
91246
  return Number.isFinite(parsed) && parsed >= 0 ? parsed : fallback2;
91132
91247
  }
91133
91248
  function buildHistoryResumeLaunchPayload(cliType, session, overrideDir) {
91134
- const dir = typeof overrideDir === "string" && overrideDir.trim() ? import_node_path4.default.resolve(overrideDir.trim()) : typeof session.workspace === "string" && session.workspace.trim() ? import_node_path4.default.resolve(session.workspace.trim()) : "";
91249
+ const dir = typeof overrideDir === "string" && overrideDir.trim() ? import_node_path3.default.resolve(overrideDir.trim()) : typeof session.workspace === "string" && session.workspace.trim() ? import_node_path3.default.resolve(session.workspace.trim()) : "";
91135
91250
  if (!dir) {
91136
91251
  throw new Error(`Saved history ${session.providerSessionId} is missing workspace metadata. Pass --dir to resume it explicitly.`);
91137
91252
  }
@@ -91251,7 +91366,7 @@ function registerSetupCommands(program2, getProviderLoader2) {
91251
91366
  console.log(source_default.gray(" Then run: adhdev launch " + targetArg));
91252
91367
  process.exit(1);
91253
91368
  }
91254
- const resolvedDir = import_node_path4.default.resolve(workingDir);
91369
+ const resolvedDir = import_node_path3.default.resolve(workingDir);
91255
91370
  const result = await sendDaemonCommand("launch_cli", {
91256
91371
  cliType,
91257
91372
  dir: resolvedDir
@@ -91723,9 +91838,9 @@ function registerSetupCommands(program2, getProviderLoader2) {
91723
91838
  });
91724
91839
  program2.command("uninstall").description("Completely wipe all setting, configuration, stop daemon and uninstall service").option("-f, --force", "Skip confirmation prompt").action(async (options) => {
91725
91840
  const inquirer2 = await Promise.resolve().then(() => (init_lib(), lib_exports));
91726
- const fs27 = await import("fs");
91727
- const path36 = await import("path");
91728
- const os31 = await import("os");
91841
+ const fs22 = await import("fs");
91842
+ const path35 = await import("path");
91843
+ const os30 = await import("os");
91729
91844
  const { spawnSync: spawnSync3 } = await import("child_process");
91730
91845
  if (!options.force) {
91731
91846
  const { confirm } = await inquirer2.default.prompt([
@@ -91750,11 +91865,11 @@ function registerSetupCommands(program2, getProviderLoader2) {
91750
91865
  }
91751
91866
  console.log(source_default.gray(" Removing OS background service..."));
91752
91867
  spawnSync3(process.execPath, [process.argv[1], "service", "uninstall"], { stdio: "inherit" });
91753
- const adhdevDir = path36.join(os31.homedir(), ".adhdev");
91754
- if (fs27.existsSync(adhdevDir)) {
91868
+ const adhdevDir = path35.join(os30.homedir(), ".adhdev");
91869
+ if (fs22.existsSync(adhdevDir)) {
91755
91870
  console.log(source_default.gray(` Deleting ${adhdevDir}...`));
91756
91871
  try {
91757
- fs27.rmSync(adhdevDir, { recursive: true, force: true });
91872
+ fs22.rmSync(adhdevDir, { recursive: true, force: true });
91758
91873
  console.log(source_default.green(" \u2713 Data wiped."));
91759
91874
  } catch (e) {
91760
91875
  console.log(source_default.red(` \u2717 Failed to delete ~/.adhdev: ${e.message}`));
@@ -91773,11 +91888,11 @@ init_source();
91773
91888
  init_src();
91774
91889
 
91775
91890
  // src/cli/runtime-tools.ts
91776
- var fs24 = __toESM(require("fs"));
91777
- var path31 = __toESM(require("path"));
91891
+ var fs19 = __toESM(require("fs"));
91892
+ var path30 = __toESM(require("path"));
91778
91893
  function defaultPackageRoot() {
91779
- const currentCliPath = process.argv[1] ? fs24.realpathSync.native(process.argv[1]) : process.cwd();
91780
- return path31.resolve(path31.dirname(currentCliPath), "../..");
91894
+ const currentCliPath = process.argv[1] ? fs19.realpathSync.native(process.argv[1]) : process.cwd();
91895
+ return path30.resolve(path30.dirname(currentCliPath), "../..");
91781
91896
  }
91782
91897
  function normalizePath2(value) {
91783
91898
  return value.replace(/\\/g, "/").toLowerCase();
@@ -91786,19 +91901,19 @@ function shouldPreferSource(currentCliPath, packageRoot) {
91786
91901
  const normalizedCliPath = normalizePath2(currentCliPath || "");
91787
91902
  if (normalizedCliPath.includes("/src/cli/")) return true;
91788
91903
  if (normalizedCliPath.includes("/dist/cli/")) return false;
91789
- return fs24.existsSync(path31.join(packageRoot, "src", "cli", "index.ts"));
91904
+ return fs19.existsSync(path30.join(packageRoot, "src", "cli", "index.ts"));
91790
91905
  }
91791
91906
  function getVendoredToolEntry(packageRoot, tool) {
91792
91907
  if (tool === "session-host-daemon") {
91793
- return path31.join(packageRoot, "vendor", "session-host-daemon", "index.js");
91908
+ return path30.join(packageRoot, "vendor", "session-host-daemon", "index.js");
91794
91909
  }
91795
- return path31.join(packageRoot, "vendor", "terminal-mux-cli", "index.js");
91910
+ return path30.join(packageRoot, "vendor", "terminal-mux-cli", "index.js");
91796
91911
  }
91797
91912
  function getSourceToolEntry(packageRoot, tool) {
91798
91913
  if (tool === "session-host-daemon") {
91799
- return path31.resolve(packageRoot, "../../oss/packages/session-host-daemon/src/index.ts");
91914
+ return path30.resolve(packageRoot, "../../oss/packages/session-host-daemon/src/index.ts");
91800
91915
  }
91801
- return path31.resolve(packageRoot, "../../oss/packages/terminal-mux-cli/src/index.ts");
91916
+ return path30.resolve(packageRoot, "../../oss/packages/terminal-mux-cli/src/index.ts");
91802
91917
  }
91803
91918
  function getGlobalToolCommand(tool) {
91804
91919
  return tool === "session-host-daemon" ? "adhdev-sessiond" : "adhmux";
@@ -91811,7 +91926,7 @@ function resolveRuntimeToolLaunch(tool, context = {}) {
91811
91926
  const vendoredEntry = getVendoredToolEntry(packageRoot, tool);
91812
91927
  const resolutionOrder = preferSource ? ["source", "vendored", "global"] : ["vendored", "source", "global"];
91813
91928
  for (const resolution of resolutionOrder) {
91814
- if (resolution === "source" && fs24.existsSync(sourceEntry)) {
91929
+ if (resolution === "source" && fs19.existsSync(sourceEntry)) {
91815
91930
  return {
91816
91931
  tool,
91817
91932
  resolvedVia: "source",
@@ -91820,7 +91935,7 @@ function resolveRuntimeToolLaunch(tool, context = {}) {
91820
91935
  env: env3
91821
91936
  };
91822
91937
  }
91823
- if (resolution === "vendored" && fs24.existsSync(vendoredEntry)) {
91938
+ if (resolution === "vendored" && fs19.existsSync(vendoredEntry)) {
91824
91939
  return {
91825
91940
  tool,
91826
91941
  resolvedVia: "vendored",
@@ -92951,9 +93066,9 @@ function registerDaemonCommands(program2, pkgVersion3) {
92951
93066
  // src/cli/doctor-commands.ts
92952
93067
  init_source();
92953
93068
  var import_child_process15 = require("child_process");
92954
- var fs26 = __toESM(require("fs"));
92955
- var os30 = __toESM(require("os"));
92956
- var path34 = __toESM(require("path"));
93069
+ var fs21 = __toESM(require("fs"));
93070
+ var os29 = __toESM(require("os"));
93071
+ var path33 = __toESM(require("path"));
92957
93072
  init_src();
92958
93073
  init_session_host();
92959
93074
 
@@ -93069,33 +93184,33 @@ function buildDoctorAdvice(input) {
93069
93184
  }
93070
93185
 
93071
93186
  // src/cli/service-commands.ts
93072
- var import_node_fs6 = __toESM(require("fs"));
93073
- var import_node_path5 = __toESM(require("path"));
93074
- var import_node_os6 = __toESM(require("os"));
93075
- var import_node_child_process6 = require("child_process");
93187
+ var import_node_fs3 = __toESM(require("fs"));
93188
+ var import_node_path4 = __toESM(require("path"));
93189
+ var import_node_os5 = __toESM(require("os"));
93190
+ var import_node_child_process = require("child_process");
93076
93191
  init_source();
93077
93192
  init_src();
93078
93193
  var DEFAULT_LOCAL_DAEMON_HEALTH_TIMEOUT_MS3 = 1500;
93079
93194
  var LAUNCHD_LABEL = "dev.adhf.daemon";
93080
- var ADHDEV_DIR = import_node_path5.default.join(import_node_os6.default.homedir(), ".adhdev");
93081
- var LOG_OUT = import_node_path5.default.join(ADHDEV_DIR, "daemon-launchd.out");
93082
- var LOG_ERR = import_node_path5.default.join(ADHDEV_DIR, "daemon-launchd.err");
93195
+ var ADHDEV_DIR = import_node_path4.default.join(import_node_os5.default.homedir(), ".adhdev");
93196
+ var LOG_OUT = import_node_path4.default.join(ADHDEV_DIR, "daemon-launchd.out");
93197
+ var LOG_ERR = import_node_path4.default.join(ADHDEV_DIR, "daemon-launchd.err");
93083
93198
  var MAX_LOG_SIZE2 = 10 * 1024 * 1024;
93084
93199
  function getDarwinPlistPath() {
93085
- return import_node_path5.default.join(import_node_os6.default.homedir(), "Library", "LaunchAgents", `${LAUNCHD_LABEL}.plist`);
93200
+ return import_node_path4.default.join(import_node_os5.default.homedir(), "Library", "LaunchAgents", `${LAUNCHD_LABEL}.plist`);
93086
93201
  }
93087
93202
  function getWindowsStartupDir() {
93088
- const appData = process.env.APPDATA || import_node_path5.default.join(import_node_os6.default.homedir(), "AppData", "Roaming");
93089
- return import_node_path5.default.join(appData, "Microsoft", "Windows", "Start Menu", "Programs", "Startup");
93203
+ const appData = process.env.APPDATA || import_node_path4.default.join(import_node_os5.default.homedir(), "AppData", "Roaming");
93204
+ return import_node_path4.default.join(appData, "Microsoft", "Windows", "Start Menu", "Programs", "Startup");
93090
93205
  }
93091
93206
  function getWindowsVbsPath() {
93092
- return import_node_path5.default.join(getWindowsStartupDir(), "adhdev-daemon.vbs");
93207
+ return import_node_path4.default.join(getWindowsStartupDir(), "adhdev-daemon.vbs");
93093
93208
  }
93094
93209
  function resolveCliPath() {
93095
- return import_node_fs6.default.realpathSync(process.argv[1]);
93210
+ return import_node_fs3.default.realpathSync(process.argv[1]);
93096
93211
  }
93097
93212
  function ensureDir(dir) {
93098
- if (!import_node_fs6.default.existsSync(dir)) import_node_fs6.default.mkdirSync(dir, { recursive: true });
93213
+ if (!import_node_fs3.default.existsSync(dir)) import_node_fs3.default.mkdirSync(dir, { recursive: true });
93099
93214
  }
93100
93215
  async function fetchHealth() {
93101
93216
  const controller = new AbortController();
@@ -93113,12 +93228,12 @@ async function fetchHealth() {
93113
93228
  function getProcessInfo(pid) {
93114
93229
  try {
93115
93230
  if (process.platform === "win32") {
93116
- const out = (0, import_node_child_process6.execSync)(`tasklist /FI "PID eq ${pid}" /FO CSV /NH`, { encoding: "utf-8" });
93231
+ const out = (0, import_node_child_process.execSync)(`tasklist /FI "PID eq ${pid}" /FO CSV /NH`, { encoding: "utf-8" });
93117
93232
  const match = out.match(/"(\d[\d,]+)\sK"/);
93118
93233
  const memKB = match ? parseInt(match[1].replace(/,/g, ""), 10) : 0;
93119
93234
  return { uptime: "-", memMB: Math.round(memKB / 1024) };
93120
93235
  } else {
93121
- const out = (0, import_node_child_process6.execSync)(`ps -o etime=,rss= -p ${pid}`, { encoding: "utf-8" }).trim();
93236
+ const out = (0, import_node_child_process.execSync)(`ps -o etime=,rss= -p ${pid}`, { encoding: "utf-8" }).trim();
93122
93237
  const parts = out.split(/\s+/);
93123
93238
  const etime = parts[0] || "-";
93124
93239
  const rssKB = parseInt(parts[1] || "0", 10);
@@ -93137,13 +93252,13 @@ function formatElapsed(etime) {
93137
93252
  }
93138
93253
  function rotateLogIfNeeded(logPath) {
93139
93254
  try {
93140
- if (!import_node_fs6.default.existsSync(logPath)) return;
93141
- const stat4 = import_node_fs6.default.statSync(logPath);
93255
+ if (!import_node_fs3.default.existsSync(logPath)) return;
93256
+ const stat4 = import_node_fs3.default.statSync(logPath);
93142
93257
  if (stat4.size > MAX_LOG_SIZE2) {
93143
93258
  const rotated = logPath + ".old";
93144
- if (import_node_fs6.default.existsSync(rotated)) import_node_fs6.default.unlinkSync(rotated);
93145
- import_node_fs6.default.renameSync(logPath, rotated);
93146
- import_node_fs6.default.writeFileSync(logPath, `[log rotated at ${(/* @__PURE__ */ new Date()).toISOString()}]
93259
+ if (import_node_fs3.default.existsSync(rotated)) import_node_fs3.default.unlinkSync(rotated);
93260
+ import_node_fs3.default.renameSync(logPath, rotated);
93261
+ import_node_fs3.default.writeFileSync(logPath, `[log rotated at ${(/* @__PURE__ */ new Date()).toISOString()}]
93147
93262
  `, "utf-8");
93148
93263
  }
93149
93264
  } catch {
@@ -93154,8 +93269,8 @@ function rotateLogs() {
93154
93269
  rotateLogIfNeeded(LOG_ERR);
93155
93270
  }
93156
93271
  function buildPlist(nodeExe, cliExe) {
93157
- const brewPrefix = import_node_fs6.default.existsSync("/opt/homebrew/bin") ? "/opt/homebrew/bin" : "/usr/local/bin";
93158
- const nodeDir = import_node_path5.default.dirname(nodeExe);
93272
+ const brewPrefix = import_node_fs3.default.existsSync("/opt/homebrew/bin") ? "/opt/homebrew/bin" : "/usr/local/bin";
93273
+ const nodeDir = import_node_path4.default.dirname(nodeExe);
93159
93274
  const pathEntries = /* @__PURE__ */ new Set([nodeDir, brewPrefix, "/usr/local/bin", "/usr/bin", "/bin", "/usr/sbin", "/sbin"]);
93160
93275
  const pathValue = Array.from(pathEntries).join(":");
93161
93276
  return `<?xml version="1.0" encoding="UTF-8"?>
@@ -93194,15 +93309,15 @@ function buildPlist(nodeExe, cliExe) {
93194
93309
  function installDarwin(nodeExe, cliExe) {
93195
93310
  const plistPath = getDarwinPlistPath();
93196
93311
  ensureDir(ADHDEV_DIR);
93197
- ensureDir(import_node_path5.default.dirname(plistPath));
93198
- import_node_fs6.default.writeFileSync(plistPath, buildPlist(nodeExe, cliExe), "utf-8");
93312
+ ensureDir(import_node_path4.default.dirname(plistPath));
93313
+ import_node_fs3.default.writeFileSync(plistPath, buildPlist(nodeExe, cliExe), "utf-8");
93199
93314
  console.log(source_default.gray(` Plist: ${plistPath}`));
93200
93315
  try {
93201
- (0, import_node_child_process6.execSync)(`launchctl unload "${plistPath}" 2>/dev/null`, { stdio: "ignore" });
93316
+ (0, import_node_child_process.execSync)(`launchctl unload "${plistPath}" 2>/dev/null`, { stdio: "ignore" });
93202
93317
  } catch {
93203
93318
  }
93204
93319
  try {
93205
- (0, import_node_child_process6.execSync)(`launchctl load -w "${plistPath}"`, { stdio: "ignore" });
93320
+ (0, import_node_child_process.execSync)(`launchctl load -w "${plistPath}"`, { stdio: "ignore" });
93206
93321
  console.log(source_default.green("\n \u2713 Registered as LaunchAgent \u2014 daemon will start on login."));
93207
93322
  console.log(source_default.gray(` Logs: ~/.adhdev/daemon-launchd.{out,err}`));
93208
93323
  } catch (e) {
@@ -93212,22 +93327,22 @@ function installDarwin(nodeExe, cliExe) {
93212
93327
  }
93213
93328
  function uninstallDarwin() {
93214
93329
  const plistPath = getDarwinPlistPath();
93215
- if (!import_node_fs6.default.existsSync(plistPath)) {
93330
+ if (!import_node_fs3.default.existsSync(plistPath)) {
93216
93331
  console.log(source_default.yellow("\n \u26A0 Service is not installed."));
93217
93332
  return;
93218
93333
  }
93219
93334
  try {
93220
- (0, import_node_child_process6.execSync)(`launchctl unload "${plistPath}" 2>/dev/null`, { stdio: "ignore" });
93335
+ (0, import_node_child_process.execSync)(`launchctl unload "${plistPath}" 2>/dev/null`, { stdio: "ignore" });
93221
93336
  } catch {
93222
93337
  }
93223
- import_node_fs6.default.unlinkSync(plistPath);
93338
+ import_node_fs3.default.unlinkSync(plistPath);
93224
93339
  console.log(source_default.green("\n \u2713 Removed LaunchAgent. Daemon will no longer auto-start."));
93225
93340
  }
93226
93341
  function isInstalledDarwin() {
93227
- return import_node_fs6.default.existsSync(getDarwinPlistPath());
93342
+ return import_node_fs3.default.existsSync(getDarwinPlistPath());
93228
93343
  }
93229
93344
  function buildVbs(nodeExe, cliExe) {
93230
- const logFile = import_node_path5.default.join(ADHDEV_DIR, "daemon-service.log").replace(/\\/g, "\\\\");
93345
+ const logFile = import_node_path4.default.join(ADHDEV_DIR, "daemon-service.log").replace(/\\/g, "\\\\");
93231
93346
  const escapedNodeExe = nodeExe.replace(/\\/g, "\\\\");
93232
93347
  const escapedCliExe = cliExe.replace(/\\/g, "\\\\");
93233
93348
  return `' ADHDev Daemon Auto-Start (generated by adhdev service install)
@@ -93238,39 +93353,39 @@ WshShell.Run "cmd.exe /c """"${escapedNodeExe}"""" """"${escapedCliExe}"""" daem
93238
93353
  function installWindows(nodeExe, cliExe) {
93239
93354
  const vbsPath = getWindowsVbsPath();
93240
93355
  ensureDir(ADHDEV_DIR);
93241
- ensureDir(import_node_path5.default.dirname(vbsPath));
93242
- import_node_fs6.default.writeFileSync(vbsPath, buildVbs(nodeExe, cliExe), "utf-8");
93356
+ ensureDir(import_node_path4.default.dirname(vbsPath));
93357
+ import_node_fs3.default.writeFileSync(vbsPath, buildVbs(nodeExe, cliExe), "utf-8");
93243
93358
  console.log(source_default.gray(` Startup script: ${vbsPath}`));
93244
93359
  console.log(source_default.green("\n \u2713 Registered in Startup folder \u2014 daemon will start on login (hidden)."));
93245
- console.log(source_default.gray(` Logs: ${import_node_path5.default.join(ADHDEV_DIR, "daemon-service.log")}`));
93360
+ console.log(source_default.gray(` Logs: ${import_node_path4.default.join(ADHDEV_DIR, "daemon-service.log")}`));
93246
93361
  console.log(source_default.gray(" To start now without rebooting, run: adhdev daemon"));
93247
93362
  }
93248
93363
  function uninstallWindows() {
93249
93364
  const vbsPath = getWindowsVbsPath();
93250
- if (!import_node_fs6.default.existsSync(vbsPath)) {
93365
+ if (!import_node_fs3.default.existsSync(vbsPath)) {
93251
93366
  console.log(source_default.yellow("\n \u26A0 Service is not installed."));
93252
93367
  return;
93253
93368
  }
93254
- import_node_fs6.default.unlinkSync(vbsPath);
93369
+ import_node_fs3.default.unlinkSync(vbsPath);
93255
93370
  console.log(source_default.green("\n \u2713 Removed Startup script. Daemon will no longer auto-start."));
93256
93371
  console.log(source_default.gray(" Note: a currently running daemon is not affected. Stop with: adhdev daemon:stop"));
93257
93372
  }
93258
93373
  function isInstalledWindows() {
93259
- return import_node_fs6.default.existsSync(getWindowsVbsPath());
93374
+ return import_node_fs3.default.existsSync(getWindowsVbsPath());
93260
93375
  }
93261
93376
  function registerServiceCommands(program2) {
93262
93377
  const svc = program2.command("service").description("\u{1F50C} Manage ADHDev as an OS background auto-start service");
93263
93378
  svc.command("install").description("Register ADHDev daemon to start automatically on login").action(async () => {
93264
93379
  console.log(source_default.bold("\n \u{1F680} Installing ADHDev Background Service"));
93265
- const platform13 = import_node_os6.default.platform();
93380
+ const platform12 = import_node_os5.default.platform();
93266
93381
  const nodeExe = process.execPath;
93267
93382
  const cliExe = resolveCliPath();
93268
93383
  console.log(source_default.gray(` Node: ${nodeExe}`));
93269
93384
  console.log(source_default.gray(` CLI: ${cliExe}`));
93270
- console.log(source_default.gray(` Platform: ${platform13}`));
93271
- if (platform13 === "darwin") {
93385
+ console.log(source_default.gray(` Platform: ${platform12}`));
93386
+ if (platform12 === "darwin") {
93272
93387
  installDarwin(nodeExe, cliExe);
93273
- } else if (platform13 === "win32") {
93388
+ } else if (platform12 === "win32") {
93274
93389
  installWindows(nodeExe, cliExe);
93275
93390
  } else {
93276
93391
  console.log(source_default.yellow("\n \u26A0 Auto-start service install is not supported on this platform."));
@@ -93281,10 +93396,10 @@ function registerServiceCommands(program2) {
93281
93396
  });
93282
93397
  svc.command("uninstall").description("Remove the OS background service").action(async () => {
93283
93398
  console.log(source_default.bold("\n \u{1F5D1}\uFE0F Removing ADHDev Background Service"));
93284
- const platform13 = import_node_os6.default.platform();
93285
- if (platform13 === "darwin") {
93399
+ const platform12 = import_node_os5.default.platform();
93400
+ if (platform12 === "darwin") {
93286
93401
  uninstallDarwin();
93287
- } else if (platform13 === "win32") {
93402
+ } else if (platform12 === "win32") {
93288
93403
  uninstallWindows();
93289
93404
  } else {
93290
93405
  console.log(source_default.yellow("\n \u26A0 Not supported on this platform."));
@@ -93292,11 +93407,11 @@ function registerServiceCommands(program2) {
93292
93407
  console.log();
93293
93408
  });
93294
93409
  svc.command("status").description("Show service installation state and live daemon health").action(async () => {
93295
- const platform13 = import_node_os6.default.platform();
93296
- const installed = platform13 === "darwin" ? isInstalledDarwin() : platform13 === "win32" ? isInstalledWindows() : false;
93410
+ const platform12 = import_node_os5.default.platform();
93411
+ const installed = platform12 === "darwin" ? isInstalledDarwin() : platform12 === "win32" ? isInstalledWindows() : false;
93297
93412
  if (installed) {
93298
93413
  console.log(source_default.green("\n \u2713 Service is installed."));
93299
- if (platform13 === "darwin") console.log(source_default.gray(` Plist: ${getDarwinPlistPath()}`));
93414
+ if (platform12 === "darwin") console.log(source_default.gray(` Plist: ${getDarwinPlistPath()}`));
93300
93415
  else console.log(source_default.gray(` Script: ${getWindowsVbsPath()}`));
93301
93416
  } else {
93302
93417
  console.log(source_default.gray("\n \u2717 Service is not installed. Run: adhdev service install"));
@@ -93312,8 +93427,8 @@ function registerServiceCommands(program2) {
93312
93427
  } else {
93313
93428
  console.log(source_default.yellow(" \u2717 Daemon is not running."));
93314
93429
  }
93315
- const outSize = import_node_fs6.default.existsSync(LOG_OUT) ? import_node_fs6.default.statSync(LOG_OUT).size : 0;
93316
- const errSize = import_node_fs6.default.existsSync(LOG_ERR) ? import_node_fs6.default.statSync(LOG_ERR).size : 0;
93430
+ const outSize = import_node_fs3.default.existsSync(LOG_OUT) ? import_node_fs3.default.statSync(LOG_OUT).size : 0;
93431
+ const errSize = import_node_fs3.default.existsSync(LOG_ERR) ? import_node_fs3.default.statSync(LOG_ERR).size : 0;
93317
93432
  if (outSize > 0 || errSize > 0) {
93318
93433
  console.log(source_default.gray(` Logs: stdout ${formatBytes(outSize)}, stderr ${formatBytes(errSize)}`));
93319
93434
  }
@@ -93322,13 +93437,13 @@ function registerServiceCommands(program2) {
93322
93437
  svc.command("logs").description("View daemon service logs").option("--err", "Show stderr log instead of stdout").option("--clear", "Truncate all log files").option("-n, --lines <count>", "Number of lines to show", "30").action(async (options) => {
93323
93438
  if (options.clear) {
93324
93439
  for (const f of [LOG_OUT, LOG_ERR]) {
93325
- if (import_node_fs6.default.existsSync(f)) import_node_fs6.default.writeFileSync(f, "", "utf-8");
93440
+ if (import_node_fs3.default.existsSync(f)) import_node_fs3.default.writeFileSync(f, "", "utf-8");
93326
93441
  }
93327
93442
  console.log(source_default.green("\n \u2713 Logs cleared.\n"));
93328
93443
  return;
93329
93444
  }
93330
93445
  const logFile = options.err ? LOG_ERR : LOG_OUT;
93331
- if (!import_node_fs6.default.existsSync(logFile)) {
93446
+ if (!import_node_fs3.default.existsSync(logFile)) {
93332
93447
  console.log(source_default.gray(`
93333
93448
  No log file found: ${logFile}
93334
93449
  `));
@@ -93338,20 +93453,20 @@ function registerServiceCommands(program2) {
93338
93453
  console.log(source_default.gray(`
93339
93454
  \u2500\u2500 ${options.err ? "stderr" : "stdout"}: ${logFile} (last ${lines} lines) \u2500\u2500
93340
93455
  `));
93341
- const content = import_node_fs6.default.readFileSync(logFile, "utf-8");
93456
+ const content = import_node_fs3.default.readFileSync(logFile, "utf-8");
93342
93457
  const allLines = content.split("\n");
93343
93458
  const lastLines = allLines.slice(-lines).join("\n");
93344
93459
  if (lastLines.trim()) console.log(lastLines);
93345
93460
  console.log(source_default.gray("\n (watching for new output, Ctrl+C to stop)\n"));
93346
93461
  let offset = Buffer.byteLength(content, "utf-8");
93347
- const watcher = import_node_fs6.default.watchFile(logFile, { interval: 500 }, () => {
93462
+ const watcher = import_node_fs3.default.watchFile(logFile, { interval: 500 }, () => {
93348
93463
  try {
93349
- const stat4 = import_node_fs6.default.statSync(logFile);
93464
+ const stat4 = import_node_fs3.default.statSync(logFile);
93350
93465
  if (stat4.size > offset) {
93351
- const fd = import_node_fs6.default.openSync(logFile, "r");
93466
+ const fd = import_node_fs3.default.openSync(logFile, "r");
93352
93467
  const buf = Buffer.alloc(stat4.size - offset);
93353
- import_node_fs6.default.readSync(fd, buf, 0, buf.length, offset);
93354
- import_node_fs6.default.closeSync(fd);
93468
+ import_node_fs3.default.readSync(fd, buf, 0, buf.length, offset);
93469
+ import_node_fs3.default.closeSync(fd);
93355
93470
  process.stdout.write(buf.toString("utf-8"));
93356
93471
  offset = stat4.size;
93357
93472
  } else if (stat4.size < offset) {
@@ -93361,15 +93476,15 @@ function registerServiceCommands(program2) {
93361
93476
  }
93362
93477
  });
93363
93478
  const cleanup = () => {
93364
- import_node_fs6.default.unwatchFile(logFile);
93479
+ import_node_fs3.default.unwatchFile(logFile);
93365
93480
  process.exit(0);
93366
93481
  };
93367
93482
  process.on("SIGINT", cleanup);
93368
93483
  process.on("SIGTERM", cleanup);
93369
93484
  });
93370
93485
  svc.command("restart").description("Restart the daemon process (service will auto-relaunch)").action(async () => {
93371
- const platform13 = import_node_os6.default.platform();
93372
- const installed = platform13 === "darwin" ? isInstalledDarwin() : platform13 === "win32" ? isInstalledWindows() : false;
93486
+ const platform12 = import_node_os5.default.platform();
93487
+ const installed = platform12 === "darwin" ? isInstalledDarwin() : platform12 === "win32" ? isInstalledWindows() : false;
93373
93488
  if (!installed) {
93374
93489
  console.log(source_default.yellow("\n \u26A0 Service is not installed. Use `adhdev daemon:restart` for manual restart."));
93375
93490
  console.log(source_default.gray(" Or install the service first: adhdev service install\n"));
@@ -93379,10 +93494,10 @@ function registerServiceCommands(program2) {
93379
93494
  const health = await fetchHealth();
93380
93495
  if (!health?.pid) {
93381
93496
  console.log(source_default.yellow("\n \u26A0 Daemon is not currently running."));
93382
- if (platform13 === "darwin") {
93497
+ if (platform12 === "darwin") {
93383
93498
  console.log(source_default.gray(" Starting via launchctl..."));
93384
93499
  try {
93385
- (0, import_node_child_process6.execSync)(`launchctl start ${LAUNCHD_LABEL}`, { stdio: "ignore" });
93500
+ (0, import_node_child_process.execSync)(`launchctl start ${LAUNCHD_LABEL}`, { stdio: "ignore" });
93386
93501
  console.log(source_default.green(" \u2713 Started.\n"));
93387
93502
  } catch {
93388
93503
  console.log(source_default.red(" \u2717 Failed to start. Check: adhdev service logs --err\n"));
@@ -93400,11 +93515,11 @@ function registerServiceCommands(program2) {
93400
93515
  console.log(source_default.yellow(" Could not send SIGTERM. Process may have already exited."));
93401
93516
  }
93402
93517
  await new Promise((r) => setTimeout(r, 2e3));
93403
- if (platform13 === "win32") {
93518
+ if (platform12 === "win32") {
93404
93519
  const vbsPath = getWindowsVbsPath();
93405
- if (import_node_fs6.default.existsSync(vbsPath)) {
93520
+ if (import_node_fs3.default.existsSync(vbsPath)) {
93406
93521
  try {
93407
- (0, import_node_child_process6.execSync)(`wscript.exe "${vbsPath}"`, { stdio: "ignore", windowsHide: true });
93522
+ (0, import_node_child_process.execSync)(`wscript.exe "${vbsPath}"`, { stdio: "ignore", windowsHide: true });
93408
93523
  } catch {
93409
93524
  }
93410
93525
  }
@@ -93436,11 +93551,11 @@ function formatBytes(bytes) {
93436
93551
 
93437
93552
  // src/cli/doctor-commands.ts
93438
93553
  function resolvePackageRoot() {
93439
- return path34.resolve(__dirname, "..", "..");
93554
+ return path33.resolve(__dirname, "..", "..");
93440
93555
  }
93441
93556
  function isLinkedInstall(packageRoot) {
93442
- const normalized = path34.normalize(packageRoot);
93443
- return !normalized.includes(`${path34.sep}node_modules${path34.sep}adhdev`);
93557
+ const normalized = path33.normalize(packageRoot);
93558
+ return !normalized.includes(`${path33.sep}node_modules${path33.sep}adhdev`);
93444
93559
  }
93445
93560
  function formatCheck(check2) {
93446
93561
  const icon = check2.ok ? source_default.green("\u2713") : source_default.red("\u2717");
@@ -93524,11 +93639,11 @@ function probeSharpRuntime(packageRoot, nativeSharpPackage) {
93524
93639
  }
93525
93640
  }
93526
93641
  function probeConfigAccess() {
93527
- const configDir = path34.join(os30.homedir(), ".adhdev");
93528
- const configPath = path34.join(configDir, "config.json");
93642
+ const configDir = path33.join(os29.homedir(), ".adhdev");
93643
+ const configPath = path33.join(configDir, "config.json");
93529
93644
  const checks = [];
93530
93645
  try {
93531
- fs26.mkdirSync(configDir, { recursive: true });
93646
+ fs21.mkdirSync(configDir, { recursive: true });
93532
93647
  checks.push({
93533
93648
  label: "Config directory",
93534
93649
  ok: true,
@@ -93543,8 +93658,8 @@ function probeConfigAccess() {
93543
93658
  }];
93544
93659
  }
93545
93660
  try {
93546
- if (fs26.existsSync(configPath)) {
93547
- fs26.readFileSync(configPath, "utf-8");
93661
+ if (fs21.existsSync(configPath)) {
93662
+ fs21.readFileSync(configPath, "utf-8");
93548
93663
  checks.push({
93549
93664
  label: "Config file",
93550
93665
  ok: true,
@@ -93565,10 +93680,10 @@ function probeConfigAccess() {
93565
93680
  fatal: true
93566
93681
  });
93567
93682
  }
93568
- const probePath = path34.join(configDir, `.doctor-write-${process.pid}-${Date.now()}.tmp`);
93683
+ const probePath = path33.join(configDir, `.doctor-write-${process.pid}-${Date.now()}.tmp`);
93569
93684
  try {
93570
- fs26.writeFileSync(probePath, "ok", "utf-8");
93571
- fs26.rmSync(probePath, { force: true });
93685
+ fs21.writeFileSync(probePath, "ok", "utf-8");
93686
+ fs21.rmSync(probePath, { force: true });
93572
93687
  checks.push({
93573
93688
  label: "Config write",
93574
93689
  ok: true,
@@ -93576,7 +93691,7 @@ function probeConfigAccess() {
93576
93691
  });
93577
93692
  } catch (error48) {
93578
93693
  try {
93579
- fs26.rmSync(probePath, { force: true });
93694
+ fs21.rmSync(probePath, { force: true });
93580
93695
  } catch {
93581
93696
  }
93582
93697
  checks.push({
@@ -93632,9 +93747,9 @@ function probeCliBinary(commandPath, currentVersion) {
93632
93747
  return probe;
93633
93748
  }
93634
93749
  function readLogHints(logPath) {
93635
- if (!fs26.existsSync(logPath)) return [];
93750
+ if (!fs21.existsSync(logPath)) return [];
93636
93751
  try {
93637
- const content = fs26.readFileSync(logPath, "utf-8");
93752
+ const content = fs21.readFileSync(logPath, "utf-8");
93638
93753
  const lines = content.split(/\r?\n/);
93639
93754
  const recent = lines.slice(-400);
93640
93755
  const hits = recent.filter(
@@ -93648,11 +93763,11 @@ function readLogHints(logPath) {
93648
93763
  function buildBrowseProbeChecks() {
93649
93764
  const probes = process.platform === "win32" ? [
93650
93765
  process.env.SystemDrive ? `${process.env.SystemDrive.replace(/[\\/]+$/, "")}\\` : "C:\\",
93651
- os30.homedir()
93652
- ] : ["/", os30.homedir()];
93766
+ os29.homedir()
93767
+ ] : ["/", os29.homedir()];
93653
93768
  return probes.map((probePath, index) => {
93654
93769
  try {
93655
- const entries = fs26.readdirSync(probePath, { withFileTypes: true });
93770
+ const entries = fs21.readdirSync(probePath, { withFileTypes: true });
93656
93771
  const directoryCount = entries.filter((entry) => entry.isDirectory()).length;
93657
93772
  return {
93658
93773
  label: index === 0 ? "Folder browse root" : "Folder browse home",
@@ -93672,7 +93787,7 @@ function buildBrowseProbeChecks() {
93672
93787
  function registerDoctorCommands(program2, pkgVersion3) {
93673
93788
  program2.command("doctor").description("Diagnose install, native dependencies, CLI resolution, and folder browse access").action(async () => {
93674
93789
  const packageRoot = resolvePackageRoot();
93675
- const cliPath = fs26.realpathSync(process.argv[1]);
93790
+ const cliPath = fs21.realpathSync(process.argv[1]);
93676
93791
  const linked = isLinkedInstall(packageRoot);
93677
93792
  const logPath = getCurrentDaemonLogPath();
93678
93793
  const claudePaths = findCommandPaths("claude");
@@ -93754,12 +93869,12 @@ function registerDoctorCommands(program2, pkgVersion3) {
93754
93869
  });
93755
93870
  }
93756
93871
  if (process.platform === "darwin") {
93757
- serviceDefinitionPath = path34.join(os30.homedir(), "Library", "LaunchAgents", "dev.adhf.daemon.plist");
93758
- if (fs26.existsSync(serviceDefinitionPath)) {
93872
+ serviceDefinitionPath = path33.join(os29.homedir(), "Library", "LaunchAgents", "dev.adhf.daemon.plist");
93873
+ if (fs21.existsSync(serviceDefinitionPath)) {
93759
93874
  serviceDefinitionCheck = evaluateServiceDefinitionDrift({
93760
93875
  serviceKind: "launchd",
93761
93876
  servicePath: serviceDefinitionPath,
93762
- installedDefinition: fs26.readFileSync(serviceDefinitionPath, "utf8"),
93877
+ installedDefinition: fs21.readFileSync(serviceDefinitionPath, "utf8"),
93763
93878
  expectedDefinition: buildPlist(process.execPath, cliPath)
93764
93879
  });
93765
93880
  checks.push({
@@ -93827,12 +93942,12 @@ function registerDoctorCommands(program2, pkgVersion3) {
93827
93942
  serviceCheck: serviceDefinitionCheck || void 0,
93828
93943
  sourceCliExample: "node --import tsx packages/daemon-cloud/src/cli/index.ts doctor"
93829
93944
  });
93830
- const sessionHostLogPath = path34.join(os30.homedir(), ".adhdev", "logs", "session-host.log");
93945
+ const sessionHostLogPath = path33.join(os29.homedir(), ".adhdev", "logs", "session-host.log");
93831
93946
  console.log(source_default.bold("\n\u{1FA7A} ADHDev Doctor\n"));
93832
93947
  console.log(source_default.gray(` Version: ${pkgVersion3}`));
93833
93948
  console.log(source_default.gray(` Platform: ${process.platform} ${process.arch}`));
93834
93949
  console.log(source_default.gray(` Node: ${process.version}`));
93835
- console.log(source_default.gray(` Home: ${os30.homedir()}`));
93950
+ console.log(source_default.gray(` Home: ${os29.homedir()}`));
93836
93951
  console.log(source_default.gray(` Log file: ${logPath}`));
93837
93952
  console.log(source_default.gray(` SH log: ${sessionHostLogPath}`));
93838
93953
  console.log();
@@ -93869,7 +93984,7 @@ function registerDoctorCommands(program2, pkgVersion3) {
93869
93984
 
93870
93985
  // src/cli/provider-commands.ts
93871
93986
  init_source();
93872
- var path35 = __toESM(require("path"));
93987
+ var path34 = __toESM(require("path"));
93873
93988
  init_cdp_utils();
93874
93989
  var DEV_SERVER_PORT3 = 19280;
93875
93990
  var IDE_AUTO_FIX_FUNCTIONS = [
@@ -93952,7 +94067,7 @@ function getProviderSourceCandidatePaths(options) {
93952
94067
  const results = [];
93953
94068
  for (const root of roots) {
93954
94069
  for (const name of relativeNames) {
93955
- results.push(path35.join(root, options.category, options.type, name));
94070
+ results.push(path34.join(root, options.category, options.type, name));
93956
94071
  }
93957
94072
  }
93958
94073
  return results;
@@ -94087,35 +94202,35 @@ function registerProviderCommands(program2) {
94087
94202
  let osPaths = {};
94088
94203
  let processNames = {};
94089
94204
  if (category === "ide") {
94090
- const fs27 = await import("fs");
94091
- const path36 = await import("path");
94092
- const os31 = await import("os");
94093
- if (os31.platform() === "darwin") {
94205
+ const fs22 = await import("fs");
94206
+ const path35 = await import("path");
94207
+ const os30 = await import("os");
94208
+ if (os30.platform() === "darwin") {
94094
94209
  while (true) {
94095
94210
  const p = (await rl.question(`macOS Application Path (e.g. /Applications/${defaultName}.app): `)).trim() || `/Applications/${defaultName}.app`;
94096
94211
  if (p === "skip") break;
94097
- if (!fs27.existsSync(p)) {
94212
+ if (!fs22.existsSync(p)) {
94098
94213
  console.log(source_default.red(` \u2717 Path not found: ${p}`));
94099
94214
  console.log(source_default.gray(` (Please provide the exact absolute path to the .app or binary, or type 'skip')`));
94100
94215
  continue;
94101
94216
  }
94102
94217
  console.log(source_default.green(` \u2713 Path verified: ${p}`));
94103
94218
  osPaths["darwin"] = [p];
94104
- processNames["darwin"] = path36.basename(p, ".app");
94219
+ processNames["darwin"] = path35.basename(p, ".app");
94105
94220
  break;
94106
94221
  }
94107
- } else if (os31.platform() === "win32") {
94222
+ } else if (os30.platform() === "win32") {
94108
94223
  while (true) {
94109
94224
  const p = (await rl.question(`Windows Executable Path (e.g. C:\\Program Files\\${defaultName}\\${defaultName}.exe): `)).trim();
94110
94225
  if (!p || p === "skip") break;
94111
- if (!fs27.existsSync(p)) {
94226
+ if (!fs22.existsSync(p)) {
94112
94227
  console.log(source_default.red(` \u2717 Path not found: ${p}`));
94113
94228
  console.log(source_default.gray(` (Please provide the exact absolute path, or type 'skip')`));
94114
94229
  continue;
94115
94230
  }
94116
94231
  console.log(source_default.green(` \u2713 Path verified: ${p}`));
94117
94232
  osPaths["win32"] = [p];
94118
- processNames["win32"] = path36.basename(p, ".exe");
94233
+ processNames["win32"] = path35.basename(p, ".exe");
94119
94234
  break;
94120
94235
  }
94121
94236
  }
@@ -94802,8 +94917,8 @@ function registerCdpCommands(program2) {
94802
94917
  }
94803
94918
  const output = typeof result === "string" ? result : JSON.stringify(result, null, 2);
94804
94919
  if (options.output) {
94805
- const fs27 = await import("fs");
94806
- fs27.writeFileSync(options.output, output, "utf-8");
94920
+ const fs22 = await import("fs");
94921
+ fs22.writeFileSync(options.output, output, "utf-8");
94807
94922
  console.log(source_default.green(`
94808
94923
  \u2713 Saved to ${options.output} (${output.length} chars)
94809
94924
  `));
@@ -94906,8 +95021,8 @@ function registerCdpCommands(program2) {
94906
95021
  ws.on("message", async (data) => {
94907
95022
  const msg = JSON.parse(data.toString());
94908
95023
  if (msg.id === 1 && msg.result?.data) {
94909
- const fs27 = await import("fs");
94910
- fs27.writeFileSync(options.output, Buffer.from(msg.result.data, "base64"));
95024
+ const fs22 = await import("fs");
95025
+ fs22.writeFileSync(options.output, Buffer.from(msg.result.data, "base64"));
94911
95026
  console.log(source_default.green(`
94912
95027
  \u2713 Screenshot saved to ${options.output}
94913
95028
  `));