@letta-ai/letta-code 0.32.9 → 0.32.10
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/mcp-client.js +2 -2
- package/dist/mcp-client.js.map +1 -1
- package/docs/examples/mods/learning/memory-citations.env.json +2 -2
- package/docs/examples/mods/learning/uv-pip-install.env.json +2 -2
- package/docs/examples/mods/memory-citations.ts +3 -3
- package/letta.js +752 -448
- package/package.json +1 -1
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"letta.events.on(\"tool_start\", handler) receives event.toolName, event.args, event.toolCallId, and event.conversationId.",
|
|
26
26
|
"letta.tools.register({ name, description, parameters, requiresApproval, parallelSafe, run }) registers a tool available to the model.",
|
|
27
27
|
"For eval compatibility, the snapshot tool must be named exactly memory_citation_snapshot.",
|
|
28
|
-
"For turn_start reminders, append a separate { type: \"message\", role: \"
|
|
28
|
+
"For turn_start reminders, append a separate { type: \"message\", role: \"user\", content: \"<system-reminder>\" + reminder + \"</system-reminder>\" } object to event.input. Do not concatenate onto an existing message content field because content may be structured parts.",
|
|
29
29
|
"For tool run handlers, ctx.conversation.id is the active conversation id; use it to retrieve state keyed by event.conversationId.",
|
|
30
30
|
"Avoid fragile generated regex strings with embedded quote characters; simple string matching/splitting is fine. The candidate must be syntactically valid TypeScript."
|
|
31
31
|
],
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"assertions": [
|
|
73
73
|
{
|
|
74
74
|
"type": "turn_start_injects_message",
|
|
75
|
-
"role": "
|
|
75
|
+
"role": "user",
|
|
76
76
|
"contains": ["[[", "]]", "cite", "memory"],
|
|
77
77
|
"notContains": ["unconditionally", "always call"],
|
|
78
78
|
"input": [
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
],
|
|
20
20
|
"modApiHints": [
|
|
21
21
|
"The mod runtime accepts TypeScript files in LETTA_MODS_DIR and calls export function activate(letta) or a default export.",
|
|
22
|
-
"letta.events.on(\"turn_start\", handler) receives event.input (an array of messages). Append a separate { type: \"message\", role: \"
|
|
22
|
+
"letta.events.on(\"turn_start\", handler) receives event.input (an array of messages). Append a separate { type: \"message\", role: \"user\", content: \"<system-reminder>\" + reminder + \"</system-reminder>\" } object; do not concatenate onto existing content because it may be structured parts.",
|
|
23
23
|
"letta.events.on(\"tool_start\", handler) receives event.toolName, event.args, event.toolCallId, and event.conversationId.",
|
|
24
24
|
"The Bash tool is named \"Bash\" and its command argument is event.args.command (a string).",
|
|
25
25
|
"To rewrite args, return { args: { ...event.args, command: rewrittenCommand } } from the tool_start handler.",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"assertions": [
|
|
65
65
|
{
|
|
66
66
|
"type": "turn_start_injects_message",
|
|
67
|
-
"role": "
|
|
67
|
+
"role": "user",
|
|
68
68
|
"contains": ["uv pip install", "pip install"],
|
|
69
69
|
"input": [
|
|
70
70
|
{
|
|
@@ -196,12 +196,12 @@ function createCitationInstruction(): string {
|
|
|
196
196
|
return `${SYSTEM_REMINDER_OPEN}\nMemory citation mod is active. If memory materially contributes to your answer, call the memory_citation_snapshot tool before your final response and include a compact "Memory references" footer using only paths returned by that tool. Do not invent memory citations. If the snapshot returns no citations, omit the footer or say that no explicit memory file reads were observed.\n${SYSTEM_REMINDER_CLOSE}`;
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
function
|
|
199
|
+
function appendReminderMessage(input: unknown[], text: string): unknown[] {
|
|
200
200
|
return [
|
|
201
201
|
...input,
|
|
202
202
|
{
|
|
203
203
|
type: "message",
|
|
204
|
-
role: "
|
|
204
|
+
role: "user",
|
|
205
205
|
content: text,
|
|
206
206
|
},
|
|
207
207
|
];
|
|
@@ -231,7 +231,7 @@ export function activate(letta) {
|
|
|
231
231
|
citations: [],
|
|
232
232
|
turnStartedAt: new Date().toISOString(),
|
|
233
233
|
});
|
|
234
|
-
event.input =
|
|
234
|
+
event.input = appendReminderMessage(
|
|
235
235
|
event.input,
|
|
236
236
|
createCitationInstruction(),
|
|
237
237
|
);
|