@atlasharness/atlascode 0.1.47 → 0.1.49
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.js +457 -284
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -55323,6 +55323,9 @@ function createSandboxManager(deps, backend) {
|
|
|
55323
55323
|
const allowedDomains = [
|
|
55324
55324
|
...s?.sandbox?.network?.allowedDomains || []
|
|
55325
55325
|
];
|
|
55326
|
+
const deniedDomains = [
|
|
55327
|
+
...s?.sandbox?.network?.deniedDomains || []
|
|
55328
|
+
];
|
|
55326
55329
|
const allowWrite = [".", deps.getAtlasTempDir()];
|
|
55327
55330
|
const denyWrite = [];
|
|
55328
55331
|
const denyRead = [];
|
|
@@ -55375,7 +55378,7 @@ function createSandboxManager(deps, backend) {
|
|
|
55375
55378
|
return {
|
|
55376
55379
|
network: {
|
|
55377
55380
|
allowedDomains,
|
|
55378
|
-
deniedDomains
|
|
55381
|
+
deniedDomains,
|
|
55379
55382
|
allowUnixSockets: s?.sandbox?.network?.allowUnixSockets,
|
|
55380
55383
|
allowAllUnixSockets: s?.sandbox?.network?.allowAllUnixSockets,
|
|
55381
55384
|
allowLocalBinding: s?.sandbox?.network?.allowLocalBinding,
|
|
@@ -55621,7 +55624,6 @@ var init_createSandboxManager = __esm(() => {
|
|
|
55621
55624
|
init_sandbox_backend();
|
|
55622
55625
|
init_ripgrep();
|
|
55623
55626
|
});
|
|
55624
|
-
|
|
55625
55627
|
// src/sandbox/index.ts
|
|
55626
55628
|
var init_sandbox = __esm(() => {
|
|
55627
55629
|
init_config4();
|
|
@@ -77967,7 +77969,7 @@ function createMcpConnectionManager() {
|
|
|
77967
77969
|
connections.set(name, conn);
|
|
77968
77970
|
return conn;
|
|
77969
77971
|
}
|
|
77970
|
-
async function connectStdio(name, config) {
|
|
77972
|
+
async function connectStdio(name, config, opts) {
|
|
77971
77973
|
const finalCommand = process.env.ATLAS_SHELL_PREFIX || config.command;
|
|
77972
77974
|
const finalArgs = process.env.ATLAS_SHELL_PREFIX ? [[config.command, ...config.args ?? []].join(" ")] : config.args ?? [];
|
|
77973
77975
|
const env = { ...process.env, ...config.env ?? {} };
|
|
@@ -78031,9 +78033,10 @@ function createMcpConnectionManager() {
|
|
|
78031
78033
|
},
|
|
78032
78034
|
clientInfo: { name: "atlascode", version: "0.0.1" }
|
|
78033
78035
|
});
|
|
78036
|
+
const budgetMs = opts?.connectionTimeoutMs ?? getConnectionTimeoutMs();
|
|
78034
78037
|
let timeoutId;
|
|
78035
78038
|
const timeoutPromise = new Promise((_, reject) => {
|
|
78036
|
-
timeoutId = setTimeout(() => reject(new Error(`MCP server "${name}" connection timed out after ${
|
|
78039
|
+
timeoutId = setTimeout(() => reject(new Error(`MCP server "${name}" connection timed out after ${budgetMs}ms`)), budgetMs);
|
|
78037
78040
|
});
|
|
78038
78041
|
initPromise.then(() => clearTimeout(timeoutId), () => clearTimeout(timeoutId));
|
|
78039
78042
|
try {
|
|
@@ -78072,7 +78075,7 @@ function createMcpConnectionManager() {
|
|
|
78072
78075
|
return fail(name, config, message);
|
|
78073
78076
|
}
|
|
78074
78077
|
}
|
|
78075
|
-
async function connect(name, config) {
|
|
78078
|
+
async function connect(name, config, opts) {
|
|
78076
78079
|
const existing = connections.get(name);
|
|
78077
78080
|
if (existing?.type === "connected")
|
|
78078
78081
|
return existing;
|
|
@@ -78082,7 +78085,7 @@ function createMcpConnectionManager() {
|
|
|
78082
78085
|
if (t === "sse" || t === "http" || t === "ws") {
|
|
78083
78086
|
return fail(name, config, `${t}: ${FORWARD_SEAM_MESSAGE}`);
|
|
78084
78087
|
}
|
|
78085
|
-
return await connectStdio(name, config);
|
|
78088
|
+
return await connectStdio(name, config, opts);
|
|
78086
78089
|
} finally {
|
|
78087
78090
|
pending.delete(name);
|
|
78088
78091
|
}
|
|
@@ -80596,7 +80599,7 @@ var init_autoCompactWindow = __esm(() => {
|
|
|
80596
80599
|
// src/engine/context/autoCompact.ts
|
|
80597
80600
|
import { randomUUID as randomUUID17 } from "crypto";
|
|
80598
80601
|
function resolveModelContextWindow(model) {
|
|
80599
|
-
return getProviderContextWindow(model) ??
|
|
80602
|
+
return getProviderContextWindow(model) ?? HARD_DEFAULT_CONTEXT_WINDOW;
|
|
80600
80603
|
}
|
|
80601
80604
|
function setAutoCompactSettingsSource(next) {
|
|
80602
80605
|
autoCompactSettingsSource = next;
|
|
@@ -80749,7 +80752,7 @@ async function autoCompactIfNeeded(messages, tracking, deps) {
|
|
|
80749
80752
|
};
|
|
80750
80753
|
}
|
|
80751
80754
|
}
|
|
80752
|
-
var AUTOCOMPACT_BUFFER_TOKENS = 13000, MAX_CONSECUTIVE_AUTOCOMPACT_FAILURES = 3,
|
|
80755
|
+
var AUTOCOMPACT_BUFFER_TOKENS = 13000, MAX_CONSECUTIVE_AUTOCOMPACT_FAILURES = 3, autoCompactSettingsSource = null, autoCompactWindowSettingsSource = null, WARNING_THRESHOLD_BUFFER_TOKENS = 20000, ERROR_THRESHOLD_BUFFER_TOKENS = 20000, MANUAL_COMPACT_BUFFER_TOKENS = 3000;
|
|
80753
80756
|
var init_autoCompact = __esm(() => {
|
|
80754
80757
|
init_modelprovider2();
|
|
80755
80758
|
init_config();
|
|
@@ -85125,7 +85128,8 @@ var init_hooksWiring = __esm(() => {
|
|
|
85125
85128
|
|
|
85126
85129
|
// src/cli/print.ts
|
|
85127
85130
|
import { randomUUID as randomUUID21 } from "crypto";
|
|
85128
|
-
import {
|
|
85131
|
+
import { readFile as readFile12 } from "node:fs/promises";
|
|
85132
|
+
import { join as join37, resolve as resolve14 } from "path";
|
|
85129
85133
|
function bridgeMcpToolClientLocal(client) {
|
|
85130
85134
|
return {
|
|
85131
85135
|
async callTool(toolName, args, _signal) {
|
|
@@ -85182,6 +85186,60 @@ function syncMcpClientRegistryLocal(manager) {
|
|
|
85182
85186
|
}
|
|
85183
85187
|
setMcpClientRegistry({ clients });
|
|
85184
85188
|
}
|
|
85189
|
+
function isMcpConnectionNonBlocking() {
|
|
85190
|
+
const v = (process.env.MCP_CONNECTION_NONBLOCKING ?? "").trim().toLowerCase();
|
|
85191
|
+
return v === "1" || v === "true" || v === "yes" || v === "on";
|
|
85192
|
+
}
|
|
85193
|
+
async function parseMcpConfigItemsLocal(items) {
|
|
85194
|
+
const out = {};
|
|
85195
|
+
for (const item of items) {
|
|
85196
|
+
const trimmed = item.trim();
|
|
85197
|
+
if (!trimmed)
|
|
85198
|
+
continue;
|
|
85199
|
+
let object = null;
|
|
85200
|
+
try {
|
|
85201
|
+
object = JSON.parse(trimmed);
|
|
85202
|
+
} catch {
|
|
85203
|
+
try {
|
|
85204
|
+
const raw = await readFile12(resolve14(trimmed), "utf8");
|
|
85205
|
+
object = JSON.parse(raw);
|
|
85206
|
+
} catch {
|
|
85207
|
+
object = null;
|
|
85208
|
+
}
|
|
85209
|
+
}
|
|
85210
|
+
const record = object?.mcpServers;
|
|
85211
|
+
if (record && typeof record === "object") {
|
|
85212
|
+
for (const [name, serverConfig] of Object.entries(record)) {
|
|
85213
|
+
out[name] = serverConfig;
|
|
85214
|
+
}
|
|
85215
|
+
}
|
|
85216
|
+
}
|
|
85217
|
+
return out;
|
|
85218
|
+
}
|
|
85219
|
+
async function connectMcpStartup(args) {
|
|
85220
|
+
const { manager, discoveryInput, mcpConfig, strictMcpConfig } = args;
|
|
85221
|
+
const baseConfigs = await buildMcpServerConfigs(discoveryInput);
|
|
85222
|
+
const dynamicConfigs = mcpConfig?.length ? await buildMcpServerConfigs({
|
|
85223
|
+
settingsServers: await parseMcpConfigItemsLocal(mcpConfig),
|
|
85224
|
+
projectMcpJsonPath: null
|
|
85225
|
+
}) : {};
|
|
85226
|
+
const dynamicNames = new Set(Object.keys(dynamicConfigs));
|
|
85227
|
+
const allConfigs = strictMcpConfig ? dynamicConfigs : { ...baseConfigs, ...dynamicConfigs };
|
|
85228
|
+
const connectAll = () => Promise.allSettled(Object.entries(allConfigs).map(([name, config]) => manager.connect(name, config, dynamicNames.has(name) ? { connectionTimeoutMs: 5000 } : undefined)));
|
|
85229
|
+
const nonBlocking = isMcpConnectionNonBlocking();
|
|
85230
|
+
if (nonBlocking) {
|
|
85231
|
+
connectAll();
|
|
85232
|
+
logForDebugging2(`[headless] mcp: non-blocking (MCP_CONNECTION_NONBLOCKING), ${String(Object.keys(allConfigs).length)} server(s) connecting in background`);
|
|
85233
|
+
} else {
|
|
85234
|
+
const mcpResults = await connectAll();
|
|
85235
|
+
const mcpOk = mcpResults.filter((r) => r.status === "fulfilled").length;
|
|
85236
|
+
logForDebugging2(mcpConnectLine(mcpOk, mcpResults.length - mcpOk));
|
|
85237
|
+
}
|
|
85238
|
+
const mcpConnections = await buildMcpEngineConnectionsLocal(manager);
|
|
85239
|
+
const mcpTools = createMcpTools(mcpConnections);
|
|
85240
|
+
syncMcpClientRegistryLocal(manager);
|
|
85241
|
+
return { mcpConnections, mcpTools, nonBlocking };
|
|
85242
|
+
}
|
|
85185
85243
|
function validateUuidLocal(value) {
|
|
85186
85244
|
return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
|
|
85187
85245
|
}
|
|
@@ -85332,13 +85390,12 @@ async function runHeadless(inputPrompt, options) {
|
|
|
85332
85390
|
settingsServers: settings.settings.mcpServers,
|
|
85333
85391
|
projectMcpJsonPath: join37(process.cwd(), ".mcp.json")
|
|
85334
85392
|
};
|
|
85335
|
-
const
|
|
85336
|
-
|
|
85337
|
-
|
|
85338
|
-
|
|
85339
|
-
|
|
85340
|
-
|
|
85341
|
-
syncMcpClientRegistryLocal(mcpManager);
|
|
85393
|
+
const { mcpTools } = await connectMcpStartup({
|
|
85394
|
+
manager: mcpManager,
|
|
85395
|
+
discoveryInput,
|
|
85396
|
+
mcpConfig: options.mcpConfig,
|
|
85397
|
+
strictMcpConfig: options.strictMcpConfig
|
|
85398
|
+
});
|
|
85342
85399
|
const hasPromptRoute = options.permissionPromptToolName === "stdio";
|
|
85343
85400
|
const role = options.model ? modelToRole(options.model) : "premium";
|
|
85344
85401
|
const roleModel = getRoleModel(role);
|
|
@@ -86627,7 +86684,7 @@ var init_autoMode2 = __esm(() => {
|
|
|
86627
86684
|
|
|
86628
86685
|
// src/cli/parse.ts
|
|
86629
86686
|
import { existsSync as existsSync8, readFileSync as readFileSync11, realpathSync as realpathSync6 } from "fs";
|
|
86630
|
-
import { dirname as dirname21, join as join40, resolve as
|
|
86687
|
+
import { dirname as dirname21, join as join40, resolve as resolve15 } from "path";
|
|
86631
86688
|
function resolveCliVersion(startDir) {
|
|
86632
86689
|
let dir;
|
|
86633
86690
|
try {
|
|
@@ -86670,11 +86727,11 @@ function readPromptFileInline(inline, file, label) {
|
|
|
86670
86727
|
process.exit(1);
|
|
86671
86728
|
}
|
|
86672
86729
|
try {
|
|
86673
|
-
return readFileSync11(
|
|
86730
|
+
return readFileSync11(resolve15(file), "utf8");
|
|
86674
86731
|
} catch (error) {
|
|
86675
86732
|
const code = error.code;
|
|
86676
86733
|
if (code === "ENOENT") {
|
|
86677
|
-
process.stderr.write(`Error: ${label} file not found: ${
|
|
86734
|
+
process.stderr.write(`Error: ${label} file not found: ${resolve15(file)}
|
|
86678
86735
|
`);
|
|
86679
86736
|
} else {
|
|
86680
86737
|
process.stderr.write(`Error reading ${label} file: ${error.message}
|
|
@@ -86739,7 +86796,9 @@ function buildHeadlessOptions(options) {
|
|
|
86739
86796
|
appendSystemPrompt: readPromptFileInline(options.appendSystemPrompt, options.appendSystemPromptFile, "Append system prompt"),
|
|
86740
86797
|
fallbackModel: options.fallbackModel,
|
|
86741
86798
|
thinkingConfig: buildHeadlessThinkingConfig(options.thinking, options.maxThinkingTokens),
|
|
86742
|
-
effort: options.effort
|
|
86799
|
+
effort: options.effort,
|
|
86800
|
+
mcpConfig: options.mcpConfig,
|
|
86801
|
+
strictMcpConfig: options.strictMcpConfig === true ? true : undefined
|
|
86743
86802
|
};
|
|
86744
86803
|
}
|
|
86745
86804
|
async function mainActionSeam(prompt, options) {
|
|
@@ -98076,11 +98135,11 @@ var init_execFileNoThrow2 = __esm(() => {
|
|
|
98076
98135
|
});
|
|
98077
98136
|
|
|
98078
98137
|
// src/tui/utils/git/gitConfigParser.ts
|
|
98079
|
-
import { readFile as
|
|
98138
|
+
import { readFile as readFile15 } from "fs/promises";
|
|
98080
98139
|
import { join as join46 } from "path";
|
|
98081
98140
|
async function parseGitConfigValue2(gitDir, section, subsection, key) {
|
|
98082
98141
|
try {
|
|
98083
|
-
const config = await
|
|
98142
|
+
const config = await readFile15(join46(gitDir, "config"), "utf-8");
|
|
98084
98143
|
return parseConfigString2(config, section, subsection, key);
|
|
98085
98144
|
} catch {
|
|
98086
98145
|
return null;
|
|
@@ -98246,13 +98305,13 @@ var init_gitConfigParser = () => {};
|
|
|
98246
98305
|
|
|
98247
98306
|
// src/tui/utils/git/gitFilesystem.ts
|
|
98248
98307
|
import { unwatchFile, watchFile } from "fs";
|
|
98249
|
-
import { readdir as readdir7, readFile as
|
|
98250
|
-
import { join as join47, resolve as
|
|
98308
|
+
import { readdir as readdir7, readFile as readFile16, stat as stat13 } from "fs/promises";
|
|
98309
|
+
import { join as join47, resolve as resolve16 } from "path";
|
|
98251
98310
|
function clearResolveGitDirCache() {
|
|
98252
98311
|
resolveGitDirCache2.clear();
|
|
98253
98312
|
}
|
|
98254
98313
|
async function resolveGitDir2(startPath) {
|
|
98255
|
-
const cwd =
|
|
98314
|
+
const cwd = resolve16(startPath ?? getCwd());
|
|
98256
98315
|
const cached = resolveGitDirCache2.get(cwd);
|
|
98257
98316
|
if (cached !== undefined) {
|
|
98258
98317
|
return cached;
|
|
@@ -98266,10 +98325,10 @@ async function resolveGitDir2(startPath) {
|
|
|
98266
98325
|
try {
|
|
98267
98326
|
const st = await stat13(gitPath);
|
|
98268
98327
|
if (st.isFile()) {
|
|
98269
|
-
const content = (await
|
|
98328
|
+
const content = (await readFile16(gitPath, "utf-8")).trim();
|
|
98270
98329
|
if (content.startsWith("gitdir:")) {
|
|
98271
98330
|
const rawDir = content.slice("gitdir:".length).trim();
|
|
98272
|
-
const resolved =
|
|
98331
|
+
const resolved = resolve16(root, rawDir);
|
|
98273
98332
|
resolveGitDirCache2.set(cwd, resolved);
|
|
98274
98333
|
return resolved;
|
|
98275
98334
|
}
|
|
@@ -98301,7 +98360,7 @@ function isValidGitSha2(s) {
|
|
|
98301
98360
|
}
|
|
98302
98361
|
async function readGitHead2(gitDir) {
|
|
98303
98362
|
try {
|
|
98304
|
-
const content = (await
|
|
98363
|
+
const content = (await readFile16(join47(gitDir, "HEAD"), "utf-8")).trim();
|
|
98305
98364
|
if (content.startsWith("ref:")) {
|
|
98306
98365
|
const ref = content.slice("ref:".length).trim();
|
|
98307
98366
|
if (ref.startsWith("refs/heads/")) {
|
|
@@ -98338,7 +98397,7 @@ async function resolveRef2(gitDir, ref) {
|
|
|
98338
98397
|
}
|
|
98339
98398
|
async function resolveRefInDir2(dir, ref) {
|
|
98340
98399
|
try {
|
|
98341
|
-
const content = (await
|
|
98400
|
+
const content = (await readFile16(join47(dir, ref), "utf-8")).trim();
|
|
98342
98401
|
if (content.startsWith("ref:")) {
|
|
98343
98402
|
const target = content.slice("ref:".length).trim();
|
|
98344
98403
|
if (!isSafeRefName2(target)) {
|
|
@@ -98352,7 +98411,7 @@ async function resolveRefInDir2(dir, ref) {
|
|
|
98352
98411
|
return content;
|
|
98353
98412
|
} catch {}
|
|
98354
98413
|
try {
|
|
98355
|
-
const packed = await
|
|
98414
|
+
const packed = await readFile16(join47(dir, "packed-refs"), "utf-8");
|
|
98356
98415
|
for (const line of packed.split(`
|
|
98357
98416
|
`)) {
|
|
98358
98417
|
if (line.startsWith("#") || line.startsWith("^")) {
|
|
@@ -98372,15 +98431,15 @@ async function resolveRefInDir2(dir, ref) {
|
|
|
98372
98431
|
}
|
|
98373
98432
|
async function getCommonDir2(gitDir) {
|
|
98374
98433
|
try {
|
|
98375
|
-
const content = (await
|
|
98376
|
-
return
|
|
98434
|
+
const content = (await readFile16(join47(gitDir, "commondir"), "utf-8")).trim();
|
|
98435
|
+
return resolve16(gitDir, content);
|
|
98377
98436
|
} catch {
|
|
98378
98437
|
return null;
|
|
98379
98438
|
}
|
|
98380
98439
|
}
|
|
98381
98440
|
async function readRawSymref2(gitDir, refPath, branchPrefix) {
|
|
98382
98441
|
try {
|
|
98383
|
-
const content = (await
|
|
98442
|
+
const content = (await readFile16(join47(gitDir, refPath), "utf-8")).trim();
|
|
98384
98443
|
if (content.startsWith("ref:")) {
|
|
98385
98444
|
const target = content.slice("ref:".length).trim();
|
|
98386
98445
|
if (target.startsWith(branchPrefix)) {
|
|
@@ -98589,11 +98648,11 @@ async function getHeadForDir(cwd) {
|
|
|
98589
98648
|
async function readWorktreeHeadSha2(worktreePath) {
|
|
98590
98649
|
let gitDir;
|
|
98591
98650
|
try {
|
|
98592
|
-
const ptr = (await
|
|
98651
|
+
const ptr = (await readFile16(join47(worktreePath, ".git"), "utf-8")).trim();
|
|
98593
98652
|
if (!ptr.startsWith("gitdir:")) {
|
|
98594
98653
|
return null;
|
|
98595
98654
|
}
|
|
98596
|
-
gitDir =
|
|
98655
|
+
gitDir = resolve16(worktreePath, ptr.slice("gitdir:".length).trim());
|
|
98597
98656
|
} catch {
|
|
98598
98657
|
return null;
|
|
98599
98658
|
}
|
|
@@ -99446,7 +99505,7 @@ var init_gitAvailability = __esm(() => {
|
|
|
99446
99505
|
|
|
99447
99506
|
// src/tui/utils/git.ts
|
|
99448
99507
|
import { readFileSync as readFileSync14, realpathSync as realpathSync7, statSync as statSync7 } from "fs";
|
|
99449
|
-
import { basename as basename9, dirname as dirname25, join as join49, resolve as
|
|
99508
|
+
import { basename as basename9, dirname as dirname25, join as join49, resolve as resolve17, sep as sep7 } from "path";
|
|
99450
99509
|
function createFindGitRoot() {
|
|
99451
99510
|
function wrapper(startPath) {
|
|
99452
99511
|
const result = findGitRootImpl2(startPath);
|
|
@@ -99582,7 +99641,7 @@ var init_git2 = __esm(() => {
|
|
|
99582
99641
|
logForDiagnosticsNoPII("info", "find_git_root_started");
|
|
99583
99642
|
if (typeof startPath !== "string")
|
|
99584
99643
|
startPath = String(startPath || "/tmp");
|
|
99585
|
-
let current =
|
|
99644
|
+
let current = resolve17(startPath);
|
|
99586
99645
|
const root = current.substring(0, current.indexOf(sep7) + 1) || sep7;
|
|
99587
99646
|
let statCount = 0;
|
|
99588
99647
|
while (current !== root) {
|
|
@@ -99632,9 +99691,9 @@ var init_git2 = __esm(() => {
|
|
|
99632
99691
|
if (!gitContent.startsWith("gitdir:")) {
|
|
99633
99692
|
return gitRoot;
|
|
99634
99693
|
}
|
|
99635
|
-
const worktreeGitDir =
|
|
99636
|
-
const commonDir =
|
|
99637
|
-
if (
|
|
99694
|
+
const worktreeGitDir = resolve17(gitRoot, gitContent.slice("gitdir:".length).trim());
|
|
99695
|
+
const commonDir = resolve17(worktreeGitDir, readFileSync14(join49(worktreeGitDir, "commondir"), "utf-8").trim());
|
|
99696
|
+
if (resolve17(dirname25(worktreeGitDir)) !== join49(commonDir, "worktrees")) {
|
|
99638
99697
|
return gitRoot;
|
|
99639
99698
|
}
|
|
99640
99699
|
const backlink = realpathSync7(readFileSync14(join49(worktreeGitDir, "gitdir"), "utf-8").trim());
|
|
@@ -99666,7 +99725,7 @@ var init_git2 = __esm(() => {
|
|
|
99666
99725
|
});
|
|
99667
99726
|
|
|
99668
99727
|
// src/tui/utils/platform.ts
|
|
99669
|
-
import { readdir as readdir8, readFile as
|
|
99728
|
+
import { readdir as readdir8, readFile as readFile17 } from "fs/promises";
|
|
99670
99729
|
import { release as osRelease } from "os";
|
|
99671
99730
|
var SUPPORTED_PLATFORMS2, getPlatform3, getWslVersion, getLinuxDistroInfo;
|
|
99672
99731
|
var init_platform3 = __esm(() => {
|
|
@@ -99728,7 +99787,7 @@ var init_platform3 = __esm(() => {
|
|
|
99728
99787
|
linuxKernel: osRelease()
|
|
99729
99788
|
};
|
|
99730
99789
|
try {
|
|
99731
|
-
const content = await
|
|
99790
|
+
const content = await readFile17("/etc/os-release", "utf8");
|
|
99732
99791
|
for (const line of content.split(`
|
|
99733
99792
|
`)) {
|
|
99734
99793
|
const match = line.match(/^(ID|VERSION_ID)=(.*)$/);
|
|
@@ -100176,7 +100235,7 @@ var init_sessionStoragePortable = __esm(() => {
|
|
|
100176
100235
|
|
|
100177
100236
|
// src/tui/utils/path.ts
|
|
100178
100237
|
import { homedir as homedir17 } from "os";
|
|
100179
|
-
import { dirname as dirname27, isAbsolute as isAbsolute11, join as join51, normalize as normalize3, relative as relative5, resolve as
|
|
100238
|
+
import { dirname as dirname27, isAbsolute as isAbsolute11, join as join51, normalize as normalize3, relative as relative5, resolve as resolve19 } from "path";
|
|
100180
100239
|
function expandPath2(path, baseDir) {
|
|
100181
100240
|
const actualBaseDir = baseDir ?? getCwd() ?? getFsImplementation2().cwd();
|
|
100182
100241
|
if (typeof path !== "string") {
|
|
@@ -100209,7 +100268,7 @@ function expandPath2(path, baseDir) {
|
|
|
100209
100268
|
if (isAbsolute11(processedPath)) {
|
|
100210
100269
|
return normalize3(processedPath).normalize("NFC");
|
|
100211
100270
|
}
|
|
100212
|
-
return
|
|
100271
|
+
return resolve19(actualBaseDir, processedPath).normalize("NFC");
|
|
100213
100272
|
}
|
|
100214
100273
|
function toRelativePath2(absolutePath) {
|
|
100215
100274
|
const relativePath = relative5(getCwd(), absolutePath);
|
|
@@ -119178,7 +119237,7 @@ function stripBOM2(content) {
|
|
|
119178
119237
|
var UTF8_BOM = "\uFEFF";
|
|
119179
119238
|
|
|
119180
119239
|
// src/tui/utils/json.ts
|
|
119181
|
-
import { open as open6, readFile as
|
|
119240
|
+
import { open as open6, readFile as readFile18, stat as stat15 } from "fs/promises";
|
|
119182
119241
|
function parseJSONUncached(json, shouldLogError) {
|
|
119183
119242
|
try {
|
|
119184
119243
|
return { ok: true, value: JSON.parse(stripBOM2(json)) };
|
|
@@ -119280,7 +119339,7 @@ async function readJSONLFile(filePath) {
|
|
|
119280
119339
|
try {
|
|
119281
119340
|
const { size } = await stat15(filePath);
|
|
119282
119341
|
if (size <= MAX_JSONL_READ_BYTES) {
|
|
119283
|
-
return parseJSONL2(await
|
|
119342
|
+
return parseJSONL2(await readFile18(filePath));
|
|
119284
119343
|
}
|
|
119285
119344
|
const fd = __using(__stack, await open6(filePath, "r"), 1);
|
|
119286
119345
|
const buf = Buffer.allocUnsafe(MAX_JSONL_READ_BYTES);
|
|
@@ -120942,7 +121001,7 @@ __export(exports_teamMemPaths, {
|
|
|
120942
121001
|
isTeamMemPath: () => isTeamMemPath,
|
|
120943
121002
|
isTeamMemoryEnabled: () => isTeamMemoryEnabled
|
|
120944
121003
|
});
|
|
120945
|
-
import { dirname as dirname28, join as join55, resolve as
|
|
121004
|
+
import { dirname as dirname28, join as join55, resolve as resolve20, sep as sep10 } from "path";
|
|
120946
121005
|
function isTeamMemoryEnabled() {
|
|
120947
121006
|
if (!isAutoMemoryEnabled2()) {
|
|
120948
121007
|
return false;
|
|
@@ -120956,7 +121015,7 @@ function getTeamMemEntrypoint() {
|
|
|
120956
121015
|
return join55(getAutoMemPath2(), "team", "MEMORY.md");
|
|
120957
121016
|
}
|
|
120958
121017
|
function isTeamMemPath(filePath) {
|
|
120959
|
-
const resolvedPath =
|
|
121018
|
+
const resolvedPath = resolve20(filePath);
|
|
120960
121019
|
const teamDir = getTeamMemPath();
|
|
120961
121020
|
return resolvedPath.startsWith(teamDir);
|
|
120962
121021
|
}
|
|
@@ -120972,7 +121031,7 @@ var init_teamMemPaths = __esm(() => {
|
|
|
120972
121031
|
// src/tui/utils/config.ts
|
|
120973
121032
|
import { randomBytes as randomBytes5 } from "crypto";
|
|
120974
121033
|
import { unwatchFile as unwatchFile2, watchFile as watchFile2 } from "fs";
|
|
120975
|
-
import { basename as basename10, dirname as dirname29, join as join56, resolve as
|
|
121034
|
+
import { basename as basename10, dirname as dirname29, join as join56, resolve as resolve21 } from "path";
|
|
120976
121035
|
function createDefaultGlobalConfig() {
|
|
120977
121036
|
return {
|
|
120978
121037
|
numStartups: 0,
|
|
@@ -121031,7 +121090,7 @@ function computeTrustDialogAccepted() {
|
|
|
121031
121090
|
if (pathConfig?.hasTrustDialogAccepted) {
|
|
121032
121091
|
return true;
|
|
121033
121092
|
}
|
|
121034
|
-
const parentPath = normalizePathForConfigKey(
|
|
121093
|
+
const parentPath = normalizePathForConfigKey(resolve21(currentPath, ".."));
|
|
121035
121094
|
if (parentPath === currentPath) {
|
|
121036
121095
|
break;
|
|
121037
121096
|
}
|
|
@@ -121656,7 +121715,7 @@ var init_config6 = __esm(() => {
|
|
|
121656
121715
|
if (gitRoot) {
|
|
121657
121716
|
return normalizePathForConfigKey(gitRoot);
|
|
121658
121717
|
}
|
|
121659
|
-
return normalizePathForConfigKey(
|
|
121718
|
+
return normalizePathForConfigKey(resolve21(originalCwd));
|
|
121660
121719
|
});
|
|
121661
121720
|
});
|
|
121662
121721
|
|
|
@@ -121904,7 +121963,7 @@ import {
|
|
|
121904
121963
|
join as join57,
|
|
121905
121964
|
normalize as normalize5,
|
|
121906
121965
|
relative as relative6,
|
|
121907
|
-
resolve as
|
|
121966
|
+
resolve as resolve22,
|
|
121908
121967
|
sep as sep11
|
|
121909
121968
|
} from "path";
|
|
121910
121969
|
async function pathExists2(path) {
|
|
@@ -122064,7 +122123,7 @@ function writeFileSyncAndFlush_DEPRECATED2(filePath, content, options = { encodi
|
|
|
122064
122123
|
let targetPath = filePath;
|
|
122065
122124
|
try {
|
|
122066
122125
|
const linkTarget = fs.readlinkSync(filePath);
|
|
122067
|
-
targetPath = isAbsolute13(linkTarget) ? linkTarget :
|
|
122126
|
+
targetPath = isAbsolute13(linkTarget) ? linkTarget : resolve22(dirname30(filePath), linkTarget);
|
|
122068
122127
|
logForDebugging3(`Writing through symlink: ${filePath} -> ${targetPath}`);
|
|
122069
122128
|
} catch {}
|
|
122070
122129
|
const tempPath = `${targetPath}.tmp.${process.pid}.${Date.now()}`;
|
|
@@ -122198,7 +122257,7 @@ var init_file = __esm(() => {
|
|
|
122198
122257
|
});
|
|
122199
122258
|
|
|
122200
122259
|
// src/tui/utils/git/gitignore.ts
|
|
122201
|
-
import { appendFile as appendFile2, mkdir as mkdir14, readFile as
|
|
122260
|
+
import { appendFile as appendFile2, mkdir as mkdir14, readFile as readFile19, writeFile as writeFile10 } from "fs/promises";
|
|
122202
122261
|
import { homedir as homedir21 } from "os";
|
|
122203
122262
|
import { dirname as dirname31, join as join58 } from "path";
|
|
122204
122263
|
async function isPathGitignored2(filePath, cwd) {
|
|
@@ -122225,7 +122284,7 @@ async function addFileGlobRuleToGitignore(filename, cwd = getCwd()) {
|
|
|
122225
122284
|
const configGitDir = dirname31(globalGitignorePath);
|
|
122226
122285
|
await mkdir14(configGitDir, { recursive: true });
|
|
122227
122286
|
try {
|
|
122228
|
-
const content = await
|
|
122287
|
+
const content = await readFile19(globalGitignorePath, { encoding: "utf-8" });
|
|
122229
122288
|
if (content.includes(gitignoreEntry)) {
|
|
122230
122289
|
return;
|
|
122231
122290
|
}
|
|
@@ -123454,7 +123513,7 @@ var init_settingsCache2 = __esm(() => {
|
|
|
123454
123513
|
});
|
|
123455
123514
|
|
|
123456
123515
|
// src/tui/utils/settings/settings.ts
|
|
123457
|
-
import { dirname as dirname32, join as join60, resolve as
|
|
123516
|
+
import { dirname as dirname32, join as join60, resolve as resolve23 } from "path";
|
|
123458
123517
|
function getManagedSettingsFilePath2() {
|
|
123459
123518
|
return join60(getManagedFilePath(), "managed-settings.json");
|
|
123460
123519
|
}
|
|
@@ -123542,15 +123601,15 @@ function parseSettingsFileUncached2(path) {
|
|
|
123542
123601
|
function getSettingsRootPathForSource2(source) {
|
|
123543
123602
|
switch (source) {
|
|
123544
123603
|
case "userSettings":
|
|
123545
|
-
return
|
|
123604
|
+
return resolve23(getAtlasConfigHomeDir3());
|
|
123546
123605
|
case "policySettings":
|
|
123547
123606
|
case "projectSettings":
|
|
123548
123607
|
case "localSettings": {
|
|
123549
|
-
return
|
|
123608
|
+
return resolve23(getOriginalCwd());
|
|
123550
123609
|
}
|
|
123551
123610
|
case "flagSettings": {
|
|
123552
123611
|
const path = getFlagSettingsPath();
|
|
123553
|
-
return path ? dirname32(
|
|
123612
|
+
return path ? dirname32(resolve23(path)) : resolve23(getOriginalCwd());
|
|
123554
123613
|
}
|
|
123555
123614
|
}
|
|
123556
123615
|
}
|
|
@@ -123831,7 +123890,7 @@ function loadSettingsFromDisk2() {
|
|
|
123831
123890
|
}
|
|
123832
123891
|
const filePath = getSettingsFilePathForSource2(source);
|
|
123833
123892
|
if (filePath) {
|
|
123834
|
-
const resolvedPath =
|
|
123893
|
+
const resolvedPath = resolve23(filePath);
|
|
123835
123894
|
if (!seenFiles.has(resolvedPath)) {
|
|
123836
123895
|
seenFiles.add(resolvedPath);
|
|
123837
123896
|
const { settings, errors } = parseSettingsFile2(filePath);
|
|
@@ -161992,14 +162051,14 @@ var init_MessageResponse = __esm(() => {
|
|
|
161992
162051
|
|
|
161993
162052
|
// src/tui/commands/add-dir/validation.ts
|
|
161994
162053
|
import { stat as stat17 } from "fs/promises";
|
|
161995
|
-
import { dirname as dirname36, resolve as
|
|
162054
|
+
import { dirname as dirname36, resolve as resolve25 } from "path";
|
|
161996
162055
|
async function validateDirectoryForWorkspace(directoryPath, permissionContext) {
|
|
161997
162056
|
if (!directoryPath) {
|
|
161998
162057
|
return {
|
|
161999
162058
|
resultType: "emptyPath"
|
|
162000
162059
|
};
|
|
162001
162060
|
}
|
|
162002
|
-
const absolutePath =
|
|
162061
|
+
const absolutePath = resolve25(expandPath2(directoryPath));
|
|
162003
162062
|
try {
|
|
162004
162063
|
const stats = await stat17(absolutePath);
|
|
162005
162064
|
if (!stats.isDirectory()) {
|
|
@@ -164454,9 +164513,9 @@ var init_pluginOnlyPolicy = __esm(() => {
|
|
|
164454
164513
|
|
|
164455
164514
|
// src/tui/utils/markdownConfigLoader.ts
|
|
164456
164515
|
import { statSync as statSync9 } from "fs";
|
|
164457
|
-
import { lstat as lstat4, readdir as readdir12, readFile as
|
|
164516
|
+
import { lstat as lstat4, readdir as readdir12, readFile as readFile20, realpath as realpath7, stat as stat22 } from "fs/promises";
|
|
164458
164517
|
import { homedir as homedir23 } from "os";
|
|
164459
|
-
import { dirname as dirname40, join as join67, resolve as
|
|
164518
|
+
import { dirname as dirname40, join as join67, resolve as resolve28, sep as sep14 } from "path";
|
|
164460
164519
|
function extractDescriptionFromMarkdown2(content, defaultDescription = "Custom item") {
|
|
164461
164520
|
const lines = content.split(`
|
|
164462
164521
|
`);
|
|
@@ -164538,9 +164597,9 @@ function resolveStopBoundary2(cwd) {
|
|
|
164538
164597
|
return cwdGitRoot;
|
|
164539
164598
|
}
|
|
164540
164599
|
function getProjectDirsUpToHome2(subdir, cwd) {
|
|
164541
|
-
const home =
|
|
164600
|
+
const home = resolve28(homedir23()).normalize("NFC");
|
|
164542
164601
|
const gitRoot = resolveStopBoundary2(cwd);
|
|
164543
|
-
let current =
|
|
164602
|
+
let current = resolve28(cwd);
|
|
164544
164603
|
const dirs = [];
|
|
164545
164604
|
while (true) {
|
|
164546
164605
|
if (normalizePathForComparison2(current) === normalizePathForComparison2(home)) {
|
|
@@ -164638,7 +164697,7 @@ async function loadMarkdownFiles2(dir) {
|
|
|
164638
164697
|
}
|
|
164639
164698
|
const results = await Promise.all(files.map(async (filePath) => {
|
|
164640
164699
|
try {
|
|
164641
|
-
const rawContent = await
|
|
164700
|
+
const rawContent = await readFile20(filePath, { encoding: "utf-8" });
|
|
164642
164701
|
const { frontmatter, content } = parseFrontmatter2(rawContent, filePath);
|
|
164643
164702
|
return {
|
|
164644
164703
|
filePath,
|
|
@@ -167727,7 +167786,7 @@ var init_readOnlyCommandValidation2 = __esm(() => {
|
|
|
167727
167786
|
|
|
167728
167787
|
// src/tui/utils/permissions/pathValidation.ts
|
|
167729
167788
|
import { homedir as homedir24 } from "os";
|
|
167730
|
-
import { dirname as dirname41, isAbsolute as isAbsolute16, resolve as
|
|
167789
|
+
import { dirname as dirname41, isAbsolute as isAbsolute16, resolve as resolve29 } from "path";
|
|
167731
167790
|
function expandTilde2(path) {
|
|
167732
167791
|
if (path === "~" || path.startsWith("~/") || process.platform === "win32" && path.startsWith("~\\")) {
|
|
167733
167792
|
return homedir24() + path.slice(1);
|
|
@@ -169029,7 +169088,7 @@ var init_agentColorManager = __esm(() => {
|
|
|
169029
169088
|
});
|
|
169030
169089
|
|
|
169031
169090
|
// src/tui/tools/AgentTool/agentMemorySnapshot.ts
|
|
169032
|
-
import { mkdir as mkdir16, readdir as readdir14, readFile as
|
|
169091
|
+
import { mkdir as mkdir16, readdir as readdir14, readFile as readFile21, unlink as unlink7, writeFile as writeFile11 } from "fs/promises";
|
|
169033
169092
|
import { join as join72 } from "path";
|
|
169034
169093
|
function getSnapshotDirForAgent(agentType) {
|
|
169035
169094
|
return join72(getCwd(), getConfigDirName2(), SNAPSHOT_BASE, agentType);
|
|
@@ -169042,7 +169101,7 @@ function getSyncedJsonPath(agentType, scope) {
|
|
|
169042
169101
|
}
|
|
169043
169102
|
async function readJsonFile(path, schema) {
|
|
169044
169103
|
try {
|
|
169045
|
-
const content = await
|
|
169104
|
+
const content = await readFile21(path, { encoding: "utf-8" });
|
|
169046
169105
|
const result = schema.safeParse(jsonParse2(content));
|
|
169047
169106
|
return result.success ? result.data : null;
|
|
169048
169107
|
} catch {
|
|
@@ -169058,7 +169117,7 @@ async function copySnapshotToLocal(agentType, scope) {
|
|
|
169058
169117
|
for (const dirent of files) {
|
|
169059
169118
|
if (!dirent.isFile() || dirent.name === SNAPSHOT_JSON)
|
|
169060
169119
|
continue;
|
|
169061
|
-
const content = await
|
|
169120
|
+
const content = await readFile21(join72(snapshotMemDir, dirent.name), {
|
|
169062
169121
|
encoding: "utf-8"
|
|
169063
169122
|
});
|
|
169064
169123
|
await writeFile11(join72(localMemDir, dirent.name), content);
|
|
@@ -177743,7 +177802,7 @@ import {
|
|
|
177743
177802
|
copyFile as copyFile2,
|
|
177744
177803
|
mkdir as mkdir17,
|
|
177745
177804
|
readdir as readdir15,
|
|
177746
|
-
readFile as
|
|
177805
|
+
readFile as readFile22,
|
|
177747
177806
|
stat as stat24,
|
|
177748
177807
|
symlink as symlink4,
|
|
177749
177808
|
utimes as utimes2
|
|
@@ -177886,7 +177945,7 @@ async function getOrCreateWorktree2(repoRoot, slug, options) {
|
|
|
177886
177945
|
async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
177887
177946
|
let includeContent;
|
|
177888
177947
|
try {
|
|
177889
|
-
includeContent = await
|
|
177948
|
+
includeContent = await readFile22(join73(repoRoot, ".worktreeinclude"), "utf-8");
|
|
177890
177949
|
} catch {
|
|
177891
177950
|
return [];
|
|
177892
177951
|
}
|
|
@@ -186956,7 +187015,7 @@ var init_validate2 = __esm(() => {
|
|
|
186956
187015
|
|
|
186957
187016
|
// src/tui/keybindings/loadUserBindings.ts
|
|
186958
187017
|
import { readFileSync as readFileSync18 } from "fs";
|
|
186959
|
-
import { readFile as
|
|
187018
|
+
import { readFile as readFile23, stat as stat26 } from "fs/promises";
|
|
186960
187019
|
import { dirname as dirname43, join as join75 } from "path";
|
|
186961
187020
|
function isKeybindingCustomizationEnabled() {
|
|
186962
187021
|
return getFeatureValue_CACHED_MAY_BE_STALE("atlas_keybinding_customization_release", false);
|
|
@@ -186989,7 +187048,7 @@ async function loadKeybindings() {
|
|
|
186989
187048
|
}
|
|
186990
187049
|
const userPath = getKeybindingsPath();
|
|
186991
187050
|
try {
|
|
186992
|
-
const content = await
|
|
187051
|
+
const content = await readFile23(userPath, "utf-8");
|
|
186993
187052
|
const parsed = jsonParse2(content);
|
|
186994
187053
|
let userBlocks;
|
|
186995
187054
|
if (typeof parsed === "object" && parsed !== null && "bindings" in parsed) {
|
|
@@ -197541,7 +197600,7 @@ var init_IdeOnboardingDialog = __esm(() => {
|
|
|
197541
197600
|
|
|
197542
197601
|
// src/tui/utils/ide.ts
|
|
197543
197602
|
import { createConnection } from "net";
|
|
197544
|
-
import { basename as basename19, join as join84, sep as pathSeparator, resolve as
|
|
197603
|
+
import { basename as basename19, join as join84, sep as pathSeparator, resolve as resolve30 } from "path";
|
|
197545
197604
|
function isProcessRunning3(pid) {
|
|
197546
197605
|
try {
|
|
197547
197606
|
process.kill(pid, 0);
|
|
@@ -197683,7 +197742,7 @@ async function getIdeLockfilesPaths() {
|
|
|
197683
197742
|
if (windowsHome) {
|
|
197684
197743
|
const converter = new WindowsToWSLConverter(process.env.WSL_DISTRO_NAME);
|
|
197685
197744
|
const wslPath = converter.toLocalPath(windowsHome);
|
|
197686
|
-
paths.push(
|
|
197745
|
+
paths.push(resolve30(wslPath, getConfigDirName2(), "ide"));
|
|
197687
197746
|
}
|
|
197688
197747
|
try {
|
|
197689
197748
|
const usersDir = "/mnt/c/Users";
|
|
@@ -197825,14 +197884,14 @@ async function detectIDEs(includeInvalid) {
|
|
|
197825
197884
|
if (!checkWSLDistroMatch(idePath, process.env.WSL_DISTRO_NAME)) {
|
|
197826
197885
|
return false;
|
|
197827
197886
|
}
|
|
197828
|
-
const resolvedOriginal =
|
|
197887
|
+
const resolvedOriginal = resolve30(localPath).normalize("NFC");
|
|
197829
197888
|
if (cwd === resolvedOriginal || cwd.startsWith(resolvedOriginal + pathSeparator)) {
|
|
197830
197889
|
return true;
|
|
197831
197890
|
}
|
|
197832
197891
|
const converter = new WindowsToWSLConverter(process.env.WSL_DISTRO_NAME);
|
|
197833
197892
|
localPath = converter.toLocalPath(idePath);
|
|
197834
197893
|
}
|
|
197835
|
-
const resolvedPath =
|
|
197894
|
+
const resolvedPath = resolve30(localPath).normalize("NFC");
|
|
197836
197895
|
if (getPlatform3() === "windows") {
|
|
197837
197896
|
const normalizedCwd = cwd.replace(/^[a-zA-Z]:/, (match) => match.toUpperCase());
|
|
197838
197897
|
const normalizedResolvedPath = resolvedPath.replace(/^[a-zA-Z]:/, (match) => match.toUpperCase());
|
|
@@ -203461,7 +203520,7 @@ var init_ComputerUseApproval = __esm(() => {
|
|
|
203461
203520
|
});
|
|
203462
203521
|
|
|
203463
203522
|
// src/tui/utils/computerUse/computerUseLock.ts
|
|
203464
|
-
import { mkdir as mkdir21, readFile as
|
|
203523
|
+
import { mkdir as mkdir21, readFile as readFile24, unlink as unlink9, writeFile as writeFile14 } from "fs/promises";
|
|
203465
203524
|
import { join as join87 } from "path";
|
|
203466
203525
|
function isComputerUseLock(value) {
|
|
203467
203526
|
if (typeof value !== "object" || value === null)
|
|
@@ -203473,7 +203532,7 @@ function getLockPath2() {
|
|
|
203473
203532
|
}
|
|
203474
203533
|
async function readLock2() {
|
|
203475
203534
|
try {
|
|
203476
|
-
const raw = await
|
|
203535
|
+
const raw = await readFile24(getLockPath2(), "utf8");
|
|
203477
203536
|
const parsed = jsonParse2(raw);
|
|
203478
203537
|
return isComputerUseLock(parsed) ? parsed : undefined;
|
|
203479
203538
|
} catch {
|
|
@@ -207570,7 +207629,7 @@ function createLinkedTransportPair() {
|
|
|
207570
207629
|
}
|
|
207571
207630
|
|
|
207572
207631
|
// src/tui/services/mcp/client.ts
|
|
207573
|
-
import { mkdir as mkdir22, readFile as
|
|
207632
|
+
import { mkdir as mkdir22, readFile as readFile25, unlink as unlink10, writeFile as writeFile15 } from "fs/promises";
|
|
207574
207633
|
import { dirname as dirname45, join as join88 } from "path";
|
|
207575
207634
|
function isMcpSessionExpiredError(error) {
|
|
207576
207635
|
const httpStatus = "code" in error ? error.code : undefined;
|
|
@@ -207587,7 +207646,7 @@ function getMcpAuthCachePath() {
|
|
|
207587
207646
|
}
|
|
207588
207647
|
function getMcpAuthCache() {
|
|
207589
207648
|
if (!authCachePromise) {
|
|
207590
|
-
authCachePromise =
|
|
207649
|
+
authCachePromise = readFile25(getMcpAuthCachePath(), "utf-8").then((data) => jsonParse2(data)).catch(() => ({}));
|
|
207591
207650
|
}
|
|
207592
207651
|
return authCachePromise;
|
|
207593
207652
|
}
|
|
@@ -209632,13 +209691,13 @@ var init_LSPDiagnosticRegistry = __esm(() => {
|
|
|
209632
209691
|
});
|
|
209633
209692
|
|
|
209634
209693
|
// src/tui/utils/plugins/lspPluginIntegration.ts
|
|
209635
|
-
import { readFile as
|
|
209636
|
-
import { join as join89, relative as relative10, resolve as
|
|
209694
|
+
import { readFile as readFile26 } from "fs/promises";
|
|
209695
|
+
import { join as join89, relative as relative10, resolve as resolve31 } from "path";
|
|
209637
209696
|
function validatePathWithinPlugin(pluginPath, relativePath) {
|
|
209638
|
-
const resolvedPluginPath =
|
|
209639
|
-
const resolvedFilePath =
|
|
209697
|
+
const resolvedPluginPath = resolve31(pluginPath);
|
|
209698
|
+
const resolvedFilePath = resolve31(pluginPath, relativePath);
|
|
209640
209699
|
const rel = relative10(resolvedPluginPath, resolvedFilePath);
|
|
209641
|
-
if (rel.startsWith("..") ||
|
|
209700
|
+
if (rel.startsWith("..") || resolve31(rel) === rel) {
|
|
209642
209701
|
return null;
|
|
209643
209702
|
}
|
|
209644
209703
|
return resolvedFilePath;
|
|
@@ -209647,7 +209706,7 @@ async function loadPluginLspServers(plugin, errors = []) {
|
|
|
209647
209706
|
const servers = {};
|
|
209648
209707
|
const lspJsonPath = join89(plugin.path, ".lsp.json");
|
|
209649
209708
|
try {
|
|
209650
|
-
const content = await
|
|
209709
|
+
const content = await readFile26(lspJsonPath, "utf-8");
|
|
209651
209710
|
const parsed = jsonParse2(content);
|
|
209652
209711
|
const result = record(string2(), LspServerConfigSchema()).safeParse(parsed);
|
|
209653
209712
|
if (result.success) {
|
|
@@ -209704,7 +209763,7 @@ async function loadLspServersFromManifest(declaration, pluginPath, pluginName, e
|
|
|
209704
209763
|
continue;
|
|
209705
209764
|
}
|
|
209706
209765
|
try {
|
|
209707
|
-
const content = await
|
|
209766
|
+
const content = await readFile26(validatedPath, "utf-8");
|
|
209708
209767
|
const parsed = jsonParse2(content);
|
|
209709
209768
|
const result = record(string2(), LspServerConfigSchema()).safeParse(parsed);
|
|
209710
209769
|
if (result.success) {
|
|
@@ -214512,7 +214571,7 @@ function getContextWindowForModel(model, betas) {
|
|
|
214512
214571
|
if (providerCtx !== undefined) {
|
|
214513
214572
|
return providerCtx;
|
|
214514
214573
|
}
|
|
214515
|
-
return
|
|
214574
|
+
return MODEL_CONTEXT_WINDOW_DEFAULT;
|
|
214516
214575
|
}
|
|
214517
214576
|
function calculateContextPercentages(currentUsage, contextWindowSize) {
|
|
214518
214577
|
if (!currentUsage) {
|
|
@@ -214536,9 +214595,10 @@ function getModelMaxOutputTokens(model) {
|
|
|
214536
214595
|
upperLimit: MAX_OUTPUT_TOKENS_UPPER_LIMIT
|
|
214537
214596
|
};
|
|
214538
214597
|
}
|
|
214539
|
-
var
|
|
214598
|
+
var MODEL_CONTEXT_WINDOW_DEFAULT, COMPACT_MAX_OUTPUT_TOKENS2 = 20000, MAX_OUTPUT_TOKENS_DEFAULT = 32000, MAX_OUTPUT_TOKENS_UPPER_LIMIT = 64000, CAPPED_DEFAULT_MAX_TOKENS = 8000;
|
|
214540
214599
|
var init_context2 = __esm(() => {
|
|
214541
214600
|
init_modelprovider2();
|
|
214601
|
+
MODEL_CONTEXT_WINDOW_DEFAULT = HARD_DEFAULT_CONTEXT_WINDOW;
|
|
214542
214602
|
});
|
|
214543
214603
|
|
|
214544
214604
|
// src/tui/cost-tracker.ts
|
|
@@ -214750,7 +214810,7 @@ import {
|
|
|
214750
214810
|
copyFile as copyFile3,
|
|
214751
214811
|
link as link2,
|
|
214752
214812
|
mkdir as mkdir23,
|
|
214753
|
-
readFile as
|
|
214813
|
+
readFile as readFile27,
|
|
214754
214814
|
stat as stat29,
|
|
214755
214815
|
unlink as unlink11
|
|
214756
214816
|
} from "fs/promises";
|
|
@@ -215067,8 +215127,8 @@ async function checkOriginFileChanged(originalFile, backupFileName, originalStat
|
|
|
215067
215127
|
return compareStatsAndContent(originalStats, backupStats, async () => {
|
|
215068
215128
|
try {
|
|
215069
215129
|
const [originalContent, backupContent] = await Promise.all([
|
|
215070
|
-
|
|
215071
|
-
|
|
215130
|
+
readFile27(originalFile, "utf-8"),
|
|
215131
|
+
readFile27(backupPath, "utf-8")
|
|
215072
215132
|
]);
|
|
215073
215133
|
return originalContent !== backupContent;
|
|
215074
215134
|
} catch {
|
|
@@ -215329,7 +215389,7 @@ async function notifyVscodeSnapshotFilesUpdated(oldState, newState) {
|
|
|
215329
215389
|
}
|
|
215330
215390
|
async function readFileAsyncOrNull(path) {
|
|
215331
215391
|
try {
|
|
215332
|
-
return await
|
|
215392
|
+
return await readFile27(path, "utf-8");
|
|
215333
215393
|
} catch {
|
|
215334
215394
|
return null;
|
|
215335
215395
|
}
|
|
@@ -215439,7 +215499,7 @@ var init_detectRepository = __esm(() => {
|
|
|
215439
215499
|
});
|
|
215440
215500
|
|
|
215441
215501
|
// src/tui/utils/gitDiff.ts
|
|
215442
|
-
import { access, readFile as
|
|
215502
|
+
import { access, readFile as readFile28 } from "fs/promises";
|
|
215443
215503
|
import { dirname as dirname47, join as join91, relative as relative12, sep as sep17 } from "path";
|
|
215444
215504
|
async function fetchGitDiff() {
|
|
215445
215505
|
const isGit = await getIsGit();
|
|
@@ -215690,7 +215750,7 @@ async function generateSyntheticDiff(gitPath, absoluteFilePath) {
|
|
|
215690
215750
|
if (!isFileWithinReadSizeLimit2(absoluteFilePath, MAX_DIFF_SIZE_BYTES)) {
|
|
215691
215751
|
return null;
|
|
215692
215752
|
}
|
|
215693
|
-
const content = await
|
|
215753
|
+
const content = await readFile28(absoluteFilePath, "utf-8");
|
|
215694
215754
|
const lines = content.split(`
|
|
215695
215755
|
`);
|
|
215696
215756
|
if (lines.length > 0 && lines.at(-1) === "") {
|
|
@@ -251272,7 +251332,7 @@ var init_readEditContext = __esm(() => {
|
|
|
251272
251332
|
});
|
|
251273
251333
|
|
|
251274
251334
|
// src/tui/tools/FileWriteTool/UI.tsx
|
|
251275
|
-
import { isAbsolute as isAbsolute20, relative as relative14, resolve as
|
|
251335
|
+
import { isAbsolute as isAbsolute20, relative as relative14, resolve as resolve33 } from "path";
|
|
251276
251336
|
function countLines(content) {
|
|
251277
251337
|
const parts = content.split(EOL);
|
|
251278
251338
|
return content.endsWith(EOL) ? parts.length - 1 : parts.length;
|
|
@@ -251596,7 +251656,7 @@ function WriteRejectionBody(t0) {
|
|
|
251596
251656
|
}
|
|
251597
251657
|
async function loadRejectionDiff(filePath, content) {
|
|
251598
251658
|
try {
|
|
251599
|
-
const fullFilePath = isAbsolute20(filePath) ? filePath :
|
|
251659
|
+
const fullFilePath = isAbsolute20(filePath) ? filePath : resolve33(getCwd(), filePath);
|
|
251600
251660
|
const handle = await openForScan(fullFilePath);
|
|
251601
251661
|
if (handle === null)
|
|
251602
251662
|
return {
|
|
@@ -253665,7 +253725,7 @@ var init_teammate2 = __esm(() => {
|
|
|
253665
253725
|
});
|
|
253666
253726
|
|
|
253667
253727
|
// src/tui/utils/tasks.ts
|
|
253668
|
-
import { mkdir as mkdir24, readdir as readdir16, readFile as
|
|
253728
|
+
import { mkdir as mkdir24, readdir as readdir16, readFile as readFile29, unlink as unlink12, writeFile as writeFile16 } from "fs/promises";
|
|
253669
253729
|
import { join as join94 } from "path";
|
|
253670
253730
|
function setLeaderTeamName2(teamName) {
|
|
253671
253731
|
if (leaderTeamName2 === teamName)
|
|
@@ -253690,7 +253750,7 @@ function getHighWaterMarkPath2(taskListId) {
|
|
|
253690
253750
|
async function readHighWaterMark2(taskListId) {
|
|
253691
253751
|
const path = getHighWaterMarkPath2(taskListId);
|
|
253692
253752
|
try {
|
|
253693
|
-
const content = (await
|
|
253753
|
+
const content = (await readFile29(path, "utf-8")).trim();
|
|
253694
253754
|
const value = parseInt(content, 10);
|
|
253695
253755
|
return isNaN(value) ? 0 : value;
|
|
253696
253756
|
} catch {
|
|
@@ -253814,7 +253874,7 @@ async function createTask2(taskListId, taskData) {
|
|
|
253814
253874
|
async function getTask2(taskListId, taskId) {
|
|
253815
253875
|
const path = getTaskPath2(taskListId, taskId);
|
|
253816
253876
|
try {
|
|
253817
|
-
const content = await
|
|
253877
|
+
const content = await readFile29(path, "utf-8");
|
|
253818
253878
|
const data = jsonParse2(content);
|
|
253819
253879
|
const parsed = TaskSchema2().safeParse(data);
|
|
253820
253880
|
if (!parsed.success) {
|
|
@@ -256411,7 +256471,7 @@ Output truncated (${sizeKB}KB total). Full output saved to: ${this.path}`;
|
|
|
256411
256471
|
});
|
|
256412
256472
|
|
|
256413
256473
|
// src/tui/utils/sessionEnvironment.ts
|
|
256414
|
-
import { mkdir as mkdir25, readdir as readdir17, readFile as
|
|
256474
|
+
import { mkdir as mkdir25, readdir as readdir17, readFile as readFile30, writeFile as writeFile17 } from "fs/promises";
|
|
256415
256475
|
import { join as join95 } from "path";
|
|
256416
256476
|
async function getSessionEnvDirPath() {
|
|
256417
256477
|
const sessionEnvDir = join95(getAtlasConfigHomeDir3(), "session-env", getSessionId());
|
|
@@ -256450,7 +256510,7 @@ async function getSessionEnvironmentScript() {
|
|
|
256450
256510
|
const envFile = process.env.ATLAS_SESSION_ENV_FILE;
|
|
256451
256511
|
if (envFile) {
|
|
256452
256512
|
try {
|
|
256453
|
-
const envScript = (await
|
|
256513
|
+
const envScript = (await readFile30(envFile, "utf8")).trim();
|
|
256454
256514
|
if (envScript) {
|
|
256455
256515
|
scripts.push(envScript);
|
|
256456
256516
|
logForDebugging3(`Session environment loaded from ATLAS_SESSION_ENV_FILE: ${envFile} (${envScript.length} chars)`);
|
|
@@ -256469,7 +256529,7 @@ async function getSessionEnvironmentScript() {
|
|
|
256469
256529
|
for (const file of hookFiles) {
|
|
256470
256530
|
const filePath = join95(sessionEnvDir, file);
|
|
256471
256531
|
try {
|
|
256472
|
-
const content = (await
|
|
256532
|
+
const content = (await readFile30(filePath, "utf8")).trim();
|
|
256473
256533
|
if (content) {
|
|
256474
256534
|
scripts.push(content);
|
|
256475
256535
|
}
|
|
@@ -257510,7 +257570,7 @@ var init_powershellProvider = __esm(() => {
|
|
|
257510
257570
|
import { execFileSync as execFileSync4, spawn as spawn9 } from "child_process";
|
|
257511
257571
|
import { constants as fsConstants5, readFileSync as readFileSync19, unlinkSync as unlinkSync3 } from "fs";
|
|
257512
257572
|
import { mkdir as mkdir27, open as open12, realpath as realpath9 } from "fs/promises";
|
|
257513
|
-
import { isAbsolute as isAbsolute25, resolve as
|
|
257573
|
+
import { isAbsolute as isAbsolute25, resolve as resolve34 } from "path";
|
|
257514
257574
|
import { join as posixJoin3 } from "path/posix";
|
|
257515
257575
|
import { accessSync as accessSync2 } from "fs";
|
|
257516
257576
|
function isExecutable2(shellPath) {
|
|
@@ -257699,7 +257759,7 @@ async function exec3(command, abortSignal, shellType, options) {
|
|
|
257699
257759
|
}
|
|
257700
257760
|
}
|
|
257701
257761
|
function setCwd2(path, relativeTo) {
|
|
257702
|
-
const resolved = isAbsolute25(path) ? path :
|
|
257762
|
+
const resolved = isAbsolute25(path) ? path : resolve34(relativeTo || getFsImplementation2().cwd(), path);
|
|
257703
257763
|
let physicalPath;
|
|
257704
257764
|
try {
|
|
257705
257765
|
physicalPath = getFsImplementation2().realpathSync(resolved);
|
|
@@ -257754,7 +257814,7 @@ var init_Shell2 = __esm(() => {
|
|
|
257754
257814
|
});
|
|
257755
257815
|
|
|
257756
257816
|
// src/tui/tools/BashTool/utils.ts
|
|
257757
|
-
import { readFile as
|
|
257817
|
+
import { readFile as readFile31, stat as stat33 } from "fs/promises";
|
|
257758
257818
|
function stripEmptyLines2(content) {
|
|
257759
257819
|
const lines = content.split(`
|
|
257760
257820
|
`);
|
|
@@ -257806,7 +257866,7 @@ async function resizeShellImageOutput2(stdout, outputFilePath, outputFileSize) {
|
|
|
257806
257866
|
const size = outputFileSize ?? (await stat33(outputFilePath)).size;
|
|
257807
257867
|
if (size > MAX_IMAGE_FILE_SIZE2)
|
|
257808
257868
|
return null;
|
|
257809
|
-
source = await
|
|
257869
|
+
source = await readFile31(outputFilePath, "utf8");
|
|
257810
257870
|
}
|
|
257811
257871
|
const parsed = parseDataUri2(source);
|
|
257812
257872
|
if (!parsed)
|
|
@@ -258300,7 +258360,7 @@ var init_UI8 = __esm(() => {
|
|
|
258300
258360
|
});
|
|
258301
258361
|
|
|
258302
258362
|
// src/tui/tools/NotebookEditTool/NotebookEditTool.ts
|
|
258303
|
-
import { extname as extname13, isAbsolute as isAbsolute26, resolve as
|
|
258363
|
+
import { extname as extname13, isAbsolute as isAbsolute26, resolve as resolve35 } from "path";
|
|
258304
258364
|
var inputSchema12, outputSchema10, NotebookEditTool2;
|
|
258305
258365
|
var init_NotebookEditTool = __esm(() => {
|
|
258306
258366
|
init_shared();
|
|
@@ -258414,7 +258474,7 @@ var init_NotebookEditTool = __esm(() => {
|
|
|
258414
258474
|
renderToolUseErrorMessage: renderToolUseErrorMessage5,
|
|
258415
258475
|
renderToolResultMessage: renderToolResultMessage8,
|
|
258416
258476
|
async validateInput({ notebook_path, cell_type, cell_id, edit_mode = "replace" }, toolUseContext) {
|
|
258417
|
-
const fullPath = isAbsolute26(notebook_path) ? notebook_path :
|
|
258477
|
+
const fullPath = isAbsolute26(notebook_path) ? notebook_path : resolve35(getCwd(), notebook_path);
|
|
258418
258478
|
if (fullPath.startsWith("\\\\") || fullPath.startsWith("//")) {
|
|
258419
258479
|
return { result: true };
|
|
258420
258480
|
}
|
|
@@ -258513,7 +258573,7 @@ var init_NotebookEditTool = __esm(() => {
|
|
|
258513
258573
|
cell_type,
|
|
258514
258574
|
edit_mode: originalEditMode
|
|
258515
258575
|
}, { readFileState, updateFileHistoryState }, _, parentMessage) {
|
|
258516
|
-
const fullPath = isAbsolute26(notebook_path) ? notebook_path :
|
|
258576
|
+
const fullPath = isAbsolute26(notebook_path) ? notebook_path : resolve35(getCwd(), notebook_path);
|
|
258517
258577
|
if (fileHistoryEnabled()) {
|
|
258518
258578
|
await fileHistoryTrackEdit(updateFileHistoryState, fullPath, parentMessage.uuid);
|
|
258519
258579
|
}
|
|
@@ -260430,7 +260490,7 @@ var init_fileStateCache = __esm(() => {
|
|
|
260430
260490
|
});
|
|
260431
260491
|
|
|
260432
260492
|
// src/tui/utils/hooks/hooksSettings.ts
|
|
260433
|
-
import { resolve as
|
|
260493
|
+
import { resolve as resolve36 } from "path";
|
|
260434
260494
|
function isHookEqual(a, b) {
|
|
260435
260495
|
if (a.type !== b.type)
|
|
260436
260496
|
return false;
|
|
@@ -260481,7 +260541,7 @@ function getAllHooks(appState) {
|
|
|
260481
260541
|
for (const source of sources) {
|
|
260482
260542
|
const filePath = getSettingsFilePathForSource2(source);
|
|
260483
260543
|
if (filePath) {
|
|
260484
|
-
const resolvedPath =
|
|
260544
|
+
const resolvedPath = resolve36(filePath);
|
|
260485
260545
|
if (seenFiles.has(resolvedPath)) {
|
|
260486
260546
|
continue;
|
|
260487
260547
|
}
|
|
@@ -264607,7 +264667,7 @@ __export(exports_teammateMailbox, {
|
|
|
264607
264667
|
sendShutdownRequestToMailbox: () => sendShutdownRequestToMailbox2,
|
|
264608
264668
|
writeToMailbox: () => writeToMailbox2
|
|
264609
264669
|
});
|
|
264610
|
-
import { mkdir as mkdir28, readFile as
|
|
264670
|
+
import { mkdir as mkdir28, readFile as readFile32, writeFile as writeFile18 } from "fs/promises";
|
|
264611
264671
|
import { join as join100 } from "path";
|
|
264612
264672
|
function getInboxPath2(agentName, teamName) {
|
|
264613
264673
|
const team = teamName || getTeamName2() || "default";
|
|
@@ -264629,7 +264689,7 @@ async function readMailbox2(agentName, teamName) {
|
|
|
264629
264689
|
const inboxPath = getInboxPath2(agentName, teamName);
|
|
264630
264690
|
logForDebugging3(`[TeammateMailbox] readMailbox: path=${inboxPath}`);
|
|
264631
264691
|
try {
|
|
264632
|
-
const content = await
|
|
264692
|
+
const content = await readFile32(inboxPath, "utf-8");
|
|
264633
264693
|
const messages = jsonParse2(content);
|
|
264634
264694
|
logForDebugging3(`[TeammateMailbox] readMailbox: read ${messages.length} message(s)`);
|
|
264635
264695
|
return messages;
|
|
@@ -292919,7 +292979,7 @@ var init_listSessionsImpl = __esm(() => {
|
|
|
292919
292979
|
});
|
|
292920
292980
|
|
|
292921
292981
|
// src/tui/services/autoDream/consolidationLock.ts
|
|
292922
|
-
import { mkdir as mkdir30, readFile as
|
|
292982
|
+
import { mkdir as mkdir30, readFile as readFile33, stat as stat35, unlink as unlink14, utimes as utimes3, writeFile as writeFile20 } from "fs/promises";
|
|
292923
292983
|
import { join as join103 } from "path";
|
|
292924
292984
|
function lockPath() {
|
|
292925
292985
|
return join103(getAutoMemPath2(), LOCK_FILE);
|
|
@@ -292937,7 +292997,7 @@ async function tryAcquireConsolidationLock() {
|
|
|
292937
292997
|
let mtimeMs;
|
|
292938
292998
|
let holderPid;
|
|
292939
292999
|
try {
|
|
292940
|
-
const [s, raw] = await Promise.all([stat35(path),
|
|
293000
|
+
const [s, raw] = await Promise.all([stat35(path), readFile33(path, "utf8")]);
|
|
292941
293001
|
mtimeMs = s.mtimeMs;
|
|
292942
293002
|
const parsed = parseInt(raw.trim(), 10);
|
|
292943
293003
|
holderPid = Number.isFinite(parsed) ? parsed : undefined;
|
|
@@ -292952,7 +293012,7 @@ async function tryAcquireConsolidationLock() {
|
|
|
292952
293012
|
await writeFile20(path, String(process.pid));
|
|
292953
293013
|
let verify;
|
|
292954
293014
|
try {
|
|
292955
|
-
verify = await
|
|
293015
|
+
verify = await readFile33(path, "utf8");
|
|
292956
293016
|
} catch {
|
|
292957
293017
|
return null;
|
|
292958
293018
|
}
|
|
@@ -298374,7 +298434,7 @@ __export(exports_voice2, {
|
|
|
298374
298434
|
stopRecording: () => stopRecording
|
|
298375
298435
|
});
|
|
298376
298436
|
import { spawn as spawn10, spawnSync as spawnSync3 } from "child_process";
|
|
298377
|
-
import { readFile as
|
|
298437
|
+
import { readFile as readFile34 } from "fs/promises";
|
|
298378
298438
|
function loadAudioNapi() {
|
|
298379
298439
|
audioNapiPromise ??= (async () => {
|
|
298380
298440
|
const t0 = Date.now();
|
|
@@ -298429,7 +298489,7 @@ function _resetArecordProbeForTesting() {
|
|
|
298429
298489
|
arecordProbe = null;
|
|
298430
298490
|
}
|
|
298431
298491
|
function linuxHasAlsaCards() {
|
|
298432
|
-
linuxAlsaCardsMemo ??=
|
|
298492
|
+
linuxAlsaCardsMemo ??= readFile34("/proc/asound/cards", "utf8").then((cards) => {
|
|
298433
298493
|
const c = cards.trim();
|
|
298434
298494
|
return c !== "" && !c.includes("no soundcards");
|
|
298435
298495
|
}, () => false);
|
|
@@ -308451,7 +308511,7 @@ var init_registry3 = __esm(() => {
|
|
|
308451
308511
|
|
|
308452
308512
|
// src/tui/utils/swarm/teamHelpers.ts
|
|
308453
308513
|
import { mkdirSync as mkdirSync7, readFileSync as readFileSync21, writeFileSync as writeFileSync6 } from "fs";
|
|
308454
|
-
import { mkdir as mkdir32, readFile as
|
|
308514
|
+
import { mkdir as mkdir32, readFile as readFile35, rm as rm3, writeFile as writeFile23 } from "fs/promises";
|
|
308455
308515
|
import { join as join105 } from "path";
|
|
308456
308516
|
function sanitizeName3(name) {
|
|
308457
308517
|
return name.replace(/[^a-zA-Z0-9]/g, "-").toLowerCase();
|
|
@@ -308475,7 +308535,7 @@ function readTeamFile2(teamName) {
|
|
|
308475
308535
|
}
|
|
308476
308536
|
async function readTeamFileAsync2(teamName) {
|
|
308477
308537
|
try {
|
|
308478
|
-
const content = await
|
|
308538
|
+
const content = await readFile35(getTeamFilePath2(teamName), "utf-8");
|
|
308479
308539
|
return jsonParse2(content);
|
|
308480
308540
|
} catch (e) {
|
|
308481
308541
|
if (getErrnoCode2(e) === "ENOENT")
|
|
@@ -308625,7 +308685,7 @@ async function destroyWorktree2(worktreePath) {
|
|
|
308625
308685
|
const gitFilePath = join105(worktreePath, ".git");
|
|
308626
308686
|
let mainRepoPath = null;
|
|
308627
308687
|
try {
|
|
308628
|
-
const gitFileContent = (await
|
|
308688
|
+
const gitFileContent = (await readFile35(gitFilePath, "utf-8")).trim();
|
|
308629
308689
|
const match = gitFileContent.match(/^gitdir:\s*(.+)$/);
|
|
308630
308690
|
if (match && match[1]) {
|
|
308631
308691
|
const worktreeGitDir = match[1];
|
|
@@ -310871,7 +310931,7 @@ var exports_SpecParser = {};
|
|
|
310871
310931
|
__export(exports_SpecParser, {
|
|
310872
310932
|
SpecParser: () => SpecParser2
|
|
310873
310933
|
});
|
|
310874
|
-
import { readFile as
|
|
310934
|
+
import { readFile as readFile36 } from "fs/promises";
|
|
310875
310935
|
var inputSchema42, outputSchema34, SpecParser2;
|
|
310876
310936
|
var init_SpecParser = __esm(() => {
|
|
310877
310937
|
init_v4();
|
|
@@ -310914,7 +310974,7 @@ var init_SpecParser = __esm(() => {
|
|
|
310914
310974
|
let raw = inp.spec_source;
|
|
310915
310975
|
let parsedFromFile = false;
|
|
310916
310976
|
try {
|
|
310917
|
-
const fileContent = await
|
|
310977
|
+
const fileContent = await readFile36(inp.spec_source, "utf-8");
|
|
310918
310978
|
raw = fileContent;
|
|
310919
310979
|
parsedFromFile = true;
|
|
310920
310980
|
} catch {}
|
|
@@ -314057,7 +314117,7 @@ var init_parser7 = __esm(() => {
|
|
|
314057
314117
|
});
|
|
314058
314118
|
|
|
314059
314119
|
// src/tui/tools/PowerShellTool/gitSafety.ts
|
|
314060
|
-
import { basename as basename29, posix as posix7, resolve as
|
|
314120
|
+
import { basename as basename29, posix as posix7, resolve as resolve37, sep as sep23 } from "path";
|
|
314061
314121
|
function resolveCwdReentry(normalized) {
|
|
314062
314122
|
if (!normalized.startsWith("../"))
|
|
314063
314123
|
return normalized;
|
|
@@ -314105,7 +314165,7 @@ function normalizeGitPathArg(arg) {
|
|
|
314105
314165
|
}
|
|
314106
314166
|
function resolveEscapingPathToCwdRelative(n) {
|
|
314107
314167
|
const cwd = getCwd();
|
|
314108
|
-
const abs =
|
|
314168
|
+
const abs = resolve37(cwd, n);
|
|
314109
314169
|
const cwdWithSep = cwd.endsWith(sep23) ? cwd : cwd + sep23;
|
|
314110
314170
|
const absLower = abs.toLowerCase();
|
|
314111
314171
|
const cwdLower = cwd.toLowerCase();
|
|
@@ -315345,7 +315405,7 @@ var init_modeValidation3 = __esm(() => {
|
|
|
315345
315405
|
|
|
315346
315406
|
// src/tui/tools/PowerShellTool/pathValidation.ts
|
|
315347
315407
|
import { homedir as homedir29 } from "os";
|
|
315348
|
-
import { isAbsolute as isAbsolute27, resolve as
|
|
315408
|
+
import { isAbsolute as isAbsolute27, resolve as resolve38 } from "path";
|
|
315349
315409
|
function matchesParam(paramLower, paramList) {
|
|
315350
315410
|
for (const p of paramList) {
|
|
315351
315411
|
if (p === paramLower || paramLower.length > 1 && p.startsWith(paramLower)) {
|
|
@@ -315453,7 +315513,7 @@ function checkDenyRuleForGuessedPath(strippedPath, cwd, toolPermissionContext, o
|
|
|
315453
315513
|
if (!strippedPath || strippedPath.includes("\x00"))
|
|
315454
315514
|
return null;
|
|
315455
315515
|
const tildeExpanded = expandTilde3(strippedPath);
|
|
315456
|
-
const abs = isAbsolute27(tildeExpanded) ? tildeExpanded :
|
|
315516
|
+
const abs = isAbsolute27(tildeExpanded) ? tildeExpanded : resolve38(cwd, tildeExpanded);
|
|
315457
315517
|
const { resolvedPath } = safeResolvePath3(getFsImplementation2(), abs);
|
|
315458
315518
|
const permissionType = operationType === "read" ? "read" : "edit";
|
|
315459
315519
|
const denyRule = matchingRuleForInput2(resolvedPath, toolPermissionContext, permissionType, "deny");
|
|
@@ -315543,7 +315603,7 @@ function validatePath3(filePath, cwd, toolPermissionContext, operationType) {
|
|
|
315543
315603
|
};
|
|
315544
315604
|
}
|
|
315545
315605
|
if (containsPathTraversal2(normalizedPath)) {
|
|
315546
|
-
const absolutePath = isAbsolute27(normalizedPath) ? normalizedPath :
|
|
315606
|
+
const absolutePath = isAbsolute27(normalizedPath) ? normalizedPath : resolve38(cwd, normalizedPath);
|
|
315547
315607
|
const { resolvedPath, isCanonical } = safeResolvePath3(getFsImplementation2(), absolutePath);
|
|
315548
315608
|
const result = isPathAllowed2(resolvedPath, toolPermissionContext, operationType, isCanonical ? [resolvedPath] : undefined);
|
|
315549
315609
|
return {
|
|
@@ -315553,7 +315613,7 @@ function validatePath3(filePath, cwd, toolPermissionContext, operationType) {
|
|
|
315553
315613
|
};
|
|
315554
315614
|
}
|
|
315555
315615
|
const basePath = getGlobBaseDirectory2(normalizedPath);
|
|
315556
|
-
const absoluteBasePath = isAbsolute27(basePath) ? basePath :
|
|
315616
|
+
const absoluteBasePath = isAbsolute27(basePath) ? basePath : resolve38(cwd, basePath);
|
|
315557
315617
|
const { resolvedPath } = safeResolvePath3(getFsImplementation2(), absoluteBasePath);
|
|
315558
315618
|
const permissionType = operationType === "read" ? "read" : "edit";
|
|
315559
315619
|
const denyRule = matchingRuleForInput2(resolvedPath, toolPermissionContext, permissionType, "deny");
|
|
@@ -315573,7 +315633,7 @@ function validatePath3(filePath, cwd, toolPermissionContext, operationType) {
|
|
|
315573
315633
|
}
|
|
315574
315634
|
};
|
|
315575
315635
|
}
|
|
315576
|
-
const absolutePath = isAbsolute27(normalizedPath) ? normalizedPath :
|
|
315636
|
+
const absolutePath = isAbsolute27(normalizedPath) ? normalizedPath : resolve38(cwd, normalizedPath);
|
|
315577
315637
|
const { resolvedPath, isCanonical } = safeResolvePath3(getFsImplementation2(), absolutePath);
|
|
315578
315638
|
const result = isPathAllowed2(resolvedPath, toolPermissionContext, operationType, isCanonical ? [resolvedPath] : undefined);
|
|
315579
315639
|
return {
|
|
@@ -317487,7 +317547,7 @@ var init_powershellSecurity = __esm(() => {
|
|
|
317487
317547
|
});
|
|
317488
317548
|
|
|
317489
317549
|
// src/tui/tools/PowerShellTool/powershellPermissions.ts
|
|
317490
|
-
import { resolve as
|
|
317550
|
+
import { resolve as resolve39 } from "path";
|
|
317491
317551
|
async function extractCommandName(command) {
|
|
317492
317552
|
const trimmed = command.trim();
|
|
317493
317553
|
if (!trimmed) {
|
|
@@ -318100,7 +318160,7 @@ async function powershellToolHasPermission(input, context) {
|
|
|
318100
318160
|
const canonical = resolveToCanonical(element.name);
|
|
318101
318161
|
if (canonical === "set-location" && element.args.length > 0) {
|
|
318102
318162
|
const target = element.args.find((a) => a.length === 0 || !PS_TOKENIZER_DASH_CHARS.has(a[0]));
|
|
318103
|
-
if (target &&
|
|
318163
|
+
if (target && resolve39(getCwd(), target) === getCwd()) {
|
|
318104
318164
|
return false;
|
|
318105
318165
|
}
|
|
318106
318166
|
}
|
|
@@ -324633,7 +324693,7 @@ var init_toolSearch = __esm(() => {
|
|
|
324633
324693
|
|
|
324634
324694
|
// src/tui/services/vcr.ts
|
|
324635
324695
|
import { createHash as createHash8, randomUUID as randomUUID33 } from "crypto";
|
|
324636
|
-
import { mkdir as mkdir34, readFile as
|
|
324696
|
+
import { mkdir as mkdir34, readFile as readFile37, writeFile as writeFile24 } from "fs/promises";
|
|
324637
324697
|
import { dirname as dirname57, join as join109 } from "path";
|
|
324638
324698
|
function shouldUseVCR() {
|
|
324639
324699
|
if (false) {}
|
|
@@ -324649,7 +324709,7 @@ async function withFixture(input, fixtureName, f) {
|
|
|
324649
324709
|
const hash = createHash8("sha1").update(jsonStringify5(input)).digest("hex").slice(0, 12);
|
|
324650
324710
|
const filename = join109(process.env.ATLAS_TEST_FIXTURES_ROOT ?? getCwd(), `fixtures/${fixtureName}-${hash}.json`);
|
|
324651
324711
|
try {
|
|
324652
|
-
const cached = jsonParse2(await
|
|
324712
|
+
const cached = jsonParse2(await readFile37(filename, { encoding: "utf8" }));
|
|
324653
324713
|
return cached;
|
|
324654
324714
|
} catch (e) {
|
|
324655
324715
|
const code = getErrnoCode2(e);
|
|
@@ -324871,7 +324931,7 @@ var init_tokenEstimation = __esm(() => {
|
|
|
324871
324931
|
|
|
324872
324932
|
// src/tui/utils/pdf.ts
|
|
324873
324933
|
import { randomUUID as randomUUID34 } from "crypto";
|
|
324874
|
-
import { mkdir as mkdir35, readdir as readdir19, readFile as
|
|
324934
|
+
import { mkdir as mkdir35, readdir as readdir19, readFile as readFile38 } from "fs/promises";
|
|
324875
324935
|
import { join as join110 } from "path";
|
|
324876
324936
|
async function readPDF2(filePath) {
|
|
324877
324937
|
try {
|
|
@@ -324893,7 +324953,7 @@ async function readPDF2(filePath) {
|
|
|
324893
324953
|
}
|
|
324894
324954
|
};
|
|
324895
324955
|
}
|
|
324896
|
-
const fileBuffer = await
|
|
324956
|
+
const fileBuffer = await readFile38(filePath);
|
|
324897
324957
|
const header = fileBuffer.subarray(0, 5).toString("ascii");
|
|
324898
324958
|
if (!header.startsWith("%PDF-")) {
|
|
324899
324959
|
return {
|
|
@@ -325068,7 +325128,7 @@ var init_pdf2 = __esm(() => {
|
|
|
325068
325128
|
|
|
325069
325129
|
// src/tui/utils/readFileInRange.ts
|
|
325070
325130
|
import { createReadStream as createReadStream3, fstat as fstat2 } from "fs";
|
|
325071
|
-
import { stat as fsStat3, readFile as
|
|
325131
|
+
import { stat as fsStat3, readFile as readFile39 } from "fs/promises";
|
|
325072
325132
|
async function readFileInRange2(filePath, offset = 0, maxLines, maxBytes, signal, options) {
|
|
325073
325133
|
signal?.throwIfAborted();
|
|
325074
325134
|
const truncateOnByteLimit = options?.truncateOnByteLimit ?? false;
|
|
@@ -325080,7 +325140,7 @@ async function readFileInRange2(filePath, offset = 0, maxLines, maxBytes, signal
|
|
|
325080
325140
|
if (!truncateOnByteLimit && maxBytes !== undefined && stats.size > maxBytes) {
|
|
325081
325141
|
throw new FileTooLargeError2(stats.size, maxBytes);
|
|
325082
325142
|
}
|
|
325083
|
-
const text = await
|
|
325143
|
+
const text = await readFile39(filePath, { encoding: "utf8", signal });
|
|
325084
325144
|
return readFileInRangeFast2(text, stats.mtimeMs, offset, maxLines, truncateOnByteLimit ? maxBytes : undefined);
|
|
325085
325145
|
}
|
|
325086
325146
|
return readFileInRangeStreaming2(filePath, offset, maxLines, maxBytes, truncateOnByteLimit, signal);
|
|
@@ -326494,7 +326554,7 @@ var init_findRelevantMemories = __esm(() => {
|
|
|
326494
326554
|
|
|
326495
326555
|
// src/tui/utils/attachments.ts
|
|
326496
326556
|
import { readdir as readdir21, stat as stat37 } from "fs/promises";
|
|
326497
|
-
import { dirname as dirname58, parse as parse12, relative as relative21, resolve as
|
|
326557
|
+
import { dirname as dirname58, parse as parse12, relative as relative21, resolve as resolve40 } from "path";
|
|
326498
326558
|
import { randomUUID as randomUUID35 } from "crypto";
|
|
326499
326559
|
async function getAttachments(input, toolUseContext, ideSelection, queuedCommands, messages, querySource, options) {
|
|
326500
326560
|
if (isEnvTruthy2(process.env.ATLAS_DISABLE_ATTACHMENTS) || isEnvTruthy2(process.env.ATLAS_SIMPLE)) {
|
|
@@ -326915,7 +326975,7 @@ async function getSelectedLinesFromIDE(ideSelection, toolUseContext) {
|
|
|
326915
326975
|
];
|
|
326916
326976
|
}
|
|
326917
326977
|
function getDirectoriesToProcess(targetPath, originalCwd) {
|
|
326918
|
-
const targetDir = dirname58(
|
|
326978
|
+
const targetDir = dirname58(resolve40(targetPath));
|
|
326919
326979
|
const nestedDirs = [];
|
|
326920
326980
|
let currentDir = targetDir;
|
|
326921
326981
|
while (currentDir !== originalCwd && currentDir !== parse12(currentDir).root) {
|
|
@@ -327214,7 +327274,7 @@ async function getDynamicSkillAttachments(toolUseContext) {
|
|
|
327214
327274
|
const candidates = entries.filter((e) => e.isDirectory() || e.isSymbolicLink()).map((e) => e.name);
|
|
327215
327275
|
const checked = await Promise.all(candidates.map(async (name) => {
|
|
327216
327276
|
try {
|
|
327217
|
-
await stat37(
|
|
327277
|
+
await stat37(resolve40(skillDir, name, "SKILL.md"));
|
|
327218
327278
|
return name;
|
|
327219
327279
|
} catch {
|
|
327220
327280
|
return null;
|
|
@@ -328628,7 +328688,7 @@ import {
|
|
|
328628
328688
|
chmod as chmod4,
|
|
328629
328689
|
lstat as lstat5,
|
|
328630
328690
|
readdir as readdir22,
|
|
328631
|
-
readFile as
|
|
328691
|
+
readFile as readFile40,
|
|
328632
328692
|
rename as rename3,
|
|
328633
328693
|
rm as rm5,
|
|
328634
328694
|
stat as stat38,
|
|
@@ -328731,7 +328791,7 @@ async function collectFilesForZip(baseDir, relativePath, files, visited) {
|
|
|
328731
328791
|
await collectFilesForZip(baseDir, relPath, files, visited);
|
|
328732
328792
|
} else if (fileStat.isFile()) {
|
|
328733
328793
|
try {
|
|
328734
|
-
const content = await
|
|
328794
|
+
const content = await readFile40(fullPath);
|
|
328735
328795
|
files[relPath] = [
|
|
328736
328796
|
new Uint8Array(content),
|
|
328737
328797
|
{ os: 3, attrs: (fileStat.mode & 65535) << 16 }
|
|
@@ -329265,11 +329325,11 @@ var init_marketplaceHelpers = __esm(() => {
|
|
|
329265
329325
|
});
|
|
329266
329326
|
|
|
329267
329327
|
// src/tui/utils/plugins/officialMarketplaceGcs.ts
|
|
329268
|
-
import { chmod as chmod5, mkdir as mkdir36, readFile as
|
|
329269
|
-
import { dirname as dirname61, join as join116, resolve as
|
|
329328
|
+
import { chmod as chmod5, mkdir as mkdir36, readFile as readFile41, rename as rename4, rm as rm7, writeFile as writeFile27 } from "fs/promises";
|
|
329329
|
+
import { dirname as dirname61, join as join116, resolve as resolve41, sep as sep24 } from "path";
|
|
329270
329330
|
async function fetchOfficialMarketplaceFromGcs(installLocation, marketplacesCacheDir) {
|
|
329271
|
-
const cacheDir =
|
|
329272
|
-
const resolvedLoc =
|
|
329331
|
+
const cacheDir = resolve41(marketplacesCacheDir);
|
|
329332
|
+
const resolvedLoc = resolve41(installLocation);
|
|
329273
329333
|
if (resolvedLoc !== cacheDir && !resolvedLoc.startsWith(cacheDir + sep24)) {
|
|
329274
329334
|
logForDebugging3(`fetchOfficialMarketplaceFromGcs: refusing path outside cache dir: ${installLocation}`, { level: "error" });
|
|
329275
329335
|
return null;
|
|
@@ -329290,7 +329350,7 @@ async function fetchOfficialMarketplaceFromGcs(installLocation, marketplacesCach
|
|
|
329290
329350
|
throw new Error("latest pointer returned empty body");
|
|
329291
329351
|
}
|
|
329292
329352
|
const sentinelPath = join116(installLocation, ".gcs-sha");
|
|
329293
|
-
const currentSha = await
|
|
329353
|
+
const currentSha = await readFile41(sentinelPath, "utf8").then((s) => s.trim(), () => null);
|
|
329294
329354
|
if (currentSha === sha) {
|
|
329295
329355
|
outcome = "noop";
|
|
329296
329356
|
return sha;
|
|
@@ -329403,7 +329463,7 @@ var init_ascendMarketplace = __esm(() => {
|
|
|
329403
329463
|
});
|
|
329404
329464
|
|
|
329405
329465
|
// src/tui/utils/plugins/orphanScanner.ts
|
|
329406
|
-
import { join as join117, resolve as
|
|
329466
|
+
import { join as join117, resolve as resolve42, sep as sep25 } from "path";
|
|
329407
329467
|
function normalizeRepoRef(ref) {
|
|
329408
329468
|
let u = ref.trim();
|
|
329409
329469
|
const ssh = u.match(/^git@([^:]+):(.+)$/);
|
|
@@ -329447,7 +329507,7 @@ async function readOrphanManifestName(dirPath) {
|
|
|
329447
329507
|
}
|
|
329448
329508
|
async function scanOrphanedMarketplaces() {
|
|
329449
329509
|
const fs = getFsImplementation2();
|
|
329450
|
-
const cacheDir =
|
|
329510
|
+
const cacheDir = resolve42(getMarketplacesCacheDir());
|
|
329451
329511
|
let entries;
|
|
329452
329512
|
try {
|
|
329453
329513
|
entries = await fs.readdir(cacheDir);
|
|
@@ -329455,8 +329515,8 @@ async function scanOrphanedMarketplaces() {
|
|
|
329455
329515
|
return [];
|
|
329456
329516
|
}
|
|
329457
329517
|
const config = await loadKnownMarketplacesConfigSafe();
|
|
329458
|
-
const registered = new Set(Object.values(config).map((e) =>
|
|
329459
|
-
const seedDirs = getPluginSeedDirs().map((d) =>
|
|
329518
|
+
const registered = new Set(Object.values(config).map((e) => resolve42(e.installLocation)));
|
|
329519
|
+
const seedDirs = getPluginSeedDirs().map((d) => resolve42(d));
|
|
329460
329520
|
const orphans = [];
|
|
329461
329521
|
for (const entry of entries) {
|
|
329462
329522
|
if (!entry.isDirectory())
|
|
@@ -329494,7 +329554,7 @@ var init_orphanScanner = __esm(() => {
|
|
|
329494
329554
|
|
|
329495
329555
|
// src/tui/utils/plugins/marketplaceManager.ts
|
|
329496
329556
|
import { writeFile as writeFile28 } from "fs/promises";
|
|
329497
|
-
import { basename as basename35, dirname as dirname62, isAbsolute as isAbsolute31, join as join118, resolve as
|
|
329557
|
+
import { basename as basename35, dirname as dirname62, isAbsolute as isAbsolute31, join as join118, resolve as resolve43, sep as sep26 } from "path";
|
|
329498
329558
|
function getKnownMarketplacesFile() {
|
|
329499
329559
|
return join118(getPluginsDirectory(), "known_marketplaces.json");
|
|
329500
329560
|
}
|
|
@@ -330280,14 +330340,14 @@ async function loadAndCacheMarketplace(source, onProgress) {
|
|
|
330280
330340
|
break;
|
|
330281
330341
|
}
|
|
330282
330342
|
case "file": {
|
|
330283
|
-
const absPath =
|
|
330343
|
+
const absPath = resolve43(source.path);
|
|
330284
330344
|
marketplacePath = absPath;
|
|
330285
330345
|
temporaryCachePath = dirname62(dirname62(absPath));
|
|
330286
330346
|
cleanupNeeded = false;
|
|
330287
330347
|
break;
|
|
330288
330348
|
}
|
|
330289
330349
|
case "directory": {
|
|
330290
|
-
const absPath =
|
|
330350
|
+
const absPath = resolve43(source.path);
|
|
330291
330351
|
marketplacePath = findManifestInDir(absPath, "marketplace.json");
|
|
330292
330352
|
temporaryCachePath = absPath;
|
|
330293
330353
|
cleanupNeeded = false;
|
|
@@ -330319,8 +330379,8 @@ async function loadAndCacheMarketplace(source, onProgress) {
|
|
|
330319
330379
|
throw new Error(`Failed to parse marketplace file at ${marketplacePath}: ${errorMessage2(e)}`);
|
|
330320
330380
|
}
|
|
330321
330381
|
const finalCachePath = join118(cacheDir, marketplace.name);
|
|
330322
|
-
const resolvedFinal =
|
|
330323
|
-
const resolvedCacheDir =
|
|
330382
|
+
const resolvedFinal = resolve43(finalCachePath);
|
|
330383
|
+
const resolvedCacheDir = resolve43(cacheDir);
|
|
330324
330384
|
if (!resolvedFinal.startsWith(resolvedCacheDir + sep26)) {
|
|
330325
330385
|
throw new Error(`Marketplace name '${marketplace.name}' resolves to a path outside the cache directory`);
|
|
330326
330386
|
}
|
|
@@ -330369,7 +330429,7 @@ async function captureResolvedSha(source, cachePath) {
|
|
|
330369
330429
|
async function addMarketplaceSource(source, onProgress) {
|
|
330370
330430
|
let resolvedSource = source;
|
|
330371
330431
|
if (isLocalMarketplaceSource(source) && !isAbsolute31(source.path)) {
|
|
330372
|
-
resolvedSource = { ...source, path:
|
|
330432
|
+
resolvedSource = { ...source, path: resolve43(source.path) };
|
|
330373
330433
|
}
|
|
330374
330434
|
if (!isSourceAllowedByPolicy(resolvedSource)) {
|
|
330375
330435
|
if (isSourceInBlocklist(resolvedSource)) {
|
|
@@ -330418,9 +330478,9 @@ Tip: The shorthand "${resolvedSource.repo}" assumes github.com. ` + `For interna
|
|
|
330418
330478
|
}
|
|
330419
330479
|
logForDebugging3(`Marketplace '${marketplace.name}' exists with different source — overwriting`);
|
|
330420
330480
|
if (!isLocalMarketplaceSource(oldEntry.source)) {
|
|
330421
|
-
const cacheDir =
|
|
330422
|
-
const resolvedOld =
|
|
330423
|
-
const resolvedNew =
|
|
330481
|
+
const cacheDir = resolve43(getMarketplacesCacheDir());
|
|
330482
|
+
const resolvedOld = resolve43(oldEntry.installLocation);
|
|
330483
|
+
const resolvedNew = resolve43(cachePath);
|
|
330424
330484
|
if (resolvedOld === resolvedNew) {} else if (resolvedOld === cacheDir || resolvedOld.startsWith(cacheDir + sep26)) {
|
|
330425
330485
|
const fs = getFsImplementation2();
|
|
330426
330486
|
await fs.rm(oldEntry.installLocation, { recursive: true, force: true });
|
|
@@ -330442,7 +330502,7 @@ Tip: The shorthand "${resolvedSource.repo}" assumes github.com. ` + `For interna
|
|
|
330442
330502
|
}
|
|
330443
330503
|
async function adoptOrphanMarketplace(dirName, overrideName) {
|
|
330444
330504
|
const fs = getFsImplementation2();
|
|
330445
|
-
const cacheDir =
|
|
330505
|
+
const cacheDir = resolve43(getMarketplacesCacheDir());
|
|
330446
330506
|
const dirPath = join118(cacheDir, dirName);
|
|
330447
330507
|
if (!fs.existsSync(dirPath) || !fs.statSync(dirPath).isDirectory()) {
|
|
330448
330508
|
throw new Error(`No marketplace directory named '${dirName}' in ${cacheDir}. ` + `Run \`plugin marketplace list\` to see unregistered directories.`);
|
|
@@ -330472,7 +330532,7 @@ async function adoptOrphanMarketplace(dirName, overrideName) {
|
|
|
330472
330532
|
await updateKnownMarketplacesConfig((existing) => {
|
|
330473
330533
|
const prior = existing[name];
|
|
330474
330534
|
if (prior) {
|
|
330475
|
-
if (
|
|
330535
|
+
if (resolve43(prior.installLocation) === resolve43(dirPath)) {
|
|
330476
330536
|
return;
|
|
330477
330537
|
}
|
|
330478
330538
|
throw new Error(`Marketplace name '${name}' is already registered at ` + `${prior.installLocation}. Remove it first ` + `(\`plugin marketplace remove ${name}\`) or adopt under a different name.`);
|
|
@@ -330703,8 +330763,8 @@ async function refreshMarketplace(name, onProgress, options) {
|
|
|
330703
330763
|
throw new Error(`Marketplace '${name}' is seed-managed (${seedDir}) and its content is ` + `controlled by the seed image. To update: ask your admin to update the seed.`);
|
|
330704
330764
|
}
|
|
330705
330765
|
if (!isLocalMarketplaceSource(source)) {
|
|
330706
|
-
const cacheDir =
|
|
330707
|
-
const resolvedLoc =
|
|
330766
|
+
const cacheDir = resolve43(getMarketplacesCacheDir());
|
|
330767
|
+
const resolvedLoc = resolve43(installLocation);
|
|
330708
330768
|
if (resolvedLoc !== cacheDir && !resolvedLoc.startsWith(cacheDir + sep26)) {
|
|
330709
330769
|
throw new Error(`Marketplace '${name}' has a corrupted installLocation ` + `(${installLocation}) — expected a path inside ${cacheDir}. ` + `This can happen after cross-platform path writes or manual edits ` + `to known_marketplaces.json. ` + `Run: claude plugin marketplace remove "${name}" and re-add it.`);
|
|
330710
330770
|
}
|
|
@@ -331454,7 +331514,7 @@ var init_mtimeAwareMemoize = () => {};
|
|
|
331454
331514
|
|
|
331455
331515
|
// src/tui/utils/plugins/installCounts.ts
|
|
331456
331516
|
import { randomBytes as randomBytes15 } from "crypto";
|
|
331457
|
-
import { readFile as
|
|
331517
|
+
import { readFile as readFile42, rename as rename5, unlink as unlink16, writeFile as writeFile29 } from "fs/promises";
|
|
331458
331518
|
import { join as join120 } from "path";
|
|
331459
331519
|
function normalizeStatsBase(raw) {
|
|
331460
331520
|
if (!raw)
|
|
@@ -331495,7 +331555,7 @@ function getInstallCountsCachePath() {
|
|
|
331495
331555
|
async function loadInstallCountsCache() {
|
|
331496
331556
|
const cachePath = getInstallCountsCachePath();
|
|
331497
331557
|
try {
|
|
331498
|
-
const content = await
|
|
331558
|
+
const content = await readFile42(cachePath, { encoding: "utf-8" });
|
|
331499
331559
|
const parsed = jsonParse2(content);
|
|
331500
331560
|
if (typeof parsed !== "object" || parsed === null || !("version" in parsed) || !("entries" in parsed)) {
|
|
331501
331561
|
logForDebugging3("Install counts cache has invalid structure");
|
|
@@ -331708,14 +331768,14 @@ var init_pluginVersioning = __esm(() => {
|
|
|
331708
331768
|
// src/tui/utils/plugins/pluginInstallationHelpers.ts
|
|
331709
331769
|
import { randomBytes as randomBytes16 } from "crypto";
|
|
331710
331770
|
import { rename as rename6, rm as rm8 } from "fs/promises";
|
|
331711
|
-
import { dirname as dirname64, join as join121, resolve as
|
|
331771
|
+
import { dirname as dirname64, join as join121, resolve as resolve44, sep as sep27 } from "path";
|
|
331712
331772
|
function getCurrentTimestamp() {
|
|
331713
331773
|
return new Date().toISOString();
|
|
331714
331774
|
}
|
|
331715
331775
|
function validatePathWithinBase(basePath, relativePath) {
|
|
331716
|
-
const resolvedPath =
|
|
331717
|
-
const normalizedBase =
|
|
331718
|
-
if (!resolvedPath.startsWith(normalizedBase) && resolvedPath !==
|
|
331776
|
+
const resolvedPath = resolve44(basePath, relativePath);
|
|
331777
|
+
const normalizedBase = resolve44(basePath) + sep27;
|
|
331778
|
+
if (!resolvedPath.startsWith(normalizedBase) && resolvedPath !== resolve44(basePath)) {
|
|
331719
331779
|
throw new Error(`Path traversal detected: "${relativePath}" would escape the base directory`);
|
|
331720
331780
|
}
|
|
331721
331781
|
return resolvedPath;
|
|
@@ -331947,7 +332007,7 @@ var init_pluginInstallationHelpers = __esm(() => {
|
|
|
331947
332007
|
import {
|
|
331948
332008
|
copyFile as copyFile6,
|
|
331949
332009
|
readdir as readdir24,
|
|
331950
|
-
readFile as
|
|
332010
|
+
readFile as readFile43,
|
|
331951
332011
|
readlink,
|
|
331952
332012
|
realpath as realpath11,
|
|
331953
332013
|
rename as rename7,
|
|
@@ -331956,7 +332016,7 @@ import {
|
|
|
331956
332016
|
stat as stat40,
|
|
331957
332017
|
symlink as symlink5
|
|
331958
332018
|
} from "fs/promises";
|
|
331959
|
-
import { basename as basename36, dirname as dirname65, join as join122, relative as relative22, resolve as
|
|
332019
|
+
import { basename as basename36, dirname as dirname65, join as join122, relative as relative22, resolve as resolve45, sep as sep28 } from "path";
|
|
331960
332020
|
function getPluginCachePath() {
|
|
331961
332021
|
return join122(getPluginsDirectory(), "cache");
|
|
331962
332022
|
}
|
|
@@ -332347,7 +332407,7 @@ async function cachePlugin(source, options) {
|
|
|
332347
332407
|
let manifest;
|
|
332348
332408
|
if (await pathExists2(manifestPath)) {
|
|
332349
332409
|
try {
|
|
332350
|
-
const content = await
|
|
332410
|
+
const content = await readFile43(manifestPath, { encoding: "utf-8" });
|
|
332351
332411
|
const parsed = jsonParse2(content);
|
|
332352
332412
|
const result = PluginManifestSchema().safeParse(parsed);
|
|
332353
332413
|
if (result.success) {
|
|
@@ -332371,7 +332431,7 @@ async function cachePlugin(source, options) {
|
|
|
332371
332431
|
}
|
|
332372
332432
|
} else if (await pathExists2(legacyManifestPath)) {
|
|
332373
332433
|
try {
|
|
332374
|
-
const content = await
|
|
332434
|
+
const content = await readFile43(legacyManifestPath, {
|
|
332375
332435
|
encoding: "utf-8"
|
|
332376
332436
|
});
|
|
332377
332437
|
const parsed = jsonParse2(content);
|
|
@@ -332421,7 +332481,7 @@ async function loadPluginManifest(manifestPath, pluginName, source) {
|
|
|
332421
332481
|
};
|
|
332422
332482
|
}
|
|
332423
332483
|
try {
|
|
332424
|
-
const content = await
|
|
332484
|
+
const content = await readFile43(manifestPath, { encoding: "utf-8" });
|
|
332425
332485
|
const parsedJson = jsonParse2(content);
|
|
332426
332486
|
const result = PluginManifestSchema().safeParse(parsedJson);
|
|
332427
332487
|
if (result.success) {
|
|
@@ -332447,7 +332507,7 @@ async function loadPluginHooks2(hooksConfigPath, pluginName) {
|
|
|
332447
332507
|
if (!await pathExists2(hooksConfigPath)) {
|
|
332448
332508
|
throw new Error(`Hooks file not found at ${hooksConfigPath} for plugin ${pluginName}. If the manifest declares hooks, the file must exist.`);
|
|
332449
332509
|
}
|
|
332450
|
-
const content = await
|
|
332510
|
+
const content = await readFile43(hooksConfigPath, { encoding: "utf-8" });
|
|
332451
332511
|
const rawHooksConfig = jsonParse2(content);
|
|
332452
332512
|
const validatedPluginHooks = PluginHooksSchema().parse(rawHooksConfig);
|
|
332453
332513
|
return validatedPluginHooks.hooks;
|
|
@@ -332750,7 +332810,7 @@ function parsePluginSettings(raw) {
|
|
|
332750
332810
|
async function loadPluginSettings(pluginPath, manifest) {
|
|
332751
332811
|
const settingsJsonPath = join122(pluginPath, "settings.json");
|
|
332752
332812
|
try {
|
|
332753
|
-
const content = await
|
|
332813
|
+
const content = await readFile43(settingsJsonPath, { encoding: "utf-8" });
|
|
332754
332814
|
const parsed = jsonParse2(content);
|
|
332755
332815
|
if (isRecord(parsed)) {
|
|
332756
332816
|
const filtered = parsePluginSettings(parsed);
|
|
@@ -333310,7 +333370,7 @@ async function loadSessionOnlyPlugins(sessionPluginPaths) {
|
|
|
333310
333370
|
const errors = [];
|
|
333311
333371
|
for (const [index, pluginPath] of sessionPluginPaths.entries()) {
|
|
333312
333372
|
try {
|
|
333313
|
-
const resolvedPath =
|
|
333373
|
+
const resolvedPath = resolve45(pluginPath);
|
|
333314
333374
|
if (!await pathExists2(resolvedPath)) {
|
|
333315
333375
|
logForDebugging3(`Plugin path does not exist: ${resolvedPath}, skipping`, { level: "warn" });
|
|
333316
333376
|
errors.push({
|
|
@@ -333834,6 +333894,9 @@ function buildYoloRejectionMessage(reason) {
|
|
|
333834
333894
|
const ruleHint = feature("BASH_CLASSIFIER") ? `To allow this type of action in the future, the user can add a permission rule like ` + `Bash(prompt: <description of allowed action>) to their settings. ` + `At the end of your session, recommend what permission rules to add so you don't get blocked again.` : `To allow this type of action in the future, the user can add a Bash permission rule to their settings.`;
|
|
333835
333895
|
return `${prefix}${reason}. ` + `If you have other tasks that don't depend on this action, continue working on those. ` + `${DENIAL_WORKAROUND_GUIDANCE2} ` + ruleHint;
|
|
333836
333896
|
}
|
|
333897
|
+
function buildYoloRejectionMessageWithRetry(reason) {
|
|
333898
|
+
return buildYoloRejectionMessage(reason) + " A PermissionDenied hook indicated this action may be retried: you may try the action again.";
|
|
333899
|
+
}
|
|
333837
333900
|
function buildClassifierUnavailableMessage(toolName, classifierModel) {
|
|
333838
333901
|
return `${classifierModel} is temporarily unavailable, so auto mode cannot determine the safety of ${toolName} right now. ` + `Wait briefly and then try this action again. ` + `If it keeps failing, continue with other tasks that don't require this action and come back to it later. ` + `Note: reading files, searching code, and other read-only operations do not require the classifier and can still be used.`;
|
|
333839
333902
|
}
|
|
@@ -337820,6 +337883,24 @@ async function runPermissionRequestHooksForHeadlessAgent(tool, input, toolUseID,
|
|
|
337820
337883
|
}
|
|
337821
337884
|
return null;
|
|
337822
337885
|
}
|
|
337886
|
+
async function runPermissionDeniedHooks(tool, input, toolUseID, reason, context, permissionMode) {
|
|
337887
|
+
let retry = false;
|
|
337888
|
+
try {
|
|
337889
|
+
for await (const hookResult of executePermissionDeniedHooks(tool.name, toolUseID, input, reason, context, permissionMode, context.abortController.signal)) {
|
|
337890
|
+
if (hookResult.retry) {
|
|
337891
|
+
retry = true;
|
|
337892
|
+
}
|
|
337893
|
+
}
|
|
337894
|
+
} catch (error) {
|
|
337895
|
+
logError3(new Error("PermissionDenied hook failed", {
|
|
337896
|
+
cause: toError2(error)
|
|
337897
|
+
}));
|
|
337898
|
+
}
|
|
337899
|
+
if (retry) {
|
|
337900
|
+
logForDebugging3("PermissionDenied hook set retry=true; rejection carries retry guidance", { level: "info" });
|
|
337901
|
+
}
|
|
337902
|
+
return retry;
|
|
337903
|
+
}
|
|
337823
337904
|
function persistDenialState(context, newState) {
|
|
337824
337905
|
if (context.localDenialTracking) {
|
|
337825
337906
|
Object.assign(context.localDenialTracking, newState);
|
|
@@ -337863,6 +337944,57 @@ Latest blocked action: ${classifierReason}`
|
|
|
337863
337944
|
}
|
|
337864
337945
|
};
|
|
337865
337946
|
}
|
|
337947
|
+
async function checkRuleBasedPermissions(tool, input, context) {
|
|
337948
|
+
const appState = context.getAppState();
|
|
337949
|
+
const denyRule = getDenyRuleForTool2(appState.toolPermissionContext, tool);
|
|
337950
|
+
if (denyRule) {
|
|
337951
|
+
return {
|
|
337952
|
+
behavior: "deny",
|
|
337953
|
+
decisionReason: {
|
|
337954
|
+
type: "rule",
|
|
337955
|
+
rule: denyRule
|
|
337956
|
+
},
|
|
337957
|
+
message: `Permission to use ${tool.name} has been denied.`
|
|
337958
|
+
};
|
|
337959
|
+
}
|
|
337960
|
+
const askRule = getAskRuleForTool2(appState.toolPermissionContext, tool);
|
|
337961
|
+
if (askRule) {
|
|
337962
|
+
const canSandboxAutoAllow = tool.name === BASH_TOOL_NAME2 && getSandboxManager().isSandboxingEnabled() && getSandboxManager().isAutoAllowBashIfSandboxedEnabled() && shouldUseSandbox2(input);
|
|
337963
|
+
if (!canSandboxAutoAllow) {
|
|
337964
|
+
return {
|
|
337965
|
+
behavior: "ask",
|
|
337966
|
+
decisionReason: {
|
|
337967
|
+
type: "rule",
|
|
337968
|
+
rule: askRule
|
|
337969
|
+
},
|
|
337970
|
+
message: createPermissionRequestMessage4(tool.name)
|
|
337971
|
+
};
|
|
337972
|
+
}
|
|
337973
|
+
}
|
|
337974
|
+
let toolPermissionResult = {
|
|
337975
|
+
behavior: "passthrough",
|
|
337976
|
+
message: createPermissionRequestMessage4(tool.name)
|
|
337977
|
+
};
|
|
337978
|
+
try {
|
|
337979
|
+
const parsedInput = tool.inputSchema.parse(input);
|
|
337980
|
+
toolPermissionResult = await tool.checkPermissions(parsedInput, context);
|
|
337981
|
+
} catch (e) {
|
|
337982
|
+
if (e instanceof AbortError2 || e instanceof APIUserAbortError3) {
|
|
337983
|
+
throw e;
|
|
337984
|
+
}
|
|
337985
|
+
logError3(e);
|
|
337986
|
+
}
|
|
337987
|
+
if (toolPermissionResult?.behavior === "deny") {
|
|
337988
|
+
return toolPermissionResult;
|
|
337989
|
+
}
|
|
337990
|
+
if (toolPermissionResult?.behavior === "ask" && toolPermissionResult.decisionReason?.type === "rule" && toolPermissionResult.decisionReason.rule.ruleBehavior === "ask") {
|
|
337991
|
+
return toolPermissionResult;
|
|
337992
|
+
}
|
|
337993
|
+
if (toolPermissionResult?.behavior === "ask" && toolPermissionResult.decisionReason?.type === "safetyCheck") {
|
|
337994
|
+
return toolPermissionResult;
|
|
337995
|
+
}
|
|
337996
|
+
return null;
|
|
337997
|
+
}
|
|
337866
337998
|
async function hasPermissionsToUseToolInner(tool, input, context) {
|
|
337867
337999
|
if (context.abortController.signal.aborted) {
|
|
337868
338000
|
throw new AbortError2;
|
|
@@ -338181,6 +338313,7 @@ var classifierDecisionModule, autoModeStateModule3, CLASSIFIER_FAIL_CLOSED_REFRE
|
|
|
338181
338313
|
if (classifierResult.unavailable) {
|
|
338182
338314
|
if (getFeatureValue_CACHED_WITH_REFRESH("atlas_iron_gate_closed", true, CLASSIFIER_FAIL_CLOSED_REFRESH_MS)) {
|
|
338183
338315
|
logForDebugging3("Auto mode classifier unavailable, denying with retry guidance (fail closed)", { level: "warn" });
|
|
338316
|
+
await runPermissionDeniedHooks(tool, input, toolUseID, "Classifier unavailable", context, appState.toolPermissionContext.mode);
|
|
338184
338317
|
return {
|
|
338185
338318
|
behavior: "deny",
|
|
338186
338319
|
decisionReason: {
|
|
@@ -338199,9 +338332,11 @@ var classifierDecisionModule, autoModeStateModule3, CLASSIFIER_FAIL_CLOSED_REFRE
|
|
|
338199
338332
|
logForDebugging3(`Auto mode classifier blocked action: ${classifierResult.reason}`, { level: "warn" });
|
|
338200
338333
|
const denialLimitResult = handleDenialLimitExceeded(newDenialState, appState, classifierResult.reason, assistantMessage, tool, result, context);
|
|
338201
338334
|
if (denialLimitResult) {
|
|
338335
|
+
await runPermissionDeniedHooks(tool, input, toolUseID, classifierResult.reason, context, appState.toolPermissionContext.mode);
|
|
338202
338336
|
return denialLimitResult;
|
|
338203
338337
|
}
|
|
338204
338338
|
if (appState.toolPermissionContext.shouldAvoidPermissionPrompts) {
|
|
338339
|
+
const deniedRetry = await runPermissionDeniedHooks(tool, input, toolUseID, classifierResult.reason, context, appState.toolPermissionContext.mode);
|
|
338205
338340
|
return {
|
|
338206
338341
|
behavior: "deny",
|
|
338207
338342
|
decisionReason: {
|
|
@@ -338209,9 +338344,10 @@ var classifierDecisionModule, autoModeStateModule3, CLASSIFIER_FAIL_CLOSED_REFRE
|
|
|
338209
338344
|
classifier: "auto-mode",
|
|
338210
338345
|
reason: classifierResult.reason
|
|
338211
338346
|
},
|
|
338212
|
-
message: buildYoloRejectionMessage(classifierResult.reason)
|
|
338347
|
+
message: deniedRetry ? buildYoloRejectionMessageWithRetry(classifierResult.reason) : buildYoloRejectionMessage(classifierResult.reason)
|
|
338213
338348
|
};
|
|
338214
338349
|
}
|
|
338350
|
+
await runPermissionDeniedHooks(tool, input, toolUseID, classifierResult.reason, context, appState.toolPermissionContext.mode);
|
|
338215
338351
|
return {
|
|
338216
338352
|
...result,
|
|
338217
338353
|
decisionReason: {
|
|
@@ -338313,7 +338449,7 @@ __export(exports_permissionSetup, {
|
|
|
338313
338449
|
verifyAutoModeGateAccess: () => verifyAutoModeGateAccess
|
|
338314
338450
|
});
|
|
338315
338451
|
import { relative as relative23 } from "path";
|
|
338316
|
-
import { resolve as
|
|
338452
|
+
import { resolve as resolve46 } from "path";
|
|
338317
338453
|
function isDangerousBashPermission(toolName, ruleContent) {
|
|
338318
338454
|
if (toolName !== BASH_TOOL_NAME2) {
|
|
338319
338455
|
return false;
|
|
@@ -338585,7 +338721,7 @@ function isSymlinkTo2({
|
|
|
338585
338721
|
originalCwd
|
|
338586
338722
|
}) {
|
|
338587
338723
|
const { resolvedPath: resolvedProcessPwd, isSymlink: isProcessPwdSymlink } = safeResolvePath3(getFsImplementation2(), processPwd);
|
|
338588
|
-
return isProcessPwdSymlink ? resolvedProcessPwd ===
|
|
338724
|
+
return isProcessPwdSymlink ? resolvedProcessPwd === resolve46(originalCwd) : false;
|
|
338589
338725
|
}
|
|
338590
338726
|
function initialPermissionModeFromCLI2({
|
|
338591
338727
|
permissionModeCli,
|
|
@@ -339644,7 +339780,7 @@ __export(exports_terminalSetup, {
|
|
|
339644
339780
|
shouldOfferTerminalSetup: () => shouldOfferTerminalSetup
|
|
339645
339781
|
});
|
|
339646
339782
|
import { randomBytes as randomBytes18 } from "crypto";
|
|
339647
|
-
import { copyFile as copyFile7, mkdir as mkdir37, readFile as
|
|
339783
|
+
import { copyFile as copyFile7, mkdir as mkdir37, readFile as readFile44, writeFile as writeFile30 } from "fs/promises";
|
|
339648
339784
|
import { homedir as homedir31, platform as platform3 } from "os";
|
|
339649
339785
|
import { dirname as dirname66, join as join124 } from "path";
|
|
339650
339786
|
import { pathToFileURL as pathToFileURL8 } from "url";
|
|
@@ -339790,7 +339926,7 @@ async function installBindingsForVSCodeTerminal(editor = "VSCode", theme) {
|
|
|
339790
339926
|
let keybindings = [];
|
|
339791
339927
|
let fileExists = false;
|
|
339792
339928
|
try {
|
|
339793
|
-
content = await
|
|
339929
|
+
content = await readFile44(keybindingsPath, {
|
|
339794
339930
|
encoding: "utf-8"
|
|
339795
339931
|
});
|
|
339796
339932
|
fileExists = true;
|
|
@@ -339937,7 +340073,7 @@ chars = "\\u001B\\r"`;
|
|
|
339937
340073
|
let configExists = false;
|
|
339938
340074
|
for (const path of configPaths) {
|
|
339939
340075
|
try {
|
|
339940
|
-
configContent = await
|
|
340076
|
+
configContent = await readFile44(path, {
|
|
339941
340077
|
encoding: "utf-8"
|
|
339942
340078
|
});
|
|
339943
340079
|
configPath = path;
|
|
@@ -339999,7 +340135,7 @@ async function installBindingsForZed(theme) {
|
|
|
339999
340135
|
let keymapContent = "[]";
|
|
340000
340136
|
let fileExists = false;
|
|
340001
340137
|
try {
|
|
340002
|
-
keymapContent = await
|
|
340138
|
+
keymapContent = await readFile44(keymapPath, {
|
|
340003
340139
|
encoding: "utf-8"
|
|
340004
340140
|
});
|
|
340005
340141
|
fileExists = true;
|
|
@@ -340071,7 +340207,7 @@ var init_terminalSetup = __esm(() => {
|
|
|
340071
340207
|
|
|
340072
340208
|
// src/tui/utils/pasteStore.ts
|
|
340073
340209
|
import { createHash as createHash10 } from "crypto";
|
|
340074
|
-
import { mkdir as mkdir38, readdir as readdir25, readFile as
|
|
340210
|
+
import { mkdir as mkdir38, readdir as readdir25, readFile as readFile45, stat as stat42, unlink as unlink17, writeFile as writeFile31 } from "fs/promises";
|
|
340075
340211
|
import { join as join125 } from "path";
|
|
340076
340212
|
function getPasteStoreDir() {
|
|
340077
340213
|
return join125(getAtlasConfigHomeDir3(), PASTE_STORE_DIR);
|
|
@@ -340096,7 +340232,7 @@ async function storePastedText(hash, content) {
|
|
|
340096
340232
|
async function retrievePastedText(hash) {
|
|
340097
340233
|
try {
|
|
340098
340234
|
const pastePath = getPastePath(hash);
|
|
340099
|
-
return await
|
|
340235
|
+
return await readFile45(pastePath, { encoding: "utf8" });
|
|
340100
340236
|
} catch (error) {
|
|
340101
340237
|
if (!isENOENT2(error)) {
|
|
340102
340238
|
logForDebugging3(`Failed to retrieve paste ${hash}: ${error}`);
|
|
@@ -344165,7 +344301,7 @@ var init_btw2 = __esm(() => {
|
|
|
344165
344301
|
});
|
|
344166
344302
|
|
|
344167
344303
|
// src/tui/components/Feedback.tsx
|
|
344168
|
-
import { readFile as
|
|
344304
|
+
import { readFile as readFile46, stat as stat43 } from "fs/promises";
|
|
344169
344305
|
function redactSensitiveInfo(text) {
|
|
344170
344306
|
let redacted = text;
|
|
344171
344307
|
redacted = redacted.replace(/"(sk-ant[^\s"']{24,})"/g, '"[REDACTED_API_KEY]"');
|
|
@@ -344204,7 +344340,7 @@ async function loadRawTranscriptJsonl() {
|
|
|
344204
344340
|
});
|
|
344205
344341
|
return null;
|
|
344206
344342
|
}
|
|
344207
|
-
return await
|
|
344343
|
+
return await readFile46(transcriptPath, "utf-8");
|
|
344208
344344
|
} catch {
|
|
344209
344345
|
return null;
|
|
344210
344346
|
}
|
|
@@ -348134,7 +348270,7 @@ var init_localInstaller = __esm(() => {
|
|
|
348134
348270
|
});
|
|
348135
348271
|
|
|
348136
348272
|
// src/tui/utils/shellConfig.ts
|
|
348137
|
-
import { open as open14, readFile as
|
|
348273
|
+
import { open as open14, readFile as readFile47, stat as stat44 } from "fs/promises";
|
|
348138
348274
|
import { homedir as osHomedir } from "os";
|
|
348139
348275
|
import { join as join132 } from "path";
|
|
348140
348276
|
function getShellConfigPaths(options) {
|
|
@@ -348169,7 +348305,7 @@ function filterAtlasAliases(lines) {
|
|
|
348169
348305
|
}
|
|
348170
348306
|
async function readFileLines(filePath) {
|
|
348171
348307
|
try {
|
|
348172
|
-
const content = await
|
|
348308
|
+
const content = await readFile47(filePath, { encoding: "utf8" });
|
|
348173
348309
|
return content.split(`
|
|
348174
348310
|
`);
|
|
348175
348311
|
} catch (e) {
|
|
@@ -348512,7 +348648,7 @@ var init_autoUpdater = __esm(() => {
|
|
|
348512
348648
|
});
|
|
348513
348649
|
|
|
348514
348650
|
// src/tui/utils/nativeInstaller/packageManagers.ts
|
|
348515
|
-
import { readFile as
|
|
348651
|
+
import { readFile as readFile48 } from "fs/promises";
|
|
348516
348652
|
function isDistroFamily(osRelease, families) {
|
|
348517
348653
|
return families.includes(osRelease.id) || osRelease.idLike.some((like) => families.includes(like));
|
|
348518
348654
|
}
|
|
@@ -348570,7 +348706,7 @@ var init_packageManagers = __esm(() => {
|
|
|
348570
348706
|
init_platform3();
|
|
348571
348707
|
getOsRelease = memoize_default(async () => {
|
|
348572
348708
|
try {
|
|
348573
|
-
const content = await
|
|
348709
|
+
const content = await readFile48("/etc/os-release", "utf8");
|
|
348574
348710
|
const idMatch = content.match(/^ID=["']?(\S+?)["']?\s*$/m);
|
|
348575
348711
|
const idLikeMatch = content.match(/^ID_LIKE=["']?(.+?)["']?\s*$/m);
|
|
348576
348712
|
return {
|
|
@@ -348691,7 +348827,7 @@ var init_packageManagers = __esm(() => {
|
|
|
348691
348827
|
});
|
|
348692
348828
|
|
|
348693
348829
|
// src/tui/utils/doctorDiagnostic.ts
|
|
348694
|
-
import { readFile as
|
|
348830
|
+
import { readFile as readFile49, realpath as realpath12 } from "fs/promises";
|
|
348695
348831
|
import { homedir as homedir33 } from "os";
|
|
348696
348832
|
import { delimiter as delimiter2, join as join134, posix as posix8, win32 as win322 } from "path";
|
|
348697
348833
|
function getNormalizedPaths() {
|
|
@@ -348847,7 +348983,7 @@ async function detectMultipleInstallations() {
|
|
|
348847
348983
|
async function detectConfigurationIssues(type) {
|
|
348848
348984
|
const warnings = [];
|
|
348849
348985
|
try {
|
|
348850
|
-
const raw = await
|
|
348986
|
+
const raw = await readFile49(join134(getManagedFilePath(), "managed-settings.json"), "utf-8");
|
|
348851
348987
|
const parsed = jsonParse2(raw);
|
|
348852
348988
|
const field = parsed && typeof parsed === "object" ? parsed.strictPluginOnlyCustomization : undefined;
|
|
348853
348989
|
if (field !== undefined && typeof field !== "boolean") {
|
|
@@ -349360,7 +349496,7 @@ import {
|
|
|
349360
349496
|
writeFile as writeFile36
|
|
349361
349497
|
} from "fs/promises";
|
|
349362
349498
|
import { homedir as homedir34 } from "os";
|
|
349363
|
-
import { basename as basename42, delimiter as delimiter3, dirname as dirname69, join as join137, resolve as
|
|
349499
|
+
import { basename as basename42, delimiter as delimiter3, dirname as dirname69, join as join137, resolve as resolve47 } from "path";
|
|
349364
349500
|
function getPlatform4() {
|
|
349365
349501
|
const os = env5.platform;
|
|
349366
349502
|
const arch = process.arch === "x64" ? "x64" : process.arch === "arm64" ? "arm64" : null;
|
|
@@ -349708,8 +349844,8 @@ async function updateSymlink(symlinkPath, targetPath) {
|
|
|
349708
349844
|
if (symlinkExists) {
|
|
349709
349845
|
try {
|
|
349710
349846
|
const currentTarget = await readlink2(symlinkPath);
|
|
349711
|
-
const resolvedCurrentTarget =
|
|
349712
|
-
const resolvedTargetPath =
|
|
349847
|
+
const resolvedCurrentTarget = resolve47(dirname69(symlinkPath), currentTarget);
|
|
349848
|
+
const resolvedTargetPath = resolve47(targetPath);
|
|
349713
349849
|
if (resolvedCurrentTarget === resolvedTargetPath) {
|
|
349714
349850
|
return false;
|
|
349715
349851
|
}
|
|
@@ -349749,7 +349885,7 @@ async function checkInstall(force = false) {
|
|
|
349749
349885
|
const dirs = getBaseDirectories();
|
|
349750
349886
|
const messages = [];
|
|
349751
349887
|
const localBinDir = dirname69(dirs.executable);
|
|
349752
|
-
const resolvedLocalBinPath =
|
|
349888
|
+
const resolvedLocalBinPath = resolve47(localBinDir);
|
|
349753
349889
|
const platform = getPlatform4();
|
|
349754
349890
|
const isWindows = platform.startsWith("win32");
|
|
349755
349891
|
try {
|
|
@@ -349772,7 +349908,7 @@ async function checkInstall(force = false) {
|
|
|
349772
349908
|
} else {
|
|
349773
349909
|
try {
|
|
349774
349910
|
const target = await readlink2(dirs.executable);
|
|
349775
|
-
const absoluteTarget =
|
|
349911
|
+
const absoluteTarget = resolve47(dirname69(dirs.executable), target);
|
|
349776
349912
|
if (!await isPossibleClaudeBinary(absoluteTarget)) {
|
|
349777
349913
|
messages.push({
|
|
349778
349914
|
message: `AtlasCode symlink points to missing or invalid binary: ${target}`,
|
|
@@ -349800,7 +349936,7 @@ async function checkInstall(force = false) {
|
|
|
349800
349936
|
}
|
|
349801
349937
|
const isInCurrentPath = (process.env.PATH || "").split(delimiter3).some((entry) => {
|
|
349802
349938
|
try {
|
|
349803
|
-
const resolvedEntry =
|
|
349939
|
+
const resolvedEntry = resolve47(entry);
|
|
349804
349940
|
if (isWindows) {
|
|
349805
349941
|
return resolvedEntry.toLowerCase() === resolvedLocalBinPath.toLowerCase();
|
|
349806
349942
|
}
|
|
@@ -349879,7 +350015,7 @@ async function installLatestImpl(channelOrVersion, forceReinstall = false) {
|
|
|
349879
350015
|
async function getVersionFromSymlink(symlinkPath) {
|
|
349880
350016
|
try {
|
|
349881
350017
|
const target = await readlink2(symlinkPath);
|
|
349882
|
-
const absoluteTarget =
|
|
350018
|
+
const absoluteTarget = resolve47(dirname69(symlinkPath), target);
|
|
349883
350019
|
if (await isPossibleClaudeBinary(absoluteTarget)) {
|
|
349884
350020
|
return absoluteTarget;
|
|
349885
350021
|
}
|
|
@@ -349895,7 +350031,7 @@ async function lockCurrentVersion() {
|
|
|
349895
350031
|
if (!process.execPath.includes(dirs.versions)) {
|
|
349896
350032
|
return;
|
|
349897
350033
|
}
|
|
349898
|
-
const versionPath =
|
|
350034
|
+
const versionPath = resolve47(process.execPath);
|
|
349899
350035
|
try {
|
|
349900
350036
|
const lockfilePath = getLockFilePathFromVersionPath(dirs, versionPath);
|
|
349901
350037
|
await mkdir40(dirs.locks, { recursive: true });
|
|
@@ -350041,7 +350177,7 @@ async function cleanupOldVersions() {
|
|
|
350041
350177
|
versionFiles.push({
|
|
350042
350178
|
name: entry,
|
|
350043
350179
|
path: entryPath,
|
|
350044
|
-
resolvedPath:
|
|
350180
|
+
resolvedPath: resolve47(entryPath),
|
|
350045
350181
|
mtime: stats.mtime
|
|
350046
350182
|
});
|
|
350047
350183
|
} catch {}
|
|
@@ -350056,7 +350192,7 @@ async function cleanupOldVersions() {
|
|
|
350056
350192
|
const currentBinaryPath = process.execPath;
|
|
350057
350193
|
const protectedVersions = new Set;
|
|
350058
350194
|
if (currentBinaryPath && currentBinaryPath.includes(dirs.versions)) {
|
|
350059
|
-
protectedVersions.add(
|
|
350195
|
+
protectedVersions.add(resolve47(currentBinaryPath));
|
|
350060
350196
|
}
|
|
350061
350197
|
const currentSymlinkVersion = await getVersionFromSymlink(dirs.executable);
|
|
350062
350198
|
if (currentSymlinkVersion) {
|
|
@@ -356526,7 +356662,7 @@ var init_useTurnDiffs = __esm(() => {
|
|
|
356526
356662
|
});
|
|
356527
356663
|
|
|
356528
356664
|
// src/tui/components/diff/DiffDetailView.tsx
|
|
356529
|
-
import { resolve as
|
|
356665
|
+
import { resolve as resolve48 } from "path";
|
|
356530
356666
|
function DiffDetailView(t0) {
|
|
356531
356667
|
const $ = import_compiler_runtime130.c(53);
|
|
356532
356668
|
const {
|
|
@@ -356559,7 +356695,7 @@ function DiffDetailView(t0) {
|
|
|
356559
356695
|
let content;
|
|
356560
356696
|
let t2;
|
|
356561
356697
|
if ($[1] !== filePath) {
|
|
356562
|
-
const fullPath =
|
|
356698
|
+
const fullPath = resolve48(getCwd(), filePath);
|
|
356563
356699
|
content = readFileSafe2(fullPath);
|
|
356564
356700
|
t2 = content?.split(`
|
|
356565
356701
|
`)[0] ?? null;
|
|
@@ -369989,7 +370125,7 @@ var init_mcp7 = __esm(() => {
|
|
|
369989
370125
|
});
|
|
369990
370126
|
|
|
369991
370127
|
// src/tui/utils/releaseNotes.ts
|
|
369992
|
-
import { mkdir as mkdir44, readFile as
|
|
370128
|
+
import { mkdir as mkdir44, readFile as readFile50, writeFile as writeFile39 } from "fs/promises";
|
|
369993
370129
|
import { dirname as dirname71, join as join140 } from "path";
|
|
369994
370130
|
function getChangelogCachePath() {
|
|
369995
370131
|
return join140(getAtlasConfigHomeDir3(), "cache", "changelog.md");
|
|
@@ -370039,7 +370175,7 @@ async function getStoredChangelog() {
|
|
|
370039
370175
|
}
|
|
370040
370176
|
const cachePath = getChangelogCachePath();
|
|
370041
370177
|
try {
|
|
370042
|
-
const content = await
|
|
370178
|
+
const content = await readFile50(cachePath, "utf-8");
|
|
370043
370179
|
changelogMemoryCache = content;
|
|
370044
370180
|
return content;
|
|
370045
370181
|
} catch {
|
|
@@ -387995,7 +388131,7 @@ __export(exports_thinkback, {
|
|
|
387995
388131
|
call: () => call34,
|
|
387996
388132
|
playAnimation: () => playAnimation
|
|
387997
388133
|
});
|
|
387998
|
-
import { readFile as
|
|
388134
|
+
import { readFile as readFile51 } from "fs/promises";
|
|
387999
388135
|
import { join as join143 } from "path";
|
|
388000
388136
|
function getMarketplaceName() {
|
|
388001
388137
|
return OFFICIAL_MARKETPLACE_NAME;
|
|
@@ -388024,7 +388160,7 @@ async function playAnimation(skillDir) {
|
|
|
388024
388160
|
const dataPath = join143(skillDir, "year_in_review.js");
|
|
388025
388161
|
const playerPath = join143(skillDir, "player.js");
|
|
388026
388162
|
try {
|
|
388027
|
-
await
|
|
388163
|
+
await readFile51(dataPath);
|
|
388028
388164
|
} catch (e) {
|
|
388029
388165
|
if (isENOENT2(e)) {
|
|
388030
388166
|
return {
|
|
@@ -388039,7 +388175,7 @@ async function playAnimation(skillDir) {
|
|
|
388039
388175
|
};
|
|
388040
388176
|
}
|
|
388041
388177
|
try {
|
|
388042
|
-
await
|
|
388178
|
+
await readFile51(playerPath);
|
|
388043
388179
|
} catch (e) {
|
|
388044
388180
|
if (isENOENT2(e)) {
|
|
388045
388181
|
return {
|
|
@@ -393118,7 +393254,7 @@ __export(exports_branch, {
|
|
|
393118
393254
|
getUniqueForkName: () => getUniqueForkName
|
|
393119
393255
|
});
|
|
393120
393256
|
import { randomUUID as randomUUID39 } from "crypto";
|
|
393121
|
-
import { mkdir as mkdir45, readFile as
|
|
393257
|
+
import { mkdir as mkdir45, readFile as readFile52, writeFile as writeFile40 } from "fs/promises";
|
|
393122
393258
|
function deriveFirstPrompt(firstUserMessage) {
|
|
393123
393259
|
const content = firstUserMessage?.message?.content;
|
|
393124
393260
|
if (!content)
|
|
@@ -393137,7 +393273,7 @@ async function createFork(customTitle, target) {
|
|
|
393137
393273
|
await mkdir45(projectDir, { recursive: true, mode: 448 });
|
|
393138
393274
|
let transcriptContent;
|
|
393139
393275
|
try {
|
|
393140
|
-
transcriptContent = await
|
|
393276
|
+
transcriptContent = await readFile52(currentTranscriptPath);
|
|
393141
393277
|
} catch {
|
|
393142
393278
|
throw new Error("No conversation to branch");
|
|
393143
393279
|
}
|
|
@@ -399430,7 +399566,7 @@ var init_refresh = __esm(() => {
|
|
|
399430
399566
|
|
|
399431
399567
|
// src/tui/utils/plugins/parseMarketplaceInput.ts
|
|
399432
399568
|
import { homedir as homedir37 } from "os";
|
|
399433
|
-
import { resolve as
|
|
399569
|
+
import { resolve as resolve49 } from "path";
|
|
399434
399570
|
function matchKnownGitHost(hostname) {
|
|
399435
399571
|
const host = hostname.toLowerCase();
|
|
399436
399572
|
for (const known of KNOWN_GIT_HOSTS) {
|
|
@@ -399482,7 +399618,7 @@ async function parseMarketplaceInput(input) {
|
|
|
399482
399618
|
const isWindows = process.platform === "win32";
|
|
399483
399619
|
const isWindowsPath = isWindows && (trimmed.startsWith(".\\") || trimmed.startsWith("..\\") || /^[a-zA-Z]:[/\\]/.test(trimmed));
|
|
399484
399620
|
if (trimmed.startsWith("./") || trimmed.startsWith("../") || trimmed.startsWith("/") || trimmed.startsWith("~") || isWindowsPath) {
|
|
399485
|
-
const resolvedPath =
|
|
399621
|
+
const resolvedPath = resolve49(trimmed.startsWith("~") ? trimmed.replace(/^~/, homedir37()) : trimmed);
|
|
399486
399622
|
let stats;
|
|
399487
399623
|
try {
|
|
399488
399624
|
stats = await fs.stat(resolvedPath);
|
|
@@ -402447,7 +402583,7 @@ var init_DiscoverPlugins = __esm(() => {
|
|
|
402447
402583
|
});
|
|
402448
402584
|
|
|
402449
402585
|
// src/tui/utils/plugins/skillSearch.ts
|
|
402450
|
-
import { readdir as readdir27, readFile as
|
|
402586
|
+
import { readdir as readdir27, readFile as readFile53, stat as stat46 } from "fs/promises";
|
|
402451
402587
|
import { join as join146 } from "path";
|
|
402452
402588
|
async function searchSkillsAcrossMarketplaces(query) {
|
|
402453
402589
|
const config = await loadKnownMarketplacesConfig();
|
|
@@ -402493,7 +402629,7 @@ async function searchSkillsAcrossMarketplaces(query) {
|
|
|
402493
402629
|
seen.add(skillFile);
|
|
402494
402630
|
let content;
|
|
402495
402631
|
try {
|
|
402496
|
-
content = await
|
|
402632
|
+
content = await readFile53(skillFile, { encoding: "utf-8" });
|
|
402497
402633
|
} catch {
|
|
402498
402634
|
continue;
|
|
402499
402635
|
}
|
|
@@ -403987,7 +404123,7 @@ var init_ManageMarketplaces = __esm(() => {
|
|
|
403987
404123
|
|
|
403988
404124
|
// src/tui/utils/plugins/pluginFlagging.ts
|
|
403989
404125
|
import { randomBytes as randomBytes19 } from "crypto";
|
|
403990
|
-
import { readFile as
|
|
404126
|
+
import { readFile as readFile54, rename as rename10, unlink as unlink20, writeFile as writeFile41 } from "fs/promises";
|
|
403991
404127
|
import { join as join147 } from "path";
|
|
403992
404128
|
function getFlaggedPluginsPath() {
|
|
403993
404129
|
return join147(getPluginsDirectory(), FLAGGED_PLUGINS_FILENAME);
|
|
@@ -404014,7 +404150,7 @@ function parsePluginsData(content) {
|
|
|
404014
404150
|
}
|
|
404015
404151
|
async function readFromDisk() {
|
|
404016
404152
|
try {
|
|
404017
|
-
const content = await
|
|
404153
|
+
const content = await readFile54(getFlaggedPluginsPath(), {
|
|
404018
404154
|
encoding: "utf-8"
|
|
404019
404155
|
});
|
|
404020
404156
|
return parsePluginsData(content);
|
|
@@ -407329,7 +407465,7 @@ function parsePluginArgs(args) {
|
|
|
407329
407465
|
}
|
|
407330
407466
|
|
|
407331
407467
|
// src/tui/utils/plugins/validatePlugin.ts
|
|
407332
|
-
import { readdir as readdir29, readFile as
|
|
407468
|
+
import { readdir as readdir29, readFile as readFile56, stat as stat48 } from "fs/promises";
|
|
407333
407469
|
import * as path24 from "path";
|
|
407334
407470
|
function detectManifestType(filePath) {
|
|
407335
407471
|
const fileName = path24.basename(filePath);
|
|
@@ -407369,7 +407505,7 @@ async function validatePluginManifest(filePath) {
|
|
|
407369
407505
|
const absolutePath = path24.resolve(filePath);
|
|
407370
407506
|
let content;
|
|
407371
407507
|
try {
|
|
407372
|
-
content = await
|
|
407508
|
+
content = await readFile56(absolutePath, { encoding: "utf-8" });
|
|
407373
407509
|
} catch (error) {
|
|
407374
407510
|
const code = getErrnoCode2(error);
|
|
407375
407511
|
let message;
|
|
@@ -407493,7 +407629,7 @@ async function validateMarketplaceManifest(filePath) {
|
|
|
407493
407629
|
const absolutePath = path24.resolve(filePath);
|
|
407494
407630
|
let content;
|
|
407495
407631
|
try {
|
|
407496
|
-
content = await
|
|
407632
|
+
content = await readFile56(absolutePath, { encoding: "utf-8" });
|
|
407497
407633
|
} catch (error) {
|
|
407498
407634
|
const code = getErrnoCode2(error);
|
|
407499
407635
|
let message;
|
|
@@ -407579,7 +407715,7 @@ async function validateMarketplaceManifest(filePath) {
|
|
|
407579
407715
|
const pluginJsonPath = findManifestInDir(path24.join(marketplaceRoot, entry.source), "plugin.json");
|
|
407580
407716
|
let manifestVersion;
|
|
407581
407717
|
try {
|
|
407582
|
-
const raw = await
|
|
407718
|
+
const raw = await readFile56(pluginJsonPath, { encoding: "utf-8" });
|
|
407583
407719
|
const parsed = jsonParse2(raw);
|
|
407584
407720
|
if (typeof parsed.version === "string") {
|
|
407585
407721
|
manifestVersion = parsed.version;
|
|
@@ -407627,7 +407763,7 @@ async function validateMarketplaceManifest(filePath) {
|
|
|
407627
407763
|
for (const skillFile of skillFiles) {
|
|
407628
407764
|
let content;
|
|
407629
407765
|
try {
|
|
407630
|
-
content = await
|
|
407766
|
+
content = await readFile56(skillFile, { encoding: "utf-8" });
|
|
407631
407767
|
} catch (e) {
|
|
407632
407768
|
if (isENOENT2(e))
|
|
407633
407769
|
continue;
|
|
@@ -407754,7 +407890,7 @@ function validateComponentFile(filePath, content, fileType) {
|
|
|
407754
407890
|
async function validateHooksJson(filePath) {
|
|
407755
407891
|
let content;
|
|
407756
407892
|
try {
|
|
407757
|
-
content = await
|
|
407893
|
+
content = await readFile56(filePath, { encoding: "utf-8" });
|
|
407758
407894
|
} catch (e) {
|
|
407759
407895
|
const code = getErrnoCode2(e);
|
|
407760
407896
|
if (code === "ENOENT") {
|
|
@@ -407847,7 +407983,7 @@ async function validatePluginContents(pluginDir) {
|
|
|
407847
407983
|
for (const filePath of files) {
|
|
407848
407984
|
let content;
|
|
407849
407985
|
try {
|
|
407850
|
-
content = await
|
|
407986
|
+
content = await readFile56(filePath, { encoding: "utf-8" });
|
|
407851
407987
|
} catch (e) {
|
|
407852
407988
|
if (isENOENT2(e))
|
|
407853
407989
|
continue;
|
|
@@ -407916,7 +408052,7 @@ async function validateManifest(filePath) {
|
|
|
407916
408052
|
return validateMarketplaceManifest(filePath);
|
|
407917
408053
|
case "unknown": {
|
|
407918
408054
|
try {
|
|
407919
|
-
const content = await
|
|
408055
|
+
const content = await readFile56(absolutePath, { encoding: "utf-8" });
|
|
407920
408056
|
const parsed = jsonParse2(content);
|
|
407921
408057
|
if (Array.isArray(parsed.plugins)) {
|
|
407922
408058
|
return validateMarketplaceManifest(filePath);
|
|
@@ -409508,7 +409644,7 @@ var init_rewind = __esm(() => {
|
|
|
409508
409644
|
|
|
409509
409645
|
// src/tui/utils/heapDumpService.ts
|
|
409510
409646
|
import { createWriteStream as createWriteStream3, writeFileSync as writeFileSync8 } from "fs";
|
|
409511
|
-
import { readdir as readdir30, readFile as
|
|
409647
|
+
import { readdir as readdir30, readFile as readFile57, writeFile as writeFile42 } from "fs/promises";
|
|
409512
409648
|
import { join as join150 } from "path";
|
|
409513
409649
|
import { pipeline as pipeline2 } from "stream/promises";
|
|
409514
409650
|
import {
|
|
@@ -409533,7 +409669,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
|
|
|
409533
409669
|
} catch {}
|
|
409534
409670
|
let smapsRollup;
|
|
409535
409671
|
try {
|
|
409536
|
-
smapsRollup = await
|
|
409672
|
+
smapsRollup = await readFile57("/proc/self/smaps_rollup", "utf8");
|
|
409537
409673
|
} catch {}
|
|
409538
409674
|
const nativeMemory = usage.rss - usage.heapUsed;
|
|
409539
409675
|
const bytesPerSecond = uptimeSeconds > 0 ? usage.rss / uptimeSeconds : 0;
|
|
@@ -411340,7 +411476,7 @@ var init_ExitFlow = __esm(() => {
|
|
|
411340
411476
|
});
|
|
411341
411477
|
|
|
411342
411478
|
// src/tui/utils/concurrentSessions.ts
|
|
411343
|
-
import { chmod as chmod8, mkdir as mkdir48, readdir as readdir31, readFile as
|
|
411479
|
+
import { chmod as chmod8, mkdir as mkdir48, readdir as readdir31, readFile as readFile58, unlink as unlink21, writeFile as writeFile43 } from "fs/promises";
|
|
411344
411480
|
import { join as join152 } from "path";
|
|
411345
411481
|
function getSessionsDir() {
|
|
411346
411482
|
return join152(getAtlasConfigHomeDir3(), "sessions");
|
|
@@ -411396,7 +411532,7 @@ async function registerSession2() {
|
|
|
411396
411532
|
async function updatePidFile(patch) {
|
|
411397
411533
|
const pidFile = join152(getSessionsDir(), `${process.pid}.json`);
|
|
411398
411534
|
try {
|
|
411399
|
-
const data = jsonParse2(await
|
|
411535
|
+
const data = jsonParse2(await readFile58(pidFile, "utf8"));
|
|
411400
411536
|
await writeFile43(pidFile, jsonStringify5({ ...data, ...patch }));
|
|
411401
411537
|
} catch (e) {
|
|
411402
411538
|
logForDebugging3(`[concurrentSessions] updatePidFile failed: ${errorMessage2(e)}`);
|
|
@@ -416519,7 +416655,7 @@ __export(exports_insights, {
|
|
|
416519
416655
|
import {
|
|
416520
416656
|
mkdir as mkdir50,
|
|
416521
416657
|
readdir as readdir32,
|
|
416522
|
-
readFile as
|
|
416658
|
+
readFile as readFile59,
|
|
416523
416659
|
unlink as unlink23,
|
|
416524
416660
|
writeFile as writeFile45
|
|
416525
416661
|
} from "fs/promises";
|
|
@@ -416880,7 +417016,7 @@ async function formatTranscriptWithSummarization(log) {
|
|
|
416880
417016
|
async function loadCachedFacets(sessionId) {
|
|
416881
417017
|
const facetPath = join158(getFacetsDir(), `${sessionId}.json`);
|
|
416882
417018
|
try {
|
|
416883
|
-
const content = await
|
|
417019
|
+
const content = await readFile59(facetPath, { encoding: "utf-8" });
|
|
416884
417020
|
const parsed = jsonParse2(content);
|
|
416885
417021
|
if (!isValidSessionFacets(parsed)) {
|
|
416886
417022
|
try {
|
|
@@ -416906,7 +417042,7 @@ async function saveFacets(facets) {
|
|
|
416906
417042
|
async function loadCachedSessionMeta(sessionId) {
|
|
416907
417043
|
const metaPath = join158(getSessionMetaDir(), `${sessionId}.json`);
|
|
416908
417044
|
try {
|
|
416909
|
-
const content = await
|
|
417045
|
+
const content = await readFile59(metaPath, { encoding: "utf-8" });
|
|
416910
417046
|
return jsonParse2(content);
|
|
416911
417047
|
} catch {
|
|
416912
417048
|
return null;
|
|
@@ -418953,7 +419089,7 @@ import {
|
|
|
418953
419089
|
open as fsOpen3,
|
|
418954
419090
|
mkdir as mkdir51,
|
|
418955
419091
|
readdir as readdir33,
|
|
418956
|
-
readFile as
|
|
419092
|
+
readFile as readFile60,
|
|
418957
419093
|
stat as stat49,
|
|
418958
419094
|
unlink as unlink24,
|
|
418959
419095
|
writeFile as writeFile46
|
|
@@ -419009,7 +419145,7 @@ async function writeAgentMetadata(agentId, metadata) {
|
|
|
419009
419145
|
async function readAgentMetadata(agentId) {
|
|
419010
419146
|
const path = getAgentMetadataPath(agentId);
|
|
419011
419147
|
try {
|
|
419012
|
-
const raw = await
|
|
419148
|
+
const raw = await readFile60(path, "utf-8");
|
|
419013
419149
|
return JSON.parse(raw);
|
|
419014
419150
|
} catch (e) {
|
|
419015
419151
|
if (isFsInaccessible2(e))
|
|
@@ -419334,7 +419470,7 @@ class Project2 {
|
|
|
419334
419470
|
logForDebugging3(`Skipping tombstone removal: session file too large (${formatFileSize3(fileSize)})`, { level: "warn" });
|
|
419335
419471
|
return;
|
|
419336
419472
|
}
|
|
419337
|
-
const content = await
|
|
419473
|
+
const content = await readFile60(this.sessionFile, { encoding: "utf-8" });
|
|
419338
419474
|
const lines = content.split(`
|
|
419339
419475
|
`).filter((line) => {
|
|
419340
419476
|
if (!line.trim())
|
|
@@ -420588,7 +420724,7 @@ async function loadTranscriptFile2(filePath, opts) {
|
|
|
420588
420724
|
}
|
|
420589
420725
|
}
|
|
420590
420726
|
}
|
|
420591
|
-
buf ??= await
|
|
420727
|
+
buf ??= await readFile60(filePath);
|
|
420592
420728
|
if (!opts?.keepAllLeaves && !hasPreservedSegment && !isEnvTruthy2(process.env.ATLAS_DISABLE_PRECOMPACT_SKIP) && buf.length > SKIP_PRECOMPACT_THRESHOLD2) {
|
|
420593
420729
|
buf = walkChainBeforeParse2(buf);
|
|
420594
420730
|
}
|
|
@@ -421512,7 +421648,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
421512
421648
|
// src/tui/utils/plans.ts
|
|
421513
421649
|
import { randomUUID as randomUUID40 } from "crypto";
|
|
421514
421650
|
import { copyFile as copyFile9, writeFile as writeFile47 } from "fs/promises";
|
|
421515
|
-
import { join as join160, resolve as
|
|
421651
|
+
import { join as join160, resolve as resolve51, sep as sep34 } from "path";
|
|
421516
421652
|
function getPlanSlug2(sessionId) {
|
|
421517
421653
|
const id = sessionId ?? getSessionId();
|
|
421518
421654
|
const cache = getPlanSlugCache();
|
|
@@ -421722,7 +421858,7 @@ var init_plans = __esm(() => {
|
|
|
421722
421858
|
let plansPath;
|
|
421723
421859
|
if (settingsDir) {
|
|
421724
421860
|
const cwd = getCwd();
|
|
421725
|
-
const resolved =
|
|
421861
|
+
const resolved = resolve51(cwd, settingsDir);
|
|
421726
421862
|
if (!resolved.startsWith(cwd + sep34) && resolved !== cwd) {
|
|
421727
421863
|
logError3(new Error(`plansDirectory must be within project root: ${settingsDir}`));
|
|
421728
421864
|
plansPath = join160(getAtlasConfigHomeDir3(), "plans");
|
|
@@ -427676,6 +427812,29 @@ async function executeHooksOutsideREPL({
|
|
|
427676
427812
|
});
|
|
427677
427813
|
return await Promise.all(hookPromises);
|
|
427678
427814
|
}
|
|
427815
|
+
async function* executePermissionDeniedHooks(toolName, toolUseID, toolInput, reason, toolUseContext, permissionMode, signal, timeoutMs = TOOL_HOOK_EXECUTION_TIMEOUT_MS) {
|
|
427816
|
+
const appState = toolUseContext.getAppState();
|
|
427817
|
+
const sessionId = toolUseContext.agentId ?? getSessionId();
|
|
427818
|
+
if (!hasHookForEvent("PermissionDenied", appState, sessionId)) {
|
|
427819
|
+
return;
|
|
427820
|
+
}
|
|
427821
|
+
const hookInput = {
|
|
427822
|
+
...createBaseHookInput2(permissionMode, undefined, toolUseContext),
|
|
427823
|
+
hook_event_name: "PermissionDenied",
|
|
427824
|
+
tool_name: toolName,
|
|
427825
|
+
tool_input: toolInput,
|
|
427826
|
+
tool_use_id: toolUseID,
|
|
427827
|
+
reason
|
|
427828
|
+
};
|
|
427829
|
+
yield* executeHooks({
|
|
427830
|
+
hookInput,
|
|
427831
|
+
toolUseID,
|
|
427832
|
+
matchQuery: toolName,
|
|
427833
|
+
signal,
|
|
427834
|
+
timeoutMs,
|
|
427835
|
+
toolUseContext
|
|
427836
|
+
});
|
|
427837
|
+
}
|
|
427679
427838
|
async function executeNotificationHooks(notificationData, timeoutMs = TOOL_HOOK_EXECUTION_TIMEOUT_MS) {
|
|
427680
427839
|
const { message, title, notificationType } = notificationData;
|
|
427681
427840
|
const hookInput = {
|
|
@@ -429594,7 +429753,7 @@ var init_compact4 = __esm(() => {
|
|
|
429594
429753
|
});
|
|
429595
429754
|
|
|
429596
429755
|
// src/tui/services/SessionMemory/prompts.ts
|
|
429597
|
-
import { readFile as
|
|
429756
|
+
import { readFile as readFile61 } from "fs/promises";
|
|
429598
429757
|
import { join as join163 } from "path";
|
|
429599
429758
|
function getDefaultUpdatePrompt() {
|
|
429600
429759
|
return `IMPORTANT: This message and these instructions are NOT part of the actual user conversation. Do NOT include any references to "note-taking", "session notes extraction", or these update instructions in the notes content.
|
|
@@ -429638,7 +429797,7 @@ REMEMBER: Use the Edit tool in parallel and stop. Do not continue after the edit
|
|
|
429638
429797
|
async function loadSessionMemoryTemplate() {
|
|
429639
429798
|
const templatePath = join163(getAtlasConfigHomeDir3(), "session-memory", "config", "template.md");
|
|
429640
429799
|
try {
|
|
429641
|
-
return await
|
|
429800
|
+
return await readFile61(templatePath, { encoding: "utf-8" });
|
|
429642
429801
|
} catch (e) {
|
|
429643
429802
|
const code = getErrnoCode2(e);
|
|
429644
429803
|
if (code === "ENOENT") {
|
|
@@ -429651,7 +429810,7 @@ async function loadSessionMemoryTemplate() {
|
|
|
429651
429810
|
async function loadSessionMemoryPrompt() {
|
|
429652
429811
|
const promptPath = join163(getAtlasConfigHomeDir3(), "session-memory", "config", "prompt.md");
|
|
429653
429812
|
try {
|
|
429654
|
-
return await
|
|
429813
|
+
return await readFile61(promptPath, { encoding: "utf-8" });
|
|
429655
429814
|
} catch (e) {
|
|
429656
429815
|
const code = getErrnoCode2(e);
|
|
429657
429816
|
if (code === "ENOENT") {
|
|
@@ -431702,6 +431861,7 @@ var init_managedEnvConstants = __esm(() => {
|
|
|
431702
431861
|
"MAX_THINKING_TOKENS",
|
|
431703
431862
|
"MCP_TIMEOUT",
|
|
431704
431863
|
"MCP_TOOL_TIMEOUT",
|
|
431864
|
+
"MCP_CONNECTION_NONBLOCKING",
|
|
431705
431865
|
"OTEL_EXPORTER_OTLP_HEADERS",
|
|
431706
431866
|
"OTEL_EXPORTER_OTLP_LOGS_HEADERS",
|
|
431707
431867
|
"OTEL_EXPORTER_OTLP_LOGS_PROTOCOL",
|
|
@@ -457056,7 +457216,14 @@ var jsx_dev_runtime378, ContextBarSegment = ({ input }) => {
|
|
|
457056
457216
|
const used = usedContextTokens(cw);
|
|
457057
457217
|
const total = cw.context_window_size;
|
|
457058
457218
|
if (pct == null) {
|
|
457059
|
-
return
|
|
457219
|
+
return /* @__PURE__ */ jsx_dev_runtime378.jsxDEV(ThemedText, {
|
|
457220
|
+
dimColor: true,
|
|
457221
|
+
children: [
|
|
457222
|
+
"▤ —/",
|
|
457223
|
+
formatK(total),
|
|
457224
|
+
" tok"
|
|
457225
|
+
]
|
|
457226
|
+
}, undefined, true, undefined, this);
|
|
457060
457227
|
}
|
|
457061
457228
|
const color = contextColorForPercentage(pct);
|
|
457062
457229
|
const modelId = input.model?.id;
|
|
@@ -464756,7 +464923,7 @@ var init_coordinatorHandler = __esm(() => {
|
|
|
464756
464923
|
});
|
|
464757
464924
|
|
|
464758
464925
|
// src/tui/utils/permissions/sessionPermissionRules.ts
|
|
464759
|
-
import { mkdir as mkdir53, readFile as
|
|
464926
|
+
import { mkdir as mkdir53, readFile as readFile62, rename as rename11, writeFile as writeFile48 } from "fs/promises";
|
|
464760
464927
|
import { dirname as dirname80, join as join170 } from "path";
|
|
464761
464928
|
function sessionRulesPath(sessionId, projectDir) {
|
|
464762
464929
|
return join170(projectDir, `${sessionId}${SESSION_RULES_FILE_SUFFIX}`);
|
|
@@ -464797,7 +464964,7 @@ function isSessionAddRules(u) {
|
|
|
464797
464964
|
}
|
|
464798
464965
|
async function readSessionPermissionRules(sessionId, projectDir) {
|
|
464799
464966
|
try {
|
|
464800
|
-
const raw = await
|
|
464967
|
+
const raw = await readFile62(sessionRulesPath(sessionId, projectDir), "utf8");
|
|
464801
464968
|
return parseSessionRulesJson(raw);
|
|
464802
464969
|
} catch (e) {
|
|
464803
464970
|
logForDebugging3(`readSessionPermissionRules: no/corrupt sidecar for ${sessionId}: ${e}`);
|
|
@@ -465091,6 +465258,11 @@ function createPermissionContext(tool, input, toolUseContext, assistantMessage,
|
|
|
465091
465258
|
});
|
|
465092
465259
|
},
|
|
465093
465260
|
async handleHookAllow(finalInput, permissionUpdates, permissionPromptStartTimeMs) {
|
|
465261
|
+
const denyCheck = await checkRuleBasedPermissions(tool, finalInput, toolUseContext);
|
|
465262
|
+
if (denyCheck && denyCheck.behavior === "deny") {
|
|
465263
|
+
this.logDecision({ decision: "reject", source: { type: "hook" } }, { input: finalInput, permissionPromptStartTimeMs });
|
|
465264
|
+
return this.buildDeny(denyCheck.message, denyCheck.decisionReason);
|
|
465265
|
+
}
|
|
465094
465266
|
const acceptedPermanentUpdates = await this.persistPermissions(permissionUpdates);
|
|
465095
465267
|
this.logDecision({
|
|
465096
465268
|
decision: "accept",
|
|
@@ -465133,6 +465305,7 @@ var init_PermissionContext = __esm(() => {
|
|
|
465133
465305
|
init_debug();
|
|
465134
465306
|
init_log5();
|
|
465135
465307
|
init_sessionPermissionRules();
|
|
465308
|
+
init_permissions6();
|
|
465136
465309
|
init_hooks7();
|
|
465137
465310
|
init_messages3();
|
|
465138
465311
|
init_PermissionUpdate();
|
|
@@ -469199,11 +469372,11 @@ var init_builtinMarketplaceSnapshots = __esm(() => {
|
|
|
469199
469372
|
// src/tui/utils/plugins/marketplaceSnapshotFallback.ts
|
|
469200
469373
|
import {
|
|
469201
469374
|
mkdir as mkdir54,
|
|
469202
|
-
readFile as
|
|
469375
|
+
readFile as readFile63,
|
|
469203
469376
|
rm as rm11,
|
|
469204
469377
|
writeFile as writeFile49
|
|
469205
469378
|
} from "fs/promises";
|
|
469206
|
-
import { join as join173, resolve as
|
|
469379
|
+
import { join as join173, resolve as resolve54, sep as sep41 } from "path";
|
|
469207
469380
|
function getBuiltinSnapshotRoot() {
|
|
469208
469381
|
return join173(getMarketplacesCacheDir(), "builtin-snapshots");
|
|
469209
469382
|
}
|
|
@@ -469215,7 +469388,7 @@ function isBuiltinSnapshotEntry(entry) {
|
|
|
469215
469388
|
return false;
|
|
469216
469389
|
if (entry.source.source !== "directory")
|
|
469217
469390
|
return false;
|
|
469218
|
-
const root =
|
|
469391
|
+
const root = resolve54(getBuiltinSnapshotRoot()) + sep41;
|
|
469219
469392
|
return entry.installLocation.startsWith(root);
|
|
469220
469393
|
}
|
|
469221
469394
|
async function installBuiltinSnapshotFallback(marketplaceName) {
|
|
@@ -469261,7 +469434,7 @@ async function materializeSnapshot(snapshotDir, manifest) {
|
|
|
469261
469434
|
await mkdir54(join173(snapshotDir, manifestDirName), { recursive: true });
|
|
469262
469435
|
const content = jsonStringify5(manifest, null, 2);
|
|
469263
469436
|
await writeFile49(manifestPath, content, { encoding: "utf-8" });
|
|
469264
|
-
const roundTrip = JSON.parse(await
|
|
469437
|
+
const roundTrip = JSON.parse(await readFile63(manifestPath, "utf-8"));
|
|
469265
469438
|
PluginMarketplaceSchema().parse(roundTrip);
|
|
469266
469439
|
}
|
|
469267
469440
|
var init_marketplaceSnapshotFallback = __esm(() => {
|
|
@@ -471736,7 +471909,7 @@ var init_usePluginAutoupdateNotification = __esm(() => {
|
|
|
471736
471909
|
});
|
|
471737
471910
|
|
|
471738
471911
|
// src/tui/utils/plugins/reconciler.ts
|
|
471739
|
-
import { isAbsolute as isAbsolute34, resolve as
|
|
471912
|
+
import { isAbsolute as isAbsolute34, resolve as resolve55 } from "path";
|
|
471740
471913
|
function diffMarketplaces(declared, materialized, opts) {
|
|
471741
471914
|
const missing = [];
|
|
471742
471915
|
const sourceChanged = [];
|
|
@@ -471849,7 +472022,7 @@ function normalizeSource(source, projectRoot) {
|
|
|
471849
472022
|
const canonicalRoot = findCanonicalGitRoot2(base);
|
|
471850
472023
|
return {
|
|
471851
472024
|
...source,
|
|
471852
|
-
path:
|
|
472025
|
+
path: resolve55(canonicalRoot ?? base, source.path)
|
|
471853
472026
|
};
|
|
471854
472027
|
}
|
|
471855
472028
|
return source;
|
|
@@ -474841,7 +475014,7 @@ var init_cronJitterConfig2 = __esm(() => {
|
|
|
474841
475014
|
});
|
|
474842
475015
|
|
|
474843
475016
|
// src/tui/utils/cronTasksLock.ts
|
|
474844
|
-
import { mkdir as mkdir55, readFile as
|
|
475017
|
+
import { mkdir as mkdir55, readFile as readFile64, unlink as unlink26, writeFile as writeFile50 } from "fs/promises";
|
|
474845
475018
|
import { dirname as dirname83, join as join176 } from "path";
|
|
474846
475019
|
function getLockPath3(dir) {
|
|
474847
475020
|
return join176(dir ?? getProjectRoot(), LOCK_FILE_REL2);
|
|
@@ -474849,7 +475022,7 @@ function getLockPath3(dir) {
|
|
|
474849
475022
|
async function readLock3(dir) {
|
|
474850
475023
|
let raw;
|
|
474851
475024
|
try {
|
|
474852
|
-
raw = await
|
|
475025
|
+
raw = await readFile64(getLockPath3(dir), "utf8");
|
|
474853
475026
|
} catch {
|
|
474854
475027
|
return;
|
|
474855
475028
|
}
|
|
@@ -486991,7 +487164,7 @@ var init_mcp8 = __esm(() => {
|
|
|
486991
487164
|
});
|
|
486992
487165
|
|
|
486993
487166
|
// src/tui/utils/atlasDesktop.ts
|
|
486994
|
-
import { readdir as readdir34, readFile as
|
|
487167
|
+
import { readdir as readdir34, readFile as readFile65, stat as stat55 } from "fs/promises";
|
|
486995
487168
|
import { homedir as homedir47 } from "os";
|
|
486996
487169
|
import { join as join183 } from "path";
|
|
486997
487170
|
async function getDesktopConfigPath() {
|
|
@@ -487039,7 +487212,7 @@ async function readDesktopMcpServers() {
|
|
|
487039
487212
|
const configPath = await getDesktopConfigPath();
|
|
487040
487213
|
let configContent;
|
|
487041
487214
|
try {
|
|
487042
|
-
configContent = await
|
|
487215
|
+
configContent = await readFile65(configPath, { encoding: "utf8" });
|
|
487043
487216
|
} catch (e) {
|
|
487044
487217
|
const code = getErrnoCode2(e);
|
|
487045
487218
|
if (code === "ENOENT") {
|
|
@@ -487474,12 +487647,12 @@ var init_auth6 = __esm(() => {
|
|
|
487474
487647
|
});
|
|
487475
487648
|
|
|
487476
487649
|
// src/tui/utils/plugins/marketplacePublish.ts
|
|
487477
|
-
import { cp, mkdir as mkdir56, readFile as
|
|
487650
|
+
import { cp, mkdir as mkdir56, readFile as readFile66, rm as rm12, writeFile as writeFile53 } from "fs/promises";
|
|
487478
487651
|
import {
|
|
487479
487652
|
dirname as dirname87,
|
|
487480
487653
|
join as join184,
|
|
487481
487654
|
relative as relative38,
|
|
487482
|
-
resolve as
|
|
487655
|
+
resolve as resolve56,
|
|
487483
487656
|
sep as sep43
|
|
487484
487657
|
} from "path";
|
|
487485
487658
|
function git(marketplaceDir, args, timeoutMs = 2 * 60 * 1000) {
|
|
@@ -487492,8 +487665,8 @@ function gitFailureMessage(res) {
|
|
|
487492
487665
|
return (res.stderr || res.error || `exit code ${res.code}`).trim();
|
|
487493
487666
|
}
|
|
487494
487667
|
async function publishPluginToMarketplace(opts) {
|
|
487495
|
-
const pluginDir =
|
|
487496
|
-
const marketplaceDir =
|
|
487668
|
+
const pluginDir = resolve56(opts.pluginDir);
|
|
487669
|
+
const marketplaceDir = resolve56(opts.marketplaceDir);
|
|
487497
487670
|
const notes = [];
|
|
487498
487671
|
if (pluginDir === marketplaceDir || pluginDir.startsWith(marketplaceDir + sep43)) {
|
|
487499
487672
|
throw new Error(`Cannot publish "${pluginDir}": the plugin directory must not live inside the target marketplace (${marketplaceDir})`);
|
|
@@ -487501,7 +487674,7 @@ async function publishPluginToMarketplace(opts) {
|
|
|
487501
487674
|
const pluginManifestPath = findManifestInDir(pluginDir, "plugin.json");
|
|
487502
487675
|
let pluginManifestRaw;
|
|
487503
487676
|
try {
|
|
487504
|
-
pluginManifestRaw = await
|
|
487677
|
+
pluginManifestRaw = await readFile66(pluginManifestPath, {
|
|
487505
487678
|
encoding: "utf-8"
|
|
487506
487679
|
});
|
|
487507
487680
|
} catch {
|
|
@@ -487526,7 +487699,7 @@ async function publishPluginToMarketplace(opts) {
|
|
|
487526
487699
|
const marketplaceManifestPath = findManifestInDir(marketplaceDir, "marketplace.json");
|
|
487527
487700
|
let marketplaceRaw;
|
|
487528
487701
|
try {
|
|
487529
|
-
marketplaceRaw = await
|
|
487702
|
+
marketplaceRaw = await readFile66(marketplaceManifestPath, {
|
|
487530
487703
|
encoding: "utf-8"
|
|
487531
487704
|
});
|
|
487532
487705
|
} catch {
|
|
@@ -487624,9 +487797,9 @@ var init_marketplacePublish = __esm(() => {
|
|
|
487624
487797
|
import { userInfo as userInfo2 } from "os";
|
|
487625
487798
|
import { existsSync as existsSync15 } from "fs";
|
|
487626
487799
|
import { mkdir as mkdir57, writeFile as writeFile54 } from "fs/promises";
|
|
487627
|
-
import { dirname as dirname88, join as join185, resolve as
|
|
487800
|
+
import { dirname as dirname88, join as join185, resolve as resolve57 } from "path";
|
|
487628
487801
|
async function scaffoldMarketplace(opts) {
|
|
487629
|
-
const targetDir =
|
|
487802
|
+
const targetDir = resolve57(opts.targetDir);
|
|
487630
487803
|
const name = opts.name.trim();
|
|
487631
487804
|
const manifestDirName = getPluginManifestDirs()[0];
|
|
487632
487805
|
const marketplaceManifestPath = join185(targetDir, manifestDirName, "marketplace.json");
|
|
@@ -487712,7 +487885,7 @@ var init_marketplaceScaffold = __esm(() => {
|
|
|
487712
487885
|
});
|
|
487713
487886
|
|
|
487714
487887
|
// src/tui/cli/handlers/plugins.ts
|
|
487715
|
-
import { basename as basename65, dirname as dirname89, resolve as
|
|
487888
|
+
import { basename as basename65, dirname as dirname89, resolve as resolve58 } from "path";
|
|
487716
487889
|
function handleMarketplaceError(error, action) {
|
|
487717
487890
|
logError3(error);
|
|
487718
487891
|
cliError2(`${figures_default.cross} Failed to ${action}: ${errorMessage2(error)}`);
|
|
@@ -488064,7 +488237,7 @@ async function marketplaceUpdateHandler(name, options) {
|
|
|
488064
488237
|
async function marketplaceScaffoldHandler(options) {
|
|
488065
488238
|
if (options.cowork)
|
|
488066
488239
|
setUseCoworkPlugins(true);
|
|
488067
|
-
const targetDir =
|
|
488240
|
+
const targetDir = resolve58(options.target ?? process.cwd());
|
|
488068
488241
|
try {
|
|
488069
488242
|
const result = await scaffoldMarketplace({
|
|
488070
488243
|
name: options.name,
|
|
@@ -488089,8 +488262,8 @@ async function marketplacePublishHandler(options) {
|
|
|
488089
488262
|
setUseCoworkPlugins(true);
|
|
488090
488263
|
try {
|
|
488091
488264
|
const result = await publishPluginToMarketplace({
|
|
488092
|
-
pluginDir:
|
|
488093
|
-
marketplaceDir:
|
|
488265
|
+
pluginDir: resolve58(options.plugin),
|
|
488266
|
+
marketplaceDir: resolve58(options.marketplace),
|
|
488094
488267
|
version: options.version,
|
|
488095
488268
|
push: options.push
|
|
488096
488269
|
});
|
|
@@ -489306,7 +489479,7 @@ var init_update2 = __esm(() => {
|
|
|
489306
489479
|
|
|
489307
489480
|
// src/tui/main.tsx
|
|
489308
489481
|
import { readFileSync as readFileSync25 } from "fs";
|
|
489309
|
-
import { resolve as
|
|
489482
|
+
import { resolve as resolve59 } from "path";
|
|
489310
489483
|
function logManagedSettings() {
|
|
489311
489484
|
try {
|
|
489312
489485
|
const policySettings = getSettingsForSource2("policySettings");
|
|
@@ -489873,12 +490046,12 @@ ${getTmuxInstallInstructions3()}
|
|
|
489873
490046
|
process.exit(1);
|
|
489874
490047
|
}
|
|
489875
490048
|
try {
|
|
489876
|
-
const filePath =
|
|
490049
|
+
const filePath = resolve59(options.systemPromptFile);
|
|
489877
490050
|
systemPrompt = readFileSync25(filePath, "utf8");
|
|
489878
490051
|
} catch (error) {
|
|
489879
490052
|
const code = getErrnoCode2(error);
|
|
489880
490053
|
if (code === "ENOENT") {
|
|
489881
|
-
process.stderr.write(source_default.red(`Error: System prompt file not found: ${
|
|
490054
|
+
process.stderr.write(source_default.red(`Error: System prompt file not found: ${resolve59(options.systemPromptFile)}
|
|
489882
490055
|
`));
|
|
489883
490056
|
process.exit(1);
|
|
489884
490057
|
}
|
|
@@ -489895,12 +490068,12 @@ ${getTmuxInstallInstructions3()}
|
|
|
489895
490068
|
process.exit(1);
|
|
489896
490069
|
}
|
|
489897
490070
|
try {
|
|
489898
|
-
const filePath =
|
|
490071
|
+
const filePath = resolve59(options.appendSystemPromptFile);
|
|
489899
490072
|
appendSystemPrompt = readFileSync25(filePath, "utf8");
|
|
489900
490073
|
} catch (error) {
|
|
489901
490074
|
const code = getErrnoCode2(error);
|
|
489902
490075
|
if (code === "ENOENT") {
|
|
489903
|
-
process.stderr.write(source_default.red(`Error: Append system prompt file not found: ${
|
|
490076
|
+
process.stderr.write(source_default.red(`Error: Append system prompt file not found: ${resolve59(options.appendSystemPromptFile)}
|
|
489904
490077
|
`));
|
|
489905
490078
|
process.exit(1);
|
|
489906
490079
|
}
|
|
@@ -489950,7 +490123,7 @@ ${addendum}` : addendum;
|
|
|
489950
490123
|
errors = result.errors;
|
|
489951
490124
|
}
|
|
489952
490125
|
} else {
|
|
489953
|
-
const configPath =
|
|
490126
|
+
const configPath = resolve59(configItem);
|
|
489954
490127
|
const result = parseMcpConfigFromFilePath({
|
|
489955
490128
|
filePath: configPath,
|
|
489956
490129
|
expandVars: true,
|
|
@@ -491596,7 +491769,7 @@ function createInMemorySandboxDeps() {
|
|
|
491596
491769
|
// src/atlascode/adapters/sessionMemoryPortAdapter.ts
|
|
491597
491770
|
init_engine();
|
|
491598
491771
|
init_shared();
|
|
491599
|
-
import { mkdir as mkdir12, readFile as
|
|
491772
|
+
import { mkdir as mkdir12, readFile as readFile13, writeFile as writeFile8 } from "fs/promises";
|
|
491600
491773
|
import { dirname as dirname22, join as join41 } from "path";
|
|
491601
491774
|
function sessionMemoryPath() {
|
|
491602
491775
|
const env = getSessionEnv();
|
|
@@ -491606,7 +491779,7 @@ function createSessionMemoryPort() {
|
|
|
491606
491779
|
return {
|
|
491607
491780
|
async load() {
|
|
491608
491781
|
try {
|
|
491609
|
-
return await
|
|
491782
|
+
return await readFile13(sessionMemoryPath(), "utf-8");
|
|
491610
491783
|
} catch (e) {
|
|
491611
491784
|
if (isFsInaccessible(e))
|
|
491612
491785
|
return null;
|
|
@@ -492225,7 +492398,7 @@ function getAscendExecutor() {
|
|
|
492225
492398
|
return _instance;
|
|
492226
492399
|
}
|
|
492227
492400
|
// src/ascend/tools/SpecParser.ts
|
|
492228
|
-
import { readFile as
|
|
492401
|
+
import { readFile as readFile14 } from "node:fs/promises";
|
|
492229
492402
|
|
|
492230
492403
|
// src/ascend/tools/constants.ts
|
|
492231
492404
|
var SPEC_PARSER_TOOL_NAME = "AscendSpecParser";
|
|
@@ -492293,7 +492466,7 @@ var SpecParser = {
|
|
|
492293
492466
|
let raw = inp.spec_source;
|
|
492294
492467
|
let parsedFromFile = false;
|
|
492295
492468
|
try {
|
|
492296
|
-
const fileContent = await
|
|
492469
|
+
const fileContent = await readFile14(inp.spec_source, "utf-8");
|
|
492297
492470
|
raw = fileContent;
|
|
492298
492471
|
parsedFromFile = true;
|
|
492299
492472
|
} catch {}
|