@atlasharness/atlascode 0.1.59 → 0.1.60
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 +483 -335
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -410535,12 +410535,319 @@ var init_reload_plugins2 = __esm(() => {
|
|
|
410535
410535
|
reload_plugins_default = reloadPlugins;
|
|
410536
410536
|
});
|
|
410537
410537
|
|
|
410538
|
+
// src/tui/utils/skills/skillChangeDetector.ts
|
|
410539
|
+
import * as platformPath2 from "path";
|
|
410540
|
+
async function initialize2() {
|
|
410541
|
+
if (initialized5 || disposed3)
|
|
410542
|
+
return;
|
|
410543
|
+
initialized5 = true;
|
|
410544
|
+
if (!dynamicSkillsCallbackRegistered) {
|
|
410545
|
+
dynamicSkillsCallbackRegistered = true;
|
|
410546
|
+
onDynamicSkillsLoaded2(() => {
|
|
410547
|
+
clearCommandMemoizationCaches2();
|
|
410548
|
+
skillsChanged.emit();
|
|
410549
|
+
});
|
|
410550
|
+
}
|
|
410551
|
+
const paths = await getWatchablePaths();
|
|
410552
|
+
if (paths.length === 0)
|
|
410553
|
+
return;
|
|
410554
|
+
logForDebugging3(`Watching for changes in skill/command directories: ${paths.join(", ")}...`);
|
|
410555
|
+
watcher4 = chokidar_default.watch(paths, {
|
|
410556
|
+
persistent: true,
|
|
410557
|
+
ignoreInitial: true,
|
|
410558
|
+
depth: 2,
|
|
410559
|
+
awaitWriteFinish: {
|
|
410560
|
+
stabilityThreshold: testOverrides2?.stabilityThreshold ?? FILE_STABILITY_THRESHOLD_MS3,
|
|
410561
|
+
pollInterval: testOverrides2?.pollInterval ?? FILE_STABILITY_POLL_INTERVAL_MS3
|
|
410562
|
+
},
|
|
410563
|
+
ignored: (path, stats) => {
|
|
410564
|
+
if (stats && !stats.isFile() && !stats.isDirectory())
|
|
410565
|
+
return true;
|
|
410566
|
+
return path.split(platformPath2.sep).some((dir) => dir === ".git");
|
|
410567
|
+
},
|
|
410568
|
+
ignorePermissionErrors: true,
|
|
410569
|
+
usePolling: USE_POLLING,
|
|
410570
|
+
interval: testOverrides2?.chokidarInterval ?? POLLING_INTERVAL_MS,
|
|
410571
|
+
atomic: true
|
|
410572
|
+
});
|
|
410573
|
+
watcher4.on("add", handleChange3);
|
|
410574
|
+
watcher4.on("change", handleChange3);
|
|
410575
|
+
watcher4.on("unlink", handleChange3);
|
|
410576
|
+
unregisterCleanup3 = registerCleanup3(async () => {
|
|
410577
|
+
await dispose3();
|
|
410578
|
+
});
|
|
410579
|
+
}
|
|
410580
|
+
function dispose3() {
|
|
410581
|
+
disposed3 = true;
|
|
410582
|
+
if (unregisterCleanup3) {
|
|
410583
|
+
unregisterCleanup3();
|
|
410584
|
+
unregisterCleanup3 = null;
|
|
410585
|
+
}
|
|
410586
|
+
let closePromise = Promise.resolve();
|
|
410587
|
+
if (watcher4) {
|
|
410588
|
+
closePromise = watcher4.close();
|
|
410589
|
+
watcher4 = null;
|
|
410590
|
+
}
|
|
410591
|
+
if (reloadTimer) {
|
|
410592
|
+
clearTimeout(reloadTimer);
|
|
410593
|
+
reloadTimer = null;
|
|
410594
|
+
}
|
|
410595
|
+
pendingChangedPaths.clear();
|
|
410596
|
+
skillsChanged.clear();
|
|
410597
|
+
return closePromise;
|
|
410598
|
+
}
|
|
410599
|
+
function reloadSkillsNow() {
|
|
410600
|
+
clearSkillCaches2();
|
|
410601
|
+
clearCommandsCache2();
|
|
410602
|
+
resetSentSkillNames();
|
|
410603
|
+
skillsChanged.emit();
|
|
410604
|
+
}
|
|
410605
|
+
async function getWatchablePaths() {
|
|
410606
|
+
const fs = getFsImplementation2();
|
|
410607
|
+
const paths = [];
|
|
410608
|
+
const userSkillsPath = getSkillsPath2("userSettings", "skills");
|
|
410609
|
+
if (userSkillsPath) {
|
|
410610
|
+
try {
|
|
410611
|
+
await fs.stat(userSkillsPath);
|
|
410612
|
+
paths.push(userSkillsPath);
|
|
410613
|
+
} catch {}
|
|
410614
|
+
}
|
|
410615
|
+
const userCommandsPath = getSkillsPath2("userSettings", "commands");
|
|
410616
|
+
if (userCommandsPath) {
|
|
410617
|
+
try {
|
|
410618
|
+
await fs.stat(userCommandsPath);
|
|
410619
|
+
paths.push(userCommandsPath);
|
|
410620
|
+
} catch {}
|
|
410621
|
+
}
|
|
410622
|
+
const projectSkillsPath = getSkillsPath2("projectSettings", "skills");
|
|
410623
|
+
if (projectSkillsPath) {
|
|
410624
|
+
try {
|
|
410625
|
+
const absolutePath = platformPath2.resolve(projectSkillsPath);
|
|
410626
|
+
await fs.stat(absolutePath);
|
|
410627
|
+
paths.push(absolutePath);
|
|
410628
|
+
} catch {}
|
|
410629
|
+
}
|
|
410630
|
+
const projectCommandsPath = getSkillsPath2("projectSettings", "commands");
|
|
410631
|
+
if (projectCommandsPath) {
|
|
410632
|
+
try {
|
|
410633
|
+
const absolutePath = platformPath2.resolve(projectCommandsPath);
|
|
410634
|
+
await fs.stat(absolutePath);
|
|
410635
|
+
paths.push(absolutePath);
|
|
410636
|
+
} catch {}
|
|
410637
|
+
}
|
|
410638
|
+
for (const dir of getAdditionalDirectoriesForClaudeMd()) {
|
|
410639
|
+
const additionalSkillsPath = platformPath2.join(dir, getConfigDirName2(), "skills");
|
|
410640
|
+
try {
|
|
410641
|
+
await fs.stat(additionalSkillsPath);
|
|
410642
|
+
paths.push(additionalSkillsPath);
|
|
410643
|
+
} catch {}
|
|
410644
|
+
}
|
|
410645
|
+
return paths;
|
|
410646
|
+
}
|
|
410647
|
+
function handleChange3(path) {
|
|
410648
|
+
logForDebugging3(`Detected skill change: ${path}`);
|
|
410649
|
+
scheduleReload(path);
|
|
410650
|
+
}
|
|
410651
|
+
function scheduleReload(changedPath) {
|
|
410652
|
+
pendingChangedPaths.add(changedPath);
|
|
410653
|
+
if (reloadTimer)
|
|
410654
|
+
clearTimeout(reloadTimer);
|
|
410655
|
+
reloadTimer = setTimeout(async () => {
|
|
410656
|
+
reloadTimer = null;
|
|
410657
|
+
const paths = [...pendingChangedPaths];
|
|
410658
|
+
pendingChangedPaths.clear();
|
|
410659
|
+
const results = await executeConfigChangeHooks("skills", paths[0]);
|
|
410660
|
+
if (hasBlockingResult(results)) {
|
|
410661
|
+
logForDebugging3(`ConfigChange hook blocked skill reload (${paths.length} paths)`);
|
|
410662
|
+
return;
|
|
410663
|
+
}
|
|
410664
|
+
clearSkillCaches2();
|
|
410665
|
+
clearCommandsCache2();
|
|
410666
|
+
resetSentSkillNames();
|
|
410667
|
+
skillsChanged.emit();
|
|
410668
|
+
}, testOverrides2?.reloadDebounce ?? RELOAD_DEBOUNCE_MS);
|
|
410669
|
+
}
|
|
410670
|
+
async function resetForTesting2(overrides) {
|
|
410671
|
+
if (watcher4) {
|
|
410672
|
+
await watcher4.close();
|
|
410673
|
+
watcher4 = null;
|
|
410674
|
+
}
|
|
410675
|
+
if (reloadTimer) {
|
|
410676
|
+
clearTimeout(reloadTimer);
|
|
410677
|
+
reloadTimer = null;
|
|
410678
|
+
}
|
|
410679
|
+
pendingChangedPaths.clear();
|
|
410680
|
+
skillsChanged.clear();
|
|
410681
|
+
initialized5 = false;
|
|
410682
|
+
disposed3 = false;
|
|
410683
|
+
testOverrides2 = overrides ?? null;
|
|
410684
|
+
}
|
|
410685
|
+
var FILE_STABILITY_THRESHOLD_MS3 = 1000, FILE_STABILITY_POLL_INTERVAL_MS3 = 500, RELOAD_DEBOUNCE_MS = 300, POLLING_INTERVAL_MS = 2000, USE_POLLING, watcher4 = null, reloadTimer = null, pendingChangedPaths, initialized5 = false, disposed3 = false, dynamicSkillsCallbackRegistered = false, unregisterCleanup3 = null, skillsChanged, testOverrides2 = null, subscribe3, skillChangeDetector;
|
|
410686
|
+
var init_skillChangeDetector = __esm(() => {
|
|
410687
|
+
init_chokidar();
|
|
410688
|
+
init_configDir();
|
|
410689
|
+
init_bootstrapState();
|
|
410690
|
+
init_commands5();
|
|
410691
|
+
init_loadSkillsDir2();
|
|
410692
|
+
init_attachments();
|
|
410693
|
+
init_cleanupRegistry3();
|
|
410694
|
+
init_debug();
|
|
410695
|
+
init_fsOperations();
|
|
410696
|
+
init_hooks7();
|
|
410697
|
+
USE_POLLING = typeof Bun !== "undefined";
|
|
410698
|
+
pendingChangedPaths = new Set;
|
|
410699
|
+
skillsChanged = createSignal3();
|
|
410700
|
+
subscribe3 = skillsChanged.subscribe;
|
|
410701
|
+
skillChangeDetector = {
|
|
410702
|
+
initialize: initialize2,
|
|
410703
|
+
dispose: dispose3,
|
|
410704
|
+
subscribe: subscribe3,
|
|
410705
|
+
resetForTesting: resetForTesting2
|
|
410706
|
+
};
|
|
410707
|
+
});
|
|
410708
|
+
|
|
410709
|
+
// src/tui/commands/reload-skills/reload-skills.ts
|
|
410710
|
+
var exports_reload_skills = {};
|
|
410711
|
+
__export(exports_reload_skills, {
|
|
410712
|
+
call: () => call45
|
|
410713
|
+
});
|
|
410714
|
+
var call45 = async (_args, _context) => {
|
|
410715
|
+
reloadSkillsNow();
|
|
410716
|
+
return {
|
|
410717
|
+
type: "text",
|
|
410718
|
+
value: "Re-scanned skill directories; in-session skill registry refreshed (new/removed/changed skills now active without restart)."
|
|
410719
|
+
};
|
|
410720
|
+
};
|
|
410721
|
+
var init_reload_skills = __esm(() => {
|
|
410722
|
+
init_skillChangeDetector();
|
|
410723
|
+
});
|
|
410724
|
+
|
|
410725
|
+
// src/tui/commands/reload-skills/index.ts
|
|
410726
|
+
var reloadSkills, reload_skills_default;
|
|
410727
|
+
var init_reload_skills2 = __esm(() => {
|
|
410728
|
+
reloadSkills = {
|
|
410729
|
+
type: "local",
|
|
410730
|
+
name: "reload-skills",
|
|
410731
|
+
description: "Re-scan skill directories and refresh the in-session skill registry",
|
|
410732
|
+
supportsNonInteractive: false,
|
|
410733
|
+
load: () => Promise.resolve().then(() => (init_reload_skills(), exports_reload_skills))
|
|
410734
|
+
};
|
|
410735
|
+
reload_skills_default = reloadSkills;
|
|
410736
|
+
});
|
|
410737
|
+
|
|
410738
|
+
// src/tui/commands/cd/cd.ts
|
|
410739
|
+
var exports_cd = {};
|
|
410740
|
+
__export(exports_cd, {
|
|
410741
|
+
call: () => call46
|
|
410742
|
+
});
|
|
410743
|
+
var USAGE2 = "Usage: /cd [path] (no argument = show current session cwd)", call46 = async (_args, _context) => {
|
|
410744
|
+
const arg = (_args ?? "").trim();
|
|
410745
|
+
if (arg === "") {
|
|
410746
|
+
return {
|
|
410747
|
+
type: "text",
|
|
410748
|
+
value: `Session working directory: ${pwd()}
|
|
410749
|
+
${USAGE2}`
|
|
410750
|
+
};
|
|
410751
|
+
}
|
|
410752
|
+
try {
|
|
410753
|
+
setCwd2(arg, pwd());
|
|
410754
|
+
return {
|
|
410755
|
+
type: "text",
|
|
410756
|
+
value: `Session working directory changed to: ${pwd()}`
|
|
410757
|
+
};
|
|
410758
|
+
} catch (e) {
|
|
410759
|
+
return {
|
|
410760
|
+
type: "text",
|
|
410761
|
+
value: `cd failed: ${e instanceof Error ? e.message : String(e)}`
|
|
410762
|
+
};
|
|
410763
|
+
}
|
|
410764
|
+
};
|
|
410765
|
+
var init_cd = __esm(() => {
|
|
410766
|
+
init_cwd3();
|
|
410767
|
+
init_Shell2();
|
|
410768
|
+
});
|
|
410769
|
+
|
|
410770
|
+
// src/tui/commands/cd/index.ts
|
|
410771
|
+
var cd, cd_default;
|
|
410772
|
+
var init_cd2 = __esm(() => {
|
|
410773
|
+
cd = {
|
|
410774
|
+
type: "local",
|
|
410775
|
+
name: "cd",
|
|
410776
|
+
description: "Change the session working directory (without breaking the prompt cache)",
|
|
410777
|
+
supportsNonInteractive: false,
|
|
410778
|
+
argumentHint: "[path]",
|
|
410779
|
+
load: () => Promise.resolve().then(() => (init_cd(), exports_cd))
|
|
410780
|
+
};
|
|
410781
|
+
cd_default = cd;
|
|
410782
|
+
});
|
|
410783
|
+
|
|
410784
|
+
// src/tui/commands/output-style/output-style.ts
|
|
410785
|
+
var exports_output_style = {};
|
|
410786
|
+
__export(exports_output_style, {
|
|
410787
|
+
call: () => call47
|
|
410788
|
+
});
|
|
410789
|
+
var USAGE3 = "Usage: /output-style [name] (no argument = current + available)", call47 = async (_args, _context) => {
|
|
410790
|
+
const arg = (_args ?? "").trim();
|
|
410791
|
+
const allStyles = await getAllOutputStyles(getCwd());
|
|
410792
|
+
const available = Object.keys(allStyles);
|
|
410793
|
+
if (arg === "") {
|
|
410794
|
+
const current = (await getOutputStyleConfig())?.name ?? DEFAULT_OUTPUT_STYLE_NAME;
|
|
410795
|
+
return {
|
|
410796
|
+
type: "text",
|
|
410797
|
+
value: `Current output style: ${current}
|
|
410798
|
+
Available: ${available.join(", ")}
|
|
410799
|
+
${USAGE3}`
|
|
410800
|
+
};
|
|
410801
|
+
}
|
|
410802
|
+
if (!available.includes(arg)) {
|
|
410803
|
+
return {
|
|
410804
|
+
type: "text",
|
|
410805
|
+
value: `Invalid /output-style "${arg}". Available: ${available.join(", ")}`
|
|
410806
|
+
};
|
|
410807
|
+
}
|
|
410808
|
+
const { error } = updateSettingsForSource2("userSettings", {
|
|
410809
|
+
outputStyle: arg
|
|
410810
|
+
});
|
|
410811
|
+
if (error) {
|
|
410812
|
+
return {
|
|
410813
|
+
type: "text",
|
|
410814
|
+
value: `Failed to persist output style "${arg}": ${error.message}`
|
|
410815
|
+
};
|
|
410816
|
+
}
|
|
410817
|
+
clearAllOutputStylesCache();
|
|
410818
|
+
clearSystemPromptSections();
|
|
410819
|
+
return {
|
|
410820
|
+
type: "text",
|
|
410821
|
+
value: arg === DEFAULT_OUTPUT_STYLE_NAME ? "Output style set to default (in-session switch, no restart)." : `Output style switched to "${arg}" (in-session switch, no restart).`
|
|
410822
|
+
};
|
|
410823
|
+
};
|
|
410824
|
+
var init_output_style = __esm(() => {
|
|
410825
|
+
init_outputStyles();
|
|
410826
|
+
init_systemPromptSections();
|
|
410827
|
+
init_settings3();
|
|
410828
|
+
init_cwd3();
|
|
410829
|
+
});
|
|
410830
|
+
|
|
410831
|
+
// src/tui/commands/output-style/index.ts
|
|
410832
|
+
var outputStyle, output_style_default;
|
|
410833
|
+
var init_output_style2 = __esm(() => {
|
|
410834
|
+
outputStyle = {
|
|
410835
|
+
type: "local",
|
|
410836
|
+
name: "output-style",
|
|
410837
|
+
description: "Show or switch the output style (no argument = current + available list)",
|
|
410838
|
+
supportsNonInteractive: false,
|
|
410839
|
+
argumentHint: "[name]",
|
|
410840
|
+
load: () => Promise.resolve().then(() => (init_output_style(), exports_output_style))
|
|
410841
|
+
};
|
|
410842
|
+
output_style_default = outputStyle;
|
|
410843
|
+
});
|
|
410844
|
+
|
|
410538
410845
|
// src/tui/commands/rewind/rewind.ts
|
|
410539
410846
|
var exports_rewind = {};
|
|
410540
410847
|
__export(exports_rewind, {
|
|
410541
|
-
call: () =>
|
|
410848
|
+
call: () => call48
|
|
410542
410849
|
});
|
|
410543
|
-
async function
|
|
410850
|
+
async function call48(_args, context) {
|
|
410544
410851
|
if (context.openMessageSelector) {
|
|
410545
410852
|
context.openMessageSelector();
|
|
410546
410853
|
}
|
|
@@ -410565,7 +410872,7 @@ var init_rewind = __esm(() => {
|
|
|
410565
410872
|
// src/tui/utils/heapDumpService.ts
|
|
410566
410873
|
import { createWriteStream as createWriteStream3, writeFileSync as writeFileSync8 } from "fs";
|
|
410567
410874
|
import { readdir as readdir30, readFile as readFile57, writeFile as writeFile42 } from "fs/promises";
|
|
410568
|
-
import { join as
|
|
410875
|
+
import { join as join151 } from "path";
|
|
410569
410876
|
import { pipeline as pipeline2 } from "stream/promises";
|
|
410570
410877
|
import {
|
|
410571
410878
|
getHeapSnapshot,
|
|
@@ -410673,8 +410980,8 @@ async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
|
410673
410980
|
const suffix = dumpNumber > 0 ? `-dump${dumpNumber}` : "";
|
|
410674
410981
|
const heapFilename = `${sessionId}${suffix}.heapsnapshot`;
|
|
410675
410982
|
const diagFilename = `${sessionId}${suffix}-diagnostics.json`;
|
|
410676
|
-
const heapPath =
|
|
410677
|
-
const diagPath =
|
|
410983
|
+
const heapPath = join151(dumpDir, heapFilename);
|
|
410984
|
+
const diagPath = join151(dumpDir, diagFilename);
|
|
410678
410985
|
await writeFile42(diagPath, jsonStringify5(diagnostics, null, 2), {
|
|
410679
410986
|
mode: 384
|
|
410680
410987
|
});
|
|
@@ -410713,9 +411020,9 @@ var init_heapDumpService = __esm(() => {
|
|
|
410713
411020
|
// src/tui/commands/heapdump/heapdump.ts
|
|
410714
411021
|
var exports_heapdump = {};
|
|
410715
411022
|
__export(exports_heapdump, {
|
|
410716
|
-
call: () =>
|
|
411023
|
+
call: () => call49
|
|
410717
411024
|
});
|
|
410718
|
-
async function
|
|
411025
|
+
async function call49() {
|
|
410719
411026
|
const result = await performHeapDump();
|
|
410720
411027
|
if (!result.success) {
|
|
410721
411028
|
return {
|
|
@@ -410748,7 +411055,7 @@ var init_heapdump2 = __esm(() => {
|
|
|
410748
411055
|
});
|
|
410749
411056
|
|
|
410750
411057
|
// src/tui/commands/version.ts
|
|
410751
|
-
var
|
|
411058
|
+
var call50 = async () => {
|
|
410752
411059
|
return {
|
|
410753
411060
|
type: "text",
|
|
410754
411061
|
value: MACRO.BUILD_TIME ? `${MACRO.VERSION} (built ${MACRO.BUILD_TIME})` : MACRO.VERSION
|
|
@@ -410761,7 +411068,7 @@ var init_version = __esm(() => {
|
|
|
410761
411068
|
description: "Print the version this session is running (not what autoupdate downloaded)",
|
|
410762
411069
|
isEnabled: () => true,
|
|
410763
411070
|
supportsNonInteractive: true,
|
|
410764
|
-
load: () => Promise.resolve({ call:
|
|
411071
|
+
load: () => Promise.resolve({ call: call50 })
|
|
410765
411072
|
};
|
|
410766
411073
|
version_default = version2;
|
|
410767
411074
|
});
|
|
@@ -411867,10 +412174,10 @@ var init_SandboxSettings = __esm(() => {
|
|
|
411867
412174
|
// src/tui/commands/sandbox-toggle/sandbox-toggle.tsx
|
|
411868
412175
|
var exports_sandbox_toggle = {};
|
|
411869
412176
|
__export(exports_sandbox_toggle, {
|
|
411870
|
-
call: () =>
|
|
412177
|
+
call: () => call51
|
|
411871
412178
|
});
|
|
411872
412179
|
import { relative as relative28 } from "path";
|
|
411873
|
-
async function
|
|
412180
|
+
async function call51(onDone, _context, args) {
|
|
411874
412181
|
const settings = getSettings_DEPRECATED();
|
|
411875
412182
|
const themeName = settings.theme || "light";
|
|
411876
412183
|
const platform = getPlatform3();
|
|
@@ -411977,9 +412284,9 @@ var init_sandbox_toggle2 = __esm(() => {
|
|
|
411977
412284
|
// src/tui/commands/stickers/stickers.ts
|
|
411978
412285
|
var exports_stickers = {};
|
|
411979
412286
|
__export(exports_stickers, {
|
|
411980
|
-
call: () =>
|
|
412287
|
+
call: () => call52
|
|
411981
412288
|
});
|
|
411982
|
-
async function
|
|
412289
|
+
async function call52() {
|
|
411983
412290
|
const url = "https://www.stickermule.com/claudecode";
|
|
411984
412291
|
const success = await openBrowser(url);
|
|
411985
412292
|
if (success) {
|
|
@@ -412011,7 +412318,7 @@ var init_stickers2 = __esm(() => {
|
|
|
412011
412318
|
// src/tui/skills/bundledSkills.ts
|
|
412012
412319
|
import { constants as fsConstants8 } from "fs";
|
|
412013
412320
|
import { mkdir as mkdir47, open as open16 } from "fs/promises";
|
|
412014
|
-
import { dirname as dirname74, isAbsolute as isAbsolute32, join as
|
|
412321
|
+
import { dirname as dirname74, isAbsolute as isAbsolute32, join as join152, normalize as normalize14, sep as pathSep3 } from "path";
|
|
412015
412322
|
function registerBundledSkill2(definition) {
|
|
412016
412323
|
const { files } = definition;
|
|
412017
412324
|
let skillRoot;
|
|
@@ -412059,7 +412366,7 @@ function getBundledSkills2() {
|
|
|
412059
412366
|
return [...bundledSkills2];
|
|
412060
412367
|
}
|
|
412061
412368
|
function getBundledSkillExtractDir2(skillName) {
|
|
412062
|
-
return
|
|
412369
|
+
return join152(getBundledSkillsRoot2(), skillName);
|
|
412063
412370
|
}
|
|
412064
412371
|
async function extractBundledSkillFiles(skillName, files) {
|
|
412065
412372
|
const dir = getBundledSkillExtractDir2(skillName);
|
|
@@ -412101,7 +412408,7 @@ function resolveSkillFilePath(baseDir, relPath) {
|
|
|
412101
412408
|
if (isAbsolute32(normalized) || normalized.split(pathSep3).includes("..") || normalized.split("/").includes("..")) {
|
|
412102
412409
|
throw new Error(`bundled skill file path escapes skill dir: ${relPath}`);
|
|
412103
412410
|
}
|
|
412104
|
-
return
|
|
412411
|
+
return join152(baseDir, normalized);
|
|
412105
412412
|
}
|
|
412106
412413
|
function prependBaseDir(blocks, baseDir) {
|
|
412107
412414
|
const prefix = `Base directory for this skill: ${baseDir}
|
|
@@ -412397,9 +412704,9 @@ var init_ExitFlow = __esm(() => {
|
|
|
412397
412704
|
|
|
412398
412705
|
// src/tui/utils/concurrentSessions.ts
|
|
412399
412706
|
import { chmod as chmod8, mkdir as mkdir48, readdir as readdir31, readFile as readFile58, unlink as unlink21, writeFile as writeFile43 } from "fs/promises";
|
|
412400
|
-
import { join as
|
|
412707
|
+
import { join as join153 } from "path";
|
|
412401
412708
|
function getSessionsDir() {
|
|
412402
|
-
return
|
|
412709
|
+
return join153(getAtlasConfigHomeDir3(), "sessions");
|
|
412403
412710
|
}
|
|
412404
412711
|
function envSessionKind() {
|
|
412405
412712
|
if (feature("BG_SESSIONS")) {
|
|
@@ -412417,7 +412724,7 @@ async function registerSession2() {
|
|
|
412417
412724
|
return false;
|
|
412418
412725
|
const kind = envSessionKind() ?? "interactive";
|
|
412419
412726
|
const dir = getSessionsDir();
|
|
412420
|
-
const pidFile =
|
|
412727
|
+
const pidFile = join153(dir, `${process.pid}.json`);
|
|
412421
412728
|
registerCleanup3(async () => {
|
|
412422
412729
|
try {
|
|
412423
412730
|
await unlink21(pidFile);
|
|
@@ -412450,7 +412757,7 @@ async function registerSession2() {
|
|
|
412450
412757
|
}
|
|
412451
412758
|
}
|
|
412452
412759
|
async function updatePidFile(patch) {
|
|
412453
|
-
const pidFile =
|
|
412760
|
+
const pidFile = join153(getSessionsDir(), `${process.pid}.json`);
|
|
412454
412761
|
try {
|
|
412455
412762
|
const data = jsonParse2(await readFile58(pidFile, "utf8"));
|
|
412456
412763
|
await writeFile43(pidFile, jsonStringify5({ ...data, ...patch }));
|
|
@@ -412491,7 +412798,7 @@ async function countConcurrentSessions2() {
|
|
|
412491
412798
|
if (isProcessRunning2(pid)) {
|
|
412492
412799
|
count++;
|
|
412493
412800
|
} else if (getPlatform3() !== "wsl") {
|
|
412494
|
-
unlink21(
|
|
412801
|
+
unlink21(join153(dir, file)).catch(() => {});
|
|
412495
412802
|
}
|
|
412496
412803
|
}
|
|
412497
412804
|
return count;
|
|
@@ -412513,13 +412820,13 @@ var init_concurrentSessions2 = __esm(() => {
|
|
|
412513
412820
|
// src/tui/commands/exit/exit.tsx
|
|
412514
412821
|
var exports_exit = {};
|
|
412515
412822
|
__export(exports_exit, {
|
|
412516
|
-
call: () =>
|
|
412823
|
+
call: () => call53
|
|
412517
412824
|
});
|
|
412518
412825
|
import { spawnSync as spawnSync5 } from "child_process";
|
|
412519
412826
|
function getRandomGoodbyeMessage2() {
|
|
412520
412827
|
return sample_default(GOODBYE_MESSAGES2) ?? "Goodbye!";
|
|
412521
412828
|
}
|
|
412522
|
-
async function
|
|
412829
|
+
async function call53(onDone) {
|
|
412523
412830
|
if (feature("BG_SESSIONS") && isBgSession2()) {
|
|
412524
412831
|
onDone();
|
|
412525
412832
|
spawnSync5("tmux", ["detach-client"], {
|
|
@@ -412566,7 +412873,7 @@ var init_exit2 = __esm(() => {
|
|
|
412566
412873
|
});
|
|
412567
412874
|
|
|
412568
412875
|
// src/tui/components/ExportDialog.tsx
|
|
412569
|
-
import { join as
|
|
412876
|
+
import { join as join154 } from "path";
|
|
412570
412877
|
function ExportDialog({
|
|
412571
412878
|
content,
|
|
412572
412879
|
defaultFilename,
|
|
@@ -412599,7 +412906,7 @@ function ExportDialog({
|
|
|
412599
412906
|
};
|
|
412600
412907
|
const handleFilenameSubmit = () => {
|
|
412601
412908
|
const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt";
|
|
412602
|
-
const filepath =
|
|
412909
|
+
const filepath = join154(getCwd(), finalFilename);
|
|
412603
412910
|
try {
|
|
412604
412911
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
412605
412912
|
encoding: "utf-8",
|
|
@@ -412818,11 +413125,11 @@ var init_exportRenderer = __esm(() => {
|
|
|
412818
413125
|
// src/tui/commands/export/export.tsx
|
|
412819
413126
|
var exports_export = {};
|
|
412820
413127
|
__export(exports_export, {
|
|
412821
|
-
call: () =>
|
|
413128
|
+
call: () => call54,
|
|
412822
413129
|
extractFirstPrompt: () => extractFirstPrompt2,
|
|
412823
413130
|
sanitizeFilename: () => sanitizeFilename
|
|
412824
413131
|
});
|
|
412825
|
-
import { join as
|
|
413132
|
+
import { join as join155 } from "path";
|
|
412826
413133
|
function formatTimestamp(date) {
|
|
412827
413134
|
const year = date.getFullYear();
|
|
412828
413135
|
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
@@ -412861,12 +413168,12 @@ async function exportWithReactRenderer(context) {
|
|
|
412861
413168
|
const tools = context.options.tools || [];
|
|
412862
413169
|
return renderMessagesToPlainText(context.messages, tools);
|
|
412863
413170
|
}
|
|
412864
|
-
async function
|
|
413171
|
+
async function call54(onDone, context, args) {
|
|
412865
413172
|
const content = await exportWithReactRenderer(context);
|
|
412866
413173
|
const filename = args.trim();
|
|
412867
413174
|
if (filename) {
|
|
412868
413175
|
const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt";
|
|
412869
|
-
const filepath =
|
|
413176
|
+
const filepath = join155(getCwd(), finalFilename);
|
|
412870
413177
|
try {
|
|
412871
413178
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
412872
413179
|
encoding: "utf-8",
|
|
@@ -412951,7 +413258,7 @@ var init_modelSwitchHooks = __esm(() => {
|
|
|
412951
413258
|
// src/tui/commands/model/model.tsx
|
|
412952
413259
|
var exports_model = {};
|
|
412953
413260
|
__export(exports_model, {
|
|
412954
|
-
call: () =>
|
|
413261
|
+
call: () => call55
|
|
412955
413262
|
});
|
|
412956
413263
|
function ModelPickerWrapper(t0) {
|
|
412957
413264
|
const $ = import_compiler_runtime237.c(17);
|
|
@@ -413133,7 +413440,7 @@ function renderModelLabel(model) {
|
|
|
413133
413440
|
const rendered = renderDefaultModelSetting(model ?? getDefaultMainLoopModelSetting());
|
|
413134
413441
|
return model === null ? `${rendered} (default)` : rendered;
|
|
413135
413442
|
}
|
|
413136
|
-
var import_compiler_runtime237, React90, jsx_dev_runtime306,
|
|
413443
|
+
var import_compiler_runtime237, React90, jsx_dev_runtime306, call55 = async (onDone, _context, args) => {
|
|
413137
413444
|
args = args?.trim() || "";
|
|
413138
413445
|
if (COMMON_INFO_ARGS.includes(args)) {
|
|
413139
413446
|
return /* @__PURE__ */ jsx_dev_runtime306.jsxDEV(ShowModelAndClose, {
|
|
@@ -413193,7 +413500,7 @@ var init_model3 = __esm(() => {
|
|
|
413193
413500
|
// src/tui/commands/tag/tag.tsx
|
|
413194
413501
|
var exports_tag = {};
|
|
413195
413502
|
__export(exports_tag, {
|
|
413196
|
-
call: () =>
|
|
413503
|
+
call: () => call56
|
|
413197
413504
|
});
|
|
413198
413505
|
function ConfirmRemoveTag(t0) {
|
|
413199
413506
|
const $ = import_compiler_runtime238.c(11);
|
|
@@ -413411,7 +413718,7 @@ Examples:
|
|
|
413411
413718
|
React91.useEffect(t1, t2);
|
|
413412
413719
|
return null;
|
|
413413
413720
|
}
|
|
413414
|
-
async function
|
|
413721
|
+
async function call56(onDone, _context, args) {
|
|
413415
413722
|
args = args?.trim() || "";
|
|
413416
413723
|
if (COMMON_INFO_ARGS.includes(args) || COMMON_HELP_ARGS.includes(args)) {
|
|
413417
413724
|
return /* @__PURE__ */ jsx_dev_runtime307.jsxDEV(ShowHelp, {
|
|
@@ -413483,7 +413790,7 @@ var init_sessionlist = __esm(() => {
|
|
|
413483
413790
|
// src/tui/commands/effort/effort.tsx
|
|
413484
413791
|
var exports_effort = {};
|
|
413485
413792
|
__export(exports_effort, {
|
|
413486
|
-
call: () =>
|
|
413793
|
+
call: () => call57,
|
|
413487
413794
|
executeEffort: () => executeEffort,
|
|
413488
413795
|
showCurrentEffort: () => showCurrentEffort
|
|
413489
413796
|
});
|
|
@@ -413632,7 +413939,7 @@ function ApplyEffortAndClose(t0) {
|
|
|
413632
413939
|
React92.useEffect(t1, t2);
|
|
413633
413940
|
return null;
|
|
413634
413941
|
}
|
|
413635
|
-
async function
|
|
413942
|
+
async function call57(onDone, _context, args) {
|
|
413636
413943
|
args = args?.trim() || "";
|
|
413637
413944
|
if (COMMON_HELP_ARGS2.includes(args)) {
|
|
413638
413945
|
onDone(`Usage: /effort [low|medium|high|xhigh|max|auto]
|
|
@@ -413784,7 +414091,7 @@ var require_asciichart = __commonJS(function(exports) {
|
|
|
413784
414091
|
// src/tui/utils/statsCache.ts
|
|
413785
414092
|
import { randomBytes as randomBytes20 } from "crypto";
|
|
413786
414093
|
import { open as open17 } from "fs/promises";
|
|
413787
|
-
import { join as
|
|
414094
|
+
import { join as join156 } from "path";
|
|
413788
414095
|
async function withStatsCacheLock(fn) {
|
|
413789
414096
|
while (statsCacheLockPromise) {
|
|
413790
414097
|
await statsCacheLockPromise;
|
|
@@ -413801,7 +414108,7 @@ async function withStatsCacheLock(fn) {
|
|
|
413801
414108
|
}
|
|
413802
414109
|
}
|
|
413803
414110
|
function getStatsCachePath() {
|
|
413804
|
-
return
|
|
414111
|
+
return join156(getAtlasConfigHomeDir3(), STATS_CACHE_FILENAME);
|
|
413805
414112
|
}
|
|
413806
414113
|
function getEmptyCache() {
|
|
413807
414114
|
return {
|
|
@@ -414484,12 +414791,12 @@ var init_ansiToPng = __esm(() => {
|
|
|
414484
414791
|
// src/tui/utils/screenshotClipboard.ts
|
|
414485
414792
|
import { mkdir as mkdir49, unlink as unlink22, writeFile as writeFile44 } from "fs/promises";
|
|
414486
414793
|
import { tmpdir as tmpdir10 } from "os";
|
|
414487
|
-
import { join as
|
|
414794
|
+
import { join as join157 } from "path";
|
|
414488
414795
|
async function copyAnsiToClipboard(ansiText, options) {
|
|
414489
414796
|
try {
|
|
414490
|
-
const tempDir =
|
|
414797
|
+
const tempDir = join157(tmpdir10(), "atlas-screenshots");
|
|
414491
414798
|
await mkdir49(tempDir, { recursive: true });
|
|
414492
|
-
const pngPath =
|
|
414799
|
+
const pngPath = join157(tempDir, `screenshot-${Date.now()}.png`);
|
|
414493
414800
|
const pngBuffer = ansiToPng(ansiText, options);
|
|
414494
414801
|
await writeFile44(pngPath, pngBuffer);
|
|
414495
414802
|
const result = await copyPngToClipboard(pngPath);
|
|
@@ -414560,7 +414867,7 @@ var init_screenshotClipboard = __esm(() => {
|
|
|
414560
414867
|
|
|
414561
414868
|
// src/tui/utils/stats.ts
|
|
414562
414869
|
import { open as open18 } from "fs/promises";
|
|
414563
|
-
import { basename as basename46, dirname as dirname75, join as
|
|
414870
|
+
import { basename as basename46, dirname as dirname75, join as join158, sep as sep34 } from "path";
|
|
414564
414871
|
async function processSessionFiles(sessionFiles, options = {}) {
|
|
414565
414872
|
const { fromDate, toDate } = options;
|
|
414566
414873
|
const fs = getFsImplementation2();
|
|
@@ -414629,7 +414936,7 @@ async function processSessionFiles(sessionFiles, options = {}) {
|
|
|
414629
414936
|
}
|
|
414630
414937
|
if (messages.length === 0)
|
|
414631
414938
|
continue;
|
|
414632
|
-
const isSubagentFile = sessionFile.includes(`${
|
|
414939
|
+
const isSubagentFile = sessionFile.includes(`${sep34}subagents${sep34}`);
|
|
414633
414940
|
if (feature("SHOT_STATS") && shotDistributionMap) {
|
|
414634
414941
|
const parentSessionId = isSubagentFile ? basename46(dirname75(dirname75(sessionFile))) : sessionId;
|
|
414635
414942
|
if (!sessionsWithShotCount.has(parentSessionId)) {
|
|
@@ -414746,17 +415053,17 @@ async function getAllSessionFiles() {
|
|
|
414746
415053
|
return [];
|
|
414747
415054
|
throw e;
|
|
414748
415055
|
}
|
|
414749
|
-
const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
415056
|
+
const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) => join158(projectsDir, dirent.name));
|
|
414750
415057
|
const projectResults = await Promise.all(projectDirs.map(async (projectDir) => {
|
|
414751
415058
|
try {
|
|
414752
415059
|
const entries = await fs.readdir(projectDir);
|
|
414753
|
-
const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) =>
|
|
415060
|
+
const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) => join158(projectDir, dirent.name));
|
|
414754
415061
|
const sessionDirs = entries.filter((dirent) => dirent.isDirectory());
|
|
414755
415062
|
const subagentResults = await Promise.all(sessionDirs.map(async (sessionDir) => {
|
|
414756
|
-
const subagentsDir =
|
|
415063
|
+
const subagentsDir = join158(projectDir, sessionDir.name, "subagents");
|
|
414757
415064
|
try {
|
|
414758
415065
|
const subagentEntries = await fs.readdir(subagentsDir);
|
|
414759
|
-
return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) =>
|
|
415066
|
+
return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) => join158(subagentsDir, dirent.name));
|
|
414760
415067
|
} catch {
|
|
414761
415068
|
return [];
|
|
414762
415069
|
}
|
|
@@ -416656,9 +416963,9 @@ var init_Stats = __esm(() => {
|
|
|
416656
416963
|
// src/tui/commands/stats/stats.tsx
|
|
416657
416964
|
var exports_stats = {};
|
|
416658
416965
|
__export(exports_stats, {
|
|
416659
|
-
call: () =>
|
|
416966
|
+
call: () => call58
|
|
416660
416967
|
});
|
|
416661
|
-
var jsx_dev_runtime310,
|
|
416968
|
+
var jsx_dev_runtime310, call58 = async (onDone) => {
|
|
416662
416969
|
return /* @__PURE__ */ jsx_dev_runtime310.jsxDEV(Stats2, {
|
|
416663
416970
|
onClose: onDone
|
|
416664
416971
|
}, undefined, false, undefined, this);
|
|
@@ -417410,9 +417717,9 @@ var init_useVoice = __esm(() => {
|
|
|
417410
417717
|
// src/tui/commands/voice/voice.ts
|
|
417411
417718
|
var exports_voice3 = {};
|
|
417412
417719
|
__export(exports_voice3, {
|
|
417413
|
-
call: () =>
|
|
417720
|
+
call: () => call59
|
|
417414
417721
|
});
|
|
417415
|
-
var LANG_HINT_MAX_SHOWS = 2,
|
|
417722
|
+
var LANG_HINT_MAX_SHOWS = 2, call59 = async () => {
|
|
417416
417723
|
if (!isVoiceModeEnabled()) {
|
|
417417
417724
|
return {
|
|
417418
417725
|
type: "text",
|
|
@@ -417611,7 +417918,7 @@ import {
|
|
|
417611
417918
|
unlink as unlink23,
|
|
417612
417919
|
writeFile as writeFile45
|
|
417613
417920
|
} from "fs/promises";
|
|
417614
|
-
import { extname as extname16, join as
|
|
417921
|
+
import { extname as extname16, join as join159 } from "path";
|
|
417615
417922
|
function getAnalysisModel() {
|
|
417616
417923
|
return getDefaultPremiumModel();
|
|
417617
417924
|
}
|
|
@@ -417619,13 +417926,13 @@ function getInsightsModel() {
|
|
|
417619
417926
|
return getDefaultPremiumModel();
|
|
417620
417927
|
}
|
|
417621
417928
|
function getDataDir() {
|
|
417622
|
-
return
|
|
417929
|
+
return join159(getAtlasConfigHomeDir3(), "usage-data");
|
|
417623
417930
|
}
|
|
417624
417931
|
function getFacetsDir() {
|
|
417625
|
-
return
|
|
417932
|
+
return join159(getDataDir(), "facets");
|
|
417626
417933
|
}
|
|
417627
417934
|
function getSessionMetaDir() {
|
|
417628
|
-
return
|
|
417935
|
+
return join159(getDataDir(), "session-meta");
|
|
417629
417936
|
}
|
|
417630
417937
|
function getLanguageFromPath(filePath) {
|
|
417631
417938
|
const ext = extname16(filePath).toLowerCase();
|
|
@@ -417966,7 +418273,7 @@ async function formatTranscriptWithSummarization(log) {
|
|
|
417966
418273
|
`);
|
|
417967
418274
|
}
|
|
417968
418275
|
async function loadCachedFacets(sessionId) {
|
|
417969
|
-
const facetPath =
|
|
418276
|
+
const facetPath = join159(getFacetsDir(), `${sessionId}.json`);
|
|
417970
418277
|
try {
|
|
417971
418278
|
const content = await readFile59(facetPath, { encoding: "utf-8" });
|
|
417972
418279
|
const parsed = jsonParse2(content);
|
|
@@ -417985,14 +418292,14 @@ async function saveFacets(facets) {
|
|
|
417985
418292
|
try {
|
|
417986
418293
|
await mkdir50(getFacetsDir(), { recursive: true });
|
|
417987
418294
|
} catch {}
|
|
417988
|
-
const facetPath =
|
|
418295
|
+
const facetPath = join159(getFacetsDir(), `${facets.session_id}.json`);
|
|
417989
418296
|
await writeFile45(facetPath, jsonStringify5(facets, null, 2), {
|
|
417990
418297
|
encoding: "utf-8",
|
|
417991
418298
|
mode: 384
|
|
417992
418299
|
});
|
|
417993
418300
|
}
|
|
417994
418301
|
async function loadCachedSessionMeta(sessionId) {
|
|
417995
|
-
const metaPath =
|
|
418302
|
+
const metaPath = join159(getSessionMetaDir(), `${sessionId}.json`);
|
|
417996
418303
|
try {
|
|
417997
418304
|
const content = await readFile59(metaPath, { encoding: "utf-8" });
|
|
417998
418305
|
return jsonParse2(content);
|
|
@@ -418004,7 +418311,7 @@ async function saveSessionMeta(meta) {
|
|
|
418004
418311
|
try {
|
|
418005
418312
|
await mkdir50(getSessionMetaDir(), { recursive: true });
|
|
418006
418313
|
} catch {}
|
|
418007
|
-
const metaPath =
|
|
418314
|
+
const metaPath = join159(getSessionMetaDir(), `${meta.session_id}.json`);
|
|
418008
418315
|
await writeFile45(metaPath, jsonStringify5(meta, null, 2), {
|
|
418009
418316
|
encoding: "utf-8",
|
|
418010
418317
|
mode: 384
|
|
@@ -419084,7 +419391,7 @@ async function scanAllSessions() {
|
|
|
419084
419391
|
} catch {
|
|
419085
419392
|
return [];
|
|
419086
419393
|
}
|
|
419087
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
419394
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join159(projectsDir, dirent.name));
|
|
419088
419395
|
const allSessions = [];
|
|
419089
419396
|
for (let i = 0;i < projectDirs.length; i++) {
|
|
419090
419397
|
const sessionFiles = await getSessionFilesWithMtime(projectDirs[i]);
|
|
@@ -419240,7 +419547,7 @@ async function generateUsageReport(options) {
|
|
|
419240
419547
|
try {
|
|
419241
419548
|
await mkdir50(getDataDir(), { recursive: true });
|
|
419242
419549
|
} catch {}
|
|
419243
|
-
const htmlPath =
|
|
419550
|
+
const htmlPath = join159(getDataDir(), "report.html");
|
|
419244
419551
|
await writeFile45(htmlPath, htmlReport, {
|
|
419245
419552
|
encoding: "utf-8",
|
|
419246
419553
|
mode: 384
|
|
@@ -419793,6 +420100,9 @@ var init_commands5 = __esm(() => {
|
|
|
419793
420100
|
init_agents3();
|
|
419794
420101
|
init_plugin3();
|
|
419795
420102
|
init_reload_plugins2();
|
|
420103
|
+
init_reload_skills2();
|
|
420104
|
+
init_cd2();
|
|
420105
|
+
init_output_style2();
|
|
419796
420106
|
init_rewind();
|
|
419797
420107
|
init_heapdump2();
|
|
419798
420108
|
init_version();
|
|
@@ -419849,6 +420159,7 @@ var init_commands5 = __esm(() => {
|
|
|
419849
420159
|
autocompact_default,
|
|
419850
420160
|
branch_default,
|
|
419851
420161
|
btw_default,
|
|
420162
|
+
cd_default,
|
|
419852
420163
|
clear_default,
|
|
419853
420164
|
color_default,
|
|
419854
420165
|
compact_default,
|
|
@@ -419870,9 +420181,11 @@ var init_commands5 = __esm(() => {
|
|
|
419870
420181
|
mcp_default,
|
|
419871
420182
|
memory_default,
|
|
419872
420183
|
model_default,
|
|
420184
|
+
output_style_default,
|
|
419873
420185
|
plugin_default,
|
|
419874
420186
|
release_notes_default,
|
|
419875
420187
|
reload_plugins_default,
|
|
420188
|
+
reload_skills_default,
|
|
419876
420189
|
rename_default,
|
|
419877
420190
|
resume_default,
|
|
419878
420191
|
session_default,
|
|
@@ -420048,7 +420361,7 @@ import {
|
|
|
420048
420361
|
unlink as unlink24,
|
|
420049
420362
|
writeFile as writeFile46
|
|
420050
420363
|
} from "fs/promises";
|
|
420051
|
-
import { basename as basename48, dirname as dirname76, join as
|
|
420364
|
+
import { basename as basename48, dirname as dirname76, join as join160 } from "path";
|
|
420052
420365
|
function isTranscriptMessage2(entry) {
|
|
420053
420366
|
return entry.type === "user" || entry.type === "assistant" || entry.type === "attachment" || entry.type === "system";
|
|
420054
420367
|
}
|
|
@@ -420062,18 +420375,18 @@ function isEphemeralToolProgress2(dataType) {
|
|
|
420062
420375
|
return typeof dataType === "string" && EPHEMERAL_PROGRESS_TYPES2.has(dataType);
|
|
420063
420376
|
}
|
|
420064
420377
|
function getProjectsDir3() {
|
|
420065
|
-
return
|
|
420378
|
+
return join160(getAtlasConfigHomeDir3(), "projects");
|
|
420066
420379
|
}
|
|
420067
420380
|
function getTranscriptPath2() {
|
|
420068
420381
|
const projectDir = getSessionProjectDir() ?? getProjectDir3(getOriginalCwd());
|
|
420069
|
-
return
|
|
420382
|
+
return join160(projectDir, `${getSessionId()}.jsonl`);
|
|
420070
420383
|
}
|
|
420071
420384
|
function getTranscriptPathForSession3(sessionId) {
|
|
420072
420385
|
if (sessionId === getSessionId()) {
|
|
420073
420386
|
return getTranscriptPath2();
|
|
420074
420387
|
}
|
|
420075
420388
|
const projectDir = getProjectDir3(getOriginalCwd());
|
|
420076
|
-
return
|
|
420389
|
+
return join160(projectDir, `${sessionId}.jsonl`);
|
|
420077
420390
|
}
|
|
420078
420391
|
function setAgentTranscriptSubdir2(agentId, subdir) {
|
|
420079
420392
|
agentTranscriptSubdirs2.set(agentId, subdir);
|
|
@@ -420085,8 +420398,8 @@ function getAgentTranscriptPath2(agentId) {
|
|
|
420085
420398
|
const projectDir = getSessionProjectDir() ?? getProjectDir3(getOriginalCwd());
|
|
420086
420399
|
const sessionId = getSessionId();
|
|
420087
420400
|
const subdir = agentTranscriptSubdirs2.get(agentId);
|
|
420088
|
-
const base = subdir ?
|
|
420089
|
-
return
|
|
420401
|
+
const base = subdir ? join160(projectDir, sessionId, "subagents", subdir) : join160(projectDir, sessionId, "subagents");
|
|
420402
|
+
return join160(base, `agent-${agentId}.jsonl`);
|
|
420090
420403
|
}
|
|
420091
420404
|
function getAgentMetadataPath(agentId) {
|
|
420092
420405
|
return getAgentTranscriptPath2(agentId).replace(/\.jsonl$/, ".meta.json");
|
|
@@ -420109,7 +420422,7 @@ async function readAgentMetadata(agentId) {
|
|
|
420109
420422
|
}
|
|
420110
420423
|
function sessionIdExists(sessionId) {
|
|
420111
420424
|
const projectDir = getProjectDir3(getOriginalCwd());
|
|
420112
|
-
const sessionFile =
|
|
420425
|
+
const sessionFile = join160(projectDir, `${sessionId}.jsonl`);
|
|
420113
420426
|
const fs = getFsImplementation2();
|
|
420114
420427
|
try {
|
|
420115
420428
|
fs.statSync(sessionFile);
|
|
@@ -421841,7 +422154,7 @@ async function loadTranscriptFile2(filePath, opts) {
|
|
|
421841
422154
|
};
|
|
421842
422155
|
}
|
|
421843
422156
|
async function loadSessionFile2(sessionId) {
|
|
421844
|
-
const sessionFile =
|
|
422157
|
+
const sessionFile = join160(getSessionProjectDir() ?? getProjectDir3(getOriginalCwd()), `${sessionId}.jsonl`);
|
|
421845
422158
|
return loadTranscriptFile2(sessionFile);
|
|
421846
422159
|
}
|
|
421847
422160
|
function clearSessionMessagesCache2() {
|
|
@@ -421905,7 +422218,7 @@ async function loadAllProjectsMessageLogsFull(limit) {
|
|
|
421905
422218
|
} catch {
|
|
421906
422219
|
return [];
|
|
421907
422220
|
}
|
|
421908
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
422221
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join160(projectsDir, dirent.name));
|
|
421909
422222
|
const logsPerProject = await Promise.all(projectDirs.map((projectDir) => getLogsWithoutIndex(projectDir, limit)));
|
|
421910
422223
|
const allLogs = logsPerProject.flat();
|
|
421911
422224
|
const deduped = new Map;
|
|
@@ -421930,7 +422243,7 @@ async function loadAllProjectsMessageLogsProgressive(limit, initialEnrichCount =
|
|
|
421930
422243
|
} catch {
|
|
421931
422244
|
return { logs: [], allStatLogs: [], nextIndex: 0 };
|
|
421932
422245
|
}
|
|
421933
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
422246
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join160(projectsDir, dirent.name));
|
|
421934
422247
|
const rawLogs = [];
|
|
421935
422248
|
for (const projectDir of projectDirs) {
|
|
421936
422249
|
rawLogs.push(...await getSessionFilesLite(projectDir, limit));
|
|
@@ -422006,7 +422319,7 @@ async function getStatOnlyLogsForWorktrees(worktreePaths, limit) {
|
|
|
422006
422319
|
for (const { path: wtPath, prefix } of indexed) {
|
|
422007
422320
|
if (dirName === prefix || dirName.startsWith(prefix + "-")) {
|
|
422008
422321
|
seenDirs.add(dirName);
|
|
422009
|
-
allLogs.push(...await getSessionFilesLite(
|
|
422322
|
+
allLogs.push(...await getSessionFilesLite(join160(projectsDir, dirent.name), undefined, wtPath));
|
|
422010
422323
|
break;
|
|
422011
422324
|
}
|
|
422012
422325
|
}
|
|
@@ -422066,7 +422379,7 @@ async function loadSubagentTranscripts(agentIds) {
|
|
|
422066
422379
|
return transcripts;
|
|
422067
422380
|
}
|
|
422068
422381
|
async function loadAllSubagentTranscriptsFromDisk() {
|
|
422069
|
-
const subagentsDir =
|
|
422382
|
+
const subagentsDir = join160(getSessionProjectDir() ?? getProjectDir3(getOriginalCwd()), getSessionId(), "subagents");
|
|
422070
422383
|
let entries;
|
|
422071
422384
|
try {
|
|
422072
422385
|
entries = await readdir33(subagentsDir, { withFileTypes: true });
|
|
@@ -422161,7 +422474,7 @@ async function getSessionFilesWithMtime(projectDir) {
|
|
|
422161
422474
|
const sessionId = validateUuid2(basename48(dirent.name, ".jsonl"));
|
|
422162
422475
|
if (!sessionId)
|
|
422163
422476
|
continue;
|
|
422164
|
-
candidates.push({ sessionId, filePath:
|
|
422477
|
+
candidates.push({ sessionId, filePath: join160(projectDir, dirent.name) });
|
|
422165
422478
|
}
|
|
422166
422479
|
await Promise.all(candidates.map(async ({ sessionId, filePath }) => {
|
|
422167
422480
|
try {
|
|
@@ -422583,7 +422896,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
422583
422896
|
MAX_TRANSCRIPT_READ_BYTES2 = 50 * 1024 * 1024;
|
|
422584
422897
|
agentTranscriptSubdirs2 = new Map;
|
|
422585
422898
|
getProjectDir3 = memoize_default((projectDir) => {
|
|
422586
|
-
return
|
|
422899
|
+
return join160(getProjectsDir3(), sanitizePath3(projectDir));
|
|
422587
422900
|
});
|
|
422588
422901
|
METADATA_TYPE_MARKERS2 = [
|
|
422589
422902
|
'"type":"summary"',
|
|
@@ -422602,7 +422915,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
422602
422915
|
// src/tui/utils/plans.ts
|
|
422603
422916
|
import { randomUUID as randomUUID40 } from "crypto";
|
|
422604
422917
|
import { copyFile as copyFile9, writeFile as writeFile47 } from "fs/promises";
|
|
422605
|
-
import { join as
|
|
422918
|
+
import { join as join161, resolve as resolve54, sep as sep35 } from "path";
|
|
422606
422919
|
function getPlanSlug2(sessionId) {
|
|
422607
422920
|
const id = sessionId ?? getSessionId();
|
|
422608
422921
|
const cache = getPlanSlugCache();
|
|
@@ -422611,7 +422924,7 @@ function getPlanSlug2(sessionId) {
|
|
|
422611
422924
|
const plansDir = getPlansDirectory2();
|
|
422612
422925
|
for (let i = 0;i < MAX_SLUG_RETRIES2; i++) {
|
|
422613
422926
|
slug = generateWordSlug2();
|
|
422614
|
-
const filePath =
|
|
422927
|
+
const filePath = join161(plansDir, `${slug}.md`);
|
|
422615
422928
|
if (!getFsImplementation2().existsSync(filePath)) {
|
|
422616
422929
|
break;
|
|
422617
422930
|
}
|
|
@@ -422629,9 +422942,9 @@ function clearAllPlanSlugs2() {
|
|
|
422629
422942
|
function getPlanFilePath2(agentId) {
|
|
422630
422943
|
const planSlug = getPlanSlug2(getSessionId());
|
|
422631
422944
|
if (!agentId) {
|
|
422632
|
-
return
|
|
422945
|
+
return join161(getPlansDirectory2(), `${planSlug}.md`);
|
|
422633
422946
|
}
|
|
422634
|
-
return
|
|
422947
|
+
return join161(getPlansDirectory2(), `${planSlug}-agent-${agentId}.md`);
|
|
422635
422948
|
}
|
|
422636
422949
|
function getPlan2(agentId) {
|
|
422637
422950
|
const filePath = getPlanFilePath2(agentId);
|
|
@@ -422654,7 +422967,7 @@ async function copyPlanForResume(log, targetSessionId) {
|
|
|
422654
422967
|
}
|
|
422655
422968
|
const sessionId = targetSessionId ?? getSessionId();
|
|
422656
422969
|
setPlanSlug2(sessionId, slug);
|
|
422657
|
-
const planPath =
|
|
422970
|
+
const planPath = join161(getPlansDirectory2(), `${slug}.md`);
|
|
422658
422971
|
try {
|
|
422659
422972
|
await getFsImplementation2().readFile(planPath, { encoding: "utf-8" });
|
|
422660
422973
|
return true;
|
|
@@ -422697,9 +423010,9 @@ async function copyPlanForFork(log, targetSessionId) {
|
|
|
422697
423010
|
return false;
|
|
422698
423011
|
}
|
|
422699
423012
|
const plansDir = getPlansDirectory2();
|
|
422700
|
-
const originalPlanPath =
|
|
423013
|
+
const originalPlanPath = join161(plansDir, `${originalSlug}.md`);
|
|
422701
423014
|
const newSlug = getPlanSlug2(targetSessionId);
|
|
422702
|
-
const newPlanPath =
|
|
423015
|
+
const newPlanPath = join161(plansDir, `${newSlug}.md`);
|
|
422703
423016
|
try {
|
|
422704
423017
|
await copyFile9(originalPlanPath, newPlanPath);
|
|
422705
423018
|
return true;
|
|
@@ -422812,15 +423125,15 @@ var init_plans = __esm(() => {
|
|
|
422812
423125
|
let plansPath;
|
|
422813
423126
|
if (settingsDir) {
|
|
422814
423127
|
const cwd = getCwd();
|
|
422815
|
-
const resolved =
|
|
422816
|
-
if (!resolved.startsWith(cwd +
|
|
423128
|
+
const resolved = resolve54(cwd, settingsDir);
|
|
423129
|
+
if (!resolved.startsWith(cwd + sep35) && resolved !== cwd) {
|
|
422817
423130
|
logError3(new Error(`plansDirectory must be within project root: ${settingsDir}`));
|
|
422818
|
-
plansPath =
|
|
423131
|
+
plansPath = join161(getAtlasConfigHomeDir3(), "plans");
|
|
422819
423132
|
} else {
|
|
422820
423133
|
plansPath = resolved;
|
|
422821
423134
|
}
|
|
422822
423135
|
} else {
|
|
422823
|
-
plansPath =
|
|
423136
|
+
plansPath = join161(getAtlasConfigHomeDir3(), "plans");
|
|
422824
423137
|
}
|
|
422825
423138
|
try {
|
|
422826
423139
|
getFsImplementation2().mkdirSync(plansPath);
|
|
@@ -422834,7 +423147,7 @@ var init_plans = __esm(() => {
|
|
|
422834
423147
|
// src/tui/utils/permissions/filesystem.ts
|
|
422835
423148
|
import { randomBytes as randomBytes21 } from "crypto";
|
|
422836
423149
|
import { homedir as homedir38, tmpdir as tmpdir11 } from "os";
|
|
422837
|
-
import { join as
|
|
423150
|
+
import { join as join162, normalize as normalize15, posix as posix9, resolve as resolve55, sep as sep36 } from "path";
|
|
422838
423151
|
function normalizeCaseForComparison2(path) {
|
|
422839
423152
|
return path.toLowerCase();
|
|
422840
423153
|
}
|
|
@@ -422844,21 +423157,21 @@ function getClaudeSkillScope(filePath) {
|
|
|
422844
423157
|
const configDir = getConfigDirName2();
|
|
422845
423158
|
const bases = [
|
|
422846
423159
|
{
|
|
422847
|
-
dir: expandPath2(
|
|
423160
|
+
dir: expandPath2(join162(getOriginalCwd(), configDir, "skills")),
|
|
422848
423161
|
prefix: `/${configDir}/skills/`
|
|
422849
423162
|
},
|
|
422850
423163
|
{
|
|
422851
|
-
dir: expandPath2(
|
|
423164
|
+
dir: expandPath2(join162(homedir38(), configDir, "skills")),
|
|
422852
423165
|
prefix: `~/${configDir}/skills/`
|
|
422853
423166
|
}
|
|
422854
423167
|
];
|
|
422855
423168
|
for (const { dir, prefix } of bases) {
|
|
422856
423169
|
const dirLower = normalizeCaseForComparison2(dir);
|
|
422857
|
-
for (const s of [
|
|
423170
|
+
for (const s of [sep36, "/"]) {
|
|
422858
423171
|
if (absolutePathLower.startsWith(dirLower + s.toLowerCase())) {
|
|
422859
423172
|
const rest = absolutePath.slice(dir.length + s.length);
|
|
422860
423173
|
const slash = rest.indexOf("/");
|
|
422861
|
-
const bslash =
|
|
423174
|
+
const bslash = sep36 === "\\" ? rest.indexOf("\\") : -1;
|
|
422862
423175
|
const cut = slash === -1 ? bslash : bslash === -1 ? slash : Math.min(slash, bslash);
|
|
422863
423176
|
if (cut <= 0)
|
|
422864
423177
|
return null;
|
|
@@ -422894,7 +423207,7 @@ function getSettingsPaths3() {
|
|
|
422894
423207
|
function isAtlasSettingsPath2(filePath) {
|
|
422895
423208
|
const expandedPath = expandPath2(filePath);
|
|
422896
423209
|
const normalizedPath = normalizeCaseForComparison2(expandedPath);
|
|
422897
|
-
if (normalizedPath.endsWith(`${
|
|
423210
|
+
if (normalizedPath.endsWith(`${sep36}getConfigDirName()${sep36}settings.json`) || normalizedPath.endsWith(`${sep36}getConfigDirName()${sep36}settings.local.json`)) {
|
|
422898
423211
|
return true;
|
|
422899
423212
|
}
|
|
422900
423213
|
return getSettingsPaths3().some((settingsPath) => normalizeCaseForComparison2(settingsPath) === normalizedPath);
|
|
@@ -422903,21 +423216,21 @@ function isClaudeConfigFilePath2(filePath) {
|
|
|
422903
423216
|
if (isAtlasSettingsPath2(filePath)) {
|
|
422904
423217
|
return true;
|
|
422905
423218
|
}
|
|
422906
|
-
const commandsDir =
|
|
422907
|
-
const agentsDir =
|
|
422908
|
-
const skillsDir =
|
|
423219
|
+
const commandsDir = join162(getOriginalCwd(), getConfigDirName2(), "commands");
|
|
423220
|
+
const agentsDir = join162(getOriginalCwd(), getConfigDirName2(), "agents");
|
|
423221
|
+
const skillsDir = join162(getOriginalCwd(), getConfigDirName2(), "skills");
|
|
422909
423222
|
return pathInWorkingPath2(filePath, commandsDir) || pathInWorkingPath2(filePath, agentsDir) || pathInWorkingPath2(filePath, skillsDir);
|
|
422910
423223
|
}
|
|
422911
423224
|
function isSessionPlanFile(absolutePath) {
|
|
422912
|
-
const expectedPrefix =
|
|
423225
|
+
const expectedPrefix = join162(getPlansDirectory2(), getPlanSlug2());
|
|
422913
423226
|
const normalizedPath = normalize15(absolutePath);
|
|
422914
423227
|
return normalizedPath.startsWith(expectedPrefix) && normalizedPath.endsWith(".md");
|
|
422915
423228
|
}
|
|
422916
423229
|
function getSessionMemoryDir() {
|
|
422917
|
-
return
|
|
423230
|
+
return join162(getProjectDir3(getCwd()), getSessionId(), "session-memory") + sep36;
|
|
422918
423231
|
}
|
|
422919
423232
|
function getSessionMemoryPath() {
|
|
422920
|
-
return
|
|
423233
|
+
return join162(getSessionMemoryDir(), "summary.md");
|
|
422921
423234
|
}
|
|
422922
423235
|
function isSessionMemoryPath(absolutePath) {
|
|
422923
423236
|
const normalizedPath = normalize15(absolutePath);
|
|
@@ -422926,7 +423239,7 @@ function isSessionMemoryPath(absolutePath) {
|
|
|
422926
423239
|
function isProjectDirPath(absolutePath) {
|
|
422927
423240
|
const projectDir = getProjectDir3(getCwd());
|
|
422928
423241
|
const normalizedPath = normalize15(absolutePath);
|
|
422929
|
-
return normalizedPath === projectDir || normalizedPath.startsWith(projectDir +
|
|
423242
|
+
return normalizedPath === projectDir || normalizedPath.startsWith(projectDir + sep36);
|
|
422930
423243
|
}
|
|
422931
423244
|
function isScratchpadEnabled() {
|
|
422932
423245
|
return checkStatsigFeatureGate_CACHED_MAY_BE_STALE("atlas_scratch");
|
|
@@ -422939,10 +423252,10 @@ function getAtlasTempDirName2() {
|
|
|
422939
423252
|
return `${getConfigDirName2()}-${uid}`;
|
|
422940
423253
|
}
|
|
422941
423254
|
function getProjectTempDir2() {
|
|
422942
|
-
return
|
|
423255
|
+
return join162(getAtlasTempDir2(), sanitizePath3(getOriginalCwd())) + sep36;
|
|
422943
423256
|
}
|
|
422944
423257
|
function getScratchpadDir() {
|
|
422945
|
-
return
|
|
423258
|
+
return join162(getProjectTempDir2(), getSessionId(), "scratchpad");
|
|
422946
423259
|
}
|
|
422947
423260
|
async function ensureScratchpadDir() {
|
|
422948
423261
|
if (!isScratchpadEnabled()) {
|
|
@@ -422959,11 +423272,11 @@ function isScratchpadPath(absolutePath) {
|
|
|
422959
423272
|
}
|
|
422960
423273
|
const scratchpadDir = getScratchpadDir();
|
|
422961
423274
|
const normalizedPath = normalize15(absolutePath);
|
|
422962
|
-
return normalizedPath === scratchpadDir || normalizedPath.startsWith(scratchpadDir +
|
|
423275
|
+
return normalizedPath === scratchpadDir || normalizedPath.startsWith(scratchpadDir + sep36);
|
|
422963
423276
|
}
|
|
422964
423277
|
function isDangerousFilePathToAutoEdit2(path) {
|
|
422965
423278
|
const absolutePath = expandPath2(path);
|
|
422966
|
-
const pathSegments = absolutePath.split(
|
|
423279
|
+
const pathSegments = absolutePath.split(sep36);
|
|
422967
423280
|
const fileName = pathSegments.at(-1);
|
|
422968
423281
|
if (path.startsWith("\\\\") || path.startsWith("//")) {
|
|
422969
423282
|
return true;
|
|
@@ -423057,13 +423370,13 @@ function isActiveWorktreeCwd2(cwd) {
|
|
|
423057
423370
|
}
|
|
423058
423371
|
let active = false;
|
|
423059
423372
|
try {
|
|
423060
|
-
const content = getFsImplementation2().readFileSync(
|
|
423373
|
+
const content = getFsImplementation2().readFileSync(join162(cwd, ".git"), {
|
|
423061
423374
|
encoding: "utf8"
|
|
423062
423375
|
});
|
|
423063
423376
|
const gitdirMatch = content.match(/^gitdir:\s*(.+)$/m);
|
|
423064
423377
|
if (gitdirMatch?.[1]) {
|
|
423065
|
-
const gitdir =
|
|
423066
|
-
active = gitdir.lastIndexOf(
|
|
423378
|
+
const gitdir = resolve55(cwd, gitdirMatch[1].trim());
|
|
423379
|
+
active = gitdir.lastIndexOf(sep36 + ".git" + sep36 + "worktrees" + sep36) > 0;
|
|
423067
423380
|
}
|
|
423068
423381
|
} catch {
|
|
423069
423382
|
active = false;
|
|
@@ -423529,15 +423842,15 @@ function checkEditableInternalPath2(absolutePath, input) {
|
|
|
423529
423842
|
if (feature("TEMPLATES")) {
|
|
423530
423843
|
const jobDir = process.env.ATLAS_JOB_DIR;
|
|
423531
423844
|
if (jobDir) {
|
|
423532
|
-
const jobsRoot =
|
|
423845
|
+
const jobsRoot = join162(getAtlasConfigHomeDir3(), "jobs");
|
|
423533
423846
|
const jobDirForms = getPathsForPermissionCheck2(jobDir).map(normalize15);
|
|
423534
423847
|
const jobsRootForms = getPathsForPermissionCheck2(jobsRoot).map(normalize15);
|
|
423535
|
-
const isUnderJobsRoot = jobDirForms.every((jd) => jobsRootForms.some((jr) => jd.startsWith(jr +
|
|
423848
|
+
const isUnderJobsRoot = jobDirForms.every((jd) => jobsRootForms.some((jr) => jd.startsWith(jr + sep36)));
|
|
423536
423849
|
if (isUnderJobsRoot) {
|
|
423537
423850
|
const targetForms = getPathsForPermissionCheck2(absolutePath);
|
|
423538
423851
|
const allInsideJobDir = targetForms.every((p) => {
|
|
423539
423852
|
const np = normalize15(p);
|
|
423540
|
-
return jobDirForms.some((jd) => np === jd || np.startsWith(jd +
|
|
423853
|
+
return jobDirForms.some((jd) => np === jd || np.startsWith(jd + sep36));
|
|
423541
423854
|
});
|
|
423542
423855
|
if (allInsideJobDir) {
|
|
423543
423856
|
return {
|
|
@@ -423572,7 +423885,7 @@ function checkEditableInternalPath2(absolutePath, input) {
|
|
|
423572
423885
|
}
|
|
423573
423886
|
};
|
|
423574
423887
|
}
|
|
423575
|
-
if (normalizeCaseForComparison2(normalizedPath) === normalizeCaseForComparison2(
|
|
423888
|
+
if (normalizeCaseForComparison2(normalizedPath) === normalizeCaseForComparison2(join162(getOriginalCwd(), getConfigDirName2(), "launch.json"))) {
|
|
423576
423889
|
return {
|
|
423577
423890
|
behavior: "allow",
|
|
423578
423891
|
updatedInput: input,
|
|
@@ -423617,7 +423930,7 @@ function checkReadableInternalPath2(absolutePath, input) {
|
|
|
423617
423930
|
};
|
|
423618
423931
|
}
|
|
423619
423932
|
const toolResultsDir = getToolResultsDir3();
|
|
423620
|
-
const toolResultsDirWithSep = toolResultsDir.endsWith(
|
|
423933
|
+
const toolResultsDirWithSep = toolResultsDir.endsWith(sep36) ? toolResultsDir : toolResultsDir + sep36;
|
|
423621
423934
|
if (normalizedPath === toolResultsDir || normalizedPath.startsWith(toolResultsDirWithSep)) {
|
|
423622
423935
|
return {
|
|
423623
423936
|
behavior: "allow",
|
|
@@ -423669,7 +423982,7 @@ function checkReadableInternalPath2(absolutePath, input) {
|
|
|
423669
423982
|
}
|
|
423670
423983
|
};
|
|
423671
423984
|
}
|
|
423672
|
-
const tasksDir =
|
|
423985
|
+
const tasksDir = join162(getAtlasConfigHomeDir3(), "tasks") + sep36;
|
|
423673
423986
|
if (normalizedPath === tasksDir.slice(0, -1) || normalizedPath.startsWith(tasksDir)) {
|
|
423674
423987
|
return {
|
|
423675
423988
|
behavior: "allow",
|
|
@@ -423680,7 +423993,7 @@ function checkReadableInternalPath2(absolutePath, input) {
|
|
|
423680
423993
|
}
|
|
423681
423994
|
};
|
|
423682
423995
|
}
|
|
423683
|
-
const teamsReadDir =
|
|
423996
|
+
const teamsReadDir = join162(getAtlasConfigHomeDir3(), "teams") + sep36;
|
|
423684
423997
|
if (normalizedPath === teamsReadDir.slice(0, -1) || normalizedPath.startsWith(teamsReadDir)) {
|
|
423685
423998
|
return {
|
|
423686
423999
|
behavior: "allow",
|
|
@@ -423691,7 +424004,7 @@ function checkReadableInternalPath2(absolutePath, input) {
|
|
|
423691
424004
|
}
|
|
423692
424005
|
};
|
|
423693
424006
|
}
|
|
423694
|
-
const bundledSkillsRoot = getBundledSkillsRoot2() +
|
|
424007
|
+
const bundledSkillsRoot = getBundledSkillsRoot2() + sep36;
|
|
423695
424008
|
if (normalizedPath.startsWith(bundledSkillsRoot)) {
|
|
423696
424009
|
return {
|
|
423697
424010
|
behavior: "allow",
|
|
@@ -423757,11 +424070,11 @@ var init_filesystem2 = __esm(() => {
|
|
|
423757
424070
|
try {
|
|
423758
424071
|
resolvedBaseTmpDir = fs.realpathSync(baseTmpDir);
|
|
423759
424072
|
} catch {}
|
|
423760
|
-
return
|
|
424073
|
+
return join162(resolvedBaseTmpDir, getAtlasTempDirName2()) + sep36;
|
|
423761
424074
|
});
|
|
423762
424075
|
getBundledSkillsRoot2 = memoize_default(function getBundledSkillsRoot() {
|
|
423763
424076
|
const nonce = randomBytes21(16).toString("hex");
|
|
423764
|
-
return
|
|
424077
|
+
return join162(getAtlasTempDir2(), "bundled-skills", MACRO.VERSION, nonce);
|
|
423765
424078
|
});
|
|
423766
424079
|
worktreeCwdProbeCache2 = new Map;
|
|
423767
424080
|
getResolvedWorkingDirPaths2 = memoize_default(getPathsForPermissionCheck2);
|
|
@@ -423776,10 +424089,10 @@ import {
|
|
|
423776
424089
|
symlink as symlink7,
|
|
423777
424090
|
unlink as unlink25
|
|
423778
424091
|
} from "fs/promises";
|
|
423779
|
-
import { join as
|
|
424092
|
+
import { join as join163 } from "path";
|
|
423780
424093
|
function getTaskOutputDir2() {
|
|
423781
424094
|
if (_taskOutputDir2 === undefined) {
|
|
423782
|
-
_taskOutputDir2 =
|
|
424095
|
+
_taskOutputDir2 = join163(getProjectTempDir2(), getSessionId(), "tasks");
|
|
423783
424096
|
}
|
|
423784
424097
|
return _taskOutputDir2;
|
|
423785
424098
|
}
|
|
@@ -423787,7 +424100,7 @@ async function ensureOutputDir2() {
|
|
|
423787
424100
|
await mkdir52(getTaskOutputDir2(), { recursive: true });
|
|
423788
424101
|
}
|
|
423789
424102
|
function getTaskOutputPath2(taskId) {
|
|
423790
|
-
return
|
|
424103
|
+
return join163(getTaskOutputDir2(), `${taskId}.output`);
|
|
423791
424104
|
}
|
|
423792
424105
|
function track2(p) {
|
|
423793
424106
|
_pendingOps2.add(p);
|
|
@@ -430818,7 +431131,7 @@ var init_compact4 = __esm(() => {
|
|
|
430818
431131
|
|
|
430819
431132
|
// src/tui/services/SessionMemory/prompts.ts
|
|
430820
431133
|
import { readFile as readFile61 } from "fs/promises";
|
|
430821
|
-
import { join as
|
|
431134
|
+
import { join as join164 } from "path";
|
|
430822
431135
|
function getDefaultUpdatePrompt() {
|
|
430823
431136
|
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.
|
|
430824
431137
|
|
|
@@ -430859,7 +431172,7 @@ You ONLY update the actual content that comes AFTER these two preserved lines. T
|
|
|
430859
431172
|
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_.`;
|
|
430860
431173
|
}
|
|
430861
431174
|
async function loadSessionMemoryTemplate() {
|
|
430862
|
-
const templatePath =
|
|
431175
|
+
const templatePath = join164(getAtlasConfigHomeDir3(), "session-memory", "config", "template.md");
|
|
430863
431176
|
try {
|
|
430864
431177
|
return await readFile61(templatePath, { encoding: "utf-8" });
|
|
430865
431178
|
} catch (e) {
|
|
@@ -430872,7 +431185,7 @@ async function loadSessionMemoryTemplate() {
|
|
|
430872
431185
|
}
|
|
430873
431186
|
}
|
|
430874
431187
|
async function loadSessionMemoryPrompt() {
|
|
430875
|
-
const promptPath =
|
|
431188
|
+
const promptPath = join164(getAtlasConfigHomeDir3(), "session-memory", "config", "prompt.md");
|
|
430876
431189
|
try {
|
|
430877
431190
|
return await readFile61(promptPath, { encoding: "utf-8" });
|
|
430878
431191
|
} catch (e) {
|
|
@@ -431478,7 +431791,7 @@ var init_contextHostWiring = __esm(() => {
|
|
|
431478
431791
|
|
|
431479
431792
|
// src/tui/core/executor/AscendFreshnessPort.ts
|
|
431480
431793
|
import { readFileSync as readFileSync22, existsSync as existsSync12 } from "fs";
|
|
431481
|
-
import { join as
|
|
431794
|
+
import { join as join165, dirname as dirname77 } from "path";
|
|
431482
431795
|
|
|
431483
431796
|
class DefaultAscendFreshnessPort {
|
|
431484
431797
|
injectedCache;
|
|
@@ -431492,8 +431805,8 @@ class DefaultAscendFreshnessPort {
|
|
|
431492
431805
|
return env;
|
|
431493
431806
|
let dir = dirname77(new URL(import.meta.url).pathname);
|
|
431494
431807
|
for (let i = 0;i < MAX_WALK_UP; i++) {
|
|
431495
|
-
if (existsSync12(
|
|
431496
|
-
return
|
|
431808
|
+
if (existsSync12(join165(dir, "package.json")))
|
|
431809
|
+
return join165(dir, ".freshness-cache.json");
|
|
431497
431810
|
const parent = dirname77(dir);
|
|
431498
431811
|
if (parent === dir)
|
|
431499
431812
|
break;
|
|
@@ -431968,10 +432281,10 @@ import {
|
|
|
431968
432281
|
dirname as dirname78,
|
|
431969
432282
|
extname as extname17,
|
|
431970
432283
|
isAbsolute as isAbsolute33,
|
|
431971
|
-
join as
|
|
432284
|
+
join as join166,
|
|
431972
432285
|
parse as parse13,
|
|
431973
432286
|
relative as relative29,
|
|
431974
|
-
sep as
|
|
432287
|
+
sep as sep37
|
|
431975
432288
|
} from "path";
|
|
431976
432289
|
function pathInOriginalCwd(path) {
|
|
431977
432290
|
return pathInWorkingPath2(path, getOriginalCwd());
|
|
@@ -432208,7 +432521,7 @@ async function processMdRules({
|
|
|
432208
432521
|
throw e;
|
|
432209
432522
|
}
|
|
432210
432523
|
for (const entry of entries) {
|
|
432211
|
-
const entryPath =
|
|
432524
|
+
const entryPath = join166(rulesDir, entry.name);
|
|
432212
432525
|
const { resolvedPath: resolvedEntryPath, isSymlink } = safeResolvePath3(fs, entryPath);
|
|
432213
432526
|
const stats = isSymlink ? await fs.stat(resolvedEntryPath) : null;
|
|
432214
432527
|
const isDirectory = stats ? stats.isDirectory() : entry.isDirectory();
|
|
@@ -432276,14 +432589,14 @@ async function getMemoryFilesForNestedDirectory(dir, targetPath, processedPaths)
|
|
|
432276
432589
|
if (isSettingSourceEnabled2("projectSettings")) {
|
|
432277
432590
|
const projectPath = findMemoryFile(dir);
|
|
432278
432591
|
result.push(...await processMemoryFile(projectPath, "Project", processedPaths, false));
|
|
432279
|
-
const dotClaudePath = findMemoryFile(
|
|
432592
|
+
const dotClaudePath = findMemoryFile(join166(dir, getConfigDirName2()));
|
|
432280
432593
|
result.push(...await processMemoryFile(dotClaudePath, "Project", processedPaths, false));
|
|
432281
432594
|
}
|
|
432282
432595
|
if (isSettingSourceEnabled2("localSettings")) {
|
|
432283
|
-
const localPath =
|
|
432596
|
+
const localPath = join166(dir, "CLAUDE.local.md");
|
|
432284
432597
|
result.push(...await processMemoryFile(localPath, "Local", processedPaths, false));
|
|
432285
432598
|
}
|
|
432286
|
-
const rulesDir =
|
|
432599
|
+
const rulesDir = join166(dir, getConfigDirName2(), "rules");
|
|
432287
432600
|
const unconditionalProcessedPaths = new Set(processedPaths);
|
|
432288
432601
|
result.push(...await processMdRules({
|
|
432289
432602
|
rulesDir,
|
|
@@ -432299,7 +432612,7 @@ async function getMemoryFilesForNestedDirectory(dir, targetPath, processedPaths)
|
|
|
432299
432612
|
return result;
|
|
432300
432613
|
}
|
|
432301
432614
|
async function getConditionalRulesForCwdLevelDirectory(dir, targetPath, processedPaths) {
|
|
432302
|
-
const rulesDir =
|
|
432615
|
+
const rulesDir = join166(dir, getConfigDirName2(), "rules");
|
|
432303
432616
|
return processConditionedMdRules(targetPath, rulesDir, "Project", processedPaths, false);
|
|
432304
432617
|
}
|
|
432305
432618
|
async function processConditionedMdRules(targetPath, rulesDir, type, processedPaths, includeExternal) {
|
|
@@ -432555,9 +432868,9 @@ var init_memoryFiles = __esm(() => {
|
|
|
432555
432868
|
if (isSettingSourceEnabled2("projectSettings") && !skipProject) {
|
|
432556
432869
|
const projectPath = findMemoryFile(dir);
|
|
432557
432870
|
result.push(...await processMemoryFile(projectPath, "Project", processedPaths, includeExternal));
|
|
432558
|
-
const dotClaudePath = findMemoryFile(
|
|
432871
|
+
const dotClaudePath = findMemoryFile(join166(dir, getConfigDirName2()));
|
|
432559
432872
|
result.push(...await processMemoryFile(dotClaudePath, "Project", processedPaths, includeExternal));
|
|
432560
|
-
const rulesDir =
|
|
432873
|
+
const rulesDir = join166(dir, getConfigDirName2(), "rules");
|
|
432561
432874
|
result.push(...await processMdRules({
|
|
432562
432875
|
rulesDir,
|
|
432563
432876
|
type: "Project",
|
|
@@ -432567,7 +432880,7 @@ var init_memoryFiles = __esm(() => {
|
|
|
432567
432880
|
}));
|
|
432568
432881
|
}
|
|
432569
432882
|
if (isSettingSourceEnabled2("localSettings")) {
|
|
432570
|
-
const localPath =
|
|
432883
|
+
const localPath = join166(dir, "CLAUDE.local.md");
|
|
432571
432884
|
result.push(...await processMemoryFile(localPath, "Local", processedPaths, includeExternal));
|
|
432572
432885
|
}
|
|
432573
432886
|
}
|
|
@@ -432576,9 +432889,9 @@ var init_memoryFiles = __esm(() => {
|
|
|
432576
432889
|
for (const dir of additionalDirs) {
|
|
432577
432890
|
const projectPath = findMemoryFile(dir);
|
|
432578
432891
|
result.push(...await processMemoryFile(projectPath, "Project", processedPaths, includeExternal));
|
|
432579
|
-
const dotClaudePath = findMemoryFile(
|
|
432892
|
+
const dotClaudePath = findMemoryFile(join166(dir, getConfigDirName2()));
|
|
432580
432893
|
result.push(...await processMemoryFile(dotClaudePath, "Project", processedPaths, includeExternal));
|
|
432581
|
-
const rulesDir =
|
|
432894
|
+
const rulesDir = join166(dir, getConfigDirName2(), "rules");
|
|
432582
432895
|
result.push(...await processMdRules({
|
|
432583
432896
|
rulesDir,
|
|
432584
432897
|
type: "Project",
|
|
@@ -441103,20 +441416,20 @@ var init_AutoModeConfirm = __esm(() => {
|
|
|
441103
441416
|
|
|
441104
441417
|
// src/tui/components/permissions/FilePermissionDialog/permissionOptions.tsx
|
|
441105
441418
|
import { homedir as homedir39 } from "os";
|
|
441106
|
-
import { basename as basename54, join as
|
|
441419
|
+
import { basename as basename54, join as join167, sep as sep38 } from "path";
|
|
441107
441420
|
function isInClaudeFolder(filePath) {
|
|
441108
441421
|
const absolutePath = expandPath2(filePath);
|
|
441109
441422
|
const claudeFolderPath = expandPath2(`${getOriginalCwd()}/${getConfigDirName2()}`);
|
|
441110
441423
|
const normalizedAbsolutePath = normalizeCaseForComparison2(absolutePath);
|
|
441111
441424
|
const normalizedClaudeFolderPath = normalizeCaseForComparison2(claudeFolderPath);
|
|
441112
|
-
return normalizedAbsolutePath.startsWith(normalizedClaudeFolderPath +
|
|
441425
|
+
return normalizedAbsolutePath.startsWith(normalizedClaudeFolderPath + sep38.toLowerCase()) || normalizedAbsolutePath.startsWith(normalizedClaudeFolderPath + "/");
|
|
441113
441426
|
}
|
|
441114
441427
|
function isInGlobalClaudeFolder(filePath) {
|
|
441115
441428
|
const absolutePath = expandPath2(filePath);
|
|
441116
|
-
const globalClaudeFolderPath =
|
|
441429
|
+
const globalClaudeFolderPath = join167(homedir39(), getConfigDirName2());
|
|
441117
441430
|
const normalizedAbsolutePath = normalizeCaseForComparison2(absolutePath);
|
|
441118
441431
|
const normalizedGlobalClaudeFolderPath = normalizeCaseForComparison2(globalClaudeFolderPath);
|
|
441119
|
-
return normalizedAbsolutePath.startsWith(normalizedGlobalClaudeFolderPath +
|
|
441432
|
+
return normalizedAbsolutePath.startsWith(normalizedGlobalClaudeFolderPath + sep38.toLowerCase()) || normalizedAbsolutePath.startsWith(normalizedGlobalClaudeFolderPath + "/");
|
|
441120
441433
|
}
|
|
441121
441434
|
function getFilePermissionOptions({
|
|
441122
441435
|
filePath,
|
|
@@ -442097,7 +442410,7 @@ var init_useShellPermissionFeedback = __esm(() => {
|
|
|
442097
442410
|
});
|
|
442098
442411
|
|
|
442099
442412
|
// src/tui/components/permissions/shellPermissionHelpers.tsx
|
|
442100
|
-
import { basename as basename56, sep as
|
|
442413
|
+
import { basename as basename56, sep as sep39 } from "path";
|
|
442101
442414
|
function commandListDisplay(commands) {
|
|
442102
442415
|
switch (commands.length) {
|
|
442103
442416
|
case 0:
|
|
@@ -442156,7 +442469,7 @@ function formatPathList(paths) {
|
|
|
442156
442469
|
bold: true,
|
|
442157
442470
|
children: names[0]
|
|
442158
442471
|
}, undefined, false, undefined, this),
|
|
442159
|
-
|
|
442472
|
+
sep39
|
|
442160
442473
|
]
|
|
442161
442474
|
}, undefined, true, undefined, this);
|
|
442162
442475
|
}
|
|
@@ -442167,13 +442480,13 @@ function formatPathList(paths) {
|
|
|
442167
442480
|
bold: true,
|
|
442168
442481
|
children: names[0]
|
|
442169
442482
|
}, undefined, false, undefined, this),
|
|
442170
|
-
|
|
442483
|
+
sep39,
|
|
442171
442484
|
" and ",
|
|
442172
442485
|
/* @__PURE__ */ jsx_dev_runtime337.jsxDEV(ThemedText, {
|
|
442173
442486
|
bold: true,
|
|
442174
442487
|
children: names[1]
|
|
442175
442488
|
}, undefined, false, undefined, this),
|
|
442176
|
-
|
|
442489
|
+
sep39
|
|
442177
442490
|
]
|
|
442178
442491
|
}, undefined, true, undefined, this);
|
|
442179
442492
|
}
|
|
@@ -442183,13 +442496,13 @@ function formatPathList(paths) {
|
|
|
442183
442496
|
bold: true,
|
|
442184
442497
|
children: names[0]
|
|
442185
442498
|
}, undefined, false, undefined, this),
|
|
442186
|
-
|
|
442499
|
+
sep39,
|
|
442187
442500
|
", ",
|
|
442188
442501
|
/* @__PURE__ */ jsx_dev_runtime337.jsxDEV(ThemedText, {
|
|
442189
442502
|
bold: true,
|
|
442190
442503
|
children: names[1]
|
|
442191
442504
|
}, undefined, false, undefined, this),
|
|
442192
|
-
|
|
442505
|
+
sep39,
|
|
442193
442506
|
" and ",
|
|
442194
442507
|
paths.length - 2,
|
|
442195
442508
|
" more"
|
|
@@ -442222,7 +442535,7 @@ function generateShellSuggestionsLabel(suggestions, shellToolName, commandTransf
|
|
|
442222
442535
|
bold: true,
|
|
442223
442536
|
children: dirName
|
|
442224
442537
|
}, undefined, false, undefined, this),
|
|
442225
|
-
|
|
442538
|
+
sep39,
|
|
442226
442539
|
" from this project"
|
|
442227
442540
|
]
|
|
442228
442541
|
}, undefined, true, undefined, this);
|
|
@@ -442246,7 +442559,7 @@ function generateShellSuggestionsLabel(suggestions, shellToolName, commandTransf
|
|
|
442246
442559
|
bold: true,
|
|
442247
442560
|
children: dirName
|
|
442248
442561
|
}, undefined, false, undefined, this),
|
|
442249
|
-
|
|
442562
|
+
sep39,
|
|
442250
442563
|
" from this project"
|
|
442251
442564
|
]
|
|
442252
442565
|
}, undefined, true, undefined, this);
|
|
@@ -458841,10 +459154,10 @@ var init_segments = __esm(() => {
|
|
|
458841
459154
|
|
|
458842
459155
|
// src/tui/components/StatusLine/segments/statusLineConfig.ts
|
|
458843
459156
|
import { readFileSync as readFileSync23, existsSync as existsSync13, writeFileSync as writeFileSync9, renameSync as renameSync3, mkdirSync as mkdirSync9 } from "fs";
|
|
458844
|
-
import { join as
|
|
459157
|
+
import { join as join168 } from "path";
|
|
458845
459158
|
import { homedir as homedir41 } from "os";
|
|
458846
459159
|
function getStatusLineJsonPath() {
|
|
458847
|
-
return
|
|
459160
|
+
return join168(homedir41(), getConfigDirName2(), "statusline.json");
|
|
458848
459161
|
}
|
|
458849
459162
|
function getDefaultConfig() {
|
|
458850
459163
|
return {
|
|
@@ -464269,7 +464582,7 @@ var init_autoDream = __esm(() => {
|
|
|
464269
464582
|
});
|
|
464270
464583
|
|
|
464271
464584
|
// src/tui/utils/cleanup.ts
|
|
464272
|
-
import { join as
|
|
464585
|
+
import { join as join169 } from "path";
|
|
464273
464586
|
function getCutoffDate() {
|
|
464274
464587
|
const settings = getSettings_DEPRECATED() || {};
|
|
464275
464588
|
const cleanupPeriodDays = settings.cleanupPeriodDays ?? DEFAULT_CLEANUP_PERIOD_DAYS;
|
|
@@ -464294,7 +464607,7 @@ async function cleanupOldFilesInDirectory(dirPath, cutoffDate, isMessagePath) {
|
|
|
464294
464607
|
try {
|
|
464295
464608
|
const timestamp = convertFileNameToDate(file.name);
|
|
464296
464609
|
if (timestamp < cutoffDate) {
|
|
464297
|
-
await getFsImplementation2().unlink(
|
|
464610
|
+
await getFsImplementation2().unlink(join169(dirPath, file.name));
|
|
464298
464611
|
if (isMessagePath) {
|
|
464299
464612
|
result.messages++;
|
|
464300
464613
|
} else {
|
|
@@ -464325,7 +464638,7 @@ async function cleanupOldMessageFiles() {
|
|
|
464325
464638
|
} catch {
|
|
464326
464639
|
return result;
|
|
464327
464640
|
}
|
|
464328
|
-
const mcpLogDirs = dirents.filter((dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")).map((dirent) =>
|
|
464641
|
+
const mcpLogDirs = dirents.filter((dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")).map((dirent) => join169(baseCachePath, dirent.name));
|
|
464329
464642
|
for (const mcpLogDir of mcpLogDirs) {
|
|
464330
464643
|
result = addCleanupResults(result, await cleanupOldFilesInDirectory(mcpLogDir, cutoffDate, true));
|
|
464331
464644
|
await tryRmdir(mcpLogDir, fsImpl);
|
|
@@ -464364,7 +464677,7 @@ async function cleanupOldSessionFiles() {
|
|
|
464364
464677
|
for (const projectDirent of projectDirents) {
|
|
464365
464678
|
if (!projectDirent.isDirectory())
|
|
464366
464679
|
continue;
|
|
464367
|
-
const projectDir =
|
|
464680
|
+
const projectDir = join169(projectsDir, projectDirent.name);
|
|
464368
464681
|
let entries;
|
|
464369
464682
|
try {
|
|
464370
464683
|
entries = await fsImpl.readdir(projectDir);
|
|
@@ -464378,15 +464691,15 @@ async function cleanupOldSessionFiles() {
|
|
|
464378
464691
|
continue;
|
|
464379
464692
|
}
|
|
464380
464693
|
try {
|
|
464381
|
-
if (await unlinkIfOld(
|
|
464694
|
+
if (await unlinkIfOld(join169(projectDir, entry.name), cutoffDate, fsImpl)) {
|
|
464382
464695
|
result.messages++;
|
|
464383
464696
|
}
|
|
464384
464697
|
} catch {
|
|
464385
464698
|
result.errors++;
|
|
464386
464699
|
}
|
|
464387
464700
|
} else if (entry.isDirectory()) {
|
|
464388
|
-
const sessionDir =
|
|
464389
|
-
const toolResultsDir =
|
|
464701
|
+
const sessionDir = join169(projectDir, entry.name);
|
|
464702
|
+
const toolResultsDir = join169(sessionDir, TOOL_RESULTS_SUBDIR3);
|
|
464390
464703
|
let toolDirs;
|
|
464391
464704
|
try {
|
|
464392
464705
|
toolDirs = await fsImpl.readdir(toolResultsDir);
|
|
@@ -464397,14 +464710,14 @@ async function cleanupOldSessionFiles() {
|
|
|
464397
464710
|
for (const toolEntry of toolDirs) {
|
|
464398
464711
|
if (toolEntry.isFile()) {
|
|
464399
464712
|
try {
|
|
464400
|
-
if (await unlinkIfOld(
|
|
464713
|
+
if (await unlinkIfOld(join169(toolResultsDir, toolEntry.name), cutoffDate, fsImpl)) {
|
|
464401
464714
|
result.messages++;
|
|
464402
464715
|
}
|
|
464403
464716
|
} catch {
|
|
464404
464717
|
result.errors++;
|
|
464405
464718
|
}
|
|
464406
464719
|
} else if (toolEntry.isDirectory()) {
|
|
464407
|
-
const toolDirPath =
|
|
464720
|
+
const toolDirPath = join169(toolResultsDir, toolEntry.name);
|
|
464408
464721
|
let toolFiles;
|
|
464409
464722
|
try {
|
|
464410
464723
|
toolFiles = await fsImpl.readdir(toolDirPath);
|
|
@@ -464415,7 +464728,7 @@ async function cleanupOldSessionFiles() {
|
|
|
464415
464728
|
if (!tf.isFile())
|
|
464416
464729
|
continue;
|
|
464417
464730
|
try {
|
|
464418
|
-
if (await unlinkIfOld(
|
|
464731
|
+
if (await unlinkIfOld(join169(toolDirPath, tf.name), cutoffDate, fsImpl)) {
|
|
464419
464732
|
result.messages++;
|
|
464420
464733
|
}
|
|
464421
464734
|
} catch {
|
|
@@ -464447,7 +464760,7 @@ async function cleanupSingleDirectory(dirPath, extension, removeEmptyDir = true)
|
|
|
464447
464760
|
if (!dirent.isFile() || !dirent.name.endsWith(extension))
|
|
464448
464761
|
continue;
|
|
464449
464762
|
try {
|
|
464450
|
-
if (await unlinkIfOld(
|
|
464763
|
+
if (await unlinkIfOld(join169(dirPath, dirent.name), cutoffDate, fsImpl)) {
|
|
464451
464764
|
result.messages++;
|
|
464452
464765
|
}
|
|
464453
464766
|
} catch {
|
|
@@ -464460,7 +464773,7 @@ async function cleanupSingleDirectory(dirPath, extension, removeEmptyDir = true)
|
|
|
464460
464773
|
return result;
|
|
464461
464774
|
}
|
|
464462
464775
|
function cleanupOldPlanFiles() {
|
|
464463
|
-
const plansDir =
|
|
464776
|
+
const plansDir = join169(getAtlasConfigHomeDir3(), "plans");
|
|
464464
464777
|
return cleanupSingleDirectory(plansDir, ".md");
|
|
464465
464778
|
}
|
|
464466
464779
|
async function cleanupOldFileHistoryBackups() {
|
|
@@ -464469,14 +464782,14 @@ async function cleanupOldFileHistoryBackups() {
|
|
|
464469
464782
|
const fsImpl = getFsImplementation2();
|
|
464470
464783
|
try {
|
|
464471
464784
|
const configDir = getAtlasConfigHomeDir3();
|
|
464472
|
-
const fileHistoryStorageDir =
|
|
464785
|
+
const fileHistoryStorageDir = join169(configDir, "file-history");
|
|
464473
464786
|
let dirents;
|
|
464474
464787
|
try {
|
|
464475
464788
|
dirents = await fsImpl.readdir(fileHistoryStorageDir);
|
|
464476
464789
|
} catch {
|
|
464477
464790
|
return result;
|
|
464478
464791
|
}
|
|
464479
|
-
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
464792
|
+
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join169(fileHistoryStorageDir, dirent.name));
|
|
464480
464793
|
await Promise.all(fileHistorySessionsDirs.map(async (fileHistorySessionDir) => {
|
|
464481
464794
|
try {
|
|
464482
464795
|
const stats = await fsImpl.stat(fileHistorySessionDir);
|
|
@@ -464503,14 +464816,14 @@ async function cleanupOldSessionEnvDirs() {
|
|
|
464503
464816
|
const fsImpl = getFsImplementation2();
|
|
464504
464817
|
try {
|
|
464505
464818
|
const configDir = getAtlasConfigHomeDir3();
|
|
464506
|
-
const sessionEnvBaseDir =
|
|
464819
|
+
const sessionEnvBaseDir = join169(configDir, "session-env");
|
|
464507
464820
|
let dirents;
|
|
464508
464821
|
try {
|
|
464509
464822
|
dirents = await fsImpl.readdir(sessionEnvBaseDir);
|
|
464510
464823
|
} catch {
|
|
464511
464824
|
return result;
|
|
464512
464825
|
}
|
|
464513
|
-
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
464826
|
+
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join169(sessionEnvBaseDir, dirent.name));
|
|
464514
464827
|
for (const sessionEnvDir of sessionEnvDirs) {
|
|
464515
464828
|
try {
|
|
464516
464829
|
const stats = await fsImpl.stat(sessionEnvDir);
|
|
@@ -464532,7 +464845,7 @@ async function cleanupOldDebugLogs() {
|
|
|
464532
464845
|
const cutoffDate = getCutoffDate();
|
|
464533
464846
|
const result = { messages: 0, errors: 0 };
|
|
464534
464847
|
const fsImpl = getFsImplementation2();
|
|
464535
|
-
const debugDir =
|
|
464848
|
+
const debugDir = join169(getAtlasConfigHomeDir3(), "debug");
|
|
464536
464849
|
let dirents;
|
|
464537
464850
|
try {
|
|
464538
464851
|
dirents = await fsImpl.readdir(debugDir);
|
|
@@ -464544,7 +464857,7 @@ async function cleanupOldDebugLogs() {
|
|
|
464544
464857
|
continue;
|
|
464545
464858
|
}
|
|
464546
464859
|
try {
|
|
464547
|
-
if (await unlinkIfOld(
|
|
464860
|
+
if (await unlinkIfOld(join169(debugDir, dirent.name), cutoffDate, fsImpl)) {
|
|
464548
464861
|
result.messages++;
|
|
464549
464862
|
}
|
|
464550
464863
|
} catch {
|
|
@@ -465990,9 +466303,9 @@ var init_coordinatorHandler = __esm(() => {
|
|
|
465990
466303
|
|
|
465991
466304
|
// src/tui/utils/permissions/sessionPermissionRules.ts
|
|
465992
466305
|
import { mkdir as mkdir53, readFile as readFile62, rename as rename11, writeFile as writeFile48 } from "fs/promises";
|
|
465993
|
-
import { dirname as dirname80, join as
|
|
466306
|
+
import { dirname as dirname80, join as join171 } from "path";
|
|
465994
466307
|
function sessionRulesPath(sessionId, projectDir) {
|
|
465995
|
-
return
|
|
466308
|
+
return join171(projectDir, `${sessionId}${SESSION_RULES_FILE_SUFFIX}`);
|
|
465996
466309
|
}
|
|
465997
466310
|
function parseSessionRulesJson(json) {
|
|
465998
466311
|
if (json.length > MAX_SESSION_RULES_BYTES)
|
|
@@ -468080,171 +468393,6 @@ var init_useMergedCommands = __esm(() => {
|
|
|
468080
468393
|
import_react250 = __toESM(require_react(), 1);
|
|
468081
468394
|
});
|
|
468082
468395
|
|
|
468083
|
-
// src/tui/utils/skills/skillChangeDetector.ts
|
|
468084
|
-
import * as platformPath2 from "path";
|
|
468085
|
-
async function initialize2() {
|
|
468086
|
-
if (initialized5 || disposed3)
|
|
468087
|
-
return;
|
|
468088
|
-
initialized5 = true;
|
|
468089
|
-
if (!dynamicSkillsCallbackRegistered) {
|
|
468090
|
-
dynamicSkillsCallbackRegistered = true;
|
|
468091
|
-
onDynamicSkillsLoaded2(() => {
|
|
468092
|
-
clearCommandMemoizationCaches2();
|
|
468093
|
-
skillsChanged.emit();
|
|
468094
|
-
});
|
|
468095
|
-
}
|
|
468096
|
-
const paths = await getWatchablePaths();
|
|
468097
|
-
if (paths.length === 0)
|
|
468098
|
-
return;
|
|
468099
|
-
logForDebugging3(`Watching for changes in skill/command directories: ${paths.join(", ")}...`);
|
|
468100
|
-
watcher4 = chokidar_default.watch(paths, {
|
|
468101
|
-
persistent: true,
|
|
468102
|
-
ignoreInitial: true,
|
|
468103
|
-
depth: 2,
|
|
468104
|
-
awaitWriteFinish: {
|
|
468105
|
-
stabilityThreshold: testOverrides2?.stabilityThreshold ?? FILE_STABILITY_THRESHOLD_MS3,
|
|
468106
|
-
pollInterval: testOverrides2?.pollInterval ?? FILE_STABILITY_POLL_INTERVAL_MS3
|
|
468107
|
-
},
|
|
468108
|
-
ignored: (path, stats) => {
|
|
468109
|
-
if (stats && !stats.isFile() && !stats.isDirectory())
|
|
468110
|
-
return true;
|
|
468111
|
-
return path.split(platformPath2.sep).some((dir) => dir === ".git");
|
|
468112
|
-
},
|
|
468113
|
-
ignorePermissionErrors: true,
|
|
468114
|
-
usePolling: USE_POLLING,
|
|
468115
|
-
interval: testOverrides2?.chokidarInterval ?? POLLING_INTERVAL_MS,
|
|
468116
|
-
atomic: true
|
|
468117
|
-
});
|
|
468118
|
-
watcher4.on("add", handleChange3);
|
|
468119
|
-
watcher4.on("change", handleChange3);
|
|
468120
|
-
watcher4.on("unlink", handleChange3);
|
|
468121
|
-
unregisterCleanup3 = registerCleanup3(async () => {
|
|
468122
|
-
await dispose3();
|
|
468123
|
-
});
|
|
468124
|
-
}
|
|
468125
|
-
function dispose3() {
|
|
468126
|
-
disposed3 = true;
|
|
468127
|
-
if (unregisterCleanup3) {
|
|
468128
|
-
unregisterCleanup3();
|
|
468129
|
-
unregisterCleanup3 = null;
|
|
468130
|
-
}
|
|
468131
|
-
let closePromise = Promise.resolve();
|
|
468132
|
-
if (watcher4) {
|
|
468133
|
-
closePromise = watcher4.close();
|
|
468134
|
-
watcher4 = null;
|
|
468135
|
-
}
|
|
468136
|
-
if (reloadTimer) {
|
|
468137
|
-
clearTimeout(reloadTimer);
|
|
468138
|
-
reloadTimer = null;
|
|
468139
|
-
}
|
|
468140
|
-
pendingChangedPaths.clear();
|
|
468141
|
-
skillsChanged.clear();
|
|
468142
|
-
return closePromise;
|
|
468143
|
-
}
|
|
468144
|
-
async function getWatchablePaths() {
|
|
468145
|
-
const fs = getFsImplementation2();
|
|
468146
|
-
const paths = [];
|
|
468147
|
-
const userSkillsPath = getSkillsPath2("userSettings", "skills");
|
|
468148
|
-
if (userSkillsPath) {
|
|
468149
|
-
try {
|
|
468150
|
-
await fs.stat(userSkillsPath);
|
|
468151
|
-
paths.push(userSkillsPath);
|
|
468152
|
-
} catch {}
|
|
468153
|
-
}
|
|
468154
|
-
const userCommandsPath = getSkillsPath2("userSettings", "commands");
|
|
468155
|
-
if (userCommandsPath) {
|
|
468156
|
-
try {
|
|
468157
|
-
await fs.stat(userCommandsPath);
|
|
468158
|
-
paths.push(userCommandsPath);
|
|
468159
|
-
} catch {}
|
|
468160
|
-
}
|
|
468161
|
-
const projectSkillsPath = getSkillsPath2("projectSettings", "skills");
|
|
468162
|
-
if (projectSkillsPath) {
|
|
468163
|
-
try {
|
|
468164
|
-
const absolutePath = platformPath2.resolve(projectSkillsPath);
|
|
468165
|
-
await fs.stat(absolutePath);
|
|
468166
|
-
paths.push(absolutePath);
|
|
468167
|
-
} catch {}
|
|
468168
|
-
}
|
|
468169
|
-
const projectCommandsPath = getSkillsPath2("projectSettings", "commands");
|
|
468170
|
-
if (projectCommandsPath) {
|
|
468171
|
-
try {
|
|
468172
|
-
const absolutePath = platformPath2.resolve(projectCommandsPath);
|
|
468173
|
-
await fs.stat(absolutePath);
|
|
468174
|
-
paths.push(absolutePath);
|
|
468175
|
-
} catch {}
|
|
468176
|
-
}
|
|
468177
|
-
for (const dir of getAdditionalDirectoriesForClaudeMd()) {
|
|
468178
|
-
const additionalSkillsPath = platformPath2.join(dir, getConfigDirName2(), "skills");
|
|
468179
|
-
try {
|
|
468180
|
-
await fs.stat(additionalSkillsPath);
|
|
468181
|
-
paths.push(additionalSkillsPath);
|
|
468182
|
-
} catch {}
|
|
468183
|
-
}
|
|
468184
|
-
return paths;
|
|
468185
|
-
}
|
|
468186
|
-
function handleChange3(path) {
|
|
468187
|
-
logForDebugging3(`Detected skill change: ${path}`);
|
|
468188
|
-
scheduleReload(path);
|
|
468189
|
-
}
|
|
468190
|
-
function scheduleReload(changedPath) {
|
|
468191
|
-
pendingChangedPaths.add(changedPath);
|
|
468192
|
-
if (reloadTimer)
|
|
468193
|
-
clearTimeout(reloadTimer);
|
|
468194
|
-
reloadTimer = setTimeout(async () => {
|
|
468195
|
-
reloadTimer = null;
|
|
468196
|
-
const paths = [...pendingChangedPaths];
|
|
468197
|
-
pendingChangedPaths.clear();
|
|
468198
|
-
const results = await executeConfigChangeHooks("skills", paths[0]);
|
|
468199
|
-
if (hasBlockingResult(results)) {
|
|
468200
|
-
logForDebugging3(`ConfigChange hook blocked skill reload (${paths.length} paths)`);
|
|
468201
|
-
return;
|
|
468202
|
-
}
|
|
468203
|
-
clearSkillCaches2();
|
|
468204
|
-
clearCommandsCache2();
|
|
468205
|
-
resetSentSkillNames();
|
|
468206
|
-
skillsChanged.emit();
|
|
468207
|
-
}, testOverrides2?.reloadDebounce ?? RELOAD_DEBOUNCE_MS);
|
|
468208
|
-
}
|
|
468209
|
-
async function resetForTesting2(overrides) {
|
|
468210
|
-
if (watcher4) {
|
|
468211
|
-
await watcher4.close();
|
|
468212
|
-
watcher4 = null;
|
|
468213
|
-
}
|
|
468214
|
-
if (reloadTimer) {
|
|
468215
|
-
clearTimeout(reloadTimer);
|
|
468216
|
-
reloadTimer = null;
|
|
468217
|
-
}
|
|
468218
|
-
pendingChangedPaths.clear();
|
|
468219
|
-
skillsChanged.clear();
|
|
468220
|
-
initialized5 = false;
|
|
468221
|
-
disposed3 = false;
|
|
468222
|
-
testOverrides2 = overrides ?? null;
|
|
468223
|
-
}
|
|
468224
|
-
var FILE_STABILITY_THRESHOLD_MS3 = 1000, FILE_STABILITY_POLL_INTERVAL_MS3 = 500, RELOAD_DEBOUNCE_MS = 300, POLLING_INTERVAL_MS = 2000, USE_POLLING, watcher4 = null, reloadTimer = null, pendingChangedPaths, initialized5 = false, disposed3 = false, dynamicSkillsCallbackRegistered = false, unregisterCleanup3 = null, skillsChanged, testOverrides2 = null, subscribe3, skillChangeDetector;
|
|
468225
|
-
var init_skillChangeDetector = __esm(() => {
|
|
468226
|
-
init_chokidar();
|
|
468227
|
-
init_configDir();
|
|
468228
|
-
init_bootstrapState();
|
|
468229
|
-
init_commands5();
|
|
468230
|
-
init_loadSkillsDir2();
|
|
468231
|
-
init_attachments();
|
|
468232
|
-
init_cleanupRegistry3();
|
|
468233
|
-
init_debug();
|
|
468234
|
-
init_fsOperations();
|
|
468235
|
-
init_hooks7();
|
|
468236
|
-
USE_POLLING = typeof Bun !== "undefined";
|
|
468237
|
-
pendingChangedPaths = new Set;
|
|
468238
|
-
skillsChanged = createSignal3();
|
|
468239
|
-
subscribe3 = skillsChanged.subscribe;
|
|
468240
|
-
skillChangeDetector = {
|
|
468241
|
-
initialize: initialize2,
|
|
468242
|
-
dispose: dispose3,
|
|
468243
|
-
subscribe: subscribe3,
|
|
468244
|
-
resetForTesting: resetForTesting2
|
|
468245
|
-
};
|
|
468246
|
-
});
|
|
468247
|
-
|
|
468248
468396
|
// src/tui/hooks/useSkillsChange.ts
|
|
468249
468397
|
function useSkillsChange(cwd, onCommandsChange) {
|
|
468250
468398
|
const handleChange = import_react251.useCallback(async () => {
|