adhdev 0.9.44 → 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/index.js CHANGED
@@ -890,17 +890,17 @@ function checkPathExists(paths) {
890
890
  return null;
891
891
  }
892
892
  async function detectIDEs(providerLoader) {
893
- const os29 = (0, import_os2.platform)();
893
+ const os28 = (0, import_os2.platform)();
894
894
  const results = [];
895
895
  for (const def of getMergedDefinitions()) {
896
896
  const cliPath = findCliCommand(providerLoader?.getIdeCliCommand(def.id, def.cli) || def.cli);
897
- const appPath = checkPathExists(providerLoader?.getIdePathCandidates(def.id, def.paths[os29] || []) || []);
897
+ const appPath = checkPathExists(providerLoader?.getIdePathCandidates(def.id, def.paths[os28] || []) || []);
898
898
  let resolvedCli = cliPath;
899
- if (!resolvedCli && appPath && os29 === "darwin") {
899
+ if (!resolvedCli && appPath && os28 === "darwin") {
900
900
  const bundledCli = `${appPath}/Contents/Resources/app/bin/${def.cli}`;
901
901
  if ((0, import_fs3.existsSync)(bundledCli)) resolvedCli = bundledCli;
902
902
  }
903
- if (!resolvedCli && appPath && os29 === "win32") {
903
+ if (!resolvedCli && appPath && os28 === "win32") {
904
904
  const { dirname: dirname10 } = await import("path");
905
905
  const appDir = dirname10(appPath);
906
906
  const candidates = [
@@ -917,7 +917,7 @@ async function detectIDEs(providerLoader) {
917
917
  }
918
918
  }
919
919
  }
920
- const installed = os29 === "darwin" ? !!(resolvedCli || appPath) : !!resolvedCli;
920
+ const installed = os28 === "darwin" ? !!(resolvedCli || appPath) : !!resolvedCli;
921
921
  const version2 = resolvedCli ? getIdeVersion(resolvedCli) : null;
922
922
  results.push({
923
923
  id: def.id,
@@ -986,8 +986,8 @@ function execAsync(cmd, timeoutMs = 5e3) {
986
986
  });
987
987
  }
988
988
  async function detectCLIs(providerLoader, options) {
989
- const platform13 = os2.platform();
990
- const whichCmd = platform13 === "win32" ? "where" : "which";
989
+ const platform12 = os2.platform();
990
+ const whichCmd = platform12 === "win32" ? "where" : "which";
991
991
  const includeVersion = options?.includeVersion !== false;
992
992
  const cliList = providerLoader ? providerLoader.getCliDetectionList() : [];
993
993
  const results = await Promise.all(
@@ -1030,8 +1030,8 @@ async function detectCLI(cliId, providerLoader, options) {
1030
1030
  const cliList = providerLoader.getCliDetectionList();
1031
1031
  const target = cliList.find((c) => c.id === resolvedId);
1032
1032
  if (target) {
1033
- const platform13 = os2.platform();
1034
- const whichCmd = platform13 === "win32" ? "where" : "which";
1033
+ const platform12 = os2.platform();
1034
+ const whichCmd = platform12 === "win32" ? "where" : "which";
1035
1035
  try {
1036
1036
  const explicitPath = resolveCommandPath(target.command);
1037
1037
  const pathResult = explicitPath || await execAsync(`${whichCmd} ${shellQuote(target.command)}`);
@@ -4032,6 +4032,27 @@ function computeSavedHistorySessionSummaries(agentType, dir, files, fileSignatur
4032
4032
  persistedEntries: nextPersistedEntries
4033
4033
  };
4034
4034
  }
4035
+ function pageHistoryRecords(agentType, records, offset = 0, limit = 30, excludeRecentCount = 0, historyBehavior) {
4036
+ const allMessages = records.map((message) => sanitizeHistoryMessage(agentType, message)).filter(Boolean);
4037
+ allMessages.sort((a, b) => a.receivedAt - b.receivedAt);
4038
+ const chronological = [];
4039
+ let lastTurn = null;
4040
+ for (const message of allMessages) {
4041
+ const previous = chronological[chronological.length - 1];
4042
+ if (isAdjacentHistoryDuplicate(agentType, previous, message)) continue;
4043
+ if (message.role !== "system" && isAdjacentHistoryDuplicate(agentType, lastTurn, message)) continue;
4044
+ chronological.push(message);
4045
+ if (message.role !== "system") lastTurn = message;
4046
+ }
4047
+ const collapsed = collapseReplayAssistantTurns(chronological, historyBehavior);
4048
+ const boundedLimit = Math.max(1, limit);
4049
+ const boundedOffset = Math.max(0, offset);
4050
+ const boundedExclude = Math.max(0, Math.min(excludeRecentCount, collapsed.length));
4051
+ const endExclusive = Math.max(0, collapsed.length - boundedExclude - boundedOffset);
4052
+ const startInclusive = Math.max(0, endExclusive - boundedLimit);
4053
+ const sliced = collapsed.slice(startInclusive, endExclusive);
4054
+ return { messages: sliced, hasMore: startInclusive > 0 };
4055
+ }
4035
4056
  function readChatHistory(agentType, offset = 0, limit = 30, historySessionId, excludeRecentCount = 0, historyBehavior) {
4036
4057
  try {
4037
4058
  const sanitized = agentType.replace(/[^a-zA-Z0-9_-]/g, "_");
@@ -4057,25 +4078,7 @@ function readChatHistory(agentType, offset = 0, limit = 30, historySessionId, ex
4057
4078
  }
4058
4079
  }
4059
4080
  }
4060
- allMessages.sort((a, b) => a.receivedAt - b.receivedAt);
4061
- const chronological = [];
4062
- let lastTurn = null;
4063
- for (const message of allMessages) {
4064
- const previous = chronological[chronological.length - 1];
4065
- if (isAdjacentHistoryDuplicate(agentType, previous, message)) continue;
4066
- if (message.role !== "system" && isAdjacentHistoryDuplicate(agentType, lastTurn, message)) continue;
4067
- chronological.push(message);
4068
- if (message.role !== "system") lastTurn = message;
4069
- }
4070
- const collapsed = collapseReplayAssistantTurns(chronological, historyBehavior);
4071
- const boundedLimit = Math.max(1, limit);
4072
- const boundedOffset = Math.max(0, offset);
4073
- const boundedExclude = Math.max(0, Math.min(excludeRecentCount, collapsed.length));
4074
- const endExclusive = Math.max(0, collapsed.length - boundedExclude - boundedOffset);
4075
- const startInclusive = Math.max(0, endExclusive - boundedLimit);
4076
- const sliced = collapsed.slice(startInclusive, endExclusive);
4077
- const hasMore = startInclusive > 0;
4078
- return { messages: sliced, hasMore };
4081
+ return pageHistoryRecords(agentType, allMessages, offset, limit, excludeRecentCount, historyBehavior);
4079
4082
  } catch {
4080
4083
  return { messages: [], hasMore: false };
4081
4084
  }
@@ -4210,6 +4213,52 @@ function rewriteCanonicalSavedHistory(agentType, historySessionId, records) {
4210
4213
  return false;
4211
4214
  }
4212
4215
  }
4216
+ function buildHermesNativeHistoryRecords(historySessionId) {
4217
+ const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId);
4218
+ if (!normalizedSessionId) return null;
4219
+ try {
4220
+ const sessionFilePath = path7.join(os5.homedir(), ".hermes", "sessions", `session_${normalizedSessionId}.json`);
4221
+ if (!fs3.existsSync(sessionFilePath)) return null;
4222
+ const raw = JSON.parse(fs3.readFileSync(sessionFilePath, "utf-8"));
4223
+ const canonicalMessages = Array.isArray(raw.messages) ? raw.messages : [];
4224
+ const records = [];
4225
+ let fallbackTs = Date.parse(raw.session_start || raw.last_updated || "") || Date.now();
4226
+ for (const message of canonicalMessages) {
4227
+ const role = String(message.role || "").trim();
4228
+ const content = normalizeCanonicalHermesMessageContent(message.content);
4229
+ if (!content) continue;
4230
+ const receivedAt = extractCanonicalHermesMessageTimestamp(message, fallbackTs);
4231
+ fallbackTs = receivedAt + 1;
4232
+ if (role === "user" || role === "assistant") {
4233
+ records.push({
4234
+ ts: new Date(receivedAt).toISOString(),
4235
+ receivedAt,
4236
+ role,
4237
+ content,
4238
+ kind: "standard",
4239
+ agent: "hermes-cli",
4240
+ historySessionId: normalizedSessionId
4241
+ });
4242
+ continue;
4243
+ }
4244
+ if (role === "tool") {
4245
+ records.push({
4246
+ ts: new Date(receivedAt).toISOString(),
4247
+ receivedAt,
4248
+ role: "assistant",
4249
+ content,
4250
+ kind: "tool",
4251
+ senderName: "Tool",
4252
+ agent: "hermes-cli",
4253
+ historySessionId: normalizedSessionId
4254
+ });
4255
+ }
4256
+ }
4257
+ return records;
4258
+ } catch {
4259
+ return null;
4260
+ }
4261
+ }
4213
4262
  function rebuildHermesSavedHistoryFromCanonicalSession(historySessionId) {
4214
4263
  const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId);
4215
4264
  if (!normalizedSessionId) return false;
@@ -4359,6 +4408,77 @@ function extractClaudeUserContentParts(content) {
4359
4408
  }
4360
4409
  return parts;
4361
4410
  }
4411
+ function buildClaudeNativeHistoryRecords(historySessionId, workspace) {
4412
+ const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId);
4413
+ if (!normalizedSessionId) return null;
4414
+ try {
4415
+ const transcriptPath = resolveClaudeProjectTranscriptPath(normalizedSessionId, workspace);
4416
+ if (!transcriptPath) return null;
4417
+ const lines = fs3.readFileSync(transcriptPath, "utf-8").split("\n").filter(Boolean);
4418
+ const records = [];
4419
+ let fallbackTs = Date.now();
4420
+ for (const line of lines) {
4421
+ let parsed = null;
4422
+ try {
4423
+ parsed = JSON.parse(line);
4424
+ } catch {
4425
+ parsed = null;
4426
+ }
4427
+ if (!parsed) continue;
4428
+ const parsedSessionId = String(parsed.sessionId || "").trim();
4429
+ if (parsedSessionId && parsedSessionId !== normalizedSessionId) continue;
4430
+ const receivedAt = extractTimestampValue(parsed.timestamp) || fallbackTs;
4431
+ fallbackTs = receivedAt + 1;
4432
+ const parsedWorkspace = String(parsed.cwd || workspace || "").trim();
4433
+ if (records.length === 0 && parsedWorkspace) {
4434
+ records.push({
4435
+ ts: new Date(receivedAt).toISOString(),
4436
+ receivedAt,
4437
+ role: "system",
4438
+ kind: "session_start",
4439
+ content: parsedWorkspace,
4440
+ agent: "claude-cli",
4441
+ historySessionId: normalizedSessionId,
4442
+ workspace: parsedWorkspace
4443
+ });
4444
+ }
4445
+ const type = String(parsed.type || "").trim();
4446
+ const message = parsed.message && typeof parsed.message === "object" ? parsed.message : null;
4447
+ if (type === "user" && message) {
4448
+ for (const part of extractClaudeUserContentParts(message.content)) {
4449
+ records.push({
4450
+ ts: new Date(receivedAt).toISOString(),
4451
+ receivedAt,
4452
+ role: part.role,
4453
+ content: part.content,
4454
+ kind: part.kind,
4455
+ senderName: part.senderName,
4456
+ agent: "claude-cli",
4457
+ historySessionId: normalizedSessionId
4458
+ });
4459
+ }
4460
+ continue;
4461
+ }
4462
+ if (type === "assistant" && message) {
4463
+ for (const part of extractClaudeAssistantContentParts(message.content)) {
4464
+ records.push({
4465
+ ts: new Date(receivedAt).toISOString(),
4466
+ receivedAt,
4467
+ role: "assistant",
4468
+ content: part.content,
4469
+ kind: part.kind,
4470
+ senderName: part.senderName,
4471
+ agent: "claude-cli",
4472
+ historySessionId: normalizedSessionId
4473
+ });
4474
+ }
4475
+ }
4476
+ }
4477
+ return records;
4478
+ } catch {
4479
+ return null;
4480
+ }
4481
+ }
4362
4482
  function rebuildClaudeSavedHistoryFromNativeProject(historySessionId, workspace) {
4363
4483
  const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId);
4364
4484
  if (!normalizedSessionId) return false;
@@ -4437,6 +4557,352 @@ function rebuildClaudeSavedHistoryFromNativeProject(historySessionId, workspace)
4437
4557
  return false;
4438
4558
  }
4439
4559
  }
4560
+ function isUuidLikeSessionId(sessionId) {
4561
+ return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(sessionId);
4562
+ }
4563
+ function readCodexSessionMeta(filePath) {
4564
+ try {
4565
+ const firstLine = fs3.readFileSync(filePath, "utf-8").split("\n").find(Boolean);
4566
+ if (!firstLine) return null;
4567
+ const parsed = JSON.parse(firstLine);
4568
+ if (String(parsed.type || "") !== "session_meta") return null;
4569
+ const payload = parsed.payload && typeof parsed.payload === "object" ? parsed.payload : null;
4570
+ return payload;
4571
+ } catch {
4572
+ return null;
4573
+ }
4574
+ }
4575
+ function resolveCodexSessionTranscriptPath(historySessionId, workspace) {
4576
+ const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId);
4577
+ if (!normalizedSessionId || !isUuidLikeSessionId(normalizedSessionId)) return null;
4578
+ const sessionsDir = path7.join(os5.homedir(), ".codex", "sessions");
4579
+ if (!fs3.existsSync(sessionsDir)) return null;
4580
+ const normalizedWorkspace = typeof workspace === "string" ? workspace.trim() : "";
4581
+ const candidates = [];
4582
+ const stack = [sessionsDir];
4583
+ while (stack.length > 0) {
4584
+ const current = stack.pop();
4585
+ if (!current) continue;
4586
+ let entries = [];
4587
+ try {
4588
+ entries = fs3.readdirSync(current, { withFileTypes: true });
4589
+ } catch {
4590
+ continue;
4591
+ }
4592
+ for (const entry of entries) {
4593
+ const entryPath = path7.join(current, entry.name);
4594
+ if (entry.isDirectory()) {
4595
+ stack.push(entryPath);
4596
+ continue;
4597
+ }
4598
+ if (!entry.isFile() || !entry.name.endsWith(".jsonl") || !entry.name.includes(normalizedSessionId)) continue;
4599
+ const meta3 = readCodexSessionMeta(entryPath);
4600
+ const metaSessionId = String(meta3?.id || "").trim();
4601
+ if (metaSessionId && metaSessionId !== normalizedSessionId) continue;
4602
+ const metaWorkspace = String(meta3?.cwd || "").trim();
4603
+ let mtimeMs = 0;
4604
+ try {
4605
+ mtimeMs = fs3.statSync(entryPath).mtimeMs;
4606
+ } catch {
4607
+ }
4608
+ candidates.push({
4609
+ path: entryPath,
4610
+ mtimeMs,
4611
+ workspaceMatches: !!normalizedWorkspace && metaWorkspace === normalizedWorkspace,
4612
+ metaMatches: metaSessionId === normalizedSessionId
4613
+ });
4614
+ }
4615
+ }
4616
+ candidates.sort((a, b) => Number(b.workspaceMatches) - Number(a.workspaceMatches) || Number(b.metaMatches) - Number(a.metaMatches) || b.mtimeMs - a.mtimeMs);
4617
+ return candidates[0]?.path || null;
4618
+ }
4619
+ function flattenCodexContent(content) {
4620
+ if (typeof content === "string") return content.trim();
4621
+ if (content == null) return "";
4622
+ if (Array.isArray(content)) {
4623
+ return content.map((entry) => flattenCodexContent(entry)).filter(Boolean).join("\n").trim();
4624
+ }
4625
+ if (typeof content === "object") {
4626
+ const record2 = content;
4627
+ if (typeof record2.text === "string") return record2.text.trim();
4628
+ if (typeof record2.content === "string" || Array.isArray(record2.content)) return flattenCodexContent(record2.content);
4629
+ if (typeof record2.output === "string") return record2.output.trim();
4630
+ if (typeof record2.message === "string") return record2.message.trim();
4631
+ }
4632
+ return "";
4633
+ }
4634
+ function summarizeCodexToolCall(payload) {
4635
+ const name = String(payload.name || payload.type || "tool").trim() || "tool";
4636
+ const rawArguments = payload.arguments ?? payload.input;
4637
+ let argumentValue = "";
4638
+ if (typeof rawArguments === "string") {
4639
+ const trimmed = rawArguments.trim();
4640
+ try {
4641
+ const parsed = JSON.parse(trimmed);
4642
+ argumentValue = summarizeCodexToolArguments(parsed);
4643
+ } catch {
4644
+ argumentValue = trimmed;
4645
+ }
4646
+ } else {
4647
+ argumentValue = summarizeCodexToolArguments(rawArguments);
4648
+ }
4649
+ return argumentValue ? `${name}: ${argumentValue}` : name;
4650
+ }
4651
+ function summarizeCodexToolArguments(value) {
4652
+ if (typeof value === "string") return value.trim();
4653
+ if (Array.isArray(value)) return value.map((entry) => String(entry)).join(" ").trim();
4654
+ if (!value || typeof value !== "object") return "";
4655
+ const record2 = value;
4656
+ const direct = record2.command || record2.cmd || record2.query || record2.path || record2.prompt;
4657
+ if (typeof direct === "string") return direct.trim();
4658
+ if (Array.isArray(direct)) return direct.map((entry) => String(entry)).join(" ").trim();
4659
+ try {
4660
+ return JSON.stringify(record2).trim();
4661
+ } catch {
4662
+ return "";
4663
+ }
4664
+ }
4665
+ function codexToolOutputContent(payload) {
4666
+ const output = payload.output ?? payload.result ?? payload.content;
4667
+ const text = flattenCodexContent(output);
4668
+ if (text) return text;
4669
+ if (output && typeof output === "object") {
4670
+ try {
4671
+ return JSON.stringify(output).trim();
4672
+ } catch {
4673
+ return "";
4674
+ }
4675
+ }
4676
+ return "";
4677
+ }
4678
+ function buildCodexNativeHistoryRecords(historySessionId, workspace) {
4679
+ const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId);
4680
+ if (!normalizedSessionId || !isUuidLikeSessionId(normalizedSessionId)) return null;
4681
+ try {
4682
+ const transcriptPath = resolveCodexSessionTranscriptPath(normalizedSessionId, workspace);
4683
+ if (!transcriptPath) return null;
4684
+ const lines = fs3.readFileSync(transcriptPath, "utf-8").split("\n").filter(Boolean);
4685
+ const records = [];
4686
+ let fallbackTs = Date.now();
4687
+ for (const line of lines) {
4688
+ let parsed = null;
4689
+ try {
4690
+ parsed = JSON.parse(line);
4691
+ } catch {
4692
+ parsed = null;
4693
+ }
4694
+ if (!parsed) continue;
4695
+ const receivedAt = extractTimestampValue(parsed.timestamp) || fallbackTs;
4696
+ fallbackTs = receivedAt + 1;
4697
+ const type = String(parsed.type || "").trim();
4698
+ const payload = parsed.payload && typeof parsed.payload === "object" ? parsed.payload : null;
4699
+ if (!payload) continue;
4700
+ if (type === "session_meta") {
4701
+ const parsedSessionId = String(payload.id || "").trim();
4702
+ if (parsedSessionId && parsedSessionId !== normalizedSessionId) return null;
4703
+ const parsedWorkspace = String(payload.cwd || workspace || "").trim();
4704
+ if (records.length === 0 && parsedWorkspace) {
4705
+ records.push({
4706
+ ts: new Date(receivedAt).toISOString(),
4707
+ receivedAt,
4708
+ role: "system",
4709
+ kind: "session_start",
4710
+ content: parsedWorkspace,
4711
+ agent: "codex-cli",
4712
+ historySessionId: normalizedSessionId,
4713
+ workspace: parsedWorkspace
4714
+ });
4715
+ }
4716
+ continue;
4717
+ }
4718
+ if (type !== "response_item") continue;
4719
+ const payloadType = String(payload.type || "").trim();
4720
+ if (payloadType === "message") {
4721
+ const role = String(payload.role || "").trim();
4722
+ if (role !== "user" && role !== "assistant") continue;
4723
+ const content = flattenCodexContent(payload.content);
4724
+ if (!content) continue;
4725
+ records.push({
4726
+ ts: new Date(receivedAt).toISOString(),
4727
+ receivedAt,
4728
+ role,
4729
+ content,
4730
+ kind: "standard",
4731
+ agent: "codex-cli",
4732
+ historySessionId: normalizedSessionId
4733
+ });
4734
+ continue;
4735
+ }
4736
+ if (payloadType === "function_call" || payloadType === "custom_tool_call") {
4737
+ const content = summarizeCodexToolCall(payload);
4738
+ if (!content) continue;
4739
+ records.push({
4740
+ ts: new Date(receivedAt).toISOString(),
4741
+ receivedAt,
4742
+ role: "assistant",
4743
+ content,
4744
+ kind: "tool",
4745
+ senderName: "Tool",
4746
+ agent: "codex-cli",
4747
+ historySessionId: normalizedSessionId
4748
+ });
4749
+ continue;
4750
+ }
4751
+ if (payloadType === "function_call_output" || payloadType === "custom_tool_call_output") {
4752
+ const content = codexToolOutputContent(payload);
4753
+ if (!content) continue;
4754
+ records.push({
4755
+ ts: new Date(receivedAt).toISOString(),
4756
+ receivedAt,
4757
+ role: "assistant",
4758
+ content,
4759
+ kind: "tool",
4760
+ senderName: "Tool",
4761
+ agent: "codex-cli",
4762
+ historySessionId: normalizedSessionId
4763
+ });
4764
+ }
4765
+ }
4766
+ return records;
4767
+ } catch {
4768
+ return null;
4769
+ }
4770
+ }
4771
+ function rebuildCodexSavedHistoryFromNativeSession(historySessionId, workspace) {
4772
+ const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId);
4773
+ if (!normalizedSessionId || !isUuidLikeSessionId(normalizedSessionId)) return false;
4774
+ const records = buildCodexNativeHistoryRecords(normalizedSessionId, workspace);
4775
+ if (!records || records.length === 0) return false;
4776
+ const existingSessionStart = readExistingSessionStartRecord("codex-cli", normalizedSessionId);
4777
+ const recordsToWrite = existingSessionStart && records[0]?.kind !== "session_start" ? [{ ...existingSessionStart, historySessionId: normalizedSessionId }, ...records] : records;
4778
+ return rewriteCanonicalSavedHistory("codex-cli", normalizedSessionId, recordsToWrite);
4779
+ }
4780
+ function isNativeSourceCanonicalHistory(canonicalHistory) {
4781
+ if (!canonicalHistory) return false;
4782
+ if (canonicalHistory.mode === "disabled") return false;
4783
+ if (canonicalHistory.mode === "materialized-mirror") return false;
4784
+ return true;
4785
+ }
4786
+ function buildNativeHistoryRecords(canonicalHistory, historySessionId, workspace) {
4787
+ const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId || "");
4788
+ if (!canonicalHistory || !normalizedSessionId || !isNativeSourceCanonicalHistory(canonicalHistory)) return null;
4789
+ if (canonicalHistory.format === "hermes-json") return buildHermesNativeHistoryRecords(normalizedSessionId);
4790
+ if (canonicalHistory.format === "claude-jsonl") return buildClaudeNativeHistoryRecords(normalizedSessionId, workspace);
4791
+ if (canonicalHistory.format === "codex-jsonl") return buildCodexNativeHistoryRecords(normalizedSessionId, workspace);
4792
+ return null;
4793
+ }
4794
+ function readProviderChatHistory(agentType, options = {}) {
4795
+ if (isNativeSourceCanonicalHistory(options.canonicalHistory) && options.historySessionId) {
4796
+ const records = buildNativeHistoryRecords(options.canonicalHistory, options.historySessionId, options.workspace);
4797
+ if (!records) return { messages: [], hasMore: false, source: "native-unavailable" };
4798
+ return {
4799
+ ...pageHistoryRecords(agentType, records, options.offset || 0, options.limit || 30, options.excludeRecentCount || 0, options.historyBehavior),
4800
+ source: "provider-native"
4801
+ };
4802
+ }
4803
+ return {
4804
+ ...readChatHistory(agentType, options.offset || 0, options.limit || 30, options.historySessionId, options.excludeRecentCount || 0, options.historyBehavior),
4805
+ source: "adhdev-mirror"
4806
+ };
4807
+ }
4808
+ function buildNativeSessionSummary(agentType, historySessionId, records, sourcePath) {
4809
+ const visible = pageHistoryRecords(agentType, records, 0, Number.MAX_SAFE_INTEGER).messages;
4810
+ if (visible.length === 0) return null;
4811
+ let sourceMtimeMs = 0;
4812
+ try {
4813
+ sourceMtimeMs = fs3.statSync(sourcePath).mtimeMs;
4814
+ } catch {
4815
+ }
4816
+ const firstMessageAt = visible[0]?.receivedAt || sourceMtimeMs || Date.now();
4817
+ const lastMessageAt = visible[visible.length - 1]?.receivedAt || firstMessageAt;
4818
+ const lastNonSystem = [...visible].reverse().find((message) => message.role !== "system") || visible[visible.length - 1];
4819
+ const firstSystem = visible.find((message) => message.kind === "session_start");
4820
+ return {
4821
+ historySessionId,
4822
+ sessionTitle: lastNonSystem?.content,
4823
+ messageCount: visible.length,
4824
+ firstMessageAt,
4825
+ lastMessageAt,
4826
+ preview: lastNonSystem?.content,
4827
+ workspace: firstSystem?.workspace || (firstSystem?.kind === "session_start" ? firstSystem.content : void 0),
4828
+ source: "provider-native",
4829
+ sourcePath,
4830
+ sourceMtimeMs
4831
+ };
4832
+ }
4833
+ function listFilesRecursive(root, predicate) {
4834
+ if (!fs3.existsSync(root)) return [];
4835
+ const results = [];
4836
+ const stack = [root];
4837
+ while (stack.length > 0) {
4838
+ const current = stack.pop();
4839
+ if (!current) continue;
4840
+ let entries = [];
4841
+ try {
4842
+ entries = fs3.readdirSync(current, { withFileTypes: true });
4843
+ } catch {
4844
+ continue;
4845
+ }
4846
+ for (const entry of entries) {
4847
+ const entryPath = path7.join(current, entry.name);
4848
+ if (entry.isDirectory()) {
4849
+ stack.push(entryPath);
4850
+ continue;
4851
+ }
4852
+ if (predicate(entryPath, entry)) results.push(entryPath);
4853
+ }
4854
+ }
4855
+ return results;
4856
+ }
4857
+ function collectNativeHistorySessionSummaries(agentType, canonicalHistory) {
4858
+ const summaries = [];
4859
+ if (canonicalHistory.format === "hermes-json") {
4860
+ const root = path7.join(os5.homedir(), ".hermes", "sessions");
4861
+ for (const filePath of listFilesRecursive(root, (_entryPath, entry) => entry.isFile() && /^session_.+\.json$/.test(entry.name))) {
4862
+ const fileName = path7.basename(filePath);
4863
+ const historySessionId = fileName.replace(/^session_/, "").replace(/\.json$/, "");
4864
+ const records = buildHermesNativeHistoryRecords(historySessionId);
4865
+ const summary = records ? buildNativeSessionSummary(agentType, historySessionId, records, filePath) : null;
4866
+ if (summary) summaries.push(summary);
4867
+ }
4868
+ } else if (canonicalHistory.format === "claude-jsonl") {
4869
+ const root = path7.join(os5.homedir(), ".claude", "projects");
4870
+ for (const filePath of listFilesRecursive(root, (_entryPath, entry) => entry.isFile() && entry.name.endsWith(".jsonl"))) {
4871
+ const historySessionId = path7.basename(filePath, ".jsonl");
4872
+ const records = buildClaudeNativeHistoryRecords(historySessionId);
4873
+ const summary = records ? buildNativeSessionSummary(agentType, historySessionId, records, filePath) : null;
4874
+ if (summary) summaries.push(summary);
4875
+ }
4876
+ } else if (canonicalHistory.format === "codex-jsonl") {
4877
+ const root = path7.join(os5.homedir(), ".codex", "sessions");
4878
+ const uuidPattern = /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i;
4879
+ for (const filePath of listFilesRecursive(root, (_entryPath, entry) => entry.isFile() && entry.name.endsWith(".jsonl"))) {
4880
+ const meta3 = readCodexSessionMeta(filePath);
4881
+ const historySessionId = String(meta3?.id || path7.basename(filePath).match(uuidPattern)?.[1] || "").trim();
4882
+ if (!historySessionId) continue;
4883
+ const records = buildCodexNativeHistoryRecords(historySessionId, String(meta3?.cwd || "").trim() || void 0);
4884
+ const summary = records ? buildNativeSessionSummary(agentType, historySessionId, records, filePath) : null;
4885
+ if (summary) summaries.push(summary);
4886
+ }
4887
+ }
4888
+ return sortSavedHistorySessionSummaries(summaries);
4889
+ }
4890
+ function listProviderHistorySessions(agentType, options = {}) {
4891
+ if (isNativeSourceCanonicalHistory(options.canonicalHistory)) {
4892
+ const offset = Math.max(0, options.offset || 0);
4893
+ const limit = Math.max(1, options.limit || 30);
4894
+ const summaries = collectNativeHistorySessionSummaries(agentType, options.canonicalHistory);
4895
+ return {
4896
+ sessions: summaries.slice(offset, offset + limit),
4897
+ hasMore: offset + limit < summaries.length,
4898
+ source: "provider-native"
4899
+ };
4900
+ }
4901
+ return {
4902
+ ...listSavedHistorySessions(agentType, { offset: options.offset, limit: options.limit }, options.historyBehavior),
4903
+ source: "adhdev-mirror"
4904
+ };
4905
+ }
4440
4906
  var fs3, path7, os5, 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;
