adhdev 0.9.43 → 0.9.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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);
@@ -11817,7 +12299,9 @@ var provider_cli_adapter_exports = {};
11817
12299
  __export(provider_cli_adapter_exports, {
11818
12300
  ProviderCliAdapter: () => ProviderCliAdapter,
11819
12301
  appendBoundedText: () => appendBoundedText,
11820
- normalizeCliProviderForRuntime: () => normalizeCliProviderForRuntime
12302
+ normalizeCliProviderForRuntime: () => normalizeCliProviderForRuntime,
12303
+ sanitizeCliStandardMessageContent: () => sanitizeCliStandardMessageContent,
12304
+ trimLastAssistantEchoForCliMessages: () => trimLastAssistantEchoForCliMessages
11821
12305
  });
11822
12306
  function normalizeComparableTranscriptText(value) {
11823
12307
  return sanitizeTerminalText(String(value || "")).replace(/\s+/g, " ").trim();
@@ -11857,7 +12341,76 @@ function appendBoundedText(current, chunk, maxChars) {
11857
12341
  if (current.length <= keepFromCurrent) return current + chunk;
11858
12342
  return current.slice(-keepFromCurrent) + chunk;
11859
12343
  }
11860
- var os12, ProviderCliAdapter;
12344
+ function isLikelyCommittedActivityPrefixContinuation(line) {
12345
+ const trimmed = String(line || "").trim();
12346
+ if (!trimmed) return false;
12347
+ if (COMMITTED_ACTIVITY_PREFIX_BLOCK_RE.test(trimmed)) return false;
12348
+ if (/\s/.test(trimmed)) return false;
12349
+ if (/[가-힣]/.test(trimmed)) return false;
12350
+ if (trimmed.length > 96) return false;
12351
+ return /^[A-Za-z0-9_./:@+%=-]+$/.test(trimmed);
12352
+ }
12353
+ function parseCommittedActivityPrefixBlock(lines, index) {
12354
+ const first = String(lines[index] || "").trim();
12355
+ if (!COMMITTED_ACTIVITY_PREFIX_BLOCK_RE.test(first)) return null;
12356
+ const parts = [first];
12357
+ let nextIndex = index + 1;
12358
+ while (nextIndex < lines.length && isLikelyCommittedActivityPrefixContinuation(lines[nextIndex])) {
12359
+ parts.push(String(lines[nextIndex] || "").trim());
12360
+ nextIndex += 1;
12361
+ }
12362
+ return { label: parts.join(""), nextIndex };
12363
+ }
12364
+ function sanitizeCliStandardMessageContent(content) {
12365
+ const source = String(content || "").trim();
12366
+ if (!source) return "";
12367
+ const lines = source.split(/\r?\n/);
12368
+ if (lines.length < 4) return source;
12369
+ const counts = /* @__PURE__ */ new Map();
12370
+ for (let index = 0; index < lines.length; index += 1) {
12371
+ const block = parseCommittedActivityPrefixBlock(lines, index);
12372
+ if (!block) continue;
12373
+ counts.set(block.label, (counts.get(block.label) || 0) + 1);
12374
+ index = block.nextIndex - 1;
12375
+ }
12376
+ const repeatedLabels = new Set(
12377
+ Array.from(counts.entries()).filter(([, count]) => count >= 3).map(([label]) => label)
12378
+ );
12379
+ if (repeatedLabels.size === 0) return source;
12380
+ const stripped = [];
12381
+ let removed = 0;
12382
+ for (let index = 0; index < lines.length; index += 1) {
12383
+ const block = parseCommittedActivityPrefixBlock(lines, index);
12384
+ if (block && repeatedLabels.has(block.label)) {
12385
+ removed += 1;
12386
+ index = block.nextIndex - 1;
12387
+ continue;
12388
+ }
12389
+ stripped.push(lines[index]);
12390
+ }
12391
+ const next = stripped.join("\n").replace(/\n{3,}/g, "\n\n").trim();
12392
+ return removed >= 3 && next.length >= 80 ? next : source;
12393
+ }
12394
+ function sanitizeCommittedMessageForDisplay(message) {
12395
+ if (!message || message.role !== "assistant" || (message.kind || "standard") !== "standard") return message;
12396
+ const content = sanitizeCliStandardMessageContent(message.content);
12397
+ if (content === message.content) return message;
12398
+ return { ...message, content };
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
+ }
12413
+ var os12, COMMITTED_ACTIVITY_PREFIX_BLOCK_RE, ProviderCliAdapter;
11861
12414
  var init_provider_cli_adapter = __esm({
11862
12415
  "../../oss/packages/daemon-core/src/cli-adapters/provider-cli-adapter.ts"() {
11863
12416
  "use strict";
@@ -11873,6 +12426,7 @@ var init_provider_cli_adapter = __esm({
11873
12426
  init_provider_cli_config();
11874
12427
  init_provider_cli_runtime();
11875
12428
  init_provider_cli_shared();
12429
+ COMMITTED_ACTIVITY_PREFIX_BLOCK_RE = /^(?:📖|💻|🔎|📚|📋|✏️|📝|🔧|🛠️|⚙️)\s+(.+)$/;
11876
12430
  ProviderCliAdapter = class _ProviderCliAdapter {
11877
12431
  constructor(provider, workingDir, extraArgs = [], transportFactory = new NodePtyTransportFactory()) {
11878
12432
  this.extraArgs = extraArgs;
@@ -12053,7 +12607,14 @@ var init_provider_cli_adapter = __esm({
12053
12607
  }
12054
12608
  return null;
12055
12609
  }
12610
+ providerOwnsTranscript() {
12611
+ return this.provider.transcriptAuthority === "provider";
12612
+ }
12613
+ shouldUseFullProviderTranscriptContext() {
12614
+ return this.providerOwnsTranscript() && this.provider.transcriptContext === "full";
12615
+ }
12056
12616
  selectParseBaseMessages(baseMessages) {
12617
+ if (this.shouldUseFullProviderTranscriptContext()) return baseMessages;
12057
12618
  if (baseMessages.length <= _ProviderCliAdapter.PARSE_MESSAGE_TAIL_LIMIT) return baseMessages;
12058
12619
  return baseMessages.slice(-_ProviderCliAdapter.PARSE_MESSAGE_TAIL_LIMIT);
12059
12620
  }
@@ -12084,7 +12645,10 @@ var init_provider_cli_adapter = __esm({
12084
12645
  const tailFirst = parseBaseMessages[0];
12085
12646
  if (tailFirst && this.messagesComparable(parsedFirst, tailFirst)) {
12086
12647
  const prefixLength = fullBaseMessages.length - parseBaseMessages.length;
12087
- return [...fullBaseMessages.slice(0, prefixLength), ...parsedMessages];
12648
+ const prefix = fullBaseMessages.slice(0, prefixLength);
12649
+ const shouldSanitizePrefix = !!this.currentTurnScope || this.currentStatus !== "idle" || !!this.activeModal;
12650
+ const nextPrefix = shouldSanitizePrefix ? prefix.map((message) => sanitizeCommittedMessageForDisplay(message)) : prefix;
12651
+ return [...nextPrefix, ...parsedMessages];
12088
12652
  }
12089
12653
  return [...fullBaseMessages, ...parsedMessages];
12090
12654
  }
@@ -12533,9 +13097,7 @@ var init_provider_cli_adapter = __esm({
12533
13097
  );
12534
13098
  }
12535
13099
  trimLastAssistantEcho(messages, prompt2) {
12536
- if (!prompt2) return;
12537
- const last = [...messages].reverse().find((m) => m.role === "assistant" && typeof m.content === "string");
12538
- if (last) last.content = trimPromptEchoPrefix(last.content, prompt2);
13100
+ trimLastAssistantEchoForCliMessages(messages, prompt2);
12539
13101
  }
12540
13102
  clearAllTimers() {
12541
13103
  if (this.responseTimeout) {
@@ -13283,10 +13845,12 @@ var init_provider_cli_adapter = __esm({
13283
13845
  }
13284
13846
  buildCommittedChatMessages() {
13285
13847
  return this.committedMessages.map((message, index) => {
13286
- const contentValue = message.content;
13848
+ const rawContentValue = message.content;
13849
+ const rawContent = typeof rawContentValue === "string" ? rawContentValue : String(rawContentValue || "");
13850
+ const content = message.role === "assistant" && (message.kind || "standard") === "standard" ? sanitizeCliStandardMessageContent(rawContent) : rawContent;
13287
13851
  return buildChatMessage({
13288
13852
  role: message.role,
13289
- content: typeof contentValue === "string" ? contentValue : String(contentValue || ""),
13853
+ content,
13290
13854
  timestamp: message.timestamp,
13291
13855
  kind: message.kind,
13292
13856
  meta: message.meta,
@@ -13387,7 +13951,8 @@ var init_provider_cli_adapter = __esm({
13387
13951
  title: parsed.title || this.cliName,
13388
13952
  messages: hydratedMessages,
13389
13953
  activeModal: parsed.activeModal ?? this.activeModal,
13390
- 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" } : {}
13391
13956
  };
13392
13957
  } else {
13393
13958
  const messages = [...this.committedMessages];
@@ -14279,6 +14844,8 @@ var init_cli_provider_instance = __esm({
14279
14844
  lastCanonicalHermesWatchPath = void 0;
14280
14845
  lastCanonicalClaudeRebuildMtimeMs = 0;
14281
14846
  lastCanonicalClaudeCheckAt = 0;
14847
+ lastCanonicalCodexRebuildMtimeMs = 0;
14848
+ lastCanonicalCodexCheckAt = 0;
14282
14849
  cachedSqliteDb = null;
14283
14850
  cachedSqliteDbPath = null;
14284
14851
  cachedSqliteDbMissingUntil = 0;
@@ -14978,6 +15545,25 @@ ${effect.notification.body || ""}`.trim();
14978
15545
  if (!this.providerSessionId) return false;
14979
15546
  const canonicalHistory = this.provider.canonicalHistory;
14980
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
+ }
14981
15567
  try {
14982
15568
  let rebuilt = false;
14983
15569
  if (canonicalHistory.format === "hermes-json") {
@@ -15011,6 +15597,23 @@ ${effect.notification.body || ""}`.trim();
15011
15597
  if (transcriptMtime > 0 && transcriptMtime <= this.lastCanonicalClaudeRebuildMtimeMs) return true;
15012
15598
  rebuilt = rebuildClaudeSavedHistoryFromNativeProject(this.providerSessionId, this.workingDir);
15013
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();
15014
15617
  }
15015
15618
  if (!rebuilt) return false;
15016
15619
  const restoredHistory = readChatHistory(this.type, 0, Number.MAX_SAFE_INTEGER, this.providerSessionId, 0, this.provider.historyBehavior);
@@ -15029,8 +15632,17 @@ ${effect.notification.body || ""}`.trim();
15029
15632
  restorePersistedHistoryFromCurrentSession() {
15030
15633
  if (!this.providerSessionId) return;
15031
15634
  this.syncCanonicalSavedHistoryIfNeeded();
15032
- this.historyWriter.compactHistorySession(this.type, this.providerSessionId, this.provider.historyBehavior);
15033
- 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
+ })();
15034
15646
  this.historyWriter.seedSessionHistory(
15035
15647
  this.type,
15036
15648
  restoredHistory.messages,
@@ -15357,10 +15969,10 @@ function mergeDefs(...defs) {
15357
15969
  function cloneDef(schema) {
15358
15970
  return mergeDefs(schema._zod.def);
15359
15971
  }
15360
- function getElementAtPath(obj, path29) {
15361
- if (!path29)
15972
+ function getElementAtPath(obj, path28) {
15973
+ if (!path28)
15362
15974
  return obj;
15363
- return path29.reduce((acc, key) => acc?.[key], obj);
15975
+ return path28.reduce((acc, key) => acc?.[key], obj);
15364
15976
  }
15365
15977
  function promiseAllObject(promisesObj) {
15366
15978
  const keys = Object.keys(promisesObj);
@@ -15672,11 +16284,11 @@ function aborted(x, startIndex = 0) {
15672
16284
  }
15673
16285
  return false;
15674
16286
  }
15675
- function prefixIssues(path29, issues) {
16287
+ function prefixIssues(path28, issues) {
15676
16288
  return issues.map((iss) => {
15677
16289
  var _a2;
15678
16290
  (_a2 = iss).path ?? (_a2.path = []);
15679
- iss.path.unshift(path29);
16291
+ iss.path.unshift(path28);
15680
16292
  return iss;
15681
16293
  });
15682
16294
  }
@@ -15919,7 +16531,7 @@ function formatError(error48, mapper = (issue2) => issue2.message) {
15919
16531
  }
15920
16532
  function treeifyError(error48, mapper = (issue2) => issue2.message) {
15921
16533
  const result = { errors: [] };
15922
- const processError = (error49, path29 = []) => {
16534
+ const processError = (error49, path28 = []) => {
15923
16535
  var _a2, _b;
15924
16536
  for (const issue2 of error49.issues) {
15925
16537
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -15929,7 +16541,7 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
15929
16541
  } else if (issue2.code === "invalid_element") {
15930
16542
  processError({ issues: issue2.issues }, issue2.path);
15931
16543
  } else {
15932
- const fullpath = [...path29, ...issue2.path];
16544
+ const fullpath = [...path28, ...issue2.path];
15933
16545
  if (fullpath.length === 0) {
15934
16546
  result.errors.push(mapper(issue2));
15935
16547
  continue;
@@ -15961,8 +16573,8 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
15961
16573
  }
15962
16574
  function toDotPath(_path) {
15963
16575
  const segs = [];
15964
- const path29 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
15965
- for (const seg of path29) {
16576
+ const path28 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
16577
+ for (const seg of path28) {
15966
16578
  if (typeof seg === "number")
15967
16579
  segs.push(`[${seg}]`);
15968
16580
  else if (typeof seg === "symbol")
@@ -28726,13 +29338,13 @@ function resolveRef(ref, ctx) {
28726
29338
  if (!ref.startsWith("#")) {
28727
29339
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
28728
29340
  }
28729
- const path29 = ref.slice(1).split("/").filter(Boolean);
28730
- if (path29.length === 0) {
29341
+ const path28 = ref.slice(1).split("/").filter(Boolean);
29342
+ if (path28.length === 0) {
28731
29343
  return ctx.rootSchema;
28732
29344
  }
28733
29345
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
28734
- if (path29[0] === defsKey) {
28735
- const key = path29[1];
29346
+ if (path28[0] === defsKey) {
29347
+ const key = path28[1];
28736
29348
  if (!key || !ctx.defs[key]) {
28737
29349
  throw new Error(`Reference not found: ${ref}`);
28738
29350
  }
@@ -33486,7 +34098,7 @@ var init_readdirp = __esm({
33486
34098
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
33487
34099
  const statMethod = opts.lstat ? import_promises.lstat : import_promises.stat;
33488
34100
  if (wantBigintFsStats) {
33489
- this._stat = (path29) => statMethod(path29, { bigint: true });
34101
+ this._stat = (path28) => statMethod(path28, { bigint: true });
33490
34102
  } else {
33491
34103
  this._stat = statMethod;
33492
34104
  }
@@ -33511,8 +34123,8 @@ var init_readdirp = __esm({
33511
34123
  const par = this.parent;
33512
34124
  const fil = par && par.files;
33513
34125
  if (fil && fil.length > 0) {
33514
- const { path: path29, depth } = par;
33515
- 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));
33516
34128
  const awaited = await Promise.all(slice);
33517
34129
  for (const entry of awaited) {
33518
34130
  if (!entry)
@@ -33552,21 +34164,21 @@ var init_readdirp = __esm({
33552
34164
  this.reading = false;
33553
34165
  }
33554
34166
  }
33555
- async _exploreDir(path29, depth) {
34167
+ async _exploreDir(path28, depth) {
33556
34168
  let files;
33557
34169
  try {
33558
- files = await (0, import_promises.readdir)(path29, this._rdOptions);
34170
+ files = await (0, import_promises.readdir)(path28, this._rdOptions);
33559
34171
  } catch (error48) {
33560
34172
  this._onError(error48);
33561
34173
  }
33562
- return { files, depth, path: path29 };
34174
+ return { files, depth, path: path28 };
33563
34175
  }
33564
- async _formatEntry(dirent, path29) {
34176
+ async _formatEntry(dirent, path28) {
33565
34177
  let entry;
33566
- const basename9 = this._isDirent ? dirent.name : dirent;
34178
+ const basename10 = this._isDirent ? dirent.name : dirent;
33567
34179
  try {
33568
- const fullPath = (0, import_node_path.resolve)((0, import_node_path.join)(path29, basename9));
33569
- 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 };
33570
34182
  entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
33571
34183
  } catch (err) {
33572
34184
  this._onError(err);
@@ -33622,16 +34234,16 @@ var init_readdirp = __esm({
33622
34234
  });
33623
34235
 
33624
34236
  // ../../oss/packages/daemon-core/node_modules/chokidar/handler.js
33625
- function createFsWatchInstance(path29, options, listener, errHandler, emitRaw) {
34237
+ function createFsWatchInstance(path28, options, listener, errHandler, emitRaw) {
33626
34238
  const handleEvent = (rawEvent, evPath) => {
33627
- listener(path29);
33628
- emitRaw(rawEvent, evPath, { watchedPath: path29 });
33629
- if (evPath && path29 !== evPath) {
33630
- 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));
33631
34243
  }
33632
34244
  };
33633
34245
  try {
33634
- return (0, import_node_fs.watch)(path29, {
34246
+ return (0, import_node_fs.watch)(path28, {
33635
34247
  persistent: options.persistent
33636
34248
  }, handleEvent);
33637
34249
  } catch (error48) {
@@ -33980,12 +34592,12 @@ var init_handler2 = __esm({
33980
34592
  listener(val1, val2, val3);
33981
34593
  });
33982
34594
  };
33983
- setFsWatchListener = (path29, fullPath, options, handlers) => {
34595
+ setFsWatchListener = (path28, fullPath, options, handlers) => {
33984
34596
  const { listener, errHandler, rawEmitter } = handlers;
33985
34597
  let cont = FsWatchInstances.get(fullPath);
33986
34598
  let watcher;
33987
34599
  if (!options.persistent) {
33988
- watcher = createFsWatchInstance(path29, options, listener, errHandler, rawEmitter);
34600
+ watcher = createFsWatchInstance(path28, options, listener, errHandler, rawEmitter);
33989
34601
  if (!watcher)
33990
34602
  return;
33991
34603
  return watcher.close.bind(watcher);
@@ -33996,7 +34608,7 @@ var init_handler2 = __esm({
33996
34608
  addAndConvert(cont, KEY_RAW, rawEmitter);
33997
34609
  } else {
33998
34610
  watcher = createFsWatchInstance(
33999
- path29,
34611
+ path28,
34000
34612
  options,
34001
34613
  fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS),
34002
34614
  errHandler,
@@ -34011,7 +34623,7 @@ var init_handler2 = __esm({
34011
34623
  cont.watcherUnusable = true;
34012
34624
  if (isWindows && error48.code === "EPERM") {
34013
34625
  try {
34014
- const fd = await (0, import_promises2.open)(path29, "r");
34626
+ const fd = await (0, import_promises2.open)(path28, "r");
34015
34627
  await fd.close();
34016
34628
  broadcastErr(error48);
34017
34629
  } catch (err) {
@@ -34042,7 +34654,7 @@ var init_handler2 = __esm({
34042
34654
  };
34043
34655
  };
34044
34656
  FsWatchFileInstances = /* @__PURE__ */ new Map();
34045
- setFsWatchFileListener = (path29, fullPath, options, handlers) => {
34657
+ setFsWatchFileListener = (path28, fullPath, options, handlers) => {
34046
34658
  const { listener, rawEmitter } = handlers;
34047
34659
  let cont = FsWatchFileInstances.get(fullPath);
34048
34660
  const copts = cont && cont.options;
@@ -34064,7 +34676,7 @@ var init_handler2 = __esm({
34064
34676
  });
34065
34677
  const currmtime = curr.mtimeMs;
34066
34678
  if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
34067
- foreach(cont.listeners, (listener2) => listener2(path29, curr));
34679
+ foreach(cont.listeners, (listener2) => listener2(path28, curr));
34068
34680
  }
34069
34681
  })
34070
34682
  };
@@ -34094,13 +34706,13 @@ var init_handler2 = __esm({
34094
34706
  * @param listener on fs change
34095
34707
  * @returns closer for the watcher instance
34096
34708
  */
34097
- _watchWithNodeFs(path29, listener) {
34709
+ _watchWithNodeFs(path28, listener) {
34098
34710
  const opts = this.fsw.options;
34099
- const directory = sp.dirname(path29);
34100
- const basename9 = sp.basename(path29);
34711
+ const directory = sp.dirname(path28);
34712
+ const basename10 = sp.basename(path28);
34101
34713
  const parent = this.fsw._getWatchedDir(directory);
34102
- parent.add(basename9);
34103
- const absolutePath = sp.resolve(path29);
34714
+ parent.add(basename10);
34715
+ const absolutePath = sp.resolve(path28);
34104
34716
  const options = {
34105
34717
  persistent: opts.persistent
34106
34718
  };
@@ -34109,13 +34721,13 @@ var init_handler2 = __esm({
34109
34721
  let closer;
34110
34722
  if (opts.usePolling) {
34111
34723
  const enableBin = opts.interval !== opts.binaryInterval;
34112
- options.interval = enableBin && isBinaryPath(basename9) ? opts.binaryInterval : opts.interval;
34113
- closer = setFsWatchFileListener(path29, absolutePath, options, {
34724
+ options.interval = enableBin && isBinaryPath(basename10) ? opts.binaryInterval : opts.interval;
34725
+ closer = setFsWatchFileListener(path28, absolutePath, options, {
34114
34726
  listener,
34115
34727
  rawEmitter: this.fsw._emitRaw
34116
34728
  });
34117
34729
  } else {
34118
- closer = setFsWatchListener(path29, absolutePath, options, {
34730
+ closer = setFsWatchListener(path28, absolutePath, options, {
34119
34731
  listener,
34120
34732
  errHandler: this._boundHandleError,
34121
34733
  rawEmitter: this.fsw._emitRaw
@@ -34132,12 +34744,12 @@ var init_handler2 = __esm({
34132
34744
  return;
34133
34745
  }
34134
34746
  const dirname10 = sp.dirname(file2);
34135
- const basename9 = sp.basename(file2);
34747
+ const basename10 = sp.basename(file2);
34136
34748
  const parent = this.fsw._getWatchedDir(dirname10);
34137
34749
  let prevStats = stats;
34138
- if (parent.has(basename9))
34750
+ if (parent.has(basename10))
34139
34751
  return;
34140
- const listener = async (path29, newStats) => {
34752
+ const listener = async (path28, newStats) => {
34141
34753
  if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file2, 5))
34142
34754
  return;
34143
34755
  if (!newStats || newStats.mtimeMs === 0) {
@@ -34151,18 +34763,18 @@ var init_handler2 = __esm({
34151
34763
  this.fsw._emit(EV.CHANGE, file2, newStats2);
34152
34764
  }
34153
34765
  if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats2.ino) {
34154
- this.fsw._closeFile(path29);
34766
+ this.fsw._closeFile(path28);
34155
34767
  prevStats = newStats2;
34156
34768
  const closer2 = this._watchWithNodeFs(file2, listener);
34157
34769
  if (closer2)
34158
- this.fsw._addPathCloser(path29, closer2);
34770
+ this.fsw._addPathCloser(path28, closer2);
34159
34771
  } else {
34160
34772
  prevStats = newStats2;
34161
34773
  }
34162
34774
  } catch (error48) {
34163
- this.fsw._remove(dirname10, basename9);
34775
+ this.fsw._remove(dirname10, basename10);
34164
34776
  }
34165
- } else if (parent.has(basename9)) {
34777
+ } else if (parent.has(basename10)) {
34166
34778
  const at = newStats.atimeMs;
34167
34779
  const mt = newStats.mtimeMs;
34168
34780
  if (!at || at <= mt || mt !== prevStats.mtimeMs) {
@@ -34187,7 +34799,7 @@ var init_handler2 = __esm({
34187
34799
  * @param item basename of this item
34188
34800
  * @returns true if no more processing is needed for this entry.
34189
34801
  */
34190
- async _handleSymlink(entry, directory, path29, item) {
34802
+ async _handleSymlink(entry, directory, path28, item) {
34191
34803
  if (this.fsw.closed) {
34192
34804
  return;
34193
34805
  }
@@ -34197,7 +34809,7 @@ var init_handler2 = __esm({
34197
34809
  this.fsw._incrReadyCount();
34198
34810
  let linkPath;
34199
34811
  try {
34200
- linkPath = await (0, import_promises2.realpath)(path29);
34812
+ linkPath = await (0, import_promises2.realpath)(path28);
34201
34813
  } catch (e) {
34202
34814
  this.fsw._emitReady();
34203
34815
  return true;
@@ -34207,12 +34819,12 @@ var init_handler2 = __esm({
34207
34819
  if (dir.has(item)) {
34208
34820
  if (this.fsw._symlinkPaths.get(full) !== linkPath) {
34209
34821
  this.fsw._symlinkPaths.set(full, linkPath);
34210
- this.fsw._emit(EV.CHANGE, path29, entry.stats);
34822
+ this.fsw._emit(EV.CHANGE, path28, entry.stats);
34211
34823
  }
34212
34824
  } else {
34213
34825
  dir.add(item);
34214
34826
  this.fsw._symlinkPaths.set(full, linkPath);
34215
- this.fsw._emit(EV.ADD, path29, entry.stats);
34827
+ this.fsw._emit(EV.ADD, path28, entry.stats);
34216
34828
  }
34217
34829
  this.fsw._emitReady();
34218
34830
  return true;
@@ -34242,9 +34854,9 @@ var init_handler2 = __esm({
34242
34854
  return;
34243
34855
  }
34244
34856
  const item = entry.path;
34245
- let path29 = sp.join(directory, item);
34857
+ let path28 = sp.join(directory, item);
34246
34858
  current.add(item);
34247
- if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path29, item)) {
34859
+ if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path28, item)) {
34248
34860
  return;
34249
34861
  }
34250
34862
  if (this.fsw.closed) {
@@ -34253,8 +34865,8 @@ var init_handler2 = __esm({
34253
34865
  }
34254
34866
  if (item === target || !target && !previous.has(item)) {
34255
34867
  this.fsw._incrReadyCount();
34256
- path29 = sp.join(dir, sp.relative(dir, path29));
34257
- this._addToNodeFs(path29, initialAdd, wh, depth + 1);
34868
+ path28 = sp.join(dir, sp.relative(dir, path28));
34869
+ this._addToNodeFs(path28, initialAdd, wh, depth + 1);
34258
34870
  }
34259
34871
  }).on(EV.ERROR, this._boundHandleError);
34260
34872
  return new Promise((resolve16, reject) => {
@@ -34323,13 +34935,13 @@ var init_handler2 = __esm({
34323
34935
  * @param depth Child path actually targeted for watch
34324
34936
  * @param target Child path actually targeted for watch
34325
34937
  */
34326
- async _addToNodeFs(path29, initialAdd, priorWh, depth, target) {
34938
+ async _addToNodeFs(path28, initialAdd, priorWh, depth, target) {
34327
34939
  const ready = this.fsw._emitReady;
34328
- if (this.fsw._isIgnored(path29) || this.fsw.closed) {
34940
+ if (this.fsw._isIgnored(path28) || this.fsw.closed) {
34329
34941
  ready();
34330
34942
  return false;
34331
34943
  }
34332
- const wh = this.fsw._getWatchHelpers(path29);
34944
+ const wh = this.fsw._getWatchHelpers(path28);
34333
34945
  if (priorWh) {
34334
34946
  wh.filterPath = (entry) => priorWh.filterPath(entry);
34335
34947
  wh.filterDir = (entry) => priorWh.filterDir(entry);
@@ -34345,8 +34957,8 @@ var init_handler2 = __esm({
34345
34957
  const follow = this.fsw.options.followSymlinks;
34346
34958
  let closer;
34347
34959
  if (stats.isDirectory()) {
34348
- const absPath = sp.resolve(path29);
34349
- 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;
34350
34962
  if (this.fsw.closed)
34351
34963
  return;
34352
34964
  closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
@@ -34356,29 +34968,29 @@ var init_handler2 = __esm({
34356
34968
  this.fsw._symlinkPaths.set(absPath, targetPath);
34357
34969
  }
34358
34970
  } else if (stats.isSymbolicLink()) {
34359
- const targetPath = follow ? await (0, import_promises2.realpath)(path29) : path29;
34971
+ const targetPath = follow ? await (0, import_promises2.realpath)(path28) : path28;
34360
34972
  if (this.fsw.closed)
34361
34973
  return;
34362
34974
  const parent = sp.dirname(wh.watchPath);
34363
34975
  this.fsw._getWatchedDir(parent).add(wh.watchPath);
34364
34976
  this.fsw._emit(EV.ADD, wh.watchPath, stats);
34365
- closer = await this._handleDir(parent, stats, initialAdd, depth, path29, wh, targetPath);
34977
+ closer = await this._handleDir(parent, stats, initialAdd, depth, path28, wh, targetPath);
34366
34978
  if (this.fsw.closed)
34367
34979
  return;
34368
34980
  if (targetPath !== void 0) {
34369
- this.fsw._symlinkPaths.set(sp.resolve(path29), targetPath);
34981
+ this.fsw._symlinkPaths.set(sp.resolve(path28), targetPath);
34370
34982
  }
34371
34983
  } else {
34372
34984
  closer = this._handleFile(wh.watchPath, stats, initialAdd);
34373
34985
  }
34374
34986
  ready();
34375
34987
  if (closer)
34376
- this.fsw._addPathCloser(path29, closer);
34988
+ this.fsw._addPathCloser(path28, closer);
34377
34989
  return false;
34378
34990
  } catch (error48) {
34379
34991
  if (this.fsw._handleError(error48)) {
34380
34992
  ready();
34381
- return path29;
34993
+ return path28;
34382
34994
  }
34383
34995
  }
34384
34996
  }
@@ -34413,24 +35025,24 @@ function createPattern(matcher) {
34413
35025
  }
34414
35026
  return () => false;
34415
35027
  }
34416
- function normalizePath(path29) {
34417
- if (typeof path29 !== "string")
35028
+ function normalizePath(path28) {
35029
+ if (typeof path28 !== "string")
34418
35030
  throw new Error("string expected");
34419
- path29 = sp2.normalize(path29);
34420
- path29 = path29.replace(/\\/g, "/");
35031
+ path28 = sp2.normalize(path28);
35032
+ path28 = path28.replace(/\\/g, "/");
34421
35033
  let prepend = false;
34422
- if (path29.startsWith("//"))
35034
+ if (path28.startsWith("//"))
34423
35035
  prepend = true;
34424
- path29 = path29.replace(DOUBLE_SLASH_RE, "/");
35036
+ path28 = path28.replace(DOUBLE_SLASH_RE, "/");
34425
35037
  if (prepend)
34426
- path29 = "/" + path29;
34427
- return path29;
35038
+ path28 = "/" + path28;
35039
+ return path28;
34428
35040
  }
34429
35041
  function matchPatterns(patterns, testString, stats) {
34430
- const path29 = normalizePath(testString);
35042
+ const path28 = normalizePath(testString);
34431
35043
  for (let index = 0; index < patterns.length; index++) {
34432
35044
  const pattern = patterns[index];
34433
- if (pattern(path29, stats)) {
35045
+ if (pattern(path28, stats)) {
34434
35046
  return true;
34435
35047
  }
34436
35048
  }
@@ -34493,19 +35105,19 @@ var init_chokidar = __esm({
34493
35105
  }
34494
35106
  return str;
34495
35107
  };
34496
- normalizePathToUnix = (path29) => toUnix(sp2.normalize(toUnix(path29)));
34497
- normalizeIgnored = (cwd = "") => (path29) => {
34498
- if (typeof path29 === "string") {
34499
- 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));
34500
35112
  } else {
34501
- return path29;
35113
+ return path28;
34502
35114
  }
34503
35115
  };
34504
- getAbsolutePath = (path29, cwd) => {
34505
- if (sp2.isAbsolute(path29)) {
34506
- return path29;
35116
+ getAbsolutePath = (path28, cwd) => {
35117
+ if (sp2.isAbsolute(path28)) {
35118
+ return path28;
34507
35119
  }
34508
- return sp2.join(cwd, path29);
35120
+ return sp2.join(cwd, path28);
34509
35121
  };
34510
35122
  EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
34511
35123
  DirEntry = class {
@@ -34570,10 +35182,10 @@ var init_chokidar = __esm({
34570
35182
  dirParts;
34571
35183
  followSymlinks;
34572
35184
  statMethod;
34573
- constructor(path29, follow, fsw) {
35185
+ constructor(path28, follow, fsw) {
34574
35186
  this.fsw = fsw;
34575
- const watchPath = path29;
34576
- this.path = path29 = path29.replace(REPLACER_RE, "");
35187
+ const watchPath = path28;
35188
+ this.path = path28 = path28.replace(REPLACER_RE, "");
34577
35189
  this.watchPath = watchPath;
34578
35190
  this.fullWatchPath = sp2.resolve(watchPath);
34579
35191
  this.dirParts = [];
@@ -34713,20 +35325,20 @@ var init_chokidar = __esm({
34713
35325
  this._closePromise = void 0;
34714
35326
  let paths = unifyPaths(paths_);
34715
35327
  if (cwd) {
34716
- paths = paths.map((path29) => {
34717
- const absPath = getAbsolutePath(path29, cwd);
35328
+ paths = paths.map((path28) => {
35329
+ const absPath = getAbsolutePath(path28, cwd);
34718
35330
  return absPath;
34719
35331
  });
34720
35332
  }
34721
- paths.forEach((path29) => {
34722
- this._removeIgnoredPath(path29);
35333
+ paths.forEach((path28) => {
35334
+ this._removeIgnoredPath(path28);
34723
35335
  });
34724
35336
  this._userIgnored = void 0;
34725
35337
  if (!this._readyCount)
34726
35338
  this._readyCount = 0;
34727
35339
  this._readyCount += paths.length;
34728
- Promise.all(paths.map(async (path29) => {
34729
- 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);
34730
35342
  if (res)
34731
35343
  this._emitReady();
34732
35344
  return res;
@@ -34748,17 +35360,17 @@ var init_chokidar = __esm({
34748
35360
  return this;
34749
35361
  const paths = unifyPaths(paths_);
34750
35362
  const { cwd } = this.options;
34751
- paths.forEach((path29) => {
34752
- if (!sp2.isAbsolute(path29) && !this._closers.has(path29)) {
35363
+ paths.forEach((path28) => {
35364
+ if (!sp2.isAbsolute(path28) && !this._closers.has(path28)) {
34753
35365
  if (cwd)
34754
- path29 = sp2.join(cwd, path29);
34755
- path29 = sp2.resolve(path29);
35366
+ path28 = sp2.join(cwd, path28);
35367
+ path28 = sp2.resolve(path28);
34756
35368
  }
34757
- this._closePath(path29);
34758
- this._addIgnoredPath(path29);
34759
- if (this._watched.has(path29)) {
35369
+ this._closePath(path28);
35370
+ this._addIgnoredPath(path28);
35371
+ if (this._watched.has(path28)) {
34760
35372
  this._addIgnoredPath({
34761
- path: path29,
35373
+ path: path28,
34762
35374
  recursive: true
34763
35375
  });
34764
35376
  }
@@ -34822,38 +35434,38 @@ var init_chokidar = __esm({
34822
35434
  * @param stats arguments to be passed with event
34823
35435
  * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
34824
35436
  */
34825
- async _emit(event, path29, stats) {
35437
+ async _emit(event, path28, stats) {
34826
35438
  if (this.closed)
34827
35439
  return;
34828
35440
  const opts = this.options;
34829
35441
  if (isWindows)
34830
- path29 = sp2.normalize(path29);
35442
+ path28 = sp2.normalize(path28);
34831
35443
  if (opts.cwd)
34832
- path29 = sp2.relative(opts.cwd, path29);
34833
- const args = [path29];
35444
+ path28 = sp2.relative(opts.cwd, path28);
35445
+ const args = [path28];
34834
35446
  if (stats != null)
34835
35447
  args.push(stats);
34836
35448
  const awf = opts.awaitWriteFinish;
34837
35449
  let pw;
34838
- if (awf && (pw = this._pendingWrites.get(path29))) {
35450
+ if (awf && (pw = this._pendingWrites.get(path28))) {
34839
35451
  pw.lastChange = /* @__PURE__ */ new Date();
34840
35452
  return this;
34841
35453
  }
34842
35454
  if (opts.atomic) {
34843
35455
  if (event === EVENTS.UNLINK) {
34844
- this._pendingUnlinks.set(path29, [event, ...args]);
35456
+ this._pendingUnlinks.set(path28, [event, ...args]);
34845
35457
  setTimeout(() => {
34846
- this._pendingUnlinks.forEach((entry, path30) => {
35458
+ this._pendingUnlinks.forEach((entry, path29) => {
34847
35459
  this.emit(...entry);
34848
35460
  this.emit(EVENTS.ALL, ...entry);
34849
- this._pendingUnlinks.delete(path30);
35461
+ this._pendingUnlinks.delete(path29);
34850
35462
  });
34851
35463
  }, typeof opts.atomic === "number" ? opts.atomic : 100);
34852
35464
  return this;
34853
35465
  }
34854
- if (event === EVENTS.ADD && this._pendingUnlinks.has(path29)) {
35466
+ if (event === EVENTS.ADD && this._pendingUnlinks.has(path28)) {
34855
35467
  event = EVENTS.CHANGE;
34856
- this._pendingUnlinks.delete(path29);
35468
+ this._pendingUnlinks.delete(path28);
34857
35469
  }
34858
35470
  }
34859
35471
  if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
@@ -34871,16 +35483,16 @@ var init_chokidar = __esm({
34871
35483
  this.emitWithAll(event, args);
34872
35484
  }
34873
35485
  };
34874
- this._awaitWriteFinish(path29, awf.stabilityThreshold, event, awfEmit);
35486
+ this._awaitWriteFinish(path28, awf.stabilityThreshold, event, awfEmit);
34875
35487
  return this;
34876
35488
  }
34877
35489
  if (event === EVENTS.CHANGE) {
34878
- const isThrottled = !this._throttle(EVENTS.CHANGE, path29, 50);
35490
+ const isThrottled = !this._throttle(EVENTS.CHANGE, path28, 50);
34879
35491
  if (isThrottled)
34880
35492
  return this;
34881
35493
  }
34882
35494
  if (opts.alwaysStat && stats === void 0 && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
34883
- const fullPath = opts.cwd ? sp2.join(opts.cwd, path29) : path29;
35495
+ const fullPath = opts.cwd ? sp2.join(opts.cwd, path28) : path28;
34884
35496
  let stats2;
34885
35497
  try {
34886
35498
  stats2 = await (0, import_promises3.stat)(fullPath);
@@ -34911,23 +35523,23 @@ var init_chokidar = __esm({
34911
35523
  * @param timeout duration of time to suppress duplicate actions
34912
35524
  * @returns tracking object or false if action should be suppressed
34913
35525
  */
34914
- _throttle(actionType, path29, timeout) {
35526
+ _throttle(actionType, path28, timeout) {
34915
35527
  if (!this._throttled.has(actionType)) {
34916
35528
  this._throttled.set(actionType, /* @__PURE__ */ new Map());
34917
35529
  }
34918
35530
  const action = this._throttled.get(actionType);
34919
35531
  if (!action)
34920
35532
  throw new Error("invalid throttle");
34921
- const actionPath = action.get(path29);
35533
+ const actionPath = action.get(path28);
34922
35534
  if (actionPath) {
34923
35535
  actionPath.count++;
34924
35536
  return false;
34925
35537
  }
34926
35538
  let timeoutObject;
34927
35539
  const clear = () => {
34928
- const item = action.get(path29);
35540
+ const item = action.get(path28);
34929
35541
  const count = item ? item.count : 0;
34930
- action.delete(path29);
35542
+ action.delete(path28);
34931
35543
  clearTimeout(timeoutObject);
34932
35544
  if (item)
34933
35545
  clearTimeout(item.timeoutObject);
@@ -34935,7 +35547,7 @@ var init_chokidar = __esm({
34935
35547
  };
34936
35548
  timeoutObject = setTimeout(clear, timeout);
34937
35549
  const thr = { timeoutObject, clear, count: 0 };
34938
- action.set(path29, thr);
35550
+ action.set(path28, thr);
34939
35551
  return thr;
34940
35552
  }
34941
35553
  _incrReadyCount() {
@@ -34949,44 +35561,44 @@ var init_chokidar = __esm({
34949
35561
  * @param event
34950
35562
  * @param awfEmit Callback to be called when ready for event to be emitted.
34951
35563
  */
34952
- _awaitWriteFinish(path29, threshold, event, awfEmit) {
35564
+ _awaitWriteFinish(path28, threshold, event, awfEmit) {
34953
35565
  const awf = this.options.awaitWriteFinish;
34954
35566
  if (typeof awf !== "object")
34955
35567
  return;
34956
35568
  const pollInterval = awf.pollInterval;
34957
35569
  let timeoutHandler;
34958
- let fullPath = path29;
34959
- if (this.options.cwd && !sp2.isAbsolute(path29)) {
34960
- 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);
34961
35573
  }
34962
35574
  const now = /* @__PURE__ */ new Date();
34963
35575
  const writes = this._pendingWrites;
34964
35576
  function awaitWriteFinishFn(prevStat) {
34965
35577
  (0, import_node_fs2.stat)(fullPath, (err, curStat) => {
34966
- if (err || !writes.has(path29)) {
35578
+ if (err || !writes.has(path28)) {
34967
35579
  if (err && err.code !== "ENOENT")
34968
35580
  awfEmit(err);
34969
35581
  return;
34970
35582
  }
34971
35583
  const now2 = Number(/* @__PURE__ */ new Date());
34972
35584
  if (prevStat && curStat.size !== prevStat.size) {
34973
- writes.get(path29).lastChange = now2;
35585
+ writes.get(path28).lastChange = now2;
34974
35586
  }
34975
- const pw = writes.get(path29);
35587
+ const pw = writes.get(path28);
34976
35588
  const df = now2 - pw.lastChange;
34977
35589
  if (df >= threshold) {
34978
- writes.delete(path29);
35590
+ writes.delete(path28);
34979
35591
  awfEmit(void 0, curStat);
34980
35592
  } else {
34981
35593
  timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
34982
35594
  }
34983
35595
  });
34984
35596
  }
34985
- if (!writes.has(path29)) {
34986
- writes.set(path29, {
35597
+ if (!writes.has(path28)) {
35598
+ writes.set(path28, {
34987
35599
  lastChange: now,
34988
35600
  cancelWait: () => {
34989
- writes.delete(path29);
35601
+ writes.delete(path28);
34990
35602
  clearTimeout(timeoutHandler);
34991
35603
  return event;
34992
35604
  }
@@ -34997,8 +35609,8 @@ var init_chokidar = __esm({
34997
35609
  /**
34998
35610
  * Determines whether user has asked to ignore this path.
34999
35611
  */
35000
- _isIgnored(path29, stats) {
35001
- if (this.options.atomic && DOT_RE.test(path29))
35612
+ _isIgnored(path28, stats) {
35613
+ if (this.options.atomic && DOT_RE.test(path28))
35002
35614
  return true;
35003
35615
  if (!this._userIgnored) {
35004
35616
  const { cwd } = this.options;
@@ -35008,17 +35620,17 @@ var init_chokidar = __esm({
35008
35620
  const list = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored];
35009
35621
  this._userIgnored = anymatch(list, void 0);
35010
35622
  }
35011
- return this._userIgnored(path29, stats);
35623
+ return this._userIgnored(path28, stats);
35012
35624
  }
35013
- _isntIgnored(path29, stat4) {
35014
- return !this._isIgnored(path29, stat4);
35625
+ _isntIgnored(path28, stat4) {
35626
+ return !this._isIgnored(path28, stat4);
35015
35627
  }
35016
35628
  /**
35017
35629
  * Provides a set of common helpers and properties relating to symlink handling.
35018
35630
  * @param path file or directory pattern being watched
35019
35631
  */
35020
- _getWatchHelpers(path29) {
35021
- return new WatchHelper(path29, this.options.followSymlinks, this);
35632
+ _getWatchHelpers(path28) {
35633
+ return new WatchHelper(path28, this.options.followSymlinks, this);
35022
35634
  }
35023
35635
  // Directory helpers
35024
35636
  // -----------------
@@ -35050,63 +35662,63 @@ var init_chokidar = __esm({
35050
35662
  * @param item base path of item/directory
35051
35663
  */
35052
35664
  _remove(directory, item, isDirectory) {
35053
- const path29 = sp2.join(directory, item);
35054
- const fullPath = sp2.resolve(path29);
35055
- isDirectory = isDirectory != null ? isDirectory : this._watched.has(path29) || this._watched.has(fullPath);
35056
- 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))
35057
35669
  return;
35058
35670
  if (!isDirectory && this._watched.size === 1) {
35059
35671
  this.add(directory, item, true);
35060
35672
  }
35061
- const wp = this._getWatchedDir(path29);
35673
+ const wp = this._getWatchedDir(path28);
35062
35674
  const nestedDirectoryChildren = wp.getChildren();
35063
- nestedDirectoryChildren.forEach((nested) => this._remove(path29, nested));
35675
+ nestedDirectoryChildren.forEach((nested) => this._remove(path28, nested));
35064
35676
  const parent = this._getWatchedDir(directory);
35065
35677
  const wasTracked = parent.has(item);
35066
35678
  parent.remove(item);
35067
35679
  if (this._symlinkPaths.has(fullPath)) {
35068
35680
  this._symlinkPaths.delete(fullPath);
35069
35681
  }
35070
- let relPath = path29;
35682
+ let relPath = path28;
35071
35683
  if (this.options.cwd)
35072
- relPath = sp2.relative(this.options.cwd, path29);
35684
+ relPath = sp2.relative(this.options.cwd, path28);
35073
35685
  if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
35074
35686
  const event = this._pendingWrites.get(relPath).cancelWait();
35075
35687
  if (event === EVENTS.ADD)
35076
35688
  return;
35077
35689
  }
35078
- this._watched.delete(path29);
35690
+ this._watched.delete(path28);
35079
35691
  this._watched.delete(fullPath);
35080
35692
  const eventName = isDirectory ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
35081
- if (wasTracked && !this._isIgnored(path29))
35082
- this._emit(eventName, path29);
35083
- this._closePath(path29);
35693
+ if (wasTracked && !this._isIgnored(path28))
35694
+ this._emit(eventName, path28);
35695
+ this._closePath(path28);
35084
35696
  }
35085
35697
  /**
35086
35698
  * Closes all watchers for a path
35087
35699
  */
35088
- _closePath(path29) {
35089
- this._closeFile(path29);
35090
- const dir = sp2.dirname(path29);
35091
- 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));
35092
35704
  }
35093
35705
  /**
35094
35706
  * Closes only file-specific watchers
35095
35707
  */
35096
- _closeFile(path29) {
35097
- const closers = this._closers.get(path29);
35708
+ _closeFile(path28) {
35709
+ const closers = this._closers.get(path28);
35098
35710
  if (!closers)
35099
35711
  return;
35100
35712
  closers.forEach((closer) => closer());
35101
- this._closers.delete(path29);
35713
+ this._closers.delete(path28);
35102
35714
  }
35103
- _addPathCloser(path29, closer) {
35715
+ _addPathCloser(path28, closer) {
35104
35716
  if (!closer)
35105
35717
  return;
35106
- let list = this._closers.get(path29);
35718
+ let list = this._closers.get(path28);
35107
35719
  if (!list) {
35108
35720
  list = [];
35109
- this._closers.set(path29, list);
35721
+ this._closers.set(path28, list);
35110
35722
  }
35111
35723
  list.push(closer);
35112
35724
  }
@@ -36855,6 +37467,43 @@ var init_provider_loader = __esm({
36855
37467
  }
36856
37468
  });
36857
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
+
36858
37507
  // ../../oss/packages/daemon-core/src/launch.ts
36859
37508
  function getProviderLoader() {
36860
37509
  if (!_providerLoader) {
@@ -36877,9 +37526,9 @@ function getWinProcessNames() {
36877
37526
  function getProviderMeta(ideId) {
36878
37527
  return getProviderLoader().getMeta(ideId);
36879
37528
  }
36880
- function getPreferredLaunchMethod(ideId, platform13) {
37529
+ function getPreferredLaunchMethod(ideId, platform12) {
36881
37530
  const prefer = getProviderMeta(ideId)?.launch?.prefer;
36882
- const value = prefer?.[platform13];
37531
+ const value = prefer?.[platform12];
36883
37532
  return value === "cli" || value === "app" || value === "auto" ? value : "auto";
36884
37533
  }
36885
37534
  function getCdpStartupTimeoutMs(ideId) {
@@ -36890,6 +37539,35 @@ function getCdpStartupTimeoutMs(ideId) {
36890
37539
  function escapeForAppleScript(value) {
36891
37540
  return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
36892
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
+ }
36893
37571
  async function findFreePort(ports) {
36894
37572
  for (const port2 of ports) {
36895
37573
  const free = await checkPortFree(port2);
@@ -36951,6 +37629,7 @@ async function killIdeProcess(ideId) {
36951
37629
  } catch {
36952
37630
  }
36953
37631
  }
37632
+ killMacAppPathProcesses(ideId, "SIGTERM");
36954
37633
  } else if (plat === "win32" && winProcesses) {
36955
37634
  for (const proc of winProcesses) {
36956
37635
  try {
@@ -36980,6 +37659,7 @@ async function killIdeProcess(ideId) {
36980
37659
  (0, import_child_process7.execSync)(`pkill -9 -x "${appName}" 2>/dev/null`, { timeout: 5e3 });
36981
37660
  } catch {
36982
37661
  }
37662
+ killMacAppPathProcesses(ideId, "SIGKILL");
36983
37663
  } else if (plat === "win32" && winProcesses) {
36984
37664
  for (const proc of winProcesses) {
36985
37665
  try {
@@ -36999,14 +37679,16 @@ function isIdeRunning(ideId) {
36999
37679
  try {
37000
37680
  if (plat === "darwin") {
37001
37681
  const appName = getMacAppIdentifiers()[ideId];
37002
- if (!appName) return false;
37682
+ if (!appName) return getMacAppProcessPids(ideId).length > 0;
37003
37683
  try {
37004
37684
  const result = (0, import_child_process7.execSync)(`pgrep -x "${appName}" 2>/dev/null`, {
37005
37685
  encoding: "utf-8",
37006
37686
  timeout: 3e3
37007
37687
  });
37008
- return result.trim().length > 0;
37688
+ if (result.trim().length > 0) return true;
37009
37689
  } catch {
37690
+ }
37691
+ try {
37010
37692
  const result = (0, import_child_process7.execSync)(
37011
37693
  `osascript -e 'tell application "System Events" to count (every process whose name is "${escapeForAppleScript(appName)}")'`,
37012
37694
  {
@@ -37015,8 +37697,10 @@ function isIdeRunning(ideId) {
37015
37697
  stdio: ["pipe", "pipe", "pipe"]
37016
37698
  }
37017
37699
  );
37018
- return Number.parseInt(result.trim() || "0", 10) > 0;
37700
+ if (Number.parseInt(result.trim() || "0", 10) > 0) return true;
37701
+ } catch {
37019
37702
  }
37703
+ return getMacAppProcessPids(ideId).length > 0;
37020
37704
  } else if (plat === "win32") {
37021
37705
  const winProcesses = getWinProcessNames()[ideId];
37022
37706
  if (!winProcesses) return false;
@@ -37061,7 +37745,7 @@ function detectCurrentWorkspace(ideId) {
37061
37745
  }
37062
37746
  } else if (plat === "win32") {
37063
37747
  try {
37064
- const fs24 = require("fs");
37748
+ const fs19 = require("fs");
37065
37749
  const appNameMap = getMacAppIdentifiers();
37066
37750
  const appName = appNameMap[ideId];
37067
37751
  if (appName) {
@@ -37070,8 +37754,8 @@ function detectCurrentWorkspace(ideId) {
37070
37754
  appName,
37071
37755
  "storage.json"
37072
37756
  );
37073
- if (fs24.existsSync(storagePath)) {
37074
- const data = JSON.parse(fs24.readFileSync(storagePath, "utf-8"));
37757
+ if (fs19.existsSync(storagePath)) {
37758
+ const data = JSON.parse(fs19.readFileSync(storagePath, "utf-8"));
37075
37759
  const workspaces = data?.openedPathsList?.workspaces3 || data?.openedPathsList?.entries || [];
37076
37760
  if (workspaces.length > 0) {
37077
37761
  const recent = workspaces[0];
@@ -37088,7 +37772,7 @@ function detectCurrentWorkspace(ideId) {
37088
37772
  return void 0;
37089
37773
  }
37090
37774
  async function launchWithCdp(options = {}) {
37091
- const platform13 = os16.platform();
37775
+ const platform12 = os16.platform();
37092
37776
  let targetIde;
37093
37777
  const ides = await detectIDEs(getProviderLoader());
37094
37778
  if (options.ideId) {
@@ -37157,9 +37841,9 @@ async function launchWithCdp(options = {}) {
37157
37841
  }
37158
37842
  const port = await findFreePort(portPair);
37159
37843
  try {
37160
- if (platform13 === "darwin") {
37844
+ if (platform12 === "darwin") {
37161
37845
  await launchMacOS(targetIde, port, workspace, options.newWindow);
37162
- } else if (platform13 === "win32") {
37846
+ } else if (platform12 === "win32") {
37163
37847
  await launchWindows(targetIde, port, workspace, options.newWindow);
37164
37848
  } else {
37165
37849
  await launchLinux(targetIde, port, workspace, options.newWindow);
@@ -37247,6 +37931,7 @@ var init_launch = __esm({
37247
37931
  path14 = __toESM(require("path"));
37248
37932
  init_ide_detector();
37249
37933
  init_provider_loader();
37934
+ init_macos_app_process();
37250
37935
  _providerLoader = null;
37251
37936
  }
37252
37937
  });
@@ -38439,13 +39124,18 @@ var init_router = __esm({
38439
39124
  const wantsAll = args?.all === true;
38440
39125
  const offset = wantsAll ? 0 : Math.max(0, Number(args?.offset) || 0);
38441
39126
  const limit = wantsAll ? Number.MAX_SAFE_INTEGER : Math.max(1, Math.min(100, Number(args?.limit) || 30));
38442
- 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
+ });
38443
39134
  const state = loadState();
38444
39135
  const savedSessions = getSavedProviderSessions(state, { providerType, kind });
38445
39136
  const recentSessions = getRecentActivity(state, 200).filter((entry) => entry.providerType === providerType && entry.kind === kind && entry.providerSessionId);
38446
39137
  const savedSessionById = new Map(savedSessions.map((entry) => [entry.providerSessionId, entry]));
38447
39138
  const recentSessionById = new Map(recentSessions.map((entry) => [entry.providerSessionId, entry]));
38448
- const providerMeta = this.deps.providerLoader.getMeta(providerType);
38449
39139
  const canResumeById = supportsExplicitSessionResume(providerMeta?.resume);
38450
39140
  return {
38451
39141
  success: true,
@@ -38468,7 +39158,8 @@ var init_router = __esm({
38468
39158
  canResume: !!(saved?.workspace || recent?.workspace || session.workspace) && canResumeById
38469
39159
  };
38470
39160
  }),
38471
- hasMore
39161
+ hasMore,
39162
+ source
38472
39163
  };
38473
39164
  }
38474
39165
  // ─── restart_session: IDE / CLI / ACP unified ───
@@ -44504,8 +45195,8 @@ var init_dev_server = __esm({
44504
45195
  }
44505
45196
  getEndpointList() {
44506
45197
  return this.routes.map((r) => {
44507
- const path29 = typeof r.pattern === "string" ? r.pattern : r.pattern.source.replace(/\\\//g, "/").replace(/\(\[.*?\]\+\)/g, ":type").replace(/[\^$]/g, "");
44508
- 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}`;
44509
45200
  });
44510
45201
  }
44511
45202
  async start(port = DEV_SERVER_PORT) {
@@ -46447,8 +47138,8 @@ async function installExtension(ide, extension) {
46447
47138
  const res = await fetch(extension.vsixUrl);
46448
47139
  if (res.ok) {
46449
47140
  const buffer = Buffer.from(await res.arrayBuffer());
46450
- const fs24 = await import("fs");
46451
- fs24.writeFileSync(vsixPath, buffer);
47141
+ const fs19 = await import("fs");
47142
+ fs19.writeFileSync(vsixPath, buffer);
46452
47143
  return new Promise((resolve16) => {
46453
47144
  const cmd = `"${ide.cliCommand}" --install-extension "${vsixPath}" --force`;
46454
47145
  (0, import_child_process11.exec)(cmd, { timeout: 6e4 }, (error48, _stdout, stderr) => {
@@ -48404,9 +49095,9 @@ var init_daemon_p2p = __esm({
48404
49095
  log(`node-datachannel not found: ${e?.message}
48405
49096
  ${e?.stack || ""}`);
48406
49097
  }
48407
- const platform13 = process.platform;
48408
- const arch4 = process.arch;
48409
- const prebuildKey = `${platform13}-${arch4}`;
49098
+ const platform12 = process.platform;
49099
+ const arch3 = process.arch;
49100
+ const prebuildKey = `${platform12}-${arch3}`;
48410
49101
  try {
48411
49102
  const candidates = [
48412
49103
  path23.join(__dirname, "node_modules", "node-datachannel"),
@@ -48786,27 +49477,27 @@ var require_process = __commonJS({
48786
49477
  var require_filesystem = __commonJS({
48787
49478
  "../../node_modules/detect-libc/lib/filesystem.js"(exports2, module2) {
48788
49479
  "use strict";
48789
- var fs24 = require("fs");
49480
+ var fs19 = require("fs");
48790
49481
  var LDD_PATH = "/usr/bin/ldd";
48791
49482
  var SELF_PATH = "/proc/self/exe";
48792
49483
  var MAX_LENGTH = 2048;
48793
- var readFileSync19 = (path29) => {
48794
- const fd = fs24.openSync(path29, "r");
49484
+ var readFileSync19 = (path28) => {
49485
+ const fd = fs19.openSync(path28, "r");
48795
49486
  const buffer = Buffer.alloc(MAX_LENGTH);
48796
- const bytesRead = fs24.readSync(fd, buffer, 0, MAX_LENGTH, 0);
48797
- fs24.close(fd, () => {
49487
+ const bytesRead = fs19.readSync(fd, buffer, 0, MAX_LENGTH, 0);
49488
+ fs19.close(fd, () => {
48798
49489
  });
48799
49490
  return buffer.subarray(0, bytesRead);
48800
49491
  };
48801
- var readFile = (path29) => new Promise((resolve16, reject) => {
48802
- fs24.open(path29, "r", (err, fd) => {
49492
+ var readFile = (path28) => new Promise((resolve16, reject) => {
49493
+ fs19.open(path28, "r", (err, fd) => {
48803
49494
  if (err) {
48804
49495
  reject(err);
48805
49496
  } else {
48806
49497
  const buffer = Buffer.alloc(MAX_LENGTH);
48807
- fs24.read(fd, buffer, 0, MAX_LENGTH, 0, (_2, bytesRead) => {
49498
+ fs19.read(fd, buffer, 0, MAX_LENGTH, 0, (_2, bytesRead) => {
48808
49499
  resolve16(buffer.subarray(0, bytesRead));
48809
- fs24.close(fd, () => {
49500
+ fs19.close(fd, () => {
48810
49501
  });
48811
49502
  });
48812
49503
  }
@@ -48862,7 +49553,7 @@ var require_elf = __commonJS({
48862
49553
  var require_detect_libc = __commonJS({
48863
49554
  "../../node_modules/detect-libc/lib/detect-libc.js"(exports2, module2) {
48864
49555
  "use strict";
48865
- var childProcess2 = require("child_process");
49556
+ var childProcess = require("child_process");
48866
49557
  var { isLinux: isLinux2, getReport } = require_process();
48867
49558
  var { LDD_PATH, SELF_PATH, readFile, readFileSync: readFileSync19 } = require_filesystem();
48868
49559
  var { interpreterPath } = require_elf();
@@ -48874,7 +49565,7 @@ var require_detect_libc = __commonJS({
48874
49565
  var safeCommand = () => {
48875
49566
  if (!commandOut) {
48876
49567
  return new Promise((resolve16) => {
48877
- childProcess2.exec(command, (err, out) => {
49568
+ childProcess.exec(command, (err, out) => {
48878
49569
  commandOut = err ? " " : out;
48879
49570
  resolve16(commandOut);
48880
49571
  });
@@ -48885,7 +49576,7 @@ var require_detect_libc = __commonJS({
48885
49576
  var safeCommandSync = () => {
48886
49577
  if (!commandOut) {
48887
49578
  try {
48888
- commandOut = childProcess2.execSync(command, { encoding: "utf8" });
49579
+ commandOut = childProcess.execSync(command, { encoding: "utf8" });
48889
49580
  } catch (_err) {
48890
49581
  commandOut = " ";
48891
49582
  }
@@ -48918,11 +49609,11 @@ var require_detect_libc = __commonJS({
48918
49609
  }
48919
49610
  return null;
48920
49611
  };
48921
- var familyFromInterpreterPath = (path29) => {
48922
- if (path29) {
48923
- if (path29.includes("/ld-musl-")) {
49612
+ var familyFromInterpreterPath = (path28) => {
49613
+ if (path28) {
49614
+ if (path28.includes("/ld-musl-")) {
48924
49615
  return MUSL;
48925
- } else if (path29.includes("/ld-linux-")) {
49616
+ } else if (path28.includes("/ld-linux-")) {
48926
49617
  return GLIBC;
48927
49618
  }
48928
49619
  }
@@ -48969,8 +49660,8 @@ var require_detect_libc = __commonJS({
48969
49660
  cachedFamilyInterpreter = null;
48970
49661
  try {
48971
49662
  const selfContent = await readFile(SELF_PATH);
48972
- const path29 = interpreterPath(selfContent);
48973
- cachedFamilyInterpreter = familyFromInterpreterPath(path29);
49663
+ const path28 = interpreterPath(selfContent);
49664
+ cachedFamilyInterpreter = familyFromInterpreterPath(path28);
48974
49665
  } catch (e) {
48975
49666
  }
48976
49667
  return cachedFamilyInterpreter;
@@ -48982,8 +49673,8 @@ var require_detect_libc = __commonJS({
48982
49673
  cachedFamilyInterpreter = null;
48983
49674
  try {
48984
49675
  const selfContent = readFileSync19(SELF_PATH);
48985
- const path29 = interpreterPath(selfContent);
48986
- cachedFamilyInterpreter = familyFromInterpreterPath(path29);
49676
+ const path28 = interpreterPath(selfContent);
49677
+ cachedFamilyInterpreter = familyFromInterpreterPath(path28);
48987
49678
  } catch (e) {
48988
49679
  }
48989
49680
  return cachedFamilyInterpreter;
@@ -50702,18 +51393,18 @@ var require_sharp = __commonJS({
50702
51393
  `@img/sharp-${runtimePlatform}/sharp.node`,
50703
51394
  "@img/sharp-wasm32/sharp.node"
50704
51395
  ];
50705
- var path29;
51396
+ var path28;
50706
51397
  var sharp;
50707
51398
  var errors = [];
50708
- for (path29 of paths) {
51399
+ for (path28 of paths) {
50709
51400
  try {
50710
- sharp = require(path29);
51401
+ sharp = require(path28);
50711
51402
  break;
50712
51403
  } catch (err) {
50713
51404
  errors.push(err);
50714
51405
  }
50715
51406
  }
50716
- if (sharp && path29.startsWith("@img/sharp-linux-x64") && !sharp._isUsingX64V2()) {
51407
+ if (sharp && path28.startsWith("@img/sharp-linux-x64") && !sharp._isUsingX64V2()) {
50717
51408
  const err = new Error("Prebuilt binaries for linux-x64 require v2 microarchitecture");
50718
51409
  err.code = "Unsupported CPU";
50719
51410
  errors.push(err);
@@ -50722,7 +51413,7 @@ var require_sharp = __commonJS({
50722
51413
  if (sharp) {
50723
51414
  module2.exports = sharp;
50724
51415
  } else {
50725
- 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));
50726
51417
  const help = [`Could not load the "sharp" module using the ${runtimePlatform} runtime`];
50727
51418
  errors.forEach((err) => {
50728
51419
  if (err.code !== "MODULE_NOT_FOUND") {
@@ -50739,15 +51430,15 @@ var require_sharp = __commonJS({
50739
51430
  ` Requires ${expected}`
50740
51431
  );
50741
51432
  } else if (prebuiltPlatforms.includes(runtimePlatform)) {
50742
- const [os29, cpu] = runtimePlatform.split("-");
50743
- const libc = os29.endsWith("musl") ? " --libc=musl" : "";
51433
+ const [os28, cpu] = runtimePlatform.split("-");
51434
+ const libc = os28.endsWith("musl") ? " --libc=musl" : "";
50744
51435
  help.push(
50745
51436
  "- Ensure optional dependencies can be installed:",
50746
51437
  " npm install --include=optional sharp",
50747
51438
  "- Ensure your package manager supports multi-platform installation:",
50748
51439
  " See https://sharp.pixelplumbing.com/install#cross-platform",
50749
51440
  "- Add platform-specific dependencies:",
50750
- ` npm install --os=${os29.replace("musl", "")}${libc} --cpu=${cpu} sharp`
51441
+ ` npm install --os=${os28.replace("musl", "")}${libc} --cpu=${cpu} sharp`
50751
51442
  );
50752
51443
  } else {
50753
51444
  help.push(
@@ -53622,15 +54313,15 @@ var require_color = __commonJS({
53622
54313
  };
53623
54314
  }
53624
54315
  function wrapConversion(toModel, graph) {
53625
- const path29 = [graph[toModel].parent, toModel];
54316
+ const path28 = [graph[toModel].parent, toModel];
53626
54317
  let fn = conversions_default[graph[toModel].parent][toModel];
53627
54318
  let cur = graph[toModel].parent;
53628
54319
  while (graph[cur].parent) {
53629
- path29.unshift(graph[cur].parent);
54320
+ path28.unshift(graph[cur].parent);
53630
54321
  fn = link(conversions_default[graph[cur].parent][cur], fn);
53631
54322
  cur = graph[cur].parent;
53632
54323
  }
53633
- fn.conversion = path29;
54324
+ fn.conversion = path28;
53634
54325
  return fn;
53635
54326
  }
53636
54327
  function route(fromModel) {
@@ -54247,7 +54938,7 @@ var require_channel = __commonJS({
54247
54938
  var require_output = __commonJS({
54248
54939
  "../../node_modules/sharp/lib/output.js"(exports2, module2) {
54249
54940
  "use strict";
54250
- var path29 = require("path");
54941
+ var path28 = require("path");
54251
54942
  var is = require_is();
54252
54943
  var sharp = require_sharp();
54253
54944
  var formats = /* @__PURE__ */ new Map([
@@ -54278,9 +54969,9 @@ var require_output = __commonJS({
54278
54969
  let err;
54279
54970
  if (!is.string(fileOut)) {
54280
54971
  err = new Error("Missing output file path");
54281
- } 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)) {
54282
54973
  err = new Error("Cannot use same file for input and output");
54283
- } 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) {
54284
54975
  err = errJp2Save();
54285
54976
  }
54286
54977
  if (err) {
@@ -56397,18 +57088,18 @@ var init_source2 = __esm({
56397
57088
  }
56398
57089
  }
56399
57090
  });
56400
- createStyler2 = (open3, close, parent) => {
57091
+ createStyler2 = (open2, close, parent) => {
56401
57092
  let openAll;
56402
57093
  let closeAll;
56403
57094
  if (parent === void 0) {
56404
- openAll = open3;
57095
+ openAll = open2;
56405
57096
  closeAll = close;
56406
57097
  } else {
56407
- openAll = parent.openAll + open3;
57098
+ openAll = parent.openAll + open2;
56408
57099
  closeAll = close + parent.closeAll;
56409
57100
  }
56410
57101
  return {
56411
- open: open3,
57102
+ open: open2,
56412
57103
  close,
56413
57104
  openAll,
56414
57105
  closeAll,
@@ -56567,7 +57258,7 @@ function removeDaemonPid(ref = {}) {
56567
57258
  function isDaemonRunning(ref = {}) {
56568
57259
  const port = resolveDaemonPort(ref);
56569
57260
  try {
56570
- const { execFileSync: execFileSync6 } = require("child_process");
57261
+ const { execFileSync: execFileSync5 } = require("child_process");
56571
57262
  const probe = `
56572
57263
  const http = require('http');
56573
57264
  const req = http.get('http://127.0.0.1:${port}/health', { timeout: 1500 }, (res) => {
@@ -56577,7 +57268,7 @@ function isDaemonRunning(ref = {}) {
56577
57268
  req.on('error', () => process.stdout.write('0'));
56578
57269
  req.on('timeout', () => { req.destroy(); process.stdout.write('0'); });
56579
57270
  `;
56580
- const result = execFileSync6(process.execPath, ["-e", probe], {
57271
+ const result = execFileSync5(process.execPath, ["-e", probe], {
56581
57272
  encoding: "utf-8",
56582
57273
  timeout: 3e3,
56583
57274
  stdio: ["ignore", "pipe", "ignore"]
@@ -56603,9 +57294,9 @@ function isDaemonRunning(ref = {}) {
56603
57294
  function isAdhdevProcess(pid) {
56604
57295
  try {
56605
57296
  if (process.platform === "win32") {
56606
- const { execFileSync: execFileSync6 } = require("child_process");
57297
+ const { execFileSync: execFileSync5 } = require("child_process");
56607
57298
  try {
56608
- const psOut = execFileSync6("powershell.exe", [
57299
+ const psOut = execFileSync5("powershell.exe", [
56609
57300
  "-NoProfile",
56610
57301
  "-NonInteractive",
56611
57302
  "-ExecutionPolicy",
@@ -56618,8 +57309,8 @@ function isAdhdevProcess(pid) {
56618
57309
  return true;
56619
57310
  }
56620
57311
  } else {
56621
- const { execFileSync: execFileSync6 } = require("child_process");
56622
- 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)], {
56623
57314
  encoding: "utf-8",
56624
57315
  timeout: 2e3,
56625
57316
  stdio: ["ignore", "pipe", "ignore"]
@@ -56633,7 +57324,7 @@ function isAdhdevProcess(pid) {
56633
57324
  function getDaemonHealthPid(ref = {}) {
56634
57325
  const port = resolveDaemonPort(ref);
56635
57326
  try {
56636
- const { execFileSync: execFileSync6 } = require("child_process");
57327
+ const { execFileSync: execFileSync5 } = require("child_process");
56637
57328
  const probe = `
56638
57329
  const http = require('http');
56639
57330
  const req = http.get('http://127.0.0.1:${port}/health', { timeout: 1500 }, (res) => {
@@ -56651,7 +57342,7 @@ function getDaemonHealthPid(ref = {}) {
56651
57342
  req.on('error', () => {});
56652
57343
  req.on('timeout', () => { req.destroy(); });
56653
57344
  `;
56654
- const result = execFileSync6(process.execPath, ["-e", probe], {
57345
+ const result = execFileSync5(process.execPath, ["-e", probe], {
56655
57346
  encoding: "utf-8",
56656
57347
  timeout: 3e3,
56657
57348
  stdio: ["ignore", "pipe", "ignore"]
@@ -56719,7 +57410,7 @@ var init_adhdev_daemon = __esm({
56719
57410
  init_version();
56720
57411
  init_src();
56721
57412
  init_runtime_defaults();
56722
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.43" });
57413
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.45" });
56723
57414
  AdhdevDaemon = class _AdhdevDaemon {
56724
57415
  localHttpServer = null;
56725
57416
  localWss = null;
@@ -57971,11 +58662,11 @@ var require_yoctocolors_cjs = __commonJS({
57971
58662
  "use strict";
57972
58663
  var tty3 = require("tty");
57973
58664
  var hasColors = tty3?.WriteStream?.prototype?.hasColors?.() ?? false;
57974
- var format = (open3, close) => {
58665
+ var format = (open2, close) => {
57975
58666
  if (!hasColors) {
57976
58667
  return (input) => input;
57977
58668
  }
57978
- const openCode = `\x1B[${open3}m`;
58669
+ const openCode = `\x1B[${open2}m`;
57979
58670
  const closeCode = `\x1B[${close}m`;
57980
58671
  return (input) => {
57981
58672
  const string4 = input + "";
@@ -61513,7 +62204,7 @@ var require_innerFrom = __commonJS({
61513
62204
  exports2.fromIterable = fromIterable;
61514
62205
  function fromAsyncIterable(asyncIterable) {
61515
62206
  return new Observable_1.Observable(function(subscriber) {
61516
- process19(asyncIterable, subscriber).catch(function(err) {
62207
+ process13(asyncIterable, subscriber).catch(function(err) {
61517
62208
  return subscriber.error(err);
61518
62209
  });
61519
62210
  });
@@ -61523,7 +62214,7 @@ var require_innerFrom = __commonJS({
61523
62214
  return fromAsyncIterable(isReadableStreamLike_1.readableStreamLikeToAsyncGenerator(readableStream));
61524
62215
  }
61525
62216
  exports2.fromReadableStreamLike = fromReadableStreamLike;
61526
- function process19(asyncIterable, subscriber) {
62217
+ function process13(asyncIterable, subscriber) {
61527
62218
  var asyncIterable_1, asyncIterable_1_1;
61528
62219
  var e_2, _a2;
61529
62220
  return __awaiter(this, void 0, void 0, function() {
@@ -69182,15 +69873,15 @@ var require_route = __commonJS({
69182
69873
  };
69183
69874
  }
69184
69875
  function wrapConversion(toModel, graph) {
69185
- const path29 = [graph[toModel].parent, toModel];
69876
+ const path28 = [graph[toModel].parent, toModel];
69186
69877
  let fn = conversions[graph[toModel].parent][toModel];
69187
69878
  let cur = graph[toModel].parent;
69188
69879
  while (graph[cur].parent) {
69189
- path29.unshift(graph[cur].parent);
69880
+ path28.unshift(graph[cur].parent);
69190
69881
  fn = link(conversions[graph[cur].parent][cur], fn);
69191
69882
  cur = graph[cur].parent;
69192
69883
  }
69193
- fn.conversion = path29;
69884
+ fn.conversion = path28;
69194
69885
  return fn;
69195
69886
  }
69196
69887
  module2.exports = function(fromModel) {
@@ -69587,7 +70278,7 @@ var require_has_flag = __commonJS({
69587
70278
  var require_supports_color = __commonJS({
69588
70279
  "../../node_modules/supports-color/index.js"(exports2, module2) {
69589
70280
  "use strict";
69590
- var os29 = require("os");
70281
+ var os28 = require("os");
69591
70282
  var tty3 = require("tty");
69592
70283
  var hasFlag3 = require_has_flag();
69593
70284
  var { env: env3 } = process;
@@ -69635,7 +70326,7 @@ var require_supports_color = __commonJS({
69635
70326
  return min;
69636
70327
  }
69637
70328
  if (process.platform === "win32") {
69638
- const osRelease = os29.release().split(".");
70329
+ const osRelease = os28.release().split(".");
69639
70330
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
69640
70331
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
69641
70332
  }
@@ -69936,18 +70627,18 @@ var require_source = __commonJS({
69936
70627
  }
69937
70628
  }
69938
70629
  });
69939
- var createStyler3 = (open3, close, parent) => {
70630
+ var createStyler3 = (open2, close, parent) => {
69940
70631
  let openAll;
69941
70632
  let closeAll;
69942
70633
  if (parent === void 0) {
69943
- openAll = open3;
70634
+ openAll = open2;
69944
70635
  closeAll = close;
69945
70636
  } else {
69946
- openAll = parent.openAll + open3;
70637
+ openAll = parent.openAll + open2;
69947
70638
  closeAll = close + parent.closeAll;
69948
70639
  }
69949
70640
  return {
69950
- open: open3,
70641
+ open: open2,
69951
70642
  close,
69952
70643
  openAll,
69953
70644
  closeAll,
@@ -70111,11 +70802,11 @@ var require_signals = __commonJS({
70111
70802
  var require_signal_exit = __commonJS({
70112
70803
  "../../node_modules/inquirer/node_modules/signal-exit/index.js"(exports2, module2) {
70113
70804
  "use strict";
70114
- var process19 = global.process;
70115
- var processOk2 = function(process20) {
70116
- 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";
70117
70808
  };
70118
- if (!processOk2(process19)) {
70809
+ if (!processOk2(process13)) {
70119
70810
  module2.exports = function() {
70120
70811
  return function() {
70121
70812
  };
@@ -70123,15 +70814,15 @@ var require_signal_exit = __commonJS({
70123
70814
  } else {
70124
70815
  assert3 = require("assert");
70125
70816
  signals2 = require_signals();
70126
- isWin = /^win/i.test(process19.platform);
70817
+ isWin = /^win/i.test(process13.platform);
70127
70818
  EE = require("events");
70128
70819
  if (typeof EE !== "function") {
70129
70820
  EE = EE.EventEmitter;
70130
70821
  }
70131
- if (process19.__signal_exit_emitter__) {
70132
- emitter = process19.__signal_exit_emitter__;
70822
+ if (process13.__signal_exit_emitter__) {
70823
+ emitter = process13.__signal_exit_emitter__;
70133
70824
  } else {
70134
- emitter = process19.__signal_exit_emitter__ = new EE();
70825
+ emitter = process13.__signal_exit_emitter__ = new EE();
70135
70826
  emitter.count = 0;
70136
70827
  emitter.emitted = {};
70137
70828
  }
@@ -70168,12 +70859,12 @@ var require_signal_exit = __commonJS({
70168
70859
  loaded = false;
70169
70860
  signals2.forEach(function(sig) {
70170
70861
  try {
70171
- process19.removeListener(sig, sigListeners[sig]);
70862
+ process13.removeListener(sig, sigListeners[sig]);
70172
70863
  } catch (er) {
70173
70864
  }
70174
70865
  });
70175
- process19.emit = originalProcessEmit;
70176
- process19.reallyExit = originalProcessReallyExit;
70866
+ process13.emit = originalProcessEmit;
70867
+ process13.reallyExit = originalProcessReallyExit;
70177
70868
  emitter.count -= 1;
70178
70869
  };
70179
70870
  module2.exports.unload = unload2;
@@ -70190,7 +70881,7 @@ var require_signal_exit = __commonJS({
70190
70881
  if (!processOk2(global.process)) {
70191
70882
  return;
70192
70883
  }
70193
- var listeners = process19.listeners(sig);
70884
+ var listeners = process13.listeners(sig);
70194
70885
  if (listeners.length === emitter.count) {
70195
70886
  unload2();
70196
70887
  emit("exit", null, sig);
@@ -70198,7 +70889,7 @@ var require_signal_exit = __commonJS({
70198
70889
  if (isWin && sig === "SIGHUP") {
70199
70890
  sig = "SIGINT";
70200
70891
  }
70201
- process19.kill(process19.pid, sig);
70892
+ process13.kill(process13.pid, sig);
70202
70893
  }
70203
70894
  };
70204
70895
  });
@@ -70214,36 +70905,36 @@ var require_signal_exit = __commonJS({
70214
70905
  emitter.count += 1;
70215
70906
  signals2 = signals2.filter(function(sig) {
70216
70907
  try {
70217
- process19.on(sig, sigListeners[sig]);
70908
+ process13.on(sig, sigListeners[sig]);
70218
70909
  return true;
70219
70910
  } catch (er) {
70220
70911
  return false;
70221
70912
  }
70222
70913
  });
70223
- process19.emit = processEmit;
70224
- process19.reallyExit = processReallyExit;
70914
+ process13.emit = processEmit;
70915
+ process13.reallyExit = processReallyExit;
70225
70916
  };
70226
70917
  module2.exports.load = load2;
70227
- originalProcessReallyExit = process19.reallyExit;
70918
+ originalProcessReallyExit = process13.reallyExit;
70228
70919
  processReallyExit = function processReallyExit2(code) {
70229
70920
  if (!processOk2(global.process)) {
70230
70921
  return;
70231
70922
  }
70232
- process19.exitCode = code || /* istanbul ignore next */
70923
+ process13.exitCode = code || /* istanbul ignore next */
70233
70924
  0;
70234
- emit("exit", process19.exitCode, null);
70235
- emit("afterexit", process19.exitCode, null);
70236
- originalProcessReallyExit.call(process19, process19.exitCode);
70925
+ emit("exit", process13.exitCode, null);
70926
+ emit("afterexit", process13.exitCode, null);
70927
+ originalProcessReallyExit.call(process13, process13.exitCode);
70237
70928
  };
70238
- originalProcessEmit = process19.emit;
70929
+ originalProcessEmit = process13.emit;
70239
70930
  processEmit = function processEmit2(ev, arg) {
70240
70931
  if (ev === "exit" && processOk2(global.process)) {
70241
70932
  if (arg !== void 0) {
70242
- process19.exitCode = arg;
70933
+ process13.exitCode = arg;
70243
70934
  }
70244
70935
  var ret = originalProcessEmit.apply(this, arguments);
70245
- emit("exit", process19.exitCode, null);
70246
- emit("afterexit", process19.exitCode, null);
70936
+ emit("exit", process13.exitCode, null);
70937
+ emit("afterexit", process13.exitCode, null);
70247
70938
  return ret;
70248
70939
  } else {
70249
70940
  return originalProcessEmit.apply(this, arguments);
@@ -72433,12 +73124,12 @@ var require_buffer_list = __commonJS({
72433
73124
  return (hint === "string" ? String : Number)(input);
72434
73125
  }
72435
73126
  var _require = require("buffer");
72436
- var Buffer3 = _require.Buffer;
73127
+ var Buffer2 = _require.Buffer;
72437
73128
  var _require2 = require("util");
72438
73129
  var inspect = _require2.inspect;
72439
73130
  var custom2 = inspect && inspect.custom || "inspect";
72440
73131
  function copyBuffer(src, target, offset) {
72441
- Buffer3.prototype.copy.call(src, target, offset);
73132
+ Buffer2.prototype.copy.call(src, target, offset);
72442
73133
  }
72443
73134
  module2.exports = /* @__PURE__ */ (function() {
72444
73135
  function BufferList() {
@@ -72498,8 +73189,8 @@ var require_buffer_list = __commonJS({
72498
73189
  }, {
72499
73190
  key: "concat",
72500
73191
  value: function concat(n) {
72501
- if (this.length === 0) return Buffer3.alloc(0);
72502
- var ret = Buffer3.allocUnsafe(n >>> 0);
73192
+ if (this.length === 0) return Buffer2.alloc(0);
73193
+ var ret = Buffer2.allocUnsafe(n >>> 0);
72503
73194
  var p = this.head;
72504
73195
  var i = 0;
72505
73196
  while (p) {
@@ -72563,7 +73254,7 @@ var require_buffer_list = __commonJS({
72563
73254
  }, {
72564
73255
  key: "_getBuffer",
72565
73256
  value: function _getBuffer(n) {
72566
- var ret = Buffer3.allocUnsafe(n);
73257
+ var ret = Buffer2.allocUnsafe(n);
72567
73258
  var p = this.head;
72568
73259
  var c = 1;
72569
73260
  p.data.copy(ret);
@@ -72895,14 +73586,14 @@ var require_stream_writable = __commonJS({
72895
73586
  deprecate: require_node()
72896
73587
  };
72897
73588
  var Stream = require_stream();
72898
- var Buffer3 = require("buffer").Buffer;
73589
+ var Buffer2 = require("buffer").Buffer;
72899
73590
  var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
72900
73591
  };
72901
73592
  function _uint8ArrayToBuffer(chunk) {
72902
- return Buffer3.from(chunk);
73593
+ return Buffer2.from(chunk);
72903
73594
  }
72904
73595
  function _isUint8Array(obj) {
72905
- return Buffer3.isBuffer(obj) || obj instanceof OurUint8Array;
73596
+ return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
72906
73597
  }
72907
73598
  var destroyImpl = require_destroy();
72908
73599
  var _require = require_state();
@@ -73030,7 +73721,7 @@ var require_stream_writable = __commonJS({
73030
73721
  var state = this._writableState;
73031
73722
  var ret = false;
73032
73723
  var isBuf = !state.objectMode && _isUint8Array(chunk);
73033
- if (isBuf && !Buffer3.isBuffer(chunk)) {
73724
+ if (isBuf && !Buffer2.isBuffer(chunk)) {
73034
73725
  chunk = _uint8ArrayToBuffer(chunk);
73035
73726
  }
73036
73727
  if (typeof encoding === "function") {
@@ -73074,7 +73765,7 @@ var require_stream_writable = __commonJS({
73074
73765
  });
73075
73766
  function decodeChunk(state, chunk, encoding) {
73076
73767
  if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") {
73077
- chunk = Buffer3.from(chunk, encoding);
73768
+ chunk = Buffer2.from(chunk, encoding);
73078
73769
  }
73079
73770
  return chunk;
73080
73771
  }
@@ -73445,34 +74136,34 @@ var require_safe_buffer = __commonJS({
73445
74136
  "../../node_modules/safe-buffer/index.js"(exports2, module2) {
73446
74137
  "use strict";
73447
74138
  var buffer = require("buffer");
73448
- var Buffer3 = buffer.Buffer;
74139
+ var Buffer2 = buffer.Buffer;
73449
74140
  function copyProps(src, dst) {
73450
74141
  for (var key in src) {
73451
74142
  dst[key] = src[key];
73452
74143
  }
73453
74144
  }
73454
- if (Buffer3.from && Buffer3.alloc && Buffer3.allocUnsafe && Buffer3.allocUnsafeSlow) {
74145
+ if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
73455
74146
  module2.exports = buffer;
73456
74147
  } else {
73457
74148
  copyProps(buffer, exports2);
73458
74149
  exports2.Buffer = SafeBuffer;
73459
74150
  }
73460
74151
  function SafeBuffer(arg, encodingOrOffset, length) {
73461
- return Buffer3(arg, encodingOrOffset, length);
74152
+ return Buffer2(arg, encodingOrOffset, length);
73462
74153
  }
73463
- SafeBuffer.prototype = Object.create(Buffer3.prototype);
73464
- copyProps(Buffer3, SafeBuffer);
74154
+ SafeBuffer.prototype = Object.create(Buffer2.prototype);
74155
+ copyProps(Buffer2, SafeBuffer);
73465
74156
  SafeBuffer.from = function(arg, encodingOrOffset, length) {
73466
74157
  if (typeof arg === "number") {
73467
74158
  throw new TypeError("Argument must not be a number");
73468
74159
  }
73469
- return Buffer3(arg, encodingOrOffset, length);
74160
+ return Buffer2(arg, encodingOrOffset, length);
73470
74161
  };
73471
74162
  SafeBuffer.alloc = function(size, fill, encoding) {
73472
74163
  if (typeof size !== "number") {
73473
74164
  throw new TypeError("Argument must be a number");
73474
74165
  }
73475
- var buf = Buffer3(size);
74166
+ var buf = Buffer2(size);
73476
74167
  if (fill !== void 0) {
73477
74168
  if (typeof encoding === "string") {
73478
74169
  buf.fill(fill, encoding);
@@ -73488,7 +74179,7 @@ var require_safe_buffer = __commonJS({
73488
74179
  if (typeof size !== "number") {
73489
74180
  throw new TypeError("Argument must be a number");
73490
74181
  }
73491
- return Buffer3(size);
74182
+ return Buffer2(size);
73492
74183
  };
73493
74184
  SafeBuffer.allocUnsafeSlow = function(size) {
73494
74185
  if (typeof size !== "number") {
@@ -73503,8 +74194,8 @@ var require_safe_buffer = __commonJS({
73503
74194
  var require_string_decoder = __commonJS({
73504
74195
  "../../node_modules/string_decoder/lib/string_decoder.js"(exports2) {
73505
74196
  "use strict";
73506
- var Buffer3 = require_safe_buffer().Buffer;
73507
- var isEncoding = Buffer3.isEncoding || function(encoding) {
74197
+ var Buffer2 = require_safe_buffer().Buffer;
74198
+ var isEncoding = Buffer2.isEncoding || function(encoding) {
73508
74199
  encoding = "" + encoding;
73509
74200
  switch (encoding && encoding.toLowerCase()) {
73510
74201
  case "hex":
@@ -73552,7 +74243,7 @@ var require_string_decoder = __commonJS({
73552
74243
  }
73553
74244
  function normalizeEncoding(enc) {
73554
74245
  var nenc = _normalizeEncoding(enc);
73555
- 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);
73556
74247
  return nenc || enc;
73557
74248
  }
73558
74249
  exports2.StringDecoder = StringDecoder;
@@ -73581,7 +74272,7 @@ var require_string_decoder = __commonJS({
73581
74272
  }
73582
74273
  this.lastNeed = 0;
73583
74274
  this.lastTotal = 0;
73584
- this.lastChar = Buffer3.allocUnsafe(nb);
74275
+ this.lastChar = Buffer2.allocUnsafe(nb);
73585
74276
  }
73586
74277
  StringDecoder.prototype.write = function(buf) {
73587
74278
  if (buf.length === 0) return "";
@@ -74142,14 +74833,14 @@ var require_stream_readable = __commonJS({
74142
74833
  return emitter.listeners(type).length;
74143
74834
  };
74144
74835
  var Stream = require_stream();
74145
- var Buffer3 = require("buffer").Buffer;
74836
+ var Buffer2 = require("buffer").Buffer;
74146
74837
  var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
74147
74838
  };
74148
74839
  function _uint8ArrayToBuffer(chunk) {
74149
- return Buffer3.from(chunk);
74840
+ return Buffer2.from(chunk);
74150
74841
  }
74151
74842
  function _isUint8Array(obj) {
74152
- return Buffer3.isBuffer(obj) || obj instanceof OurUint8Array;
74843
+ return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
74153
74844
  }
74154
74845
  var debugUtil = require("util");
74155
74846
  var debug;
@@ -74257,7 +74948,7 @@ var require_stream_readable = __commonJS({
74257
74948
  if (typeof chunk === "string") {
74258
74949
  encoding = encoding || state.defaultEncoding;
74259
74950
  if (encoding !== state.encoding) {
74260
- chunk = Buffer3.from(chunk, encoding);
74951
+ chunk = Buffer2.from(chunk, encoding);
74261
74952
  encoding = "";
74262
74953
  }
74263
74954
  skipChunkCheck = true;
@@ -74282,7 +74973,7 @@ var require_stream_readable = __commonJS({
74282
74973
  if (er) {
74283
74974
  errorOrDestroy(stream, er);
74284
74975
  } else if (state.objectMode || chunk && chunk.length > 0) {
74285
- if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer3.prototype) {
74976
+ if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer2.prototype) {
74286
74977
  chunk = _uint8ArrayToBuffer(chunk);
74287
74978
  }
74288
74979
  if (addToFront) {
@@ -75093,7 +75784,7 @@ var require_readable = __commonJS({
75093
75784
  var require_BufferList = __commonJS({
75094
75785
  "../../node_modules/bl/BufferList.js"(exports2, module2) {
75095
75786
  "use strict";
75096
- var { Buffer: Buffer3 } = require("buffer");
75787
+ var { Buffer: Buffer2 } = require("buffer");
75097
75788
  var symbol2 = /* @__PURE__ */ Symbol.for("BufferList");
75098
75789
  function BufferList(buf) {
75099
75790
  if (!(this instanceof BufferList)) {
@@ -75157,10 +75848,10 @@ var require_BufferList = __commonJS({
75157
75848
  srcEnd = this.length;
75158
75849
  }
75159
75850
  if (srcStart >= this.length) {
75160
- return dst || Buffer3.alloc(0);
75851
+ return dst || Buffer2.alloc(0);
75161
75852
  }
75162
75853
  if (srcEnd <= 0) {
75163
- return dst || Buffer3.alloc(0);
75854
+ return dst || Buffer2.alloc(0);
75164
75855
  }
75165
75856
  const copy2 = !!dst;
75166
75857
  const off = this._offset(srcStart);
@@ -75170,7 +75861,7 @@ var require_BufferList = __commonJS({
75170
75861
  let start = off[1];
75171
75862
  if (srcStart === 0 && srcEnd === this.length) {
75172
75863
  if (!copy2) {
75173
- 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);
75174
75865
  }
75175
75866
  for (let i = 0; i < this._bufs.length; i++) {
75176
75867
  this._bufs[i].copy(dst, bufoff);
@@ -75182,7 +75873,7 @@ var require_BufferList = __commonJS({
75182
75873
  return copy2 ? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes) : this._bufs[off[0]].slice(start, start + bytes);
75183
75874
  }
75184
75875
  if (!copy2) {
75185
- dst = Buffer3.allocUnsafe(len);
75876
+ dst = Buffer2.allocUnsafe(len);
75186
75877
  }
75187
75878
  for (let i = off[0]; i < this._bufs.length; i++) {
75188
75879
  const l = this._bufs[i].length - start;
@@ -75258,7 +75949,7 @@ var require_BufferList = __commonJS({
75258
75949
  return this;
75259
75950
  }
75260
75951
  if (buf.buffer) {
75261
- this._appendBuffer(Buffer3.from(buf.buffer, buf.byteOffset, buf.byteLength));
75952
+ this._appendBuffer(Buffer2.from(buf.buffer, buf.byteOffset, buf.byteLength));
75262
75953
  } else if (Array.isArray(buf)) {
75263
75954
  for (let i = 0; i < buf.length; i++) {
75264
75955
  this.append(buf[i]);
@@ -75271,7 +75962,7 @@ var require_BufferList = __commonJS({
75271
75962
  if (typeof buf === "number") {
75272
75963
  buf = buf.toString();
75273
75964
  }
75274
- this._appendBuffer(Buffer3.from(buf));
75965
+ this._appendBuffer(Buffer2.from(buf));
75275
75966
  }
75276
75967
  return this;
75277
75968
  };
@@ -75287,15 +75978,15 @@ var require_BufferList = __commonJS({
75287
75978
  if (typeof search === "function" || Array.isArray(search)) {
75288
75979
  throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');
75289
75980
  } else if (typeof search === "number") {
75290
- search = Buffer3.from([search]);
75981
+ search = Buffer2.from([search]);
75291
75982
  } else if (typeof search === "string") {
75292
- search = Buffer3.from(search, encoding);
75983
+ search = Buffer2.from(search, encoding);
75293
75984
  } else if (this._isBufferList(search)) {
75294
75985
  search = search.slice();
75295
75986
  } else if (Array.isArray(search.buffer)) {
75296
- search = Buffer3.from(search.buffer, search.byteOffset, search.byteLength);
75297
- } else if (!Buffer3.isBuffer(search)) {
75298
- 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);
75299
75990
  }
75300
75991
  offset = Number(offset || 0);
75301
75992
  if (isNaN(offset)) {
@@ -82611,10 +83302,10 @@ var require_lib2 = __commonJS({
82611
83302
  exports2.analyse = analyse;
82612
83303
  var detectFile = (filepath, opts = {}) => new Promise((resolve16, reject) => {
82613
83304
  let fd;
82614
- const fs24 = (0, node_1.default)();
83305
+ const fs19 = (0, node_1.default)();
82615
83306
  const handler = (err, buffer) => {
82616
83307
  if (fd) {
82617
- fs24.closeSync(fd);
83308
+ fs19.closeSync(fd);
82618
83309
  }
82619
83310
  if (err) {
82620
83311
  reject(err);
@@ -82626,9 +83317,9 @@ var require_lib2 = __commonJS({
82626
83317
  };
82627
83318
  const sampleSize = (opts === null || opts === void 0 ? void 0 : opts.sampleSize) || 0;
82628
83319
  if (sampleSize > 0) {
82629
- fd = fs24.openSync(filepath, "r");
83320
+ fd = fs19.openSync(filepath, "r");
82630
83321
  let sample = Buffer.allocUnsafe(sampleSize);
82631
- fs24.read(fd, sample, 0, sampleSize, opts.offset, (err, bytesRead) => {
83322
+ fs19.read(fd, sample, 0, sampleSize, opts.offset, (err, bytesRead) => {
82632
83323
  if (err) {
82633
83324
  handler(err, null);
82634
83325
  } else {
@@ -82640,22 +83331,22 @@ var require_lib2 = __commonJS({
82640
83331
  });
82641
83332
  return;
82642
83333
  }
82643
- fs24.readFile(filepath, handler);
83334
+ fs19.readFile(filepath, handler);
82644
83335
  });
82645
83336
  exports2.detectFile = detectFile;
82646
83337
  var detectFileSync = (filepath, opts = {}) => {
82647
- const fs24 = (0, node_1.default)();
83338
+ const fs19 = (0, node_1.default)();
82648
83339
  if (opts && opts.sampleSize) {
82649
- const fd = fs24.openSync(filepath, "r");
83340
+ const fd = fs19.openSync(filepath, "r");
82650
83341
  let sample = Buffer.allocUnsafe(opts.sampleSize);
82651
- const bytesRead = fs24.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
83342
+ const bytesRead = fs19.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
82652
83343
  if (bytesRead < opts.sampleSize) {
82653
83344
  sample = sample.subarray(0, bytesRead);
82654
83345
  }
82655
- fs24.closeSync(fd);
83346
+ fs19.closeSync(fd);
82656
83347
  return (0, exports2.detect)(sample);
82657
83348
  }
82658
- return (0, exports2.detect)(fs24.readFileSync(filepath));
83349
+ return (0, exports2.detect)(fs19.readFileSync(filepath));
82659
83350
  };
82660
83351
  exports2.detectFileSync = detectFileSync;
82661
83352
  exports2.default = {
@@ -82672,7 +83363,7 @@ var require_safer = __commonJS({
82672
83363
  "../../node_modules/safer-buffer/safer.js"(exports2, module2) {
82673
83364
  "use strict";
82674
83365
  var buffer = require("buffer");
82675
- var Buffer3 = buffer.Buffer;
83366
+ var Buffer2 = buffer.Buffer;
82676
83367
  var safer = {};
82677
83368
  var key;
82678
83369
  for (key in buffer) {
@@ -82681,12 +83372,12 @@ var require_safer = __commonJS({
82681
83372
  safer[key] = buffer[key];
82682
83373
  }
82683
83374
  var Safer = safer.Buffer = {};
82684
- for (key in Buffer3) {
82685
- if (!Buffer3.hasOwnProperty(key)) continue;
83375
+ for (key in Buffer2) {
83376
+ if (!Buffer2.hasOwnProperty(key)) continue;
82686
83377
  if (key === "allocUnsafe" || key === "allocUnsafeSlow") continue;
82687
- Safer[key] = Buffer3[key];
83378
+ Safer[key] = Buffer2[key];
82688
83379
  }
82689
- safer.Buffer.prototype = Buffer3.prototype;
83380
+ safer.Buffer.prototype = Buffer2.prototype;
82690
83381
  if (!Safer.from || Safer.from === Uint8Array.from) {
82691
83382
  Safer.from = function(value, encodingOrOffset, length) {
82692
83383
  if (typeof value === "number") {
@@ -82695,7 +83386,7 @@ var require_safer = __commonJS({
82695
83386
  if (value && typeof value.length === "undefined") {
82696
83387
  throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value);
82697
83388
  }
82698
- return Buffer3(value, encodingOrOffset, length);
83389
+ return Buffer2(value, encodingOrOffset, length);
82699
83390
  };
82700
83391
  }
82701
83392
  if (!Safer.alloc) {
@@ -82706,7 +83397,7 @@ var require_safer = __commonJS({
82706
83397
  if (size < 0 || size >= 2 * (1 << 30)) {
82707
83398
  throw new RangeError('The value "' + size + '" is invalid for option "size"');
82708
83399
  }
82709
- var buf = Buffer3(size);
83400
+ var buf = Buffer2(size);
82710
83401
  if (!fill || fill.length === 0) {
82711
83402
  buf.fill(0);
82712
83403
  } else if (typeof encoding === "string") {
@@ -82801,7 +83492,7 @@ var require_merge_exports = __commonJS({
82801
83492
  var require_internal = __commonJS({
82802
83493
  "../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/internal.js"(exports2, module2) {
82803
83494
  "use strict";
82804
- var Buffer3 = require_safer().Buffer;
83495
+ var Buffer2 = require_safer().Buffer;
82805
83496
  module2.exports = {
82806
83497
  // Encodings
82807
83498
  utf8: { type: "_internal", bomAware: true },
@@ -82825,7 +83516,7 @@ var require_internal = __commonJS({
82825
83516
  } else if (this.enc === "cesu8") {
82826
83517
  this.enc = "utf8";
82827
83518
  this.encoder = InternalEncoderCesu8;
82828
- if (Buffer3.from("eda0bdedb2a9", "hex").toString() !== "\u{1F4A9}") {
83519
+ if (Buffer2.from("eda0bdedb2a9", "hex").toString() !== "\u{1F4A9}") {
82829
83520
  this.decoder = InternalDecoderCesu8;
82830
83521
  this.defaultCharUnicode = iconv2.defaultCharUnicode;
82831
83522
  }
@@ -82838,8 +83529,8 @@ var require_internal = __commonJS({
82838
83529
  this.decoder = new StringDecoder(codec2.enc);
82839
83530
  }
82840
83531
  InternalDecoder.prototype.write = function(buf) {
82841
- if (!Buffer3.isBuffer(buf)) {
82842
- buf = Buffer3.from(buf);
83532
+ if (!Buffer2.isBuffer(buf)) {
83533
+ buf = Buffer2.from(buf);
82843
83534
  }
82844
83535
  return this.decoder.write(buf);
82845
83536
  };
@@ -82850,7 +83541,7 @@ var require_internal = __commonJS({
82850
83541
  this.enc = codec2.enc;
82851
83542
  }
82852
83543
  InternalEncoder.prototype.write = function(str) {
82853
- return Buffer3.from(str, this.enc);
83544
+ return Buffer2.from(str, this.enc);
82854
83545
  };
82855
83546
  InternalEncoder.prototype.end = function() {
82856
83547
  };
@@ -82862,15 +83553,15 @@ var require_internal = __commonJS({
82862
83553
  var completeQuads = str.length - str.length % 4;
82863
83554
  this.prevStr = str.slice(completeQuads);
82864
83555
  str = str.slice(0, completeQuads);
82865
- return Buffer3.from(str, "base64");
83556
+ return Buffer2.from(str, "base64");
82866
83557
  };
82867
83558
  InternalEncoderBase64.prototype.end = function() {
82868
- return Buffer3.from(this.prevStr, "base64");
83559
+ return Buffer2.from(this.prevStr, "base64");
82869
83560
  };
82870
83561
  function InternalEncoderCesu8(options, codec2) {
82871
83562
  }
82872
83563
  InternalEncoderCesu8.prototype.write = function(str) {
82873
- var buf = Buffer3.alloc(str.length * 3);
83564
+ var buf = Buffer2.alloc(str.length * 3);
82874
83565
  var bufIdx = 0;
82875
83566
  for (var i = 0; i < str.length; i++) {
82876
83567
  var charCode = str.charCodeAt(i);
@@ -82966,13 +83657,13 @@ var require_internal = __commonJS({
82966
83657
  str = str.slice(0, str.length - 1);
82967
83658
  }
82968
83659
  }
82969
- return Buffer3.from(str, this.enc);
83660
+ return Buffer2.from(str, this.enc);
82970
83661
  };
82971
83662
  InternalEncoderUtf8.prototype.end = function() {
82972
83663
  if (this.highSurrogate) {
82973
83664
  var str = this.highSurrogate;
82974
83665
  this.highSurrogate = "";
82975
- return Buffer3.from(str, this.enc);
83666
+ return Buffer2.from(str, this.enc);
82976
83667
  }
82977
83668
  };
82978
83669
  }
@@ -82982,7 +83673,7 @@ var require_internal = __commonJS({
82982
83673
  var require_utf32 = __commonJS({
82983
83674
  "../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/utf32.js"(exports2) {
82984
83675
  "use strict";
82985
- var Buffer3 = require_safer().Buffer;
83676
+ var Buffer2 = require_safer().Buffer;
82986
83677
  exports2._utf32 = Utf32Codec;
82987
83678
  function Utf32Codec(codecOptions, iconv2) {
82988
83679
  this.iconv = iconv2;
@@ -83000,8 +83691,8 @@ var require_utf32 = __commonJS({
83000
83691
  this.highSurrogate = 0;
83001
83692
  }
83002
83693
  Utf32Encoder.prototype.write = function(str) {
83003
- var src = Buffer3.from(str, "ucs2");
83004
- var dst = Buffer3.alloc(src.length * 2);
83694
+ var src = Buffer2.from(str, "ucs2");
83695
+ var dst = Buffer2.alloc(src.length * 2);
83005
83696
  var write32 = this.isLE ? dst.writeUInt32LE : dst.writeUInt32BE;
83006
83697
  var offset = 0;
83007
83698
  for (var i = 0; i < src.length; i += 2) {
@@ -83037,7 +83728,7 @@ var require_utf32 = __commonJS({
83037
83728
  if (!this.highSurrogate) {
83038
83729
  return;
83039
83730
  }
83040
- var buf = Buffer3.alloc(4);
83731
+ var buf = Buffer2.alloc(4);
83041
83732
  if (this.isLE) {
83042
83733
  buf.writeUInt32LE(this.highSurrogate, 0);
83043
83734
  } else {
@@ -83057,7 +83748,7 @@ var require_utf32 = __commonJS({
83057
83748
  }
83058
83749
  var i = 0;
83059
83750
  var codepoint = 0;
83060
- var dst = Buffer3.alloc(src.length + 4);
83751
+ var dst = Buffer2.alloc(src.length + 4);
83061
83752
  var offset = 0;
83062
83753
  var isLE = this.isLE;
83063
83754
  var overflow = this.overflow;
@@ -83213,7 +83904,7 @@ var require_utf32 = __commonJS({
83213
83904
  var require_utf16 = __commonJS({
83214
83905
  "../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/utf16.js"(exports2) {
83215
83906
  "use strict";
83216
- var Buffer3 = require_safer().Buffer;
83907
+ var Buffer2 = require_safer().Buffer;
83217
83908
  exports2.utf16be = Utf16BECodec;
83218
83909
  function Utf16BECodec() {
83219
83910
  }
@@ -83223,7 +83914,7 @@ var require_utf16 = __commonJS({
83223
83914
  function Utf16BEEncoder() {
83224
83915
  }
83225
83916
  Utf16BEEncoder.prototype.write = function(str) {
83226
- var buf = Buffer3.from(str, "ucs2");
83917
+ var buf = Buffer2.from(str, "ucs2");
83227
83918
  for (var i = 0; i < buf.length; i += 2) {
83228
83919
  var tmp = buf[i];
83229
83920
  buf[i] = buf[i + 1];
@@ -83240,7 +83931,7 @@ var require_utf16 = __commonJS({
83240
83931
  if (buf.length == 0) {
83241
83932
  return "";
83242
83933
  }
83243
- var buf2 = Buffer3.alloc(buf.length + 1);
83934
+ var buf2 = Buffer2.alloc(buf.length + 1);
83244
83935
  var i = 0;
83245
83936
  var j = 0;
83246
83937
  if (this.overflowByte !== -1) {
@@ -83356,7 +84047,7 @@ var require_utf16 = __commonJS({
83356
84047
  var require_utf7 = __commonJS({
83357
84048
  "../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/utf7.js"(exports2) {
83358
84049
  "use strict";
83359
- var Buffer3 = require_safer().Buffer;
84050
+ var Buffer2 = require_safer().Buffer;
83360
84051
  exports2.utf7 = Utf7Codec;
83361
84052
  exports2.unicode11utf7 = "utf7";
83362
84053
  function Utf7Codec(codecOptions, iconv2) {
@@ -83370,7 +84061,7 @@ var require_utf7 = __commonJS({
83370
84061
  this.iconv = codec2.iconv;
83371
84062
  }
83372
84063
  Utf7Encoder.prototype.write = function(str) {
83373
- return Buffer3.from(str.replace(nonDirectChars, function(chunk) {
84064
+ return Buffer2.from(str.replace(nonDirectChars, function(chunk) {
83374
84065
  return "+" + (chunk === "+" ? "" : this.iconv.encode(chunk, "utf16-be").toString("base64").replace(/=+$/, "")) + "-";
83375
84066
  }.bind(this)));
83376
84067
  };
@@ -83408,7 +84099,7 @@ var require_utf7 = __commonJS({
83408
84099
  res += "+";
83409
84100
  } else {
83410
84101
  var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i2), "ascii");
83411
- res += this.iconv.decode(Buffer3.from(b64str, "base64"), "utf16-be");
84102
+ res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
83412
84103
  }
83413
84104
  if (buf[i2] != minusChar) {
83414
84105
  i2--;
@@ -83426,7 +84117,7 @@ var require_utf7 = __commonJS({
83426
84117
  var canBeDecoded = b64str.length - b64str.length % 8;
83427
84118
  base64Accum = b64str.slice(canBeDecoded);
83428
84119
  b64str = b64str.slice(0, canBeDecoded);
83429
- res += this.iconv.decode(Buffer3.from(b64str, "base64"), "utf16-be");
84120
+ res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
83430
84121
  }
83431
84122
  this.inBase64 = inBase64;
83432
84123
  this.base64Accum = base64Accum;
@@ -83435,7 +84126,7 @@ var require_utf7 = __commonJS({
83435
84126
  Utf7Decoder.prototype.end = function() {
83436
84127
  var res = "";
83437
84128
  if (this.inBase64 && this.base64Accum.length > 0) {
83438
- res = this.iconv.decode(Buffer3.from(this.base64Accum, "base64"), "utf16-be");
84129
+ res = this.iconv.decode(Buffer2.from(this.base64Accum, "base64"), "utf16-be");
83439
84130
  }
83440
84131
  this.inBase64 = false;
83441
84132
  this.base64Accum = "";
@@ -83451,14 +84142,14 @@ var require_utf7 = __commonJS({
83451
84142
  function Utf7IMAPEncoder(options, codec2) {
83452
84143
  this.iconv = codec2.iconv;
83453
84144
  this.inBase64 = false;
83454
- this.base64Accum = Buffer3.alloc(6);
84145
+ this.base64Accum = Buffer2.alloc(6);
83455
84146
  this.base64AccumIdx = 0;
83456
84147
  }
83457
84148
  Utf7IMAPEncoder.prototype.write = function(str) {
83458
84149
  var inBase64 = this.inBase64;
83459
84150
  var base64Accum = this.base64Accum;
83460
84151
  var base64AccumIdx = this.base64AccumIdx;
83461
- var buf = Buffer3.alloc(str.length * 5 + 10);
84152
+ var buf = Buffer2.alloc(str.length * 5 + 10);
83462
84153
  var bufIdx = 0;
83463
84154
  for (var i2 = 0; i2 < str.length; i2++) {
83464
84155
  var uChar = str.charCodeAt(i2);
@@ -83497,7 +84188,7 @@ var require_utf7 = __commonJS({
83497
84188
  return buf.slice(0, bufIdx);
83498
84189
  };
83499
84190
  Utf7IMAPEncoder.prototype.end = function() {
83500
- var buf = Buffer3.alloc(10);
84191
+ var buf = Buffer2.alloc(10);
83501
84192
  var bufIdx = 0;
83502
84193
  if (this.inBase64) {
83503
84194
  if (this.base64AccumIdx > 0) {
@@ -83534,7 +84225,7 @@ var require_utf7 = __commonJS({
83534
84225
  res += "&";
83535
84226
  } else {
83536
84227
  var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i2), "ascii").replace(/,/g, "/");
83537
- res += this.iconv.decode(Buffer3.from(b64str, "base64"), "utf16-be");
84228
+ res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
83538
84229
  }
83539
84230
  if (buf[i2] != minusChar) {
83540
84231
  i2--;
@@ -83552,7 +84243,7 @@ var require_utf7 = __commonJS({
83552
84243
  var canBeDecoded = b64str.length - b64str.length % 8;
83553
84244
  base64Accum = b64str.slice(canBeDecoded);
83554
84245
  b64str = b64str.slice(0, canBeDecoded);
83555
- res += this.iconv.decode(Buffer3.from(b64str, "base64"), "utf16-be");
84246
+ res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
83556
84247
  }
83557
84248
  this.inBase64 = inBase64;
83558
84249
  this.base64Accum = base64Accum;
@@ -83561,7 +84252,7 @@ var require_utf7 = __commonJS({
83561
84252
  Utf7IMAPDecoder.prototype.end = function() {
83562
84253
  var res = "";
83563
84254
  if (this.inBase64 && this.base64Accum.length > 0) {
83564
- res = this.iconv.decode(Buffer3.from(this.base64Accum, "base64"), "utf16-be");
84255
+ res = this.iconv.decode(Buffer2.from(this.base64Accum, "base64"), "utf16-be");
83565
84256
  }
83566
84257
  this.inBase64 = false;
83567
84258
  this.base64Accum = "";
@@ -83574,7 +84265,7 @@ var require_utf7 = __commonJS({
83574
84265
  var require_sbcs_codec = __commonJS({
83575
84266
  "../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/sbcs-codec.js"(exports2) {
83576
84267
  "use strict";
83577
- var Buffer3 = require_safer().Buffer;
84268
+ var Buffer2 = require_safer().Buffer;
83578
84269
  exports2._sbcs = SBCSCodec;
83579
84270
  function SBCSCodec(codecOptions, iconv2) {
83580
84271
  if (!codecOptions) {
@@ -83590,8 +84281,8 @@ var require_sbcs_codec = __commonJS({
83590
84281
  }
83591
84282
  codecOptions.chars = asciiString + codecOptions.chars;
83592
84283
  }
83593
- this.decodeBuf = Buffer3.from(codecOptions.chars, "ucs2");
83594
- 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));
83595
84286
  for (var i = 0; i < codecOptions.chars.length; i++) {
83596
84287
  encodeBuf[codecOptions.chars.charCodeAt(i)] = i;
83597
84288
  }
@@ -83603,7 +84294,7 @@ var require_sbcs_codec = __commonJS({
83603
84294
  this.encodeBuf = codec2.encodeBuf;
83604
84295
  }
83605
84296
  SBCSEncoder.prototype.write = function(str) {
83606
- var buf = Buffer3.alloc(str.length);
84297
+ var buf = Buffer2.alloc(str.length);
83607
84298
  for (var i = 0; i < str.length; i++) {
83608
84299
  buf[i] = this.encodeBuf[str.charCodeAt(i)];
83609
84300
  }
@@ -83616,7 +84307,7 @@ var require_sbcs_codec = __commonJS({
83616
84307
  }
83617
84308
  SBCSDecoder.prototype.write = function(buf) {
83618
84309
  var decodeBuf = this.decodeBuf;
83619
- var newBuf = Buffer3.alloc(buf.length * 2);
84310
+ var newBuf = Buffer2.alloc(buf.length * 2);
83620
84311
  var idx1 = 0;
83621
84312
  var idx2 = 0;
83622
84313
  for (var i = 0; i < buf.length; i++) {
@@ -84244,7 +84935,7 @@ var require_sbcs_data_generated = __commonJS({
84244
84935
  var require_dbcs_codec = __commonJS({
84245
84936
  "../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/dbcs-codec.js"(exports2) {
84246
84937
  "use strict";
84247
- var Buffer3 = require_safer().Buffer;
84938
+ var Buffer2 = require_safer().Buffer;
84248
84939
  exports2._dbcs = DBCSCodec;
84249
84940
  var UNASSIGNED = -1;
84250
84941
  var GB18030_CODE = -2;
@@ -84480,7 +85171,7 @@ var require_dbcs_codec = __commonJS({
84480
85171
  this.gb18030 = codec2.gb18030;
84481
85172
  }
84482
85173
  DBCSEncoder.prototype.write = function(str) {
84483
- var newBuf = Buffer3.alloc(str.length * (this.gb18030 ? 4 : 3));
85174
+ var newBuf = Buffer2.alloc(str.length * (this.gb18030 ? 4 : 3));
84484
85175
  var leadSurrogate = this.leadSurrogate;
84485
85176
  var seqObj = this.seqObj;
84486
85177
  var nextChar = -1;
@@ -84584,7 +85275,7 @@ var require_dbcs_codec = __commonJS({
84584
85275
  if (this.leadSurrogate === -1 && this.seqObj === void 0) {
84585
85276
  return;
84586
85277
  }
84587
- var newBuf = Buffer3.alloc(10);
85278
+ var newBuf = Buffer2.alloc(10);
84588
85279
  var j = 0;
84589
85280
  if (this.seqObj) {
84590
85281
  var dbcsCode = this.seqObj[DEF_CHAR];
@@ -84615,7 +85306,7 @@ var require_dbcs_codec = __commonJS({
84615
85306
  this.gb18030 = codec2.gb18030;
84616
85307
  }
84617
85308
  DBCSDecoder.prototype.write = function(buf) {
84618
- var newBuf = Buffer3.alloc(buf.length * 2);
85309
+ var newBuf = Buffer2.alloc(buf.length * 2);
84619
85310
  var nodeIdx = this.nodeIdx;
84620
85311
  var prevBytes = this.prevBytes;
84621
85312
  var prevOffset = this.prevBytes.length;
@@ -86224,7 +86915,7 @@ var require_encodings = __commonJS({
86224
86915
  var require_streams = __commonJS({
86225
86916
  "../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/lib/streams.js"(exports2, module2) {
86226
86917
  "use strict";
86227
- var Buffer3 = require_safer().Buffer;
86918
+ var Buffer2 = require_safer().Buffer;
86228
86919
  module2.exports = function(streamModule) {
86229
86920
  var Transform = streamModule.Transform;
86230
86921
  function IconvLiteEncoderStream(conv, options) {
@@ -86264,7 +86955,7 @@ var require_streams = __commonJS({
86264
86955
  chunks.push(chunk);
86265
86956
  });
86266
86957
  this.on("end", function() {
86267
- cb(null, Buffer3.concat(chunks));
86958
+ cb(null, Buffer2.concat(chunks));
86268
86959
  });
86269
86960
  return this;
86270
86961
  };
@@ -86278,7 +86969,7 @@ var require_streams = __commonJS({
86278
86969
  constructor: { value: IconvLiteDecoderStream }
86279
86970
  });
86280
86971
  IconvLiteDecoderStream.prototype._transform = function(chunk, encoding, done) {
86281
- if (!Buffer3.isBuffer(chunk) && !(chunk instanceof Uint8Array)) {
86972
+ if (!Buffer2.isBuffer(chunk) && !(chunk instanceof Uint8Array)) {
86282
86973
  return done(new Error("Iconv decoding stream needs buffers as its input."));
86283
86974
  }
86284
86975
  try {
@@ -86321,7 +87012,7 @@ var require_streams = __commonJS({
86321
87012
  var require_lib3 = __commonJS({
86322
87013
  "../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/lib/index.js"(exports2, module2) {
86323
87014
  "use strict";
86324
- var Buffer3 = require_safer().Buffer;
87015
+ var Buffer2 = require_safer().Buffer;
86325
87016
  var bomHandling = require_bom_handling();
86326
87017
  var mergeModules = require_merge_exports();
86327
87018
  module2.exports.encodings = null;
@@ -86332,7 +87023,7 @@ var require_lib3 = __commonJS({
86332
87023
  var encoder = module2.exports.getEncoder(encoding, options);
86333
87024
  var res = encoder.write(str);
86334
87025
  var trail = encoder.end();
86335
- return trail && trail.length > 0 ? Buffer3.concat([res, trail]) : res;
87026
+ return trail && trail.length > 0 ? Buffer2.concat([res, trail]) : res;
86336
87027
  };
86337
87028
  module2.exports.decode = function decode3(buf, encoding, options) {
86338
87029
  if (typeof buf === "string") {
@@ -86340,7 +87031,7 @@ var require_lib3 = __commonJS({
86340
87031
  console.error("Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding");
86341
87032
  module2.exports.skipDecodeWarning = true;
86342
87033
  }
86343
- buf = Buffer3.from("" + (buf || ""), "binary");
87034
+ buf = Buffer2.from("" + (buf || ""), "binary");
86344
87035
  }
86345
87036
  var decoder = module2.exports.getDecoder(encoding, options);
86346
87037
  var res = decoder.write(buf);
@@ -87060,9 +87751,9 @@ var init_prompt = __esm({
87060
87751
  init_utils();
87061
87752
  init_baseUI();
87062
87753
  _ = {
87063
- set: (obj, path29 = "", value) => {
87754
+ set: (obj, path28 = "", value) => {
87064
87755
  let pointer = obj;
87065
- path29.split(".").forEach((key, index, arr) => {
87756
+ path28.split(".").forEach((key, index, arr) => {
87066
87757
  if (key === "__proto__" || key === "constructor") return;
87067
87758
  if (index === arr.length - 1) {
87068
87759
  pointer[key] = value;
@@ -87072,8 +87763,8 @@ var init_prompt = __esm({
87072
87763
  pointer = pointer[key];
87073
87764
  });
87074
87765
  },
87075
- get: (obj, path29 = "", defaultValue) => {
87076
- 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(
87077
87768
  // @ts-expect-error implicit any on res[key]
87078
87769
  (res, key) => res !== null && res !== void 0 ? res[key] : res,
87079
87770
  obj
@@ -87389,7 +88080,7 @@ var init_mjs = __esm({
87389
88080
  "../../node_modules/signal-exit/dist/mjs/index.js"() {
87390
88081
  "use strict";
87391
88082
  init_signals();
87392
- 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";
87393
88084
  kExitEmitter = /* @__PURE__ */ Symbol.for("signal-exit emitter");
87394
88085
  global2 = globalThis;
87395
88086
  ObjectDefineProperty = Object.defineProperty.bind(Object);
@@ -87482,15 +88173,15 @@ var init_mjs = __esm({
87482
88173
  #originalProcessReallyExit;
87483
88174
  #sigListeners = {};
87484
88175
  #loaded = false;
87485
- constructor(process19) {
88176
+ constructor(process13) {
87486
88177
  super();
87487
- this.#process = process19;
88178
+ this.#process = process13;
87488
88179
  this.#sigListeners = {};
87489
88180
  for (const sig of signals) {
87490
88181
  this.#sigListeners[sig] = () => {
87491
88182
  const listeners = this.#process.listeners(sig);
87492
88183
  let { count } = this.#emitter;
87493
- const p = process19;
88184
+ const p = process13;
87494
88185
  if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
87495
88186
  count += p.__signal_exit_emitter__.count;
87496
88187
  }
@@ -87499,12 +88190,12 @@ var init_mjs = __esm({
87499
88190
  const ret = this.#emitter.emit("exit", null, sig);
87500
88191
  const s = sig === "SIGHUP" ? this.#hupSig : sig;
87501
88192
  if (!ret)
87502
- process19.kill(process19.pid, s);
88193
+ process13.kill(process13.pid, s);
87503
88194
  }
87504
88195
  };
87505
88196
  }
87506
- this.#originalProcessReallyExit = process19.reallyExit;
87507
- this.#originalProcessEmit = process19.emit;
88197
+ this.#originalProcessReallyExit = process13.reallyExit;
88198
+ this.#originalProcessEmit = process13.emit;
87508
88199
  }
87509
88200
  onExit(cb, opts) {
87510
88201
  if (!processOk(this.#process)) {
@@ -88369,523 +89060,6 @@ init_daemon_p2p2();
88369
89060
  init_source2();
88370
89061
  init_lib();
88371
89062
  init_ora();
88372
-
88373
- // ../../node_modules/open/index.js
88374
- var import_node_process15 = __toESM(require("process"), 1);
88375
- var import_node_buffer = require("buffer");
88376
- var import_node_path3 = __toESM(require("path"), 1);
88377
- var import_node_url = require("url");
88378
- var import_node_util5 = require("util");
88379
- var import_node_child_process5 = __toESM(require("child_process"), 1);
88380
- var import_promises5 = __toESM(require("fs/promises"), 1);
88381
-
88382
- // ../../node_modules/wsl-utils/index.js
88383
- var import_node_process11 = __toESM(require("process"), 1);
88384
- var import_promises4 = __toESM(require("fs/promises"), 1);
88385
-
88386
- // ../../node_modules/is-wsl/index.js
88387
- var import_node_process10 = __toESM(require("process"), 1);
88388
- var import_node_os5 = __toESM(require("os"), 1);
88389
- var import_node_fs5 = __toESM(require("fs"), 1);
88390
-
88391
- // ../../node_modules/is-inside-container/index.js
88392
- var import_node_fs4 = __toESM(require("fs"), 1);
88393
-
88394
- // ../../node_modules/is-docker/index.js
88395
- var import_node_fs3 = __toESM(require("fs"), 1);
88396
- var isDockerCached;
88397
- function hasDockerEnv() {
88398
- try {
88399
- import_node_fs3.default.statSync("/.dockerenv");
88400
- return true;
88401
- } catch {
88402
- return false;
88403
- }
88404
- }
88405
- function hasDockerCGroup() {
88406
- try {
88407
- return import_node_fs3.default.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
88408
- } catch {
88409
- return false;
88410
- }
88411
- }
88412
- function isDocker() {
88413
- if (isDockerCached === void 0) {
88414
- isDockerCached = hasDockerEnv() || hasDockerCGroup();
88415
- }
88416
- return isDockerCached;
88417
- }
88418
-
88419
- // ../../node_modules/is-inside-container/index.js
88420
- var cachedResult;
88421
- var hasContainerEnv = () => {
88422
- try {
88423
- import_node_fs4.default.statSync("/run/.containerenv");
88424
- return true;
88425
- } catch {
88426
- return false;
88427
- }
88428
- };
88429
- function isInsideContainer() {
88430
- if (cachedResult === void 0) {
88431
- cachedResult = hasContainerEnv() || isDocker();
88432
- }
88433
- return cachedResult;
88434
- }
88435
-
88436
- // ../../node_modules/is-wsl/index.js
88437
- var isWsl = () => {
88438
- if (import_node_process10.default.platform !== "linux") {
88439
- return false;
88440
- }
88441
- if (import_node_os5.default.release().toLowerCase().includes("microsoft")) {
88442
- if (isInsideContainer()) {
88443
- return false;
88444
- }
88445
- return true;
88446
- }
88447
- try {
88448
- if (import_node_fs5.default.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft")) {
88449
- return !isInsideContainer();
88450
- }
88451
- } catch {
88452
- }
88453
- if (import_node_fs5.default.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || import_node_fs5.default.existsSync("/run/WSL")) {
88454
- return !isInsideContainer();
88455
- }
88456
- return false;
88457
- };
88458
- var is_wsl_default = import_node_process10.default.env.__IS_WSL_TEST__ ? isWsl : isWsl();
88459
-
88460
- // ../../node_modules/wsl-utils/index.js
88461
- var wslDrivesMountPoint = /* @__PURE__ */ (() => {
88462
- const defaultMountPoint = "/mnt/";
88463
- let mountPoint;
88464
- return async function() {
88465
- if (mountPoint) {
88466
- return mountPoint;
88467
- }
88468
- const configFilePath = "/etc/wsl.conf";
88469
- let isConfigFileExists = false;
88470
- try {
88471
- await import_promises4.default.access(configFilePath, import_promises4.constants.F_OK);
88472
- isConfigFileExists = true;
88473
- } catch {
88474
- }
88475
- if (!isConfigFileExists) {
88476
- return defaultMountPoint;
88477
- }
88478
- const configContent = await import_promises4.default.readFile(configFilePath, { encoding: "utf8" });
88479
- const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
88480
- if (!configMountPoint) {
88481
- return defaultMountPoint;
88482
- }
88483
- mountPoint = configMountPoint.groups.mountPoint.trim();
88484
- mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
88485
- return mountPoint;
88486
- };
88487
- })();
88488
- var powerShellPathFromWsl = async () => {
88489
- const mountPoint = await wslDrivesMountPoint();
88490
- return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
88491
- };
88492
- var powerShellPath = async () => {
88493
- if (is_wsl_default) {
88494
- return powerShellPathFromWsl();
88495
- }
88496
- return `${import_node_process11.default.env.SYSTEMROOT || import_node_process11.default.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
88497
- };
88498
-
88499
- // ../../node_modules/define-lazy-prop/index.js
88500
- function defineLazyProperty(object2, propertyName, valueGetter) {
88501
- const define = (value) => Object.defineProperty(object2, propertyName, { value, enumerable: true, writable: true });
88502
- Object.defineProperty(object2, propertyName, {
88503
- configurable: true,
88504
- enumerable: true,
88505
- get() {
88506
- const result = valueGetter();
88507
- define(result);
88508
- return result;
88509
- },
88510
- set(value) {
88511
- define(value);
88512
- }
88513
- });
88514
- return object2;
88515
- }
88516
-
88517
- // ../../node_modules/default-browser/index.js
88518
- var import_node_util4 = require("util");
88519
- var import_node_process14 = __toESM(require("process"), 1);
88520
- var import_node_child_process4 = require("child_process");
88521
-
88522
- // ../../node_modules/default-browser-id/index.js
88523
- var import_node_util = require("util");
88524
- var import_node_process12 = __toESM(require("process"), 1);
88525
- var import_node_child_process = require("child_process");
88526
- var execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
88527
- async function defaultBrowserId() {
88528
- if (import_node_process12.default.platform !== "darwin") {
88529
- throw new Error("macOS only");
88530
- }
88531
- const { stdout } = await execFileAsync("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
88532
- const match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
88533
- const browserId = match?.groups.id ?? "com.apple.Safari";
88534
- if (browserId === "com.apple.safari") {
88535
- return "com.apple.Safari";
88536
- }
88537
- return browserId;
88538
- }
88539
-
88540
- // ../../node_modules/run-applescript/index.js
88541
- var import_node_process13 = __toESM(require("process"), 1);
88542
- var import_node_util2 = require("util");
88543
- var import_node_child_process2 = require("child_process");
88544
- var execFileAsync2 = (0, import_node_util2.promisify)(import_node_child_process2.execFile);
88545
- async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
88546
- if (import_node_process13.default.platform !== "darwin") {
88547
- throw new Error("macOS only");
88548
- }
88549
- const outputArguments = humanReadableOutput ? [] : ["-ss"];
88550
- const execOptions = {};
88551
- if (signal) {
88552
- execOptions.signal = signal;
88553
- }
88554
- const { stdout } = await execFileAsync2("osascript", ["-e", script, outputArguments], execOptions);
88555
- return stdout.trim();
88556
- }
88557
-
88558
- // ../../node_modules/bundle-name/index.js
88559
- async function bundleName(bundleId) {
88560
- return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string
88561
- tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
88562
- }
88563
-
88564
- // ../../node_modules/default-browser/windows.js
88565
- var import_node_util3 = require("util");
88566
- var import_node_child_process3 = require("child_process");
88567
- var execFileAsync3 = (0, import_node_util3.promisify)(import_node_child_process3.execFile);
88568
- var windowsBrowserProgIds = {
88569
- MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
88570
- // The missing `L` is correct.
88571
- MSEdgeBHTML: { name: "Edge Beta", id: "com.microsoft.edge.beta" },
88572
- MSEdgeDHTML: { name: "Edge Dev", id: "com.microsoft.edge.dev" },
88573
- AppXq0fevzme2pys62n3e0fbqa7peapykr8v: { name: "Edge", id: "com.microsoft.edge.old" },
88574
- ChromeHTML: { name: "Chrome", id: "com.google.chrome" },
88575
- ChromeBHTML: { name: "Chrome Beta", id: "com.google.chrome.beta" },
88576
- ChromeDHTML: { name: "Chrome Dev", id: "com.google.chrome.dev" },
88577
- ChromiumHTM: { name: "Chromium", id: "org.chromium.Chromium" },
88578
- BraveHTML: { name: "Brave", id: "com.brave.Browser" },
88579
- BraveBHTML: { name: "Brave Beta", id: "com.brave.Browser.beta" },
88580
- BraveDHTML: { name: "Brave Dev", id: "com.brave.Browser.dev" },
88581
- BraveSSHTM: { name: "Brave Nightly", id: "com.brave.Browser.nightly" },
88582
- FirefoxURL: { name: "Firefox", id: "org.mozilla.firefox" },
88583
- OperaStable: { name: "Opera", id: "com.operasoftware.Opera" },
88584
- VivaldiHTM: { name: "Vivaldi", id: "com.vivaldi.Vivaldi" },
88585
- "IE.HTTP": { name: "Internet Explorer", id: "com.microsoft.ie" }
88586
- };
88587
- var _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
88588
- var UnknownBrowserError = class extends Error {
88589
- };
88590
- async function defaultBrowser(_execFileAsync = execFileAsync3) {
88591
- const { stdout } = await _execFileAsync("reg", [
88592
- "QUERY",
88593
- " HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
88594
- "/v",
88595
- "ProgId"
88596
- ]);
88597
- const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
88598
- if (!match) {
88599
- throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
88600
- }
88601
- const { id } = match.groups;
88602
- const dotIndex = id.lastIndexOf(".");
88603
- const hyphenIndex = id.lastIndexOf("-");
88604
- const baseIdByDot = dotIndex === -1 ? void 0 : id.slice(0, dotIndex);
88605
- const baseIdByHyphen = hyphenIndex === -1 ? void 0 : id.slice(0, hyphenIndex);
88606
- return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? { name: id, id };
88607
- }
88608
-
88609
- // ../../node_modules/default-browser/index.js
88610
- var execFileAsync4 = (0, import_node_util4.promisify)(import_node_child_process4.execFile);
88611
- var titleize = (string4) => string4.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
88612
- async function defaultBrowser2() {
88613
- if (import_node_process14.default.platform === "darwin") {
88614
- const id = await defaultBrowserId();
88615
- const name = await bundleName(id);
88616
- return { name, id };
88617
- }
88618
- if (import_node_process14.default.platform === "linux") {
88619
- const { stdout } = await execFileAsync4("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
88620
- const id = stdout.trim();
88621
- const name = titleize(id.replace(/.desktop$/, "").replace("-", " "));
88622
- return { name, id };
88623
- }
88624
- if (import_node_process14.default.platform === "win32") {
88625
- return defaultBrowser();
88626
- }
88627
- throw new Error("Only macOS, Linux, and Windows are supported");
88628
- }
88629
-
88630
- // ../../node_modules/open/index.js
88631
- var import_meta = {};
88632
- var execFile5 = (0, import_node_util5.promisify)(import_node_child_process5.default.execFile);
88633
- var __dirname2 = import_node_path3.default.dirname((0, import_node_url.fileURLToPath)(import_meta.url));
88634
- var localXdgOpenPath = import_node_path3.default.join(__dirname2, "xdg-open");
88635
- var { platform: platform12, arch: arch3 } = import_node_process15.default;
88636
- async function getWindowsDefaultBrowserFromWsl() {
88637
- const powershellPath = await powerShellPath();
88638
- const rawCommand = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
88639
- const encodedCommand = import_node_buffer.Buffer.from(rawCommand, "utf16le").toString("base64");
88640
- const { stdout } = await execFile5(
88641
- powershellPath,
88642
- [
88643
- "-NoProfile",
88644
- "-NonInteractive",
88645
- "-ExecutionPolicy",
88646
- "Bypass",
88647
- "-EncodedCommand",
88648
- encodedCommand
88649
- ],
88650
- { encoding: "utf8" }
88651
- );
88652
- const progId = stdout.trim();
88653
- const browserMap = {
88654
- ChromeHTML: "com.google.chrome",
88655
- BraveHTML: "com.brave.Browser",
88656
- MSEdgeHTM: "com.microsoft.edge",
88657
- FirefoxURL: "org.mozilla.firefox"
88658
- };
88659
- return browserMap[progId] ? { id: browserMap[progId] } : {};
88660
- }
88661
- var pTryEach = async (array2, mapper) => {
88662
- let latestError;
88663
- for (const item of array2) {
88664
- try {
88665
- return await mapper(item);
88666
- } catch (error48) {
88667
- latestError = error48;
88668
- }
88669
- }
88670
- throw latestError;
88671
- };
88672
- var baseOpen = async (options) => {
88673
- options = {
88674
- wait: false,
88675
- background: false,
88676
- newInstance: false,
88677
- allowNonzeroExitCode: false,
88678
- ...options
88679
- };
88680
- if (Array.isArray(options.app)) {
88681
- return pTryEach(options.app, (singleApp) => baseOpen({
88682
- ...options,
88683
- app: singleApp
88684
- }));
88685
- }
88686
- let { name: app, arguments: appArguments = [] } = options.app ?? {};
88687
- appArguments = [...appArguments];
88688
- if (Array.isArray(app)) {
88689
- return pTryEach(app, (appName) => baseOpen({
88690
- ...options,
88691
- app: {
88692
- name: appName,
88693
- arguments: appArguments
88694
- }
88695
- }));
88696
- }
88697
- if (app === "browser" || app === "browserPrivate") {
88698
- const ids = {
88699
- "com.google.chrome": "chrome",
88700
- "google-chrome.desktop": "chrome",
88701
- "com.brave.Browser": "brave",
88702
- "org.mozilla.firefox": "firefox",
88703
- "firefox.desktop": "firefox",
88704
- "com.microsoft.msedge": "edge",
88705
- "com.microsoft.edge": "edge",
88706
- "com.microsoft.edgemac": "edge",
88707
- "microsoft-edge.desktop": "edge"
88708
- };
88709
- const flags = {
88710
- chrome: "--incognito",
88711
- brave: "--incognito",
88712
- firefox: "--private-window",
88713
- edge: "--inPrivate"
88714
- };
88715
- const browser = is_wsl_default ? await getWindowsDefaultBrowserFromWsl() : await defaultBrowser2();
88716
- if (browser.id in ids) {
88717
- const browserName = ids[browser.id];
88718
- if (app === "browserPrivate") {
88719
- appArguments.push(flags[browserName]);
88720
- }
88721
- return baseOpen({
88722
- ...options,
88723
- app: {
88724
- name: apps[browserName],
88725
- arguments: appArguments
88726
- }
88727
- });
88728
- }
88729
- throw new Error(`${browser.name} is not supported as a default browser`);
88730
- }
88731
- let command;
88732
- const cliArguments = [];
88733
- const childProcessOptions = {};
88734
- if (platform12 === "darwin") {
88735
- command = "open";
88736
- if (options.wait) {
88737
- cliArguments.push("--wait-apps");
88738
- }
88739
- if (options.background) {
88740
- cliArguments.push("--background");
88741
- }
88742
- if (options.newInstance) {
88743
- cliArguments.push("--new");
88744
- }
88745
- if (app) {
88746
- cliArguments.push("-a", app);
88747
- }
88748
- } else if (platform12 === "win32" || is_wsl_default && !isInsideContainer() && !app) {
88749
- command = await powerShellPath();
88750
- cliArguments.push(
88751
- "-NoProfile",
88752
- "-NonInteractive",
88753
- "-ExecutionPolicy",
88754
- "Bypass",
88755
- "-EncodedCommand"
88756
- );
88757
- if (!is_wsl_default) {
88758
- childProcessOptions.windowsVerbatimArguments = true;
88759
- }
88760
- const encodedArguments = ["Start"];
88761
- if (options.wait) {
88762
- encodedArguments.push("-Wait");
88763
- }
88764
- if (app) {
88765
- encodedArguments.push(`"\`"${app}\`""`);
88766
- if (options.target) {
88767
- appArguments.push(options.target);
88768
- }
88769
- } else if (options.target) {
88770
- encodedArguments.push(`"${options.target}"`);
88771
- }
88772
- if (appArguments.length > 0) {
88773
- appArguments = appArguments.map((argument) => `"\`"${argument}\`""`);
88774
- encodedArguments.push("-ArgumentList", appArguments.join(","));
88775
- }
88776
- options.target = import_node_buffer.Buffer.from(encodedArguments.join(" "), "utf16le").toString("base64");
88777
- } else {
88778
- if (app) {
88779
- command = app;
88780
- } else {
88781
- const isBundled = !__dirname2 || __dirname2 === "/";
88782
- let exeLocalXdgOpen = false;
88783
- try {
88784
- await import_promises5.default.access(localXdgOpenPath, import_promises5.constants.X_OK);
88785
- exeLocalXdgOpen = true;
88786
- } catch {
88787
- }
88788
- const useSystemXdgOpen = import_node_process15.default.versions.electron ?? (platform12 === "android" || isBundled || !exeLocalXdgOpen);
88789
- command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
88790
- }
88791
- if (appArguments.length > 0) {
88792
- cliArguments.push(...appArguments);
88793
- }
88794
- if (!options.wait) {
88795
- childProcessOptions.stdio = "ignore";
88796
- childProcessOptions.detached = true;
88797
- }
88798
- }
88799
- if (platform12 === "darwin" && appArguments.length > 0) {
88800
- cliArguments.push("--args", ...appArguments);
88801
- }
88802
- if (options.target) {
88803
- cliArguments.push(options.target);
88804
- }
88805
- const subprocess = import_node_child_process5.default.spawn(command, cliArguments, childProcessOptions);
88806
- if (options.wait) {
88807
- return new Promise((resolve16, reject) => {
88808
- subprocess.once("error", reject);
88809
- subprocess.once("close", (exitCode) => {
88810
- if (!options.allowNonzeroExitCode && exitCode > 0) {
88811
- reject(new Error(`Exited with code ${exitCode}`));
88812
- return;
88813
- }
88814
- resolve16(subprocess);
88815
- });
88816
- });
88817
- }
88818
- subprocess.unref();
88819
- return subprocess;
88820
- };
88821
- var open2 = (target, options) => {
88822
- if (typeof target !== "string") {
88823
- throw new TypeError("Expected a `target`");
88824
- }
88825
- return baseOpen({
88826
- ...options,
88827
- target
88828
- });
88829
- };
88830
- function detectArchBinary(binary) {
88831
- if (typeof binary === "string" || Array.isArray(binary)) {
88832
- return binary;
88833
- }
88834
- const { [arch3]: archBinary } = binary;
88835
- if (!archBinary) {
88836
- throw new Error(`${arch3} is not supported`);
88837
- }
88838
- return archBinary;
88839
- }
88840
- function detectPlatformBinary({ [platform12]: platformBinary }, { wsl }) {
88841
- if (wsl && is_wsl_default) {
88842
- return detectArchBinary(wsl);
88843
- }
88844
- if (!platformBinary) {
88845
- throw new Error(`${platform12} is not supported`);
88846
- }
88847
- return detectArchBinary(platformBinary);
88848
- }
88849
- var apps = {};
88850
- defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
88851
- darwin: "google chrome",
88852
- win32: "chrome",
88853
- linux: ["google-chrome", "google-chrome-stable", "chromium"]
88854
- }, {
88855
- wsl: {
88856
- ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
88857
- x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
88858
- }
88859
- }));
88860
- defineLazyProperty(apps, "brave", () => detectPlatformBinary({
88861
- darwin: "brave browser",
88862
- win32: "brave",
88863
- linux: ["brave-browser", "brave"]
88864
- }, {
88865
- wsl: {
88866
- ia32: "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",
88867
- x64: ["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe", "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]
88868
- }
88869
- }));
88870
- defineLazyProperty(apps, "firefox", () => detectPlatformBinary({
88871
- darwin: "firefox",
88872
- win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
88873
- linux: "firefox"
88874
- }, {
88875
- wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
88876
- }));
88877
- defineLazyProperty(apps, "edge", () => detectPlatformBinary({
88878
- darwin: "microsoft edge",
88879
- win32: "msedge",
88880
- linux: ["microsoft-edge", "microsoft-edge-dev"]
88881
- }, {
88882
- wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
88883
- }));
88884
- defineLazyProperty(apps, "browser", () => "browser");
88885
- defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
88886
- var open_default = open2;
88887
-
88888
- // src/wizard.ts
88889
89063
  init_src();
88890
89064
  init_version();
88891
89065
  var SERVER_URL = process.env.ADHDEV_SERVER_URL || "https://api.adhf.dev";
@@ -88896,6 +89070,10 @@ ${source_default2.cyan("\u2551")} ${source_default2.gray("Agent Dashboard Hub f
88896
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")}
88897
89071
  `;
88898
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
+ }
88899
89077
  function hasCloudMachineAuth() {
88900
89078
  const config2 = loadConfig();
88901
89079
  return Boolean(config2.machineSecret && config2.machineSecret.trim());
@@ -88945,9 +89123,9 @@ async function runWizard(options = {}) {
88945
89123
  }
88946
89124
  async function checkForUpdate() {
88947
89125
  try {
88948
- const { execFileSync: execFileSync6 } = await import("child_process");
89126
+ const { execFileSync: execFileSync5 } = await import("child_process");
88949
89127
  const currentVersion = resolvePackageVersion();
88950
- const latestVersion = readLatestPublishedCliVersion(execFileSync6);
89128
+ const latestVersion = readLatestPublishedCliVersion(execFileSync5);
88951
89129
  if (!latestVersion) return;
88952
89130
  if (!currentVersion || !latestVersion || currentVersion === latestVersion) return;
88953
89131
  console.log(source_default2.yellow(` Update available: ${currentVersion} \u2192 ${latestVersion}`));
@@ -88964,7 +89142,7 @@ async function checkForUpdate() {
88964
89142
  const spinner = (await Promise.resolve().then(() => (init_ora(), ora_exports))).default("Updating adhdev CLI...").start();
88965
89143
  try {
88966
89144
  const installCommand = buildPinnedGlobalInstallCommand({ packageName: "adhdev", targetVersion: "latest" });
88967
- execFileSync6(installCommand.command, installCommand.args, {
89145
+ execFileSync5(installCommand.command, installCommand.args, {
88968
89146
  encoding: "utf-8",
88969
89147
  timeout: 6e4,
88970
89148
  stdio: ["pipe", "pipe", "pipe"]
@@ -89048,15 +89226,15 @@ async function loginFlow() {
89048
89226
  let verificationUrl;
89049
89227
  try {
89050
89228
  const config2 = loadConfig();
89051
- const os29 = await import("os");
89229
+ const os28 = await import("os");
89052
89230
  const res = await fetch(`${SERVER_URL}/auth/cli/init`, {
89053
89231
  method: "POST",
89054
89232
  headers: { "Content-Type": "application/json" },
89055
89233
  body: JSON.stringify({
89056
89234
  clientMachineId: config2.machineId,
89057
- hostname: os29.hostname(),
89058
- platform: os29.platform(),
89059
- arch: os29.arch()
89235
+ hostname: os28.hostname(),
89236
+ platform: os28.platform(),
89237
+ arch: os28.arch()
89060
89238
  })
89061
89239
  });
89062
89240
  if (!res.ok) {
@@ -89080,7 +89258,7 @@ async function loginFlow() {
89080
89258
  console.log(source_default2.gray(` Opening: ${verificationUrl}`));
89081
89259
  console.log();
89082
89260
  try {
89083
- await open_default(verificationUrl);
89261
+ await openBrowser(verificationUrl);
89084
89262
  console.log(source_default2.green(" \u2713 Browser opened \u2014 please sign in and approve"));
89085
89263
  } catch {
89086
89264
  console.log(source_default2.yellow(` \u26A0 Could not open browser. Visit: ${verificationUrl}`));
@@ -89161,10 +89339,10 @@ async function startDaemonFlow() {
89161
89339
  const { execSync: execSync7 } = await import("child_process");
89162
89340
  const { getCurrentDaemonLogPath: getCurrentDaemonLogPath2 } = await Promise.resolve().then(() => (init_src(), src_exports));
89163
89341
  const logPath = getCurrentDaemonLogPath2();
89164
- const os29 = await import("os");
89165
- const platform13 = os29.platform();
89342
+ const os28 = await import("os");
89343
+ const platform12 = os28.platform();
89166
89344
  try {
89167
- if (platform13 === "win32") {
89345
+ if (platform12 === "win32") {
89168
89346
  execSync7("start /B adhdev daemon >NUL 2>&1", {
89169
89347
  timeout: 3e3,
89170
89348
  stdio: "ignore",