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/index.js
CHANGED
|
@@ -890,17 +890,17 @@ function checkPathExists(paths) {
|
|
|
890
890
|
return null;
|
|
891
891
|
}
|
|
892
892
|
async function detectIDEs(providerLoader) {
|
|
893
|
-
const
|
|
893
|
+
const os28 = (0, import_os2.platform)();
|
|
894
894
|
const results = [];
|
|
895
895
|
for (const def of getMergedDefinitions()) {
|
|
896
896
|
const cliPath = findCliCommand(providerLoader?.getIdeCliCommand(def.id, def.cli) || def.cli);
|
|
897
|
-
const appPath = checkPathExists(providerLoader?.getIdePathCandidates(def.id, def.paths[
|
|
897
|
+
const appPath = checkPathExists(providerLoader?.getIdePathCandidates(def.id, def.paths[os28] || []) || []);
|
|
898
898
|
let resolvedCli = cliPath;
|
|
899
|
-
if (!resolvedCli && appPath &&
|
|
899
|
+
if (!resolvedCli && appPath && os28 === "darwin") {
|
|
900
900
|
const bundledCli = `${appPath}/Contents/Resources/app/bin/${def.cli}`;
|
|
901
901
|
if ((0, import_fs3.existsSync)(bundledCli)) resolvedCli = bundledCli;
|
|
902
902
|
}
|
|
903
|
-
if (!resolvedCli && appPath &&
|
|
903
|
+
if (!resolvedCli && appPath && os28 === "win32") {
|
|
904
904
|
const { dirname: dirname10 } = await import("path");
|
|
905
905
|
const appDir = dirname10(appPath);
|
|
906
906
|
const candidates = [
|
|
@@ -917,7 +917,7 @@ async function detectIDEs(providerLoader) {
|
|
|
917
917
|
}
|
|
918
918
|
}
|
|
919
919
|
}
|
|
920
|
-
const installed =
|
|
920
|
+
const installed = os28 === "darwin" ? !!(resolvedCli || appPath) : !!resolvedCli;
|
|
921
921
|
const version2 = resolvedCli ? getIdeVersion(resolvedCli) : null;
|
|
922
922
|
results.push({
|
|
923
923
|
id: def.id,
|
|
@@ -986,8 +986,8 @@ function execAsync(cmd, timeoutMs = 5e3) {
|
|
|
986
986
|
});
|
|
987
987
|
}
|
|
988
988
|
async function detectCLIs(providerLoader, options) {
|
|
989
|
-
const
|
|
990
|
-
const whichCmd =
|
|
989
|
+
const platform12 = os2.platform();
|
|
990
|
+
const whichCmd = platform12 === "win32" ? "where" : "which";
|
|
991
991
|
const includeVersion = options?.includeVersion !== false;
|
|
992
992
|
const cliList = providerLoader ? providerLoader.getCliDetectionList() : [];
|
|
993
993
|
const results = await Promise.all(
|
|
@@ -1030,8 +1030,8 @@ async function detectCLI(cliId, providerLoader, options) {
|
|
|
1030
1030
|
const cliList = providerLoader.getCliDetectionList();
|
|
1031
1031
|
const target = cliList.find((c) => c.id === resolvedId);
|
|
1032
1032
|
if (target) {
|
|
1033
|
-
const
|
|
1034
|
-
const whichCmd =
|
|
1033
|
+
const platform12 = os2.platform();
|
|
1034
|
+
const whichCmd = platform12 === "win32" ? "where" : "which";
|
|
1035
1035
|
try {
|
|
1036
1036
|
const explicitPath = resolveCommandPath(target.command);
|
|
1037
1037
|
const pathResult = explicitPath || await execAsync(`${whichCmd} ${shellQuote(target.command)}`);
|
|
@@ -4032,6 +4032,27 @@ function computeSavedHistorySessionSummaries(agentType, dir, files, fileSignatur
|
|
|
4032
4032
|
persistedEntries: nextPersistedEntries
|
|
4033
4033
|
};
|
|
4034
4034
|
}
|
|
4035
|
+
function pageHistoryRecords(agentType, records, offset = 0, limit = 30, excludeRecentCount = 0, historyBehavior) {
|
|
4036
|
+
const allMessages = records.map((message) => sanitizeHistoryMessage(agentType, message)).filter(Boolean);
|
|
4037
|
+
allMessages.sort((a, b) => a.receivedAt - b.receivedAt);
|
|
4038
|
+
const chronological = [];
|
|
4039
|
+
let lastTurn = null;
|
|
4040
|
+
for (const message of allMessages) {
|
|
4041
|
+
const previous = chronological[chronological.length - 1];
|
|
4042
|
+
if (isAdjacentHistoryDuplicate(agentType, previous, message)) continue;
|
|
4043
|
+
if (message.role !== "system" && isAdjacentHistoryDuplicate(agentType, lastTurn, message)) continue;
|
|
4044
|
+
chronological.push(message);
|
|
4045
|
+
if (message.role !== "system") lastTurn = message;
|
|
4046
|
+
}
|
|
4047
|
+
const collapsed = collapseReplayAssistantTurns(chronological, historyBehavior);
|
|
4048
|
+
const boundedLimit = Math.max(1, limit);
|
|
4049
|
+
const boundedOffset = Math.max(0, offset);
|
|
4050
|
+
const boundedExclude = Math.max(0, Math.min(excludeRecentCount, collapsed.length));
|
|
4051
|
+
const endExclusive = Math.max(0, collapsed.length - boundedExclude - boundedOffset);
|
|
4052
|
+
const startInclusive = Math.max(0, endExclusive - boundedLimit);
|
|
4053
|
+
const sliced = collapsed.slice(startInclusive, endExclusive);
|
|
4054
|
+
return { messages: sliced, hasMore: startInclusive > 0 };
|
|
4055
|
+
}
|
|
4035
4056
|
function readChatHistory(agentType, offset = 0, limit = 30, historySessionId, excludeRecentCount = 0, historyBehavior) {
|
|
4036
4057
|
try {
|
|
4037
4058
|
const sanitized = agentType.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
@@ -4057,25 +4078,7 @@ function readChatHistory(agentType, offset = 0, limit = 30, historySessionId, ex
|
|
|
4057
4078
|
}
|
|
4058
4079
|
}
|
|
4059
4080
|
}
|
|
4060
|
-
|
|
4061
|
-
const chronological = [];
|
|
4062
|
-
let lastTurn = null;
|
|
4063
|
-
for (const message of allMessages) {
|
|
4064
|
-
const previous = chronological[chronological.length - 1];
|
|
4065
|
-
if (isAdjacentHistoryDuplicate(agentType, previous, message)) continue;
|
|
4066
|
-
if (message.role !== "system" && isAdjacentHistoryDuplicate(agentType, lastTurn, message)) continue;
|
|
4067
|
-
chronological.push(message);
|
|
4068
|
-
if (message.role !== "system") lastTurn = message;
|
|
4069
|
-
}
|
|
4070
|
-
const collapsed = collapseReplayAssistantTurns(chronological, historyBehavior);
|
|
4071
|
-
const boundedLimit = Math.max(1, limit);
|
|
4072
|
-
const boundedOffset = Math.max(0, offset);
|
|
4073
|
-
const boundedExclude = Math.max(0, Math.min(excludeRecentCount, collapsed.length));
|
|
4074
|
-
const endExclusive = Math.max(0, collapsed.length - boundedExclude - boundedOffset);
|
|
4075
|
-
const startInclusive = Math.max(0, endExclusive - boundedLimit);
|
|
4076
|
-
const sliced = collapsed.slice(startInclusive, endExclusive);
|
|
4077
|
-
const hasMore = startInclusive > 0;
|
|
4078
|
-
return { messages: sliced, hasMore };
|
|
4081
|
+
return pageHistoryRecords(agentType, allMessages, offset, limit, excludeRecentCount, historyBehavior);
|
|
4079
4082
|
} catch {
|
|
4080
4083
|
return { messages: [], hasMore: false };
|
|
4081
4084
|
}
|
|
@@ -4142,29 +4145,6 @@ function listSavedHistorySessions(agentType, options = {}, historyBehavior) {
|
|
|
4142
4145
|
return { sessions: [], hasMore: false };
|
|
4143
4146
|
}
|
|
4144
4147
|
}
|
|
4145
|
-
function normalizeCanonicalHermesMessageContent(content) {
|
|
4146
|
-
if (typeof content === "string") return content.trim();
|
|
4147
|
-
if (content == null) return "";
|
|
4148
|
-
try {
|
|
4149
|
-
return JSON.stringify(content).trim();
|
|
4150
|
-
} catch {
|
|
4151
|
-
return String(content).trim();
|
|
4152
|
-
}
|
|
4153
|
-
}
|
|
4154
|
-
function extractCanonicalHermesMessageTimestamp(message, fallbackTs) {
|
|
4155
|
-
const numericTimestamp = Number(message.receivedAt || message.timestamp || message.ts || 0);
|
|
4156
|
-
if (Number.isFinite(numericTimestamp) && numericTimestamp > 0) return numericTimestamp;
|
|
4157
|
-
const stringTimestamp = typeof message.ts === "string" ? Date.parse(message.ts) : typeof message.timestamp === "string" ? Date.parse(message.timestamp) : NaN;
|
|
4158
|
-
if (Number.isFinite(stringTimestamp) && stringTimestamp > 0) return stringTimestamp;
|
|
4159
|
-
return fallbackTs;
|
|
4160
|
-
}
|
|
4161
|
-
function extractTimestampValue(value) {
|
|
4162
|
-
const numericTimestamp = Number(value || 0);
|
|
4163
|
-
if (Number.isFinite(numericTimestamp) && numericTimestamp > 0) return numericTimestamp;
|
|
4164
|
-
const stringTimestamp = typeof value === "string" ? Date.parse(value) : NaN;
|
|
4165
|
-
if (Number.isFinite(stringTimestamp) && stringTimestamp > 0) return stringTimestamp;
|
|
4166
|
-
return 0;
|
|
4167
|
-
}
|
|
4168
4148
|
function readExistingSessionStartRecord(agentType, historySessionId) {
|
|
4169
4149
|
try {
|
|
4170
4150
|
const dir = path7.join(HISTORY_DIR, agentType);
|
|
@@ -4210,232 +4190,193 @@ function rewriteCanonicalSavedHistory(agentType, historySessionId, records) {
|
|
|
4210
4190
|
return false;
|
|
4211
4191
|
}
|
|
4212
4192
|
}
|
|
4213
|
-
function
|
|
4193
|
+
function getNativeHistoryScriptName(canonicalHistory, key) {
|
|
4194
|
+
const configured = canonicalHistory?.scripts?.[key];
|
|
4195
|
+
if (typeof configured === "string" && configured.trim()) return configured.trim();
|
|
4196
|
+
return key === "readSession" ? "readNativeHistory" : "listNativeHistory";
|
|
4197
|
+
}
|
|
4198
|
+
function getProviderNativeHistoryScript(scripts, canonicalHistory, key) {
|
|
4199
|
+
if (!canonicalHistory?.scripts) return null;
|
|
4200
|
+
const fn = scripts?.[getNativeHistoryScriptName(canonicalHistory, key)];
|
|
4201
|
+
return typeof fn === "function" ? fn : null;
|
|
4202
|
+
}
|
|
4203
|
+
function normalizeProviderNativeHistoryRecords(agentType, historySessionId, records) {
|
|
4204
|
+
if (!Array.isArray(records)) return [];
|
|
4205
|
+
const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId);
|
|
4206
|
+
return records.map((record2) => sanitizeHistoryMessage(agentType, {
|
|
4207
|
+
ts: typeof record2?.ts === "string" ? record2.ts : new Date(Number(record2?.receivedAt) || Date.now()).toISOString(),
|
|
4208
|
+
receivedAt: Number(record2?.receivedAt) || Date.parse(record2?.ts || "") || Date.now(),
|
|
4209
|
+
role: record2?.role,
|
|
4210
|
+
content: String(record2?.content || ""),
|
|
4211
|
+
kind: record2?.kind || (record2?.role === "system" ? "session_start" : "standard"),
|
|
4212
|
+
senderName: record2?.senderName,
|
|
4213
|
+
agent: agentType,
|
|
4214
|
+
instanceId: record2?.instanceId,
|
|
4215
|
+
historySessionId: normalizeSavedHistorySessionId(record2?.historySessionId || normalizedSessionId),
|
|
4216
|
+
sessionTitle: record2?.sessionTitle,
|
|
4217
|
+
workspace: record2?.workspace
|
|
4218
|
+
})).filter(Boolean);
|
|
4219
|
+
}
|
|
4220
|
+
function callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, historySessionId, workspace) {
|
|
4221
|
+
const fn = getProviderNativeHistoryScript(scripts, canonicalHistory, "readSession");
|
|
4222
|
+
if (!fn) return null;
|
|
4223
|
+
const result = fn({
|
|
4224
|
+
agentType,
|
|
4225
|
+
sessionId: historySessionId,
|
|
4226
|
+
historySessionId,
|
|
4227
|
+
workspace,
|
|
4228
|
+
format: canonicalHistory?.format,
|
|
4229
|
+
watchPath: canonicalHistory?.watchPath,
|
|
4230
|
+
args: { sessionId: historySessionId, historySessionId, workspace }
|
|
4231
|
+
});
|
|
4232
|
+
if (!result || typeof result !== "object") return null;
|
|
4233
|
+
const records = normalizeProviderNativeHistoryRecords(agentType, historySessionId, result.messages || result.records);
|
|
4234
|
+
if (records.length === 0) return null;
|
|
4235
|
+
return {
|
|
4236
|
+
records,
|
|
4237
|
+
sourcePath: typeof result.sourcePath === "string" ? result.sourcePath : "",
|
|
4238
|
+
sourceMtimeMs: Number(result.sourceMtimeMs) || 0
|
|
4239
|
+
};
|
|
4240
|
+
}
|
|
4241
|
+
function buildNativeHistoryReadResult(agentType, canonicalHistory, scripts, historySessionId, workspace) {
|
|
4242
|
+
const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId || "");
|
|
4243
|
+
if (!canonicalHistory || !normalizedSessionId || !isNativeSourceCanonicalHistory(canonicalHistory)) return null;
|
|
4244
|
+
return callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, normalizedSessionId, workspace);
|
|
4245
|
+
}
|
|
4246
|
+
function materializeNativeHistoryToMirror(agentType, canonicalHistory, historySessionId, workspace, scripts) {
|
|
4214
4247
|
const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId);
|
|
4215
4248
|
if (!normalizedSessionId) return false;
|
|
4249
|
+
const nativeResult = callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, normalizedSessionId, workspace);
|
|
4250
|
+
const nativeRecords = nativeResult?.records || [];
|
|
4251
|
+
if (nativeRecords.length === 0) return false;
|
|
4252
|
+
const normalizedRecords = nativeRecords.map((record2) => ({
|
|
4253
|
+
...record2,
|
|
4254
|
+
agent: agentType,
|
|
4255
|
+
historySessionId: normalizedSessionId
|
|
4256
|
+
}));
|
|
4257
|
+
const existingSessionStart = readExistingSessionStartRecord(agentType, normalizedSessionId);
|
|
4258
|
+
const records = existingSessionStart && normalizedRecords[0]?.kind !== "session_start" ? [{ ...existingSessionStart, historySessionId: normalizedSessionId, agent: agentType }, ...normalizedRecords] : normalizedRecords;
|
|
4259
|
+
return rewriteCanonicalSavedHistory(agentType, normalizedSessionId, records);
|
|
4260
|
+
}
|
|
4261
|
+
function materializeProviderNativeHistory(agentType, canonicalHistory, historySessionId, workspace, scripts) {
|
|
4262
|
+
if (!canonicalHistory || canonicalHistory.mode !== "materialized-mirror") return false;
|
|
4263
|
+
return materializeNativeHistoryToMirror(agentType, canonicalHistory, historySessionId, workspace, scripts);
|
|
4264
|
+
}
|
|
4265
|
+
function isNativeSourceCanonicalHistory(canonicalHistory) {
|
|
4266
|
+
if (!canonicalHistory) return false;
|
|
4267
|
+
if (canonicalHistory.mode === "disabled") return false;
|
|
4268
|
+
if (canonicalHistory.mode === "materialized-mirror") return false;
|
|
4269
|
+
return true;
|
|
4270
|
+
}
|
|
4271
|
+
function readProviderChatHistory(agentType, options = {}) {
|
|
4272
|
+
if (isNativeSourceCanonicalHistory(options.canonicalHistory) && options.historySessionId) {
|
|
4273
|
+
const nativeResult = buildNativeHistoryReadResult(agentType, options.canonicalHistory, options.scripts, options.historySessionId, options.workspace);
|
|
4274
|
+
if (!nativeResult) return { messages: [], hasMore: false, source: "native-unavailable" };
|
|
4275
|
+
return {
|
|
4276
|
+
...pageHistoryRecords(agentType, nativeResult.records, options.offset || 0, options.limit || 30, options.excludeRecentCount || 0, options.historyBehavior),
|
|
4277
|
+
source: "provider-native",
|
|
4278
|
+
sourcePath: nativeResult.sourcePath,
|
|
4279
|
+
sourceMtimeMs: nativeResult.sourceMtimeMs
|
|
4280
|
+
};
|
|
4281
|
+
}
|
|
4282
|
+
return {
|
|
4283
|
+
...readChatHistory(agentType, options.offset || 0, options.limit || 30, options.historySessionId, options.excludeRecentCount || 0, options.historyBehavior),
|
|
4284
|
+
source: "adhdev-mirror"
|
|
4285
|
+
};
|
|
4286
|
+
}
|
|
4287
|
+
function buildNativeSessionSummary(agentType, historySessionId, records, sourcePath) {
|
|
4288
|
+
const visible = pageHistoryRecords(agentType, records, 0, Number.MAX_SAFE_INTEGER).messages;
|
|
4289
|
+
if (visible.length === 0) return null;
|
|
4290
|
+
let sourceMtimeMs = 0;
|
|
4216
4291
|
try {
|
|
4217
|
-
|
|
4218
|
-
if (!fs3.existsSync(sessionFilePath)) return false;
|
|
4219
|
-
const raw = JSON.parse(fs3.readFileSync(sessionFilePath, "utf-8"));
|
|
4220
|
-
const canonicalMessages = Array.isArray(raw.messages) ? raw.messages : [];
|
|
4221
|
-
const dir = path7.join(HISTORY_DIR, "hermes-cli");
|
|
4222
|
-
fs3.mkdirSync(dir, { recursive: true });
|
|
4223
|
-
const existingSessionStart = readExistingSessionStartRecord("hermes-cli", normalizedSessionId);
|
|
4224
|
-
const records = [];
|
|
4225
|
-
if (existingSessionStart) {
|
|
4226
|
-
records.push({
|
|
4227
|
-
...existingSessionStart,
|
|
4228
|
-
historySessionId: normalizedSessionId
|
|
4229
|
-
});
|
|
4230
|
-
}
|
|
4231
|
-
let fallbackTs = Date.parse(raw.session_start || raw.last_updated || "") || Date.now();
|
|
4232
|
-
for (const message of canonicalMessages) {
|
|
4233
|
-
const role = String(message.role || "").trim();
|
|
4234
|
-
const content = normalizeCanonicalHermesMessageContent(message.content);
|
|
4235
|
-
if (!content) continue;
|
|
4236
|
-
const receivedAt = extractCanonicalHermesMessageTimestamp(message, fallbackTs);
|
|
4237
|
-
fallbackTs = receivedAt + 1;
|
|
4238
|
-
if (role === "user") {
|
|
4239
|
-
records.push({
|
|
4240
|
-
ts: new Date(receivedAt).toISOString(),
|
|
4241
|
-
receivedAt,
|
|
4242
|
-
role: "user",
|
|
4243
|
-
content,
|
|
4244
|
-
kind: "standard",
|
|
4245
|
-
agent: "hermes-cli",
|
|
4246
|
-
historySessionId: normalizedSessionId
|
|
4247
|
-
});
|
|
4248
|
-
continue;
|
|
4249
|
-
}
|
|
4250
|
-
if (role === "assistant") {
|
|
4251
|
-
records.push({
|
|
4252
|
-
ts: new Date(receivedAt).toISOString(),
|
|
4253
|
-
receivedAt,
|
|
4254
|
-
role: "assistant",
|
|
4255
|
-
content,
|
|
4256
|
-
kind: "standard",
|
|
4257
|
-
agent: "hermes-cli",
|
|
4258
|
-
historySessionId: normalizedSessionId
|
|
4259
|
-
});
|
|
4260
|
-
continue;
|
|
4261
|
-
}
|
|
4262
|
-
if (role === "tool") {
|
|
4263
|
-
records.push({
|
|
4264
|
-
ts: new Date(receivedAt).toISOString(),
|
|
4265
|
-
receivedAt,
|
|
4266
|
-
role: "assistant",
|
|
4267
|
-
content,
|
|
4268
|
-
kind: "tool",
|
|
4269
|
-
senderName: "Tool",
|
|
4270
|
-
agent: "hermes-cli",
|
|
4271
|
-
historySessionId: normalizedSessionId
|
|
4272
|
-
});
|
|
4273
|
-
}
|
|
4274
|
-
}
|
|
4275
|
-
return rewriteCanonicalSavedHistory("hermes-cli", normalizedSessionId, records);
|
|
4292
|
+
sourceMtimeMs = fs3.statSync(sourcePath).mtimeMs;
|
|
4276
4293
|
} catch {
|
|
4277
|
-
return false;
|
|
4278
4294
|
}
|
|
4295
|
+
const firstMessageAt = visible[0]?.receivedAt || sourceMtimeMs || Date.now();
|
|
4296
|
+
const lastMessageAt = visible[visible.length - 1]?.receivedAt || firstMessageAt;
|
|
4297
|
+
const lastNonSystem = [...visible].reverse().find((message) => message.role !== "system") || visible[visible.length - 1];
|
|
4298
|
+
const firstSystem = visible.find((message) => message.kind === "session_start");
|
|
4299
|
+
return {
|
|
4300
|
+
historySessionId,
|
|
4301
|
+
sessionTitle: lastNonSystem?.content,
|
|
4302
|
+
messageCount: visible.length,
|
|
4303
|
+
firstMessageAt,
|
|
4304
|
+
lastMessageAt,
|
|
4305
|
+
preview: lastNonSystem?.content,
|
|
4306
|
+
workspace: firstSystem?.workspace || (firstSystem?.kind === "session_start" ? firstSystem.content : void 0),
|
|
4307
|
+
source: "provider-native",
|
|
4308
|
+
sourcePath,
|
|
4309
|
+
sourceMtimeMs
|
|
4310
|
+
};
|
|
4279
4311
|
}
|
|
4280
|
-
function
|
|
4281
|
-
const
|
|
4282
|
-
if (!
|
|
4283
|
-
const
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
}
|
|
4301
|
-
}
|
|
4302
|
-
}
|
|
4303
|
-
return null;
|
|
4312
|
+
function normalizeProviderNativeHistorySessionSummary(agentType, item) {
|
|
4313
|
+
const historySessionId = normalizeSavedHistorySessionId(item?.historySessionId || item?.sessionId || "");
|
|
4314
|
+
if (!historySessionId) return null;
|
|
4315
|
+
const sourcePath = typeof item?.sourcePath === "string" ? item.sourcePath : "";
|
|
4316
|
+
const sourceMtimeMs = Number(item?.sourceMtimeMs) || 0;
|
|
4317
|
+
const firstMessageAt = Number(item?.firstMessageAt) || sourceMtimeMs || Date.now();
|
|
4318
|
+
const lastMessageAt = Number(item?.lastMessageAt) || firstMessageAt;
|
|
4319
|
+
const messageCount = Math.max(0, Number(item?.messageCount) || 0);
|
|
4320
|
+
return {
|
|
4321
|
+
historySessionId,
|
|
4322
|
+
sessionTitle: typeof item?.sessionTitle === "string" ? item.sessionTitle : void 0,
|
|
4323
|
+
messageCount,
|
|
4324
|
+
firstMessageAt,
|
|
4325
|
+
lastMessageAt,
|
|
4326
|
+
preview: typeof item?.preview === "string" ? item.preview : void 0,
|
|
4327
|
+
workspace: typeof item?.workspace === "string" ? item.workspace : void 0,
|
|
4328
|
+
source: "provider-native",
|
|
4329
|
+
sourcePath,
|
|
4330
|
+
sourceMtimeMs
|
|
4331
|
+
};
|
|
4304
4332
|
}
|
|
4305
|
-
function
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4333
|
+
function collectProviderScriptNativeHistorySessionSummaries(agentType, canonicalHistory, scripts) {
|
|
4334
|
+
const fn = getProviderNativeHistoryScript(scripts, canonicalHistory, "listSessions");
|
|
4335
|
+
if (!fn) return null;
|
|
4336
|
+
const result = fn({
|
|
4337
|
+
agentType,
|
|
4338
|
+
format: canonicalHistory.format,
|
|
4339
|
+
watchPath: canonicalHistory.watchPath,
|
|
4340
|
+
args: {}
|
|
4341
|
+
});
|
|
4342
|
+
if (!result || typeof result !== "object") return [];
|
|
4343
|
+
const sessions = Array.isArray(result.sessions) ? result.sessions : [];
|
|
4344
|
+
const summaries = [];
|
|
4345
|
+
for (const item of sessions) {
|
|
4346
|
+
if (Array.isArray(item?.messages || item?.records)) {
|
|
4347
|
+
const historySessionId = normalizeSavedHistorySessionId(item?.historySessionId || item?.sessionId || "");
|
|
4348
|
+
if (!historySessionId) continue;
|
|
4349
|
+
const records = normalizeProviderNativeHistoryRecords(agentType, historySessionId, item.messages || item.records);
|
|
4350
|
+
const summary2 = buildNativeSessionSummary(agentType, historySessionId, records, typeof item?.sourcePath === "string" ? item.sourcePath : "");
|
|
4351
|
+
if (summary2) {
|
|
4352
|
+
if (Number(item?.sourceMtimeMs)) summary2.sourceMtimeMs = Number(item.sourceMtimeMs);
|
|
4353
|
+
summaries.push(summary2);
|
|
4354
|
+
}
|
|
4319
4355
|
continue;
|
|
4320
4356
|
}
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
const input = record2.input && typeof record2.input === "object" ? record2.input : null;
|
|
4324
|
-
const command = input ? String(input.command || "").trim() : "";
|
|
4325
|
-
const summary = command ? `${name}: ${command}` : name;
|
|
4326
|
-
if (summary) parts.push({ content: summary, kind: "tool", senderName: "Tool", role: "assistant" });
|
|
4327
|
-
}
|
|
4357
|
+
const summary = normalizeProviderNativeHistorySessionSummary(agentType, item);
|
|
4358
|
+
if (summary) summaries.push(summary);
|
|
4328
4359
|
}
|
|
4329
|
-
return
|
|
4360
|
+
return sortSavedHistorySessionSummaries(summaries);
|
|
4330
4361
|
}
|
|
4331
|
-
function
|
|
4332
|
-
|
|
4333
|
-
const trimmed = content.trim();
|
|
4334
|
-
return trimmed ? [{ role: "user", content: trimmed, kind: "standard" }] : [];
|
|
4335
|
-
}
|
|
4336
|
-
if (!Array.isArray(content)) return [];
|
|
4337
|
-
const parts = [];
|
|
4338
|
-
for (const block of content) {
|
|
4339
|
-
if (!block || typeof block !== "object") continue;
|
|
4340
|
-
const record2 = block;
|
|
4341
|
-
const type = String(record2.type || "").trim();
|
|
4342
|
-
if (type === "text") {
|
|
4343
|
-
const text = String(record2.text || "").trim();
|
|
4344
|
-
if (text) parts.push({ role: "user", content: text, kind: "standard" });
|
|
4345
|
-
continue;
|
|
4346
|
-
}
|
|
4347
|
-
if (type === "tool_result") {
|
|
4348
|
-
const rawContent = record2.content;
|
|
4349
|
-
const text = typeof rawContent === "string" ? rawContent.trim() : Array.isArray(rawContent) ? rawContent.map((entry) => {
|
|
4350
|
-
if (typeof entry === "string") return entry.trim();
|
|
4351
|
-
if (!entry || typeof entry !== "object") return "";
|
|
4352
|
-
const nested = entry;
|
|
4353
|
-
if (typeof nested.text === "string") return nested.text.trim();
|
|
4354
|
-
if (typeof nested.content === "string") return nested.content.trim();
|
|
4355
|
-
return "";
|
|
4356
|
-
}).filter(Boolean).join("\n") : "";
|
|
4357
|
-
if (text) parts.push({ role: "assistant", content: text, kind: "tool", senderName: "Tool" });
|
|
4358
|
-
}
|
|
4359
|
-
}
|
|
4360
|
-
return parts;
|
|
4362
|
+
function collectNativeHistorySessionSummaries(agentType, canonicalHistory, scripts) {
|
|
4363
|
+
return collectProviderScriptNativeHistorySessionSummaries(agentType, canonicalHistory, scripts) || [];
|
|
4361
4364
|
}
|
|
4362
|
-
function
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
const
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
records.push({
|
|
4373
|
-
...existingSessionStart,
|
|
4374
|
-
historySessionId: normalizedSessionId
|
|
4375
|
-
});
|
|
4376
|
-
}
|
|
4377
|
-
let fallbackTs = Date.now();
|
|
4378
|
-
for (const line of lines) {
|
|
4379
|
-
let parsed = null;
|
|
4380
|
-
try {
|
|
4381
|
-
parsed = JSON.parse(line);
|
|
4382
|
-
} catch {
|
|
4383
|
-
parsed = null;
|
|
4384
|
-
}
|
|
4385
|
-
if (!parsed) continue;
|
|
4386
|
-
const parsedSessionId = String(parsed.sessionId || "").trim();
|
|
4387
|
-
if (parsedSessionId && parsedSessionId !== normalizedSessionId) continue;
|
|
4388
|
-
const receivedAt = extractTimestampValue(parsed.timestamp) || fallbackTs;
|
|
4389
|
-
fallbackTs = receivedAt + 1;
|
|
4390
|
-
const parsedWorkspace = String(parsed.cwd || workspace || "").trim();
|
|
4391
|
-
if (records.length === 0 && parsedWorkspace) {
|
|
4392
|
-
records.push({
|
|
4393
|
-
ts: new Date(receivedAt).toISOString(),
|
|
4394
|
-
receivedAt,
|
|
4395
|
-
role: "system",
|
|
4396
|
-
kind: "session_start",
|
|
4397
|
-
content: parsedWorkspace,
|
|
4398
|
-
agent: "claude-cli",
|
|
4399
|
-
historySessionId: normalizedSessionId,
|
|
4400
|
-
workspace: parsedWorkspace
|
|
4401
|
-
});
|
|
4402
|
-
}
|
|
4403
|
-
const type = String(parsed.type || "").trim();
|
|
4404
|
-
const message = parsed.message && typeof parsed.message === "object" ? parsed.message : null;
|
|
4405
|
-
if (type === "user" && message) {
|
|
4406
|
-
for (const part of extractClaudeUserContentParts(message.content)) {
|
|
4407
|
-
records.push({
|
|
4408
|
-
ts: new Date(receivedAt).toISOString(),
|
|
4409
|
-
receivedAt,
|
|
4410
|
-
role: part.role,
|
|
4411
|
-
content: part.content,
|
|
4412
|
-
kind: part.kind,
|
|
4413
|
-
senderName: part.senderName,
|
|
4414
|
-
agent: "claude-cli",
|
|
4415
|
-
historySessionId: normalizedSessionId
|
|
4416
|
-
});
|
|
4417
|
-
}
|
|
4418
|
-
continue;
|
|
4419
|
-
}
|
|
4420
|
-
if (type === "assistant" && message) {
|
|
4421
|
-
for (const part of extractClaudeAssistantContentParts(message.content)) {
|
|
4422
|
-
records.push({
|
|
4423
|
-
ts: new Date(receivedAt).toISOString(),
|
|
4424
|
-
receivedAt,
|
|
4425
|
-
role: "assistant",
|
|
4426
|
-
content: part.content,
|
|
4427
|
-
kind: part.kind,
|
|
4428
|
-
senderName: part.senderName,
|
|
4429
|
-
agent: "claude-cli",
|
|
4430
|
-
historySessionId: normalizedSessionId
|
|
4431
|
-
});
|
|
4432
|
-
}
|
|
4433
|
-
}
|
|
4434
|
-
}
|
|
4435
|
-
return rewriteCanonicalSavedHistory("claude-cli", normalizedSessionId, records);
|
|
4436
|
-
} catch {
|
|
4437
|
-
return false;
|
|
4365
|
+
function listProviderHistorySessions(agentType, options = {}) {
|
|
4366
|
+
if (isNativeSourceCanonicalHistory(options.canonicalHistory)) {
|
|
4367
|
+
const offset = Math.max(0, options.offset || 0);
|
|
4368
|
+
const limit = Math.max(1, options.limit || 30);
|
|
4369
|
+
const summaries = collectNativeHistorySessionSummaries(agentType, options.canonicalHistory, options.scripts);
|
|
4370
|
+
return {
|
|
4371
|
+
sessions: summaries.slice(offset, offset + limit),
|
|
4372
|
+
hasMore: offset + limit < summaries.length,
|
|
4373
|
+
source: "provider-native"
|
|
4374
|
+
};
|
|
4438
4375
|
}
|
|
4376
|
+
return {
|
|
4377
|
+
...listSavedHistorySessions(agentType, { offset: options.offset, limit: options.limit }, options.historyBehavior),
|
|
4378
|
+
source: "adhdev-mirror"
|
|
4379
|
+
};
|
|
4439
4380
|
}
|
|
4440
4381
|
var fs3, path7, os5, HISTORY_DIR, RETAIN_DAYS, SAVED_HISTORY_INDEX_VERSION, SAVED_HISTORY_INDEX_FILE, SAVED_HISTORY_INDEX_LOCK_SUFFIX, SAVED_HISTORY_INDEX_LOCK_WAIT_MS, SAVED_HISTORY_INDEX_LOCK_STALE_MS, SAVED_HISTORY_INDEX_LOCK_POLL_MS, SAVED_HISTORY_ROLLUP_THRESHOLD_BYTES, savedHistorySessionCache, savedHistoryFileSummaryCache, savedHistoryBackgroundRefresh, savedHistoryRollupInFlight, ChatHistoryWriter;
|
|
4441
4382
|
var init_chat_history = __esm({
|
|
@@ -5440,6 +5381,8 @@ function validateReadChatResultPayload(raw, source = "read_chat") {
|
|
|
5440
5381
|
if (raw.summaryMetadata !== void 0) normalized.summaryMetadata = raw.summaryMetadata;
|
|
5441
5382
|
if (Array.isArray(raw.effects)) normalized.effects = raw.effects;
|
|
5442
5383
|
if (typeof raw.providerSessionId === "string") normalized.providerSessionId = raw.providerSessionId;
|
|
5384
|
+
if (raw.transcriptAuthority === "provider" || raw.transcriptAuthority === "daemon") normalized.transcriptAuthority = raw.transcriptAuthority;
|
|
5385
|
+
if (raw.coverage === "full" || raw.coverage === "tail" || raw.coverage === "current-turn") normalized.coverage = raw.coverage;
|
|
5443
5386
|
return normalized;
|
|
5444
5387
|
}
|
|
5445
5388
|
var VALID_STATUSES, VALID_ROLES, VALID_BUBBLE_STATES, VALID_TURN_STATUSES;
|
|
@@ -7707,7 +7650,17 @@ async function handleChatHistory(h, args) {
|
|
|
7707
7650
|
const visibleCount = Array.isArray(status?.messages) ? status.messages.length : 0;
|
|
7708
7651
|
if (visibleCount > excludeRecentCount) excludeRecentCount = visibleCount;
|
|
7709
7652
|
}
|
|
7710
|
-
const
|
|
7653
|
+
const workspace = typeof args?.workspace === "string" ? args.workspace : typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : void 0;
|
|
7654
|
+
const result = readProviderChatHistory(agentStr, {
|
|
7655
|
+
canonicalHistory: provider?.canonicalHistory,
|
|
7656
|
+
historySessionId,
|
|
7657
|
+
workspace,
|
|
7658
|
+
offset: offset || 0,
|
|
7659
|
+
limit: limit || 30,
|
|
7660
|
+
excludeRecentCount,
|
|
7661
|
+
historyBehavior: provider?.historyBehavior,
|
|
7662
|
+
scripts: provider?.scripts
|
|
7663
|
+
});
|
|
7711
7664
|
return { success: true, ...result, agent: agentStr };
|
|
7712
7665
|
} catch (e) {
|
|
7713
7666
|
return { success: false, error: e.message };
|
|
@@ -7732,7 +7685,8 @@ async function handleReadChat(h, args) {
|
|
|
7732
7685
|
}
|
|
7733
7686
|
const parsedRecord = parsedStatus && typeof parsedStatus === "object" ? parsedStatus : null;
|
|
7734
7687
|
const adapterStatus = adapter.getStatus();
|
|
7735
|
-
const
|
|
7688
|
+
const parsedIsProviderAuthoritative = parsedRecord?.transcriptAuthority === "provider" || parsedRecord?.coverage === "full";
|
|
7689
|
+
const shouldPreferAdapterMessages = !parsedIsProviderAuthoritative && Array.isArray(adapterStatus.messages) && adapterStatus.messages.length > 0 && Array.isArray(parsedRecord?.messages) && adapterStatus.messages.length > parsedRecord.messages.length;
|
|
7736
7690
|
const parsedShowsApproval = hasNonEmptyModalButtons(parsedRecord?.activeModal) && parsedRecord?.status === "waiting_approval";
|
|
7737
7691
|
const status = parsedRecord ? {
|
|
7738
7692
|
...parsedRecord,
|
|
@@ -7742,6 +7696,8 @@ async function handleReadChat(h, args) {
|
|
|
7742
7696
|
} : adapterStatus;
|
|
7743
7697
|
const title = typeof parsedRecord?.title === "string" ? parsedRecord.title : void 0;
|
|
7744
7698
|
const providerSessionId = typeof parsedRecord?.providerSessionId === "string" ? parsedRecord.providerSessionId : void 0;
|
|
7699
|
+
const transcriptAuthority = parsedRecord?.transcriptAuthority === "provider" || parsedRecord?.transcriptAuthority === "daemon" ? parsedRecord.transcriptAuthority : void 0;
|
|
7700
|
+
const coverage = parsedRecord?.coverage === "full" || parsedRecord?.coverage === "tail" || parsedRecord?.coverage === "current-turn" ? parsedRecord.coverage : void 0;
|
|
7745
7701
|
if (status) {
|
|
7746
7702
|
LOG.debug("Command", `[read_chat] cli-like resolved provider=${adapter.cliType} target=${String(args?.targetSessionId || "")} adapterStatus=${String(adapterStatus.status || "")} parsedStatus=${String(parsedRecord?.status || "")} shouldPreferAdapterMessages=${String(shouldPreferAdapterMessages)} adapterMsgCount=${Array.isArray(adapterStatus.messages) ? adapterStatus.messages.length : 0} parsedMsgCount=${Array.isArray(parsedRecord?.messages) ? parsedRecord.messages.length : 0} returnedMsgCount=${Array.isArray(status.messages) ? status.messages.length : 0}`);
|
|
7747
7703
|
return buildReadChatCommandResult({
|
|
@@ -7760,7 +7716,9 @@ async function handleReadChat(h, args) {
|
|
|
7760
7716
|
returnedMsgCount: Array.isArray(status.messages) ? status.messages.length : 0
|
|
7761
7717
|
},
|
|
7762
7718
|
...title ? { title } : {},
|
|
7763
|
-
...providerSessionId ? { providerSessionId } : {}
|
|
7719
|
+
...providerSessionId ? { providerSessionId } : {},
|
|
7720
|
+
...transcriptAuthority ? { transcriptAuthority } : {},
|
|
7721
|
+
...coverage ? { coverage } : {}
|
|
7764
7722
|
}, args);
|
|
7765
7723
|
}
|
|
7766
7724
|
}
|
|
@@ -10552,18 +10510,18 @@ var init_source = __esm({
|
|
|
10552
10510
|
}
|
|
10553
10511
|
}
|
|
10554
10512
|
});
|
|
10555
|
-
createStyler = (
|
|
10513
|
+
createStyler = (open2, close, parent) => {
|
|
10556
10514
|
let openAll;
|
|
10557
10515
|
let closeAll;
|
|
10558
10516
|
if (parent === void 0) {
|
|
10559
|
-
openAll =
|
|
10517
|
+
openAll = open2;
|
|
10560
10518
|
closeAll = close;
|
|
10561
10519
|
} else {
|
|
10562
|
-
openAll = parent.openAll +
|
|
10520
|
+
openAll = parent.openAll + open2;
|
|
10563
10521
|
closeAll = close + parent.closeAll;
|
|
10564
10522
|
}
|
|
10565
10523
|
return {
|
|
10566
|
-
open:
|
|
10524
|
+
open: open2,
|
|
10567
10525
|
close,
|
|
10568
10526
|
openAll,
|
|
10569
10527
|
closeAll,
|
|
@@ -10936,14 +10894,14 @@ function applyTerminalColorEnv(env3) {
|
|
|
10936
10894
|
function ensureNodePtySpawnHelperPermissions(logFn) {
|
|
10937
10895
|
if (os22.platform() === "win32") return;
|
|
10938
10896
|
try {
|
|
10939
|
-
const
|
|
10897
|
+
const fs19 = __require("fs");
|
|
10940
10898
|
const ptyDir = path32.resolve(path32.dirname(__require.resolve("node-pty")), "..");
|
|
10941
10899
|
const platformArch = `${os22.platform()}-${os22.arch()}`;
|
|
10942
10900
|
const helper = path32.join(ptyDir, "prebuilds", platformArch, "spawn-helper");
|
|
10943
|
-
if (
|
|
10944
|
-
const stat4 =
|
|
10901
|
+
if (fs19.existsSync(helper)) {
|
|
10902
|
+
const stat4 = fs19.statSync(helper);
|
|
10945
10903
|
if (!(stat4.mode & 73)) {
|
|
10946
|
-
|
|
10904
|
+
fs19.chmodSync(helper, stat4.mode | 493);
|
|
10947
10905
|
logFn?.(`Fixed spawn-helper permissions: ${helper}`);
|
|
10948
10906
|
}
|
|
10949
10907
|
}
|
|
@@ -11138,8 +11096,8 @@ var init_pty_transport = __esm({
|
|
|
11138
11096
|
let cwd = options.cwd;
|
|
11139
11097
|
if (cwd) {
|
|
11140
11098
|
try {
|
|
11141
|
-
const
|
|
11142
|
-
const stat4 =
|
|
11099
|
+
const fs19 = require("fs");
|
|
11100
|
+
const stat4 = fs19.statSync(cwd);
|
|
11143
11101
|
if (!stat4.isDirectory()) cwd = os9.homedir();
|
|
11144
11102
|
} catch {
|
|
11145
11103
|
cwd = os9.homedir();
|
|
@@ -11237,12 +11195,12 @@ function findBinary(name) {
|
|
|
11237
11195
|
function isScriptBinary(binaryPath) {
|
|
11238
11196
|
if (!path9.isAbsolute(binaryPath)) return false;
|
|
11239
11197
|
try {
|
|
11240
|
-
const
|
|
11241
|
-
const resolved =
|
|
11198
|
+
const fs19 = require("fs");
|
|
11199
|
+
const resolved = fs19.realpathSync(binaryPath);
|
|
11242
11200
|
const head = Buffer.alloc(8);
|
|
11243
|
-
const fd =
|
|
11244
|
-
|
|
11245
|
-
|
|
11201
|
+
const fd = fs19.openSync(resolved, "r");
|
|
11202
|
+
fs19.readSync(fd, head, 0, 8, 0);
|
|
11203
|
+
fs19.closeSync(fd);
|
|
11246
11204
|
let i = 0;
|
|
11247
11205
|
if (head[0] === 239 && head[1] === 187 && head[2] === 191) i = 3;
|
|
11248
11206
|
return head[i] === 35 && head[i + 1] === 33;
|
|
@@ -11253,12 +11211,12 @@ function isScriptBinary(binaryPath) {
|
|
|
11253
11211
|
function looksLikeMachOOrElf(filePath) {
|
|
11254
11212
|
if (!path9.isAbsolute(filePath)) return false;
|
|
11255
11213
|
try {
|
|
11256
|
-
const
|
|
11257
|
-
const resolved =
|
|
11214
|
+
const fs19 = require("fs");
|
|
11215
|
+
const resolved = fs19.realpathSync(filePath);
|
|
11258
11216
|
const buf = Buffer.alloc(8);
|
|
11259
|
-
const fd =
|
|
11260
|
-
|
|
11261
|
-
|
|
11217
|
+
const fd = fs19.openSync(resolved, "r");
|
|
11218
|
+
fs19.readSync(fd, buf, 0, 8, 0);
|
|
11219
|
+
fs19.closeSync(fd);
|
|
11262
11220
|
let i = 0;
|
|
11263
11221
|
if (buf[0] === 239 && buf[1] === 187 && buf[2] === 191) i = 3;
|
|
11264
11222
|
const b = buf.subarray(i);
|
|
@@ -11818,7 +11776,8 @@ __export(provider_cli_adapter_exports, {
|
|
|
11818
11776
|
ProviderCliAdapter: () => ProviderCliAdapter,
|
|
11819
11777
|
appendBoundedText: () => appendBoundedText,
|
|
11820
11778
|
normalizeCliProviderForRuntime: () => normalizeCliProviderForRuntime,
|
|
11821
|
-
sanitizeCliStandardMessageContent: () => sanitizeCliStandardMessageContent
|
|
11779
|
+
sanitizeCliStandardMessageContent: () => sanitizeCliStandardMessageContent,
|
|
11780
|
+
trimLastAssistantEchoForCliMessages: () => trimLastAssistantEchoForCliMessages
|
|
11822
11781
|
});
|
|
11823
11782
|
function normalizeComparableTranscriptText(value) {
|
|
11824
11783
|
return sanitizeTerminalText(String(value || "")).replace(/\s+/g, " ").trim();
|
|
@@ -11914,6 +11873,19 @@ function sanitizeCommittedMessageForDisplay(message) {
|
|
|
11914
11873
|
if (content === message.content) return message;
|
|
11915
11874
|
return { ...message, content };
|
|
11916
11875
|
}
|
|
11876
|
+
function trimLastAssistantEchoForCliMessages(messages, prompt2) {
|
|
11877
|
+
if (!prompt2) return;
|
|
11878
|
+
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
11879
|
+
const message = messages[index];
|
|
11880
|
+
if (!message || message.role !== "assistant" || typeof message.content !== "string") continue;
|
|
11881
|
+
if ((message.kind || "standard") !== "standard") continue;
|
|
11882
|
+
message.content = trimPromptEchoPrefix(message.content, prompt2);
|
|
11883
|
+
if (!message.content.trim()) {
|
|
11884
|
+
messages.splice(index, 1);
|
|
11885
|
+
}
|
|
11886
|
+
return;
|
|
11887
|
+
}
|
|
11888
|
+
}
|
|
11917
11889
|
var os12, COMMITTED_ACTIVITY_PREFIX_BLOCK_RE, ProviderCliAdapter;
|
|
11918
11890
|
var init_provider_cli_adapter = __esm({
|
|
11919
11891
|
"../../oss/packages/daemon-core/src/cli-adapters/provider-cli-adapter.ts"() {
|
|
@@ -12111,7 +12083,14 @@ var init_provider_cli_adapter = __esm({
|
|
|
12111
12083
|
}
|
|
12112
12084
|
return null;
|
|
12113
12085
|
}
|
|
12086
|
+
providerOwnsTranscript() {
|
|
12087
|
+
return this.provider.transcriptAuthority === "provider";
|
|
12088
|
+
}
|
|
12089
|
+
shouldUseFullProviderTranscriptContext() {
|
|
12090
|
+
return this.providerOwnsTranscript() && this.provider.transcriptContext === "full";
|
|
12091
|
+
}
|
|
12114
12092
|
selectParseBaseMessages(baseMessages) {
|
|
12093
|
+
if (this.shouldUseFullProviderTranscriptContext()) return baseMessages;
|
|
12115
12094
|
if (baseMessages.length <= _ProviderCliAdapter.PARSE_MESSAGE_TAIL_LIMIT) return baseMessages;
|
|
12116
12095
|
return baseMessages.slice(-_ProviderCliAdapter.PARSE_MESSAGE_TAIL_LIMIT);
|
|
12117
12096
|
}
|
|
@@ -12594,9 +12573,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
12594
12573
|
);
|
|
12595
12574
|
}
|
|
12596
12575
|
trimLastAssistantEcho(messages, prompt2) {
|
|
12597
|
-
|
|
12598
|
-
const last = [...messages].reverse().find((m) => m.role === "assistant" && typeof m.content === "string");
|
|
12599
|
-
if (last) last.content = trimPromptEchoPrefix(last.content, prompt2);
|
|
12576
|
+
trimLastAssistantEchoForCliMessages(messages, prompt2);
|
|
12600
12577
|
}
|
|
12601
12578
|
clearAllTimers() {
|
|
12602
12579
|
if (this.responseTimeout) {
|
|
@@ -13450,7 +13427,8 @@ var init_provider_cli_adapter = __esm({
|
|
|
13450
13427
|
title: parsed.title || this.cliName,
|
|
13451
13428
|
messages: hydratedMessages,
|
|
13452
13429
|
activeModal: parsed.activeModal ?? this.activeModal,
|
|
13453
|
-
providerSessionId: typeof parsed.providerSessionId === "string" ? parsed.providerSessionId : void 0
|
|
13430
|
+
providerSessionId: typeof parsed.providerSessionId === "string" ? parsed.providerSessionId : void 0,
|
|
13431
|
+
...this.providerOwnsTranscript() ? { transcriptAuthority: "provider", coverage: this.shouldUseFullProviderTranscriptContext() ? "full" : "tail" } : {}
|
|
13454
13432
|
};
|
|
13455
13433
|
} else {
|
|
13456
13434
|
const messages = [...this.committedMessages];
|
|
@@ -14337,11 +14315,8 @@ var init_cli_provider_instance = __esm({
|
|
|
14337
14315
|
historyWriter;
|
|
14338
14316
|
runtimeMessages = [];
|
|
14339
14317
|
lastPersistedHistoryMessages = [];
|
|
14340
|
-
|
|
14341
|
-
|
|
14342
|
-
lastCanonicalHermesWatchPath = void 0;
|
|
14343
|
-
lastCanonicalClaudeRebuildMtimeMs = 0;
|
|
14344
|
-
lastCanonicalClaudeCheckAt = 0;
|
|
14318
|
+
lastNativeSourceCanonicalCheckAt = 0;
|
|
14319
|
+
lastNativeSourceCanonicalCacheKey = void 0;
|
|
14345
14320
|
cachedSqliteDb = null;
|
|
14346
14321
|
cachedSqliteDbPath = null;
|
|
14347
14322
|
cachedSqliteDbMissingUntil = 0;
|
|
@@ -15041,41 +15016,45 @@ ${effect.notification.body || ""}`.trim();
|
|
|
15041
15016
|
if (!this.providerSessionId) return false;
|
|
15042
15017
|
const canonicalHistory = this.provider.canonicalHistory;
|
|
15043
15018
|
if (!canonicalHistory) return false;
|
|
15019
|
+
if (isNativeSourceCanonicalHistory(canonicalHistory)) {
|
|
15020
|
+
const cacheKey = [this.type, this.providerSessionId, this.workingDir].join("\0");
|
|
15021
|
+
const now = Date.now();
|
|
15022
|
+
if (cacheKey === this.lastNativeSourceCanonicalCacheKey && now - this.lastNativeSourceCanonicalCheckAt < 2e3) {
|
|
15023
|
+
return true;
|
|
15024
|
+
}
|
|
15025
|
+
this.lastNativeSourceCanonicalCacheKey = cacheKey;
|
|
15026
|
+
this.lastNativeSourceCanonicalCheckAt = now;
|
|
15027
|
+
const restoredHistory = readProviderChatHistory(this.type, {
|
|
15028
|
+
canonicalHistory,
|
|
15029
|
+
historySessionId: this.providerSessionId,
|
|
15030
|
+
workspace: this.workingDir,
|
|
15031
|
+
offset: 0,
|
|
15032
|
+
limit: Number.MAX_SAFE_INTEGER,
|
|
15033
|
+
historyBehavior: this.provider.historyBehavior,
|
|
15034
|
+
scripts: this.provider.scripts
|
|
15035
|
+
});
|
|
15036
|
+
if (restoredHistory.source === "provider-native") {
|
|
15037
|
+
this.lastPersistedHistoryMessages = restoredHistory.messages.map((message) => ({
|
|
15038
|
+
role: message.role,
|
|
15039
|
+
content: message.content,
|
|
15040
|
+
kind: message.kind,
|
|
15041
|
+
senderName: message.senderName,
|
|
15042
|
+
receivedAt: message.receivedAt
|
|
15043
|
+
}));
|
|
15044
|
+
}
|
|
15045
|
+
return true;
|
|
15046
|
+
}
|
|
15044
15047
|
try {
|
|
15045
|
-
|
|
15046
|
-
|
|
15047
|
-
|
|
15048
|
-
|
|
15049
|
-
|
|
15050
|
-
|
|
15051
|
-
|
|
15052
|
-
|
|
15053
|
-
|
|
15054
|
-
if (!fs5.existsSync(watchPath)) return false;
|
|
15055
|
-
}
|
|
15056
|
-
const stat4 = fs5.statSync(watchPath);
|
|
15057
|
-
if (stat4.mtimeMs <= this.lastCanonicalHermesSyncMtimeMs) return true;
|
|
15058
|
-
rebuilt = rebuildHermesSavedHistoryFromCanonicalSession(this.providerSessionId);
|
|
15059
|
-
if (rebuilt) this.lastCanonicalHermesSyncMtimeMs = stat4.mtimeMs;
|
|
15060
|
-
} else if (canonicalHistory.format === "claude-jsonl") {
|
|
15061
|
-
const now = Date.now();
|
|
15062
|
-
if (now - this.lastCanonicalClaudeCheckAt < 2e3 && this.lastCanonicalClaudeRebuildMtimeMs !== 0) {
|
|
15063
|
-
return true;
|
|
15064
|
-
}
|
|
15065
|
-
this.lastCanonicalClaudeCheckAt = now;
|
|
15066
|
-
const claudeProjectsDir = path11.join(os13.homedir(), ".claude", "projects");
|
|
15067
|
-
const workspaceSegment = typeof this.workingDir === "string" ? this.workingDir.replace(/[\\/]/g, "-").replace(/^-+/, "") : "";
|
|
15068
|
-
const transcriptFile = path11.join(claudeProjectsDir, workspaceSegment, `${this.providerSessionId}.jsonl`);
|
|
15069
|
-
let transcriptMtime = 0;
|
|
15070
|
-
try {
|
|
15071
|
-
transcriptMtime = fs5.statSync(transcriptFile).mtimeMs;
|
|
15072
|
-
} catch {
|
|
15073
|
-
}
|
|
15074
|
-
if (transcriptMtime > 0 && transcriptMtime <= this.lastCanonicalClaudeRebuildMtimeMs) return true;
|
|
15075
|
-
rebuilt = rebuildClaudeSavedHistoryFromNativeProject(this.providerSessionId, this.workingDir);
|
|
15076
|
-
if (rebuilt) this.lastCanonicalClaudeRebuildMtimeMs = transcriptMtime || Date.now();
|
|
15048
|
+
const cacheKey = [this.type, this.providerSessionId, this.workingDir, canonicalHistory.mode || "materialized-mirror"].join("\0");
|
|
15049
|
+
const now = Date.now();
|
|
15050
|
+
if (cacheKey === this.lastNativeSourceCanonicalCacheKey && now - this.lastNativeSourceCanonicalCheckAt < 2e3) {
|
|
15051
|
+
return true;
|
|
15052
|
+
}
|
|
15053
|
+
this.lastNativeSourceCanonicalCacheKey = cacheKey;
|
|
15054
|
+
this.lastNativeSourceCanonicalCheckAt = now;
|
|
15055
|
+
if (!materializeProviderNativeHistory(this.type, canonicalHistory, this.providerSessionId, this.workingDir, this.provider.scripts)) {
|
|
15056
|
+
return false;
|
|
15077
15057
|
}
|
|
15078
|
-
if (!rebuilt) return false;
|
|
15079
15058
|
const restoredHistory = readChatHistory(this.type, 0, Number.MAX_SAFE_INTEGER, this.providerSessionId, 0, this.provider.historyBehavior);
|
|
15080
15059
|
this.lastPersistedHistoryMessages = restoredHistory.messages.map((message) => ({
|
|
15081
15060
|
role: message.role,
|
|
@@ -15092,8 +15071,18 @@ ${effect.notification.body || ""}`.trim();
|
|
|
15092
15071
|
restorePersistedHistoryFromCurrentSession() {
|
|
15093
15072
|
if (!this.providerSessionId) return;
|
|
15094
15073
|
this.syncCanonicalSavedHistoryIfNeeded();
|
|
15095
|
-
this.
|
|
15096
|
-
|
|
15074
|
+
const restoredHistory = isNativeSourceCanonicalHistory(this.provider.canonicalHistory) ? readProviderChatHistory(this.type, {
|
|
15075
|
+
canonicalHistory: this.provider.canonicalHistory,
|
|
15076
|
+
historySessionId: this.providerSessionId,
|
|
15077
|
+
workspace: this.workingDir,
|
|
15078
|
+
offset: 0,
|
|
15079
|
+
limit: Number.MAX_SAFE_INTEGER,
|
|
15080
|
+
historyBehavior: this.provider.historyBehavior,
|
|
15081
|
+
scripts: this.provider.scripts
|
|
15082
|
+
}) : (() => {
|
|
15083
|
+
this.historyWriter.compactHistorySession(this.type, this.providerSessionId, this.provider.historyBehavior);
|
|
15084
|
+
return readChatHistory(this.type, 0, Number.MAX_SAFE_INTEGER, this.providerSessionId, 0, this.provider.historyBehavior);
|
|
15085
|
+
})();
|
|
15097
15086
|
this.historyWriter.seedSessionHistory(
|
|
15098
15087
|
this.type,
|
|
15099
15088
|
restoredHistory.messages,
|
|
@@ -15420,10 +15409,10 @@ function mergeDefs(...defs) {
|
|
|
15420
15409
|
function cloneDef(schema) {
|
|
15421
15410
|
return mergeDefs(schema._zod.def);
|
|
15422
15411
|
}
|
|
15423
|
-
function getElementAtPath(obj,
|
|
15424
|
-
if (!
|
|
15412
|
+
function getElementAtPath(obj, path28) {
|
|
15413
|
+
if (!path28)
|
|
15425
15414
|
return obj;
|
|
15426
|
-
return
|
|
15415
|
+
return path28.reduce((acc, key) => acc?.[key], obj);
|
|
15427
15416
|
}
|
|
15428
15417
|
function promiseAllObject(promisesObj) {
|
|
15429
15418
|
const keys = Object.keys(promisesObj);
|
|
@@ -15735,11 +15724,11 @@ function aborted(x, startIndex = 0) {
|
|
|
15735
15724
|
}
|
|
15736
15725
|
return false;
|
|
15737
15726
|
}
|
|
15738
|
-
function prefixIssues(
|
|
15727
|
+
function prefixIssues(path28, issues) {
|
|
15739
15728
|
return issues.map((iss) => {
|
|
15740
15729
|
var _a2;
|
|
15741
15730
|
(_a2 = iss).path ?? (_a2.path = []);
|
|
15742
|
-
iss.path.unshift(
|
|
15731
|
+
iss.path.unshift(path28);
|
|
15743
15732
|
return iss;
|
|
15744
15733
|
});
|
|
15745
15734
|
}
|
|
@@ -15982,7 +15971,7 @@ function formatError(error48, mapper = (issue2) => issue2.message) {
|
|
|
15982
15971
|
}
|
|
15983
15972
|
function treeifyError(error48, mapper = (issue2) => issue2.message) {
|
|
15984
15973
|
const result = { errors: [] };
|
|
15985
|
-
const processError = (error49,
|
|
15974
|
+
const processError = (error49, path28 = []) => {
|
|
15986
15975
|
var _a2, _b;
|
|
15987
15976
|
for (const issue2 of error49.issues) {
|
|
15988
15977
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
@@ -15992,7 +15981,7 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
|
|
|
15992
15981
|
} else if (issue2.code === "invalid_element") {
|
|
15993
15982
|
processError({ issues: issue2.issues }, issue2.path);
|
|
15994
15983
|
} else {
|
|
15995
|
-
const fullpath = [...
|
|
15984
|
+
const fullpath = [...path28, ...issue2.path];
|
|
15996
15985
|
if (fullpath.length === 0) {
|
|
15997
15986
|
result.errors.push(mapper(issue2));
|
|
15998
15987
|
continue;
|
|
@@ -16024,8 +16013,8 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
|
|
|
16024
16013
|
}
|
|
16025
16014
|
function toDotPath(_path) {
|
|
16026
16015
|
const segs = [];
|
|
16027
|
-
const
|
|
16028
|
-
for (const seg of
|
|
16016
|
+
const path28 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
16017
|
+
for (const seg of path28) {
|
|
16029
16018
|
if (typeof seg === "number")
|
|
16030
16019
|
segs.push(`[${seg}]`);
|
|
16031
16020
|
else if (typeof seg === "symbol")
|
|
@@ -28789,13 +28778,13 @@ function resolveRef(ref, ctx) {
|
|
|
28789
28778
|
if (!ref.startsWith("#")) {
|
|
28790
28779
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
28791
28780
|
}
|
|
28792
|
-
const
|
|
28793
|
-
if (
|
|
28781
|
+
const path28 = ref.slice(1).split("/").filter(Boolean);
|
|
28782
|
+
if (path28.length === 0) {
|
|
28794
28783
|
return ctx.rootSchema;
|
|
28795
28784
|
}
|
|
28796
28785
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
28797
|
-
if (
|
|
28798
|
-
const key =
|
|
28786
|
+
if (path28[0] === defsKey) {
|
|
28787
|
+
const key = path28[1];
|
|
28799
28788
|
if (!key || !ctx.defs[key]) {
|
|
28800
28789
|
throw new Error(`Reference not found: ${ref}`);
|
|
28801
28790
|
}
|
|
@@ -33549,7 +33538,7 @@ var init_readdirp = __esm({
|
|
|
33549
33538
|
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
|
33550
33539
|
const statMethod = opts.lstat ? import_promises.lstat : import_promises.stat;
|
|
33551
33540
|
if (wantBigintFsStats) {
|
|
33552
|
-
this._stat = (
|
|
33541
|
+
this._stat = (path28) => statMethod(path28, { bigint: true });
|
|
33553
33542
|
} else {
|
|
33554
33543
|
this._stat = statMethod;
|
|
33555
33544
|
}
|
|
@@ -33574,8 +33563,8 @@ var init_readdirp = __esm({
|
|
|
33574
33563
|
const par = this.parent;
|
|
33575
33564
|
const fil = par && par.files;
|
|
33576
33565
|
if (fil && fil.length > 0) {
|
|
33577
|
-
const { path:
|
|
33578
|
-
const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent,
|
|
33566
|
+
const { path: path28, depth } = par;
|
|
33567
|
+
const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path28));
|
|
33579
33568
|
const awaited = await Promise.all(slice);
|
|
33580
33569
|
for (const entry of awaited) {
|
|
33581
33570
|
if (!entry)
|
|
@@ -33615,20 +33604,20 @@ var init_readdirp = __esm({
|
|
|
33615
33604
|
this.reading = false;
|
|
33616
33605
|
}
|
|
33617
33606
|
}
|
|
33618
|
-
async _exploreDir(
|
|
33607
|
+
async _exploreDir(path28, depth) {
|
|
33619
33608
|
let files;
|
|
33620
33609
|
try {
|
|
33621
|
-
files = await (0, import_promises.readdir)(
|
|
33610
|
+
files = await (0, import_promises.readdir)(path28, this._rdOptions);
|
|
33622
33611
|
} catch (error48) {
|
|
33623
33612
|
this._onError(error48);
|
|
33624
33613
|
}
|
|
33625
|
-
return { files, depth, path:
|
|
33614
|
+
return { files, depth, path: path28 };
|
|
33626
33615
|
}
|
|
33627
|
-
async _formatEntry(dirent,
|
|
33616
|
+
async _formatEntry(dirent, path28) {
|
|
33628
33617
|
let entry;
|
|
33629
33618
|
const basename9 = this._isDirent ? dirent.name : dirent;
|
|
33630
33619
|
try {
|
|
33631
|
-
const fullPath = (0, import_node_path.resolve)((0, import_node_path.join)(
|
|
33620
|
+
const fullPath = (0, import_node_path.resolve)((0, import_node_path.join)(path28, basename9));
|
|
33632
33621
|
entry = { path: (0, import_node_path.relative)(this._root, fullPath), fullPath, basename: basename9 };
|
|
33633
33622
|
entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
|
33634
33623
|
} catch (err) {
|
|
@@ -33685,16 +33674,16 @@ var init_readdirp = __esm({
|
|
|
33685
33674
|
});
|
|
33686
33675
|
|
|
33687
33676
|
// ../../oss/packages/daemon-core/node_modules/chokidar/handler.js
|
|
33688
|
-
function createFsWatchInstance(
|
|
33677
|
+
function createFsWatchInstance(path28, options, listener, errHandler, emitRaw) {
|
|
33689
33678
|
const handleEvent = (rawEvent, evPath) => {
|
|
33690
|
-
listener(
|
|
33691
|
-
emitRaw(rawEvent, evPath, { watchedPath:
|
|
33692
|
-
if (evPath &&
|
|
33693
|
-
fsWatchBroadcast(sp.resolve(
|
|
33679
|
+
listener(path28);
|
|
33680
|
+
emitRaw(rawEvent, evPath, { watchedPath: path28 });
|
|
33681
|
+
if (evPath && path28 !== evPath) {
|
|
33682
|
+
fsWatchBroadcast(sp.resolve(path28, evPath), KEY_LISTENERS, sp.join(path28, evPath));
|
|
33694
33683
|
}
|
|
33695
33684
|
};
|
|
33696
33685
|
try {
|
|
33697
|
-
return (0, import_node_fs.watch)(
|
|
33686
|
+
return (0, import_node_fs.watch)(path28, {
|
|
33698
33687
|
persistent: options.persistent
|
|
33699
33688
|
}, handleEvent);
|
|
33700
33689
|
} catch (error48) {
|
|
@@ -34043,12 +34032,12 @@ var init_handler2 = __esm({
|
|
|
34043
34032
|
listener(val1, val2, val3);
|
|
34044
34033
|
});
|
|
34045
34034
|
};
|
|
34046
|
-
setFsWatchListener = (
|
|
34035
|
+
setFsWatchListener = (path28, fullPath, options, handlers) => {
|
|
34047
34036
|
const { listener, errHandler, rawEmitter } = handlers;
|
|
34048
34037
|
let cont = FsWatchInstances.get(fullPath);
|
|
34049
34038
|
let watcher;
|
|
34050
34039
|
if (!options.persistent) {
|
|
34051
|
-
watcher = createFsWatchInstance(
|
|
34040
|
+
watcher = createFsWatchInstance(path28, options, listener, errHandler, rawEmitter);
|
|
34052
34041
|
if (!watcher)
|
|
34053
34042
|
return;
|
|
34054
34043
|
return watcher.close.bind(watcher);
|
|
@@ -34059,7 +34048,7 @@ var init_handler2 = __esm({
|
|
|
34059
34048
|
addAndConvert(cont, KEY_RAW, rawEmitter);
|
|
34060
34049
|
} else {
|
|
34061
34050
|
watcher = createFsWatchInstance(
|
|
34062
|
-
|
|
34051
|
+
path28,
|
|
34063
34052
|
options,
|
|
34064
34053
|
fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS),
|
|
34065
34054
|
errHandler,
|
|
@@ -34074,7 +34063,7 @@ var init_handler2 = __esm({
|
|
|
34074
34063
|
cont.watcherUnusable = true;
|
|
34075
34064
|
if (isWindows && error48.code === "EPERM") {
|
|
34076
34065
|
try {
|
|
34077
|
-
const fd = await (0, import_promises2.open)(
|
|
34066
|
+
const fd = await (0, import_promises2.open)(path28, "r");
|
|
34078
34067
|
await fd.close();
|
|
34079
34068
|
broadcastErr(error48);
|
|
34080
34069
|
} catch (err) {
|
|
@@ -34105,7 +34094,7 @@ var init_handler2 = __esm({
|
|
|
34105
34094
|
};
|
|
34106
34095
|
};
|
|
34107
34096
|
FsWatchFileInstances = /* @__PURE__ */ new Map();
|
|
34108
|
-
setFsWatchFileListener = (
|
|
34097
|
+
setFsWatchFileListener = (path28, fullPath, options, handlers) => {
|
|
34109
34098
|
const { listener, rawEmitter } = handlers;
|
|
34110
34099
|
let cont = FsWatchFileInstances.get(fullPath);
|
|
34111
34100
|
const copts = cont && cont.options;
|
|
@@ -34127,7 +34116,7 @@ var init_handler2 = __esm({
|
|
|
34127
34116
|
});
|
|
34128
34117
|
const currmtime = curr.mtimeMs;
|
|
34129
34118
|
if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
|
|
34130
|
-
foreach(cont.listeners, (listener2) => listener2(
|
|
34119
|
+
foreach(cont.listeners, (listener2) => listener2(path28, curr));
|
|
34131
34120
|
}
|
|
34132
34121
|
})
|
|
34133
34122
|
};
|
|
@@ -34157,13 +34146,13 @@ var init_handler2 = __esm({
|
|
|
34157
34146
|
* @param listener on fs change
|
|
34158
34147
|
* @returns closer for the watcher instance
|
|
34159
34148
|
*/
|
|
34160
|
-
_watchWithNodeFs(
|
|
34149
|
+
_watchWithNodeFs(path28, listener) {
|
|
34161
34150
|
const opts = this.fsw.options;
|
|
34162
|
-
const directory = sp.dirname(
|
|
34163
|
-
const basename9 = sp.basename(
|
|
34151
|
+
const directory = sp.dirname(path28);
|
|
34152
|
+
const basename9 = sp.basename(path28);
|
|
34164
34153
|
const parent = this.fsw._getWatchedDir(directory);
|
|
34165
34154
|
parent.add(basename9);
|
|
34166
|
-
const absolutePath = sp.resolve(
|
|
34155
|
+
const absolutePath = sp.resolve(path28);
|
|
34167
34156
|
const options = {
|
|
34168
34157
|
persistent: opts.persistent
|
|
34169
34158
|
};
|
|
@@ -34173,12 +34162,12 @@ var init_handler2 = __esm({
|
|
|
34173
34162
|
if (opts.usePolling) {
|
|
34174
34163
|
const enableBin = opts.interval !== opts.binaryInterval;
|
|
34175
34164
|
options.interval = enableBin && isBinaryPath(basename9) ? opts.binaryInterval : opts.interval;
|
|
34176
|
-
closer = setFsWatchFileListener(
|
|
34165
|
+
closer = setFsWatchFileListener(path28, absolutePath, options, {
|
|
34177
34166
|
listener,
|
|
34178
34167
|
rawEmitter: this.fsw._emitRaw
|
|
34179
34168
|
});
|
|
34180
34169
|
} else {
|
|
34181
|
-
closer = setFsWatchListener(
|
|
34170
|
+
closer = setFsWatchListener(path28, absolutePath, options, {
|
|
34182
34171
|
listener,
|
|
34183
34172
|
errHandler: this._boundHandleError,
|
|
34184
34173
|
rawEmitter: this.fsw._emitRaw
|
|
@@ -34200,7 +34189,7 @@ var init_handler2 = __esm({
|
|
|
34200
34189
|
let prevStats = stats;
|
|
34201
34190
|
if (parent.has(basename9))
|
|
34202
34191
|
return;
|
|
34203
|
-
const listener = async (
|
|
34192
|
+
const listener = async (path28, newStats) => {
|
|
34204
34193
|
if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file2, 5))
|
|
34205
34194
|
return;
|
|
34206
34195
|
if (!newStats || newStats.mtimeMs === 0) {
|
|
@@ -34214,11 +34203,11 @@ var init_handler2 = __esm({
|
|
|
34214
34203
|
this.fsw._emit(EV.CHANGE, file2, newStats2);
|
|
34215
34204
|
}
|
|
34216
34205
|
if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats2.ino) {
|
|
34217
|
-
this.fsw._closeFile(
|
|
34206
|
+
this.fsw._closeFile(path28);
|
|
34218
34207
|
prevStats = newStats2;
|
|
34219
34208
|
const closer2 = this._watchWithNodeFs(file2, listener);
|
|
34220
34209
|
if (closer2)
|
|
34221
|
-
this.fsw._addPathCloser(
|
|
34210
|
+
this.fsw._addPathCloser(path28, closer2);
|
|
34222
34211
|
} else {
|
|
34223
34212
|
prevStats = newStats2;
|
|
34224
34213
|
}
|
|
@@ -34250,7 +34239,7 @@ var init_handler2 = __esm({
|
|
|
34250
34239
|
* @param item basename of this item
|
|
34251
34240
|
* @returns true if no more processing is needed for this entry.
|
|
34252
34241
|
*/
|
|
34253
|
-
async _handleSymlink(entry, directory,
|
|
34242
|
+
async _handleSymlink(entry, directory, path28, item) {
|
|
34254
34243
|
if (this.fsw.closed) {
|
|
34255
34244
|
return;
|
|
34256
34245
|
}
|
|
@@ -34260,7 +34249,7 @@ var init_handler2 = __esm({
|
|
|
34260
34249
|
this.fsw._incrReadyCount();
|
|
34261
34250
|
let linkPath;
|
|
34262
34251
|
try {
|
|
34263
|
-
linkPath = await (0, import_promises2.realpath)(
|
|
34252
|
+
linkPath = await (0, import_promises2.realpath)(path28);
|
|
34264
34253
|
} catch (e) {
|
|
34265
34254
|
this.fsw._emitReady();
|
|
34266
34255
|
return true;
|
|
@@ -34270,12 +34259,12 @@ var init_handler2 = __esm({
|
|
|
34270
34259
|
if (dir.has(item)) {
|
|
34271
34260
|
if (this.fsw._symlinkPaths.get(full) !== linkPath) {
|
|
34272
34261
|
this.fsw._symlinkPaths.set(full, linkPath);
|
|
34273
|
-
this.fsw._emit(EV.CHANGE,
|
|
34262
|
+
this.fsw._emit(EV.CHANGE, path28, entry.stats);
|
|
34274
34263
|
}
|
|
34275
34264
|
} else {
|
|
34276
34265
|
dir.add(item);
|
|
34277
34266
|
this.fsw._symlinkPaths.set(full, linkPath);
|
|
34278
|
-
this.fsw._emit(EV.ADD,
|
|
34267
|
+
this.fsw._emit(EV.ADD, path28, entry.stats);
|
|
34279
34268
|
}
|
|
34280
34269
|
this.fsw._emitReady();
|
|
34281
34270
|
return true;
|
|
@@ -34305,9 +34294,9 @@ var init_handler2 = __esm({
|
|
|
34305
34294
|
return;
|
|
34306
34295
|
}
|
|
34307
34296
|
const item = entry.path;
|
|
34308
|
-
let
|
|
34297
|
+
let path28 = sp.join(directory, item);
|
|
34309
34298
|
current.add(item);
|
|
34310
|
-
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory,
|
|
34299
|
+
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path28, item)) {
|
|
34311
34300
|
return;
|
|
34312
34301
|
}
|
|
34313
34302
|
if (this.fsw.closed) {
|
|
@@ -34316,8 +34305,8 @@ var init_handler2 = __esm({
|
|
|
34316
34305
|
}
|
|
34317
34306
|
if (item === target || !target && !previous.has(item)) {
|
|
34318
34307
|
this.fsw._incrReadyCount();
|
|
34319
|
-
|
|
34320
|
-
this._addToNodeFs(
|
|
34308
|
+
path28 = sp.join(dir, sp.relative(dir, path28));
|
|
34309
|
+
this._addToNodeFs(path28, initialAdd, wh, depth + 1);
|
|
34321
34310
|
}
|
|
34322
34311
|
}).on(EV.ERROR, this._boundHandleError);
|
|
34323
34312
|
return new Promise((resolve16, reject) => {
|
|
@@ -34386,13 +34375,13 @@ var init_handler2 = __esm({
|
|
|
34386
34375
|
* @param depth Child path actually targeted for watch
|
|
34387
34376
|
* @param target Child path actually targeted for watch
|
|
34388
34377
|
*/
|
|
34389
|
-
async _addToNodeFs(
|
|
34378
|
+
async _addToNodeFs(path28, initialAdd, priorWh, depth, target) {
|
|
34390
34379
|
const ready = this.fsw._emitReady;
|
|
34391
|
-
if (this.fsw._isIgnored(
|
|
34380
|
+
if (this.fsw._isIgnored(path28) || this.fsw.closed) {
|
|
34392
34381
|
ready();
|
|
34393
34382
|
return false;
|
|
34394
34383
|
}
|
|
34395
|
-
const wh = this.fsw._getWatchHelpers(
|
|
34384
|
+
const wh = this.fsw._getWatchHelpers(path28);
|
|
34396
34385
|
if (priorWh) {
|
|
34397
34386
|
wh.filterPath = (entry) => priorWh.filterPath(entry);
|
|
34398
34387
|
wh.filterDir = (entry) => priorWh.filterDir(entry);
|
|
@@ -34408,8 +34397,8 @@ var init_handler2 = __esm({
|
|
|
34408
34397
|
const follow = this.fsw.options.followSymlinks;
|
|
34409
34398
|
let closer;
|
|
34410
34399
|
if (stats.isDirectory()) {
|
|
34411
|
-
const absPath = sp.resolve(
|
|
34412
|
-
const targetPath = follow ? await (0, import_promises2.realpath)(
|
|
34400
|
+
const absPath = sp.resolve(path28);
|
|
34401
|
+
const targetPath = follow ? await (0, import_promises2.realpath)(path28) : path28;
|
|
34413
34402
|
if (this.fsw.closed)
|
|
34414
34403
|
return;
|
|
34415
34404
|
closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
|
|
@@ -34419,29 +34408,29 @@ var init_handler2 = __esm({
|
|
|
34419
34408
|
this.fsw._symlinkPaths.set(absPath, targetPath);
|
|
34420
34409
|
}
|
|
34421
34410
|
} else if (stats.isSymbolicLink()) {
|
|
34422
|
-
const targetPath = follow ? await (0, import_promises2.realpath)(
|
|
34411
|
+
const targetPath = follow ? await (0, import_promises2.realpath)(path28) : path28;
|
|
34423
34412
|
if (this.fsw.closed)
|
|
34424
34413
|
return;
|
|
34425
34414
|
const parent = sp.dirname(wh.watchPath);
|
|
34426
34415
|
this.fsw._getWatchedDir(parent).add(wh.watchPath);
|
|
34427
34416
|
this.fsw._emit(EV.ADD, wh.watchPath, stats);
|
|
34428
|
-
closer = await this._handleDir(parent, stats, initialAdd, depth,
|
|
34417
|
+
closer = await this._handleDir(parent, stats, initialAdd, depth, path28, wh, targetPath);
|
|
34429
34418
|
if (this.fsw.closed)
|
|
34430
34419
|
return;
|
|
34431
34420
|
if (targetPath !== void 0) {
|
|
34432
|
-
this.fsw._symlinkPaths.set(sp.resolve(
|
|
34421
|
+
this.fsw._symlinkPaths.set(sp.resolve(path28), targetPath);
|
|
34433
34422
|
}
|
|
34434
34423
|
} else {
|
|
34435
34424
|
closer = this._handleFile(wh.watchPath, stats, initialAdd);
|
|
34436
34425
|
}
|
|
34437
34426
|
ready();
|
|
34438
34427
|
if (closer)
|
|
34439
|
-
this.fsw._addPathCloser(
|
|
34428
|
+
this.fsw._addPathCloser(path28, closer);
|
|
34440
34429
|
return false;
|
|
34441
34430
|
} catch (error48) {
|
|
34442
34431
|
if (this.fsw._handleError(error48)) {
|
|
34443
34432
|
ready();
|
|
34444
|
-
return
|
|
34433
|
+
return path28;
|
|
34445
34434
|
}
|
|
34446
34435
|
}
|
|
34447
34436
|
}
|
|
@@ -34476,24 +34465,24 @@ function createPattern(matcher) {
|
|
|
34476
34465
|
}
|
|
34477
34466
|
return () => false;
|
|
34478
34467
|
}
|
|
34479
|
-
function normalizePath(
|
|
34480
|
-
if (typeof
|
|
34468
|
+
function normalizePath(path28) {
|
|
34469
|
+
if (typeof path28 !== "string")
|
|
34481
34470
|
throw new Error("string expected");
|
|
34482
|
-
|
|
34483
|
-
|
|
34471
|
+
path28 = sp2.normalize(path28);
|
|
34472
|
+
path28 = path28.replace(/\\/g, "/");
|
|
34484
34473
|
let prepend = false;
|
|
34485
|
-
if (
|
|
34474
|
+
if (path28.startsWith("//"))
|
|
34486
34475
|
prepend = true;
|
|
34487
|
-
|
|
34476
|
+
path28 = path28.replace(DOUBLE_SLASH_RE, "/");
|
|
34488
34477
|
if (prepend)
|
|
34489
|
-
|
|
34490
|
-
return
|
|
34478
|
+
path28 = "/" + path28;
|
|
34479
|
+
return path28;
|
|
34491
34480
|
}
|
|
34492
34481
|
function matchPatterns(patterns, testString, stats) {
|
|
34493
|
-
const
|
|
34482
|
+
const path28 = normalizePath(testString);
|
|
34494
34483
|
for (let index = 0; index < patterns.length; index++) {
|
|
34495
34484
|
const pattern = patterns[index];
|
|
34496
|
-
if (pattern(
|
|
34485
|
+
if (pattern(path28, stats)) {
|
|
34497
34486
|
return true;
|
|
34498
34487
|
}
|
|
34499
34488
|
}
|
|
@@ -34556,19 +34545,19 @@ var init_chokidar = __esm({
|
|
|
34556
34545
|
}
|
|
34557
34546
|
return str;
|
|
34558
34547
|
};
|
|
34559
|
-
normalizePathToUnix = (
|
|
34560
|
-
normalizeIgnored = (cwd = "") => (
|
|
34561
|
-
if (typeof
|
|
34562
|
-
return normalizePathToUnix(sp2.isAbsolute(
|
|
34548
|
+
normalizePathToUnix = (path28) => toUnix(sp2.normalize(toUnix(path28)));
|
|
34549
|
+
normalizeIgnored = (cwd = "") => (path28) => {
|
|
34550
|
+
if (typeof path28 === "string") {
|
|
34551
|
+
return normalizePathToUnix(sp2.isAbsolute(path28) ? path28 : sp2.join(cwd, path28));
|
|
34563
34552
|
} else {
|
|
34564
|
-
return
|
|
34553
|
+
return path28;
|
|
34565
34554
|
}
|
|
34566
34555
|
};
|
|
34567
|
-
getAbsolutePath = (
|
|
34568
|
-
if (sp2.isAbsolute(
|
|
34569
|
-
return
|
|
34556
|
+
getAbsolutePath = (path28, cwd) => {
|
|
34557
|
+
if (sp2.isAbsolute(path28)) {
|
|
34558
|
+
return path28;
|
|
34570
34559
|
}
|
|
34571
|
-
return sp2.join(cwd,
|
|
34560
|
+
return sp2.join(cwd, path28);
|
|
34572
34561
|
};
|
|
34573
34562
|
EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
|
|
34574
34563
|
DirEntry = class {
|
|
@@ -34633,10 +34622,10 @@ var init_chokidar = __esm({
|
|
|
34633
34622
|
dirParts;
|
|
34634
34623
|
followSymlinks;
|
|
34635
34624
|
statMethod;
|
|
34636
|
-
constructor(
|
|
34625
|
+
constructor(path28, follow, fsw) {
|
|
34637
34626
|
this.fsw = fsw;
|
|
34638
|
-
const watchPath =
|
|
34639
|
-
this.path =
|
|
34627
|
+
const watchPath = path28;
|
|
34628
|
+
this.path = path28 = path28.replace(REPLACER_RE, "");
|
|
34640
34629
|
this.watchPath = watchPath;
|
|
34641
34630
|
this.fullWatchPath = sp2.resolve(watchPath);
|
|
34642
34631
|
this.dirParts = [];
|
|
@@ -34776,20 +34765,20 @@ var init_chokidar = __esm({
|
|
|
34776
34765
|
this._closePromise = void 0;
|
|
34777
34766
|
let paths = unifyPaths(paths_);
|
|
34778
34767
|
if (cwd) {
|
|
34779
|
-
paths = paths.map((
|
|
34780
|
-
const absPath = getAbsolutePath(
|
|
34768
|
+
paths = paths.map((path28) => {
|
|
34769
|
+
const absPath = getAbsolutePath(path28, cwd);
|
|
34781
34770
|
return absPath;
|
|
34782
34771
|
});
|
|
34783
34772
|
}
|
|
34784
|
-
paths.forEach((
|
|
34785
|
-
this._removeIgnoredPath(
|
|
34773
|
+
paths.forEach((path28) => {
|
|
34774
|
+
this._removeIgnoredPath(path28);
|
|
34786
34775
|
});
|
|
34787
34776
|
this._userIgnored = void 0;
|
|
34788
34777
|
if (!this._readyCount)
|
|
34789
34778
|
this._readyCount = 0;
|
|
34790
34779
|
this._readyCount += paths.length;
|
|
34791
|
-
Promise.all(paths.map(async (
|
|
34792
|
-
const res = await this._nodeFsHandler._addToNodeFs(
|
|
34780
|
+
Promise.all(paths.map(async (path28) => {
|
|
34781
|
+
const res = await this._nodeFsHandler._addToNodeFs(path28, !_internal, void 0, 0, _origAdd);
|
|
34793
34782
|
if (res)
|
|
34794
34783
|
this._emitReady();
|
|
34795
34784
|
return res;
|
|
@@ -34811,17 +34800,17 @@ var init_chokidar = __esm({
|
|
|
34811
34800
|
return this;
|
|
34812
34801
|
const paths = unifyPaths(paths_);
|
|
34813
34802
|
const { cwd } = this.options;
|
|
34814
|
-
paths.forEach((
|
|
34815
|
-
if (!sp2.isAbsolute(
|
|
34803
|
+
paths.forEach((path28) => {
|
|
34804
|
+
if (!sp2.isAbsolute(path28) && !this._closers.has(path28)) {
|
|
34816
34805
|
if (cwd)
|
|
34817
|
-
|
|
34818
|
-
|
|
34806
|
+
path28 = sp2.join(cwd, path28);
|
|
34807
|
+
path28 = sp2.resolve(path28);
|
|
34819
34808
|
}
|
|
34820
|
-
this._closePath(
|
|
34821
|
-
this._addIgnoredPath(
|
|
34822
|
-
if (this._watched.has(
|
|
34809
|
+
this._closePath(path28);
|
|
34810
|
+
this._addIgnoredPath(path28);
|
|
34811
|
+
if (this._watched.has(path28)) {
|
|
34823
34812
|
this._addIgnoredPath({
|
|
34824
|
-
path:
|
|
34813
|
+
path: path28,
|
|
34825
34814
|
recursive: true
|
|
34826
34815
|
});
|
|
34827
34816
|
}
|
|
@@ -34885,38 +34874,38 @@ var init_chokidar = __esm({
|
|
|
34885
34874
|
* @param stats arguments to be passed with event
|
|
34886
34875
|
* @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
|
|
34887
34876
|
*/
|
|
34888
|
-
async _emit(event,
|
|
34877
|
+
async _emit(event, path28, stats) {
|
|
34889
34878
|
if (this.closed)
|
|
34890
34879
|
return;
|
|
34891
34880
|
const opts = this.options;
|
|
34892
34881
|
if (isWindows)
|
|
34893
|
-
|
|
34882
|
+
path28 = sp2.normalize(path28);
|
|
34894
34883
|
if (opts.cwd)
|
|
34895
|
-
|
|
34896
|
-
const args = [
|
|
34884
|
+
path28 = sp2.relative(opts.cwd, path28);
|
|
34885
|
+
const args = [path28];
|
|
34897
34886
|
if (stats != null)
|
|
34898
34887
|
args.push(stats);
|
|
34899
34888
|
const awf = opts.awaitWriteFinish;
|
|
34900
34889
|
let pw;
|
|
34901
|
-
if (awf && (pw = this._pendingWrites.get(
|
|
34890
|
+
if (awf && (pw = this._pendingWrites.get(path28))) {
|
|
34902
34891
|
pw.lastChange = /* @__PURE__ */ new Date();
|
|
34903
34892
|
return this;
|
|
34904
34893
|
}
|
|
34905
34894
|
if (opts.atomic) {
|
|
34906
34895
|
if (event === EVENTS.UNLINK) {
|
|
34907
|
-
this._pendingUnlinks.set(
|
|
34896
|
+
this._pendingUnlinks.set(path28, [event, ...args]);
|
|
34908
34897
|
setTimeout(() => {
|
|
34909
|
-
this._pendingUnlinks.forEach((entry,
|
|
34898
|
+
this._pendingUnlinks.forEach((entry, path29) => {
|
|
34910
34899
|
this.emit(...entry);
|
|
34911
34900
|
this.emit(EVENTS.ALL, ...entry);
|
|
34912
|
-
this._pendingUnlinks.delete(
|
|
34901
|
+
this._pendingUnlinks.delete(path29);
|
|
34913
34902
|
});
|
|
34914
34903
|
}, typeof opts.atomic === "number" ? opts.atomic : 100);
|
|
34915
34904
|
return this;
|
|
34916
34905
|
}
|
|
34917
|
-
if (event === EVENTS.ADD && this._pendingUnlinks.has(
|
|
34906
|
+
if (event === EVENTS.ADD && this._pendingUnlinks.has(path28)) {
|
|
34918
34907
|
event = EVENTS.CHANGE;
|
|
34919
|
-
this._pendingUnlinks.delete(
|
|
34908
|
+
this._pendingUnlinks.delete(path28);
|
|
34920
34909
|
}
|
|
34921
34910
|
}
|
|
34922
34911
|
if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
|
|
@@ -34934,16 +34923,16 @@ var init_chokidar = __esm({
|
|
|
34934
34923
|
this.emitWithAll(event, args);
|
|
34935
34924
|
}
|
|
34936
34925
|
};
|
|
34937
|
-
this._awaitWriteFinish(
|
|
34926
|
+
this._awaitWriteFinish(path28, awf.stabilityThreshold, event, awfEmit);
|
|
34938
34927
|
return this;
|
|
34939
34928
|
}
|
|
34940
34929
|
if (event === EVENTS.CHANGE) {
|
|
34941
|
-
const isThrottled = !this._throttle(EVENTS.CHANGE,
|
|
34930
|
+
const isThrottled = !this._throttle(EVENTS.CHANGE, path28, 50);
|
|
34942
34931
|
if (isThrottled)
|
|
34943
34932
|
return this;
|
|
34944
34933
|
}
|
|
34945
34934
|
if (opts.alwaysStat && stats === void 0 && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
|
|
34946
|
-
const fullPath = opts.cwd ? sp2.join(opts.cwd,
|
|
34935
|
+
const fullPath = opts.cwd ? sp2.join(opts.cwd, path28) : path28;
|
|
34947
34936
|
let stats2;
|
|
34948
34937
|
try {
|
|
34949
34938
|
stats2 = await (0, import_promises3.stat)(fullPath);
|
|
@@ -34974,23 +34963,23 @@ var init_chokidar = __esm({
|
|
|
34974
34963
|
* @param timeout duration of time to suppress duplicate actions
|
|
34975
34964
|
* @returns tracking object or false if action should be suppressed
|
|
34976
34965
|
*/
|
|
34977
|
-
_throttle(actionType,
|
|
34966
|
+
_throttle(actionType, path28, timeout) {
|
|
34978
34967
|
if (!this._throttled.has(actionType)) {
|
|
34979
34968
|
this._throttled.set(actionType, /* @__PURE__ */ new Map());
|
|
34980
34969
|
}
|
|
34981
34970
|
const action = this._throttled.get(actionType);
|
|
34982
34971
|
if (!action)
|
|
34983
34972
|
throw new Error("invalid throttle");
|
|
34984
|
-
const actionPath = action.get(
|
|
34973
|
+
const actionPath = action.get(path28);
|
|
34985
34974
|
if (actionPath) {
|
|
34986
34975
|
actionPath.count++;
|
|
34987
34976
|
return false;
|
|
34988
34977
|
}
|
|
34989
34978
|
let timeoutObject;
|
|
34990
34979
|
const clear = () => {
|
|
34991
|
-
const item = action.get(
|
|
34980
|
+
const item = action.get(path28);
|
|
34992
34981
|
const count = item ? item.count : 0;
|
|
34993
|
-
action.delete(
|
|
34982
|
+
action.delete(path28);
|
|
34994
34983
|
clearTimeout(timeoutObject);
|
|
34995
34984
|
if (item)
|
|
34996
34985
|
clearTimeout(item.timeoutObject);
|
|
@@ -34998,7 +34987,7 @@ var init_chokidar = __esm({
|
|
|
34998
34987
|
};
|
|
34999
34988
|
timeoutObject = setTimeout(clear, timeout);
|
|
35000
34989
|
const thr = { timeoutObject, clear, count: 0 };
|
|
35001
|
-
action.set(
|
|
34990
|
+
action.set(path28, thr);
|
|
35002
34991
|
return thr;
|
|
35003
34992
|
}
|
|
35004
34993
|
_incrReadyCount() {
|
|
@@ -35012,44 +35001,44 @@ var init_chokidar = __esm({
|
|
|
35012
35001
|
* @param event
|
|
35013
35002
|
* @param awfEmit Callback to be called when ready for event to be emitted.
|
|
35014
35003
|
*/
|
|
35015
|
-
_awaitWriteFinish(
|
|
35004
|
+
_awaitWriteFinish(path28, threshold, event, awfEmit) {
|
|
35016
35005
|
const awf = this.options.awaitWriteFinish;
|
|
35017
35006
|
if (typeof awf !== "object")
|
|
35018
35007
|
return;
|
|
35019
35008
|
const pollInterval = awf.pollInterval;
|
|
35020
35009
|
let timeoutHandler;
|
|
35021
|
-
let fullPath =
|
|
35022
|
-
if (this.options.cwd && !sp2.isAbsolute(
|
|
35023
|
-
fullPath = sp2.join(this.options.cwd,
|
|
35010
|
+
let fullPath = path28;
|
|
35011
|
+
if (this.options.cwd && !sp2.isAbsolute(path28)) {
|
|
35012
|
+
fullPath = sp2.join(this.options.cwd, path28);
|
|
35024
35013
|
}
|
|
35025
35014
|
const now = /* @__PURE__ */ new Date();
|
|
35026
35015
|
const writes = this._pendingWrites;
|
|
35027
35016
|
function awaitWriteFinishFn(prevStat) {
|
|
35028
35017
|
(0, import_node_fs2.stat)(fullPath, (err, curStat) => {
|
|
35029
|
-
if (err || !writes.has(
|
|
35018
|
+
if (err || !writes.has(path28)) {
|
|
35030
35019
|
if (err && err.code !== "ENOENT")
|
|
35031
35020
|
awfEmit(err);
|
|
35032
35021
|
return;
|
|
35033
35022
|
}
|
|
35034
35023
|
const now2 = Number(/* @__PURE__ */ new Date());
|
|
35035
35024
|
if (prevStat && curStat.size !== prevStat.size) {
|
|
35036
|
-
writes.get(
|
|
35025
|
+
writes.get(path28).lastChange = now2;
|
|
35037
35026
|
}
|
|
35038
|
-
const pw = writes.get(
|
|
35027
|
+
const pw = writes.get(path28);
|
|
35039
35028
|
const df = now2 - pw.lastChange;
|
|
35040
35029
|
if (df >= threshold) {
|
|
35041
|
-
writes.delete(
|
|
35030
|
+
writes.delete(path28);
|
|
35042
35031
|
awfEmit(void 0, curStat);
|
|
35043
35032
|
} else {
|
|
35044
35033
|
timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
|
|
35045
35034
|
}
|
|
35046
35035
|
});
|
|
35047
35036
|
}
|
|
35048
|
-
if (!writes.has(
|
|
35049
|
-
writes.set(
|
|
35037
|
+
if (!writes.has(path28)) {
|
|
35038
|
+
writes.set(path28, {
|
|
35050
35039
|
lastChange: now,
|
|
35051
35040
|
cancelWait: () => {
|
|
35052
|
-
writes.delete(
|
|
35041
|
+
writes.delete(path28);
|
|
35053
35042
|
clearTimeout(timeoutHandler);
|
|
35054
35043
|
return event;
|
|
35055
35044
|
}
|
|
@@ -35060,8 +35049,8 @@ var init_chokidar = __esm({
|
|
|
35060
35049
|
/**
|
|
35061
35050
|
* Determines whether user has asked to ignore this path.
|
|
35062
35051
|
*/
|
|
35063
|
-
_isIgnored(
|
|
35064
|
-
if (this.options.atomic && DOT_RE.test(
|
|
35052
|
+
_isIgnored(path28, stats) {
|
|
35053
|
+
if (this.options.atomic && DOT_RE.test(path28))
|
|
35065
35054
|
return true;
|
|
35066
35055
|
if (!this._userIgnored) {
|
|
35067
35056
|
const { cwd } = this.options;
|
|
@@ -35071,17 +35060,17 @@ var init_chokidar = __esm({
|
|
|
35071
35060
|
const list = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored];
|
|
35072
35061
|
this._userIgnored = anymatch(list, void 0);
|
|
35073
35062
|
}
|
|
35074
|
-
return this._userIgnored(
|
|
35063
|
+
return this._userIgnored(path28, stats);
|
|
35075
35064
|
}
|
|
35076
|
-
_isntIgnored(
|
|
35077
|
-
return !this._isIgnored(
|
|
35065
|
+
_isntIgnored(path28, stat4) {
|
|
35066
|
+
return !this._isIgnored(path28, stat4);
|
|
35078
35067
|
}
|
|
35079
35068
|
/**
|
|
35080
35069
|
* Provides a set of common helpers and properties relating to symlink handling.
|
|
35081
35070
|
* @param path file or directory pattern being watched
|
|
35082
35071
|
*/
|
|
35083
|
-
_getWatchHelpers(
|
|
35084
|
-
return new WatchHelper(
|
|
35072
|
+
_getWatchHelpers(path28) {
|
|
35073
|
+
return new WatchHelper(path28, this.options.followSymlinks, this);
|
|
35085
35074
|
}
|
|
35086
35075
|
// Directory helpers
|
|
35087
35076
|
// -----------------
|
|
@@ -35113,63 +35102,63 @@ var init_chokidar = __esm({
|
|
|
35113
35102
|
* @param item base path of item/directory
|
|
35114
35103
|
*/
|
|
35115
35104
|
_remove(directory, item, isDirectory) {
|
|
35116
|
-
const
|
|
35117
|
-
const fullPath = sp2.resolve(
|
|
35118
|
-
isDirectory = isDirectory != null ? isDirectory : this._watched.has(
|
|
35119
|
-
if (!this._throttle("remove",
|
|
35105
|
+
const path28 = sp2.join(directory, item);
|
|
35106
|
+
const fullPath = sp2.resolve(path28);
|
|
35107
|
+
isDirectory = isDirectory != null ? isDirectory : this._watched.has(path28) || this._watched.has(fullPath);
|
|
35108
|
+
if (!this._throttle("remove", path28, 100))
|
|
35120
35109
|
return;
|
|
35121
35110
|
if (!isDirectory && this._watched.size === 1) {
|
|
35122
35111
|
this.add(directory, item, true);
|
|
35123
35112
|
}
|
|
35124
|
-
const wp = this._getWatchedDir(
|
|
35113
|
+
const wp = this._getWatchedDir(path28);
|
|
35125
35114
|
const nestedDirectoryChildren = wp.getChildren();
|
|
35126
|
-
nestedDirectoryChildren.forEach((nested) => this._remove(
|
|
35115
|
+
nestedDirectoryChildren.forEach((nested) => this._remove(path28, nested));
|
|
35127
35116
|
const parent = this._getWatchedDir(directory);
|
|
35128
35117
|
const wasTracked = parent.has(item);
|
|
35129
35118
|
parent.remove(item);
|
|
35130
35119
|
if (this._symlinkPaths.has(fullPath)) {
|
|
35131
35120
|
this._symlinkPaths.delete(fullPath);
|
|
35132
35121
|
}
|
|
35133
|
-
let relPath =
|
|
35122
|
+
let relPath = path28;
|
|
35134
35123
|
if (this.options.cwd)
|
|
35135
|
-
relPath = sp2.relative(this.options.cwd,
|
|
35124
|
+
relPath = sp2.relative(this.options.cwd, path28);
|
|
35136
35125
|
if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
|
|
35137
35126
|
const event = this._pendingWrites.get(relPath).cancelWait();
|
|
35138
35127
|
if (event === EVENTS.ADD)
|
|
35139
35128
|
return;
|
|
35140
35129
|
}
|
|
35141
|
-
this._watched.delete(
|
|
35130
|
+
this._watched.delete(path28);
|
|
35142
35131
|
this._watched.delete(fullPath);
|
|
35143
35132
|
const eventName = isDirectory ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
|
|
35144
|
-
if (wasTracked && !this._isIgnored(
|
|
35145
|
-
this._emit(eventName,
|
|
35146
|
-
this._closePath(
|
|
35133
|
+
if (wasTracked && !this._isIgnored(path28))
|
|
35134
|
+
this._emit(eventName, path28);
|
|
35135
|
+
this._closePath(path28);
|
|
35147
35136
|
}
|
|
35148
35137
|
/**
|
|
35149
35138
|
* Closes all watchers for a path
|
|
35150
35139
|
*/
|
|
35151
|
-
_closePath(
|
|
35152
|
-
this._closeFile(
|
|
35153
|
-
const dir = sp2.dirname(
|
|
35154
|
-
this._getWatchedDir(dir).remove(sp2.basename(
|
|
35140
|
+
_closePath(path28) {
|
|
35141
|
+
this._closeFile(path28);
|
|
35142
|
+
const dir = sp2.dirname(path28);
|
|
35143
|
+
this._getWatchedDir(dir).remove(sp2.basename(path28));
|
|
35155
35144
|
}
|
|
35156
35145
|
/**
|
|
35157
35146
|
* Closes only file-specific watchers
|
|
35158
35147
|
*/
|
|
35159
|
-
_closeFile(
|
|
35160
|
-
const closers = this._closers.get(
|
|
35148
|
+
_closeFile(path28) {
|
|
35149
|
+
const closers = this._closers.get(path28);
|
|
35161
35150
|
if (!closers)
|
|
35162
35151
|
return;
|
|
35163
35152
|
closers.forEach((closer) => closer());
|
|
35164
|
-
this._closers.delete(
|
|
35153
|
+
this._closers.delete(path28);
|
|
35165
35154
|
}
|
|
35166
|
-
_addPathCloser(
|
|
35155
|
+
_addPathCloser(path28, closer) {
|
|
35167
35156
|
if (!closer)
|
|
35168
35157
|
return;
|
|
35169
|
-
let list = this._closers.get(
|
|
35158
|
+
let list = this._closers.get(path28);
|
|
35170
35159
|
if (!list) {
|
|
35171
35160
|
list = [];
|
|
35172
|
-
this._closers.set(
|
|
35161
|
+
this._closers.set(path28, list);
|
|
35173
35162
|
}
|
|
35174
35163
|
list.push(closer);
|
|
35175
35164
|
}
|
|
@@ -35238,6 +35227,7 @@ function validateProviderDefinition(raw) {
|
|
|
35238
35227
|
warnings.push("Extension providers should have extensionId");
|
|
35239
35228
|
}
|
|
35240
35229
|
validateCapabilities(provider, controls, errors);
|
|
35230
|
+
validateCanonicalHistory(provider.canonicalHistory, errors);
|
|
35241
35231
|
for (const control of controls) {
|
|
35242
35232
|
validateControl(control, errors);
|
|
35243
35233
|
}
|
|
@@ -35295,6 +35285,39 @@ function validateCapabilities(provider, controls, errors) {
|
|
|
35295
35285
|
errors.push("providers declaring controls must set capabilities.controls.typedResults=true");
|
|
35296
35286
|
}
|
|
35297
35287
|
}
|
|
35288
|
+
function validateCanonicalHistory(raw, errors) {
|
|
35289
|
+
if (raw === void 0) return;
|
|
35290
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
35291
|
+
errors.push("canonicalHistory must be an object");
|
|
35292
|
+
return;
|
|
35293
|
+
}
|
|
35294
|
+
const canonicalHistory = raw;
|
|
35295
|
+
const format = canonicalHistory.format;
|
|
35296
|
+
if (format !== void 0 && (typeof format !== "string" || !format.trim())) {
|
|
35297
|
+
errors.push("canonicalHistory.format must be a non-empty string when provided");
|
|
35298
|
+
}
|
|
35299
|
+
const watchPath = canonicalHistory.watchPath;
|
|
35300
|
+
if (watchPath !== void 0 && (typeof watchPath !== "string" || !watchPath.trim())) {
|
|
35301
|
+
errors.push("canonicalHistory.watchPath must be a non-empty string when provided");
|
|
35302
|
+
}
|
|
35303
|
+
const mode = canonicalHistory.mode;
|
|
35304
|
+
if (mode !== void 0 && !["native-source", "materialized-mirror", "disabled"].includes(String(mode))) {
|
|
35305
|
+
errors.push("canonicalHistory.mode must be one of: native-source, materialized-mirror, disabled");
|
|
35306
|
+
}
|
|
35307
|
+
const scripts = canonicalHistory.scripts;
|
|
35308
|
+
if (scripts === void 0) return;
|
|
35309
|
+
if (!scripts || typeof scripts !== "object" || Array.isArray(scripts)) {
|
|
35310
|
+
errors.push("canonicalHistory.scripts must be an object");
|
|
35311
|
+
return;
|
|
35312
|
+
}
|
|
35313
|
+
const scriptConfig = scripts;
|
|
35314
|
+
for (const key of ["readSession", "listSessions"]) {
|
|
35315
|
+
const value = scriptConfig[key];
|
|
35316
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
35317
|
+
errors.push(`canonicalHistory.scripts.${key} must be a non-empty string`);
|
|
35318
|
+
}
|
|
35319
|
+
}
|
|
35320
|
+
}
|
|
35298
35321
|
function validateControl(control, errors) {
|
|
35299
35322
|
if (!control || typeof control !== "object") {
|
|
35300
35323
|
errors.push("controls: each control must be an object");
|
|
@@ -36918,6 +36941,43 @@ var init_provider_loader = __esm({
|
|
|
36918
36941
|
}
|
|
36919
36942
|
});
|
|
36920
36943
|
|
|
36944
|
+
// ../../oss/packages/daemon-core/src/launch/macos-app-process.ts
|
|
36945
|
+
function normalizeMacAppPath(appPath) {
|
|
36946
|
+
const trimmed = String(appPath || "").trim();
|
|
36947
|
+
if (!trimmed) return null;
|
|
36948
|
+
return trimmed.replace(/\/+$/, "");
|
|
36949
|
+
}
|
|
36950
|
+
function parsePsLine(line) {
|
|
36951
|
+
const match = line.match(/^\s*(\d+)\s+(.+)$/);
|
|
36952
|
+
if (!match) return null;
|
|
36953
|
+
const pid = Number.parseInt(match[1], 10);
|
|
36954
|
+
if (!Number.isFinite(pid)) return null;
|
|
36955
|
+
return { pid, args: match[2] };
|
|
36956
|
+
}
|
|
36957
|
+
function isMacAppProcessArgs(args, appPath) {
|
|
36958
|
+
const normalized = normalizeMacAppPath(appPath);
|
|
36959
|
+
if (!normalized) return false;
|
|
36960
|
+
return String(args || "").startsWith(`${normalized}/`);
|
|
36961
|
+
}
|
|
36962
|
+
function findMacAppProcessPids(psOutput, appPaths) {
|
|
36963
|
+
const normalizedPaths = appPaths.map(normalizeMacAppPath).filter((value) => !!value);
|
|
36964
|
+
if (normalizedPaths.length === 0) return [];
|
|
36965
|
+
const pids = [];
|
|
36966
|
+
for (const line of String(psOutput || "").split(/\r?\n/)) {
|
|
36967
|
+
const parsed = parsePsLine(line);
|
|
36968
|
+
if (!parsed) continue;
|
|
36969
|
+
if (normalizedPaths.some((appPath) => isMacAppProcessArgs(parsed.args, appPath))) {
|
|
36970
|
+
pids.push(parsed.pid);
|
|
36971
|
+
}
|
|
36972
|
+
}
|
|
36973
|
+
return pids;
|
|
36974
|
+
}
|
|
36975
|
+
var init_macos_app_process = __esm({
|
|
36976
|
+
"../../oss/packages/daemon-core/src/launch/macos-app-process.ts"() {
|
|
36977
|
+
"use strict";
|
|
36978
|
+
}
|
|
36979
|
+
});
|
|
36980
|
+
|
|
36921
36981
|
// ../../oss/packages/daemon-core/src/launch.ts
|
|
36922
36982
|
function getProviderLoader() {
|
|
36923
36983
|
if (!_providerLoader) {
|
|
@@ -36940,9 +37000,9 @@ function getWinProcessNames() {
|
|
|
36940
37000
|
function getProviderMeta(ideId) {
|
|
36941
37001
|
return getProviderLoader().getMeta(ideId);
|
|
36942
37002
|
}
|
|
36943
|
-
function getPreferredLaunchMethod(ideId,
|
|
37003
|
+
function getPreferredLaunchMethod(ideId, platform12) {
|
|
36944
37004
|
const prefer = getProviderMeta(ideId)?.launch?.prefer;
|
|
36945
|
-
const value = prefer?.[
|
|
37005
|
+
const value = prefer?.[platform12];
|
|
36946
37006
|
return value === "cli" || value === "app" || value === "auto" ? value : "auto";
|
|
36947
37007
|
}
|
|
36948
37008
|
function getCdpStartupTimeoutMs(ideId) {
|
|
@@ -36953,6 +37013,35 @@ function getCdpStartupTimeoutMs(ideId) {
|
|
|
36953
37013
|
function escapeForAppleScript(value) {
|
|
36954
37014
|
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
36955
37015
|
}
|
|
37016
|
+
function getIdePathCandidates(ideId) {
|
|
37017
|
+
return getProviderLoader().getIdePathCandidates(ideId);
|
|
37018
|
+
}
|
|
37019
|
+
function getMacAppProcessPids(ideId) {
|
|
37020
|
+
const appPaths = getIdePathCandidates(ideId);
|
|
37021
|
+
if (appPaths.length === 0) return [];
|
|
37022
|
+
try {
|
|
37023
|
+
const output = (0, import_child_process7.execSync)("ps axww -o pid=,args=", {
|
|
37024
|
+
encoding: "utf-8",
|
|
37025
|
+
timeout: 3e3,
|
|
37026
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
37027
|
+
});
|
|
37028
|
+
return findMacAppProcessPids(output, appPaths);
|
|
37029
|
+
} catch {
|
|
37030
|
+
return [];
|
|
37031
|
+
}
|
|
37032
|
+
}
|
|
37033
|
+
function killMacAppPathProcesses(ideId, signal) {
|
|
37034
|
+
const pids = getMacAppProcessPids(ideId);
|
|
37035
|
+
let signalled = false;
|
|
37036
|
+
for (const pid of pids) {
|
|
37037
|
+
try {
|
|
37038
|
+
process.kill(pid, signal);
|
|
37039
|
+
signalled = true;
|
|
37040
|
+
} catch {
|
|
37041
|
+
}
|
|
37042
|
+
}
|
|
37043
|
+
return signalled;
|
|
37044
|
+
}
|
|
36956
37045
|
async function findFreePort(ports) {
|
|
36957
37046
|
for (const port2 of ports) {
|
|
36958
37047
|
const free = await checkPortFree(port2);
|
|
@@ -37014,6 +37103,7 @@ async function killIdeProcess(ideId) {
|
|
|
37014
37103
|
} catch {
|
|
37015
37104
|
}
|
|
37016
37105
|
}
|
|
37106
|
+
killMacAppPathProcesses(ideId, "SIGTERM");
|
|
37017
37107
|
} else if (plat === "win32" && winProcesses) {
|
|
37018
37108
|
for (const proc of winProcesses) {
|
|
37019
37109
|
try {
|
|
@@ -37043,6 +37133,7 @@ async function killIdeProcess(ideId) {
|
|
|
37043
37133
|
(0, import_child_process7.execSync)(`pkill -9 -x "${appName}" 2>/dev/null`, { timeout: 5e3 });
|
|
37044
37134
|
} catch {
|
|
37045
37135
|
}
|
|
37136
|
+
killMacAppPathProcesses(ideId, "SIGKILL");
|
|
37046
37137
|
} else if (plat === "win32" && winProcesses) {
|
|
37047
37138
|
for (const proc of winProcesses) {
|
|
37048
37139
|
try {
|
|
@@ -37062,14 +37153,16 @@ function isIdeRunning(ideId) {
|
|
|
37062
37153
|
try {
|
|
37063
37154
|
if (plat === "darwin") {
|
|
37064
37155
|
const appName = getMacAppIdentifiers()[ideId];
|
|
37065
|
-
if (!appName) return
|
|
37156
|
+
if (!appName) return getMacAppProcessPids(ideId).length > 0;
|
|
37066
37157
|
try {
|
|
37067
37158
|
const result = (0, import_child_process7.execSync)(`pgrep -x "${appName}" 2>/dev/null`, {
|
|
37068
37159
|
encoding: "utf-8",
|
|
37069
37160
|
timeout: 3e3
|
|
37070
37161
|
});
|
|
37071
|
-
|
|
37162
|
+
if (result.trim().length > 0) return true;
|
|
37072
37163
|
} catch {
|
|
37164
|
+
}
|
|
37165
|
+
try {
|
|
37073
37166
|
const result = (0, import_child_process7.execSync)(
|
|
37074
37167
|
`osascript -e 'tell application "System Events" to count (every process whose name is "${escapeForAppleScript(appName)}")'`,
|
|
37075
37168
|
{
|
|
@@ -37078,8 +37171,10 @@ function isIdeRunning(ideId) {
|
|
|
37078
37171
|
stdio: ["pipe", "pipe", "pipe"]
|
|
37079
37172
|
}
|
|
37080
37173
|
);
|
|
37081
|
-
|
|
37174
|
+
if (Number.parseInt(result.trim() || "0", 10) > 0) return true;
|
|
37175
|
+
} catch {
|
|
37082
37176
|
}
|
|
37177
|
+
return getMacAppProcessPids(ideId).length > 0;
|
|
37083
37178
|
} else if (plat === "win32") {
|
|
37084
37179
|
const winProcesses = getWinProcessNames()[ideId];
|
|
37085
37180
|
if (!winProcesses) return false;
|
|
@@ -37124,7 +37219,7 @@ function detectCurrentWorkspace(ideId) {
|
|
|
37124
37219
|
}
|
|
37125
37220
|
} else if (plat === "win32") {
|
|
37126
37221
|
try {
|
|
37127
|
-
const
|
|
37222
|
+
const fs19 = require("fs");
|
|
37128
37223
|
const appNameMap = getMacAppIdentifiers();
|
|
37129
37224
|
const appName = appNameMap[ideId];
|
|
37130
37225
|
if (appName) {
|
|
@@ -37133,8 +37228,8 @@ function detectCurrentWorkspace(ideId) {
|
|
|
37133
37228
|
appName,
|
|
37134
37229
|
"storage.json"
|
|
37135
37230
|
);
|
|
37136
|
-
if (
|
|
37137
|
-
const data = JSON.parse(
|
|
37231
|
+
if (fs19.existsSync(storagePath)) {
|
|
37232
|
+
const data = JSON.parse(fs19.readFileSync(storagePath, "utf-8"));
|
|
37138
37233
|
const workspaces = data?.openedPathsList?.workspaces3 || data?.openedPathsList?.entries || [];
|
|
37139
37234
|
if (workspaces.length > 0) {
|
|
37140
37235
|
const recent = workspaces[0];
|
|
@@ -37151,7 +37246,7 @@ function detectCurrentWorkspace(ideId) {
|
|
|
37151
37246
|
return void 0;
|
|
37152
37247
|
}
|
|
37153
37248
|
async function launchWithCdp(options = {}) {
|
|
37154
|
-
const
|
|
37249
|
+
const platform12 = os16.platform();
|
|
37155
37250
|
let targetIde;
|
|
37156
37251
|
const ides = await detectIDEs(getProviderLoader());
|
|
37157
37252
|
if (options.ideId) {
|
|
@@ -37220,9 +37315,9 @@ async function launchWithCdp(options = {}) {
|
|
|
37220
37315
|
}
|
|
37221
37316
|
const port = await findFreePort(portPair);
|
|
37222
37317
|
try {
|
|
37223
|
-
if (
|
|
37318
|
+
if (platform12 === "darwin") {
|
|
37224
37319
|
await launchMacOS(targetIde, port, workspace, options.newWindow);
|
|
37225
|
-
} else if (
|
|
37320
|
+
} else if (platform12 === "win32") {
|
|
37226
37321
|
await launchWindows(targetIde, port, workspace, options.newWindow);
|
|
37227
37322
|
} else {
|
|
37228
37323
|
await launchLinux(targetIde, port, workspace, options.newWindow);
|
|
@@ -37310,6 +37405,7 @@ var init_launch = __esm({
|
|
|
37310
37405
|
path14 = __toESM(require("path"));
|
|
37311
37406
|
init_ide_detector();
|
|
37312
37407
|
init_provider_loader();
|
|
37408
|
+
init_macos_app_process();
|
|
37313
37409
|
_providerLoader = null;
|
|
37314
37410
|
}
|
|
37315
37411
|
});
|
|
@@ -38502,13 +38598,19 @@ var init_router = __esm({
|
|
|
38502
38598
|
const wantsAll = args?.all === true;
|
|
38503
38599
|
const offset = wantsAll ? 0 : Math.max(0, Number(args?.offset) || 0);
|
|
38504
38600
|
const limit = wantsAll ? Number.MAX_SAFE_INTEGER : Math.max(1, Math.min(100, Number(args?.limit) || 30));
|
|
38505
|
-
const
|
|
38601
|
+
const providerMeta = this.deps.providerLoader.getMeta(providerType);
|
|
38602
|
+
const { sessions: historySessions, hasMore, source } = listProviderHistorySessions(providerType, {
|
|
38603
|
+
canonicalHistory: providerMeta?.canonicalHistory,
|
|
38604
|
+
offset,
|
|
38605
|
+
limit,
|
|
38606
|
+
historyBehavior: providerMeta?.historyBehavior,
|
|
38607
|
+
scripts: providerMeta?.scripts
|
|
38608
|
+
});
|
|
38506
38609
|
const state = loadState();
|
|
38507
38610
|
const savedSessions = getSavedProviderSessions(state, { providerType, kind });
|
|
38508
38611
|
const recentSessions = getRecentActivity(state, 200).filter((entry) => entry.providerType === providerType && entry.kind === kind && entry.providerSessionId);
|
|
38509
38612
|
const savedSessionById = new Map(savedSessions.map((entry) => [entry.providerSessionId, entry]));
|
|
38510
38613
|
const recentSessionById = new Map(recentSessions.map((entry) => [entry.providerSessionId, entry]));
|
|
38511
|
-
const providerMeta = this.deps.providerLoader.getMeta(providerType);
|
|
38512
38614
|
const canResumeById = supportsExplicitSessionResume(providerMeta?.resume);
|
|
38513
38615
|
return {
|
|
38514
38616
|
success: true,
|
|
@@ -38528,10 +38630,14 @@ var init_router = __esm({
|
|
|
38528
38630
|
messageCount: session.messageCount,
|
|
38529
38631
|
firstMessageAt: session.firstMessageAt,
|
|
38530
38632
|
lastMessageAt: session.lastMessageAt,
|
|
38531
|
-
canResume: !!(saved?.workspace || recent?.workspace || session.workspace) && canResumeById
|
|
38633
|
+
canResume: !!(saved?.workspace || recent?.workspace || session.workspace) && canResumeById,
|
|
38634
|
+
historySource: session.source,
|
|
38635
|
+
sourcePath: session.sourcePath,
|
|
38636
|
+
sourceMtimeMs: session.sourceMtimeMs
|
|
38532
38637
|
};
|
|
38533
38638
|
}),
|
|
38534
|
-
hasMore
|
|
38639
|
+
hasMore,
|
|
38640
|
+
source
|
|
38535
38641
|
};
|
|
38536
38642
|
}
|
|
38537
38643
|
// ─── restart_session: IDE / CLI / ACP unified ───
|
|
@@ -44567,8 +44673,8 @@ var init_dev_server = __esm({
|
|
|
44567
44673
|
}
|
|
44568
44674
|
getEndpointList() {
|
|
44569
44675
|
return this.routes.map((r) => {
|
|
44570
|
-
const
|
|
44571
|
-
return `${r.method.padEnd(5)} ${
|
|
44676
|
+
const path28 = typeof r.pattern === "string" ? r.pattern : r.pattern.source.replace(/\\\//g, "/").replace(/\(\[.*?\]\+\)/g, ":type").replace(/[\^$]/g, "");
|
|
44677
|
+
return `${r.method.padEnd(5)} ${path28}`;
|
|
44572
44678
|
});
|
|
44573
44679
|
}
|
|
44574
44680
|
async start(port = DEV_SERVER_PORT) {
|
|
@@ -46510,8 +46616,8 @@ async function installExtension(ide, extension) {
|
|
|
46510
46616
|
const res = await fetch(extension.vsixUrl);
|
|
46511
46617
|
if (res.ok) {
|
|
46512
46618
|
const buffer = Buffer.from(await res.arrayBuffer());
|
|
46513
|
-
const
|
|
46514
|
-
|
|
46619
|
+
const fs19 = await import("fs");
|
|
46620
|
+
fs19.writeFileSync(vsixPath, buffer);
|
|
46515
46621
|
return new Promise((resolve16) => {
|
|
46516
46622
|
const cmd = `"${ide.cliCommand}" --install-extension "${vsixPath}" --force`;
|
|
46517
46623
|
(0, import_child_process11.exec)(cmd, { timeout: 6e4 }, (error48, _stdout, stderr) => {
|
|
@@ -47216,6 +47322,7 @@ var init_server_connection = __esm({
|
|
|
47216
47322
|
iceServers = null;
|
|
47217
47323
|
planLimits = null;
|
|
47218
47324
|
compatBlocked = false;
|
|
47325
|
+
fatalAuthRejectedReason = null;
|
|
47219
47326
|
get authTimeoutMs() {
|
|
47220
47327
|
return Math.max(1, this.options.authTimeoutMs ?? 15e3);
|
|
47221
47328
|
}
|
|
@@ -47332,6 +47439,7 @@ var init_server_connection = __esm({
|
|
|
47332
47439
|
this.clearAuthTimeout();
|
|
47333
47440
|
this.reconnectAttempts = 0;
|
|
47334
47441
|
this.compatBlocked = false;
|
|
47442
|
+
this.fatalAuthRejectedReason = null;
|
|
47335
47443
|
const payload = message.payload;
|
|
47336
47444
|
this.userPlan = payload.plan || "free";
|
|
47337
47445
|
this.iceServers = payload.iceServers || null;
|
|
@@ -47345,8 +47453,20 @@ var init_server_connection = __esm({
|
|
|
47345
47453
|
this.startHeartbeat();
|
|
47346
47454
|
} else if (message.type === "auth_error") {
|
|
47347
47455
|
this.clearAuthTimeout();
|
|
47348
|
-
|
|
47456
|
+
const payload = message.payload;
|
|
47457
|
+
const reason = String(payload.reason || "Authentication failed");
|
|
47458
|
+
this.fatalAuthRejectedReason = reason;
|
|
47459
|
+
LOG.error("Server", `Auth failed: ${reason}`);
|
|
47460
|
+
if (reason === "machine_limit_exceeded") {
|
|
47461
|
+
LOG.error("Server", `[ServerConn] ${payload.message || "Machine limit exceeded. Remove an unused machine in the dashboard or upgrade your plan."}`);
|
|
47462
|
+
} else {
|
|
47463
|
+
LOG.error("Server", `[ServerConn] Saved machine credentials were rejected. Run 'adhdev setup --force' to re-authenticate, then restart the daemon.`);
|
|
47464
|
+
}
|
|
47349
47465
|
this.setState("error");
|
|
47466
|
+
try {
|
|
47467
|
+
this.ws?.close(1e3, "Authentication rejected");
|
|
47468
|
+
} catch {
|
|
47469
|
+
}
|
|
47350
47470
|
return;
|
|
47351
47471
|
} else if (message.type === "version_mismatch") {
|
|
47352
47472
|
const p = message.payload;
|
|
@@ -47379,6 +47499,18 @@ var init_server_connection = __esm({
|
|
|
47379
47499
|
LOG.info("Server", `[ServerConn] WebSocket closed: ${code} ${reason}`);
|
|
47380
47500
|
this.clearTimers();
|
|
47381
47501
|
this.ws = null;
|
|
47502
|
+
if (code === 4001 || this.fatalAuthRejectedReason) {
|
|
47503
|
+
const authReason = this.fatalAuthRejectedReason;
|
|
47504
|
+
const reasonText = authReason ? `: ${authReason}` : "";
|
|
47505
|
+
LOG.error("Server", `[ServerConn] Authentication rejected${reasonText}. Not reconnecting with the same credentials.`);
|
|
47506
|
+
if (authReason === "machine_limit_exceeded") {
|
|
47507
|
+
LOG.error("Server", `[ServerConn] Remove an unused machine in the dashboard or upgrade your plan, then restart the daemon.`);
|
|
47508
|
+
} else {
|
|
47509
|
+
LOG.error("Server", `[ServerConn] Run 'adhdev setup --force', then 'adhdev daemon:restart'.`);
|
|
47510
|
+
}
|
|
47511
|
+
this.setState("disconnected");
|
|
47512
|
+
return;
|
|
47513
|
+
}
|
|
47382
47514
|
if (code === 4011) {
|
|
47383
47515
|
LOG.info("Server", `[ServerConn] \u26A0 Evicted by another machine. Not reconnecting.`);
|
|
47384
47516
|
LOG.info("Server", `[ServerConn] This connection was released because another machine connected.`);
|
|
@@ -48467,9 +48599,9 @@ var init_daemon_p2p = __esm({
|
|
|
48467
48599
|
log(`node-datachannel not found: ${e?.message}
|
|
48468
48600
|
${e?.stack || ""}`);
|
|
48469
48601
|
}
|
|
48470
|
-
const
|
|
48471
|
-
const
|
|
48472
|
-
const prebuildKey = `${
|
|
48602
|
+
const platform12 = process.platform;
|
|
48603
|
+
const arch3 = process.arch;
|
|
48604
|
+
const prebuildKey = `${platform12}-${arch3}`;
|
|
48473
48605
|
try {
|
|
48474
48606
|
const candidates = [
|
|
48475
48607
|
path23.join(__dirname, "node_modules", "node-datachannel"),
|
|
@@ -48849,27 +48981,27 @@ var require_process = __commonJS({
|
|
|
48849
48981
|
var require_filesystem = __commonJS({
|
|
48850
48982
|
"../../node_modules/detect-libc/lib/filesystem.js"(exports2, module2) {
|
|
48851
48983
|
"use strict";
|
|
48852
|
-
var
|
|
48984
|
+
var fs19 = require("fs");
|
|
48853
48985
|
var LDD_PATH = "/usr/bin/ldd";
|
|
48854
48986
|
var SELF_PATH = "/proc/self/exe";
|
|
48855
48987
|
var MAX_LENGTH = 2048;
|
|
48856
|
-
var readFileSync19 = (
|
|
48857
|
-
const fd =
|
|
48988
|
+
var readFileSync19 = (path28) => {
|
|
48989
|
+
const fd = fs19.openSync(path28, "r");
|
|
48858
48990
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
48859
|
-
const bytesRead =
|
|
48860
|
-
|
|
48991
|
+
const bytesRead = fs19.readSync(fd, buffer, 0, MAX_LENGTH, 0);
|
|
48992
|
+
fs19.close(fd, () => {
|
|
48861
48993
|
});
|
|
48862
48994
|
return buffer.subarray(0, bytesRead);
|
|
48863
48995
|
};
|
|
48864
|
-
var readFile = (
|
|
48865
|
-
|
|
48996
|
+
var readFile = (path28) => new Promise((resolve16, reject) => {
|
|
48997
|
+
fs19.open(path28, "r", (err, fd) => {
|
|
48866
48998
|
if (err) {
|
|
48867
48999
|
reject(err);
|
|
48868
49000
|
} else {
|
|
48869
49001
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
48870
|
-
|
|
49002
|
+
fs19.read(fd, buffer, 0, MAX_LENGTH, 0, (_2, bytesRead) => {
|
|
48871
49003
|
resolve16(buffer.subarray(0, bytesRead));
|
|
48872
|
-
|
|
49004
|
+
fs19.close(fd, () => {
|
|
48873
49005
|
});
|
|
48874
49006
|
});
|
|
48875
49007
|
}
|
|
@@ -48925,7 +49057,7 @@ var require_elf = __commonJS({
|
|
|
48925
49057
|
var require_detect_libc = __commonJS({
|
|
48926
49058
|
"../../node_modules/detect-libc/lib/detect-libc.js"(exports2, module2) {
|
|
48927
49059
|
"use strict";
|
|
48928
|
-
var
|
|
49060
|
+
var childProcess = require("child_process");
|
|
48929
49061
|
var { isLinux: isLinux2, getReport } = require_process();
|
|
48930
49062
|
var { LDD_PATH, SELF_PATH, readFile, readFileSync: readFileSync19 } = require_filesystem();
|
|
48931
49063
|
var { interpreterPath } = require_elf();
|
|
@@ -48937,7 +49069,7 @@ var require_detect_libc = __commonJS({
|
|
|
48937
49069
|
var safeCommand = () => {
|
|
48938
49070
|
if (!commandOut) {
|
|
48939
49071
|
return new Promise((resolve16) => {
|
|
48940
|
-
|
|
49072
|
+
childProcess.exec(command, (err, out) => {
|
|
48941
49073
|
commandOut = err ? " " : out;
|
|
48942
49074
|
resolve16(commandOut);
|
|
48943
49075
|
});
|
|
@@ -48948,7 +49080,7 @@ var require_detect_libc = __commonJS({
|
|
|
48948
49080
|
var safeCommandSync = () => {
|
|
48949
49081
|
if (!commandOut) {
|
|
48950
49082
|
try {
|
|
48951
|
-
commandOut =
|
|
49083
|
+
commandOut = childProcess.execSync(command, { encoding: "utf8" });
|
|
48952
49084
|
} catch (_err) {
|
|
48953
49085
|
commandOut = " ";
|
|
48954
49086
|
}
|
|
@@ -48981,11 +49113,11 @@ var require_detect_libc = __commonJS({
|
|
|
48981
49113
|
}
|
|
48982
49114
|
return null;
|
|
48983
49115
|
};
|
|
48984
|
-
var familyFromInterpreterPath = (
|
|
48985
|
-
if (
|
|
48986
|
-
if (
|
|
49116
|
+
var familyFromInterpreterPath = (path28) => {
|
|
49117
|
+
if (path28) {
|
|
49118
|
+
if (path28.includes("/ld-musl-")) {
|
|
48987
49119
|
return MUSL;
|
|
48988
|
-
} else if (
|
|
49120
|
+
} else if (path28.includes("/ld-linux-")) {
|
|
48989
49121
|
return GLIBC;
|
|
48990
49122
|
}
|
|
48991
49123
|
}
|
|
@@ -49032,8 +49164,8 @@ var require_detect_libc = __commonJS({
|
|
|
49032
49164
|
cachedFamilyInterpreter = null;
|
|
49033
49165
|
try {
|
|
49034
49166
|
const selfContent = await readFile(SELF_PATH);
|
|
49035
|
-
const
|
|
49036
|
-
cachedFamilyInterpreter = familyFromInterpreterPath(
|
|
49167
|
+
const path28 = interpreterPath(selfContent);
|
|
49168
|
+
cachedFamilyInterpreter = familyFromInterpreterPath(path28);
|
|
49037
49169
|
} catch (e) {
|
|
49038
49170
|
}
|
|
49039
49171
|
return cachedFamilyInterpreter;
|
|
@@ -49045,8 +49177,8 @@ var require_detect_libc = __commonJS({
|
|
|
49045
49177
|
cachedFamilyInterpreter = null;
|
|
49046
49178
|
try {
|
|
49047
49179
|
const selfContent = readFileSync19(SELF_PATH);
|
|
49048
|
-
const
|
|
49049
|
-
cachedFamilyInterpreter = familyFromInterpreterPath(
|
|
49180
|
+
const path28 = interpreterPath(selfContent);
|
|
49181
|
+
cachedFamilyInterpreter = familyFromInterpreterPath(path28);
|
|
49050
49182
|
} catch (e) {
|
|
49051
49183
|
}
|
|
49052
49184
|
return cachedFamilyInterpreter;
|
|
@@ -50765,18 +50897,18 @@ var require_sharp = __commonJS({
|
|
|
50765
50897
|
`@img/sharp-${runtimePlatform}/sharp.node`,
|
|
50766
50898
|
"@img/sharp-wasm32/sharp.node"
|
|
50767
50899
|
];
|
|
50768
|
-
var
|
|
50900
|
+
var path28;
|
|
50769
50901
|
var sharp;
|
|
50770
50902
|
var errors = [];
|
|
50771
|
-
for (
|
|
50903
|
+
for (path28 of paths) {
|
|
50772
50904
|
try {
|
|
50773
|
-
sharp = require(
|
|
50905
|
+
sharp = require(path28);
|
|
50774
50906
|
break;
|
|
50775
50907
|
} catch (err) {
|
|
50776
50908
|
errors.push(err);
|
|
50777
50909
|
}
|
|
50778
50910
|
}
|
|
50779
|
-
if (sharp &&
|
|
50911
|
+
if (sharp && path28.startsWith("@img/sharp-linux-x64") && !sharp._isUsingX64V2()) {
|
|
50780
50912
|
const err = new Error("Prebuilt binaries for linux-x64 require v2 microarchitecture");
|
|
50781
50913
|
err.code = "Unsupported CPU";
|
|
50782
50914
|
errors.push(err);
|
|
@@ -50785,7 +50917,7 @@ var require_sharp = __commonJS({
|
|
|
50785
50917
|
if (sharp) {
|
|
50786
50918
|
module2.exports = sharp;
|
|
50787
50919
|
} else {
|
|
50788
|
-
const [isLinux2, isMacOs, isWindows2] = ["linux", "darwin", "win32"].map((
|
|
50920
|
+
const [isLinux2, isMacOs, isWindows2] = ["linux", "darwin", "win32"].map((os28) => runtimePlatform.startsWith(os28));
|
|
50789
50921
|
const help = [`Could not load the "sharp" module using the ${runtimePlatform} runtime`];
|
|
50790
50922
|
errors.forEach((err) => {
|
|
50791
50923
|
if (err.code !== "MODULE_NOT_FOUND") {
|
|
@@ -50802,15 +50934,15 @@ var require_sharp = __commonJS({
|
|
|
50802
50934
|
` Requires ${expected}`
|
|
50803
50935
|
);
|
|
50804
50936
|
} else if (prebuiltPlatforms.includes(runtimePlatform)) {
|
|
50805
|
-
const [
|
|
50806
|
-
const libc =
|
|
50937
|
+
const [os28, cpu] = runtimePlatform.split("-");
|
|
50938
|
+
const libc = os28.endsWith("musl") ? " --libc=musl" : "";
|
|
50807
50939
|
help.push(
|
|
50808
50940
|
"- Ensure optional dependencies can be installed:",
|
|
50809
50941
|
" npm install --include=optional sharp",
|
|
50810
50942
|
"- Ensure your package manager supports multi-platform installation:",
|
|
50811
50943
|
" See https://sharp.pixelplumbing.com/install#cross-platform",
|
|
50812
50944
|
"- Add platform-specific dependencies:",
|
|
50813
|
-
` npm install --os=${
|
|
50945
|
+
` npm install --os=${os28.replace("musl", "")}${libc} --cpu=${cpu} sharp`
|
|
50814
50946
|
);
|
|
50815
50947
|
} else {
|
|
50816
50948
|
help.push(
|
|
@@ -53685,15 +53817,15 @@ var require_color = __commonJS({
|
|
|
53685
53817
|
};
|
|
53686
53818
|
}
|
|
53687
53819
|
function wrapConversion(toModel, graph) {
|
|
53688
|
-
const
|
|
53820
|
+
const path28 = [graph[toModel].parent, toModel];
|
|
53689
53821
|
let fn = conversions_default[graph[toModel].parent][toModel];
|
|
53690
53822
|
let cur = graph[toModel].parent;
|
|
53691
53823
|
while (graph[cur].parent) {
|
|
53692
|
-
|
|
53824
|
+
path28.unshift(graph[cur].parent);
|
|
53693
53825
|
fn = link(conversions_default[graph[cur].parent][cur], fn);
|
|
53694
53826
|
cur = graph[cur].parent;
|
|
53695
53827
|
}
|
|
53696
|
-
fn.conversion =
|
|
53828
|
+
fn.conversion = path28;
|
|
53697
53829
|
return fn;
|
|
53698
53830
|
}
|
|
53699
53831
|
function route(fromModel) {
|
|
@@ -54310,7 +54442,7 @@ var require_channel = __commonJS({
|
|
|
54310
54442
|
var require_output = __commonJS({
|
|
54311
54443
|
"../../node_modules/sharp/lib/output.js"(exports2, module2) {
|
|
54312
54444
|
"use strict";
|
|
54313
|
-
var
|
|
54445
|
+
var path28 = require("path");
|
|
54314
54446
|
var is = require_is();
|
|
54315
54447
|
var sharp = require_sharp();
|
|
54316
54448
|
var formats = /* @__PURE__ */ new Map([
|
|
@@ -54341,9 +54473,9 @@ var require_output = __commonJS({
|
|
|
54341
54473
|
let err;
|
|
54342
54474
|
if (!is.string(fileOut)) {
|
|
54343
54475
|
err = new Error("Missing output file path");
|
|
54344
|
-
} else if (is.string(this.options.input.file) &&
|
|
54476
|
+
} else if (is.string(this.options.input.file) && path28.resolve(this.options.input.file) === path28.resolve(fileOut)) {
|
|
54345
54477
|
err = new Error("Cannot use same file for input and output");
|
|
54346
|
-
} else if (jp2Regex.test(
|
|
54478
|
+
} else if (jp2Regex.test(path28.extname(fileOut)) && !this.constructor.format.jp2k.output.file) {
|
|
54347
54479
|
err = errJp2Save();
|
|
54348
54480
|
}
|
|
54349
54481
|
if (err) {
|
|
@@ -56460,18 +56592,18 @@ var init_source2 = __esm({
|
|
|
56460
56592
|
}
|
|
56461
56593
|
}
|
|
56462
56594
|
});
|
|
56463
|
-
createStyler2 = (
|
|
56595
|
+
createStyler2 = (open2, close, parent) => {
|
|
56464
56596
|
let openAll;
|
|
56465
56597
|
let closeAll;
|
|
56466
56598
|
if (parent === void 0) {
|
|
56467
|
-
openAll =
|
|
56599
|
+
openAll = open2;
|
|
56468
56600
|
closeAll = close;
|
|
56469
56601
|
} else {
|
|
56470
|
-
openAll = parent.openAll +
|
|
56602
|
+
openAll = parent.openAll + open2;
|
|
56471
56603
|
closeAll = close + parent.closeAll;
|
|
56472
56604
|
}
|
|
56473
56605
|
return {
|
|
56474
|
-
open:
|
|
56606
|
+
open: open2,
|
|
56475
56607
|
close,
|
|
56476
56608
|
openAll,
|
|
56477
56609
|
closeAll,
|
|
@@ -56630,7 +56762,7 @@ function removeDaemonPid(ref = {}) {
|
|
|
56630
56762
|
function isDaemonRunning(ref = {}) {
|
|
56631
56763
|
const port = resolveDaemonPort(ref);
|
|
56632
56764
|
try {
|
|
56633
|
-
const { execFileSync:
|
|
56765
|
+
const { execFileSync: execFileSync5 } = require("child_process");
|
|
56634
56766
|
const probe = `
|
|
56635
56767
|
const http = require('http');
|
|
56636
56768
|
const req = http.get('http://127.0.0.1:${port}/health', { timeout: 1500 }, (res) => {
|
|
@@ -56640,7 +56772,7 @@ function isDaemonRunning(ref = {}) {
|
|
|
56640
56772
|
req.on('error', () => process.stdout.write('0'));
|
|
56641
56773
|
req.on('timeout', () => { req.destroy(); process.stdout.write('0'); });
|
|
56642
56774
|
`;
|
|
56643
|
-
const result =
|
|
56775
|
+
const result = execFileSync5(process.execPath, ["-e", probe], {
|
|
56644
56776
|
encoding: "utf-8",
|
|
56645
56777
|
timeout: 3e3,
|
|
56646
56778
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -56666,9 +56798,9 @@ function isDaemonRunning(ref = {}) {
|
|
|
56666
56798
|
function isAdhdevProcess(pid) {
|
|
56667
56799
|
try {
|
|
56668
56800
|
if (process.platform === "win32") {
|
|
56669
|
-
const { execFileSync:
|
|
56801
|
+
const { execFileSync: execFileSync5 } = require("child_process");
|
|
56670
56802
|
try {
|
|
56671
|
-
const psOut =
|
|
56803
|
+
const psOut = execFileSync5("powershell.exe", [
|
|
56672
56804
|
"-NoProfile",
|
|
56673
56805
|
"-NonInteractive",
|
|
56674
56806
|
"-ExecutionPolicy",
|
|
@@ -56681,8 +56813,8 @@ function isAdhdevProcess(pid) {
|
|
|
56681
56813
|
return true;
|
|
56682
56814
|
}
|
|
56683
56815
|
} else {
|
|
56684
|
-
const { execFileSync:
|
|
56685
|
-
const cmdline =
|
|
56816
|
+
const { execFileSync: execFileSync5 } = require("child_process");
|
|
56817
|
+
const cmdline = execFileSync5("ps", ["-o", "command=", "-p", String(pid)], {
|
|
56686
56818
|
encoding: "utf-8",
|
|
56687
56819
|
timeout: 2e3,
|
|
56688
56820
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -56696,7 +56828,7 @@ function isAdhdevProcess(pid) {
|
|
|
56696
56828
|
function getDaemonHealthPid(ref = {}) {
|
|
56697
56829
|
const port = resolveDaemonPort(ref);
|
|
56698
56830
|
try {
|
|
56699
|
-
const { execFileSync:
|
|
56831
|
+
const { execFileSync: execFileSync5 } = require("child_process");
|
|
56700
56832
|
const probe = `
|
|
56701
56833
|
const http = require('http');
|
|
56702
56834
|
const req = http.get('http://127.0.0.1:${port}/health', { timeout: 1500 }, (res) => {
|
|
@@ -56714,7 +56846,7 @@ function getDaemonHealthPid(ref = {}) {
|
|
|
56714
56846
|
req.on('error', () => {});
|
|
56715
56847
|
req.on('timeout', () => { req.destroy(); });
|
|
56716
56848
|
`;
|
|
56717
|
-
const result =
|
|
56849
|
+
const result = execFileSync5(process.execPath, ["-e", probe], {
|
|
56718
56850
|
encoding: "utf-8",
|
|
56719
56851
|
timeout: 3e3,
|
|
56720
56852
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -56782,7 +56914,7 @@ var init_adhdev_daemon = __esm({
|
|
|
56782
56914
|
init_version();
|
|
56783
56915
|
init_src();
|
|
56784
56916
|
init_runtime_defaults();
|
|
56785
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.
|
|
56917
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.46" });
|
|
56786
56918
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
56787
56919
|
localHttpServer = null;
|
|
56788
56920
|
localWss = null;
|
|
@@ -58034,11 +58166,11 @@ var require_yoctocolors_cjs = __commonJS({
|
|
|
58034
58166
|
"use strict";
|
|
58035
58167
|
var tty3 = require("tty");
|
|
58036
58168
|
var hasColors = tty3?.WriteStream?.prototype?.hasColors?.() ?? false;
|
|
58037
|
-
var format = (
|
|
58169
|
+
var format = (open2, close) => {
|
|
58038
58170
|
if (!hasColors) {
|
|
58039
58171
|
return (input) => input;
|
|
58040
58172
|
}
|
|
58041
|
-
const openCode = `\x1B[${
|
|
58173
|
+
const openCode = `\x1B[${open2}m`;
|
|
58042
58174
|
const closeCode = `\x1B[${close}m`;
|
|
58043
58175
|
return (input) => {
|
|
58044
58176
|
const string4 = input + "";
|
|
@@ -61576,7 +61708,7 @@ var require_innerFrom = __commonJS({
|
|
|
61576
61708
|
exports2.fromIterable = fromIterable;
|
|
61577
61709
|
function fromAsyncIterable(asyncIterable) {
|
|
61578
61710
|
return new Observable_1.Observable(function(subscriber) {
|
|
61579
|
-
|
|
61711
|
+
process13(asyncIterable, subscriber).catch(function(err) {
|
|
61580
61712
|
return subscriber.error(err);
|
|
61581
61713
|
});
|
|
61582
61714
|
});
|
|
@@ -61586,7 +61718,7 @@ var require_innerFrom = __commonJS({
|
|
|
61586
61718
|
return fromAsyncIterable(isReadableStreamLike_1.readableStreamLikeToAsyncGenerator(readableStream));
|
|
61587
61719
|
}
|
|
61588
61720
|
exports2.fromReadableStreamLike = fromReadableStreamLike;
|
|
61589
|
-
function
|
|
61721
|
+
function process13(asyncIterable, subscriber) {
|
|
61590
61722
|
var asyncIterable_1, asyncIterable_1_1;
|
|
61591
61723
|
var e_2, _a2;
|
|
61592
61724
|
return __awaiter(this, void 0, void 0, function() {
|
|
@@ -69245,15 +69377,15 @@ var require_route = __commonJS({
|
|
|
69245
69377
|
};
|
|
69246
69378
|
}
|
|
69247
69379
|
function wrapConversion(toModel, graph) {
|
|
69248
|
-
const
|
|
69380
|
+
const path28 = [graph[toModel].parent, toModel];
|
|
69249
69381
|
let fn = conversions[graph[toModel].parent][toModel];
|
|
69250
69382
|
let cur = graph[toModel].parent;
|
|
69251
69383
|
while (graph[cur].parent) {
|
|
69252
|
-
|
|
69384
|
+
path28.unshift(graph[cur].parent);
|
|
69253
69385
|
fn = link(conversions[graph[cur].parent][cur], fn);
|
|
69254
69386
|
cur = graph[cur].parent;
|
|
69255
69387
|
}
|
|
69256
|
-
fn.conversion =
|
|
69388
|
+
fn.conversion = path28;
|
|
69257
69389
|
return fn;
|
|
69258
69390
|
}
|
|
69259
69391
|
module2.exports = function(fromModel) {
|
|
@@ -69650,7 +69782,7 @@ var require_has_flag = __commonJS({
|
|
|
69650
69782
|
var require_supports_color = __commonJS({
|
|
69651
69783
|
"../../node_modules/supports-color/index.js"(exports2, module2) {
|
|
69652
69784
|
"use strict";
|
|
69653
|
-
var
|
|
69785
|
+
var os28 = require("os");
|
|
69654
69786
|
var tty3 = require("tty");
|
|
69655
69787
|
var hasFlag3 = require_has_flag();
|
|
69656
69788
|
var { env: env3 } = process;
|
|
@@ -69698,7 +69830,7 @@ var require_supports_color = __commonJS({
|
|
|
69698
69830
|
return min;
|
|
69699
69831
|
}
|
|
69700
69832
|
if (process.platform === "win32") {
|
|
69701
|
-
const osRelease =
|
|
69833
|
+
const osRelease = os28.release().split(".");
|
|
69702
69834
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
69703
69835
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
69704
69836
|
}
|
|
@@ -69999,18 +70131,18 @@ var require_source = __commonJS({
|
|
|
69999
70131
|
}
|
|
70000
70132
|
}
|
|
70001
70133
|
});
|
|
70002
|
-
var createStyler3 = (
|
|
70134
|
+
var createStyler3 = (open2, close, parent) => {
|
|
70003
70135
|
let openAll;
|
|
70004
70136
|
let closeAll;
|
|
70005
70137
|
if (parent === void 0) {
|
|
70006
|
-
openAll =
|
|
70138
|
+
openAll = open2;
|
|
70007
70139
|
closeAll = close;
|
|
70008
70140
|
} else {
|
|
70009
|
-
openAll = parent.openAll +
|
|
70141
|
+
openAll = parent.openAll + open2;
|
|
70010
70142
|
closeAll = close + parent.closeAll;
|
|
70011
70143
|
}
|
|
70012
70144
|
return {
|
|
70013
|
-
open:
|
|
70145
|
+
open: open2,
|
|
70014
70146
|
close,
|
|
70015
70147
|
openAll,
|
|
70016
70148
|
closeAll,
|
|
@@ -70174,11 +70306,11 @@ var require_signals = __commonJS({
|
|
|
70174
70306
|
var require_signal_exit = __commonJS({
|
|
70175
70307
|
"../../node_modules/inquirer/node_modules/signal-exit/index.js"(exports2, module2) {
|
|
70176
70308
|
"use strict";
|
|
70177
|
-
var
|
|
70178
|
-
var processOk2 = function(
|
|
70179
|
-
return
|
|
70309
|
+
var process13 = global.process;
|
|
70310
|
+
var processOk2 = function(process14) {
|
|
70311
|
+
return process14 && typeof process14 === "object" && typeof process14.removeListener === "function" && typeof process14.emit === "function" && typeof process14.reallyExit === "function" && typeof process14.listeners === "function" && typeof process14.kill === "function" && typeof process14.pid === "number" && typeof process14.on === "function";
|
|
70180
70312
|
};
|
|
70181
|
-
if (!processOk2(
|
|
70313
|
+
if (!processOk2(process13)) {
|
|
70182
70314
|
module2.exports = function() {
|
|
70183
70315
|
return function() {
|
|
70184
70316
|
};
|
|
@@ -70186,15 +70318,15 @@ var require_signal_exit = __commonJS({
|
|
|
70186
70318
|
} else {
|
|
70187
70319
|
assert3 = require("assert");
|
|
70188
70320
|
signals2 = require_signals();
|
|
70189
|
-
isWin = /^win/i.test(
|
|
70321
|
+
isWin = /^win/i.test(process13.platform);
|
|
70190
70322
|
EE = require("events");
|
|
70191
70323
|
if (typeof EE !== "function") {
|
|
70192
70324
|
EE = EE.EventEmitter;
|
|
70193
70325
|
}
|
|
70194
|
-
if (
|
|
70195
|
-
emitter =
|
|
70326
|
+
if (process13.__signal_exit_emitter__) {
|
|
70327
|
+
emitter = process13.__signal_exit_emitter__;
|
|
70196
70328
|
} else {
|
|
70197
|
-
emitter =
|
|
70329
|
+
emitter = process13.__signal_exit_emitter__ = new EE();
|
|
70198
70330
|
emitter.count = 0;
|
|
70199
70331
|
emitter.emitted = {};
|
|
70200
70332
|
}
|
|
@@ -70231,12 +70363,12 @@ var require_signal_exit = __commonJS({
|
|
|
70231
70363
|
loaded = false;
|
|
70232
70364
|
signals2.forEach(function(sig) {
|
|
70233
70365
|
try {
|
|
70234
|
-
|
|
70366
|
+
process13.removeListener(sig, sigListeners[sig]);
|
|
70235
70367
|
} catch (er) {
|
|
70236
70368
|
}
|
|
70237
70369
|
});
|
|
70238
|
-
|
|
70239
|
-
|
|
70370
|
+
process13.emit = originalProcessEmit;
|
|
70371
|
+
process13.reallyExit = originalProcessReallyExit;
|
|
70240
70372
|
emitter.count -= 1;
|
|
70241
70373
|
};
|
|
70242
70374
|
module2.exports.unload = unload2;
|
|
@@ -70253,7 +70385,7 @@ var require_signal_exit = __commonJS({
|
|
|
70253
70385
|
if (!processOk2(global.process)) {
|
|
70254
70386
|
return;
|
|
70255
70387
|
}
|
|
70256
|
-
var listeners =
|
|
70388
|
+
var listeners = process13.listeners(sig);
|
|
70257
70389
|
if (listeners.length === emitter.count) {
|
|
70258
70390
|
unload2();
|
|
70259
70391
|
emit("exit", null, sig);
|
|
@@ -70261,7 +70393,7 @@ var require_signal_exit = __commonJS({
|
|
|
70261
70393
|
if (isWin && sig === "SIGHUP") {
|
|
70262
70394
|
sig = "SIGINT";
|
|
70263
70395
|
}
|
|
70264
|
-
|
|
70396
|
+
process13.kill(process13.pid, sig);
|
|
70265
70397
|
}
|
|
70266
70398
|
};
|
|
70267
70399
|
});
|
|
@@ -70277,36 +70409,36 @@ var require_signal_exit = __commonJS({
|
|
|
70277
70409
|
emitter.count += 1;
|
|
70278
70410
|
signals2 = signals2.filter(function(sig) {
|
|
70279
70411
|
try {
|
|
70280
|
-
|
|
70412
|
+
process13.on(sig, sigListeners[sig]);
|
|
70281
70413
|
return true;
|
|
70282
70414
|
} catch (er) {
|
|
70283
70415
|
return false;
|
|
70284
70416
|
}
|
|
70285
70417
|
});
|
|
70286
|
-
|
|
70287
|
-
|
|
70418
|
+
process13.emit = processEmit;
|
|
70419
|
+
process13.reallyExit = processReallyExit;
|
|
70288
70420
|
};
|
|
70289
70421
|
module2.exports.load = load2;
|
|
70290
|
-
originalProcessReallyExit =
|
|
70422
|
+
originalProcessReallyExit = process13.reallyExit;
|
|
70291
70423
|
processReallyExit = function processReallyExit2(code) {
|
|
70292
70424
|
if (!processOk2(global.process)) {
|
|
70293
70425
|
return;
|
|
70294
70426
|
}
|
|
70295
|
-
|
|
70427
|
+
process13.exitCode = code || /* istanbul ignore next */
|
|
70296
70428
|
0;
|
|
70297
|
-
emit("exit",
|
|
70298
|
-
emit("afterexit",
|
|
70299
|
-
originalProcessReallyExit.call(
|
|
70429
|
+
emit("exit", process13.exitCode, null);
|
|
70430
|
+
emit("afterexit", process13.exitCode, null);
|
|
70431
|
+
originalProcessReallyExit.call(process13, process13.exitCode);
|
|
70300
70432
|
};
|
|
70301
|
-
originalProcessEmit =
|
|
70433
|
+
originalProcessEmit = process13.emit;
|
|
70302
70434
|
processEmit = function processEmit2(ev, arg) {
|
|
70303
70435
|
if (ev === "exit" && processOk2(global.process)) {
|
|
70304
70436
|
if (arg !== void 0) {
|
|
70305
|
-
|
|
70437
|
+
process13.exitCode = arg;
|
|
70306
70438
|
}
|
|
70307
70439
|
var ret = originalProcessEmit.apply(this, arguments);
|
|
70308
|
-
emit("exit",
|
|
70309
|
-
emit("afterexit",
|
|
70440
|
+
emit("exit", process13.exitCode, null);
|
|
70441
|
+
emit("afterexit", process13.exitCode, null);
|
|
70310
70442
|
return ret;
|
|
70311
70443
|
} else {
|
|
70312
70444
|
return originalProcessEmit.apply(this, arguments);
|
|
@@ -72496,12 +72628,12 @@ var require_buffer_list = __commonJS({
|
|
|
72496
72628
|
return (hint === "string" ? String : Number)(input);
|
|
72497
72629
|
}
|
|
72498
72630
|
var _require = require("buffer");
|
|
72499
|
-
var
|
|
72631
|
+
var Buffer2 = _require.Buffer;
|
|
72500
72632
|
var _require2 = require("util");
|
|
72501
72633
|
var inspect = _require2.inspect;
|
|
72502
72634
|
var custom2 = inspect && inspect.custom || "inspect";
|
|
72503
72635
|
function copyBuffer(src, target, offset) {
|
|
72504
|
-
|
|
72636
|
+
Buffer2.prototype.copy.call(src, target, offset);
|
|
72505
72637
|
}
|
|
72506
72638
|
module2.exports = /* @__PURE__ */ (function() {
|
|
72507
72639
|
function BufferList() {
|
|
@@ -72561,8 +72693,8 @@ var require_buffer_list = __commonJS({
|
|
|
72561
72693
|
}, {
|
|
72562
72694
|
key: "concat",
|
|
72563
72695
|
value: function concat(n) {
|
|
72564
|
-
if (this.length === 0) return
|
|
72565
|
-
var ret =
|
|
72696
|
+
if (this.length === 0) return Buffer2.alloc(0);
|
|
72697
|
+
var ret = Buffer2.allocUnsafe(n >>> 0);
|
|
72566
72698
|
var p = this.head;
|
|
72567
72699
|
var i = 0;
|
|
72568
72700
|
while (p) {
|
|
@@ -72626,7 +72758,7 @@ var require_buffer_list = __commonJS({
|
|
|
72626
72758
|
}, {
|
|
72627
72759
|
key: "_getBuffer",
|
|
72628
72760
|
value: function _getBuffer(n) {
|
|
72629
|
-
var ret =
|
|
72761
|
+
var ret = Buffer2.allocUnsafe(n);
|
|
72630
72762
|
var p = this.head;
|
|
72631
72763
|
var c = 1;
|
|
72632
72764
|
p.data.copy(ret);
|
|
@@ -72958,14 +73090,14 @@ var require_stream_writable = __commonJS({
|
|
|
72958
73090
|
deprecate: require_node()
|
|
72959
73091
|
};
|
|
72960
73092
|
var Stream = require_stream();
|
|
72961
|
-
var
|
|
73093
|
+
var Buffer2 = require("buffer").Buffer;
|
|
72962
73094
|
var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
|
|
72963
73095
|
};
|
|
72964
73096
|
function _uint8ArrayToBuffer(chunk) {
|
|
72965
|
-
return
|
|
73097
|
+
return Buffer2.from(chunk);
|
|
72966
73098
|
}
|
|
72967
73099
|
function _isUint8Array(obj) {
|
|
72968
|
-
return
|
|
73100
|
+
return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
|
|
72969
73101
|
}
|
|
72970
73102
|
var destroyImpl = require_destroy();
|
|
72971
73103
|
var _require = require_state();
|
|
@@ -73093,7 +73225,7 @@ var require_stream_writable = __commonJS({
|
|
|
73093
73225
|
var state = this._writableState;
|
|
73094
73226
|
var ret = false;
|
|
73095
73227
|
var isBuf = !state.objectMode && _isUint8Array(chunk);
|
|
73096
|
-
if (isBuf && !
|
|
73228
|
+
if (isBuf && !Buffer2.isBuffer(chunk)) {
|
|
73097
73229
|
chunk = _uint8ArrayToBuffer(chunk);
|
|
73098
73230
|
}
|
|
73099
73231
|
if (typeof encoding === "function") {
|
|
@@ -73137,7 +73269,7 @@ var require_stream_writable = __commonJS({
|
|
|
73137
73269
|
});
|
|
73138
73270
|
function decodeChunk(state, chunk, encoding) {
|
|
73139
73271
|
if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") {
|
|
73140
|
-
chunk =
|
|
73272
|
+
chunk = Buffer2.from(chunk, encoding);
|
|
73141
73273
|
}
|
|
73142
73274
|
return chunk;
|
|
73143
73275
|
}
|
|
@@ -73508,34 +73640,34 @@ var require_safe_buffer = __commonJS({
|
|
|
73508
73640
|
"../../node_modules/safe-buffer/index.js"(exports2, module2) {
|
|
73509
73641
|
"use strict";
|
|
73510
73642
|
var buffer = require("buffer");
|
|
73511
|
-
var
|
|
73643
|
+
var Buffer2 = buffer.Buffer;
|
|
73512
73644
|
function copyProps(src, dst) {
|
|
73513
73645
|
for (var key in src) {
|
|
73514
73646
|
dst[key] = src[key];
|
|
73515
73647
|
}
|
|
73516
73648
|
}
|
|
73517
|
-
if (
|
|
73649
|
+
if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
|
|
73518
73650
|
module2.exports = buffer;
|
|
73519
73651
|
} else {
|
|
73520
73652
|
copyProps(buffer, exports2);
|
|
73521
73653
|
exports2.Buffer = SafeBuffer;
|
|
73522
73654
|
}
|
|
73523
73655
|
function SafeBuffer(arg, encodingOrOffset, length) {
|
|
73524
|
-
return
|
|
73656
|
+
return Buffer2(arg, encodingOrOffset, length);
|
|
73525
73657
|
}
|
|
73526
|
-
SafeBuffer.prototype = Object.create(
|
|
73527
|
-
copyProps(
|
|
73658
|
+
SafeBuffer.prototype = Object.create(Buffer2.prototype);
|
|
73659
|
+
copyProps(Buffer2, SafeBuffer);
|
|
73528
73660
|
SafeBuffer.from = function(arg, encodingOrOffset, length) {
|
|
73529
73661
|
if (typeof arg === "number") {
|
|
73530
73662
|
throw new TypeError("Argument must not be a number");
|
|
73531
73663
|
}
|
|
73532
|
-
return
|
|
73664
|
+
return Buffer2(arg, encodingOrOffset, length);
|
|
73533
73665
|
};
|
|
73534
73666
|
SafeBuffer.alloc = function(size, fill, encoding) {
|
|
73535
73667
|
if (typeof size !== "number") {
|
|
73536
73668
|
throw new TypeError("Argument must be a number");
|
|
73537
73669
|
}
|
|
73538
|
-
var buf =
|
|
73670
|
+
var buf = Buffer2(size);
|
|
73539
73671
|
if (fill !== void 0) {
|
|
73540
73672
|
if (typeof encoding === "string") {
|
|
73541
73673
|
buf.fill(fill, encoding);
|
|
@@ -73551,7 +73683,7 @@ var require_safe_buffer = __commonJS({
|
|
|
73551
73683
|
if (typeof size !== "number") {
|
|
73552
73684
|
throw new TypeError("Argument must be a number");
|
|
73553
73685
|
}
|
|
73554
|
-
return
|
|
73686
|
+
return Buffer2(size);
|
|
73555
73687
|
};
|
|
73556
73688
|
SafeBuffer.allocUnsafeSlow = function(size) {
|
|
73557
73689
|
if (typeof size !== "number") {
|
|
@@ -73566,8 +73698,8 @@ var require_safe_buffer = __commonJS({
|
|
|
73566
73698
|
var require_string_decoder = __commonJS({
|
|
73567
73699
|
"../../node_modules/string_decoder/lib/string_decoder.js"(exports2) {
|
|
73568
73700
|
"use strict";
|
|
73569
|
-
var
|
|
73570
|
-
var isEncoding =
|
|
73701
|
+
var Buffer2 = require_safe_buffer().Buffer;
|
|
73702
|
+
var isEncoding = Buffer2.isEncoding || function(encoding) {
|
|
73571
73703
|
encoding = "" + encoding;
|
|
73572
73704
|
switch (encoding && encoding.toLowerCase()) {
|
|
73573
73705
|
case "hex":
|
|
@@ -73615,7 +73747,7 @@ var require_string_decoder = __commonJS({
|
|
|
73615
73747
|
}
|
|
73616
73748
|
function normalizeEncoding(enc) {
|
|
73617
73749
|
var nenc = _normalizeEncoding(enc);
|
|
73618
|
-
if (typeof nenc !== "string" && (
|
|
73750
|
+
if (typeof nenc !== "string" && (Buffer2.isEncoding === isEncoding || !isEncoding(enc))) throw new Error("Unknown encoding: " + enc);
|
|
73619
73751
|
return nenc || enc;
|
|
73620
73752
|
}
|
|
73621
73753
|
exports2.StringDecoder = StringDecoder;
|
|
@@ -73644,7 +73776,7 @@ var require_string_decoder = __commonJS({
|
|
|
73644
73776
|
}
|
|
73645
73777
|
this.lastNeed = 0;
|
|
73646
73778
|
this.lastTotal = 0;
|
|
73647
|
-
this.lastChar =
|
|
73779
|
+
this.lastChar = Buffer2.allocUnsafe(nb);
|
|
73648
73780
|
}
|
|
73649
73781
|
StringDecoder.prototype.write = function(buf) {
|
|
73650
73782
|
if (buf.length === 0) return "";
|
|
@@ -74205,14 +74337,14 @@ var require_stream_readable = __commonJS({
|
|
|
74205
74337
|
return emitter.listeners(type).length;
|
|
74206
74338
|
};
|
|
74207
74339
|
var Stream = require_stream();
|
|
74208
|
-
var
|
|
74340
|
+
var Buffer2 = require("buffer").Buffer;
|
|
74209
74341
|
var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
|
|
74210
74342
|
};
|
|
74211
74343
|
function _uint8ArrayToBuffer(chunk) {
|
|
74212
|
-
return
|
|
74344
|
+
return Buffer2.from(chunk);
|
|
74213
74345
|
}
|
|
74214
74346
|
function _isUint8Array(obj) {
|
|
74215
|
-
return
|
|
74347
|
+
return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
|
|
74216
74348
|
}
|
|
74217
74349
|
var debugUtil = require("util");
|
|
74218
74350
|
var debug;
|
|
@@ -74320,7 +74452,7 @@ var require_stream_readable = __commonJS({
|
|
|
74320
74452
|
if (typeof chunk === "string") {
|
|
74321
74453
|
encoding = encoding || state.defaultEncoding;
|
|
74322
74454
|
if (encoding !== state.encoding) {
|
|
74323
|
-
chunk =
|
|
74455
|
+
chunk = Buffer2.from(chunk, encoding);
|
|
74324
74456
|
encoding = "";
|
|
74325
74457
|
}
|
|
74326
74458
|
skipChunkCheck = true;
|
|
@@ -74345,7 +74477,7 @@ var require_stream_readable = __commonJS({
|
|
|
74345
74477
|
if (er) {
|
|
74346
74478
|
errorOrDestroy(stream, er);
|
|
74347
74479
|
} else if (state.objectMode || chunk && chunk.length > 0) {
|
|
74348
|
-
if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !==
|
|
74480
|
+
if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer2.prototype) {
|
|
74349
74481
|
chunk = _uint8ArrayToBuffer(chunk);
|
|
74350
74482
|
}
|
|
74351
74483
|
if (addToFront) {
|
|
@@ -75156,7 +75288,7 @@ var require_readable = __commonJS({
|
|
|
75156
75288
|
var require_BufferList = __commonJS({
|
|
75157
75289
|
"../../node_modules/bl/BufferList.js"(exports2, module2) {
|
|
75158
75290
|
"use strict";
|
|
75159
|
-
var { Buffer:
|
|
75291
|
+
var { Buffer: Buffer2 } = require("buffer");
|
|
75160
75292
|
var symbol2 = /* @__PURE__ */ Symbol.for("BufferList");
|
|
75161
75293
|
function BufferList(buf) {
|
|
75162
75294
|
if (!(this instanceof BufferList)) {
|
|
@@ -75220,10 +75352,10 @@ var require_BufferList = __commonJS({
|
|
|
75220
75352
|
srcEnd = this.length;
|
|
75221
75353
|
}
|
|
75222
75354
|
if (srcStart >= this.length) {
|
|
75223
|
-
return dst ||
|
|
75355
|
+
return dst || Buffer2.alloc(0);
|
|
75224
75356
|
}
|
|
75225
75357
|
if (srcEnd <= 0) {
|
|
75226
|
-
return dst ||
|
|
75358
|
+
return dst || Buffer2.alloc(0);
|
|
75227
75359
|
}
|
|
75228
75360
|
const copy2 = !!dst;
|
|
75229
75361
|
const off = this._offset(srcStart);
|
|
@@ -75233,7 +75365,7 @@ var require_BufferList = __commonJS({
|
|
|
75233
75365
|
let start = off[1];
|
|
75234
75366
|
if (srcStart === 0 && srcEnd === this.length) {
|
|
75235
75367
|
if (!copy2) {
|
|
75236
|
-
return this._bufs.length === 1 ? this._bufs[0] :
|
|
75368
|
+
return this._bufs.length === 1 ? this._bufs[0] : Buffer2.concat(this._bufs, this.length);
|
|
75237
75369
|
}
|
|
75238
75370
|
for (let i = 0; i < this._bufs.length; i++) {
|
|
75239
75371
|
this._bufs[i].copy(dst, bufoff);
|
|
@@ -75245,7 +75377,7 @@ var require_BufferList = __commonJS({
|
|
|
75245
75377
|
return copy2 ? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes) : this._bufs[off[0]].slice(start, start + bytes);
|
|
75246
75378
|
}
|
|
75247
75379
|
if (!copy2) {
|
|
75248
|
-
dst =
|
|
75380
|
+
dst = Buffer2.allocUnsafe(len);
|
|
75249
75381
|
}
|
|
75250
75382
|
for (let i = off[0]; i < this._bufs.length; i++) {
|
|
75251
75383
|
const l = this._bufs[i].length - start;
|
|
@@ -75321,7 +75453,7 @@ var require_BufferList = __commonJS({
|
|
|
75321
75453
|
return this;
|
|
75322
75454
|
}
|
|
75323
75455
|
if (buf.buffer) {
|
|
75324
|
-
this._appendBuffer(
|
|
75456
|
+
this._appendBuffer(Buffer2.from(buf.buffer, buf.byteOffset, buf.byteLength));
|
|
75325
75457
|
} else if (Array.isArray(buf)) {
|
|
75326
75458
|
for (let i = 0; i < buf.length; i++) {
|
|
75327
75459
|
this.append(buf[i]);
|
|
@@ -75334,7 +75466,7 @@ var require_BufferList = __commonJS({
|
|
|
75334
75466
|
if (typeof buf === "number") {
|
|
75335
75467
|
buf = buf.toString();
|
|
75336
75468
|
}
|
|
75337
|
-
this._appendBuffer(
|
|
75469
|
+
this._appendBuffer(Buffer2.from(buf));
|
|
75338
75470
|
}
|
|
75339
75471
|
return this;
|
|
75340
75472
|
};
|
|
@@ -75350,15 +75482,15 @@ var require_BufferList = __commonJS({
|
|
|
75350
75482
|
if (typeof search === "function" || Array.isArray(search)) {
|
|
75351
75483
|
throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');
|
|
75352
75484
|
} else if (typeof search === "number") {
|
|
75353
|
-
search =
|
|
75485
|
+
search = Buffer2.from([search]);
|
|
75354
75486
|
} else if (typeof search === "string") {
|
|
75355
|
-
search =
|
|
75487
|
+
search = Buffer2.from(search, encoding);
|
|
75356
75488
|
} else if (this._isBufferList(search)) {
|
|
75357
75489
|
search = search.slice();
|
|
75358
75490
|
} else if (Array.isArray(search.buffer)) {
|
|
75359
|
-
search =
|
|
75360
|
-
} else if (!
|
|
75361
|
-
search =
|
|
75491
|
+
search = Buffer2.from(search.buffer, search.byteOffset, search.byteLength);
|
|
75492
|
+
} else if (!Buffer2.isBuffer(search)) {
|
|
75493
|
+
search = Buffer2.from(search);
|
|
75362
75494
|
}
|
|
75363
75495
|
offset = Number(offset || 0);
|
|
75364
75496
|
if (isNaN(offset)) {
|
|
@@ -82674,10 +82806,10 @@ var require_lib2 = __commonJS({
|
|
|
82674
82806
|
exports2.analyse = analyse;
|
|
82675
82807
|
var detectFile = (filepath, opts = {}) => new Promise((resolve16, reject) => {
|
|
82676
82808
|
let fd;
|
|
82677
|
-
const
|
|
82809
|
+
const fs19 = (0, node_1.default)();
|
|
82678
82810
|
const handler = (err, buffer) => {
|
|
82679
82811
|
if (fd) {
|
|
82680
|
-
|
|
82812
|
+
fs19.closeSync(fd);
|
|
82681
82813
|
}
|
|
82682
82814
|
if (err) {
|
|
82683
82815
|
reject(err);
|
|
@@ -82689,9 +82821,9 @@ var require_lib2 = __commonJS({
|
|
|
82689
82821
|
};
|
|
82690
82822
|
const sampleSize = (opts === null || opts === void 0 ? void 0 : opts.sampleSize) || 0;
|
|
82691
82823
|
if (sampleSize > 0) {
|
|
82692
|
-
fd =
|
|
82824
|
+
fd = fs19.openSync(filepath, "r");
|
|
82693
82825
|
let sample = Buffer.allocUnsafe(sampleSize);
|
|
82694
|
-
|
|
82826
|
+
fs19.read(fd, sample, 0, sampleSize, opts.offset, (err, bytesRead) => {
|
|
82695
82827
|
if (err) {
|
|
82696
82828
|
handler(err, null);
|
|
82697
82829
|
} else {
|
|
@@ -82703,22 +82835,22 @@ var require_lib2 = __commonJS({
|
|
|
82703
82835
|
});
|
|
82704
82836
|
return;
|
|
82705
82837
|
}
|
|
82706
|
-
|
|
82838
|
+
fs19.readFile(filepath, handler);
|
|
82707
82839
|
});
|
|
82708
82840
|
exports2.detectFile = detectFile;
|
|
82709
82841
|
var detectFileSync = (filepath, opts = {}) => {
|
|
82710
|
-
const
|
|
82842
|
+
const fs19 = (0, node_1.default)();
|
|
82711
82843
|
if (opts && opts.sampleSize) {
|
|
82712
|
-
const fd =
|
|
82844
|
+
const fd = fs19.openSync(filepath, "r");
|
|
82713
82845
|
let sample = Buffer.allocUnsafe(opts.sampleSize);
|
|
82714
|
-
const bytesRead =
|
|
82846
|
+
const bytesRead = fs19.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
|
|
82715
82847
|
if (bytesRead < opts.sampleSize) {
|
|
82716
82848
|
sample = sample.subarray(0, bytesRead);
|
|
82717
82849
|
}
|
|
82718
|
-
|
|
82850
|
+
fs19.closeSync(fd);
|
|
82719
82851
|
return (0, exports2.detect)(sample);
|
|
82720
82852
|
}
|
|
82721
|
-
return (0, exports2.detect)(
|
|
82853
|
+
return (0, exports2.detect)(fs19.readFileSync(filepath));
|
|
82722
82854
|
};
|
|
82723
82855
|
exports2.detectFileSync = detectFileSync;
|
|
82724
82856
|
exports2.default = {
|
|
@@ -82735,7 +82867,7 @@ var require_safer = __commonJS({
|
|
|
82735
82867
|
"../../node_modules/safer-buffer/safer.js"(exports2, module2) {
|
|
82736
82868
|
"use strict";
|
|
82737
82869
|
var buffer = require("buffer");
|
|
82738
|
-
var
|
|
82870
|
+
var Buffer2 = buffer.Buffer;
|
|
82739
82871
|
var safer = {};
|
|
82740
82872
|
var key;
|
|
82741
82873
|
for (key in buffer) {
|
|
@@ -82744,12 +82876,12 @@ var require_safer = __commonJS({
|
|
|
82744
82876
|
safer[key] = buffer[key];
|
|
82745
82877
|
}
|
|
82746
82878
|
var Safer = safer.Buffer = {};
|
|
82747
|
-
for (key in
|
|
82748
|
-
if (!
|
|
82879
|
+
for (key in Buffer2) {
|
|
82880
|
+
if (!Buffer2.hasOwnProperty(key)) continue;
|
|
82749
82881
|
if (key === "allocUnsafe" || key === "allocUnsafeSlow") continue;
|
|
82750
|
-
Safer[key] =
|
|
82882
|
+
Safer[key] = Buffer2[key];
|
|
82751
82883
|
}
|
|
82752
|
-
safer.Buffer.prototype =
|
|
82884
|
+
safer.Buffer.prototype = Buffer2.prototype;
|
|
82753
82885
|
if (!Safer.from || Safer.from === Uint8Array.from) {
|
|
82754
82886
|
Safer.from = function(value, encodingOrOffset, length) {
|
|
82755
82887
|
if (typeof value === "number") {
|
|
@@ -82758,7 +82890,7 @@ var require_safer = __commonJS({
|
|
|
82758
82890
|
if (value && typeof value.length === "undefined") {
|
|
82759
82891
|
throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value);
|
|
82760
82892
|
}
|
|
82761
|
-
return
|
|
82893
|
+
return Buffer2(value, encodingOrOffset, length);
|
|
82762
82894
|
};
|
|
82763
82895
|
}
|
|
82764
82896
|
if (!Safer.alloc) {
|
|
@@ -82769,7 +82901,7 @@ var require_safer = __commonJS({
|
|
|
82769
82901
|
if (size < 0 || size >= 2 * (1 << 30)) {
|
|
82770
82902
|
throw new RangeError('The value "' + size + '" is invalid for option "size"');
|
|
82771
82903
|
}
|
|
82772
|
-
var buf =
|
|
82904
|
+
var buf = Buffer2(size);
|
|
82773
82905
|
if (!fill || fill.length === 0) {
|
|
82774
82906
|
buf.fill(0);
|
|
82775
82907
|
} else if (typeof encoding === "string") {
|
|
@@ -82864,7 +82996,7 @@ var require_merge_exports = __commonJS({
|
|
|
82864
82996
|
var require_internal = __commonJS({
|
|
82865
82997
|
"../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/internal.js"(exports2, module2) {
|
|
82866
82998
|
"use strict";
|
|
82867
|
-
var
|
|
82999
|
+
var Buffer2 = require_safer().Buffer;
|
|
82868
83000
|
module2.exports = {
|
|
82869
83001
|
// Encodings
|
|
82870
83002
|
utf8: { type: "_internal", bomAware: true },
|
|
@@ -82888,7 +83020,7 @@ var require_internal = __commonJS({
|
|
|
82888
83020
|
} else if (this.enc === "cesu8") {
|
|
82889
83021
|
this.enc = "utf8";
|
|
82890
83022
|
this.encoder = InternalEncoderCesu8;
|
|
82891
|
-
if (
|
|
83023
|
+
if (Buffer2.from("eda0bdedb2a9", "hex").toString() !== "\u{1F4A9}") {
|
|
82892
83024
|
this.decoder = InternalDecoderCesu8;
|
|
82893
83025
|
this.defaultCharUnicode = iconv2.defaultCharUnicode;
|
|
82894
83026
|
}
|
|
@@ -82901,8 +83033,8 @@ var require_internal = __commonJS({
|
|
|
82901
83033
|
this.decoder = new StringDecoder(codec2.enc);
|
|
82902
83034
|
}
|
|
82903
83035
|
InternalDecoder.prototype.write = function(buf) {
|
|
82904
|
-
if (!
|
|
82905
|
-
buf =
|
|
83036
|
+
if (!Buffer2.isBuffer(buf)) {
|
|
83037
|
+
buf = Buffer2.from(buf);
|
|
82906
83038
|
}
|
|
82907
83039
|
return this.decoder.write(buf);
|
|
82908
83040
|
};
|
|
@@ -82913,7 +83045,7 @@ var require_internal = __commonJS({
|
|
|
82913
83045
|
this.enc = codec2.enc;
|
|
82914
83046
|
}
|
|
82915
83047
|
InternalEncoder.prototype.write = function(str) {
|
|
82916
|
-
return
|
|
83048
|
+
return Buffer2.from(str, this.enc);
|
|
82917
83049
|
};
|
|
82918
83050
|
InternalEncoder.prototype.end = function() {
|
|
82919
83051
|
};
|
|
@@ -82925,15 +83057,15 @@ var require_internal = __commonJS({
|
|
|
82925
83057
|
var completeQuads = str.length - str.length % 4;
|
|
82926
83058
|
this.prevStr = str.slice(completeQuads);
|
|
82927
83059
|
str = str.slice(0, completeQuads);
|
|
82928
|
-
return
|
|
83060
|
+
return Buffer2.from(str, "base64");
|
|
82929
83061
|
};
|
|
82930
83062
|
InternalEncoderBase64.prototype.end = function() {
|
|
82931
|
-
return
|
|
83063
|
+
return Buffer2.from(this.prevStr, "base64");
|
|
82932
83064
|
};
|
|
82933
83065
|
function InternalEncoderCesu8(options, codec2) {
|
|
82934
83066
|
}
|
|
82935
83067
|
InternalEncoderCesu8.prototype.write = function(str) {
|
|
82936
|
-
var buf =
|
|
83068
|
+
var buf = Buffer2.alloc(str.length * 3);
|
|
82937
83069
|
var bufIdx = 0;
|
|
82938
83070
|
for (var i = 0; i < str.length; i++) {
|
|
82939
83071
|
var charCode = str.charCodeAt(i);
|
|
@@ -83029,13 +83161,13 @@ var require_internal = __commonJS({
|
|
|
83029
83161
|
str = str.slice(0, str.length - 1);
|
|
83030
83162
|
}
|
|
83031
83163
|
}
|
|
83032
|
-
return
|
|
83164
|
+
return Buffer2.from(str, this.enc);
|
|
83033
83165
|
};
|
|
83034
83166
|
InternalEncoderUtf8.prototype.end = function() {
|
|
83035
83167
|
if (this.highSurrogate) {
|
|
83036
83168
|
var str = this.highSurrogate;
|
|
83037
83169
|
this.highSurrogate = "";
|
|
83038
|
-
return
|
|
83170
|
+
return Buffer2.from(str, this.enc);
|
|
83039
83171
|
}
|
|
83040
83172
|
};
|
|
83041
83173
|
}
|
|
@@ -83045,7 +83177,7 @@ var require_internal = __commonJS({
|
|
|
83045
83177
|
var require_utf32 = __commonJS({
|
|
83046
83178
|
"../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/utf32.js"(exports2) {
|
|
83047
83179
|
"use strict";
|
|
83048
|
-
var
|
|
83180
|
+
var Buffer2 = require_safer().Buffer;
|
|
83049
83181
|
exports2._utf32 = Utf32Codec;
|
|
83050
83182
|
function Utf32Codec(codecOptions, iconv2) {
|
|
83051
83183
|
this.iconv = iconv2;
|
|
@@ -83063,8 +83195,8 @@ var require_utf32 = __commonJS({
|
|
|
83063
83195
|
this.highSurrogate = 0;
|
|
83064
83196
|
}
|
|
83065
83197
|
Utf32Encoder.prototype.write = function(str) {
|
|
83066
|
-
var src =
|
|
83067
|
-
var dst =
|
|
83198
|
+
var src = Buffer2.from(str, "ucs2");
|
|
83199
|
+
var dst = Buffer2.alloc(src.length * 2);
|
|
83068
83200
|
var write32 = this.isLE ? dst.writeUInt32LE : dst.writeUInt32BE;
|
|
83069
83201
|
var offset = 0;
|
|
83070
83202
|
for (var i = 0; i < src.length; i += 2) {
|
|
@@ -83100,7 +83232,7 @@ var require_utf32 = __commonJS({
|
|
|
83100
83232
|
if (!this.highSurrogate) {
|
|
83101
83233
|
return;
|
|
83102
83234
|
}
|
|
83103
|
-
var buf =
|
|
83235
|
+
var buf = Buffer2.alloc(4);
|
|
83104
83236
|
if (this.isLE) {
|
|
83105
83237
|
buf.writeUInt32LE(this.highSurrogate, 0);
|
|
83106
83238
|
} else {
|
|
@@ -83120,7 +83252,7 @@ var require_utf32 = __commonJS({
|
|
|
83120
83252
|
}
|
|
83121
83253
|
var i = 0;
|
|
83122
83254
|
var codepoint = 0;
|
|
83123
|
-
var dst =
|
|
83255
|
+
var dst = Buffer2.alloc(src.length + 4);
|
|
83124
83256
|
var offset = 0;
|
|
83125
83257
|
var isLE = this.isLE;
|
|
83126
83258
|
var overflow = this.overflow;
|
|
@@ -83276,7 +83408,7 @@ var require_utf32 = __commonJS({
|
|
|
83276
83408
|
var require_utf16 = __commonJS({
|
|
83277
83409
|
"../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/utf16.js"(exports2) {
|
|
83278
83410
|
"use strict";
|
|
83279
|
-
var
|
|
83411
|
+
var Buffer2 = require_safer().Buffer;
|
|
83280
83412
|
exports2.utf16be = Utf16BECodec;
|
|
83281
83413
|
function Utf16BECodec() {
|
|
83282
83414
|
}
|
|
@@ -83286,7 +83418,7 @@ var require_utf16 = __commonJS({
|
|
|
83286
83418
|
function Utf16BEEncoder() {
|
|
83287
83419
|
}
|
|
83288
83420
|
Utf16BEEncoder.prototype.write = function(str) {
|
|
83289
|
-
var buf =
|
|
83421
|
+
var buf = Buffer2.from(str, "ucs2");
|
|
83290
83422
|
for (var i = 0; i < buf.length; i += 2) {
|
|
83291
83423
|
var tmp = buf[i];
|
|
83292
83424
|
buf[i] = buf[i + 1];
|
|
@@ -83303,7 +83435,7 @@ var require_utf16 = __commonJS({
|
|
|
83303
83435
|
if (buf.length == 0) {
|
|
83304
83436
|
return "";
|
|
83305
83437
|
}
|
|
83306
|
-
var buf2 =
|
|
83438
|
+
var buf2 = Buffer2.alloc(buf.length + 1);
|
|
83307
83439
|
var i = 0;
|
|
83308
83440
|
var j = 0;
|
|
83309
83441
|
if (this.overflowByte !== -1) {
|
|
@@ -83419,7 +83551,7 @@ var require_utf16 = __commonJS({
|
|
|
83419
83551
|
var require_utf7 = __commonJS({
|
|
83420
83552
|
"../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/utf7.js"(exports2) {
|
|
83421
83553
|
"use strict";
|
|
83422
|
-
var
|
|
83554
|
+
var Buffer2 = require_safer().Buffer;
|
|
83423
83555
|
exports2.utf7 = Utf7Codec;
|
|
83424
83556
|
exports2.unicode11utf7 = "utf7";
|
|
83425
83557
|
function Utf7Codec(codecOptions, iconv2) {
|
|
@@ -83433,7 +83565,7 @@ var require_utf7 = __commonJS({
|
|
|
83433
83565
|
this.iconv = codec2.iconv;
|
|
83434
83566
|
}
|
|
83435
83567
|
Utf7Encoder.prototype.write = function(str) {
|
|
83436
|
-
return
|
|
83568
|
+
return Buffer2.from(str.replace(nonDirectChars, function(chunk) {
|
|
83437
83569
|
return "+" + (chunk === "+" ? "" : this.iconv.encode(chunk, "utf16-be").toString("base64").replace(/=+$/, "")) + "-";
|
|
83438
83570
|
}.bind(this)));
|
|
83439
83571
|
};
|
|
@@ -83471,7 +83603,7 @@ var require_utf7 = __commonJS({
|
|
|
83471
83603
|
res += "+";
|
|
83472
83604
|
} else {
|
|
83473
83605
|
var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i2), "ascii");
|
|
83474
|
-
res += this.iconv.decode(
|
|
83606
|
+
res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
|
|
83475
83607
|
}
|
|
83476
83608
|
if (buf[i2] != minusChar) {
|
|
83477
83609
|
i2--;
|
|
@@ -83489,7 +83621,7 @@ var require_utf7 = __commonJS({
|
|
|
83489
83621
|
var canBeDecoded = b64str.length - b64str.length % 8;
|
|
83490
83622
|
base64Accum = b64str.slice(canBeDecoded);
|
|
83491
83623
|
b64str = b64str.slice(0, canBeDecoded);
|
|
83492
|
-
res += this.iconv.decode(
|
|
83624
|
+
res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
|
|
83493
83625
|
}
|
|
83494
83626
|
this.inBase64 = inBase64;
|
|
83495
83627
|
this.base64Accum = base64Accum;
|
|
@@ -83498,7 +83630,7 @@ var require_utf7 = __commonJS({
|
|
|
83498
83630
|
Utf7Decoder.prototype.end = function() {
|
|
83499
83631
|
var res = "";
|
|
83500
83632
|
if (this.inBase64 && this.base64Accum.length > 0) {
|
|
83501
|
-
res = this.iconv.decode(
|
|
83633
|
+
res = this.iconv.decode(Buffer2.from(this.base64Accum, "base64"), "utf16-be");
|
|
83502
83634
|
}
|
|
83503
83635
|
this.inBase64 = false;
|
|
83504
83636
|
this.base64Accum = "";
|
|
@@ -83514,14 +83646,14 @@ var require_utf7 = __commonJS({
|
|
|
83514
83646
|
function Utf7IMAPEncoder(options, codec2) {
|
|
83515
83647
|
this.iconv = codec2.iconv;
|
|
83516
83648
|
this.inBase64 = false;
|
|
83517
|
-
this.base64Accum =
|
|
83649
|
+
this.base64Accum = Buffer2.alloc(6);
|
|
83518
83650
|
this.base64AccumIdx = 0;
|
|
83519
83651
|
}
|
|
83520
83652
|
Utf7IMAPEncoder.prototype.write = function(str) {
|
|
83521
83653
|
var inBase64 = this.inBase64;
|
|
83522
83654
|
var base64Accum = this.base64Accum;
|
|
83523
83655
|
var base64AccumIdx = this.base64AccumIdx;
|
|
83524
|
-
var buf =
|
|
83656
|
+
var buf = Buffer2.alloc(str.length * 5 + 10);
|
|
83525
83657
|
var bufIdx = 0;
|
|
83526
83658
|
for (var i2 = 0; i2 < str.length; i2++) {
|
|
83527
83659
|
var uChar = str.charCodeAt(i2);
|
|
@@ -83560,7 +83692,7 @@ var require_utf7 = __commonJS({
|
|
|
83560
83692
|
return buf.slice(0, bufIdx);
|
|
83561
83693
|
};
|
|
83562
83694
|
Utf7IMAPEncoder.prototype.end = function() {
|
|
83563
|
-
var buf =
|
|
83695
|
+
var buf = Buffer2.alloc(10);
|
|
83564
83696
|
var bufIdx = 0;
|
|
83565
83697
|
if (this.inBase64) {
|
|
83566
83698
|
if (this.base64AccumIdx > 0) {
|
|
@@ -83597,7 +83729,7 @@ var require_utf7 = __commonJS({
|
|
|
83597
83729
|
res += "&";
|
|
83598
83730
|
} else {
|
|
83599
83731
|
var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i2), "ascii").replace(/,/g, "/");
|
|
83600
|
-
res += this.iconv.decode(
|
|
83732
|
+
res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
|
|
83601
83733
|
}
|
|
83602
83734
|
if (buf[i2] != minusChar) {
|
|
83603
83735
|
i2--;
|
|
@@ -83615,7 +83747,7 @@ var require_utf7 = __commonJS({
|
|
|
83615
83747
|
var canBeDecoded = b64str.length - b64str.length % 8;
|
|
83616
83748
|
base64Accum = b64str.slice(canBeDecoded);
|
|
83617
83749
|
b64str = b64str.slice(0, canBeDecoded);
|
|
83618
|
-
res += this.iconv.decode(
|
|
83750
|
+
res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
|
|
83619
83751
|
}
|
|
83620
83752
|
this.inBase64 = inBase64;
|
|
83621
83753
|
this.base64Accum = base64Accum;
|
|
@@ -83624,7 +83756,7 @@ var require_utf7 = __commonJS({
|
|
|
83624
83756
|
Utf7IMAPDecoder.prototype.end = function() {
|
|
83625
83757
|
var res = "";
|
|
83626
83758
|
if (this.inBase64 && this.base64Accum.length > 0) {
|
|
83627
|
-
res = this.iconv.decode(
|
|
83759
|
+
res = this.iconv.decode(Buffer2.from(this.base64Accum, "base64"), "utf16-be");
|
|
83628
83760
|
}
|
|
83629
83761
|
this.inBase64 = false;
|
|
83630
83762
|
this.base64Accum = "";
|
|
@@ -83637,7 +83769,7 @@ var require_utf7 = __commonJS({
|
|
|
83637
83769
|
var require_sbcs_codec = __commonJS({
|
|
83638
83770
|
"../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/sbcs-codec.js"(exports2) {
|
|
83639
83771
|
"use strict";
|
|
83640
|
-
var
|
|
83772
|
+
var Buffer2 = require_safer().Buffer;
|
|
83641
83773
|
exports2._sbcs = SBCSCodec;
|
|
83642
83774
|
function SBCSCodec(codecOptions, iconv2) {
|
|
83643
83775
|
if (!codecOptions) {
|
|
@@ -83653,8 +83785,8 @@ var require_sbcs_codec = __commonJS({
|
|
|
83653
83785
|
}
|
|
83654
83786
|
codecOptions.chars = asciiString + codecOptions.chars;
|
|
83655
83787
|
}
|
|
83656
|
-
this.decodeBuf =
|
|
83657
|
-
var encodeBuf =
|
|
83788
|
+
this.decodeBuf = Buffer2.from(codecOptions.chars, "ucs2");
|
|
83789
|
+
var encodeBuf = Buffer2.alloc(65536, iconv2.defaultCharSingleByte.charCodeAt(0));
|
|
83658
83790
|
for (var i = 0; i < codecOptions.chars.length; i++) {
|
|
83659
83791
|
encodeBuf[codecOptions.chars.charCodeAt(i)] = i;
|
|
83660
83792
|
}
|
|
@@ -83666,7 +83798,7 @@ var require_sbcs_codec = __commonJS({
|
|
|
83666
83798
|
this.encodeBuf = codec2.encodeBuf;
|
|
83667
83799
|
}
|
|
83668
83800
|
SBCSEncoder.prototype.write = function(str) {
|
|
83669
|
-
var buf =
|
|
83801
|
+
var buf = Buffer2.alloc(str.length);
|
|
83670
83802
|
for (var i = 0; i < str.length; i++) {
|
|
83671
83803
|
buf[i] = this.encodeBuf[str.charCodeAt(i)];
|
|
83672
83804
|
}
|
|
@@ -83679,7 +83811,7 @@ var require_sbcs_codec = __commonJS({
|
|
|
83679
83811
|
}
|
|
83680
83812
|
SBCSDecoder.prototype.write = function(buf) {
|
|
83681
83813
|
var decodeBuf = this.decodeBuf;
|
|
83682
|
-
var newBuf =
|
|
83814
|
+
var newBuf = Buffer2.alloc(buf.length * 2);
|
|
83683
83815
|
var idx1 = 0;
|
|
83684
83816
|
var idx2 = 0;
|
|
83685
83817
|
for (var i = 0; i < buf.length; i++) {
|
|
@@ -84307,7 +84439,7 @@ var require_sbcs_data_generated = __commonJS({
|
|
|
84307
84439
|
var require_dbcs_codec = __commonJS({
|
|
84308
84440
|
"../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/encodings/dbcs-codec.js"(exports2) {
|
|
84309
84441
|
"use strict";
|
|
84310
|
-
var
|
|
84442
|
+
var Buffer2 = require_safer().Buffer;
|
|
84311
84443
|
exports2._dbcs = DBCSCodec;
|
|
84312
84444
|
var UNASSIGNED = -1;
|
|
84313
84445
|
var GB18030_CODE = -2;
|
|
@@ -84543,7 +84675,7 @@ var require_dbcs_codec = __commonJS({
|
|
|
84543
84675
|
this.gb18030 = codec2.gb18030;
|
|
84544
84676
|
}
|
|
84545
84677
|
DBCSEncoder.prototype.write = function(str) {
|
|
84546
|
-
var newBuf =
|
|
84678
|
+
var newBuf = Buffer2.alloc(str.length * (this.gb18030 ? 4 : 3));
|
|
84547
84679
|
var leadSurrogate = this.leadSurrogate;
|
|
84548
84680
|
var seqObj = this.seqObj;
|
|
84549
84681
|
var nextChar = -1;
|
|
@@ -84647,7 +84779,7 @@ var require_dbcs_codec = __commonJS({
|
|
|
84647
84779
|
if (this.leadSurrogate === -1 && this.seqObj === void 0) {
|
|
84648
84780
|
return;
|
|
84649
84781
|
}
|
|
84650
|
-
var newBuf =
|
|
84782
|
+
var newBuf = Buffer2.alloc(10);
|
|
84651
84783
|
var j = 0;
|
|
84652
84784
|
if (this.seqObj) {
|
|
84653
84785
|
var dbcsCode = this.seqObj[DEF_CHAR];
|
|
@@ -84678,7 +84810,7 @@ var require_dbcs_codec = __commonJS({
|
|
|
84678
84810
|
this.gb18030 = codec2.gb18030;
|
|
84679
84811
|
}
|
|
84680
84812
|
DBCSDecoder.prototype.write = function(buf) {
|
|
84681
|
-
var newBuf =
|
|
84813
|
+
var newBuf = Buffer2.alloc(buf.length * 2);
|
|
84682
84814
|
var nodeIdx = this.nodeIdx;
|
|
84683
84815
|
var prevBytes = this.prevBytes;
|
|
84684
84816
|
var prevOffset = this.prevBytes.length;
|
|
@@ -86287,7 +86419,7 @@ var require_encodings = __commonJS({
|
|
|
86287
86419
|
var require_streams = __commonJS({
|
|
86288
86420
|
"../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/lib/streams.js"(exports2, module2) {
|
|
86289
86421
|
"use strict";
|
|
86290
|
-
var
|
|
86422
|
+
var Buffer2 = require_safer().Buffer;
|
|
86291
86423
|
module2.exports = function(streamModule) {
|
|
86292
86424
|
var Transform = streamModule.Transform;
|
|
86293
86425
|
function IconvLiteEncoderStream(conv, options) {
|
|
@@ -86327,7 +86459,7 @@ var require_streams = __commonJS({
|
|
|
86327
86459
|
chunks.push(chunk);
|
|
86328
86460
|
});
|
|
86329
86461
|
this.on("end", function() {
|
|
86330
|
-
cb(null,
|
|
86462
|
+
cb(null, Buffer2.concat(chunks));
|
|
86331
86463
|
});
|
|
86332
86464
|
return this;
|
|
86333
86465
|
};
|
|
@@ -86341,7 +86473,7 @@ var require_streams = __commonJS({
|
|
|
86341
86473
|
constructor: { value: IconvLiteDecoderStream }
|
|
86342
86474
|
});
|
|
86343
86475
|
IconvLiteDecoderStream.prototype._transform = function(chunk, encoding, done) {
|
|
86344
|
-
if (!
|
|
86476
|
+
if (!Buffer2.isBuffer(chunk) && !(chunk instanceof Uint8Array)) {
|
|
86345
86477
|
return done(new Error("Iconv decoding stream needs buffers as its input."));
|
|
86346
86478
|
}
|
|
86347
86479
|
try {
|
|
@@ -86384,7 +86516,7 @@ var require_streams = __commonJS({
|
|
|
86384
86516
|
var require_lib3 = __commonJS({
|
|
86385
86517
|
"../../node_modules/@inquirer/external-editor/node_modules/iconv-lite/lib/index.js"(exports2, module2) {
|
|
86386
86518
|
"use strict";
|
|
86387
|
-
var
|
|
86519
|
+
var Buffer2 = require_safer().Buffer;
|
|
86388
86520
|
var bomHandling = require_bom_handling();
|
|
86389
86521
|
var mergeModules = require_merge_exports();
|
|
86390
86522
|
module2.exports.encodings = null;
|
|
@@ -86395,7 +86527,7 @@ var require_lib3 = __commonJS({
|
|
|
86395
86527
|
var encoder = module2.exports.getEncoder(encoding, options);
|
|
86396
86528
|
var res = encoder.write(str);
|
|
86397
86529
|
var trail = encoder.end();
|
|
86398
|
-
return trail && trail.length > 0 ?
|
|
86530
|
+
return trail && trail.length > 0 ? Buffer2.concat([res, trail]) : res;
|
|
86399
86531
|
};
|
|
86400
86532
|
module2.exports.decode = function decode3(buf, encoding, options) {
|
|
86401
86533
|
if (typeof buf === "string") {
|
|
@@ -86403,7 +86535,7 @@ var require_lib3 = __commonJS({
|
|
|
86403
86535
|
console.error("Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding");
|
|
86404
86536
|
module2.exports.skipDecodeWarning = true;
|
|
86405
86537
|
}
|
|
86406
|
-
buf =
|
|
86538
|
+
buf = Buffer2.from("" + (buf || ""), "binary");
|
|
86407
86539
|
}
|
|
86408
86540
|
var decoder = module2.exports.getDecoder(encoding, options);
|
|
86409
86541
|
var res = decoder.write(buf);
|
|
@@ -87123,9 +87255,9 @@ var init_prompt = __esm({
|
|
|
87123
87255
|
init_utils();
|
|
87124
87256
|
init_baseUI();
|
|
87125
87257
|
_ = {
|
|
87126
|
-
set: (obj,
|
|
87258
|
+
set: (obj, path28 = "", value) => {
|
|
87127
87259
|
let pointer = obj;
|
|
87128
|
-
|
|
87260
|
+
path28.split(".").forEach((key, index, arr) => {
|
|
87129
87261
|
if (key === "__proto__" || key === "constructor") return;
|
|
87130
87262
|
if (index === arr.length - 1) {
|
|
87131
87263
|
pointer[key] = value;
|
|
@@ -87135,8 +87267,8 @@ var init_prompt = __esm({
|
|
|
87135
87267
|
pointer = pointer[key];
|
|
87136
87268
|
});
|
|
87137
87269
|
},
|
|
87138
|
-
get: (obj,
|
|
87139
|
-
const travel = (regexp) => String.prototype.split.call(
|
|
87270
|
+
get: (obj, path28 = "", defaultValue) => {
|
|
87271
|
+
const travel = (regexp) => String.prototype.split.call(path28, regexp).filter(Boolean).reduce(
|
|
87140
87272
|
// @ts-expect-error implicit any on res[key]
|
|
87141
87273
|
(res, key) => res !== null && res !== void 0 ? res[key] : res,
|
|
87142
87274
|
obj
|
|
@@ -87452,7 +87584,7 @@ var init_mjs = __esm({
|
|
|
87452
87584
|
"../../node_modules/signal-exit/dist/mjs/index.js"() {
|
|
87453
87585
|
"use strict";
|
|
87454
87586
|
init_signals();
|
|
87455
|
-
processOk = (
|
|
87587
|
+
processOk = (process13) => !!process13 && typeof process13 === "object" && typeof process13.removeListener === "function" && typeof process13.emit === "function" && typeof process13.reallyExit === "function" && typeof process13.listeners === "function" && typeof process13.kill === "function" && typeof process13.pid === "number" && typeof process13.on === "function";
|
|
87456
87588
|
kExitEmitter = /* @__PURE__ */ Symbol.for("signal-exit emitter");
|
|
87457
87589
|
global2 = globalThis;
|
|
87458
87590
|
ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
@@ -87545,15 +87677,15 @@ var init_mjs = __esm({
|
|
|
87545
87677
|
#originalProcessReallyExit;
|
|
87546
87678
|
#sigListeners = {};
|
|
87547
87679
|
#loaded = false;
|
|
87548
|
-
constructor(
|
|
87680
|
+
constructor(process13) {
|
|
87549
87681
|
super();
|
|
87550
|
-
this.#process =
|
|
87682
|
+
this.#process = process13;
|
|
87551
87683
|
this.#sigListeners = {};
|
|
87552
87684
|
for (const sig of signals) {
|
|
87553
87685
|
this.#sigListeners[sig] = () => {
|
|
87554
87686
|
const listeners = this.#process.listeners(sig);
|
|
87555
87687
|
let { count } = this.#emitter;
|
|
87556
|
-
const p =
|
|
87688
|
+
const p = process13;
|
|
87557
87689
|
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
|
|
87558
87690
|
count += p.__signal_exit_emitter__.count;
|
|
87559
87691
|
}
|
|
@@ -87562,12 +87694,12 @@ var init_mjs = __esm({
|
|
|
87562
87694
|
const ret = this.#emitter.emit("exit", null, sig);
|
|
87563
87695
|
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
87564
87696
|
if (!ret)
|
|
87565
|
-
|
|
87697
|
+
process13.kill(process13.pid, s);
|
|
87566
87698
|
}
|
|
87567
87699
|
};
|
|
87568
87700
|
}
|
|
87569
|
-
this.#originalProcessReallyExit =
|
|
87570
|
-
this.#originalProcessEmit =
|
|
87701
|
+
this.#originalProcessReallyExit = process13.reallyExit;
|
|
87702
|
+
this.#originalProcessEmit = process13.emit;
|
|
87571
87703
|
}
|
|
87572
87704
|
onExit(cb, opts) {
|
|
87573
87705
|
if (!processOk(this.#process)) {
|
|
@@ -88432,523 +88564,6 @@ init_daemon_p2p2();
|
|
|
88432
88564
|
init_source2();
|
|
88433
88565
|
init_lib();
|
|
88434
88566
|
init_ora();
|
|
88435
|
-
|
|
88436
|
-
// ../../node_modules/open/index.js
|
|
88437
|
-
var import_node_process15 = __toESM(require("process"), 1);
|
|
88438
|
-
var import_node_buffer = require("buffer");
|
|
88439
|
-
var import_node_path3 = __toESM(require("path"), 1);
|
|
88440
|
-
var import_node_url = require("url");
|
|
88441
|
-
var import_node_util5 = require("util");
|
|
88442
|
-
var import_node_child_process5 = __toESM(require("child_process"), 1);
|
|
88443
|
-
var import_promises5 = __toESM(require("fs/promises"), 1);
|
|
88444
|
-
|
|
88445
|
-
// ../../node_modules/wsl-utils/index.js
|
|
88446
|
-
var import_node_process11 = __toESM(require("process"), 1);
|
|
88447
|
-
var import_promises4 = __toESM(require("fs/promises"), 1);
|
|
88448
|
-
|
|
88449
|
-
// ../../node_modules/is-wsl/index.js
|
|
88450
|
-
var import_node_process10 = __toESM(require("process"), 1);
|
|
88451
|
-
var import_node_os5 = __toESM(require("os"), 1);
|
|
88452
|
-
var import_node_fs5 = __toESM(require("fs"), 1);
|
|
88453
|
-
|
|
88454
|
-
// ../../node_modules/is-inside-container/index.js
|
|
88455
|
-
var import_node_fs4 = __toESM(require("fs"), 1);
|
|
88456
|
-
|
|
88457
|
-
// ../../node_modules/is-docker/index.js
|
|
88458
|
-
var import_node_fs3 = __toESM(require("fs"), 1);
|
|
88459
|
-
var isDockerCached;
|
|
88460
|
-
function hasDockerEnv() {
|
|
88461
|
-
try {
|
|
88462
|
-
import_node_fs3.default.statSync("/.dockerenv");
|
|
88463
|
-
return true;
|
|
88464
|
-
} catch {
|
|
88465
|
-
return false;
|
|
88466
|
-
}
|
|
88467
|
-
}
|
|
88468
|
-
function hasDockerCGroup() {
|
|
88469
|
-
try {
|
|
88470
|
-
return import_node_fs3.default.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
|
|
88471
|
-
} catch {
|
|
88472
|
-
return false;
|
|
88473
|
-
}
|
|
88474
|
-
}
|
|
88475
|
-
function isDocker() {
|
|
88476
|
-
if (isDockerCached === void 0) {
|
|
88477
|
-
isDockerCached = hasDockerEnv() || hasDockerCGroup();
|
|
88478
|
-
}
|
|
88479
|
-
return isDockerCached;
|
|
88480
|
-
}
|
|
88481
|
-
|
|
88482
|
-
// ../../node_modules/is-inside-container/index.js
|
|
88483
|
-
var cachedResult;
|
|
88484
|
-
var hasContainerEnv = () => {
|
|
88485
|
-
try {
|
|
88486
|
-
import_node_fs4.default.statSync("/run/.containerenv");
|
|
88487
|
-
return true;
|
|
88488
|
-
} catch {
|
|
88489
|
-
return false;
|
|
88490
|
-
}
|
|
88491
|
-
};
|
|
88492
|
-
function isInsideContainer() {
|
|
88493
|
-
if (cachedResult === void 0) {
|
|
88494
|
-
cachedResult = hasContainerEnv() || isDocker();
|
|
88495
|
-
}
|
|
88496
|
-
return cachedResult;
|
|
88497
|
-
}
|
|
88498
|
-
|
|
88499
|
-
// ../../node_modules/is-wsl/index.js
|
|
88500
|
-
var isWsl = () => {
|
|
88501
|
-
if (import_node_process10.default.platform !== "linux") {
|
|
88502
|
-
return false;
|
|
88503
|
-
}
|
|
88504
|
-
if (import_node_os5.default.release().toLowerCase().includes("microsoft")) {
|
|
88505
|
-
if (isInsideContainer()) {
|
|
88506
|
-
return false;
|
|
88507
|
-
}
|
|
88508
|
-
return true;
|
|
88509
|
-
}
|
|
88510
|
-
try {
|
|
88511
|
-
if (import_node_fs5.default.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft")) {
|
|
88512
|
-
return !isInsideContainer();
|
|
88513
|
-
}
|
|
88514
|
-
} catch {
|
|
88515
|
-
}
|
|
88516
|
-
if (import_node_fs5.default.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || import_node_fs5.default.existsSync("/run/WSL")) {
|
|
88517
|
-
return !isInsideContainer();
|
|
88518
|
-
}
|
|
88519
|
-
return false;
|
|
88520
|
-
};
|
|
88521
|
-
var is_wsl_default = import_node_process10.default.env.__IS_WSL_TEST__ ? isWsl : isWsl();
|
|
88522
|
-
|
|
88523
|
-
// ../../node_modules/wsl-utils/index.js
|
|
88524
|
-
var wslDrivesMountPoint = /* @__PURE__ */ (() => {
|
|
88525
|
-
const defaultMountPoint = "/mnt/";
|
|
88526
|
-
let mountPoint;
|
|
88527
|
-
return async function() {
|
|
88528
|
-
if (mountPoint) {
|
|
88529
|
-
return mountPoint;
|
|
88530
|
-
}
|
|
88531
|
-
const configFilePath = "/etc/wsl.conf";
|
|
88532
|
-
let isConfigFileExists = false;
|
|
88533
|
-
try {
|
|
88534
|
-
await import_promises4.default.access(configFilePath, import_promises4.constants.F_OK);
|
|
88535
|
-
isConfigFileExists = true;
|
|
88536
|
-
} catch {
|
|
88537
|
-
}
|
|
88538
|
-
if (!isConfigFileExists) {
|
|
88539
|
-
return defaultMountPoint;
|
|
88540
|
-
}
|
|
88541
|
-
const configContent = await import_promises4.default.readFile(configFilePath, { encoding: "utf8" });
|
|
88542
|
-
const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
|
|
88543
|
-
if (!configMountPoint) {
|
|
88544
|
-
return defaultMountPoint;
|
|
88545
|
-
}
|
|
88546
|
-
mountPoint = configMountPoint.groups.mountPoint.trim();
|
|
88547
|
-
mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
|
|
88548
|
-
return mountPoint;
|
|
88549
|
-
};
|
|
88550
|
-
})();
|
|
88551
|
-
var powerShellPathFromWsl = async () => {
|
|
88552
|
-
const mountPoint = await wslDrivesMountPoint();
|
|
88553
|
-
return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
|
|
88554
|
-
};
|
|
88555
|
-
var powerShellPath = async () => {
|
|
88556
|
-
if (is_wsl_default) {
|
|
88557
|
-
return powerShellPathFromWsl();
|
|
88558
|
-
}
|
|
88559
|
-
return `${import_node_process11.default.env.SYSTEMROOT || import_node_process11.default.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
|
|
88560
|
-
};
|
|
88561
|
-
|
|
88562
|
-
// ../../node_modules/define-lazy-prop/index.js
|
|
88563
|
-
function defineLazyProperty(object2, propertyName, valueGetter) {
|
|
88564
|
-
const define = (value) => Object.defineProperty(object2, propertyName, { value, enumerable: true, writable: true });
|
|
88565
|
-
Object.defineProperty(object2, propertyName, {
|
|
88566
|
-
configurable: true,
|
|
88567
|
-
enumerable: true,
|
|
88568
|
-
get() {
|
|
88569
|
-
const result = valueGetter();
|
|
88570
|
-
define(result);
|
|
88571
|
-
return result;
|
|
88572
|
-
},
|
|
88573
|
-
set(value) {
|
|
88574
|
-
define(value);
|
|
88575
|
-
}
|
|
88576
|
-
});
|
|
88577
|
-
return object2;
|
|
88578
|
-
}
|
|
88579
|
-
|
|
88580
|
-
// ../../node_modules/default-browser/index.js
|
|
88581
|
-
var import_node_util4 = require("util");
|
|
88582
|
-
var import_node_process14 = __toESM(require("process"), 1);
|
|
88583
|
-
var import_node_child_process4 = require("child_process");
|
|
88584
|
-
|
|
88585
|
-
// ../../node_modules/default-browser-id/index.js
|
|
88586
|
-
var import_node_util = require("util");
|
|
88587
|
-
var import_node_process12 = __toESM(require("process"), 1);
|
|
88588
|
-
var import_node_child_process = require("child_process");
|
|
88589
|
-
var execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
|
|
88590
|
-
async function defaultBrowserId() {
|
|
88591
|
-
if (import_node_process12.default.platform !== "darwin") {
|
|
88592
|
-
throw new Error("macOS only");
|
|
88593
|
-
}
|
|
88594
|
-
const { stdout } = await execFileAsync("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
|
|
88595
|
-
const match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
|
|
88596
|
-
const browserId = match?.groups.id ?? "com.apple.Safari";
|
|
88597
|
-
if (browserId === "com.apple.safari") {
|
|
88598
|
-
return "com.apple.Safari";
|
|
88599
|
-
}
|
|
88600
|
-
return browserId;
|
|
88601
|
-
}
|
|
88602
|
-
|
|
88603
|
-
// ../../node_modules/run-applescript/index.js
|
|
88604
|
-
var import_node_process13 = __toESM(require("process"), 1);
|
|
88605
|
-
var import_node_util2 = require("util");
|
|
88606
|
-
var import_node_child_process2 = require("child_process");
|
|
88607
|
-
var execFileAsync2 = (0, import_node_util2.promisify)(import_node_child_process2.execFile);
|
|
88608
|
-
async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
|
|
88609
|
-
if (import_node_process13.default.platform !== "darwin") {
|
|
88610
|
-
throw new Error("macOS only");
|
|
88611
|
-
}
|
|
88612
|
-
const outputArguments = humanReadableOutput ? [] : ["-ss"];
|
|
88613
|
-
const execOptions = {};
|
|
88614
|
-
if (signal) {
|
|
88615
|
-
execOptions.signal = signal;
|
|
88616
|
-
}
|
|
88617
|
-
const { stdout } = await execFileAsync2("osascript", ["-e", script, outputArguments], execOptions);
|
|
88618
|
-
return stdout.trim();
|
|
88619
|
-
}
|
|
88620
|
-
|
|
88621
|
-
// ../../node_modules/bundle-name/index.js
|
|
88622
|
-
async function bundleName(bundleId) {
|
|
88623
|
-
return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string
|
|
88624
|
-
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
|
|
88625
|
-
}
|
|
88626
|
-
|
|
88627
|
-
// ../../node_modules/default-browser/windows.js
|
|
88628
|
-
var import_node_util3 = require("util");
|
|
88629
|
-
var import_node_child_process3 = require("child_process");
|
|
88630
|
-
var execFileAsync3 = (0, import_node_util3.promisify)(import_node_child_process3.execFile);
|
|
88631
|
-
var windowsBrowserProgIds = {
|
|
88632
|
-
MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
|
|
88633
|
-
// The missing `L` is correct.
|
|
88634
|
-
MSEdgeBHTML: { name: "Edge Beta", id: "com.microsoft.edge.beta" },
|
|
88635
|
-
MSEdgeDHTML: { name: "Edge Dev", id: "com.microsoft.edge.dev" },
|
|
88636
|
-
AppXq0fevzme2pys62n3e0fbqa7peapykr8v: { name: "Edge", id: "com.microsoft.edge.old" },
|
|
88637
|
-
ChromeHTML: { name: "Chrome", id: "com.google.chrome" },
|
|
88638
|
-
ChromeBHTML: { name: "Chrome Beta", id: "com.google.chrome.beta" },
|
|
88639
|
-
ChromeDHTML: { name: "Chrome Dev", id: "com.google.chrome.dev" },
|
|
88640
|
-
ChromiumHTM: { name: "Chromium", id: "org.chromium.Chromium" },
|
|
88641
|
-
BraveHTML: { name: "Brave", id: "com.brave.Browser" },
|
|
88642
|
-
BraveBHTML: { name: "Brave Beta", id: "com.brave.Browser.beta" },
|
|
88643
|
-
BraveDHTML: { name: "Brave Dev", id: "com.brave.Browser.dev" },
|
|
88644
|
-
BraveSSHTM: { name: "Brave Nightly", id: "com.brave.Browser.nightly" },
|
|
88645
|
-
FirefoxURL: { name: "Firefox", id: "org.mozilla.firefox" },
|
|
88646
|
-
OperaStable: { name: "Opera", id: "com.operasoftware.Opera" },
|
|
88647
|
-
VivaldiHTM: { name: "Vivaldi", id: "com.vivaldi.Vivaldi" },
|
|
88648
|
-
"IE.HTTP": { name: "Internet Explorer", id: "com.microsoft.ie" }
|
|
88649
|
-
};
|
|
88650
|
-
var _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
|
|
88651
|
-
var UnknownBrowserError = class extends Error {
|
|
88652
|
-
};
|
|
88653
|
-
async function defaultBrowser(_execFileAsync = execFileAsync3) {
|
|
88654
|
-
const { stdout } = await _execFileAsync("reg", [
|
|
88655
|
-
"QUERY",
|
|
88656
|
-
" HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
|
|
88657
|
-
"/v",
|
|
88658
|
-
"ProgId"
|
|
88659
|
-
]);
|
|
88660
|
-
const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
|
|
88661
|
-
if (!match) {
|
|
88662
|
-
throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
|
|
88663
|
-
}
|
|
88664
|
-
const { id } = match.groups;
|
|
88665
|
-
const dotIndex = id.lastIndexOf(".");
|
|
88666
|
-
const hyphenIndex = id.lastIndexOf("-");
|
|
88667
|
-
const baseIdByDot = dotIndex === -1 ? void 0 : id.slice(0, dotIndex);
|
|
88668
|
-
const baseIdByHyphen = hyphenIndex === -1 ? void 0 : id.slice(0, hyphenIndex);
|
|
88669
|
-
return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? { name: id, id };
|
|
88670
|
-
}
|
|
88671
|
-
|
|
88672
|
-
// ../../node_modules/default-browser/index.js
|
|
88673
|
-
var execFileAsync4 = (0, import_node_util4.promisify)(import_node_child_process4.execFile);
|
|
88674
|
-
var titleize = (string4) => string4.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
|
|
88675
|
-
async function defaultBrowser2() {
|
|
88676
|
-
if (import_node_process14.default.platform === "darwin") {
|
|
88677
|
-
const id = await defaultBrowserId();
|
|
88678
|
-
const name = await bundleName(id);
|
|
88679
|
-
return { name, id };
|
|
88680
|
-
}
|
|
88681
|
-
if (import_node_process14.default.platform === "linux") {
|
|
88682
|
-
const { stdout } = await execFileAsync4("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
|
|
88683
|
-
const id = stdout.trim();
|
|
88684
|
-
const name = titleize(id.replace(/.desktop$/, "").replace("-", " "));
|
|
88685
|
-
return { name, id };
|
|
88686
|
-
}
|
|
88687
|
-
if (import_node_process14.default.platform === "win32") {
|
|
88688
|
-
return defaultBrowser();
|
|
88689
|
-
}
|
|
88690
|
-
throw new Error("Only macOS, Linux, and Windows are supported");
|
|
88691
|
-
}
|
|
88692
|
-
|
|
88693
|
-
// ../../node_modules/open/index.js
|
|
88694
|
-
var import_meta = {};
|
|
88695
|
-
var execFile5 = (0, import_node_util5.promisify)(import_node_child_process5.default.execFile);
|
|
88696
|
-
var __dirname2 = import_node_path3.default.dirname((0, import_node_url.fileURLToPath)(import_meta.url));
|
|
88697
|
-
var localXdgOpenPath = import_node_path3.default.join(__dirname2, "xdg-open");
|
|
88698
|
-
var { platform: platform12, arch: arch3 } = import_node_process15.default;
|
|
88699
|
-
async function getWindowsDefaultBrowserFromWsl() {
|
|
88700
|
-
const powershellPath = await powerShellPath();
|
|
88701
|
-
const rawCommand = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
|
|
88702
|
-
const encodedCommand = import_node_buffer.Buffer.from(rawCommand, "utf16le").toString("base64");
|
|
88703
|
-
const { stdout } = await execFile5(
|
|
88704
|
-
powershellPath,
|
|
88705
|
-
[
|
|
88706
|
-
"-NoProfile",
|
|
88707
|
-
"-NonInteractive",
|
|
88708
|
-
"-ExecutionPolicy",
|
|
88709
|
-
"Bypass",
|
|
88710
|
-
"-EncodedCommand",
|
|
88711
|
-
encodedCommand
|
|
88712
|
-
],
|
|
88713
|
-
{ encoding: "utf8" }
|
|
88714
|
-
);
|
|
88715
|
-
const progId = stdout.trim();
|
|
88716
|
-
const browserMap = {
|
|
88717
|
-
ChromeHTML: "com.google.chrome",
|
|
88718
|
-
BraveHTML: "com.brave.Browser",
|
|
88719
|
-
MSEdgeHTM: "com.microsoft.edge",
|
|
88720
|
-
FirefoxURL: "org.mozilla.firefox"
|
|
88721
|
-
};
|
|
88722
|
-
return browserMap[progId] ? { id: browserMap[progId] } : {};
|
|
88723
|
-
}
|
|
88724
|
-
var pTryEach = async (array2, mapper) => {
|
|
88725
|
-
let latestError;
|
|
88726
|
-
for (const item of array2) {
|
|
88727
|
-
try {
|
|
88728
|
-
return await mapper(item);
|
|
88729
|
-
} catch (error48) {
|
|
88730
|
-
latestError = error48;
|
|
88731
|
-
}
|
|
88732
|
-
}
|
|
88733
|
-
throw latestError;
|
|
88734
|
-
};
|
|
88735
|
-
var baseOpen = async (options) => {
|
|
88736
|
-
options = {
|
|
88737
|
-
wait: false,
|
|
88738
|
-
background: false,
|
|
88739
|
-
newInstance: false,
|
|
88740
|
-
allowNonzeroExitCode: false,
|
|
88741
|
-
...options
|
|
88742
|
-
};
|
|
88743
|
-
if (Array.isArray(options.app)) {
|
|
88744
|
-
return pTryEach(options.app, (singleApp) => baseOpen({
|
|
88745
|
-
...options,
|
|
88746
|
-
app: singleApp
|
|
88747
|
-
}));
|
|
88748
|
-
}
|
|
88749
|
-
let { name: app, arguments: appArguments = [] } = options.app ?? {};
|
|
88750
|
-
appArguments = [...appArguments];
|
|
88751
|
-
if (Array.isArray(app)) {
|
|
88752
|
-
return pTryEach(app, (appName) => baseOpen({
|
|
88753
|
-
...options,
|
|
88754
|
-
app: {
|
|
88755
|
-
name: appName,
|
|
88756
|
-
arguments: appArguments
|
|
88757
|
-
}
|
|
88758
|
-
}));
|
|
88759
|
-
}
|
|
88760
|
-
if (app === "browser" || app === "browserPrivate") {
|
|
88761
|
-
const ids = {
|
|
88762
|
-
"com.google.chrome": "chrome",
|
|
88763
|
-
"google-chrome.desktop": "chrome",
|
|
88764
|
-
"com.brave.Browser": "brave",
|
|
88765
|
-
"org.mozilla.firefox": "firefox",
|
|
88766
|
-
"firefox.desktop": "firefox",
|
|
88767
|
-
"com.microsoft.msedge": "edge",
|
|
88768
|
-
"com.microsoft.edge": "edge",
|
|
88769
|
-
"com.microsoft.edgemac": "edge",
|
|
88770
|
-
"microsoft-edge.desktop": "edge"
|
|
88771
|
-
};
|
|
88772
|
-
const flags = {
|
|
88773
|
-
chrome: "--incognito",
|
|
88774
|
-
brave: "--incognito",
|
|
88775
|
-
firefox: "--private-window",
|
|
88776
|
-
edge: "--inPrivate"
|
|
88777
|
-
};
|
|
88778
|
-
const browser = is_wsl_default ? await getWindowsDefaultBrowserFromWsl() : await defaultBrowser2();
|
|
88779
|
-
if (browser.id in ids) {
|
|
88780
|
-
const browserName = ids[browser.id];
|
|
88781
|
-
if (app === "browserPrivate") {
|
|
88782
|
-
appArguments.push(flags[browserName]);
|
|
88783
|
-
}
|
|
88784
|
-
return baseOpen({
|
|
88785
|
-
...options,
|
|
88786
|
-
app: {
|
|
88787
|
-
name: apps[browserName],
|
|
88788
|
-
arguments: appArguments
|
|
88789
|
-
}
|
|
88790
|
-
});
|
|
88791
|
-
}
|
|
88792
|
-
throw new Error(`${browser.name} is not supported as a default browser`);
|
|
88793
|
-
}
|
|
88794
|
-
let command;
|
|
88795
|
-
const cliArguments = [];
|
|
88796
|
-
const childProcessOptions = {};
|
|
88797
|
-
if (platform12 === "darwin") {
|
|
88798
|
-
command = "open";
|
|
88799
|
-
if (options.wait) {
|
|
88800
|
-
cliArguments.push("--wait-apps");
|
|
88801
|
-
}
|
|
88802
|
-
if (options.background) {
|
|
88803
|
-
cliArguments.push("--background");
|
|
88804
|
-
}
|
|
88805
|
-
if (options.newInstance) {
|
|
88806
|
-
cliArguments.push("--new");
|
|
88807
|
-
}
|
|
88808
|
-
if (app) {
|
|
88809
|
-
cliArguments.push("-a", app);
|
|
88810
|
-
}
|
|
88811
|
-
} else if (platform12 === "win32" || is_wsl_default && !isInsideContainer() && !app) {
|
|
88812
|
-
command = await powerShellPath();
|
|
88813
|
-
cliArguments.push(
|
|
88814
|
-
"-NoProfile",
|
|
88815
|
-
"-NonInteractive",
|
|
88816
|
-
"-ExecutionPolicy",
|
|
88817
|
-
"Bypass",
|
|
88818
|
-
"-EncodedCommand"
|
|
88819
|
-
);
|
|
88820
|
-
if (!is_wsl_default) {
|
|
88821
|
-
childProcessOptions.windowsVerbatimArguments = true;
|
|
88822
|
-
}
|
|
88823
|
-
const encodedArguments = ["Start"];
|
|
88824
|
-
if (options.wait) {
|
|
88825
|
-
encodedArguments.push("-Wait");
|
|
88826
|
-
}
|
|
88827
|
-
if (app) {
|
|
88828
|
-
encodedArguments.push(`"\`"${app}\`""`);
|
|
88829
|
-
if (options.target) {
|
|
88830
|
-
appArguments.push(options.target);
|
|
88831
|
-
}
|
|
88832
|
-
} else if (options.target) {
|
|
88833
|
-
encodedArguments.push(`"${options.target}"`);
|
|
88834
|
-
}
|
|
88835
|
-
if (appArguments.length > 0) {
|
|
88836
|
-
appArguments = appArguments.map((argument) => `"\`"${argument}\`""`);
|
|
88837
|
-
encodedArguments.push("-ArgumentList", appArguments.join(","));
|
|
88838
|
-
}
|
|
88839
|
-
options.target = import_node_buffer.Buffer.from(encodedArguments.join(" "), "utf16le").toString("base64");
|
|
88840
|
-
} else {
|
|
88841
|
-
if (app) {
|
|
88842
|
-
command = app;
|
|
88843
|
-
} else {
|
|
88844
|
-
const isBundled = !__dirname2 || __dirname2 === "/";
|
|
88845
|
-
let exeLocalXdgOpen = false;
|
|
88846
|
-
try {
|
|
88847
|
-
await import_promises5.default.access(localXdgOpenPath, import_promises5.constants.X_OK);
|
|
88848
|
-
exeLocalXdgOpen = true;
|
|
88849
|
-
} catch {
|
|
88850
|
-
}
|
|
88851
|
-
const useSystemXdgOpen = import_node_process15.default.versions.electron ?? (platform12 === "android" || isBundled || !exeLocalXdgOpen);
|
|
88852
|
-
command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
|
|
88853
|
-
}
|
|
88854
|
-
if (appArguments.length > 0) {
|
|
88855
|
-
cliArguments.push(...appArguments);
|
|
88856
|
-
}
|
|
88857
|
-
if (!options.wait) {
|
|
88858
|
-
childProcessOptions.stdio = "ignore";
|
|
88859
|
-
childProcessOptions.detached = true;
|
|
88860
|
-
}
|
|
88861
|
-
}
|
|
88862
|
-
if (platform12 === "darwin" && appArguments.length > 0) {
|
|
88863
|
-
cliArguments.push("--args", ...appArguments);
|
|
88864
|
-
}
|
|
88865
|
-
if (options.target) {
|
|
88866
|
-
cliArguments.push(options.target);
|
|
88867
|
-
}
|
|
88868
|
-
const subprocess = import_node_child_process5.default.spawn(command, cliArguments, childProcessOptions);
|
|
88869
|
-
if (options.wait) {
|
|
88870
|
-
return new Promise((resolve16, reject) => {
|
|
88871
|
-
subprocess.once("error", reject);
|
|
88872
|
-
subprocess.once("close", (exitCode) => {
|
|
88873
|
-
if (!options.allowNonzeroExitCode && exitCode > 0) {
|
|
88874
|
-
reject(new Error(`Exited with code ${exitCode}`));
|
|
88875
|
-
return;
|
|
88876
|
-
}
|
|
88877
|
-
resolve16(subprocess);
|
|
88878
|
-
});
|
|
88879
|
-
});
|
|
88880
|
-
}
|
|
88881
|
-
subprocess.unref();
|
|
88882
|
-
return subprocess;
|
|
88883
|
-
};
|
|
88884
|
-
var open2 = (target, options) => {
|
|
88885
|
-
if (typeof target !== "string") {
|
|
88886
|
-
throw new TypeError("Expected a `target`");
|
|
88887
|
-
}
|
|
88888
|
-
return baseOpen({
|
|
88889
|
-
...options,
|
|
88890
|
-
target
|
|
88891
|
-
});
|
|
88892
|
-
};
|
|
88893
|
-
function detectArchBinary(binary) {
|
|
88894
|
-
if (typeof binary === "string" || Array.isArray(binary)) {
|
|
88895
|
-
return binary;
|
|
88896
|
-
}
|
|
88897
|
-
const { [arch3]: archBinary } = binary;
|
|
88898
|
-
if (!archBinary) {
|
|
88899
|
-
throw new Error(`${arch3} is not supported`);
|
|
88900
|
-
}
|
|
88901
|
-
return archBinary;
|
|
88902
|
-
}
|
|
88903
|
-
function detectPlatformBinary({ [platform12]: platformBinary }, { wsl }) {
|
|
88904
|
-
if (wsl && is_wsl_default) {
|
|
88905
|
-
return detectArchBinary(wsl);
|
|
88906
|
-
}
|
|
88907
|
-
if (!platformBinary) {
|
|
88908
|
-
throw new Error(`${platform12} is not supported`);
|
|
88909
|
-
}
|
|
88910
|
-
return detectArchBinary(platformBinary);
|
|
88911
|
-
}
|
|
88912
|
-
var apps = {};
|
|
88913
|
-
defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
|
|
88914
|
-
darwin: "google chrome",
|
|
88915
|
-
win32: "chrome",
|
|
88916
|
-
linux: ["google-chrome", "google-chrome-stable", "chromium"]
|
|
88917
|
-
}, {
|
|
88918
|
-
wsl: {
|
|
88919
|
-
ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
|
|
88920
|
-
x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
|
|
88921
|
-
}
|
|
88922
|
-
}));
|
|
88923
|
-
defineLazyProperty(apps, "brave", () => detectPlatformBinary({
|
|
88924
|
-
darwin: "brave browser",
|
|
88925
|
-
win32: "brave",
|
|
88926
|
-
linux: ["brave-browser", "brave"]
|
|
88927
|
-
}, {
|
|
88928
|
-
wsl: {
|
|
88929
|
-
ia32: "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",
|
|
88930
|
-
x64: ["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe", "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]
|
|
88931
|
-
}
|
|
88932
|
-
}));
|
|
88933
|
-
defineLazyProperty(apps, "firefox", () => detectPlatformBinary({
|
|
88934
|
-
darwin: "firefox",
|
|
88935
|
-
win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
|
|
88936
|
-
linux: "firefox"
|
|
88937
|
-
}, {
|
|
88938
|
-
wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
|
|
88939
|
-
}));
|
|
88940
|
-
defineLazyProperty(apps, "edge", () => detectPlatformBinary({
|
|
88941
|
-
darwin: "microsoft edge",
|
|
88942
|
-
win32: "msedge",
|
|
88943
|
-
linux: ["microsoft-edge", "microsoft-edge-dev"]
|
|
88944
|
-
}, {
|
|
88945
|
-
wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
|
|
88946
|
-
}));
|
|
88947
|
-
defineLazyProperty(apps, "browser", () => "browser");
|
|
88948
|
-
defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
|
|
88949
|
-
var open_default = open2;
|
|
88950
|
-
|
|
88951
|
-
// src/wizard.ts
|
|
88952
88567
|
init_src();
|
|
88953
88568
|
init_version();
|
|
88954
88569
|
var SERVER_URL = process.env.ADHDEV_SERVER_URL || "https://api.adhf.dev";
|
|
@@ -88959,6 +88574,10 @@ ${source_default2.cyan("\u2551")} ${source_default2.gray("Agent Dashboard Hub f
|
|
|
88959
88574
|
${source_default2.cyan("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")}
|
|
88960
88575
|
`;
|
|
88961
88576
|
var DIVIDER = source_default2.gray("\u2500".repeat(44));
|
|
88577
|
+
async function openBrowser(url2) {
|
|
88578
|
+
const mod = await import("open");
|
|
88579
|
+
return mod.default(url2);
|
|
88580
|
+
}
|
|
88962
88581
|
function hasCloudMachineAuth() {
|
|
88963
88582
|
const config2 = loadConfig();
|
|
88964
88583
|
return Boolean(config2.machineSecret && config2.machineSecret.trim());
|
|
@@ -89008,9 +88627,9 @@ async function runWizard(options = {}) {
|
|
|
89008
88627
|
}
|
|
89009
88628
|
async function checkForUpdate() {
|
|
89010
88629
|
try {
|
|
89011
|
-
const { execFileSync:
|
|
88630
|
+
const { execFileSync: execFileSync5 } = await import("child_process");
|
|
89012
88631
|
const currentVersion = resolvePackageVersion();
|
|
89013
|
-
const latestVersion = readLatestPublishedCliVersion(
|
|
88632
|
+
const latestVersion = readLatestPublishedCliVersion(execFileSync5);
|
|
89014
88633
|
if (!latestVersion) return;
|
|
89015
88634
|
if (!currentVersion || !latestVersion || currentVersion === latestVersion) return;
|
|
89016
88635
|
console.log(source_default2.yellow(` Update available: ${currentVersion} \u2192 ${latestVersion}`));
|
|
@@ -89027,7 +88646,7 @@ async function checkForUpdate() {
|
|
|
89027
88646
|
const spinner = (await Promise.resolve().then(() => (init_ora(), ora_exports))).default("Updating adhdev CLI...").start();
|
|
89028
88647
|
try {
|
|
89029
88648
|
const installCommand = buildPinnedGlobalInstallCommand({ packageName: "adhdev", targetVersion: "latest" });
|
|
89030
|
-
|
|
88649
|
+
execFileSync5(installCommand.command, installCommand.args, {
|
|
89031
88650
|
encoding: "utf-8",
|
|
89032
88651
|
timeout: 6e4,
|
|
89033
88652
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -89111,15 +88730,15 @@ async function loginFlow() {
|
|
|
89111
88730
|
let verificationUrl;
|
|
89112
88731
|
try {
|
|
89113
88732
|
const config2 = loadConfig();
|
|
89114
|
-
const
|
|
88733
|
+
const os28 = await import("os");
|
|
89115
88734
|
const res = await fetch(`${SERVER_URL}/auth/cli/init`, {
|
|
89116
88735
|
method: "POST",
|
|
89117
88736
|
headers: { "Content-Type": "application/json" },
|
|
89118
88737
|
body: JSON.stringify({
|
|
89119
88738
|
clientMachineId: config2.machineId,
|
|
89120
|
-
hostname:
|
|
89121
|
-
platform:
|
|
89122
|
-
arch:
|
|
88739
|
+
hostname: os28.hostname(),
|
|
88740
|
+
platform: os28.platform(),
|
|
88741
|
+
arch: os28.arch()
|
|
89123
88742
|
})
|
|
89124
88743
|
});
|
|
89125
88744
|
if (!res.ok) {
|
|
@@ -89143,7 +88762,7 @@ async function loginFlow() {
|
|
|
89143
88762
|
console.log(source_default2.gray(` Opening: ${verificationUrl}`));
|
|
89144
88763
|
console.log();
|
|
89145
88764
|
try {
|
|
89146
|
-
await
|
|
88765
|
+
await openBrowser(verificationUrl);
|
|
89147
88766
|
console.log(source_default2.green(" \u2713 Browser opened \u2014 please sign in and approve"));
|
|
89148
88767
|
} catch {
|
|
89149
88768
|
console.log(source_default2.yellow(` \u26A0 Could not open browser. Visit: ${verificationUrl}`));
|
|
@@ -89224,10 +88843,10 @@ async function startDaemonFlow() {
|
|
|
89224
88843
|
const { execSync: execSync7 } = await import("child_process");
|
|
89225
88844
|
const { getCurrentDaemonLogPath: getCurrentDaemonLogPath2 } = await Promise.resolve().then(() => (init_src(), src_exports));
|
|
89226
88845
|
const logPath = getCurrentDaemonLogPath2();
|
|
89227
|
-
const
|
|
89228
|
-
const
|
|
88846
|
+
const os28 = await import("os");
|
|
88847
|
+
const platform12 = os28.platform();
|
|
89229
88848
|
try {
|
|
89230
|
-
if (
|
|
88849
|
+
if (platform12 === "win32") {
|
|
89231
88850
|
execSync7("start /B adhdev daemon >NUL 2>&1", {
|
|
89232
88851
|
timeout: 3e3,
|
|
89233
88852
|
stdio: "ignore",
|