4441
4907
  var init_chat_history = __esm({
4442
4908
  "../../oss/packages/daemon-core/src/config/chat-history.ts"() {
@@ -5440,6 +5906,8 @@ function validateReadChatResultPayload(raw, source = "read_chat") {
5440
5906
  if (raw.summaryMetadata !== void 0) normalized.summaryMetadata = raw.summaryMetadata;
5441
5907
  if (Array.isArray(raw.effects)) normalized.effects = raw.effects;
5442
5908
  if (typeof raw.providerSessionId === "string") normalized.providerSessionId = raw.providerSessionId;
5909
+ if (raw.transcriptAuthority === "provider" || raw.transcriptAuthority === "daemon") normalized.transcriptAuthority = raw.transcriptAuthority;
5910
+ if (raw.coverage === "full" || raw.coverage === "tail" || raw.coverage === "current-turn") normalized.coverage = raw.coverage;
5443
5911
  return normalized;
5444
5912
  }
5445
5913
  var VALID_STATUSES, VALID_ROLES, VALID_BUBBLE_STATES, VALID_TURN_STATUSES;
@@ -7707,7 +8175,16 @@ async function handleChatHistory(h, args) {
7707
8175
  const visibleCount = Array.isArray(status?.messages) ? status.messages.length : 0;
7708
8176
  if (visibleCount > excludeRecentCount) excludeRecentCount = visibleCount;
7709
8177
  }
7710
- const result = readChatHistory(agentStr, offset || 0, limit || 30, historySessionId, excludeRecentCount);
8178
+ const workspace = typeof args?.workspace === "string" ? args.workspace : typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : void 0;
8179
+ const result = readProviderChatHistory(agentStr, {
8180
+ canonicalHistory: provider?.canonicalHistory,
8181
+ historySessionId,
8182
+ workspace,
8183
+ offset: offset || 0,
8184
+ limit: limit || 30,
8185
+ excludeRecentCount,
8186
+ historyBehavior: provider?.historyBehavior
8187
+ });
7711
8188
  return { success: true, ...result, agent: agentStr };
7712
8189
  } catch (e) {
7713
8190
  return { success: false, error: e.message };
@@ -7732,7 +8209,8 @@ async function handleReadChat(h, args) {
7732
8209
  }
7733
8210
  const parsedRecord = parsedStatus && typeof parsedStatus === "object" ? parsedStatus : null;
7734
8211
  const adapterStatus = adapter.getStatus();
7735
- const shouldPreferAdapterMessages = Array.isArray(adapterStatus.messages) && adapterStatus.messages.length > 0 && Array.isArray(parsedRecord?.messages) && adapterStatus.messages.length > parsedRecord.messages.length;
8212
+ const parsedIsProviderAuthoritative = parsedRecord?.transcriptAuthority === "provider" || parsedRecord?.coverage === "full";
8213
+ const shouldPreferAdapterMessages = !parsedIsProviderAuthoritative && Array.isArray(adapterStatus.messages) && adapterStatus.messages.length > 0 && Array.isArray(parsedRecord?.messages) && adapterStatus.messages.length > parsedRecord.messages.length;
7736
8214
  const parsedShowsApproval = hasNonEmptyModalButtons(parsedRecord?.activeModal) && parsedRecord?.status === "waiting_approval";
7737
8215
  const status = parsedRecord ? {
7738
8216
  ...parsedRecord,
@@ -7742,6 +8220,8 @@ async function handleReadChat(h, args) {
7742
8220
  } : adapterStatus;
7743
8221
  const title = typeof parsedRecord?.title === "string" ? parsedRecord.title : void 0;
7744
8222
  const providerSessionId = typeof parsedRecord?.providerSessionId === "string" ? parsedRecord.providerSessionId : void 0;
8223
+ const transcriptAuthority = parsedRecord?.transcriptAuthority === "provider" || parsedRecord?.transcriptAuthority === "daemon" ? parsedRecord.transcriptAuthority : void 0;
8224
+ const coverage = parsedRecord?.coverage === "full" || parsedRecord?.coverage === "tail" || parsedRecord?.coverage === "current-turn" ? parsedRecord.coverage : void 0;
7745
8225
  if (status) {
7746
8226
  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}`);
7747
8227
  return buildReadChatCommandResult({
@@ -7760,7 +8240,9 @@ async function handleReadChat(h, args) {
7760
8240
  returnedMsgCount: Array.isArray(status.messages) ? status.messages.length : 0
7761
8241
  },
7762
8242
  ...title ? { title } : {},
7763
- ...providerSessionId ? { providerSessionId } : {}
8243
+ ...providerSessionId ? { providerSessionId } : {},
8244
+ ...transcriptAuthority ? { transcriptAuthority } : {},
8245
+ ...coverage ? { coverage } : {}
7764
8246
  }, args);
7765
8247
  }
7766
8248
  }
@@ -10552,18 +11034,18 @@ var init_source = __esm({
10552
11034
  }
10553
11035
  }
10554
11036
  });
10555
- createStyler = (open3, close, parent) => {
11037
+ createStyler = (open2, close, parent) => {
10556
11038
  let openAll;
10557
11039
  let closeAll;
10558
11040
  if (parent === void 0) {
10559
- openAll = open3;
11041
+ openAll = open2;
10560
11042
  closeAll = close;
10561
11043
  } else {
10562
- openAll = parent.openAll + open3;
11044
+ openAll = parent.openAll + open2;
10563
11045
  closeAll = close + parent.closeAll;
10564
11046
  }
10565
11047
  return {
10566
- open: open3,
11048
+ open: open2,
10567
11049
  close,
10568
11050
  openAll,
10569
11051
  closeAll,
@@ -10936,14 +11418,14 @@ function applyTerminalColorEnv(env3) {
10936
11418
  function ensureNodePtySpawnHelperPermissions(logFn) {
10937
11419
  if (os22.platform() === "win32") return;
10938
11420
  try {
10939
- const fs24 = __require("fs");
11421
+ const fs19 = __require("fs");
10940
11422
  const ptyDir = path32.resolve(path32.dirname(__require.resolve("node-pty")), "..");
10941
11423
  const platformArch = `${os22.platform()}-${os22.arch()}`;
10942
11424
  const helper = path32.join(ptyDir, "prebuilds", platformArch, "spawn-helper");
10943
- if (fs24.existsSync(helper)) {
10944
- const stat4 = fs24.statSync(helper);
11425
+ if (fs19.existsSync(helper)) {
11426
+ const stat4 = fs19.statSync(helper);
10945
11427
  if (!(stat4.mode & 73)) {
10946
- fs24.chmodSync(helper, stat4.mode | 493);
11428
+ fs19.chmodSync(helper, stat4.mode | 493);
10947
11429
  logFn?.(`Fixed spawn-helper permissions: ${helper}`);
10948
11430
  }
10949
11431
  }
@@ -11138,8 +11620,8 @@ var init_pty_transport = __esm({
11138
11620
  let cwd = options.cwd;
11139
11621
  if (cwd) {
11140
11622
  try {
11141
- const fs24 = require("fs");
11142
- const stat4 = fs24.statSync(cwd);
11623
+ const fs19 = require("fs");
11624
+ const stat4 = fs19.statSync(cwd);
11143
11625
  if (!stat4.isDirectory()) cwd = os9.homedir();
11144
11626
  } catch {
11145
11627
  cwd = os9.homedir();
@@ -11237,12 +11719,12 @@ function findBinary(name) {
11237
11719
  function isScriptBinary(binaryPath) {
11238
11720
  if (!path9.isAbsolute(binaryPath)) return false;
11239
11721
  try {
11240
- const fs24 = require("fs");
11241
- const resolved = fs24.realpathSync(binaryPath);
11722
+ const fs19 = require("fs");
11723
+ const resolved = fs19.realpathSync(binaryPath);
11242
11724
  const head = Buffer.alloc(8);
11243
- const fd = fs24.openSync(resolved, "r");
11244
- fs24.readSync(fd, head, 0, 8, 0);
11245
- fs24.closeSync(fd);
11725
+ const fd = fs19.openSync(resolved, "r");
11726
+ fs19.readSync(fd, head, 0, 8, 0);
11727
+ fs19.closeSync(fd);
11246
11728
  let i = 0;
11247
11729
  if (head[0] === 239 && head[1] === 187 && head[2] === 191) i = 3;
11248
11730
  return head[i] === 35 && head[i + 1] === 33;
@@ -11253,12 +11735,12 @@ function isScriptBinary(binaryPath) {
11253
11735
  function looksLikeMachOOrElf(filePath) {
11254
11736
  if (!path9.isAbsolute(filePath)) return false;
11255
11737
  try {
11256
- const fs24 = require("fs");
11257
- const resolved = fs24.realpathSync(filePath);
11738
+ const fs19 = require("fs");
11739
+ const resolved = fs19.realpathSync(filePath);
11258
11740
  const buf = Buffer.alloc(8);
11259
- const fd = fs24.openSync(resolved, "r");
11260
- fs24.readSync(fd, buf, 0, 8, 0);
11261
- fs24.closeSync(fd);
11741
+ const fd = fs19.openSync(resolved, "r");
11742
+ fs19.readSync(fd, buf, 0, 8, 0);
11743
+ fs19.closeSync(fd);
11262
11744
  let i = 0;
11263
11745
  if (buf[0] === 239 && buf[1] === 187 && buf[2] === 191) i = 3;
11264
11746
  const b = buf.subarray(i);
@@ -11818,7 +12300,8 @@ __export(provider_cli_adapter_exports, {
11818
12300
  ProviderCliAdapter: () => ProviderCliAdapter,
11819
12301
  appendBoundedText: () => appendBoundedText,
11820
12302
  normalizeCliProviderForRuntime: () => normalizeCliProviderForRuntime,
11821
- sanitizeCliStandardMessageContent: () => sanitizeCliStandardMessageContent
12303
+ sanitizeCliStandardMessageContent: () => sanitizeCliStandardMessageContent,
12304
+ trimLastAssistantEchoForCliMessages: () => trimLastAssistantEchoForCliMessages
11822
12305
  });
11823
12306
  function normalizeComparableTranscriptText(value) {
11824
12307
  return sanitizeTerminalText(String(value || "")).replace(/\s+/g, " ").trim();
@@ -11914,6 +12397,19 @@ function sanitizeCommittedMessageForDisplay(message) {
11914
12397
  if (content === message.content) return message;
11915
12398
  return { ...message, content };
11916
12399
  }
12400
+ function trimLastAssistantEchoForCliMessages(messages, prompt2) {
12401
+ if (!prompt2) return;
12402
+ for (let index = messages.length - 1; index >= 0; index -= 1) {
12403
+ const message = messages[index];
12404
+ if (!message || message.role !== "assistant" || typeof message.content !== "string") continue;
12405
+ if ((message.kind || "standard") !== "standard") continue;
12406
+ message.content = trimPromptEchoPrefix(message.content, prompt2);
12407
+ if (!message.content.trim()) {
12408
+ messages.splice(index, 1);
12409
+ }
12410
+ return;
12411
+ }
12412
+ }
11917
12413
  var os12, COMMITTED_ACTIVITY_PREFIX_BLOCK_RE, ProviderCliAdapter;
11918
12414
  var init_provider_cli_adapter = __esm({
11919
12415
  "../../oss/packages/daemon-core/src/cli-adapters/provider-cli-adapter.ts"() {
@@ -12111,7 +12607,14 @@ var init_provider_cli_adapter = __esm({
12111
12607
  }
12112
12608
  return null;
12113
12609
  }
12610
+ providerOwnsTranscript() {
12611
+ return this.provider.transcriptAuthority === "provider";
12612
+ }
12613
+ shouldUseFullProviderTranscriptContext() {
12614
+ return this.providerOwnsTranscript() && this.provider.transcriptContext === "full";
12615
+ }
12114
12616
  selectParseBaseMessages(baseMessages) {
12617
+ if (this.shouldUseFullProviderTranscriptContext()) return baseMessages;
12115
12618
  if (baseMessages.length <= _ProviderCliAdapter.PARSE_MESSAGE_TAIL_LIMIT) return baseMessages;
12116
12619
  return baseMessages.slice(-_ProviderCliAdapter.PARSE_MESSAGE_TAIL_LIMIT);
12117
12620
  }
@@ -12594,9 +13097,7 @@ var init_provider_cli_adapter = __esm({
12594
13097
  );
12595
13098
  }
12596
13099
  trimLastAssistantEcho(messages, prompt2) {
12597
- if (!prompt2) return;
12598
- const last = [...messages].reverse().find((m) => m.role === "assistant" && typeof m.content === "string");
12599
- if (last) last.content = trimPromptEchoPrefix(last.content, prompt2);
13100
+ trimLastAssistantEchoForCliMessages(messages, prompt2);
12600
13101
  }
12601
13102
  clearAllTimers() {
12602
13103
  if (this.responseTimeout) {
@@ -13450,7 +13951,8 @@ var init_provider_cli_adapter = __esm({
13450
13951
  title: parsed.title || this.cliName,
13451
13952
  messages: hydratedMessages,
13452
13953
  activeModal: parsed.activeModal ?? this.activeModal,
13453
- providerSessionId: typeof parsed.providerSessionId === "string" ? parsed.providerSessionId : void 0
13954
+ providerSessionId: typeof parsed.providerSessionId === "string" ? parsed.providerSessionId : void 0,
13955
+ ...this.providerOwnsTranscript() ? { transcriptAuthority: "provider", coverage: this.shouldUseFullProviderTranscriptContext() ? "full" : "tail" } : {}
13454
13956
  };
13455
13957
  } else {
13456
13958
  const messages = [...this.committedMessages];
@@ -14342,6 +14844,8 @@ var init_cli_provider_instance = __esm({
14342
14844
  lastCanonicalHermesWatchPath = void 0;
14343
14845
  lastCanonicalClaudeRebuildMtimeMs = 0;
14344
14846
  lastCanonicalClaudeCheckAt = 0;
14847
+ lastCanonicalCodexRebuildMtimeMs = 0;
14848
+ lastCanonicalCodexCheckAt = 0;
14345
14849
  cachedSqliteDb = null;
14346
14850
  cachedSqliteDbPath = null;
14347
14851
  cachedSqliteDbMissingUntil = 0;
@@ -15041,6 +15545,25 @@ ${effect.notification.body || ""}`.trim();
15041
15545
  if (!this.providerSessionId) return false;
15042
15546
  const canonicalHistory = this.provider.canonicalHistory;
15043
15547
  if (!canonicalHistory) return false;
15548
+ if (isNativeSourceCanonicalHistory(canonicalHistory)) {
15549
+ const restoredHistory = readProviderChatHistory(this.type, {
15550
+ canonicalHistory,
15551
+ historySessionId: this.providerSessionId,
15552
+ workspace: this.workingDir,
15553
+ offset: 0,
15554
+ limit: Number.MAX_SAFE_INTEGER,
15555
+ historyBehavior: this.provider.historyBehavior
15556
+ });
15557
+ if (restoredHistory.source !== "provider-native") return false;
15558
+ this.lastPersistedHistoryMessages = restoredHistory.messages.map((message) => ({
15559
+ role: message.role,
15560
+ content: message.content,
15561
+ kind: message.kind,
15562
+ senderName: message.senderName,
15563
+ receivedAt: message.receivedAt
15564
+ }));
15565
+ return true;
15566
+ }
15044
15567
  try {
15045
15568
  let rebuilt = false;
15046
15569
  if (canonicalHistory.format === "hermes-json") {
@@ -15074,6 +15597,23 @@ ${effect.notification.body || ""}`.trim();
15074
15597
  if (transcriptMtime > 0 && transcriptMtime <= this.lastCanonicalClaudeRebuildMtimeMs) return true;
15075
15598
  rebuilt = rebuildClaudeSavedHistoryFromNativeProject(this.providerSessionId, this.workingDir);
15076
15599
  if (rebuilt) this.lastCanonicalClaudeRebuildMtimeMs = transcriptMtime || Date.now();
15600
+ } else if (canonicalHistory.format === "codex-jsonl") {
15601
+ const now = Date.now();
15602
+ if (now - this.lastCanonicalCodexCheckAt < 2e3 && this.lastCanonicalCodexRebuildMtimeMs !== 0) {
15603
+ return true;
15604
+ }
15605
+ this.lastCanonicalCodexCheckAt = now;
15606
+ const transcriptFile = resolveCodexSessionTranscriptPath(this.providerSessionId, this.workingDir);
15607
+ let transcriptMtime = 0;
15608
+ if (transcriptFile) {
15609
+ try {
15610
+ transcriptMtime = fs5.statSync(transcriptFile).mtimeMs;
15611
+ } catch {
15612
+ }
15613
+ }
15614
+ if (transcriptMtime > 0 && transcriptMtime <= this.lastCanonicalCodexRebuildMtimeMs) return true;
15615
+ rebuilt = rebuildCodexSavedHistoryFromNativeSession(this.providerSessionId, this.workingDir);
15616
+ if (rebuilt) this.lastCanonicalCodexRebuildMtimeMs = transcriptMtime || Date.now();
15077
15617
  }
15078
15618
  if (!rebuilt) return false;
15079
15619
  const restoredHistory = readChatHistory(this.type, 0, Number.MAX_SAFE_INTEGER, this.providerSessionId, 0, this.provider.historyBehavior);
@@ -15092,8 +15632,17 @@ ${effect.notification.body || ""}`.trim();
15092
15632
  restorePersistedHistoryFromCurrentSession() {
15093
15633
  if (!this.providerSessionId) return;
15094
15634
  this.syncCanonicalSavedHistoryIfNeeded();
15095
- this.historyWriter.compactHistorySession(this.type, this.providerSessionId, this.provider.historyBehavior);
15096
- const restoredHistory = readChatHistory(this.type, 0, Number.MAX_SAFE_INTEGER, this.providerSessionId, 0, this.provider.historyBehavior);
15635
+ const restoredHistory = isNativeSourceCanonicalHistory(this.provider.canonicalHistory) ? readProviderChatHistory(this.type, {
15636
+ canonicalHistory: this.provider.canonicalHistory,
15637
+ historySessionId: this.providerSessionId,
15638
+ workspace: this.workingDir,
15639
+ offset: 0,
15640
+ limit: Number.MAX_SAFE_INTEGER,
15641
+ historyBehavior: this.provider.historyBehavior
15642
+ }) : (() => {
15643
+ this.historyWriter.compactHistorySession(this.type, this.providerSessionId, this.provider.historyBehavior);
15644
+ return readChatHistory(this.type, 0, Number.MAX_SAFE_INTEGER, this.providerSessionId, 0, this.provider.historyBehavior);
15645
+ })();
15097
15646
  this.historyWriter.seedSessionHistory(
15098
15647
  this.type,
15099
15648
  restoredHistory.messages,
@@ -15420,10 +15969,10 @@ function mergeDefs(...defs) {
15420
15969
  function cloneDef(schema) {
15421
15970
  return mergeDefs(schema._zod.def);
15422
15971
  }
15423
- function getElementAtPath(obj, path29) {
15424
- if (!path29)
15972
+ function getElementAtPath(obj, path28) {
15973
+ if (!path28)
15425
15974
  return obj;
15426
- return path29.reduce((acc, key) => acc?.[key], obj);
15975
+ return path28.reduce((acc, key) => acc?.[key], obj);
15427
15976
  }
15428
15977
  function promiseAllObject(promisesObj) {
15429
15978
  const keys = Object.keys(promisesObj);
@@ -15735,11 +16284,11 @@ function aborted(x, startIndex = 0) {
15735
16284
  }
15736
16285
  return false;
15737
16286
  }
15738
- function prefixIssues(path29, issues) {
16287
+ function prefixIssues(path28, issues) {
15739
16288
  return issues.map((iss) => {
15740
16289
  var _a2;
15741
16290
  (_a2 = iss).path ?? (_a2.path = []);
15742
- iss.path.unshift(path29);
16291
+ iss.path.unshift(path28);
15743
16292
  return iss;
15744
16293
  });
15745
16294
  }
@@ -15982,7 +16531,7 @@ function formatError(error48, mapper = (issue2) => issue2.message) {
15982
16531
  }
15983
16532
  function treeifyError(error48, mapper = (issue2) => issue2.message) {
15984
16533
  const result = { errors: [] };
15985
- const processError = (error49, path29 = []) => {
16534
+ const processError = (error49, path28 = []) => {
15986
16535
  var _a2, _b;
15987
16536
  for (const issue2 of error49.issues) {
15988
16537
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -15992,7 +16541,7 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
15992
16541
  } else if (issue2.code === "invalid_element") {
15993
16542
  processError({ issues: issue2.issues }, issue2.path);
15994
16543
  } else {
15995
- const fullpath = [...path29, ...issue2.path];
16544
+ const fullpath = [...path28, ...issue2.path];
15996
16545
  if (fullpath.length === 0) {
15997
16546
  result.errors.push(mapper(issue2));
15998
16547
  continue;
@@ -16024,8 +16573,8 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
16024
16573
  }
16025
16574
  function toDotPath(_path) {
16026
16575
  const segs = [];
16027
- const path29 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
16028
- for (const seg of path29) {
16576
+ const path28 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
16577
+ for (const seg of path28) {
16029
16578
  if (typeof seg === "number")
16030
16579
  segs.push(`[${seg}]`);
16031
16580
  else if (typeof seg === "symbol")
@@ -28789,13 +29338,13 @@ function resolveRef(ref, ctx) {
28789
29338
  if (!ref.startsWith("#")) {
28790
29339
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
28791
29340
  }
28792
- const path29 = ref.slice(1).split("/").filter(Boolean);
28793
- if (path29.length === 0) {
29341
+ const path28 = ref.slice(1).split("/").filter(Boolean);
29342
+ if (path28.length === 0) {
28794
29343
  return ctx.rootSchema;
28795
29344
  }
28796
29345
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
28797
- if (path29[0] === defsKey) {
28798
- const key = path29[1];
29346
+ if (path28[0] === defsKey) {
29347
+ const key = path28[1];
28799
29348
  if (!key || !ctx.defs[key]) {
28800
29349
  throw new Error(`Reference not found: ${ref}`);
28801
29350
  }
@@ -33549,7 +34098,7 @@ var init_readdirp = __esm({
33549
34098
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
33550
34099
  const statMethod = opts.lstat ? import_promises.lstat : import_promises.stat;
33551
34100
  if (wantBigintFsStats) {
33552
- this._stat = (path29) => statMethod(path29, { bigint: true });
34101
+ this._stat = (path28) => statMethod(path28, { bigint: true });
33553
34102
  } else {
33554
34103
  this._stat = statMethod;
33555
34104
  }
@@ -33574,8 +34123,8 @@ var init_readdirp = __esm({
33574
34123
  const par = this.parent;
33575
34124
  const fil = par && par.files;
33576
34125
  if (fil && fil.length > 0) {
33577
- const { path: path29, depth } = par;
33578
- const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path29));
34126
+ const { path: path28, depth } = par;
34127
+ const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path28));
33579
34128
  const awaited = await Promise.all(slice);
33580
34129
  for (const entry of awaited) {
33581
34130
  if (!entry)
@@ -33615,21 +34164,21 @@ var init_readdirp = __esm({
33615
34164
  this.reading = false;
33616
34165
  }
33617
34166
  }
33618
- async _exploreDir(path29, depth) {
34167
+ async _exploreDir(path28, depth) {
33619
34168
  let files;
33620
34169
  try {
33621
- files = await (0, import_promises.readdir)(path29, this._rdOptions);
34170
+ files = await (0, import_promises.readdir)(path28, this._rdOptions);
33622
34171
  } catch (error48) {
33623
34172
  this._onError(error48);
33624
34173
  }
33625
- return { files, depth, path: path29 };
34174
+ return { files, depth, path: path28 };
33626
34175
  }
33627
- async _formatEntry(dirent, path29) {
34176
+ async _formatEntry(dirent, path28) {
33628
34177
  let entry;
33629
- const basename9 = this._isDirent ? dirent.name : dirent;
34178
+ const basename10 = this._isDirent ? dirent.name : dirent;
33630
34179
  try {
33631
- const fullPath = (0, import_node_path.resolve)((0, import_node_path.join)(path29, basename9));
33632
- entry = { path: (0, import_node_path.relative)(this._root, fullPath), fullPath, basename: basename9 };
34180
+ const fullPath = (0, import_node_path.resolve)((0, import_node_path.join)(path28, basename10));
34181
+ entry = { path: (0, import_node_path.relative)(this._root, fullPath), fullPath, basename: basename10 };
33633
34182
  entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
33634
34183
  } catch (err) {
33635
34184
  this._onError(err);
@@ -33685,16 +34234,16 @@ var init_readdirp = __esm({
33685
34234
  });
33686
34235
 
33687
34236
  // ../../oss/packages/daemon-core/node_modules/chokidar/handler.js
33688
- function createFsWatchInstance(path29, options, listener, errHandler, emitRaw) {
34237
+ function createFsWatchInstance(path28, options, listener, errHandler, emitRaw) {
33689
34238
  const handleEvent = (rawEvent, evPath) => {
33690
- listener(path29);
33691
- emitRaw(rawEvent, evPath, { watchedPath: path29 });
33692
- if (evPath && path29 !== evPath) {
33693
- fsWatchBroadcast(sp.resolve(path29, evPath), KEY_LISTENERS, sp.join(path29, evPath));
34239
+ listener(path28);
34240
+ emitRaw(rawEvent, evPath, { watchedPath: path28 });
34241
+ if (evPath && path28 !== evPath) {
34242
+ fsWatchBroadcast(sp.resolve(path28, evPath), KEY_LISTENERS, sp.join(path28, evPath));
33694
34243
  }
33695
34244
  };
33696
34245
  try {
33697
- return (0, import_node_fs.watch)(path29, {
34246
+ return (0, import_node_fs.watch)(path28, {
33698
34247
  persistent: options.persistent
33699
34248
  }, handleEvent);
33700
34249
  } catch (error48) {
@@ -34043,12 +34592,12 @@ var init_handler2 = __esm({
34043
34592
  listener(val1, val2, val3);
34044
34593
  });
34045
34594
  };
34046
- setFsWatchListener = (path29, fullPath, options, handlers) => {
34595
+ setFsWatchListener = (path28, fullPath, options, handlers) => {
34047
34596
  const { listener, errHandler, rawEmitter } = handlers;
34048
34597
  let cont = FsWatchInstances.get(fullPath);
34049
34598
  let watcher;
34050
34599
  if (!options.persistent) {
34051
- watcher = createFsWatchInstance(path29, options, listener, errHandler, rawEmitter);
34600
+ watcher = createFsWatchInstance(path28, options, listener, errHandler, rawEmitter);
34052
34601
  if (!watcher)
34053
34602
  return;
34054
34603
  return watcher.close.bind(watcher);
@@ -34059,7 +34608,7 @@ var init_handler2 = __esm({
34059
34608
  addAndConvert(cont, KEY_RAW, rawEmitter);
34060
34609
  } else {
34061
34610
  watcher = createFsWatchInstance(
34062
- path29,
34611
+ path28,
34063
34612
  options,
34064
34613
  fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS),
34065
34614
  errHandler,
@@ -34074,7 +34623,7 @@ var init_handler2 = __esm({
34074
34623
  cont.watcherUnusable = true;
34075
34624
  if (isWindows && error48.code === "EPERM") {
34076
34625
  try {
34077
- const fd = await (0, import_promises2.open)(path29, "r");
34626
+ const fd = await (0, import_promises2.open)(path28, "r");
34078
34627
  await fd.close();
34079
34628
  broadcastErr(error48);
34080
34629
  } catch (err) {
@@ -34105,7 +34654,7 @@ var init_handler2 = __esm({
34105
34654
  };
34106
34655
  };
34107
34656
  FsWatchFileInstances = /* @__PURE__ */ new Map();
34108
- setFsWatchFileListener = (path29, fullPath, options, handlers) => {
34657
+ setFsWatchFileListener = (path28, fullPath, options, handlers) => {
34109
34658
  const { listener, rawEmitter } = handlers;
34110
34659
  let cont = FsWatchFileInstances.get(fullPath);
34111
34660
  const copts = cont && cont.options;
@@ -34127,7 +34676,7 @@ var init_handler2 = __esm({
34127
34676
  });
34128
34677
  const currmtime = curr.mtimeMs;
34129
34678
  if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
34130
- foreach(cont.listeners, (listener2) => listener2(path29, curr));
34679
+ foreach(cont.listeners, (listener2) => listener2(path28, curr));
34131
34680
  }
34132
34681
  })
34133
34682
  };
@@ -34157,13 +34706,13 @@ var init_handler2 = __esm({
34157
34706
  * @param listener on fs change
34158
34707
  * @returns closer for the watcher instance
34159
34708
  */
34160
- _watchWithNodeFs(path29, listener) {
34709
+ _watchWithNodeFs(path28, listener) {
34161
34710
  const opts = this.fsw.options;
34162
- const directory = sp.dirname(path29);
34163
- const basename9 = sp.basename(path29);
34711
+ const directory = sp.dirname(path28);
34712
+ const basename10 = sp.basename(path28);
34164
34713
  const parent = this.fsw._getWatchedDir(directory);
34165
- parent.add(basename9);
34166
- const absolutePath = sp.resolve(path29);
34714
+ parent.add(basename10);
34715
+ const absolutePath = sp.resolve(path28);
34167
34716
  const options = {
34168
34717
  persistent: opts.persistent
34169
34718
  };
@@ -34172,13 +34721,13 @@ var init_handler2 = __esm({
34172
34721
  let closer;
34173
34722
  if (opts.usePolling) {
34174
34723
  const enableBin = opts.interval !== opts.binaryInterval;
34175
- options.interval = enableBin && isBinaryPath(basename9) ? opts.binaryInterval : opts.interval;
34176
- closer = setFsWatchFileListener(path29, absolutePath, options, {
34724
+ options.interval = enableBin && isBinaryPath(basename10) ? opts.binaryInterval : opts.interval;
34725
+ closer = setFsWatchFileListener(path28, absolutePath, options, {
34177
34726
  listener,
34178
34727
  rawEmitter: this.fsw._emitRaw
34179
34728
  });
34180
34729
  } else {
34181
- closer = setFsWatchListener(path29, absolutePath, options, {
34730
+ closer = setFsWatchListener(path28, absolutePath, options, {
34182
34731
  listener,
34183
34732
  errHandler: this._boundHandleError,
34184
34733
  rawEmitter: this.fsw._emitRaw
@@ -34195,12 +34744,12 @@ var init_handler2 = __esm({
34195
34744
  return;
34196
34745
  }
34197
34746
  const dirname10 = sp.dirname(file2);
34198
- const basename9 = sp.basename(file2);
34747
+ const basename10 = sp.basename(file2);
34199
34748
  const parent = this.fsw._getWatchedDir(dirname10);
34200
34749
  let prevStats = stats;
34201
- if (parent.has(basename9))
34750
+ if (parent.has(basename10))
34202
34751
  return;
34203
- const listener = async (path29, newStats) => {
34752
+ const listener = async (path28, newStats) => {
34204
34753
  if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file2, 5))
34205
34754
  return;
34206
34755
  if (!newStats || newStats.mtimeMs === 0) {
@@ -34214,18 +34763,18 @@ var init_handler2 = __esm({
34214
34763
  this.fsw._emit(EV.CHANGE, file2, newStats2);
34215
34764
  }
34216
34765
  if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats2.ino) {
34217
- this.fsw._closeFile(path29);
34766
+ this.fsw._closeFile(path28);
34218
34767
  prevStats = newStats2;
34219
34768
  const closer2 = this._watchWithNodeFs(file2, listener);
34220
34769
  if (closer2)
34221
- this.fsw._addPathCloser(path29, closer2);
34770
+ this.fsw._addPathCloser(path28, closer2);
34222
34771
  } else {
34223
34772
  prevStats = newStats2;
34224
34773
  }
34225
34774
  } catch (error48) {
34226
- this.fsw._remove(dirname10, basename9);
34775
+ this.fsw._remove(dirname10, basename10);
34227
34776
  }
34228
- } else if (parent.has(basename9)) {
34777
+ } else if (parent.has(basename10)) {
34229
34778
  const at = newStats.atimeMs;
34230
34779
  const mt = newStats.mtimeMs;
34231
34780
  if (!at || at <= mt || mt !== prevStats.mtimeMs) {
@@ -34250,7 +34799,7 @@ var init_handler2 = __esm({
34250
34799
  * @param item basename of this item
34251
34800
  * @returns true if no more processing is needed for this entry.
34252
34801
  */
34253
- async _handleSymlink(entry, directory, path29, item) {
34802
+ async _handleSymlink(entry, directory, path28, item) {
34254
34803
  if (this.fsw.closed) {
34255
34804
  return;
34256
34805
  }
@@ -34260,7 +34809,7 @@ var init_handler2 = __esm({
34260
34809
  this.fsw._incrReadyCount();
34261
34810
  let linkPath;
34262
34811
  try {
34263
- linkPath = await (0, import_promises2.realpath)(path29);
34812
+ linkPath = await (0, import_promises2.realpath)(path28);
34264
34813
  } catch (e) {
34265
34814
  this.fsw._emitReady();
34266
34815
  return true;
@@ -34270,12 +34819,12 @@ var init_handler2 = __esm({
34270
34819
  if (dir.has(item)) {
34271
34820
  if (this.fsw._symlinkPaths.get(full) !== linkPath) {
34272
34821
  this.fsw._symlinkPaths.set(full, linkPath);
34273
- this.fsw._emit(EV.CHANGE, path29, entry.stats);
34822
+ this.fsw._emit(EV.CHANGE, path28, entry.stats);
34274
34823
  }
34275
34824
  } else {
34276
34825
  dir.add(item);
34277
34826
  this.fsw._symlinkPaths.set(full, linkPath);
34278
- this.fsw._emit(EV.ADD, path29, entry.stats);
34827
+ this.fsw._emit(EV.ADD, path28, entry.stats);
34279
34828
  }
34280
34829
  this.fsw._emitReady();
34281
34830
  return true;
@@ -34305,9 +34854,9 @@ var init_handler2 = __esm({
34305
34854
  return;
34306
34855
  }
34307
34856
  const item = entry.path;
34308
- let path29 = sp.join(directory, item);
34857
+ let path28 = sp.join(directory, item);
34309
34858
  current.add(item);
34310
- if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path29, item)) {
34859
+ if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path28, item)) {
34311
34860
  return;
34312
34861
  }
34313
34862
  if (this.fsw.closed) {
@@ -34316,8 +34865,8 @@ var init_handler2 = __esm({
34316
34865
  }
34317
34866
  if (item === target || !target && !previous.has(item)) {
34318
34867
  this.fsw._incrReadyCount();
34319
- path29 = sp.join(dir, sp.relative(dir, path29));
34320
- this._addToNodeFs(path29, initialAdd, wh, depth + 1);
34868
+ path28 = sp.join(dir, sp.relative(dir, path28));
34869
+ this._addToNodeFs(path28, initialAdd, wh, depth + 1);
34321
34870
  }
34322
34871
  }).on(EV.ERROR, this._boundHandleError);
34323
34872
  return new Promise((resolve16, reject) => {
@@ -34386,13 +34935,13 @@ var init_handler2 = __esm({
34386
34935
  * @param depth Child path actually targeted for watch
34387
34936
  * @param target Child path actually targeted for watch
34388
34937
  */
34389
- async _addToNodeFs(path29, initialAdd, priorWh, depth, target) {
34938
+ async _addToNodeFs(path28, initialAdd, priorWh, depth, target) {
34390
34939
  const ready = this.fsw._emitReady;
34391
- if (this.fsw._isIgnored(path29) || this.fsw.closed) {
34940
+ if (this.fsw._isIgnored(path28) || this.fsw.closed) {
34392
34941
  ready();
34393
34942
  return false;
34394
34943
  }
34395
- const wh = this.fsw._getWatchHelpers(path29);
34944
+ const wh = this.fsw._getWatchHelpers(path28);
34396
34945
  if (priorWh) {
34397
34946
  wh.filterPath = (entry) => priorWh.filterPath(entry);
34398
34947
  wh.filterDir = (entry) => priorWh.filterDir(entry);
@@ -34408,8 +34957,8 @@ var init_handler2 = __esm({
34408
34957
  const follow = this.fsw.options.followSymlinks;
34409
34958
  let closer;
34410
34959
  if (stats.isDirectory()) {
34411
- const absPath = sp.resolve(path29);
34412
- const targetPath = follow ? await (0, import_promises2.realpath)(path29) : path29;
34960
+ const absPath = sp.resolve(path28);
34961
+ const targetPath = follow ? await (0, import_promises2.realpath)(path28) : path28;
34413
34962
  if (this.fsw.closed)
34414
34963
  return;
34415
34964
  closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
@@ -34419,29 +34968,29 @@ var init_handler2 = __esm({
34419
34968
  this.fsw._symlinkPaths.set(absPath, targetPath);
34420
34969
  }
34421
34970
  } else if (stats.isSymbolicLink()) {
34422
- const targetPath = follow ? await (0, import_promises2.realpath)(path29) : path29;
34971
+ const targetPath = follow ? await (0, import_promises2.realpath)(path28) : path28;
34423
34972
  if (this.fsw.closed)
34424
34973
  return;
34425
34974
  const parent = sp.dirname(wh.watchPath);
34426
34975
  this.fsw._getWatchedDir(parent).add(wh.watchPath);
34427
34976
  this.fsw._emit(EV.ADD, wh.watchPath, stats);
34428
- closer = await this._handleDir(parent, stats, initialAdd, depth, path29, wh, targetPath);
34977
+ closer = await this._handleDir(parent, stats, initialAdd, depth, path28, wh, targetPath);
34429
34978
  if (this.fsw.closed)
34430
34979
  return;
34431
34980
  if (targetPath !== void 0) {
34432
- this.fsw._symlinkPaths.set(sp.resolve(path29), targetPath);
34981
+ this.fsw._symlinkPaths.set(sp.resolve(path28), targetPath);
34433
34982
  }
34434
34983
  } else {
34435
34984
  closer = this._handleFile(wh.watchPath, stats, initialAdd);
34436
34985
  }
34437
34986
  ready();
34438
34987
  if (closer)
34439
- this.fsw._addPathCloser(path29, closer);
34988
+ this.fsw._addPathCloser(path28, closer);
34440
34989
  return false;
34441
34990
  } catch (error48) {
34442
34991
  if (this.fsw._handleError(error48)) {
34443
34992
  ready();
34444
- return path29;
34993
+ return path28;
34445
34994
  }
34446
34995
  }
34447
34996
  }
@@ -34476,24 +35025,24 @@ function createPattern(matcher) {
34476
35025
  }
34477
35026
  return () => false;
34478
35027
  }
34479
- function normalizePath(path29) {
34480
- if (typeof path29 !== "string")
35028
+ function normalizePath(path28) {
35029
+ if (typeof path28 !== "string")
34481
35030
  throw new Error("string expected");
34482
- path29 = sp2.normalize(path29);
34483
- path29 = path29.replace(/\\/g, "/");
35031
+ path28 = sp2.normalize(path28);
35032
+ path28 = path28.replace(/\\/g, "/");
34484
35033
  let prepend = false;
34485
- if (path29.startsWith("//"))
35034
+ if (path28.startsWith("//"))
34486
35035
  prepend = true;
34487
- path29 = path29.replace(DOUBLE_SLASH_RE, "/");
35036
+ path28 = path28.replace(DOUBLE_SLASH_RE, "/");
34488
35037
  if (prepend)
34489
- path29 = "/" + path29;
34490
- return path29;
35038
+ path28 = "/" + path28;
35039
+ return path28;
34491
35040
  }
34492
35041
  function matchPatterns(patterns, testString, stats) {
34493
- const path29 = normalizePath(testString);
35042
+ const path28 = normalizePath(testString);
34494
35043
  for (let index = 0; index < patterns.length; index++) {
34495
35044
  const pattern = patterns[index];
34496
- if (pattern(path29, stats)) {
35045
+ if (pattern(path28, stats)) {
34497
35046
  return true;
34498
35047
  }
34499
35048
  }
@@ -34556,19 +35105,19 @@ var init_chokidar = __esm({
34556
35105
  }
34557
35106
  return str;
34558
35107
  };
34559
- normalizePathToUnix = (path29) => toUnix(sp2.normalize(toUnix(path29)));
34560
- normalizeIgnored = (cwd = "") => (path29) => {
34561
- if (typeof path29 === "string") {
34562
- return normalizePathToUnix(sp2.isAbsolute(path29) ? path29 : sp2.join(cwd, path29));
35108
+ normalizePathToUnix = (path28) => toUnix(sp2.normalize(toUnix(path28)));
35109
+ normalizeIgnored = (cwd = "") => (path28) => {
35110
+ if (typeof path28 === "string") {
35111
+ return normalizePathToUnix(sp2.isAbsolute(path28) ? path28 : sp2.join(cwd, path28));
34563
35112
  } else {
34564
- return path29;
35113
+ return path28;
34565
35114
  }
34566
35115
  };
34567
- getAbsolutePath = (path29, cwd) => {
34568
- if (sp2.isAbsolute(path29)) {
34569
- return path29;
35116
+ getAbsolutePath = (path28, cwd) => {
35117
+ if (sp2.isAbsolute(path28)) {
35118
+ return path28;
34570
35119
  }
34571
- return sp2.join(cwd, path29);
35120
+ return sp2.join(cwd, path28);
34572
35121
  };
34573
35122
  EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
34574
35123
  DirEntry = class {
@@ -34633,10 +35182,10 @@ var init_chokidar = __esm({
34633
35182
  dirParts;
34634
35183
  followSymlinks;
34635
35184
  statMethod;
34636
- constructor(path29, follow, fsw) {
35185
+ constructor(path28, follow, fsw) {
34637
35186
  this.fsw = fsw;
34638
- const watchPath = path29;
34639
- this.path = path29 = path29.replace(REPLACER_RE, "");
35187
+ const watchPath = path28;
35188
+ this.path = path28 = path28.replace(REPLACER_RE, "");
34640
35189
  this.watchPath = watchPath;
34641
35190
  this.fullWatchPath = sp2.resolve(watchPath);
34642
35191
  this.dirParts = [];
@@ -34776,20 +35325,20 @@ var init_chokidar = __esm({
34776
35325
  this._closePromise = void 0;
34777
35326
  let paths = unifyPaths(paths_);
34778
35327
  if (cwd) {
34779
- paths = paths.map((path29) => {
34780
- const absPath = getAbsolutePath(path29, cwd);
35328
+ paths = paths.map((path28) => {
35329
+ const absPath = getAbsolutePath(path28, cwd);
34781
35330
  return absPath;
34782
35331
  });
34783
35332
  }
34784
- paths.forEach((path29) => {
34785
- this._removeIgnoredPath(path29);
35333
+ paths.forEach((path28) => {
35334
+ this._removeIgnoredPath(path28);
34786
35335
  });
34787
35336
  this._userIgnored = void 0;
34788
35337
  if (!this._readyCount)
34789
35338
  this._readyCount = 0;
34790
35339
  this._readyCount += paths.length;
34791
- Promise.all(paths.map(async (path29) => {
34792
- const res = await this._nodeFsHandler._addToNodeFs(path29, !_internal, void 0, 0, _origAdd);
35340
+ Promise.all(paths.map(async (path28) => {
35341
+ const res = await this._nodeFsHandler._addToNodeFs(path28, !_internal, void 0, 0, _origAdd);
34793
35342
  if (res)
34794
35343
  this._emitReady();
34795
35344
  return res;
@@ -34811,17 +35360,17 @@ var init_chokidar = __esm({
34811
35360
  return this;
34812
35361
  const paths = unifyPaths(paths_);
34813
35362
  const { cwd } = this.options;
34814
- paths.forEach((path29) => {
34815
- if (!sp2.isAbsolute(path29) && !this._closers.has(path29)) {
35363
+ paths.forEach((path28) => {
35364
+ if (!sp2.isAbsolute(path28) && !this._closers.has(path28)) {
34816
35365
  if (cwd)
34817
- path29 = sp2.join(cwd, path29);
34818
- path29 = sp2.resolve(path29);
35366
+ path28 = sp2.join(cwd, path28);
35367
+ path28 = sp2.resolve(path28);
34819
35368
  }
34820
- this._closePath(path29);
34821
- this._addIgnoredPath(path29);
34822
- if (this._watched.has(path29)) {
35369
+ this._closePath(path28);
35370
+ this._addIgnoredPath(path28);
35371
+ if (this._watched.has(path28)) {
34823
35372
  this._addIgnoredPath({
34824
- path: path29,
35373
+ path: path28,
34825
35374
  recursive: true
34826
35375
  });
34827
35376
  }
@@ -34885,38 +35434,38 @@ var init_chokidar = __esm({
34885
35434
  * @param stats arguments to be passed with event
34886
35435
  * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
34887
35436
  */
34888
- async _emit(event, path29, stats) {
35437
+ async _emit(event, path28, stats) {
34889
35438
  if (this.closed)
34890
35439
  return;
34891
35440
  const opts = this.options;
34892
35441
  if (isWindows)
34893
- path29 = sp2.normalize(path29);
35442
+ path28 = sp2.normalize(path28);
34894
35443
  if (opts.cwd)
34895
- path29 = sp2.relative(opts.cwd, path29);
34896
- const args = [path29];
35444
+ path28 = sp2.relative(opts.cwd, path28);
35445
+ const args = [path28];
34897
35446
  if (stats != null)
34898
35447
  args.push(stats);
34899
35448
  const awf = opts.awaitWriteFinish;
34900
35449
  let pw;
34901
- if (awf && (pw = this._pendingWrites.get(path29))) {
35450
+ if (awf && (pw = this._pendingWrites.get(path28))) {
34902
35451
  pw.lastChange = /* @__PURE__ */ new Date();
34903
35452
  return this;
34904
35453
  }
34905
35454
  if (opts.atomic) {
34906
35455
  if (event === EVENTS.UNLINK) {
34907
- this._pendingUnlinks.set(path29, [event, ...args]);
35456
+ this._pendingUnlinks.set(path28, [event, ...args]);
34908
35457
  setTimeout(() => {
34909
- this._pendingUnlinks.forEach((entry, path30) => {
35458
+ this._pendingUnlinks.forEach((entry, path29) => {
34910
35459
  this.emit(...entry);
34911
35460
  this.emit(EVENTS.ALL, ...entry);
34912
- this._pendingUnlinks.delete(path30);
35461
+ this._pendingUnlinks.delete(path29);
34913
35462
  });
34914
35463
  }, typeof opts.atomic === "number" ? opts.atomic : 100);
34915
35464
  return this;
34916
35465
  }
34917
- if (event === EVENTS.ADD && this._pendingUnlinks.has(path29)) {
35466
+ if (event === EVENTS.ADD && this._pendingUnlinks.has(path28)) {
34918
35467
  event = EVENTS.CHANGE;
34919
- this._pendingUnlinks.delete(path29);
35468
+ this._pendingUnlinks.delete(path28);
34920
35469
  }
34921
35470
  }
34922
35471
  if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
@@ -34934,16 +35483,16 @@ var init_chokidar = __esm({
34934
35483
  this.emitWithAll(event, args);
34935
35484
  }
34936
35485
  };
34937
- this._awaitWriteFinish(path29, awf.stabilityThreshold, event, awfEmit);
35486
+ this._awaitWriteFinish(path28, awf.stabilityThreshold, event, awfEmit);
34938
35487
  return this;
34939
35488
  }
34940
35489
  if (event === EVENTS.CHANGE) {
34941
- const isThrottled = !this._throttle(EVENTS.CHANGE, path29, 50);
35490
+ const isThrottled = !this._throttle(EVENTS.CHANGE, path28, 50);
34942
35491
  if (isThrottled)
34943
35492
  return this;
34944
35493
  }
34945
35494
  if (opts.alwaysStat && stats === void 0 && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
34946
- const fullPath = opts.cwd ? sp2.join(opts.cwd, path29) : path29;
35495
+ const fullPath = opts.cwd ? sp2.join(opts.cwd, path28) : path28;
34947
35496
  let stats2;
34948
35497
  try {
34949
35498
  stats2 = await (0, import_promises3.stat)(fullPath);
@@ -34974,23 +35523,23 @@ var init_chokidar = __esm({
34974
35523
  * @param timeout duration of time to suppress duplicate actions
34975
35524
  * @returns tracking object or false if action should be suppressed
34976
35525
  */
34977
- _throttle(actionType, path29, timeout) {
35526
+ _throttle(actionType, path28, timeout) {
34978
35527
  if (!this._throttled.has(actionType)) {
34979
35528
  this._throttled.set(actionType, /* @__PURE__ */ new Map());
34980
35529
  }
34981
35530
  const action = this._throttled.get(actionType);
34982
35531
  if (!action)
34983
35532
  throw new Error("invalid throttle");
34984
- const actionPath = action.get(path29);
35533
+ const actionPath = action.get(path28);
34985
35534
  if (actionPath) {
34986
35535
  actionPath.count++;
34987
35536
  return false;
34988
35537
  }
34989
35538
  let timeoutObject;
34990
35539
  const clear = () => {
34991
- const item = action.get(path29);
35540
+ const item = action.get(path28);
34992
35541
  const count = item ? item.count : 0;
34993
- action.delete(path29);
35542
+ action.delete(path28);
34994
35543
  clearTimeout(timeoutObject);
34995
35544
  if (item)
34996
35545
  clearTimeout(item.timeoutObject);
@@ -34998,7 +35547,7 @@ var init_chokidar = __esm({
34998
35547
  };
34999
35548
  timeoutObject = setTimeout(clear, timeout);
35000
35549
  const thr = { timeoutObject, clear, count: 0 };
35001
- action.set(path29, thr);
35550
+ action.set(path28, thr);
35002
35551
  return thr;
35003
35552
  }
35004
35553
  _incrReadyCount() {
@@ -35012,44 +35561,44 @@ var init_chokidar = __esm({
35012
35561
  * @param event
35013
35562
  * @param awfEmit Callback to be called when ready for event to be emitted.
35014
35563
  */
35015
- _awaitWriteFinish(path29, threshold, event, awfEmit) {
35564
+ _awaitWriteFinish(path28, threshold, event, awfEmit) {
35016
35565
  const awf = this.options.awaitWriteFinish;
35017
35566
  if (typeof awf !== "object")
35018
35567
  return;
35019
35568
  const pollInterval = awf.pollInterval;
35020
35569
  let timeoutHandler;
35021
- let fullPath = path29;
35022
- if (this.options.cwd && !sp2.isAbsolute(path29)) {
35023
- fullPath = sp2.join(this.options.cwd, path29);
35570
+ let fullPath = path28;
35571
+ if (this.options.cwd && !sp2.isAbsolute(path28)) {
35572
+ fullPath = sp2.join(this.options.cwd, path28);
35024
35573
  }
35025
35574
  const now = /* @__PURE__ */ new Date();
35026
35575
  const writes = this._pendingWrites;
35027
35576
  function awaitWriteFinishFn(prevStat) {
35028
35577
  (0, import_node_fs2.stat)(fullPath, (err, curStat) => {
35029
- if (err || !writes.has(path29)) {
35578
+ if (err || !writes.has(path28)) {
35030
35579
  if (err && err.code !== "ENOENT")
35031
35580
  awfEmit(err);
35032
35581
  return;
35033
35582
  }
35034
35583
  const now2 = Number(/* @__PURE__ */ new Date());
35035
35584
  if (prevStat && curStat.size !== prevStat.size) {
35036
- writes.get(path29).lastChange = now2;
35585
+ writes.get(path28).lastChange = now2;
35037
35586
  }
35038
- const pw = writes.get(path29);
35587
+ const pw = writes.get(path28);
35039
35588
  const df = now2 - pw.lastChange;
35040
35589
  if (df >= threshold) {
35041
- writes.delete(path29);
35590
+ writes.delete(path28);
35042
35591
  awfEmit(void 0, curStat);
35043
35592
  } else {
35044
35593
  timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
35045
35594
  }
35046
35595
  });
35047
35596
  }
35048
- if (!writes.has(path29)) {
35049
- writes.set(path29, {
35597
+ if (!writes.has(path28)) {
35598
+ writes.set(path28, {
35050
35599
  lastChange: now,
35051
35600
  cancelWait: () => {
35052
- writes.delete(path29);
35601
+ writes.delete(path28);
35053
35602
  clearTimeout(timeoutHandler);
35054
35603
  return event;
35055
35604
  }
@@ -35060,8 +35609,8 @@ var init_chokidar = __esm({
35060
35609
  /**
35061
35610
  * Determines whether user has asked to ignore this path.
35062
35611
  */
35063
- _isIgnored(path29, stats) {
35064
- if (this.options.atomic && DOT_RE.test(path29))
35612
+ _isIgnored(path28, stats) {
35613
+ if (this.options.atomic && DOT_RE.test(path28))
35065
35614
  return true;
35066
35615
  if (!this._userIgnored) {
35067
35616
  const { cwd } = this.options;
@@ -35071,17 +35620,17 @@ var init_chokidar = __esm({
35071
35620
  const list = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored];
35072
35621
  this._userIgnored = anymatch(list, void 0);
35073
35622
  }
35074
- return this._userIgnored(path29, stats);
35623
+ return this._userIgnored(path28, stats);
35075
35624
  }
35076
- _isntIgnored(path29, stat4) {
35077
- return !this._isIgnored(path29, stat4);
35625
+ _isntIgnored(path28, stat4) {
35626
+ return !this._isIgnored(path28, stat4);
35078
35627
  }
35079
35628
  /**
35080
35629
  * Provides a set of common helpers and properties relating to symlink handling.
35081
35630
  * @param path file or directory pattern being watched
35082
35631
  */
35083
- _getWatchHelpers(path29) {
35084
- return new WatchHelper(path29, this.options.followSymlinks, this);
35632
+ _getWatchHelpers(path28) {
35633
+ return new WatchHelper(path28, this.options.followSymlinks, this);
35085
35634
  }
35086
35635
  // Directory helpers
35087
35636
  // -----------------
@@ -35113,63 +35662,63 @@ var init_chokidar = __esm({
35113
35662
  * @param item base path of item/directory
35114
35663
  */
35115
35664
  _remove(directory, item, isDirectory) {
35116
- const path29 = sp2.join(directory, item);
35117
- const fullPath = sp2.resolve(path29);
35118
- isDirectory = isDirectory != null ? isDirectory : this._watched.has(path29) || this._watched.has(fullPath);
35119
- if (!this._throttle("remove", path29, 100))
35665
+ const path28 = sp2.join(directory, item);
35666
+ const fullPath = sp2.resolve(path28);
35667
+ isDirectory = isDirectory != null ? isDirectory : this._watched.has(path28) || this._watched.has(fullPath);
35668
+ if (!this._throttle("remove", path28, 100))
35120
35669
  return;
35121
35670
  if (!isDirectory && this._watched.size === 1) {
35122
35671
  this.add(directory, item, true);
35123
35672
  }
35124
- const wp = this._getWatchedDir(path29);
35673
+ const wp = this._getWatchedDir(path28);
35125
35674
  const nestedDirectoryChildren = wp.getChildren();
35126
- nestedDirectoryChildren.forEach((nested) => this._remove(path29, nested));
35675
+ nestedDirectoryChildren.forEach((nested) => this._remove(path28, nested));
35127
35676
  const parent = this._getWatchedDir(directory);
35128
35677
  const wasTracked = parent.has(item);
35129
35678
  parent.remove(item);
35130
35679
  if (this._symlinkPaths.has(fullPath)) {
35131
35680
  this._symlinkPaths.delete(fullPath);
35132
35681
  }
35133
- let relPath = path29;
35682
+ let relPath = path28;
35134
35683
  if (this.options.cwd)
35135
- relPath = sp2.relative(this.options.cwd, path29);
35684
+ relPath = sp2.relative(this.options.cwd, path28);
35136
35685
  if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
35137
35686
  const event = this._pendingWrites.get(relPath).cancelWait();
35138
35687
  if (event === EVENTS.ADD)
35139
35688
  return;
35140
35689
  }
35141
- this._watched.delete(path29);
35690
+ this._watched.delete(path28);
35142
35691
  this._watched.delete(fullPath);
35143
35692
  const eventName = isDirectory ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
35144
- if (wasTracked && !this._isIgnored(path29))
35145
- this._emit(eventName, path29);
35146
- this._closePath(path29);
35693
+ if (wasTracked && !this._isIgnored(path28))
35694
+ this._emit(eventName, path28);
35695
+ this._closePath(path28);
35147
35696
  }
35148
35697
  /**
35149
35698
  * Closes all watchers for a path
35150
35699
  */
35151
- _closePath(path29) {
35152
- this._closeFile(path29);
35153
- const dir = sp2.dirname(path29);
35154
- this._getWatchedDir(dir).remove(sp2.basename(path29));
35700
+ _closePath(path28) {
35701
+ this._closeFile(path28);
35702
+ const dir = sp2.dirname(path28);
35703
+ this._getWatchedDir(dir).remove(sp2.basename(path28));
35155
35704
  }
35156
35705
  /**
35157
35706
  * Closes only file-specific watchers
35158
35707
  */
35159
- _closeFile(path29) {
35160
- const closers = this._closers.get(path29);
35708
+ _closeFile(path28) {
35709
+ const closers = this._closers.get(path28);
35161
35710
  if (!closers)
35162
35711
  return;
35163
35712
  closers.forEach((closer) => closer());
35164
- this._closers.delete(path29);
35713
+ this._closers.delete(path28);
35165
35714
  }
35166
- _addPathCloser(path29, closer) {
35715
+ _addPathCloser(path28, closer) {
35167
35716
  if (!closer)
35168
35717
  return;
35169
- let list = this._closers.get(path29);
35718
+ let list = this._closers.get(path28);
35170
35719
  if (!list) {
35171
35720
  list = [];
35172
- this._closers.set(path29, list);
35721
+ this._closers.set(path28, list);
35173
35722
  }
35174
35723
  list.push(closer);
35175
35724
  }
@@ -36918,6 +37467,43 @@ var init_provider_loader = __esm({
36918
37467
  }
36919
37468
  });
36920
37469
 
37470
+ // ../../oss/packages/daemon-core/src/launch/macos-app-process.ts
37471
+ function normalizeMacAppPath(appPath) {
37472
+ const trimmed = String(appPath || "").trim();
37473
+ if (!trimmed) return null;
37474
+ return trimmed.replace(/\/+$/, "");
37475
+ }
37476
+ function parsePsLine(line) {
37477
+ const match = line.match(/^\s*(\d+)\s+(.+)$/);
37478
+ if (!match) return null;
37479
+ const pid = Number.parseInt(match[1], 10);
37480
+ if (!Number.isFinite(pid)) return null;
37481
+ return { pid, args: match[2] };
37482
+ }
37483
+ function isMacAppProcessArgs(args, appPath) {
37484
+ const normalized = normalizeMacAppPath(appPath);
37485
+ if (!normalized) return false;
37486
+ return String(args || "").startsWith(`${normalized}/`);
37487
+ }
37488
+ function findMacAppProcessPids(psOutput, appPaths) {
37489
+ const normalizedPaths = appPaths.map(normalizeMacAppPath).filter((value) => !!value);
37490
+ if (normalizedPaths.length === 0) return [];
37491
+ const pids = [];
37492
+ for (const line of String(psOutput || "").split(/\r?\n/)) {
37493
+ const parsed = parsePsLine(line);
37494
+ if (!parsed) continue;
37495
+ if (normalizedPaths.some((appPath) => isMacAppProcessArgs(parsed.args, appPath))) {
37496
+ pids.push(parsed.pid);
37497
+ }
37498
+ }
37499
+ return pids;
37500
+ }
37501
+ var init_macos_app_process = __esm({
37502
+ "../../oss/packages/daemon-core/src/launch/macos-app-process.ts"() {
37503
+ "use strict";
37504
+ }
37505
+ });
37506
+
36921
37507
  // ../../oss/packages/daemon-core/src/launch.ts
36922
37508
  function getProviderLoader() {
36923
37509
  if (!_providerLoader) {
@@ -36940,9 +37526,9 @@ function getWinProcessNames() {
36940
37526
  function getProviderMeta(ideId) {
36941
37527
  return getProviderLoader().getMeta(ideId);
36942
37528
  }
36943
- function getPreferredLaunchMethod(ideId, platform13) {
37529
+ function getPreferredLaunchMethod(ideId, platform12) {
36944
37530
  const prefer = getProviderMeta(ideId)?.launch?.prefer;
36945
- const value = prefer?.[platform13];
37531
+ const value = prefer?.[platform12];
36946
37532
  return value === "cli" || value === "app" || value === "auto" ? value : "auto";
36947
37533
  }
36948
37534
  function getCdpStartupTimeoutMs(ideId) {
@@ -36953,6 +37539,35 @@ function getCdpStartupTimeoutMs(ideId) {
36953
37539
  function escapeForAppleScript(value) {
36954
37540
  return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
36955
37541
  }
37542
+ function getIdePathCandidates(ideId) {
37543
+ return getProviderLoader().getIdePathCandidates(ideId);
37544
+ }
37545
+ function getMacAppProcessPids(ideId) {
37546
+ const appPaths = getIdePathCandidates(ideId);
37547
+ if (appPaths.length === 0) return [];
37548
+ try {
37549
+ const output = (0, import_child_process7.execSync)("ps axww -o pid=,args=", {
37550
+ encoding: "utf-8",
37551
+ timeout: 3e3,
37552
+ stdio: ["pipe", "pipe", "pipe"]
37553
+ });
37554
+ return findMacAppProcessPids(output, appPaths);
37555
+ } catch {
37556
+ return [];
37557
+ }
37558
+ }
37559
+ function killMacAppPathProcesses(ideId, signal) {
37560
+ const pids = getMacAppProcessPids(ideId);
37561
+ let signalled = false;
37562
+ for (const pid of pids) {
37563
+ try {
37564
+ process.kill(pid, signal);
37565
+ signalled = true;
37566
+ } catch {
37567
+ }
37568
+ }
37569
+ return signalled;
37570
+ }
36956
37571
  async function findFreePort(ports) {
36957
37572
  for (const port2 of ports) {
36958
37573
  const free = await checkPortFree(port2);
@@ -37014,6 +37629,7 @@ async function killIdeProcess(ideId) {
37014
37629
  } catch {
37015
37630
  }
37016
37631
  }
37632
+ killMacAppPathProcesses(ideId, "SIGTERM");
37017
37633
  } else if (plat === "win32" && winProcesses) {
37018
37634
  for (const proc of winProcesses) {
37019
37635
  try {
@@ -37043,6 +37659,7 @@ async function killIdeProcess(ideId) {
37043
37659
  (0, import_child_process7.execSync)(`pkill -9 -x "${appName}" 2>/dev/null`, { timeout: 5e3 });
37044
37660
  } catch {
37045
37661
  }
37662
+ killMacAppPathProcesses(ideId, "SIGKILL");
37046
37663
  } else if (plat === "win32" && winProcesses) {
37047
37664
  for (const proc of winProcesses) {
37048
37665
  try {
@@ -37062,14 +37679,16 @@ function isIdeRunning(ideId) {
37062
37679
  try {
37063
37680
  if (plat === "darwin") {
37064
37681
  const appName = getMacAppIdentifiers()[ideId];
37065
- if (!appName) return false;
37682
+ if (!appName) return getMacAppProcessPids(ideId).length > 0;
37066
37683
  try {
37067
37684
  const result = (0, import_child_process7.execSync)(`pgrep -x "${appName}" 2>/dev/null`, {
37068
37685
  encoding: "utf-8",
37069
37686
  timeout: 3e3
37070
37687
  });
37071
- return result.trim().length > 0;
37688
+ if (result.trim().length > 0) return true;
37072
37689
  } catch {
37690
+ }
37691
+ try {
37073
37692
  const result = (0, import_child_process7.execSync)(
37074
37693
  `osascript -e 'tell application "System Events" to count (every process whose name is "${escapeForAppleScript(appName)}")'`,
37075
37694
  {
@@ -37078,8 +37697,10 @@ function isIdeRunning(ideId) {
37078
37697
  stdio: ["pipe", "pipe", "pipe"]
37079
37698
  }
37080
37699
  );
37081
- return Number.parseInt(result.trim() || "0", 10) > 0;
37700
+ if (Number.parseInt(result.trim() || "0", 10) > 0) return true;
37701
+ } catch {
37082
37702
  }
37703
+ return getMacAppProcessPids(ideId).length > 0;
37083
37704
  } else if (plat === "win32") {
37084
37705
  const winProcesses = getWinProcessNames()[ideId];
37085
37706
  if (!winProcesses) return false;
@@ -37124,7 +37745,7 @@ function detectCurrentWorkspace(ideId) {
37124
37745
  }
37125
37746
  } else if (plat === "win32") {
37126
37747
  try {
37127
- const fs24 = require("fs");
37748
+ const fs19 = require("fs");
37128
37749
  const appNameMap = getMacAppIdentifiers();
37129
37750
  const appName = appNameMap[ideId];
37130
37751
  if (appName) {
@@ -37133,8 +37754,8 @@ function detectCurrentWorkspace(ideId) {
37133
37754
  appName,
37134
37755
  "storage.json"
37135
37756
  );
37136
- if (fs24.existsSync(storagePath)) {
37137
- const data = JSON.parse(fs24.readFileSync(storagePath, "utf-8"));
37757
+ if (fs19.existsSync(storagePath)) {
37758
+ const data = JSON.parse(fs19.readFileSync(storagePath, "utf-8"));
37138
37759
  const workspaces = data?.openedPathsList?.workspaces3 || data?.openedPathsList?.entries || [];
37139
37760
  if (workspaces.length > 0) {
37140
37761
  const recent = workspaces[0];
@@ -37151,7 +37772,7 @@ function detectCurrentWorkspace(ideId) {
37151
37772
  return void 0;
37152
37773
  }
37153
37774
  async function launchWithCdp(options = {}) {
37154
- const platform13 = os16.platform();
37775
+ const platform12 = os16.platform();
37155
37776
  let targetIde;
37156
37777
  const ides = await detectIDEs(getProviderLoader());
37157
37778
  if (options.ideId) {
@@ -37220,9 +37841,9 @@ async function launchWithCdp(options = {}) {
37220
37841
  }
37221
37842
  const port = await findFreePort(portPair);
37222
37843
  try {
37223
- if (platform13 === "darwin") {
37844
+ if (platform12 === "darwin") {
37224
37845
  await launchMacOS(targetIde, port, workspace, options.newWindow);
37225
- } else if (platform13 === "win32") {
37846
+ } else if (platform12 === "win32") {
37226
37847
  await launchWindows(targetIde, port, workspace, options.newWindow);
37227
37848
  } else {
37228
37849
  await launchLinux(targetIde, port, workspace, options.newWindow);
@@ -37310,6 +37931,7 @@ var init_launch = __esm({
37310
37931
  path14 = __toESM(require("path"));
37311
37932
  init_ide_detector();
37312
37933
  init_provider_loader();
37934
+ init_macos_app_process();
37313
37935
  _providerLoader = null;
37314
37936
  }
37315
37937
  });
@@ -38502,13 +39124,18 @@ var init_router = __esm({
38502
39124
  const wantsAll = args?.all === true;
38503
39125
  const offset = wantsAll ? 0 : Math.max(0, Number(args?.offset) || 0);
38504
39126
  const limit = wantsAll ? Number.MAX_SAFE_INTEGER : Math.max(1, Math.min(100, Number(args?.limit) || 30));
38505
- const { sessions: historySessions, hasMore } = listSavedHistorySessions(providerType, { offset, limit });
39127
+ const providerMeta = this.deps.providerLoader.getMeta(providerType);
39128
+ const { sessions: historySessions, hasMore, source } = listProviderHistorySessions(providerType, {
39129
+ canonicalHistory: providerMeta?.canonicalHistory,
39130
+ offset,
39131
+ limit,
39132
+ historyBehavior: providerMeta?.historyBehavior
39133
+ });
38506
39134
  const state = loadState();
38507
39135
  const savedSessions = getSavedProviderSessions(state, { providerType, kind });
38508
39136
  const recentSessions = getRecentActivity(state, 200).filter((entry) => entry.providerType === providerType && entry.kind === kind && entry.providerSessionId);
38509
39137
  const savedSessionById = new Map(savedSessions.map((entry) => [entry.providerSessionId, entry]));
38510
39138
  const recentSessionById = new Map(recentSessions.map((entry) => [entry.providerSessionId, entry]));
38511
- const providerMeta = this.deps.providerLoader.getMeta(providerType);
38512
39139
  const canResumeById = supportsExplicitSessionResume(providerMeta?.resume);
38513
39140
  return {
38514
39141
  success: true,
@@ -38531,7 +39158,8 @@ var init_router = __esm({
38531
39158
  canResume: !!(saved?.workspace || recent?.workspace || session.workspace) && canResumeById
38532
39159
  };
38533
39160
  }),
38534
- hasMore
39161
+ hasMore,
39162
+ source
38535
39163
  };
38536
39164
  }
38537
39165
  // ─── restart_session: IDE / CLI / ACP unified ───
@@ -44567,8 +45195,8 @@ var init_dev_server = __esm({
44567
45195
  }
44568
45196
  getEndpointList() {
44569
45197
  return this.routes.map((r) => {
44570
- const path29 = typeof r.pattern === "string" ? r.pattern : r.pattern.source.replace(/\\\//g, "/").replace(/\(\[.*?\]\+\)/g, ":type").replace(/[\^$]/g, "");
44571
- return `${r.method.padEnd(5)} ${path29}`;
45198
+ const path28 = typeof r.pattern === "string" ? r.pattern : r.pattern.source.replace(/\\\//g, "/").replace(/\(\[.*?\]\+\)/g, ":type").replace(/[\^$]/g, "");
45199
+ return `${r.method.padEnd(5)} ${path28}`;
44572
45200
  });
44573
45201
  }
44574
45202
  async start(port = DEV_SERVER_PORT) {
@@ -46510,8 +47138,8 @@ async function installExtension(ide, extension) {
46510
47138
  const res = await fetch(extension.vsixUrl);
46511
47139
  if (res.ok) {
46512
47140
  const buffer = Buffer.from(await res.arrayBuffer());
46513
- const fs24 = await import("fs");
46514
- fs24.writeFileSync(vsixPath, buffer);
47141
+ const fs19 = await import("fs");
47142
+ fs19.writeFileSync(vsixPath, buffer);
46515
47143
  return new Promise((resolve16) => {
46516
47144
  const cmd = `"${ide.cliCommand}" --install-extension "${vsixPath}" --force`;
46517
47145
  (0, import_child_process11.exec)(cmd, { timeout: 6e4 }, (error48, _stdout, stderr) => {
@@ -48467,9 +49095,9 @@ var init_daemon_p2p = __esm({
48467
49095
  log(`node-datachannel not found: ${e?.message}
48468
49096
  ${e?.stack || ""}`);
48469
49097
  }
48470
- const platform13 = process.platform;
48471
- const arch4 = process.arch;
48472
- const prebuildKey = `${platform13}-${arch4}`;
49098
+ const platform12 = process.platform;
49099
+ const arch3 = process.arch;
49100
+ const prebuildKey = `${platform12}-${arch3}`;
48473
49101
  try {
48474
49102
  const candidates = [
48475
49103
  path23.join(__dirname, "node_modules", "node-datachannel"),
@@ -48849,27 +49477,27 @@ var require_process = __commonJS({
48849
49477
  var require_filesystem = __commonJS({
48850
49478
  "../../node_modules/detect-libc/lib/filesystem.js"(exports2, module2) {
48851
49479
  "use strict";
48852
- var fs24 = require("fs");
49480
+ var fs19 = require("fs");
48853
49481
  var LDD_PATH = "/usr/bin/ldd";
48854
49482
  var SELF_PATH = "/proc/self/exe";
48855
49483
  var MAX_LENGTH = 2048;
48856
- var readFileSync19 = (path29) => {
48857
- const fd = fs24.openSync(path29, "r");
49484
+ var readFileSync19 = (path28) => {
49485
+ const fd = fs19.openSync(path28, "r");
48858
49486
  const buffer = Buffer.alloc(MAX_LENGTH);
48859
- const bytesRead = fs24.readSync(fd, buffer, 0, MAX_LENGTH, 0);
48860
- fs24.close(fd, () => {
49487
+ const bytesRead = fs19.readSync(fd, buffer, 0, MAX_LENGTH, 0);
49488
+ fs19.close(fd, () => {
48861
49489
  });
48862
49490
  return buffer.subarray(0, bytesRead);
48863
49491
  };
48864
- var readFile = (path29) => new Promise((resolve16, reject) => {
48865
- fs24.open(path29, "r", (err, fd) => {
49492
+ var readFile = (path28) => new Promise((resolve16, reject) => {
49493
+ fs19.open(path28, "r", (err, fd) => {
48866
49494
  if (err) {
48867
49495
  reject(err);
48868
49496
  } else {
48869
49497
  const buffer = Buffer.alloc(MAX_LENGTH);
48870
- fs24.read(fd, buffer, 0, MAX_LENGTH, 0, (_2, bytesRead) => {
49498
+ fs19.read(fd, buffer, 0, MAX_LENGTH, 0, (_2, bytesRead) => {
48871
49499
  resolve16(buffer.subarray(0, bytesRead));
48872
- fs24.close(fd, () => {
49500
+ fs19.close(fd, () => {
48873
49501
  });
48874
49502
  });
48875
49503
  }
@@ -48925,7 +49553,7 @@ var require_elf = __commonJS({
48925
49553
  var require_detect_libc = __commonJS({
48926
49554
  "../../node_modules/detect-libc/lib/detect-libc.js"(exports2, module2) {
48927
49555
  "use strict";
48928
- var childProcess2 = require("child_process");
49556
+ var childProcess = require("child_process");
48929
49557
  var { isLinux: isLinux2, getReport } = require_process();
48930
49558
  var { LDD_PATH, SELF_PATH, readFile, readFileSync: readFileSync19 } = require_filesystem();
48931
49559
  var { interpreterPath } = require_elf();
@@ -48937,7 +49565,7 @@ var require_detect_libc = __commonJS({
48937
49565
  var safeCommand = () => {
48938
49566
  if (!commandOut) {
48939
49567
  return new Promise((resolve16) => {
48940
- childProcess2.exec(command, (err, out) => {
49568
+ childProcess.exec(command, (err, out) => {
48941
49569
  commandOut = err ? " " : out;
48942
49570
  resolve16(commandOut);
48943
49571
  });
@@ -48948,7 +49576,7 @@ var require_detect_libc = __commonJS({
48948
49576
  var safeCommandSync = () => {
48949
49577
  if (!commandOut) {
48950
49578
  try {
48951
- commandOut = childProcess2.execSync(command, { encoding: "utf8" });
49579
+ commandOut = childProcess.execSync(command, { encoding: "utf8" });
48952
49580
  } catch (_err) {
48953
49581
  commandOut = " ";
48954
49582
  }
@@ -48981,11 +49609,11 @@ var require_detect_libc = __commonJS({
48981
49609
  }
48982
49610
  return null;
48983
49611
  };
48984
- var familyFromInterpreterPath = (path29) => {
48985
- if (path29) {
48986
- if (path29.includes("/ld-musl-")) {
49612
+ var familyFromInterpreterPath = (path28) => {
49613
+ if (path28) {
49614
+ if (path28.includes("/ld-musl-")) {
48987
49615
  return MUSL;
48988
- } else if (path29.includes("/ld-linux-")) {
49616
+ } else if (path28.includes("/ld-linux-")) {
48989
49617
  return GLIBC;
48990
49618
  }
48991
49619
  }
@@ -49032,8 +49660,8 @@ var require_detect_libc = __commonJS({
49032
49660
  cachedFamilyInterpreter = null;
49033
49661
  try {
49034
49662
  const selfContent = await readFile(SELF_PATH);
49035
- const path29 = interpreterPath(selfContent);
49036
- cachedFamilyInterpreter = familyFromInterpreterPath(path29);
49663
+ const path28 = interpreterPath(selfContent);
49664
+ cachedFamilyInterpreter = familyFromInterpreterPath(path28);
49037
49665
  } catch (e) {
49038
49666
  }
49039
49667
  return cachedFamilyInterpreter;
@@ -49045,8 +49673,8 @@ var require_detect_libc = __commonJS({
49045
49673
  cachedFamilyInterpreter = null;
49046
49674
  try {
49047
49675
  const selfContent = readFileSync19(SELF_PATH);
49048
- const path29 = interpreterPath(selfContent);
49049
- cachedFamilyInterpreter = familyFromInterpreterPath(path29);
49676
+ const path28 = interpreterPath(selfContent);
49677
+ cachedFamilyInterpreter = familyFromInterpreterPath(path28);
49050
49678
  } catch (e) {
49051
49679
  }
49052
49680
  return cachedFamilyInterpreter;
@@ -50765,18 +51393,18 @@ var require_sharp = __commonJS({
50765
51393
  `@img/sharp-${runtimePlatform}/sharp.node`,
50766
51394
  "@img/sharp-wasm32/sharp.node"
50767
51395
  ];
50768
- var path29;
51396
+ var path28;
50769
51397
  var sharp;
50770
51398
  var errors = [];
50771
- for (path29 of paths) {
51399
+ for (path28 of paths) {
50772
51400
  try {
50773
- sharp = require(path29);
51401
+ sharp = require(path28);
50774
51402
  break;
50775
51403
  } catch (err) {
50776
51404
  errors.push(err);
50777
51405
  }
50778
51406
  }
50779
- if (sharp && path29.startsWith("@img/sharp-linux-x64") && !sharp._isUsingX64V2()) {
51407
+ if (sharp && path28.startsWith("@img/sharp-linux-x64") && !sharp._isUsingX64V2()) {
50780
51408
  const err = new Error("Prebuilt binaries for linux-x64 require v2 microarchitecture");
50781
51409
  err.code = "Unsupported CPU";
50782
51410
  errors.push(err);
@@ -50785,7 +51413,7 @@ var require_sharp = __commonJS({
50785
51413
  if (sharp) {
50786
51414
  module2.exports = sharp;
50787
51415
  } else {
50788
- const [isLinux2, isMacOs, isWindows2] = ["linux", "darwin", "win32"].map((os29) => runtimePlatform.startsWith(os29));
51416
+ const [isLinux2, isMacOs, isWindows2] = ["linux", "darwin", "win32"].map((os28) => runtimePlatform.startsWith(os28));
50789
51417
  const help = [`Could not load the "sharp" module using the ${runtimePlatform} runtime`];
50790
51418
  errors.forEach((err) => {
50791
51419
  if (err.code !== "MODULE_NOT_FOUND") {
@@ -50802,15 +51430,15 @@ var require_sharp = __commonJS({
50802
51430
  ` Requires ${expected}`
50803
51431
  );
50804
51432
  } else if (prebuiltPlatforms.includes(runtimePlatform)) {
50805
- const [os29, cpu] = runtimePlatform.split("-");
50806
- const libc = os29.endsWith("musl") ? " --libc=musl" : "";
51433
+ const [os28, cpu] = runtimePlatform.split("-");
51434
+ const libc = os28.endsWith("musl") ? " --libc=musl" : "";
50807
51435
  help.push(
50808
51436
  "- Ensure optional dependencies can be installed:",
50809
51437
  " npm install --include=optional sharp",
50810
51438
  "- Ensure your package manager supports multi-platform installation:",
50811
51439
  " See https://sharp.pixelplumbing.com/install#cross-platform",
50812
51440
  "- Add platform-specific dependencies:",
50813
- ` npm install --os=${os29.replace("musl", "")}${libc} --cpu=${cpu} sharp`
51441
+ ` npm install --os=${os28.replace("musl", "")}${libc} --cpu=${cpu} sharp`
50814
51442
  );
50815
51443
  } else {
50816
51444
  help.push(
@@ -53685,15 +54313,15 @@ var require_color = __commonJS({
53685
54313
  };
53686
54314
  }
53687
54315
  function wrapConversion(toModel, graph) {
53688
- const path29 = [graph[toModel].parent, toModel];
54316
+ const path28 = [graph[toModel].parent, toModel];
53689
54317
  let fn = conversions_default[graph[toModel].parent][toModel];
53690
54318
  let cur = graph[toModel].parent;
53691
54319
  while (graph[cur].parent) {
53692
- path29.unshift(graph[cur].parent);
54320
+ path28.unshift(graph[cur].parent);
53693
54321
  fn = link(conversions_default[graph[cur].parent][cur], fn);
53694
54322
  cur = graph[cur].parent;
53695
54323
  }
53696
- fn.conversion = path29;
54324
+ fn.conversion = path28;
53697
54325
  return fn;
53698
54326
  }
53699
54327
  function route(fromModel) {
@@ -54310,7 +54938,7 @@ var require_channel = __commonJS({
54310
54938
  var require_output = __commonJS({
54311
54939
  "../../node_modules/sharp/lib/output.js"(exports2, module2) {
54312
54940
  "use strict";
54313
- var path29 = require("path");
54941
+ var path28 = require("path");
54314
54942
  var is = require_is();
54315
54943
  var sharp = require_sharp();
54316
54944
  var formats = /* @__PURE__ */ new Map([
@@ -54341,9 +54969,9 @@ var require_output = __commonJS({
54341
54969
  let err;
54342
54970
  if (!is.string(fileOut)) {
54343
54971
  err = new Error("Missing output file path");
54344
- } else if (is.string(this.options.input.file) && path29.resolve(this.options.input.file) === path29.resolve(fileOut)) {
54972
+ } else if (is.string(this.options.input.file) && path28.resolve(this.options.input.file) === path28.resolve(fileOut)) {
54345
54973
  err = new Error("Cannot use same file for input and output");
54346
- } else if (jp2Regex.test(path29.extname(fileOut)) && !this.constructor.format.jp2k.output.file) {
54974
+ } else if (jp2Regex.test(path28.extname(fileOut)) && !this.constructor.format.jp2k.output.file) {
54347
54975
  err = errJp2Save();
54348
54976
  }
54349
54977
  if (err) {
@@ -56460,18 +57088,18 @@ var init_source2 = __esm({
56460
57088
  }
56461
57089
  }
56462
57090
  });
56463
- createStyler2 = (open3, close, parent) => {
57091
+ createStyler2 = (open2, close, parent) => {
56464
57092
  let openAll;
56465
57093
  let closeAll;
56466
57094
  if (parent === void 0) {
56467
- openAll = open3;
57095
+ openAll = open2;
56468
57096
  closeAll = close;
56469
57097
  } else {
56470
- openAll = parent.openAll + open3;
57098
+ openAll = parent.openAll + open2;
56471
57099
  closeAll = close + parent.closeAll;
56472
57100
  }
56473
57101
  return {
56474
- open: open3,
57102
+ open: open2,
56475
57103
  close,
56476
57104
  openAll,
56477
57105
  closeAll,
@@ -56630,7 +57258,7 @@ function removeDaemonPid(ref = {}) {
56630
57258
  function isDaemonRunning(ref = {}) {
56631
57259
  const port = resolveDaemonPort(ref);
56632
57260
  try {
56633
- const { execFileSync: execFileSync6 } = require("child_process");
57261
+ const { execFileSync: execFileSync5 } = require("child_process");
56634
57262
  const probe = `
56635
57263
  const http = require('http');
56636
57264
  const req = http.get('http://127.0.0.1:${port}/health', { timeout: 1500 }, (res) => {
@@ -56640,7 +57268,7 @@ function isDaemonRunning(ref = {}) {
56640
57268
  req.on('error', () => process.stdout.write('0'));
56641
57269
  req.on('timeout', () => { req.destroy(); process.stdout.write('0'); });
56642
57270
  `;
56643
- const result = execFileSync6(process.execPath, ["-e", probe], {
57271
+ const result = execFileSync5(process.execPath, ["-e", probe], {
56644
57272
  encoding: "utf-8",
56645
57273
  timeout: 3e3,
56646
57274
  stdio: ["ignore", "pipe", "ignore"]
@@ -56666,9 +57294,9 @@ function isDaemonRunning(ref = {}) {
56666
57294
  function isAdhdevProcess(pid) {
56667
57295
  try {
56668
57296
  if (process.platform === "win32") {
56669
- const { execFileSync: execFileSync6 } = require("child_process");
57297
+ const { execFileSync: execFileSync5 } = require("child_process");
56670
57298
  try {
56671
- const psOut = execFileSync6("powershell.exe", [
57299
+ const psOut = execFileSync5("powershell.exe", [
56672
57300
  "-NoProfile",
56673
57301
  "-NonInteractive",
56674
57302
  "-ExecutionPolicy",
@@ -56681,8 +57309,8 @@ function isAdhdevProcess(pid) {
56681
57309
  return true;
56682
57310
  }
56683
57311
  } else {
56684
- const { execFileSync: execFileSync6 } = require("child_process");
56685
- const cmdline = execFileSync6("ps", ["-o", "command=", "-p", String(pid)], {
57312
+ const { execFileSync: execFileSync5 } = require("child_process");
57313
+ const cmdline = execFileSync5("ps", ["-o", "command=", "-p", String(pid)], {
56686
57314
  encoding: "utf-8",
56687
57315
  timeout: 2e3,
56688
57316
  stdio: ["ignore", "pipe", "ignore"]
@@ -56696,7 +57324,7 @@ function isAdhdevProcess(pid) {
56696
57324
  function getDaemonHealthPid(ref = {}) {
56697
57325
  const port = resolveDaemonPort(ref);
56698
57326
  try {
56699
- const { execFileSync: execFileSync6 } = require("child_process");
57327
+ const { execFileSync: execFileSync5 } = require("child_process");
56700
57328
  const probe = `
56701
57329
  const http = require('http');
56702
57330
  const req = http.get('http://127.0.0.1:${port}/health', { timeout: 1500 }, (res) => {
@@ -56714,7 +57342,7 @@ function getDaemonHealthPid(ref = {}) {
56714
57342
  req.on('error', () => {});
56715
57343
  req.on('timeout', () => { req.destroy(); });
56716
57344
  `;
56717
- const result = execFileSync6(process.execPath, ["-e", probe], {
57345
+ const result = execFileSync5(process.execPath, ["-e", probe], {
56718
57346
  encoding: "utf-8",
56719
57347
  timeout: 3e3,
56720
57348
  stdio: ["ignore", "pipe", "ignore"]
@@ -56782,7 +57410,7 @@ var init_adhdev_daemon = __esm({
56782
57410
  init_version();
56783
57411
  init_src();
56784
57412
  init_runtime_defaults();
56785
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.44" });
57413
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.45" });
56786
57414
  AdhdevDaemon = class _AdhdevDaemon {
56787
57415
  localHttpServer = null;
56788
57416
  localWss = null;
@@ -58034,11 +58662,11 @@ var require_yoctocolors_cjs = __commonJS({
58034
58662
  "use strict";
58035
58663
  var tty3 = require("tty");
58036
58664
  var hasColors = tty3?.WriteStream?.prototype?.hasColors?.() ?? false;
58037
- var format = (open3, close) => {
58665
+ var format = (open2, close) => {
58038
58666
  if (!hasColors) {
58039
58667
  return (input) => input;
58040
58668
  }
58041
- const openCode = `\x1B[${open3}m`;
58669
+ const openCode = `\x1B[${open2}m`;
58042
58670
  const closeCode = `\x1B[${close}m`;
58043
58671
  return (input) => {
58044
58672
  const string4 = input + "";
@@ -61576,7 +62204,7 @@ var require_innerFrom = __commonJS({
61576
62204
  exports2.fromIterable = fromIterable;
61577
62205
  function fromAsyncIterable(asyncIterable) {
61578
62206
  return new Observable_1.Observable(function(subscriber) {
61579
- process19(asyncIterable, subscriber).catch(function(err) {
62207
+ process13(asyncIterable, subscriber).catch(function(err) {
61580
62208
  return subscriber.error(err);
61581
62209
  });
61582
62210
  });
@@ -61586,7 +62214,7 @@ var require_innerFrom = __commonJS({
61586
62214
  return fromAsyncIterable(isReadableStreamLike_1.readableStreamLikeToAsyncGenerator(readableStream));
61587
62215
  }
61588
62216
  exports2.fromReadableStreamLike = fromReadableStreamLike;
61589
- function process19(asyncIterable, subscriber) {
62217
+ function process13(asyncIterable, subscriber) {
61590
62218
  var asyncIterable_1, asyncIterable_1_1;
61591
62219
  var e_2, _a2;
61592
62220
  return __awaiter(this, void 0, void 0, function() {
@@ -69245,15 +69873,15 @@ var require_route = __commonJS({
69245
69873
  };
69246
69874
  }
69247
69875
  function wrapConversion(toModel, graph) {
69248
- const path29 = [graph[toModel].parent, toModel];
69876
+ const path28 = [graph[toModel].parent, toModel];
69249
69877
  let fn = conversions[graph[toModel].parent][toModel];
69250
69878
  let cur = graph[toModel].parent;
69251
69879
  while (graph[cur].parent) {
69252
- path29.unshift(graph[cur].parent);
69880
+ path28.unshift(graph[cur].parent);
69253
69881
  fn = link(conversions[graph[cur].parent][cur], fn);
69254
69882
  cur = graph[cur].parent;
69255
69883
  }
69256
- fn.conversion = path29;
69884
+ fn.conversion = path28;
69257
69885
  return fn;
69258
69886
  }
69259
69887
  module2.exports = function(fromModel) {
@@ -69650,7 +70278,7 @@ var require_has_flag = __commonJS({
69650
70278
  var require_supports_color = __commonJS({
69651
70279
  "../../node_modules/supports-color/index.js"(exports2, module2) {
69652
70280
  "use strict";
69653
- var os29 = require("os");
70281
+ var os28 = require("os");
69654
70282
  var tty3 = require("tty");
69655
70283
  var hasFlag3 = require_has_flag();
69656
70284
  var { env: env3 } = process;
@@ -69698,7 +70326,7 @@ var require_supports_color = __commonJS({
69698
70326
  return min;
69699
70327
  }
69700
70328
  if (process.platform === "win32") {
69701
- const osRelease = os29.release().split(".");
70329
+ const osRelease = os28.release().split(".");
69702
70330
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
69703
70331
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
69704
70332
  }
@@ -69999,18 +70627,18 @@ var require_source = __commonJS({
69999
70627
  }
70000
70628
  }
70001
70629
  });
70002
- var createStyler3 = (open3, close, parent) => {
70630
+ var createStyler3 = (open2, close, parent) => {
70003
70631
  let openAll;
70004
70632
  let closeAll;
70005
70633
  if (parent === void 0) {
70006
- openAll = open3;
70634
+ openAll = open2;
70007
70635
  closeAll = close;
70008
70636
  } else {
70009
- openAll = parent.openAll + open3;
70637
+ openAll = parent.openAll + open2;
70010
70638
  closeAll = close + parent.closeAll;
70011
70639
  }
70012
70640
  return {
70013
- open: open3,
70641
+ open: open2,
70014
70642
  close,
70015
70643
  openAll,
70016
70644
  closeAll,
@@ -70174,11 +70802,11 @@ var require_signals = __commonJS({
70174
70802
  var require_signal_exit = __commonJS({
70175
70803
  "../../node_modules/inquirer/node_modules/signal-exit/index.js"(exports2, module2) {
70176
70804
  "use strict";
70177
- var process19 = global.process;
70178
- var processOk2 = function(process20) {
70179
- 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";
70805
+ var process13 = global.process;
70806
+ var processOk2 = function(process14) {
70807
+ 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";
70180
70808
  };
70181
- if (!processOk2(process19)) {
70809
+ if (!processOk2(process13)) {
70182
70810
  module2.exports = function() {
70183
70811
  return function() {
70184
70812
  };
@@ -70186,15 +70814,15 @@ var require_signal_exit = __commonJS({
70186
70814
  } else {
70187
70815
  assert3 = require("assert");
70188
70816
  signals2 = require_signals();
70189
- isWin = /^win/i.test(process19.platform);
70817
+ isWin = /^win/i.test(process13.platform);
70190
70818
  EE = require("events");
70191
70819
  if (typeof EE !== "function") {
70192
70820
  EE = EE.EventEmitter;
70193
70821
  }
70194
- if (process19.__signal_exit_emitter__) {
70195
- emitter = process19.__signal_exit_emitter__;
70822
+ if (process13.__signal_exit_emitter__) {
70823
+ emitter = process13.__signal_exit_emitter__;
70196
70824
  } else {
70197
- emitter = process19.__signal_exit_emitter__ = new EE();
70825
+ emitter = process13.__signal_exit_emitter__ = new EE();
70198
70826
  emitter.count = 0;
70199
70827
  emitter.emitted = {};
70200
70828
  }
@@ -70231,12 +70859,12 @@ var require_signal_exit = __commonJS({
70231
70859
  loaded = false;
70232
70860
  signals2.forEach(function(sig) {
70233
70861
  try {
70234
- process19.removeListener(sig, sigListeners[sig]);
70862
+ process13.removeListener(sig, sigListeners[sig]);
70235
70863
  } catch (er) {
70236
70864
  }
70237
70865
  });
70238
- process19.emit = originalProcessEmit;
70239
- process19.reallyExit = originalProcessReallyExit;
70866
+ process13.emit = originalProcessEmit;
70867
+ process13.reallyExit = originalProcessReallyExit;
70240
70868
  emitter.count -= 1;
70241
70869
  };
70242
70870
  module2.exports.unload = unload2;
@@ -70253,7 +70881,7 @@ var require_signal_exit = __commonJS({
70253
70881
  if (!processOk2(global.process)) {
70254
70882
  return;
70255
70883
  }
70256
- var listeners = process19.listeners(sig);
70884
+ var listeners = process13.listeners(sig);
70257
70885
  if (listeners.length === emitter.count) {
70258
70886
  unload2();
70259
70887
  emit("exit", null, sig);
@@ -70261,7 +70889,7 @@ var require_signal_exit = __commonJS({
70261
70889
  if (isWin && sig === "SIGHUP") {
70262
70890
  sig = "SIGINT";
70263
70891
  }
70264
- process19.kill(process19.pid, sig);
70892
+ process13.kill(process13.pid, sig);
70265
70893
  }
70266
70894
  };
70267
70895
  });
@@ -70277,36 +70905,36 @@ var require_signal_exit = __commonJS({
70277
70905
  emitter.count += 1;
70278
70906
  signals2 = signals2.filter(function(sig) {
70279
70907
  try {
70280
- process19.on(sig, sigListeners[sig]);
70908
+ process13.on(sig, sigListeners[sig]);
70281
70909
  return true;
70282
70910
  } catch (er) {
70283
70911
  return false;
70284
70912
  }
70285
70913
  });
70286
- process19.emit = processEmit;
70287
- process19.reallyExit = processReallyExit;
70914
+ process13.emit = processEmit;
70915
+ process13.reallyExit = processReallyExit;
70288
70916
  };
70289
70917
  module2.exports.load = load2;
70290
- originalProcessReallyExit = process19.reallyExit;
70918
+ originalProcessReallyExit = process13.reallyExit;
70291
70919
  processReallyExit = function processReallyExit2(code) {
70292
70920
  if (!processOk2(global.process)) {
70293
70921
  return;
70294
70922
  }
70295
- process19.exitCode = code || /* istanbul ignore next */
70923
+ process13.exitCode = code || /* istanbul ignore next */
70296
70924
  0;
70297
- emit("exit", process19.exitCode, null);
70298
- emit("afterexit", process19.exitCode, null);
70299
- originalProcessReallyExit.call(process19, process19.exitCode);
70925
+ emit("exit", process13.exitCode, null);
70926
+ emit("afterexit", process13.exitCode, null);
70927
+ originalProcessReallyExit.call(process13, process13.exitCode);
70300
70928
  };
70301
- originalProcessEmit = process19.emit;
70929
+ originalProcessEmit = process13.emit;
70302
70930
  processEmit = function processEmit2(ev, arg) {
70303
70931
  if (ev === "exit" && processOk2(global.process)) {
70304
70932
  if (arg !== void 0) {
70305
- process19.exitCode = arg;
70933
+ process13.exitCode = arg;
70306
70934
  }
70307
70935
  var ret = originalProcessEmit.apply(this, arguments);
70308
- emit("exit", process19.exitCode, null);
70309
- emit("afterexit", process19.exitCode, null);
70936
+ emit("exit", process13.exitCode, null);
70937
+ emit("afterexit", process13.exitCode, null);
70310
70938
  return ret;
70311
70939
  } else {
70312
70940
  return originalProcessEmit.apply(this, arguments);
@@ -72496,12 +73124,12 @@ var require_buffer_list = __commonJS({
72496
73124
  return (hint === "string" ? String : Number)(input);
72497
73125
  }
72498
73126
  var _require = require("buffer");
72499
- var Buffer3 = _require.Buffer;
73127
+ var Buffer2 = _require.Buffer;
72500
73128
  var _require2 = require("util");
72501
73129
  var inspect = _require2.inspect;
72502
73130
  var custom2 = inspect && inspect.custom || "inspect";
72503
73131
  function copyBuffer(src, target, offset) {
72504
- Buffer3.prototype.copy.call(src, target, offset);
73132
+ Buffer2.prototype.copy.call(src, target, offset);
72505
73133
  }
72506
73134
  module2.exports = /* @__PURE__ */ (function() {
72507
73135
  function BufferList() {
@@ -72561,8 +73189,8 @@ var require_buffer_list = __commonJS({
72561
73189
  }, {
72562
73190
  key: "concat",
72563
73191
  value: function concat(n) {
72564
- if (this.length === 0) return Buffer3.alloc(0);
72565
- var ret = Buffer3.allocUnsafe(n >>> 0);
73192
+ if (this.length === 0) return Buffer2.alloc(0);
73193
+ var ret = Buffer2.allocUnsafe(n >>> 0);
72566
73194
  var p = this.head;
72567
73195
  var i = 0;
72568
73196
  while (p) {
@@ -72626,7 +73254,7 @@ var require_buffer_list = __commonJS({
72626
73254
  }, {
72627
73255
  key: "_getBuffer",
72628
73256
  value: function _getBuffer(n) {
72629
- var ret = Buffer3.allocUnsafe(n);
73257
+ var ret = Buffer2.allocUnsafe(n);
72630
73258
  var p = this.head;
72631
73259
  var c = 1;
72632
73260
  p.data.copy(ret);
@@ -72958,14 +73586,14 @@ var require_stream_writable = __commonJS({
72958
73586
  deprecate: require_node()
72959
73587
  };
72960
73588
  var Stream = require_stream();
72961
- var Buffer3 = require("buffer").Buffer;
73589
+ var Buffer2 = require("buffer").Buffer;
72962
73590
  var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
72963
73591
  };
72964
73592
  function _uint8ArrayToBuffer(chunk) {
72965
- return Buffer3.from(chunk);
73593
+ return Buffer2.from(chunk);
72966
73594
  }
72967
73595
  function _isUint8Array(obj) {
72968
- return Buffer3.isBuffer(obj) || obj instanceof OurUint8Array;
73596
+ return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
72969
73597
  }
72970
73598
  var destroyImpl = require_destroy();
72971
73599
  var _require = require_state();
@@ -73093,7 +73721,7 @@ var require_stream_writable = __commonJS({
73093
73721
  var state = this._writableState;
73094
73722
  var ret = false;
73095
73723
  var isBuf = !state.objectMode && _isUint8Array(chunk);
73096
- if (isBuf && !Buffer3.isBuffer(chunk)) {
73724
+ if (isBuf && !Buffer2.isBuffer(chunk)) {
73097
73725
  chunk = _uint8ArrayToBuffer(chunk);
73098
73726
  }
73099
73727
  if (typeof encoding === "function") {
@@ -73137,7 +73765,7 @@ var require_stream_writable = __commonJS({
73137
73765
  });
73138
73766
  function decodeChunk(state, chunk, encoding) {
73139
73767
  if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") {
73140
- chunk = Buffer3.from(chunk, encoding);
73768
+ chunk = Buffer2.from(chunk, encoding);
73141
73769
  }
73142
73770
  return chunk;
73143
73771
  }
@@ -73508,34 +74136,34 @@ var require_safe_buffer = __commonJS({
73508
74136
  "../../node_modules/safe-buffer/index.js"(exports2, module2) {
73509
74137
  "use strict";
73510
74138
  var buffer = require("buffer");
73511
- var Buffer3 = buffer.Buffer;
74139
+ var Buffer2 = buffer.Buffer;
73512
74140
  function copyProps(src, dst) {
73513
74141
  for (var key in src) {
73514
74142
  dst[key] = src[key];
73515
74143
  }
73516
74144
  }
73517
- if (Buffer3.from && Buffer3.alloc && Buffer3.allocUnsafe && Buffer3.allocUnsafeSlow) {
74145
+ if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
73518
74146
  module2.exports = buffer;
73519
74147
  } else {
73520
74148
  copyProps(buffer, exports2);
73521
74149
  exports2.Buffer = SafeBuffer;
73522
74150
  }
73523
74151
  function SafeBuffer(arg, encodingOrOffset, length) {
73524
- return Buffer3(arg, encodingOrOffset, length);
74152
+ return Buffer2(arg, encodingOrOffset, length);
73525
74153
  }
73526
- SafeBuffer.prototype = Object.create(Buffer3.prototype);
73527
- copyProps(Buffer3, SafeBuffer);
74154
+ SafeBuffer.prototype = Object.create(Buffer2.prototype);
74155
+ copyProps(Buffer2, SafeBuffer);
73528
74156
  SafeBuffer.from = function(arg, encodingOrOffset, length) {
73529
74157
  if (typeof arg === "number") {
73530
74158
  throw new TypeError("Argument must not be a number");
73531
74159
  }
73532
- return Buffer3(arg, encodingOrOffset, length);
74160
+ return Buffer2(arg, encodingOrOffset, length);
73533
74161
  };
73534
74162
  SafeBuffer.alloc = function(size, fill, encoding) {
73535
74163
  if (typeof size !== "number") {
73536
74164
  throw new TypeError("Argument must be a number");
73537
74165
  }
73538
- var buf = Buffer3(size);
74166
+ var buf = Buffer2(size);
73539
74167
  if (fill !== void 0) {
73540
74168
  if (typeof encoding === "string") {
73541
74169
  buf.fill(fill, encoding);
@@ -73551,7 +74179,7 @@ var require_safe_buffer = __commonJS({
73551
74179
  if (typeof size !== "number") {
73552
74180
  throw new TypeError("Argument must be a number");
73553
74181
  }
73554
- return Buffer3(size);
74182
+ return Buffer2(size);
73555
74183
  };
73556
74184
  SafeBuffer.allocUnsafeSlow = function(size) {
73557
74185
  if (typeof size !== "number") {
@@ -73566,8 +74194,8 @@ var require_safe_buffer = __commonJS({
73566
74194
  var require_string_decoder = __commonJS({
73567
74195
  "../../node_modules/string_decoder/lib/string_decoder.js"(exports2) {
73568
74196
  "use strict";
73569
- var Buffer3 = require_safe_buffer().Buffer;
73570
- var isEncoding = Buffer3.isEncoding || function(encoding) {
74197
+ var Buffer2 = require_safe_buffer().Buffer;
74198
+ var isEncoding = Buffer2.isEncoding || function(encoding) {
73571
74199
  encoding = "" + encoding;
73572
74200
  switch (encoding && encoding.toLowerCase()) {
73573
74201
  case "hex":
@@ -73615,7 +74243,7 @@ var require_string_decoder = __commonJS({
73615
74243
  }
73616
74244
  function normalizeEncoding(enc) {
73617
74245
  var nenc = _normalizeEncoding(enc);
73618
- if (typeof nenc !== "string" && (Buffer3.isEncoding === isEncoding || !isEncoding(enc))) throw new Error("Unknown encoding: " + enc);
74246
+ if (typeof nenc !== "string" && (Buffer2.isEncoding === isEncoding || !isEncoding(enc))) throw new Error("Unknown encoding: " + enc);
73619
74247
  return nenc || enc;
73620
74248
  }
73621
74249
  exports2.StringDecoder = StringDecoder;
@@ -73644,7 +74272,7 @@ var require_string_decoder = __commonJS({
73644
74272
  }
73645
74273
  this.lastNeed = 0;
73646
74274
  this.lastTotal = 0;
73647
- this.lastChar = Buffer3.allocUnsafe(nb);
74275
+ this.lastChar = Buffer2.allocUnsafe(nb);
73648
74276
  }
73649
74277
  StringDecoder.prototype.write = function(buf) {
73650
74278
  if (buf.length === 0) return "";
@@ -74205,14 +74833,14 @@ var require_stream_readable = __commonJS({
74205
74833
  return emitter.listeners(type).length;
74206
74834
  };
74207
74835
  var Stream = require_stream();
74208
- var Buffer3 = require("buffer").Buffer;
74836
+ var Buffer2 = require("buffer").Buffer;
74209
74837
  var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
74210
74838
  };
74211
74839
  function _uint8ArrayToBuffer(chunk) {
74212
- return Buffer3.from(chunk);
74840
+ return Buffer2.from(chunk);
74213
74841
  }
74214
74842
  function _isUint8Array(obj) {
74215
- return Buffer3.isBuffer(obj) || obj instanceof OurUint8Array;
74843
+ return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
74216
74844
  }
74217
74845
  var debugUtil = require("util");
74218
74846
  var debug;
@@ -74320,7 +74948,7 @@ var require_stream_readable = __commonJS({
74320
74948
  if (typeof chunk === "string") {
74321
74949
  encoding = encoding || state.defaultEncoding;
74322
74950
  if (encoding !== state.encoding) {
74323
- chunk = Buffer3.from(chunk, encoding);
74951
+ chunk = Buffer2.from(chunk, encoding);
74324
74952
  encoding = "";
74325
74953
  }
74326
74954
  skipChunkCheck = true;
@@ -74345,7 +74973,7 @@ var require_stream_readable = __commonJS({
74345
74973
  if (er) {
74346
74974
  errorOrDestroy(stream, er);
74347
74975
  } else if (state.objectMode || chunk && chunk.length > 0) {
74348
- if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer3.prototype) {
74976
+ if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer2.prototype) {
74349
74977
  chunk = _uint8ArrayToBuffer(chunk);
74350
74978
  }
74351
74979
  if (addToFront) {
@@ -75156,7 +75784,7 @@ var require_readable = __commonJS({
75156
75784
  var require_BufferList = __commonJS({
75157
75785
  "../../node_modules/bl/BufferList.js"(exports2, module2) {
75158
75786
  "use strict";
75159
- var { Buffer: Buffer3 } = require("buffer");
75787
+ var { Buffer: Buffer2 } = require("buffer");
75160
75788
  var symbol2 = /* @__PURE__ */ Symbol.for("BufferList");
75161
75789
  function BufferList(buf) {
75162
75790
  if (!(this instanceof BufferList)) {
@@ -75220,10 +75848,10 @@ var require_BufferList = __commonJS({
75220
75848
  srcEnd = this.length;
75221
75849
  }
75222
75850
  if (srcStart >= this.length) {
75223
- return dst || Buffer3.alloc(0);
75851
+ return dst || Buffer2.alloc(0);
75224
75852
  }
75225
75853
  if (srcEnd <= 0) {
75226
- return dst || Buffer3.alloc(0);
75854
+ return dst || Buffer2.alloc(0);
75227
75855
  }
75228
75856
  const copy2 = !!dst;
75229
75857
  const off = this._offset(srcStart);
@@ -75233,7 +75861,7 @@ var require_BufferList = __commonJS({
75233
75861
  let start = off[1];
75234
75862
  if (srcStart === 0 && srcEnd === this.length) {
75235
75863
  if (!copy2) {
75236
- return this._bufs.length === 1 ? this._bufs[0] : Buffer3.concat(this._bufs, this.length);
75864
+ return this._bufs.length === 1 ? this._bufs[0] : Buffer2.concat(this._bufs, this.length);
75237
75865
  }
75238
75866
  for (let i = 0; i < this._bufs.length; i++) {
75239
75867
  this._bufs[i].copy(dst, bufoff);
@@ -75245,7 +75873,7 @@ var require_BufferList = __commonJS({
75245
75873
  return copy2 ? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes) : this._bufs[off[0]].slice(start, start + bytes);
75246
75874
  }
75247
75875
  if (!copy2) {
75248
- dst = Buffer3.allocUnsafe(len);
75876
+ dst = Buffer2.allocUnsafe(len);
75249
75877
  }
75250
75878
  for (let i = off[0]; i < this._bufs.length; i++) {
75251
75879
  const l = this._bufs[i].length - start;
@@ -75321,7 +75949,7 @@ var require_BufferList = __commonJS({
75321
75949
  return this;
75322
75950
  }
75323
75951
  if (buf.buffer) {
75324
- this._appendBuffer(Buffer3.from(buf.buffer, buf.byteOffset, buf.byteLength));
75952
+ this._appendBuffer(Buffer2.from(buf.buffer, buf.byteOffset, buf.byteLength));
75325
75953
  } else if (Array.isArray(buf)) {
75326
75954
  for (let i = 0; i < buf.length; i++) {
75327
75955
  this.append(buf[i]);
@@ -75334,7 +75962,7 @@ var require_BufferList = __commonJS({
75334
75962
  if (typeof buf === "number") {
75335
75963
  buf = buf.toString();
75336
75964
  }
75337
- this._appendBuffer(Buffer3.from(buf));
75965
+ this._appendBuffer(Buffer2.from(buf));
75338
75966
  }
75339
75967
  return this;
75340
75968
  };
@@ -75350,15 +75978,15 @@ var require_BufferList = __commonJS({
75350
75978
  if (typeof search === "function" || Array.isArray(search)) {
75351
75979
  throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');
75352
75980
  } else if (typeof search === "number") {
75353
- search = Buffer3.from([search]);
75981
+ search = Buffer2.from([search]);
75354
75982
  } else if (typeof search === "string") {
75355
- search = Buffer3.from(search, encoding);
75983
+ search = Buffer2.from(search, encoding);
75356
75984
  } else if (this._isBufferList(search)) {
75357
75985
  search = search.slice();
75358
75986
  } else if (Array.isArray(search.buffer)) {
75359
- search = Buffer3.from(search.buffer, search.byteOffset, search.byteLength);
75360
- } else if (!Buffer3.isBuffer(search)) {
75361
- search = Buffer3.from(search);
75987
+ search = Buffer2.from(search.buffer, search.byteOffset, search.byteLength);
75988
+ } else if (!Buffer2.isBuffer(search)) {
75989
+ search = Buffer2.from(search);
75362
75990
  }
75363
75991
  offset = Number(offset || 0);
75364
75992
  if (isNaN(offset)) {
@@ -82674,10 +83302,10 @@ var require_lib2 = __commonJS({
82674
83302
  exports2.analyse = analyse;
82675
83303
  var detectFile = (filepath, opts = {}) => new Promise((resolve16, reject) => {
82676
83304
  let fd;
82677
- const fs24 = (0, node_1.default)();
83305
+ const fs19 = (0, node_1.default)();
82678
83306
  const handler = (err, buffer) => {
82679
83307
  if (fd) {
82680
- fs24.closeSync(fd);
83308
+ fs19.closeSync(fd);
82681
83309
  }
82682
83310
  if (err) {
82683
83311
  reject(err);
@@ -82689,9 +83317,9 @@ var require_lib2 = __commonJS({
82689
83317
  };
82690
83318
  const sampleSize = (opts === null || opts === void 0 ? void 0 : opts.sampleSize) || 0;
82691
83319
  if (sampleSize > 0) {
82692
- fd = fs24.openSync(filepath, "r");
83320
+ fd = fs19.openSync(filepath, "r");
82693
83321
  let sample = Buffer.allocUnsafe(sampleSize);
82694
- fs24.read(fd, sample, 0, sampleSize, opts.offset, (err, bytesRead) => {
83322
+ fs19.read(fd, sample, 0, sampleSize, opts.offset, (err, bytesRead) => {
82695
83323
  if (err) {
82696
83324
  handler(err, null);
82697
83325
  } else {
@@ -82703,22 +83331,22 @@ var require_lib2 = __commonJS({
82703
83331
  });
82704
83332
  return;
82705
83333
  }
82706
- fs24.readFile(filepath, handler);
83334
+ fs19.readFile(filepath, handler);
82707
83335
  });
82708
83336
  exports2.detectFile = detectFile;
82709
83337
  var detectFileSync = (filepath, opts = {}) => {
82710
- const fs24 = (0, node_1.default)();
83338
+ const fs19 = (0, node_1.default)();
82711
83339
  if (opts && opts.sampleSize) {
82712
- const fd = fs24.openSync(filepath, "r");
83340
+ const fd = fs19.openSync(filepath, "r");
82713
83341
  let sample = Buffer.allocUnsafe(opts.sampleSize);
82714
- const bytesRead = fs24.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
83342
+ const bytesRead = fs19.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
82715
83343
  if (bytesRead < opts.sampleSize) {
82716
83344
  sample = sample.subarray(0, bytesRead);
82717
83345
  }
82718
- fs24.closeSync(fd);
83346
+ fs19.closeSync(fd);
82719
83347
  return (0, exports2.detect)(sample);
82720
83348
  }
82721
- return (0, exports2.detect)(fs24.readFileSync(filepath));
83349
+ return (0, exports2.detect)(fs19.readFileSync(filepath));
82722
83350
  };
82723
83351
  exports2.detectFileSync = detectFileSync;
82724
83352
  exports2.default = {
@@ -82735,7 +83363,7 @@ var require_safer = __commonJS({
82735
83363
  "../../node_modules/safer-buffer/safer.js"(exports2, module2) {
82736
83364
  "use strict";
82737
83365
  var buffer = require("buffer");
82738
- var Buffer3 = buffer.Buffer;
83366
+ var Buffer2 = buffer.Buffer;
82739
83367
  var safer = {};
82740
83368
  var key;
82741
83369
  for (key in buffer) {
@@ -82744,12 +83372,12 @@ var require_safer = __commonJS({
82744
83372
  safer[key] = buffer[key];
82745
83373
  }
82746
83374
  var Safer = safer.Buffer = {};
82747
- for (key in Buffer3) {
82748
- if (!Buffer3.hasOwnProperty(key)) continue;
83375
+ for (key in Buffer2) {
83376
+ if (!Buffer2.hasOwnProperty(key)) continue;
82749
83377
  if (key === "allocUnsafe" || key === "allocUnsafeSlow") continue;
82750
- Safer[key] = Buffer3[key];
83378
+ Safer[key] = Buffer2[key];
82751
83379
  }
82752
- safer.Buffer.prototype = Buffer3.prototype;
83380
+ safer.Buffer.prototype = Buffer2.prototype;
82753
83381
  if (!Safer.from || Safer.from === Uint8Array.from) {
82754
83382
  Safer.from = function(value, encodingOrOffset, length) {
82755
83383
  if (typeof value === "number") {
@@ -82758,7 +83386,7 @@ var require_safer = __commonJS({
82758
83386
  if (value && typeof value.length === "undefined") {
82759
83387
  throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value);
82760
83388
  }
82761
- return Buffer3(value, encodingOrOffset, length);
83389
+ return Buffer2(value, encodingOrOffset, length);
82762
83390
  };
82763
83391
  }
82764
83392
  if (!Safer.alloc) {
@@ -82769,7 +83397,7 @@ var require_safer = __commonJS({
82769
83397
  if (size < 0 || size >= 2 * (1 << 30)) {
82770
83398
  throw new RangeError('The value "' + size + '" is invalid for option "size"');
82771
83399
  }
82772
- var buf = Buffer3(size);
83400
+ var buf = Buffer2(size);
82773
83401
  if (!fill || fill.length === 0) {
82774
83402
  buf.fill(0);
82775
83403
  } else if (typeof encoding === "string") {
@@ -82864,7 +83492,7 @@ var require_merge_exports = __commonJS({
82864
83492
  var require_internal = __commonJS({
82865
83493
  "../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/internal.js"(exports2, module2) {
82866
83494
  "use strict";
82867
- var Buffer3 = require_safer().Buffer;
83495
+ var Buffer2 = require_safer().Buffer;
82868
83496
  module2.exports = {
82869
83497
  // Encodings
82870
83498
  utf8: { type: "_internal", bomAware: true },
@@ -82888,7 +83516,7 @@ var require_internal = __commonJS({
82888
83516
  } else if (this.enc === "cesu8") {
82889
83517
  this.enc = "utf8";
82890
83518
  this.encoder = InternalEncoderCesu8;
82891
- if (Buffer3.from("eda0bdedb2a9", "hex").toString() !== "\u{1F4A9}") {
83519
+ if (Buffer2.from("eda0bdedb2a9", "hex").toString() !== "\u{1F4A9}") {
82892
83520
  this.decoder = InternalDecoderCesu8;
82893
83521
  this.defaultCharUnicode = iconv2.defaultCharUnicode;
82894
83522
  }
@@ -82901,8 +83529,8 @@ var require_internal = __commonJS({
82901
83529
  this.decoder = new StringDecoder(codec2.enc);
82902
83530
  }
82903
83531
  InternalDecoder.prototype.write = function(buf) {
82904
- if (!Buffer3.isBuffer(buf)) {
82905
- buf = Buffer3.from(buf);
83532
+ if (!Buffer2.isBuffer(buf)) {
83533
+ buf = Buffer2.from(buf);
82906
83534
  }
82907
83535
  return this.decoder.write(buf);
82908
83536
  };
@@ -82913,7 +83541,7 @@ var require_internal = __commonJS({
82913
83541
  this.enc = codec2.enc;
82914
83542
  }
82915
83543
  InternalEncoder.prototype.write = function(str) {
82916
- return Buffer3.from(str, this.enc);
83544
+ return Buffer2.from(str, this.enc);
82917
83545
  };
82918
83546
  InternalEncoder.prototype.end = function() {
82919
83547
  };
@@ -82925,15 +83553,15 @@ var require_internal = __commonJS({
82925
83553
  var completeQuads = str.length - str.length % 4;
82926
83554
  this.prevStr = str.slice(completeQuads);
82927
83555
  str = str.slice(0, completeQuads);
82928
- return Buffer3.from(str, "base64");
83556
+ return Buffer2.from(str, "base64");
82929
83557
  };
82930
83558
  InternalEncoderBase64.prototype.end = function() {
82931
- return Buffer3.from(this.prevStr, "base64");
83559
+ return Buffer2.from(this.prevStr, "base64");
82932
83560
  };
82933
83561
  function InternalEncoderCesu8(options, codec2) {
82934
83562
  }
82935
83563
  InternalEncoderCesu8.prototype.write = function(str) {
82936
- var buf = Buffer3.alloc(str.length * 3);
83564
+ var buf = Buffer2.alloc(str.length * 3);
82937
83565
  var bufIdx = 0;
82938
83566
  for (var i = 0; i < str.length; i++) {
82939
83567
  var charCode = str.charCodeAt(i);
@@ -83029,13 +83657,13 @@ var require_internal = __commonJS({
83029
83657
  str = str.slice(0, str.length - 1);
83030
83658
  }
83031
83659
  }
83032
- return Buffer3.from(str, this.enc);
83660
+ return Buffer2.from(str, this.enc);
83033
83661
  };
83034
83662
  InternalEncoderUtf8.prototype.end = function() {
83035
83663
  if (this.highSurrogate) {
83036
83664
  var str = this.highSurrogate;
83037
83665
  this.highSurrogate = "";
83038
- return Buffer3.from(str, this.enc);
83666
+ return Buffer2.from(str, this.enc);
83039
83667
  }
83040
83668
  };
83041
83669
  }
@@ -83045,7 +83673,7 @@ var require_internal = __commonJS({
83045
83673
  var require_utf32 = __commonJS({
83046
83674
  "../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/utf32.js"(exports2) {
83047
83675
  "use strict";
83048
- var Buffer3 = require_safer().Buffer;
83676
+ var Buffer2 = require_safer().Buffer;
83049
83677
  exports2._utf32 = Utf32Codec;
83050
83678
  function Utf32Codec(codecOptions, iconv2) {
83051
83679
  this.iconv = iconv2;
@@ -83063,8 +83691,8 @@ var require_utf32 = __commonJS({
83063
83691
  this.highSurrogate = 0;
83064
83692
  }
83065
83693
  Utf32Encoder.prototype.write = function(str) {
83066
- var src = Buffer3.from(str, "ucs2");
83067
- var dst = Buffer3.alloc(src.length * 2);
83694
+ var src = Buffer2.from(str, "ucs2");
83695
+ var dst = Buffer2.alloc(src.length * 2);
83068
83696
  var write32 = this.isLE ? dst.writeUInt32LE : dst.writeUInt32BE;
83069
83697
  var offset = 0;
83070
83698
  for (var i = 0; i < src.length; i += 2) {
@@ -83100,7 +83728,7 @@ var require_utf32 = __commonJS({
83100
83728
  if (!this.highSurrogate) {
83101
83729
  return;
83102
83730
  }
83103
- var buf = Buffer3.alloc(4);
83731
+ var buf = Buffer2.alloc(4);
83104
83732
  if (this.isLE) {
83105
83733
  buf.writeUInt32LE(this.highSurrogate, 0);
83106
83734
  } else {
@@ -83120,7 +83748,7 @@ var require_utf32 = __commonJS({
83120
83748
  }
83121
83749
  var i = 0;
83122
83750
  var codepoint = 0;
83123
- var dst = Buffer3.alloc(src.length + 4);
83751
+ var dst = Buffer2.alloc(src.length + 4);
83124
83752
  var offset = 0;
83125
83753
  var isLE = this.isLE;
83126
83754
  var overflow = this.overflow;
@@ -83276,7 +83904,7 @@ var require_utf32 = __commonJS({
83276
83904
  var require_utf16 = __commonJS({
83277
83905
  "../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/utf16.js"(exports2) {
83278
83906
  "use strict";
83279
- var Buffer3 = require_safer().Buffer;
83907
+ var Buffer2 = require_safer().Buffer;
83280
83908
  exports2.utf16be = Utf16BECodec;
83281
83909
  function Utf16BECodec() {
83282
83910
  }
@@ -83286,7 +83914,7 @@ var require_utf16 = __commonJS({
83286
83914
  function Utf16BEEncoder() {
83287
83915
  }
83288
83916
  Utf16BEEncoder.prototype.write = function(str) {
83289
- var buf = Buffer3.from(str, "ucs2");
83917
+ var buf = Buffer2.from(str, "ucs2");
83290
83918
  for (var i = 0; i < buf.length; i += 2) {
83291
83919
  var tmp = buf[i];
83292
83920
  buf[i] = buf[i + 1];
@@ -83303,7 +83931,7 @@ var require_utf16 = __commonJS({
83303
83931
  if (buf.length == 0) {
83304
83932
  return "";
83305
83933
  }
83306
- var buf2 = Buffer3.alloc(buf.length + 1);
83934
+ var buf2 = Buffer2.alloc(buf.length + 1);
83307
83935
  var i = 0;
83308
83936
  var j = 0;
83309
83937
  if (this.overflowByte !== -1) {
@@ -83419,7 +84047,7 @@ var require_utf16 = __commonJS({
83419
84047
  var require_utf7 = __commonJS({
83420
84048
  "../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/utf7.js"(exports2) {
83421
84049
  "use strict";
83422
- var Buffer3 = require_safer().Buffer;
84050
+ var Buffer2 = require_safer().Buffer;
83423
84051
  exports2.utf7 = Utf7Codec;
83424
84052
  exports2.unicode11utf7 = "utf7";
83425
84053
  function Utf7Codec(codecOptions, iconv2) {
@@ -83433,7 +84061,7 @@ var require_utf7 = __commonJS({
83433
84061
  this.iconv = codec2.iconv;
83434
84062
  }
83435
84063
  Utf7Encoder.prototype.write = function(str) {
83436
- return Buffer3.from(str.replace(nonDirectChars, function(chunk) {
84064
+ return Buffer2.from(str.replace(nonDirectChars, function(chunk) {
83437
84065
  return "+" + (chunk === "+" ? "" : this.iconv.encode(chunk, "utf16-be").toString("base64").replace(/=+$/, "")) + "-";
83438
84066
  }.bind(this)));
83439
84067
  };
@@ -83471,7 +84099,7 @@ var require_utf7 = __commonJS({
83471
84099
  res += "+";
83472
84100
  } else {
83473
84101
  var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i2), "ascii");
83474
- res += this.iconv.decode(Buffer3.from(b64str, "base64"), "utf16-be");
84102
+ res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
83475
84103
  }
83476
84104
  if (buf[i2] != minusChar) {
83477
84105
  i2--;
@@ -83489,7 +84117,7 @@ var require_utf7 = __commonJS({
83489
84117
  var canBeDecoded = b64str.length - b64str.length % 8;
83490
84118
  base64Accum = b64str.slice(canBeDecoded);
83491
84119
  b64str = b64str.slice(0, canBeDecoded);
83492
- res += this.iconv.decode(Buffer3.from(b64str, "base64"), "utf16-be");
84120
+ res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
83493
84121
  }
83494
84122
  this.inBase64 = inBase64;
83495
84123
  this.base64Accum = base64Accum;
@@ -83498,7 +84126,7 @@ var require_utf7 = __commonJS({
83498
84126
  Utf7Decoder.prototype.end = function() {
83499
84127
  var res = "";
83500
84128
  if (this.inBase64 && this.base64Accum.length > 0) {
83501
- res = this.iconv.decode(Buffer3.from(this.base64Accum, "base64"), "utf16-be");
84129
+ res = this.iconv.decode(Buffer2.from(this.base64Accum, "base64"), "utf16-be");
83502
84130
  }
83503
84131
  this.inBase64 = false;
83504
84132
  this.base64Accum = "";
@@ -83514,14 +84142,14 @@ var require_utf7 = __commonJS({
83514
84142
  function Utf7IMAPEncoder(options, codec2) {
83515
84143
  this.iconv = codec2.iconv;
83516
84144
  this.inBase64 = false;
83517
- this.base64Accum = Buffer3.alloc(6);
84145
+ this.base64Accum = Buffer2.alloc(6);
83518
84146
  this.base64AccumIdx = 0;
83519
84147
  }
83520
84148
  Utf7IMAPEncoder.prototype.write = function(str) {
83521
84149
  var inBase64 = this.inBase64;
83522
84150
  var base64Accum = this.base64Accum;
83523
84151
  var base64AccumIdx = this.base64AccumIdx;
83524
- var buf = Buffer3.alloc(str.length * 5 + 10);
84152
+ var buf = Buffer2.alloc(str.length * 5 + 10);
83525
84153
  var bufIdx = 0;
83526
84154
  for (var i2 = 0; i2 < str.length; i2++) {
83527
84155
  var uChar = str.charCodeAt(i2);
@@ -83560,7 +84188,7 @@ var require_utf7 = __commonJS({
83560
84188
  return buf.slice(0, bufIdx);
83561
84189
  };
83562
84190
  Utf7IMAPEncoder.prototype.end = function() {
83563
- var buf = Buffer3.alloc(10);
84191
+ var buf = Buffer2.alloc(10);
83564
84192
  var bufIdx = 0;
83565
84193
  if (this.inBase64) {
83566
84194
  if (this.base64AccumIdx > 0) {
@@ -83597,7 +84225,7 @@ var require_utf7 = __commonJS({
83597
84225
  res += "&";
83598
84226
  } else {
83599
84227
  var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i2), "ascii").replace(/,/g, "/");
83600
- res += this.iconv.decode(Buffer3.from(b64str, "base64"), "utf16-be");
84228
+ res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
83601
84229
  }
83602
84230
  if (buf[i2] != minusChar) {
83603
84231
  i2--;
@@ -83615,7 +84243,7 @@ var require_utf7 = __commonJS({
83615
84243
  var canBeDecoded = b64str.length - b64str.length % 8;
83616
84244
  base64Accum = b64str.slice(canBeDecoded);
83617
84245
  b64str = b64str.slice(0, canBeDecoded);
83618
- res += this.iconv.decode(Buffer3.from(b64str, "base64"), "utf16-be");
84246
+ res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
83619
84247
  }
83620
84248
  this.inBase64 = inBase64;
83621
84249
  this.base64Accum = base64Accum;
@@ -83624,7 +84252,7 @@ var require_utf7 = __commonJS({
83624
84252
  Utf7IMAPDecoder.prototype.end = function() {
83625
84253
  var res = "";
83626
84254
  if (this.inBase64 && this.base64Accum.length > 0) {
83627
- res = this.iconv.decode(Buffer3.from(this.base64Accum, "base64"), "utf16-be");
84255
+ res = this.iconv.decode(Buffer2.from(this.base64Accum, "base64"), "utf16-be");
83628
84256
  }
83629
84257
  this.inBase64 = false;
83630
84258
  this.base64Accum = "";
@@ -83637,7 +84265,7 @@ var require_utf7 = __commonJS({
83637
84265
  var require_sbcs_codec = __commonJS({
83638
84266
  "../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/sbcs-codec.js"(exports2) {
83639
84267
  "use strict";
83640
- var Buffer3 = require_safer().Buffer;
84268
+ var Buffer2 = require_safer().Buffer;
83641
84269
  exports2._sbcs = SBCSCodec;
83642
84270
  function SBCSCodec(codecOptions, iconv2) {
83643
84271
  if (!codecOptions) {
@@ -83653,8 +84281,8 @@ var require_sbcs_codec = __commonJS({
83653
84281
  }
83654
84282
  codecOptions.chars = asciiString + codecOptions.chars;
83655
84283
  }
83656
- this.decodeBuf = Buffer3.from(codecOptions.chars, "ucs2");
83657
- var encodeBuf = Buffer3.alloc(65536, iconv2.defaultCharSingleByte.charCodeAt(0));
84284
+ this.decodeBuf = Buffer2.from(codecOptions.chars, "ucs2");
84285
+ var encodeBuf = Buffer2.alloc(65536, iconv2.defaultCharSingleByte.charCodeAt(0));
83658
84286
  for (var i = 0; i < codecOptions.chars.length; i++) {
83659
84287
  encodeBuf[codecOptions.chars.charCodeAt(i)] = i;
83660
84288
  }
@@ -83666,7 +84294,7 @@ var require_sbcs_codec = __commonJS({
83666
84294
  this.encodeBuf = codec2.encodeBuf;
83667
84295
  }
83668
84296
  SBCSEncoder.prototype.write = function(str) {
83669
- var buf = Buffer3.alloc(str.length);
84297
+ var buf = Buffer2.alloc(str.length);
83670
84298
  for (var i = 0; i < str.length; i++) {
83671
84299
  buf[i] = this.encodeBuf[str.charCodeAt(i)];
83672
84300
  }
@@ -83679,7 +84307,7 @@ var require_sbcs_codec = __commonJS({
83679
84307
  }
83680
84308
  SBCSDecoder.prototype.write = function(buf) {
83681
84309
  var decodeBuf = this.decodeBuf;
83682
- var newBuf = Buffer3.alloc(buf.length * 2);
84310
+ var newBuf = Buffer2.alloc(buf.length * 2);
83683
84311
  var idx1 = 0;
83684
84312
  var idx2 = 0;
83685
84313
  for (var i = 0; i < buf.length; i++) {
@@ -84307,7 +84935,7 @@ var require_sbcs_data_generated = __commonJS({
84307
84935
  var require_dbcs_codec = __commonJS({
84308
84936
  "../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/dbcs-codec.js"(exports2) {
84309
84937
  "use strict";
84310
- var Buffer3 = require_safer().Buffer;
84938
+ var Buffer2 = require_safer().Buffer;
84311
84939
  exports2._dbcs = DBCSCodec;
84312
84940
  var UNASSIGNED = -1;
84313
84941
  var GB18030_CODE = -2;
@@ -84543,7 +85171,7 @@ var require_dbcs_codec = __commonJS({
84543
85171
  this.gb18030 = codec2.gb18030;
84544
85172
  }
84545
85173
  DBCSEncoder.prototype.write = function(str) {
84546
- var newBuf = Buffer3.alloc(str.length * (this.gb18030 ? 4 : 3));
85174
+ var newBuf = Buffer2.alloc(str.length * (this.gb18030 ? 4 : 3));
84547
85175
  var leadSurrogate = this.leadSurrogate;
84548
85176
  var seqObj = this.seqObj;
84549
85177
  var nextChar = -1;
@@ -84647,7 +85275,7 @@ var require_dbcs_codec = __commonJS({
84647
85275
  if (this.leadSurrogate === -1 && this.seqObj === void 0) {
84648
85276
  return;
84649
85277
  }
84650
- var newBuf = Buffer3.alloc(10);
85278
+ var newBuf = Buffer2.alloc(10);
84651
85279
  var j = 0;
84652
85280
  if (this.seqObj) {
84653
85281
  var dbcsCode = this.seqObj[DEF_CHAR];
@@ -84678,7 +85306,7 @@ var require_dbcs_codec = __commonJS({
84678
85306
  this.gb18030 = codec2.gb18030;
84679
85307
  }
84680
85308
  DBCSDecoder.prototype.write = function(buf) {
84681
- var newBuf = Buffer3.alloc(buf.length * 2);
85309
+ var newBuf = Buffer2.alloc(buf.length * 2);
84682
85310
  var nodeIdx = this.nodeIdx;
84683
85311
  var prevBytes = this.prevBytes;
84684
85312
  var prevOffset = this.prevBytes.length;
@@ -86287,7 +86915,7 @@ var require_encodings = __commonJS({
86287
86915
  var require_streams = __commonJS({
86288
86916
  "../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/lib/streams.js"(exports2, module2) {
86289
86917
  "use strict";
86290
- var Buffer3 = require_safer().Buffer;
86918
+ var Buffer2 = require_safer().Buffer;
86291
86919
  module2.exports = function(streamModule) {
86292
86920
  var Transform = streamModule.Transform;
86293
86921
  function IconvLiteEncoderStream(conv, options) {
@@ -86327,7 +86955,7 @@ var require_streams = __commonJS({
86327
86955
  chunks.push(chunk);
86328
86956
  });
86329
86957
  this.on("end", function() {
86330
- cb(null, Buffer3.concat(chunks));
86958
+ cb(null, Buffer2.concat(chunks));
86331
86959
  });
86332
86960
  return this;
86333
86961
  };
@@ -86341,7 +86969,7 @@ var require_streams = __commonJS({
86341
86969
  constructor: { value: IconvLiteDecoderStream }
86342
86970
  });
86343
86971
  IconvLiteDecoderStream.prototype._transform = function(chunk, encoding, done) {
86344
- if (!Buffer3.isBuffer(chunk) && !(chunk instanceof Uint8Array)) {
86972
+ if (!Buffer2.isBuffer(chunk) && !(chunk instanceof Uint8Array)) {
86345
86973
  return done(new Error("Iconv decoding stream needs buffers as its input."));
86346
86974
  }
86347
86975
  try {
@@ -86384,7 +87012,7 @@ var require_streams = __commonJS({
86384
87012
  var require_lib3 = __commonJS({
86385
87013
  "../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/lib/index.js"(exports2, module2) {
86386
87014
  "use strict";
86387
- var Buffer3 = require_safer().Buffer;
87015
+ var Buffer2 = require_safer().Buffer;
86388
87016
  var bomHandling = require_bom_handling();
86389
87017
  var mergeModules = require_merge_exports();
86390
87018
  module2.exports.encodings = null;
@@ -86395,7 +87023,7 @@ var require_lib3 = __commonJS({
86395
87023
  var encoder = module2.exports.getEncoder(encoding, options);
86396
87024
  var res = encoder.write(str);
86397
87025
  var trail = encoder.end();
86398
- return trail && trail.length > 0 ? Buffer3.concat([res, trail]) : res;
87026
+ return trail && trail.length > 0 ? Buffer2.concat([res, trail]) : res;
86399
87027
  };
86400
87028
  module2.exports.decode = function decode3(buf, encoding, options) {
86401
87029
  if (typeof buf === "string") {
@@ -86403,7 +87031,7 @@ var require_lib3 = __commonJS({
86403
87031
  console.error("Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding");
86404
87032
  module2.exports.skipDecodeWarning = true;
86405
87033
  }
86406
- buf = Buffer3.from("" + (buf || ""), "binary");
87034
+ buf = Buffer2.from("" + (buf || ""), "binary");
86407
87035
  }
86408
87036
  var decoder = module2.exports.getDecoder(encoding, options);
86409
87037
  var res = decoder.write(buf);
@@ -87123,9 +87751,9 @@ var init_prompt = __esm({
87123
87751
  init_utils();
87124
87752
  init_baseUI();
87125
87753
  _ = {
87126
- set: (obj, path29 = "", value) => {
87754
+ set: (obj, path28 = "", value) => {
87127
87755
  let pointer = obj;
87128
- path29.split(".").forEach((key, index, arr) => {
87756
+ path28.split(".").forEach((key, index, arr) => {
87129
87757
  if (key === "__proto__" || key === "constructor") return;
87130
87758
  if (index === arr.length - 1) {
87131
87759
  pointer[key] = value;
@@ -87135,8 +87763,8 @@ var init_prompt = __esm({
87135
87763
  pointer = pointer[key];
87136
87764
  });
87137
87765
  },
87138
- get: (obj, path29 = "", defaultValue) => {
87139
- const travel = (regexp) => String.prototype.split.call(path29, regexp).filter(Boolean).reduce(
87766
+ get: (obj, path28 = "", defaultValue) => {
87767
+ const travel = (regexp) => String.prototype.split.call(path28, regexp).filter(Boolean).reduce(
87140
87768
  // @ts-expect-error implicit any on res[key]
87141
87769
  (res, key) => res !== null && res !== void 0 ? res[key] : res,
87142
87770
  obj
@@ -87452,7 +88080,7 @@ var init_mjs = __esm({
87452
88080
  "../../node_modules/signal-exit/dist/mjs/index.js"() {
87453
88081
  "use strict";
87454
88082
  init_signals();
87455
- 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";
88083
+ 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";
87456
88084
  kExitEmitter = /* @__PURE__ */ Symbol.for("signal-exit emitter");
87457
88085
  global2 = globalThis;
87458
88086
  ObjectDefineProperty = Object.defineProperty.bind(Object);
@@ -87545,15 +88173,15 @@ var init_mjs = __esm({
87545
88173
  #originalProcessReallyExit;
87546
88174
  #sigListeners = {};
87547
88175
  #loaded = false;
87548
- constructor(process19) {
88176
+ constructor(process13) {
87549
88177
  super();
87550
- this.#process = process19;
88178
+ this.#process = process13;
87551
88179
  this.#sigListeners = {};
87552
88180
  for (const sig of signals) {
87553
88181
  this.#sigListeners[sig] = () => {
87554
88182
  const listeners = this.#process.listeners(sig);
87555
88183
  let { count } = this.#emitter;
87556
- const p = process19;
88184
+ const p = process13;
87557
88185
  if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
87558
88186
  count += p.__signal_exit_emitter__.count;
87559
88187
  }
@@ -87562,12 +88190,12 @@ var init_mjs = __esm({
87562
88190
  const ret = this.#emitter.emit("exit", null, sig);
87563
88191
  const s = sig === "SIGHUP" ? this.#hupSig : sig;
87564
88192
  if (!ret)
87565
- process19.kill(process19.pid, s);
88193
+ process13.kill(process13.pid, s);
87566
88194
  }
87567
88195
  };
87568
88196
  }
87569
- this.#originalProcessReallyExit = process19.reallyExit;
87570
- this.#originalProcessEmit = process19.emit;
88197
+ this.#originalProcessReallyExit = process13.reallyExit;
88198
+ this.#originalProcessEmit = process13.emit;
87571
88199
  }
87572
88200
  onExit(cb, opts) {
87573
88201
  if (!processOk(this.#process)) {
@@ -88432,523 +89060,6 @@ init_daemon_p2p2();
88432
89060
  init_source2();
88433
89061
  init_lib();
88434
89062
  init_ora();
88435
-
88436
- // ../../node_modules/open/index.js
88437
- var import_node_process15 = __toESM(require("process"), 1);
88438
- var import_node_buffer = require("buffer");
88439
- var import_node_path3 = __toESM(require("path"), 1);
88440
- var import_node_url = require("url");
88441
- var import_node_util5 = require("util");
88442
- var import_node_child_process5 = __toESM(require("child_process"), 1);
88443
- var import_promises5 = __toESM(require("fs/promises"), 1);
88444
-
88445
- // ../../node_modules/wsl-utils/index.js
88446
- var import_node_process11 = __toESM(require("process"), 1);
88447
- var import_promises4 = __toESM(require("fs/promises"), 1);
88448
-
88449
- // ../../node_modules/is-wsl/index.js
88450
- var import_node_process10 = __toESM(require("process"), 1);
88451
- var import_node_os5 = __toESM(require("os"), 1);
88452
- var import_node_fs5 = __toESM(require("fs"), 1);
88453
-
88454
- // ../../node_modules/is-inside-container/index.js
88455
- var import_node_fs4 = __toESM(require("fs"), 1);
88456
-
88457
- // ../../node_modules/is-docker/index.js
88458
- var import_node_fs3 = __toESM(require("fs"), 1);
88459
- var isDockerCached;
88460
- function hasDockerEnv() {
88461
- try {
88462
- import_node_fs3.default.statSync("/.dockerenv");
88463
- return true;
88464
- } catch {
88465
- return false;
88466
- }
88467
- }
88468
- function hasDockerCGroup() {
88469
- try {
88470
- return import_node_fs3.default.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
88471
- } catch {
88472
- return false;
88473
- }
88474
- }
88475
- function isDocker() {
88476
- if (isDockerCached === void 0) {
88477
- isDockerCached = hasDockerEnv() || hasDockerCGroup();
88478
- }
88479
- return isDockerCached;
88480
- }
88481
-
88482
- // ../../node_modules/is-inside-container/index.js
88483
- var cachedResult;
88484
- var hasContainerEnv = () => {
88485
- try {
88486
- import_node_fs4.default.statSync("/run/.containerenv");
88487
- return true;
88488
- } catch {
88489
- return false;
88490
- }
88491
- };
88492
- function isInsideContainer() {
88493
- if (cachedResult === void 0) {
88494
- cachedResult = hasContainerEnv() || isDocker();
88495
- }
88496
- return cachedResult;
88497
- }
88498
-
88499
- // ../../node_modules/is-wsl/index.js
88500
- var isWsl = () => {
88501
- if (import_node_process10.default.platform !== "linux") {
88502
- return false;
88503
- }
88504
- if (import_node_os5.default.release().toLowerCase().includes("microsoft")) {
88505
- if (isInsideContainer()) {
88506
- return false;
88507
- }
88508
- return true;
88509
- }
88510
- try {
88511
- if (import_node_fs5.default.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft")) {
88512
- return !isInsideContainer();
88513
- }
88514
- } catch {
88515
- }
88516
- if (import_node_fs5.default.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || import_node_fs5.default.existsSync("/run/WSL")) {
88517
- return !isInsideContainer();
88518
- }
88519
- return false;
88520
- };
88521
- var is_wsl_default = import_node_process10.default.env.__IS_WSL_TEST__ ? isWsl : isWsl();
88522
-
88523
- // ../../node_modules/wsl-utils/index.js
88524
- var wslDrivesMountPoint = /* @__PURE__ */ (() => {
88525
- const defaultMountPoint = "/mnt/";
88526
- let mountPoint;
88527
- return async function() {
88528
- if (mountPoint) {
88529
- return mountPoint;
88530
- }
88531
- const configFilePath = "/etc/wsl.conf";
88532
- let isConfigFileExists = false;
88533
- try {
88534
- await import_promises4.default.access(configFilePath, import_promises4.constants.F_OK);
88535
- isConfigFileExists = true;
88536
- } catch {
88537
- }
88538
- if (!isConfigFileExists) {
88539
- return defaultMountPoint;
88540
- }
88541
- const configContent = await import_promises4.default.readFile(configFilePath, { encoding: "utf8" });
88542
- const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
88543
- if (!configMountPoint) {
88544
- return defaultMountPoint;
88545
- }
88546
- mountPoint = configMountPoint.groups.mountPoint.trim();
88547
- mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
88548
- return mountPoint;
88549
- };
88550
- })();
88551
- var powerShellPathFromWsl = async () => {
88552
- const mountPoint = await wslDrivesMountPoint();
88553
- return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
88554
- };
88555
- var powerShellPath = async () => {
88556
- if (is_wsl_default) {
88557
- return powerShellPathFromWsl();
88558
- }
88559
- return `${import_node_process11.default.env.SYSTEMROOT || import_node_process11.default.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
88560
- };
88561
-
88562
- // ../../node_modules/define-lazy-prop/index.js
88563
- function defineLazyProperty(object2, propertyName, valueGetter) {
88564
- const define = (value) => Object.defineProperty(object2, propertyName, { value, enumerable: true, writable: true });
88565
- Object.defineProperty(object2, propertyName, {
88566
- configurable: true,
88567
- enumerable: true,
88568
- get() {
88569
- const result = valueGetter();
88570
- define(result);
88571
- return result;
88572
- },
88573
- set(value) {
88574
- define(value);
88575
- }
88576
- });
88577
- return object2;
88578
- }
88579
-
88580
- // ../../node_modules/default-browser/index.js
88581
- var import_node_util4 = require("util");
88582
- var import_node_process14 = __toESM(require("process"), 1);
88583
- var import_node_child_process4 = require("child_process");
88584
-
88585
- // ../../node_modules/default-browser-id/index.js
88586
- var import_node_util = require("util");
88587
- var import_node_process12 = __toESM(require("process"), 1);
88588
- var import_node_child_process = require("child_process");
88589
- var execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
88590
- async function defaultBrowserId() {
88591
- if (import_node_process12.default.platform !== "darwin") {
88592
- throw new Error("macOS only");
88593
- }
88594
- const { stdout } = await execFileAsync("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
88595
- const match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
88596
- const browserId = match?.groups.id ?? "com.apple.Safari";
88597
- if (browserId === "com.apple.safari") {
88598
- return "com.apple.Safari";
88599
- }
88600
- return browserId;
88601
- }
88602
-
88603
- // ../../node_modules/run-applescript/index.js
88604
- var import_node_process13 = __toESM(require("process"), 1);
88605
- var import_node_util2 = require("util");
88606
- var import_node_child_process2 = require("child_process");
88607
- var execFileAsync2 = (0, import_node_util2.promisify)(import_node_child_process2.execFile);
88608
- async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
88609
- if (import_node_process13.default.platform !== "darwin") {
88610
- throw new Error("macOS only");
88611
- }
88612
- const outputArguments = humanReadableOutput ? [] : ["-ss"];
88613
- const execOptions = {};
88614
- if (signal) {
88615
- execOptions.signal = signal;
88616
- }
88617
- const { stdout } = await execFileAsync2("osascript", ["-e", script, outputArguments], execOptions);
88618
- return stdout.trim();
88619
- }
88620
-
88621
- // ../../node_modules/bundle-name/index.js
88622
- async function bundleName(bundleId) {
88623
- return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string
88624
- tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
88625
- }
88626
-
88627
- // ../../node_modules/default-browser/windows.js
88628
- var import_node_util3 = require("util");
88629
- var import_node_child_process3 = require("child_process");
88630
- var execFileAsync3 = (0, import_node_util3.promisify)(import_node_child_process3.execFile);
88631
- var windowsBrowserProgIds = {
88632
- MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
88633
- // The missing `L` is correct.
88634
- MSEdgeBHTML: { name: "Edge Beta", id: "com.microsoft.edge.beta" },
88635
- MSEdgeDHTML: { name: "Edge Dev", id: "com.microsoft.edge.dev" },
88636
- AppXq0fevzme2pys62n3e0fbqa7peapykr8v: { name: "Edge", id: "com.microsoft.edge.old" },
88637
- ChromeHTML: { name: "Chrome", id: "com.google.chrome" },
88638
- ChromeBHTML: { name: "Chrome Beta", id: "com.google.chrome.beta" },
88639
- ChromeDHTML: { name: "Chrome Dev", id: "com.google.chrome.dev" },
88640
- ChromiumHTM: { name: "Chromium", id: "org.chromium.Chromium" },
88641
- BraveHTML: { name: "Brave", id: "com.brave.Browser" },
88642
- BraveBHTML: { name: "Brave Beta", id: "com.brave.Browser.beta" },
88643
- BraveDHTML: { name: "Brave Dev", id: "com.brave.Browser.dev" },
88644
- BraveSSHTM: { name: "Brave Nightly", id: "com.brave.Browser.nightly" },
88645
- FirefoxURL: { name: "Firefox", id: "org.mozilla.firefox" },
88646
- OperaStable: { name: "Opera", id: "com.operasoftware.Opera" },
88647
- VivaldiHTM: { name: "Vivaldi", id: "com.vivaldi.Vivaldi" },
88648
- "IE.HTTP": { name: "Internet Explorer", id: "com.microsoft.ie" }
88649
- };
88650
- var _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
88651
- var UnknownBrowserError = class extends Error {
88652
- };
88653
- async function defaultBrowser(_execFileAsync = execFileAsync3) {
88654
- const { stdout } = await _execFileAsync("reg", [
88655
- "QUERY",
88656
- " HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
88657
- "/v",
88658
- "ProgId"
88659
- ]);
88660
- const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
88661
- if (!match) {
88662
- throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
88663
- }
88664
- const { id } = match.groups;
88665
- const dotIndex = id.lastIndexOf(".");
88666
- const hyphenIndex = id.lastIndexOf("-");
88667
- const baseIdByDot = dotIndex === -1 ? void 0 : id.slice(0, dotIndex);
88668
- const baseIdByHyphen = hyphenIndex === -1 ? void 0 : id.slice(0, hyphenIndex);
88669
- return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? { name: id, id };
88670
- }
88671
-
88672
- // ../../node_modules/default-browser/index.js
88673
- var execFileAsync4 = (0, import_node_util4.promisify)(import_node_child_process4.execFile);
88674
- var titleize = (string4) => string4.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
88675
- async function defaultBrowser2() {
88676
- if (import_node_process14.default.platform === "darwin") {
88677
- const id = await defaultBrowserId();
88678
- const name = await bundleName(id);
88679
- return { name, id };
88680
- }
88681
- if (import_node_process14.default.platform === "linux") {
88682
- const { stdout } = await execFileAsync4("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
88683
- const id = stdout.trim();
88684
- const name = titleize(id.replace(/.desktop$/, "").replace("-", " "));
88685
- return { name, id };
88686
- }
88687
- if (import_node_process14.default.platform === "win32") {
88688
- return defaultBrowser();
88689
- }
88690
- throw new Error("Only macOS, Linux, and Windows are supported");
88691
- }
88692
-
88693
- // ../../node_modules/open/index.js
88694
- var import_meta = {};
88695
- var execFile5 = (0, import_node_util5.promisify)(import_node_child_process5.default.execFile);
88696
- var __dirname2 = import_node_path3.default.dirname((0, import_node_url.fileURLToPath)(import_meta.url));
88697
- var localXdgOpenPath = import_node_path3.default.join(__dirname2, "xdg-open");
88698
- var { platform: platform12, arch: arch3 } = import_node_process15.default;
88699
- async function getWindowsDefaultBrowserFromWsl() {
88700
- const powershellPath = await powerShellPath();
88701
- const rawCommand = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
88702
- const encodedCommand = import_node_buffer.Buffer.from(rawCommand, "utf16le").toString("base64");
88703
- const { stdout } = await execFile5(
88704
- powershellPath,
88705
- [
88706
- "-NoProfile",
88707
- "-NonInteractive",
88708
- "-ExecutionPolicy",
88709
- "Bypass",
88710
- "-EncodedCommand",
88711
- encodedCommand
88712
- ],
88713
- { encoding: "utf8" }
88714
- );
88715
- const progId = stdout.trim();
88716
- const browserMap = {
88717
- ChromeHTML: "com.google.chrome",
88718
- BraveHTML: "com.brave.Browser",
88719
- MSEdgeHTM: "com.microsoft.edge",
88720
- FirefoxURL: "org.mozilla.firefox"
88721
- };
88722
- return browserMap[progId] ? { id: browserMap[progId] } : {};
88723
- }
88724
- var pTryEach = async (array2, mapper) => {
88725
- let latestError;
88726
- for (const item of array2) {
88727
- try {
88728
- return await mapper(item);
88729
- } catch (error48) {
88730
- latestError = error48;
88731
- }
88732
- }
88733
- throw latestError;
88734
- };
88735
- var baseOpen = async (options) => {
88736
- options = {
88737
- wait: false,
88738
- background: false,
88739
- newInstance: false,
88740
- allowNonzeroExitCode: false,
88741
- ...options
88742
- };
88743
- if (Array.isArray(options.app)) {
88744
- return pTryEach(options.app, (singleApp) => baseOpen({
88745
- ...options,
88746
- app: singleApp
88747
- }));
88748
- }
88749
- let { name: app, arguments: appArguments = [] } = options.app ?? {};
88750
- appArguments = [...appArguments];
88751
- if (Array.isArray(app)) {
88752
- return pTryEach(app, (appName) => baseOpen({
88753
- ...options,
88754
- app: {
88755
- name: appName,
88756
- arguments: appArguments
88757
- }
88758
- }));
88759
- }
88760
- if (app === "browser" || app === "browserPrivate") {
88761
- const ids = {
88762
- "com.google.chrome": "chrome",
88763
- "google-chrome.desktop": "chrome",
88764
- "com.brave.Browser": "brave",
88765
- "org.mozilla.firefox": "firefox",
88766
- "firefox.desktop": "firefox",
88767
- "com.microsoft.msedge": "edge",
88768
- "com.microsoft.edge": "edge",
88769
- "com.microsoft.edgemac": "edge",
88770
- "microsoft-edge.desktop": "edge"
88771
- };
88772
- const flags = {
88773
- chrome: "--incognito",
88774
- brave: "--incognito",
88775
- firefox: "--private-window",
88776
- edge: "--inPrivate"
88777
- };
88778
- const browser = is_wsl_default ? await getWindowsDefaultBrowserFromWsl() : await defaultBrowser2();
88779
- if (browser.id in ids) {
88780
- const browserName = ids[browser.id];
88781
- if (app === "browserPrivate") {
88782
- appArguments.push(flags[browserName]);
88783
- }
88784
- return baseOpen({
88785
- ...options,
88786
- app: {
88787
- name: apps[browserName],
88788
- arguments: appArguments
88789
- }
88790
- });
88791
- }
88792
- throw new Error(`${browser.name} is not supported as a default browser`);
88793
- }
88794
- let command;
88795
- const cliArguments = [];
88796
- const childProcessOptions = {};
88797
- if (platform12 === "darwin") {
88798
- command = "open";
88799
- if (options.wait) {
88800
- cliArguments.push("--wait-apps");
88801
- }
88802
- if (options.background) {
88803
- cliArguments.push("--background");
88804
- }
88805
- if (options.newInstance) {
88806
- cliArguments.push("--new");
88807
- }
88808
- if (app) {
88809
- cliArguments.push("-a", app);
88810
- }
88811
- } else if (platform12 === "win32" || is_wsl_default && !isInsideContainer() && !app) {
88812
- command = await powerShellPath();
88813
- cliArguments.push(
88814
- "-NoProfile",
88815
- "-NonInteractive",
88816
- "-ExecutionPolicy",
88817
- "Bypass",
88818
- "-EncodedCommand"
88819
- );
88820
- if (!is_wsl_default) {
88821
- childProcessOptions.windowsVerbatimArguments = true;
88822
- }
88823
- const encodedArguments = ["Start"];
88824
- if (options.wait) {
88825
- encodedArguments.push("-Wait");
88826
- }
88827
- if (app) {
88828
- encodedArguments.push(`"\`"${app}\`""`);
88829
- if (options.target) {
88830
- appArguments.push(options.target);
88831
- }
88832
- } else if (options.target) {
88833
- encodedArguments.push(`"${options.target}"`);
88834
- }
88835
- if (appArguments.length > 0) {
88836
- appArguments = appArguments.map((argument) => `"\`"${argument}\`""`);
88837
- encodedArguments.push("-ArgumentList", appArguments.join(","));
88838
- }
88839
- options.target = import_node_buffer.Buffer.from(encodedArguments.join(" "), "utf16le").toString("base64");
88840
- } else {
88841
- if (app) {
88842
- command = app;
88843
- } else {
88844
- const isBundled = !__dirname2 || __dirname2 === "/";
88845
- let exeLocalXdgOpen = false;
88846
- try {
88847
- await import_promises5.default.access(localXdgOpenPath, import_promises5.constants.X_OK);
88848
- exeLocalXdgOpen = true;
88849
- } catch {
88850
- }
88851
- const useSystemXdgOpen = import_node_process15.default.versions.electron ?? (platform12 === "android" || isBundled || !exeLocalXdgOpen);
88852
- command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
88853
- }
88854
- if (appArguments.length > 0) {
88855
- cliArguments.push(...appArguments);
88856
- }
88857
- if (!options.wait) {
88858
- childProcessOptions.stdio = "ignore";
88859
- childProcessOptions.detached = true;
88860
- }
88861
- }
88862
- if (platform12 === "darwin" && appArguments.length > 0) {
88863
- cliArguments.push("--args", ...appArguments);
88864
- }
88865
- if (options.target) {
88866
- cliArguments.push(options.target);
88867
- }
88868
- const subprocess = import_node_child_process5.default.spawn(command, cliArguments, childProcessOptions);
88869
- if (options.wait) {
88870
- return new Promise((resolve16, reject) => {
88871
- subprocess.once("error", reject);
88872
- subprocess.once("close", (exitCode) => {
88873
- if (!options.allowNonzeroExitCode && exitCode > 0) {
88874
- reject(new Error(`Exited with code ${exitCode}`));
88875
- return;
88876
- }
88877
- resolve16(subprocess);
88878
- });
88879
- });
88880
- }
88881
- subprocess.unref();
88882
- return subprocess;
88883
- };
88884
- var open2 = (target, options) => {
88885
- if (typeof target !== "string") {
88886
- throw new TypeError("Expected a `target`");
88887
- }
88888
- return baseOpen({
88889
- ...options,
88890
- target
88891
- });
88892
- };
88893
- function detectArchBinary(binary) {
88894
- if (typeof binary === "string" || Array.isArray(binary)) {
88895
- return binary;
88896
- }
88897
- const { [arch3]: archBinary } = binary;
88898
- if (!archBinary) {
88899
- throw new Error(`${arch3} is not supported`);
88900
- }
88901
- return archBinary;
88902
- }
88903
- function detectPlatformBinary({ [platform12]: platformBinary }, { wsl }) {
88904
- if (wsl && is_wsl_default) {
88905
- return detectArchBinary(wsl);
88906
- }
88907
- if (!platformBinary) {
88908
- throw new Error(`${platform12} is not supported`);
88909
- }
88910
- return detectArchBinary(platformBinary);
88911
- }
88912
- var apps = {};
88913
- defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
88914
- darwin: "google chrome",
88915
- win32: "chrome",
88916
- linux: ["google-chrome", "google-chrome-stable", "chromium"]
88917
- }, {
88918
- wsl: {
88919
- ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
88920
- x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
88921
- }
88922
- }));
88923
- defineLazyProperty(apps, "brave", () => detectPlatformBinary({
88924
- darwin: "brave browser",
88925
- win32: "brave",
88926
- linux: ["brave-browser", "brave"]
88927
- }, {
88928
- wsl: {
88929
- ia32: "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",
88930
- x64: ["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe", "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]
88931
- }
88932
- }));
88933
- defineLazyProperty(apps, "firefox", () => detectPlatformBinary({
88934
- darwin: "firefox",
88935
- win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
88936
- linux: "firefox"
88937
- }, {
88938
- wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
88939
- }));
88940
- defineLazyProperty(apps, "edge", () => detectPlatformBinary({
88941
- darwin: "microsoft edge",
88942
- win32: "msedge",
88943
- linux: ["microsoft-edge", "microsoft-edge-dev"]
88944
- }, {
88945
- wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
88946
- }));
88947
- defineLazyProperty(apps, "browser", () => "browser");
88948
- defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
88949
- var open_default = open2;
88950
-
88951
- // src/wizard.ts
88952
89063
  init_src();
88953
89064
  init_version();
88954
89065
  var SERVER_URL = process.env.ADHDEV_SERVER_URL || "https://api.adhf.dev";
@@ -88959,6 +89070,10 @@ ${source_default2.cyan("\u2551")} ${source_default2.gray("Agent Dashboard Hub f
88959
89070
  ${source_default2.cyan("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")}
88960
89071
  `;
88961
89072
  var DIVIDER = source_default2.gray("\u2500".repeat(44));
89073
+ async function openBrowser(url2) {
89074
+ const mod = await import("open");
89075
+ return mod.default(url2);
89076
+ }
88962
89077
  function hasCloudMachineAuth() {
88963
89078
  const config2 = loadConfig();
88964
89079
  return Boolean(config2.machineSecret && config2.machineSecret.trim());
@@ -89008,9 +89123,9 @@ async function runWizard(options = {}) {
89008
89123
  }
89009
89124
  async function checkForUpdate() {
89010
89125
  try {
89011
- const { execFileSync: execFileSync6 } = await import("child_process");
89126
+ const { execFileSync: execFileSync5 } = await import("child_process");
89012
89127
  const currentVersion = resolvePackageVersion();
89013
- const latestVersion = readLatestPublishedCliVersion(execFileSync6);
89128
+ const latestVersion = readLatestPublishedCliVersion(execFileSync5);
89014
89129
  if (!latestVersion) return;
89015
89130
  if (!currentVersion || !latestVersion || currentVersion === latestVersion) return;
89016
89131
  console.log(source_default2.yellow(` Update available: ${currentVersion} \u2192 ${latestVersion}`));
@@ -89027,7 +89142,7 @@ async function checkForUpdate() {
89027
89142
  const spinner = (await Promise.resolve().then(() => (init_ora(), ora_exports))).default("Updating adhdev CLI...").start();
89028
89143
  try {
89029
89144
  const installCommand = buildPinnedGlobalInstallCommand({ packageName: "adhdev", targetVersion: "latest" });
89030
- execFileSync6(installCommand.command, installCommand.args, {
89145
+ execFileSync5(installCommand.command, installCommand.args, {
89031
89146
  encoding: "utf-8",
89032
89147
  timeout: 6e4,
89033
89148
  stdio: ["pipe", "pipe", "pipe"]
@@ -89111,15 +89226,15 @@ async function loginFlow() {
89111
89226
  let verificationUrl;
89112
89227
  try {
89113
89228
  const config2 = loadConfig();
89114
- const os29 = await import("os");
89229
+ const os28 = await import("os");
89115
89230
  const res = await fetch(`${SERVER_URL}/auth/cli/init`, {
89116
89231
  method: "POST",
89117
89232
  headers: { "Content-Type": "application/json" },
89118
89233
  body: JSON.stringify({
89119
89234
  clientMachineId: config2.machineId,
89120
- hostname: os29.hostname(),
89121
- platform: os29.platform(),
89122
- arch: os29.arch()
89235
+ hostname: os28.hostname(),
89236
+ platform: os28.platform(),
89237
+ arch: os28.arch()
89123
89238
  })
89124
89239
  });
89125
89240
  if (!res.ok) {
@@ -89143,7 +89258,7 @@ async function loginFlow() {
89143
89258
  console.log(source_default2.gray(` Opening: ${verificationUrl}`));
89144
89259
  console.log();
89145
89260
  try {
89146
- await open_default(verificationUrl);
89261
+ await openBrowser(verificationUrl);
89147
89262
  console.log(source_default2.green(" \u2713 Browser opened \u2014 please sign in and approve"));
89148
89263
  } catch {
89149
89264
  console.log(source_default2.yellow(` \u26A0 Could not open browser. Visit: ${verificationUrl}`));
@@ -89224,10 +89339,10 @@ async function startDaemonFlow() {
89224
89339
  const { execSync: execSync7 } = await import("child_process");
89225
89340
  const { getCurrentDaemonLogPath: getCurrentDaemonLogPath2 } = await Promise.resolve().then(() => (init_src(), src_exports));
89226
89341
  const logPath = getCurrentDaemonLogPath2();
89227
- const os29 = await import("os");
89228
- const platform13 = os29.platform();
89342
+ const os28 = await import("os");
89343
+ const platform12 = os28.platform();
89229
89344
  try {
89230
- if (platform13 === "win32") {
89345
+ if (platform12 === "win32") {
89231
89346
  execSync7("start /B adhdev daemon >NUL 2>&1", {
89232
89347
  timeout: 3e3,
89233
89348
  stdio: "ignore",