adhdev 0.9.44 → 0.9.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +1037 -1481
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +852 -1233
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -500,18 +500,18 @@ var init_source = __esm({
|
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
502
|
});
|
|
503
|
-
createStyler = (
|
|
503
|
+
createStyler = (open2, close, parent) => {
|
|
504
504
|
let openAll;
|
|
505
505
|
let closeAll;
|
|
506
506
|
if (parent === void 0) {
|
|
507
|
-
openAll =
|
|
507
|
+
openAll = open2;
|
|
508
508
|
closeAll = close;
|
|
509
509
|
} else {
|
|
510
|
-
openAll = parent.openAll +
|
|
510
|
+
openAll = parent.openAll + open2;
|
|
511
511
|
closeAll = close + parent.closeAll;
|
|
512
512
|
}
|
|
513
513
|
return {
|
|
514
|
-
open:
|
|
514
|
+
open: open2,
|
|
515
515
|
close,
|
|
516
516
|
openAll,
|
|
517
517
|
closeAll,
|
|
@@ -1410,17 +1410,17 @@ function checkPathExists(paths) {
|
|
|
1410
1410
|
return null;
|
|
1411
1411
|
}
|
|
1412
1412
|
async function detectIDEs(providerLoader) {
|
|
1413
|
-
const
|
|
1413
|
+
const os30 = (0, import_os2.platform)();
|
|
1414
1414
|
const results = [];
|
|
1415
1415
|
for (const def of getMergedDefinitions()) {
|
|
1416
1416
|
const cliPath = findCliCommand(providerLoader?.getIdeCliCommand(def.id, def.cli) || def.cli);
|
|
1417
|
-
const appPath = checkPathExists(providerLoader?.getIdePathCandidates(def.id, def.paths[
|
|
1417
|
+
const appPath = checkPathExists(providerLoader?.getIdePathCandidates(def.id, def.paths[os30] || []) || []);
|
|
1418
1418
|
let resolvedCli = cliPath;
|
|
1419
|
-
if (!resolvedCli && appPath &&
|
|
1419
|
+
if (!resolvedCli && appPath && os30 === "darwin") {
|
|
1420
1420
|
const bundledCli = `${appPath}/Contents/Resources/app/bin/${def.cli}`;
|
|
1421
1421
|
if ((0, import_fs3.existsSync)(bundledCli)) resolvedCli = bundledCli;
|
|
1422
1422
|
}
|
|
1423
|
-
if (!resolvedCli && appPath &&
|
|
1423
|
+
if (!resolvedCli && appPath && os30 === "win32") {
|
|
1424
1424
|
const { dirname: dirname11 } = await import("path");
|
|
1425
1425
|
const appDir = dirname11(appPath);
|
|
1426
1426
|
const candidates = [
|
|
@@ -1437,7 +1437,7 @@ async function detectIDEs(providerLoader) {
|
|
|
1437
1437
|
}
|
|
1438
1438
|
}
|
|
1439
1439
|
}
|
|
1440
|
-
const installed =
|
|
1440
|
+
const installed = os30 === "darwin" ? !!(resolvedCli || appPath) : !!resolvedCli;
|
|
1441
1441
|
const version2 = resolvedCli ? getIdeVersion(resolvedCli) : null;
|
|
1442
1442
|
results.push({
|
|
1443
1443
|
id: def.id,
|
|
@@ -1506,8 +1506,8 @@ function execAsync(cmd, timeoutMs = 5e3) {
|
|
|
1506
1506
|
});
|
|
1507
1507
|
}
|
|
1508
1508
|
async function detectCLIs(providerLoader, options) {
|
|
1509
|
-
const
|
|
1510
|
-
const whichCmd =
|
|
1509
|
+
const platform12 = os3.platform();
|
|
1510
|
+
const whichCmd = platform12 === "win32" ? "where" : "which";
|
|
1511
1511
|
const includeVersion = options?.includeVersion !== false;
|
|
1512
1512
|
const cliList = providerLoader ? providerLoader.getCliDetectionList() : [];
|
|
1513
1513
|
const results = await Promise.all(
|
|
@@ -1550,8 +1550,8 @@ async function detectCLI(cliId, providerLoader, options) {
|
|
|
1550
1550
|
const cliList = providerLoader.getCliDetectionList();
|
|
1551
1551
|
const target = cliList.find((c) => c.id === resolvedId);
|
|
1552
1552
|
if (target) {
|
|
1553
|
-
const
|
|
1554
|
-
const whichCmd =
|
|
1553
|
+
const platform12 = os3.platform();
|
|
1554
|
+
const whichCmd = platform12 === "win32" ? "where" : "which";
|
|
1555
1555
|
try {
|
|
1556
1556
|
const explicitPath = resolveCommandPath(target.command);
|
|
1557
1557
|
const pathResult = explicitPath || await execAsync(`${whichCmd} ${shellQuote(target.command)}`);
|
|
@@ -4552,6 +4552,27 @@ function computeSavedHistorySessionSummaries(agentType, dir, files, fileSignatur
|
|
|
4552
4552
|
persistedEntries: nextPersistedEntries
|
|
4553
4553
|
};
|
|
4554
4554
|
}
|
|
4555
|
+
function pageHistoryRecords(agentType, records, offset = 0, limit = 30, excludeRecentCount = 0, historyBehavior) {
|
|
4556
|
+
const allMessages = records.map((message) => sanitizeHistoryMessage(agentType, message)).filter(Boolean);
|
|
4557
|
+
allMessages.sort((a, b) => a.receivedAt - b.receivedAt);
|
|
4558
|
+
const chronological = [];
|
|
4559
|
+
let lastTurn = null;
|
|
4560
|
+
for (const message of allMessages) {
|
|
4561
|
+
const previous = chronological[chronological.length - 1];
|
|
4562
|
+
if (isAdjacentHistoryDuplicate(agentType, previous, message)) continue;
|
|
4563
|
+
if (message.role !== "system" && isAdjacentHistoryDuplicate(agentType, lastTurn, message)) continue;
|
|
4564
|
+
chronological.push(message);
|
|
4565
|
+
if (message.role !== "system") lastTurn = message;
|
|
4566
|
+
}
|
|
4567
|
+
const collapsed = collapseReplayAssistantTurns(chronological, historyBehavior);
|
|
4568
|
+
const boundedLimit = Math.max(1, limit);
|
|
4569
|
+
const boundedOffset = Math.max(0, offset);
|
|
4570
|
+
const boundedExclude = Math.max(0, Math.min(excludeRecentCount, collapsed.length));
|
|
4571
|
+
const endExclusive = Math.max(0, collapsed.length - boundedExclude - boundedOffset);
|
|
4572
|
+
const startInclusive = Math.max(0, endExclusive - boundedLimit);
|
|
4573
|
+
const sliced = collapsed.slice(startInclusive, endExclusive);
|
|
4574
|
+
return { messages: sliced, hasMore: startInclusive > 0 };
|
|
4575
|
+
}
|
|
4555
4576
|
function readChatHistory(agentType, offset = 0, limit = 30, historySessionId, excludeRecentCount = 0, historyBehavior) {
|
|
4556
4577
|
try {
|
|
4557
4578
|
const sanitized = agentType.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
@@ -4577,25 +4598,7 @@ function readChatHistory(agentType, offset = 0, limit = 30, historySessionId, ex
|
|
|
4577
4598
|
}
|
|
4578
4599
|
}
|
|
4579
4600
|
}
|
|
4580
|
-
|
|
4581
|
-
const chronological = [];
|
|
4582
|
-
let lastTurn = null;
|
|
4583
|
-
for (const message of allMessages) {
|
|
4584
|
-
const previous = chronological[chronological.length - 1];
|
|
4585
|
-
if (isAdjacentHistoryDuplicate(agentType, previous, message)) continue;
|
|
4586
|
-
if (message.role !== "system" && isAdjacentHistoryDuplicate(agentType, lastTurn, message)) continue;
|
|
4587
|
-
chronological.push(message);
|
|
4588
|
-
if (message.role !== "system") lastTurn = message;
|
|
4589
|
-
}
|
|
4590
|
-
const collapsed = collapseReplayAssistantTurns(chronological, historyBehavior);
|
|
4591
|
-
const boundedLimit = Math.max(1, limit);
|
|
4592
|
-
const boundedOffset = Math.max(0, offset);
|
|
4593
|
-
const boundedExclude = Math.max(0, Math.min(excludeRecentCount, collapsed.length));
|
|
4594
|
-
const endExclusive = Math.max(0, collapsed.length - boundedExclude - boundedOffset);
|
|
4595
|
-
const startInclusive = Math.max(0, endExclusive - boundedLimit);
|
|
4596
|
-
const sliced = collapsed.slice(startInclusive, endExclusive);
|
|
4597
|
-
const hasMore = startInclusive > 0;
|
|
4598
|
-
return { messages: sliced, hasMore };
|
|
4601
|
+
return pageHistoryRecords(agentType, allMessages, offset, limit, excludeRecentCount, historyBehavior);
|
|
4599
4602
|
} catch {
|
|
4600
4603
|
return { messages: [], hasMore: false };
|
|
4601
4604
|
}
|
|
@@ -4662,29 +4665,6 @@ function listSavedHistorySessions(agentType, options = {}, historyBehavior) {
|
|
|
4662
4665
|
return { sessions: [], hasMore: false };
|
|
4663
4666
|
}
|
|
4664
4667
|
}
|
|
4665
|
-
function normalizeCanonicalHermesMessageContent(content) {
|
|
4666
|
-
if (typeof content === "string") return content.trim();
|
|
4667
|
-
if (content == null) return "";
|
|
4668
|
-
try {
|
|
4669
|
-
return JSON.stringify(content).trim();
|
|
4670
|
-
} catch {
|
|
4671
|
-
return String(content).trim();
|
|
4672
|
-
}
|
|
4673
|
-
}
|
|
4674
|
-
function extractCanonicalHermesMessageTimestamp(message, fallbackTs) {
|
|
4675
|
-
const numericTimestamp = Number(message.receivedAt || message.timestamp || message.ts || 0);
|
|
4676
|
-
if (Number.isFinite(numericTimestamp) && numericTimestamp > 0) return numericTimestamp;
|
|
4677
|
-
const stringTimestamp = typeof message.ts === "string" ? Date.parse(message.ts) : typeof message.timestamp === "string" ? Date.parse(message.timestamp) : NaN;
|
|
4678
|
-
if (Number.isFinite(stringTimestamp) && stringTimestamp > 0) return stringTimestamp;
|
|
4679
|
-
return fallbackTs;
|
|
4680
|
-
}
|
|
4681
|
-
function extractTimestampValue(value) {
|
|
4682
|
-
const numericTimestamp = Number(value || 0);
|
|
4683
|
-
if (Number.isFinite(numericTimestamp) && numericTimestamp > 0) return numericTimestamp;
|
|
4684
|
-
const stringTimestamp = typeof value === "string" ? Date.parse(value) : NaN;
|
|
4685
|
-
if (Number.isFinite(stringTimestamp) && stringTimestamp > 0) return stringTimestamp;
|
|
4686
|
-
return 0;
|
|
4687
|
-
}
|
|
4688
4668
|
function readExistingSessionStartRecord(agentType, historySessionId) {
|
|
4689
4669
|
try {
|
|
4690
4670
|
const dir = path7.join(HISTORY_DIR, agentType);
|
|
@@ -4730,232 +4710,193 @@ function rewriteCanonicalSavedHistory(agentType, historySessionId, records) {
|
|
|
4730
4710
|
return false;
|
|
4731
4711
|
}
|
|
4732
4712
|
}
|
|
4733
|
-
function
|
|
4713
|
+
function getNativeHistoryScriptName(canonicalHistory, key) {
|
|
4714
|
+
const configured = canonicalHistory?.scripts?.[key];
|
|
4715
|
+
if (typeof configured === "string" && configured.trim()) return configured.trim();
|
|
4716
|
+
return key === "readSession" ? "readNativeHistory" : "listNativeHistory";
|
|
4717
|
+
}
|
|
4718
|
+
function getProviderNativeHistoryScript(scripts, canonicalHistory, key) {
|
|
4719
|
+
if (!canonicalHistory?.scripts) return null;
|
|
4720
|
+
const fn = scripts?.[getNativeHistoryScriptName(canonicalHistory, key)];
|
|
4721
|
+
return typeof fn === "function" ? fn : null;
|
|
4722
|
+
}
|
|
4723
|
+
function normalizeProviderNativeHistoryRecords(agentType, historySessionId, records) {
|
|
4724
|
+
if (!Array.isArray(records)) return [];
|
|
4725
|
+
const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId);
|
|
4726
|
+
return records.map((record2) => sanitizeHistoryMessage(agentType, {
|
|
4727
|
+
ts: typeof record2?.ts === "string" ? record2.ts : new Date(Number(record2?.receivedAt) || Date.now()).toISOString(),
|
|
4728
|
+
receivedAt: Number(record2?.receivedAt) || Date.parse(record2?.ts || "") || Date.now(),
|
|
4729
|
+
role: record2?.role,
|
|
4730
|
+
content: String(record2?.content || ""),
|
|
4731
|
+
kind: record2?.kind || (record2?.role === "system" ? "session_start" : "standard"),
|
|
4732
|
+
senderName: record2?.senderName,
|
|
4733
|
+
agent: agentType,
|
|
4734
|
+
instanceId: record2?.instanceId,
|
|
4735
|
+
historySessionId: normalizeSavedHistorySessionId(record2?.historySessionId || normalizedSessionId),
|
|
4736
|
+
sessionTitle: record2?.sessionTitle,
|
|
4737
|
+
workspace: record2?.workspace
|
|
4738
|
+
})).filter(Boolean);
|
|
4739
|
+
}
|
|
4740
|
+
function callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, historySessionId, workspace) {
|
|
4741
|
+
const fn = getProviderNativeHistoryScript(scripts, canonicalHistory, "readSession");
|
|
4742
|
+
if (!fn) return null;
|
|
4743
|
+
const result = fn({
|
|
4744
|
+
agentType,
|
|
4745
|
+
sessionId: historySessionId,
|
|
4746
|
+
historySessionId,
|
|
4747
|
+
workspace,
|
|
4748
|
+
format: canonicalHistory?.format,
|
|
4749
|
+
watchPath: canonicalHistory?.watchPath,
|
|
4750
|
+
args: { sessionId: historySessionId, historySessionId, workspace }
|
|
4751
|
+
});
|
|
4752
|
+
if (!result || typeof result !== "object") return null;
|
|
4753
|
+
const records = normalizeProviderNativeHistoryRecords(agentType, historySessionId, result.messages || result.records);
|
|
4754
|
+
if (records.length === 0) return null;
|
|
4755
|
+
return {
|
|
4756
|
+
records,
|
|
4757
|
+
sourcePath: typeof result.sourcePath === "string" ? result.sourcePath : "",
|
|
4758
|
+
sourceMtimeMs: Number(result.sourceMtimeMs) || 0
|
|
4759
|
+
};
|
|
4760
|
+
}
|
|
4761
|
+
function buildNativeHistoryReadResult(agentType, canonicalHistory, scripts, historySessionId, workspace) {
|
|
4762
|
+
const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId || "");
|
|
4763
|
+
if (!canonicalHistory || !normalizedSessionId || !isNativeSourceCanonicalHistory(canonicalHistory)) return null;
|
|
4764
|
+
return callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, normalizedSessionId, workspace);
|
|
4765
|
+
}
|
|
4766
|
+
function materializeNativeHistoryToMirror(agentType, canonicalHistory, historySessionId, workspace, scripts) {
|
|
4734
4767
|
const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId);
|
|
4735
4768
|
if (!normalizedSessionId) return false;
|
|
4769
|
+
const nativeResult = callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, normalizedSessionId, workspace);
|
|
4770
|
+
const nativeRecords = nativeResult?.records || [];
|
|
4771
|
+
if (nativeRecords.length === 0) return false;
|
|
4772
|
+
const normalizedRecords = nativeRecords.map((record2) => ({
|
|
4773
|
+
...record2,
|
|
4774
|
+
agent: agentType,
|
|
4775
|
+
historySessionId: normalizedSessionId
|
|
4776
|
+
}));
|
|
4777
|
+
const existingSessionStart = readExistingSessionStartRecord(agentType, normalizedSessionId);
|
|
4778
|
+
const records = existingSessionStart && normalizedRecords[0]?.kind !== "session_start" ? [{ ...existingSessionStart, historySessionId: normalizedSessionId, agent: agentType }, ...normalizedRecords] : normalizedRecords;
|
|
4779
|
+
return rewriteCanonicalSavedHistory(agentType, normalizedSessionId, records);
|
|
4780
|
+
}
|
|
4781
|
+
function materializeProviderNativeHistory(agentType, canonicalHistory, historySessionId, workspace, scripts) {
|
|
4782
|
+
if (!canonicalHistory || canonicalHistory.mode !== "materialized-mirror") return false;
|
|
4783
|
+
return materializeNativeHistoryToMirror(agentType, canonicalHistory, historySessionId, workspace, scripts);
|
|
4784
|
+
}
|
|
4785
|
+
function isNativeSourceCanonicalHistory(canonicalHistory) {
|
|
4786
|
+
if (!canonicalHistory) return false;
|
|
4787
|
+
if (canonicalHistory.mode === "disabled") return false;
|
|
4788
|
+
if (canonicalHistory.mode === "materialized-mirror") return false;
|
|
4789
|
+
return true;
|
|
4790
|
+
}
|
|
4791
|
+
function readProviderChatHistory(agentType, options = {}) {
|
|
4792
|
+
if (isNativeSourceCanonicalHistory(options.canonicalHistory) && options.historySessionId) {
|
|
4793
|
+
const nativeResult = buildNativeHistoryReadResult(agentType, options.canonicalHistory, options.scripts, options.historySessionId, options.workspace);
|
|
4794
|
+
if (!nativeResult) return { messages: [], hasMore: false, source: "native-unavailable" };
|
|
4795
|
+
return {
|
|
4796
|
+
...pageHistoryRecords(agentType, nativeResult.records, options.offset || 0, options.limit || 30, options.excludeRecentCount || 0, options.historyBehavior),
|
|
4797
|
+
source: "provider-native",
|
|
4798
|
+
sourcePath: nativeResult.sourcePath,
|
|
4799
|
+
sourceMtimeMs: nativeResult.sourceMtimeMs
|
|
4800
|
+
};
|
|
4801
|
+
}
|
|
4802
|
+
return {
|
|
4803
|
+
...readChatHistory(agentType, options.offset || 0, options.limit || 30, options.historySessionId, options.excludeRecentCount || 0, options.historyBehavior),
|
|
4804
|
+
source: "adhdev-mirror"
|
|
4805
|
+
};
|
|
4806
|
+
}
|
|
4807
|
+
function buildNativeSessionSummary(agentType, historySessionId, records, sourcePath) {
|
|
4808
|
+
const visible = pageHistoryRecords(agentType, records, 0, Number.MAX_SAFE_INTEGER).messages;
|
|
4809
|
+
if (visible.length === 0) return null;
|
|
4810
|
+
let sourceMtimeMs = 0;
|
|
4736
4811
|
try {
|
|
4737
|
-
|
|
4738
|
-
if (!fs3.existsSync(sessionFilePath)) return false;
|
|
4739
|
-
const raw = JSON.parse(fs3.readFileSync(sessionFilePath, "utf-8"));
|
|
4740
|
-
const canonicalMessages = Array.isArray(raw.messages) ? raw.messages : [];
|
|
4741
|
-
const dir = path7.join(HISTORY_DIR, "hermes-cli");
|
|
4742
|
-
fs3.mkdirSync(dir, { recursive: true });
|
|
4743
|
-
const existingSessionStart = readExistingSessionStartRecord("hermes-cli", normalizedSessionId);
|
|
4744
|
-
const records = [];
|
|
4745
|
-
if (existingSessionStart) {
|
|
4746
|
-
records.push({
|
|
4747
|
-
...existingSessionStart,
|
|
4748
|
-
historySessionId: normalizedSessionId
|
|
4749
|
-
});
|
|
4750
|
-
}
|
|
4751
|
-
let fallbackTs = Date.parse(raw.session_start || raw.last_updated || "") || Date.now();
|
|
4752
|
-
for (const message of canonicalMessages) {
|
|
4753
|
-
const role = String(message.role || "").trim();
|
|
4754
|
-
const content = normalizeCanonicalHermesMessageContent(message.content);
|
|
4755
|
-
if (!content) continue;
|
|
4756
|
-
const receivedAt = extractCanonicalHermesMessageTimestamp(message, fallbackTs);
|
|
4757
|
-
fallbackTs = receivedAt + 1;
|
|
4758
|
-
if (role === "user") {
|
|
4759
|
-
records.push({
|
|
4760
|
-
ts: new Date(receivedAt).toISOString(),
|
|
4761
|
-
receivedAt,
|
|
4762
|
-
role: "user",
|
|
4763
|
-
content,
|
|
4764
|
-
kind: "standard",
|
|
4765
|
-
agent: "hermes-cli",
|
|
4766
|
-
historySessionId: normalizedSessionId
|
|
4767
|
-
});
|
|
4768
|
-
continue;
|
|
4769
|
-
}
|
|
4770
|
-
if (role === "assistant") {
|
|
4771
|
-
records.push({
|
|
4772
|
-
ts: new Date(receivedAt).toISOString(),
|
|
4773
|
-
receivedAt,
|
|
4774
|
-
role: "assistant",
|
|
4775
|
-
content,
|
|
4776
|
-
kind: "standard",
|
|
4777
|
-
agent: "hermes-cli",
|
|
4778
|
-
historySessionId: normalizedSessionId
|
|
4779
|
-
});
|
|
4780
|
-
continue;
|
|
4781
|
-
}
|
|
4782
|
-
if (role === "tool") {
|
|
4783
|
-
records.push({
|
|
4784
|
-
ts: new Date(receivedAt).toISOString(),
|
|
4785
|
-
receivedAt,
|
|
4786
|
-
role: "assistant",
|
|
4787
|
-
content,
|
|
4788
|
-
kind: "tool",
|
|
4789
|
-
senderName: "Tool",
|
|
4790
|
-
agent: "hermes-cli",
|
|
4791
|
-
historySessionId: normalizedSessionId
|
|
4792
|
-
});
|
|
4793
|
-
}
|
|
4794
|
-
}
|
|
4795
|
-
return rewriteCanonicalSavedHistory("hermes-cli", normalizedSessionId, records);
|
|
4812
|
+
sourceMtimeMs = fs3.statSync(sourcePath).mtimeMs;
|
|
4796
4813
|
} catch {
|
|
4797
|
-
return false;
|
|
4798
4814
|
}
|
|
4815
|
+
const firstMessageAt = visible[0]?.receivedAt || sourceMtimeMs || Date.now();
|
|
4816
|
+
const lastMessageAt = visible[visible.length - 1]?.receivedAt || firstMessageAt;
|
|
4817
|
+
const lastNonSystem = [...visible].reverse().find((message) => message.role !== "system") || visible[visible.length - 1];
|
|
4818
|
+
const firstSystem = visible.find((message) => message.kind === "session_start");
|
|
4819
|
+
return {
|
|
4820
|
+
historySessionId,
|
|
4821
|
+
sessionTitle: lastNonSystem?.content,
|
|
4822
|
+
messageCount: visible.length,
|
|
4823
|
+
firstMessageAt,
|
|
4824
|
+
lastMessageAt,
|
|
4825
|
+
preview: lastNonSystem?.content,
|
|
4826
|
+
workspace: firstSystem?.workspace || (firstSystem?.kind === "session_start" ? firstSystem.content : void 0),
|
|
4827
|
+
source: "provider-native",
|
|
4828
|
+
sourcePath,
|
|
4829
|
+
sourceMtimeMs
|
|
4830
|
+
};
|
|
4799
4831
|
}
|
|
4800
|
-
function
|
|
4801
|
-
const
|
|
4802
|
-
if (!
|
|
4803
|
-
const
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
}
|
|
4821
|
-
}
|
|
4822
|
-
}
|
|
4823
|
-
return null;
|
|
4832
|
+
function normalizeProviderNativeHistorySessionSummary(agentType, item) {
|
|
4833
|
+
const historySessionId = normalizeSavedHistorySessionId(item?.historySessionId || item?.sessionId || "");
|
|
4834
|
+
if (!historySessionId) return null;
|
|
4835
|
+
const sourcePath = typeof item?.sourcePath === "string" ? item.sourcePath : "";
|
|
4836
|
+
const sourceMtimeMs = Number(item?.sourceMtimeMs) || 0;
|
|
4837
|
+
const firstMessageAt = Number(item?.firstMessageAt) || sourceMtimeMs || Date.now();
|
|
4838
|
+
const lastMessageAt = Number(item?.lastMessageAt) || firstMessageAt;
|
|
4839
|
+
const messageCount = Math.max(0, Number(item?.messageCount) || 0);
|
|
4840
|
+
return {
|
|
4841
|
+
historySessionId,
|
|
4842
|
+
sessionTitle: typeof item?.sessionTitle === "string" ? item.sessionTitle : void 0,
|
|
4843
|
+
messageCount,
|
|
4844
|
+
firstMessageAt,
|
|
4845
|
+
lastMessageAt,
|
|
4846
|
+
preview: typeof item?.preview === "string" ? item.preview : void 0,
|
|
4847
|
+
workspace: typeof item?.workspace === "string" ? item.workspace : void 0,
|
|
4848
|
+
source: "provider-native",
|
|
4849
|
+
sourcePath,
|
|
4850
|
+
sourceMtimeMs
|
|
4851
|
+
};
|
|
4824
4852
|
}
|
|
4825
|
-
function
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4853
|
+
function collectProviderScriptNativeHistorySessionSummaries(agentType, canonicalHistory, scripts) {
|
|
4854
|
+
const fn = getProviderNativeHistoryScript(scripts, canonicalHistory, "listSessions");
|
|
4855
|
+
if (!fn) return null;
|
|
4856
|
+
const result = fn({
|
|
4857
|
+
agentType,
|
|
4858
|
+
format: canonicalHistory.format,
|
|
4859
|
+
watchPath: canonicalHistory.watchPath,
|
|
4860
|
+
args: {}
|
|
4861
|
+
});
|
|
4862
|
+
if (!result || typeof result !== "object") return [];
|
|
4863
|
+
const sessions = Array.isArray(result.sessions) ? result.sessions : [];
|
|
4864
|
+
const summaries = [];
|
|
4865
|
+
for (const item of sessions) {
|
|
4866
|
+
if (Array.isArray(item?.messages || item?.records)) {
|
|
4867
|
+
const historySessionId = normalizeSavedHistorySessionId(item?.historySessionId || item?.sessionId || "");
|
|
4868
|
+
if (!historySessionId) continue;
|
|
4869
|
+
const records = normalizeProviderNativeHistoryRecords(agentType, historySessionId, item.messages || item.records);
|
|
4870
|
+
const summary2 = buildNativeSessionSummary(agentType, historySessionId, records, typeof item?.sourcePath === "string" ? item.sourcePath : "");
|
|
4871
|
+
if (summary2) {
|
|
4872
|
+
if (Number(item?.sourceMtimeMs)) summary2.sourceMtimeMs = Number(item.sourceMtimeMs);
|
|
4873
|
+
summaries.push(summary2);
|
|
4874
|
+
}
|
|
4839
4875
|
continue;
|
|
4840
4876
|
}
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
const input = record2.input && typeof record2.input === "object" ? record2.input : null;
|
|
4844
|
-
const command = input ? String(input.command || "").trim() : "";
|
|
4845
|
-
const summary = command ? `${name}: ${command}` : name;
|
|
4846
|
-
if (summary) parts.push({ content: summary, kind: "tool", senderName: "Tool", role: "assistant" });
|
|
4847
|
-
}
|
|
4877
|
+
const summary = normalizeProviderNativeHistorySessionSummary(agentType, item);
|
|
4878
|
+
if (summary) summaries.push(summary);
|
|
4848
4879
|
}
|
|
4849
|
-
return
|
|
4880
|
+
return sortSavedHistorySessionSummaries(summaries);
|
|
4850
4881
|
}
|
|
4851
|
-
function
|
|
4852
|
-
|
|
4853
|
-
const trimmed = content.trim();
|
|
4854
|
-
return trimmed ? [{ role: "user", content: trimmed, kind: "standard" }] : [];
|
|
4855
|
-
}
|
|
4856
|
-
if (!Array.isArray(content)) return [];
|
|
4857
|
-
const parts = [];
|
|
4858
|
-
for (const block of content) {
|
|
4859
|
-
if (!block || typeof block !== "object") continue;
|
|
4860
|
-
const record2 = block;
|
|
4861
|
-
const type = String(record2.type || "").trim();
|
|
4862
|
-
if (type === "text") {
|
|
4863
|
-
const text = String(record2.text || "").trim();
|
|
4864
|
-
if (text) parts.push({ role: "user", content: text, kind: "standard" });
|
|
4865
|
-
continue;
|
|
4866
|
-
}
|
|
4867
|
-
if (type === "tool_result") {
|
|
4868
|
-
const rawContent = record2.content;
|
|
4869
|
-
const text = typeof rawContent === "string" ? rawContent.trim() : Array.isArray(rawContent) ? rawContent.map((entry) => {
|
|
4870
|
-
if (typeof entry === "string") return entry.trim();
|
|
4871
|
-
if (!entry || typeof entry !== "object") return "";
|
|
4872
|
-
const nested = entry;
|
|
4873
|
-
if (typeof nested.text === "string") return nested.text.trim();
|
|
4874
|
-
if (typeof nested.content === "string") return nested.content.trim();
|
|
4875
|
-
return "";
|
|
4876
|
-
}).filter(Boolean).join("\n") : "";
|
|
4877
|
-
if (text) parts.push({ role: "assistant", content: text, kind: "tool", senderName: "Tool" });
|
|
4878
|
-
}
|
|
4879
|
-
}
|
|
4880
|
-
return parts;
|
|
4882
|
+
function collectNativeHistorySessionSummaries(agentType, canonicalHistory, scripts) {
|
|
4883
|
+
return collectProviderScriptNativeHistorySessionSummaries(agentType, canonicalHistory, scripts) || [];
|
|
4881
4884
|
}
|
|
4882
|
-
function
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
const
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
records.push({
|
|
4893
|
-
...existingSessionStart,
|
|
4894
|
-
historySessionId: normalizedSessionId
|
|
4895
|
-
});
|
|
4896
|
-
}
|
|
4897
|
-
let fallbackTs = Date.now();
|
|
4898
|
-
for (const line of lines) {
|
|
4899
|
-
let parsed = null;
|
|
4900
|
-
try {
|
|
4901
|
-
parsed = JSON.parse(line);
|
|
4902
|
-
} catch {
|
|
4903
|
-
parsed = null;
|
|
4904
|
-
}
|
|
4905
|
-
if (!parsed) continue;
|
|
4906
|
-
const parsedSessionId = String(parsed.sessionId || "").trim();
|
|
4907
|
-
if (parsedSessionId && parsedSessionId !== normalizedSessionId) continue;
|
|
4908
|
-
const receivedAt = extractTimestampValue(parsed.timestamp) || fallbackTs;
|
|
4909
|
-
fallbackTs = receivedAt + 1;
|
|
4910
|
-
const parsedWorkspace = String(parsed.cwd || workspace || "").trim();
|
|
4911
|
-
if (records.length === 0 && parsedWorkspace) {
|
|
4912
|
-
records.push({
|
|
4913
|
-
ts: new Date(receivedAt).toISOString(),
|
|
4914
|
-
receivedAt,
|
|
4915
|
-
role: "system",
|
|
4916
|
-
kind: "session_start",
|
|
4917
|
-
content: parsedWorkspace,
|
|
4918
|
-
agent: "claude-cli",
|
|
4919
|
-
historySessionId: normalizedSessionId,
|
|
4920
|
-
workspace: parsedWorkspace
|
|
4921
|
-
});
|
|
4922
|
-
}
|
|
4923
|
-
const type = String(parsed.type || "").trim();
|
|
4924
|
-
const message = parsed.message && typeof parsed.message === "object" ? parsed.message : null;
|
|
4925
|
-
if (type === "user" && message) {
|
|
4926
|
-
for (const part of extractClaudeUserContentParts(message.content)) {
|
|
4927
|
-
records.push({
|
|
4928
|
-
ts: new Date(receivedAt).toISOString(),
|
|
4929
|
-
receivedAt,
|
|
4930
|
-
role: part.role,
|
|
4931
|
-
content: part.content,
|
|
4932
|
-
kind: part.kind,
|
|
4933
|
-
senderName: part.senderName,
|
|
4934
|
-
agent: "claude-cli",
|
|
4935
|
-
historySessionId: normalizedSessionId
|
|
4936
|
-
});
|
|
4937
|
-
}
|
|
4938
|
-
continue;
|
|
4939
|
-
}
|
|
4940
|
-
if (type === "assistant" && message) {
|
|
4941
|
-
for (const part of extractClaudeAssistantContentParts(message.content)) {
|
|
4942
|
-
records.push({
|
|
4943
|
-
ts: new Date(receivedAt).toISOString(),
|
|
4944
|
-
receivedAt,
|
|
4945
|
-
role: "assistant",
|
|
4946
|
-
content: part.content,
|
|
4947
|
-
kind: part.kind,
|
|
4948
|
-
senderName: part.senderName,
|
|
4949
|
-
agent: "claude-cli",
|
|
4950
|
-
historySessionId: normalizedSessionId
|
|
4951
|
-
});
|
|
4952
|
-
}
|
|
4953
|
-
}
|
|
4954
|
-
}
|
|
4955
|
-
return rewriteCanonicalSavedHistory("claude-cli", normalizedSessionId, records);
|
|
4956
|
-
} catch {
|
|
4957
|
-
return false;
|
|
4885
|
+
function listProviderHistorySessions(agentType, options = {}) {
|
|
4886
|
+
if (isNativeSourceCanonicalHistory(options.canonicalHistory)) {
|
|
4887
|
+
const offset = Math.max(0, options.offset || 0);
|
|
4888
|
+
const limit = Math.max(1, options.limit || 30);
|
|
4889
|
+
const summaries = collectNativeHistorySessionSummaries(agentType, options.canonicalHistory, options.scripts);
|
|
4890
|
+
return {
|
|
4891
|
+
sessions: summaries.slice(offset, offset + limit),
|
|
4892
|
+
hasMore: offset + limit < summaries.length,
|
|
4893
|
+
source: "provider-native"
|
|
4894
|
+
};
|
|
4958
4895
|
}
|
|
4896
|
+
return {
|
|
4897
|
+
...listSavedHistorySessions(agentType, { offset: options.offset, limit: options.limit }, options.historyBehavior),
|
|
4898
|
+
source: "adhdev-mirror"
|
|
4899
|
+
};
|
|
4959
4900
|
}
|
|
4960
4901
|
var fs3, path7, os6, HISTORY_DIR, RETAIN_DAYS, SAVED_HISTORY_INDEX_VERSION, SAVED_HISTORY_INDEX_FILE, SAVED_HISTORY_INDEX_LOCK_SUFFIX, SAVED_HISTORY_INDEX_LOCK_WAIT_MS, SAVED_HISTORY_INDEX_LOCK_STALE_MS, SAVED_HISTORY_INDEX_LOCK_POLL_MS, SAVED_HISTORY_ROLLUP_THRESHOLD_BYTES, savedHistorySessionCache, savedHistoryFileSummaryCache, savedHistoryBackgroundRefresh, savedHistoryRollupInFlight, ChatHistoryWriter;
|
|
4961
4902
|
var init_chat_history = __esm({
|
|
@@ -5960,6 +5901,8 @@ function validateReadChatResultPayload(raw, source = "read_chat") {
|
|
|
5960
5901
|
if (raw.summaryMetadata !== void 0) normalized.summaryMetadata = raw.summaryMetadata;
|
|
5961
5902
|
if (Array.isArray(raw.effects)) normalized.effects = raw.effects;
|
|
5962
5903
|
if (typeof raw.providerSessionId === "string") normalized.providerSessionId = raw.providerSessionId;
|
|
5904
|
+
if (raw.transcriptAuthority === "provider" || raw.transcriptAuthority === "daemon") normalized.transcriptAuthority = raw.transcriptAuthority;
|
|
5905
|
+
if (raw.coverage === "full" || raw.coverage === "tail" || raw.coverage === "current-turn") normalized.coverage = raw.coverage;
|
|
5963
5906
|
return normalized;
|
|
5964
5907
|
}
|
|
5965
5908
|
var VALID_STATUSES, VALID_ROLES, VALID_BUBBLE_STATES, VALID_TURN_STATUSES;
|
|
@@ -8227,7 +8170,17 @@ async function handleChatHistory(h, args) {
|
|
|
8227
8170
|
const visibleCount = Array.isArray(status?.messages) ? status.messages.length : 0;
|
|
8228
8171
|
if (visibleCount > excludeRecentCount) excludeRecentCount = visibleCount;
|
|
8229
8172
|
}
|
|
8230
|
-
const
|
|
8173
|
+
const workspace = typeof args?.workspace === "string" ? args.workspace : typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : void 0;
|
|
8174
|
+
const result = readProviderChatHistory(agentStr, {
|
|
8175
|
+
canonicalHistory: provider?.canonicalHistory,
|
|
8176
|
+
historySessionId,
|
|
8177
|
+
workspace,
|
|
8178
|
+
offset: offset || 0,
|
|
8179
|
+
limit: limit || 30,
|
|
8180
|
+
excludeRecentCount,
|
|
8181
|
+
historyBehavior: provider?.historyBehavior,
|
|
8182
|
+
scripts: provider?.scripts
|
|
8183
|
+
});
|
|
8231
8184
|
return { success: true, ...result, agent: agentStr };
|
|
8232
8185
|
} catch (e) {
|
|
8233
8186
|
return { success: false, error: e.message };
|
|
@@ -8252,7 +8205,8 @@ async function handleReadChat(h, args) {
|
|
|
8252
8205
|
}
|
|
8253
8206
|
const parsedRecord = parsedStatus && typeof parsedStatus === "object" ? parsedStatus : null;
|
|
8254
8207
|
const adapterStatus = adapter.getStatus();
|
|
8255
|
-
const
|
|
8208
|
+
const parsedIsProviderAuthoritative = parsedRecord?.transcriptAuthority === "provider" || parsedRecord?.coverage === "full";
|
|
8209
|
+
const shouldPreferAdapterMessages = !parsedIsProviderAuthoritative && Array.isArray(adapterStatus.messages) && adapterStatus.messages.length > 0 && Array.isArray(parsedRecord?.messages) && adapterStatus.messages.length > parsedRecord.messages.length;
|
|
8256
8210
|
const parsedShowsApproval = hasNonEmptyModalButtons(parsedRecord?.activeModal) && parsedRecord?.status === "waiting_approval";
|
|
8257
8211
|
const status = parsedRecord ? {
|
|
8258
8212
|
...parsedRecord,
|
|
@@ -8262,6 +8216,8 @@ async function handleReadChat(h, args) {
|
|
|
8262
8216
|
} : adapterStatus;
|
|
8263
8217
|
const title = typeof parsedRecord?.title === "string" ? parsedRecord.title : void 0;
|
|
8264
8218
|
const providerSessionId = typeof parsedRecord?.providerSessionId === "string" ? parsedRecord.providerSessionId : void 0;
|
|
8219
|
+
const transcriptAuthority = parsedRecord?.transcriptAuthority === "provider" || parsedRecord?.transcriptAuthority === "daemon" ? parsedRecord.transcriptAuthority : void 0;
|
|
8220
|
+
const coverage = parsedRecord?.coverage === "full" || parsedRecord?.coverage === "tail" || parsedRecord?.coverage === "current-turn" ? parsedRecord.coverage : void 0;
|
|
8265
8221
|
if (status) {
|
|
8266
8222
|
LOG.debug("Command", `[read_chat] cli-like resolved provider=${adapter.cliType} target=${String(args?.targetSessionId || "")} adapterStatus=${String(adapterStatus.status || "")} parsedStatus=${String(parsedRecord?.status || "")} shouldPreferAdapterMessages=${String(shouldPreferAdapterMessages)} adapterMsgCount=${Array.isArray(adapterStatus.messages) ? adapterStatus.messages.length : 0} parsedMsgCount=${Array.isArray(parsedRecord?.messages) ? parsedRecord.messages.length : 0} returnedMsgCount=${Array.isArray(status.messages) ? status.messages.length : 0}`);
|
|
8267
8223
|
return buildReadChatCommandResult({
|
|
@@ -8280,7 +8236,9 @@ async function handleReadChat(h, args) {
|
|
|
8280
8236
|
returnedMsgCount: Array.isArray(status.messages) ? status.messages.length : 0
|
|
8281
8237
|
},
|
|
8282
8238
|
...title ? { title } : {},
|
|
8283
|
-
...providerSessionId ? { providerSessionId } : {}
|
|
8239
|
+
...providerSessionId ? { providerSessionId } : {},
|
|
8240
|
+
...transcriptAuthority ? { transcriptAuthority } : {},
|
|
8241
|
+
...coverage ? { coverage } : {}
|
|
8284
8242
|
}, args);
|
|
8285
8243
|
}
|
|
8286
8244
|
}
|
|
@@ -11072,18 +11030,18 @@ var init_source2 = __esm({
|
|
|
11072
11030
|
}
|
|
11073
11031
|
}
|
|
11074
11032
|
});
|
|
11075
|
-
createStyler2 = (
|
|
11033
|
+
createStyler2 = (open2, close, parent) => {
|
|
11076
11034
|
let openAll;
|
|
11077
11035
|
let closeAll;
|
|
11078
11036
|
if (parent === void 0) {
|
|
11079
|
-
openAll =
|
|
11037
|
+
openAll = open2;
|
|
11080
11038
|
closeAll = close;
|
|
11081
11039
|
} else {
|
|
11082
|
-
openAll = parent.openAll +
|
|
11040
|
+
openAll = parent.openAll + open2;
|
|
11083
11041
|
closeAll = close + parent.closeAll;
|
|
11084
11042
|
}
|
|
11085
11043
|
return {
|
|
11086
|
-
open:
|
|
11044
|
+
open: open2,
|
|
11087
11045
|
close,
|
|
11088
11046
|
openAll,
|
|
11089
11047
|
closeAll,
|
|
@@ -11615,14 +11573,14 @@ function applyTerminalColorEnv(env3) {
|
|
|
11615
11573
|
function ensureNodePtySpawnHelperPermissions(logFn) {
|
|
11616
11574
|
if (os22.platform() === "win32") return;
|
|
11617
11575
|
try {
|
|
11618
|
-
const
|
|
11576
|
+
const fs22 = __require("fs");
|
|
11619
11577
|
const ptyDir = path32.resolve(path32.dirname(__require.resolve("node-pty")), "..");
|
|
11620
11578
|
const platformArch = `${os22.platform()}-${os22.arch()}`;
|
|
11621
11579
|
const helper = path32.join(ptyDir, "prebuilds", platformArch, "spawn-helper");
|
|
11622
|
-
if (
|
|
11623
|
-
const stat4 =
|
|
11580
|
+
if (fs22.existsSync(helper)) {
|
|
11581
|
+
const stat4 = fs22.statSync(helper);
|
|
11624
11582
|
if (!(stat4.mode & 73)) {
|
|
11625
|
-
|
|
11583
|
+
fs22.chmodSync(helper, stat4.mode | 493);
|
|
11626
11584
|
logFn?.(`Fixed spawn-helper permissions: ${helper}`);
|
|
11627
11585
|
}
|
|
11628
11586
|
}
|
|
@@ -12095,8 +12053,8 @@ var init_pty_transport = __esm({
|
|
|
12095
12053
|
let cwd = options.cwd;
|
|
12096
12054
|
if (cwd) {
|
|
12097
12055
|
try {
|
|
12098
|
-
const
|
|
12099
|
-
const stat4 =
|
|
12056
|
+
const fs22 = require("fs");
|
|
12057
|
+
const stat4 = fs22.statSync(cwd);
|
|
12100
12058
|
if (!stat4.isDirectory()) cwd = os10.homedir();
|
|
12101
12059
|
} catch {
|
|
12102
12060
|
cwd = os10.homedir();
|
|
@@ -12194,12 +12152,12 @@ function findBinary(name) {
|
|
|
12194
12152
|
function isScriptBinary(binaryPath) {
|
|
12195
12153
|
if (!path10.isAbsolute(binaryPath)) return false;
|
|
12196
12154
|
try {
|
|
12197
|
-
const
|
|
12198
|
-
const resolved =
|
|
12155
|
+
const fs22 = require("fs");
|
|
12156
|
+
const resolved = fs22.realpathSync(binaryPath);
|
|
12199
12157
|
const head = Buffer.alloc(8);
|
|
12200
|
-
const fd =
|
|
12201
|
-
|
|
12202
|
-
|
|
12158
|
+
const fd = fs22.openSync(resolved, "r");
|
|
12159
|
+
fs22.readSync(fd, head, 0, 8, 0);
|
|
12160
|
+
fs22.closeSync(fd);
|
|
12203
12161
|
let i = 0;
|
|
12204
12162
|
if (head[0] === 239 && head[1] === 187 && head[2] === 191) i = 3;
|
|
12205
12163
|
return head[i] === 35 && head[i + 1] === 33;
|
|
@@ -12210,12 +12168,12 @@ function isScriptBinary(binaryPath) {
|
|
|
12210
12168
|
function looksLikeMachOOrElf(filePath) {
|
|
12211
12169
|
if (!path10.isAbsolute(filePath)) return false;
|
|
12212
12170
|
try {
|
|
12213
|
-
const
|
|
12214
|
-
const resolved =
|
|
12171
|
+
const fs22 = require("fs");
|
|
12172
|
+
const resolved = fs22.realpathSync(filePath);
|
|
12215
12173
|
const buf = Buffer.alloc(8);
|
|
12216
|
-
const fd =
|
|
12217
|
-
|
|
12218
|
-
|
|
12174
|
+
const fd = fs22.openSync(resolved, "r");
|
|
12175
|
+
fs22.readSync(fd, buf, 0, 8, 0);
|
|
12176
|
+
fs22.closeSync(fd);
|
|
12219
12177
|
let i = 0;
|
|
12220
12178
|
if (buf[0] === 239 && buf[1] === 187 && buf[2] === 191) i = 3;
|
|
12221
12179
|
const b = buf.subarray(i);
|
|
@@ -12775,7 +12733,8 @@ __export(provider_cli_adapter_exports, {
|
|
|
12775
12733
|
ProviderCliAdapter: () => ProviderCliAdapter,
|
|
12776
12734
|
appendBoundedText: () => appendBoundedText,
|
|
12777
12735
|
normalizeCliProviderForRuntime: () => normalizeCliProviderForRuntime,
|
|
12778
|
-
sanitizeCliStandardMessageContent: () => sanitizeCliStandardMessageContent
|
|
12736
|
+
sanitizeCliStandardMessageContent: () => sanitizeCliStandardMessageContent,
|
|
12737
|
+
trimLastAssistantEchoForCliMessages: () => trimLastAssistantEchoForCliMessages
|
|
12779
12738
|
});
|
|
12780
12739
|
function normalizeComparableTranscriptText(value) {
|
|
12781
12740
|
return sanitizeTerminalText(String(value || "")).replace(/\s+/g, " ").trim();
|
|
@@ -12871,6 +12830,19 @@ function sanitizeCommittedMessageForDisplay(message) {
|
|
|
12871
12830
|
if (content === message.content) return message;
|
|
12872
12831
|
return { ...message, content };
|
|
12873
12832
|
}
|
|
12833
|
+
function trimLastAssistantEchoForCliMessages(messages, prompt2) {
|
|
12834
|
+
if (!prompt2) return;
|
|
12835
|
+
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
12836
|
+
const message = messages[index];
|
|
12837
|
+
if (!message || message.role !== "assistant" || typeof message.content !== "string") continue;
|
|
12838
|
+
if ((message.kind || "standard") !== "standard") continue;
|
|
12839
|
+
message.content = trimPromptEchoPrefix(message.content, prompt2);
|
|
12840
|
+
if (!message.content.trim()) {
|
|
12841
|
+
messages.splice(index, 1);
|
|
12842
|
+
}
|
|
12843
|
+
return;
|
|
12844
|
+
}
|
|
12845
|
+
}
|
|
12874
12846
|
var os13, COMMITTED_ACTIVITY_PREFIX_BLOCK_RE, ProviderCliAdapter;
|
|
12875
12847
|
var init_provider_cli_adapter = __esm({
|
|
12876
12848
|
"../../oss/packages/daemon-core/src/cli-adapters/provider-cli-adapter.ts"() {
|
|
@@ -13068,7 +13040,14 @@ var init_provider_cli_adapter = __esm({
|
|
|
13068
13040
|
}
|
|
13069
13041
|
return null;
|
|
13070
13042
|
}
|
|
13043
|
+
providerOwnsTranscript() {
|
|
13044
|
+
return this.provider.transcriptAuthority === "provider";
|
|
13045
|
+
}
|
|
13046
|
+
shouldUseFullProviderTranscriptContext() {
|
|
13047
|
+
return this.providerOwnsTranscript() && this.provider.transcriptContext === "full";
|
|
13048
|
+
}
|
|
13071
13049
|
selectParseBaseMessages(baseMessages) {
|
|
13050
|
+
if (this.shouldUseFullProviderTranscriptContext()) return baseMessages;
|
|
13072
13051
|
if (baseMessages.length <= _ProviderCliAdapter.PARSE_MESSAGE_TAIL_LIMIT) return baseMessages;
|
|
13073
13052
|
return baseMessages.slice(-_ProviderCliAdapter.PARSE_MESSAGE_TAIL_LIMIT);
|
|
13074
13053
|
}
|
|
@@ -13551,9 +13530,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
13551
13530
|
);
|
|
13552
13531
|
}
|
|
13553
13532
|
trimLastAssistantEcho(messages, prompt2) {
|
|
13554
|
-
|
|
13555
|
-
const last = [...messages].reverse().find((m) => m.role === "assistant" && typeof m.content === "string");
|
|
13556
|
-
if (last) last.content = trimPromptEchoPrefix(last.content, prompt2);
|
|
13533
|
+
trimLastAssistantEchoForCliMessages(messages, prompt2);
|
|
13557
13534
|
}
|
|
13558
13535
|
clearAllTimers() {
|
|
13559
13536
|
if (this.responseTimeout) {
|
|
@@ -14407,7 +14384,8 @@ var init_provider_cli_adapter = __esm({
|
|
|
14407
14384
|
title: parsed.title || this.cliName,
|
|
14408
14385
|
messages: hydratedMessages,
|
|
14409
14386
|
activeModal: parsed.activeModal ?? this.activeModal,
|
|
14410
|
-
providerSessionId: typeof parsed.providerSessionId === "string" ? parsed.providerSessionId : void 0
|
|
14387
|
+
providerSessionId: typeof parsed.providerSessionId === "string" ? parsed.providerSessionId : void 0,
|
|
14388
|
+
...this.providerOwnsTranscript() ? { transcriptAuthority: "provider", coverage: this.shouldUseFullProviderTranscriptContext() ? "full" : "tail" } : {}
|
|
14411
14389
|
};
|
|
14412
14390
|
} else {
|
|
14413
14391
|
const messages = [...this.committedMessages];
|
|
@@ -15294,11 +15272,8 @@ var init_cli_provider_instance = __esm({
|
|
|
15294
15272
|
historyWriter;
|
|
15295
15273
|
runtimeMessages = [];
|
|
15296
15274
|
lastPersistedHistoryMessages = [];
|
|
15297
|
-
|
|
15298
|
-
|
|
15299
|
-
lastCanonicalHermesWatchPath = void 0;
|
|
15300
|
-
lastCanonicalClaudeRebuildMtimeMs = 0;
|
|
15301
|
-
lastCanonicalClaudeCheckAt = 0;
|
|
15275
|
+
lastNativeSourceCanonicalCheckAt = 0;
|
|
15276
|
+
lastNativeSourceCanonicalCacheKey = void 0;
|
|
15302
15277
|
cachedSqliteDb = null;
|
|
15303
15278
|
cachedSqliteDbPath = null;
|
|
15304
15279
|
cachedSqliteDbMissingUntil = 0;
|
|
@@ -15998,41 +15973,45 @@ ${effect.notification.body || ""}`.trim();
|
|
|
15998
15973
|
if (!this.providerSessionId) return false;
|
|
15999
15974
|
const canonicalHistory = this.provider.canonicalHistory;
|
|
16000
15975
|
if (!canonicalHistory) return false;
|
|
15976
|
+
if (isNativeSourceCanonicalHistory(canonicalHistory)) {
|
|
15977
|
+
const cacheKey = [this.type, this.providerSessionId, this.workingDir].join("\0");
|
|
15978
|
+
const now = Date.now();
|
|
15979
|
+
if (cacheKey === this.lastNativeSourceCanonicalCacheKey && now - this.lastNativeSourceCanonicalCheckAt < 2e3) {
|
|
15980
|
+
return true;
|
|
15981
|
+
}
|
|
15982
|
+
this.lastNativeSourceCanonicalCacheKey = cacheKey;
|
|
15983
|
+
this.lastNativeSourceCanonicalCheckAt = now;
|
|
15984
|
+
const restoredHistory = readProviderChatHistory(this.type, {
|
|
15985
|
+
canonicalHistory,
|
|
15986
|
+
historySessionId: this.providerSessionId,
|
|
15987
|
+
workspace: this.workingDir,
|
|
15988
|
+
offset: 0,
|
|
15989
|
+
limit: Number.MAX_SAFE_INTEGER,
|
|
15990
|
+
historyBehavior: this.provider.historyBehavior,
|
|
15991
|
+
scripts: this.provider.scripts
|
|
15992
|
+
});
|
|
15993
|
+
if (restoredHistory.source === "provider-native") {
|
|
15994
|
+
this.lastPersistedHistoryMessages = restoredHistory.messages.map((message) => ({
|
|
15995
|
+
role: message.role,
|
|
15996
|
+
content: message.content,
|
|
15997
|
+
kind: message.kind,
|
|
15998
|
+
senderName: message.senderName,
|
|
15999
|
+
receivedAt: message.receivedAt
|
|
16000
|
+
}));
|
|
16001
|
+
}
|
|
16002
|
+
return true;
|
|
16003
|
+
}
|
|
16001
16004
|
try {
|
|
16002
|
-
|
|
16003
|
-
|
|
16004
|
-
|
|
16005
|
-
|
|
16006
|
-
|
|
16007
|
-
|
|
16008
|
-
|
|
16009
|
-
|
|
16010
|
-
|
|
16011
|
-
if (!fs5.existsSync(watchPath)) return false;
|
|
16012
|
-
}
|
|
16013
|
-
const stat4 = fs5.statSync(watchPath);
|
|
16014
|
-
if (stat4.mtimeMs <= this.lastCanonicalHermesSyncMtimeMs) return true;
|
|
16015
|
-
rebuilt = rebuildHermesSavedHistoryFromCanonicalSession(this.providerSessionId);
|
|
16016
|
-
if (rebuilt) this.lastCanonicalHermesSyncMtimeMs = stat4.mtimeMs;
|
|
16017
|
-
} else if (canonicalHistory.format === "claude-jsonl") {
|
|
16018
|
-
const now = Date.now();
|
|
16019
|
-
if (now - this.lastCanonicalClaudeCheckAt < 2e3 && this.lastCanonicalClaudeRebuildMtimeMs !== 0) {
|
|
16020
|
-
return true;
|
|
16021
|
-
}
|
|
16022
|
-
this.lastCanonicalClaudeCheckAt = now;
|
|
16023
|
-
const claudeProjectsDir = path12.join(os14.homedir(), ".claude", "projects");
|
|
16024
|
-
const workspaceSegment = typeof this.workingDir === "string" ? this.workingDir.replace(/[\\/]/g, "-").replace(/^-+/, "") : "";
|
|
16025
|
-
const transcriptFile = path12.join(claudeProjectsDir, workspaceSegment, `${this.providerSessionId}.jsonl`);
|
|
16026
|
-
let transcriptMtime = 0;
|
|
16027
|
-
try {
|
|
16028
|
-
transcriptMtime = fs5.statSync(transcriptFile).mtimeMs;
|
|
16029
|
-
} catch {
|
|
16030
|
-
}
|
|
16031
|
-
if (transcriptMtime > 0 && transcriptMtime <= this.lastCanonicalClaudeRebuildMtimeMs) return true;
|
|
16032
|
-
rebuilt = rebuildClaudeSavedHistoryFromNativeProject(this.providerSessionId, this.workingDir);
|
|
16033
|
-
if (rebuilt) this.lastCanonicalClaudeRebuildMtimeMs = transcriptMtime || Date.now();
|
|
16005
|
+
const cacheKey = [this.type, this.providerSessionId, this.workingDir, canonicalHistory.mode || "materialized-mirror"].join("\0");
|
|
16006
|
+
const now = Date.now();
|
|
16007
|
+
if (cacheKey === this.lastNativeSourceCanonicalCacheKey && now - this.lastNativeSourceCanonicalCheckAt < 2e3) {
|
|
16008
|
+
return true;
|
|
16009
|
+
}
|
|
16010
|
+
this.lastNativeSourceCanonicalCacheKey = cacheKey;
|
|
16011
|
+
this.lastNativeSourceCanonicalCheckAt = now;
|
|
16012
|
+
if (!materializeProviderNativeHistory(this.type, canonicalHistory, this.providerSessionId, this.workingDir, this.provider.scripts)) {
|
|
16013
|
+
return false;
|
|
16034
16014
|
}
|
|
16035
|
-
if (!rebuilt) return false;
|
|
16036
16015
|
const restoredHistory = readChatHistory(this.type, 0, Number.MAX_SAFE_INTEGER, this.providerSessionId, 0, this.provider.historyBehavior);
|
|
16037
16016
|
this.lastPersistedHistoryMessages = restoredHistory.messages.map((message) => ({
|
|
16038
16017
|
role: message.role,
|
|
@@ -16049,8 +16028,18 @@ ${effect.notification.body || ""}`.trim();
|
|
|
16049
16028
|
restorePersistedHistoryFromCurrentSession() {
|
|
16050
16029
|
if (!this.providerSessionId) return;
|
|
16051
16030
|
this.syncCanonicalSavedHistoryIfNeeded();
|
|
16052
|
-
this.
|
|
16053
|
-
|
|
16031
|
+
const restoredHistory = isNativeSourceCanonicalHistory(this.provider.canonicalHistory) ? readProviderChatHistory(this.type, {
|
|
16032
|
+
canonicalHistory: this.provider.canonicalHistory,
|
|
16033
|
+
historySessionId: this.providerSessionId,
|
|
16034
|
+
workspace: this.workingDir,
|
|
16035
|
+
offset: 0,
|
|
16036
|
+
limit: Number.MAX_SAFE_INTEGER,
|
|
16037
|
+
historyBehavior: this.provider.historyBehavior,
|
|
16038
|
+
scripts: this.provider.scripts
|
|
16039
|
+
}) : (() => {
|
|
16040
|
+
this.historyWriter.compactHistorySession(this.type, this.providerSessionId, this.provider.historyBehavior);
|
|
16041
|
+
return readChatHistory(this.type, 0, Number.MAX_SAFE_INTEGER, this.providerSessionId, 0, this.provider.historyBehavior);
|
|
16042
|
+
})();
|
|
16054
16043
|
this.historyWriter.seedSessionHistory(
|
|
16055
16044
|
this.type,
|
|
16056
16045
|
restoredHistory.messages,
|
|
@@ -16377,10 +16366,10 @@ function mergeDefs(...defs) {
|
|
|
16377
16366
|
function cloneDef(schema) {
|
|
16378
16367
|
return mergeDefs(schema._zod.def);
|
|
16379
16368
|
}
|
|
16380
|
-
function getElementAtPath(obj,
|
|
16381
|
-
if (!
|
|
16369
|
+
function getElementAtPath(obj, path35) {
|
|
16370
|
+
if (!path35)
|
|
16382
16371
|
return obj;
|
|
16383
|
-
return
|
|
16372
|
+
return path35.reduce((acc, key) => acc?.[key], obj);
|
|
16384
16373
|
}
|
|
16385
16374
|
function promiseAllObject(promisesObj) {
|
|
16386
16375
|
const keys = Object.keys(promisesObj);
|
|
@@ -16692,11 +16681,11 @@ function aborted(x, startIndex = 0) {
|
|
|
16692
16681
|
}
|
|
16693
16682
|
return false;
|
|
16694
16683
|
}
|
|
16695
|
-
function prefixIssues(
|
|
16684
|
+
function prefixIssues(path35, issues) {
|
|
16696
16685
|
return issues.map((iss) => {
|
|
16697
16686
|
var _a2;
|
|
16698
16687
|
(_a2 = iss).path ?? (_a2.path = []);
|
|
16699
|
-
iss.path.unshift(
|
|
16688
|
+
iss.path.unshift(path35);
|
|
16700
16689
|
return iss;
|
|
16701
16690
|
});
|
|
16702
16691
|
}
|
|
@@ -16939,7 +16928,7 @@ function formatError(error48, mapper = (issue2) => issue2.message) {
|
|
|
16939
16928
|
}
|
|
16940
16929
|
function treeifyError(error48, mapper = (issue2) => issue2.message) {
|
|
16941
16930
|
const result = { errors: [] };
|
|
16942
|
-
const processError = (error49,
|
|
16931
|
+
const processError = (error49, path35 = []) => {
|
|
16943
16932
|
var _a2, _b;
|
|
16944
16933
|
for (const issue2 of error49.issues) {
|
|
16945
16934
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
@@ -16949,7 +16938,7 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
|
|
|
16949
16938
|
} else if (issue2.code === "invalid_element") {
|
|
16950
16939
|
processError({ issues: issue2.issues }, issue2.path);
|
|
16951
16940
|
} else {
|
|
16952
|
-
const fullpath = [...
|
|
16941
|
+
const fullpath = [...path35, ...issue2.path];
|
|
16953
16942
|
if (fullpath.length === 0) {
|
|
16954
16943
|
result.errors.push(mapper(issue2));
|
|
16955
16944
|
continue;
|
|
@@ -16981,8 +16970,8 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
|
|
|
16981
16970
|
}
|
|
16982
16971
|
function toDotPath(_path) {
|
|
16983
16972
|
const segs = [];
|
|
16984
|
-
const
|
|
16985
|
-
for (const seg of
|
|
16973
|
+
const path35 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
16974
|
+
for (const seg of path35) {
|
|
16986
16975
|
if (typeof seg === "number")
|
|
16987
16976
|
segs.push(`[${seg}]`);
|
|
16988
16977
|
else if (typeof seg === "symbol")
|
|
@@ -29746,13 +29735,13 @@ function resolveRef(ref, ctx) {
|
|
|
29746
29735
|
if (!ref.startsWith("#")) {
|
|
29747
29736
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
29748
29737
|
}
|
|
29749
|
-
const
|
|
29750
|
-
if (
|
|
29738
|
+
const path35 = ref.slice(1).split("/").filter(Boolean);
|
|
29739
|
+
if (path35.length === 0) {
|
|
29751
29740
|
return ctx.rootSchema;
|
|
29752
29741
|
}
|
|
29753
29742
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
29754
|
-
if (
|
|
29755
|
-
const key =
|
|
29743
|
+
if (path35[0] === defsKey) {
|
|
29744
|
+
const key = path35[1];
|
|
29756
29745
|
if (!key || !ctx.defs[key]) {
|
|
29757
29746
|
throw new Error(`Reference not found: ${ref}`);
|
|
29758
29747
|
}
|
|
@@ -34506,7 +34495,7 @@ var init_readdirp = __esm({
|
|
|
34506
34495
|
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
|
34507
34496
|
const statMethod = opts.lstat ? import_promises.lstat : import_promises.stat;
|
|
34508
34497
|
if (wantBigintFsStats) {
|
|
34509
|
-
this._stat = (
|
|
34498
|
+
this._stat = (path35) => statMethod(path35, { bigint: true });
|
|
34510
34499
|
} else {
|
|
34511
34500
|
this._stat = statMethod;
|
|
34512
34501
|
}
|
|
@@ -34531,8 +34520,8 @@ var init_readdirp = __esm({
|
|
|
34531
34520
|
const par = this.parent;
|
|
34532
34521
|
const fil = par && par.files;
|
|
34533
34522
|
if (fil && fil.length > 0) {
|
|
34534
|
-
const { path:
|
|
34535
|
-
const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent,
|
|
34523
|
+
const { path: path35, depth } = par;
|
|
34524
|
+
const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path35));
|
|
34536
34525
|
const awaited = await Promise.all(slice);
|
|
34537
34526
|
for (const entry of awaited) {
|
|
34538
34527
|
if (!entry)
|
|
@@ -34572,20 +34561,20 @@ var init_readdirp = __esm({
|
|
|
34572
34561
|
this.reading = false;
|
|
34573
34562
|
}
|
|
34574
34563
|
}
|
|
34575
|
-
async _exploreDir(
|
|
34564
|
+
async _exploreDir(path35, depth) {
|
|
34576
34565
|
let files;
|
|
34577
34566
|
try {
|
|
34578
|
-
files = await (0, import_promises.readdir)(
|
|
34567
|
+
files = await (0, import_promises.readdir)(path35, this._rdOptions);
|
|
34579
34568
|
} catch (error48) {
|
|
34580
34569
|
this._onError(error48);
|
|
34581
34570
|
}
|
|
34582
|
-
return { files, depth, path:
|
|
34571
|
+
return { files, depth, path: path35 };
|
|
34583
34572
|
}
|
|
34584
|
-
async _formatEntry(dirent,
|
|
34573
|
+
async _formatEntry(dirent, path35) {
|
|
34585
34574
|
let entry;
|
|
34586
34575
|
const basename10 = this._isDirent ? dirent.name : dirent;
|
|
34587
34576
|
try {
|
|
34588
|
-
const fullPath = (0, import_node_path.resolve)((0, import_node_path.join)(
|
|
34577
|
+
const fullPath = (0, import_node_path.resolve)((0, import_node_path.join)(path35, basename10));
|
|
34589
34578
|
entry = { path: (0, import_node_path.relative)(this._root, fullPath), fullPath, basename: basename10 };
|
|
34590
34579
|
entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
|
34591
34580
|
} catch (err) {
|
|
@@ -34642,16 +34631,16 @@ var init_readdirp = __esm({
|
|
|
34642
34631
|
});
|
|
34643
34632
|
|
|
34644
34633
|
// ../../oss/packages/daemon-core/node_modules/chokidar/handler.js
|
|
34645
|
-
function createFsWatchInstance(
|
|
34634
|
+
function createFsWatchInstance(path35, options, listener, errHandler, emitRaw) {
|
|
34646
34635
|
const handleEvent = (rawEvent, evPath) => {
|
|
34647
|
-
listener(
|
|
34648
|
-
emitRaw(rawEvent, evPath, { watchedPath:
|
|
34649
|
-
if (evPath &&
|
|
34650
|
-
fsWatchBroadcast(sp.resolve(
|
|
34636
|
+
listener(path35);
|
|
34637
|
+
emitRaw(rawEvent, evPath, { watchedPath: path35 });
|
|
34638
|
+
if (evPath && path35 !== evPath) {
|
|
34639
|
+
fsWatchBroadcast(sp.resolve(path35, evPath), KEY_LISTENERS, sp.join(path35, evPath));
|
|
34651
34640
|
}
|
|
34652
34641
|
};
|
|
34653
34642
|
try {
|
|
34654
|
-
return (0, import_node_fs.watch)(
|
|
34643
|
+
return (0, import_node_fs.watch)(path35, {
|
|
34655
34644
|
persistent: options.persistent
|
|
34656
34645
|
}, handleEvent);
|
|
34657
34646
|
} catch (error48) {
|
|
@@ -35000,12 +34989,12 @@ var init_handler2 = __esm({
|
|
|
35000
34989
|
listener(val1, val2, val3);
|
|
35001
34990
|
});
|
|
35002
34991
|
};
|
|
35003
|
-
setFsWatchListener = (
|
|
34992
|
+
setFsWatchListener = (path35, fullPath, options, handlers) => {
|
|
35004
34993
|
const { listener, errHandler, rawEmitter } = handlers;
|
|
35005
34994
|
let cont = FsWatchInstances.get(fullPath);
|
|
35006
34995
|
let watcher;
|
|
35007
34996
|
if (!options.persistent) {
|
|
35008
|
-
watcher = createFsWatchInstance(
|
|
34997
|
+
watcher = createFsWatchInstance(path35, options, listener, errHandler, rawEmitter);
|
|
35009
34998
|
if (!watcher)
|
|
35010
34999
|
return;
|
|
35011
35000
|
return watcher.close.bind(watcher);
|
|
@@ -35016,7 +35005,7 @@ var init_handler2 = __esm({
|
|
|
35016
35005
|
addAndConvert(cont, KEY_RAW, rawEmitter);
|
|
35017
35006
|
} else {
|
|
35018
35007
|
watcher = createFsWatchInstance(
|
|
35019
|
-
|
|
35008
|
+
path35,
|
|
35020
35009
|
options,
|
|
35021
35010
|
fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS),
|
|
35022
35011
|
errHandler,
|
|
@@ -35031,7 +35020,7 @@ var init_handler2 = __esm({
|
|
|
35031
35020
|
cont.watcherUnusable = true;
|
|
35032
35021
|
if (isWindows && error48.code === "EPERM") {
|
|
35033
35022
|
try {
|
|
35034
|
-
const fd = await (0, import_promises2.open)(
|
|
35023
|
+
const fd = await (0, import_promises2.open)(path35, "r");
|
|
35035
35024
|
await fd.close();
|
|
35036
35025
|
broadcastErr(error48);
|
|
35037
35026
|
} catch (err) {
|
|
@@ -35062,7 +35051,7 @@ var init_handler2 = __esm({
|
|
|
35062
35051
|
};
|
|
35063
35052
|
};
|
|
35064
35053
|
FsWatchFileInstances = /* @__PURE__ */ new Map();
|
|
35065
|
-
setFsWatchFileListener = (
|
|
35054
|
+
setFsWatchFileListener = (path35, fullPath, options, handlers) => {
|
|
35066
35055
|
const { listener, rawEmitter } = handlers;
|
|
35067
35056
|
let cont = FsWatchFileInstances.get(fullPath);
|
|
35068
35057
|
const copts = cont && cont.options;
|
|
@@ -35084,7 +35073,7 @@ var init_handler2 = __esm({
|
|
|
35084
35073
|
});
|
|
35085
35074
|
const currmtime = curr.mtimeMs;
|
|
35086
35075
|
if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
|
|
35087
|
-
foreach(cont.listeners, (listener2) => listener2(
|
|
35076
|
+
foreach(cont.listeners, (listener2) => listener2(path35, curr));
|
|
35088
35077
|
}
|
|
35089
35078
|
})
|
|
35090
35079
|
};
|
|
@@ -35114,13 +35103,13 @@ var init_handler2 = __esm({
|
|
|
35114
35103
|
* @param listener on fs change
|
|
35115
35104
|
* @returns closer for the watcher instance
|
|
35116
35105
|
*/
|
|
35117
|
-
_watchWithNodeFs(
|
|
35106
|
+
_watchWithNodeFs(path35, listener) {
|
|
35118
35107
|
const opts = this.fsw.options;
|
|
35119
|
-
const directory = sp.dirname(
|
|
35120
|
-
const basename10 = sp.basename(
|
|
35108
|
+
const directory = sp.dirname(path35);
|
|
35109
|
+
const basename10 = sp.basename(path35);
|
|
35121
35110
|
const parent = this.fsw._getWatchedDir(directory);
|
|
35122
35111
|
parent.add(basename10);
|
|
35123
|
-
const absolutePath = sp.resolve(
|
|
35112
|
+
const absolutePath = sp.resolve(path35);
|
|
35124
35113
|
const options = {
|
|
35125
35114
|
persistent: opts.persistent
|
|
35126
35115
|
};
|
|
@@ -35130,12 +35119,12 @@ var init_handler2 = __esm({
|
|
|
35130
35119
|
if (opts.usePolling) {
|
|
35131
35120
|
const enableBin = opts.interval !== opts.binaryInterval;
|
|
35132
35121
|
options.interval = enableBin && isBinaryPath(basename10) ? opts.binaryInterval : opts.interval;
|
|
35133
|
-
closer = setFsWatchFileListener(
|
|
35122
|
+
closer = setFsWatchFileListener(path35, absolutePath, options, {
|
|
35134
35123
|
listener,
|
|
35135
35124
|
rawEmitter: this.fsw._emitRaw
|
|
35136
35125
|
});
|
|
35137
35126
|
} else {
|
|
35138
|
-
closer = setFsWatchListener(
|
|
35127
|
+
closer = setFsWatchListener(path35, absolutePath, options, {
|
|
35139
35128
|
listener,
|
|
35140
35129
|
errHandler: this._boundHandleError,
|
|
35141
35130
|
rawEmitter: this.fsw._emitRaw
|
|
@@ -35157,7 +35146,7 @@ var init_handler2 = __esm({
|
|
|
35157
35146
|
let prevStats = stats;
|
|
35158
35147
|
if (parent.has(basename10))
|
|
35159
35148
|
return;
|
|
35160
|
-
const listener = async (
|
|
35149
|
+
const listener = async (path35, newStats) => {
|
|
35161
35150
|
if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file2, 5))
|
|
35162
35151
|
return;
|
|
35163
35152
|
if (!newStats || newStats.mtimeMs === 0) {
|
|
@@ -35171,11 +35160,11 @@ var init_handler2 = __esm({
|
|
|
35171
35160
|
this.fsw._emit(EV.CHANGE, file2, newStats2);
|
|
35172
35161
|
}
|
|
35173
35162
|
if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats2.ino) {
|
|
35174
|
-
this.fsw._closeFile(
|
|
35163
|
+
this.fsw._closeFile(path35);
|
|
35175
35164
|
prevStats = newStats2;
|
|
35176
35165
|
const closer2 = this._watchWithNodeFs(file2, listener);
|
|
35177
35166
|
if (closer2)
|
|
35178
|
-
this.fsw._addPathCloser(
|
|
35167
|
+
this.fsw._addPathCloser(path35, closer2);
|
|
35179
35168
|
} else {
|
|
35180
35169
|
prevStats = newStats2;
|
|
35181
35170
|
}
|
|
@@ -35207,7 +35196,7 @@ var init_handler2 = __esm({
|
|
|
35207
35196
|
* @param item basename of this item
|
|
35208
35197
|
* @returns true if no more processing is needed for this entry.
|
|
35209
35198
|
*/
|
|
35210
|
-
async _handleSymlink(entry, directory,
|
|
35199
|
+
async _handleSymlink(entry, directory, path35, item) {
|
|
35211
35200
|
if (this.fsw.closed) {
|
|
35212
35201
|
return;
|
|
35213
35202
|
}
|
|
@@ -35217,7 +35206,7 @@ var init_handler2 = __esm({
|
|
|
35217
35206
|
this.fsw._incrReadyCount();
|
|
35218
35207
|
let linkPath;
|
|
35219
35208
|
try {
|
|
35220
|
-
linkPath = await (0, import_promises2.realpath)(
|
|
35209
|
+
linkPath = await (0, import_promises2.realpath)(path35);
|
|
35221
35210
|
} catch (e) {
|
|
35222
35211
|
this.fsw._emitReady();
|
|
35223
35212
|
return true;
|
|
@@ -35227,12 +35216,12 @@ var init_handler2 = __esm({
|
|
|
35227
35216
|
if (dir.has(item)) {
|
|
35228
35217
|
if (this.fsw._symlinkPaths.get(full) !== linkPath) {
|
|
35229
35218
|
this.fsw._symlinkPaths.set(full, linkPath);
|
|
35230
|
-
this.fsw._emit(EV.CHANGE,
|
|
35219
|
+
this.fsw._emit(EV.CHANGE, path35, entry.stats);
|
|
35231
35220
|
}
|
|
35232
35221
|
} else {
|
|
35233
35222
|
dir.add(item);
|
|
35234
35223
|
this.fsw._symlinkPaths.set(full, linkPath);
|
|
35235
|
-
this.fsw._emit(EV.ADD,
|
|
35224
|
+
this.fsw._emit(EV.ADD, path35, entry.stats);
|
|
35236
35225
|
}
|
|
35237
35226
|
this.fsw._emitReady();
|
|
35238
35227
|
return true;
|
|
@@ -35262,9 +35251,9 @@ var init_handler2 = __esm({
|
|
|
35262
35251
|
return;
|
|
35263
35252
|
}
|
|
35264
35253
|
const item = entry.path;
|
|
35265
|
-
let
|
|
35254
|
+
let path35 = sp.join(directory, item);
|
|
35266
35255
|
current.add(item);
|
|
35267
|
-
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory,
|
|
35256
|
+
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path35, item)) {
|
|
35268
35257
|
return;
|
|
35269
35258
|
}
|
|
35270
35259
|
if (this.fsw.closed) {
|
|
@@ -35273,8 +35262,8 @@ var init_handler2 = __esm({
|
|
|
35273
35262
|
}
|
|
35274
35263
|
if (item === target || !target && !previous.has(item)) {
|
|
35275
35264
|
this.fsw._incrReadyCount();
|
|
35276
|
-
|
|
35277
|
-
this._addToNodeFs(
|
|
35265
|
+
path35 = sp.join(dir, sp.relative(dir, path35));
|
|
35266
|
+
this._addToNodeFs(path35, initialAdd, wh, depth + 1);
|
|
35278
35267
|
}
|
|
35279
35268
|
}).on(EV.ERROR, this._boundHandleError);
|
|
35280
35269
|
return new Promise((resolve18, reject) => {
|
|
@@ -35343,13 +35332,13 @@ var init_handler2 = __esm({
|
|
|
35343
35332
|
* @param depth Child path actually targeted for watch
|
|
35344
35333
|
* @param target Child path actually targeted for watch
|
|
35345
35334
|
*/
|
|
35346
|
-
async _addToNodeFs(
|
|
35335
|
+
async _addToNodeFs(path35, initialAdd, priorWh, depth, target) {
|
|
35347
35336
|
const ready = this.fsw._emitReady;
|
|
35348
|
-
if (this.fsw._isIgnored(
|
|
35337
|
+
if (this.fsw._isIgnored(path35) || this.fsw.closed) {
|
|
35349
35338
|
ready();
|
|
35350
35339
|
return false;
|
|
35351
35340
|
}
|
|
35352
|
-
const wh = this.fsw._getWatchHelpers(
|
|
35341
|
+
const wh = this.fsw._getWatchHelpers(path35);
|
|
35353
35342
|
if (priorWh) {
|
|
35354
35343
|
wh.filterPath = (entry) => priorWh.filterPath(entry);
|
|
35355
35344
|
wh.filterDir = (entry) => priorWh.filterDir(entry);
|
|
@@ -35365,8 +35354,8 @@ var init_handler2 = __esm({
|
|
|
35365
35354
|
const follow = this.fsw.options.followSymlinks;
|
|
35366
35355
|
let closer;
|
|
35367
35356
|
if (stats.isDirectory()) {
|
|
35368
|
-
const absPath = sp.resolve(
|
|
35369
|
-
const targetPath = follow ? await (0, import_promises2.realpath)(
|
|
35357
|
+
const absPath = sp.resolve(path35);
|
|
35358
|
+
const targetPath = follow ? await (0, import_promises2.realpath)(path35) : path35;
|
|
35370
35359
|
if (this.fsw.closed)
|
|
35371
35360
|
return;
|
|
35372
35361
|
closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
|
|
@@ -35376,29 +35365,29 @@ var init_handler2 = __esm({
|
|
|
35376
35365
|
this.fsw._symlinkPaths.set(absPath, targetPath);
|
|
35377
35366
|
}
|
|
35378
35367
|
} else if (stats.isSymbolicLink()) {
|
|
35379
|
-
const targetPath = follow ? await (0, import_promises2.realpath)(
|
|
35368
|
+
const targetPath = follow ? await (0, import_promises2.realpath)(path35) : path35;
|
|
35380
35369
|
if (this.fsw.closed)
|
|
35381
35370
|
return;
|
|
35382
35371
|
const parent = sp.dirname(wh.watchPath);
|
|
35383
35372
|
this.fsw._getWatchedDir(parent).add(wh.watchPath);
|
|
35384
35373
|
this.fsw._emit(EV.ADD, wh.watchPath, stats);
|
|
35385
|
-
closer = await this._handleDir(parent, stats, initialAdd, depth,
|
|
35374
|
+
closer = await this._handleDir(parent, stats, initialAdd, depth, path35, wh, targetPath);
|
|
35386
35375
|
if (this.fsw.closed)
|
|
35387
35376
|
return;
|
|
35388
35377
|
if (targetPath !== void 0) {
|
|
35389
|
-
this.fsw._symlinkPaths.set(sp.resolve(
|
|
35378
|
+
this.fsw._symlinkPaths.set(sp.resolve(path35), targetPath);
|
|
35390
35379
|
}
|
|
35391
35380
|
} else {
|
|
35392
35381
|
closer = this._handleFile(wh.watchPath, stats, initialAdd);
|
|
35393
35382
|
}
|
|
35394
35383
|
ready();
|
|
35395
35384
|
if (closer)
|
|
35396
|
-
this.fsw._addPathCloser(
|
|
35385
|
+
this.fsw._addPathCloser(path35, closer);
|
|
35397
35386
|
return false;
|
|
35398
35387
|
} catch (error48) {
|
|
35399
35388
|
if (this.fsw._handleError(error48)) {
|
|
35400
35389
|
ready();
|
|
35401
|
-
return
|
|
35390
|
+
return path35;
|
|
35402
35391
|
}
|
|
35403
35392
|
}
|
|
35404
35393
|
}
|
|
@@ -35433,24 +35422,24 @@ function createPattern(matcher) {
|
|
|
35433
35422
|
}
|
|
35434
35423
|
return () => false;
|
|
35435
35424
|
}
|
|
35436
|
-
function normalizePath(
|
|
35437
|
-
if (typeof
|
|
35425
|
+
function normalizePath(path35) {
|
|
35426
|
+
if (typeof path35 !== "string")
|
|
35438
35427
|
throw new Error("string expected");
|
|
35439
|
-
|
|
35440
|
-
|
|
35428
|
+
path35 = sp2.normalize(path35);
|
|
35429
|
+
path35 = path35.replace(/\\/g, "/");
|
|
35441
35430
|
let prepend = false;
|
|
35442
|
-
if (
|
|
35431
|
+
if (path35.startsWith("//"))
|
|
35443
35432
|
prepend = true;
|
|
35444
|
-
|
|
35433
|
+
path35 = path35.replace(DOUBLE_SLASH_RE, "/");
|
|
35445
35434
|
if (prepend)
|
|
35446
|
-
|
|
35447
|
-
return
|
|
35435
|
+
path35 = "/" + path35;
|
|
35436
|
+
return path35;
|
|
35448
35437
|
}
|
|
35449
35438
|
function matchPatterns(patterns, testString, stats) {
|
|
35450
|
-
const
|
|
35439
|
+
const path35 = normalizePath(testString);
|
|
35451
35440
|
for (let index = 0; index < patterns.length; index++) {
|
|
35452
35441
|
const pattern = patterns[index];
|
|
35453
|
-
if (pattern(
|
|
35442
|
+
if (pattern(path35, stats)) {
|
|
35454
35443
|
return true;
|
|
35455
35444
|
}
|
|
35456
35445
|
}
|
|
@@ -35513,19 +35502,19 @@ var init_chokidar = __esm({
|
|
|
35513
35502
|
}
|
|
35514
35503
|
return str;
|
|
35515
35504
|
};
|
|
35516
|
-
normalizePathToUnix = (
|
|
35517
|
-
normalizeIgnored = (cwd = "") => (
|
|
35518
|
-
if (typeof
|
|
35519
|
-
return normalizePathToUnix(sp2.isAbsolute(
|
|
35505
|
+
normalizePathToUnix = (path35) => toUnix(sp2.normalize(toUnix(path35)));
|
|
35506
|
+
normalizeIgnored = (cwd = "") => (path35) => {
|
|
35507
|
+
if (typeof path35 === "string") {
|
|
35508
|
+
return normalizePathToUnix(sp2.isAbsolute(path35) ? path35 : sp2.join(cwd, path35));
|
|
35520
35509
|
} else {
|
|
35521
|
-
return
|
|
35510
|
+
return path35;
|
|
35522
35511
|
}
|
|
35523
35512
|
};
|
|
35524
|
-
getAbsolutePath = (
|
|
35525
|
-
if (sp2.isAbsolute(
|
|
35526
|
-
return
|
|
35513
|
+
getAbsolutePath = (path35, cwd) => {
|
|
35514
|
+
if (sp2.isAbsolute(path35)) {
|
|
35515
|
+
return path35;
|
|
35527
35516
|
}
|
|
35528
|
-
return sp2.join(cwd,
|
|
35517
|
+
return sp2.join(cwd, path35);
|
|
35529
35518
|
};
|
|
35530
35519
|
EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
|
|
35531
35520
|
DirEntry = class {
|
|
@@ -35590,10 +35579,10 @@ var init_chokidar = __esm({
|
|
|
35590
35579
|
dirParts;
|
|
35591
35580
|
followSymlinks;
|
|
35592
35581
|
statMethod;
|
|
35593
|
-
constructor(
|
|
35582
|
+
constructor(path35, follow, fsw) {
|
|
35594
35583
|
this.fsw = fsw;
|
|
35595
|
-
const watchPath =
|
|
35596
|
-
this.path =
|
|
35584
|
+
const watchPath = path35;
|
|
35585
|
+
this.path = path35 = path35.replace(REPLACER_RE, "");
|
|
35597
35586
|
this.watchPath = watchPath;
|
|
35598
35587
|
this.fullWatchPath = sp2.resolve(watchPath);
|
|
35599
35588
|
this.dirParts = [];
|
|
@@ -35733,20 +35722,20 @@ var init_chokidar = __esm({
|
|
|
35733
35722
|
this._closePromise = void 0;
|
|
35734
35723
|
let paths = unifyPaths(paths_);
|
|
35735
35724
|
if (cwd) {
|
|
35736
|
-
paths = paths.map((
|
|
35737
|
-
const absPath = getAbsolutePath(
|
|
35725
|
+
paths = paths.map((path35) => {
|
|
35726
|
+
const absPath = getAbsolutePath(path35, cwd);
|
|
35738
35727
|
return absPath;
|
|
35739
35728
|
});
|
|
35740
35729
|
}
|
|
35741
|
-
paths.forEach((
|
|
35742
|
-
this._removeIgnoredPath(
|
|
35730
|
+
paths.forEach((path35) => {
|
|
35731
|
+
this._removeIgnoredPath(path35);
|
|
35743
35732
|
});
|
|
35744
35733
|
this._userIgnored = void 0;
|
|
35745
35734
|
if (!this._readyCount)
|
|
35746
35735
|
this._readyCount = 0;
|
|
35747
35736
|
this._readyCount += paths.length;
|
|
35748
|
-
Promise.all(paths.map(async (
|
|
35749
|
-
const res = await this._nodeFsHandler._addToNodeFs(
|
|
35737
|
+
Promise.all(paths.map(async (path35) => {
|
|
35738
|
+
const res = await this._nodeFsHandler._addToNodeFs(path35, !_internal, void 0, 0, _origAdd);
|
|
35750
35739
|
if (res)
|
|
35751
35740
|
this._emitReady();
|
|
35752
35741
|
return res;
|
|
@@ -35768,17 +35757,17 @@ var init_chokidar = __esm({
|
|
|
35768
35757
|
return this;
|
|
35769
35758
|
const paths = unifyPaths(paths_);
|
|
35770
35759
|
const { cwd } = this.options;
|
|
35771
|
-
paths.forEach((
|
|
35772
|
-
if (!sp2.isAbsolute(
|
|
35760
|
+
paths.forEach((path35) => {
|
|
35761
|
+
if (!sp2.isAbsolute(path35) && !this._closers.has(path35)) {
|
|
35773
35762
|
if (cwd)
|
|
35774
|
-
|
|
35775
|
-
|
|
35763
|
+
path35 = sp2.join(cwd, path35);
|
|
35764
|
+
path35 = sp2.resolve(path35);
|
|
35776
35765
|
}
|
|
35777
|
-
this._closePath(
|
|
35778
|
-
this._addIgnoredPath(
|
|
35779
|
-
if (this._watched.has(
|
|
35766
|
+
this._closePath(path35);
|
|
35767
|
+
this._addIgnoredPath(path35);
|
|
35768
|
+
if (this._watched.has(path35)) {
|
|
35780
35769
|
this._addIgnoredPath({
|
|
35781
|
-
path:
|
|
35770
|
+
path: path35,
|
|
35782
35771
|
recursive: true
|
|
35783
35772
|
});
|
|
35784
35773
|
}
|
|
@@ -35842,38 +35831,38 @@ var init_chokidar = __esm({
|
|
|
35842
35831
|
* @param stats arguments to be passed with event
|
|
35843
35832
|
* @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
|
|
35844
35833
|
*/
|
|
35845
|
-
async _emit(event,
|
|
35834
|
+
async _emit(event, path35, stats) {
|
|
35846
35835
|
if (this.closed)
|
|
35847
35836
|
return;
|
|
35848
35837
|
const opts = this.options;
|
|
35849
35838
|
if (isWindows)
|
|
35850
|
-
|
|
35839
|
+
path35 = sp2.normalize(path35);
|
|
35851
35840
|
if (opts.cwd)
|
|
35852
|
-
|
|
35853
|
-
const args = [
|
|
35841
|
+
path35 = sp2.relative(opts.cwd, path35);
|
|
35842
|
+
const args = [path35];
|
|
35854
35843
|
if (stats != null)
|
|
35855
35844
|
args.push(stats);
|
|
35856
35845
|
const awf = opts.awaitWriteFinish;
|
|
35857
35846
|
let pw;
|
|
35858
|
-
if (awf && (pw = this._pendingWrites.get(
|
|
35847
|
+
if (awf && (pw = this._pendingWrites.get(path35))) {
|
|
35859
35848
|
pw.lastChange = /* @__PURE__ */ new Date();
|
|
35860
35849
|
return this;
|
|
35861
35850
|
}
|
|
35862
35851
|
if (opts.atomic) {
|
|
35863
35852
|
if (event === EVENTS.UNLINK) {
|
|
35864
|
-
this._pendingUnlinks.set(
|
|
35853
|
+
this._pendingUnlinks.set(path35, [event, ...args]);
|
|
35865
35854
|
setTimeout(() => {
|
|
35866
|
-
this._pendingUnlinks.forEach((entry,
|
|
35855
|
+
this._pendingUnlinks.forEach((entry, path36) => {
|
|
35867
35856
|
this.emit(...entry);
|
|
35868
35857
|
this.emit(EVENTS.ALL, ...entry);
|
|
35869
|
-
this._pendingUnlinks.delete(
|
|
35858
|
+
this._pendingUnlinks.delete(path36);
|
|
35870
35859
|
});
|
|
35871
35860
|
}, typeof opts.atomic === "number" ? opts.atomic : 100);
|
|
35872
35861
|
return this;
|
|
35873
35862
|
}
|
|
35874
|
-
if (event === EVENTS.ADD && this._pendingUnlinks.has(
|
|
35863
|
+
if (event === EVENTS.ADD && this._pendingUnlinks.has(path35)) {
|
|
35875
35864
|
event = EVENTS.CHANGE;
|
|
35876
|
-
this._pendingUnlinks.delete(
|
|
35865
|
+
this._pendingUnlinks.delete(path35);
|
|
35877
35866
|
}
|
|
35878
35867
|
}
|
|
35879
35868
|
if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
|
|
@@ -35891,16 +35880,16 @@ var init_chokidar = __esm({
|
|
|
35891
35880
|
this.emitWithAll(event, args);
|
|
35892
35881
|
}
|
|
35893
35882
|
};
|
|
35894
|
-
this._awaitWriteFinish(
|
|
35883
|
+
this._awaitWriteFinish(path35, awf.stabilityThreshold, event, awfEmit);
|
|
35895
35884
|
return this;
|
|
35896
35885
|
}
|
|
35897
35886
|
if (event === EVENTS.CHANGE) {
|
|
35898
|
-
const isThrottled = !this._throttle(EVENTS.CHANGE,
|
|
35887
|
+
const isThrottled = !this._throttle(EVENTS.CHANGE, path35, 50);
|
|
35899
35888
|
if (isThrottled)
|
|
35900
35889
|
return this;
|
|
35901
35890
|
}
|
|
35902
35891
|
if (opts.alwaysStat && stats === void 0 && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
|
|
35903
|
-
const fullPath = opts.cwd ? sp2.join(opts.cwd,
|
|
35892
|
+
const fullPath = opts.cwd ? sp2.join(opts.cwd, path35) : path35;
|
|
35904
35893
|
let stats2;
|
|
35905
35894
|
try {
|
|
35906
35895
|
stats2 = await (0, import_promises3.stat)(fullPath);
|
|
@@ -35931,23 +35920,23 @@ var init_chokidar = __esm({
|
|
|
35931
35920
|
* @param timeout duration of time to suppress duplicate actions
|
|
35932
35921
|
* @returns tracking object or false if action should be suppressed
|
|
35933
35922
|
*/
|
|
35934
|
-
_throttle(actionType,
|
|
35923
|
+
_throttle(actionType, path35, timeout) {
|
|
35935
35924
|
if (!this._throttled.has(actionType)) {
|
|
35936
35925
|
this._throttled.set(actionType, /* @__PURE__ */ new Map());
|
|
35937
35926
|
}
|
|
35938
35927
|
const action = this._throttled.get(actionType);
|
|
35939
35928
|
if (!action)
|
|
35940
35929
|
throw new Error("invalid throttle");
|
|
35941
|
-
const actionPath = action.get(
|
|
35930
|
+
const actionPath = action.get(path35);
|
|
35942
35931
|
if (actionPath) {
|
|
35943
35932
|
actionPath.count++;
|
|
35944
35933
|
return false;
|
|
35945
35934
|
}
|
|
35946
35935
|
let timeoutObject;
|
|
35947
35936
|
const clear = () => {
|
|
35948
|
-
const item = action.get(
|
|
35937
|
+
const item = action.get(path35);
|
|
35949
35938
|
const count = item ? item.count : 0;
|
|
35950
|
-
action.delete(
|
|
35939
|
+
action.delete(path35);
|
|
35951
35940
|
clearTimeout(timeoutObject);
|
|
35952
35941
|
if (item)
|
|
35953
35942
|
clearTimeout(item.timeoutObject);
|
|
@@ -35955,7 +35944,7 @@ var init_chokidar = __esm({
|
|
|
35955
35944
|
};
|
|
35956
35945
|
timeoutObject = setTimeout(clear, timeout);
|
|
35957
35946
|
const thr = { timeoutObject, clear, count: 0 };
|
|
35958
|
-
action.set(
|
|
35947
|
+
action.set(path35, thr);
|
|
35959
35948
|
return thr;
|
|
35960
35949
|
}
|
|
35961
35950
|
_incrReadyCount() {
|
|
@@ -35969,44 +35958,44 @@ var init_chokidar = __esm({
|
|
|
35969
35958
|
* @param event
|
|
35970
35959
|
* @param awfEmit Callback to be called when ready for event to be emitted.
|
|
35971
35960
|
*/
|
|
35972
|
-
_awaitWriteFinish(
|
|
35961
|
+
_awaitWriteFinish(path35, threshold, event, awfEmit) {
|
|
35973
35962
|
const awf = this.options.awaitWriteFinish;
|
|
35974
35963
|
if (typeof awf !== "object")
|
|
35975
35964
|
return;
|
|
35976
35965
|
const pollInterval = awf.pollInterval;
|
|
35977
35966
|
let timeoutHandler;
|
|
35978
|
-
let fullPath =
|
|
35979
|
-
if (this.options.cwd && !sp2.isAbsolute(
|
|
35980
|
-
fullPath = sp2.join(this.options.cwd,
|
|
35967
|
+
let fullPath = path35;
|
|
35968
|
+
if (this.options.cwd && !sp2.isAbsolute(path35)) {
|
|
35969
|
+
fullPath = sp2.join(this.options.cwd, path35);
|
|
35981
35970
|
}
|
|
35982
35971
|
const now = /* @__PURE__ */ new Date();
|
|
35983
35972
|
const writes = this._pendingWrites;
|
|
35984
35973
|
function awaitWriteFinishFn(prevStat) {
|
|
35985
35974
|
(0, import_node_fs2.stat)(fullPath, (err, curStat) => {
|
|
35986
|
-
if (err || !writes.has(
|
|
35975
|
+
if (err || !writes.has(path35)) {
|
|
35987
35976
|
if (err && err.code !== "ENOENT")
|
|
35988
35977
|
awfEmit(err);
|
|
35989
35978
|
return;
|
|
35990
35979
|
}
|
|
35991
35980
|
const now2 = Number(/* @__PURE__ */ new Date());
|
|
35992
35981
|
if (prevStat && curStat.size !== prevStat.size) {
|
|
35993
|
-
writes.get(
|
|
35982
|
+
writes.get(path35).lastChange = now2;
|
|
35994
35983
|
}
|
|
35995
|
-
const pw = writes.get(
|
|
35984
|
+
const pw = writes.get(path35);
|
|
35996
35985
|
const df = now2 - pw.lastChange;
|
|
35997
35986
|
if (df >= threshold) {
|
|
35998
|
-
writes.delete(
|
|
35987
|
+
writes.delete(path35);
|
|
35999
35988
|
awfEmit(void 0, curStat);
|
|
36000
35989
|
} else {
|
|
36001
35990
|
timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
|
|
36002
35991
|
}
|
|
36003
35992
|
});
|
|
36004
35993
|
}
|
|
36005
|
-
if (!writes.has(
|
|
36006
|
-
writes.set(
|
|
35994
|
+
if (!writes.has(path35)) {
|
|
35995
|
+
writes.set(path35, {
|
|
36007
35996
|
lastChange: now,
|
|
36008
35997
|
cancelWait: () => {
|
|
36009
|
-
writes.delete(
|
|
35998
|
+
writes.delete(path35);
|
|
36010
35999
|
clearTimeout(timeoutHandler);
|
|
36011
36000
|
return event;
|
|
36012
36001
|
}
|
|
@@ -36017,8 +36006,8 @@ var init_chokidar = __esm({
|
|
|
36017
36006
|
/**
|
|
36018
36007
|
* Determines whether user has asked to ignore this path.
|
|
36019
36008
|
*/
|
|
36020
|
-
_isIgnored(
|
|
36021
|
-
if (this.options.atomic && DOT_RE.test(
|
|
36009
|
+
_isIgnored(path35, stats) {
|
|
36010
|
+
if (this.options.atomic && DOT_RE.test(path35))
|
|
36022
36011
|
return true;
|
|
36023
36012
|
if (!this._userIgnored) {
|
|
36024
36013
|
const { cwd } = this.options;
|
|
@@ -36028,17 +36017,17 @@ var init_chokidar = __esm({
|
|
|
36028
36017
|
const list = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored];
|
|
36029
36018
|
this._userIgnored = anymatch(list, void 0);
|
|
36030
36019
|
}
|
|
36031
|
-
return this._userIgnored(
|
|
36020
|
+
return this._userIgnored(path35, stats);
|
|
36032
36021
|
}
|
|
36033
|
-
_isntIgnored(
|
|
36034
|
-
return !this._isIgnored(
|
|
36022
|
+
_isntIgnored(path35, stat4) {
|
|
36023
|
+
return !this._isIgnored(path35, stat4);
|
|
36035
36024
|
}
|
|
36036
36025
|
/**
|
|
36037
36026
|
* Provides a set of common helpers and properties relating to symlink handling.
|
|
36038
36027
|
* @param path file or directory pattern being watched
|
|
36039
36028
|
*/
|
|
36040
|
-
_getWatchHelpers(
|
|
36041
|
-
return new WatchHelper(
|
|
36029
|
+
_getWatchHelpers(path35) {
|
|
36030
|
+
return new WatchHelper(path35, this.options.followSymlinks, this);
|
|
36042
36031
|
}
|
|
36043
36032
|
// Directory helpers
|
|
36044
36033
|
// -----------------
|
|
@@ -36070,63 +36059,63 @@ var init_chokidar = __esm({
|
|
|
36070
36059
|
* @param item base path of item/directory
|
|
36071
36060
|
*/
|
|
36072
36061
|
_remove(directory, item, isDirectory) {
|
|
36073
|
-
const
|
|
36074
|
-
const fullPath = sp2.resolve(
|
|
36075
|
-
isDirectory = isDirectory != null ? isDirectory : this._watched.has(
|
|
36076
|
-
if (!this._throttle("remove",
|
|
36062
|
+
const path35 = sp2.join(directory, item);
|
|
36063
|
+
const fullPath = sp2.resolve(path35);
|
|
36064
|
+
isDirectory = isDirectory != null ? isDirectory : this._watched.has(path35) || this._watched.has(fullPath);
|
|
36065
|
+
if (!this._throttle("remove", path35, 100))
|
|
36077
36066
|
return;
|
|
36078
36067
|
if (!isDirectory && this._watched.size === 1) {
|
|
36079
36068
|
this.add(directory, item, true);
|
|
36080
36069
|
}
|
|
36081
|
-
const wp = this._getWatchedDir(
|
|
36070
|
+
const wp = this._getWatchedDir(path35);
|
|
36082
36071
|
const nestedDirectoryChildren = wp.getChildren();
|
|
36083
|
-
nestedDirectoryChildren.forEach((nested) => this._remove(
|
|
36072
|
+
nestedDirectoryChildren.forEach((nested) => this._remove(path35, nested));
|
|
36084
36073
|
const parent = this._getWatchedDir(directory);
|
|
36085
36074
|
const wasTracked = parent.has(item);
|
|
36086
36075
|
parent.remove(item);
|
|
36087
36076
|
if (this._symlinkPaths.has(fullPath)) {
|
|
36088
36077
|
this._symlinkPaths.delete(fullPath);
|
|
36089
36078
|
}
|
|
36090
|
-
let relPath =
|
|
36079
|
+
let relPath = path35;
|
|
36091
36080
|
if (this.options.cwd)
|
|
36092
|
-
relPath = sp2.relative(this.options.cwd,
|
|
36081
|
+
relPath = sp2.relative(this.options.cwd, path35);
|
|
36093
36082
|
if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
|
|
36094
36083
|
const event = this._pendingWrites.get(relPath).cancelWait();
|
|
36095
36084
|
if (event === EVENTS.ADD)
|
|
36096
36085
|
return;
|
|
36097
36086
|
}
|
|
36098
|
-
this._watched.delete(
|
|
36087
|
+
this._watched.delete(path35);
|
|
36099
36088
|
this._watched.delete(fullPath);
|
|
36100
36089
|
const eventName = isDirectory ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
|
|
36101
|
-
if (wasTracked && !this._isIgnored(
|
|
36102
|
-
this._emit(eventName,
|
|
36103
|
-
this._closePath(
|
|
36090
|
+
if (wasTracked && !this._isIgnored(path35))
|
|
36091
|
+
this._emit(eventName, path35);
|
|
36092
|
+
this._closePath(path35);
|
|
36104
36093
|
}
|
|
36105
36094
|
/**
|
|
36106
36095
|
* Closes all watchers for a path
|
|
36107
36096
|
*/
|
|
36108
|
-
_closePath(
|
|
36109
|
-
this._closeFile(
|
|
36110
|
-
const dir = sp2.dirname(
|
|
36111
|
-
this._getWatchedDir(dir).remove(sp2.basename(
|
|
36097
|
+
_closePath(path35) {
|
|
36098
|
+
this._closeFile(path35);
|
|
36099
|
+
const dir = sp2.dirname(path35);
|
|
36100
|
+
this._getWatchedDir(dir).remove(sp2.basename(path35));
|
|
36112
36101
|
}
|
|
36113
36102
|
/**
|
|
36114
36103
|
* Closes only file-specific watchers
|
|
36115
36104
|
*/
|
|
36116
|
-
_closeFile(
|
|
36117
|
-
const closers = this._closers.get(
|
|
36105
|
+
_closeFile(path35) {
|
|
36106
|
+
const closers = this._closers.get(path35);
|
|
36118
36107
|
if (!closers)
|
|
36119
36108
|
return;
|
|
36120
36109
|
closers.forEach((closer) => closer());
|
|
36121
|
-
this._closers.delete(
|
|
36110
|
+
this._closers.delete(path35);
|
|
36122
36111
|
}
|
|
36123
|
-
_addPathCloser(
|
|
36112
|
+
_addPathCloser(path35, closer) {
|
|
36124
36113
|
if (!closer)
|
|
36125
36114
|
return;
|
|
36126
|
-
let list = this._closers.get(
|
|
36115
|
+
let list = this._closers.get(path35);
|
|
36127
36116
|
if (!list) {
|
|
36128
36117
|
list = [];
|
|
36129
|
-
this._closers.set(
|
|
36118
|
+
this._closers.set(path35, list);
|
|
36130
36119
|
}
|
|
36131
36120
|
list.push(closer);
|
|
36132
36121
|
}
|
|
@@ -36195,6 +36184,7 @@ function validateProviderDefinition(raw) {
|
|
|
36195
36184
|
warnings.push("Extension providers should have extensionId");
|
|
36196
36185
|
}
|
|
36197
36186
|
validateCapabilities(provider, controls, errors);
|
|
36187
|
+
validateCanonicalHistory(provider.canonicalHistory, errors);
|
|
36198
36188
|
for (const control of controls) {
|
|
36199
36189
|
validateControl(control, errors);
|
|
36200
36190
|
}
|
|
@@ -36252,6 +36242,39 @@ function validateCapabilities(provider, controls, errors) {
|
|
|
36252
36242
|
errors.push("providers declaring controls must set capabilities.controls.typedResults=true");
|
|
36253
36243
|
}
|
|
36254
36244
|
}
|
|
36245
|
+
function validateCanonicalHistory(raw, errors) {
|
|
36246
|
+
if (raw === void 0) return;
|
|
36247
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
36248
|
+
errors.push("canonicalHistory must be an object");
|
|
36249
|
+
return;
|
|
36250
|
+
}
|
|
36251
|
+
const canonicalHistory = raw;
|
|
36252
|
+
const format = canonicalHistory.format;
|
|
36253
|
+
if (format !== void 0 && (typeof format !== "string" || !format.trim())) {
|
|
36254
|
+
errors.push("canonicalHistory.format must be a non-empty string when provided");
|
|
36255
|
+
}
|
|
36256
|
+
const watchPath = canonicalHistory.watchPath;
|
|
36257
|
+
if (watchPath !== void 0 && (typeof watchPath !== "string" || !watchPath.trim())) {
|
|
36258
|
+
errors.push("canonicalHistory.watchPath must be a non-empty string when provided");
|
|
36259
|
+
}
|
|
36260
|
+
const mode = canonicalHistory.mode;
|
|
36261
|
+
if (mode !== void 0 && !["native-source", "materialized-mirror", "disabled"].includes(String(mode))) {
|
|
36262
|
+
errors.push("canonicalHistory.mode must be one of: native-source, materialized-mirror, disabled");
|
|
36263
|
+
}
|
|
36264
|
+
const scripts = canonicalHistory.scripts;
|
|
36265
|
+
if (scripts === void 0) return;
|
|
36266
|
+
if (!scripts || typeof scripts !== "object" || Array.isArray(scripts)) {
|
|
36267
|
+
errors.push("canonicalHistory.scripts must be an object");
|
|
36268
|
+
return;
|
|
36269
|
+
}
|
|
36270
|
+
const scriptConfig = scripts;
|
|
36271
|
+
for (const key of ["readSession", "listSessions"]) {
|
|
36272
|
+
const value = scriptConfig[key];
|
|
36273
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
36274
|
+
errors.push(`canonicalHistory.scripts.${key} must be a non-empty string`);
|
|
36275
|
+
}
|
|
36276
|
+
}
|
|
36277
|
+
}
|
|
36255
36278
|
function validateControl(control, errors) {
|
|
36256
36279
|
if (!control || typeof control !== "object") {
|
|
36257
36280
|
errors.push("controls: each control must be an object");
|
|
@@ -37875,6 +37898,43 @@ var init_provider_loader = __esm({
|
|
|
37875
37898
|
}
|
|
37876
37899
|
});
|
|
37877
37900
|
|
|
37901
|
+
// ../../oss/packages/daemon-core/src/launch/macos-app-process.ts
|
|
37902
|
+
function normalizeMacAppPath(appPath) {
|
|
37903
|
+
const trimmed = String(appPath || "").trim();
|
|
37904
|
+
if (!trimmed) return null;
|
|
37905
|
+
return trimmed.replace(/\/+$/, "");
|
|
37906
|
+
}
|
|
37907
|
+
function parsePsLine(line) {
|
|
37908
|
+
const match = line.match(/^\s*(\d+)\s+(.+)$/);
|
|
37909
|
+
if (!match) return null;
|
|
37910
|
+
const pid = Number.parseInt(match[1], 10);
|
|
37911
|
+
if (!Number.isFinite(pid)) return null;
|
|
37912
|
+
return { pid, args: match[2] };
|
|
37913
|
+
}
|
|
37914
|
+
function isMacAppProcessArgs(args, appPath) {
|
|
37915
|
+
const normalized = normalizeMacAppPath(appPath);
|
|
37916
|
+
if (!normalized) return false;
|
|
37917
|
+
return String(args || "").startsWith(`${normalized}/`);
|
|
37918
|
+
}
|
|
37919
|
+
function findMacAppProcessPids(psOutput, appPaths) {
|
|
37920
|
+
const normalizedPaths = appPaths.map(normalizeMacAppPath).filter((value) => !!value);
|
|
37921
|
+
if (normalizedPaths.length === 0) return [];
|
|
37922
|
+
const pids = [];
|
|
37923
|
+
for (const line of String(psOutput || "").split(/\r?\n/)) {
|
|
37924
|
+
const parsed = parsePsLine(line);
|
|
37925
|
+
if (!parsed) continue;
|
|
37926
|
+
if (normalizedPaths.some((appPath) => isMacAppProcessArgs(parsed.args, appPath))) {
|
|
37927
|
+
pids.push(parsed.pid);
|
|
37928
|
+
}
|
|
37929
|
+
}
|
|
37930
|
+
return pids;
|
|
37931
|
+
}
|
|
37932
|
+
var init_macos_app_process = __esm({
|
|
37933
|
+
"../../oss/packages/daemon-core/src/launch/macos-app-process.ts"() {
|
|
37934
|
+
"use strict";
|
|
37935
|
+
}
|
|
37936
|
+
});
|
|
37937
|
+
|
|
37878
37938
|
// ../../oss/packages/daemon-core/src/launch.ts
|
|
37879
37939
|
function getProviderLoader() {
|
|
37880
37940
|
if (!_providerLoader) {
|
|
@@ -37897,9 +37957,9 @@ function getWinProcessNames() {
|
|
|
37897
37957
|
function getProviderMeta(ideId) {
|
|
37898
37958
|
return getProviderLoader().getMeta(ideId);
|
|
37899
37959
|
}
|
|
37900
|
-
function getPreferredLaunchMethod(ideId,
|
|
37960
|
+
function getPreferredLaunchMethod(ideId, platform12) {
|
|
37901
37961
|
const prefer = getProviderMeta(ideId)?.launch?.prefer;
|
|
37902
|
-
const value = prefer?.[
|
|
37962
|
+
const value = prefer?.[platform12];
|
|
37903
37963
|
return value === "cli" || value === "app" || value === "auto" ? value : "auto";
|
|
37904
37964
|
}
|
|
37905
37965
|
function getCdpStartupTimeoutMs(ideId) {
|
|
@@ -37910,6 +37970,35 @@ function getCdpStartupTimeoutMs(ideId) {
|
|
|
37910
37970
|
function escapeForAppleScript(value) {
|
|
37911
37971
|
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
37912
37972
|
}
|
|
37973
|
+
function getIdePathCandidates(ideId) {
|
|
37974
|
+
return getProviderLoader().getIdePathCandidates(ideId);
|
|
37975
|
+
}
|
|
37976
|
+
function getMacAppProcessPids(ideId) {
|
|
37977
|
+
const appPaths = getIdePathCandidates(ideId);
|
|
37978
|
+
if (appPaths.length === 0) return [];
|
|
37979
|
+
try {
|
|
37980
|
+
const output = (0, import_child_process7.execSync)("ps axww -o pid=,args=", {
|
|
37981
|
+
encoding: "utf-8",
|
|
37982
|
+
timeout: 3e3,
|
|
37983
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
37984
|
+
});
|
|
37985
|
+
return findMacAppProcessPids(output, appPaths);
|
|
37986
|
+
} catch {
|
|
37987
|
+
return [];
|
|
37988
|
+
}
|
|
37989
|
+
}
|
|
37990
|
+
function killMacAppPathProcesses(ideId, signal) {
|
|
37991
|
+
const pids = getMacAppProcessPids(ideId);
|
|
37992
|
+
let signalled = false;
|
|
37993
|
+
for (const pid of pids) {
|
|
37994
|
+
try {
|
|
37995
|
+
process.kill(pid, signal);
|
|
37996
|
+
signalled = true;
|
|
37997
|
+
} catch {
|
|
37998
|
+
}
|
|
37999
|
+
}
|
|
38000
|
+
return signalled;
|
|
38001
|
+
}
|
|
37913
38002
|
async function findFreePort(ports) {
|
|
37914
38003
|
for (const port2 of ports) {
|
|
37915
38004
|
const free = await checkPortFree(port2);
|
|
@@ -37971,6 +38060,7 @@ async function killIdeProcess(ideId) {
|
|
|
37971
38060
|
} catch {
|
|
37972
38061
|
}
|
|
37973
38062
|
}
|
|
38063
|
+
killMacAppPathProcesses(ideId, "SIGTERM");
|
|
37974
38064
|
} else if (plat === "win32" && winProcesses) {
|
|
37975
38065
|
for (const proc of winProcesses) {
|
|
37976
38066
|
try {
|
|
@@ -38000,6 +38090,7 @@ async function killIdeProcess(ideId) {
|
|
|
38000
38090
|
(0, import_child_process7.execSync)(`pkill -9 -x "${appName}" 2>/dev/null`, { timeout: 5e3 });
|
|
38001
38091
|
} catch {
|
|
38002
38092
|
}
|
|
38093
|
+
killMacAppPathProcesses(ideId, "SIGKILL");
|
|
38003
38094
|
} else if (plat === "win32" && winProcesses) {
|
|
38004
38095
|
for (const proc of winProcesses) {
|
|
38005
38096
|
try {
|
|
@@ -38019,14 +38110,16 @@ function isIdeRunning(ideId) {
|
|
|
38019
38110
|
try {
|
|
38020
38111
|
if (plat === "darwin") {
|
|
38021
38112
|
const appName = getMacAppIdentifiers()[ideId];
|
|
38022
|
-
if (!appName) return
|
|
38113
|
+
if (!appName) return getMacAppProcessPids(ideId).length > 0;
|
|
38023
38114
|
try {
|
|
38024
38115
|
const result = (0, import_child_process7.execSync)(`pgrep -x "${appName}" 2>/dev/null`, {
|
|
38025
38116
|
encoding: "utf-8",
|
|
38026
38117
|
timeout: 3e3
|
|
38027
38118
|
});
|
|
38028
|
-
|
|
38119
|
+
if (result.trim().length > 0) return true;
|
|
38029
38120
|
} catch {
|
|
38121
|
+
}
|
|
38122
|
+
try {
|
|
38030
38123
|
const result = (0, import_child_process7.execSync)(
|
|
38031
38124
|
`osascript -e 'tell application "System Events" to count (every process whose name is "${escapeForAppleScript(appName)}")'`,
|
|
38032
38125
|
{
|
|
@@ -38035,8 +38128,10 @@ function isIdeRunning(ideId) {
|
|
|
38035
38128
|
stdio: ["pipe", "pipe", "pipe"]
|
|
38036
38129
|
}
|
|
38037
38130
|
);
|
|
38038
|
-
|
|
38131
|
+
if (Number.parseInt(result.trim() || "0", 10) > 0) return true;
|
|
38132
|
+
} catch {
|
|
38039
38133
|
}
|
|
38134
|
+
return getMacAppProcessPids(ideId).length > 0;
|
|
38040
38135
|
} else if (plat === "win32") {
|
|
38041
38136
|
const winProcesses = getWinProcessNames()[ideId];
|
|
38042
38137
|
if (!winProcesses) return false;
|
|
@@ -38081,7 +38176,7 @@ function detectCurrentWorkspace(ideId) {
|
|
|
38081
38176
|
}
|
|
38082
38177
|
} else if (plat === "win32") {
|
|
38083
38178
|
try {
|
|
38084
|
-
const
|
|
38179
|
+
const fs22 = require("fs");
|
|
38085
38180
|
const appNameMap = getMacAppIdentifiers();
|
|
38086
38181
|
const appName = appNameMap[ideId];
|
|
38087
38182
|
if (appName) {
|
|
@@ -38090,8 +38185,8 @@ function detectCurrentWorkspace(ideId) {
|
|
|
38090
38185
|
appName,
|
|
38091
38186
|
"storage.json"
|
|
38092
38187
|
);
|
|
38093
|
-
if (
|
|
38094
|
-
const data = JSON.parse(
|
|
38188
|
+
if (fs22.existsSync(storagePath)) {
|
|
38189
|
+
const data = JSON.parse(fs22.readFileSync(storagePath, "utf-8"));
|
|
38095
38190
|
const workspaces = data?.openedPathsList?.workspaces3 || data?.openedPathsList?.entries || [];
|
|
38096
38191
|
if (workspaces.length > 0) {
|
|
38097
38192
|
const recent = workspaces[0];
|
|
@@ -38108,7 +38203,7 @@ function detectCurrentWorkspace(ideId) {
|
|
|
38108
38203
|
return void 0;
|
|
38109
38204
|
}
|
|
38110
38205
|
async function launchWithCdp(options = {}) {
|
|
38111
|
-
const
|
|
38206
|
+
const platform12 = os17.platform();
|
|
38112
38207
|
let targetIde;
|
|
38113
38208
|
const ides = await detectIDEs(getProviderLoader());
|
|
38114
38209
|
if (options.ideId) {
|
|
@@ -38177,9 +38272,9 @@ async function launchWithCdp(options = {}) {
|
|
|
38177
38272
|
}
|
|
38178
38273
|
const port = await findFreePort(portPair);
|
|
38179
38274
|
try {
|
|
38180
|
-
if (
|
|
38275
|
+
if (platform12 === "darwin") {
|
|
38181
38276
|
await launchMacOS(targetIde, port, workspace, options.newWindow);
|
|
38182
|
-
} else if (
|
|
38277
|
+
} else if (platform12 === "win32") {
|
|
38183
38278
|
await launchWindows(targetIde, port, workspace, options.newWindow);
|
|
38184
38279
|
} else {
|
|
38185
38280
|
await launchLinux(targetIde, port, workspace, options.newWindow);
|
|
@@ -38267,6 +38362,7 @@ var init_launch = __esm({
|
|
|
38267
38362
|
path15 = __toESM(require("path"));
|
|
38268
38363
|
init_ide_detector();
|
|
38269
38364
|
init_provider_loader();
|
|
38365
|
+
init_macos_app_process();
|
|
38270
38366
|
_providerLoader = null;
|
|
38271
38367
|
}
|
|
38272
38368
|
});
|
|
@@ -39459,13 +39555,19 @@ var init_router = __esm({
|
|
|
39459
39555
|
const wantsAll = args?.all === true;
|
|
39460
39556
|
const offset = wantsAll ? 0 : Math.max(0, Number(args?.offset) || 0);
|
|
39461
39557
|
const limit = wantsAll ? Number.MAX_SAFE_INTEGER : Math.max(1, Math.min(100, Number(args?.limit) || 30));
|
|
39462
|
-
const
|
|
39558
|
+
const providerMeta = this.deps.providerLoader.getMeta(providerType);
|
|
39559
|
+
const { sessions: historySessions, hasMore, source } = listProviderHistorySessions(providerType, {
|
|
39560
|
+
canonicalHistory: providerMeta?.canonicalHistory,
|
|
39561
|
+
offset,
|
|
39562
|
+
limit,
|
|
39563
|
+
historyBehavior: providerMeta?.historyBehavior,
|
|
39564
|
+
scripts: providerMeta?.scripts
|
|
39565
|
+
});
|
|
39463
39566
|
const state = loadState();
|
|
39464
39567
|
const savedSessions = getSavedProviderSessions(state, { providerType, kind });
|
|
39465
39568
|
const recentSessions = getRecentActivity(state, 200).filter((entry) => entry.providerType === providerType && entry.kind === kind && entry.providerSessionId);
|
|
39466
39569
|
const savedSessionById = new Map(savedSessions.map((entry) => [entry.providerSessionId, entry]));
|
|
39467
39570
|
const recentSessionById = new Map(recentSessions.map((entry) => [entry.providerSessionId, entry]));
|
|
39468
|
-
const providerMeta = this.deps.providerLoader.getMeta(providerType);
|
|
39469
39571
|
const canResumeById = supportsExplicitSessionResume(providerMeta?.resume);
|
|
39470
39572
|
return {
|
|
39471
39573
|
success: true,
|
|
@@ -39485,10 +39587,14 @@ var init_router = __esm({
|
|
|
39485
39587
|
messageCount: session.messageCount,
|
|
39486
39588
|
firstMessageAt: session.firstMessageAt,
|
|
39487
39589
|
lastMessageAt: session.lastMessageAt,
|
|
39488
|
-
canResume: !!(saved?.workspace || recent?.workspace || session.workspace) && canResumeById
|
|
39590
|
+
canResume: !!(saved?.workspace || recent?.workspace || session.workspace) && canResumeById,
|
|
39591
|
+
historySource: session.source,
|
|
39592
|
+
sourcePath: session.sourcePath,
|
|
39593
|
+
sourceMtimeMs: session.sourceMtimeMs
|
|
39489
39594
|
};
|
|
39490
39595
|
}),
|
|
39491
|
-
hasMore
|
|
39596
|
+
hasMore,
|
|
39597
|
+
source
|
|
39492
39598
|
};
|
|
39493
39599
|
}
|
|
39494
39600
|
// ─── restart_session: IDE / CLI / ACP unified ───
|
|
@@ -45524,8 +45630,8 @@ var init_dev_server = __esm({
|
|
|
45524
45630
|
}
|
|
45525
45631
|
getEndpointList() {
|
|
45526
45632
|
return this.routes.map((r) => {
|
|
45527
|
-
const
|
|
45528
|
-
return `${r.method.padEnd(5)} ${
|
|
45633
|
+
const path35 = typeof r.pattern === "string" ? r.pattern : r.pattern.source.replace(/\\\//g, "/").replace(/\(\[.*?\]\+\)/g, ":type").replace(/[\^$]/g, "");
|
|
45634
|
+
return `${r.method.padEnd(5)} ${path35}`;
|
|
45529
45635
|
});
|
|
45530
45636
|
}
|
|
45531
45637
|
async start(port = DEV_SERVER_PORT) {
|
|
@@ -47467,8 +47573,8 @@ async function installExtension(ide, extension) {
|
|
|
47467
47573
|
const res = await fetch(extension.vsixUrl);
|
|
47468
47574
|
if (res.ok) {
|
|
47469
47575
|
const buffer = Buffer.from(await res.arrayBuffer());
|
|
47470
|
-
const
|
|
47471
|
-
|
|
47576
|
+
const fs22 = await import("fs");
|
|
47577
|
+
fs22.writeFileSync(vsixPath, buffer);
|
|
47472
47578
|
return new Promise((resolve18) => {
|
|
47473
47579
|
const cmd = `"${ide.cliCommand}" --install-extension "${vsixPath}" --force`;
|
|
47474
47580
|
(0, import_child_process11.exec)(cmd, { timeout: 6e4 }, (error48, _stdout, stderr) => {
|
|
@@ -48419,11 +48525,11 @@ var require_yoctocolors_cjs = __commonJS({
|
|
|
48419
48525
|
"use strict";
|
|
48420
48526
|
var tty3 = require("tty");
|
|
48421
48527
|
var hasColors = tty3?.WriteStream?.prototype?.hasColors?.() ?? false;
|
|
48422
|
-
var format = (
|
|
48528
|
+
var format = (open2, close) => {
|
|
48423
48529
|
if (!hasColors) {
|
|
48424
48530
|
return (input) => input;
|
|
48425
48531
|
}
|
|
48426
|
-
const openCode = `\x1B[${
|
|
48532
|
+
const openCode = `\x1B[${open2}m`;
|
|
48427
48533
|
const closeCode = `\x1B[${close}m`;
|
|
48428
48534
|
return (input) => {
|
|
48429
48535
|
const string4 = input + "";
|
|
@@ -51961,7 +52067,7 @@ var require_innerFrom = __commonJS({
|
|
|
51961
52067
|
exports2.fromIterable = fromIterable;
|
|
51962
52068
|
function fromAsyncIterable(asyncIterable) {
|
|
51963
52069
|
return new Observable_1.Observable(function(subscriber) {
|
|
51964
|
-
|
|
52070
|
+
process13(asyncIterable, subscriber).catch(function(err) {
|
|
51965
52071
|
return subscriber.error(err);
|
|
51966
52072
|
});
|
|
51967
52073
|
});
|
|
@@ -51971,7 +52077,7 @@ var require_innerFrom = __commonJS({
|
|
|
51971
52077
|
return fromAsyncIterable(isReadableStreamLike_1.readableStreamLikeToAsyncGenerator(readableStream));
|
|
51972
52078
|
}
|
|
51973
52079
|
exports2.fromReadableStreamLike = fromReadableStreamLike;
|
|
51974
|
-
function
|
|
52080
|
+
function process13(asyncIterable, subscriber) {
|
|
51975
52081
|
var asyncIterable_1, asyncIterable_1_1;
|
|
51976
52082
|
var e_2, _a2;
|
|
51977
52083
|
return __awaiter(this, void 0, void 0, function() {
|
|
@@ -59630,15 +59736,15 @@ var require_route = __commonJS({
|
|
|
59630
59736
|
};
|
|
59631
59737
|
}
|
|
59632
59738
|
function wrapConversion(toModel, graph) {
|
|
59633
|
-
const
|
|
59739
|
+
const path35 = [graph[toModel].parent, toModel];
|
|
59634
59740
|
let fn = conversions[graph[toModel].parent][toModel];
|
|
59635
59741
|
let cur = graph[toModel].parent;
|
|
59636
59742
|
while (graph[cur].parent) {
|
|
59637
|
-
|
|
59743
|
+
path35.unshift(graph[cur].parent);
|
|
59638
59744
|
fn = link(conversions[graph[cur].parent][cur], fn);
|
|
59639
59745
|
cur = graph[cur].parent;
|
|
59640
59746
|
}
|
|
59641
|
-
fn.conversion =
|
|
59747
|
+
fn.conversion = path35;
|
|
59642
59748
|
return fn;
|
|
59643
59749
|
}
|
|
59644
59750
|
module2.exports = function(fromModel) {
|
|
@@ -60035,7 +60141,7 @@ var require_has_flag = __commonJS({
|
|
|
60035
60141
|
var require_supports_color = __commonJS({
|
|
60036
60142
|
"../../node_modules/supports-color/index.js"(exports2, module2) {
|
|
60037
60143
|
"use strict";
|
|
60038
|
-
var
|
|
60144
|
+
var os30 = require("os");
|
|
60039
60145
|
var tty3 = require("tty");
|
|
60040
60146
|
var hasFlag3 = require_has_flag();
|
|
60041
60147
|
var { env: env3 } = process;
|
|
@@ -60083,7 +60189,7 @@ var require_supports_color = __commonJS({
|
|
|
60083
60189
|
return min;
|
|
60084
60190
|
}
|
|
60085
60191
|
if (process.platform === "win32") {
|
|
60086
|
-
const osRelease =
|
|
60192
|
+
const osRelease = os30.release().split(".");
|
|
60087
60193
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
60088
60194
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
60089
60195
|
}
|
|
@@ -60384,18 +60490,18 @@ var require_source = __commonJS({
|
|
|
60384
60490
|
}
|
|
60385
60491
|
}
|
|
60386
60492
|
});
|
|
60387
|
-
var createStyler3 = (
|
|
60493
|
+
var createStyler3 = (open2, close, parent) => {
|
|
60388
60494
|
let openAll;
|
|
60389
60495
|
let closeAll;
|
|
60390
60496
|
if (parent === void 0) {
|
|
60391
|
-
openAll =
|
|
60497
|
+
openAll = open2;
|
|
60392
60498
|
closeAll = close;
|
|
60393
60499
|
} else {
|
|
60394
|
-
openAll = parent.openAll +
|
|
60500
|
+
openAll = parent.openAll + open2;
|
|
60395
60501
|
closeAll = close + parent.closeAll;
|
|
60396
60502
|
}
|
|
60397
60503
|
return {
|
|
60398
|
-
open:
|
|
60504
|
+
open: open2,
|
|
60399
60505
|
close,
|
|
60400
60506
|
openAll,
|
|
60401
60507
|
closeAll,
|
|
@@ -60559,11 +60665,11 @@ var require_signals = __commonJS({
|
|
|
60559
60665
|
var require_signal_exit = __commonJS({
|
|
60560
60666
|
"../../node_modules/inquirer/node_modules/signal-exit/index.js"(exports2, module2) {
|
|
60561
60667
|
"use strict";
|
|
60562
|
-
var
|
|
60563
|
-
var processOk2 = function(
|
|
60564
|
-
return
|
|
60668
|
+
var process13 = global.process;
|
|
60669
|
+
var processOk2 = function(process14) {
|
|
60670
|
+
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";
|
|
60565
60671
|
};
|
|
60566
|
-
if (!processOk2(
|
|
60672
|
+
if (!processOk2(process13)) {
|
|
60567
60673
|
module2.exports = function() {
|
|
60568
60674
|
return function() {
|
|
60569
60675
|
};
|
|
@@ -60571,15 +60677,15 @@ var require_signal_exit = __commonJS({
|
|
|
60571
60677
|
} else {
|
|
60572
60678
|
assert3 = require("assert");
|
|
60573
60679
|
signals2 = require_signals();
|
|
60574
|
-
isWin = /^win/i.test(
|
|
60680
|
+
isWin = /^win/i.test(process13.platform);
|
|
60575
60681
|
EE = require("events");
|
|
60576
60682
|
if (typeof EE !== "function") {
|
|
60577
60683
|
EE = EE.EventEmitter;
|
|
60578
60684
|
}
|
|
60579
|
-
if (
|
|
60580
|
-
emitter =
|
|
60685
|
+
if (process13.__signal_exit_emitter__) {
|
|
60686
|
+
emitter = process13.__signal_exit_emitter__;
|
|
60581
60687
|
} else {
|
|
60582
|
-
emitter =
|
|
60688
|
+
emitter = process13.__signal_exit_emitter__ = new EE();
|
|
60583
60689
|
emitter.count = 0;
|
|
60584
60690
|
emitter.emitted = {};
|
|
60585
60691
|
}
|
|
@@ -60616,12 +60722,12 @@ var require_signal_exit = __commonJS({
|
|
|
60616
60722
|
loaded = false;
|
|
60617
60723
|
signals2.forEach(function(sig) {
|
|
60618
60724
|
try {
|
|
60619
|
-
|
|
60725
|
+
process13.removeListener(sig, sigListeners[sig]);
|
|
60620
60726
|
} catch (er) {
|
|
60621
60727
|
}
|
|
60622
60728
|
});
|
|
60623
|
-
|
|
60624
|
-
|
|
60729
|
+
process13.emit = originalProcessEmit;
|
|
60730
|
+
process13.reallyExit = originalProcessReallyExit;
|
|
60625
60731
|
emitter.count -= 1;
|
|
60626
60732
|
};
|
|
60627
60733
|
module2.exports.unload = unload2;
|
|
@@ -60638,7 +60744,7 @@ var require_signal_exit = __commonJS({
|
|
|
60638
60744
|
if (!processOk2(global.process)) {
|
|
60639
60745
|
return;
|
|
60640
60746
|
}
|
|
60641
|
-
var listeners =
|
|
60747
|
+
var listeners = process13.listeners(sig);
|
|
60642
60748
|
if (listeners.length === emitter.count) {
|
|
60643
60749
|
unload2();
|
|
60644
60750
|
emit("exit", null, sig);
|
|
@@ -60646,7 +60752,7 @@ var require_signal_exit = __commonJS({
|
|
|
60646
60752
|
if (isWin && sig === "SIGHUP") {
|
|
60647
60753
|
sig = "SIGINT";
|
|
60648
60754
|
}
|
|
60649
|
-
|
|
60755
|
+
process13.kill(process13.pid, sig);
|
|
60650
60756
|
}
|
|
60651
60757
|
};
|
|
60652
60758
|
});
|
|
@@ -60662,36 +60768,36 @@ var require_signal_exit = __commonJS({
|
|
|
60662
60768
|
emitter.count += 1;
|
|
60663
60769
|
signals2 = signals2.filter(function(sig) {
|
|
60664
60770
|
try {
|
|
60665
|
-
|
|
60771
|
+
process13.on(sig, sigListeners[sig]);
|
|
60666
60772
|
return true;
|
|
60667
60773
|
} catch (er) {
|
|
60668
60774
|
return false;
|
|
60669
60775
|
}
|
|
60670
60776
|
});
|
|
60671
|
-
|
|
60672
|
-
|
|
60777
|
+
process13.emit = processEmit;
|
|
60778
|
+
process13.reallyExit = processReallyExit;
|
|
60673
60779
|
};
|
|
60674
60780
|
module2.exports.load = load2;
|
|
60675
|
-
originalProcessReallyExit =
|
|
60781
|
+
originalProcessReallyExit = process13.reallyExit;
|
|
60676
60782
|
processReallyExit = function processReallyExit2(code) {
|
|
60677
60783
|
if (!processOk2(global.process)) {
|
|
60678
60784
|
return;
|
|
60679
60785
|
}
|
|
60680
|
-
|
|
60786
|
+
process13.exitCode = code || /* istanbul ignore next */
|
|
60681
60787
|
0;
|
|
60682
|
-
emit("exit",
|
|
60683
|
-
emit("afterexit",
|
|
60684
|
-
originalProcessReallyExit.call(
|
|
60788
|
+
emit("exit", process13.exitCode, null);
|
|
60789
|
+
emit("afterexit", process13.exitCode, null);
|
|
60790
|
+
originalProcessReallyExit.call(process13, process13.exitCode);
|
|
60685
60791
|
};
|
|
60686
|
-
originalProcessEmit =
|
|
60792
|
+
originalProcessEmit = process13.emit;
|
|
60687
60793
|
processEmit = function processEmit2(ev, arg) {
|
|
60688
60794
|
if (ev === "exit" && processOk2(global.process)) {
|
|
60689
60795
|
if (arg !== void 0) {
|
|
60690
|
-
|
|
60796
|
+
process13.exitCode = arg;
|
|
60691
60797
|
}
|
|
60692
60798
|
var ret = originalProcessEmit.apply(this, arguments);
|
|
60693
|
-
emit("exit",
|
|
60694
|
-
emit("afterexit",
|
|
60799
|
+
emit("exit", process13.exitCode, null);
|
|
60800
|
+
emit("afterexit", process13.exitCode, null);
|
|
60695
60801
|
return ret;
|
|
60696
60802
|
} else {
|
|
60697
60803
|
return originalProcessEmit.apply(this, arguments);
|
|
@@ -62881,12 +62987,12 @@ var require_buffer_list = __commonJS({
|
|
|
62881
62987
|
return (hint === "string" ? String : Number)(input);
|
|
62882
62988
|
}
|
|
62883
62989
|
var _require = require("buffer");
|
|
62884
|
-
var
|
|
62990
|
+
var Buffer2 = _require.Buffer;
|
|
62885
62991
|
var _require2 = require("util");
|
|
62886
62992
|
var inspect = _require2.inspect;
|
|
62887
62993
|
var custom2 = inspect && inspect.custom || "inspect";
|
|
62888
62994
|
function copyBuffer(src, target, offset) {
|
|
62889
|
-
|
|
62995
|
+
Buffer2.prototype.copy.call(src, target, offset);
|
|
62890
62996
|
}
|
|
62891
62997
|
module2.exports = /* @__PURE__ */ (function() {
|
|
62892
62998
|
function BufferList() {
|
|
@@ -62946,8 +63052,8 @@ var require_buffer_list = __commonJS({
|
|
|
62946
63052
|
}, {
|
|
62947
63053
|
key: "concat",
|
|
62948
63054
|
value: function concat(n) {
|
|
62949
|
-
if (this.length === 0) return
|
|
62950
|
-
var ret =
|
|
63055
|
+
if (this.length === 0) return Buffer2.alloc(0);
|
|
63056
|
+
var ret = Buffer2.allocUnsafe(n >>> 0);
|
|
62951
63057
|
var p = this.head;
|
|
62952
63058
|
var i = 0;
|
|
62953
63059
|
while (p) {
|
|
@@ -63011,7 +63117,7 @@ var require_buffer_list = __commonJS({
|
|
|
63011
63117
|
}, {
|
|
63012
63118
|
key: "_getBuffer",
|
|
63013
63119
|
value: function _getBuffer(n) {
|
|
63014
|
-
var ret =
|
|
63120
|
+
var ret = Buffer2.allocUnsafe(n);
|
|
63015
63121
|
var p = this.head;
|
|
63016
63122
|
var c = 1;
|
|
63017
63123
|
p.data.copy(ret);
|
|
@@ -63343,14 +63449,14 @@ var require_stream_writable = __commonJS({
|
|
|
63343
63449
|
deprecate: require_node()
|
|
63344
63450
|
};
|
|
63345
63451
|
var Stream = require_stream();
|
|
63346
|
-
var
|
|
63452
|
+
var Buffer2 = require("buffer").Buffer;
|
|
63347
63453
|
var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
|
|
63348
63454
|
};
|
|
63349
63455
|
function _uint8ArrayToBuffer(chunk) {
|
|
63350
|
-
return
|
|
63456
|
+
return Buffer2.from(chunk);
|
|
63351
63457
|
}
|
|
63352
63458
|
function _isUint8Array(obj) {
|
|
63353
|
-
return
|
|
63459
|
+
return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
|
|
63354
63460
|
}
|
|
63355
63461
|
var destroyImpl = require_destroy();
|
|
63356
63462
|
var _require = require_state();
|
|
@@ -63478,7 +63584,7 @@ var require_stream_writable = __commonJS({
|
|
|
63478
63584
|
var state = this._writableState;
|
|
63479
63585
|
var ret = false;
|
|
63480
63586
|
var isBuf = !state.objectMode && _isUint8Array(chunk);
|
|
63481
|
-
if (isBuf && !
|
|
63587
|
+
if (isBuf && !Buffer2.isBuffer(chunk)) {
|
|
63482
63588
|
chunk = _uint8ArrayToBuffer(chunk);
|
|
63483
63589
|
}
|
|
63484
63590
|
if (typeof encoding === "function") {
|
|
@@ -63522,7 +63628,7 @@ var require_stream_writable = __commonJS({
|
|
|
63522
63628
|
});
|
|
63523
63629
|
function decodeChunk(state, chunk, encoding) {
|
|
63524
63630
|
if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") {
|
|
63525
|
-
chunk =
|
|
63631
|
+
chunk = Buffer2.from(chunk, encoding);
|
|
63526
63632
|
}
|
|
63527
63633
|
return chunk;
|
|
63528
63634
|
}
|
|
@@ -63893,34 +63999,34 @@ var require_safe_buffer = __commonJS({
|
|
|
63893
63999
|
"../../node_modules/safe-buffer/index.js"(exports2, module2) {
|
|
63894
64000
|
"use strict";
|
|
63895
64001
|
var buffer = require("buffer");
|
|
63896
|
-
var
|
|
64002
|
+
var Buffer2 = buffer.Buffer;
|
|
63897
64003
|
function copyProps(src, dst) {
|
|
63898
64004
|
for (var key in src) {
|
|
63899
64005
|
dst[key] = src[key];
|
|
63900
64006
|
}
|
|
63901
64007
|
}
|
|
63902
|
-
if (
|
|
64008
|
+
if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
|
|
63903
64009
|
module2.exports = buffer;
|
|
63904
64010
|
} else {
|
|
63905
64011
|
copyProps(buffer, exports2);
|
|
63906
64012
|
exports2.Buffer = SafeBuffer;
|
|
63907
64013
|
}
|
|
63908
64014
|
function SafeBuffer(arg, encodingOrOffset, length) {
|
|
63909
|
-
return
|
|
64015
|
+
return Buffer2(arg, encodingOrOffset, length);
|
|
63910
64016
|
}
|
|
63911
|
-
SafeBuffer.prototype = Object.create(
|
|
63912
|
-
copyProps(
|
|
64017
|
+
SafeBuffer.prototype = Object.create(Buffer2.prototype);
|
|
64018
|
+
copyProps(Buffer2, SafeBuffer);
|
|
63913
64019
|
SafeBuffer.from = function(arg, encodingOrOffset, length) {
|
|
63914
64020
|
if (typeof arg === "number") {
|
|
63915
64021
|
throw new TypeError("Argument must not be a number");
|
|
63916
64022
|
}
|
|
63917
|
-
return
|
|
64023
|
+
return Buffer2(arg, encodingOrOffset, length);
|
|
63918
64024
|
};
|
|
63919
64025
|
SafeBuffer.alloc = function(size, fill, encoding) {
|
|
63920
64026
|
if (typeof size !== "number") {
|
|
63921
64027
|
throw new TypeError("Argument must be a number");
|
|
63922
64028
|
}
|
|
63923
|
-
var buf =
|
|
64029
|
+
var buf = Buffer2(size);
|
|
63924
64030
|
if (fill !== void 0) {
|
|
63925
64031
|
if (typeof encoding === "string") {
|
|
63926
64032
|
buf.fill(fill, encoding);
|
|
@@ -63936,7 +64042,7 @@ var require_safe_buffer = __commonJS({
|
|
|
63936
64042
|
if (typeof size !== "number") {
|
|
63937
64043
|
throw new TypeError("Argument must be a number");
|
|
63938
64044
|
}
|
|
63939
|
-
return
|
|
64045
|
+
return Buffer2(size);
|
|
63940
64046
|
};
|
|
63941
64047
|
SafeBuffer.allocUnsafeSlow = function(size) {
|
|
63942
64048
|
if (typeof size !== "number") {
|
|
@@ -63951,8 +64057,8 @@ var require_safe_buffer = __commonJS({
|
|
|
63951
64057
|
var require_string_decoder = __commonJS({
|
|
63952
64058
|
"../../node_modules/string_decoder/lib/string_decoder.js"(exports2) {
|
|
63953
64059
|
"use strict";
|
|
63954
|
-
var
|
|
63955
|
-
var isEncoding =
|
|
64060
|
+
var Buffer2 = require_safe_buffer().Buffer;
|
|
64061
|
+
var isEncoding = Buffer2.isEncoding || function(encoding) {
|
|
63956
64062
|
encoding = "" + encoding;
|
|
63957
64063
|
switch (encoding && encoding.toLowerCase()) {
|
|
63958
64064
|
case "hex":
|
|
@@ -64000,7 +64106,7 @@ var require_string_decoder = __commonJS({
|
|
|
64000
64106
|
}
|
|
64001
64107
|
function normalizeEncoding(enc) {
|
|
64002
64108
|
var nenc = _normalizeEncoding(enc);
|
|
64003
|
-
if (typeof nenc !== "string" && (
|
|
64109
|
+
if (typeof nenc !== "string" && (Buffer2.isEncoding === isEncoding || !isEncoding(enc))) throw new Error("Unknown encoding: " + enc);
|
|
64004
64110
|
return nenc || enc;
|
|
64005
64111
|
}
|
|
64006
64112
|
exports2.StringDecoder = StringDecoder;
|
|
@@ -64029,7 +64135,7 @@ var require_string_decoder = __commonJS({
|
|
|
64029
64135
|
}
|
|
64030
64136
|
this.lastNeed = 0;
|
|
64031
64137
|
this.lastTotal = 0;
|
|
64032
|
-
this.lastChar =
|
|
64138
|
+
this.lastChar = Buffer2.allocUnsafe(nb);
|
|
64033
64139
|
}
|
|
64034
64140
|
StringDecoder.prototype.write = function(buf) {
|
|
64035
64141
|
if (buf.length === 0) return "";
|
|
@@ -64590,14 +64696,14 @@ var require_stream_readable = __commonJS({
|
|
|
64590
64696
|
return emitter.listeners(type).length;
|
|
64591
64697
|
};
|
|
64592
64698
|
var Stream = require_stream();
|
|
64593
|
-
var
|
|
64699
|
+
var Buffer2 = require("buffer").Buffer;
|
|
64594
64700
|
var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
|
|
64595
64701
|
};
|
|
64596
64702
|
function _uint8ArrayToBuffer(chunk) {
|
|
64597
|
-
return
|
|
64703
|
+
return Buffer2.from(chunk);
|
|
64598
64704
|
}
|
|
64599
64705
|
function _isUint8Array(obj) {
|
|
64600
|
-
return
|
|
64706
|
+
return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
|
|
64601
64707
|
}
|
|
64602
64708
|
var debugUtil = require("util");
|
|
64603
64709
|
var debug;
|
|
@@ -64705,7 +64811,7 @@ var require_stream_readable = __commonJS({
|
|
|
64705
64811
|
if (typeof chunk === "string") {
|
|
64706
64812
|
encoding = encoding || state.defaultEncoding;
|
|
64707
64813
|
if (encoding !== state.encoding) {
|
|
64708
|
-
chunk =
|
|
64814
|
+
chunk = Buffer2.from(chunk, encoding);
|
|
64709
64815
|
encoding = "";
|
|
64710
64816
|
}
|
|
64711
64817
|
skipChunkCheck = true;
|
|
@@ -64730,7 +64836,7 @@ var require_stream_readable = __commonJS({
|
|
|
64730
64836
|
if (er) {
|
|
64731
64837
|
errorOrDestroy(stream, er);
|
|
64732
64838
|
} else if (state.objectMode || chunk && chunk.length > 0) {
|
|
64733
|
-
if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !==
|
|
64839
|
+
if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer2.prototype) {
|
|
64734
64840
|
chunk = _uint8ArrayToBuffer(chunk);
|
|
64735
64841
|
}
|
|
64736
64842
|
if (addToFront) {
|
|
@@ -65541,7 +65647,7 @@ var require_readable = __commonJS({
|
|
|
65541
65647
|
var require_BufferList = __commonJS({
|
|
65542
65648
|
"../../node_modules/bl/BufferList.js"(exports2, module2) {
|
|
65543
65649
|
"use strict";
|
|
65544
|
-
var { Buffer:
|
|
65650
|
+
var { Buffer: Buffer2 } = require("buffer");
|
|
65545
65651
|
var symbol2 = /* @__PURE__ */ Symbol.for("BufferList");
|
|
65546
65652
|
function BufferList(buf) {
|
|
65547
65653
|
if (!(this instanceof BufferList)) {
|
|
@@ -65605,10 +65711,10 @@ var require_BufferList = __commonJS({
|
|
|
65605
65711
|
srcEnd = this.length;
|
|
65606
65712
|
}
|
|
65607
65713
|
if (srcStart >= this.length) {
|
|
65608
|
-
return dst ||
|
|
65714
|
+
return dst || Buffer2.alloc(0);
|
|
65609
65715
|
}
|
|
65610
65716
|
if (srcEnd <= 0) {
|
|
65611
|
-
return dst ||
|
|
65717
|
+
return dst || Buffer2.alloc(0);
|
|
65612
65718
|
}
|
|
65613
65719
|
const copy2 = !!dst;
|
|
65614
65720
|
const off = this._offset(srcStart);
|
|
@@ -65618,7 +65724,7 @@ var require_BufferList = __commonJS({
|
|
|
65618
65724
|
let start = off[1];
|
|
65619
65725
|
if (srcStart === 0 && srcEnd === this.length) {
|
|
65620
65726
|
if (!copy2) {
|
|
65621
|
-
return this._bufs.length === 1 ? this._bufs[0] :
|
|
65727
|
+
return this._bufs.length === 1 ? this._bufs[0] : Buffer2.concat(this._bufs, this.length);
|
|
65622
65728
|
}
|
|
65623
65729
|
for (let i = 0; i < this._bufs.length; i++) {
|
|
65624
65730
|
this._bufs[i].copy(dst, bufoff);
|
|
@@ -65630,7 +65736,7 @@ var require_BufferList = __commonJS({
|
|
|
65630
65736
|
return copy2 ? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes) : this._bufs[off[0]].slice(start, start + bytes);
|
|
65631
65737
|
}
|
|
65632
65738
|
if (!copy2) {
|
|
65633
|
-
dst =
|
|
65739
|
+
dst = Buffer2.allocUnsafe(len);
|
|
65634
65740
|
}
|
|
65635
65741
|
for (let i = off[0]; i < this._bufs.length; i++) {
|
|
65636
65742
|
const l = this._bufs[i].length - start;
|
|
@@ -65706,7 +65812,7 @@ var require_BufferList = __commonJS({
|
|
|
65706
65812
|
return this;
|
|
65707
65813
|
}
|
|
65708
65814
|
if (buf.buffer) {
|
|
65709
|
-
this._appendBuffer(
|
|
65815
|
+
this._appendBuffer(Buffer2.from(buf.buffer, buf.byteOffset, buf.byteLength));
|
|
65710
65816
|
} else if (Array.isArray(buf)) {
|
|
65711
65817
|
for (let i = 0; i < buf.length; i++) {
|
|
65712
65818
|
this.append(buf[i]);
|
|
@@ -65719,7 +65825,7 @@ var require_BufferList = __commonJS({
|
|
|
65719
65825
|
if (typeof buf === "number") {
|
|
65720
65826
|
buf = buf.toString();
|
|
65721
65827
|
}
|
|
65722
|
-
this._appendBuffer(
|
|
65828
|
+
this._appendBuffer(Buffer2.from(buf));
|
|
65723
65829
|
}
|
|
65724
65830
|
return this;
|
|
65725
65831
|
};
|
|
@@ -65735,15 +65841,15 @@ var require_BufferList = __commonJS({
|
|
|
65735
65841
|
if (typeof search === "function" || Array.isArray(search)) {
|
|
65736
65842
|
throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');
|
|
65737
65843
|
} else if (typeof search === "number") {
|
|
65738
|
-
search =
|
|
65844
|
+
search = Buffer2.from([search]);
|
|
65739
65845
|
} else if (typeof search === "string") {
|
|
65740
|
-
search =
|
|
65846
|
+
search = Buffer2.from(search, encoding);
|
|
65741
65847
|
} else if (this._isBufferList(search)) {
|
|
65742
65848
|
search = search.slice();
|
|
65743
65849
|
} else if (Array.isArray(search.buffer)) {
|
|
65744
|
-
search =
|
|
65745
|
-
} else if (!
|
|
65746
|
-
search =
|
|
65850
|
+
search = Buffer2.from(search.buffer, search.byteOffset, search.byteLength);
|
|
65851
|
+
} else if (!Buffer2.isBuffer(search)) {
|
|
65852
|
+
search = Buffer2.from(search);
|
|
65747
65853
|
}
|
|
65748
65854
|
offset = Number(offset || 0);
|
|
65749
65855
|
if (isNaN(offset)) {
|
|
@@ -73059,10 +73165,10 @@ var require_lib = __commonJS({
|
|
|
73059
73165
|
exports2.analyse = analyse;
|
|
73060
73166
|
var detectFile = (filepath, opts = {}) => new Promise((resolve18, reject) => {
|
|
73061
73167
|
let fd;
|
|
73062
|
-
const
|
|
73168
|
+
const fs22 = (0, node_1.default)();
|
|
73063
73169
|
const handler = (err, buffer) => {
|
|
73064
73170
|
if (fd) {
|
|
73065
|
-
|
|
73171
|
+
fs22.closeSync(fd);
|
|
73066
73172
|
}
|
|
73067
73173
|
if (err) {
|
|
73068
73174
|
reject(err);
|
|
@@ -73074,9 +73180,9 @@ var require_lib = __commonJS({
|
|
|
73074
73180
|
};
|
|
73075
73181
|
const sampleSize = (opts === null || opts === void 0 ? void 0 : opts.sampleSize) || 0;
|
|
73076
73182
|
if (sampleSize > 0) {
|
|
73077
|
-
fd =
|
|
73183
|
+
fd = fs22.openSync(filepath, "r");
|
|
73078
73184
|
let sample = Buffer.allocUnsafe(sampleSize);
|
|
73079
|
-
|
|
73185
|
+
fs22.read(fd, sample, 0, sampleSize, opts.offset, (err, bytesRead) => {
|
|
73080
73186
|
if (err) {
|
|
73081
73187
|
handler(err, null);
|
|
73082
73188
|
} else {
|
|
@@ -73088,22 +73194,22 @@ var require_lib = __commonJS({
|
|
|
73088
73194
|
});
|
|
73089
73195
|
return;
|
|
73090
73196
|
}
|
|
73091
|
-
|
|
73197
|
+
fs22.readFile(filepath, handler);
|
|
73092
73198
|
});
|
|
73093
73199
|
exports2.detectFile = detectFile;
|
|
73094
73200
|
var detectFileSync = (filepath, opts = {}) => {
|
|
73095
|
-
const
|
|
73201
|
+
const fs22 = (0, node_1.default)();
|
|
73096
73202
|
if (opts && opts.sampleSize) {
|
|
73097
|
-
const fd =
|
|
73203
|
+
const fd = fs22.openSync(filepath, "r");
|
|
73098
73204
|
let sample = Buffer.allocUnsafe(opts.sampleSize);
|
|
73099
|
-
const bytesRead =
|
|
73205
|
+
const bytesRead = fs22.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
|
|
73100
73206
|
if (bytesRead < opts.sampleSize) {
|
|
73101
73207
|
sample = sample.subarray(0, bytesRead);
|
|
73102
73208
|
}
|
|
73103
|
-
|
|
73209
|
+
fs22.closeSync(fd);
|
|
73104
73210
|
return (0, exports2.detect)(sample);
|
|
73105
73211
|
}
|
|
73106
|
-
return (0, exports2.detect)(
|
|
73212
|
+
return (0, exports2.detect)(fs22.readFileSync(filepath));
|
|
73107
73213
|
};
|
|
73108
73214
|
exports2.detectFileSync = detectFileSync;
|
|
73109
73215
|
exports2.default = {
|
|
@@ -73120,7 +73226,7 @@ var require_safer = __commonJS({
|
|
|
73120
73226
|
"../../node_modules/safer-buffer/safer.js"(exports2, module2) {
|
|
73121
73227
|
"use strict";
|
|
73122
73228
|
var buffer = require("buffer");
|
|
73123
|
-
var
|
|
73229
|
+
var Buffer2 = buffer.Buffer;
|
|
73124
73230
|
var safer = {};
|
|
73125
73231
|
var key;
|
|
73126
73232
|
for (key in buffer) {
|
|
@@ -73129,12 +73235,12 @@ var require_safer = __commonJS({
|
|
|
73129
73235
|
safer[key] = buffer[key];
|
|
73130
73236
|
}
|
|
73131
73237
|
var Safer = safer.Buffer = {};
|
|
73132
|
-
for (key in
|
|
73133
|
-
if (!
|
|
73238
|
+
for (key in Buffer2) {
|
|
73239
|
+
if (!Buffer2.hasOwnProperty(key)) continue;
|
|
73134
73240
|
if (key === "allocUnsafe" || key === "allocUnsafeSlow") continue;
|
|
73135
|
-
Safer[key] =
|
|
73241
|
+
Safer[key] = Buffer2[key];
|
|
73136
73242
|
}
|
|
73137
|
-
safer.Buffer.prototype =
|
|
73243
|
+
safer.Buffer.prototype = Buffer2.prototype;
|
|
73138
73244
|
if (!Safer.from || Safer.from === Uint8Array.from) {
|
|
73139
73245
|
Safer.from = function(value, encodingOrOffset, length) {
|
|
73140
73246
|
if (typeof value === "number") {
|
|
@@ -73143,7 +73249,7 @@ var require_safer = __commonJS({
|
|
|
73143
73249
|
if (value && typeof value.length === "undefined") {
|
|
73144
73250
|
throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value);
|
|
73145
73251
|
}
|
|
73146
|
-
return
|
|
73252
|
+
return Buffer2(value, encodingOrOffset, length);
|
|
73147
73253
|
};
|
|
73148
73254
|
}
|
|
73149
73255
|
if (!Safer.alloc) {
|
|
@@ -73154,7 +73260,7 @@ var require_safer = __commonJS({
|
|
|
73154
73260
|
if (size < 0 || size >= 2 * (1 << 30)) {
|
|
73155
73261
|
throw new RangeError('The value "' + size + '" is invalid for option "size"');
|
|
73156
73262
|
}
|
|
73157
|
-
var buf =
|
|
73263
|
+
var buf = Buffer2(size);
|
|
73158
73264
|
if (!fill || fill.length === 0) {
|
|
73159
73265
|
buf.fill(0);
|
|
73160
73266
|
} else if (typeof encoding === "string") {
|
|
@@ -73249,7 +73355,7 @@ var require_merge_exports = __commonJS({
|
|
|
73249
73355
|
var require_internal = __commonJS({
|
|
73250
73356
|
"../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/internal.js"(exports2, module2) {
|
|
73251
73357
|
"use strict";
|
|
73252
|
-
var
|
|
73358
|
+
var Buffer2 = require_safer().Buffer;
|
|
73253
73359
|
module2.exports = {
|
|
73254
73360
|
// Encodings
|
|
73255
73361
|
utf8: { type: "_internal", bomAware: true },
|
|
@@ -73273,7 +73379,7 @@ var require_internal = __commonJS({
|
|
|
73273
73379
|
} else if (this.enc === "cesu8") {
|
|
73274
73380
|
this.enc = "utf8";
|
|
73275
73381
|
this.encoder = InternalEncoderCesu8;
|
|
73276
|
-
if (
|
|
73382
|
+
if (Buffer2.from("eda0bdedb2a9", "hex").toString() !== "\u{1F4A9}") {
|
|
73277
73383
|
this.decoder = InternalDecoderCesu8;
|
|
73278
73384
|
this.defaultCharUnicode = iconv2.defaultCharUnicode;
|
|
73279
73385
|
}
|
|
@@ -73286,8 +73392,8 @@ var require_internal = __commonJS({
|
|
|
73286
73392
|
this.decoder = new StringDecoder(codec2.enc);
|
|
73287
73393
|
}
|
|
73288
73394
|
InternalDecoder.prototype.write = function(buf) {
|
|
73289
|
-
if (!
|
|
73290
|
-
buf =
|
|
73395
|
+
if (!Buffer2.isBuffer(buf)) {
|
|
73396
|
+
buf = Buffer2.from(buf);
|
|
73291
73397
|
}
|
|
73292
73398
|
return this.decoder.write(buf);
|
|
73293
73399
|
};
|
|
@@ -73298,7 +73404,7 @@ var require_internal = __commonJS({
|
|
|
73298
73404
|
this.enc = codec2.enc;
|
|
73299
73405
|
}
|
|
73300
73406
|
InternalEncoder.prototype.write = function(str) {
|
|
73301
|
-
return
|
|
73407
|
+
return Buffer2.from(str, this.enc);
|
|
73302
73408
|
};
|
|
73303
73409
|
InternalEncoder.prototype.end = function() {
|
|
73304
73410
|
};
|
|
@@ -73310,15 +73416,15 @@ var require_internal = __commonJS({
|
|
|
73310
73416
|
var completeQuads = str.length - str.length % 4;
|
|
73311
73417
|
this.prevStr = str.slice(completeQuads);
|
|
73312
73418
|
str = str.slice(0, completeQuads);
|
|
73313
|
-
return
|
|
73419
|
+
return Buffer2.from(str, "base64");
|
|
73314
73420
|
};
|
|
73315
73421
|
InternalEncoderBase64.prototype.end = function() {
|
|
73316
|
-
return
|
|
73422
|
+
return Buffer2.from(this.prevStr, "base64");
|
|
73317
73423
|
};
|
|
73318
73424
|
function InternalEncoderCesu8(options, codec2) {
|
|
73319
73425
|
}
|
|
73320
73426
|
InternalEncoderCesu8.prototype.write = function(str) {
|
|
73321
|
-
var buf =
|
|
73427
|
+
var buf = Buffer2.alloc(str.length * 3);
|
|
73322
73428
|
var bufIdx = 0;
|
|
73323
73429
|
for (var i = 0; i < str.length; i++) {
|
|
73324
73430
|
var charCode = str.charCodeAt(i);
|
|
@@ -73414,13 +73520,13 @@ var require_internal = __commonJS({
|
|
|
73414
73520
|
str = str.slice(0, str.length - 1);
|
|
73415
73521
|
}
|
|
73416
73522
|
}
|
|
73417
|
-
return
|
|
73523
|
+
return Buffer2.from(str, this.enc);
|
|
73418
73524
|
};
|
|
73419
73525
|
InternalEncoderUtf8.prototype.end = function() {
|
|
73420
73526
|
if (this.highSurrogate) {
|
|
73421
73527
|
var str = this.highSurrogate;
|
|
73422
73528
|
this.highSurrogate = "";
|
|
73423
|
-
return
|
|
73529
|
+
return Buffer2.from(str, this.enc);
|
|
73424
73530
|
}
|
|
73425
73531
|
};
|
|
73426
73532
|
}
|
|
@@ -73430,7 +73536,7 @@ var require_internal = __commonJS({
|
|
|
73430
73536
|
var require_utf32 = __commonJS({
|
|
73431
73537
|
"../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/utf32.js"(exports2) {
|
|
73432
73538
|
"use strict";
|
|
73433
|
-
var
|
|
73539
|
+
var Buffer2 = require_safer().Buffer;
|
|
73434
73540
|
exports2._utf32 = Utf32Codec;
|
|
73435
73541
|
function Utf32Codec(codecOptions, iconv2) {
|
|
73436
73542
|
this.iconv = iconv2;
|
|
@@ -73448,8 +73554,8 @@ var require_utf32 = __commonJS({
|
|
|
73448
73554
|
this.highSurrogate = 0;
|
|
73449
73555
|
}
|
|
73450
73556
|
Utf32Encoder.prototype.write = function(str) {
|
|
73451
|
-
var src =
|
|
73452
|
-
var dst =
|
|
73557
|
+
var src = Buffer2.from(str, "ucs2");
|
|
73558
|
+
var dst = Buffer2.alloc(src.length * 2);
|
|
73453
73559
|
var write32 = this.isLE ? dst.writeUInt32LE : dst.writeUInt32BE;
|
|
73454
73560
|
var offset = 0;
|
|
73455
73561
|
for (var i = 0; i < src.length; i += 2) {
|
|
@@ -73485,7 +73591,7 @@ var require_utf32 = __commonJS({
|
|
|
73485
73591
|
if (!this.highSurrogate) {
|
|
73486
73592
|
return;
|
|
73487
73593
|
}
|
|
73488
|
-
var buf =
|
|
73594
|
+
var buf = Buffer2.alloc(4);
|
|
73489
73595
|
if (this.isLE) {
|
|
73490
73596
|
buf.writeUInt32LE(this.highSurrogate, 0);
|
|
73491
73597
|
} else {
|
|
@@ -73505,7 +73611,7 @@ var require_utf32 = __commonJS({
|
|
|
73505
73611
|
}
|
|
73506
73612
|
var i = 0;
|
|
73507
73613
|
var codepoint = 0;
|
|
73508
|
-
var dst =
|
|
73614
|
+
var dst = Buffer2.alloc(src.length + 4);
|
|
73509
73615
|
var offset = 0;
|
|
73510
73616
|
var isLE = this.isLE;
|
|
73511
73617
|
var overflow = this.overflow;
|
|
@@ -73661,7 +73767,7 @@ var require_utf32 = __commonJS({
|
|
|
73661
73767
|
var require_utf16 = __commonJS({
|
|
73662
73768
|
"../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/utf16.js"(exports2) {
|
|
73663
73769
|
"use strict";
|
|
73664
|
-
var
|
|
73770
|
+
var Buffer2 = require_safer().Buffer;
|
|
73665
73771
|
exports2.utf16be = Utf16BECodec;
|
|
73666
73772
|
function Utf16BECodec() {
|
|
73667
73773
|
}
|
|
@@ -73671,7 +73777,7 @@ var require_utf16 = __commonJS({
|
|
|
73671
73777
|
function Utf16BEEncoder() {
|
|
73672
73778
|
}
|
|
73673
73779
|
Utf16BEEncoder.prototype.write = function(str) {
|
|
73674
|
-
var buf =
|
|
73780
|
+
var buf = Buffer2.from(str, "ucs2");
|
|
73675
73781
|
for (var i = 0; i < buf.length; i += 2) {
|
|
73676
73782
|
var tmp = buf[i];
|
|
73677
73783
|
buf[i] = buf[i + 1];
|
|
@@ -73688,7 +73794,7 @@ var require_utf16 = __commonJS({
|
|
|
73688
73794
|
if (buf.length == 0) {
|
|
73689
73795
|
return "";
|
|
73690
73796
|
}
|
|
73691
|
-
var buf2 =
|
|
73797
|
+
var buf2 = Buffer2.alloc(buf.length + 1);
|
|
73692
73798
|
var i = 0;
|
|
73693
73799
|
var j = 0;
|
|
73694
73800
|
if (this.overflowByte !== -1) {
|
|
@@ -73804,7 +73910,7 @@ var require_utf16 = __commonJS({
|
|
|
73804
73910
|
var require_utf7 = __commonJS({
|
|
73805
73911
|
"../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/utf7.js"(exports2) {
|
|
73806
73912
|
"use strict";
|
|
73807
|
-
var
|
|
73913
|
+
var Buffer2 = require_safer().Buffer;
|
|
73808
73914
|
exports2.utf7 = Utf7Codec;
|
|
73809
73915
|
exports2.unicode11utf7 = "utf7";
|
|
73810
73916
|
function Utf7Codec(codecOptions, iconv2) {
|
|
@@ -73818,7 +73924,7 @@ var require_utf7 = __commonJS({
|
|
|
73818
73924
|
this.iconv = codec2.iconv;
|
|
73819
73925
|
}
|
|
73820
73926
|
Utf7Encoder.prototype.write = function(str) {
|
|
73821
|
-
return
|
|
73927
|
+
return Buffer2.from(str.replace(nonDirectChars, function(chunk) {
|
|
73822
73928
|
return "+" + (chunk === "+" ? "" : this.iconv.encode(chunk, "utf16-be").toString("base64").replace(/=+$/, "")) + "-";
|
|
73823
73929
|
}.bind(this)));
|
|
73824
73930
|
};
|
|
@@ -73856,7 +73962,7 @@ var require_utf7 = __commonJS({
|
|
|
73856
73962
|
res += "+";
|
|
73857
73963
|
} else {
|
|
73858
73964
|
var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i2), "ascii");
|
|
73859
|
-
res += this.iconv.decode(
|
|
73965
|
+
res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
|
|
73860
73966
|
}
|
|
73861
73967
|
if (buf[i2] != minusChar) {
|
|
73862
73968
|
i2--;
|
|
@@ -73874,7 +73980,7 @@ var require_utf7 = __commonJS({
|
|
|
73874
73980
|
var canBeDecoded = b64str.length - b64str.length % 8;
|
|
73875
73981
|
base64Accum = b64str.slice(canBeDecoded);
|
|
73876
73982
|
b64str = b64str.slice(0, canBeDecoded);
|
|
73877
|
-
res += this.iconv.decode(
|
|
73983
|
+
res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
|
|
73878
73984
|
}
|
|
73879
73985
|
this.inBase64 = inBase64;
|
|
73880
73986
|
this.base64Accum = base64Accum;
|
|
@@ -73883,7 +73989,7 @@ var require_utf7 = __commonJS({
|
|
|
73883
73989
|
Utf7Decoder.prototype.end = function() {
|
|
73884
73990
|
var res = "";
|
|
73885
73991
|
if (this.inBase64 && this.base64Accum.length > 0) {
|
|
73886
|
-
res = this.iconv.decode(
|
|
73992
|
+
res = this.iconv.decode(Buffer2.from(this.base64Accum, "base64"), "utf16-be");
|
|
73887
73993
|
}
|
|
73888
73994
|
this.inBase64 = false;
|
|
73889
73995
|
this.base64Accum = "";
|
|
@@ -73899,14 +74005,14 @@ var require_utf7 = __commonJS({
|
|
|
73899
74005
|
function Utf7IMAPEncoder(options, codec2) {
|
|
73900
74006
|
this.iconv = codec2.iconv;
|
|
73901
74007
|
this.inBase64 = false;
|
|
73902
|
-
this.base64Accum =
|
|
74008
|
+
this.base64Accum = Buffer2.alloc(6);
|
|
73903
74009
|
this.base64AccumIdx = 0;
|
|
73904
74010
|
}
|
|
73905
74011
|
Utf7IMAPEncoder.prototype.write = function(str) {
|
|
73906
74012
|
var inBase64 = this.inBase64;
|
|
73907
74013
|
var base64Accum = this.base64Accum;
|
|
73908
74014
|
var base64AccumIdx = this.base64AccumIdx;
|
|
73909
|
-
var buf =
|
|
74015
|
+
var buf = Buffer2.alloc(str.length * 5 + 10);
|
|
73910
74016
|
var bufIdx = 0;
|
|
73911
74017
|
for (var i2 = 0; i2 < str.length; i2++) {
|
|
73912
74018
|
var uChar = str.charCodeAt(i2);
|
|
@@ -73945,7 +74051,7 @@ var require_utf7 = __commonJS({
|
|
|
73945
74051
|
return buf.slice(0, bufIdx);
|
|
73946
74052
|
};
|
|
73947
74053
|
Utf7IMAPEncoder.prototype.end = function() {
|
|
73948
|
-
var buf =
|
|
74054
|
+
var buf = Buffer2.alloc(10);
|
|
73949
74055
|
var bufIdx = 0;
|
|
73950
74056
|
if (this.inBase64) {
|
|
73951
74057
|
if (this.base64AccumIdx > 0) {
|
|
@@ -73982,7 +74088,7 @@ var require_utf7 = __commonJS({
|
|
|
73982
74088
|
res += "&";
|
|
73983
74089
|
} else {
|
|
73984
74090
|
var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i2), "ascii").replace(/,/g, "/");
|
|
73985
|
-
res += this.iconv.decode(
|
|
74091
|
+
res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
|
|
73986
74092
|
}
|
|
73987
74093
|
if (buf[i2] != minusChar) {
|
|
73988
74094
|
i2--;
|
|
@@ -74000,7 +74106,7 @@ var require_utf7 = __commonJS({
|
|
|
74000
74106
|
var canBeDecoded = b64str.length - b64str.length % 8;
|
|
74001
74107
|
base64Accum = b64str.slice(canBeDecoded);
|
|
74002
74108
|
b64str = b64str.slice(0, canBeDecoded);
|
|
74003
|
-
res += this.iconv.decode(
|
|
74109
|
+
res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
|
|
74004
74110
|
}
|
|
74005
74111
|
this.inBase64 = inBase64;
|
|
74006
74112
|
this.base64Accum = base64Accum;
|
|
@@ -74009,7 +74115,7 @@ var require_utf7 = __commonJS({
|
|
|
74009
74115
|
Utf7IMAPDecoder.prototype.end = function() {
|
|
74010
74116
|
var res = "";
|
|
74011
74117
|
if (this.inBase64 && this.base64Accum.length > 0) {
|
|
74012
|
-
res = this.iconv.decode(
|
|
74118
|
+
res = this.iconv.decode(Buffer2.from(this.base64Accum, "base64"), "utf16-be");
|
|
74013
74119
|
}
|
|
74014
74120
|
this.inBase64 = false;
|
|
74015
74121
|
this.base64Accum = "";
|
|
@@ -74022,7 +74128,7 @@ var require_utf7 = __commonJS({
|
|
|
74022
74128
|
var require_sbcs_codec = __commonJS({
|
|
74023
74129
|
"../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/sbcs-codec.js"(exports2) {
|
|
74024
74130
|
"use strict";
|
|
74025
|
-
var
|
|
74131
|
+
var Buffer2 = require_safer().Buffer;
|
|
74026
74132
|
exports2._sbcs = SBCSCodec;
|
|
74027
74133
|
function SBCSCodec(codecOptions, iconv2) {
|
|
74028
74134
|
if (!codecOptions) {
|
|
@@ -74038,8 +74144,8 @@ var require_sbcs_codec = __commonJS({
|
|
|
74038
74144
|
}
|
|
74039
74145
|
codecOptions.chars = asciiString + codecOptions.chars;
|
|
74040
74146
|
}
|
|
74041
|
-
this.decodeBuf =
|
|
74042
|
-
var encodeBuf =
|
|
74147
|
+
this.decodeBuf = Buffer2.from(codecOptions.chars, "ucs2");
|
|
74148
|
+
var encodeBuf = Buffer2.alloc(65536, iconv2.defaultCharSingleByte.charCodeAt(0));
|
|
74043
74149
|
for (var i = 0; i < codecOptions.chars.length; i++) {
|
|
74044
74150
|
encodeBuf[codecOptions.chars.charCodeAt(i)] = i;
|
|
74045
74151
|
}
|
|
@@ -74051,7 +74157,7 @@ var require_sbcs_codec = __commonJS({
|
|
|
74051
74157
|
this.encodeBuf = codec2.encodeBuf;
|
|
74052
74158
|
}
|
|
74053
74159
|
SBCSEncoder.prototype.write = function(str) {
|
|
74054
|
-
var buf =
|
|
74160
|
+
var buf = Buffer2.alloc(str.length);
|
|
74055
74161
|
for (var i = 0; i < str.length; i++) {
|
|
74056
74162
|
buf[i] = this.encodeBuf[str.charCodeAt(i)];
|
|
74057
74163
|
}
|
|
@@ -74064,7 +74170,7 @@ var require_sbcs_codec = __commonJS({
|
|
|
74064
74170
|
}
|
|
74065
74171
|
SBCSDecoder.prototype.write = function(buf) {
|
|
74066
74172
|
var decodeBuf = this.decodeBuf;
|
|
74067
|
-
var newBuf =
|
|
74173
|
+
var newBuf = Buffer2.alloc(buf.length * 2);
|
|
74068
74174
|
var idx1 = 0;
|
|
74069
74175
|
var idx2 = 0;
|
|
74070
74176
|
for (var i = 0; i < buf.length; i++) {
|
|
@@ -74692,7 +74798,7 @@ var require_sbcs_data_generated = __commonJS({
|
|
|
74692
74798
|
var require_dbcs_codec = __commonJS({
|
|
74693
74799
|
"../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/dbcs-codec.js"(exports2) {
|
|
74694
74800
|
"use strict";
|
|
74695
|
-
var
|
|
74801
|
+
var Buffer2 = require_safer().Buffer;
|
|
74696
74802
|
exports2._dbcs = DBCSCodec;
|
|
74697
74803
|
var UNASSIGNED = -1;
|
|
74698
74804
|
var GB18030_CODE = -2;
|
|
@@ -74928,7 +75034,7 @@ var require_dbcs_codec = __commonJS({
|
|
|
74928
75034
|
this.gb18030 = codec2.gb18030;
|
|
74929
75035
|
}
|
|
74930
75036
|
DBCSEncoder.prototype.write = function(str) {
|
|
74931
|
-
var newBuf =
|
|
75037
|
+
var newBuf = Buffer2.alloc(str.length * (this.gb18030 ? 4 : 3));
|
|
74932
75038
|
var leadSurrogate = this.leadSurrogate;
|
|
74933
75039
|
var seqObj = this.seqObj;
|
|
74934
75040
|
var nextChar = -1;
|
|
@@ -75032,7 +75138,7 @@ var require_dbcs_codec = __commonJS({
|
|
|
75032
75138
|
if (this.leadSurrogate === -1 && this.seqObj === void 0) {
|
|
75033
75139
|
return;
|
|
75034
75140
|
}
|
|
75035
|
-
var newBuf =
|
|
75141
|
+
var newBuf = Buffer2.alloc(10);
|
|
75036
75142
|
var j = 0;
|
|
75037
75143
|
if (this.seqObj) {
|
|
75038
75144
|
var dbcsCode = this.seqObj[DEF_CHAR];
|
|
@@ -75063,7 +75169,7 @@ var require_dbcs_codec = __commonJS({
|
|
|
75063
75169
|
this.gb18030 = codec2.gb18030;
|
|
75064
75170
|
}
|
|
75065
75171
|
DBCSDecoder.prototype.write = function(buf) {
|
|
75066
|
-
var newBuf =
|
|
75172
|
+
var newBuf = Buffer2.alloc(buf.length * 2);
|
|
75067
75173
|
var nodeIdx = this.nodeIdx;
|
|
75068
75174
|
var prevBytes = this.prevBytes;
|
|
75069
75175
|
var prevOffset = this.prevBytes.length;
|
|
@@ -76672,7 +76778,7 @@ var require_encodings = __commonJS({
|
|
|
76672
76778
|
var require_streams = __commonJS({
|
|
76673
76779
|
"../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/lib/streams.js"(exports2, module2) {
|
|
76674
76780
|
"use strict";
|
|
76675
|
-
var
|
|
76781
|
+
var Buffer2 = require_safer().Buffer;
|
|
76676
76782
|
module2.exports = function(streamModule) {
|
|
76677
76783
|
var Transform = streamModule.Transform;
|
|
76678
76784
|
function IconvLiteEncoderStream(conv, options) {
|
|
@@ -76712,7 +76818,7 @@ var require_streams = __commonJS({
|
|
|
76712
76818
|
chunks.push(chunk);
|
|
76713
76819
|
});
|
|
76714
76820
|
this.on("end", function() {
|
|
76715
|
-
cb(null,
|
|
76821
|
+
cb(null, Buffer2.concat(chunks));
|
|
76716
76822
|
});
|
|
76717
76823
|
return this;
|
|
76718
76824
|
};
|
|
@@ -76726,7 +76832,7 @@ var require_streams = __commonJS({
|
|
|
76726
76832
|
constructor: { value: IconvLiteDecoderStream }
|
|
76727
76833
|
});
|
|
76728
76834
|
IconvLiteDecoderStream.prototype._transform = function(chunk, encoding, done) {
|
|
76729
|
-
if (!
|
|
76835
|
+
if (!Buffer2.isBuffer(chunk) && !(chunk instanceof Uint8Array)) {
|
|
76730
76836
|
return done(new Error("Iconv decoding stream needs buffers as its input."));
|
|
76731
76837
|
}
|
|
76732
76838
|
try {
|
|
@@ -76769,7 +76875,7 @@ var require_streams = __commonJS({
|
|
|
76769
76875
|
var require_lib2 = __commonJS({
|
|
76770
76876
|
"../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/lib/index.js"(exports2, module2) {
|
|
76771
76877
|
"use strict";
|
|
76772
|
-
var
|
|
76878
|
+
var Buffer2 = require_safer().Buffer;
|
|
76773
76879
|
var bomHandling = require_bom_handling();
|
|
76774
76880
|
var mergeModules = require_merge_exports();
|
|
76775
76881
|
module2.exports.encodings = null;
|
|
@@ -76780,7 +76886,7 @@ var require_lib2 = __commonJS({
|
|
|
76780
76886
|
var encoder = module2.exports.getEncoder(encoding, options);
|
|
76781
76887
|
var res = encoder.write(str);
|
|
76782
76888
|
var trail = encoder.end();
|
|
76783
|
-
return trail && trail.length > 0 ?
|
|
76889
|
+
return trail && trail.length > 0 ? Buffer2.concat([res, trail]) : res;
|
|
76784
76890
|
};
|
|
76785
76891
|
module2.exports.decode = function decode3(buf, encoding, options) {
|
|
76786
76892
|
if (typeof buf === "string") {
|
|
@@ -76788,7 +76894,7 @@ var require_lib2 = __commonJS({
|
|
|
76788
76894
|
console.error("Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding");
|
|
76789
76895
|
module2.exports.skipDecodeWarning = true;
|
|
76790
76896
|
}
|
|
76791
|
-
buf =
|
|
76897
|
+
buf = Buffer2.from("" + (buf || ""), "binary");
|
|
76792
76898
|
}
|
|
76793
76899
|
var decoder = module2.exports.getDecoder(encoding, options);
|
|
76794
76900
|
var res = decoder.write(buf);
|
|
@@ -77508,9 +77614,9 @@ var init_prompt = __esm({
|
|
|
77508
77614
|
init_utils();
|
|
77509
77615
|
init_baseUI();
|
|
77510
77616
|
_ = {
|
|
77511
|
-
set: (obj,
|
|
77617
|
+
set: (obj, path35 = "", value) => {
|
|
77512
77618
|
let pointer = obj;
|
|
77513
|
-
|
|
77619
|
+
path35.split(".").forEach((key, index, arr) => {
|
|
77514
77620
|
if (key === "__proto__" || key === "constructor") return;
|
|
77515
77621
|
if (index === arr.length - 1) {
|
|
77516
77622
|
pointer[key] = value;
|
|
@@ -77520,8 +77626,8 @@ var init_prompt = __esm({
|
|
|
77520
77626
|
pointer = pointer[key];
|
|
77521
77627
|
});
|
|
77522
77628
|
},
|
|
77523
|
-
get: (obj,
|
|
77524
|
-
const travel = (regexp) => String.prototype.split.call(
|
|
77629
|
+
get: (obj, path35 = "", defaultValue) => {
|
|
77630
|
+
const travel = (regexp) => String.prototype.split.call(path35, regexp).filter(Boolean).reduce(
|
|
77525
77631
|
// @ts-expect-error implicit any on res[key]
|
|
77526
77632
|
(res, key) => res !== null && res !== void 0 ? res[key] : res,
|
|
77527
77633
|
obj
|
|
@@ -77837,7 +77943,7 @@ var init_mjs = __esm({
|
|
|
77837
77943
|
"../../node_modules/signal-exit/dist/mjs/index.js"() {
|
|
77838
77944
|
"use strict";
|
|
77839
77945
|
init_signals();
|
|
77840
|
-
processOk = (
|
|
77946
|
+
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";
|
|
77841
77947
|
kExitEmitter = /* @__PURE__ */ Symbol.for("signal-exit emitter");
|
|
77842
77948
|
global2 = globalThis;
|
|
77843
77949
|
ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
@@ -77930,15 +78036,15 @@ var init_mjs = __esm({
|
|
|
77930
78036
|
#originalProcessReallyExit;
|
|
77931
78037
|
#sigListeners = {};
|
|
77932
78038
|
#loaded = false;
|
|
77933
|
-
constructor(
|
|
78039
|
+
constructor(process13) {
|
|
77934
78040
|
super();
|
|
77935
|
-
this.#process =
|
|
78041
|
+
this.#process = process13;
|
|
77936
78042
|
this.#sigListeners = {};
|
|
77937
78043
|
for (const sig of signals) {
|
|
77938
78044
|
this.#sigListeners[sig] = () => {
|
|
77939
78045
|
const listeners = this.#process.listeners(sig);
|
|
77940
78046
|
let { count } = this.#emitter;
|
|
77941
|
-
const p =
|
|
78047
|
+
const p = process13;
|
|
77942
78048
|
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
|
|
77943
78049
|
count += p.__signal_exit_emitter__.count;
|
|
77944
78050
|
}
|
|
@@ -77947,12 +78053,12 @@ var init_mjs = __esm({
|
|
|
77947
78053
|
const ret = this.#emitter.emit("exit", null, sig);
|
|
77948
78054
|
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
77949
78055
|
if (!ret)
|
|
77950
|
-
|
|
78056
|
+
process13.kill(process13.pid, s);
|
|
77951
78057
|
}
|
|
77952
78058
|
};
|
|
77953
78059
|
}
|
|
77954
|
-
this.#originalProcessReallyExit =
|
|
77955
|
-
this.#originalProcessEmit =
|
|
78060
|
+
this.#originalProcessReallyExit = process13.reallyExit;
|
|
78061
|
+
this.#originalProcessEmit = process13.emit;
|
|
77956
78062
|
}
|
|
77957
78063
|
onExit(cb, opts) {
|
|
77958
78064
|
if (!processOk(this.#process)) {
|
|
@@ -78797,585 +78903,6 @@ var init_ora = __esm({
|
|
|
78797
78903
|
}
|
|
78798
78904
|
});
|
|
78799
78905
|
|
|
78800
|
-
// ../../node_modules/is-docker/index.js
|
|
78801
|
-
function hasDockerEnv() {
|
|
78802
|
-
try {
|
|
78803
|
-
import_node_fs3.default.statSync("/.dockerenv");
|
|
78804
|
-
return true;
|
|
78805
|
-
} catch {
|
|
78806
|
-
return false;
|
|
78807
|
-
}
|
|
78808
|
-
}
|
|
78809
|
-
function hasDockerCGroup() {
|
|
78810
|
-
try {
|
|
78811
|
-
return import_node_fs3.default.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
|
|
78812
|
-
} catch {
|
|
78813
|
-
return false;
|
|
78814
|
-
}
|
|
78815
|
-
}
|
|
78816
|
-
function isDocker() {
|
|
78817
|
-
if (isDockerCached === void 0) {
|
|
78818
|
-
isDockerCached = hasDockerEnv() || hasDockerCGroup();
|
|
78819
|
-
}
|
|
78820
|
-
return isDockerCached;
|
|
78821
|
-
}
|
|
78822
|
-
var import_node_fs3, isDockerCached;
|
|
78823
|
-
var init_is_docker = __esm({
|
|
78824
|
-
"../../node_modules/is-docker/index.js"() {
|
|
78825
|
-
"use strict";
|
|
78826
|
-
import_node_fs3 = __toESM(require("fs"), 1);
|
|
78827
|
-
}
|
|
78828
|
-
});
|
|
78829
|
-
|
|
78830
|
-
// ../../node_modules/is-inside-container/index.js
|
|
78831
|
-
function isInsideContainer() {
|
|
78832
|
-
if (cachedResult === void 0) {
|
|
78833
|
-
cachedResult = hasContainerEnv() || isDocker();
|
|
78834
|
-
}
|
|
78835
|
-
return cachedResult;
|
|
78836
|
-
}
|
|
78837
|
-
var import_node_fs4, cachedResult, hasContainerEnv;
|
|
78838
|
-
var init_is_inside_container = __esm({
|
|
78839
|
-
"../../node_modules/is-inside-container/index.js"() {
|
|
78840
|
-
"use strict";
|
|
78841
|
-
import_node_fs4 = __toESM(require("fs"), 1);
|
|
78842
|
-
init_is_docker();
|
|
78843
|
-
hasContainerEnv = () => {
|
|
78844
|
-
try {
|
|
78845
|
-
import_node_fs4.default.statSync("/run/.containerenv");
|
|
78846
|
-
return true;
|
|
78847
|
-
} catch {
|
|
78848
|
-
return false;
|
|
78849
|
-
}
|
|
78850
|
-
};
|
|
78851
|
-
}
|
|
78852
|
-
});
|
|
78853
|
-
|
|
78854
|
-
// ../../node_modules/is-wsl/index.js
|
|
78855
|
-
var import_node_process10, import_node_os5, import_node_fs5, isWsl, is_wsl_default;
|
|
78856
|
-
var init_is_wsl = __esm({
|
|
78857
|
-
"../../node_modules/is-wsl/index.js"() {
|
|
78858
|
-
"use strict";
|
|
78859
|
-
import_node_process10 = __toESM(require("process"), 1);
|
|
78860
|
-
import_node_os5 = __toESM(require("os"), 1);
|
|
78861
|
-
import_node_fs5 = __toESM(require("fs"), 1);
|
|
78862
|
-
init_is_inside_container();
|
|
78863
|
-
isWsl = () => {
|
|
78864
|
-
if (import_node_process10.default.platform !== "linux") {
|
|
78865
|
-
return false;
|
|
78866
|
-
}
|
|
78867
|
-
if (import_node_os5.default.release().toLowerCase().includes("microsoft")) {
|
|
78868
|
-
if (isInsideContainer()) {
|
|
78869
|
-
return false;
|
|
78870
|
-
}
|
|
78871
|
-
return true;
|
|
78872
|
-
}
|
|
78873
|
-
try {
|
|
78874
|
-
if (import_node_fs5.default.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft")) {
|
|
78875
|
-
return !isInsideContainer();
|
|
78876
|
-
}
|
|
78877
|
-
} catch {
|
|
78878
|
-
}
|
|
78879
|
-
if (import_node_fs5.default.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || import_node_fs5.default.existsSync("/run/WSL")) {
|
|
78880
|
-
return !isInsideContainer();
|
|
78881
|
-
}
|
|
78882
|
-
return false;
|
|
78883
|
-
};
|
|
78884
|
-
is_wsl_default = import_node_process10.default.env.__IS_WSL_TEST__ ? isWsl : isWsl();
|
|
78885
|
-
}
|
|
78886
|
-
});
|
|
78887
|
-
|
|
78888
|
-
// ../../node_modules/wsl-utils/index.js
|
|
78889
|
-
var import_node_process11, import_promises4, wslDrivesMountPoint, powerShellPathFromWsl, powerShellPath;
|
|
78890
|
-
var init_wsl_utils = __esm({
|
|
78891
|
-
"../../node_modules/wsl-utils/index.js"() {
|
|
78892
|
-
"use strict";
|
|
78893
|
-
import_node_process11 = __toESM(require("process"), 1);
|
|
78894
|
-
import_promises4 = __toESM(require("fs/promises"), 1);
|
|
78895
|
-
init_is_wsl();
|
|
78896
|
-
init_is_wsl();
|
|
78897
|
-
wslDrivesMountPoint = /* @__PURE__ */ (() => {
|
|
78898
|
-
const defaultMountPoint = "/mnt/";
|
|
78899
|
-
let mountPoint;
|
|
78900
|
-
return async function() {
|
|
78901
|
-
if (mountPoint) {
|
|
78902
|
-
return mountPoint;
|
|
78903
|
-
}
|
|
78904
|
-
const configFilePath = "/etc/wsl.conf";
|
|
78905
|
-
let isConfigFileExists = false;
|
|
78906
|
-
try {
|
|
78907
|
-
await import_promises4.default.access(configFilePath, import_promises4.constants.F_OK);
|
|
78908
|
-
isConfigFileExists = true;
|
|
78909
|
-
} catch {
|
|
78910
|
-
}
|
|
78911
|
-
if (!isConfigFileExists) {
|
|
78912
|
-
return defaultMountPoint;
|
|
78913
|
-
}
|
|
78914
|
-
const configContent = await import_promises4.default.readFile(configFilePath, { encoding: "utf8" });
|
|
78915
|
-
const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
|
|
78916
|
-
if (!configMountPoint) {
|
|
78917
|
-
return defaultMountPoint;
|
|
78918
|
-
}
|
|
78919
|
-
mountPoint = configMountPoint.groups.mountPoint.trim();
|
|
78920
|
-
mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
|
|
78921
|
-
return mountPoint;
|
|
78922
|
-
};
|
|
78923
|
-
})();
|
|
78924
|
-
powerShellPathFromWsl = async () => {
|
|
78925
|
-
const mountPoint = await wslDrivesMountPoint();
|
|
78926
|
-
return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
|
|
78927
|
-
};
|
|
78928
|
-
powerShellPath = async () => {
|
|
78929
|
-
if (is_wsl_default) {
|
|
78930
|
-
return powerShellPathFromWsl();
|
|
78931
|
-
}
|
|
78932
|
-
return `${import_node_process11.default.env.SYSTEMROOT || import_node_process11.default.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
|
|
78933
|
-
};
|
|
78934
|
-
}
|
|
78935
|
-
});
|
|
78936
|
-
|
|
78937
|
-
// ../../node_modules/define-lazy-prop/index.js
|
|
78938
|
-
function defineLazyProperty(object2, propertyName, valueGetter) {
|
|
78939
|
-
const define = (value) => Object.defineProperty(object2, propertyName, { value, enumerable: true, writable: true });
|
|
78940
|
-
Object.defineProperty(object2, propertyName, {
|
|
78941
|
-
configurable: true,
|
|
78942
|
-
enumerable: true,
|
|
78943
|
-
get() {
|
|
78944
|
-
const result = valueGetter();
|
|
78945
|
-
define(result);
|
|
78946
|
-
return result;
|
|
78947
|
-
},
|
|
78948
|
-
set(value) {
|
|
78949
|
-
define(value);
|
|
78950
|
-
}
|
|
78951
|
-
});
|
|
78952
|
-
return object2;
|
|
78953
|
-
}
|
|
78954
|
-
var init_define_lazy_prop = __esm({
|
|
78955
|
-
"../../node_modules/define-lazy-prop/index.js"() {
|
|
78956
|
-
"use strict";
|
|
78957
|
-
}
|
|
78958
|
-
});
|
|
78959
|
-
|
|
78960
|
-
// ../../node_modules/default-browser-id/index.js
|
|
78961
|
-
async function defaultBrowserId() {
|
|
78962
|
-
if (import_node_process12.default.platform !== "darwin") {
|
|
78963
|
-
throw new Error("macOS only");
|
|
78964
|
-
}
|
|
78965
|
-
const { stdout } = await execFileAsync("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
|
|
78966
|
-
const match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
|
|
78967
|
-
const browserId = match?.groups.id ?? "com.apple.Safari";
|
|
78968
|
-
if (browserId === "com.apple.safari") {
|
|
78969
|
-
return "com.apple.Safari";
|
|
78970
|
-
}
|
|
78971
|
-
return browserId;
|
|
78972
|
-
}
|
|
78973
|
-
var import_node_util, import_node_process12, import_node_child_process, execFileAsync;
|
|
78974
|
-
var init_default_browser_id = __esm({
|
|
78975
|
-
"../../node_modules/default-browser-id/index.js"() {
|
|
78976
|
-
"use strict";
|
|
78977
|
-
import_node_util = require("util");
|
|
78978
|
-
import_node_process12 = __toESM(require("process"), 1);
|
|
78979
|
-
import_node_child_process = require("child_process");
|
|
78980
|
-
execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
|
|
78981
|
-
}
|
|
78982
|
-
});
|
|
78983
|
-
|
|
78984
|
-
// ../../node_modules/run-applescript/index.js
|
|
78985
|
-
async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
|
|
78986
|
-
if (import_node_process13.default.platform !== "darwin") {
|
|
78987
|
-
throw new Error("macOS only");
|
|
78988
|
-
}
|
|
78989
|
-
const outputArguments = humanReadableOutput ? [] : ["-ss"];
|
|
78990
|
-
const execOptions = {};
|
|
78991
|
-
if (signal) {
|
|
78992
|
-
execOptions.signal = signal;
|
|
78993
|
-
}
|
|
78994
|
-
const { stdout } = await execFileAsync2("osascript", ["-e", script, outputArguments], execOptions);
|
|
78995
|
-
return stdout.trim();
|
|
78996
|
-
}
|
|
78997
|
-
var import_node_process13, import_node_util2, import_node_child_process2, execFileAsync2;
|
|
78998
|
-
var init_run_applescript = __esm({
|
|
78999
|
-
"../../node_modules/run-applescript/index.js"() {
|
|
79000
|
-
"use strict";
|
|
79001
|
-
import_node_process13 = __toESM(require("process"), 1);
|
|
79002
|
-
import_node_util2 = require("util");
|
|
79003
|
-
import_node_child_process2 = require("child_process");
|
|
79004
|
-
execFileAsync2 = (0, import_node_util2.promisify)(import_node_child_process2.execFile);
|
|
79005
|
-
}
|
|
79006
|
-
});
|
|
79007
|
-
|
|
79008
|
-
// ../../node_modules/bundle-name/index.js
|
|
79009
|
-
async function bundleName(bundleId) {
|
|
79010
|
-
return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string
|
|
79011
|
-
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
|
|
79012
|
-
}
|
|
79013
|
-
var init_bundle_name = __esm({
|
|
79014
|
-
"../../node_modules/bundle-name/index.js"() {
|
|
79015
|
-
"use strict";
|
|
79016
|
-
init_run_applescript();
|
|
79017
|
-
}
|
|
79018
|
-
});
|
|
79019
|
-
|
|
79020
|
-
// ../../node_modules/default-browser/windows.js
|
|
79021
|
-
async function defaultBrowser(_execFileAsync = execFileAsync3) {
|
|
79022
|
-
const { stdout } = await _execFileAsync("reg", [
|
|
79023
|
-
"QUERY",
|
|
79024
|
-
" HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
|
|
79025
|
-
"/v",
|
|
79026
|
-
"ProgId"
|
|
79027
|
-
]);
|
|
79028
|
-
const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
|
|
79029
|
-
if (!match) {
|
|
79030
|
-
throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
|
|
79031
|
-
}
|
|
79032
|
-
const { id } = match.groups;
|
|
79033
|
-
const dotIndex = id.lastIndexOf(".");
|
|
79034
|
-
const hyphenIndex = id.lastIndexOf("-");
|
|
79035
|
-
const baseIdByDot = dotIndex === -1 ? void 0 : id.slice(0, dotIndex);
|
|
79036
|
-
const baseIdByHyphen = hyphenIndex === -1 ? void 0 : id.slice(0, hyphenIndex);
|
|
79037
|
-
return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? { name: id, id };
|
|
79038
|
-
}
|
|
79039
|
-
var import_node_util3, import_node_child_process3, execFileAsync3, windowsBrowserProgIds, _windowsBrowserProgIdMap, UnknownBrowserError;
|
|
79040
|
-
var init_windows = __esm({
|
|
79041
|
-
"../../node_modules/default-browser/windows.js"() {
|
|
79042
|
-
"use strict";
|
|
79043
|
-
import_node_util3 = require("util");
|
|
79044
|
-
import_node_child_process3 = require("child_process");
|
|
79045
|
-
execFileAsync3 = (0, import_node_util3.promisify)(import_node_child_process3.execFile);
|
|
79046
|
-
windowsBrowserProgIds = {
|
|
79047
|
-
MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
|
|
79048
|
-
// The missing `L` is correct.
|
|
79049
|
-
MSEdgeBHTML: { name: "Edge Beta", id: "com.microsoft.edge.beta" },
|
|
79050
|
-
MSEdgeDHTML: { name: "Edge Dev", id: "com.microsoft.edge.dev" },
|
|
79051
|
-
AppXq0fevzme2pys62n3e0fbqa7peapykr8v: { name: "Edge", id: "com.microsoft.edge.old" },
|
|
79052
|
-
ChromeHTML: { name: "Chrome", id: "com.google.chrome" },
|
|
79053
|
-
ChromeBHTML: { name: "Chrome Beta", id: "com.google.chrome.beta" },
|
|
79054
|
-
ChromeDHTML: { name: "Chrome Dev", id: "com.google.chrome.dev" },
|
|
79055
|
-
ChromiumHTM: { name: "Chromium", id: "org.chromium.Chromium" },
|
|
79056
|
-
BraveHTML: { name: "Brave", id: "com.brave.Browser" },
|
|
79057
|
-
BraveBHTML: { name: "Brave Beta", id: "com.brave.Browser.beta" },
|
|
79058
|
-
BraveDHTML: { name: "Brave Dev", id: "com.brave.Browser.dev" },
|
|
79059
|
-
BraveSSHTM: { name: "Brave Nightly", id: "com.brave.Browser.nightly" },
|
|
79060
|
-
FirefoxURL: { name: "Firefox", id: "org.mozilla.firefox" },
|
|
79061
|
-
OperaStable: { name: "Opera", id: "com.operasoftware.Opera" },
|
|
79062
|
-
VivaldiHTM: { name: "Vivaldi", id: "com.vivaldi.Vivaldi" },
|
|
79063
|
-
"IE.HTTP": { name: "Internet Explorer", id: "com.microsoft.ie" }
|
|
79064
|
-
};
|
|
79065
|
-
_windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
|
|
79066
|
-
UnknownBrowserError = class extends Error {
|
|
79067
|
-
};
|
|
79068
|
-
}
|
|
79069
|
-
});
|
|
79070
|
-
|
|
79071
|
-
// ../../node_modules/default-browser/index.js
|
|
79072
|
-
async function defaultBrowser2() {
|
|
79073
|
-
if (import_node_process14.default.platform === "darwin") {
|
|
79074
|
-
const id = await defaultBrowserId();
|
|
79075
|
-
const name = await bundleName(id);
|
|
79076
|
-
return { name, id };
|
|
79077
|
-
}
|
|
79078
|
-
if (import_node_process14.default.platform === "linux") {
|
|
79079
|
-
const { stdout } = await execFileAsync4("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
|
|
79080
|
-
const id = stdout.trim();
|
|
79081
|
-
const name = titleize(id.replace(/.desktop$/, "").replace("-", " "));
|
|
79082
|
-
return { name, id };
|
|
79083
|
-
}
|
|
79084
|
-
if (import_node_process14.default.platform === "win32") {
|
|
79085
|
-
return defaultBrowser();
|
|
79086
|
-
}
|
|
79087
|
-
throw new Error("Only macOS, Linux, and Windows are supported");
|
|
79088
|
-
}
|
|
79089
|
-
var import_node_util4, import_node_process14, import_node_child_process4, execFileAsync4, titleize;
|
|
79090
|
-
var init_default_browser = __esm({
|
|
79091
|
-
"../../node_modules/default-browser/index.js"() {
|
|
79092
|
-
"use strict";
|
|
79093
|
-
import_node_util4 = require("util");
|
|
79094
|
-
import_node_process14 = __toESM(require("process"), 1);
|
|
79095
|
-
import_node_child_process4 = require("child_process");
|
|
79096
|
-
init_default_browser_id();
|
|
79097
|
-
init_bundle_name();
|
|
79098
|
-
init_windows();
|
|
79099
|
-
execFileAsync4 = (0, import_node_util4.promisify)(import_node_child_process4.execFile);
|
|
79100
|
-
titleize = (string4) => string4.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
|
|
79101
|
-
}
|
|
79102
|
-
});
|
|
79103
|
-
|
|
79104
|
-
// ../../node_modules/open/index.js
|
|
79105
|
-
async function getWindowsDefaultBrowserFromWsl() {
|
|
79106
|
-
const powershellPath = await powerShellPath();
|
|
79107
|
-
const rawCommand = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
|
|
79108
|
-
const encodedCommand = import_node_buffer.Buffer.from(rawCommand, "utf16le").toString("base64");
|
|
79109
|
-
const { stdout } = await execFile5(
|
|
79110
|
-
powershellPath,
|
|
79111
|
-
[
|
|
79112
|
-
"-NoProfile",
|
|
79113
|
-
"-NonInteractive",
|
|
79114
|
-
"-ExecutionPolicy",
|
|
79115
|
-
"Bypass",
|
|
79116
|
-
"-EncodedCommand",
|
|
79117
|
-
encodedCommand
|
|
79118
|
-
],
|
|
79119
|
-
{ encoding: "utf8" }
|
|
79120
|
-
);
|
|
79121
|
-
const progId = stdout.trim();
|
|
79122
|
-
const browserMap = {
|
|
79123
|
-
ChromeHTML: "com.google.chrome",
|
|
79124
|
-
BraveHTML: "com.brave.Browser",
|
|
79125
|
-
MSEdgeHTM: "com.microsoft.edge",
|
|
79126
|
-
FirefoxURL: "org.mozilla.firefox"
|
|
79127
|
-
};
|
|
79128
|
-
return browserMap[progId] ? { id: browserMap[progId] } : {};
|
|
79129
|
-
}
|
|
79130
|
-
function detectArchBinary(binary) {
|
|
79131
|
-
if (typeof binary === "string" || Array.isArray(binary)) {
|
|
79132
|
-
return binary;
|
|
79133
|
-
}
|
|
79134
|
-
const { [arch3]: archBinary } = binary;
|
|
79135
|
-
if (!archBinary) {
|
|
79136
|
-
throw new Error(`${arch3} is not supported`);
|
|
79137
|
-
}
|
|
79138
|
-
return archBinary;
|
|
79139
|
-
}
|
|
79140
|
-
function detectPlatformBinary({ [platform11]: platformBinary }, { wsl }) {
|
|
79141
|
-
if (wsl && is_wsl_default) {
|
|
79142
|
-
return detectArchBinary(wsl);
|
|
79143
|
-
}
|
|
79144
|
-
if (!platformBinary) {
|
|
79145
|
-
throw new Error(`${platform11} is not supported`);
|
|
79146
|
-
}
|
|
79147
|
-
return detectArchBinary(platformBinary);
|
|
79148
|
-
}
|
|
79149
|
-
var import_node_process15, import_node_buffer, import_node_path3, import_node_url, import_node_util5, import_node_child_process5, import_promises5, import_meta, execFile5, __dirname2, localXdgOpenPath, platform11, arch3, pTryEach, baseOpen, open2, apps, open_default;
|
|
79150
|
-
var init_open = __esm({
|
|
79151
|
-
"../../node_modules/open/index.js"() {
|
|
79152
|
-
"use strict";
|
|
79153
|
-
import_node_process15 = __toESM(require("process"), 1);
|
|
79154
|
-
import_node_buffer = require("buffer");
|
|
79155
|
-
import_node_path3 = __toESM(require("path"), 1);
|
|
79156
|
-
import_node_url = require("url");
|
|
79157
|
-
import_node_util5 = require("util");
|
|
79158
|
-
import_node_child_process5 = __toESM(require("child_process"), 1);
|
|
79159
|
-
import_promises5 = __toESM(require("fs/promises"), 1);
|
|
79160
|
-
init_wsl_utils();
|
|
79161
|
-
init_define_lazy_prop();
|
|
79162
|
-
init_default_browser();
|
|
79163
|
-
init_is_inside_container();
|
|
79164
|
-
import_meta = {};
|
|
79165
|
-
execFile5 = (0, import_node_util5.promisify)(import_node_child_process5.default.execFile);
|
|
79166
|
-
__dirname2 = import_node_path3.default.dirname((0, import_node_url.fileURLToPath)(import_meta.url));
|
|
79167
|
-
localXdgOpenPath = import_node_path3.default.join(__dirname2, "xdg-open");
|
|
79168
|
-
({ platform: platform11, arch: arch3 } = import_node_process15.default);
|
|
79169
|
-
pTryEach = async (array2, mapper) => {
|
|
79170
|
-
let latestError;
|
|
79171
|
-
for (const item of array2) {
|
|
79172
|
-
try {
|
|
79173
|
-
return await mapper(item);
|
|
79174
|
-
} catch (error48) {
|
|
79175
|
-
latestError = error48;
|
|
79176
|
-
}
|
|
79177
|
-
}
|
|
79178
|
-
throw latestError;
|
|
79179
|
-
};
|
|
79180
|
-
baseOpen = async (options) => {
|
|
79181
|
-
options = {
|
|
79182
|
-
wait: false,
|
|
79183
|
-
background: false,
|
|
79184
|
-
newInstance: false,
|
|
79185
|
-
allowNonzeroExitCode: false,
|
|
79186
|
-
...options
|
|
79187
|
-
};
|
|
79188
|
-
if (Array.isArray(options.app)) {
|
|
79189
|
-
return pTryEach(options.app, (singleApp) => baseOpen({
|
|
79190
|
-
...options,
|
|
79191
|
-
app: singleApp
|
|
79192
|
-
}));
|
|
79193
|
-
}
|
|
79194
|
-
let { name: app, arguments: appArguments = [] } = options.app ?? {};
|
|
79195
|
-
appArguments = [...appArguments];
|
|
79196
|
-
if (Array.isArray(app)) {
|
|
79197
|
-
return pTryEach(app, (appName) => baseOpen({
|
|
79198
|
-
...options,
|
|
79199
|
-
app: {
|
|
79200
|
-
name: appName,
|
|
79201
|
-
arguments: appArguments
|
|
79202
|
-
}
|
|
79203
|
-
}));
|
|
79204
|
-
}
|
|
79205
|
-
if (app === "browser" || app === "browserPrivate") {
|
|
79206
|
-
const ids = {
|
|
79207
|
-
"com.google.chrome": "chrome",
|
|
79208
|
-
"google-chrome.desktop": "chrome",
|
|
79209
|
-
"com.brave.Browser": "brave",
|
|
79210
|
-
"org.mozilla.firefox": "firefox",
|
|
79211
|
-
"firefox.desktop": "firefox",
|
|
79212
|
-
"com.microsoft.msedge": "edge",
|
|
79213
|
-
"com.microsoft.edge": "edge",
|
|
79214
|
-
"com.microsoft.edgemac": "edge",
|
|
79215
|
-
"microsoft-edge.desktop": "edge"
|
|
79216
|
-
};
|
|
79217
|
-
const flags = {
|
|
79218
|
-
chrome: "--incognito",
|
|
79219
|
-
brave: "--incognito",
|
|
79220
|
-
firefox: "--private-window",
|
|
79221
|
-
edge: "--inPrivate"
|
|
79222
|
-
};
|
|
79223
|
-
const browser = is_wsl_default ? await getWindowsDefaultBrowserFromWsl() : await defaultBrowser2();
|
|
79224
|
-
if (browser.id in ids) {
|
|
79225
|
-
const browserName = ids[browser.id];
|
|
79226
|
-
if (app === "browserPrivate") {
|
|
79227
|
-
appArguments.push(flags[browserName]);
|
|
79228
|
-
}
|
|
79229
|
-
return baseOpen({
|
|
79230
|
-
...options,
|
|
79231
|
-
app: {
|
|
79232
|
-
name: apps[browserName],
|
|
79233
|
-
arguments: appArguments
|
|
79234
|
-
}
|
|
79235
|
-
});
|
|
79236
|
-
}
|
|
79237
|
-
throw new Error(`${browser.name} is not supported as a default browser`);
|
|
79238
|
-
}
|
|
79239
|
-
let command;
|
|
79240
|
-
const cliArguments = [];
|
|
79241
|
-
const childProcessOptions = {};
|
|
79242
|
-
if (platform11 === "darwin") {
|
|
79243
|
-
command = "open";
|
|
79244
|
-
if (options.wait) {
|
|
79245
|
-
cliArguments.push("--wait-apps");
|
|
79246
|
-
}
|
|
79247
|
-
if (options.background) {
|
|
79248
|
-
cliArguments.push("--background");
|
|
79249
|
-
}
|
|
79250
|
-
if (options.newInstance) {
|
|
79251
|
-
cliArguments.push("--new");
|
|
79252
|
-
}
|
|
79253
|
-
if (app) {
|
|
79254
|
-
cliArguments.push("-a", app);
|
|
79255
|
-
}
|
|
79256
|
-
} else if (platform11 === "win32" || is_wsl_default && !isInsideContainer() && !app) {
|
|
79257
|
-
command = await powerShellPath();
|
|
79258
|
-
cliArguments.push(
|
|
79259
|
-
"-NoProfile",
|
|
79260
|
-
"-NonInteractive",
|
|
79261
|
-
"-ExecutionPolicy",
|
|
79262
|
-
"Bypass",
|
|
79263
|
-
"-EncodedCommand"
|
|
79264
|
-
);
|
|
79265
|
-
if (!is_wsl_default) {
|
|
79266
|
-
childProcessOptions.windowsVerbatimArguments = true;
|
|
79267
|
-
}
|
|
79268
|
-
const encodedArguments = ["Start"];
|
|
79269
|
-
if (options.wait) {
|
|
79270
|
-
encodedArguments.push("-Wait");
|
|
79271
|
-
}
|
|
79272
|
-
if (app) {
|
|
79273
|
-
encodedArguments.push(`"\`"${app}\`""`);
|
|
79274
|
-
if (options.target) {
|
|
79275
|
-
appArguments.push(options.target);
|
|
79276
|
-
}
|
|
79277
|
-
} else if (options.target) {
|
|
79278
|
-
encodedArguments.push(`"${options.target}"`);
|
|
79279
|
-
}
|
|
79280
|
-
if (appArguments.length > 0) {
|
|
79281
|
-
appArguments = appArguments.map((argument) => `"\`"${argument}\`""`);
|
|
79282
|
-
encodedArguments.push("-ArgumentList", appArguments.join(","));
|
|
79283
|
-
}
|
|
79284
|
-
options.target = import_node_buffer.Buffer.from(encodedArguments.join(" "), "utf16le").toString("base64");
|
|
79285
|
-
} else {
|
|
79286
|
-
if (app) {
|
|
79287
|
-
command = app;
|
|
79288
|
-
} else {
|
|
79289
|
-
const isBundled = !__dirname2 || __dirname2 === "/";
|
|
79290
|
-
let exeLocalXdgOpen = false;
|
|
79291
|
-
try {
|
|
79292
|
-
await import_promises5.default.access(localXdgOpenPath, import_promises5.constants.X_OK);
|
|
79293
|
-
exeLocalXdgOpen = true;
|
|
79294
|
-
} catch {
|
|
79295
|
-
}
|
|
79296
|
-
const useSystemXdgOpen = import_node_process15.default.versions.electron ?? (platform11 === "android" || isBundled || !exeLocalXdgOpen);
|
|
79297
|
-
command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
|
|
79298
|
-
}
|
|
79299
|
-
if (appArguments.length > 0) {
|
|
79300
|
-
cliArguments.push(...appArguments);
|
|
79301
|
-
}
|
|
79302
|
-
if (!options.wait) {
|
|
79303
|
-
childProcessOptions.stdio = "ignore";
|
|
79304
|
-
childProcessOptions.detached = true;
|
|
79305
|
-
}
|
|
79306
|
-
}
|
|
79307
|
-
if (platform11 === "darwin" && appArguments.length > 0) {
|
|
79308
|
-
cliArguments.push("--args", ...appArguments);
|
|
79309
|
-
}
|
|
79310
|
-
if (options.target) {
|
|
79311
|
-
cliArguments.push(options.target);
|
|
79312
|
-
}
|
|
79313
|
-
const subprocess = import_node_child_process5.default.spawn(command, cliArguments, childProcessOptions);
|
|
79314
|
-
if (options.wait) {
|
|
79315
|
-
return new Promise((resolve18, reject) => {
|
|
79316
|
-
subprocess.once("error", reject);
|
|
79317
|
-
subprocess.once("close", (exitCode) => {
|
|
79318
|
-
if (!options.allowNonzeroExitCode && exitCode > 0) {
|
|
79319
|
-
reject(new Error(`Exited with code ${exitCode}`));
|
|
79320
|
-
return;
|
|
79321
|
-
}
|
|
79322
|
-
resolve18(subprocess);
|
|
79323
|
-
});
|
|
79324
|
-
});
|
|
79325
|
-
}
|
|
79326
|
-
subprocess.unref();
|
|
79327
|
-
return subprocess;
|
|
79328
|
-
};
|
|
79329
|
-
open2 = (target, options) => {
|
|
79330
|
-
if (typeof target !== "string") {
|
|
79331
|
-
throw new TypeError("Expected a `target`");
|
|
79332
|
-
}
|
|
79333
|
-
return baseOpen({
|
|
79334
|
-
...options,
|
|
79335
|
-
target
|
|
79336
|
-
});
|
|
79337
|
-
};
|
|
79338
|
-
apps = {};
|
|
79339
|
-
defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
|
|
79340
|
-
darwin: "google chrome",
|
|
79341
|
-
win32: "chrome",
|
|
79342
|
-
linux: ["google-chrome", "google-chrome-stable", "chromium"]
|
|
79343
|
-
}, {
|
|
79344
|
-
wsl: {
|
|
79345
|
-
ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
|
|
79346
|
-
x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
|
|
79347
|
-
}
|
|
79348
|
-
}));
|
|
79349
|
-
defineLazyProperty(apps, "brave", () => detectPlatformBinary({
|
|
79350
|
-
darwin: "brave browser",
|
|
79351
|
-
win32: "brave",
|
|
79352
|
-
linux: ["brave-browser", "brave"]
|
|
79353
|
-
}, {
|
|
79354
|
-
wsl: {
|
|
79355
|
-
ia32: "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",
|
|
79356
|
-
x64: ["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe", "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]
|
|
79357
|
-
}
|
|
79358
|
-
}));
|
|
79359
|
-
defineLazyProperty(apps, "firefox", () => detectPlatformBinary({
|
|
79360
|
-
darwin: "firefox",
|
|
79361
|
-
win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
|
|
79362
|
-
linux: "firefox"
|
|
79363
|
-
}, {
|
|
79364
|
-
wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
|
|
79365
|
-
}));
|
|
79366
|
-
defineLazyProperty(apps, "edge", () => detectPlatformBinary({
|
|
79367
|
-
darwin: "microsoft edge",
|
|
79368
|
-
win32: "msedge",
|
|
79369
|
-
linux: ["microsoft-edge", "microsoft-edge-dev"]
|
|
79370
|
-
}, {
|
|
79371
|
-
wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
|
|
79372
|
-
}));
|
|
79373
|
-
defineLazyProperty(apps, "browser", () => "browser");
|
|
79374
|
-
defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
|
|
79375
|
-
open_default = open2;
|
|
79376
|
-
}
|
|
79377
|
-
});
|
|
79378
|
-
|
|
79379
78906
|
// src/version.ts
|
|
79380
78907
|
function resolvePackageVersion(options) {
|
|
79381
78908
|
const injectedVersion = options?.injectedVersion || "unknown";
|
|
@@ -79431,6 +78958,7 @@ var init_server_connection = __esm({
|
|
|
79431
78958
|
iceServers = null;
|
|
79432
78959
|
planLimits = null;
|
|
79433
78960
|
compatBlocked = false;
|
|
78961
|
+
fatalAuthRejectedReason = null;
|
|
79434
78962
|
get authTimeoutMs() {
|
|
79435
78963
|
return Math.max(1, this.options.authTimeoutMs ?? 15e3);
|
|
79436
78964
|
}
|
|
@@ -79547,6 +79075,7 @@ var init_server_connection = __esm({
|
|
|
79547
79075
|
this.clearAuthTimeout();
|
|
79548
79076
|
this.reconnectAttempts = 0;
|
|
79549
79077
|
this.compatBlocked = false;
|
|
79078
|
+
this.fatalAuthRejectedReason = null;
|
|
79550
79079
|
const payload = message.payload;
|
|
79551
79080
|
this.userPlan = payload.plan || "free";
|
|
79552
79081
|
this.iceServers = payload.iceServers || null;
|
|
@@ -79560,8 +79089,20 @@ var init_server_connection = __esm({
|
|
|
79560
79089
|
this.startHeartbeat();
|
|
79561
79090
|
} else if (message.type === "auth_error") {
|
|
79562
79091
|
this.clearAuthTimeout();
|
|
79563
|
-
|
|
79092
|
+
const payload = message.payload;
|
|
79093
|
+
const reason = String(payload.reason || "Authentication failed");
|
|
79094
|
+
this.fatalAuthRejectedReason = reason;
|
|
79095
|
+
LOG.error("Server", `Auth failed: ${reason}`);
|
|
79096
|
+
if (reason === "machine_limit_exceeded") {
|
|
79097
|
+
LOG.error("Server", `[ServerConn] ${payload.message || "Machine limit exceeded. Remove an unused machine in the dashboard or upgrade your plan."}`);
|
|
79098
|
+
} else {
|
|
79099
|
+
LOG.error("Server", `[ServerConn] Saved machine credentials were rejected. Run 'adhdev setup --force' to re-authenticate, then restart the daemon.`);
|
|
79100
|
+
}
|
|
79564
79101
|
this.setState("error");
|
|
79102
|
+
try {
|
|
79103
|
+
this.ws?.close(1e3, "Authentication rejected");
|
|
79104
|
+
} catch {
|
|
79105
|
+
}
|
|
79565
79106
|
return;
|
|
79566
79107
|
} else if (message.type === "version_mismatch") {
|
|
79567
79108
|
const p = message.payload;
|
|
@@ -79594,6 +79135,18 @@ var init_server_connection = __esm({
|
|
|
79594
79135
|
LOG.info("Server", `[ServerConn] WebSocket closed: ${code} ${reason}`);
|
|
79595
79136
|
this.clearTimers();
|
|
79596
79137
|
this.ws = null;
|
|
79138
|
+
if (code === 4001 || this.fatalAuthRejectedReason) {
|
|
79139
|
+
const authReason = this.fatalAuthRejectedReason;
|
|
79140
|
+
const reasonText = authReason ? `: ${authReason}` : "";
|
|
79141
|
+
LOG.error("Server", `[ServerConn] Authentication rejected${reasonText}. Not reconnecting with the same credentials.`);
|
|
79142
|
+
if (authReason === "machine_limit_exceeded") {
|
|
79143
|
+
LOG.error("Server", `[ServerConn] Remove an unused machine in the dashboard or upgrade your plan, then restart the daemon.`);
|
|
79144
|
+
} else {
|
|
79145
|
+
LOG.error("Server", `[ServerConn] Run 'adhdev setup --force', then 'adhdev daemon:restart'.`);
|
|
79146
|
+
}
|
|
79147
|
+
this.setState("disconnected");
|
|
79148
|
+
return;
|
|
79149
|
+
}
|
|
79597
79150
|
if (code === 4011) {
|
|
79598
79151
|
LOG.info("Server", `[ServerConn] \u26A0 Evicted by another machine. Not reconnecting.`);
|
|
79599
79152
|
LOG.info("Server", `[ServerConn] This connection was released because another machine connected.`);
|
|
@@ -80603,12 +80156,12 @@ var init_peer_connection_manager = __esm({
|
|
|
80603
80156
|
});
|
|
80604
80157
|
|
|
80605
80158
|
// src/daemon-p2p/index.ts
|
|
80606
|
-
var
|
|
80159
|
+
var fs15, path25, import_node_module2, esmRequire, DaemonP2PSender;
|
|
80607
80160
|
var init_daemon_p2p = __esm({
|
|
80608
80161
|
"src/daemon-p2p/index.ts"() {
|
|
80609
80162
|
"use strict";
|
|
80610
|
-
|
|
80611
|
-
|
|
80163
|
+
fs15 = __toESM(require("fs"));
|
|
80164
|
+
path25 = __toESM(require("path"));
|
|
80612
80165
|
import_node_module2 = require("module");
|
|
80613
80166
|
init_src();
|
|
80614
80167
|
init_data_channel_router();
|
|
@@ -80682,22 +80235,22 @@ var init_daemon_p2p = __esm({
|
|
|
80682
80235
|
log(`node-datachannel not found: ${e?.message}
|
|
80683
80236
|
${e?.stack || ""}`);
|
|
80684
80237
|
}
|
|
80685
|
-
const
|
|
80686
|
-
const
|
|
80687
|
-
const prebuildKey = `${
|
|
80238
|
+
const platform12 = process.platform;
|
|
80239
|
+
const arch3 = process.arch;
|
|
80240
|
+
const prebuildKey = `${platform12}-${arch3}`;
|
|
80688
80241
|
try {
|
|
80689
80242
|
const candidates = [
|
|
80690
|
-
|
|
80691
|
-
|
|
80692
|
-
|
|
80243
|
+
path25.join(__dirname, "node_modules", "node-datachannel"),
|
|
80244
|
+
path25.join(__dirname, "..", "node_modules", "node-datachannel"),
|
|
80245
|
+
path25.join(__dirname, "..", "..", "node_modules", "node-datachannel")
|
|
80693
80246
|
];
|
|
80694
80247
|
for (const candidate of candidates) {
|
|
80695
|
-
const prebuildPath =
|
|
80696
|
-
if (
|
|
80697
|
-
const targetDir =
|
|
80698
|
-
const targetPath =
|
|
80699
|
-
|
|
80700
|
-
|
|
80248
|
+
const prebuildPath = path25.join(candidate, "prebuilds", prebuildKey, "node_datachannel.node");
|
|
80249
|
+
if (fs15.existsSync(prebuildPath)) {
|
|
80250
|
+
const targetDir = path25.join(candidate, "build", "Release");
|
|
80251
|
+
const targetPath = path25.join(targetDir, "node_datachannel.node");
|
|
80252
|
+
fs15.mkdirSync(targetDir, { recursive: true });
|
|
80253
|
+
fs15.copyFileSync(prebuildPath, targetPath);
|
|
80701
80254
|
try {
|
|
80702
80255
|
delete esmRequire.cache[esmRequire.resolve("node-datachannel")];
|
|
80703
80256
|
} catch {
|
|
@@ -81064,27 +80617,27 @@ var require_process = __commonJS({
|
|
|
81064
80617
|
var require_filesystem = __commonJS({
|
|
81065
80618
|
"../../node_modules/detect-libc/lib/filesystem.js"(exports2, module2) {
|
|
81066
80619
|
"use strict";
|
|
81067
|
-
var
|
|
80620
|
+
var fs22 = require("fs");
|
|
81068
80621
|
var LDD_PATH = "/usr/bin/ldd";
|
|
81069
80622
|
var SELF_PATH = "/proc/self/exe";
|
|
81070
80623
|
var MAX_LENGTH = 2048;
|
|
81071
|
-
var readFileSync20 = (
|
|
81072
|
-
const fd =
|
|
80624
|
+
var readFileSync20 = (path35) => {
|
|
80625
|
+
const fd = fs22.openSync(path35, "r");
|
|
81073
80626
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
81074
|
-
const bytesRead =
|
|
81075
|
-
|
|
80627
|
+
const bytesRead = fs22.readSync(fd, buffer, 0, MAX_LENGTH, 0);
|
|
80628
|
+
fs22.close(fd, () => {
|
|
81076
80629
|
});
|
|
81077
80630
|
return buffer.subarray(0, bytesRead);
|
|
81078
80631
|
};
|
|
81079
|
-
var readFile = (
|
|
81080
|
-
|
|
80632
|
+
var readFile = (path35) => new Promise((resolve18, reject) => {
|
|
80633
|
+
fs22.open(path35, "r", (err, fd) => {
|
|
81081
80634
|
if (err) {
|
|
81082
80635
|
reject(err);
|
|
81083
80636
|
} else {
|
|
81084
80637
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
81085
|
-
|
|
80638
|
+
fs22.read(fd, buffer, 0, MAX_LENGTH, 0, (_2, bytesRead) => {
|
|
81086
80639
|
resolve18(buffer.subarray(0, bytesRead));
|
|
81087
|
-
|
|
80640
|
+
fs22.close(fd, () => {
|
|
81088
80641
|
});
|
|
81089
80642
|
});
|
|
81090
80643
|
}
|
|
@@ -81140,7 +80693,7 @@ var require_elf = __commonJS({
|
|
|
81140
80693
|
var require_detect_libc = __commonJS({
|
|
81141
80694
|
"../../node_modules/detect-libc/lib/detect-libc.js"(exports2, module2) {
|
|
81142
80695
|
"use strict";
|
|
81143
|
-
var
|
|
80696
|
+
var childProcess = require("child_process");
|
|
81144
80697
|
var { isLinux: isLinux2, getReport } = require_process();
|
|
81145
80698
|
var { LDD_PATH, SELF_PATH, readFile, readFileSync: readFileSync20 } = require_filesystem();
|
|
81146
80699
|
var { interpreterPath } = require_elf();
|
|
@@ -81152,7 +80705,7 @@ var require_detect_libc = __commonJS({
|
|
|
81152
80705
|
var safeCommand = () => {
|
|
81153
80706
|
if (!commandOut) {
|
|
81154
80707
|
return new Promise((resolve18) => {
|
|
81155
|
-
|
|
80708
|
+
childProcess.exec(command, (err, out) => {
|
|
81156
80709
|
commandOut = err ? " " : out;
|
|
81157
80710
|
resolve18(commandOut);
|
|
81158
80711
|
});
|
|
@@ -81163,7 +80716,7 @@ var require_detect_libc = __commonJS({
|
|
|
81163
80716
|
var safeCommandSync = () => {
|
|
81164
80717
|
if (!commandOut) {
|
|
81165
80718
|
try {
|
|
81166
|
-
commandOut =
|
|
80719
|
+
commandOut = childProcess.execSync(command, { encoding: "utf8" });
|
|
81167
80720
|
} catch (_err) {
|
|
81168
80721
|
commandOut = " ";
|
|
81169
80722
|
}
|
|
@@ -81196,11 +80749,11 @@ var require_detect_libc = __commonJS({
|
|
|
81196
80749
|
}
|
|
81197
80750
|
return null;
|
|
81198
80751
|
};
|
|
81199
|
-
var familyFromInterpreterPath = (
|
|
81200
|
-
if (
|
|
81201
|
-
if (
|
|
80752
|
+
var familyFromInterpreterPath = (path35) => {
|
|
80753
|
+
if (path35) {
|
|
80754
|
+
if (path35.includes("/ld-musl-")) {
|
|
81202
80755
|
return MUSL;
|
|
81203
|
-
} else if (
|
|
80756
|
+
} else if (path35.includes("/ld-linux-")) {
|
|
81204
80757
|
return GLIBC;
|
|
81205
80758
|
}
|
|
81206
80759
|
}
|
|
@@ -81247,8 +80800,8 @@ var require_detect_libc = __commonJS({
|
|
|
81247
80800
|
cachedFamilyInterpreter = null;
|
|
81248
80801
|
try {
|
|
81249
80802
|
const selfContent = await readFile(SELF_PATH);
|
|
81250
|
-
const
|
|
81251
|
-
cachedFamilyInterpreter = familyFromInterpreterPath(
|
|
80803
|
+
const path35 = interpreterPath(selfContent);
|
|
80804
|
+
cachedFamilyInterpreter = familyFromInterpreterPath(path35);
|
|
81252
80805
|
} catch (e) {
|
|
81253
80806
|
}
|
|
81254
80807
|
return cachedFamilyInterpreter;
|
|
@@ -81260,8 +80813,8 @@ var require_detect_libc = __commonJS({
|
|
|
81260
80813
|
cachedFamilyInterpreter = null;
|
|
81261
80814
|
try {
|
|
81262
80815
|
const selfContent = readFileSync20(SELF_PATH);
|
|
81263
|
-
const
|
|
81264
|
-
cachedFamilyInterpreter = familyFromInterpreterPath(
|
|
80816
|
+
const path35 = interpreterPath(selfContent);
|
|
80817
|
+
cachedFamilyInterpreter = familyFromInterpreterPath(path35);
|
|
81265
80818
|
} catch (e) {
|
|
81266
80819
|
}
|
|
81267
80820
|
return cachedFamilyInterpreter;
|
|
@@ -82980,18 +82533,18 @@ var require_sharp = __commonJS({
|
|
|
82980
82533
|
`@img/sharp-${runtimePlatform}/sharp.node`,
|
|
82981
82534
|
"@img/sharp-wasm32/sharp.node"
|
|
82982
82535
|
];
|
|
82983
|
-
var
|
|
82536
|
+
var path35;
|
|
82984
82537
|
var sharp;
|
|
82985
82538
|
var errors = [];
|
|
82986
|
-
for (
|
|
82539
|
+
for (path35 of paths) {
|
|
82987
82540
|
try {
|
|
82988
|
-
sharp = require(
|
|
82541
|
+
sharp = require(path35);
|
|
82989
82542
|
break;
|
|
82990
82543
|
} catch (err) {
|
|
82991
82544
|
errors.push(err);
|
|
82992
82545
|
}
|
|
82993
82546
|
}
|
|
82994
|
-
if (sharp &&
|
|
82547
|
+
if (sharp && path35.startsWith("@img/sharp-linux-x64") && !sharp._isUsingX64V2()) {
|
|
82995
82548
|
const err = new Error("Prebuilt binaries for linux-x64 require v2 microarchitecture");
|
|
82996
82549
|
err.code = "Unsupported CPU";
|
|
82997
82550
|
errors.push(err);
|
|
@@ -83000,7 +82553,7 @@ var require_sharp = __commonJS({
|
|
|
83000
82553
|
if (sharp) {
|
|
83001
82554
|
module2.exports = sharp;
|
|
83002
82555
|
} else {
|
|
83003
|
-
const [isLinux2, isMacOs, isWindows2] = ["linux", "darwin", "win32"].map((
|
|
82556
|
+
const [isLinux2, isMacOs, isWindows2] = ["linux", "darwin", "win32"].map((os30) => runtimePlatform.startsWith(os30));
|
|
83004
82557
|
const help = [`Could not load the "sharp" module using the ${runtimePlatform} runtime`];
|
|
83005
82558
|
errors.forEach((err) => {
|
|
83006
82559
|
if (err.code !== "MODULE_NOT_FOUND") {
|
|
@@ -83017,15 +82570,15 @@ var require_sharp = __commonJS({
|
|
|
83017
82570
|
` Requires ${expected}`
|
|
83018
82571
|
);
|
|
83019
82572
|
} else if (prebuiltPlatforms.includes(runtimePlatform)) {
|
|
83020
|
-
const [
|
|
83021
|
-
const libc =
|
|
82573
|
+
const [os30, cpu] = runtimePlatform.split("-");
|
|
82574
|
+
const libc = os30.endsWith("musl") ? " --libc=musl" : "";
|
|
83022
82575
|
help.push(
|
|
83023
82576
|
"- Ensure optional dependencies can be installed:",
|
|
83024
82577
|
" npm install --include=optional sharp",
|
|
83025
82578
|
"- Ensure your package manager supports multi-platform installation:",
|
|
83026
82579
|
" See https://sharp.pixelplumbing.com/install#cross-platform",
|
|
83027
82580
|
"- Add platform-specific dependencies:",
|
|
83028
|
-
` npm install --os=${
|
|
82581
|
+
` npm install --os=${os30.replace("musl", "")}${libc} --cpu=${cpu} sharp`
|
|
83029
82582
|
);
|
|
83030
82583
|
} else {
|
|
83031
82584
|
help.push(
|
|
@@ -85900,15 +85453,15 @@ var require_color = __commonJS({
|
|
|
85900
85453
|
};
|
|
85901
85454
|
}
|
|
85902
85455
|
function wrapConversion(toModel, graph) {
|
|
85903
|
-
const
|
|
85456
|
+
const path35 = [graph[toModel].parent, toModel];
|
|
85904
85457
|
let fn = conversions_default[graph[toModel].parent][toModel];
|
|
85905
85458
|
let cur = graph[toModel].parent;
|
|
85906
85459
|
while (graph[cur].parent) {
|
|
85907
|
-
|
|
85460
|
+
path35.unshift(graph[cur].parent);
|
|
85908
85461
|
fn = link(conversions_default[graph[cur].parent][cur], fn);
|
|
85909
85462
|
cur = graph[cur].parent;
|
|
85910
85463
|
}
|
|
85911
|
-
fn.conversion =
|
|
85464
|
+
fn.conversion = path35;
|
|
85912
85465
|
return fn;
|
|
85913
85466
|
}
|
|
85914
85467
|
function route(fromModel) {
|
|
@@ -86525,7 +86078,7 @@ var require_channel = __commonJS({
|
|
|
86525
86078
|
var require_output = __commonJS({
|
|
86526
86079
|
"../../node_modules/sharp/lib/output.js"(exports2, module2) {
|
|
86527
86080
|
"use strict";
|
|
86528
|
-
var
|
|
86081
|
+
var path35 = require("path");
|
|
86529
86082
|
var is = require_is();
|
|
86530
86083
|
var sharp = require_sharp();
|
|
86531
86084
|
var formats = /* @__PURE__ */ new Map([
|
|
@@ -86556,9 +86109,9 @@ var require_output = __commonJS({
|
|
|
86556
86109
|
let err;
|
|
86557
86110
|
if (!is.string(fileOut)) {
|
|
86558
86111
|
err = new Error("Missing output file path");
|
|
86559
|
-
} else if (is.string(this.options.input.file) &&
|
|
86112
|
+
} else if (is.string(this.options.input.file) && path35.resolve(this.options.input.file) === path35.resolve(fileOut)) {
|
|
86560
86113
|
err = new Error("Cannot use same file for input and output");
|
|
86561
|
-
} else if (jp2Regex.test(
|
|
86114
|
+
} else if (jp2Regex.test(path35.extname(fileOut)) && !this.constructor.format.jp2k.output.file) {
|
|
86562
86115
|
err = errJp2Save();
|
|
86563
86116
|
}
|
|
86564
86117
|
if (err) {
|
|
@@ -87832,21 +87385,21 @@ function quarantineLegacyStandaloneSessions(options) {
|
|
|
87832
87385
|
if (shouldSkipForExplicitOverride(env3)) {
|
|
87833
87386
|
return { movedCount: 0, skippedActiveCount: 0, backupDir: null };
|
|
87834
87387
|
}
|
|
87835
|
-
const homeDir = options.homeDir ||
|
|
87388
|
+
const homeDir = options.homeDir || os25.homedir();
|
|
87836
87389
|
const now = options.now || (() => /* @__PURE__ */ new Date());
|
|
87837
87390
|
const isPidRunning = options.isPidRunning || defaultPidRunning;
|
|
87838
|
-
const runtimesDir =
|
|
87839
|
-
if (!
|
|
87391
|
+
const runtimesDir = path26.join(homeDir, ".adhdev", "session-host", options.appName, "runtimes");
|
|
87392
|
+
if (!fs16.existsSync(runtimesDir)) {
|
|
87840
87393
|
return { movedCount: 0, skippedActiveCount: 0, backupDir: null };
|
|
87841
87394
|
}
|
|
87842
|
-
const candidates =
|
|
87395
|
+
const candidates = fs16.readdirSync(runtimesDir).filter((name) => name.endsWith(".json")).map((name) => path26.join(runtimesDir, name));
|
|
87843
87396
|
let movedCount = 0;
|
|
87844
87397
|
let skippedActiveCount = 0;
|
|
87845
87398
|
let backupDir = null;
|
|
87846
87399
|
for (const sourcePath of candidates) {
|
|
87847
87400
|
let parsed;
|
|
87848
87401
|
try {
|
|
87849
|
-
parsed = JSON.parse(
|
|
87402
|
+
parsed = JSON.parse(fs16.readFileSync(sourcePath, "utf8"));
|
|
87850
87403
|
} catch {
|
|
87851
87404
|
continue;
|
|
87852
87405
|
}
|
|
@@ -87857,26 +87410,26 @@ function quarantineLegacyStandaloneSessions(options) {
|
|
|
87857
87410
|
continue;
|
|
87858
87411
|
}
|
|
87859
87412
|
if (!backupDir) {
|
|
87860
|
-
backupDir =
|
|
87413
|
+
backupDir = path26.join(
|
|
87861
87414
|
homeDir,
|
|
87862
87415
|
".adhdev",
|
|
87863
87416
|
"session-host-backups",
|
|
87864
87417
|
`legacy-standalone-${options.appName}-${formatTimestamp(now())}`
|
|
87865
87418
|
);
|
|
87866
|
-
|
|
87419
|
+
fs16.mkdirSync(path26.join(backupDir, "runtimes"), { recursive: true });
|
|
87867
87420
|
}
|
|
87868
|
-
|
|
87421
|
+
fs16.renameSync(sourcePath, path26.join(backupDir, "runtimes", path26.basename(sourcePath)));
|
|
87869
87422
|
movedCount += 1;
|
|
87870
87423
|
}
|
|
87871
87424
|
return { movedCount, skippedActiveCount, backupDir };
|
|
87872
87425
|
}
|
|
87873
|
-
var
|
|
87426
|
+
var fs16, os25, path26, LEGACY_STANDALONE_MANAGER_TAG;
|
|
87874
87427
|
var init_session_host_hygiene = __esm({
|
|
87875
87428
|
"src/session-host-hygiene.ts"() {
|
|
87876
87429
|
"use strict";
|
|
87877
|
-
|
|
87878
|
-
|
|
87879
|
-
|
|
87430
|
+
fs16 = __toESM(require("fs"));
|
|
87431
|
+
os25 = __toESM(require("os"));
|
|
87432
|
+
path26 = __toESM(require("path"));
|
|
87880
87433
|
init_src();
|
|
87881
87434
|
LEGACY_STANDALONE_MANAGER_TAG = "adhdev-standalone";
|
|
87882
87435
|
}
|
|
@@ -87900,18 +87453,18 @@ function buildSessionHostEnv(baseEnv) {
|
|
|
87900
87453
|
}
|
|
87901
87454
|
function resolveSessionHostEntry() {
|
|
87902
87455
|
const packagedCandidates = [
|
|
87903
|
-
|
|
87904
|
-
|
|
87456
|
+
path27.resolve(__dirname, "../vendor/session-host-daemon/index.js"),
|
|
87457
|
+
path27.resolve(__dirname, "../../vendor/session-host-daemon/index.js")
|
|
87905
87458
|
];
|
|
87906
87459
|
for (const candidate of packagedCandidates) {
|
|
87907
|
-
if (
|
|
87460
|
+
if (fs17.existsSync(candidate)) {
|
|
87908
87461
|
return candidate;
|
|
87909
87462
|
}
|
|
87910
87463
|
}
|
|
87911
87464
|
return require.resolve("@adhdev/session-host-daemon");
|
|
87912
87465
|
}
|
|
87913
87466
|
function getSessionHostPidFile() {
|
|
87914
|
-
return
|
|
87467
|
+
return path27.join(os26.homedir(), ".adhdev", `${SESSION_HOST_APP_NAME}-session-host.pid`);
|
|
87915
87468
|
}
|
|
87916
87469
|
function getSessionHostStatusPaths() {
|
|
87917
87470
|
return {
|
|
@@ -87922,8 +87475,8 @@ function getSessionHostStatusPaths() {
|
|
|
87922
87475
|
function getSessionHostPid() {
|
|
87923
87476
|
try {
|
|
87924
87477
|
const pidFile = getSessionHostPidFile();
|
|
87925
|
-
if (!
|
|
87926
|
-
const pid = Number.parseInt(
|
|
87478
|
+
if (!fs17.existsSync(pidFile)) return null;
|
|
87479
|
+
const pid = Number.parseInt(fs17.readFileSync(pidFile, "utf8").trim(), 10);
|
|
87927
87480
|
return Number.isFinite(pid) ? pid : null;
|
|
87928
87481
|
} catch {
|
|
87929
87482
|
return null;
|
|
@@ -87993,8 +87546,8 @@ function stopManagedSessionHostProcess() {
|
|
|
87993
87546
|
let stopped = false;
|
|
87994
87547
|
const pidFile = getSessionHostPidFile();
|
|
87995
87548
|
try {
|
|
87996
|
-
if (
|
|
87997
|
-
const pid = Number.parseInt(
|
|
87549
|
+
if (fs17.existsSync(pidFile)) {
|
|
87550
|
+
const pid = Number.parseInt(fs17.readFileSync(pidFile, "utf8").trim(), 10);
|
|
87998
87551
|
if (Number.isFinite(pid) && pid !== process.pid && isManagedSessionHostPid2(pid)) {
|
|
87999
87552
|
stopped = killPid2(pid) || stopped;
|
|
88000
87553
|
}
|
|
@@ -88002,7 +87555,7 @@ function stopManagedSessionHostProcess() {
|
|
|
88002
87555
|
} catch {
|
|
88003
87556
|
} finally {
|
|
88004
87557
|
try {
|
|
88005
|
-
|
|
87558
|
+
fs17.unlinkSync(pidFile);
|
|
88006
87559
|
} catch {
|
|
88007
87560
|
}
|
|
88008
87561
|
}
|
|
@@ -88030,9 +87583,9 @@ async function ensureSessionHostReady2() {
|
|
|
88030
87583
|
}
|
|
88031
87584
|
const spawnHost = () => {
|
|
88032
87585
|
const entry = resolveSessionHostEntry();
|
|
88033
|
-
const logDir =
|
|
88034
|
-
|
|
88035
|
-
const logFd =
|
|
87586
|
+
const logDir = path27.join(os26.homedir(), ".adhdev", "logs");
|
|
87587
|
+
fs17.mkdirSync(logDir, { recursive: true });
|
|
87588
|
+
const logFd = fs17.openSync(path27.join(logDir, "session-host.log"), "a");
|
|
88036
87589
|
const child = (0, import_child_process13.spawn)(process.execPath, [entry], {
|
|
88037
87590
|
detached: true,
|
|
88038
87591
|
stdio: ["ignore", logFd, logFd],
|
|
@@ -88041,7 +87594,7 @@ async function ensureSessionHostReady2() {
|
|
|
88041
87594
|
});
|
|
88042
87595
|
child.unref();
|
|
88043
87596
|
try {
|
|
88044
|
-
|
|
87597
|
+
fs17.closeSync(logFd);
|
|
88045
87598
|
} catch {
|
|
88046
87599
|
}
|
|
88047
87600
|
};
|
|
@@ -88094,14 +87647,14 @@ async function probeSessionHostStatus() {
|
|
|
88094
87647
|
};
|
|
88095
87648
|
}
|
|
88096
87649
|
}
|
|
88097
|
-
var import_child_process13,
|
|
87650
|
+
var import_child_process13, fs17, os26, path27, SESSION_HOST_APP_NAME, SESSION_HOST_START_TIMEOUT_MS;
|
|
88098
87651
|
var init_session_host = __esm({
|
|
88099
87652
|
"src/session-host.ts"() {
|
|
88100
87653
|
"use strict";
|
|
88101
87654
|
import_child_process13 = require("child_process");
|
|
88102
|
-
|
|
88103
|
-
|
|
88104
|
-
|
|
87655
|
+
fs17 = __toESM(require("fs"));
|
|
87656
|
+
os26 = __toESM(require("os"));
|
|
87657
|
+
path27 = __toESM(require("path"));
|
|
88105
87658
|
init_src();
|
|
88106
87659
|
init_dist();
|
|
88107
87660
|
init_session_host_hygiene();
|
|
@@ -88329,29 +87882,29 @@ function resolveDaemonPort(ref = {}) {
|
|
|
88329
87882
|
return Number.isFinite(ref.port) && Number(ref.port) > 0 ? Number(ref.port) : DEFAULT_DAEMON_PORT;
|
|
88330
87883
|
}
|
|
88331
87884
|
function getDaemonPidFile(ref = {}) {
|
|
88332
|
-
const dir =
|
|
88333
|
-
if (!
|
|
87885
|
+
const dir = path28.join(ref.homeDir || os27.homedir(), ".adhdev");
|
|
87886
|
+
if (!fs18.existsSync(dir)) fs18.mkdirSync(dir, { recursive: true });
|
|
88334
87887
|
const port = resolveDaemonPort(ref);
|
|
88335
|
-
return
|
|
87888
|
+
return path28.join(dir, port === DEFAULT_DAEMON_PORT ? "daemon.pid" : `daemon-${port}.pid`);
|
|
88336
87889
|
}
|
|
88337
87890
|
function writeDaemonPid(pid, ref = {}) {
|
|
88338
87891
|
const pidFile = getDaemonPidFile(ref);
|
|
88339
87892
|
try {
|
|
88340
|
-
|
|
87893
|
+
fs18.writeFileSync(pidFile, String(pid), { encoding: "utf-8", flag: "wx" });
|
|
88341
87894
|
} catch {
|
|
88342
|
-
|
|
87895
|
+
fs18.writeFileSync(pidFile, String(pid), "utf-8");
|
|
88343
87896
|
}
|
|
88344
87897
|
}
|
|
88345
87898
|
function removeDaemonPid(ref = {}) {
|
|
88346
87899
|
try {
|
|
88347
|
-
|
|
87900
|
+
fs18.unlinkSync(getDaemonPidFile(ref));
|
|
88348
87901
|
} catch (e) {
|
|
88349
87902
|
}
|
|
88350
87903
|
}
|
|
88351
87904
|
function isDaemonRunning(ref = {}) {
|
|
88352
87905
|
const port = resolveDaemonPort(ref);
|
|
88353
87906
|
try {
|
|
88354
|
-
const { execFileSync:
|
|
87907
|
+
const { execFileSync: execFileSync6 } = require("child_process");
|
|
88355
87908
|
const probe = `
|
|
88356
87909
|
const http = require('http');
|
|
88357
87910
|
const req = http.get('http://127.0.0.1:${port}/health', { timeout: 1500 }, (res) => {
|
|
@@ -88361,7 +87914,7 @@ function isDaemonRunning(ref = {}) {
|
|
|
88361
87914
|
req.on('error', () => process.stdout.write('0'));
|
|
88362
87915
|
req.on('timeout', () => { req.destroy(); process.stdout.write('0'); });
|
|
88363
87916
|
`;
|
|
88364
|
-
const result =
|
|
87917
|
+
const result = execFileSync6(process.execPath, ["-e", probe], {
|
|
88365
87918
|
encoding: "utf-8",
|
|
88366
87919
|
timeout: 3e3,
|
|
88367
87920
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -88371,8 +87924,8 @@ function isDaemonRunning(ref = {}) {
|
|
|
88371
87924
|
}
|
|
88372
87925
|
const pidFile = getDaemonPidFile(ref);
|
|
88373
87926
|
try {
|
|
88374
|
-
if (!
|
|
88375
|
-
const pid = parseInt(
|
|
87927
|
+
if (!fs18.existsSync(pidFile)) return false;
|
|
87928
|
+
const pid = parseInt(fs18.readFileSync(pidFile, "utf-8").trim());
|
|
88376
87929
|
process.kill(pid, 0);
|
|
88377
87930
|
if (!isAdhdevProcess(pid)) {
|
|
88378
87931
|
removeDaemonPid(ref);
|
|
@@ -88387,9 +87940,9 @@ function isDaemonRunning(ref = {}) {
|
|
|
88387
87940
|
function isAdhdevProcess(pid) {
|
|
88388
87941
|
try {
|
|
88389
87942
|
if (process.platform === "win32") {
|
|
88390
|
-
const { execFileSync:
|
|
87943
|
+
const { execFileSync: execFileSync6 } = require("child_process");
|
|
88391
87944
|
try {
|
|
88392
|
-
const psOut =
|
|
87945
|
+
const psOut = execFileSync6("powershell.exe", [
|
|
88393
87946
|
"-NoProfile",
|
|
88394
87947
|
"-NonInteractive",
|
|
88395
87948
|
"-ExecutionPolicy",
|
|
@@ -88402,8 +87955,8 @@ function isAdhdevProcess(pid) {
|
|
|
88402
87955
|
return true;
|
|
88403
87956
|
}
|
|
88404
87957
|
} else {
|
|
88405
|
-
const { execFileSync:
|
|
88406
|
-
const cmdline =
|
|
87958
|
+
const { execFileSync: execFileSync6 } = require("child_process");
|
|
87959
|
+
const cmdline = execFileSync6("ps", ["-o", "command=", "-p", String(pid)], {
|
|
88407
87960
|
encoding: "utf-8",
|
|
88408
87961
|
timeout: 2e3,
|
|
88409
87962
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -88417,7 +87970,7 @@ function isAdhdevProcess(pid) {
|
|
|
88417
87970
|
function getDaemonHealthPid(ref = {}) {
|
|
88418
87971
|
const port = resolveDaemonPort(ref);
|
|
88419
87972
|
try {
|
|
88420
|
-
const { execFileSync:
|
|
87973
|
+
const { execFileSync: execFileSync6 } = require("child_process");
|
|
88421
87974
|
const probe = `
|
|
88422
87975
|
const http = require('http');
|
|
88423
87976
|
const req = http.get('http://127.0.0.1:${port}/health', { timeout: 1500 }, (res) => {
|
|
@@ -88435,7 +87988,7 @@ function getDaemonHealthPid(ref = {}) {
|
|
|
88435
87988
|
req.on('error', () => {});
|
|
88436
87989
|
req.on('timeout', () => { req.destroy(); });
|
|
88437
87990
|
`;
|
|
88438
|
-
const result =
|
|
87991
|
+
const result = execFileSync6(process.execPath, ["-e", probe], {
|
|
88439
87992
|
encoding: "utf-8",
|
|
88440
87993
|
timeout: 3e3,
|
|
88441
87994
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -88449,8 +88002,8 @@ function getDaemonHealthPid(ref = {}) {
|
|
|
88449
88002
|
function getDaemonPid(ref = {}) {
|
|
88450
88003
|
const pidFile = getDaemonPidFile(ref);
|
|
88451
88004
|
try {
|
|
88452
|
-
if (
|
|
88453
|
-
const pid = parseInt(
|
|
88005
|
+
if (fs18.existsSync(pidFile)) {
|
|
88006
|
+
const pid = parseInt(fs18.readFileSync(pidFile, "utf-8").trim(), 10);
|
|
88454
88007
|
if (Number.isFinite(pid)) return pid;
|
|
88455
88008
|
}
|
|
88456
88009
|
} catch {
|
|
@@ -88461,8 +88014,8 @@ function stopDaemon(ref = {}) {
|
|
|
88461
88014
|
const pidFile = getDaemonPidFile(ref);
|
|
88462
88015
|
let pid = null;
|
|
88463
88016
|
try {
|
|
88464
|
-
if (
|
|
88465
|
-
const pidFromFile = parseInt(
|
|
88017
|
+
if (fs18.existsSync(pidFile)) {
|
|
88018
|
+
const pidFromFile = parseInt(fs18.readFileSync(pidFile, "utf-8").trim(), 10);
|
|
88466
88019
|
if (Number.isFinite(pidFromFile)) pid = pidFromFile;
|
|
88467
88020
|
}
|
|
88468
88021
|
} catch {
|
|
@@ -88481,7 +88034,7 @@ function stopDaemon(ref = {}) {
|
|
|
88481
88034
|
return false;
|
|
88482
88035
|
}
|
|
88483
88036
|
}
|
|
88484
|
-
var
|
|
88037
|
+
var os27, fs18, path28, import_http, import_child_process14, import_ws3, pkgVersion, AdhdevDaemon;
|
|
88485
88038
|
var init_adhdev_daemon = __esm({
|
|
88486
88039
|
"src/adhdev-daemon.ts"() {
|
|
88487
88040
|
"use strict";
|
|
@@ -88493,9 +88046,9 @@ var init_adhdev_daemon = __esm({
|
|
|
88493
88046
|
init_startup_restore_policy();
|
|
88494
88047
|
init_dist();
|
|
88495
88048
|
init_session_host_controller();
|
|
88496
|
-
|
|
88497
|
-
|
|
88498
|
-
|
|
88049
|
+
os27 = __toESM(require("os"));
|
|
88050
|
+
fs18 = __toESM(require("fs"));
|
|
88051
|
+
path28 = __toESM(require("path"));
|
|
88499
88052
|
import_http = require("http");
|
|
88500
88053
|
import_child_process14 = require("child_process");
|
|
88501
88054
|
import_ws3 = require("ws");
|
|
@@ -88503,7 +88056,7 @@ var init_adhdev_daemon = __esm({
|
|
|
88503
88056
|
init_version();
|
|
88504
88057
|
init_src();
|
|
88505
88058
|
init_runtime_defaults();
|
|
88506
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.
|
|
88059
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.46" });
|
|
88507
88060
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
88508
88061
|
localHttpServer = null;
|
|
88509
88062
|
localWss = null;
|
|
@@ -89027,8 +88580,8 @@ ${err?.stack || ""}`);
|
|
|
89027
88580
|
cliInfo: {
|
|
89028
88581
|
type: "adhdev-daemon",
|
|
89029
88582
|
version: pkgVersion,
|
|
89030
|
-
platform:
|
|
89031
|
-
hostname:
|
|
88583
|
+
platform: os27.platform(),
|
|
88584
|
+
hostname: os27.hostname(),
|
|
89032
88585
|
machineId: config2.machineId,
|
|
89033
88586
|
instanceId
|
|
89034
88587
|
}
|
|
@@ -89627,6 +89180,10 @@ var wizard_exports = {};
|
|
|
89627
89180
|
__export(wizard_exports, {
|
|
89628
89181
|
runWizard: () => runWizard
|
|
89629
89182
|
});
|
|
89183
|
+
async function openBrowser(url2) {
|
|
89184
|
+
const mod = await import("open");
|
|
89185
|
+
return mod.default(url2);
|
|
89186
|
+
}
|
|
89630
89187
|
function hasCloudMachineAuth() {
|
|
89631
89188
|
const config2 = loadConfig();
|
|
89632
89189
|
return Boolean(config2.machineSecret && config2.machineSecret.trim());
|
|
@@ -89676,9 +89233,9 @@ async function runWizard(options = {}) {
|
|
|
89676
89233
|
}
|
|
89677
89234
|
async function checkForUpdate() {
|
|
89678
89235
|
try {
|
|
89679
|
-
const { execFileSync:
|
|
89236
|
+
const { execFileSync: execFileSync6 } = await import("child_process");
|
|
89680
89237
|
const currentVersion = resolvePackageVersion();
|
|
89681
|
-
const latestVersion = readLatestPublishedCliVersion(
|
|
89238
|
+
const latestVersion = readLatestPublishedCliVersion(execFileSync6);
|
|
89682
89239
|
if (!latestVersion) return;
|
|
89683
89240
|
if (!currentVersion || !latestVersion || currentVersion === latestVersion) return;
|
|
89684
89241
|
console.log(source_default.yellow(` Update available: ${currentVersion} \u2192 ${latestVersion}`));
|
|
@@ -89695,7 +89252,7 @@ async function checkForUpdate() {
|
|
|
89695
89252
|
const spinner = (await Promise.resolve().then(() => (init_ora(), ora_exports))).default("Updating adhdev CLI...").start();
|
|
89696
89253
|
try {
|
|
89697
89254
|
const installCommand = buildPinnedGlobalInstallCommand({ packageName: "adhdev", targetVersion: "latest" });
|
|
89698
|
-
|
|
89255
|
+
execFileSync6(installCommand.command, installCommand.args, {
|
|
89699
89256
|
encoding: "utf-8",
|
|
89700
89257
|
timeout: 6e4,
|
|
89701
89258
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -89779,15 +89336,15 @@ async function loginFlow() {
|
|
|
89779
89336
|
let verificationUrl;
|
|
89780
89337
|
try {
|
|
89781
89338
|
const config2 = loadConfig();
|
|
89782
|
-
const
|
|
89339
|
+
const os30 = await import("os");
|
|
89783
89340
|
const res = await fetch(`${SERVER_URL}/auth/cli/init`, {
|
|
89784
89341
|
method: "POST",
|
|
89785
89342
|
headers: { "Content-Type": "application/json" },
|
|
89786
89343
|
body: JSON.stringify({
|
|
89787
89344
|
clientMachineId: config2.machineId,
|
|
89788
|
-
hostname:
|
|
89789
|
-
platform:
|
|
89790
|
-
arch:
|
|
89345
|
+
hostname: os30.hostname(),
|
|
89346
|
+
platform: os30.platform(),
|
|
89347
|
+
arch: os30.arch()
|
|
89791
89348
|
})
|
|
89792
89349
|
});
|
|
89793
89350
|
if (!res.ok) {
|
|
@@ -89811,7 +89368,7 @@ async function loginFlow() {
|
|
|
89811
89368
|
console.log(source_default.gray(` Opening: ${verificationUrl}`));
|
|
89812
89369
|
console.log();
|
|
89813
89370
|
try {
|
|
89814
|
-
await
|
|
89371
|
+
await openBrowser(verificationUrl);
|
|
89815
89372
|
console.log(source_default.green(" \u2713 Browser opened \u2014 please sign in and approve"));
|
|
89816
89373
|
} catch {
|
|
89817
89374
|
console.log(source_default.yellow(` \u26A0 Could not open browser. Visit: ${verificationUrl}`));
|
|
@@ -89892,10 +89449,10 @@ async function startDaemonFlow() {
|
|
|
89892
89449
|
const { execSync: execSync8 } = await import("child_process");
|
|
89893
89450
|
const { getCurrentDaemonLogPath: getCurrentDaemonLogPath2 } = await Promise.resolve().then(() => (init_src(), src_exports));
|
|
89894
89451
|
const logPath = getCurrentDaemonLogPath2();
|
|
89895
|
-
const
|
|
89896
|
-
const
|
|
89452
|
+
const os30 = await import("os");
|
|
89453
|
+
const platform12 = os30.platform();
|
|
89897
89454
|
try {
|
|
89898
|
-
if (
|
|
89455
|
+
if (platform12 === "win32") {
|
|
89899
89456
|
execSync8("start /B adhdev daemon >NUL 2>&1", {
|
|
89900
89457
|
timeout: 3e3,
|
|
89901
89458
|
stdio: "ignore",
|
|
@@ -90008,7 +89565,6 @@ var init_wizard = __esm({
|
|
|
90008
89565
|
init_source();
|
|
90009
89566
|
init_lib();
|
|
90010
89567
|
init_ora();
|
|
90011
|
-
init_open();
|
|
90012
89568
|
init_src();
|
|
90013
89569
|
init_version();
|
|
90014
89570
|
SERVER_URL = process.env.ADHDEV_SERVER_URL || "https://api.adhf.dev";
|
|
@@ -91041,7 +90597,7 @@ init_source();
|
|
|
91041
90597
|
init_src();
|
|
91042
90598
|
|
|
91043
90599
|
// src/cli/setup-commands.ts
|
|
91044
|
-
var
|
|
90600
|
+
var import_node_path3 = __toESM(require("path"));
|
|
91045
90601
|
init_source();
|
|
91046
90602
|
init_src();
|
|
91047
90603
|
|
|
@@ -91194,7 +90750,7 @@ function parsePositiveInteger(value, fallback2) {
|
|
|
91194
90750
|
return Number.isFinite(parsed) && parsed >= 0 ? parsed : fallback2;
|
|
91195
90751
|
}
|
|
91196
90752
|
function buildHistoryResumeLaunchPayload(cliType, session, overrideDir) {
|
|
91197
|
-
const dir = typeof overrideDir === "string" && overrideDir.trim() ?
|
|
90753
|
+
const dir = typeof overrideDir === "string" && overrideDir.trim() ? import_node_path3.default.resolve(overrideDir.trim()) : typeof session.workspace === "string" && session.workspace.trim() ? import_node_path3.default.resolve(session.workspace.trim()) : "";
|
|
91198
90754
|
if (!dir) {
|
|
91199
90755
|
throw new Error(`Saved history ${session.providerSessionId} is missing workspace metadata. Pass --dir to resume it explicitly.`);
|
|
91200
90756
|
}
|
|
@@ -91314,7 +90870,7 @@ function registerSetupCommands(program2, getProviderLoader2) {
|
|
|
91314
90870
|
console.log(source_default.gray(" Then run: adhdev launch " + targetArg));
|
|
91315
90871
|
process.exit(1);
|
|
91316
90872
|
}
|
|
91317
|
-
const resolvedDir =
|
|
90873
|
+
const resolvedDir = import_node_path3.default.resolve(workingDir);
|
|
91318
90874
|
const result = await sendDaemonCommand("launch_cli", {
|
|
91319
90875
|
cliType,
|
|
91320
90876
|
dir: resolvedDir
|
|
@@ -91786,9 +91342,9 @@ function registerSetupCommands(program2, getProviderLoader2) {
|
|
|
91786
91342
|
});
|
|
91787
91343
|
program2.command("uninstall").description("Completely wipe all setting, configuration, stop daemon and uninstall service").option("-f, --force", "Skip confirmation prompt").action(async (options) => {
|
|
91788
91344
|
const inquirer2 = await Promise.resolve().then(() => (init_lib(), lib_exports));
|
|
91789
|
-
const
|
|
91790
|
-
const
|
|
91791
|
-
const
|
|
91345
|
+
const fs22 = await import("fs");
|
|
91346
|
+
const path35 = await import("path");
|
|
91347
|
+
const os30 = await import("os");
|
|
91792
91348
|
const { spawnSync: spawnSync3 } = await import("child_process");
|
|
91793
91349
|
if (!options.force) {
|
|
91794
91350
|
const { confirm } = await inquirer2.default.prompt([
|
|
@@ -91813,11 +91369,11 @@ function registerSetupCommands(program2, getProviderLoader2) {
|
|
|
91813
91369
|
}
|
|
91814
91370
|
console.log(source_default.gray(" Removing OS background service..."));
|
|
91815
91371
|
spawnSync3(process.execPath, [process.argv[1], "service", "uninstall"], { stdio: "inherit" });
|
|
91816
|
-
const adhdevDir =
|
|
91817
|
-
if (
|
|
91372
|
+
const adhdevDir = path35.join(os30.homedir(), ".adhdev");
|
|
91373
|
+
if (fs22.existsSync(adhdevDir)) {
|
|
91818
91374
|
console.log(source_default.gray(` Deleting ${adhdevDir}...`));
|
|
91819
91375
|
try {
|
|
91820
|
-
|
|
91376
|
+
fs22.rmSync(adhdevDir, { recursive: true, force: true });
|
|
91821
91377
|
console.log(source_default.green(" \u2713 Data wiped."));
|
|
91822
91378
|
} catch (e) {
|
|
91823
91379
|
console.log(source_default.red(` \u2717 Failed to delete ~/.adhdev: ${e.message}`));
|
|
@@ -91836,11 +91392,11 @@ init_source();
|
|
|
91836
91392
|
init_src();
|
|
91837
91393
|
|
|
91838
91394
|
// src/cli/runtime-tools.ts
|
|
91839
|
-
var
|
|
91840
|
-
var
|
|
91395
|
+
var fs19 = __toESM(require("fs"));
|
|
91396
|
+
var path30 = __toESM(require("path"));
|
|
91841
91397
|
function defaultPackageRoot() {
|
|
91842
|
-
const currentCliPath = process.argv[1] ?
|
|
91843
|
-
return
|
|
91398
|
+
const currentCliPath = process.argv[1] ? fs19.realpathSync.native(process.argv[1]) : process.cwd();
|
|
91399
|
+
return path30.resolve(path30.dirname(currentCliPath), "../..");
|
|
91844
91400
|
}
|
|
91845
91401
|
function normalizePath2(value) {
|
|
91846
91402
|
return value.replace(/\\/g, "/").toLowerCase();
|
|
@@ -91849,19 +91405,19 @@ function shouldPreferSource(currentCliPath, packageRoot) {
|
|
|
91849
91405
|
const normalizedCliPath = normalizePath2(currentCliPath || "");
|
|
91850
91406
|
if (normalizedCliPath.includes("/src/cli/")) return true;
|
|
91851
91407
|
if (normalizedCliPath.includes("/dist/cli/")) return false;
|
|
91852
|
-
return
|
|
91408
|
+
return fs19.existsSync(path30.join(packageRoot, "src", "cli", "index.ts"));
|
|
91853
91409
|
}
|
|
91854
91410
|
function getVendoredToolEntry(packageRoot, tool) {
|
|
91855
91411
|
if (tool === "session-host-daemon") {
|
|
91856
|
-
return
|
|
91412
|
+
return path30.join(packageRoot, "vendor", "session-host-daemon", "index.js");
|
|
91857
91413
|
}
|
|
91858
|
-
return
|
|
91414
|
+
return path30.join(packageRoot, "vendor", "terminal-mux-cli", "index.js");
|
|
91859
91415
|
}
|
|
91860
91416
|
function getSourceToolEntry(packageRoot, tool) {
|
|
91861
91417
|
if (tool === "session-host-daemon") {
|
|
91862
|
-
return
|
|
91418
|
+
return path30.resolve(packageRoot, "../../oss/packages/session-host-daemon/src/index.ts");
|
|
91863
91419
|
}
|
|
91864
|
-
return
|
|
91420
|
+
return path30.resolve(packageRoot, "../../oss/packages/terminal-mux-cli/src/index.ts");
|
|
91865
91421
|
}
|
|
91866
91422
|
function getGlobalToolCommand(tool) {
|
|
91867
91423
|
return tool === "session-host-daemon" ? "adhdev-sessiond" : "adhmux";
|
|
@@ -91874,7 +91430,7 @@ function resolveRuntimeToolLaunch(tool, context = {}) {
|
|
|
91874
91430
|
const vendoredEntry = getVendoredToolEntry(packageRoot, tool);
|
|
91875
91431
|
const resolutionOrder = preferSource ? ["source", "vendored", "global"] : ["vendored", "source", "global"];
|
|
91876
91432
|
for (const resolution of resolutionOrder) {
|
|
91877
|
-
if (resolution === "source" &&
|
|
91433
|
+
if (resolution === "source" && fs19.existsSync(sourceEntry)) {
|
|
91878
91434
|
return {
|
|
91879
91435
|
tool,
|
|
91880
91436
|
resolvedVia: "source",
|
|
@@ -91883,7 +91439,7 @@ function resolveRuntimeToolLaunch(tool, context = {}) {
|
|
|
91883
91439
|
env: env3
|
|
91884
91440
|
};
|
|
91885
91441
|
}
|
|
91886
|
-
if (resolution === "vendored" &&
|
|
91442
|
+
if (resolution === "vendored" && fs19.existsSync(vendoredEntry)) {
|
|
91887
91443
|
return {
|
|
91888
91444
|
tool,
|
|
91889
91445
|
resolvedVia: "vendored",
|
|
@@ -93014,9 +92570,9 @@ function registerDaemonCommands(program2, pkgVersion3) {
|
|
|
93014
92570
|
// src/cli/doctor-commands.ts
|
|
93015
92571
|
init_source();
|
|
93016
92572
|
var import_child_process15 = require("child_process");
|
|
93017
|
-
var
|
|
93018
|
-
var
|
|
93019
|
-
var
|
|
92573
|
+
var fs21 = __toESM(require("fs"));
|
|
92574
|
+
var os29 = __toESM(require("os"));
|
|
92575
|
+
var path33 = __toESM(require("path"));
|
|
93020
92576
|
init_src();
|
|
93021
92577
|
init_session_host();
|
|
93022
92578
|
|
|
@@ -93132,33 +92688,33 @@ function buildDoctorAdvice(input) {
|
|
|
93132
92688
|
}
|
|
93133
92689
|
|
|
93134
92690
|
// src/cli/service-commands.ts
|
|
93135
|
-
var
|
|
93136
|
-
var
|
|
93137
|
-
var
|
|
93138
|
-
var
|
|
92691
|
+
var import_node_fs3 = __toESM(require("fs"));
|
|
92692
|
+
var import_node_path4 = __toESM(require("path"));
|
|
92693
|
+
var import_node_os5 = __toESM(require("os"));
|
|
92694
|
+
var import_node_child_process = require("child_process");
|
|
93139
92695
|
init_source();
|
|
93140
92696
|
init_src();
|
|
93141
92697
|
var DEFAULT_LOCAL_DAEMON_HEALTH_TIMEOUT_MS3 = 1500;
|
|
93142
92698
|
var LAUNCHD_LABEL = "dev.adhf.daemon";
|
|
93143
|
-
var ADHDEV_DIR =
|
|
93144
|
-
var LOG_OUT =
|
|
93145
|
-
var LOG_ERR =
|
|
92699
|
+
var ADHDEV_DIR = import_node_path4.default.join(import_node_os5.default.homedir(), ".adhdev");
|
|
92700
|
+
var LOG_OUT = import_node_path4.default.join(ADHDEV_DIR, "daemon-launchd.out");
|
|
92701
|
+
var LOG_ERR = import_node_path4.default.join(ADHDEV_DIR, "daemon-launchd.err");
|
|
93146
92702
|
var MAX_LOG_SIZE2 = 10 * 1024 * 1024;
|
|
93147
92703
|
function getDarwinPlistPath() {
|
|
93148
|
-
return
|
|
92704
|
+
return import_node_path4.default.join(import_node_os5.default.homedir(), "Library", "LaunchAgents", `${LAUNCHD_LABEL}.plist`);
|
|
93149
92705
|
}
|
|
93150
92706
|
function getWindowsStartupDir() {
|
|
93151
|
-
const appData = process.env.APPDATA ||
|
|
93152
|
-
return
|
|
92707
|
+
const appData = process.env.APPDATA || import_node_path4.default.join(import_node_os5.default.homedir(), "AppData", "Roaming");
|
|
92708
|
+
return import_node_path4.default.join(appData, "Microsoft", "Windows", "Start Menu", "Programs", "Startup");
|
|
93153
92709
|
}
|
|
93154
92710
|
function getWindowsVbsPath() {
|
|
93155
|
-
return
|
|
92711
|
+
return import_node_path4.default.join(getWindowsStartupDir(), "adhdev-daemon.vbs");
|
|
93156
92712
|
}
|
|
93157
92713
|
function resolveCliPath() {
|
|
93158
|
-
return
|
|
92714
|
+
return import_node_fs3.default.realpathSync(process.argv[1]);
|
|
93159
92715
|
}
|
|
93160
92716
|
function ensureDir(dir) {
|
|
93161
|
-
if (!
|
|
92717
|
+
if (!import_node_fs3.default.existsSync(dir)) import_node_fs3.default.mkdirSync(dir, { recursive: true });
|
|
93162
92718
|
}
|
|
93163
92719
|
async function fetchHealth() {
|
|
93164
92720
|
const controller = new AbortController();
|
|
@@ -93176,12 +92732,12 @@ async function fetchHealth() {
|
|
|
93176
92732
|
function getProcessInfo(pid) {
|
|
93177
92733
|
try {
|
|
93178
92734
|
if (process.platform === "win32") {
|
|
93179
|
-
const out = (0,
|
|
92735
|
+
const out = (0, import_node_child_process.execSync)(`tasklist /FI "PID eq ${pid}" /FO CSV /NH`, { encoding: "utf-8" });
|
|
93180
92736
|
const match = out.match(/"(\d[\d,]+)\sK"/);
|
|
93181
92737
|
const memKB = match ? parseInt(match[1].replace(/,/g, ""), 10) : 0;
|
|
93182
92738
|
return { uptime: "-", memMB: Math.round(memKB / 1024) };
|
|
93183
92739
|
} else {
|
|
93184
|
-
const out = (0,
|
|
92740
|
+
const out = (0, import_node_child_process.execSync)(`ps -o etime=,rss= -p ${pid}`, { encoding: "utf-8" }).trim();
|
|
93185
92741
|
const parts = out.split(/\s+/);
|
|
93186
92742
|
const etime = parts[0] || "-";
|
|
93187
92743
|
const rssKB = parseInt(parts[1] || "0", 10);
|
|
@@ -93200,13 +92756,13 @@ function formatElapsed(etime) {
|
|
|
93200
92756
|
}
|
|
93201
92757
|
function rotateLogIfNeeded(logPath) {
|
|
93202
92758
|
try {
|
|
93203
|
-
if (!
|
|
93204
|
-
const stat4 =
|
|
92759
|
+
if (!import_node_fs3.default.existsSync(logPath)) return;
|
|
92760
|
+
const stat4 = import_node_fs3.default.statSync(logPath);
|
|
93205
92761
|
if (stat4.size > MAX_LOG_SIZE2) {
|
|
93206
92762
|
const rotated = logPath + ".old";
|
|
93207
|
-
if (
|
|
93208
|
-
|
|
93209
|
-
|
|
92763
|
+
if (import_node_fs3.default.existsSync(rotated)) import_node_fs3.default.unlinkSync(rotated);
|
|
92764
|
+
import_node_fs3.default.renameSync(logPath, rotated);
|
|
92765
|
+
import_node_fs3.default.writeFileSync(logPath, `[log rotated at ${(/* @__PURE__ */ new Date()).toISOString()}]
|
|
93210
92766
|
`, "utf-8");
|
|
93211
92767
|
}
|
|
93212
92768
|
} catch {
|
|
@@ -93217,8 +92773,8 @@ function rotateLogs() {
|
|
|
93217
92773
|
rotateLogIfNeeded(LOG_ERR);
|
|
93218
92774
|
}
|
|
93219
92775
|
function buildPlist(nodeExe, cliExe) {
|
|
93220
|
-
const brewPrefix =
|
|
93221
|
-
const nodeDir =
|
|
92776
|
+
const brewPrefix = import_node_fs3.default.existsSync("/opt/homebrew/bin") ? "/opt/homebrew/bin" : "/usr/local/bin";
|
|
92777
|
+
const nodeDir = import_node_path4.default.dirname(nodeExe);
|
|
93222
92778
|
const pathEntries = /* @__PURE__ */ new Set([nodeDir, brewPrefix, "/usr/local/bin", "/usr/bin", "/bin", "/usr/sbin", "/sbin"]);
|
|
93223
92779
|
const pathValue = Array.from(pathEntries).join(":");
|
|
93224
92780
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
@@ -93257,15 +92813,15 @@ function buildPlist(nodeExe, cliExe) {
|
|
|
93257
92813
|
function installDarwin(nodeExe, cliExe) {
|
|
93258
92814
|
const plistPath = getDarwinPlistPath();
|
|
93259
92815
|
ensureDir(ADHDEV_DIR);
|
|
93260
|
-
ensureDir(
|
|
93261
|
-
|
|
92816
|
+
ensureDir(import_node_path4.default.dirname(plistPath));
|
|
92817
|
+
import_node_fs3.default.writeFileSync(plistPath, buildPlist(nodeExe, cliExe), "utf-8");
|
|
93262
92818
|
console.log(source_default.gray(` Plist: ${plistPath}`));
|
|
93263
92819
|
try {
|
|
93264
|
-
(0,
|
|
92820
|
+
(0, import_node_child_process.execSync)(`launchctl unload "${plistPath}" 2>/dev/null`, { stdio: "ignore" });
|
|
93265
92821
|
} catch {
|
|
93266
92822
|
}
|
|
93267
92823
|
try {
|
|
93268
|
-
(0,
|
|
92824
|
+
(0, import_node_child_process.execSync)(`launchctl load -w "${plistPath}"`, { stdio: "ignore" });
|
|
93269
92825
|
console.log(source_default.green("\n \u2713 Registered as LaunchAgent \u2014 daemon will start on login."));
|
|
93270
92826
|
console.log(source_default.gray(` Logs: ~/.adhdev/daemon-launchd.{out,err}`));
|
|
93271
92827
|
} catch (e) {
|
|
@@ -93275,22 +92831,22 @@ function installDarwin(nodeExe, cliExe) {
|
|
|
93275
92831
|
}
|
|
93276
92832
|
function uninstallDarwin() {
|
|
93277
92833
|
const plistPath = getDarwinPlistPath();
|
|
93278
|
-
if (!
|
|
92834
|
+
if (!import_node_fs3.default.existsSync(plistPath)) {
|
|
93279
92835
|
console.log(source_default.yellow("\n \u26A0 Service is not installed."));
|
|
93280
92836
|
return;
|
|
93281
92837
|
}
|
|
93282
92838
|
try {
|
|
93283
|
-
(0,
|
|
92839
|
+
(0, import_node_child_process.execSync)(`launchctl unload "${plistPath}" 2>/dev/null`, { stdio: "ignore" });
|
|
93284
92840
|
} catch {
|
|
93285
92841
|
}
|
|
93286
|
-
|
|
92842
|
+
import_node_fs3.default.unlinkSync(plistPath);
|
|
93287
92843
|
console.log(source_default.green("\n \u2713 Removed LaunchAgent. Daemon will no longer auto-start."));
|
|
93288
92844
|
}
|
|
93289
92845
|
function isInstalledDarwin() {
|
|
93290
|
-
return
|
|
92846
|
+
return import_node_fs3.default.existsSync(getDarwinPlistPath());
|
|
93291
92847
|
}
|
|
93292
92848
|
function buildVbs(nodeExe, cliExe) {
|
|
93293
|
-
const logFile =
|
|
92849
|
+
const logFile = import_node_path4.default.join(ADHDEV_DIR, "daemon-service.log").replace(/\\/g, "\\\\");
|
|
93294
92850
|
const escapedNodeExe = nodeExe.replace(/\\/g, "\\\\");
|
|
93295
92851
|
const escapedCliExe = cliExe.replace(/\\/g, "\\\\");
|
|
93296
92852
|
return `' ADHDev Daemon Auto-Start (generated by adhdev service install)
|
|
@@ -93301,39 +92857,39 @@ WshShell.Run "cmd.exe /c """"${escapedNodeExe}"""" """"${escapedCliExe}"""" daem
|
|
|
93301
92857
|
function installWindows(nodeExe, cliExe) {
|
|
93302
92858
|
const vbsPath = getWindowsVbsPath();
|
|
93303
92859
|
ensureDir(ADHDEV_DIR);
|
|
93304
|
-
ensureDir(
|
|
93305
|
-
|
|
92860
|
+
ensureDir(import_node_path4.default.dirname(vbsPath));
|
|
92861
|
+
import_node_fs3.default.writeFileSync(vbsPath, buildVbs(nodeExe, cliExe), "utf-8");
|
|
93306
92862
|
console.log(source_default.gray(` Startup script: ${vbsPath}`));
|
|
93307
92863
|
console.log(source_default.green("\n \u2713 Registered in Startup folder \u2014 daemon will start on login (hidden)."));
|
|
93308
|
-
console.log(source_default.gray(` Logs: ${
|
|
92864
|
+
console.log(source_default.gray(` Logs: ${import_node_path4.default.join(ADHDEV_DIR, "daemon-service.log")}`));
|
|
93309
92865
|
console.log(source_default.gray(" To start now without rebooting, run: adhdev daemon"));
|
|
93310
92866
|
}
|
|
93311
92867
|
function uninstallWindows() {
|
|
93312
92868
|
const vbsPath = getWindowsVbsPath();
|
|
93313
|
-
if (!
|
|
92869
|
+
if (!import_node_fs3.default.existsSync(vbsPath)) {
|
|
93314
92870
|
console.log(source_default.yellow("\n \u26A0 Service is not installed."));
|
|
93315
92871
|
return;
|
|
93316
92872
|
}
|
|
93317
|
-
|
|
92873
|
+
import_node_fs3.default.unlinkSync(vbsPath);
|
|
93318
92874
|
console.log(source_default.green("\n \u2713 Removed Startup script. Daemon will no longer auto-start."));
|
|
93319
92875
|
console.log(source_default.gray(" Note: a currently running daemon is not affected. Stop with: adhdev daemon:stop"));
|
|
93320
92876
|
}
|
|
93321
92877
|
function isInstalledWindows() {
|
|
93322
|
-
return
|
|
92878
|
+
return import_node_fs3.default.existsSync(getWindowsVbsPath());
|
|
93323
92879
|
}
|
|
93324
92880
|
function registerServiceCommands(program2) {
|
|
93325
92881
|
const svc = program2.command("service").description("\u{1F50C} Manage ADHDev as an OS background auto-start service");
|
|
93326
92882
|
svc.command("install").description("Register ADHDev daemon to start automatically on login").action(async () => {
|
|
93327
92883
|
console.log(source_default.bold("\n \u{1F680} Installing ADHDev Background Service"));
|
|
93328
|
-
const
|
|
92884
|
+
const platform12 = import_node_os5.default.platform();
|
|
93329
92885
|
const nodeExe = process.execPath;
|
|
93330
92886
|
const cliExe = resolveCliPath();
|
|
93331
92887
|
console.log(source_default.gray(` Node: ${nodeExe}`));
|
|
93332
92888
|
console.log(source_default.gray(` CLI: ${cliExe}`));
|
|
93333
|
-
console.log(source_default.gray(` Platform: ${
|
|
93334
|
-
if (
|
|
92889
|
+
console.log(source_default.gray(` Platform: ${platform12}`));
|
|
92890
|
+
if (platform12 === "darwin") {
|
|
93335
92891
|
installDarwin(nodeExe, cliExe);
|
|
93336
|
-
} else if (
|
|
92892
|
+
} else if (platform12 === "win32") {
|
|
93337
92893
|
installWindows(nodeExe, cliExe);
|
|
93338
92894
|
} else {
|
|
93339
92895
|
console.log(source_default.yellow("\n \u26A0 Auto-start service install is not supported on this platform."));
|
|
@@ -93344,10 +92900,10 @@ function registerServiceCommands(program2) {
|
|
|
93344
92900
|
});
|
|
93345
92901
|
svc.command("uninstall").description("Remove the OS background service").action(async () => {
|
|
93346
92902
|
console.log(source_default.bold("\n \u{1F5D1}\uFE0F Removing ADHDev Background Service"));
|
|
93347
|
-
const
|
|
93348
|
-
if (
|
|
92903
|
+
const platform12 = import_node_os5.default.platform();
|
|
92904
|
+
if (platform12 === "darwin") {
|
|
93349
92905
|
uninstallDarwin();
|
|
93350
|
-
} else if (
|
|
92906
|
+
} else if (platform12 === "win32") {
|
|
93351
92907
|
uninstallWindows();
|
|
93352
92908
|
} else {
|
|
93353
92909
|
console.log(source_default.yellow("\n \u26A0 Not supported on this platform."));
|
|
@@ -93355,11 +92911,11 @@ function registerServiceCommands(program2) {
|
|
|
93355
92911
|
console.log();
|
|
93356
92912
|
});
|
|
93357
92913
|
svc.command("status").description("Show service installation state and live daemon health").action(async () => {
|
|
93358
|
-
const
|
|
93359
|
-
const installed =
|
|
92914
|
+
const platform12 = import_node_os5.default.platform();
|
|
92915
|
+
const installed = platform12 === "darwin" ? isInstalledDarwin() : platform12 === "win32" ? isInstalledWindows() : false;
|
|
93360
92916
|
if (installed) {
|
|
93361
92917
|
console.log(source_default.green("\n \u2713 Service is installed."));
|
|
93362
|
-
if (
|
|
92918
|
+
if (platform12 === "darwin") console.log(source_default.gray(` Plist: ${getDarwinPlistPath()}`));
|
|
93363
92919
|
else console.log(source_default.gray(` Script: ${getWindowsVbsPath()}`));
|
|
93364
92920
|
} else {
|
|
93365
92921
|
console.log(source_default.gray("\n \u2717 Service is not installed. Run: adhdev service install"));
|
|
@@ -93375,8 +92931,8 @@ function registerServiceCommands(program2) {
|
|
|
93375
92931
|
} else {
|
|
93376
92932
|
console.log(source_default.yellow(" \u2717 Daemon is not running."));
|
|
93377
92933
|
}
|
|
93378
|
-
const outSize =
|
|
93379
|
-
const errSize =
|
|
92934
|
+
const outSize = import_node_fs3.default.existsSync(LOG_OUT) ? import_node_fs3.default.statSync(LOG_OUT).size : 0;
|
|
92935
|
+
const errSize = import_node_fs3.default.existsSync(LOG_ERR) ? import_node_fs3.default.statSync(LOG_ERR).size : 0;
|
|
93380
92936
|
if (outSize > 0 || errSize > 0) {
|
|
93381
92937
|
console.log(source_default.gray(` Logs: stdout ${formatBytes(outSize)}, stderr ${formatBytes(errSize)}`));
|
|
93382
92938
|
}
|
|
@@ -93385,13 +92941,13 @@ function registerServiceCommands(program2) {
|
|
|
93385
92941
|
svc.command("logs").description("View daemon service logs").option("--err", "Show stderr log instead of stdout").option("--clear", "Truncate all log files").option("-n, --lines <count>", "Number of lines to show", "30").action(async (options) => {
|
|
93386
92942
|
if (options.clear) {
|
|
93387
92943
|
for (const f of [LOG_OUT, LOG_ERR]) {
|
|
93388
|
-
if (
|
|
92944
|
+
if (import_node_fs3.default.existsSync(f)) import_node_fs3.default.writeFileSync(f, "", "utf-8");
|
|
93389
92945
|
}
|
|
93390
92946
|
console.log(source_default.green("\n \u2713 Logs cleared.\n"));
|
|
93391
92947
|
return;
|
|
93392
92948
|
}
|
|
93393
92949
|
const logFile = options.err ? LOG_ERR : LOG_OUT;
|
|
93394
|
-
if (!
|
|
92950
|
+
if (!import_node_fs3.default.existsSync(logFile)) {
|
|
93395
92951
|
console.log(source_default.gray(`
|
|
93396
92952
|
No log file found: ${logFile}
|
|
93397
92953
|
`));
|
|
@@ -93401,20 +92957,20 @@ function registerServiceCommands(program2) {
|
|
|
93401
92957
|
console.log(source_default.gray(`
|
|
93402
92958
|
\u2500\u2500 ${options.err ? "stderr" : "stdout"}: ${logFile} (last ${lines} lines) \u2500\u2500
|
|
93403
92959
|
`));
|
|
93404
|
-
const content =
|
|
92960
|
+
const content = import_node_fs3.default.readFileSync(logFile, "utf-8");
|
|
93405
92961
|
const allLines = content.split("\n");
|
|
93406
92962
|
const lastLines = allLines.slice(-lines).join("\n");
|
|
93407
92963
|
if (lastLines.trim()) console.log(lastLines);
|
|
93408
92964
|
console.log(source_default.gray("\n (watching for new output, Ctrl+C to stop)\n"));
|
|
93409
92965
|
let offset = Buffer.byteLength(content, "utf-8");
|
|
93410
|
-
const watcher =
|
|
92966
|
+
const watcher = import_node_fs3.default.watchFile(logFile, { interval: 500 }, () => {
|
|
93411
92967
|
try {
|
|
93412
|
-
const stat4 =
|
|
92968
|
+
const stat4 = import_node_fs3.default.statSync(logFile);
|
|
93413
92969
|
if (stat4.size > offset) {
|
|
93414
|
-
const fd =
|
|
92970
|
+
const fd = import_node_fs3.default.openSync(logFile, "r");
|
|
93415
92971
|
const buf = Buffer.alloc(stat4.size - offset);
|
|
93416
|
-
|
|
93417
|
-
|
|
92972
|
+
import_node_fs3.default.readSync(fd, buf, 0, buf.length, offset);
|
|
92973
|
+
import_node_fs3.default.closeSync(fd);
|
|
93418
92974
|
process.stdout.write(buf.toString("utf-8"));
|
|
93419
92975
|
offset = stat4.size;
|
|
93420
92976
|
} else if (stat4.size < offset) {
|
|
@@ -93424,15 +92980,15 @@ function registerServiceCommands(program2) {
|
|
|
93424
92980
|
}
|
|
93425
92981
|
});
|
|
93426
92982
|
const cleanup = () => {
|
|
93427
|
-
|
|
92983
|
+
import_node_fs3.default.unwatchFile(logFile);
|
|
93428
92984
|
process.exit(0);
|
|
93429
92985
|
};
|
|
93430
92986
|
process.on("SIGINT", cleanup);
|
|
93431
92987
|
process.on("SIGTERM", cleanup);
|
|
93432
92988
|
});
|
|
93433
92989
|
svc.command("restart").description("Restart the daemon process (service will auto-relaunch)").action(async () => {
|
|
93434
|
-
const
|
|
93435
|
-
const installed =
|
|
92990
|
+
const platform12 = import_node_os5.default.platform();
|
|
92991
|
+
const installed = platform12 === "darwin" ? isInstalledDarwin() : platform12 === "win32" ? isInstalledWindows() : false;
|
|
93436
92992
|
if (!installed) {
|
|
93437
92993
|
console.log(source_default.yellow("\n \u26A0 Service is not installed. Use `adhdev daemon:restart` for manual restart."));
|
|
93438
92994
|
console.log(source_default.gray(" Or install the service first: adhdev service install\n"));
|
|
@@ -93442,10 +92998,10 @@ function registerServiceCommands(program2) {
|
|
|
93442
92998
|
const health = await fetchHealth();
|
|
93443
92999
|
if (!health?.pid) {
|
|
93444
93000
|
console.log(source_default.yellow("\n \u26A0 Daemon is not currently running."));
|
|
93445
|
-
if (
|
|
93001
|
+
if (platform12 === "darwin") {
|
|
93446
93002
|
console.log(source_default.gray(" Starting via launchctl..."));
|
|
93447
93003
|
try {
|
|
93448
|
-
(0,
|
|
93004
|
+
(0, import_node_child_process.execSync)(`launchctl start ${LAUNCHD_LABEL}`, { stdio: "ignore" });
|
|
93449
93005
|
console.log(source_default.green(" \u2713 Started.\n"));
|
|
93450
93006
|
} catch {
|
|
93451
93007
|
console.log(source_default.red(" \u2717 Failed to start. Check: adhdev service logs --err\n"));
|
|
@@ -93463,11 +93019,11 @@ function registerServiceCommands(program2) {
|
|
|
93463
93019
|
console.log(source_default.yellow(" Could not send SIGTERM. Process may have already exited."));
|
|
93464
93020
|
}
|
|
93465
93021
|
await new Promise((r) => setTimeout(r, 2e3));
|
|
93466
|
-
if (
|
|
93022
|
+
if (platform12 === "win32") {
|
|
93467
93023
|
const vbsPath = getWindowsVbsPath();
|
|
93468
|
-
if (
|
|
93024
|
+
if (import_node_fs3.default.existsSync(vbsPath)) {
|
|
93469
93025
|
try {
|
|
93470
|
-
(0,
|
|
93026
|
+
(0, import_node_child_process.execSync)(`wscript.exe "${vbsPath}"`, { stdio: "ignore", windowsHide: true });
|
|
93471
93027
|
} catch {
|
|
93472
93028
|
}
|
|
93473
93029
|
}
|
|
@@ -93499,11 +93055,11 @@ function formatBytes(bytes) {
|
|
|
93499
93055
|
|
|
93500
93056
|
// src/cli/doctor-commands.ts
|
|
93501
93057
|
function resolvePackageRoot() {
|
|
93502
|
-
return
|
|
93058
|
+
return path33.resolve(__dirname, "..", "..");
|
|
93503
93059
|
}
|
|
93504
93060
|
function isLinkedInstall(packageRoot) {
|
|
93505
|
-
const normalized =
|
|
93506
|
-
return !normalized.includes(`${
|
|
93061
|
+
const normalized = path33.normalize(packageRoot);
|
|
93062
|
+
return !normalized.includes(`${path33.sep}node_modules${path33.sep}adhdev`);
|
|
93507
93063
|
}
|
|
93508
93064
|
function formatCheck(check2) {
|
|
93509
93065
|
const icon = check2.ok ? source_default.green("\u2713") : source_default.red("\u2717");
|
|
@@ -93587,11 +93143,11 @@ function probeSharpRuntime(packageRoot, nativeSharpPackage) {
|
|
|
93587
93143
|
}
|
|
93588
93144
|
}
|
|
93589
93145
|
function probeConfigAccess() {
|
|
93590
|
-
const configDir =
|
|
93591
|
-
const configPath =
|
|
93146
|
+
const configDir = path33.join(os29.homedir(), ".adhdev");
|
|
93147
|
+
const configPath = path33.join(configDir, "config.json");
|
|
93592
93148
|
const checks = [];
|
|
93593
93149
|
try {
|
|
93594
|
-
|
|
93150
|
+
fs21.mkdirSync(configDir, { recursive: true });
|
|
93595
93151
|
checks.push({
|
|
93596
93152
|
label: "Config directory",
|
|
93597
93153
|
ok: true,
|
|
@@ -93606,8 +93162,8 @@ function probeConfigAccess() {
|
|
|
93606
93162
|
}];
|
|
93607
93163
|
}
|
|
93608
93164
|
try {
|
|
93609
|
-
if (
|
|
93610
|
-
|
|
93165
|
+
if (fs21.existsSync(configPath)) {
|
|
93166
|
+
fs21.readFileSync(configPath, "utf-8");
|
|
93611
93167
|
checks.push({
|
|
93612
93168
|
label: "Config file",
|
|
93613
93169
|
ok: true,
|
|
@@ -93628,10 +93184,10 @@ function probeConfigAccess() {
|
|
|
93628
93184
|
fatal: true
|
|
93629
93185
|
});
|
|
93630
93186
|
}
|
|
93631
|
-
const probePath =
|
|
93187
|
+
const probePath = path33.join(configDir, `.doctor-write-${process.pid}-${Date.now()}.tmp`);
|
|
93632
93188
|
try {
|
|
93633
|
-
|
|
93634
|
-
|
|
93189
|
+
fs21.writeFileSync(probePath, "ok", "utf-8");
|
|
93190
|
+
fs21.rmSync(probePath, { force: true });
|
|
93635
93191
|
checks.push({
|
|
93636
93192
|
label: "Config write",
|
|
93637
93193
|
ok: true,
|
|
@@ -93639,7 +93195,7 @@ function probeConfigAccess() {
|
|
|
93639
93195
|
});
|
|
93640
93196
|
} catch (error48) {
|
|
93641
93197
|
try {
|
|
93642
|
-
|
|
93198
|
+
fs21.rmSync(probePath, { force: true });
|
|
93643
93199
|
} catch {
|
|
93644
93200
|
}
|
|
93645
93201
|
checks.push({
|
|
@@ -93695,9 +93251,9 @@ function probeCliBinary(commandPath, currentVersion) {
|
|
|
93695
93251
|
return probe;
|
|
93696
93252
|
}
|
|
93697
93253
|
function readLogHints(logPath) {
|
|
93698
|
-
if (!
|
|
93254
|
+
if (!fs21.existsSync(logPath)) return [];
|
|
93699
93255
|
try {
|
|
93700
|
-
const content =
|
|
93256
|
+
const content = fs21.readFileSync(logPath, "utf-8");
|
|
93701
93257
|
const lines = content.split(/\r?\n/);
|
|
93702
93258
|
const recent = lines.slice(-400);
|
|
93703
93259
|
const hits = recent.filter(
|
|
@@ -93711,11 +93267,11 @@ function readLogHints(logPath) {
|
|
|
93711
93267
|
function buildBrowseProbeChecks() {
|
|
93712
93268
|
const probes = process.platform === "win32" ? [
|
|
93713
93269
|
process.env.SystemDrive ? `${process.env.SystemDrive.replace(/[\\/]+$/, "")}\\` : "C:\\",
|
|
93714
|
-
|
|
93715
|
-
] : ["/",
|
|
93270
|
+
os29.homedir()
|
|
93271
|
+
] : ["/", os29.homedir()];
|
|
93716
93272
|
return probes.map((probePath, index) => {
|
|
93717
93273
|
try {
|
|
93718
|
-
const entries =
|
|
93274
|
+
const entries = fs21.readdirSync(probePath, { withFileTypes: true });
|
|
93719
93275
|
const directoryCount = entries.filter((entry) => entry.isDirectory()).length;
|
|
93720
93276
|
return {
|
|
93721
93277
|
label: index === 0 ? "Folder browse root" : "Folder browse home",
|
|
@@ -93735,7 +93291,7 @@ function buildBrowseProbeChecks() {
|
|
|
93735
93291
|
function registerDoctorCommands(program2, pkgVersion3) {
|
|
93736
93292
|
program2.command("doctor").description("Diagnose install, native dependencies, CLI resolution, and folder browse access").action(async () => {
|
|
93737
93293
|
const packageRoot = resolvePackageRoot();
|
|
93738
|
-
const cliPath =
|
|
93294
|
+
const cliPath = fs21.realpathSync(process.argv[1]);
|
|
93739
93295
|
const linked = isLinkedInstall(packageRoot);
|
|
93740
93296
|
const logPath = getCurrentDaemonLogPath();
|
|
93741
93297
|
const claudePaths = findCommandPaths("claude");
|
|
@@ -93817,12 +93373,12 @@ function registerDoctorCommands(program2, pkgVersion3) {
|
|
|
93817
93373
|
});
|
|
93818
93374
|
}
|
|
93819
93375
|
if (process.platform === "darwin") {
|
|
93820
|
-
serviceDefinitionPath =
|
|
93821
|
-
if (
|
|
93376
|
+
serviceDefinitionPath = path33.join(os29.homedir(), "Library", "LaunchAgents", "dev.adhf.daemon.plist");
|
|
93377
|
+
if (fs21.existsSync(serviceDefinitionPath)) {
|
|
93822
93378
|
serviceDefinitionCheck = evaluateServiceDefinitionDrift({
|
|
93823
93379
|
serviceKind: "launchd",
|
|
93824
93380
|
servicePath: serviceDefinitionPath,
|
|
93825
|
-
installedDefinition:
|
|
93381
|
+
installedDefinition: fs21.readFileSync(serviceDefinitionPath, "utf8"),
|
|
93826
93382
|
expectedDefinition: buildPlist(process.execPath, cliPath)
|
|
93827
93383
|
});
|
|
93828
93384
|
checks.push({
|
|
@@ -93890,12 +93446,12 @@ function registerDoctorCommands(program2, pkgVersion3) {
|
|
|
93890
93446
|
serviceCheck: serviceDefinitionCheck || void 0,
|
|
93891
93447
|
sourceCliExample: "node --import tsx packages/daemon-cloud/src/cli/index.ts doctor"
|
|
93892
93448
|
});
|
|
93893
|
-
const sessionHostLogPath =
|
|
93449
|
+
const sessionHostLogPath = path33.join(os29.homedir(), ".adhdev", "logs", "session-host.log");
|
|
93894
93450
|
console.log(source_default.bold("\n\u{1FA7A} ADHDev Doctor\n"));
|
|
93895
93451
|
console.log(source_default.gray(` Version: ${pkgVersion3}`));
|
|
93896
93452
|
console.log(source_default.gray(` Platform: ${process.platform} ${process.arch}`));
|
|
93897
93453
|
console.log(source_default.gray(` Node: ${process.version}`));
|
|
93898
|
-
console.log(source_default.gray(` Home: ${
|
|
93454
|
+
console.log(source_default.gray(` Home: ${os29.homedir()}`));
|
|
93899
93455
|
console.log(source_default.gray(` Log file: ${logPath}`));
|
|
93900
93456
|
console.log(source_default.gray(` SH log: ${sessionHostLogPath}`));
|
|
93901
93457
|
console.log();
|
|
@@ -93932,7 +93488,7 @@ function registerDoctorCommands(program2, pkgVersion3) {
|
|
|
93932
93488
|
|
|
93933
93489
|
// src/cli/provider-commands.ts
|
|
93934
93490
|
init_source();
|
|
93935
|
-
var
|
|
93491
|
+
var path34 = __toESM(require("path"));
|
|
93936
93492
|
init_cdp_utils();
|
|
93937
93493
|
var DEV_SERVER_PORT3 = 19280;
|
|
93938
93494
|
var IDE_AUTO_FIX_FUNCTIONS = [
|
|
@@ -94015,7 +93571,7 @@ function getProviderSourceCandidatePaths(options) {
|
|
|
94015
93571
|
const results = [];
|
|
94016
93572
|
for (const root of roots) {
|
|
94017
93573
|
for (const name of relativeNames) {
|
|
94018
|
-
results.push(
|
|
93574
|
+
results.push(path34.join(root, options.category, options.type, name));
|
|
94019
93575
|
}
|
|
94020
93576
|
}
|
|
94021
93577
|
return results;
|
|
@@ -94150,35 +93706,35 @@ function registerProviderCommands(program2) {
|
|
|
94150
93706
|
let osPaths = {};
|
|
94151
93707
|
let processNames = {};
|
|
94152
93708
|
if (category === "ide") {
|
|
94153
|
-
const
|
|
94154
|
-
const
|
|
94155
|
-
const
|
|
94156
|
-
if (
|
|
93709
|
+
const fs22 = await import("fs");
|
|
93710
|
+
const path35 = await import("path");
|
|
93711
|
+
const os30 = await import("os");
|
|
93712
|
+
if (os30.platform() === "darwin") {
|
|
94157
93713
|
while (true) {
|
|
94158
93714
|
const p = (await rl.question(`macOS Application Path (e.g. /Applications/${defaultName}.app): `)).trim() || `/Applications/${defaultName}.app`;
|
|
94159
93715
|
if (p === "skip") break;
|
|
94160
|
-
if (!
|
|
93716
|
+
if (!fs22.existsSync(p)) {
|
|
94161
93717
|
console.log(source_default.red(` \u2717 Path not found: ${p}`));
|
|
94162
93718
|
console.log(source_default.gray(` (Please provide the exact absolute path to the .app or binary, or type 'skip')`));
|
|
94163
93719
|
continue;
|
|
94164
93720
|
}
|
|
94165
93721
|
console.log(source_default.green(` \u2713 Path verified: ${p}`));
|
|
94166
93722
|
osPaths["darwin"] = [p];
|
|
94167
|
-
processNames["darwin"] =
|
|
93723
|
+
processNames["darwin"] = path35.basename(p, ".app");
|
|
94168
93724
|
break;
|
|
94169
93725
|
}
|
|
94170
|
-
} else if (
|
|
93726
|
+
} else if (os30.platform() === "win32") {
|
|
94171
93727
|
while (true) {
|
|
94172
93728
|
const p = (await rl.question(`Windows Executable Path (e.g. C:\\Program Files\\${defaultName}\\${defaultName}.exe): `)).trim();
|
|
94173
93729
|
if (!p || p === "skip") break;
|
|
94174
|
-
if (!
|
|
93730
|
+
if (!fs22.existsSync(p)) {
|
|
94175
93731
|
console.log(source_default.red(` \u2717 Path not found: ${p}`));
|
|
94176
93732
|
console.log(source_default.gray(` (Please provide the exact absolute path, or type 'skip')`));
|
|
94177
93733
|
continue;
|
|
94178
93734
|
}
|
|
94179
93735
|
console.log(source_default.green(` \u2713 Path verified: ${p}`));
|
|
94180
93736
|
osPaths["win32"] = [p];
|
|
94181
|
-
processNames["win32"] =
|
|
93737
|
+
processNames["win32"] = path35.basename(p, ".exe");
|
|
94182
93738
|
break;
|
|
94183
93739
|
}
|
|
94184
93740
|
}
|
|
@@ -94865,8 +94421,8 @@ function registerCdpCommands(program2) {
|
|
|
94865
94421
|
}
|
|
94866
94422
|
const output = typeof result === "string" ? result : JSON.stringify(result, null, 2);
|
|
94867
94423
|
if (options.output) {
|
|
94868
|
-
const
|
|
94869
|
-
|
|
94424
|
+
const fs22 = await import("fs");
|
|
94425
|
+
fs22.writeFileSync(options.output, output, "utf-8");
|
|
94870
94426
|
console.log(source_default.green(`
|
|
94871
94427
|
\u2713 Saved to ${options.output} (${output.length} chars)
|
|
94872
94428
|
`));
|
|
@@ -94969,8 +94525,8 @@ function registerCdpCommands(program2) {
|
|
|
94969
94525
|
ws.on("message", async (data) => {
|
|
94970
94526
|
const msg = JSON.parse(data.toString());
|
|
94971
94527
|
if (msg.id === 1 && msg.result?.data) {
|
|
94972
|
-
const
|
|
94973
|
-
|
|
94528
|
+
const fs22 = await import("fs");
|
|
94529
|
+
fs22.writeFileSync(options.output, Buffer.from(msg.result.data, "base64"));
|
|
94974
94530
|
console.log(source_default.green(`
|
|
94975
94531
|
\u2713 Screenshot saved to ${options.output}
|
|
94976
94532
|
`));
|