@letta-ai/letta-code 0.12.6 → 0.12.7
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/letta.js
CHANGED
|
@@ -3237,7 +3237,7 @@ var package_default;
|
|
|
3237
3237
|
var init_package = __esm(() => {
|
|
3238
3238
|
package_default = {
|
|
3239
3239
|
name: "@letta-ai/letta-code",
|
|
3240
|
-
version: "0.12.
|
|
3240
|
+
version: "0.12.7",
|
|
3241
3241
|
description: "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
|
|
3242
3242
|
type: "module",
|
|
3243
3243
|
bin: {
|
|
@@ -32126,7 +32126,7 @@ __export(exports_subagents, {
|
|
|
32126
32126
|
});
|
|
32127
32127
|
import { existsSync as existsSync3 } from "node:fs";
|
|
32128
32128
|
import { readdir, readFile as readFile2 } from "node:fs/promises";
|
|
32129
|
-
import { join as
|
|
32129
|
+
import { join as join4 } from "node:path";
|
|
32130
32130
|
function isValidName(name) {
|
|
32131
32131
|
return /^[a-z][a-z0-9-]*$/.test(name);
|
|
32132
32132
|
}
|
|
@@ -32217,7 +32217,7 @@ async function discoverSubagentsFromDir(agentsDir, seenNames, subagents, errors)
|
|
|
32217
32217
|
if (!entry.isFile() || !entry.name.endsWith(".md")) {
|
|
32218
32218
|
continue;
|
|
32219
32219
|
}
|
|
32220
|
-
const filePath =
|
|
32220
|
+
const filePath = join4(agentsDir, entry.name);
|
|
32221
32221
|
try {
|
|
32222
32222
|
const config = await parseSubagentFile(filePath);
|
|
32223
32223
|
if (config) {
|
|
@@ -32249,7 +32249,7 @@ async function discoverSubagents(workingDirectory = process.cwd()) {
|
|
|
32249
32249
|
const subagents = [];
|
|
32250
32250
|
const seenNames = new Set;
|
|
32251
32251
|
await discoverSubagentsFromDir(GLOBAL_AGENTS_DIR, seenNames, subagents, errors);
|
|
32252
|
-
const projectAgentsDir =
|
|
32252
|
+
const projectAgentsDir = join4(workingDirectory, AGENTS_DIR);
|
|
32253
32253
|
await discoverSubagentsFromDir(projectAgentsDir, seenNames, subagents, errors);
|
|
32254
32254
|
return { subagents, errors };
|
|
32255
32255
|
}
|
|
@@ -32288,7 +32288,7 @@ var init_subagents = __esm(() => {
|
|
|
32288
32288
|
plan_default,
|
|
32289
32289
|
recall_default
|
|
32290
32290
|
];
|
|
32291
|
-
GLOBAL_AGENTS_DIR =
|
|
32291
|
+
GLOBAL_AGENTS_DIR = join4(process.env.HOME || process.env.USERPROFILE || "~", ".letta/agents");
|
|
32292
32292
|
VALID_MEMORY_BLOCKS = new Set(MEMORY_BLOCK_LABELS);
|
|
32293
32293
|
cache3 = {
|
|
32294
32294
|
builtins: null,
|
|
@@ -34566,8 +34566,8 @@ String: ${old_string}`);
|
|
|
34566
34566
|
var init_Edit2 = () => {};
|
|
34567
34567
|
|
|
34568
34568
|
// src/cli/helpers/planName.ts
|
|
34569
|
-
import { homedir as
|
|
34570
|
-
import { join as
|
|
34569
|
+
import { homedir as homedir6 } from "node:os";
|
|
34570
|
+
import { join as join6 } from "node:path";
|
|
34571
34571
|
function randomElement(arr) {
|
|
34572
34572
|
return arr[Math.floor(Math.random() * arr.length)];
|
|
34573
34573
|
}
|
|
@@ -34579,7 +34579,7 @@ function generatePlanName() {
|
|
|
34579
34579
|
}
|
|
34580
34580
|
function generatePlanFilePath() {
|
|
34581
34581
|
const name = generatePlanName();
|
|
34582
|
-
return
|
|
34582
|
+
return join6(homedir6(), ".letta", "plans", `${name}.md`);
|
|
34583
34583
|
}
|
|
34584
34584
|
var adjectives, nouns;
|
|
34585
34585
|
var init_planName = __esm(() => {
|
|
@@ -34688,6 +34688,8 @@ var exports_mode = {};
|
|
|
34688
34688
|
__export(exports_mode, {
|
|
34689
34689
|
permissionMode: () => permissionMode2
|
|
34690
34690
|
});
|
|
34691
|
+
import { homedir as homedir7 } from "node:os";
|
|
34692
|
+
import { join as join7 } from "node:path";
|
|
34691
34693
|
function getGlobalMode2() {
|
|
34692
34694
|
const global2 = globalThis;
|
|
34693
34695
|
if (!global2[MODE_KEY2]) {
|
|
@@ -34790,7 +34792,7 @@ class PermissionModeManager2 {
|
|
|
34790
34792
|
return "allow";
|
|
34791
34793
|
}
|
|
34792
34794
|
if (writeTools.includes(toolName)) {
|
|
34793
|
-
const
|
|
34795
|
+
const plansDir = join7(homedir7(), ".letta", "plans");
|
|
34794
34796
|
let targetPath = toolArgs?.file_path || toolArgs?.path;
|
|
34795
34797
|
if ((toolName === "ApplyPatch" || toolName === "apply_patch") && toolArgs?.input) {
|
|
34796
34798
|
const input = toolArgs.input;
|
|
@@ -34799,7 +34801,7 @@ class PermissionModeManager2 {
|
|
|
34799
34801
|
targetPath = match[1].trim();
|
|
34800
34802
|
}
|
|
34801
34803
|
}
|
|
34802
|
-
if (
|
|
34804
|
+
if (targetPath && targetPath.startsWith(plansDir) && targetPath.endsWith(".md")) {
|
|
34803
34805
|
return "allow";
|
|
34804
34806
|
}
|
|
34805
34807
|
}
|
|
@@ -34891,7 +34893,9 @@ var init_EnterPlanMode2 = __esm(() => {
|
|
|
34891
34893
|
async function exit_plan_mode() {
|
|
34892
34894
|
return {
|
|
34893
34895
|
message: `User has approved your plan. You can now start coding.
|
|
34894
|
-
Start with updating your todo list if applicable
|
|
34896
|
+
` + `Start with updating your todo list if applicable.
|
|
34897
|
+
|
|
34898
|
+
` + "Tip: If this plan will be referenced in the future by your future-self, " + "other agents, or humans, consider renaming the plan file to something easily " + "identifiable with a timestamp (e.g., `2026-01-auth-refactor.md`) rather than the random name."
|
|
34895
34899
|
};
|
|
34896
34900
|
}
|
|
34897
34901
|
|
|
@@ -36809,7 +36813,7 @@ var init_LS2 = __esm(() => {
|
|
|
36809
36813
|
|
|
36810
36814
|
// src/tools/impl/LS.ts
|
|
36811
36815
|
import { readdir as readdir2, stat } from "node:fs/promises";
|
|
36812
|
-
import { join as
|
|
36816
|
+
import { join as join9, resolve as resolve6 } from "node:path";
|
|
36813
36817
|
async function ls(args) {
|
|
36814
36818
|
validateRequiredParams(args, ["path"], "LS");
|
|
36815
36819
|
validateParamTypes(args, LS_default2, "LS");
|
|
@@ -36819,7 +36823,7 @@ async function ls(args) {
|
|
|
36819
36823
|
const items = await readdir2(dirPath);
|
|
36820
36824
|
const filteredItems = items.filter((item) => !ignore.some((pattern) => import_picomatch.default.isMatch(item, pattern)));
|
|
36821
36825
|
const fileInfos = await Promise.all(filteredItems.map(async (item) => {
|
|
36822
|
-
const fullPath =
|
|
36826
|
+
const fullPath = join9(dirPath, item);
|
|
36823
36827
|
try {
|
|
36824
36828
|
const stats = await stat(fullPath);
|
|
36825
36829
|
return {
|
|
@@ -43650,14 +43654,14 @@ __export(exports_skills, {
|
|
|
43650
43654
|
});
|
|
43651
43655
|
import { existsSync as existsSync5 } from "node:fs";
|
|
43652
43656
|
import { readdir as readdir4, readFile as readFile3 } from "node:fs/promises";
|
|
43653
|
-
import { dirname as dirname4, join as
|
|
43657
|
+
import { dirname as dirname4, join as join10 } from "node:path";
|
|
43654
43658
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
43655
43659
|
function getBundledSkillsPath() {
|
|
43656
43660
|
const thisDir = dirname4(fileURLToPath6(import.meta.url));
|
|
43657
43661
|
if (thisDir.includes("src/agent") || thisDir.includes("src\\agent")) {
|
|
43658
|
-
return
|
|
43662
|
+
return join10(thisDir, "../skills/builtin");
|
|
43659
43663
|
}
|
|
43660
|
-
return
|
|
43664
|
+
return join10(thisDir, "skills");
|
|
43661
43665
|
}
|
|
43662
43666
|
async function getBundledSkills() {
|
|
43663
43667
|
const bundledPath = getBundledSkillsPath();
|
|
@@ -43680,7 +43684,7 @@ async function discoverSkillsFromDir(skillsPath, source) {
|
|
|
43680
43684
|
}
|
|
43681
43685
|
return { skills, errors };
|
|
43682
43686
|
}
|
|
43683
|
-
async function discoverSkills(projectSkillsPath =
|
|
43687
|
+
async function discoverSkills(projectSkillsPath = join10(process.cwd(), SKILLS_DIR)) {
|
|
43684
43688
|
const allErrors = [];
|
|
43685
43689
|
const skillsById = new Map;
|
|
43686
43690
|
const bundledSkills = await getBundledSkills();
|
|
@@ -43706,7 +43710,7 @@ async function findSkillFiles(currentPath, rootPath, skills, errors, source) {
|
|
|
43706
43710
|
try {
|
|
43707
43711
|
const entries = await readdir4(currentPath, { withFileTypes: true });
|
|
43708
43712
|
for (const entry of entries) {
|
|
43709
|
-
const fullPath =
|
|
43713
|
+
const fullPath = join10(currentPath, entry.name);
|
|
43710
43714
|
if (entry.isDirectory()) {
|
|
43711
43715
|
await findSkillFiles(fullPath, rootPath, skills, errors, source);
|
|
43712
43716
|
} else if (entry.isFile() && entry.name.toUpperCase() === "SKILL.MD") {
|
|
@@ -43892,13 +43896,13 @@ function formatSkillsForMemory(skills, skillsDirectory) {
|
|
|
43892
43896
|
}
|
|
43893
43897
|
var SKILLS_DIR = ".skills", GLOBAL_SKILLS_DIR, SKILLS_BLOCK_CHAR_LIMIT = 20000;
|
|
43894
43898
|
var init_skills2 = __esm(() => {
|
|
43895
|
-
GLOBAL_SKILLS_DIR =
|
|
43899
|
+
GLOBAL_SKILLS_DIR = join10(process.env.HOME || process.env.USERPROFILE || "~", ".letta/skills");
|
|
43896
43900
|
});
|
|
43897
43901
|
|
|
43898
43902
|
// src/tools/impl/Skill.ts
|
|
43899
43903
|
import { readdirSync as readdirSync3 } from "node:fs";
|
|
43900
43904
|
import { readFile as readFile4 } from "node:fs/promises";
|
|
43901
|
-
import { dirname as dirname5, join as
|
|
43905
|
+
import { dirname as dirname5, join as join11 } from "node:path";
|
|
43902
43906
|
function parseLoadedSkills(value) {
|
|
43903
43907
|
const skillMap = new Map;
|
|
43904
43908
|
const skillHeaderRegex = /# Skill: ([^\n]+)/g;
|
|
@@ -43973,19 +43977,19 @@ async function readSkillContent(skillId, skillsDir) {
|
|
|
43973
43977
|
return { content, path: bundledSkill.path };
|
|
43974
43978
|
} catch {}
|
|
43975
43979
|
}
|
|
43976
|
-
const globalSkillPath =
|
|
43980
|
+
const globalSkillPath = join11(GLOBAL_SKILLS_DIR, skillId, "SKILL.md");
|
|
43977
43981
|
try {
|
|
43978
43982
|
const content = await readFile4(globalSkillPath, "utf-8");
|
|
43979
43983
|
return { content, path: globalSkillPath };
|
|
43980
43984
|
} catch {}
|
|
43981
|
-
const projectSkillPath =
|
|
43985
|
+
const projectSkillPath = join11(skillsDir, skillId, "SKILL.md");
|
|
43982
43986
|
try {
|
|
43983
43987
|
const content = await readFile4(projectSkillPath, "utf-8");
|
|
43984
43988
|
return { content, path: projectSkillPath };
|
|
43985
43989
|
} catch (primaryError) {
|
|
43986
43990
|
try {
|
|
43987
|
-
const bundledSkillsDir =
|
|
43988
|
-
const bundledSkillPath =
|
|
43991
|
+
const bundledSkillsDir = join11(process.cwd(), "skills", "skills");
|
|
43992
|
+
const bundledSkillPath = join11(bundledSkillsDir, skillId, "SKILL.md");
|
|
43989
43993
|
const content = await readFile4(bundledSkillPath, "utf-8");
|
|
43990
43994
|
return { content, path: bundledSkillPath };
|
|
43991
43995
|
} catch {
|
|
@@ -44006,7 +44010,7 @@ async function getResolvedSkillsDir(client, agentId) {
|
|
|
44006
44010
|
} catch {}
|
|
44007
44011
|
}
|
|
44008
44012
|
if (!skillsDir) {
|
|
44009
|
-
skillsDir =
|
|
44013
|
+
skillsDir = join11(process.cwd(), SKILLS_DIR);
|
|
44010
44014
|
}
|
|
44011
44015
|
return skillsDir;
|
|
44012
44016
|
}
|
|
@@ -46324,14 +46328,14 @@ __export(exports_skills2, {
|
|
|
46324
46328
|
});
|
|
46325
46329
|
import { existsSync as existsSync6 } from "node:fs";
|
|
46326
46330
|
import { readdir as readdir5, readFile as readFile5 } from "node:fs/promises";
|
|
46327
|
-
import { dirname as dirname7, join as
|
|
46331
|
+
import { dirname as dirname7, join as join12 } from "node:path";
|
|
46328
46332
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
46329
46333
|
function getBundledSkillsPath2() {
|
|
46330
46334
|
const thisDir = dirname7(fileURLToPath7(import.meta.url));
|
|
46331
46335
|
if (thisDir.includes("src/agent") || thisDir.includes("src\\agent")) {
|
|
46332
|
-
return
|
|
46336
|
+
return join12(thisDir, "../skills/builtin");
|
|
46333
46337
|
}
|
|
46334
|
-
return
|
|
46338
|
+
return join12(thisDir, "skills");
|
|
46335
46339
|
}
|
|
46336
46340
|
async function getBundledSkills2() {
|
|
46337
46341
|
const bundledPath = getBundledSkillsPath2();
|
|
@@ -46354,7 +46358,7 @@ async function discoverSkillsFromDir2(skillsPath, source) {
|
|
|
46354
46358
|
}
|
|
46355
46359
|
return { skills, errors };
|
|
46356
46360
|
}
|
|
46357
|
-
async function discoverSkills2(projectSkillsPath =
|
|
46361
|
+
async function discoverSkills2(projectSkillsPath = join12(process.cwd(), SKILLS_DIR2)) {
|
|
46358
46362
|
const allErrors = [];
|
|
46359
46363
|
const skillsById = new Map;
|
|
46360
46364
|
const bundledSkills = await getBundledSkills2();
|
|
@@ -46380,7 +46384,7 @@ async function findSkillFiles2(currentPath, rootPath, skills, errors, source) {
|
|
|
46380
46384
|
try {
|
|
46381
46385
|
const entries = await readdir5(currentPath, { withFileTypes: true });
|
|
46382
46386
|
for (const entry of entries) {
|
|
46383
|
-
const fullPath =
|
|
46387
|
+
const fullPath = join12(currentPath, entry.name);
|
|
46384
46388
|
if (entry.isDirectory()) {
|
|
46385
46389
|
await findSkillFiles2(fullPath, rootPath, skills, errors, source);
|
|
46386
46390
|
} else if (entry.isFile() && entry.name.toUpperCase() === "SKILL.MD") {
|
|
@@ -46566,7 +46570,7 @@ function formatSkillsForMemory2(skills, skillsDirectory) {
|
|
|
46566
46570
|
}
|
|
46567
46571
|
var SKILLS_DIR2 = ".skills", GLOBAL_SKILLS_DIR2, SKILLS_BLOCK_CHAR_LIMIT2 = 20000;
|
|
46568
46572
|
var init_skills3 = __esm(() => {
|
|
46569
|
-
GLOBAL_SKILLS_DIR2 =
|
|
46573
|
+
GLOBAL_SKILLS_DIR2 = join12(process.env.HOME || process.env.USERPROFILE || "~", ".letta/skills");
|
|
46570
46574
|
});
|
|
46571
46575
|
|
|
46572
46576
|
// src/utils/fs.ts
|
|
@@ -47046,7 +47050,7 @@ __export(exports_subagents2, {
|
|
|
47046
47050
|
});
|
|
47047
47051
|
import { existsSync as existsSync8 } from "node:fs";
|
|
47048
47052
|
import { readdir as readdir6, readFile as readFile7 } from "node:fs/promises";
|
|
47049
|
-
import { join as
|
|
47053
|
+
import { join as join13 } from "node:path";
|
|
47050
47054
|
function isValidName2(name) {
|
|
47051
47055
|
return /^[a-z][a-z0-9-]*$/.test(name);
|
|
47052
47056
|
}
|
|
@@ -47137,7 +47141,7 @@ async function discoverSubagentsFromDir2(agentsDir, seenNames, subagents, errors
|
|
|
47137
47141
|
if (!entry.isFile() || !entry.name.endsWith(".md")) {
|
|
47138
47142
|
continue;
|
|
47139
47143
|
}
|
|
47140
|
-
const filePath =
|
|
47144
|
+
const filePath = join13(agentsDir, entry.name);
|
|
47141
47145
|
try {
|
|
47142
47146
|
const config = await parseSubagentFile2(filePath);
|
|
47143
47147
|
if (config) {
|
|
@@ -47169,7 +47173,7 @@ async function discoverSubagents2(workingDirectory = process.cwd()) {
|
|
|
47169
47173
|
const subagents = [];
|
|
47170
47174
|
const seenNames = new Set;
|
|
47171
47175
|
await discoverSubagentsFromDir2(GLOBAL_AGENTS_DIR2, seenNames, subagents, errors);
|
|
47172
|
-
const projectAgentsDir =
|
|
47176
|
+
const projectAgentsDir = join13(workingDirectory, AGENTS_DIR2);
|
|
47173
47177
|
await discoverSubagentsFromDir2(projectAgentsDir, seenNames, subagents, errors);
|
|
47174
47178
|
return { subagents, errors };
|
|
47175
47179
|
}
|
|
@@ -47208,7 +47212,7 @@ var init_subagents2 = __esm(() => {
|
|
|
47208
47212
|
plan_default,
|
|
47209
47213
|
recall_default
|
|
47210
47214
|
];
|
|
47211
|
-
GLOBAL_AGENTS_DIR2 =
|
|
47215
|
+
GLOBAL_AGENTS_DIR2 = join13(process.env.HOME || process.env.USERPROFILE || "~", ".letta/agents");
|
|
47212
47216
|
VALID_MEMORY_BLOCKS2 = new Set(MEMORY_BLOCK_LABELS);
|
|
47213
47217
|
cache4 = {
|
|
47214
47218
|
builtins: null,
|
|
@@ -49522,8 +49526,8 @@ function matchesFilePattern(query, pattern, workingDirectory) {
|
|
|
49522
49526
|
globPattern = globPattern.slice(2);
|
|
49523
49527
|
}
|
|
49524
49528
|
if (globPattern.startsWith("~/")) {
|
|
49525
|
-
const
|
|
49526
|
-
globPattern = globPattern.replace(/^~/,
|
|
49529
|
+
const homedir8 = __require("node:os").homedir();
|
|
49530
|
+
globPattern = globPattern.replace(/^~/, homedir8);
|
|
49527
49531
|
}
|
|
49528
49532
|
if (globPattern.startsWith("//")) {
|
|
49529
49533
|
globPattern = globPattern.slice(1);
|
|
@@ -49901,8 +49905,8 @@ __export(exports_loader, {
|
|
|
49901
49905
|
savePermissionRule: () => savePermissionRule,
|
|
49902
49906
|
loadPermissions: () => loadPermissions
|
|
49903
49907
|
});
|
|
49904
|
-
import { homedir as
|
|
49905
|
-
import { join as
|
|
49908
|
+
import { homedir as homedir8 } from "node:os";
|
|
49909
|
+
import { join as join14 } from "node:path";
|
|
49906
49910
|
async function loadPermissions(workingDirectory = process.cwd()) {
|
|
49907
49911
|
const merged = {
|
|
49908
49912
|
allow: [],
|
|
@@ -49911,10 +49915,10 @@ async function loadPermissions(workingDirectory = process.cwd()) {
|
|
|
49911
49915
|
additionalDirectories: []
|
|
49912
49916
|
};
|
|
49913
49917
|
const sources = [
|
|
49914
|
-
|
|
49915
|
-
|
|
49916
|
-
|
|
49917
|
-
|
|
49918
|
+
join14(process.env.XDG_CONFIG_HOME || join14(homedir8(), ".config"), "letta", "settings.json"),
|
|
49919
|
+
join14(homedir8(), ".letta", "settings.json"),
|
|
49920
|
+
join14(workingDirectory, ".letta", "settings.json"),
|
|
49921
|
+
join14(workingDirectory, ".letta", "settings.local.json")
|
|
49918
49922
|
];
|
|
49919
49923
|
for (const settingsPath of sources) {
|
|
49920
49924
|
try {
|
|
@@ -49950,13 +49954,13 @@ async function savePermissionRule(rule, ruleType, scope, workingDirectory = proc
|
|
|
49950
49954
|
let settingsPath;
|
|
49951
49955
|
switch (scope) {
|
|
49952
49956
|
case "user":
|
|
49953
|
-
settingsPath =
|
|
49957
|
+
settingsPath = join14(process.env.XDG_CONFIG_HOME || join14(homedir8(), ".config"), "letta", "settings.json");
|
|
49954
49958
|
break;
|
|
49955
49959
|
case "project":
|
|
49956
|
-
settingsPath =
|
|
49960
|
+
settingsPath = join14(workingDirectory, ".letta", "settings.json");
|
|
49957
49961
|
break;
|
|
49958
49962
|
case "local":
|
|
49959
|
-
settingsPath =
|
|
49963
|
+
settingsPath = join14(workingDirectory, ".letta", "settings.local.json");
|
|
49960
49964
|
break;
|
|
49961
49965
|
}
|
|
49962
49966
|
let settings = {};
|
|
@@ -49981,7 +49985,7 @@ async function savePermissionRule(rule, ruleType, scope, workingDirectory = proc
|
|
|
49981
49985
|
}
|
|
49982
49986
|
}
|
|
49983
49987
|
async function ensureLocalSettingsIgnored(workingDirectory) {
|
|
49984
|
-
const gitignorePath =
|
|
49988
|
+
const gitignorePath = join14(workingDirectory, ".gitignore");
|
|
49985
49989
|
const pattern = ".letta/settings.local.json";
|
|
49986
49990
|
try {
|
|
49987
49991
|
let content = "";
|
|
@@ -50887,7 +50891,7 @@ var init_manager4 = __esm(async () => {
|
|
|
50887
50891
|
});
|
|
50888
50892
|
|
|
50889
50893
|
// src/agent/create.ts
|
|
50890
|
-
import { join as
|
|
50894
|
+
import { join as join15 } from "node:path";
|
|
50891
50895
|
async function createAgent(nameOrOptions = DEFAULT_AGENT_NAME, model, embeddingModel = "openai/text-embedding-3-small", updateArgs, skillsDirectory, parallelToolCalls = true, enableSleeptime = false, systemPromptPreset, initBlocks, baseTools) {
|
|
50892
50896
|
let options;
|
|
50893
50897
|
if (typeof nameOrOptions === "object") {
|
|
@@ -50982,7 +50986,7 @@ async function createAgent(nameOrOptions = DEFAULT_AGENT_NAME, model, embeddingM
|
|
|
50982
50986
|
}
|
|
50983
50987
|
}
|
|
50984
50988
|
}
|
|
50985
|
-
const resolvedSkillsDirectory = options.skillsDirectory ||
|
|
50989
|
+
const resolvedSkillsDirectory = options.skillsDirectory || join15(process.cwd(), SKILLS_DIR);
|
|
50986
50990
|
try {
|
|
50987
50991
|
const { skills, errors } = await discoverSkills(resolvedSkillsDirectory);
|
|
50988
50992
|
if (errors.length > 0) {
|
|
@@ -52556,8 +52560,8 @@ async function handleHeadlessCommand(argv, model, skillsDirectory) {
|
|
|
52556
52560
|
await initializeLoadedSkillsFlag2();
|
|
52557
52561
|
try {
|
|
52558
52562
|
const { discoverSkills: discoverSkills3, formatSkillsForMemory: formatSkillsForMemory3, SKILLS_DIR: SKILLS_DIR3 } = await Promise.resolve().then(() => (init_skills2(), exports_skills));
|
|
52559
|
-
const { join:
|
|
52560
|
-
const resolvedSkillsDirectory = skillsDirectory ||
|
|
52563
|
+
const { join: join16 } = await import("node:path");
|
|
52564
|
+
const resolvedSkillsDirectory = skillsDirectory || join16(process.cwd(), SKILLS_DIR3);
|
|
52561
52565
|
const { skills, errors } = await discoverSkills3(resolvedSkillsDirectory);
|
|
52562
52566
|
if (errors.length > 0) {
|
|
52563
52567
|
console.warn("Errors encountered during skill discovery:");
|
|
@@ -53019,7 +53023,8 @@ async function handleHeadlessCommand(argv, model, skillsDirectory) {
|
|
|
53019
53023
|
"OpenAI API error",
|
|
53020
53024
|
"Google Vertex API error",
|
|
53021
53025
|
"overloaded",
|
|
53022
|
-
"api_error"
|
|
53026
|
+
"api_error",
|
|
53027
|
+
"Network error"
|
|
53023
53028
|
];
|
|
53024
53029
|
const isLlmErrorFromDetail = errorType === "internal_error" && llmProviderPatterns.some((pattern) => detail.includes(pattern));
|
|
53025
53030
|
if (errorType === "llm_error" || isLlmErrorFromDetail) {
|
|
@@ -53854,10 +53859,10 @@ __export(exports_settings, {
|
|
|
53854
53859
|
loadProjectSettings: () => loadProjectSettings,
|
|
53855
53860
|
getSetting: () => getSetting
|
|
53856
53861
|
});
|
|
53857
|
-
import { homedir as
|
|
53858
|
-
import { join as
|
|
53862
|
+
import { homedir as homedir9 } from "node:os";
|
|
53863
|
+
import { join as join16 } from "node:path";
|
|
53859
53864
|
function getSettingsPath() {
|
|
53860
|
-
return
|
|
53865
|
+
return join16(homedir9(), ".letta", "settings.json");
|
|
53861
53866
|
}
|
|
53862
53867
|
async function loadSettings() {
|
|
53863
53868
|
const settingsPath = getSettingsPath();
|
|
@@ -53894,7 +53899,7 @@ async function getSetting(key) {
|
|
|
53894
53899
|
return settings[key];
|
|
53895
53900
|
}
|
|
53896
53901
|
function getProjectSettingsPath() {
|
|
53897
|
-
return
|
|
53902
|
+
return join16(process.cwd(), ".letta", "settings.local.json");
|
|
53898
53903
|
}
|
|
53899
53904
|
async function loadProjectSettings() {
|
|
53900
53905
|
const settingsPath = getProjectSettingsPath();
|
|
@@ -53912,7 +53917,7 @@ async function loadProjectSettings() {
|
|
|
53912
53917
|
}
|
|
53913
53918
|
async function saveProjectSettings(settings) {
|
|
53914
53919
|
const settingsPath = getProjectSettingsPath();
|
|
53915
|
-
const dirPath =
|
|
53920
|
+
const dirPath = join16(process.cwd(), ".letta");
|
|
53916
53921
|
try {
|
|
53917
53922
|
if (!exists(dirPath)) {
|
|
53918
53923
|
await mkdir(dirPath, { recursive: true });
|
|
@@ -57510,12 +57515,15 @@ var init_BlinkDot = __esm(async () => {
|
|
|
57510
57515
|
});
|
|
57511
57516
|
|
|
57512
57517
|
// src/cli/components/CollapsedOutputDisplay.tsx
|
|
57513
|
-
var import_react35, jsx_dev_runtime15, COLLAPSED_LINES = 3, CollapsedOutputDisplay;
|
|
57518
|
+
var import_react35, jsx_dev_runtime15, COLLAPSED_LINES = 3, PREFIX_WIDTH = 5, CollapsedOutputDisplay;
|
|
57514
57519
|
var init_CollapsedOutputDisplay = __esm(async () => {
|
|
57520
|
+
init_useTerminalWidth();
|
|
57515
57521
|
await init_build2();
|
|
57516
57522
|
import_react35 = __toESM(require_react(), 1);
|
|
57517
57523
|
jsx_dev_runtime15 = __toESM(require_jsx_dev_runtime(), 1);
|
|
57518
57524
|
CollapsedOutputDisplay = import_react35.memo(({ output }) => {
|
|
57525
|
+
const columns = useTerminalWidth();
|
|
57526
|
+
const contentWidth = Math.max(0, columns - PREFIX_WIDTH);
|
|
57519
57527
|
const lines = output.split(`
|
|
57520
57528
|
`);
|
|
57521
57529
|
if (lines.length > 0 && lines[lines.length - 1] === "") {
|
|
@@ -57530,28 +57538,67 @@ var init_CollapsedOutputDisplay = __esm(async () => {
|
|
|
57530
57538
|
flexDirection: "column",
|
|
57531
57539
|
children: [
|
|
57532
57540
|
/* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Box_default, {
|
|
57541
|
+
flexDirection: "row",
|
|
57533
57542
|
children: [
|
|
57534
|
-
/* @__PURE__ */ jsx_dev_runtime15.jsxDEV(
|
|
57535
|
-
|
|
57543
|
+
/* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Box_default, {
|
|
57544
|
+
width: PREFIX_WIDTH,
|
|
57545
|
+
flexShrink: 0,
|
|
57546
|
+
children: /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Text, {
|
|
57547
|
+
children: " ⎿ "
|
|
57548
|
+
}, undefined, false, undefined, this)
|
|
57536
57549
|
}, undefined, false, undefined, this),
|
|
57537
|
-
/* @__PURE__ */ jsx_dev_runtime15.jsxDEV(
|
|
57538
|
-
|
|
57550
|
+
/* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Box_default, {
|
|
57551
|
+
flexGrow: 1,
|
|
57552
|
+
width: contentWidth,
|
|
57553
|
+
children: /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Text, {
|
|
57554
|
+
wrap: "wrap",
|
|
57555
|
+
children: visibleLines[0]
|
|
57556
|
+
}, undefined, false, undefined, this)
|
|
57539
57557
|
}, undefined, false, undefined, this)
|
|
57540
57558
|
]
|
|
57541
57559
|
}, undefined, true, undefined, this),
|
|
57542
|
-
visibleLines.slice(1).map((line, i) => /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(
|
|
57560
|
+
visibleLines.slice(1).map((line, i) => /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Box_default, {
|
|
57561
|
+
flexDirection: "row",
|
|
57543
57562
|
children: [
|
|
57544
|
-
|
|
57545
|
-
|
|
57563
|
+
/* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Box_default, {
|
|
57564
|
+
width: PREFIX_WIDTH,
|
|
57565
|
+
flexShrink: 0,
|
|
57566
|
+
children: /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Text, {
|
|
57567
|
+
children: " "
|
|
57568
|
+
}, undefined, false, undefined, this)
|
|
57569
|
+
}, undefined, false, undefined, this),
|
|
57570
|
+
/* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Box_default, {
|
|
57571
|
+
flexGrow: 1,
|
|
57572
|
+
width: contentWidth,
|
|
57573
|
+
children: /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Text, {
|
|
57574
|
+
wrap: "wrap",
|
|
57575
|
+
children: line
|
|
57576
|
+
}, undefined, false, undefined, this)
|
|
57577
|
+
}, undefined, false, undefined, this)
|
|
57546
57578
|
]
|
|
57547
57579
|
}, i, true, undefined, this)),
|
|
57548
|
-
hiddenCount > 0 && /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(
|
|
57549
|
-
|
|
57580
|
+
hiddenCount > 0 && /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Box_default, {
|
|
57581
|
+
flexDirection: "row",
|
|
57550
57582
|
children: [
|
|
57551
|
-
|
|
57552
|
-
|
|
57553
|
-
|
|
57554
|
-
|
|
57583
|
+
/* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Box_default, {
|
|
57584
|
+
width: PREFIX_WIDTH,
|
|
57585
|
+
flexShrink: 0,
|
|
57586
|
+
children: /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Text, {
|
|
57587
|
+
children: " "
|
|
57588
|
+
}, undefined, false, undefined, this)
|
|
57589
|
+
}, undefined, false, undefined, this),
|
|
57590
|
+
/* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Box_default, {
|
|
57591
|
+
flexGrow: 1,
|
|
57592
|
+
width: contentWidth,
|
|
57593
|
+
children: /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Text, {
|
|
57594
|
+
dimColor: true,
|
|
57595
|
+
children: [
|
|
57596
|
+
"… +",
|
|
57597
|
+
hiddenCount,
|
|
57598
|
+
" lines"
|
|
57599
|
+
]
|
|
57600
|
+
}, undefined, true, undefined, this)
|
|
57601
|
+
}, undefined, false, undefined, this)
|
|
57555
57602
|
]
|
|
57556
57603
|
}, undefined, true, undefined, this)
|
|
57557
57604
|
]
|
|
@@ -58741,8 +58788,8 @@ import {
|
|
|
58741
58788
|
readFileSync as readFileSync3,
|
|
58742
58789
|
writeFileSync as writeFileSync2
|
|
58743
58790
|
} from "node:fs";
|
|
58744
|
-
import { homedir as
|
|
58745
|
-
import { dirname as dirname10, join as
|
|
58791
|
+
import { homedir as homedir10, platform as platform3 } from "node:os";
|
|
58792
|
+
import { dirname as dirname10, join as join17 } from "node:path";
|
|
58746
58793
|
function detectTerminalType() {
|
|
58747
58794
|
if (process.env.CURSOR_TRACE_ID || process.env.CURSOR_CHANNEL) {
|
|
58748
58795
|
return "cursor";
|
|
@@ -58774,16 +58821,16 @@ function getKeybindingsPath(terminal) {
|
|
|
58774
58821
|
}[terminal];
|
|
58775
58822
|
const os4 = platform3();
|
|
58776
58823
|
if (os4 === "darwin") {
|
|
58777
|
-
return
|
|
58824
|
+
return join17(homedir10(), "Library", "Application Support", appName, "User", "keybindings.json");
|
|
58778
58825
|
}
|
|
58779
58826
|
if (os4 === "win32") {
|
|
58780
58827
|
const appData = process.env.APPDATA;
|
|
58781
58828
|
if (!appData)
|
|
58782
58829
|
return null;
|
|
58783
|
-
return
|
|
58830
|
+
return join17(appData, appName, "User", "keybindings.json");
|
|
58784
58831
|
}
|
|
58785
58832
|
if (os4 === "linux") {
|
|
58786
|
-
return
|
|
58833
|
+
return join17(homedir10(), ".config", appName, "User", "keybindings.json");
|
|
58787
58834
|
}
|
|
58788
58835
|
return null;
|
|
58789
58836
|
}
|
|
@@ -58936,14 +58983,14 @@ function getWezTermConfigPath() {
|
|
|
58936
58983
|
}
|
|
58937
58984
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
58938
58985
|
if (xdgConfig) {
|
|
58939
|
-
const xdgPath =
|
|
58986
|
+
const xdgPath = join17(xdgConfig, "wezterm", "wezterm.lua");
|
|
58940
58987
|
if (existsSync10(xdgPath))
|
|
58941
58988
|
return xdgPath;
|
|
58942
58989
|
}
|
|
58943
|
-
const configPath =
|
|
58990
|
+
const configPath = join17(homedir10(), ".config", "wezterm", "wezterm.lua");
|
|
58944
58991
|
if (existsSync10(configPath))
|
|
58945
58992
|
return configPath;
|
|
58946
|
-
return
|
|
58993
|
+
return join17(homedir10(), ".wezterm.lua");
|
|
58947
58994
|
}
|
|
58948
58995
|
function wezTermDeleteFixExists(configPath) {
|
|
58949
58996
|
if (!existsSync10(configPath))
|
|
@@ -59379,7 +59426,7 @@ __export(exports_custom, {
|
|
|
59379
59426
|
});
|
|
59380
59427
|
import { existsSync as existsSync11 } from "node:fs";
|
|
59381
59428
|
import { readdir as readdir7, readFile as readFile8 } from "node:fs/promises";
|
|
59382
|
-
import { basename as basename3, dirname as dirname11, join as
|
|
59429
|
+
import { basename as basename3, dirname as dirname11, join as join18 } from "node:path";
|
|
59383
59430
|
async function getCustomCommands() {
|
|
59384
59431
|
if (cachedCommands !== null) {
|
|
59385
59432
|
return cachedCommands;
|
|
@@ -59390,7 +59437,7 @@ async function getCustomCommands() {
|
|
|
59390
59437
|
function refreshCustomCommands() {
|
|
59391
59438
|
cachedCommands = null;
|
|
59392
59439
|
}
|
|
59393
|
-
async function discoverCustomCommands(projectPath =
|
|
59440
|
+
async function discoverCustomCommands(projectPath = join18(process.cwd(), COMMANDS_DIR)) {
|
|
59394
59441
|
const commandsById = new Map;
|
|
59395
59442
|
const userCommands = await discoverFromDirectory(GLOBAL_COMMANDS_DIR, "user");
|
|
59396
59443
|
for (const cmd of userCommands) {
|
|
@@ -59422,7 +59469,7 @@ async function findCommandFiles(currentPath, rootPath, commands2, source) {
|
|
|
59422
59469
|
try {
|
|
59423
59470
|
const entries = await readdir7(currentPath, { withFileTypes: true });
|
|
59424
59471
|
for (const entry of entries) {
|
|
59425
|
-
const fullPath =
|
|
59472
|
+
const fullPath = join18(currentPath, entry.name);
|
|
59426
59473
|
if (entry.isDirectory()) {
|
|
59427
59474
|
await findCommandFiles(fullPath, rootPath, commands2, source);
|
|
59428
59475
|
} else if (entry.isFile() && entry.name.endsWith(".md")) {
|
|
@@ -59507,7 +59554,7 @@ async function findCustomCommand(commandName) {
|
|
|
59507
59554
|
}
|
|
59508
59555
|
var COMMANDS_DIR = ".commands", GLOBAL_COMMANDS_DIR, cachedCommands = null;
|
|
59509
59556
|
var init_custom = __esm(() => {
|
|
59510
|
-
GLOBAL_COMMANDS_DIR =
|
|
59557
|
+
GLOBAL_COMMANDS_DIR = join18(process.env.HOME || process.env.USERPROFILE || "~", ".letta/commands");
|
|
59511
59558
|
});
|
|
59512
59559
|
|
|
59513
59560
|
// src/cli/components/HelpDialog.tsx
|
|
@@ -64479,7 +64526,7 @@ var init_AgentInfoBar = __esm(async () => {
|
|
|
64479
64526
|
|
|
64480
64527
|
// src/cli/helpers/fileSearch.ts
|
|
64481
64528
|
import { readdirSync as readdirSync4, statSync as statSync3 } from "node:fs";
|
|
64482
|
-
import { join as
|
|
64529
|
+
import { join as join19, resolve as resolve19 } from "node:path";
|
|
64483
64530
|
function searchDirectoryRecursive(dir, pattern, maxResults = 200, results = []) {
|
|
64484
64531
|
if (results.length >= maxResults) {
|
|
64485
64532
|
return results;
|
|
@@ -64491,7 +64538,7 @@ function searchDirectoryRecursive(dir, pattern, maxResults = 200, results = [])
|
|
|
64491
64538
|
continue;
|
|
64492
64539
|
}
|
|
64493
64540
|
try {
|
|
64494
|
-
const fullPath =
|
|
64541
|
+
const fullPath = join19(dir, entry);
|
|
64495
64542
|
const stats = statSync3(fullPath);
|
|
64496
64543
|
const relativePath = fullPath.startsWith(process.cwd()) ? fullPath.slice(process.cwd().length + 1) : fullPath;
|
|
64497
64544
|
const matches = pattern.length === 0 || relativePath.toLowerCase().includes(pattern.toLowerCase());
|
|
@@ -64543,7 +64590,7 @@ async function searchFiles(query, deep = false) {
|
|
|
64543
64590
|
const matchingEntries = searchPattern.length === 0 ? entries : entries.filter((entry) => entry.toLowerCase().includes(searchPattern.toLowerCase()));
|
|
64544
64591
|
for (const entry of matchingEntries.slice(0, 50)) {
|
|
64545
64592
|
try {
|
|
64546
|
-
const fullPath =
|
|
64593
|
+
const fullPath = join19(searchDir, entry);
|
|
64547
64594
|
const stats = statSync3(fullPath);
|
|
64548
64595
|
const relativePath = fullPath.startsWith(process.cwd()) ? fullPath.slice(process.cwd().length + 1) : fullPath;
|
|
64549
64596
|
results.push({
|
|
@@ -72520,6 +72567,8 @@ __export(exports_App, {
|
|
|
72520
72567
|
default: () => App2
|
|
72521
72568
|
});
|
|
72522
72569
|
import { existsSync as existsSync12, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "node:fs";
|
|
72570
|
+
import { homedir as homedir11 } from "node:os";
|
|
72571
|
+
import { join as join20 } from "node:path";
|
|
72523
72572
|
function uid4(prefix) {
|
|
72524
72573
|
return `${prefix}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
72525
72574
|
}
|
|
@@ -72543,7 +72592,8 @@ async function isRetriableError(stopReason, lastRunId) {
|
|
|
72543
72592
|
"OpenAI API error",
|
|
72544
72593
|
"Google Vertex API error",
|
|
72545
72594
|
"overloaded",
|
|
72546
|
-
"api_error"
|
|
72595
|
+
"api_error",
|
|
72596
|
+
"Network error"
|
|
72547
72597
|
];
|
|
72548
72598
|
if (errorType === "internal_error" && llmProviderPatterns.some((pattern) => detail.includes(pattern))) {
|
|
72549
72599
|
return true;
|
|
@@ -76503,9 +76553,10 @@ Consider switching to a different system prompt using /system to match.` : null;
|
|
|
76503
76553
|
const approval = pendingApprovals[currentIndex];
|
|
76504
76554
|
if (approval?.toolName === "ExitPlanMode" && !planFileExists()) {
|
|
76505
76555
|
const planFilePath = permissionMode2.getPlanFilePath();
|
|
76506
|
-
|
|
76507
|
-
`
|
|
76508
|
-
` +
|
|
76556
|
+
const plansDir = join20(homedir11(), ".letta", "plans");
|
|
76557
|
+
handlePlanKeepPlanning(`You must write your plan to a plan file before exiting plan mode.
|
|
76558
|
+
` + (planFilePath ? `Plan file path: ${planFilePath}
|
|
76559
|
+
` : "") + `Use a write tool to create your plan in ${plansDir}, then use ExitPlanMode to present the plan to the user.`);
|
|
76509
76560
|
}
|
|
76510
76561
|
}, [pendingApprovals, approvalResults.length, handlePlanKeepPlanning]);
|
|
76511
76562
|
const handleQuestionSubmit = import_react82.useCallback(async (answers) => {
|
|
@@ -76784,6 +76835,9 @@ Plan file path: ${planFilePath}`;
|
|
|
76784
76835
|
if (ln.kind === "tool_call" && ln.name && isTaskTool(ln.name) && ln.toolCallId && !pendingIds.has(ln.toolCallId)) {
|
|
76785
76836
|
return null;
|
|
76786
76837
|
}
|
|
76838
|
+
if (ln.kind === "tool_call" && ln.toolCallId && eagerCommittedPreviewsRef.current.has(ln.toolCallId) && ln.toolCallId !== currentApproval?.toolCallId) {
|
|
76839
|
+
return null;
|
|
76840
|
+
}
|
|
76787
76841
|
const isExitPlanModeApproval = ln.kind === "tool_call" && currentApproval?.toolName === "ExitPlanMode" && ln.toolCallId === currentApproval?.toolCallId;
|
|
76788
76842
|
const isFileEditApproval = ln.kind === "tool_call" && currentApproval && (isFileEditTool(currentApproval.toolName) || isFileWriteTool(currentApproval.toolName) || isPatchTool(currentApproval.toolName)) && ln.toolCallId === currentApproval.toolCallId;
|
|
76789
76843
|
const isBashApproval = ln.kind === "tool_call" && currentApproval && isShellTool(currentApproval.toolName) && ln.toolCallId === currentApproval.toolCallId;
|
|
@@ -77254,8 +77308,8 @@ import {
|
|
|
77254
77308
|
readFileSync as readFileSync5,
|
|
77255
77309
|
writeFileSync as writeFileSync4
|
|
77256
77310
|
} from "node:fs";
|
|
77257
|
-
import { homedir as
|
|
77258
|
-
import { dirname as dirname12, join as
|
|
77311
|
+
import { homedir as homedir12, platform as platform5 } from "node:os";
|
|
77312
|
+
import { dirname as dirname12, join as join21 } from "node:path";
|
|
77259
77313
|
function detectTerminalType2() {
|
|
77260
77314
|
if (process.env.CURSOR_TRACE_ID || process.env.CURSOR_CHANNEL) {
|
|
77261
77315
|
return "cursor";
|
|
@@ -77287,16 +77341,16 @@ function getKeybindingsPath2(terminal) {
|
|
|
77287
77341
|
}[terminal];
|
|
77288
77342
|
const os5 = platform5();
|
|
77289
77343
|
if (os5 === "darwin") {
|
|
77290
|
-
return
|
|
77344
|
+
return join21(homedir12(), "Library", "Application Support", appName, "User", "keybindings.json");
|
|
77291
77345
|
}
|
|
77292
77346
|
if (os5 === "win32") {
|
|
77293
77347
|
const appData = process.env.APPDATA;
|
|
77294
77348
|
if (!appData)
|
|
77295
77349
|
return null;
|
|
77296
|
-
return
|
|
77350
|
+
return join21(appData, appName, "User", "keybindings.json");
|
|
77297
77351
|
}
|
|
77298
77352
|
if (os5 === "linux") {
|
|
77299
|
-
return
|
|
77353
|
+
return join21(homedir12(), ".config", appName, "User", "keybindings.json");
|
|
77300
77354
|
}
|
|
77301
77355
|
return null;
|
|
77302
77356
|
}
|
|
@@ -77449,14 +77503,14 @@ function getWezTermConfigPath2() {
|
|
|
77449
77503
|
}
|
|
77450
77504
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
77451
77505
|
if (xdgConfig) {
|
|
77452
|
-
const xdgPath =
|
|
77506
|
+
const xdgPath = join21(xdgConfig, "wezterm", "wezterm.lua");
|
|
77453
77507
|
if (existsSync13(xdgPath))
|
|
77454
77508
|
return xdgPath;
|
|
77455
77509
|
}
|
|
77456
|
-
const configPath =
|
|
77510
|
+
const configPath = join21(homedir12(), ".config", "wezterm", "wezterm.lua");
|
|
77457
77511
|
if (existsSync13(configPath))
|
|
77458
77512
|
return configPath;
|
|
77459
|
-
return
|
|
77513
|
+
return join21(homedir12(), ".wezterm.lua");
|
|
77460
77514
|
}
|
|
77461
77515
|
function wezTermDeleteFixExists2(configPath) {
|
|
77462
77516
|
if (!existsSync13(configPath))
|
|
@@ -77554,10 +77608,10 @@ __export(exports_settings2, {
|
|
|
77554
77608
|
loadProjectSettings: () => loadProjectSettings2,
|
|
77555
77609
|
getSetting: () => getSetting2
|
|
77556
77610
|
});
|
|
77557
|
-
import { homedir as
|
|
77558
|
-
import { join as
|
|
77611
|
+
import { homedir as homedir13 } from "node:os";
|
|
77612
|
+
import { join as join22 } from "node:path";
|
|
77559
77613
|
function getSettingsPath2() {
|
|
77560
|
-
return
|
|
77614
|
+
return join22(homedir13(), ".letta", "settings.json");
|
|
77561
77615
|
}
|
|
77562
77616
|
async function loadSettings2() {
|
|
77563
77617
|
const settingsPath = getSettingsPath2();
|
|
@@ -77594,7 +77648,7 @@ async function getSetting2(key) {
|
|
|
77594
77648
|
return settings[key];
|
|
77595
77649
|
}
|
|
77596
77650
|
function getProjectSettingsPath2() {
|
|
77597
|
-
return
|
|
77651
|
+
return join22(process.cwd(), ".letta", "settings.local.json");
|
|
77598
77652
|
}
|
|
77599
77653
|
async function loadProjectSettings2() {
|
|
77600
77654
|
const settingsPath = getProjectSettingsPath2();
|
|
@@ -77612,7 +77666,7 @@ async function loadProjectSettings2() {
|
|
|
77612
77666
|
}
|
|
77613
77667
|
async function saveProjectSettings2(settings) {
|
|
77614
77668
|
const settingsPath = getProjectSettingsPath2();
|
|
77615
|
-
const dirPath =
|
|
77669
|
+
const dirPath = join22(process.cwd(), ".letta");
|
|
77616
77670
|
try {
|
|
77617
77671
|
if (!exists(dirPath)) {
|
|
77618
77672
|
await mkdir(dirPath, { recursive: true });
|
|
@@ -77644,7 +77698,7 @@ var exports_create = {};
|
|
|
77644
77698
|
__export(exports_create, {
|
|
77645
77699
|
createAgent: () => createAgent2
|
|
77646
77700
|
});
|
|
77647
|
-
import { join as
|
|
77701
|
+
import { join as join23 } from "node:path";
|
|
77648
77702
|
async function createAgent2(nameOrOptions = DEFAULT_AGENT_NAME, model, embeddingModel = "openai/text-embedding-3-small", updateArgs, skillsDirectory, parallelToolCalls = true, enableSleeptime = false, systemPromptPreset, initBlocks, baseTools) {
|
|
77649
77703
|
let options;
|
|
77650
77704
|
if (typeof nameOrOptions === "object") {
|
|
@@ -77739,7 +77793,7 @@ async function createAgent2(nameOrOptions = DEFAULT_AGENT_NAME, model, embedding
|
|
|
77739
77793
|
}
|
|
77740
77794
|
}
|
|
77741
77795
|
}
|
|
77742
|
-
const resolvedSkillsDirectory = options.skillsDirectory ||
|
|
77796
|
+
const resolvedSkillsDirectory = options.skillsDirectory || join23(process.cwd(), SKILLS_DIR);
|
|
77743
77797
|
try {
|
|
77744
77798
|
const { skills, errors } = await discoverSkills(resolvedSkillsDirectory);
|
|
77745
77799
|
if (errors.length > 0) {
|
|
@@ -78560,6 +78614,8 @@ function ProfileSelectionInline({
|
|
|
78560
78614
|
|
|
78561
78615
|
// src/permissions/mode.ts
|
|
78562
78616
|
init_readOnlyShell();
|
|
78617
|
+
import { homedir as homedir3 } from "node:os";
|
|
78618
|
+
import { join as join2 } from "node:path";
|
|
78563
78619
|
var MODE_KEY = Symbol.for("@letta/permissionMode");
|
|
78564
78620
|
var PLAN_FILE_KEY = Symbol.for("@letta/planFilePath");
|
|
78565
78621
|
function getGlobalMode() {
|
|
@@ -78664,7 +78720,7 @@ class PermissionModeManager {
|
|
|
78664
78720
|
return "allow";
|
|
78665
78721
|
}
|
|
78666
78722
|
if (writeTools.includes(toolName)) {
|
|
78667
|
-
const
|
|
78723
|
+
const plansDir = join2(homedir3(), ".letta", "plans");
|
|
78668
78724
|
let targetPath = toolArgs?.file_path || toolArgs?.path;
|
|
78669
78725
|
if ((toolName === "ApplyPatch" || toolName === "apply_patch") && toolArgs?.input) {
|
|
78670
78726
|
const input = toolArgs.input;
|
|
@@ -78673,7 +78729,7 @@ class PermissionModeManager {
|
|
|
78673
78729
|
targetPath = match[1].trim();
|
|
78674
78730
|
}
|
|
78675
78731
|
}
|
|
78676
|
-
if (
|
|
78732
|
+
if (targetPath && targetPath.startsWith(plansDir) && targetPath.endsWith(".md")) {
|
|
78677
78733
|
return "allow";
|
|
78678
78734
|
}
|
|
78679
78735
|
}
|
|
@@ -78729,8 +78785,8 @@ var permissionMode = new PermissionModeManager;
|
|
|
78729
78785
|
// src/settings-manager.ts
|
|
78730
78786
|
init_fs();
|
|
78731
78787
|
await init_secrets();
|
|
78732
|
-
import { homedir as
|
|
78733
|
-
import { join as
|
|
78788
|
+
import { homedir as homedir4 } from "node:os";
|
|
78789
|
+
import { join as join3 } from "node:path";
|
|
78734
78790
|
var DEFAULT_SETTINGS2 = {
|
|
78735
78791
|
lastAgent: null,
|
|
78736
78792
|
tokenStreaming: false,
|
|
@@ -78976,8 +79032,8 @@ class SettingsManager2 {
|
|
|
78976
79032
|
if (!this.settings)
|
|
78977
79033
|
return;
|
|
78978
79034
|
const settingsPath = this.getSettingsPath();
|
|
78979
|
-
const home = process.env.HOME ||
|
|
78980
|
-
const dirPath =
|
|
79035
|
+
const home = process.env.HOME || homedir4();
|
|
79036
|
+
const dirPath = join3(home, ".letta");
|
|
78981
79037
|
try {
|
|
78982
79038
|
if (!exists(dirPath)) {
|
|
78983
79039
|
await mkdir(dirPath, { recursive: true });
|
|
@@ -78993,7 +79049,7 @@ class SettingsManager2 {
|
|
|
78993
79049
|
if (!settings)
|
|
78994
79050
|
return;
|
|
78995
79051
|
const settingsPath = this.getProjectSettingsPath(workingDirectory);
|
|
78996
|
-
const dirPath =
|
|
79052
|
+
const dirPath = join3(workingDirectory, ".letta");
|
|
78997
79053
|
try {
|
|
78998
79054
|
let existingSettings = {};
|
|
78999
79055
|
if (exists(settingsPath)) {
|
|
@@ -79014,14 +79070,14 @@ class SettingsManager2 {
|
|
|
79014
79070
|
}
|
|
79015
79071
|
}
|
|
79016
79072
|
getSettingsPath() {
|
|
79017
|
-
const home = process.env.HOME ||
|
|
79018
|
-
return
|
|
79073
|
+
const home = process.env.HOME || homedir4();
|
|
79074
|
+
return join3(home, ".letta", "settings.json");
|
|
79019
79075
|
}
|
|
79020
79076
|
getProjectSettingsPath(workingDirectory) {
|
|
79021
|
-
return
|
|
79077
|
+
return join3(workingDirectory, ".letta", "settings.json");
|
|
79022
79078
|
}
|
|
79023
79079
|
getLocalProjectSettingsPath(workingDirectory) {
|
|
79024
|
-
return
|
|
79080
|
+
return join3(workingDirectory, ".letta", "settings.local.json");
|
|
79025
79081
|
}
|
|
79026
79082
|
async loadLocalProjectSettings(workingDirectory = process.cwd()) {
|
|
79027
79083
|
const cached = this.localProjectSettings.get(workingDirectory);
|
|
@@ -79072,7 +79128,7 @@ class SettingsManager2 {
|
|
|
79072
79128
|
if (!settings)
|
|
79073
79129
|
return;
|
|
79074
79130
|
const settingsPath = this.getLocalProjectSettingsPath(workingDirectory);
|
|
79075
|
-
const dirPath =
|
|
79131
|
+
const dirPath = join3(workingDirectory, ".letta");
|
|
79076
79132
|
try {
|
|
79077
79133
|
if (!exists(dirPath)) {
|
|
79078
79134
|
await mkdir(dirPath, { recursive: true });
|
|
@@ -79182,7 +79238,7 @@ class SettingsManager2 {
|
|
|
79182
79238
|
console.warn("unpinProfile is deprecated, use unpinLocal(agentId) instead");
|
|
79183
79239
|
}
|
|
79184
79240
|
hasLocalLettaDir(workingDirectory = process.cwd()) {
|
|
79185
|
-
const dirPath =
|
|
79241
|
+
const dirPath = join3(workingDirectory, ".letta");
|
|
79186
79242
|
return exists(dirPath);
|
|
79187
79243
|
}
|
|
79188
79244
|
storeAnthropicTokens(tokens) {
|
|
@@ -79773,12 +79829,12 @@ EXAMPLES
|
|
|
79773
79829
|
console.log(usage);
|
|
79774
79830
|
}
|
|
79775
79831
|
async function printInfo() {
|
|
79776
|
-
const { join:
|
|
79832
|
+
const { join: join24 } = await import("path");
|
|
79777
79833
|
const { getVersion: getVersion3 } = await Promise.resolve().then(() => (init_version2(), exports_version));
|
|
79778
79834
|
const { SKILLS_DIR: SKILLS_DIR3 } = await Promise.resolve().then(() => (init_skills3(), exports_skills2));
|
|
79779
79835
|
const { exists: exists3 } = await Promise.resolve().then(() => (init_fs2(), exports_fs));
|
|
79780
79836
|
const cwd2 = process.cwd();
|
|
79781
|
-
const skillsDir =
|
|
79837
|
+
const skillsDir = join24(cwd2, SKILLS_DIR3);
|
|
79782
79838
|
const skillsExist = exists3(skillsDir);
|
|
79783
79839
|
await settingsManager2.loadLocalProjectSettings(cwd2);
|
|
79784
79840
|
const localPinned = settingsManager2.getLocalPinnedAgents(cwd2);
|
|
@@ -80437,8 +80493,8 @@ Error: ${message}`);
|
|
|
80437
80493
|
await initializeLoadedSkillsFlag();
|
|
80438
80494
|
try {
|
|
80439
80495
|
const { discoverSkills: discoverSkills3, formatSkillsForMemory: formatSkillsForMemory3, SKILLS_DIR: SKILLS_DIR3 } = await Promise.resolve().then(() => (init_skills3(), exports_skills2));
|
|
80440
|
-
const { join:
|
|
80441
|
-
const resolvedSkillsDirectory = skillsDirectory2 ||
|
|
80496
|
+
const { join: join24 } = await import("path");
|
|
80497
|
+
const resolvedSkillsDirectory = skillsDirectory2 || join24(process.cwd(), SKILLS_DIR3);
|
|
80442
80498
|
const { skills, errors } = await discoverSkills3(resolvedSkillsDirectory);
|
|
80443
80499
|
if (errors.length > 0) {
|
|
80444
80500
|
console.warn("Errors encountered during skill discovery:");
|
|
@@ -80582,4 +80638,4 @@ Error during initialization: ${message}`);
|
|
|
80582
80638
|
}
|
|
80583
80639
|
main();
|
|
80584
80640
|
|
|
80585
|
-
//# debugId=
|
|
80641
|
+
//# debugId=8F40442B5CEE87AA64756E2164756E21
|