@letta-ai/letta-code 0.15.3 → 0.15.5
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/types/protocol.d.ts +5 -0
- package/dist/types/protocol.d.ts.map +1 -1
- package/letta.js +503 -202
- package/package.json +1 -1
package/dist/types/protocol.d.ts
CHANGED
|
@@ -58,6 +58,11 @@ export interface SystemInitMessage extends MessageEnvelope {
|
|
|
58
58
|
permission_mode: string;
|
|
59
59
|
slash_commands: string[];
|
|
60
60
|
memfs_enabled?: boolean;
|
|
61
|
+
skill_sources?: Array<"bundled" | "global" | "agent" | "project">;
|
|
62
|
+
system_info_reminder_enabled?: boolean;
|
|
63
|
+
reflection_trigger?: "off" | "step-count" | "compaction-event";
|
|
64
|
+
reflection_behavior?: "reminder" | "auto-launch";
|
|
65
|
+
reflection_step_count?: number;
|
|
61
66
|
}
|
|
62
67
|
export type SystemMessage = SystemInitMessage;
|
|
63
68
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/types/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AACpF,OAAO,KAAK,EACV,gBAAgB,IAAI,qBAAqB,EACzC,gBAAgB,IAAI,qBAAqB,EACzC,sBAAsB,EACtB,eAAe,IAAI,oBAAoB,EACvC,QAAQ,EACT,MAAM,kDAAkD,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gDAAgD,CAAC;AAClF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AACjF,OAAO,KAAK,EAAE,iBAAiB,IAAI,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAG1G,YAAY,EACV,sBAAsB,EACtB,QAAQ,EACR,cAAc,EACd,aAAa,EACb,sBAAsB,EACtB,WAAW,GACZ,CAAC;A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cAAc,GACd,WAAW,GACX,mBAAmB,GACnB,YAAY,GACZ,YAAY,GACZ,eAAe,GACf,aAAa,GACb,eAAe,GACf,cAAc,CAAC"}
|
package/letta.js
CHANGED
|
@@ -3122,7 +3122,7 @@ var package_default;
|
|
|
3122
3122
|
var init_package = __esm(() => {
|
|
3123
3123
|
package_default = {
|
|
3124
3124
|
name: "@letta-ai/letta-code",
|
|
3125
|
-
version: "0.15.
|
|
3125
|
+
version: "0.15.5",
|
|
3126
3126
|
description: "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
|
|
3127
3127
|
type: "module",
|
|
3128
3128
|
bin: {
|
|
@@ -4439,6 +4439,57 @@ var init_timing = __esm(() => {
|
|
|
4439
4439
|
milestones = new Map;
|
|
4440
4440
|
});
|
|
4441
4441
|
|
|
4442
|
+
// src/agent/skillSources.ts
|
|
4443
|
+
function isSkillSource(value) {
|
|
4444
|
+
return ALL_SKILL_SOURCES.includes(value);
|
|
4445
|
+
}
|
|
4446
|
+
function normalizeSkillSources(sources) {
|
|
4447
|
+
const sourceSet = new Set(sources);
|
|
4448
|
+
return ALL_SKILL_SOURCES.filter((source) => sourceSet.has(source));
|
|
4449
|
+
}
|
|
4450
|
+
function parseSkillSourcesList(skillSourcesRaw) {
|
|
4451
|
+
const tokens = skillSourcesRaw.split(",").map((source) => source.trim()).filter((source) => source.length > 0);
|
|
4452
|
+
if (tokens.length === 0) {
|
|
4453
|
+
throw new Error("--skill-sources must include at least one source (e.g. bundled,project)");
|
|
4454
|
+
}
|
|
4455
|
+
const sources = [];
|
|
4456
|
+
for (const token of tokens) {
|
|
4457
|
+
const source = token;
|
|
4458
|
+
if (!VALID_SKILL_SOURCE_SPECIFIERS.includes(source)) {
|
|
4459
|
+
throw new Error(`Invalid skill source "${token}". Valid values: ${VALID_SKILL_SOURCE_SPECIFIERS.join(", ")}`);
|
|
4460
|
+
}
|
|
4461
|
+
if (source === "all") {
|
|
4462
|
+
sources.push(...ALL_SKILL_SOURCES);
|
|
4463
|
+
continue;
|
|
4464
|
+
}
|
|
4465
|
+
if (isSkillSource(source)) {
|
|
4466
|
+
sources.push(source);
|
|
4467
|
+
}
|
|
4468
|
+
}
|
|
4469
|
+
return normalizeSkillSources(sources);
|
|
4470
|
+
}
|
|
4471
|
+
function resolveSkillSourcesSelection(input) {
|
|
4472
|
+
if (input.noSkills) {
|
|
4473
|
+
return [];
|
|
4474
|
+
}
|
|
4475
|
+
const configuredSources = input.skillSourcesRaw ? parseSkillSourcesList(input.skillSourcesRaw) : [...ALL_SKILL_SOURCES];
|
|
4476
|
+
const filteredSources = input.noBundledSkills ? configuredSources.filter((source) => source !== "bundled") : configuredSources;
|
|
4477
|
+
return normalizeSkillSources(filteredSources);
|
|
4478
|
+
}
|
|
4479
|
+
var ALL_SKILL_SOURCES, VALID_SKILL_SOURCE_SPECIFIERS;
|
|
4480
|
+
var init_skillSources = __esm(() => {
|
|
4481
|
+
ALL_SKILL_SOURCES = [
|
|
4482
|
+
"bundled",
|
|
4483
|
+
"global",
|
|
4484
|
+
"agent",
|
|
4485
|
+
"project"
|
|
4486
|
+
];
|
|
4487
|
+
VALID_SKILL_SOURCE_SPECIFIERS = [
|
|
4488
|
+
"all",
|
|
4489
|
+
...ALL_SKILL_SOURCES
|
|
4490
|
+
];
|
|
4491
|
+
});
|
|
4492
|
+
|
|
4442
4493
|
// src/agent/memoryConstants.ts
|
|
4443
4494
|
var READ_ONLY_BLOCK_LABELS;
|
|
4444
4495
|
var init_memoryConstants = __esm(() => {
|
|
@@ -33086,12 +33137,24 @@ var init_MarkdownDisplay = __esm(async () => {
|
|
|
33086
33137
|
var models_default;
|
|
33087
33138
|
var init_models2 = __esm(() => {
|
|
33088
33139
|
models_default = [
|
|
33140
|
+
{
|
|
33141
|
+
id: "sonnet-4.6",
|
|
33142
|
+
handle: "anthropic/claude-sonnet-4-6",
|
|
33143
|
+
label: "Sonnet 4.6",
|
|
33144
|
+
description: "Anthropic's new Sonnet model with adaptive thinking",
|
|
33145
|
+
isDefault: true,
|
|
33146
|
+
isFeatured: true,
|
|
33147
|
+
updateArgs: {
|
|
33148
|
+
context_window: 200000,
|
|
33149
|
+
max_output_tokens: 128000,
|
|
33150
|
+
enable_reasoner: true
|
|
33151
|
+
}
|
|
33152
|
+
},
|
|
33089
33153
|
{
|
|
33090
33154
|
id: "sonnet-4.5",
|
|
33091
33155
|
handle: "anthropic/claude-sonnet-4-5-20250929",
|
|
33092
33156
|
label: "Sonnet 4.5",
|
|
33093
|
-
description: "
|
|
33094
|
-
isDefault: true,
|
|
33157
|
+
description: "Previous default Sonnet model",
|
|
33095
33158
|
isFeatured: true,
|
|
33096
33159
|
updateArgs: {
|
|
33097
33160
|
context_window: 180000,
|
|
@@ -35035,6 +35098,7 @@ __export(exports_context, {
|
|
|
35035
35098
|
setConversationId: () => setConversationId2,
|
|
35036
35099
|
setAgentContext: () => setAgentContext2,
|
|
35037
35100
|
getSkillsDirectory: () => getSkillsDirectory,
|
|
35101
|
+
getSkillSources: () => getSkillSources,
|
|
35038
35102
|
getNoSkills: () => getNoSkills,
|
|
35039
35103
|
getCurrentAgentId: () => getCurrentAgentId,
|
|
35040
35104
|
getConversationId: () => getConversationId
|
|
@@ -35045,16 +35109,16 @@ function getContext2() {
|
|
|
35045
35109
|
global2[CONTEXT_KEY2] = {
|
|
35046
35110
|
agentId: null,
|
|
35047
35111
|
skillsDirectory: null,
|
|
35048
|
-
|
|
35112
|
+
skillSources: [...ALL_SKILL_SOURCES],
|
|
35049
35113
|
conversationId: null
|
|
35050
35114
|
};
|
|
35051
35115
|
}
|
|
35052
35116
|
return global2[CONTEXT_KEY2];
|
|
35053
35117
|
}
|
|
35054
|
-
function setAgentContext2(agentId, skillsDirectory,
|
|
35118
|
+
function setAgentContext2(agentId, skillsDirectory, skillSources) {
|
|
35055
35119
|
context2.agentId = agentId;
|
|
35056
35120
|
context2.skillsDirectory = skillsDirectory || null;
|
|
35057
|
-
context2.
|
|
35121
|
+
context2.skillSources = skillSources !== undefined ? [...skillSources] : [...ALL_SKILL_SOURCES];
|
|
35058
35122
|
}
|
|
35059
35123
|
function setCurrentAgentId(agentId) {
|
|
35060
35124
|
context2.agentId = agentId;
|
|
@@ -35068,8 +35132,11 @@ function getCurrentAgentId() {
|
|
|
35068
35132
|
function getSkillsDirectory() {
|
|
35069
35133
|
return context2.skillsDirectory;
|
|
35070
35134
|
}
|
|
35135
|
+
function getSkillSources() {
|
|
35136
|
+
return [...context2.skillSources];
|
|
35137
|
+
}
|
|
35071
35138
|
function getNoSkills() {
|
|
35072
|
-
return context2.
|
|
35139
|
+
return !context2.skillSources.includes("bundled");
|
|
35073
35140
|
}
|
|
35074
35141
|
function setConversationId2(conversationId) {
|
|
35075
35142
|
context2.conversationId = conversationId;
|
|
@@ -35079,6 +35146,7 @@ function getConversationId() {
|
|
|
35079
35146
|
}
|
|
35080
35147
|
var CONTEXT_KEY2, context2;
|
|
35081
35148
|
var init_context = __esm(() => {
|
|
35149
|
+
init_skillSources();
|
|
35082
35150
|
CONTEXT_KEY2 = Symbol.for("@letta/agentContext");
|
|
35083
35151
|
context2 = getContext2();
|
|
35084
35152
|
});
|
|
@@ -55308,18 +55376,22 @@ async function discoverSkillsFromDir(skillsPath, source) {
|
|
|
55308
55376
|
async function discoverSkills(projectSkillsPath = join15(process.cwd(), SKILLS_DIR), agentId, options) {
|
|
55309
55377
|
const allErrors = [];
|
|
55310
55378
|
const skillsById = new Map;
|
|
55311
|
-
|
|
55379
|
+
const sourceSet = new Set(options?.sources ?? ALL_SKILL_SOURCES);
|
|
55380
|
+
const includeSource = (source) => sourceSet.has(source);
|
|
55381
|
+
if (includeSource("bundled") && !options?.skipBundled) {
|
|
55312
55382
|
const bundledSkills = await getBundledSkills();
|
|
55313
55383
|
for (const skill of bundledSkills) {
|
|
55314
55384
|
skillsById.set(skill.id, skill);
|
|
55315
55385
|
}
|
|
55316
55386
|
}
|
|
55317
|
-
|
|
55318
|
-
|
|
55319
|
-
|
|
55320
|
-
|
|
55387
|
+
if (includeSource("global")) {
|
|
55388
|
+
const globalResult = await discoverSkillsFromDir(GLOBAL_SKILLS_DIR, "global");
|
|
55389
|
+
allErrors.push(...globalResult.errors);
|
|
55390
|
+
for (const skill of globalResult.skills) {
|
|
55391
|
+
skillsById.set(skill.id, skill);
|
|
55392
|
+
}
|
|
55321
55393
|
}
|
|
55322
|
-
if (agentId) {
|
|
55394
|
+
if (agentId && includeSource("agent")) {
|
|
55323
55395
|
const agentSkillsDir = getAgentSkillsDir(agentId);
|
|
55324
55396
|
const agentResult = await discoverSkillsFromDir(agentSkillsDir, "agent");
|
|
55325
55397
|
allErrors.push(...agentResult.errors);
|
|
@@ -55327,10 +55399,12 @@ async function discoverSkills(projectSkillsPath = join15(process.cwd(), SKILLS_D
|
|
|
55327
55399
|
skillsById.set(skill.id, skill);
|
|
55328
55400
|
}
|
|
55329
55401
|
}
|
|
55330
|
-
|
|
55331
|
-
|
|
55332
|
-
|
|
55333
|
-
|
|
55402
|
+
if (includeSource("project")) {
|
|
55403
|
+
const projectResult = await discoverSkillsFromDir(projectSkillsPath, "project");
|
|
55404
|
+
allErrors.push(...projectResult.errors);
|
|
55405
|
+
for (const skill of projectResult.skills) {
|
|
55406
|
+
skillsById.set(skill.id, skill);
|
|
55407
|
+
}
|
|
55334
55408
|
}
|
|
55335
55409
|
return {
|
|
55336
55410
|
skills: Array.from(skillsById.values()),
|
|
@@ -55415,6 +55489,7 @@ ${lines.join(`
|
|
|
55415
55489
|
}
|
|
55416
55490
|
var SKILLS_DIR = ".skills", GLOBAL_SKILLS_DIR;
|
|
55417
55491
|
var init_skills = __esm(() => {
|
|
55492
|
+
init_skillSources();
|
|
55418
55493
|
GLOBAL_SKILLS_DIR = join15(process.env.HOME || process.env.USERPROFILE || "~", ".letta/skills");
|
|
55419
55494
|
});
|
|
55420
55495
|
|
|
@@ -61613,18 +61688,22 @@ async function discoverSkillsFromDir2(skillsPath, source) {
|
|
|
61613
61688
|
async function discoverSkills2(projectSkillsPath = join18(process.cwd(), SKILLS_DIR2), agentId, options) {
|
|
61614
61689
|
const allErrors = [];
|
|
61615
61690
|
const skillsById = new Map;
|
|
61616
|
-
|
|
61691
|
+
const sourceSet = new Set(options?.sources ?? ALL_SKILL_SOURCES);
|
|
61692
|
+
const includeSource = (source) => sourceSet.has(source);
|
|
61693
|
+
if (includeSource("bundled") && !options?.skipBundled) {
|
|
61617
61694
|
const bundledSkills = await getBundledSkills2();
|
|
61618
61695
|
for (const skill2 of bundledSkills) {
|
|
61619
61696
|
skillsById.set(skill2.id, skill2);
|
|
61620
61697
|
}
|
|
61621
61698
|
}
|
|
61622
|
-
|
|
61623
|
-
|
|
61624
|
-
|
|
61625
|
-
|
|
61699
|
+
if (includeSource("global")) {
|
|
61700
|
+
const globalResult = await discoverSkillsFromDir2(GLOBAL_SKILLS_DIR2, "global");
|
|
61701
|
+
allErrors.push(...globalResult.errors);
|
|
61702
|
+
for (const skill2 of globalResult.skills) {
|
|
61703
|
+
skillsById.set(skill2.id, skill2);
|
|
61704
|
+
}
|
|
61626
61705
|
}
|
|
61627
|
-
if (agentId) {
|
|
61706
|
+
if (agentId && includeSource("agent")) {
|
|
61628
61707
|
const agentSkillsDir = getAgentSkillsDir2(agentId);
|
|
61629
61708
|
const agentResult = await discoverSkillsFromDir2(agentSkillsDir, "agent");
|
|
61630
61709
|
allErrors.push(...agentResult.errors);
|
|
@@ -61632,10 +61711,12 @@ async function discoverSkills2(projectSkillsPath = join18(process.cwd(), SKILLS_
|
|
|
61632
61711
|
skillsById.set(skill2.id, skill2);
|
|
61633
61712
|
}
|
|
61634
61713
|
}
|
|
61635
|
-
|
|
61636
|
-
|
|
61637
|
-
|
|
61638
|
-
|
|
61714
|
+
if (includeSource("project")) {
|
|
61715
|
+
const projectResult = await discoverSkillsFromDir2(projectSkillsPath, "project");
|
|
61716
|
+
allErrors.push(...projectResult.errors);
|
|
61717
|
+
for (const skill2 of projectResult.skills) {
|
|
61718
|
+
skillsById.set(skill2.id, skill2);
|
|
61719
|
+
}
|
|
61639
61720
|
}
|
|
61640
61721
|
return {
|
|
61641
61722
|
skills: Array.from(skillsById.values()),
|
|
@@ -61720,6 +61801,7 @@ ${lines.join(`
|
|
|
61720
61801
|
}
|
|
61721
61802
|
var SKILLS_DIR2 = ".skills", GLOBAL_SKILLS_DIR2;
|
|
61722
61803
|
var init_skills2 = __esm(() => {
|
|
61804
|
+
init_skillSources();
|
|
61723
61805
|
GLOBAL_SKILLS_DIR2 = join18(process.env.HOME || process.env.USERPROFILE || "~", ".letta/skills");
|
|
61724
61806
|
});
|
|
61725
61807
|
|
|
@@ -65824,6 +65906,157 @@ var init_errorFormatter = __esm(() => {
|
|
|
65824
65906
|
`);
|
|
65825
65907
|
});
|
|
65826
65908
|
|
|
65909
|
+
// src/cli/helpers/memoryReminder.ts
|
|
65910
|
+
function isValidStepCount(value) {
|
|
65911
|
+
return typeof value === "number" && Number.isFinite(value) && Number.isInteger(value) && value > 0;
|
|
65912
|
+
}
|
|
65913
|
+
function normalizeStepCount(value, fallback) {
|
|
65914
|
+
return isValidStepCount(value) ? value : fallback;
|
|
65915
|
+
}
|
|
65916
|
+
function normalizeTrigger(value, fallback) {
|
|
65917
|
+
if (value === "off" || value === "step-count" || value === "compaction-event") {
|
|
65918
|
+
return value;
|
|
65919
|
+
}
|
|
65920
|
+
return fallback;
|
|
65921
|
+
}
|
|
65922
|
+
function normalizeBehavior(value, fallback) {
|
|
65923
|
+
if (value === "reminder" || value === "auto-launch") {
|
|
65924
|
+
return value;
|
|
65925
|
+
}
|
|
65926
|
+
return fallback;
|
|
65927
|
+
}
|
|
65928
|
+
function applyExplicitReflectionOverrides(base2, raw) {
|
|
65929
|
+
return {
|
|
65930
|
+
trigger: normalizeTrigger(raw.reflectionTrigger, base2.trigger),
|
|
65931
|
+
behavior: normalizeBehavior(raw.reflectionBehavior, base2.behavior),
|
|
65932
|
+
stepCount: normalizeStepCount(raw.reflectionStepCount, base2.stepCount)
|
|
65933
|
+
};
|
|
65934
|
+
}
|
|
65935
|
+
function legacyModeToReflectionSettings(mode) {
|
|
65936
|
+
if (typeof mode === "number") {
|
|
65937
|
+
return {
|
|
65938
|
+
trigger: "step-count",
|
|
65939
|
+
behavior: "reminder",
|
|
65940
|
+
stepCount: normalizeStepCount(mode, DEFAULT_STEP_COUNT)
|
|
65941
|
+
};
|
|
65942
|
+
}
|
|
65943
|
+
if (mode === null) {
|
|
65944
|
+
return {
|
|
65945
|
+
trigger: "off",
|
|
65946
|
+
behavior: DEFAULT_REFLECTION_SETTINGS.behavior,
|
|
65947
|
+
stepCount: DEFAULT_REFLECTION_SETTINGS.stepCount
|
|
65948
|
+
};
|
|
65949
|
+
}
|
|
65950
|
+
if (mode === "compaction") {
|
|
65951
|
+
return {
|
|
65952
|
+
trigger: "compaction-event",
|
|
65953
|
+
behavior: "reminder",
|
|
65954
|
+
stepCount: DEFAULT_REFLECTION_SETTINGS.stepCount
|
|
65955
|
+
};
|
|
65956
|
+
}
|
|
65957
|
+
if (mode === "auto-compaction") {
|
|
65958
|
+
return {
|
|
65959
|
+
trigger: "compaction-event",
|
|
65960
|
+
behavior: "auto-launch",
|
|
65961
|
+
stepCount: DEFAULT_REFLECTION_SETTINGS.stepCount
|
|
65962
|
+
};
|
|
65963
|
+
}
|
|
65964
|
+
return { ...DEFAULT_REFLECTION_SETTINGS };
|
|
65965
|
+
}
|
|
65966
|
+
function reflectionSettingsToLegacyMode(settings) {
|
|
65967
|
+
if (settings.trigger === "off") {
|
|
65968
|
+
return null;
|
|
65969
|
+
}
|
|
65970
|
+
if (settings.trigger === "compaction-event") {
|
|
65971
|
+
return settings.behavior === "auto-launch" ? "auto-compaction" : "compaction";
|
|
65972
|
+
}
|
|
65973
|
+
return normalizeStepCount(settings.stepCount, DEFAULT_STEP_COUNT);
|
|
65974
|
+
}
|
|
65975
|
+
function getReflectionSettings() {
|
|
65976
|
+
const globalSettings = settingsManager.getSettings();
|
|
65977
|
+
let resolved = legacyModeToReflectionSettings(globalSettings.memoryReminderInterval);
|
|
65978
|
+
resolved = applyExplicitReflectionOverrides(resolved, globalSettings);
|
|
65979
|
+
try {
|
|
65980
|
+
const localSettings = settingsManager.getLocalProjectSettings();
|
|
65981
|
+
if (localSettings.memoryReminderInterval !== undefined) {
|
|
65982
|
+
resolved = legacyModeToReflectionSettings(localSettings.memoryReminderInterval);
|
|
65983
|
+
}
|
|
65984
|
+
resolved = applyExplicitReflectionOverrides(resolved, localSettings);
|
|
65985
|
+
} catch {}
|
|
65986
|
+
return resolved;
|
|
65987
|
+
}
|
|
65988
|
+
function shouldFireStepCountTrigger(turnCount, settings = getReflectionSettings()) {
|
|
65989
|
+
if (settings.trigger !== "step-count") {
|
|
65990
|
+
return false;
|
|
65991
|
+
}
|
|
65992
|
+
const stepCount = normalizeStepCount(settings.stepCount, DEFAULT_STEP_COUNT);
|
|
65993
|
+
return turnCount > 0 && turnCount % stepCount === 0;
|
|
65994
|
+
}
|
|
65995
|
+
async function buildMemfsAwareMemoryReminder(agentId, trigger) {
|
|
65996
|
+
if (settingsManager.isMemfsEnabled(agentId)) {
|
|
65997
|
+
debugLog("memory", `Reflection reminder fired (${trigger}, agent ${agentId})`);
|
|
65998
|
+
const { MEMORY_REFLECTION_REMINDER: MEMORY_REFLECTION_REMINDER3 } = await Promise.resolve().then(() => (init_promptAssets(), exports_promptAssets));
|
|
65999
|
+
return MEMORY_REFLECTION_REMINDER3;
|
|
66000
|
+
}
|
|
66001
|
+
debugLog("memory", `Memory check reminder fired (${trigger}, agent ${agentId})`);
|
|
66002
|
+
const { MEMORY_CHECK_REMINDER: MEMORY_CHECK_REMINDER3 } = await Promise.resolve().then(() => (init_promptAssets(), exports_promptAssets));
|
|
66003
|
+
return MEMORY_CHECK_REMINDER3;
|
|
66004
|
+
}
|
|
66005
|
+
async function buildCompactionMemoryReminder(agentId) {
|
|
66006
|
+
return buildMemfsAwareMemoryReminder(agentId, "compaction");
|
|
66007
|
+
}
|
|
66008
|
+
async function buildMemoryReminder(turnCount, agentId) {
|
|
66009
|
+
const reflectionSettings = getReflectionSettings();
|
|
66010
|
+
if (reflectionSettings.trigger !== "step-count") {
|
|
66011
|
+
return "";
|
|
66012
|
+
}
|
|
66013
|
+
if (shouldFireStepCountTrigger(turnCount, reflectionSettings)) {
|
|
66014
|
+
debugLog("memory", `Turn-based memory reminder fired (turn ${turnCount}, interval ${reflectionSettings.stepCount}, agent ${agentId})`);
|
|
66015
|
+
return buildMemfsAwareMemoryReminder(agentId, "interval");
|
|
66016
|
+
}
|
|
66017
|
+
return "";
|
|
66018
|
+
}
|
|
66019
|
+
function parseMemoryPreference(questions, answers) {
|
|
66020
|
+
for (const q of questions) {
|
|
66021
|
+
if (!q.question)
|
|
66022
|
+
continue;
|
|
66023
|
+
const questionLower = q.question.toLowerCase();
|
|
66024
|
+
const headerLower = q.header?.toLowerCase() || "";
|
|
66025
|
+
if (questionLower.includes("memory") || questionLower.includes("remember") || headerLower.includes("memory")) {
|
|
66026
|
+
const answer = answers[q.question]?.toLowerCase() || "";
|
|
66027
|
+
if (answer.includes("frequent")) {
|
|
66028
|
+
settingsManager.updateLocalProjectSettings({
|
|
66029
|
+
memoryReminderInterval: MEMORY_INTERVAL_FREQUENT,
|
|
66030
|
+
reflectionTrigger: "step-count",
|
|
66031
|
+
reflectionBehavior: "reminder",
|
|
66032
|
+
reflectionStepCount: MEMORY_INTERVAL_FREQUENT
|
|
66033
|
+
});
|
|
66034
|
+
return true;
|
|
66035
|
+
} else if (answer.includes("occasional")) {
|
|
66036
|
+
settingsManager.updateLocalProjectSettings({
|
|
66037
|
+
memoryReminderInterval: MEMORY_INTERVAL_OCCASIONAL,
|
|
66038
|
+
reflectionTrigger: "step-count",
|
|
66039
|
+
reflectionBehavior: "reminder",
|
|
66040
|
+
reflectionStepCount: MEMORY_INTERVAL_OCCASIONAL
|
|
66041
|
+
});
|
|
66042
|
+
return true;
|
|
66043
|
+
}
|
|
66044
|
+
break;
|
|
66045
|
+
}
|
|
66046
|
+
}
|
|
66047
|
+
return false;
|
|
66048
|
+
}
|
|
66049
|
+
var MEMORY_INTERVAL_FREQUENT = 5, MEMORY_INTERVAL_OCCASIONAL = 10, DEFAULT_STEP_COUNT = 25, DEFAULT_REFLECTION_SETTINGS;
|
|
66050
|
+
var init_memoryReminder = __esm(async () => {
|
|
66051
|
+
init_debug();
|
|
66052
|
+
await init_settings_manager();
|
|
66053
|
+
DEFAULT_REFLECTION_SETTINGS = {
|
|
66054
|
+
trigger: "compaction-event",
|
|
66055
|
+
behavior: "reminder",
|
|
66056
|
+
stepCount: DEFAULT_STEP_COUNT
|
|
66057
|
+
};
|
|
66058
|
+
});
|
|
66059
|
+
|
|
65827
66060
|
// src/cli/helpers/streamProcessor.ts
|
|
65828
66061
|
class StreamProcessor {
|
|
65829
66062
|
pendingApprovals = new Map;
|
|
@@ -66551,7 +66784,76 @@ ${content}`;
|
|
|
66551
66784
|
function shouldReinjectSkillsAfterCompaction(lines) {
|
|
66552
66785
|
return lines.some((line) => line.kind === "event" && line.eventType === "compaction" && line.phase === "finished" && (line.summary !== undefined || line.stats !== undefined));
|
|
66553
66786
|
}
|
|
66554
|
-
|
|
66787
|
+
function parseReflectionOverrides(values) {
|
|
66788
|
+
const triggerRaw = values["reflection-trigger"];
|
|
66789
|
+
const behaviorRaw = values["reflection-behavior"];
|
|
66790
|
+
const stepCountRaw = values["reflection-step-count"];
|
|
66791
|
+
if (!triggerRaw && !behaviorRaw && !stepCountRaw) {
|
|
66792
|
+
return {};
|
|
66793
|
+
}
|
|
66794
|
+
const overrides = {};
|
|
66795
|
+
if (triggerRaw !== undefined) {
|
|
66796
|
+
if (triggerRaw !== "off" && triggerRaw !== "step-count" && triggerRaw !== "compaction-event") {
|
|
66797
|
+
throw new Error(`Invalid --reflection-trigger "${triggerRaw}". Valid values: off, step-count, compaction-event`);
|
|
66798
|
+
}
|
|
66799
|
+
overrides.trigger = triggerRaw;
|
|
66800
|
+
}
|
|
66801
|
+
if (behaviorRaw !== undefined) {
|
|
66802
|
+
if (behaviorRaw !== "reminder" && behaviorRaw !== "auto-launch") {
|
|
66803
|
+
throw new Error(`Invalid --reflection-behavior "${behaviorRaw}". Valid values: reminder, auto-launch`);
|
|
66804
|
+
}
|
|
66805
|
+
overrides.behavior = behaviorRaw;
|
|
66806
|
+
}
|
|
66807
|
+
if (stepCountRaw !== undefined) {
|
|
66808
|
+
const parsed = Number.parseInt(stepCountRaw, 10);
|
|
66809
|
+
if (Number.isNaN(parsed) || parsed <= 0) {
|
|
66810
|
+
throw new Error(`Invalid --reflection-step-count "${stepCountRaw}". Expected a positive integer.`);
|
|
66811
|
+
}
|
|
66812
|
+
overrides.stepCount = parsed;
|
|
66813
|
+
}
|
|
66814
|
+
return overrides;
|
|
66815
|
+
}
|
|
66816
|
+
function hasReflectionOverrides(overrides) {
|
|
66817
|
+
return overrides.trigger !== undefined || overrides.behavior !== undefined || overrides.stepCount !== undefined;
|
|
66818
|
+
}
|
|
66819
|
+
async function applyReflectionOverrides(agentId, overrides) {
|
|
66820
|
+
const current = getReflectionSettings();
|
|
66821
|
+
const merged = {
|
|
66822
|
+
trigger: overrides.trigger ?? current.trigger,
|
|
66823
|
+
behavior: overrides.behavior ?? current.behavior,
|
|
66824
|
+
stepCount: overrides.stepCount ?? current.stepCount
|
|
66825
|
+
};
|
|
66826
|
+
if (!hasReflectionOverrides(overrides)) {
|
|
66827
|
+
return merged;
|
|
66828
|
+
}
|
|
66829
|
+
const memfsEnabled = settingsManager.isMemfsEnabled(agentId);
|
|
66830
|
+
if (!memfsEnabled && merged.trigger === "compaction-event") {
|
|
66831
|
+
throw new Error("--reflection-trigger compaction-event requires memfs enabled for this agent.");
|
|
66832
|
+
}
|
|
66833
|
+
if (!memfsEnabled && merged.trigger !== "off" && merged.behavior === "auto-launch") {
|
|
66834
|
+
throw new Error("--reflection-behavior auto-launch requires memfs enabled for this agent.");
|
|
66835
|
+
}
|
|
66836
|
+
try {
|
|
66837
|
+
settingsManager.getLocalProjectSettings();
|
|
66838
|
+
} catch {
|
|
66839
|
+
await settingsManager.loadLocalProjectSettings();
|
|
66840
|
+
}
|
|
66841
|
+
const legacyMode = reflectionSettingsToLegacyMode(merged);
|
|
66842
|
+
settingsManager.updateLocalProjectSettings({
|
|
66843
|
+
memoryReminderInterval: legacyMode,
|
|
66844
|
+
reflectionTrigger: merged.trigger,
|
|
66845
|
+
reflectionBehavior: merged.behavior,
|
|
66846
|
+
reflectionStepCount: merged.stepCount
|
|
66847
|
+
});
|
|
66848
|
+
settingsManager.updateSettings({
|
|
66849
|
+
memoryReminderInterval: legacyMode,
|
|
66850
|
+
reflectionTrigger: merged.trigger,
|
|
66851
|
+
reflectionBehavior: merged.behavior,
|
|
66852
|
+
reflectionStepCount: merged.stepCount
|
|
66853
|
+
});
|
|
66854
|
+
return merged;
|
|
66855
|
+
}
|
|
66856
|
+
async function handleHeadlessCommand(argv, model, skillsDirectoryOverride, skillSourcesOverride, systemInfoReminderEnabledOverride) {
|
|
66555
66857
|
const { values, positionals } = parseArgs5({
|
|
66556
66858
|
args: argv,
|
|
66557
66859
|
options: {
|
|
@@ -66584,6 +66886,7 @@ async function handleHeadlessCommand(argv, model, skillsDirectory, noSkills) {
|
|
|
66584
66886
|
"permission-mode": { type: "string" },
|
|
66585
66887
|
yolo: { type: "boolean" },
|
|
66586
66888
|
skills: { type: "string" },
|
|
66889
|
+
"skill-sources": { type: "string" },
|
|
66587
66890
|
"pre-load-skills": { type: "string" },
|
|
66588
66891
|
"init-blocks": { type: "string" },
|
|
66589
66892
|
"base-tools": { type: "string" },
|
|
@@ -66592,6 +66895,11 @@ async function handleHeadlessCommand(argv, model, skillsDirectory, noSkills) {
|
|
|
66592
66895
|
memfs: { type: "boolean" },
|
|
66593
66896
|
"no-memfs": { type: "boolean" },
|
|
66594
66897
|
"no-skills": { type: "boolean" },
|
|
66898
|
+
"no-bundled-skills": { type: "boolean" },
|
|
66899
|
+
"no-system-info-reminder": { type: "boolean" },
|
|
66900
|
+
"reflection-trigger": { type: "string" },
|
|
66901
|
+
"reflection-behavior": { type: "string" },
|
|
66902
|
+
"reflection-step-count": { type: "string" },
|
|
66595
66903
|
"max-turns": { type: "string" }
|
|
66596
66904
|
},
|
|
66597
66905
|
strict: false,
|
|
@@ -66683,14 +66991,42 @@ In headless mode, use:
|
|
|
66683
66991
|
const blockValueArgs = values["block-value"];
|
|
66684
66992
|
const initBlocksRaw = values["init-blocks"];
|
|
66685
66993
|
const baseToolsRaw = values["base-tools"];
|
|
66994
|
+
const skillsDirectory = values.skills ?? skillsDirectoryOverride;
|
|
66995
|
+
const noSkillsFlag = values["no-skills"];
|
|
66996
|
+
const noBundledSkillsFlag = values["no-bundled-skills"];
|
|
66997
|
+
const skillSourcesRaw = values["skill-sources"];
|
|
66686
66998
|
const memfsFlag = values.memfs;
|
|
66687
66999
|
const noMemfsFlag = values["no-memfs"];
|
|
66688
67000
|
const requestedMemoryPromptMode = memfsFlag ? "memfs" : noMemfsFlag ? "standard" : undefined;
|
|
66689
67001
|
const shouldAutoEnableMemfsForNewAgent = !memfsFlag && !noMemfsFlag;
|
|
66690
67002
|
const fromAfFile = values["from-af"];
|
|
66691
67003
|
const preLoadSkillsRaw = values["pre-load-skills"];
|
|
67004
|
+
const systemInfoReminderEnabled = systemInfoReminderEnabledOverride ?? !values["no-system-info-reminder"];
|
|
67005
|
+
const reflectionOverrides = (() => {
|
|
67006
|
+
try {
|
|
67007
|
+
return parseReflectionOverrides(values);
|
|
67008
|
+
} catch (error) {
|
|
67009
|
+
console.error(error instanceof Error ? `Error: ${error.message}` : String(error));
|
|
67010
|
+
process.exit(1);
|
|
67011
|
+
}
|
|
67012
|
+
})();
|
|
66692
67013
|
const maxTurnsRaw = values["max-turns"];
|
|
66693
67014
|
const tagsRaw = values.tags;
|
|
67015
|
+
const resolvedSkillSources = (() => {
|
|
67016
|
+
if (skillSourcesOverride) {
|
|
67017
|
+
return skillSourcesOverride;
|
|
67018
|
+
}
|
|
67019
|
+
try {
|
|
67020
|
+
return resolveSkillSourcesSelection({
|
|
67021
|
+
skillSourcesRaw,
|
|
67022
|
+
noSkills: noSkillsFlag,
|
|
67023
|
+
noBundledSkills: noBundledSkillsFlag
|
|
67024
|
+
});
|
|
67025
|
+
} catch (error) {
|
|
67026
|
+
console.error(error instanceof Error ? `Error: ${error.message}` : String(error));
|
|
67027
|
+
process.exit(1);
|
|
67028
|
+
}
|
|
67029
|
+
})();
|
|
66694
67030
|
let tags;
|
|
66695
67031
|
if (tagsRaw !== undefined) {
|
|
66696
67032
|
const trimmed = tagsRaw.trim();
|
|
@@ -66709,6 +67045,10 @@ In headless mode, use:
|
|
|
66709
67045
|
}
|
|
66710
67046
|
maxTurns = parsed;
|
|
66711
67047
|
}
|
|
67048
|
+
if (preLoadSkillsRaw && resolvedSkillSources.length === 0) {
|
|
67049
|
+
console.error("Error: --pre-load-skills cannot be used when all skill sources are disabled.");
|
|
67050
|
+
process.exit(1);
|
|
67051
|
+
}
|
|
66712
67052
|
if (specifiedConversationId?.startsWith("agent-")) {
|
|
66713
67053
|
if (specifiedAgentId && specifiedAgentId !== specifiedConversationId) {
|
|
66714
67054
|
console.error(`Error: Conflicting agent IDs: --agent ${specifiedAgentId} vs --conv ${specifiedConversationId}`);
|
|
@@ -66995,6 +67335,7 @@ In headless mode, use:
|
|
|
66995
67335
|
}
|
|
66996
67336
|
}
|
|
66997
67337
|
let conversationId;
|
|
67338
|
+
let effectiveReflectionSettings;
|
|
66998
67339
|
const isSubagent = process.env.LETTA_CODE_AGENT_ROLE === "subagent";
|
|
66999
67340
|
try {
|
|
67000
67341
|
const { applyMemfsFlags: applyMemfsFlags2 } = await Promise.resolve().then(() => (init_memoryFilesystem(), exports_memoryFilesystem));
|
|
@@ -67007,6 +67348,12 @@ In headless mode, use:
|
|
|
67007
67348
|
console.error(`Memory git sync failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
67008
67349
|
process.exit(1);
|
|
67009
67350
|
}
|
|
67351
|
+
try {
|
|
67352
|
+
effectiveReflectionSettings = await applyReflectionOverrides(agent.id, reflectionOverrides);
|
|
67353
|
+
} catch (error) {
|
|
67354
|
+
console.error(`Failed to apply sleeptime settings: ${error instanceof Error ? error.message : String(error)}`);
|
|
67355
|
+
process.exit(1);
|
|
67356
|
+
}
|
|
67010
67357
|
const isolatedBlockLabels = initBlocks === undefined ? [...ISOLATED_BLOCK_LABELS] : ISOLATED_BLOCK_LABELS.filter((label) => initBlocks.includes(label));
|
|
67011
67358
|
if (specifiedConversationId) {
|
|
67012
67359
|
if (specifiedConversationId === "default") {
|
|
@@ -67084,7 +67431,7 @@ In headless mode, use:
|
|
|
67084
67431
|
}
|
|
67085
67432
|
} catch {}
|
|
67086
67433
|
}
|
|
67087
|
-
setAgentContext2(agent.id, skillsDirectory,
|
|
67434
|
+
setAgentContext2(agent.id, skillsDirectory, resolvedSkillSources);
|
|
67088
67435
|
const outputFormat = values["output-format"] || "text";
|
|
67089
67436
|
const includePartialMessages = Boolean(values["include-partial-messages"]);
|
|
67090
67437
|
if (!["text", "json", "stream-json"].includes(outputFormat)) {
|
|
@@ -67099,7 +67446,7 @@ In headless mode, use:
|
|
|
67099
67446
|
const loadedToolNames = getClientToolsFromRegistry2().map((t) => t.name);
|
|
67100
67447
|
const availableTools = loadedToolNames.length > 0 ? loadedToolNames : agent.tools?.map((t) => t.name).filter((n) => !!n) || [];
|
|
67101
67448
|
if (isBidirectionalMode) {
|
|
67102
|
-
await runBidirectionalMode(agent, conversationId, client, outputFormat, includePartialMessages, availableTools);
|
|
67449
|
+
await runBidirectionalMode(agent, conversationId, client, outputFormat, includePartialMessages, availableTools, resolvedSkillSources, systemInfoReminderEnabled, effectiveReflectionSettings);
|
|
67103
67450
|
return;
|
|
67104
67451
|
}
|
|
67105
67452
|
const buffers = createBuffers(agent.id);
|
|
@@ -67119,6 +67466,11 @@ In headless mode, use:
|
|
|
67119
67466
|
permission_mode: "",
|
|
67120
67467
|
slash_commands: [],
|
|
67121
67468
|
memfs_enabled: settingsManager.isMemfsEnabled(agent.id),
|
|
67469
|
+
skill_sources: resolvedSkillSources,
|
|
67470
|
+
system_info_reminder_enabled: systemInfoReminderEnabled,
|
|
67471
|
+
reflection_trigger: effectiveReflectionSettings.trigger,
|
|
67472
|
+
reflection_behavior: effectiveReflectionSettings.behavior,
|
|
67473
|
+
reflection_step_count: effectiveReflectionSettings.stepCount,
|
|
67122
67474
|
uuid: `init-${agent.id}`
|
|
67123
67475
|
};
|
|
67124
67476
|
console.log(JSON.stringify(initEvent));
|
|
@@ -67242,7 +67594,7 @@ ${SYSTEM_REMINDER_CLOSE}
|
|
|
67242
67594
|
try {
|
|
67243
67595
|
const skillsDir = getSkillsDirectory2() || join22(process.cwd(), defaultDir);
|
|
67244
67596
|
const { skills } = await discoverSkills3(skillsDir, agent.id, {
|
|
67245
|
-
|
|
67597
|
+
sources: resolvedSkillSources
|
|
67246
67598
|
});
|
|
67247
67599
|
const skillsReminder = formatSkillsAsSystemReminder3(skills);
|
|
67248
67600
|
if (skillsReminder) {
|
|
@@ -67806,7 +68158,7 @@ ${loadedContents.join(`
|
|
|
67806
68158
|
markMilestone("HEADLESS_COMPLETE");
|
|
67807
68159
|
reportAllMilestones();
|
|
67808
68160
|
}
|
|
67809
|
-
async function runBidirectionalMode(agent, conversationId, client, _outputFormat, includePartialMessages, availableTools) {
|
|
68161
|
+
async function runBidirectionalMode(agent, conversationId, client, _outputFormat, includePartialMessages, availableTools, skillSources, systemInfoReminderEnabled, reflectionSettings) {
|
|
67810
68162
|
const sessionId = agent.id;
|
|
67811
68163
|
const readline = await import("node:readline");
|
|
67812
68164
|
const initEvent = {
|
|
@@ -67819,6 +68171,11 @@ async function runBidirectionalMode(agent, conversationId, client, _outputFormat
|
|
|
67819
68171
|
tools: availableTools,
|
|
67820
68172
|
cwd: process.cwd(),
|
|
67821
68173
|
memfs_enabled: settingsManager.isMemfsEnabled(agent.id),
|
|
68174
|
+
skill_sources: skillSources,
|
|
68175
|
+
system_info_reminder_enabled: systemInfoReminderEnabled,
|
|
68176
|
+
reflection_trigger: reflectionSettings.trigger,
|
|
68177
|
+
reflection_behavior: reflectionSettings.behavior,
|
|
68178
|
+
reflection_step_count: reflectionSettings.stepCount,
|
|
67822
68179
|
uuid: `init-${agent.id}`
|
|
67823
68180
|
};
|
|
67824
68181
|
console.log(JSON.stringify(initEvent));
|
|
@@ -68007,7 +68364,13 @@ async function runBidirectionalMode(agent, conversationId, client, _outputFormat
|
|
|
68007
68364
|
response: {
|
|
68008
68365
|
agent_id: agent.id,
|
|
68009
68366
|
model: agent.llm_config?.model,
|
|
68010
|
-
tools: availableTools
|
|
68367
|
+
tools: availableTools,
|
|
68368
|
+
memfs_enabled: settingsManager.isMemfsEnabled(agent.id),
|
|
68369
|
+
skill_sources: skillSources,
|
|
68370
|
+
system_info_reminder_enabled: systemInfoReminderEnabled,
|
|
68371
|
+
reflection_trigger: reflectionSettings.trigger,
|
|
68372
|
+
reflection_behavior: reflectionSettings.behavior,
|
|
68373
|
+
reflection_step_count: reflectionSettings.stepCount
|
|
68011
68374
|
}
|
|
68012
68375
|
},
|
|
68013
68376
|
session_id: sessionId,
|
|
@@ -68112,7 +68475,9 @@ async function runBidirectionalMode(agent, conversationId, client, _outputFormat
|
|
|
68112
68475
|
const { getSkillsDirectory: getSkillsDirectory2 } = await Promise.resolve().then(() => (init_context(), exports_context));
|
|
68113
68476
|
const { join: join22 } = await import("node:path");
|
|
68114
68477
|
const skillsDir = getSkillsDirectory2() || join22(process.cwd(), defaultDir);
|
|
68115
|
-
const { skills } = await discover(skillsDir, agent.id
|
|
68478
|
+
const { skills } = await discover(skillsDir, agent.id, {
|
|
68479
|
+
sources: skillSources
|
|
68480
|
+
});
|
|
68116
68481
|
const latestSkillsReminder = formatSkillsAsSystemReminder3(skills);
|
|
68117
68482
|
if (cachedSkillsReminder !== null && latestSkillsReminder !== cachedSkillsReminder) {
|
|
68118
68483
|
pendingSkillsReinject = true;
|
|
@@ -68422,6 +68787,7 @@ var init_headless = __esm(async () => {
|
|
|
68422
68787
|
init_context();
|
|
68423
68788
|
init_memory();
|
|
68424
68789
|
init_model();
|
|
68790
|
+
init_skillSources();
|
|
68425
68791
|
init_errorFormatter();
|
|
68426
68792
|
init_constants();
|
|
68427
68793
|
init_interactivePolicy();
|
|
@@ -68433,6 +68799,7 @@ var init_headless = __esm(async () => {
|
|
|
68433
68799
|
init_message(),
|
|
68434
68800
|
init_accumulator(),
|
|
68435
68801
|
init_approvalClassification(),
|
|
68802
|
+
init_memoryReminder(),
|
|
68436
68803
|
init_stream(),
|
|
68437
68804
|
init_settings_manager(),
|
|
68438
68805
|
init_manager3()
|
|
@@ -88833,11 +89200,11 @@ function SkillsDialog({ onClose, agentId }) {
|
|
|
88833
89200
|
(async () => {
|
|
88834
89201
|
try {
|
|
88835
89202
|
const { discoverSkills: discoverSkills3, SKILLS_DIR: SKILLS_DIR3 } = await Promise.resolve().then(() => (init_skills(), exports_skills));
|
|
88836
|
-
const { getSkillsDirectory: getSkillsDirectory2,
|
|
89203
|
+
const { getSkillsDirectory: getSkillsDirectory2, getSkillSources: getSkillSources2 } = await Promise.resolve().then(() => (init_context(), exports_context));
|
|
88837
89204
|
const { join: join29 } = await import("node:path");
|
|
88838
89205
|
const skillsDir = getSkillsDirectory2() || join29(process.cwd(), SKILLS_DIR3);
|
|
88839
89206
|
const result = await discoverSkills3(skillsDir, agentId, {
|
|
88840
|
-
|
|
89207
|
+
sources: getSkillSources2()
|
|
88841
89208
|
});
|
|
88842
89209
|
setSkills(result.skills);
|
|
88843
89210
|
} catch {
|
|
@@ -89059,7 +89426,7 @@ function parseInitialState(initialSettings) {
|
|
|
89059
89426
|
return {
|
|
89060
89427
|
trigger: initialSettings.trigger === "off" || initialSettings.trigger === "step-count" || initialSettings.trigger === "compaction-event" ? initialSettings.trigger : "step-count",
|
|
89061
89428
|
behavior: initialSettings.behavior === "auto-launch" ? "auto-launch" : "reminder",
|
|
89062
|
-
stepCount: String(Number.isInteger(initialSettings.stepCount) && initialSettings.stepCount > 0 ? initialSettings.stepCount : Number(
|
|
89429
|
+
stepCount: String(Number.isInteger(initialSettings.stepCount) && initialSettings.stepCount > 0 ? initialSettings.stepCount : Number(DEFAULT_STEP_COUNT2))
|
|
89063
89430
|
};
|
|
89064
89431
|
}
|
|
89065
89432
|
function parseStepCount(raw) {
|
|
@@ -89121,7 +89488,7 @@ function SleeptimeSelector({
|
|
|
89121
89488
|
});
|
|
89122
89489
|
return;
|
|
89123
89490
|
}
|
|
89124
|
-
const fallbackStepCount = parseStepCount(stepCountInput) ?? Number(
|
|
89491
|
+
const fallbackStepCount = parseStepCount(stepCountInput) ?? Number(DEFAULT_STEP_COUNT2);
|
|
89125
89492
|
onSave({
|
|
89126
89493
|
trigger,
|
|
89127
89494
|
behavior: memfsEnabled ? behavior : "reminder",
|
|
@@ -89378,7 +89745,7 @@ function SleeptimeSelector({
|
|
|
89378
89745
|
]
|
|
89379
89746
|
}, undefined, true, undefined, this);
|
|
89380
89747
|
}
|
|
89381
|
-
var import_react81, jsx_dev_runtime58, SOLID_LINE23 = "─",
|
|
89748
|
+
var import_react81, jsx_dev_runtime58, SOLID_LINE23 = "─", DEFAULT_STEP_COUNT2 = "25", BEHAVIOR_OPTIONS;
|
|
89382
89749
|
var init_SleeptimeSelector = __esm(async () => {
|
|
89383
89750
|
init_useTerminalWidth();
|
|
89384
89751
|
init_colors();
|
|
@@ -92802,157 +93169,6 @@ var init_contextChart = __esm(() => {
|
|
|
92802
93169
|
].map(hexToFgAnsi);
|
|
92803
93170
|
});
|
|
92804
93171
|
|
|
92805
|
-
// src/cli/helpers/memoryReminder.ts
|
|
92806
|
-
function isValidStepCount(value) {
|
|
92807
|
-
return typeof value === "number" && Number.isFinite(value) && Number.isInteger(value) && value > 0;
|
|
92808
|
-
}
|
|
92809
|
-
function normalizeStepCount(value, fallback) {
|
|
92810
|
-
return isValidStepCount(value) ? value : fallback;
|
|
92811
|
-
}
|
|
92812
|
-
function normalizeTrigger(value, fallback) {
|
|
92813
|
-
if (value === "off" || value === "step-count" || value === "compaction-event") {
|
|
92814
|
-
return value;
|
|
92815
|
-
}
|
|
92816
|
-
return fallback;
|
|
92817
|
-
}
|
|
92818
|
-
function normalizeBehavior(value, fallback) {
|
|
92819
|
-
if (value === "reminder" || value === "auto-launch") {
|
|
92820
|
-
return value;
|
|
92821
|
-
}
|
|
92822
|
-
return fallback;
|
|
92823
|
-
}
|
|
92824
|
-
function applyExplicitReflectionOverrides(base2, raw) {
|
|
92825
|
-
return {
|
|
92826
|
-
trigger: normalizeTrigger(raw.reflectionTrigger, base2.trigger),
|
|
92827
|
-
behavior: normalizeBehavior(raw.reflectionBehavior, base2.behavior),
|
|
92828
|
-
stepCount: normalizeStepCount(raw.reflectionStepCount, base2.stepCount)
|
|
92829
|
-
};
|
|
92830
|
-
}
|
|
92831
|
-
function legacyModeToReflectionSettings(mode) {
|
|
92832
|
-
if (typeof mode === "number") {
|
|
92833
|
-
return {
|
|
92834
|
-
trigger: "step-count",
|
|
92835
|
-
behavior: "reminder",
|
|
92836
|
-
stepCount: normalizeStepCount(mode, DEFAULT_STEP_COUNT2)
|
|
92837
|
-
};
|
|
92838
|
-
}
|
|
92839
|
-
if (mode === null) {
|
|
92840
|
-
return {
|
|
92841
|
-
trigger: "off",
|
|
92842
|
-
behavior: DEFAULT_REFLECTION_SETTINGS.behavior,
|
|
92843
|
-
stepCount: DEFAULT_REFLECTION_SETTINGS.stepCount
|
|
92844
|
-
};
|
|
92845
|
-
}
|
|
92846
|
-
if (mode === "compaction") {
|
|
92847
|
-
return {
|
|
92848
|
-
trigger: "compaction-event",
|
|
92849
|
-
behavior: "reminder",
|
|
92850
|
-
stepCount: DEFAULT_REFLECTION_SETTINGS.stepCount
|
|
92851
|
-
};
|
|
92852
|
-
}
|
|
92853
|
-
if (mode === "auto-compaction") {
|
|
92854
|
-
return {
|
|
92855
|
-
trigger: "compaction-event",
|
|
92856
|
-
behavior: "auto-launch",
|
|
92857
|
-
stepCount: DEFAULT_REFLECTION_SETTINGS.stepCount
|
|
92858
|
-
};
|
|
92859
|
-
}
|
|
92860
|
-
return { ...DEFAULT_REFLECTION_SETTINGS };
|
|
92861
|
-
}
|
|
92862
|
-
function reflectionSettingsToLegacyMode(settings) {
|
|
92863
|
-
if (settings.trigger === "off") {
|
|
92864
|
-
return null;
|
|
92865
|
-
}
|
|
92866
|
-
if (settings.trigger === "compaction-event") {
|
|
92867
|
-
return settings.behavior === "auto-launch" ? "auto-compaction" : "compaction";
|
|
92868
|
-
}
|
|
92869
|
-
return normalizeStepCount(settings.stepCount, DEFAULT_STEP_COUNT2);
|
|
92870
|
-
}
|
|
92871
|
-
function getReflectionSettings() {
|
|
92872
|
-
const globalSettings = settingsManager.getSettings();
|
|
92873
|
-
let resolved = legacyModeToReflectionSettings(globalSettings.memoryReminderInterval);
|
|
92874
|
-
resolved = applyExplicitReflectionOverrides(resolved, globalSettings);
|
|
92875
|
-
try {
|
|
92876
|
-
const localSettings = settingsManager.getLocalProjectSettings();
|
|
92877
|
-
if (localSettings.memoryReminderInterval !== undefined) {
|
|
92878
|
-
resolved = legacyModeToReflectionSettings(localSettings.memoryReminderInterval);
|
|
92879
|
-
}
|
|
92880
|
-
resolved = applyExplicitReflectionOverrides(resolved, localSettings);
|
|
92881
|
-
} catch {}
|
|
92882
|
-
return resolved;
|
|
92883
|
-
}
|
|
92884
|
-
function shouldFireStepCountTrigger(turnCount, settings = getReflectionSettings()) {
|
|
92885
|
-
if (settings.trigger !== "step-count") {
|
|
92886
|
-
return false;
|
|
92887
|
-
}
|
|
92888
|
-
const stepCount = normalizeStepCount(settings.stepCount, DEFAULT_STEP_COUNT2);
|
|
92889
|
-
return turnCount > 0 && turnCount % stepCount === 0;
|
|
92890
|
-
}
|
|
92891
|
-
async function buildMemfsAwareMemoryReminder(agentId, trigger) {
|
|
92892
|
-
if (settingsManager.isMemfsEnabled(agentId)) {
|
|
92893
|
-
debugLog("memory", `Reflection reminder fired (${trigger}, agent ${agentId})`);
|
|
92894
|
-
const { MEMORY_REFLECTION_REMINDER: MEMORY_REFLECTION_REMINDER3 } = await Promise.resolve().then(() => (init_promptAssets(), exports_promptAssets));
|
|
92895
|
-
return MEMORY_REFLECTION_REMINDER3;
|
|
92896
|
-
}
|
|
92897
|
-
debugLog("memory", `Memory check reminder fired (${trigger}, agent ${agentId})`);
|
|
92898
|
-
const { MEMORY_CHECK_REMINDER: MEMORY_CHECK_REMINDER3 } = await Promise.resolve().then(() => (init_promptAssets(), exports_promptAssets));
|
|
92899
|
-
return MEMORY_CHECK_REMINDER3;
|
|
92900
|
-
}
|
|
92901
|
-
async function buildCompactionMemoryReminder(agentId) {
|
|
92902
|
-
return buildMemfsAwareMemoryReminder(agentId, "compaction");
|
|
92903
|
-
}
|
|
92904
|
-
async function buildMemoryReminder(turnCount, agentId) {
|
|
92905
|
-
const reflectionSettings = getReflectionSettings();
|
|
92906
|
-
if (reflectionSettings.trigger !== "step-count") {
|
|
92907
|
-
return "";
|
|
92908
|
-
}
|
|
92909
|
-
if (shouldFireStepCountTrigger(turnCount, reflectionSettings)) {
|
|
92910
|
-
debugLog("memory", `Turn-based memory reminder fired (turn ${turnCount}, interval ${reflectionSettings.stepCount}, agent ${agentId})`);
|
|
92911
|
-
return buildMemfsAwareMemoryReminder(agentId, "interval");
|
|
92912
|
-
}
|
|
92913
|
-
return "";
|
|
92914
|
-
}
|
|
92915
|
-
function parseMemoryPreference(questions, answers) {
|
|
92916
|
-
for (const q of questions) {
|
|
92917
|
-
if (!q.question)
|
|
92918
|
-
continue;
|
|
92919
|
-
const questionLower = q.question.toLowerCase();
|
|
92920
|
-
const headerLower = q.header?.toLowerCase() || "";
|
|
92921
|
-
if (questionLower.includes("memory") || questionLower.includes("remember") || headerLower.includes("memory")) {
|
|
92922
|
-
const answer = answers[q.question]?.toLowerCase() || "";
|
|
92923
|
-
if (answer.includes("frequent")) {
|
|
92924
|
-
settingsManager.updateLocalProjectSettings({
|
|
92925
|
-
memoryReminderInterval: MEMORY_INTERVAL_FREQUENT,
|
|
92926
|
-
reflectionTrigger: "step-count",
|
|
92927
|
-
reflectionBehavior: "reminder",
|
|
92928
|
-
reflectionStepCount: MEMORY_INTERVAL_FREQUENT
|
|
92929
|
-
});
|
|
92930
|
-
return true;
|
|
92931
|
-
} else if (answer.includes("occasional")) {
|
|
92932
|
-
settingsManager.updateLocalProjectSettings({
|
|
92933
|
-
memoryReminderInterval: MEMORY_INTERVAL_OCCASIONAL,
|
|
92934
|
-
reflectionTrigger: "step-count",
|
|
92935
|
-
reflectionBehavior: "reminder",
|
|
92936
|
-
reflectionStepCount: MEMORY_INTERVAL_OCCASIONAL
|
|
92937
|
-
});
|
|
92938
|
-
return true;
|
|
92939
|
-
}
|
|
92940
|
-
break;
|
|
92941
|
-
}
|
|
92942
|
-
}
|
|
92943
|
-
return false;
|
|
92944
|
-
}
|
|
92945
|
-
var MEMORY_INTERVAL_FREQUENT = 5, MEMORY_INTERVAL_OCCASIONAL = 10, DEFAULT_STEP_COUNT2 = 25, DEFAULT_REFLECTION_SETTINGS;
|
|
92946
|
-
var init_memoryReminder = __esm(async () => {
|
|
92947
|
-
init_debug();
|
|
92948
|
-
await init_settings_manager();
|
|
92949
|
-
DEFAULT_REFLECTION_SETTINGS = {
|
|
92950
|
-
trigger: "compaction-event",
|
|
92951
|
-
behavior: "reminder",
|
|
92952
|
-
stepCount: DEFAULT_STEP_COUNT2
|
|
92953
|
-
};
|
|
92954
|
-
});
|
|
92955
|
-
|
|
92956
93172
|
// src/cli/helpers/queuedMessageParts.ts
|
|
92957
93173
|
function getQueuedNotificationSummaries(queued) {
|
|
92958
93174
|
const summaries = [];
|
|
@@ -95452,7 +95668,8 @@ function App2({
|
|
|
95452
95668
|
tokenStreaming = false,
|
|
95453
95669
|
showCompactions = false,
|
|
95454
95670
|
agentProvenance = null,
|
|
95455
|
-
releaseNotes = null
|
|
95671
|
+
releaseNotes = null,
|
|
95672
|
+
sessionContextReminderEnabled = true
|
|
95456
95673
|
}) {
|
|
95457
95674
|
import_react94.useEffect(() => {
|
|
95458
95675
|
prefetchAvailableModelHandles();
|
|
@@ -99716,7 +99933,7 @@ ${SYSTEM_REMINDER_CLOSE}`)
|
|
|
99716
99933
|
}
|
|
99717
99934
|
let sessionContextReminder = "";
|
|
99718
99935
|
const sessionContextEnabled = settingsManager.getSetting("sessionContextEnabled");
|
|
99719
|
-
if (!hasSentSessionContextRef.current && sessionContextEnabled) {
|
|
99936
|
+
if (!hasSentSessionContextRef.current && sessionContextEnabled && sessionContextReminderEnabled) {
|
|
99720
99937
|
const { buildSessionContext: buildSessionContext2 } = await init_sessionContext().then(() => exports_sessionContext);
|
|
99721
99938
|
sessionContextReminder = buildSessionContext2({
|
|
99722
99939
|
agentInfo: {
|
|
@@ -99831,13 +100048,13 @@ ${SYSTEM_REMINDER_CLOSE}
|
|
|
99831
100048
|
SKILLS_DIR: defaultDir,
|
|
99832
100049
|
formatSkillsAsSystemReminder: formatSkillsAsSystemReminder3
|
|
99833
100050
|
} = await Promise.resolve().then(() => (init_skills(), exports_skills));
|
|
99834
|
-
const { getSkillsDirectory: getSkillsDirectory2,
|
|
100051
|
+
const { getSkillsDirectory: getSkillsDirectory2, getSkillSources: getSkillSources2 } = await Promise.resolve().then(() => (init_context(), exports_context));
|
|
99835
100052
|
const previousSkillsReminder = discoveredSkillsRef.current ? formatSkillsAsSystemReminder3(discoveredSkillsRef.current) : null;
|
|
99836
100053
|
let latestSkills = discoveredSkillsRef.current ?? [];
|
|
99837
100054
|
try {
|
|
99838
100055
|
const skillsDir = getSkillsDirectory2() || join30(process.cwd(), defaultDir);
|
|
99839
100056
|
const { skills } = await discover(skillsDir, agentId, {
|
|
99840
|
-
|
|
100057
|
+
sources: getSkillSources2()
|
|
99841
100058
|
});
|
|
99842
100059
|
latestSkills = skills;
|
|
99843
100060
|
} catch {}
|
|
@@ -100311,6 +100528,7 @@ ${SYSTEM_REMINDER_CLOSE}
|
|
|
100311
100528
|
pendingRalphConfig,
|
|
100312
100529
|
openTrajectorySegment,
|
|
100313
100530
|
resetTrajectoryBases,
|
|
100531
|
+
sessionContextReminderEnabled,
|
|
100314
100532
|
appendTaskNotificationEvents
|
|
100315
100533
|
]);
|
|
100316
100534
|
const onSubmitRef = import_react94.useRef(onSubmit);
|
|
@@ -104105,6 +104323,7 @@ async function getClient() {
|
|
|
104105
104323
|
}
|
|
104106
104324
|
|
|
104107
104325
|
// src/agent/context.ts
|
|
104326
|
+
init_skillSources();
|
|
104108
104327
|
var CONTEXT_KEY = Symbol.for("@letta/agentContext");
|
|
104109
104328
|
function getContext() {
|
|
104110
104329
|
const global2 = globalThis;
|
|
@@ -104112,17 +104331,17 @@ function getContext() {
|
|
|
104112
104331
|
global2[CONTEXT_KEY] = {
|
|
104113
104332
|
agentId: null,
|
|
104114
104333
|
skillsDirectory: null,
|
|
104115
|
-
|
|
104334
|
+
skillSources: [...ALL_SKILL_SOURCES],
|
|
104116
104335
|
conversationId: null
|
|
104117
104336
|
};
|
|
104118
104337
|
}
|
|
104119
104338
|
return global2[CONTEXT_KEY];
|
|
104120
104339
|
}
|
|
104121
104340
|
var context = getContext();
|
|
104122
|
-
function setAgentContext(agentId, skillsDirectory,
|
|
104341
|
+
function setAgentContext(agentId, skillsDirectory, skillSources) {
|
|
104123
104342
|
context.agentId = agentId;
|
|
104124
104343
|
context.skillsDirectory = skillsDirectory || null;
|
|
104125
|
-
context.
|
|
104344
|
+
context.skillSources = skillSources !== undefined ? [...skillSources] : [...ALL_SKILL_SOURCES];
|
|
104126
104345
|
}
|
|
104127
104346
|
function setConversationId(conversationId) {
|
|
104128
104347
|
context.conversationId = conversationId;
|
|
@@ -104150,6 +104369,54 @@ var MEMORY_BLOCK_LABELS2 = [
|
|
|
104150
104369
|
];
|
|
104151
104370
|
var ISOLATED_BLOCK_LABELS2 = [];
|
|
104152
104371
|
|
|
104372
|
+
// src/agent/skillSources.ts
|
|
104373
|
+
var ALL_SKILL_SOURCES2 = [
|
|
104374
|
+
"bundled",
|
|
104375
|
+
"global",
|
|
104376
|
+
"agent",
|
|
104377
|
+
"project"
|
|
104378
|
+
];
|
|
104379
|
+
var VALID_SKILL_SOURCE_SPECIFIERS2 = [
|
|
104380
|
+
"all",
|
|
104381
|
+
...ALL_SKILL_SOURCES2
|
|
104382
|
+
];
|
|
104383
|
+
function isSkillSource2(value) {
|
|
104384
|
+
return ALL_SKILL_SOURCES2.includes(value);
|
|
104385
|
+
}
|
|
104386
|
+
function normalizeSkillSources2(sources) {
|
|
104387
|
+
const sourceSet = new Set(sources);
|
|
104388
|
+
return ALL_SKILL_SOURCES2.filter((source) => sourceSet.has(source));
|
|
104389
|
+
}
|
|
104390
|
+
function parseSkillSourcesList2(skillSourcesRaw) {
|
|
104391
|
+
const tokens = skillSourcesRaw.split(",").map((source) => source.trim()).filter((source) => source.length > 0);
|
|
104392
|
+
if (tokens.length === 0) {
|
|
104393
|
+
throw new Error("--skill-sources must include at least one source (e.g. bundled,project)");
|
|
104394
|
+
}
|
|
104395
|
+
const sources = [];
|
|
104396
|
+
for (const token of tokens) {
|
|
104397
|
+
const source = token;
|
|
104398
|
+
if (!VALID_SKILL_SOURCE_SPECIFIERS2.includes(source)) {
|
|
104399
|
+
throw new Error(`Invalid skill source "${token}". Valid values: ${VALID_SKILL_SOURCE_SPECIFIERS2.join(", ")}`);
|
|
104400
|
+
}
|
|
104401
|
+
if (source === "all") {
|
|
104402
|
+
sources.push(...ALL_SKILL_SOURCES2);
|
|
104403
|
+
continue;
|
|
104404
|
+
}
|
|
104405
|
+
if (isSkillSource2(source)) {
|
|
104406
|
+
sources.push(source);
|
|
104407
|
+
}
|
|
104408
|
+
}
|
|
104409
|
+
return normalizeSkillSources2(sources);
|
|
104410
|
+
}
|
|
104411
|
+
function resolveSkillSourcesSelection2(input) {
|
|
104412
|
+
if (input.noSkills) {
|
|
104413
|
+
return [];
|
|
104414
|
+
}
|
|
104415
|
+
const configuredSources = input.skillSourcesRaw ? parseSkillSourcesList2(input.skillSourcesRaw) : [...ALL_SKILL_SOURCES2];
|
|
104416
|
+
const filteredSources = input.noBundledSkills ? configuredSources.filter((source) => source !== "bundled") : configuredSources;
|
|
104417
|
+
return normalizeSkillSources2(filteredSources);
|
|
104418
|
+
}
|
|
104419
|
+
|
|
104153
104420
|
// src/index.ts
|
|
104154
104421
|
init_oauth2();
|
|
104155
104422
|
|
|
@@ -107386,10 +107653,21 @@ OPTIONS
|
|
|
107386
107653
|
Emit stream_event wrappers for each chunk (stream-json only)
|
|
107387
107654
|
--from-agent <id> Inject agent-to-agent system reminder (headless mode)
|
|
107388
107655
|
--skills <path> Custom path to skills directory (default: .skills in current directory)
|
|
107656
|
+
--skill-sources <csv> Skill sources: all,bundled,global,agent,project (default: all)
|
|
107657
|
+
--no-skills Disable all skill sources
|
|
107658
|
+
--no-bundled-skills Disable bundled skills only
|
|
107389
107659
|
--import <path> Create agent from an AgentFile (.af) template
|
|
107390
107660
|
Use @author/name to import from the agent registry
|
|
107391
107661
|
--memfs Enable memory filesystem for this agent
|
|
107392
107662
|
--no-memfs Disable memory filesystem for this agent
|
|
107663
|
+
--no-system-info-reminder
|
|
107664
|
+
Disable first-turn environment reminder (device/git/cwd context)
|
|
107665
|
+
--reflection-trigger <mode>
|
|
107666
|
+
Sleeptime trigger: off, step-count, compaction-event
|
|
107667
|
+
--reflection-behavior <mode>
|
|
107668
|
+
Sleeptime behavior: reminder, auto-launch
|
|
107669
|
+
--reflection-step-count <n>
|
|
107670
|
+
Sleeptime step-count interval (positive integer)
|
|
107393
107671
|
|
|
107394
107672
|
SUBCOMMANDS (JSON-only)
|
|
107395
107673
|
letta memfs status --agent <id>
|
|
@@ -107635,6 +107913,7 @@ async function main() {
|
|
|
107635
107913
|
"include-partial-messages": { type: "boolean" },
|
|
107636
107914
|
"from-agent": { type: "string" },
|
|
107637
107915
|
skills: { type: "string" },
|
|
107916
|
+
"skill-sources": { type: "string" },
|
|
107638
107917
|
"pre-load-skills": { type: "string" },
|
|
107639
107918
|
"from-af": { type: "string" },
|
|
107640
107919
|
import: { type: "string" },
|
|
@@ -107642,6 +107921,11 @@ async function main() {
|
|
|
107642
107921
|
memfs: { type: "boolean" },
|
|
107643
107922
|
"no-memfs": { type: "boolean" },
|
|
107644
107923
|
"no-skills": { type: "boolean" },
|
|
107924
|
+
"no-bundled-skills": { type: "boolean" },
|
|
107925
|
+
"no-system-info-reminder": { type: "boolean" },
|
|
107926
|
+
"reflection-trigger": { type: "string" },
|
|
107927
|
+
"reflection-behavior": { type: "string" },
|
|
107928
|
+
"reflection-step-count": { type: "string" },
|
|
107645
107929
|
"max-turns": { type: "string" }
|
|
107646
107930
|
},
|
|
107647
107931
|
strict: true,
|
|
@@ -107727,6 +108011,21 @@ Note: Flags should use double dashes for full names (e.g., --yolo, not -yolo)`);
|
|
|
107727
108011
|
const requestedMemoryPromptMode = memfsFlag ? "memfs" : noMemfsFlag ? "standard" : undefined;
|
|
107728
108012
|
const shouldAutoEnableMemfsForNewAgent = !memfsFlag && !noMemfsFlag;
|
|
107729
108013
|
const noSkillsFlag = values["no-skills"];
|
|
108014
|
+
const noBundledSkillsFlag = values["no-bundled-skills"];
|
|
108015
|
+
const skillSourcesRaw = values["skill-sources"];
|
|
108016
|
+
const noSystemInfoReminderFlag = values["no-system-info-reminder"];
|
|
108017
|
+
const resolvedSkillSources = (() => {
|
|
108018
|
+
try {
|
|
108019
|
+
return resolveSkillSourcesSelection2({
|
|
108020
|
+
skillSourcesRaw,
|
|
108021
|
+
noSkills: noSkillsFlag,
|
|
108022
|
+
noBundledSkills: noBundledSkillsFlag
|
|
108023
|
+
});
|
|
108024
|
+
} catch (error) {
|
|
108025
|
+
console.error(error instanceof Error ? `Error: ${error.message}` : String(error));
|
|
108026
|
+
process.exit(1);
|
|
108027
|
+
}
|
|
108028
|
+
})();
|
|
107730
108029
|
const fromAfFile = values.import ?? values["from-af"];
|
|
107731
108030
|
const isHeadless = values.prompt || values.run || !process.stdin.isTTY;
|
|
107732
108031
|
if (command && !isHeadless) {
|
|
@@ -107992,7 +108291,7 @@ Error: ${message}`);
|
|
|
107992
108291
|
await loadTools2(modelForTools);
|
|
107993
108292
|
markMilestone2("TOOLS_LOADED");
|
|
107994
108293
|
const { handleHeadlessCommand: handleHeadlessCommand2 } = await init_headless().then(() => exports_headless);
|
|
107995
|
-
await handleHeadlessCommand2(process.argv, specifiedModel, skillsDirectory,
|
|
108294
|
+
await handleHeadlessCommand2(process.argv, specifiedModel, skillsDirectory, resolvedSkillSources, !noSystemInfoReminderFlag);
|
|
107996
108295
|
return;
|
|
107997
108296
|
}
|
|
107998
108297
|
markMilestone2("TUI_MODE_START");
|
|
@@ -108472,7 +108771,7 @@ Error: ${message}`);
|
|
|
108472
108771
|
}
|
|
108473
108772
|
} catch {}
|
|
108474
108773
|
}
|
|
108475
|
-
setAgentContext(agent.id, skillsDirectory2,
|
|
108774
|
+
setAgentContext(agent.id, skillsDirectory2, resolvedSkillSources);
|
|
108476
108775
|
const isSubagent = process.env.LETTA_CODE_AGENT_ROLE === "subagent";
|
|
108477
108776
|
try {
|
|
108478
108777
|
const { applyMemfsFlags: applyMemfsFlags3 } = await Promise.resolve().then(() => (init_memoryFilesystem2(), exports_memoryFilesystem2));
|
|
@@ -108694,7 +108993,8 @@ Error during initialization: ${message}`);
|
|
|
108694
108993
|
tokenStreaming: settings.tokenStreaming,
|
|
108695
108994
|
showCompactions: settings.showCompactions,
|
|
108696
108995
|
agentProvenance,
|
|
108697
|
-
releaseNotes: releaseNotes2
|
|
108996
|
+
releaseNotes: releaseNotes2,
|
|
108997
|
+
sessionContextReminderEnabled: !noSystemInfoReminderFlag
|
|
108698
108998
|
});
|
|
108699
108999
|
}
|
|
108700
109000
|
return React14.createElement(App3, {
|
|
@@ -108710,7 +109010,8 @@ Error during initialization: ${message}`);
|
|
|
108710
109010
|
tokenStreaming: settings.tokenStreaming,
|
|
108711
109011
|
showCompactions: settings.showCompactions,
|
|
108712
109012
|
agentProvenance,
|
|
108713
|
-
releaseNotes: releaseNotes2
|
|
109013
|
+
releaseNotes: releaseNotes2,
|
|
109014
|
+
sessionContextReminderEnabled: !noSystemInfoReminderFlag
|
|
108714
109015
|
});
|
|
108715
109016
|
}
|
|
108716
109017
|
markMilestone2("REACT_RENDER_START");
|
|
@@ -108732,4 +109033,4 @@ Error during initialization: ${message}`);
|
|
|
108732
109033
|
}
|
|
108733
109034
|
main();
|
|
108734
109035
|
|
|
108735
|
-
//# debugId=
|
|
109036
|
+
//# debugId=A249B0D2C7F9A4B164756E2164756E21
|