@letta-ai/letta-code 0.15.3 → 0.15.4
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 +489 -200
- 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.4",
|
|
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(() => {
|
|
@@ -35035,6 +35086,7 @@ __export(exports_context, {
|
|
|
35035
35086
|
setConversationId: () => setConversationId2,
|
|
35036
35087
|
setAgentContext: () => setAgentContext2,
|
|
35037
35088
|
getSkillsDirectory: () => getSkillsDirectory,
|
|
35089
|
+
getSkillSources: () => getSkillSources,
|
|
35038
35090
|
getNoSkills: () => getNoSkills,
|
|
35039
35091
|
getCurrentAgentId: () => getCurrentAgentId,
|
|
35040
35092
|
getConversationId: () => getConversationId
|
|
@@ -35045,16 +35097,16 @@ function getContext2() {
|
|
|
35045
35097
|
global2[CONTEXT_KEY2] = {
|
|
35046
35098
|
agentId: null,
|
|
35047
35099
|
skillsDirectory: null,
|
|
35048
|
-
|
|
35100
|
+
skillSources: [...ALL_SKILL_SOURCES],
|
|
35049
35101
|
conversationId: null
|
|
35050
35102
|
};
|
|
35051
35103
|
}
|
|
35052
35104
|
return global2[CONTEXT_KEY2];
|
|
35053
35105
|
}
|
|
35054
|
-
function setAgentContext2(agentId, skillsDirectory,
|
|
35106
|
+
function setAgentContext2(agentId, skillsDirectory, skillSources) {
|
|
35055
35107
|
context2.agentId = agentId;
|
|
35056
35108
|
context2.skillsDirectory = skillsDirectory || null;
|
|
35057
|
-
context2.
|
|
35109
|
+
context2.skillSources = skillSources !== undefined ? [...skillSources] : [...ALL_SKILL_SOURCES];
|
|
35058
35110
|
}
|
|
35059
35111
|
function setCurrentAgentId(agentId) {
|
|
35060
35112
|
context2.agentId = agentId;
|
|
@@ -35068,8 +35120,11 @@ function getCurrentAgentId() {
|
|
|
35068
35120
|
function getSkillsDirectory() {
|
|
35069
35121
|
return context2.skillsDirectory;
|
|
35070
35122
|
}
|
|
35123
|
+
function getSkillSources() {
|
|
35124
|
+
return [...context2.skillSources];
|
|
35125
|
+
}
|
|
35071
35126
|
function getNoSkills() {
|
|
35072
|
-
return context2.
|
|
35127
|
+
return !context2.skillSources.includes("bundled");
|
|
35073
35128
|
}
|
|
35074
35129
|
function setConversationId2(conversationId) {
|
|
35075
35130
|
context2.conversationId = conversationId;
|
|
@@ -35079,6 +35134,7 @@ function getConversationId() {
|
|
|
35079
35134
|
}
|
|
35080
35135
|
var CONTEXT_KEY2, context2;
|
|
35081
35136
|
var init_context = __esm(() => {
|
|
35137
|
+
init_skillSources();
|
|
35082
35138
|
CONTEXT_KEY2 = Symbol.for("@letta/agentContext");
|
|
35083
35139
|
context2 = getContext2();
|
|
35084
35140
|
});
|
|
@@ -55308,18 +55364,22 @@ async function discoverSkillsFromDir(skillsPath, source) {
|
|
|
55308
55364
|
async function discoverSkills(projectSkillsPath = join15(process.cwd(), SKILLS_DIR), agentId, options) {
|
|
55309
55365
|
const allErrors = [];
|
|
55310
55366
|
const skillsById = new Map;
|
|
55311
|
-
|
|
55367
|
+
const sourceSet = new Set(options?.sources ?? ALL_SKILL_SOURCES);
|
|
55368
|
+
const includeSource = (source) => sourceSet.has(source);
|
|
55369
|
+
if (includeSource("bundled") && !options?.skipBundled) {
|
|
55312
55370
|
const bundledSkills = await getBundledSkills();
|
|
55313
55371
|
for (const skill of bundledSkills) {
|
|
55314
55372
|
skillsById.set(skill.id, skill);
|
|
55315
55373
|
}
|
|
55316
55374
|
}
|
|
55317
|
-
|
|
55318
|
-
|
|
55319
|
-
|
|
55320
|
-
|
|
55375
|
+
if (includeSource("global")) {
|
|
55376
|
+
const globalResult = await discoverSkillsFromDir(GLOBAL_SKILLS_DIR, "global");
|
|
55377
|
+
allErrors.push(...globalResult.errors);
|
|
55378
|
+
for (const skill of globalResult.skills) {
|
|
55379
|
+
skillsById.set(skill.id, skill);
|
|
55380
|
+
}
|
|
55321
55381
|
}
|
|
55322
|
-
if (agentId) {
|
|
55382
|
+
if (agentId && includeSource("agent")) {
|
|
55323
55383
|
const agentSkillsDir = getAgentSkillsDir(agentId);
|
|
55324
55384
|
const agentResult = await discoverSkillsFromDir(agentSkillsDir, "agent");
|
|
55325
55385
|
allErrors.push(...agentResult.errors);
|
|
@@ -55327,10 +55387,12 @@ async function discoverSkills(projectSkillsPath = join15(process.cwd(), SKILLS_D
|
|
|
55327
55387
|
skillsById.set(skill.id, skill);
|
|
55328
55388
|
}
|
|
55329
55389
|
}
|
|
55330
|
-
|
|
55331
|
-
|
|
55332
|
-
|
|
55333
|
-
|
|
55390
|
+
if (includeSource("project")) {
|
|
55391
|
+
const projectResult = await discoverSkillsFromDir(projectSkillsPath, "project");
|
|
55392
|
+
allErrors.push(...projectResult.errors);
|
|
55393
|
+
for (const skill of projectResult.skills) {
|
|
55394
|
+
skillsById.set(skill.id, skill);
|
|
55395
|
+
}
|
|
55334
55396
|
}
|
|
55335
55397
|
return {
|
|
55336
55398
|
skills: Array.from(skillsById.values()),
|
|
@@ -55415,6 +55477,7 @@ ${lines.join(`
|
|
|
55415
55477
|
}
|
|
55416
55478
|
var SKILLS_DIR = ".skills", GLOBAL_SKILLS_DIR;
|
|
55417
55479
|
var init_skills = __esm(() => {
|
|
55480
|
+
init_skillSources();
|
|
55418
55481
|
GLOBAL_SKILLS_DIR = join15(process.env.HOME || process.env.USERPROFILE || "~", ".letta/skills");
|
|
55419
55482
|
});
|
|
55420
55483
|
|
|
@@ -61613,18 +61676,22 @@ async function discoverSkillsFromDir2(skillsPath, source) {
|
|
|
61613
61676
|
async function discoverSkills2(projectSkillsPath = join18(process.cwd(), SKILLS_DIR2), agentId, options) {
|
|
61614
61677
|
const allErrors = [];
|
|
61615
61678
|
const skillsById = new Map;
|
|
61616
|
-
|
|
61679
|
+
const sourceSet = new Set(options?.sources ?? ALL_SKILL_SOURCES);
|
|
61680
|
+
const includeSource = (source) => sourceSet.has(source);
|
|
61681
|
+
if (includeSource("bundled") && !options?.skipBundled) {
|
|
61617
61682
|
const bundledSkills = await getBundledSkills2();
|
|
61618
61683
|
for (const skill2 of bundledSkills) {
|
|
61619
61684
|
skillsById.set(skill2.id, skill2);
|
|
61620
61685
|
}
|
|
61621
61686
|
}
|
|
61622
|
-
|
|
61623
|
-
|
|
61624
|
-
|
|
61625
|
-
|
|
61687
|
+
if (includeSource("global")) {
|
|
61688
|
+
const globalResult = await discoverSkillsFromDir2(GLOBAL_SKILLS_DIR2, "global");
|
|
61689
|
+
allErrors.push(...globalResult.errors);
|
|
61690
|
+
for (const skill2 of globalResult.skills) {
|
|
61691
|
+
skillsById.set(skill2.id, skill2);
|
|
61692
|
+
}
|
|
61626
61693
|
}
|
|
61627
|
-
if (agentId) {
|
|
61694
|
+
if (agentId && includeSource("agent")) {
|
|
61628
61695
|
const agentSkillsDir = getAgentSkillsDir2(agentId);
|
|
61629
61696
|
const agentResult = await discoverSkillsFromDir2(agentSkillsDir, "agent");
|
|
61630
61697
|
allErrors.push(...agentResult.errors);
|
|
@@ -61632,10 +61699,12 @@ async function discoverSkills2(projectSkillsPath = join18(process.cwd(), SKILLS_
|
|
|
61632
61699
|
skillsById.set(skill2.id, skill2);
|
|
61633
61700
|
}
|
|
61634
61701
|
}
|
|
61635
|
-
|
|
61636
|
-
|
|
61637
|
-
|
|
61638
|
-
|
|
61702
|
+
if (includeSource("project")) {
|
|
61703
|
+
const projectResult = await discoverSkillsFromDir2(projectSkillsPath, "project");
|
|
61704
|
+
allErrors.push(...projectResult.errors);
|
|
61705
|
+
for (const skill2 of projectResult.skills) {
|
|
61706
|
+
skillsById.set(skill2.id, skill2);
|
|
61707
|
+
}
|
|
61639
61708
|
}
|
|
61640
61709
|
return {
|
|
61641
61710
|
skills: Array.from(skillsById.values()),
|
|
@@ -61720,6 +61789,7 @@ ${lines.join(`
|
|
|
61720
61789
|
}
|
|
61721
61790
|
var SKILLS_DIR2 = ".skills", GLOBAL_SKILLS_DIR2;
|
|
61722
61791
|
var init_skills2 = __esm(() => {
|
|
61792
|
+
init_skillSources();
|
|
61723
61793
|
GLOBAL_SKILLS_DIR2 = join18(process.env.HOME || process.env.USERPROFILE || "~", ".letta/skills");
|
|
61724
61794
|
});
|
|
61725
61795
|
|
|
@@ -65824,6 +65894,157 @@ var init_errorFormatter = __esm(() => {
|
|
|
65824
65894
|
`);
|
|
65825
65895
|
});
|
|
65826
65896
|
|
|
65897
|
+
// src/cli/helpers/memoryReminder.ts
|
|
65898
|
+
function isValidStepCount(value) {
|
|
65899
|
+
return typeof value === "number" && Number.isFinite(value) && Number.isInteger(value) && value > 0;
|
|
65900
|
+
}
|
|
65901
|
+
function normalizeStepCount(value, fallback) {
|
|
65902
|
+
return isValidStepCount(value) ? value : fallback;
|
|
65903
|
+
}
|
|
65904
|
+
function normalizeTrigger(value, fallback) {
|
|
65905
|
+
if (value === "off" || value === "step-count" || value === "compaction-event") {
|
|
65906
|
+
return value;
|
|
65907
|
+
}
|
|
65908
|
+
return fallback;
|
|
65909
|
+
}
|
|
65910
|
+
function normalizeBehavior(value, fallback) {
|
|
65911
|
+
if (value === "reminder" || value === "auto-launch") {
|
|
65912
|
+
return value;
|
|
65913
|
+
}
|
|
65914
|
+
return fallback;
|
|
65915
|
+
}
|
|
65916
|
+
function applyExplicitReflectionOverrides(base2, raw) {
|
|
65917
|
+
return {
|
|
65918
|
+
trigger: normalizeTrigger(raw.reflectionTrigger, base2.trigger),
|
|
65919
|
+
behavior: normalizeBehavior(raw.reflectionBehavior, base2.behavior),
|
|
65920
|
+
stepCount: normalizeStepCount(raw.reflectionStepCount, base2.stepCount)
|
|
65921
|
+
};
|
|
65922
|
+
}
|
|
65923
|
+
function legacyModeToReflectionSettings(mode) {
|
|
65924
|
+
if (typeof mode === "number") {
|
|
65925
|
+
return {
|
|
65926
|
+
trigger: "step-count",
|
|
65927
|
+
behavior: "reminder",
|
|
65928
|
+
stepCount: normalizeStepCount(mode, DEFAULT_STEP_COUNT)
|
|
65929
|
+
};
|
|
65930
|
+
}
|
|
65931
|
+
if (mode === null) {
|
|
65932
|
+
return {
|
|
65933
|
+
trigger: "off",
|
|
65934
|
+
behavior: DEFAULT_REFLECTION_SETTINGS.behavior,
|
|
65935
|
+
stepCount: DEFAULT_REFLECTION_SETTINGS.stepCount
|
|
65936
|
+
};
|
|
65937
|
+
}
|
|
65938
|
+
if (mode === "compaction") {
|
|
65939
|
+
return {
|
|
65940
|
+
trigger: "compaction-event",
|
|
65941
|
+
behavior: "reminder",
|
|
65942
|
+
stepCount: DEFAULT_REFLECTION_SETTINGS.stepCount
|
|
65943
|
+
};
|
|
65944
|
+
}
|
|
65945
|
+
if (mode === "auto-compaction") {
|
|
65946
|
+
return {
|
|
65947
|
+
trigger: "compaction-event",
|
|
65948
|
+
behavior: "auto-launch",
|
|
65949
|
+
stepCount: DEFAULT_REFLECTION_SETTINGS.stepCount
|
|
65950
|
+
};
|
|
65951
|
+
}
|
|
65952
|
+
return { ...DEFAULT_REFLECTION_SETTINGS };
|
|
65953
|
+
}
|
|
65954
|
+
function reflectionSettingsToLegacyMode(settings) {
|
|
65955
|
+
if (settings.trigger === "off") {
|
|
65956
|
+
return null;
|
|
65957
|
+
}
|
|
65958
|
+
if (settings.trigger === "compaction-event") {
|
|
65959
|
+
return settings.behavior === "auto-launch" ? "auto-compaction" : "compaction";
|
|
65960
|
+
}
|
|
65961
|
+
return normalizeStepCount(settings.stepCount, DEFAULT_STEP_COUNT);
|
|
65962
|
+
}
|
|
65963
|
+
function getReflectionSettings() {
|
|
65964
|
+
const globalSettings = settingsManager.getSettings();
|
|
65965
|
+
let resolved = legacyModeToReflectionSettings(globalSettings.memoryReminderInterval);
|
|
65966
|
+
resolved = applyExplicitReflectionOverrides(resolved, globalSettings);
|
|
65967
|
+
try {
|
|
65968
|
+
const localSettings = settingsManager.getLocalProjectSettings();
|
|
65969
|
+
if (localSettings.memoryReminderInterval !== undefined) {
|
|
65970
|
+
resolved = legacyModeToReflectionSettings(localSettings.memoryReminderInterval);
|
|
65971
|
+
}
|
|
65972
|
+
resolved = applyExplicitReflectionOverrides(resolved, localSettings);
|
|
65973
|
+
} catch {}
|
|
65974
|
+
return resolved;
|
|
65975
|
+
}
|
|
65976
|
+
function shouldFireStepCountTrigger(turnCount, settings = getReflectionSettings()) {
|
|
65977
|
+
if (settings.trigger !== "step-count") {
|
|
65978
|
+
return false;
|
|
65979
|
+
}
|
|
65980
|
+
const stepCount = normalizeStepCount(settings.stepCount, DEFAULT_STEP_COUNT);
|
|
65981
|
+
return turnCount > 0 && turnCount % stepCount === 0;
|
|
65982
|
+
}
|
|
65983
|
+
async function buildMemfsAwareMemoryReminder(agentId, trigger) {
|
|
65984
|
+
if (settingsManager.isMemfsEnabled(agentId)) {
|
|
65985
|
+
debugLog("memory", `Reflection reminder fired (${trigger}, agent ${agentId})`);
|
|
65986
|
+
const { MEMORY_REFLECTION_REMINDER: MEMORY_REFLECTION_REMINDER3 } = await Promise.resolve().then(() => (init_promptAssets(), exports_promptAssets));
|
|
65987
|
+
return MEMORY_REFLECTION_REMINDER3;
|
|
65988
|
+
}
|
|
65989
|
+
debugLog("memory", `Memory check reminder fired (${trigger}, agent ${agentId})`);
|
|
65990
|
+
const { MEMORY_CHECK_REMINDER: MEMORY_CHECK_REMINDER3 } = await Promise.resolve().then(() => (init_promptAssets(), exports_promptAssets));
|
|
65991
|
+
return MEMORY_CHECK_REMINDER3;
|
|
65992
|
+
}
|
|
65993
|
+
async function buildCompactionMemoryReminder(agentId) {
|
|
65994
|
+
return buildMemfsAwareMemoryReminder(agentId, "compaction");
|
|
65995
|
+
}
|
|
65996
|
+
async function buildMemoryReminder(turnCount, agentId) {
|
|
65997
|
+
const reflectionSettings = getReflectionSettings();
|
|
65998
|
+
if (reflectionSettings.trigger !== "step-count") {
|
|
65999
|
+
return "";
|
|
66000
|
+
}
|
|
66001
|
+
if (shouldFireStepCountTrigger(turnCount, reflectionSettings)) {
|
|
66002
|
+
debugLog("memory", `Turn-based memory reminder fired (turn ${turnCount}, interval ${reflectionSettings.stepCount}, agent ${agentId})`);
|
|
66003
|
+
return buildMemfsAwareMemoryReminder(agentId, "interval");
|
|
66004
|
+
}
|
|
66005
|
+
return "";
|
|
66006
|
+
}
|
|
66007
|
+
function parseMemoryPreference(questions, answers) {
|
|
66008
|
+
for (const q of questions) {
|
|
66009
|
+
if (!q.question)
|
|
66010
|
+
continue;
|
|
66011
|
+
const questionLower = q.question.toLowerCase();
|
|
66012
|
+
const headerLower = q.header?.toLowerCase() || "";
|
|
66013
|
+
if (questionLower.includes("memory") || questionLower.includes("remember") || headerLower.includes("memory")) {
|
|
66014
|
+
const answer = answers[q.question]?.toLowerCase() || "";
|
|
66015
|
+
if (answer.includes("frequent")) {
|
|
66016
|
+
settingsManager.updateLocalProjectSettings({
|
|
66017
|
+
memoryReminderInterval: MEMORY_INTERVAL_FREQUENT,
|
|
66018
|
+
reflectionTrigger: "step-count",
|
|
66019
|
+
reflectionBehavior: "reminder",
|
|
66020
|
+
reflectionStepCount: MEMORY_INTERVAL_FREQUENT
|
|
66021
|
+
});
|
|
66022
|
+
return true;
|
|
66023
|
+
} else if (answer.includes("occasional")) {
|
|
66024
|
+
settingsManager.updateLocalProjectSettings({
|
|
66025
|
+
memoryReminderInterval: MEMORY_INTERVAL_OCCASIONAL,
|
|
66026
|
+
reflectionTrigger: "step-count",
|
|
66027
|
+
reflectionBehavior: "reminder",
|
|
66028
|
+
reflectionStepCount: MEMORY_INTERVAL_OCCASIONAL
|
|
66029
|
+
});
|
|
66030
|
+
return true;
|
|
66031
|
+
}
|
|
66032
|
+
break;
|
|
66033
|
+
}
|
|
66034
|
+
}
|
|
66035
|
+
return false;
|
|
66036
|
+
}
|
|
66037
|
+
var MEMORY_INTERVAL_FREQUENT = 5, MEMORY_INTERVAL_OCCASIONAL = 10, DEFAULT_STEP_COUNT = 25, DEFAULT_REFLECTION_SETTINGS;
|
|
66038
|
+
var init_memoryReminder = __esm(async () => {
|
|
66039
|
+
init_debug();
|
|
66040
|
+
await init_settings_manager();
|
|
66041
|
+
DEFAULT_REFLECTION_SETTINGS = {
|
|
66042
|
+
trigger: "compaction-event",
|
|
66043
|
+
behavior: "reminder",
|
|
66044
|
+
stepCount: DEFAULT_STEP_COUNT
|
|
66045
|
+
};
|
|
66046
|
+
});
|
|
66047
|
+
|
|
65827
66048
|
// src/cli/helpers/streamProcessor.ts
|
|
65828
66049
|
class StreamProcessor {
|
|
65829
66050
|
pendingApprovals = new Map;
|
|
@@ -66551,7 +66772,76 @@ ${content}`;
|
|
|
66551
66772
|
function shouldReinjectSkillsAfterCompaction(lines) {
|
|
66552
66773
|
return lines.some((line) => line.kind === "event" && line.eventType === "compaction" && line.phase === "finished" && (line.summary !== undefined || line.stats !== undefined));
|
|
66553
66774
|
}
|
|
66554
|
-
|
|
66775
|
+
function parseReflectionOverrides(values) {
|
|
66776
|
+
const triggerRaw = values["reflection-trigger"];
|
|
66777
|
+
const behaviorRaw = values["reflection-behavior"];
|
|
66778
|
+
const stepCountRaw = values["reflection-step-count"];
|
|
66779
|
+
if (!triggerRaw && !behaviorRaw && !stepCountRaw) {
|
|
66780
|
+
return {};
|
|
66781
|
+
}
|
|
66782
|
+
const overrides = {};
|
|
66783
|
+
if (triggerRaw !== undefined) {
|
|
66784
|
+
if (triggerRaw !== "off" && triggerRaw !== "step-count" && triggerRaw !== "compaction-event") {
|
|
66785
|
+
throw new Error(`Invalid --reflection-trigger "${triggerRaw}". Valid values: off, step-count, compaction-event`);
|
|
66786
|
+
}
|
|
66787
|
+
overrides.trigger = triggerRaw;
|
|
66788
|
+
}
|
|
66789
|
+
if (behaviorRaw !== undefined) {
|
|
66790
|
+
if (behaviorRaw !== "reminder" && behaviorRaw !== "auto-launch") {
|
|
66791
|
+
throw new Error(`Invalid --reflection-behavior "${behaviorRaw}". Valid values: reminder, auto-launch`);
|
|
66792
|
+
}
|
|
66793
|
+
overrides.behavior = behaviorRaw;
|
|
66794
|
+
}
|
|
66795
|
+
if (stepCountRaw !== undefined) {
|
|
66796
|
+
const parsed = Number.parseInt(stepCountRaw, 10);
|
|
66797
|
+
if (Number.isNaN(parsed) || parsed <= 0) {
|
|
66798
|
+
throw new Error(`Invalid --reflection-step-count "${stepCountRaw}". Expected a positive integer.`);
|
|
66799
|
+
}
|
|
66800
|
+
overrides.stepCount = parsed;
|
|
66801
|
+
}
|
|
66802
|
+
return overrides;
|
|
66803
|
+
}
|
|
66804
|
+
function hasReflectionOverrides(overrides) {
|
|
66805
|
+
return overrides.trigger !== undefined || overrides.behavior !== undefined || overrides.stepCount !== undefined;
|
|
66806
|
+
}
|
|
66807
|
+
async function applyReflectionOverrides(agentId, overrides) {
|
|
66808
|
+
const current = getReflectionSettings();
|
|
66809
|
+
const merged = {
|
|
66810
|
+
trigger: overrides.trigger ?? current.trigger,
|
|
66811
|
+
behavior: overrides.behavior ?? current.behavior,
|
|
66812
|
+
stepCount: overrides.stepCount ?? current.stepCount
|
|
66813
|
+
};
|
|
66814
|
+
if (!hasReflectionOverrides(overrides)) {
|
|
66815
|
+
return merged;
|
|
66816
|
+
}
|
|
66817
|
+
const memfsEnabled = settingsManager.isMemfsEnabled(agentId);
|
|
66818
|
+
if (!memfsEnabled && merged.trigger === "compaction-event") {
|
|
66819
|
+
throw new Error("--reflection-trigger compaction-event requires memfs enabled for this agent.");
|
|
66820
|
+
}
|
|
66821
|
+
if (!memfsEnabled && merged.trigger !== "off" && merged.behavior === "auto-launch") {
|
|
66822
|
+
throw new Error("--reflection-behavior auto-launch requires memfs enabled for this agent.");
|
|
66823
|
+
}
|
|
66824
|
+
try {
|
|
66825
|
+
settingsManager.getLocalProjectSettings();
|
|
66826
|
+
} catch {
|
|
66827
|
+
await settingsManager.loadLocalProjectSettings();
|
|
66828
|
+
}
|
|
66829
|
+
const legacyMode = reflectionSettingsToLegacyMode(merged);
|
|
66830
|
+
settingsManager.updateLocalProjectSettings({
|
|
66831
|
+
memoryReminderInterval: legacyMode,
|
|
66832
|
+
reflectionTrigger: merged.trigger,
|
|
66833
|
+
reflectionBehavior: merged.behavior,
|
|
66834
|
+
reflectionStepCount: merged.stepCount
|
|
66835
|
+
});
|
|
66836
|
+
settingsManager.updateSettings({
|
|
66837
|
+
memoryReminderInterval: legacyMode,
|
|
66838
|
+
reflectionTrigger: merged.trigger,
|
|
66839
|
+
reflectionBehavior: merged.behavior,
|
|
66840
|
+
reflectionStepCount: merged.stepCount
|
|
66841
|
+
});
|
|
66842
|
+
return merged;
|
|
66843
|
+
}
|
|
66844
|
+
async function handleHeadlessCommand(argv, model, skillsDirectoryOverride, skillSourcesOverride, systemInfoReminderEnabledOverride) {
|
|
66555
66845
|
const { values, positionals } = parseArgs5({
|
|
66556
66846
|
args: argv,
|
|
66557
66847
|
options: {
|
|
@@ -66584,6 +66874,7 @@ async function handleHeadlessCommand(argv, model, skillsDirectory, noSkills) {
|
|
|
66584
66874
|
"permission-mode": { type: "string" },
|
|
66585
66875
|
yolo: { type: "boolean" },
|
|
66586
66876
|
skills: { type: "string" },
|
|
66877
|
+
"skill-sources": { type: "string" },
|
|
66587
66878
|
"pre-load-skills": { type: "string" },
|
|
66588
66879
|
"init-blocks": { type: "string" },
|
|
66589
66880
|
"base-tools": { type: "string" },
|
|
@@ -66592,6 +66883,11 @@ async function handleHeadlessCommand(argv, model, skillsDirectory, noSkills) {
|
|
|
66592
66883
|
memfs: { type: "boolean" },
|
|
66593
66884
|
"no-memfs": { type: "boolean" },
|
|
66594
66885
|
"no-skills": { type: "boolean" },
|
|
66886
|
+
"no-bundled-skills": { type: "boolean" },
|
|
66887
|
+
"no-system-info-reminder": { type: "boolean" },
|
|
66888
|
+
"reflection-trigger": { type: "string" },
|
|
66889
|
+
"reflection-behavior": { type: "string" },
|
|
66890
|
+
"reflection-step-count": { type: "string" },
|
|
66595
66891
|
"max-turns": { type: "string" }
|
|
66596
66892
|
},
|
|
66597
66893
|
strict: false,
|
|
@@ -66683,14 +66979,42 @@ In headless mode, use:
|
|
|
66683
66979
|
const blockValueArgs = values["block-value"];
|
|
66684
66980
|
const initBlocksRaw = values["init-blocks"];
|
|
66685
66981
|
const baseToolsRaw = values["base-tools"];
|
|
66982
|
+
const skillsDirectory = values.skills ?? skillsDirectoryOverride;
|
|
66983
|
+
const noSkillsFlag = values["no-skills"];
|
|
66984
|
+
const noBundledSkillsFlag = values["no-bundled-skills"];
|
|
66985
|
+
const skillSourcesRaw = values["skill-sources"];
|
|
66686
66986
|
const memfsFlag = values.memfs;
|
|
66687
66987
|
const noMemfsFlag = values["no-memfs"];
|
|
66688
66988
|
const requestedMemoryPromptMode = memfsFlag ? "memfs" : noMemfsFlag ? "standard" : undefined;
|
|
66689
66989
|
const shouldAutoEnableMemfsForNewAgent = !memfsFlag && !noMemfsFlag;
|
|
66690
66990
|
const fromAfFile = values["from-af"];
|
|
66691
66991
|
const preLoadSkillsRaw = values["pre-load-skills"];
|
|
66992
|
+
const systemInfoReminderEnabled = systemInfoReminderEnabledOverride ?? !values["no-system-info-reminder"];
|
|
66993
|
+
const reflectionOverrides = (() => {
|
|
66994
|
+
try {
|
|
66995
|
+
return parseReflectionOverrides(values);
|
|
66996
|
+
} catch (error) {
|
|
66997
|
+
console.error(error instanceof Error ? `Error: ${error.message}` : String(error));
|
|
66998
|
+
process.exit(1);
|
|
66999
|
+
}
|
|
67000
|
+
})();
|
|
66692
67001
|
const maxTurnsRaw = values["max-turns"];
|
|
66693
67002
|
const tagsRaw = values.tags;
|
|
67003
|
+
const resolvedSkillSources = (() => {
|
|
67004
|
+
if (skillSourcesOverride) {
|
|
67005
|
+
return skillSourcesOverride;
|
|
67006
|
+
}
|
|
67007
|
+
try {
|
|
67008
|
+
return resolveSkillSourcesSelection({
|
|
67009
|
+
skillSourcesRaw,
|
|
67010
|
+
noSkills: noSkillsFlag,
|
|
67011
|
+
noBundledSkills: noBundledSkillsFlag
|
|
67012
|
+
});
|
|
67013
|
+
} catch (error) {
|
|
67014
|
+
console.error(error instanceof Error ? `Error: ${error.message}` : String(error));
|
|
67015
|
+
process.exit(1);
|
|
67016
|
+
}
|
|
67017
|
+
})();
|
|
66694
67018
|
let tags;
|
|
66695
67019
|
if (tagsRaw !== undefined) {
|
|
66696
67020
|
const trimmed = tagsRaw.trim();
|
|
@@ -66709,6 +67033,10 @@ In headless mode, use:
|
|
|
66709
67033
|
}
|
|
66710
67034
|
maxTurns = parsed;
|
|
66711
67035
|
}
|
|
67036
|
+
if (preLoadSkillsRaw && resolvedSkillSources.length === 0) {
|
|
67037
|
+
console.error("Error: --pre-load-skills cannot be used when all skill sources are disabled.");
|
|
67038
|
+
process.exit(1);
|
|
67039
|
+
}
|
|
66712
67040
|
if (specifiedConversationId?.startsWith("agent-")) {
|
|
66713
67041
|
if (specifiedAgentId && specifiedAgentId !== specifiedConversationId) {
|
|
66714
67042
|
console.error(`Error: Conflicting agent IDs: --agent ${specifiedAgentId} vs --conv ${specifiedConversationId}`);
|
|
@@ -66995,6 +67323,7 @@ In headless mode, use:
|
|
|
66995
67323
|
}
|
|
66996
67324
|
}
|
|
66997
67325
|
let conversationId;
|
|
67326
|
+
let effectiveReflectionSettings;
|
|
66998
67327
|
const isSubagent = process.env.LETTA_CODE_AGENT_ROLE === "subagent";
|
|
66999
67328
|
try {
|
|
67000
67329
|
const { applyMemfsFlags: applyMemfsFlags2 } = await Promise.resolve().then(() => (init_memoryFilesystem(), exports_memoryFilesystem));
|
|
@@ -67007,6 +67336,12 @@ In headless mode, use:
|
|
|
67007
67336
|
console.error(`Memory git sync failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
67008
67337
|
process.exit(1);
|
|
67009
67338
|
}
|
|
67339
|
+
try {
|
|
67340
|
+
effectiveReflectionSettings = await applyReflectionOverrides(agent.id, reflectionOverrides);
|
|
67341
|
+
} catch (error) {
|
|
67342
|
+
console.error(`Failed to apply sleeptime settings: ${error instanceof Error ? error.message : String(error)}`);
|
|
67343
|
+
process.exit(1);
|
|
67344
|
+
}
|
|
67010
67345
|
const isolatedBlockLabels = initBlocks === undefined ? [...ISOLATED_BLOCK_LABELS] : ISOLATED_BLOCK_LABELS.filter((label) => initBlocks.includes(label));
|
|
67011
67346
|
if (specifiedConversationId) {
|
|
67012
67347
|
if (specifiedConversationId === "default") {
|
|
@@ -67084,7 +67419,7 @@ In headless mode, use:
|
|
|
67084
67419
|
}
|
|
67085
67420
|
} catch {}
|
|
67086
67421
|
}
|
|
67087
|
-
setAgentContext2(agent.id, skillsDirectory,
|
|
67422
|
+
setAgentContext2(agent.id, skillsDirectory, resolvedSkillSources);
|
|
67088
67423
|
const outputFormat = values["output-format"] || "text";
|
|
67089
67424
|
const includePartialMessages = Boolean(values["include-partial-messages"]);
|
|
67090
67425
|
if (!["text", "json", "stream-json"].includes(outputFormat)) {
|
|
@@ -67099,7 +67434,7 @@ In headless mode, use:
|
|
|
67099
67434
|
const loadedToolNames = getClientToolsFromRegistry2().map((t) => t.name);
|
|
67100
67435
|
const availableTools = loadedToolNames.length > 0 ? loadedToolNames : agent.tools?.map((t) => t.name).filter((n) => !!n) || [];
|
|
67101
67436
|
if (isBidirectionalMode) {
|
|
67102
|
-
await runBidirectionalMode(agent, conversationId, client, outputFormat, includePartialMessages, availableTools);
|
|
67437
|
+
await runBidirectionalMode(agent, conversationId, client, outputFormat, includePartialMessages, availableTools, resolvedSkillSources, systemInfoReminderEnabled, effectiveReflectionSettings);
|
|
67103
67438
|
return;
|
|
67104
67439
|
}
|
|
67105
67440
|
const buffers = createBuffers(agent.id);
|
|
@@ -67119,6 +67454,11 @@ In headless mode, use:
|
|
|
67119
67454
|
permission_mode: "",
|
|
67120
67455
|
slash_commands: [],
|
|
67121
67456
|
memfs_enabled: settingsManager.isMemfsEnabled(agent.id),
|
|
67457
|
+
skill_sources: resolvedSkillSources,
|
|
67458
|
+
system_info_reminder_enabled: systemInfoReminderEnabled,
|
|
67459
|
+
reflection_trigger: effectiveReflectionSettings.trigger,
|
|
67460
|
+
reflection_behavior: effectiveReflectionSettings.behavior,
|
|
67461
|
+
reflection_step_count: effectiveReflectionSettings.stepCount,
|
|
67122
67462
|
uuid: `init-${agent.id}`
|
|
67123
67463
|
};
|
|
67124
67464
|
console.log(JSON.stringify(initEvent));
|
|
@@ -67242,7 +67582,7 @@ ${SYSTEM_REMINDER_CLOSE}
|
|
|
67242
67582
|
try {
|
|
67243
67583
|
const skillsDir = getSkillsDirectory2() || join22(process.cwd(), defaultDir);
|
|
67244
67584
|
const { skills } = await discoverSkills3(skillsDir, agent.id, {
|
|
67245
|
-
|
|
67585
|
+
sources: resolvedSkillSources
|
|
67246
67586
|
});
|
|
67247
67587
|
const skillsReminder = formatSkillsAsSystemReminder3(skills);
|
|
67248
67588
|
if (skillsReminder) {
|
|
@@ -67806,7 +68146,7 @@ ${loadedContents.join(`
|
|
|
67806
68146
|
markMilestone("HEADLESS_COMPLETE");
|
|
67807
68147
|
reportAllMilestones();
|
|
67808
68148
|
}
|
|
67809
|
-
async function runBidirectionalMode(agent, conversationId, client, _outputFormat, includePartialMessages, availableTools) {
|
|
68149
|
+
async function runBidirectionalMode(agent, conversationId, client, _outputFormat, includePartialMessages, availableTools, skillSources, systemInfoReminderEnabled, reflectionSettings) {
|
|
67810
68150
|
const sessionId = agent.id;
|
|
67811
68151
|
const readline = await import("node:readline");
|
|
67812
68152
|
const initEvent = {
|
|
@@ -67819,6 +68159,11 @@ async function runBidirectionalMode(agent, conversationId, client, _outputFormat
|
|
|
67819
68159
|
tools: availableTools,
|
|
67820
68160
|
cwd: process.cwd(),
|
|
67821
68161
|
memfs_enabled: settingsManager.isMemfsEnabled(agent.id),
|
|
68162
|
+
skill_sources: skillSources,
|
|
68163
|
+
system_info_reminder_enabled: systemInfoReminderEnabled,
|
|
68164
|
+
reflection_trigger: reflectionSettings.trigger,
|
|
68165
|
+
reflection_behavior: reflectionSettings.behavior,
|
|
68166
|
+
reflection_step_count: reflectionSettings.stepCount,
|
|
67822
68167
|
uuid: `init-${agent.id}`
|
|
67823
68168
|
};
|
|
67824
68169
|
console.log(JSON.stringify(initEvent));
|
|
@@ -68007,7 +68352,13 @@ async function runBidirectionalMode(agent, conversationId, client, _outputFormat
|
|
|
68007
68352
|
response: {
|
|
68008
68353
|
agent_id: agent.id,
|
|
68009
68354
|
model: agent.llm_config?.model,
|
|
68010
|
-
tools: availableTools
|
|
68355
|
+
tools: availableTools,
|
|
68356
|
+
memfs_enabled: settingsManager.isMemfsEnabled(agent.id),
|
|
68357
|
+
skill_sources: skillSources,
|
|
68358
|
+
system_info_reminder_enabled: systemInfoReminderEnabled,
|
|
68359
|
+
reflection_trigger: reflectionSettings.trigger,
|
|
68360
|
+
reflection_behavior: reflectionSettings.behavior,
|
|
68361
|
+
reflection_step_count: reflectionSettings.stepCount
|
|
68011
68362
|
}
|
|
68012
68363
|
},
|
|
68013
68364
|
session_id: sessionId,
|
|
@@ -68112,7 +68463,9 @@ async function runBidirectionalMode(agent, conversationId, client, _outputFormat
|
|
|
68112
68463
|
const { getSkillsDirectory: getSkillsDirectory2 } = await Promise.resolve().then(() => (init_context(), exports_context));
|
|
68113
68464
|
const { join: join22 } = await import("node:path");
|
|
68114
68465
|
const skillsDir = getSkillsDirectory2() || join22(process.cwd(), defaultDir);
|
|
68115
|
-
const { skills } = await discover(skillsDir, agent.id
|
|
68466
|
+
const { skills } = await discover(skillsDir, agent.id, {
|
|
68467
|
+
sources: skillSources
|
|
68468
|
+
});
|
|
68116
68469
|
const latestSkillsReminder = formatSkillsAsSystemReminder3(skills);
|
|
68117
68470
|
if (cachedSkillsReminder !== null && latestSkillsReminder !== cachedSkillsReminder) {
|
|
68118
68471
|
pendingSkillsReinject = true;
|
|
@@ -68422,6 +68775,7 @@ var init_headless = __esm(async () => {
|
|
|
68422
68775
|
init_context();
|
|
68423
68776
|
init_memory();
|
|
68424
68777
|
init_model();
|
|
68778
|
+
init_skillSources();
|
|
68425
68779
|
init_errorFormatter();
|
|
68426
68780
|
init_constants();
|
|
68427
68781
|
init_interactivePolicy();
|
|
@@ -68433,6 +68787,7 @@ var init_headless = __esm(async () => {
|
|
|
68433
68787
|
init_message(),
|
|
68434
68788
|
init_accumulator(),
|
|
68435
68789
|
init_approvalClassification(),
|
|
68790
|
+
init_memoryReminder(),
|
|
68436
68791
|
init_stream(),
|
|
68437
68792
|
init_settings_manager(),
|
|
68438
68793
|
init_manager3()
|
|
@@ -88833,11 +89188,11 @@ function SkillsDialog({ onClose, agentId }) {
|
|
|
88833
89188
|
(async () => {
|
|
88834
89189
|
try {
|
|
88835
89190
|
const { discoverSkills: discoverSkills3, SKILLS_DIR: SKILLS_DIR3 } = await Promise.resolve().then(() => (init_skills(), exports_skills));
|
|
88836
|
-
const { getSkillsDirectory: getSkillsDirectory2,
|
|
89191
|
+
const { getSkillsDirectory: getSkillsDirectory2, getSkillSources: getSkillSources2 } = await Promise.resolve().then(() => (init_context(), exports_context));
|
|
88837
89192
|
const { join: join29 } = await import("node:path");
|
|
88838
89193
|
const skillsDir = getSkillsDirectory2() || join29(process.cwd(), SKILLS_DIR3);
|
|
88839
89194
|
const result = await discoverSkills3(skillsDir, agentId, {
|
|
88840
|
-
|
|
89195
|
+
sources: getSkillSources2()
|
|
88841
89196
|
});
|
|
88842
89197
|
setSkills(result.skills);
|
|
88843
89198
|
} catch {
|
|
@@ -89059,7 +89414,7 @@ function parseInitialState(initialSettings) {
|
|
|
89059
89414
|
return {
|
|
89060
89415
|
trigger: initialSettings.trigger === "off" || initialSettings.trigger === "step-count" || initialSettings.trigger === "compaction-event" ? initialSettings.trigger : "step-count",
|
|
89061
89416
|
behavior: initialSettings.behavior === "auto-launch" ? "auto-launch" : "reminder",
|
|
89062
|
-
stepCount: String(Number.isInteger(initialSettings.stepCount) && initialSettings.stepCount > 0 ? initialSettings.stepCount : Number(
|
|
89417
|
+
stepCount: String(Number.isInteger(initialSettings.stepCount) && initialSettings.stepCount > 0 ? initialSettings.stepCount : Number(DEFAULT_STEP_COUNT2))
|
|
89063
89418
|
};
|
|
89064
89419
|
}
|
|
89065
89420
|
function parseStepCount(raw) {
|
|
@@ -89121,7 +89476,7 @@ function SleeptimeSelector({
|
|
|
89121
89476
|
});
|
|
89122
89477
|
return;
|
|
89123
89478
|
}
|
|
89124
|
-
const fallbackStepCount = parseStepCount(stepCountInput) ?? Number(
|
|
89479
|
+
const fallbackStepCount = parseStepCount(stepCountInput) ?? Number(DEFAULT_STEP_COUNT2);
|
|
89125
89480
|
onSave({
|
|
89126
89481
|
trigger,
|
|
89127
89482
|
behavior: memfsEnabled ? behavior : "reminder",
|
|
@@ -89378,7 +89733,7 @@ function SleeptimeSelector({
|
|
|
89378
89733
|
]
|
|
89379
89734
|
}, undefined, true, undefined, this);
|
|
89380
89735
|
}
|
|
89381
|
-
var import_react81, jsx_dev_runtime58, SOLID_LINE23 = "─",
|
|
89736
|
+
var import_react81, jsx_dev_runtime58, SOLID_LINE23 = "─", DEFAULT_STEP_COUNT2 = "25", BEHAVIOR_OPTIONS;
|
|
89382
89737
|
var init_SleeptimeSelector = __esm(async () => {
|
|
89383
89738
|
init_useTerminalWidth();
|
|
89384
89739
|
init_colors();
|
|
@@ -92802,157 +93157,6 @@ var init_contextChart = __esm(() => {
|
|
|
92802
93157
|
].map(hexToFgAnsi);
|
|
92803
93158
|
});
|
|
92804
93159
|
|
|
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
93160
|
// src/cli/helpers/queuedMessageParts.ts
|
|
92957
93161
|
function getQueuedNotificationSummaries(queued) {
|
|
92958
93162
|
const summaries = [];
|
|
@@ -95452,7 +95656,8 @@ function App2({
|
|
|
95452
95656
|
tokenStreaming = false,
|
|
95453
95657
|
showCompactions = false,
|
|
95454
95658
|
agentProvenance = null,
|
|
95455
|
-
releaseNotes = null
|
|
95659
|
+
releaseNotes = null,
|
|
95660
|
+
sessionContextReminderEnabled = true
|
|
95456
95661
|
}) {
|
|
95457
95662
|
import_react94.useEffect(() => {
|
|
95458
95663
|
prefetchAvailableModelHandles();
|
|
@@ -99716,7 +99921,7 @@ ${SYSTEM_REMINDER_CLOSE}`)
|
|
|
99716
99921
|
}
|
|
99717
99922
|
let sessionContextReminder = "";
|
|
99718
99923
|
const sessionContextEnabled = settingsManager.getSetting("sessionContextEnabled");
|
|
99719
|
-
if (!hasSentSessionContextRef.current && sessionContextEnabled) {
|
|
99924
|
+
if (!hasSentSessionContextRef.current && sessionContextEnabled && sessionContextReminderEnabled) {
|
|
99720
99925
|
const { buildSessionContext: buildSessionContext2 } = await init_sessionContext().then(() => exports_sessionContext);
|
|
99721
99926
|
sessionContextReminder = buildSessionContext2({
|
|
99722
99927
|
agentInfo: {
|
|
@@ -99831,13 +100036,13 @@ ${SYSTEM_REMINDER_CLOSE}
|
|
|
99831
100036
|
SKILLS_DIR: defaultDir,
|
|
99832
100037
|
formatSkillsAsSystemReminder: formatSkillsAsSystemReminder3
|
|
99833
100038
|
} = await Promise.resolve().then(() => (init_skills(), exports_skills));
|
|
99834
|
-
const { getSkillsDirectory: getSkillsDirectory2,
|
|
100039
|
+
const { getSkillsDirectory: getSkillsDirectory2, getSkillSources: getSkillSources2 } = await Promise.resolve().then(() => (init_context(), exports_context));
|
|
99835
100040
|
const previousSkillsReminder = discoveredSkillsRef.current ? formatSkillsAsSystemReminder3(discoveredSkillsRef.current) : null;
|
|
99836
100041
|
let latestSkills = discoveredSkillsRef.current ?? [];
|
|
99837
100042
|
try {
|
|
99838
100043
|
const skillsDir = getSkillsDirectory2() || join30(process.cwd(), defaultDir);
|
|
99839
100044
|
const { skills } = await discover(skillsDir, agentId, {
|
|
99840
|
-
|
|
100045
|
+
sources: getSkillSources2()
|
|
99841
100046
|
});
|
|
99842
100047
|
latestSkills = skills;
|
|
99843
100048
|
} catch {}
|
|
@@ -100311,6 +100516,7 @@ ${SYSTEM_REMINDER_CLOSE}
|
|
|
100311
100516
|
pendingRalphConfig,
|
|
100312
100517
|
openTrajectorySegment,
|
|
100313
100518
|
resetTrajectoryBases,
|
|
100519
|
+
sessionContextReminderEnabled,
|
|
100314
100520
|
appendTaskNotificationEvents
|
|
100315
100521
|
]);
|
|
100316
100522
|
const onSubmitRef = import_react94.useRef(onSubmit);
|
|
@@ -104105,6 +104311,7 @@ async function getClient() {
|
|
|
104105
104311
|
}
|
|
104106
104312
|
|
|
104107
104313
|
// src/agent/context.ts
|
|
104314
|
+
init_skillSources();
|
|
104108
104315
|
var CONTEXT_KEY = Symbol.for("@letta/agentContext");
|
|
104109
104316
|
function getContext() {
|
|
104110
104317
|
const global2 = globalThis;
|
|
@@ -104112,17 +104319,17 @@ function getContext() {
|
|
|
104112
104319
|
global2[CONTEXT_KEY] = {
|
|
104113
104320
|
agentId: null,
|
|
104114
104321
|
skillsDirectory: null,
|
|
104115
|
-
|
|
104322
|
+
skillSources: [...ALL_SKILL_SOURCES],
|
|
104116
104323
|
conversationId: null
|
|
104117
104324
|
};
|
|
104118
104325
|
}
|
|
104119
104326
|
return global2[CONTEXT_KEY];
|
|
104120
104327
|
}
|
|
104121
104328
|
var context = getContext();
|
|
104122
|
-
function setAgentContext(agentId, skillsDirectory,
|
|
104329
|
+
function setAgentContext(agentId, skillsDirectory, skillSources) {
|
|
104123
104330
|
context.agentId = agentId;
|
|
104124
104331
|
context.skillsDirectory = skillsDirectory || null;
|
|
104125
|
-
context.
|
|
104332
|
+
context.skillSources = skillSources !== undefined ? [...skillSources] : [...ALL_SKILL_SOURCES];
|
|
104126
104333
|
}
|
|
104127
104334
|
function setConversationId(conversationId) {
|
|
104128
104335
|
context.conversationId = conversationId;
|
|
@@ -104150,6 +104357,54 @@ var MEMORY_BLOCK_LABELS2 = [
|
|
|
104150
104357
|
];
|
|
104151
104358
|
var ISOLATED_BLOCK_LABELS2 = [];
|
|
104152
104359
|
|
|
104360
|
+
// src/agent/skillSources.ts
|
|
104361
|
+
var ALL_SKILL_SOURCES2 = [
|
|
104362
|
+
"bundled",
|
|
104363
|
+
"global",
|
|
104364
|
+
"agent",
|
|
104365
|
+
"project"
|
|
104366
|
+
];
|
|
104367
|
+
var VALID_SKILL_SOURCE_SPECIFIERS2 = [
|
|
104368
|
+
"all",
|
|
104369
|
+
...ALL_SKILL_SOURCES2
|
|
104370
|
+
];
|
|
104371
|
+
function isSkillSource2(value) {
|
|
104372
|
+
return ALL_SKILL_SOURCES2.includes(value);
|
|
104373
|
+
}
|
|
104374
|
+
function normalizeSkillSources2(sources) {
|
|
104375
|
+
const sourceSet = new Set(sources);
|
|
104376
|
+
return ALL_SKILL_SOURCES2.filter((source) => sourceSet.has(source));
|
|
104377
|
+
}
|
|
104378
|
+
function parseSkillSourcesList2(skillSourcesRaw) {
|
|
104379
|
+
const tokens = skillSourcesRaw.split(",").map((source) => source.trim()).filter((source) => source.length > 0);
|
|
104380
|
+
if (tokens.length === 0) {
|
|
104381
|
+
throw new Error("--skill-sources must include at least one source (e.g. bundled,project)");
|
|
104382
|
+
}
|
|
104383
|
+
const sources = [];
|
|
104384
|
+
for (const token of tokens) {
|
|
104385
|
+
const source = token;
|
|
104386
|
+
if (!VALID_SKILL_SOURCE_SPECIFIERS2.includes(source)) {
|
|
104387
|
+
throw new Error(`Invalid skill source "${token}". Valid values: ${VALID_SKILL_SOURCE_SPECIFIERS2.join(", ")}`);
|
|
104388
|
+
}
|
|
104389
|
+
if (source === "all") {
|
|
104390
|
+
sources.push(...ALL_SKILL_SOURCES2);
|
|
104391
|
+
continue;
|
|
104392
|
+
}
|
|
104393
|
+
if (isSkillSource2(source)) {
|
|
104394
|
+
sources.push(source);
|
|
104395
|
+
}
|
|
104396
|
+
}
|
|
104397
|
+
return normalizeSkillSources2(sources);
|
|
104398
|
+
}
|
|
104399
|
+
function resolveSkillSourcesSelection2(input) {
|
|
104400
|
+
if (input.noSkills) {
|
|
104401
|
+
return [];
|
|
104402
|
+
}
|
|
104403
|
+
const configuredSources = input.skillSourcesRaw ? parseSkillSourcesList2(input.skillSourcesRaw) : [...ALL_SKILL_SOURCES2];
|
|
104404
|
+
const filteredSources = input.noBundledSkills ? configuredSources.filter((source) => source !== "bundled") : configuredSources;
|
|
104405
|
+
return normalizeSkillSources2(filteredSources);
|
|
104406
|
+
}
|
|
104407
|
+
|
|
104153
104408
|
// src/index.ts
|
|
104154
104409
|
init_oauth2();
|
|
104155
104410
|
|
|
@@ -107386,10 +107641,21 @@ OPTIONS
|
|
|
107386
107641
|
Emit stream_event wrappers for each chunk (stream-json only)
|
|
107387
107642
|
--from-agent <id> Inject agent-to-agent system reminder (headless mode)
|
|
107388
107643
|
--skills <path> Custom path to skills directory (default: .skills in current directory)
|
|
107644
|
+
--skill-sources <csv> Skill sources: all,bundled,global,agent,project (default: all)
|
|
107645
|
+
--no-skills Disable all skill sources
|
|
107646
|
+
--no-bundled-skills Disable bundled skills only
|
|
107389
107647
|
--import <path> Create agent from an AgentFile (.af) template
|
|
107390
107648
|
Use @author/name to import from the agent registry
|
|
107391
107649
|
--memfs Enable memory filesystem for this agent
|
|
107392
107650
|
--no-memfs Disable memory filesystem for this agent
|
|
107651
|
+
--no-system-info-reminder
|
|
107652
|
+
Disable first-turn environment reminder (device/git/cwd context)
|
|
107653
|
+
--reflection-trigger <mode>
|
|
107654
|
+
Sleeptime trigger: off, step-count, compaction-event
|
|
107655
|
+
--reflection-behavior <mode>
|
|
107656
|
+
Sleeptime behavior: reminder, auto-launch
|
|
107657
|
+
--reflection-step-count <n>
|
|
107658
|
+
Sleeptime step-count interval (positive integer)
|
|
107393
107659
|
|
|
107394
107660
|
SUBCOMMANDS (JSON-only)
|
|
107395
107661
|
letta memfs status --agent <id>
|
|
@@ -107635,6 +107901,7 @@ async function main() {
|
|
|
107635
107901
|
"include-partial-messages": { type: "boolean" },
|
|
107636
107902
|
"from-agent": { type: "string" },
|
|
107637
107903
|
skills: { type: "string" },
|
|
107904
|
+
"skill-sources": { type: "string" },
|
|
107638
107905
|
"pre-load-skills": { type: "string" },
|
|
107639
107906
|
"from-af": { type: "string" },
|
|
107640
107907
|
import: { type: "string" },
|
|
@@ -107642,6 +107909,11 @@ async function main() {
|
|
|
107642
107909
|
memfs: { type: "boolean" },
|
|
107643
107910
|
"no-memfs": { type: "boolean" },
|
|
107644
107911
|
"no-skills": { type: "boolean" },
|
|
107912
|
+
"no-bundled-skills": { type: "boolean" },
|
|
107913
|
+
"no-system-info-reminder": { type: "boolean" },
|
|
107914
|
+
"reflection-trigger": { type: "string" },
|
|
107915
|
+
"reflection-behavior": { type: "string" },
|
|
107916
|
+
"reflection-step-count": { type: "string" },
|
|
107645
107917
|
"max-turns": { type: "string" }
|
|
107646
107918
|
},
|
|
107647
107919
|
strict: true,
|
|
@@ -107727,6 +107999,21 @@ Note: Flags should use double dashes for full names (e.g., --yolo, not -yolo)`);
|
|
|
107727
107999
|
const requestedMemoryPromptMode = memfsFlag ? "memfs" : noMemfsFlag ? "standard" : undefined;
|
|
107728
108000
|
const shouldAutoEnableMemfsForNewAgent = !memfsFlag && !noMemfsFlag;
|
|
107729
108001
|
const noSkillsFlag = values["no-skills"];
|
|
108002
|
+
const noBundledSkillsFlag = values["no-bundled-skills"];
|
|
108003
|
+
const skillSourcesRaw = values["skill-sources"];
|
|
108004
|
+
const noSystemInfoReminderFlag = values["no-system-info-reminder"];
|
|
108005
|
+
const resolvedSkillSources = (() => {
|
|
108006
|
+
try {
|
|
108007
|
+
return resolveSkillSourcesSelection2({
|
|
108008
|
+
skillSourcesRaw,
|
|
108009
|
+
noSkills: noSkillsFlag,
|
|
108010
|
+
noBundledSkills: noBundledSkillsFlag
|
|
108011
|
+
});
|
|
108012
|
+
} catch (error) {
|
|
108013
|
+
console.error(error instanceof Error ? `Error: ${error.message}` : String(error));
|
|
108014
|
+
process.exit(1);
|
|
108015
|
+
}
|
|
108016
|
+
})();
|
|
107730
108017
|
const fromAfFile = values.import ?? values["from-af"];
|
|
107731
108018
|
const isHeadless = values.prompt || values.run || !process.stdin.isTTY;
|
|
107732
108019
|
if (command && !isHeadless) {
|
|
@@ -107992,7 +108279,7 @@ Error: ${message}`);
|
|
|
107992
108279
|
await loadTools2(modelForTools);
|
|
107993
108280
|
markMilestone2("TOOLS_LOADED");
|
|
107994
108281
|
const { handleHeadlessCommand: handleHeadlessCommand2 } = await init_headless().then(() => exports_headless);
|
|
107995
|
-
await handleHeadlessCommand2(process.argv, specifiedModel, skillsDirectory,
|
|
108282
|
+
await handleHeadlessCommand2(process.argv, specifiedModel, skillsDirectory, resolvedSkillSources, !noSystemInfoReminderFlag);
|
|
107996
108283
|
return;
|
|
107997
108284
|
}
|
|
107998
108285
|
markMilestone2("TUI_MODE_START");
|
|
@@ -108472,7 +108759,7 @@ Error: ${message}`);
|
|
|
108472
108759
|
}
|
|
108473
108760
|
} catch {}
|
|
108474
108761
|
}
|
|
108475
|
-
setAgentContext(agent.id, skillsDirectory2,
|
|
108762
|
+
setAgentContext(agent.id, skillsDirectory2, resolvedSkillSources);
|
|
108476
108763
|
const isSubagent = process.env.LETTA_CODE_AGENT_ROLE === "subagent";
|
|
108477
108764
|
try {
|
|
108478
108765
|
const { applyMemfsFlags: applyMemfsFlags3 } = await Promise.resolve().then(() => (init_memoryFilesystem2(), exports_memoryFilesystem2));
|
|
@@ -108694,7 +108981,8 @@ Error during initialization: ${message}`);
|
|
|
108694
108981
|
tokenStreaming: settings.tokenStreaming,
|
|
108695
108982
|
showCompactions: settings.showCompactions,
|
|
108696
108983
|
agentProvenance,
|
|
108697
|
-
releaseNotes: releaseNotes2
|
|
108984
|
+
releaseNotes: releaseNotes2,
|
|
108985
|
+
sessionContextReminderEnabled: !noSystemInfoReminderFlag
|
|
108698
108986
|
});
|
|
108699
108987
|
}
|
|
108700
108988
|
return React14.createElement(App3, {
|
|
@@ -108710,7 +108998,8 @@ Error during initialization: ${message}`);
|
|
|
108710
108998
|
tokenStreaming: settings.tokenStreaming,
|
|
108711
108999
|
showCompactions: settings.showCompactions,
|
|
108712
109000
|
agentProvenance,
|
|
108713
|
-
releaseNotes: releaseNotes2
|
|
109001
|
+
releaseNotes: releaseNotes2,
|
|
109002
|
+
sessionContextReminderEnabled: !noSystemInfoReminderFlag
|
|
108714
109003
|
});
|
|
108715
109004
|
}
|
|
108716
109005
|
markMilestone2("REACT_RENDER_START");
|
|
@@ -108732,4 +109021,4 @@ Error during initialization: ${message}`);
|
|
|
108732
109021
|
}
|
|
108733
109022
|
main();
|
|
108734
109023
|
|
|
108735
|
-
//# debugId=
|
|
109024
|
+
//# debugId=097C38A722A3206664756E2164756E21
|