@atlasharness/atlascode 0.1.44 → 0.1.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +311 -647
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -31975,9 +31975,6 @@ function setQuestionPreviewFormat(f) {
|
|
|
31975
31975
|
function getQuestionPreviewFormat() {
|
|
31976
31976
|
return _questionPreviewFormat;
|
|
31977
31977
|
}
|
|
31978
|
-
function setSessionSource(s) {
|
|
31979
|
-
_sessionSource = s;
|
|
31980
|
-
}
|
|
31981
31978
|
function setSessionBypassPermissionsMode(v) {
|
|
31982
31979
|
_sessionBypassPermissionsMode = v;
|
|
31983
31980
|
}
|
|
@@ -32079,7 +32076,7 @@ function setTrustAccepted(accepted) {
|
|
|
32079
32076
|
function hasTrustAccepted() {
|
|
32080
32077
|
return _trustAccepted;
|
|
32081
32078
|
}
|
|
32082
|
-
var _originalCwd2, _cwdState, _sessionId2, _isNonInteractiveSession = false, _clientType, _questionPreviewFormat,
|
|
32079
|
+
var _originalCwd2, _cwdState, _sessionId2, _isNonInteractiveSession = false, _clientType, _questionPreviewFormat, _sessionBypassPermissionsMode = false, _sessionPersistenceDisabled = false, _flagSettingsPath, _allowedSettingSources, _costState, sessionCreatedTeams, _transcriptDir, _mainThreadAgentType, _trustAccepted = true;
|
|
32083
32080
|
var init_state = __esm(() => {
|
|
32084
32081
|
init_shared();
|
|
32085
32082
|
_originalCwd2 = process.cwd();
|
|
@@ -84065,8 +84062,7 @@ async function main() {
|
|
|
84065
84062
|
const cliArgs = process.argv.slice(2);
|
|
84066
84063
|
const hasPrintFlag = cliArgs.includes("-p") || cliArgs.includes("--print");
|
|
84067
84064
|
const hasInitOnlyFlag = cliArgs.includes("--init-only");
|
|
84068
|
-
const
|
|
84069
|
-
const isNonInteractive = hasPrintFlag || hasInitOnlyFlag || hasSdkUrl || !process.stdout.isTTY;
|
|
84065
|
+
const isNonInteractive = hasPrintFlag || hasInitOnlyFlag || !process.stdout.isTTY;
|
|
84070
84066
|
const isInteractive = !isNonInteractive;
|
|
84071
84067
|
setIsInteractive(isInteractive);
|
|
84072
84068
|
initializeEntrypoint(isNonInteractive);
|
|
@@ -84098,9 +84094,6 @@ async function main() {
|
|
|
84098
84094
|
} else if (!clientType.startsWith("sdk-") && clientType !== "claude-desktop" && clientType !== "local-agent" && clientType !== "remote") {
|
|
84099
84095
|
setQuestionPreviewFormat("markdown");
|
|
84100
84096
|
}
|
|
84101
|
-
if (process.env.ATLAS_ENVIRONMENT_KIND === "bridge") {
|
|
84102
|
-
setSessionSource("remote-control");
|
|
84103
|
-
}
|
|
84104
84097
|
eagerLoadSettings();
|
|
84105
84098
|
await runCli();
|
|
84106
84099
|
}
|
|
@@ -85217,9 +85210,6 @@ function extractUserText(message) {
|
|
|
85217
85210
|
return "";
|
|
85218
85211
|
}
|
|
85219
85212
|
function createStructuredIO(inputPrompt, options) {
|
|
85220
|
-
if (options.sdkUrl) {
|
|
85221
|
-
throw new Error("--sdk-url is not available in this build (cloud transport cut; see cli 域裁登记)");
|
|
85222
|
-
}
|
|
85223
85213
|
const inputStream = typeof inputPrompt === "string" ? fromArray([]) : inputPrompt;
|
|
85224
85214
|
return new StructuredIO(inputStream, options.replayUserMessages);
|
|
85225
85215
|
}
|
|
@@ -85320,8 +85310,7 @@ async function runHeadless(inputPrompt, options) {
|
|
|
85320
85310
|
process.exit(1);
|
|
85321
85311
|
}
|
|
85322
85312
|
const hasValidResumeSessionId = typeof options.resume === "string" && (validateUuidLocal(options.resume) || options.resume.endsWith(".jsonl"));
|
|
85323
|
-
|
|
85324
|
-
if (!inputPrompt && !hasValidResumeSessionId && !isUsingSdkUrl) {
|
|
85313
|
+
if (!inputPrompt && !hasValidResumeSessionId) {
|
|
85325
85314
|
process.stderr.write(`Error: Input must be provided either through stdin or as a prompt argument when using --print
|
|
85326
85315
|
`);
|
|
85327
85316
|
process.exit(1);
|
|
@@ -85332,7 +85321,6 @@ async function runHeadless(inputPrompt, options) {
|
|
|
85332
85321
|
process.exit(1);
|
|
85333
85322
|
}
|
|
85334
85323
|
const structuredIO = createStructuredIO(inputPrompt, {
|
|
85335
|
-
sdkUrl: options.sdkUrl,
|
|
85336
85324
|
replayUserMessages: options.replayUserMessages
|
|
85337
85325
|
});
|
|
85338
85326
|
if (options.outputFormat === "stream-json") {
|
|
@@ -85351,7 +85339,7 @@ async function runHeadless(inputPrompt, options) {
|
|
|
85351
85339
|
const mcpConnections = await buildMcpEngineConnectionsLocal(mcpManager);
|
|
85352
85340
|
const mcpTools = createMcpTools(mcpConnections);
|
|
85353
85341
|
syncMcpClientRegistryLocal(mcpManager);
|
|
85354
|
-
const hasPromptRoute =
|
|
85342
|
+
const hasPromptRoute = options.permissionPromptToolName === "stdio";
|
|
85355
85343
|
const role = options.model ? modelToRole(options.model) : "premium";
|
|
85356
85344
|
const roleModel = getRoleModel(role);
|
|
85357
85345
|
logForDebugging2(modelLine(role, options.model ?? roleModel));
|
|
@@ -85403,7 +85391,7 @@ async function runHeadless(inputPrompt, options) {
|
|
|
85403
85391
|
},
|
|
85404
85392
|
options: { isNonInteractiveSession: true }
|
|
85405
85393
|
});
|
|
85406
|
-
const canUseTool = getCanUseToolFn(
|
|
85394
|
+
const canUseTool = getCanUseToolFn(options.permissionPromptToolName, structuredIO, () => mcpTools, hasPromptRoute ? onPermissionPrompt : undefined);
|
|
85407
85395
|
const checkPermission = async (tool, input) => {
|
|
85408
85396
|
const gate = createPermissionGate(tpcRef.current, {
|
|
85409
85397
|
getAppState: () => ({ toolPermissionContext: tpcRef.current })
|
|
@@ -86743,7 +86731,6 @@ function buildHeadlessOptions(options) {
|
|
|
86743
86731
|
model: options.model,
|
|
86744
86732
|
dangerouslySkipPermissions: options.dangerouslySkipPermissions === true ? true : undefined,
|
|
86745
86733
|
addDirs: options.addDir,
|
|
86746
|
-
sdkUrl: options.sdkUrl,
|
|
86747
86734
|
replayUserMessages: options.replayUserMessages === true ? true : undefined,
|
|
86748
86735
|
agent: options.agent,
|
|
86749
86736
|
disablePersistence: options.sessionPersistence === false ? true : undefined,
|
|
@@ -86786,11 +86773,6 @@ async function mainActionSeam(prompt, options) {
|
|
|
86786
86773
|
const outputFormat = options.outputFormat;
|
|
86787
86774
|
if (inputFormat === "stream-json" && outputFormat !== "stream-json") {
|
|
86788
86775
|
process.stderr.write(`Error: --input-format=stream-json requires output-format=stream-json.
|
|
86789
|
-
`);
|
|
86790
|
-
process.exit(1);
|
|
86791
|
-
}
|
|
86792
|
-
if (options.sdkUrl && (inputFormat !== "stream-json" || outputFormat !== "stream-json")) {
|
|
86793
|
-
process.stderr.write(`Error: --sdk-url requires both --input-format=stream-json and --output-format=stream-json.
|
|
86794
86776
|
`);
|
|
86795
86777
|
process.exit(1);
|
|
86796
86778
|
}
|
|
@@ -86852,7 +86834,6 @@ function buildProgram() {
|
|
|
86852
86834
|
program.addOption(new Option("--parent-session-id <id>", "Parent session ID for analytics correlation").hideHelp());
|
|
86853
86835
|
program.addOption(new Option("--teammate-mode <mode>", 'How to spawn teammates: "tmux", "in-process", or "auto"').choices(["auto", "tmux", "in-process"]).hideHelp());
|
|
86854
86836
|
program.addOption(new Option("--agent-type <type>", "Custom agent type for this teammate").hideHelp());
|
|
86855
|
-
program.addOption(new Option("--sdk-url <url>", "Use remote WebSocket endpoint for SDK I/O streaming (only with -p and stream-json format)").hideHelp());
|
|
86856
86837
|
if (feature("HARD_FAIL")) {
|
|
86857
86838
|
program.addOption(new Option("--hard-fail", "Crash on logError calls instead of silently logging").hideHelp());
|
|
86858
86839
|
}
|
|
@@ -121224,12 +121205,6 @@ function getGlobalConfig() {
|
|
|
121224
121205
|
return migrateConfigFields(getConfig2(getGlobalClaudeFile(), createDefaultGlobalConfig));
|
|
121225
121206
|
}
|
|
121226
121207
|
}
|
|
121227
|
-
function getRemoteControlAtStartup() {
|
|
121228
|
-
const explicit = getGlobalConfig().remoteControlAtStartup;
|
|
121229
|
-
if (explicit !== undefined)
|
|
121230
|
-
return explicit;
|
|
121231
|
-
return false;
|
|
121232
|
-
}
|
|
121233
121208
|
function getCustomApiKeyStatus(truncatedApiKey) {
|
|
121234
121209
|
const config = getGlobalConfig();
|
|
121235
121210
|
if (config.customApiKeyResponses?.approved?.includes(truncatedApiKey)) {
|
|
@@ -298060,7 +298035,6 @@ function getPath2(key) {
|
|
|
298060
298035
|
var SUPPORTED_SETTINGS2;
|
|
298061
298036
|
var init_supportedSettings2 = __esm(() => {
|
|
298062
298037
|
init_shared();
|
|
298063
|
-
init_config6();
|
|
298064
298038
|
init_configConstants();
|
|
298065
298039
|
init_modelOptions();
|
|
298066
298040
|
init_validateModel();
|
|
@@ -298169,14 +298143,6 @@ var init_supportedSettings2 = __esm(() => {
|
|
|
298169
298143
|
type: "boolean",
|
|
298170
298144
|
description: "Enable voice dictation (hold-to-talk)"
|
|
298171
298145
|
}
|
|
298172
|
-
} : {},
|
|
298173
|
-
...feature("BRIDGE_MODE") ? {
|
|
298174
|
-
remoteControlAtStartup: {
|
|
298175
|
-
source: "global",
|
|
298176
|
-
type: "boolean",
|
|
298177
|
-
description: "Enable Remote Control for all sessions (true | false | default)",
|
|
298178
|
-
formatOnRead: () => getRemoteControlAtStartup()
|
|
298179
|
-
}
|
|
298180
298146
|
} : {}
|
|
298181
298147
|
};
|
|
298182
298148
|
});
|
|
@@ -298836,33 +298802,6 @@ var init_ConfigTool = __esm(() => {
|
|
|
298836
298802
|
data: { success: true, operation: "get", setting, value: displayValue }
|
|
298837
298803
|
};
|
|
298838
298804
|
}
|
|
298839
|
-
if (setting === "remoteControlAtStartup" && typeof value === "string" && value.toLowerCase().trim() === "default") {
|
|
298840
|
-
saveGlobalConfig((prev) => {
|
|
298841
|
-
if (prev.remoteControlAtStartup === undefined)
|
|
298842
|
-
return prev;
|
|
298843
|
-
const next = { ...prev };
|
|
298844
|
-
delete next.remoteControlAtStartup;
|
|
298845
|
-
return next;
|
|
298846
|
-
});
|
|
298847
|
-
const resolved = getRemoteControlAtStartup();
|
|
298848
|
-
context.setAppState((prev) => {
|
|
298849
|
-
if (prev.replBridgeEnabled === resolved && !prev.replBridgeOutboundOnly)
|
|
298850
|
-
return prev;
|
|
298851
|
-
return {
|
|
298852
|
-
...prev,
|
|
298853
|
-
replBridgeEnabled: resolved,
|
|
298854
|
-
replBridgeOutboundOnly: false
|
|
298855
|
-
};
|
|
298856
|
-
});
|
|
298857
|
-
return {
|
|
298858
|
-
data: {
|
|
298859
|
-
success: true,
|
|
298860
|
-
operation: "set",
|
|
298861
|
-
setting,
|
|
298862
|
-
value: resolved
|
|
298863
|
-
}
|
|
298864
|
-
};
|
|
298865
|
-
}
|
|
298866
298805
|
let finalValue = value;
|
|
298867
298806
|
if (config.type === "boolean") {
|
|
298868
298807
|
if (typeof value === "string") {
|
|
@@ -299007,18 +298946,6 @@ var init_ConfigTool = __esm(() => {
|
|
|
299007
298946
|
return { ...prev, [appKey]: finalValue };
|
|
299008
298947
|
});
|
|
299009
298948
|
}
|
|
299010
|
-
if (setting === "remoteControlAtStartup") {
|
|
299011
|
-
const resolved = getRemoteControlAtStartup();
|
|
299012
|
-
context.setAppState((prev) => {
|
|
299013
|
-
if (prev.replBridgeEnabled === resolved && !prev.replBridgeOutboundOnly)
|
|
299014
|
-
return prev;
|
|
299015
|
-
return {
|
|
299016
|
-
...prev,
|
|
299017
|
-
replBridgeEnabled: resolved,
|
|
299018
|
-
replBridgeOutboundOnly: false
|
|
299019
|
-
};
|
|
299020
|
-
});
|
|
299021
|
-
}
|
|
299022
298949
|
return {
|
|
299023
298950
|
data: {
|
|
299024
298951
|
success: true,
|
|
@@ -348920,180 +348847,29 @@ function getUserBinDir(options) {
|
|
|
348920
348847
|
var init_xdg = () => {};
|
|
348921
348848
|
|
|
348922
348849
|
// src/tui/utils/nativeInstaller/download.ts
|
|
348923
|
-
import { createHash as createHash11 } from "crypto";
|
|
348924
|
-
import { chmod as chmod7, writeFile as writeFile35 } from "fs/promises";
|
|
348925
|
-
import { join as join135 } from "path";
|
|
348926
|
-
async function getLatestVersionFromBinaryRepo(channel = "latest", baseUrl, authConfig) {
|
|
348927
|
-
const startTime = Date.now();
|
|
348928
|
-
try {
|
|
348929
|
-
const response = await axios_default.get(`${baseUrl}/${channel}`, {
|
|
348930
|
-
timeout: 30000,
|
|
348931
|
-
responseType: "text",
|
|
348932
|
-
...authConfig
|
|
348933
|
-
});
|
|
348934
|
-
const latencyMs = Date.now() - startTime;
|
|
348935
|
-
return response.data.trim();
|
|
348936
|
-
} catch (error) {
|
|
348937
|
-
const latencyMs = Date.now() - startTime;
|
|
348938
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
348939
|
-
let httpStatus;
|
|
348940
|
-
if (axios_default.isAxiosError(error) && error.response) {
|
|
348941
|
-
httpStatus = error.response.status;
|
|
348942
|
-
}
|
|
348943
|
-
const fetchError = new Error(`Failed to fetch version from ${baseUrl}/${channel}: ${errorMessage}`);
|
|
348944
|
-
logError3(fetchError);
|
|
348945
|
-
throw fetchError;
|
|
348946
|
-
}
|
|
348947
|
-
}
|
|
348948
348850
|
async function getLatestVersion2(channelOrVersion) {
|
|
348949
348851
|
if (/^v?\d+\.\d+\.\d+(-\S+)?$/.test(channelOrVersion)) {
|
|
348950
348852
|
const normalized = channelOrVersion.startsWith("v") ? channelOrVersion.slice(1) : channelOrVersion;
|
|
348951
348853
|
if (/^99\.99\./.test(normalized) && !feature("ALLOW_TEST_VERSIONS")) {
|
|
348952
348854
|
throw new Error(`Version ${normalized} is not available for installation. Use 'stable' or 'latest'.`);
|
|
348953
348855
|
}
|
|
348954
|
-
|
|
348856
|
+
throw new Error(`Version ${normalized} cannot be installed: this product has no native distribution form (npm package / git source only)`);
|
|
348955
348857
|
}
|
|
348956
348858
|
const channel = channelOrVersion;
|
|
348957
348859
|
if (channel !== "stable" && channel !== "latest") {
|
|
348958
348860
|
throw new Error(`Invalid channel: ${channelOrVersion}. Use 'stable' or 'latest'`);
|
|
348959
348861
|
}
|
|
348960
|
-
|
|
348961
|
-
}
|
|
348962
|
-
function getStallTimeoutMs() {
|
|
348963
|
-
return Number(process.env.ATLAS_STALL_TIMEOUT_MS_FOR_TESTING) || DEFAULT_STALL_TIMEOUT_MS;
|
|
348964
|
-
}
|
|
348965
|
-
async function downloadAndVerifyBinary(binaryUrl, expectedChecksum, binaryPath, requestConfig = {}) {
|
|
348966
|
-
let lastError;
|
|
348967
|
-
for (let attempt = 1;attempt <= MAX_DOWNLOAD_RETRIES; attempt++) {
|
|
348968
|
-
const controller = new AbortController;
|
|
348969
|
-
let stallTimer;
|
|
348970
|
-
const clearStallTimer = () => {
|
|
348971
|
-
if (stallTimer) {
|
|
348972
|
-
clearTimeout(stallTimer);
|
|
348973
|
-
stallTimer = undefined;
|
|
348974
|
-
}
|
|
348975
|
-
};
|
|
348976
|
-
const resetStallTimer = () => {
|
|
348977
|
-
clearStallTimer();
|
|
348978
|
-
stallTimer = setTimeout((c) => c.abort(), getStallTimeoutMs(), controller);
|
|
348979
|
-
};
|
|
348980
|
-
try {
|
|
348981
|
-
resetStallTimer();
|
|
348982
|
-
const response = await axios_default.get(binaryUrl, {
|
|
348983
|
-
timeout: 5 * 60000,
|
|
348984
|
-
responseType: "arraybuffer",
|
|
348985
|
-
signal: controller.signal,
|
|
348986
|
-
onDownloadProgress: () => {
|
|
348987
|
-
resetStallTimer();
|
|
348988
|
-
},
|
|
348989
|
-
...requestConfig
|
|
348990
|
-
});
|
|
348991
|
-
clearStallTimer();
|
|
348992
|
-
const hash = createHash11("sha256");
|
|
348993
|
-
hash.update(response.data);
|
|
348994
|
-
const actualChecksum = hash.digest("hex");
|
|
348995
|
-
if (actualChecksum !== expectedChecksum) {
|
|
348996
|
-
throw new Error(`Checksum mismatch: expected ${expectedChecksum}, got ${actualChecksum}`);
|
|
348997
|
-
}
|
|
348998
|
-
await writeFile35(binaryPath, Buffer.from(response.data));
|
|
348999
|
-
await chmod7(binaryPath, 493);
|
|
349000
|
-
return;
|
|
349001
|
-
} catch (error) {
|
|
349002
|
-
clearStallTimer();
|
|
349003
|
-
const isStallTimeout = axios_default.isCancel(error);
|
|
349004
|
-
if (isStallTimeout) {
|
|
349005
|
-
lastError = new StallTimeoutError;
|
|
349006
|
-
} else {
|
|
349007
|
-
lastError = toError2(error);
|
|
349008
|
-
}
|
|
349009
|
-
if (isStallTimeout && attempt < MAX_DOWNLOAD_RETRIES) {
|
|
349010
|
-
logForDebugging3(`Download stalled on attempt ${attempt}/${MAX_DOWNLOAD_RETRIES}, retrying...`);
|
|
349011
|
-
await sleep9(1000);
|
|
349012
|
-
continue;
|
|
349013
|
-
}
|
|
349014
|
-
throw lastError;
|
|
349015
|
-
}
|
|
349016
|
-
}
|
|
349017
|
-
throw lastError ?? new Error("Download failed after all retries");
|
|
349018
|
-
}
|
|
349019
|
-
async function downloadVersionFromBinaryRepo(version, stagingPath, baseUrl, authConfig) {
|
|
349020
|
-
const fs = getFsImplementation2();
|
|
349021
|
-
await fs.rm(stagingPath, { recursive: true, force: true });
|
|
349022
|
-
const platform = getPlatform4();
|
|
349023
|
-
const startTime = Date.now();
|
|
349024
|
-
let manifest;
|
|
349025
|
-
try {
|
|
349026
|
-
const manifestResponse = await axios_default.get(`${baseUrl}/${version}/manifest.json`, {
|
|
349027
|
-
timeout: 1e4,
|
|
349028
|
-
responseType: "json",
|
|
349029
|
-
...authConfig
|
|
349030
|
-
});
|
|
349031
|
-
manifest = manifestResponse.data;
|
|
349032
|
-
} catch (error) {
|
|
349033
|
-
const latencyMs = Date.now() - startTime;
|
|
349034
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
349035
|
-
let httpStatus;
|
|
349036
|
-
if (axios_default.isAxiosError(error) && error.response) {
|
|
349037
|
-
httpStatus = error.response.status;
|
|
349038
|
-
}
|
|
349039
|
-
logError3(new Error(`Failed to fetch manifest from ${baseUrl}/${version}/manifest.json: ${errorMessage}`));
|
|
349040
|
-
throw error;
|
|
349041
|
-
}
|
|
349042
|
-
const platformInfo = manifest.platforms[platform];
|
|
349043
|
-
if (!platformInfo) {
|
|
349044
|
-
throw new Error(`Platform ${platform} not found in manifest for version ${version}`);
|
|
349045
|
-
}
|
|
349046
|
-
const expectedChecksum = platformInfo.checksum;
|
|
349047
|
-
const binaryName = getBinaryName(platform);
|
|
349048
|
-
const binaryUrl = `${baseUrl}/${version}/${platform}/${binaryName}`;
|
|
349049
|
-
await fs.mkdir(stagingPath);
|
|
349050
|
-
const binaryPath = join135(stagingPath, binaryName);
|
|
349051
|
-
try {
|
|
349052
|
-
await downloadAndVerifyBinary(binaryUrl, expectedChecksum, binaryPath, authConfig || {});
|
|
349053
|
-
const latencyMs = Date.now() - startTime;
|
|
349054
|
-
} catch (error) {
|
|
349055
|
-
const latencyMs = Date.now() - startTime;
|
|
349056
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
349057
|
-
let httpStatus;
|
|
349058
|
-
if (axios_default.isAxiosError(error) && error.response) {
|
|
349059
|
-
httpStatus = error.response.status;
|
|
349060
|
-
}
|
|
349061
|
-
logError3(new Error(`Failed to download binary from ${binaryUrl}: ${errorMessage}`));
|
|
349062
|
-
throw error;
|
|
349063
|
-
}
|
|
348862
|
+
throw new Error(`Channel '${channel}' cannot be resolved: this product has no native distribution form (npm package / git source only)`);
|
|
349064
348863
|
}
|
|
349065
|
-
async function downloadVersion(
|
|
349066
|
-
|
|
349067
|
-
const { stdout } = await execFileNoThrowWithCwd2("gcloud", [
|
|
349068
|
-
"auth",
|
|
349069
|
-
"print-access-token"
|
|
349070
|
-
]);
|
|
349071
|
-
await downloadVersionFromBinaryRepo(version, stagingPath, "https://storage.googleapis.com/claude-code-ci-sentinel", { headers: { Authorization: `Bearer ${stdout.trim()}` } });
|
|
349072
|
-
return "binary";
|
|
349073
|
-
}
|
|
349074
|
-
await downloadVersionFromBinaryRepo(version, stagingPath, GCS_BUCKET_URL);
|
|
349075
|
-
return "binary";
|
|
348864
|
+
async function downloadVersion(_version, _stagingPath) {
|
|
348865
|
+
throw new Error("Native binary download is not available in this product (no native distribution form; npm package / git source only)");
|
|
349076
348866
|
}
|
|
349077
|
-
var GCS_BUCKET_URL = "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases", DEFAULT_STALL_TIMEOUT_MS = 60000, MAX_DOWNLOAD_RETRIES = 3, StallTimeoutError;
|
|
349078
348867
|
var init_download = __esm(() => {
|
|
349079
348868
|
init_shared();
|
|
349080
|
-
init_axios2();
|
|
349081
|
-
init_debug();
|
|
349082
|
-
init_errors4();
|
|
349083
|
-
init_execFileNoThrow2();
|
|
349084
|
-
init_fsOperations();
|
|
349085
|
-
init_log5();
|
|
349086
|
-
init_installer();
|
|
349087
|
-
StallTimeoutError = class StallTimeoutError extends Error {
|
|
349088
|
-
constructor() {
|
|
349089
|
-
super("Download stalled: no data received for 60 seconds");
|
|
349090
|
-
this.name = "StallTimeoutError";
|
|
349091
|
-
}
|
|
349092
|
-
};
|
|
349093
348869
|
});
|
|
349094
348870
|
|
|
349095
348871
|
// src/tui/utils/nativeInstaller/pidLock.ts
|
|
349096
|
-
import { basename as basename41, join as
|
|
348872
|
+
import { basename as basename41, join as join135 } from "path";
|
|
349097
348873
|
function isPidBasedLockingEnabled() {
|
|
349098
348874
|
const envVar = process.env.ENABLE_PID_BASED_VERSION_LOCKING;
|
|
349099
348875
|
if (isEnvTruthy2(envVar)) {
|
|
@@ -349261,7 +349037,7 @@ function getAllLockInfo(locksDir) {
|
|
|
349261
349037
|
try {
|
|
349262
349038
|
const lockFiles = fs.readdirStringSync(locksDir).filter((f) => f.endsWith(".lock"));
|
|
349263
349039
|
for (const lockFile of lockFiles) {
|
|
349264
|
-
const lockFilePath =
|
|
349040
|
+
const lockFilePath = join135(locksDir, lockFile);
|
|
349265
349041
|
const content = readLockContent(lockFilePath);
|
|
349266
349042
|
if (content) {
|
|
349267
349043
|
lockInfos.push({
|
|
@@ -349288,7 +349064,7 @@ function cleanupStaleLocks(locksDir) {
|
|
|
349288
349064
|
try {
|
|
349289
349065
|
const lockEntries = fs.readdirStringSync(locksDir).filter((f) => f.endsWith(".lock"));
|
|
349290
349066
|
for (const lockEntry of lockEntries) {
|
|
349291
|
-
const lockFilePath =
|
|
349067
|
+
const lockFilePath = join135(locksDir, lockEntry);
|
|
349292
349068
|
try {
|
|
349293
349069
|
const stats = fs.lstatSync(lockFilePath);
|
|
349294
349070
|
if (stats.isDirectory()) {
|
|
@@ -349327,7 +349103,7 @@ var init_pidLock = __esm(() => {
|
|
|
349327
349103
|
import { constants as fsConstants7 } from "fs";
|
|
349328
349104
|
import {
|
|
349329
349105
|
access as access5,
|
|
349330
|
-
chmod as
|
|
349106
|
+
chmod as chmod7,
|
|
349331
349107
|
copyFile as copyFile8,
|
|
349332
349108
|
lstat as lstat6,
|
|
349333
349109
|
mkdir as mkdir40,
|
|
@@ -349340,10 +349116,10 @@ import {
|
|
|
349340
349116
|
stat as stat45,
|
|
349341
349117
|
symlink as symlink6,
|
|
349342
349118
|
unlink as unlink17,
|
|
349343
|
-
writeFile as
|
|
349119
|
+
writeFile as writeFile35
|
|
349344
349120
|
} from "fs/promises";
|
|
349345
349121
|
import { homedir as homedir34 } from "os";
|
|
349346
|
-
import { basename as basename42, delimiter as delimiter3, dirname as dirname69, join as
|
|
349122
|
+
import { basename as basename42, delimiter as delimiter3, dirname as dirname69, join as join136, resolve as resolve46 } from "path";
|
|
349347
349123
|
function getPlatform4() {
|
|
349348
349124
|
const os = env5.platform;
|
|
349349
349125
|
const arch = process.arch === "x64" ? "x64" : process.arch === "arm64" ? "arm64" : null;
|
|
@@ -349364,10 +349140,10 @@ function getBaseDirectories() {
|
|
|
349364
349140
|
const platform = getPlatform4();
|
|
349365
349141
|
const executableName = getBinaryName(platform);
|
|
349366
349142
|
return {
|
|
349367
|
-
versions:
|
|
349368
|
-
staging:
|
|
349369
|
-
locks:
|
|
349370
|
-
executable:
|
|
349143
|
+
versions: join136(getXDGDataHome(), getConfigDirName2(), "versions"),
|
|
349144
|
+
staging: join136(getXDGCacheHome(), getConfigDirName2(), "staging"),
|
|
349145
|
+
locks: join136(getXDGStateHome(), getConfigDirName2(), "locks"),
|
|
349146
|
+
executable: join136(getUserBinDir(), executableName)
|
|
349371
349147
|
};
|
|
349372
349148
|
}
|
|
349373
349149
|
async function isPossibleClaudeBinary(filePath) {
|
|
@@ -349388,14 +349164,14 @@ async function getVersionPaths(version) {
|
|
|
349388
349164
|
await Promise.all(dirsToCreate.map((dir) => mkdir40(dir, { recursive: true })));
|
|
349389
349165
|
const executableParentDir = dirname69(dirs.executable);
|
|
349390
349166
|
await mkdir40(executableParentDir, { recursive: true });
|
|
349391
|
-
const installPath =
|
|
349167
|
+
const installPath = join136(dirs.versions, version);
|
|
349392
349168
|
try {
|
|
349393
349169
|
await stat45(installPath);
|
|
349394
349170
|
} catch {
|
|
349395
|
-
await
|
|
349171
|
+
await writeFile35(installPath, "", { encoding: "utf8" });
|
|
349396
349172
|
}
|
|
349397
349173
|
return {
|
|
349398
|
-
stagingPath:
|
|
349174
|
+
stagingPath: join136(dirs.staging, version),
|
|
349399
349175
|
installPath
|
|
349400
349176
|
};
|
|
349401
349177
|
}
|
|
@@ -349466,7 +349242,7 @@ async function atomicMoveToInstallPath(stagedBinaryPath, installPath) {
|
|
|
349466
349242
|
const tempInstallPath = `${installPath}.tmp.${process.pid}.${Date.now()}`;
|
|
349467
349243
|
try {
|
|
349468
349244
|
await copyFile8(stagedBinaryPath, tempInstallPath);
|
|
349469
|
-
await
|
|
349245
|
+
await chmod7(tempInstallPath, 493);
|
|
349470
349246
|
await rename7(tempInstallPath, installPath);
|
|
349471
349247
|
logForDebugging3(`Atomically installed binary to ${installPath}`);
|
|
349472
349248
|
} catch (error) {
|
|
@@ -349478,14 +349254,14 @@ async function atomicMoveToInstallPath(stagedBinaryPath, installPath) {
|
|
|
349478
349254
|
}
|
|
349479
349255
|
async function installVersionFromPackage(stagingPath, installPath) {
|
|
349480
349256
|
try {
|
|
349481
|
-
const nodeModulesDir =
|
|
349257
|
+
const nodeModulesDir = join136(stagingPath, "node_modules", "@anthropic-ai");
|
|
349482
349258
|
const entries = await readdir26(nodeModulesDir);
|
|
349483
349259
|
const nativePackage = entries.find((entry) => entry.startsWith("atlas-cli-native-") || entry.startsWith("claude-cli-native-"));
|
|
349484
349260
|
if (!nativePackage) {
|
|
349485
349261
|
const error = new Error("Could not find platform-specific native package");
|
|
349486
349262
|
throw error;
|
|
349487
349263
|
}
|
|
349488
|
-
const stagedBinaryPath =
|
|
349264
|
+
const stagedBinaryPath = join136(nodeModulesDir, nativePackage, "cli");
|
|
349489
349265
|
try {
|
|
349490
349266
|
await stat45(stagedBinaryPath);
|
|
349491
349267
|
} catch {
|
|
@@ -349505,7 +349281,7 @@ async function installVersionFromBinary(stagingPath, installPath) {
|
|
|
349505
349281
|
try {
|
|
349506
349282
|
const platform = getPlatform4();
|
|
349507
349283
|
const binaryName = getBinaryName(platform);
|
|
349508
|
-
const stagedBinaryPath =
|
|
349284
|
+
const stagedBinaryPath = join136(stagingPath, binaryName);
|
|
349509
349285
|
try {
|
|
349510
349286
|
await stat45(stagedBinaryPath);
|
|
349511
349287
|
} catch {
|
|
@@ -349871,7 +349647,7 @@ async function getVersionFromSymlink(symlinkPath) {
|
|
|
349871
349647
|
}
|
|
349872
349648
|
function getLockFilePathFromVersionPath(dirs, versionPath) {
|
|
349873
349649
|
const versionName = basename42(versionPath);
|
|
349874
|
-
return
|
|
349650
|
+
return join136(dirs.locks, `${versionName}.lock`);
|
|
349875
349651
|
}
|
|
349876
349652
|
async function lockCurrentVersion() {
|
|
349877
349653
|
const dirs = getBaseDirectories();
|
|
@@ -349949,7 +349725,7 @@ async function cleanupOldVersions() {
|
|
|
349949
349725
|
if (!/atlas\.exe\.old\.\d+$/.test(file))
|
|
349950
349726
|
continue;
|
|
349951
349727
|
try {
|
|
349952
|
-
await unlink17(
|
|
349728
|
+
await unlink17(join136(executableDir, file));
|
|
349953
349729
|
cleanedCount++;
|
|
349954
349730
|
} catch {}
|
|
349955
349731
|
}
|
|
@@ -349966,7 +349742,7 @@ async function cleanupOldVersions() {
|
|
|
349966
349742
|
const stagingEntries = await readdir26(dirs.staging);
|
|
349967
349743
|
let stagingCleanedCount = 0;
|
|
349968
349744
|
for (const entry of stagingEntries) {
|
|
349969
|
-
const stagingPath =
|
|
349745
|
+
const stagingPath = join136(dirs.staging, entry);
|
|
349970
349746
|
try {
|
|
349971
349747
|
const stats = await stat45(stagingPath);
|
|
349972
349748
|
if (stats.mtime.getTime() < oneHourAgo) {
|
|
@@ -350002,7 +349778,7 @@ async function cleanupOldVersions() {
|
|
|
350002
349778
|
const versionFiles = [];
|
|
350003
349779
|
let tempFilesCleanedCount = 0;
|
|
350004
349780
|
for (const entry of versionEntries) {
|
|
350005
|
-
const entryPath =
|
|
349781
|
+
const entryPath = join136(dirs.versions, entry);
|
|
350006
349782
|
if (/\.tmp\.\d+\.\d+$/.test(entry)) {
|
|
350007
349783
|
try {
|
|
350008
349784
|
const stats = await stat45(entryPath);
|
|
@@ -350175,9 +349951,9 @@ async function manualRemoveNpmPackage(packageName) {
|
|
|
350175
349951
|
}
|
|
350176
349952
|
}
|
|
350177
349953
|
if (getPlatform4().startsWith("win32")) {
|
|
350178
|
-
const binCmd =
|
|
350179
|
-
const binPs1 =
|
|
350180
|
-
const binExe =
|
|
349954
|
+
const binCmd = join136(globalPrefix, "atlas.cmd");
|
|
349955
|
+
const binPs1 = join136(globalPrefix, "atlas.ps1");
|
|
349956
|
+
const binExe = join136(globalPrefix, "atlas");
|
|
350181
349957
|
if (await tryRemove(binCmd, "bin script")) {
|
|
350182
349958
|
manuallyRemoved = true;
|
|
350183
349959
|
}
|
|
@@ -350188,14 +349964,14 @@ async function manualRemoveNpmPackage(packageName) {
|
|
|
350188
349964
|
manuallyRemoved = true;
|
|
350189
349965
|
}
|
|
350190
349966
|
} else {
|
|
350191
|
-
const binSymlink =
|
|
349967
|
+
const binSymlink = join136(globalPrefix, "bin", "atlas");
|
|
350192
349968
|
if (await tryRemove(binSymlink, "bin symlink")) {
|
|
350193
349969
|
manuallyRemoved = true;
|
|
350194
349970
|
}
|
|
350195
349971
|
}
|
|
350196
349972
|
if (manuallyRemoved) {
|
|
350197
349973
|
logForDebugging3(`Successfully removed ${packageName} manually`);
|
|
350198
|
-
const nodeModulesPath = getPlatform4().startsWith("win32") ?
|
|
349974
|
+
const nodeModulesPath = getPlatform4().startsWith("win32") ? join136(globalPrefix, "node_modules", packageName) : join136(globalPrefix, "lib", "node_modules", packageName);
|
|
350199
349975
|
return {
|
|
350200
349976
|
success: true,
|
|
350201
349977
|
warning: `${packageName} executables removed, but node_modules directory was left intact for safety. You may manually delete it later at: ${nodeModulesPath}`
|
|
@@ -350264,7 +350040,7 @@ async function cleanupNpmInstallations() {
|
|
|
350264
350040
|
errors.push(macroPackageResult.error);
|
|
350265
350041
|
}
|
|
350266
350042
|
}
|
|
350267
|
-
const localInstallDir =
|
|
350043
|
+
const localInstallDir = join136(homedir34(), getConfigDirName2(), "local");
|
|
350268
350044
|
try {
|
|
350269
350045
|
await rm10(localInstallDir, { recursive: true });
|
|
350270
350046
|
removed++;
|
|
@@ -353493,54 +353269,6 @@ function Config({
|
|
|
353493
353269
|
onChange() {}
|
|
353494
353270
|
}];
|
|
353495
353271
|
})() : [],
|
|
353496
|
-
...feature("BRIDGE_MODE") && isBridgeEnabled() ? [{
|
|
353497
|
-
id: "remoteControlAtStartup",
|
|
353498
|
-
label: "Enable Remote Control for all sessions",
|
|
353499
|
-
value: globalConfig.remoteControlAtStartup === undefined ? "default" : String(globalConfig.remoteControlAtStartup),
|
|
353500
|
-
options: ["true", "false", "default"],
|
|
353501
|
-
type: "enum",
|
|
353502
|
-
onChange(selected_0) {
|
|
353503
|
-
if (selected_0 === "default") {
|
|
353504
|
-
saveGlobalConfig((current_20) => {
|
|
353505
|
-
if (current_20.remoteControlAtStartup === undefined)
|
|
353506
|
-
return current_20;
|
|
353507
|
-
const next_0 = {
|
|
353508
|
-
...current_20
|
|
353509
|
-
};
|
|
353510
|
-
delete next_0.remoteControlAtStartup;
|
|
353511
|
-
return next_0;
|
|
353512
|
-
});
|
|
353513
|
-
setGlobalConfig({
|
|
353514
|
-
...getGlobalConfig(),
|
|
353515
|
-
remoteControlAtStartup: undefined
|
|
353516
|
-
});
|
|
353517
|
-
} else {
|
|
353518
|
-
const enabled_6 = selected_0 === "true";
|
|
353519
|
-
saveGlobalConfig((current_21) => {
|
|
353520
|
-
if (current_21.remoteControlAtStartup === enabled_6)
|
|
353521
|
-
return current_21;
|
|
353522
|
-
return {
|
|
353523
|
-
...current_21,
|
|
353524
|
-
remoteControlAtStartup: enabled_6
|
|
353525
|
-
};
|
|
353526
|
-
});
|
|
353527
|
-
setGlobalConfig({
|
|
353528
|
-
...getGlobalConfig(),
|
|
353529
|
-
remoteControlAtStartup: enabled_6
|
|
353530
|
-
});
|
|
353531
|
-
}
|
|
353532
|
-
const resolved = getRemoteControlAtStartup();
|
|
353533
|
-
setAppState((prev_20) => {
|
|
353534
|
-
if (prev_20.replBridgeEnabled === resolved && !prev_20.replBridgeOutboundOnly)
|
|
353535
|
-
return prev_20;
|
|
353536
|
-
return {
|
|
353537
|
-
...prev_20,
|
|
353538
|
-
replBridgeEnabled: resolved,
|
|
353539
|
-
replBridgeOutboundOnly: false
|
|
353540
|
-
};
|
|
353541
|
-
});
|
|
353542
|
-
}
|
|
353543
|
-
}] : [],
|
|
353544
353272
|
...shouldShowExternalIncludesToggle ? [{
|
|
353545
353273
|
id: "showExternalIncludesDialog",
|
|
353546
353274
|
label: "External ATLAS.md includes",
|
|
@@ -353708,10 +353436,6 @@ function Config({
|
|
|
353708
353436
|
if (globalConfig.showTurnDuration !== initialConfig.current.showTurnDuration) {
|
|
353709
353437
|
formattedChanges.push(`${globalConfig.showTurnDuration ? "Enabled" : "Disabled"} turn duration`);
|
|
353710
353438
|
}
|
|
353711
|
-
if (globalConfig.remoteControlAtStartup !== initialConfig.current.remoteControlAtStartup) {
|
|
353712
|
-
const remoteLabel = globalConfig.remoteControlAtStartup === undefined ? "Reset Remote Control to default" : `${globalConfig.remoteControlAtStartup ? "Enabled" : "Disabled"} Remote Control for all sessions`;
|
|
353713
|
-
formattedChanges.push(remoteLabel);
|
|
353714
|
-
}
|
|
353715
353439
|
if (settingsData?.autoUpdatesChannel !== initialSettingsData.current?.autoUpdatesChannel) {
|
|
353716
353440
|
formattedChanges.push(`Set auto-update channel to ${source_default.bold(settingsData?.autoUpdatesChannel ?? "latest")}`);
|
|
353717
353441
|
}
|
|
@@ -354520,7 +354244,7 @@ function NotifChannelLabel(t0) {
|
|
|
354520
354244
|
}
|
|
354521
354245
|
}
|
|
354522
354246
|
}
|
|
354523
|
-
var import_compiler_runtime124, React45, import_react90, jsx_dev_runtime151,
|
|
354247
|
+
var import_compiler_runtime124, React45, import_react90, jsx_dev_runtime151, THEME_LABELS;
|
|
354524
354248
|
var init_Config = __esm(() => {
|
|
354525
354249
|
init_shared();
|
|
354526
354250
|
init_ink2();
|
|
@@ -359018,7 +358742,7 @@ var init_doctorContextWarnings = __esm(() => {
|
|
|
359018
358742
|
});
|
|
359019
358743
|
|
|
359020
358744
|
// src/tui/screens/Doctor.tsx
|
|
359021
|
-
import { join as
|
|
358745
|
+
import { join as join137 } from "path";
|
|
359022
358746
|
function DistTagsDisplay(t0) {
|
|
359023
358747
|
const $ = import_compiler_runtime139.c(8);
|
|
359024
358748
|
const {
|
|
@@ -359148,8 +358872,8 @@ function Doctor(t0) {
|
|
|
359148
358872
|
t5 = () => {
|
|
359149
358873
|
getDoctorDiagnostic().then(setDiagnostic);
|
|
359150
358874
|
(async () => {
|
|
359151
|
-
const userAgentsDir =
|
|
359152
|
-
const projectAgentsDir =
|
|
358875
|
+
const userAgentsDir = join137(getAtlasConfigHomeDir3(), "agents");
|
|
358876
|
+
const projectAgentsDir = join137(getOriginalCwd(), "getConfigDirName()", "agents");
|
|
359153
358877
|
const {
|
|
359154
358878
|
activeAgents,
|
|
359155
358879
|
allAgents,
|
|
@@ -359172,7 +358896,7 @@ function Doctor(t0) {
|
|
|
359172
358896
|
}, async () => toolPermissionContext);
|
|
359173
358897
|
setContextWarnings(warnings);
|
|
359174
358898
|
if (isPidBasedLockingEnabled()) {
|
|
359175
|
-
const locksDir =
|
|
358899
|
+
const locksDir = join137(getXDGStateHome(), getConfigDirName2(), "locks");
|
|
359176
358900
|
const staleLocksCleaned = cleanupStaleLocks(locksDir);
|
|
359177
358901
|
const locks = getAllLockInfo(locksDir);
|
|
359178
358902
|
setVersionLockInfo({
|
|
@@ -360661,12 +360385,12 @@ var init_editor = __esm(() => {
|
|
|
360661
360385
|
});
|
|
360662
360386
|
|
|
360663
360387
|
// src/tui/utils/tempfile.ts
|
|
360664
|
-
import { createHash as
|
|
360388
|
+
import { createHash as createHash11, randomUUID as randomUUID38 } from "crypto";
|
|
360665
360389
|
import { tmpdir as tmpdir9 } from "os";
|
|
360666
|
-
import { join as
|
|
360390
|
+
import { join as join138 } from "path";
|
|
360667
360391
|
function generateTempFilePath2(prefix = "atlas-prompt", extension = ".md", options) {
|
|
360668
|
-
const id = options?.contentHash ?
|
|
360669
|
-
return
|
|
360392
|
+
const id = options?.contentHash ? createHash11("sha256").update(options.contentHash).digest("hex").slice(0, 16) : randomUUID38();
|
|
360393
|
+
return join138(tmpdir9(), `${prefix}-${id}${extension}`);
|
|
360670
360394
|
}
|
|
360671
360395
|
var init_tempfile = () => {};
|
|
360672
360396
|
|
|
@@ -360791,7 +360515,7 @@ var exports_memory = {};
|
|
|
360791
360515
|
__export(exports_memory, {
|
|
360792
360516
|
call: () => call16
|
|
360793
360517
|
});
|
|
360794
|
-
import { mkdir as mkdir42, writeFile as
|
|
360518
|
+
import { mkdir as mkdir42, writeFile as writeFile36 } from "fs/promises";
|
|
360795
360519
|
function MemoryCommand({
|
|
360796
360520
|
onDone
|
|
360797
360521
|
}) {
|
|
@@ -360803,7 +360527,7 @@ function MemoryCommand({
|
|
|
360803
360527
|
});
|
|
360804
360528
|
}
|
|
360805
360529
|
try {
|
|
360806
|
-
await
|
|
360530
|
+
await writeFile36(memoryPath, "", {
|
|
360807
360531
|
encoding: "utf8",
|
|
360808
360532
|
flag: "wx"
|
|
360809
360533
|
});
|
|
@@ -363295,7 +363019,7 @@ var exports_keybindings = {};
|
|
|
363295
363019
|
__export(exports_keybindings, {
|
|
363296
363020
|
call: () => call19
|
|
363297
363021
|
});
|
|
363298
|
-
import { mkdir as mkdir43, writeFile as
|
|
363022
|
+
import { mkdir as mkdir43, writeFile as writeFile37 } from "fs/promises";
|
|
363299
363023
|
import { dirname as dirname70 } from "path";
|
|
363300
363024
|
async function call19() {
|
|
363301
363025
|
if (!isKeybindingCustomizationEnabled()) {
|
|
@@ -363308,7 +363032,7 @@ async function call19() {
|
|
|
363308
363032
|
let fileExists = false;
|
|
363309
363033
|
await mkdir43(dirname70(keybindingsPath), { recursive: true });
|
|
363310
363034
|
try {
|
|
363311
|
-
await
|
|
363035
|
+
await writeFile37(keybindingsPath, generateKeybindingsTemplate(), {
|
|
363312
363036
|
encoding: "utf-8",
|
|
363313
363037
|
flag: "wx"
|
|
363314
363038
|
});
|
|
@@ -370024,10 +369748,10 @@ var init_mcp7 = __esm(() => {
|
|
|
370024
369748
|
});
|
|
370025
369749
|
|
|
370026
369750
|
// src/tui/utils/releaseNotes.ts
|
|
370027
|
-
import { mkdir as mkdir44, readFile as readFile48, writeFile as
|
|
370028
|
-
import { dirname as dirname71, join as
|
|
369751
|
+
import { mkdir as mkdir44, readFile as readFile48, writeFile as writeFile38 } from "fs/promises";
|
|
369752
|
+
import { dirname as dirname71, join as join139 } from "path";
|
|
370029
369753
|
function getChangelogCachePath() {
|
|
370030
|
-
return
|
|
369754
|
+
return join139(getAtlasConfigHomeDir3(), "cache", "changelog.md");
|
|
370031
369755
|
}
|
|
370032
369756
|
async function migrateChangelogFromConfig() {
|
|
370033
369757
|
const config = getGlobalConfig();
|
|
@@ -370037,7 +369761,7 @@ async function migrateChangelogFromConfig() {
|
|
|
370037
369761
|
const cachePath = getChangelogCachePath();
|
|
370038
369762
|
try {
|
|
370039
369763
|
await mkdir44(dirname71(cachePath), { recursive: true });
|
|
370040
|
-
await
|
|
369764
|
+
await writeFile38(cachePath, config.cachedChangelog, {
|
|
370041
369765
|
encoding: "utf-8",
|
|
370042
369766
|
flag: "wx"
|
|
370043
369767
|
});
|
|
@@ -370059,7 +369783,7 @@ async function fetchAndStoreChangelog() {
|
|
|
370059
369783
|
}
|
|
370060
369784
|
const cachePath = getChangelogCachePath();
|
|
370061
369785
|
await mkdir44(dirname71(cachePath), { recursive: true });
|
|
370062
|
-
await
|
|
369786
|
+
await writeFile38(cachePath, changelogContent, { encoding: "utf-8" });
|
|
370063
369787
|
changelogMemoryCache = changelogContent;
|
|
370064
369788
|
const changelogLastFetched = Date.now();
|
|
370065
369789
|
saveGlobalConfig((current) => ({
|
|
@@ -387349,7 +387073,7 @@ var init_vim2 = __esm(() => {
|
|
|
387349
387073
|
});
|
|
387350
387074
|
|
|
387351
387075
|
// src/tui/utils/plugins/pluginStartupCheck.ts
|
|
387352
|
-
import { join as
|
|
387076
|
+
import { join as join140 } from "path";
|
|
387353
387077
|
function getPluginEditableScopes() {
|
|
387354
387078
|
const result = new Map;
|
|
387355
387079
|
const addDirPlugins = getAddDirEnabledPlugins();
|
|
@@ -387421,7 +387145,7 @@ async function installSelectedPlugins(pluginsToInstall, onProgress, scope = "use
|
|
|
387421
387145
|
} else {
|
|
387422
387146
|
registerPluginInstallation({
|
|
387423
387147
|
pluginId,
|
|
387424
|
-
installPath:
|
|
387148
|
+
installPath: join140(marketplaceInstallLocation, entry.source),
|
|
387425
387149
|
version: entry.version
|
|
387426
387150
|
}, scope, projectPath);
|
|
387427
387151
|
}
|
|
@@ -387453,7 +387177,7 @@ var init_pluginStartupCheck = __esm(() => {
|
|
|
387453
387177
|
});
|
|
387454
387178
|
|
|
387455
387179
|
// src/tui/services/plugins/pluginOperations.ts
|
|
387456
|
-
import { dirname as dirname72, join as
|
|
387180
|
+
import { dirname as dirname72, join as join141 } from "path";
|
|
387457
387181
|
function assertInstallableScope(scope) {
|
|
387458
387182
|
if (!VALID_INSTALLABLE_SCOPES.includes(scope)) {
|
|
387459
387183
|
throw new Error(`Invalid scope "${scope}". Must be one of: ${VALID_INSTALLABLE_SCOPES.join(", ")}`);
|
|
@@ -387931,7 +387655,7 @@ async function performPluginUpdate({
|
|
|
387931
387655
|
throw e;
|
|
387932
387656
|
}
|
|
387933
387657
|
const marketplaceDir = marketplaceStats.isDirectory() ? marketplaceInstallLocation : dirname72(marketplaceInstallLocation);
|
|
387934
|
-
sourcePath =
|
|
387658
|
+
sourcePath = join141(marketplaceDir, entry.source);
|
|
387935
387659
|
try {
|
|
387936
387660
|
await fs.stat(sourcePath);
|
|
387937
387661
|
} catch (e) {
|
|
@@ -388031,7 +387755,7 @@ __export(exports_thinkback, {
|
|
|
388031
387755
|
playAnimation: () => playAnimation
|
|
388032
387756
|
});
|
|
388033
387757
|
import { readFile as readFile49 } from "fs/promises";
|
|
388034
|
-
import { join as
|
|
387758
|
+
import { join as join142 } from "path";
|
|
388035
387759
|
function getMarketplaceName() {
|
|
388036
387760
|
return OFFICIAL_MARKETPLACE_NAME;
|
|
388037
387761
|
}
|
|
@@ -388049,15 +387773,15 @@ async function getThinkbackSkillDir() {
|
|
|
388049
387773
|
if (!thinkbackPlugin) {
|
|
388050
387774
|
return null;
|
|
388051
387775
|
}
|
|
388052
|
-
const skillDir =
|
|
387776
|
+
const skillDir = join142(thinkbackPlugin.path, "skills", SKILL_NAME);
|
|
388053
387777
|
if (await pathExists2(skillDir)) {
|
|
388054
387778
|
return skillDir;
|
|
388055
387779
|
}
|
|
388056
387780
|
return null;
|
|
388057
387781
|
}
|
|
388058
387782
|
async function playAnimation(skillDir) {
|
|
388059
|
-
const dataPath =
|
|
388060
|
-
const playerPath =
|
|
387783
|
+
const dataPath = join142(skillDir, "year_in_review.js");
|
|
387784
|
+
const playerPath = join142(skillDir, "player.js");
|
|
388061
387785
|
try {
|
|
388062
387786
|
await readFile49(dataPath);
|
|
388063
387787
|
} catch (e) {
|
|
@@ -388105,7 +387829,7 @@ async function playAnimation(skillDir) {
|
|
|
388105
387829
|
} catch {} finally {
|
|
388106
387830
|
inkInstance.exitAlternateScreen();
|
|
388107
387831
|
}
|
|
388108
|
-
const htmlPath =
|
|
387832
|
+
const htmlPath = join142(skillDir, "year_in_review.html");
|
|
388109
387833
|
if (await pathExists2(htmlPath)) {
|
|
388110
387834
|
const platform = getPlatform3();
|
|
388111
387835
|
const openCmd = platform === "macos" ? "open" : platform === "windows" ? "start" : "xdg-open";
|
|
@@ -388441,7 +388165,7 @@ function ThinkbackFlow(t0) {
|
|
|
388441
388165
|
if (!skillDir) {
|
|
388442
388166
|
return;
|
|
388443
388167
|
}
|
|
388444
|
-
const dataPath =
|
|
388168
|
+
const dataPath = join142(skillDir, "year_in_review.js");
|
|
388445
388169
|
pathExists2(dataPath).then((exists) => {
|
|
388446
388170
|
logForDebugging3(`Checking for ${dataPath}: ${exists ? "found" : "not found"}`);
|
|
388447
388171
|
setHasGenerated(exists);
|
|
@@ -388615,7 +388339,7 @@ var exports_thinkback_play = {};
|
|
|
388615
388339
|
__export(exports_thinkback_play, {
|
|
388616
388340
|
call: () => call35
|
|
388617
388341
|
});
|
|
388618
|
-
import { join as
|
|
388342
|
+
import { join as join143 } from "path";
|
|
388619
388343
|
function getPluginId2() {
|
|
388620
388344
|
return `thinkback@${OFFICIAL_MARKETPLACE_NAME}`;
|
|
388621
388345
|
}
|
|
@@ -388636,7 +388360,7 @@ async function call35() {
|
|
|
388636
388360
|
value: "Thinkback plugin installation path not found."
|
|
388637
388361
|
};
|
|
388638
388362
|
}
|
|
388639
|
-
const skillDir =
|
|
388363
|
+
const skillDir = join143(firstInstall.installPath, "skills", SKILL_NAME2);
|
|
388640
388364
|
const result = await playAnimation(skillDir);
|
|
388641
388365
|
return { type: "text", value: result.message };
|
|
388642
388366
|
}
|
|
@@ -393153,7 +392877,7 @@ __export(exports_branch, {
|
|
|
393153
392877
|
getUniqueForkName: () => getUniqueForkName
|
|
393154
392878
|
});
|
|
393155
392879
|
import { randomUUID as randomUUID39 } from "crypto";
|
|
393156
|
-
import { mkdir as mkdir45, readFile as readFile50, writeFile as
|
|
392880
|
+
import { mkdir as mkdir45, readFile as readFile50, writeFile as writeFile39 } from "fs/promises";
|
|
393157
392881
|
function deriveFirstPrompt(firstUserMessage) {
|
|
393158
392882
|
const content = firstUserMessage?.message?.content;
|
|
393159
392883
|
if (!content)
|
|
@@ -393217,7 +392941,7 @@ async function createFork(customTitle, target) {
|
|
|
393217
392941
|
};
|
|
393218
392942
|
lines.push(jsonStringify5(forkedReplacementEntry));
|
|
393219
392943
|
}
|
|
393220
|
-
await
|
|
392944
|
+
await writeFile39(forkSessionPath, lines.join(`
|
|
393221
392945
|
`) + `
|
|
393222
392946
|
`, {
|
|
393223
392947
|
encoding: "utf8",
|
|
@@ -393495,7 +393219,7 @@ var init_types16 = __esm(() => {
|
|
|
393495
393219
|
|
|
393496
393220
|
// src/tui/components/agents/agentFileUtils.ts
|
|
393497
393221
|
import { mkdir as mkdir46, open as open15, unlink as unlink18 } from "fs/promises";
|
|
393498
|
-
import { join as
|
|
393222
|
+
import { join as join144 } from "path";
|
|
393499
393223
|
function formatAgentAsMarkdown(agentType, whenToUse, tools, systemPrompt, color, model, memory, effort) {
|
|
393500
393224
|
const escapedWhenToUse = whenToUse.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\\\n");
|
|
393501
393225
|
const isAllTools = tools === undefined || tools.length === 1 && tools[0] === "*";
|
|
@@ -393522,26 +393246,26 @@ function getAgentDirectoryPath(location) {
|
|
|
393522
393246
|
case "flagSettings":
|
|
393523
393247
|
throw new Error(`Cannot get directory path for ${location} agents`);
|
|
393524
393248
|
case "userSettings":
|
|
393525
|
-
return
|
|
393249
|
+
return join144(getAtlasConfigHomeDir3(), AGENT_PATHS.AGENTS_DIR);
|
|
393526
393250
|
case "projectSettings":
|
|
393527
|
-
return
|
|
393251
|
+
return join144(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
393528
393252
|
case "policySettings":
|
|
393529
|
-
return
|
|
393253
|
+
return join144(getManagedFilePath(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
393530
393254
|
case "localSettings":
|
|
393531
|
-
return
|
|
393255
|
+
return join144(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
393532
393256
|
}
|
|
393533
393257
|
}
|
|
393534
393258
|
function getRelativeAgentDirectoryPath(location) {
|
|
393535
393259
|
switch (location) {
|
|
393536
393260
|
case "projectSettings":
|
|
393537
|
-
return
|
|
393261
|
+
return join144(".", AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
393538
393262
|
default:
|
|
393539
393263
|
return getAgentDirectoryPath(location);
|
|
393540
393264
|
}
|
|
393541
393265
|
}
|
|
393542
393266
|
function getNewAgentFilePath(agent) {
|
|
393543
393267
|
const dirPath = getAgentDirectoryPath(agent.source);
|
|
393544
|
-
return
|
|
393268
|
+
return join144(dirPath, `${agent.agentType}.md`);
|
|
393545
393269
|
}
|
|
393546
393270
|
function getActualAgentFilePath(agent) {
|
|
393547
393271
|
if (agent.source === "built-in") {
|
|
@@ -393552,14 +393276,14 @@ function getActualAgentFilePath(agent) {
|
|
|
393552
393276
|
}
|
|
393553
393277
|
const dirPath = getAgentDirectoryPath(agent.source);
|
|
393554
393278
|
const filename = agent.filename || agent.agentType;
|
|
393555
|
-
return
|
|
393279
|
+
return join144(dirPath, `${filename}.md`);
|
|
393556
393280
|
}
|
|
393557
393281
|
function getNewRelativeAgentFilePath(agent) {
|
|
393558
393282
|
if (agent.source === "built-in") {
|
|
393559
393283
|
return "Built-in";
|
|
393560
393284
|
}
|
|
393561
393285
|
const dirPath = getRelativeAgentDirectoryPath(agent.source);
|
|
393562
|
-
return
|
|
393286
|
+
return join144(dirPath, `${agent.agentType}.md`);
|
|
393563
393287
|
}
|
|
393564
393288
|
function getActualRelativeAgentFilePath(agent) {
|
|
393565
393289
|
if (isBuiltInAgent2(agent)) {
|
|
@@ -393573,7 +393297,7 @@ function getActualRelativeAgentFilePath(agent) {
|
|
|
393573
393297
|
}
|
|
393574
393298
|
const dirPath = getRelativeAgentDirectoryPath(agent.source);
|
|
393575
393299
|
const filename = agent.filename || agent.agentType;
|
|
393576
|
-
return
|
|
393300
|
+
return join144(dirPath, `${filename}.md`);
|
|
393577
393301
|
}
|
|
393578
393302
|
async function ensureAgentDirectoryExists(source) {
|
|
393579
393303
|
const dirPath = getAgentDirectoryPath(source);
|
|
@@ -399840,10 +399564,10 @@ var init_MarketplaceAdopt = __esm(() => {
|
|
|
399840
399564
|
|
|
399841
399565
|
// src/tui/utils/plugins/installCounts.ts
|
|
399842
399566
|
import { randomBytes as randomBytes18 } from "crypto";
|
|
399843
|
-
import { readFile as readFile51, rename as rename9, unlink as unlink19, writeFile as
|
|
399844
|
-
import { join as
|
|
399567
|
+
import { readFile as readFile51, rename as rename9, unlink as unlink19, writeFile as writeFile40 } from "fs/promises";
|
|
399568
|
+
import { join as join145 } from "path";
|
|
399845
399569
|
function getInstallCountsCachePath() {
|
|
399846
|
-
return
|
|
399570
|
+
return join145(getPluginsDirectory(), INSTALL_COUNTS_CACHE_FILENAME);
|
|
399847
399571
|
}
|
|
399848
399572
|
async function loadInstallCountsCache() {
|
|
399849
399573
|
const cachePath = getInstallCountsCachePath();
|
|
@@ -399898,7 +399622,7 @@ async function saveInstallCountsCache(cache) {
|
|
|
399898
399622
|
const pluginsDir = getPluginsDirectory();
|
|
399899
399623
|
await getFsImplementation2().mkdir(pluginsDir);
|
|
399900
399624
|
const content = jsonStringify5(cache, null, 2);
|
|
399901
|
-
await
|
|
399625
|
+
await writeFile40(tempPath, content, {
|
|
399902
399626
|
encoding: "utf-8",
|
|
399903
399627
|
mode: 384
|
|
399904
399628
|
});
|
|
@@ -402631,7 +402355,7 @@ var init_DiscoverPlugins = __esm(() => {
|
|
|
402631
402355
|
|
|
402632
402356
|
// src/tui/utils/plugins/skillSearch.ts
|
|
402633
402357
|
import { readdir as readdir27, readFile as readFile52, stat as stat46 } from "fs/promises";
|
|
402634
|
-
import { join as
|
|
402358
|
+
import { join as join146 } from "path";
|
|
402635
402359
|
async function searchSkillsAcrossMarketplaces(query) {
|
|
402636
402360
|
const config = await loadKnownMarketplacesConfig();
|
|
402637
402361
|
const q = query?.trim().toLowerCase();
|
|
@@ -402643,20 +402367,20 @@ async function searchSkillsAcrossMarketplaces(query) {
|
|
|
402643
402367
|
let marketplaceDir;
|
|
402644
402368
|
try {
|
|
402645
402369
|
const locStat = await stat46(marketplaceConfig.installLocation);
|
|
402646
|
-
marketplaceDir = locStat.isDirectory() ? marketplaceConfig.installLocation :
|
|
402370
|
+
marketplaceDir = locStat.isDirectory() ? marketplaceConfig.installLocation : join146(marketplaceConfig.installLocation, "..");
|
|
402647
402371
|
} catch {
|
|
402648
402372
|
continue;
|
|
402649
402373
|
}
|
|
402650
402374
|
for (const entry of data.plugins) {
|
|
402651
402375
|
if (typeof entry.source !== "string")
|
|
402652
402376
|
continue;
|
|
402653
|
-
const pluginPath =
|
|
402654
|
-
const skillDirCandidates = [
|
|
402377
|
+
const pluginPath = join146(marketplaceDir, entry.source);
|
|
402378
|
+
const skillDirCandidates = [join146(pluginPath, "skills")];
|
|
402655
402379
|
if (typeof entry.skills === "string") {
|
|
402656
|
-
skillDirCandidates.push(
|
|
402380
|
+
skillDirCandidates.push(join146(pluginPath, entry.skills));
|
|
402657
402381
|
} else if (Array.isArray(entry.skills)) {
|
|
402658
402382
|
for (const extra of entry.skills) {
|
|
402659
|
-
skillDirCandidates.push(
|
|
402383
|
+
skillDirCandidates.push(join146(pluginPath, extra));
|
|
402660
402384
|
}
|
|
402661
402385
|
}
|
|
402662
402386
|
const seen = new Set;
|
|
@@ -402670,7 +402394,7 @@ async function searchSkillsAcrossMarketplaces(query) {
|
|
|
402670
402394
|
for (const d of dirEntries) {
|
|
402671
402395
|
if (!d.isDirectory())
|
|
402672
402396
|
continue;
|
|
402673
|
-
const skillFile =
|
|
402397
|
+
const skillFile = join146(skillDir, d.name, "SKILL.md");
|
|
402674
402398
|
if (seen.has(skillFile))
|
|
402675
402399
|
continue;
|
|
402676
402400
|
seen.add(skillFile);
|
|
@@ -404170,10 +403894,10 @@ var init_ManageMarketplaces = __esm(() => {
|
|
|
404170
403894
|
|
|
404171
403895
|
// src/tui/utils/plugins/pluginFlagging.ts
|
|
404172
403896
|
import { randomBytes as randomBytes19 } from "crypto";
|
|
404173
|
-
import { readFile as readFile53, rename as rename10, unlink as unlink20, writeFile as
|
|
404174
|
-
import { join as
|
|
403897
|
+
import { readFile as readFile53, rename as rename10, unlink as unlink20, writeFile as writeFile41 } from "fs/promises";
|
|
403898
|
+
import { join as join147 } from "path";
|
|
404175
403899
|
function getFlaggedPluginsPath() {
|
|
404176
|
-
return
|
|
403900
|
+
return join147(getPluginsDirectory(), FLAGGED_PLUGINS_FILENAME);
|
|
404177
403901
|
}
|
|
404178
403902
|
function parsePluginsData(content) {
|
|
404179
403903
|
const parsed = jsonParse2(content);
|
|
@@ -404211,7 +403935,7 @@ async function writeToDisk(plugins) {
|
|
|
404211
403935
|
try {
|
|
404212
403936
|
await getFsImplementation2().mkdir(getPluginsDirectory());
|
|
404213
403937
|
const content = jsonStringify5({ plugins }, null, 2);
|
|
404214
|
-
await
|
|
403938
|
+
await writeFile41(tempPath, content, {
|
|
404215
403939
|
encoding: "utf-8",
|
|
404216
403940
|
mode: 384
|
|
404217
403941
|
});
|
|
@@ -409691,8 +409415,8 @@ var init_rewind = __esm(() => {
|
|
|
409691
409415
|
|
|
409692
409416
|
// src/tui/utils/heapDumpService.ts
|
|
409693
409417
|
import { createWriteStream as createWriteStream3, writeFileSync as writeFileSync8 } from "fs";
|
|
409694
|
-
import { readdir as readdir30, readFile as readFile56, writeFile as
|
|
409695
|
-
import { join as
|
|
409418
|
+
import { readdir as readdir30, readFile as readFile56, writeFile as writeFile42 } from "fs/promises";
|
|
409419
|
+
import { join as join150 } from "path";
|
|
409696
409420
|
import { pipeline as pipeline2 } from "stream/promises";
|
|
409697
409421
|
import {
|
|
409698
409422
|
getHeapSnapshot,
|
|
@@ -409800,9 +409524,9 @@ async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
|
409800
409524
|
const suffix = dumpNumber > 0 ? `-dump${dumpNumber}` : "";
|
|
409801
409525
|
const heapFilename = `${sessionId}${suffix}.heapsnapshot`;
|
|
409802
409526
|
const diagFilename = `${sessionId}${suffix}-diagnostics.json`;
|
|
409803
|
-
const heapPath =
|
|
409804
|
-
const diagPath =
|
|
409805
|
-
await
|
|
409527
|
+
const heapPath = join150(dumpDir, heapFilename);
|
|
409528
|
+
const diagPath = join150(dumpDir, diagFilename);
|
|
409529
|
+
await writeFile42(diagPath, jsonStringify5(diagnostics, null, 2), {
|
|
409806
409530
|
mode: 384
|
|
409807
409531
|
});
|
|
409808
409532
|
logForDebugging3(`[HeapDump] Diagnostics written to ${diagPath}`);
|
|
@@ -411138,7 +410862,7 @@ var init_stickers2 = __esm(() => {
|
|
|
411138
410862
|
// src/tui/skills/bundledSkills.ts
|
|
411139
410863
|
import { constants as fsConstants8 } from "fs";
|
|
411140
410864
|
import { mkdir as mkdir47, open as open16 } from "fs/promises";
|
|
411141
|
-
import { dirname as dirname74, isAbsolute as isAbsolute32, join as
|
|
410865
|
+
import { dirname as dirname74, isAbsolute as isAbsolute32, join as join151, normalize as normalize14, sep as pathSep3 } from "path";
|
|
411142
410866
|
function registerBundledSkill2(definition) {
|
|
411143
410867
|
const { files } = definition;
|
|
411144
410868
|
let skillRoot;
|
|
@@ -411186,7 +410910,7 @@ function getBundledSkills2() {
|
|
|
411186
410910
|
return [...bundledSkills2];
|
|
411187
410911
|
}
|
|
411188
410912
|
function getBundledSkillExtractDir2(skillName) {
|
|
411189
|
-
return
|
|
410913
|
+
return join151(getBundledSkillsRoot2(), skillName);
|
|
411190
410914
|
}
|
|
411191
410915
|
async function extractBundledSkillFiles(skillName, files) {
|
|
411192
410916
|
const dir = getBundledSkillExtractDir2(skillName);
|
|
@@ -411228,7 +410952,7 @@ function resolveSkillFilePath(baseDir, relPath) {
|
|
|
411228
410952
|
if (isAbsolute32(normalized) || normalized.split(pathSep3).includes("..") || normalized.split("/").includes("..")) {
|
|
411229
410953
|
throw new Error(`bundled skill file path escapes skill dir: ${relPath}`);
|
|
411230
410954
|
}
|
|
411231
|
-
return
|
|
410955
|
+
return join151(baseDir, normalized);
|
|
411232
410956
|
}
|
|
411233
410957
|
function prependBaseDir(blocks, baseDir) {
|
|
411234
410958
|
const prefix = `Base directory for this skill: ${baseDir}
|
|
@@ -411523,10 +411247,10 @@ var init_ExitFlow = __esm(() => {
|
|
|
411523
411247
|
});
|
|
411524
411248
|
|
|
411525
411249
|
// src/tui/utils/concurrentSessions.ts
|
|
411526
|
-
import { chmod as
|
|
411527
|
-
import { join as
|
|
411250
|
+
import { chmod as chmod8, mkdir as mkdir48, readdir as readdir31, readFile as readFile57, unlink as unlink21, writeFile as writeFile43 } from "fs/promises";
|
|
411251
|
+
import { join as join152 } from "path";
|
|
411528
411252
|
function getSessionsDir() {
|
|
411529
|
-
return
|
|
411253
|
+
return join152(getAtlasConfigHomeDir3(), "sessions");
|
|
411530
411254
|
}
|
|
411531
411255
|
function envSessionKind() {
|
|
411532
411256
|
if (feature("BG_SESSIONS")) {
|
|
@@ -411544,7 +411268,7 @@ async function registerSession2() {
|
|
|
411544
411268
|
return false;
|
|
411545
411269
|
const kind = envSessionKind() ?? "interactive";
|
|
411546
411270
|
const dir = getSessionsDir();
|
|
411547
|
-
const pidFile =
|
|
411271
|
+
const pidFile = join152(dir, `${process.pid}.json`);
|
|
411548
411272
|
registerCleanup3(async () => {
|
|
411549
411273
|
try {
|
|
411550
411274
|
await unlink21(pidFile);
|
|
@@ -411552,8 +411276,8 @@ async function registerSession2() {
|
|
|
411552
411276
|
});
|
|
411553
411277
|
try {
|
|
411554
411278
|
await mkdir48(dir, { recursive: true, mode: 448 });
|
|
411555
|
-
await
|
|
411556
|
-
await
|
|
411279
|
+
await chmod8(dir, 448);
|
|
411280
|
+
await writeFile43(pidFile, jsonStringify5({
|
|
411557
411281
|
pid: process.pid,
|
|
411558
411282
|
sessionId: getSessionId(),
|
|
411559
411283
|
cwd: getOriginalCwd(),
|
|
@@ -411577,10 +411301,10 @@ async function registerSession2() {
|
|
|
411577
411301
|
}
|
|
411578
411302
|
}
|
|
411579
411303
|
async function updatePidFile(patch) {
|
|
411580
|
-
const pidFile =
|
|
411304
|
+
const pidFile = join152(getSessionsDir(), `${process.pid}.json`);
|
|
411581
411305
|
try {
|
|
411582
411306
|
const data = jsonParse2(await readFile57(pidFile, "utf8"));
|
|
411583
|
-
await
|
|
411307
|
+
await writeFile43(pidFile, jsonStringify5({ ...data, ...patch }));
|
|
411584
411308
|
} catch (e) {
|
|
411585
411309
|
logForDebugging3(`[concurrentSessions] updatePidFile failed: ${errorMessage2(e)}`);
|
|
411586
411310
|
}
|
|
@@ -411618,7 +411342,7 @@ async function countConcurrentSessions2() {
|
|
|
411618
411342
|
if (isProcessRunning2(pid)) {
|
|
411619
411343
|
count++;
|
|
411620
411344
|
} else if (getPlatform3() !== "wsl") {
|
|
411621
|
-
unlink21(
|
|
411345
|
+
unlink21(join152(dir, file)).catch(() => {});
|
|
411622
411346
|
}
|
|
411623
411347
|
}
|
|
411624
411348
|
return count;
|
|
@@ -411693,7 +411417,7 @@ var init_exit2 = __esm(() => {
|
|
|
411693
411417
|
});
|
|
411694
411418
|
|
|
411695
411419
|
// src/tui/components/ExportDialog.tsx
|
|
411696
|
-
import { join as
|
|
411420
|
+
import { join as join153 } from "path";
|
|
411697
411421
|
function ExportDialog({
|
|
411698
411422
|
content,
|
|
411699
411423
|
defaultFilename,
|
|
@@ -411726,7 +411450,7 @@ function ExportDialog({
|
|
|
411726
411450
|
};
|
|
411727
411451
|
const handleFilenameSubmit = () => {
|
|
411728
411452
|
const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt";
|
|
411729
|
-
const filepath =
|
|
411453
|
+
const filepath = join153(getCwd(), finalFilename);
|
|
411730
411454
|
try {
|
|
411731
411455
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
411732
411456
|
encoding: "utf-8",
|
|
@@ -411949,7 +411673,7 @@ __export(exports_export, {
|
|
|
411949
411673
|
extractFirstPrompt: () => extractFirstPrompt2,
|
|
411950
411674
|
sanitizeFilename: () => sanitizeFilename
|
|
411951
411675
|
});
|
|
411952
|
-
import { join as
|
|
411676
|
+
import { join as join154 } from "path";
|
|
411953
411677
|
function formatTimestamp(date) {
|
|
411954
411678
|
const year = date.getFullYear();
|
|
411955
411679
|
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
@@ -411993,7 +411717,7 @@ async function call50(onDone, context, args) {
|
|
|
411993
411717
|
const filename = args.trim();
|
|
411994
411718
|
if (filename) {
|
|
411995
411719
|
const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt";
|
|
411996
|
-
const filepath =
|
|
411720
|
+
const filepath = join154(getCwd(), finalFilename);
|
|
411997
411721
|
try {
|
|
411998
411722
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
411999
411723
|
encoding: "utf-8",
|
|
@@ -412879,7 +412603,7 @@ var require_asciichart = __commonJS(function(exports) {
|
|
|
412879
412603
|
// src/tui/utils/statsCache.ts
|
|
412880
412604
|
import { randomBytes as randomBytes20 } from "crypto";
|
|
412881
412605
|
import { open as open17 } from "fs/promises";
|
|
412882
|
-
import { join as
|
|
412606
|
+
import { join as join155 } from "path";
|
|
412883
412607
|
async function withStatsCacheLock(fn) {
|
|
412884
412608
|
while (statsCacheLockPromise) {
|
|
412885
412609
|
await statsCacheLockPromise;
|
|
@@ -412896,7 +412620,7 @@ async function withStatsCacheLock(fn) {
|
|
|
412896
412620
|
}
|
|
412897
412621
|
}
|
|
412898
412622
|
function getStatsCachePath() {
|
|
412899
|
-
return
|
|
412623
|
+
return join155(getAtlasConfigHomeDir3(), STATS_CACHE_FILENAME);
|
|
412900
412624
|
}
|
|
412901
412625
|
function getEmptyCache() {
|
|
412902
412626
|
return {
|
|
@@ -413577,16 +413301,16 @@ var init_ansiToPng = __esm(() => {
|
|
|
413577
413301
|
});
|
|
413578
413302
|
|
|
413579
413303
|
// src/tui/utils/screenshotClipboard.ts
|
|
413580
|
-
import { mkdir as mkdir49, unlink as unlink22, writeFile as
|
|
413304
|
+
import { mkdir as mkdir49, unlink as unlink22, writeFile as writeFile44 } from "fs/promises";
|
|
413581
413305
|
import { tmpdir as tmpdir10 } from "os";
|
|
413582
|
-
import { join as
|
|
413306
|
+
import { join as join156 } from "path";
|
|
413583
413307
|
async function copyAnsiToClipboard(ansiText, options) {
|
|
413584
413308
|
try {
|
|
413585
|
-
const tempDir =
|
|
413309
|
+
const tempDir = join156(tmpdir10(), "atlas-screenshots");
|
|
413586
413310
|
await mkdir49(tempDir, { recursive: true });
|
|
413587
|
-
const pngPath =
|
|
413311
|
+
const pngPath = join156(tempDir, `screenshot-${Date.now()}.png`);
|
|
413588
413312
|
const pngBuffer = ansiToPng(ansiText, options);
|
|
413589
|
-
await
|
|
413313
|
+
await writeFile44(pngPath, pngBuffer);
|
|
413590
413314
|
const result = await copyPngToClipboard(pngPath);
|
|
413591
413315
|
try {
|
|
413592
413316
|
await unlink22(pngPath);
|
|
@@ -413655,7 +413379,7 @@ var init_screenshotClipboard = __esm(() => {
|
|
|
413655
413379
|
|
|
413656
413380
|
// src/tui/utils/stats.ts
|
|
413657
413381
|
import { open as open18 } from "fs/promises";
|
|
413658
|
-
import { basename as basename46, dirname as dirname75, join as
|
|
413382
|
+
import { basename as basename46, dirname as dirname75, join as join157, sep as sep33 } from "path";
|
|
413659
413383
|
async function processSessionFiles(sessionFiles, options = {}) {
|
|
413660
413384
|
const { fromDate, toDate } = options;
|
|
413661
413385
|
const fs = getFsImplementation2();
|
|
@@ -413841,17 +413565,17 @@ async function getAllSessionFiles() {
|
|
|
413841
413565
|
return [];
|
|
413842
413566
|
throw e;
|
|
413843
413567
|
}
|
|
413844
|
-
const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
413568
|
+
const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) => join157(projectsDir, dirent.name));
|
|
413845
413569
|
const projectResults = await Promise.all(projectDirs.map(async (projectDir) => {
|
|
413846
413570
|
try {
|
|
413847
413571
|
const entries = await fs.readdir(projectDir);
|
|
413848
|
-
const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) =>
|
|
413572
|
+
const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) => join157(projectDir, dirent.name));
|
|
413849
413573
|
const sessionDirs = entries.filter((dirent) => dirent.isDirectory());
|
|
413850
413574
|
const subagentResults = await Promise.all(sessionDirs.map(async (sessionDir) => {
|
|
413851
|
-
const subagentsDir =
|
|
413575
|
+
const subagentsDir = join157(projectDir, sessionDir.name, "subagents");
|
|
413852
413576
|
try {
|
|
413853
413577
|
const subagentEntries = await fs.readdir(subagentsDir);
|
|
413854
|
-
return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) =>
|
|
413578
|
+
return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) => join157(subagentsDir, dirent.name));
|
|
413855
413579
|
} catch {
|
|
413856
413580
|
return [];
|
|
413857
413581
|
}
|
|
@@ -416704,9 +416428,9 @@ import {
|
|
|
416704
416428
|
readdir as readdir32,
|
|
416705
416429
|
readFile as readFile58,
|
|
416706
416430
|
unlink as unlink23,
|
|
416707
|
-
writeFile as
|
|
416431
|
+
writeFile as writeFile45
|
|
416708
416432
|
} from "fs/promises";
|
|
416709
|
-
import { extname as extname16, join as
|
|
416433
|
+
import { extname as extname16, join as join158 } from "path";
|
|
416710
416434
|
function getAnalysisModel() {
|
|
416711
416435
|
return getDefaultPremiumModel();
|
|
416712
416436
|
}
|
|
@@ -416714,13 +416438,13 @@ function getInsightsModel() {
|
|
|
416714
416438
|
return getDefaultPremiumModel();
|
|
416715
416439
|
}
|
|
416716
416440
|
function getDataDir() {
|
|
416717
|
-
return
|
|
416441
|
+
return join158(getAtlasConfigHomeDir3(), "usage-data");
|
|
416718
416442
|
}
|
|
416719
416443
|
function getFacetsDir() {
|
|
416720
|
-
return
|
|
416444
|
+
return join158(getDataDir(), "facets");
|
|
416721
416445
|
}
|
|
416722
416446
|
function getSessionMetaDir() {
|
|
416723
|
-
return
|
|
416447
|
+
return join158(getDataDir(), "session-meta");
|
|
416724
416448
|
}
|
|
416725
416449
|
function getLanguageFromPath(filePath) {
|
|
416726
416450
|
const ext = extname16(filePath).toLowerCase();
|
|
@@ -417061,7 +416785,7 @@ async function formatTranscriptWithSummarization(log) {
|
|
|
417061
416785
|
`);
|
|
417062
416786
|
}
|
|
417063
416787
|
async function loadCachedFacets(sessionId) {
|
|
417064
|
-
const facetPath =
|
|
416788
|
+
const facetPath = join158(getFacetsDir(), `${sessionId}.json`);
|
|
417065
416789
|
try {
|
|
417066
416790
|
const content = await readFile58(facetPath, { encoding: "utf-8" });
|
|
417067
416791
|
const parsed = jsonParse2(content);
|
|
@@ -417080,14 +416804,14 @@ async function saveFacets(facets) {
|
|
|
417080
416804
|
try {
|
|
417081
416805
|
await mkdir50(getFacetsDir(), { recursive: true });
|
|
417082
416806
|
} catch {}
|
|
417083
|
-
const facetPath =
|
|
417084
|
-
await
|
|
416807
|
+
const facetPath = join158(getFacetsDir(), `${facets.session_id}.json`);
|
|
416808
|
+
await writeFile45(facetPath, jsonStringify5(facets, null, 2), {
|
|
417085
416809
|
encoding: "utf-8",
|
|
417086
416810
|
mode: 384
|
|
417087
416811
|
});
|
|
417088
416812
|
}
|
|
417089
416813
|
async function loadCachedSessionMeta(sessionId) {
|
|
417090
|
-
const metaPath =
|
|
416814
|
+
const metaPath = join158(getSessionMetaDir(), `${sessionId}.json`);
|
|
417091
416815
|
try {
|
|
417092
416816
|
const content = await readFile58(metaPath, { encoding: "utf-8" });
|
|
417093
416817
|
return jsonParse2(content);
|
|
@@ -417099,8 +416823,8 @@ async function saveSessionMeta(meta) {
|
|
|
417099
416823
|
try {
|
|
417100
416824
|
await mkdir50(getSessionMetaDir(), { recursive: true });
|
|
417101
416825
|
} catch {}
|
|
417102
|
-
const metaPath =
|
|
417103
|
-
await
|
|
416826
|
+
const metaPath = join158(getSessionMetaDir(), `${meta.session_id}.json`);
|
|
416827
|
+
await writeFile45(metaPath, jsonStringify5(meta, null, 2), {
|
|
417104
416828
|
encoding: "utf-8",
|
|
417105
416829
|
mode: 384
|
|
417106
416830
|
});
|
|
@@ -418179,7 +417903,7 @@ async function scanAllSessions() {
|
|
|
418179
417903
|
} catch {
|
|
418180
417904
|
return [];
|
|
418181
417905
|
}
|
|
418182
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
417906
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join158(projectsDir, dirent.name));
|
|
418183
417907
|
const allSessions = [];
|
|
418184
417908
|
for (let i = 0;i < projectDirs.length; i++) {
|
|
418185
417909
|
const sessionFiles = await getSessionFilesWithMtime(projectDirs[i]);
|
|
@@ -418335,8 +418059,8 @@ async function generateUsageReport(options) {
|
|
|
418335
418059
|
try {
|
|
418336
418060
|
await mkdir50(getDataDir(), { recursive: true });
|
|
418337
418061
|
} catch {}
|
|
418338
|
-
const htmlPath =
|
|
418339
|
-
await
|
|
418062
|
+
const htmlPath = join158(getDataDir(), "report.html");
|
|
418063
|
+
await writeFile45(htmlPath, htmlReport, {
|
|
418340
418064
|
encoding: "utf-8",
|
|
418341
418065
|
mode: 384
|
|
418342
418066
|
});
|
|
@@ -419139,9 +418863,9 @@ import {
|
|
|
419139
418863
|
readFile as readFile59,
|
|
419140
418864
|
stat as stat49,
|
|
419141
418865
|
unlink as unlink24,
|
|
419142
|
-
writeFile as
|
|
418866
|
+
writeFile as writeFile46
|
|
419143
418867
|
} from "fs/promises";
|
|
419144
|
-
import { basename as basename48, dirname as dirname76, join as
|
|
418868
|
+
import { basename as basename48, dirname as dirname76, join as join159 } from "path";
|
|
419145
418869
|
function isTranscriptMessage2(entry) {
|
|
419146
418870
|
return entry.type === "user" || entry.type === "assistant" || entry.type === "attachment" || entry.type === "system";
|
|
419147
418871
|
}
|
|
@@ -419155,18 +418879,18 @@ function isEphemeralToolProgress2(dataType) {
|
|
|
419155
418879
|
return typeof dataType === "string" && EPHEMERAL_PROGRESS_TYPES2.has(dataType);
|
|
419156
418880
|
}
|
|
419157
418881
|
function getProjectsDir3() {
|
|
419158
|
-
return
|
|
418882
|
+
return join159(getAtlasConfigHomeDir3(), "projects");
|
|
419159
418883
|
}
|
|
419160
418884
|
function getTranscriptPath2() {
|
|
419161
418885
|
const projectDir = getSessionProjectDir() ?? getProjectDir3(getOriginalCwd());
|
|
419162
|
-
return
|
|
418886
|
+
return join159(projectDir, `${getSessionId()}.jsonl`);
|
|
419163
418887
|
}
|
|
419164
418888
|
function getTranscriptPathForSession3(sessionId) {
|
|
419165
418889
|
if (sessionId === getSessionId()) {
|
|
419166
418890
|
return getTranscriptPath2();
|
|
419167
418891
|
}
|
|
419168
418892
|
const projectDir = getProjectDir3(getOriginalCwd());
|
|
419169
|
-
return
|
|
418893
|
+
return join159(projectDir, `${sessionId}.jsonl`);
|
|
419170
418894
|
}
|
|
419171
418895
|
function setAgentTranscriptSubdir2(agentId, subdir) {
|
|
419172
418896
|
agentTranscriptSubdirs2.set(agentId, subdir);
|
|
@@ -419178,8 +418902,8 @@ function getAgentTranscriptPath2(agentId) {
|
|
|
419178
418902
|
const projectDir = getSessionProjectDir() ?? getProjectDir3(getOriginalCwd());
|
|
419179
418903
|
const sessionId = getSessionId();
|
|
419180
418904
|
const subdir = agentTranscriptSubdirs2.get(agentId);
|
|
419181
|
-
const base = subdir ?
|
|
419182
|
-
return
|
|
418905
|
+
const base = subdir ? join159(projectDir, sessionId, "subagents", subdir) : join159(projectDir, sessionId, "subagents");
|
|
418906
|
+
return join159(base, `agent-${agentId}.jsonl`);
|
|
419183
418907
|
}
|
|
419184
418908
|
function getAgentMetadataPath(agentId) {
|
|
419185
418909
|
return getAgentTranscriptPath2(agentId).replace(/\.jsonl$/, ".meta.json");
|
|
@@ -419187,7 +418911,7 @@ function getAgentMetadataPath(agentId) {
|
|
|
419187
418911
|
async function writeAgentMetadata(agentId, metadata) {
|
|
419188
418912
|
const path = getAgentMetadataPath(agentId);
|
|
419189
418913
|
await mkdir51(dirname76(path), { recursive: true });
|
|
419190
|
-
await
|
|
418914
|
+
await writeFile46(path, JSON.stringify(metadata));
|
|
419191
418915
|
}
|
|
419192
418916
|
async function readAgentMetadata(agentId) {
|
|
419193
418917
|
const path = getAgentMetadataPath(agentId);
|
|
@@ -419202,7 +418926,7 @@ async function readAgentMetadata(agentId) {
|
|
|
419202
418926
|
}
|
|
419203
418927
|
function sessionIdExists(sessionId) {
|
|
419204
418928
|
const projectDir = getProjectDir3(getOriginalCwd());
|
|
419205
|
-
const sessionFile =
|
|
418929
|
+
const sessionFile = join159(projectDir, `${sessionId}.jsonl`);
|
|
419206
418930
|
const fs = getFsImplementation2();
|
|
419207
418931
|
try {
|
|
419208
418932
|
fs.statSync(sessionFile);
|
|
@@ -419529,7 +419253,7 @@ class Project2 {
|
|
|
419529
419253
|
return true;
|
|
419530
419254
|
}
|
|
419531
419255
|
});
|
|
419532
|
-
await
|
|
419256
|
+
await writeFile46(this.sessionFile, lines.join(`
|
|
419533
419257
|
`), {
|
|
419534
419258
|
encoding: "utf8"
|
|
419535
419259
|
});
|
|
@@ -420934,7 +420658,7 @@ async function loadTranscriptFile2(filePath, opts) {
|
|
|
420934
420658
|
};
|
|
420935
420659
|
}
|
|
420936
420660
|
async function loadSessionFile2(sessionId) {
|
|
420937
|
-
const sessionFile =
|
|
420661
|
+
const sessionFile = join159(getSessionProjectDir() ?? getProjectDir3(getOriginalCwd()), `${sessionId}.jsonl`);
|
|
420938
420662
|
return loadTranscriptFile2(sessionFile);
|
|
420939
420663
|
}
|
|
420940
420664
|
function clearSessionMessagesCache2() {
|
|
@@ -420998,7 +420722,7 @@ async function loadAllProjectsMessageLogsFull(limit) {
|
|
|
420998
420722
|
} catch {
|
|
420999
420723
|
return [];
|
|
421000
420724
|
}
|
|
421001
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
420725
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join159(projectsDir, dirent.name));
|
|
421002
420726
|
const logsPerProject = await Promise.all(projectDirs.map((projectDir) => getLogsWithoutIndex(projectDir, limit)));
|
|
421003
420727
|
const allLogs = logsPerProject.flat();
|
|
421004
420728
|
const deduped = new Map;
|
|
@@ -421023,7 +420747,7 @@ async function loadAllProjectsMessageLogsProgressive(limit, initialEnrichCount =
|
|
|
421023
420747
|
} catch {
|
|
421024
420748
|
return { logs: [], allStatLogs: [], nextIndex: 0 };
|
|
421025
420749
|
}
|
|
421026
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
420750
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join159(projectsDir, dirent.name));
|
|
421027
420751
|
const rawLogs = [];
|
|
421028
420752
|
for (const projectDir of projectDirs) {
|
|
421029
420753
|
rawLogs.push(...await getSessionFilesLite(projectDir, limit));
|
|
@@ -421099,7 +420823,7 @@ async function getStatOnlyLogsForWorktrees(worktreePaths, limit) {
|
|
|
421099
420823
|
for (const { path: wtPath, prefix } of indexed) {
|
|
421100
420824
|
if (dirName === prefix || dirName.startsWith(prefix + "-")) {
|
|
421101
420825
|
seenDirs.add(dirName);
|
|
421102
|
-
allLogs.push(...await getSessionFilesLite(
|
|
420826
|
+
allLogs.push(...await getSessionFilesLite(join159(projectsDir, dirent.name), undefined, wtPath));
|
|
421103
420827
|
break;
|
|
421104
420828
|
}
|
|
421105
420829
|
}
|
|
@@ -421159,7 +420883,7 @@ async function loadSubagentTranscripts(agentIds) {
|
|
|
421159
420883
|
return transcripts;
|
|
421160
420884
|
}
|
|
421161
420885
|
async function loadAllSubagentTranscriptsFromDisk() {
|
|
421162
|
-
const subagentsDir =
|
|
420886
|
+
const subagentsDir = join159(getSessionProjectDir() ?? getProjectDir3(getOriginalCwd()), getSessionId(), "subagents");
|
|
421163
420887
|
let entries;
|
|
421164
420888
|
try {
|
|
421165
420889
|
entries = await readdir33(subagentsDir, { withFileTypes: true });
|
|
@@ -421254,7 +420978,7 @@ async function getSessionFilesWithMtime(projectDir) {
|
|
|
421254
420978
|
const sessionId = validateUuid2(basename48(dirent.name, ".jsonl"));
|
|
421255
420979
|
if (!sessionId)
|
|
421256
420980
|
continue;
|
|
421257
|
-
candidates.push({ sessionId, filePath:
|
|
420981
|
+
candidates.push({ sessionId, filePath: join159(projectDir, dirent.name) });
|
|
421258
420982
|
}
|
|
421259
420983
|
await Promise.all(candidates.map(async ({ sessionId, filePath }) => {
|
|
421260
420984
|
try {
|
|
@@ -421676,7 +421400,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
421676
421400
|
MAX_TRANSCRIPT_READ_BYTES2 = 50 * 1024 * 1024;
|
|
421677
421401
|
agentTranscriptSubdirs2 = new Map;
|
|
421678
421402
|
getProjectDir3 = memoize_default((projectDir) => {
|
|
421679
|
-
return
|
|
421403
|
+
return join159(getProjectsDir3(), sanitizePath3(projectDir));
|
|
421680
421404
|
});
|
|
421681
421405
|
METADATA_TYPE_MARKERS2 = [
|
|
421682
421406
|
'"type":"summary"',
|
|
@@ -421694,8 +421418,8 @@ var init_sessionStorage = __esm(() => {
|
|
|
421694
421418
|
|
|
421695
421419
|
// src/tui/utils/plans.ts
|
|
421696
421420
|
import { randomUUID as randomUUID40 } from "crypto";
|
|
421697
|
-
import { copyFile as copyFile9, writeFile as
|
|
421698
|
-
import { join as
|
|
421421
|
+
import { copyFile as copyFile9, writeFile as writeFile47 } from "fs/promises";
|
|
421422
|
+
import { join as join160, resolve as resolve50, sep as sep34 } from "path";
|
|
421699
421423
|
function getPlanSlug2(sessionId) {
|
|
421700
421424
|
const id = sessionId ?? getSessionId();
|
|
421701
421425
|
const cache = getPlanSlugCache();
|
|
@@ -421704,7 +421428,7 @@ function getPlanSlug2(sessionId) {
|
|
|
421704
421428
|
const plansDir = getPlansDirectory2();
|
|
421705
421429
|
for (let i = 0;i < MAX_SLUG_RETRIES2; i++) {
|
|
421706
421430
|
slug = generateWordSlug2();
|
|
421707
|
-
const filePath =
|
|
421431
|
+
const filePath = join160(plansDir, `${slug}.md`);
|
|
421708
421432
|
if (!getFsImplementation2().existsSync(filePath)) {
|
|
421709
421433
|
break;
|
|
421710
421434
|
}
|
|
@@ -421722,9 +421446,9 @@ function clearAllPlanSlugs2() {
|
|
|
421722
421446
|
function getPlanFilePath2(agentId) {
|
|
421723
421447
|
const planSlug = getPlanSlug2(getSessionId());
|
|
421724
421448
|
if (!agentId) {
|
|
421725
|
-
return
|
|
421449
|
+
return join160(getPlansDirectory2(), `${planSlug}.md`);
|
|
421726
421450
|
}
|
|
421727
|
-
return
|
|
421451
|
+
return join160(getPlansDirectory2(), `${planSlug}-agent-${agentId}.md`);
|
|
421728
421452
|
}
|
|
421729
421453
|
function getPlan2(agentId) {
|
|
421730
421454
|
const filePath = getPlanFilePath2(agentId);
|
|
@@ -421747,7 +421471,7 @@ async function copyPlanForResume(log, targetSessionId) {
|
|
|
421747
421471
|
}
|
|
421748
421472
|
const sessionId = targetSessionId ?? getSessionId();
|
|
421749
421473
|
setPlanSlug2(sessionId, slug);
|
|
421750
|
-
const planPath =
|
|
421474
|
+
const planPath = join160(getPlansDirectory2(), `${slug}.md`);
|
|
421751
421475
|
try {
|
|
421752
421476
|
await getFsImplementation2().readFile(planPath, { encoding: "utf-8" });
|
|
421753
421477
|
return true;
|
|
@@ -421773,7 +421497,7 @@ async function copyPlanForResume(log, targetSessionId) {
|
|
|
421773
421497
|
}
|
|
421774
421498
|
if (recovered) {
|
|
421775
421499
|
try {
|
|
421776
|
-
await
|
|
421500
|
+
await writeFile47(planPath, recovered, { encoding: "utf-8" });
|
|
421777
421501
|
return true;
|
|
421778
421502
|
} catch (writeError) {
|
|
421779
421503
|
logError3(writeError);
|
|
@@ -421790,9 +421514,9 @@ async function copyPlanForFork(log, targetSessionId) {
|
|
|
421790
421514
|
return false;
|
|
421791
421515
|
}
|
|
421792
421516
|
const plansDir = getPlansDirectory2();
|
|
421793
|
-
const originalPlanPath =
|
|
421517
|
+
const originalPlanPath = join160(plansDir, `${originalSlug}.md`);
|
|
421794
421518
|
const newSlug = getPlanSlug2(targetSessionId);
|
|
421795
|
-
const newPlanPath =
|
|
421519
|
+
const newPlanPath = join160(plansDir, `${newSlug}.md`);
|
|
421796
421520
|
try {
|
|
421797
421521
|
await copyFile9(originalPlanPath, newPlanPath);
|
|
421798
421522
|
return true;
|
|
@@ -421908,12 +421632,12 @@ var init_plans = __esm(() => {
|
|
|
421908
421632
|
const resolved = resolve50(cwd, settingsDir);
|
|
421909
421633
|
if (!resolved.startsWith(cwd + sep34) && resolved !== cwd) {
|
|
421910
421634
|
logError3(new Error(`plansDirectory must be within project root: ${settingsDir}`));
|
|
421911
|
-
plansPath =
|
|
421635
|
+
plansPath = join160(getAtlasConfigHomeDir3(), "plans");
|
|
421912
421636
|
} else {
|
|
421913
421637
|
plansPath = resolved;
|
|
421914
421638
|
}
|
|
421915
421639
|
} else {
|
|
421916
|
-
plansPath =
|
|
421640
|
+
plansPath = join160(getAtlasConfigHomeDir3(), "plans");
|
|
421917
421641
|
}
|
|
421918
421642
|
try {
|
|
421919
421643
|
getFsImplementation2().mkdirSync(plansPath);
|
|
@@ -421927,7 +421651,7 @@ var init_plans = __esm(() => {
|
|
|
421927
421651
|
// src/tui/utils/permissions/filesystem.ts
|
|
421928
421652
|
import { randomBytes as randomBytes21 } from "crypto";
|
|
421929
421653
|
import { homedir as homedir38, tmpdir as tmpdir11 } from "os";
|
|
421930
|
-
import { join as
|
|
421654
|
+
import { join as join161, normalize as normalize15, posix as posix9, sep as sep35 } from "path";
|
|
421931
421655
|
function normalizeCaseForComparison2(path) {
|
|
421932
421656
|
return path.toLowerCase();
|
|
421933
421657
|
}
|
|
@@ -421937,11 +421661,11 @@ function getClaudeSkillScope(filePath) {
|
|
|
421937
421661
|
const configDir = getConfigDirName2();
|
|
421938
421662
|
const bases = [
|
|
421939
421663
|
{
|
|
421940
|
-
dir: expandPath2(
|
|
421664
|
+
dir: expandPath2(join161(getOriginalCwd(), configDir, "skills")),
|
|
421941
421665
|
prefix: `/${configDir}/skills/`
|
|
421942
421666
|
},
|
|
421943
421667
|
{
|
|
421944
|
-
dir: expandPath2(
|
|
421668
|
+
dir: expandPath2(join161(homedir38(), configDir, "skills")),
|
|
421945
421669
|
prefix: `~/${configDir}/skills/`
|
|
421946
421670
|
}
|
|
421947
421671
|
];
|
|
@@ -421996,21 +421720,21 @@ function isClaudeConfigFilePath2(filePath) {
|
|
|
421996
421720
|
if (isAtlasSettingsPath2(filePath)) {
|
|
421997
421721
|
return true;
|
|
421998
421722
|
}
|
|
421999
|
-
const commandsDir =
|
|
422000
|
-
const agentsDir =
|
|
422001
|
-
const skillsDir =
|
|
421723
|
+
const commandsDir = join161(getOriginalCwd(), getConfigDirName2(), "commands");
|
|
421724
|
+
const agentsDir = join161(getOriginalCwd(), getConfigDirName2(), "agents");
|
|
421725
|
+
const skillsDir = join161(getOriginalCwd(), getConfigDirName2(), "skills");
|
|
422002
421726
|
return pathInWorkingPath2(filePath, commandsDir) || pathInWorkingPath2(filePath, agentsDir) || pathInWorkingPath2(filePath, skillsDir);
|
|
422003
421727
|
}
|
|
422004
421728
|
function isSessionPlanFile(absolutePath) {
|
|
422005
|
-
const expectedPrefix =
|
|
421729
|
+
const expectedPrefix = join161(getPlansDirectory2(), getPlanSlug2());
|
|
422006
421730
|
const normalizedPath = normalize15(absolutePath);
|
|
422007
421731
|
return normalizedPath.startsWith(expectedPrefix) && normalizedPath.endsWith(".md");
|
|
422008
421732
|
}
|
|
422009
421733
|
function getSessionMemoryDir() {
|
|
422010
|
-
return
|
|
421734
|
+
return join161(getProjectDir3(getCwd()), getSessionId(), "session-memory") + sep35;
|
|
422011
421735
|
}
|
|
422012
421736
|
function getSessionMemoryPath() {
|
|
422013
|
-
return
|
|
421737
|
+
return join161(getSessionMemoryDir(), "summary.md");
|
|
422014
421738
|
}
|
|
422015
421739
|
function isSessionMemoryPath(absolutePath) {
|
|
422016
421740
|
const normalizedPath = normalize15(absolutePath);
|
|
@@ -422032,10 +421756,10 @@ function getAtlasTempDirName2() {
|
|
|
422032
421756
|
return `${getConfigDirName2()}-${uid}`;
|
|
422033
421757
|
}
|
|
422034
421758
|
function getProjectTempDir2() {
|
|
422035
|
-
return
|
|
421759
|
+
return join161(getAtlasTempDir2(), sanitizePath3(getOriginalCwd())) + sep35;
|
|
422036
421760
|
}
|
|
422037
421761
|
function getScratchpadDir() {
|
|
422038
|
-
return
|
|
421762
|
+
return join161(getProjectTempDir2(), getSessionId(), "scratchpad");
|
|
422039
421763
|
}
|
|
422040
421764
|
async function ensureScratchpadDir() {
|
|
422041
421765
|
if (!isScratchpadEnabled()) {
|
|
@@ -422595,7 +422319,7 @@ function checkEditableInternalPath2(absolutePath, input) {
|
|
|
422595
422319
|
if (feature("TEMPLATES")) {
|
|
422596
422320
|
const jobDir = process.env.ATLAS_JOB_DIR;
|
|
422597
422321
|
if (jobDir) {
|
|
422598
|
-
const jobsRoot =
|
|
422322
|
+
const jobsRoot = join161(getAtlasConfigHomeDir3(), "jobs");
|
|
422599
422323
|
const jobDirForms = getPathsForPermissionCheck2(jobDir).map(normalize15);
|
|
422600
422324
|
const jobsRootForms = getPathsForPermissionCheck2(jobsRoot).map(normalize15);
|
|
422601
422325
|
const isUnderJobsRoot = jobDirForms.every((jd) => jobsRootForms.some((jr) => jd.startsWith(jr + sep35)));
|
|
@@ -422638,7 +422362,7 @@ function checkEditableInternalPath2(absolutePath, input) {
|
|
|
422638
422362
|
}
|
|
422639
422363
|
};
|
|
422640
422364
|
}
|
|
422641
|
-
if (normalizeCaseForComparison2(normalizedPath) === normalizeCaseForComparison2(
|
|
422365
|
+
if (normalizeCaseForComparison2(normalizedPath) === normalizeCaseForComparison2(join161(getOriginalCwd(), getConfigDirName2(), "launch.json"))) {
|
|
422642
422366
|
return {
|
|
422643
422367
|
behavior: "allow",
|
|
422644
422368
|
updatedInput: input,
|
|
@@ -422735,7 +422459,7 @@ function checkReadableInternalPath2(absolutePath, input) {
|
|
|
422735
422459
|
}
|
|
422736
422460
|
};
|
|
422737
422461
|
}
|
|
422738
|
-
const tasksDir =
|
|
422462
|
+
const tasksDir = join161(getAtlasConfigHomeDir3(), "tasks") + sep35;
|
|
422739
422463
|
if (normalizedPath === tasksDir.slice(0, -1) || normalizedPath.startsWith(tasksDir)) {
|
|
422740
422464
|
return {
|
|
422741
422465
|
behavior: "allow",
|
|
@@ -422746,7 +422470,7 @@ function checkReadableInternalPath2(absolutePath, input) {
|
|
|
422746
422470
|
}
|
|
422747
422471
|
};
|
|
422748
422472
|
}
|
|
422749
|
-
const teamsReadDir =
|
|
422473
|
+
const teamsReadDir = join161(getAtlasConfigHomeDir3(), "teams") + sep35;
|
|
422750
422474
|
if (normalizedPath === teamsReadDir.slice(0, -1) || normalizedPath.startsWith(teamsReadDir)) {
|
|
422751
422475
|
return {
|
|
422752
422476
|
behavior: "allow",
|
|
@@ -422823,11 +422547,11 @@ var init_filesystem2 = __esm(() => {
|
|
|
422823
422547
|
try {
|
|
422824
422548
|
resolvedBaseTmpDir = fs.realpathSync(baseTmpDir);
|
|
422825
422549
|
} catch {}
|
|
422826
|
-
return
|
|
422550
|
+
return join161(resolvedBaseTmpDir, getAtlasTempDirName2()) + sep35;
|
|
422827
422551
|
});
|
|
422828
422552
|
getBundledSkillsRoot2 = memoize_default(function getBundledSkillsRoot() {
|
|
422829
422553
|
const nonce = randomBytes21(16).toString("hex");
|
|
422830
|
-
return
|
|
422554
|
+
return join161(getAtlasTempDir2(), "bundled-skills", MACRO.VERSION, nonce);
|
|
422831
422555
|
});
|
|
422832
422556
|
getResolvedWorkingDirPaths2 = memoize_default(getPathsForPermissionCheck2);
|
|
422833
422557
|
});
|
|
@@ -422841,10 +422565,10 @@ import {
|
|
|
422841
422565
|
symlink as symlink7,
|
|
422842
422566
|
unlink as unlink25
|
|
422843
422567
|
} from "fs/promises";
|
|
422844
|
-
import { join as
|
|
422568
|
+
import { join as join162 } from "path";
|
|
422845
422569
|
function getTaskOutputDir2() {
|
|
422846
422570
|
if (_taskOutputDir2 === undefined) {
|
|
422847
|
-
_taskOutputDir2 =
|
|
422571
|
+
_taskOutputDir2 = join162(getProjectTempDir2(), getSessionId(), "tasks");
|
|
422848
422572
|
}
|
|
422849
422573
|
return _taskOutputDir2;
|
|
422850
422574
|
}
|
|
@@ -422852,7 +422576,7 @@ async function ensureOutputDir2() {
|
|
|
422852
422576
|
await mkdir52(getTaskOutputDir2(), { recursive: true });
|
|
422853
422577
|
}
|
|
422854
422578
|
function getTaskOutputPath2(taskId) {
|
|
422855
|
-
return
|
|
422579
|
+
return join162(getTaskOutputDir2(), `${taskId}.output`);
|
|
422856
422580
|
}
|
|
422857
422581
|
function track2(p) {
|
|
422858
422582
|
_pendingOps2.add(p);
|
|
@@ -429778,7 +429502,7 @@ var init_compact4 = __esm(() => {
|
|
|
429778
429502
|
|
|
429779
429503
|
// src/tui/services/SessionMemory/prompts.ts
|
|
429780
429504
|
import { readFile as readFile60 } from "fs/promises";
|
|
429781
|
-
import { join as
|
|
429505
|
+
import { join as join163 } from "path";
|
|
429782
429506
|
function getDefaultUpdatePrompt() {
|
|
429783
429507
|
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.
|
|
429784
429508
|
|
|
@@ -429819,7 +429543,7 @@ You ONLY update the actual content that comes AFTER these two preserved lines. T
|
|
|
429819
429543
|
REMEMBER: Use the Edit tool in parallel and stop. Do not continue after the edits. Only include insights from the actual user conversation, never from these note-taking instructions. Do not delete or change section headers or italic _section descriptions_.`;
|
|
429820
429544
|
}
|
|
429821
429545
|
async function loadSessionMemoryTemplate() {
|
|
429822
|
-
const templatePath =
|
|
429546
|
+
const templatePath = join163(getAtlasConfigHomeDir3(), "session-memory", "config", "template.md");
|
|
429823
429547
|
try {
|
|
429824
429548
|
return await readFile60(templatePath, { encoding: "utf-8" });
|
|
429825
429549
|
} catch (e) {
|
|
@@ -429832,7 +429556,7 @@ async function loadSessionMemoryTemplate() {
|
|
|
429832
429556
|
}
|
|
429833
429557
|
}
|
|
429834
429558
|
async function loadSessionMemoryPrompt() {
|
|
429835
|
-
const promptPath =
|
|
429559
|
+
const promptPath = join163(getAtlasConfigHomeDir3(), "session-memory", "config", "prompt.md");
|
|
429836
429560
|
try {
|
|
429837
429561
|
return await readFile60(promptPath, { encoding: "utf-8" });
|
|
429838
429562
|
} catch (e) {
|
|
@@ -430438,7 +430162,7 @@ var init_contextHostWiring = __esm(() => {
|
|
|
430438
430162
|
|
|
430439
430163
|
// src/tui/core/executor/AscendFreshnessPort.ts
|
|
430440
430164
|
import { readFileSync as readFileSync22, existsSync as existsSync12 } from "fs";
|
|
430441
|
-
import { join as
|
|
430165
|
+
import { join as join164, dirname as dirname77 } from "path";
|
|
430442
430166
|
|
|
430443
430167
|
class DefaultAscendFreshnessPort {
|
|
430444
430168
|
injectedCache;
|
|
@@ -430452,8 +430176,8 @@ class DefaultAscendFreshnessPort {
|
|
|
430452
430176
|
return env;
|
|
430453
430177
|
let dir = dirname77(new URL(import.meta.url).pathname);
|
|
430454
430178
|
for (let i = 0;i < MAX_WALK_UP; i++) {
|
|
430455
|
-
if (existsSync12(
|
|
430456
|
-
return
|
|
430179
|
+
if (existsSync12(join164(dir, "package.json")))
|
|
430180
|
+
return join164(dir, ".freshness-cache.json");
|
|
430457
430181
|
const parent = dirname77(dir);
|
|
430458
430182
|
if (parent === dir)
|
|
430459
430183
|
break;
|
|
@@ -430926,7 +430650,7 @@ import {
|
|
|
430926
430650
|
dirname as dirname78,
|
|
430927
430651
|
extname as extname17,
|
|
430928
430652
|
isAbsolute as isAbsolute33,
|
|
430929
|
-
join as
|
|
430653
|
+
join as join165,
|
|
430930
430654
|
parse as parse13,
|
|
430931
430655
|
relative as relative29,
|
|
430932
430656
|
sep as sep36
|
|
@@ -431166,7 +430890,7 @@ async function processMdRules({
|
|
|
431166
430890
|
throw e;
|
|
431167
430891
|
}
|
|
431168
430892
|
for (const entry of entries) {
|
|
431169
|
-
const entryPath =
|
|
430893
|
+
const entryPath = join165(rulesDir, entry.name);
|
|
431170
430894
|
const { resolvedPath: resolvedEntryPath, isSymlink } = safeResolvePath3(fs, entryPath);
|
|
431171
430895
|
const stats = isSymlink ? await fs.stat(resolvedEntryPath) : null;
|
|
431172
430896
|
const isDirectory = stats ? stats.isDirectory() : entry.isDirectory();
|
|
@@ -431234,14 +430958,14 @@ async function getMemoryFilesForNestedDirectory(dir, targetPath, processedPaths)
|
|
|
431234
430958
|
if (isSettingSourceEnabled2("projectSettings")) {
|
|
431235
430959
|
const projectPath = findMemoryFile(dir);
|
|
431236
430960
|
result.push(...await processMemoryFile(projectPath, "Project", processedPaths, false));
|
|
431237
|
-
const dotClaudePath = findMemoryFile(
|
|
430961
|
+
const dotClaudePath = findMemoryFile(join165(dir, getConfigDirName2()));
|
|
431238
430962
|
result.push(...await processMemoryFile(dotClaudePath, "Project", processedPaths, false));
|
|
431239
430963
|
}
|
|
431240
430964
|
if (isSettingSourceEnabled2("localSettings")) {
|
|
431241
|
-
const localPath =
|
|
430965
|
+
const localPath = join165(dir, "CLAUDE.local.md");
|
|
431242
430966
|
result.push(...await processMemoryFile(localPath, "Local", processedPaths, false));
|
|
431243
430967
|
}
|
|
431244
|
-
const rulesDir =
|
|
430968
|
+
const rulesDir = join165(dir, getConfigDirName2(), "rules");
|
|
431245
430969
|
const unconditionalProcessedPaths = new Set(processedPaths);
|
|
431246
430970
|
result.push(...await processMdRules({
|
|
431247
430971
|
rulesDir,
|
|
@@ -431257,7 +430981,7 @@ async function getMemoryFilesForNestedDirectory(dir, targetPath, processedPaths)
|
|
|
431257
430981
|
return result;
|
|
431258
430982
|
}
|
|
431259
430983
|
async function getConditionalRulesForCwdLevelDirectory(dir, targetPath, processedPaths) {
|
|
431260
|
-
const rulesDir =
|
|
430984
|
+
const rulesDir = join165(dir, getConfigDirName2(), "rules");
|
|
431261
430985
|
return processConditionedMdRules(targetPath, rulesDir, "Project", processedPaths, false);
|
|
431262
430986
|
}
|
|
431263
430987
|
async function processConditionedMdRules(targetPath, rulesDir, type, processedPaths, includeExternal) {
|
|
@@ -431513,9 +431237,9 @@ var init_memoryFiles = __esm(() => {
|
|
|
431513
431237
|
if (isSettingSourceEnabled2("projectSettings") && !skipProject) {
|
|
431514
431238
|
const projectPath = findMemoryFile(dir);
|
|
431515
431239
|
result.push(...await processMemoryFile(projectPath, "Project", processedPaths, includeExternal));
|
|
431516
|
-
const dotClaudePath = findMemoryFile(
|
|
431240
|
+
const dotClaudePath = findMemoryFile(join165(dir, getConfigDirName2()));
|
|
431517
431241
|
result.push(...await processMemoryFile(dotClaudePath, "Project", processedPaths, includeExternal));
|
|
431518
|
-
const rulesDir =
|
|
431242
|
+
const rulesDir = join165(dir, getConfigDirName2(), "rules");
|
|
431519
431243
|
result.push(...await processMdRules({
|
|
431520
431244
|
rulesDir,
|
|
431521
431245
|
type: "Project",
|
|
@@ -431525,7 +431249,7 @@ var init_memoryFiles = __esm(() => {
|
|
|
431525
431249
|
}));
|
|
431526
431250
|
}
|
|
431527
431251
|
if (isSettingSourceEnabled2("localSettings")) {
|
|
431528
|
-
const localPath =
|
|
431252
|
+
const localPath = join165(dir, "CLAUDE.local.md");
|
|
431529
431253
|
result.push(...await processMemoryFile(localPath, "Local", processedPaths, includeExternal));
|
|
431530
431254
|
}
|
|
431531
431255
|
}
|
|
@@ -431534,9 +431258,9 @@ var init_memoryFiles = __esm(() => {
|
|
|
431534
431258
|
for (const dir of additionalDirs) {
|
|
431535
431259
|
const projectPath = findMemoryFile(dir);
|
|
431536
431260
|
result.push(...await processMemoryFile(projectPath, "Project", processedPaths, includeExternal));
|
|
431537
|
-
const dotClaudePath = findMemoryFile(
|
|
431261
|
+
const dotClaudePath = findMemoryFile(join165(dir, getConfigDirName2()));
|
|
431538
431262
|
result.push(...await processMemoryFile(dotClaudePath, "Project", processedPaths, includeExternal));
|
|
431539
|
-
const rulesDir =
|
|
431263
|
+
const rulesDir = join165(dir, getConfigDirName2(), "rules");
|
|
431540
431264
|
result.push(...await processMdRules({
|
|
431541
431265
|
rulesDir,
|
|
431542
431266
|
type: "Project",
|
|
@@ -440060,7 +439784,7 @@ var init_AutoModeConfirm = __esm(() => {
|
|
|
440060
439784
|
|
|
440061
439785
|
// src/tui/components/permissions/FilePermissionDialog/permissionOptions.tsx
|
|
440062
439786
|
import { homedir as homedir39 } from "os";
|
|
440063
|
-
import { basename as basename54, join as
|
|
439787
|
+
import { basename as basename54, join as join166, sep as sep37 } from "path";
|
|
440064
439788
|
function isInClaudeFolder(filePath) {
|
|
440065
439789
|
const absolutePath = expandPath2(filePath);
|
|
440066
439790
|
const claudeFolderPath = expandPath2(`${getOriginalCwd()}/${getConfigDirName2()}`);
|
|
@@ -440070,7 +439794,7 @@ function isInClaudeFolder(filePath) {
|
|
|
440070
439794
|
}
|
|
440071
439795
|
function isInGlobalClaudeFolder(filePath) {
|
|
440072
439796
|
const absolutePath = expandPath2(filePath);
|
|
440073
|
-
const globalClaudeFolderPath =
|
|
439797
|
+
const globalClaudeFolderPath = join166(homedir39(), getConfigDirName2());
|
|
440074
439798
|
const normalizedAbsolutePath = normalizeCaseForComparison2(absolutePath);
|
|
440075
439799
|
const normalizedGlobalClaudeFolderPath = normalizeCaseForComparison2(globalClaudeFolderPath);
|
|
440076
439800
|
return normalizedAbsolutePath.startsWith(normalizedGlobalClaudeFolderPath + sep37.toLowerCase()) || normalizedAbsolutePath.startsWith(normalizedGlobalClaudeFolderPath + "/");
|
|
@@ -457791,10 +457515,10 @@ var init_segments = __esm(() => {
|
|
|
457791
457515
|
|
|
457792
457516
|
// src/tui/components/StatusLine/segments/statusLineConfig.ts
|
|
457793
457517
|
import { readFileSync as readFileSync23, existsSync as existsSync13, writeFileSync as writeFileSync9, renameSync as renameSync3, mkdirSync as mkdirSync9 } from "fs";
|
|
457794
|
-
import { join as
|
|
457518
|
+
import { join as join167 } from "path";
|
|
457795
457519
|
import { homedir as homedir41 } from "os";
|
|
457796
457520
|
function getStatusLineJsonPath() {
|
|
457797
|
-
return
|
|
457521
|
+
return join167(homedir41(), getConfigDirName2(), "statusline.json");
|
|
457798
457522
|
}
|
|
457799
457523
|
function getDefaultConfig() {
|
|
457800
457524
|
return {
|
|
@@ -463219,7 +462943,7 @@ var init_autoDream = __esm(() => {
|
|
|
463219
462943
|
});
|
|
463220
462944
|
|
|
463221
462945
|
// src/tui/utils/cleanup.ts
|
|
463222
|
-
import { join as
|
|
462946
|
+
import { join as join168 } from "path";
|
|
463223
462947
|
function getCutoffDate() {
|
|
463224
462948
|
const settings = getSettings_DEPRECATED() || {};
|
|
463225
462949
|
const cleanupPeriodDays = settings.cleanupPeriodDays ?? DEFAULT_CLEANUP_PERIOD_DAYS;
|
|
@@ -463244,7 +462968,7 @@ async function cleanupOldFilesInDirectory(dirPath, cutoffDate, isMessagePath) {
|
|
|
463244
462968
|
try {
|
|
463245
462969
|
const timestamp = convertFileNameToDate(file.name);
|
|
463246
462970
|
if (timestamp < cutoffDate) {
|
|
463247
|
-
await getFsImplementation2().unlink(
|
|
462971
|
+
await getFsImplementation2().unlink(join168(dirPath, file.name));
|
|
463248
462972
|
if (isMessagePath) {
|
|
463249
462973
|
result.messages++;
|
|
463250
462974
|
} else {
|
|
@@ -463275,7 +462999,7 @@ async function cleanupOldMessageFiles() {
|
|
|
463275
462999
|
} catch {
|
|
463276
463000
|
return result;
|
|
463277
463001
|
}
|
|
463278
|
-
const mcpLogDirs = dirents.filter((dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")).map((dirent) =>
|
|
463002
|
+
const mcpLogDirs = dirents.filter((dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")).map((dirent) => join168(baseCachePath, dirent.name));
|
|
463279
463003
|
for (const mcpLogDir of mcpLogDirs) {
|
|
463280
463004
|
result = addCleanupResults(result, await cleanupOldFilesInDirectory(mcpLogDir, cutoffDate, true));
|
|
463281
463005
|
await tryRmdir(mcpLogDir, fsImpl);
|
|
@@ -463314,7 +463038,7 @@ async function cleanupOldSessionFiles() {
|
|
|
463314
463038
|
for (const projectDirent of projectDirents) {
|
|
463315
463039
|
if (!projectDirent.isDirectory())
|
|
463316
463040
|
continue;
|
|
463317
|
-
const projectDir =
|
|
463041
|
+
const projectDir = join168(projectsDir, projectDirent.name);
|
|
463318
463042
|
let entries;
|
|
463319
463043
|
try {
|
|
463320
463044
|
entries = await fsImpl.readdir(projectDir);
|
|
@@ -463328,15 +463052,15 @@ async function cleanupOldSessionFiles() {
|
|
|
463328
463052
|
continue;
|
|
463329
463053
|
}
|
|
463330
463054
|
try {
|
|
463331
|
-
if (await unlinkIfOld(
|
|
463055
|
+
if (await unlinkIfOld(join168(projectDir, entry.name), cutoffDate, fsImpl)) {
|
|
463332
463056
|
result.messages++;
|
|
463333
463057
|
}
|
|
463334
463058
|
} catch {
|
|
463335
463059
|
result.errors++;
|
|
463336
463060
|
}
|
|
463337
463061
|
} else if (entry.isDirectory()) {
|
|
463338
|
-
const sessionDir =
|
|
463339
|
-
const toolResultsDir =
|
|
463062
|
+
const sessionDir = join168(projectDir, entry.name);
|
|
463063
|
+
const toolResultsDir = join168(sessionDir, TOOL_RESULTS_SUBDIR3);
|
|
463340
463064
|
let toolDirs;
|
|
463341
463065
|
try {
|
|
463342
463066
|
toolDirs = await fsImpl.readdir(toolResultsDir);
|
|
@@ -463347,14 +463071,14 @@ async function cleanupOldSessionFiles() {
|
|
|
463347
463071
|
for (const toolEntry of toolDirs) {
|
|
463348
463072
|
if (toolEntry.isFile()) {
|
|
463349
463073
|
try {
|
|
463350
|
-
if (await unlinkIfOld(
|
|
463074
|
+
if (await unlinkIfOld(join168(toolResultsDir, toolEntry.name), cutoffDate, fsImpl)) {
|
|
463351
463075
|
result.messages++;
|
|
463352
463076
|
}
|
|
463353
463077
|
} catch {
|
|
463354
463078
|
result.errors++;
|
|
463355
463079
|
}
|
|
463356
463080
|
} else if (toolEntry.isDirectory()) {
|
|
463357
|
-
const toolDirPath =
|
|
463081
|
+
const toolDirPath = join168(toolResultsDir, toolEntry.name);
|
|
463358
463082
|
let toolFiles;
|
|
463359
463083
|
try {
|
|
463360
463084
|
toolFiles = await fsImpl.readdir(toolDirPath);
|
|
@@ -463365,7 +463089,7 @@ async function cleanupOldSessionFiles() {
|
|
|
463365
463089
|
if (!tf.isFile())
|
|
463366
463090
|
continue;
|
|
463367
463091
|
try {
|
|
463368
|
-
if (await unlinkIfOld(
|
|
463092
|
+
if (await unlinkIfOld(join168(toolDirPath, tf.name), cutoffDate, fsImpl)) {
|
|
463369
463093
|
result.messages++;
|
|
463370
463094
|
}
|
|
463371
463095
|
} catch {
|
|
@@ -463397,7 +463121,7 @@ async function cleanupSingleDirectory(dirPath, extension, removeEmptyDir = true)
|
|
|
463397
463121
|
if (!dirent.isFile() || !dirent.name.endsWith(extension))
|
|
463398
463122
|
continue;
|
|
463399
463123
|
try {
|
|
463400
|
-
if (await unlinkIfOld(
|
|
463124
|
+
if (await unlinkIfOld(join168(dirPath, dirent.name), cutoffDate, fsImpl)) {
|
|
463401
463125
|
result.messages++;
|
|
463402
463126
|
}
|
|
463403
463127
|
} catch {
|
|
@@ -463410,7 +463134,7 @@ async function cleanupSingleDirectory(dirPath, extension, removeEmptyDir = true)
|
|
|
463410
463134
|
return result;
|
|
463411
463135
|
}
|
|
463412
463136
|
function cleanupOldPlanFiles() {
|
|
463413
|
-
const plansDir =
|
|
463137
|
+
const plansDir = join168(getAtlasConfigHomeDir3(), "plans");
|
|
463414
463138
|
return cleanupSingleDirectory(plansDir, ".md");
|
|
463415
463139
|
}
|
|
463416
463140
|
async function cleanupOldFileHistoryBackups() {
|
|
@@ -463419,14 +463143,14 @@ async function cleanupOldFileHistoryBackups() {
|
|
|
463419
463143
|
const fsImpl = getFsImplementation2();
|
|
463420
463144
|
try {
|
|
463421
463145
|
const configDir = getAtlasConfigHomeDir3();
|
|
463422
|
-
const fileHistoryStorageDir =
|
|
463146
|
+
const fileHistoryStorageDir = join168(configDir, "file-history");
|
|
463423
463147
|
let dirents;
|
|
463424
463148
|
try {
|
|
463425
463149
|
dirents = await fsImpl.readdir(fileHistoryStorageDir);
|
|
463426
463150
|
} catch {
|
|
463427
463151
|
return result;
|
|
463428
463152
|
}
|
|
463429
|
-
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
463153
|
+
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join168(fileHistoryStorageDir, dirent.name));
|
|
463430
463154
|
await Promise.all(fileHistorySessionsDirs.map(async (fileHistorySessionDir) => {
|
|
463431
463155
|
try {
|
|
463432
463156
|
const stats = await fsImpl.stat(fileHistorySessionDir);
|
|
@@ -463453,14 +463177,14 @@ async function cleanupOldSessionEnvDirs() {
|
|
|
463453
463177
|
const fsImpl = getFsImplementation2();
|
|
463454
463178
|
try {
|
|
463455
463179
|
const configDir = getAtlasConfigHomeDir3();
|
|
463456
|
-
const sessionEnvBaseDir =
|
|
463180
|
+
const sessionEnvBaseDir = join168(configDir, "session-env");
|
|
463457
463181
|
let dirents;
|
|
463458
463182
|
try {
|
|
463459
463183
|
dirents = await fsImpl.readdir(sessionEnvBaseDir);
|
|
463460
463184
|
} catch {
|
|
463461
463185
|
return result;
|
|
463462
463186
|
}
|
|
463463
|
-
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
463187
|
+
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join168(sessionEnvBaseDir, dirent.name));
|
|
463464
463188
|
for (const sessionEnvDir of sessionEnvDirs) {
|
|
463465
463189
|
try {
|
|
463466
463190
|
const stats = await fsImpl.stat(sessionEnvDir);
|
|
@@ -463482,7 +463206,7 @@ async function cleanupOldDebugLogs() {
|
|
|
463482
463206
|
const cutoffDate = getCutoffDate();
|
|
463483
463207
|
const result = { messages: 0, errors: 0 };
|
|
463484
463208
|
const fsImpl = getFsImplementation2();
|
|
463485
|
-
const debugDir =
|
|
463209
|
+
const debugDir = join168(getAtlasConfigHomeDir3(), "debug");
|
|
463486
463210
|
let dirents;
|
|
463487
463211
|
try {
|
|
463488
463212
|
dirents = await fsImpl.readdir(debugDir);
|
|
@@ -463494,7 +463218,7 @@ async function cleanupOldDebugLogs() {
|
|
|
463494
463218
|
continue;
|
|
463495
463219
|
}
|
|
463496
463220
|
try {
|
|
463497
|
-
if (await unlinkIfOld(
|
|
463221
|
+
if (await unlinkIfOld(join168(debugDir, dirent.name), cutoffDate, fsImpl)) {
|
|
463498
463222
|
result.messages++;
|
|
463499
463223
|
}
|
|
463500
463224
|
} catch {
|
|
@@ -464939,10 +464663,10 @@ var init_coordinatorHandler = __esm(() => {
|
|
|
464939
464663
|
});
|
|
464940
464664
|
|
|
464941
464665
|
// src/tui/utils/permissions/sessionPermissionRules.ts
|
|
464942
|
-
import { mkdir as mkdir53, readFile as readFile61, rename as rename11, writeFile as
|
|
464943
|
-
import { dirname as dirname80, join as
|
|
464666
|
+
import { mkdir as mkdir53, readFile as readFile61, rename as rename11, writeFile as writeFile48 } from "fs/promises";
|
|
464667
|
+
import { dirname as dirname80, join as join170 } from "path";
|
|
464944
464668
|
function sessionRulesPath(sessionId, projectDir) {
|
|
464945
|
-
return
|
|
464669
|
+
return join170(projectDir, `${sessionId}${SESSION_RULES_FILE_SUFFIX}`);
|
|
464946
464670
|
}
|
|
464947
464671
|
function parseSessionRulesJson(json) {
|
|
464948
464672
|
if (json.length > MAX_SESSION_RULES_BYTES)
|
|
@@ -465002,7 +464726,7 @@ async function mergeSessionPermissionRules(sessionId, projectDir, updates) {
|
|
|
465002
464726
|
await mkdir53(projectDir, { recursive: true });
|
|
465003
464727
|
const target = sessionRulesPath(sessionId, projectDir);
|
|
465004
464728
|
const tmp = `${target}.tmp-${process.pid}`;
|
|
465005
|
-
await
|
|
464729
|
+
await writeFile48(tmp, JSON.stringify({ version: 1, updates: merged }, null, 2));
|
|
465006
464730
|
await rename11(tmp, target);
|
|
465007
464731
|
return true;
|
|
465008
464732
|
} catch (e) {
|
|
@@ -467929,7 +467653,7 @@ var init_conversationRecovery = __esm(() => {
|
|
|
467929
467653
|
|
|
467930
467654
|
// src/tui/utils/asciicast.ts
|
|
467931
467655
|
import { appendFile as appendFile6, rename as rename12 } from "fs/promises";
|
|
467932
|
-
import { basename as basename63, dirname as dirname81, join as
|
|
467656
|
+
import { basename as basename63, dirname as dirname81, join as join172 } from "path";
|
|
467933
467657
|
function getRecordFilePath() {
|
|
467934
467658
|
if (recordingState.filePath !== null) {
|
|
467935
467659
|
return recordingState.filePath;
|
|
@@ -467940,10 +467664,10 @@ function getRecordFilePath() {
|
|
|
467940
467664
|
if (!isEnvTruthy2(process.env.ATLAS_TERMINAL_RECORDING)) {
|
|
467941
467665
|
return null;
|
|
467942
467666
|
}
|
|
467943
|
-
const projectsDir =
|
|
467944
|
-
const projectDir =
|
|
467667
|
+
const projectsDir = join172(getAtlasConfigHomeDir3(), "projects");
|
|
467668
|
+
const projectDir = join172(projectsDir, sanitizePath3(getOriginalCwd()));
|
|
467945
467669
|
recordingState.timestamp = Date.now();
|
|
467946
|
-
recordingState.filePath =
|
|
467670
|
+
recordingState.filePath = join172(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
|
|
467947
467671
|
return recordingState.filePath;
|
|
467948
467672
|
}
|
|
467949
467673
|
async function renameRecordingForSession() {
|
|
@@ -467951,9 +467675,9 @@ async function renameRecordingForSession() {
|
|
|
467951
467675
|
if (!oldPath || recordingState.timestamp === 0) {
|
|
467952
467676
|
return;
|
|
467953
467677
|
}
|
|
467954
|
-
const projectsDir =
|
|
467955
|
-
const projectDir =
|
|
467956
|
-
const newPath =
|
|
467678
|
+
const projectsDir = join172(getAtlasConfigHomeDir3(), "projects");
|
|
467679
|
+
const projectDir = join172(projectsDir, sanitizePath3(getOriginalCwd()));
|
|
467680
|
+
const newPath = join172(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
|
|
467957
467681
|
if (oldPath === newPath) {
|
|
467958
467682
|
return;
|
|
467959
467683
|
}
|
|
@@ -469367,7 +469091,7 @@ var init_useAwaySummary = __esm(() => {
|
|
|
469367
469091
|
});
|
|
469368
469092
|
|
|
469369
469093
|
// src/tui/utils/plugins/officialMarketplaceStartupCheck.ts
|
|
469370
|
-
import { join as
|
|
469094
|
+
import { join as join173 } from "path";
|
|
469371
469095
|
function isOfficialMarketplaceAutoInstallDisabled() {
|
|
469372
469096
|
return isEnvTruthy2(process.env.ATLAS_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL);
|
|
469373
469097
|
}
|
|
@@ -469445,7 +469169,7 @@ async function checkAndInstallOfficialMarketplace() {
|
|
|
469445
469169
|
return { installed: false, skipped: true, reason: "policy_blocked" };
|
|
469446
469170
|
}
|
|
469447
469171
|
const cacheDir = getMarketplacesCacheDir();
|
|
469448
|
-
const installLocation =
|
|
469172
|
+
const installLocation = join173(cacheDir, OFFICIAL_MARKETPLACE_NAME);
|
|
469449
469173
|
const gcsSha = await fetchOfficialMarketplaceFromGcs(installLocation, cacheDir);
|
|
469450
469174
|
if (gcsSha !== null) {
|
|
469451
469175
|
const known = await loadKnownMarketplacesConfig();
|
|
@@ -470936,7 +470660,7 @@ var init_usePluginRecommendationBase = __esm(() => {
|
|
|
470936
470660
|
});
|
|
470937
470661
|
|
|
470938
470662
|
// src/tui/hooks/useLspPluginRecommendation.tsx
|
|
470939
|
-
import { extname as extname19, join as
|
|
470663
|
+
import { extname as extname19, join as join174 } from "path";
|
|
470940
470664
|
function useLspPluginRecommendation() {
|
|
470941
470665
|
const $ = import_compiler_runtime310.c(12);
|
|
470942
470666
|
const trackedFiles = useAppState(_temp184);
|
|
@@ -471021,7 +470745,7 @@ function useLspPluginRecommendation() {
|
|
|
471021
470745
|
case "yes": {
|
|
471022
470746
|
installPluginAndNotify(pluginId, pluginName, "lsp-plugin", addNotification, async (pluginData) => {
|
|
471023
470747
|
logForDebugging3(`[useLspPluginRecommendation] Installing plugin: ${pluginId}`);
|
|
471024
|
-
const localSourcePath = typeof pluginData.entry.source === "string" ?
|
|
470748
|
+
const localSourcePath = typeof pluginData.entry.source === "string" ? join174(pluginData.marketplaceInstallLocation, pluginData.entry.source) : undefined;
|
|
471025
470749
|
await cacheAndRegisterPlugin(pluginId, pluginData.entry, "user", undefined, localSourcePath);
|
|
471026
470750
|
const settings = getSettingsForSource2("userSettings");
|
|
471027
470751
|
updateSettingsForSource2("userSettings", {
|
|
@@ -474824,10 +474548,10 @@ var init_cronJitterConfig2 = __esm(() => {
|
|
|
474824
474548
|
});
|
|
474825
474549
|
|
|
474826
474550
|
// src/tui/utils/cronTasksLock.ts
|
|
474827
|
-
import { mkdir as mkdir54, readFile as readFile62, unlink as unlink26, writeFile as
|
|
474828
|
-
import { dirname as dirname83, join as
|
|
474551
|
+
import { mkdir as mkdir54, readFile as readFile62, unlink as unlink26, writeFile as writeFile49 } from "fs/promises";
|
|
474552
|
+
import { dirname as dirname83, join as join175 } from "path";
|
|
474829
474553
|
function getLockPath3(dir) {
|
|
474830
|
-
return
|
|
474554
|
+
return join175(dir ?? getProjectRoot(), LOCK_FILE_REL2);
|
|
474831
474555
|
}
|
|
474832
474556
|
async function readLock3(dir) {
|
|
474833
474557
|
let raw;
|
|
@@ -474843,7 +474567,7 @@ async function tryCreateExclusive3(lock, dir) {
|
|
|
474843
474567
|
const path = getLockPath3(dir);
|
|
474844
474568
|
const body = jsonStringify5(lock);
|
|
474845
474569
|
try {
|
|
474846
|
-
await
|
|
474570
|
+
await writeFile49(path, body, { flag: "wx" });
|
|
474847
474571
|
return true;
|
|
474848
474572
|
} catch (e) {
|
|
474849
474573
|
const code = getErrnoCode2(e);
|
|
@@ -474852,7 +474576,7 @@ async function tryCreateExclusive3(lock, dir) {
|
|
|
474852
474576
|
if (code === "ENOENT") {
|
|
474853
474577
|
await mkdir54(dirname83(path), { recursive: true });
|
|
474854
474578
|
try {
|
|
474855
|
-
await
|
|
474579
|
+
await writeFile49(path, body, { flag: "wx" });
|
|
474856
474580
|
return true;
|
|
474857
474581
|
} catch (retryErr) {
|
|
474858
474582
|
if (getErrnoCode2(retryErr) === "EEXIST")
|
|
@@ -474886,7 +474610,7 @@ async function tryAcquireSchedulerLock2(opts) {
|
|
|
474886
474610
|
const existing = await readLock3(dir);
|
|
474887
474611
|
if (existing?.sessionId === sessionId) {
|
|
474888
474612
|
if (existing.pid !== process.pid) {
|
|
474889
|
-
await
|
|
474613
|
+
await writeFile49(getLockPath3(dir), jsonStringify5(lock));
|
|
474890
474614
|
registerLockCleanup3(opts);
|
|
474891
474615
|
}
|
|
474892
474616
|
return true;
|
|
@@ -474934,7 +474658,7 @@ var init_cronTasksLock2 = __esm(() => {
|
|
|
474934
474658
|
init_genericProcessUtils();
|
|
474935
474659
|
init_json2();
|
|
474936
474660
|
init_slowOperations();
|
|
474937
|
-
LOCK_FILE_REL2 =
|
|
474661
|
+
LOCK_FILE_REL2 = join175(getConfigDirName2(), "scheduled_tasks.lock");
|
|
474938
474662
|
schedulerLockSchema2 = lazySchema2(() => object({
|
|
474939
474663
|
sessionId: string2(),
|
|
474940
474664
|
pid: number2(),
|
|
@@ -475279,9 +475003,9 @@ var init_useScheduledTasks = __esm(() => {
|
|
|
475279
475003
|
|
|
475280
475004
|
// src/tui/screens/REPL.tsx
|
|
475281
475005
|
import { spawnSync as spawnSync7 } from "child_process";
|
|
475282
|
-
import { dirname as dirname84, join as
|
|
475006
|
+
import { dirname as dirname84, join as join176 } from "path";
|
|
475283
475007
|
import { tmpdir as tmpdir12 } from "os";
|
|
475284
|
-
import { writeFile as
|
|
475008
|
+
import { writeFile as writeFile50 } from "fs/promises";
|
|
475285
475009
|
import { randomUUID as randomUUID53 } from "crypto";
|
|
475286
475010
|
function _useMoreRightStub(_args) {
|
|
475287
475011
|
return {
|
|
@@ -477840,8 +477564,8 @@ Note: ctrl + z now suspends AtlasCode, ctrl + _ undoes input.
|
|
|
477840
477564
|
const w = Math.max(80, (process.stdout.columns ?? 80) - 6);
|
|
477841
477565
|
const raw = await renderMessagesToPlainText(deferredMessages, tools, w);
|
|
477842
477566
|
const text = raw.replace(/[ \t]+$/gm, "");
|
|
477843
|
-
const path =
|
|
477844
|
-
await
|
|
477567
|
+
const path = join176(tmpdir12(), `cc-transcript-${Date.now()}.txt`);
|
|
477568
|
+
await writeFile50(path, text);
|
|
477845
477569
|
const opened = openFileInExternalEditor(path);
|
|
477846
477570
|
setStatus(opened ? `opening ${path}` : `wrote ${path} · no $VISUAL/$EDITOR set`);
|
|
477847
477571
|
} catch (e) {
|
|
@@ -484586,7 +484310,7 @@ var init_bundled = __esm(() => {
|
|
|
484586
484310
|
// src/tui/utils/deepLink/banner.ts
|
|
484587
484311
|
import { stat as stat53 } from "fs/promises";
|
|
484588
484312
|
import { homedir as homedir44 } from "os";
|
|
484589
|
-
import { join as
|
|
484313
|
+
import { join as join177, sep as sep41 } from "path";
|
|
484590
484314
|
function buildDeepLinkBanner(info) {
|
|
484591
484315
|
const lines = [
|
|
484592
484316
|
`This session was opened by an external deep link in ${tildify(info.cwd)}`
|
|
@@ -484608,8 +484332,8 @@ async function readLastFetchTime(cwd) {
|
|
|
484608
484332
|
return;
|
|
484609
484333
|
const commonDir = await getCommonDir2(gitDir);
|
|
484610
484334
|
const [local, common] = await Promise.all([
|
|
484611
|
-
mtimeOrUndefined(
|
|
484612
|
-
commonDir ? mtimeOrUndefined(
|
|
484335
|
+
mtimeOrUndefined(join177(gitDir, "FETCH_HEAD")),
|
|
484336
|
+
commonDir ? mtimeOrUndefined(join177(commonDir, "FETCH_HEAD")) : Promise.resolve(undefined)
|
|
484613
484337
|
]);
|
|
484614
484338
|
if (local && common)
|
|
484615
484339
|
return local > common ? local : common;
|
|
@@ -484968,7 +484692,7 @@ function eagerParseCliFlag2(flagName, argv = process.argv) {
|
|
|
484968
484692
|
}
|
|
484969
484693
|
|
|
484970
484694
|
// src/tui/utils/memoryFileMigration.ts
|
|
484971
|
-
import { join as
|
|
484695
|
+
import { join as join178 } from "path";
|
|
484972
484696
|
function migrateMemoryFiles(opts) {
|
|
484973
484697
|
const fsImpl = opts?.fs ?? getFsImplementation2();
|
|
484974
484698
|
const dirs = opts?.dirs ?? [getCwd(), getAtlasConfigHomeDir3(), getManagedFilePath()];
|
|
@@ -484980,8 +484704,8 @@ function migrateMemoryFiles(opts) {
|
|
|
484980
484704
|
for (const dir of dirs) {
|
|
484981
484705
|
for (const [oldName, newName] of migrations) {
|
|
484982
484706
|
try {
|
|
484983
|
-
const oldPath =
|
|
484984
|
-
const newPath =
|
|
484707
|
+
const oldPath = join178(dir, oldName);
|
|
484708
|
+
const newPath = join178(dir, newName);
|
|
484985
484709
|
if (fsImpl.existsSync(oldPath) && !fsImpl.existsSync(newPath)) {
|
|
484986
484710
|
fsImpl.renameSync(oldPath, newPath);
|
|
484987
484711
|
logForDebugging3(`[STARTUP] Migrated memory file ${oldPath} -> ${newPath}`);
|
|
@@ -485134,23 +484858,6 @@ var init_migrateEnableAllProjectMcpServersToSettings = __esm(() => {
|
|
|
485134
484858
|
init_settings3();
|
|
485135
484859
|
});
|
|
485136
484860
|
|
|
485137
|
-
// src/tui/migrations/migrateReplBridgeEnabledToRemoteControlAtStartup.ts
|
|
485138
|
-
function migrateReplBridgeEnabledToRemoteControlAtStartup() {
|
|
485139
|
-
saveGlobalConfig((prev) => {
|
|
485140
|
-
const oldValue = prev["replBridgeEnabled"];
|
|
485141
|
-
if (oldValue === undefined)
|
|
485142
|
-
return prev;
|
|
485143
|
-
if (prev.remoteControlAtStartup !== undefined)
|
|
485144
|
-
return prev;
|
|
485145
|
-
const next = { ...prev, remoteControlAtStartup: Boolean(oldValue) };
|
|
485146
|
-
delete next["replBridgeEnabled"];
|
|
485147
|
-
return next;
|
|
485148
|
-
});
|
|
485149
|
-
}
|
|
485150
|
-
var init_migrateReplBridgeEnabledToRemoteControlAtStartup = __esm(() => {
|
|
485151
|
-
init_config6();
|
|
485152
|
-
});
|
|
485153
|
-
|
|
485154
484861
|
// src/tui/migrations/resetAutoModeOptInForDefaultOffer.ts
|
|
485155
484862
|
function resetAutoModeOptInForDefaultOffer() {
|
|
485156
484863
|
if (feature("TRANSCRIPT_CLASSIFIER")) {
|
|
@@ -485584,12 +485291,12 @@ var init_protocolHandler = __esm(() => {
|
|
|
485584
485291
|
});
|
|
485585
485292
|
|
|
485586
485293
|
// src/tui/utils/errorLogSink.ts
|
|
485587
|
-
import { dirname as dirname86, join as
|
|
485294
|
+
import { dirname as dirname86, join as join179 } from "path";
|
|
485588
485295
|
function getErrorsPath() {
|
|
485589
|
-
return
|
|
485296
|
+
return join179(CACHE_PATHS.errors(), DATE + ".jsonl");
|
|
485590
485297
|
}
|
|
485591
485298
|
function getMCPLogsPath(serverName) {
|
|
485592
|
-
return
|
|
485299
|
+
return join179(CACHE_PATHS.mcpLogs(serverName), DATE + ".jsonl");
|
|
485593
485300
|
}
|
|
485594
485301
|
function createJsonlWriter(options) {
|
|
485595
485302
|
const writer = createBufferedWriter(options);
|
|
@@ -485727,12 +485434,12 @@ var init_sinks = __esm(() => {
|
|
|
485727
485434
|
});
|
|
485728
485435
|
|
|
485729
485436
|
// src/tui/utils/computerUse/setup.ts
|
|
485730
|
-
import { join as
|
|
485437
|
+
import { join as join180 } from "path";
|
|
485731
485438
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
485732
485439
|
function setupComputerUseMCP() {
|
|
485733
485440
|
const allowedTools = buildComputerUseTools(CLI_CU_CAPABILITIES, getChicagoCoordinateMode()).map((t) => buildMcpToolName3(COMPUTER_USE_MCP_SERVER_NAME, t.name));
|
|
485734
485441
|
const args = isInBundledMode2() ? ["--computer-use-mcp"] : [
|
|
485735
|
-
|
|
485442
|
+
join180(fileURLToPath5(import.meta.url), "..", "cli.js"),
|
|
485736
485443
|
"--computer-use-mcp"
|
|
485737
485444
|
];
|
|
485738
485445
|
return {
|
|
@@ -485755,7 +485462,7 @@ var init_setup3 = __esm(() => {
|
|
|
485755
485462
|
});
|
|
485756
485463
|
|
|
485757
485464
|
// src/tui/services/SessionMemory/sessionMemory.ts
|
|
485758
|
-
import { writeFile as
|
|
485465
|
+
import { writeFile as writeFile51 } from "fs/promises";
|
|
485759
485466
|
function isSessionMemoryGateEnabled() {
|
|
485760
485467
|
return getFeatureValue_CACHED_MAY_BE_STALE("atlas_session_memory", false);
|
|
485761
485468
|
}
|
|
@@ -485809,13 +485516,13 @@ async function setupSessionMemoryFile(toolUseContext) {
|
|
|
485809
485516
|
await fs.mkdir(sessionMemoryDir, { mode: 448 });
|
|
485810
485517
|
const memoryPath = getSessionMemoryPath();
|
|
485811
485518
|
try {
|
|
485812
|
-
await
|
|
485519
|
+
await writeFile51(memoryPath, "", {
|
|
485813
485520
|
encoding: "utf-8",
|
|
485814
485521
|
mode: 384,
|
|
485815
485522
|
flag: "wx"
|
|
485816
485523
|
});
|
|
485817
485524
|
const template = await loadSessionMemoryTemplate();
|
|
485818
|
-
await
|
|
485525
|
+
await writeFile51(memoryPath, template, {
|
|
485819
485526
|
encoding: "utf-8",
|
|
485820
485527
|
mode: 384
|
|
485821
485528
|
});
|
|
@@ -485933,7 +485640,7 @@ var init_sessionMemory2 = __esm(() => {
|
|
|
485933
485640
|
// src/tui/utils/iTermBackup.ts
|
|
485934
485641
|
import { copyFile as copyFile10, stat as stat54 } from "fs/promises";
|
|
485935
485642
|
import { homedir as homedir46 } from "os";
|
|
485936
|
-
import { join as
|
|
485643
|
+
import { join as join181 } from "path";
|
|
485937
485644
|
function markITerm2SetupComplete() {
|
|
485938
485645
|
saveGlobalConfig((current) => ({
|
|
485939
485646
|
...current,
|
|
@@ -485948,7 +485655,7 @@ function getIterm2RecoveryInfo() {
|
|
|
485948
485655
|
};
|
|
485949
485656
|
}
|
|
485950
485657
|
function getITerm2PlistPath() {
|
|
485951
|
-
return
|
|
485658
|
+
return join181(homedir46(), "Library", "Preferences", "com.googlecode.iterm2.plist");
|
|
485952
485659
|
}
|
|
485953
485660
|
async function checkAndRestoreITerm2Backup() {
|
|
485954
485661
|
const { inProgress, backupPath } = getIterm2RecoveryInfo();
|
|
@@ -486993,14 +486700,14 @@ var init_mcp8 = __esm(() => {
|
|
|
486993
486700
|
// src/tui/utils/atlasDesktop.ts
|
|
486994
486701
|
import { readdir as readdir34, readFile as readFile63, stat as stat55 } from "fs/promises";
|
|
486995
486702
|
import { homedir as homedir47 } from "os";
|
|
486996
|
-
import { join as
|
|
486703
|
+
import { join as join182 } from "path";
|
|
486997
486704
|
async function getDesktopConfigPath() {
|
|
486998
486705
|
const platform = getPlatform3();
|
|
486999
486706
|
if (!SUPPORTED_PLATFORMS2.includes(platform)) {
|
|
487000
486707
|
throw new Error(`Unsupported platform: ${platform} - Claude Desktop integration only works on macOS and WSL.`);
|
|
487001
486708
|
}
|
|
487002
486709
|
if (platform === "macos") {
|
|
487003
|
-
return
|
|
486710
|
+
return join182(homedir47(), "Library", "Application Support", "AtlasCode", "claude_desktop_config.json");
|
|
487004
486711
|
}
|
|
487005
486712
|
const windowsHome = process.env.USERPROFILE ? process.env.USERPROFILE.replace(/\\/g, "/") : null;
|
|
487006
486713
|
if (windowsHome) {
|
|
@@ -487019,7 +486726,7 @@ async function getDesktopConfigPath() {
|
|
|
487019
486726
|
if (user.name === "Public" || user.name === "Default" || user.name === "Default User" || user.name === "All Users") {
|
|
487020
486727
|
continue;
|
|
487021
486728
|
}
|
|
487022
|
-
const potentialConfigPath =
|
|
486729
|
+
const potentialConfigPath = join182(usersDir, user.name, "AppData", "Roaming", "AtlasCode", "claude_desktop_config.json");
|
|
487023
486730
|
try {
|
|
487024
486731
|
await stat55(potentialConfigPath);
|
|
487025
486732
|
return potentialConfigPath;
|
|
@@ -487474,10 +487181,10 @@ var init_auth6 = __esm(() => {
|
|
|
487474
487181
|
});
|
|
487475
487182
|
|
|
487476
487183
|
// src/tui/utils/plugins/marketplacePublish.ts
|
|
487477
|
-
import { cp, mkdir as mkdir55, readFile as readFile64, rm as rm11, writeFile as
|
|
487184
|
+
import { cp, mkdir as mkdir55, readFile as readFile64, rm as rm11, writeFile as writeFile52 } from "fs/promises";
|
|
487478
487185
|
import {
|
|
487479
487186
|
dirname as dirname87,
|
|
487480
|
-
join as
|
|
487187
|
+
join as join183,
|
|
487481
487188
|
relative as relative38,
|
|
487482
487189
|
resolve as resolve54,
|
|
487483
487190
|
sep as sep42
|
|
@@ -487519,7 +487226,7 @@ async function publishPluginToMarketplace(opts) {
|
|
|
487519
487226
|
}
|
|
487520
487227
|
const name = manifest.name;
|
|
487521
487228
|
const version = opts.version ?? (typeof manifest.version === "string" ? manifest.version : undefined);
|
|
487522
|
-
const targetDir =
|
|
487229
|
+
const targetDir = join183(marketplaceDir, "plugins", name);
|
|
487523
487230
|
await rm11(targetDir, { recursive: true, force: true });
|
|
487524
487231
|
await mkdir55(dirname87(targetDir), { recursive: true });
|
|
487525
487232
|
await cp(pluginDir, targetDir, { recursive: true });
|
|
@@ -487553,7 +487260,7 @@ async function publishPluginToMarketplace(opts) {
|
|
|
487553
487260
|
} else {
|
|
487554
487261
|
pluginsList.push(entry);
|
|
487555
487262
|
}
|
|
487556
|
-
await
|
|
487263
|
+
await writeFile52(marketplaceManifestPath, jsonStringify5(marketplaceDoc, null, 2) + `
|
|
487557
487264
|
`, "utf-8");
|
|
487558
487265
|
const marketplaceCheck = await validateMarketplaceManifest(marketplaceManifestPath);
|
|
487559
487266
|
if (!marketplaceCheck.success) {
|
|
@@ -487623,13 +487330,13 @@ var init_marketplacePublish = __esm(() => {
|
|
|
487623
487330
|
// src/tui/utils/plugins/marketplaceScaffold.ts
|
|
487624
487331
|
import { userInfo as userInfo2 } from "os";
|
|
487625
487332
|
import { existsSync as existsSync15 } from "fs";
|
|
487626
|
-
import { mkdir as mkdir56, writeFile as
|
|
487627
|
-
import { dirname as dirname88, join as
|
|
487333
|
+
import { mkdir as mkdir56, writeFile as writeFile53 } from "fs/promises";
|
|
487334
|
+
import { dirname as dirname88, join as join184, resolve as resolve55 } from "path";
|
|
487628
487335
|
async function scaffoldMarketplace(opts) {
|
|
487629
487336
|
const targetDir = resolve55(opts.targetDir);
|
|
487630
487337
|
const name = opts.name.trim();
|
|
487631
487338
|
const manifestDirName = getPluginManifestDirs()[0];
|
|
487632
|
-
const marketplaceManifestPath =
|
|
487339
|
+
const marketplaceManifestPath = join184(targetDir, manifestDirName, "marketplace.json");
|
|
487633
487340
|
if (existsSync15(marketplaceManifestPath)) {
|
|
487634
487341
|
throw new Error(`Marketplace manifest already exists at ${marketplaceManifestPath} — refusing to overwrite (delete it and re-run to re-scaffold)`);
|
|
487635
487342
|
}
|
|
@@ -487671,19 +487378,19 @@ async function scaffoldMarketplace(opts) {
|
|
|
487671
487378
|
}
|
|
487672
487379
|
const files = [];
|
|
487673
487380
|
const write = async (relPath, content) => {
|
|
487674
|
-
const abs =
|
|
487381
|
+
const abs = join184(targetDir, relPath);
|
|
487675
487382
|
await mkdir56(dirname88(abs), { recursive: true });
|
|
487676
|
-
await
|
|
487383
|
+
await writeFile53(abs, content, "utf-8");
|
|
487677
487384
|
files.push(relPath);
|
|
487678
487385
|
};
|
|
487679
|
-
await write(
|
|
487386
|
+
await write(join184(manifestDirName, "marketplace.json"), jsonStringify5(marketplaceDoc, null, 2) + `
|
|
487680
487387
|
`);
|
|
487681
487388
|
if (includeExamplePlugin && pluginManifestDoc) {
|
|
487682
|
-
await write(
|
|
487389
|
+
await write(join184("plugins", EXAMPLE_PLUGIN, manifestDirName, "plugin.json"), jsonStringify5(pluginManifestDoc, null, 2) + `
|
|
487683
487390
|
`);
|
|
487684
|
-
await write(
|
|
487391
|
+
await write(join184("plugins", EXAMPLE_PLUGIN, "commands", "example.md"), EXAMPLE_COMMAND_MD);
|
|
487685
487392
|
if (includeSkillPack) {
|
|
487686
|
-
await write(
|
|
487393
|
+
await write(join184("plugins", EXAMPLE_PLUGIN, "skills", "example-skill", "SKILL.md"), EXAMPLE_SKILL_MD);
|
|
487687
487394
|
}
|
|
487688
487395
|
}
|
|
487689
487396
|
return { targetDir, marketplaceManifestPath, files };
|
|
@@ -488247,12 +487954,12 @@ var init_plugins = __esm(() => {
|
|
|
488247
487954
|
|
|
488248
487955
|
// src/tui/commands/install.tsx
|
|
488249
487956
|
import { homedir as homedir48 } from "node:os";
|
|
488250
|
-
import { join as
|
|
487957
|
+
import { join as join185 } from "node:path";
|
|
488251
487958
|
function getInstallationPath2() {
|
|
488252
487959
|
const isWindows = env5.platform === "win32";
|
|
488253
487960
|
const homeDir = homedir48();
|
|
488254
487961
|
if (isWindows) {
|
|
488255
|
-
const windowsPath =
|
|
487962
|
+
const windowsPath = join185(homeDir, ".local", "bin", "atlas.exe");
|
|
488256
487963
|
return windowsPath.replace(/\//g, "\\");
|
|
488257
487964
|
}
|
|
488258
487965
|
return "~/.local/bin/atlas";
|
|
@@ -488884,37 +488591,37 @@ var init_autoMode3 = __esm(() => {
|
|
|
488884
488591
|
|
|
488885
488592
|
// src/tui/utils/completionCache.ts
|
|
488886
488593
|
import { homedir as homedir49 } from "os";
|
|
488887
|
-
import { dirname as dirname90, join as
|
|
488594
|
+
import { dirname as dirname90, join as join186 } from "path";
|
|
488888
488595
|
function detectShell() {
|
|
488889
488596
|
const shell = process.env.SHELL || "";
|
|
488890
488597
|
const home = homedir49();
|
|
488891
|
-
const claudeDir =
|
|
488598
|
+
const claudeDir = join186(home, getConfigDirName2());
|
|
488892
488599
|
if (shell.endsWith("/zsh") || shell.endsWith("/zsh.exe")) {
|
|
488893
|
-
const cacheFile =
|
|
488600
|
+
const cacheFile = join186(claudeDir, "completion.zsh");
|
|
488894
488601
|
return {
|
|
488895
488602
|
name: "zsh",
|
|
488896
|
-
rcFile:
|
|
488603
|
+
rcFile: join186(home, ".zshrc"),
|
|
488897
488604
|
cacheFile,
|
|
488898
488605
|
completionLine: `[[ -f "${cacheFile}" ]] && source "${cacheFile}"`,
|
|
488899
488606
|
shellFlag: "zsh"
|
|
488900
488607
|
};
|
|
488901
488608
|
}
|
|
488902
488609
|
if (shell.endsWith("/bash") || shell.endsWith("/bash.exe")) {
|
|
488903
|
-
const cacheFile =
|
|
488610
|
+
const cacheFile = join186(claudeDir, "completion.bash");
|
|
488904
488611
|
return {
|
|
488905
488612
|
name: "bash",
|
|
488906
|
-
rcFile:
|
|
488613
|
+
rcFile: join186(home, ".bashrc"),
|
|
488907
488614
|
cacheFile,
|
|
488908
488615
|
completionLine: `[ -f "${cacheFile}" ] && source "${cacheFile}"`,
|
|
488909
488616
|
shellFlag: "bash"
|
|
488910
488617
|
};
|
|
488911
488618
|
}
|
|
488912
488619
|
if (shell.endsWith("/fish") || shell.endsWith("/fish.exe")) {
|
|
488913
|
-
const xdg = process.env.XDG_CONFIG_HOME ||
|
|
488914
|
-
const cacheFile =
|
|
488620
|
+
const xdg = process.env.XDG_CONFIG_HOME || join186(home, ".config");
|
|
488621
|
+
const cacheFile = join186(claudeDir, "completion.fish");
|
|
488915
488622
|
return {
|
|
488916
488623
|
name: "fish",
|
|
488917
|
-
rcFile:
|
|
488624
|
+
rcFile: join186(xdg, "fish", "config.fish"),
|
|
488918
488625
|
cacheFile,
|
|
488919
488626
|
completionLine: `[ -f "${cacheFile}" ] && source "${cacheFile}"`,
|
|
488920
488627
|
shellFlag: "fish"
|
|
@@ -489353,7 +489060,6 @@ function runMigrations() {
|
|
|
489353
489060
|
migrateAutoUpdatesToSettings();
|
|
489354
489061
|
migrateBypassPermissionsAcceptedToSettings();
|
|
489355
489062
|
migrateEnableAllProjectMcpServersToSettings();
|
|
489356
|
-
migrateReplBridgeEnabledToRemoteControlAtStartup();
|
|
489357
489063
|
if (feature("TRANSCRIPT_CLASSIFIER")) {
|
|
489358
489064
|
resetAutoModeOptInForDefaultOffer();
|
|
489359
489065
|
}
|
|
@@ -489616,8 +489322,7 @@ async function main2() {
|
|
|
489616
489322
|
const cliArgs = process.argv.slice(2);
|
|
489617
489323
|
const hasPrintFlag = cliArgs.includes("-p") || cliArgs.includes("--print");
|
|
489618
489324
|
const hasInitOnlyFlag = cliArgs.includes("--init-only");
|
|
489619
|
-
const
|
|
489620
|
-
const isNonInteractive = hasPrintFlag || hasInitOnlyFlag || hasSdkUrl || !process.stdout.isTTY;
|
|
489325
|
+
const isNonInteractive = hasPrintFlag || hasInitOnlyFlag || !process.stdout.isTTY;
|
|
489621
489326
|
if (isNonInteractive) {
|
|
489622
489327
|
stopCapturingEarlyInput();
|
|
489623
489328
|
}
|
|
@@ -489652,9 +489357,6 @@ async function main2() {
|
|
|
489652
489357
|
} else if (!clientType.startsWith("sdk-") && clientType !== "claude-desktop" && clientType !== "local-agent" && clientType !== "remote") {
|
|
489653
489358
|
setQuestionPreviewFormat("markdown");
|
|
489654
489359
|
}
|
|
489655
|
-
if (process.env.ATLAS_ENVIRONMENT_KIND === "bridge") {
|
|
489656
|
-
setSessionSource("remote-control");
|
|
489657
|
-
}
|
|
489658
489360
|
profileCheckpoint("main_client_type_determined");
|
|
489659
489361
|
eagerLoadSettings2();
|
|
489660
489362
|
profileCheckpoint("main_before_run");
|
|
@@ -489837,49 +489539,26 @@ ${getTmuxInstallInstructions3()}
|
|
|
489837
489539
|
getTeammateModeSnapshot().setCliTeammateModeOverride?.(teammateOpts.teammateMode);
|
|
489838
489540
|
}
|
|
489839
489541
|
}
|
|
489840
|
-
const sdkUrl = options.sdkUrl ?? undefined;
|
|
489841
489542
|
const effectiveIncludePartialMessages = includePartialMessages || isEnvTruthy2(process.env.ATLAS_INCLUDE_PARTIAL_MESSAGES);
|
|
489842
489543
|
if (includeHookEvents || isEnvTruthy2(process.env.ATLAS_REMOTE)) {
|
|
489843
489544
|
setAllHookEventsEnabled(true);
|
|
489844
489545
|
}
|
|
489845
|
-
if (sdkUrl) {
|
|
489846
|
-
if (!inputFormat) {
|
|
489847
|
-
inputFormat = "stream-json";
|
|
489848
|
-
}
|
|
489849
|
-
if (!outputFormat) {
|
|
489850
|
-
outputFormat = "stream-json";
|
|
489851
|
-
}
|
|
489852
|
-
if (options.verbose === undefined) {
|
|
489853
|
-
verbose = true;
|
|
489854
|
-
}
|
|
489855
|
-
if (!options.print) {
|
|
489856
|
-
print = true;
|
|
489857
|
-
}
|
|
489858
|
-
}
|
|
489859
|
-
const teleport = options.teleport ?? null;
|
|
489860
|
-
const remoteOption = options.remote;
|
|
489861
|
-
const remote = remoteOption === true ? "" : remoteOption ?? null;
|
|
489862
|
-
const remoteControlOption = options.remoteControl ?? options.rc;
|
|
489863
|
-
let remoteControl = false;
|
|
489864
|
-
const remoteControlName = typeof remoteControlOption === "string" && remoteControlOption.length > 0 ? remoteControlOption : undefined;
|
|
489865
489546
|
if (sessionId) {
|
|
489866
489547
|
if ((options.continue || options.resume) && !options.forkSession) {
|
|
489867
489548
|
process.stderr.write(source_default.red(`Error: --session-id can only be used with --continue or --resume if --fork-session is also specified.
|
|
489868
489549
|
`));
|
|
489869
489550
|
process.exit(1);
|
|
489870
489551
|
}
|
|
489871
|
-
|
|
489872
|
-
|
|
489873
|
-
|
|
489874
|
-
process.stderr.write(source_default.red(`Error: Invalid session ID. Must be a valid UUID.
|
|
489552
|
+
const validatedSessionId = validateUuid2(sessionId);
|
|
489553
|
+
if (!validatedSessionId) {
|
|
489554
|
+
process.stderr.write(source_default.red(`Error: Invalid session ID. Must be a valid UUID.
|
|
489875
489555
|
`));
|
|
489876
|
-
|
|
489877
|
-
|
|
489878
|
-
|
|
489879
|
-
|
|
489556
|
+
process.exit(1);
|
|
489557
|
+
}
|
|
489558
|
+
if (sessionIdExists(validatedSessionId)) {
|
|
489559
|
+
process.stderr.write(source_default.red(`Error: Session ID ${validatedSessionId} is already in use.
|
|
489880
489560
|
`));
|
|
489881
|
-
|
|
489882
|
-
}
|
|
489561
|
+
process.exit(1);
|
|
489883
489562
|
}
|
|
489884
489563
|
}
|
|
489885
489564
|
const fileSpecs = options.file;
|
|
@@ -490073,7 +489752,7 @@ ${formattedErrors}
|
|
|
490073
489752
|
}
|
|
490074
489753
|
}
|
|
490075
489754
|
setAdditionalDirectoriesForClaudeMd(addDir);
|
|
490076
|
-
const shouldAvoidPermissionPrompts = isNonInteractiveSession && !
|
|
489755
|
+
const shouldAvoidPermissionPrompts = isNonInteractiveSession && !options.permissionPromptTool;
|
|
490077
489756
|
const initResult = await initializeToolPermissionContext2({
|
|
490078
489757
|
allowedToolsCli: allowedTools,
|
|
490079
489758
|
disallowedToolsCli: disallowedTools,
|
|
@@ -490114,12 +489793,6 @@ ${formattedErrors}
|
|
|
490114
489793
|
console.error(`Error: --input-format=stream-json requires output-format=stream-json.`);
|
|
490115
489794
|
process.exit(1);
|
|
490116
489795
|
}
|
|
490117
|
-
if (sdkUrl) {
|
|
490118
|
-
if (inputFormat !== "stream-json" || outputFormat !== "stream-json") {
|
|
490119
|
-
console.error(`Error: --sdk-url requires both --input-format=stream-json and --output-format=stream-json.`);
|
|
490120
|
-
process.exit(1);
|
|
490121
|
-
}
|
|
490122
|
-
}
|
|
490123
489796
|
if (options.replayUserMessages) {
|
|
490124
489797
|
if (inputFormat !== "stream-json" || outputFormat !== "stream-json") {
|
|
490125
489798
|
console.error(`Error: --replay-user-messages requires both --input-format=stream-json and --output-format=stream-json.`);
|
|
@@ -490489,7 +490162,7 @@ ${inputPrompt}` : mergePrompt;
|
|
|
490489
490162
|
}
|
|
490490
490163
|
applyConfigEnvironmentVariables2();
|
|
490491
490164
|
initializeTelemetryAfterTrust();
|
|
490492
|
-
const sessionStartHooksPromise = options.continue || options.resume ||
|
|
490165
|
+
const sessionStartHooksPromise = options.continue || options.resume || setupTrigger ? undefined : processSessionStartHooks("startup");
|
|
490493
490166
|
sessionStartHooksPromise?.catch(() => {});
|
|
490494
490167
|
profileCheckpoint("before_validateForceLoginOrg");
|
|
490495
490168
|
const orgValidation = await validateForceLoginOrg();
|
|
@@ -490657,7 +490330,6 @@ ${inputPrompt}` : mergePrompt;
|
|
|
490657
490330
|
permissionPromptToolName: options.permissionPromptTool,
|
|
490658
490331
|
maxTurns: options.maxTurns,
|
|
490659
490332
|
model: effectiveModel,
|
|
490660
|
-
sdkUrl,
|
|
490661
490333
|
replayUserMessages: effectiveReplayUserMessages,
|
|
490662
490334
|
agent: agentCli
|
|
490663
490335
|
});
|
|
@@ -490696,7 +490368,7 @@ ${inputPrompt}` : mergePrompt;
|
|
|
490696
490368
|
...toolPermissionContext,
|
|
490697
490369
|
mode: isAgentSwarmsEnabled2() && getTeammateUtils().isPlanModeRequired() ? "plan" : toolPermissionContext.mode
|
|
490698
490370
|
};
|
|
490699
|
-
const fullRemoteControl =
|
|
490371
|
+
const fullRemoteControl = false;
|
|
490700
490372
|
let ccrMirrorEnabled = false;
|
|
490701
490373
|
const initialState = {
|
|
490702
490374
|
settings: getInitialSettings2(),
|
|
@@ -490737,7 +490409,7 @@ ${inputPrompt}` : mergePrompt;
|
|
|
490737
490409
|
remoteConnectionStatus: "connecting",
|
|
490738
490410
|
remoteBackgroundTaskCount: 0,
|
|
490739
490411
|
replBridgeEnabled: fullRemoteControl || ccrMirrorEnabled,
|
|
490740
|
-
replBridgeExplicit:
|
|
490412
|
+
replBridgeExplicit: false,
|
|
490741
490413
|
replBridgeOutboundOnly: ccrMirrorEnabled,
|
|
490742
490414
|
replBridgeConnected: false,
|
|
490743
490415
|
replBridgeSessionActive: false,
|
|
@@ -490747,7 +490419,7 @@ ${inputPrompt}` : mergePrompt;
|
|
|
490747
490419
|
replBridgeEnvironmentId: undefined,
|
|
490748
490420
|
replBridgeSessionId: undefined,
|
|
490749
490421
|
replBridgeError: undefined,
|
|
490750
|
-
replBridgeInitialName:
|
|
490422
|
+
replBridgeInitialName: undefined,
|
|
490751
490423
|
showRemoteCallout: false,
|
|
490752
490424
|
notifications: {
|
|
490753
490425
|
current: null,
|
|
@@ -490876,7 +490548,7 @@ ${inputPrompt}` : mergePrompt;
|
|
|
490876
490548
|
} else if (feature("SSH_REMOTE") && _pendingSSH?.host) {
|
|
490877
490549
|
return await exitWithError(root, "SSH_REMOTE feature not available in this build.", () => gracefulShutdown(1));
|
|
490878
490550
|
}
|
|
490879
|
-
if (options.resume || options.fromPr
|
|
490551
|
+
if (options.resume || options.fromPr) {
|
|
490880
490552
|
await Promise.resolve().then(() => init_caches());
|
|
490881
490553
|
clearSessionCaches();
|
|
490882
490554
|
let messages = null;
|
|
@@ -491010,13 +490682,6 @@ ${inputPrompt}` : mergePrompt;
|
|
|
491010
490682
|
program.addOption(new Option("--parent-session-id <id>", "Parent session ID for analytics correlation").hideHelp());
|
|
491011
490683
|
program.addOption(new Option("--teammate-mode <mode>", 'How to spawn teammates: "tmux", "in-process", or "auto"').choices(["auto", "tmux", "in-process"]).hideHelp());
|
|
491012
490684
|
program.addOption(new Option("--agent-type <type>", "Custom agent type for this teammate").hideHelp());
|
|
491013
|
-
program.addOption(new Option("--sdk-url <url>", "Use remote WebSocket endpoint for SDK I/O streaming (only with -p and stream-json format)").hideHelp());
|
|
491014
|
-
program.addOption(new Option("--teleport [session]", "Resume a teleport session, optionally specify session ID").hideHelp());
|
|
491015
|
-
program.addOption(new Option("--remote [description]", "Create a remote session with the given description").hideHelp());
|
|
491016
|
-
if (feature("BRIDGE_MODE")) {
|
|
491017
|
-
program.addOption(new Option("--remote-control [name]", "Start an interactive session with Remote Control enabled (optionally named)").argParser((value) => value || true).hideHelp());
|
|
491018
|
-
program.addOption(new Option("--rc [name]", "Alias for --remote-control").argParser((value) => value || true).hideHelp());
|
|
491019
|
-
}
|
|
491020
490685
|
if (feature("HARD_FAIL")) {
|
|
491021
490686
|
program.addOption(new Option("--hard-fail", "Crash on logError calls instead of silently logging").hideHelp());
|
|
491022
490687
|
}
|
|
@@ -491426,7 +491091,6 @@ var init_main3 = __esm(() => {
|
|
|
491426
491091
|
init_migrateAutoUpdatesToSettings();
|
|
491427
491092
|
init_migrateBypassPermissionsAcceptedToSettings();
|
|
491428
491093
|
init_migrateEnableAllProjectMcpServersToSettings();
|
|
491429
|
-
init_migrateReplBridgeEnabledToRemoteControlAtStartup();
|
|
491430
491094
|
init_resetAutoModeOptInForDefaultOffer();
|
|
491431
491095
|
init_manager();
|
|
491432
491096
|
init_promptSuggestion();
|