fluxflow-cli 1.12.5 → 1.12.6

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.
Files changed (2) hide show
  1. package/dist/fluxflow.js +33 -21
  2. package/package.json +1 -1
package/dist/fluxflow.js CHANGED
@@ -989,13 +989,13 @@ var init_janitor_tools = __esm({
989
989
  Your tool syntax is: '[tool:functions.ToolName(args...)]'
990
990
 
991
991
  -- CHAT MANAGEMENT TOOLS (MUST CALL THESE 2 TOOLS ALWAYS) --
992
- [tool:functions.Chat(title='<short creative title of FULL conversation in 3-5 words>')]. Consider full chat context to generate title NOT just latest message.
993
- [tool:functions.Memory(action='temp', content='<summary of the user prompt & model responses ONLY FROM LATEST PROMPT UNDER 40 WORDS>. [Talked on: <date> <hour>]')]
992
+ [tool:functions.Chat(title="<short creative title of FULL conversation in 3-5 words>")]. Consider full chat context to generate title NOT just latest message.
993
+ [tool:functions.Memory(action="temp", content="<summary of the user prompt & model responses ONLY FROM LATEST PROMPT UNDER 40 WORDS>. [Talked on: <date> <hour>]")]
994
994
 
995
995
  ${isMemoryEnabled ? `-- User-specific long-term/permanent memory (USE BASED ON CONVERSATION CONTEXT, PROACTIVE USAGE) --
996
- - Add: [tool:functions.Memory(action='user', method='add', content='<string to add>. [Saved on: <date ONLY>]')]
997
- - Delete: [tool:functions.Memory(action='user', method='delete', content='exact memory id')]
998
- - Update: [tool:functions.Memory(action='user', method='update', content-new='string to update', content-old='exact memory id')]
996
+ - Add: [tool:functions.Memory(action="user", method="add", content="<string to add>. [Saved on: <date ONLY>]")]
997
+ - Delete: [tool:functions.Memory(action="user", method="delete", id="<memory id>")]
998
+ - Update: [tool:functions.Memory(action="user", method="update", content-new="string to update", id="<memory id>")]
999
999
 
1000
1000
  Explicit Triggers for permanent memory:
1001
1001
  - User explicitly asks to 'remember' something.
@@ -2118,6 +2118,7 @@ var init_memory = __esm({
2118
2118
  const content = parseArg("content");
2119
2119
  const contentNew = parseArg("content-new");
2120
2120
  const contentOld = parseArg("content-old");
2121
+ const id = parseArg("id");
2121
2122
  const chatId = parseArg("chat-id") || context.chatId || context.sessionId || "default-session";
2122
2123
  if (action === "temp") {
2123
2124
  if (!content) return "ERROR: Missing 'content' for temp memory.";
@@ -2137,30 +2138,36 @@ var init_memory = __esm({
2137
2138
  const memories = readEncryptedJson(MEMORIES_FILE, []);
2138
2139
  if (method === "add") {
2139
2140
  if (!content) return "ERROR: Missing 'content' for memory addition.";
2141
+ const now = /* @__PURE__ */ new Date();
2142
+ const dateStr = `${now.getDate()}/${now.getMonth() + 1}/${now.getFullYear()}`;
2143
+ const formattedContent = content.includes("[Saved on:") ? content : `${content.trim()} [Saved on: ${dateStr}]`;
2140
2144
  const MAX_CHARS = 1024 * 4;
2141
2145
  let currentTotalLength = memories.reduce((acc, m) => acc + (m.memory?.length || 0), 0);
2142
- while (memories.length > 0 && currentTotalLength + content.length > MAX_CHARS) {
2146
+ while (memories.length > 0 && currentTotalLength + formattedContent.length > MAX_CHARS) {
2143
2147
  const removed = memories.shift();
2144
2148
  currentTotalLength -= removed.memory?.length || 0;
2145
2149
  }
2146
- const newMemory = { id: `mem-${Date.now().toString(36)}`, memory: content };
2150
+ const newMemory = { id: `mem-${Date.now().toString(36)}`, memory: formattedContent };
2147
2151
  memories.push(newMemory);
2148
2152
  writeEncryptedJson(MEMORIES_FILE, memories);
2149
- return `SUCCESS: Memory added with ID [${newMemory.id}]. (Vault Size: ${currentTotalLength + content.length} chars)`;
2153
+ return `SUCCESS: Memory added with ID [${newMemory.id}]. (Vault Size: ${currentTotalLength + formattedContent.length} chars)`;
2150
2154
  }
2151
2155
  if (method === "update") {
2152
- const memId = contentOld;
2153
- const newText = contentNew;
2154
- if (!memId || !newText) return "ERROR: Missing 'content-old' (id) or 'content-new' for update.";
2156
+ const memId = id || contentOld;
2157
+ const newText = contentNew || content;
2158
+ if (!memId || !newText) return "ERROR: Missing 'id' or content for update.";
2155
2159
  const index = memories.findIndex((m) => m.id === memId);
2156
2160
  if (index === -1) return `ERROR: Memory ID [${memId}] not found.`;
2157
- memories[index].memory = newText;
2161
+ const now = /* @__PURE__ */ new Date();
2162
+ const dateStr = `${now.getDate()}/${now.getMonth() + 1}/${now.getFullYear()}`;
2163
+ const formattedText = newText.includes("[Saved on:") ? newText : `${newText.trim()} [Saved on: ${dateStr}]`;
2164
+ memories[index].memory = formattedText;
2158
2165
  writeEncryptedJson(MEMORIES_FILE, memories);
2159
2166
  return `SUCCESS: Memory [${memId}] updated.`;
2160
2167
  }
2161
2168
  if (method === "delete") {
2162
- const memId = content;
2163
- if (!memId) return "ERROR: Missing 'content' (id) for deletion.";
2169
+ const memId = id || content;
2170
+ if (!memId) return "ERROR: Missing 'id' for deletion.";
2164
2171
  const initialLen = memories.length;
2165
2172
  const updatedMemories = memories.filter((m) => m.id !== memId);
2166
2173
  if (updatedMemories.length === initialLen) return `ERROR: Memory ID [${memId}] not found.`;
@@ -3524,25 +3531,30 @@ var init_ai = __esm({
3524
3531
  const isMemoryEnabled = systemSettings?.memory !== false;
3525
3532
  const persistentStorage = readEncryptedJson(MEMORIES_FILE, []);
3526
3533
  const janitorUserMemories = persistentStorage.map((m) => `- [${m.id}]: ${m.memory}`).join("\n");
3527
- const janitorContents = history.slice(-12).filter((msg) => msg.text && !msg.text.includes("[TOOL RESULT]") && !msg.text.includes("OBSERVATION:")).map((msg) => {
3528
- let processedText = msg.text.replace(/\[tool:functions\..*?\]/g, "").replace(/<think>[\s\S]*?<\/think>/g, "").replace(/\[Prompted on:.*?\]/g, "").replace(/\[turn: continue\]/g, "").replace(/\[turn: finish\]/g, "").replace(/\[TOOL RESULTS\]/g, "").replace(/\[tool results\]/g, "").replace(/\r?\n\r?\n/g, "\n").replace(/\n\n/g, "\n").replace(/\\n\\n/g, "").trim();
3534
+ const janitorContents = history.slice(0, -1).filter((msg) => msg.text && !msg.text.includes("[TOOL RESULT]") && !msg.text.includes("OBSERVATION:") && !msg.isMeta && !msg.isLogo && !String(msg.id).startsWith("welcome") && !String(msg.id).startsWith("logo")).slice(-18).map((msg) => {
3535
+ let processedText = msg.text.replace(/\[tool:functions\..*?\]/g, "").replace(/<think>[\s\S]*?<\/think>/g, "").replace(/\[Prompted on:.*?\]/g, "").replace(/\[METADATA \(PRIORITY: DYNAMIC\)\] Time: ([^|\n]+)/g, (match, p1) => {
3536
+ return `[METADATA (PRIORITY: DYNAMIC)] Time: ${p1.replace(/:\d{2}/g, "")}`;
3537
+ }).replace(/\[turn: continue\]/g, "").replace(/\[turn: finish\]/g, "").replace(/\[TOOL RESULTS\]/g, "").replace(/\[tool results\]/g, "").replace(/\r?\n\r?\n/g, "\n").replace(/\n\n/g, "\n").replace(/\\n\\n/g, "").trim();
3529
3538
  const limit = msg.role === "user" ? USER_CONTEXT_LENGTH : AGENT_CONTEXT_LENGTH;
3530
3539
  let truncatedText = processedText.substring(0, limit);
3531
3540
  if (processedText.length > limit) {
3532
3541
  truncatedText += "\n... (truncated) ...";
3533
3542
  }
3543
+ const prefix = msg.role === "user" ? truncatedText.startsWith("[USER]") ? "" : "[USER]: " : truncatedText.startsWith("[AGENT]") ? "" : "[AGENT]: ";
3534
3544
  return {
3535
3545
  role: msg.role === "user" ? "user" : "model",
3536
- parts: [{ text: truncatedText }]
3546
+ parts: [{ text: `${prefix}${truncatedText}` }]
3537
3547
  };
3538
3548
  });
3549
+ const isFirstPrompt = history.filter((m) => m.role === "user").length === 1;
3550
+ const hasTitleSignal = agentText.includes("[TITLE-UPDATE]");
3551
+ const thisHas80pChanceOfBeingTrue = Math.random() < 0.8;
3552
+ const needTitle = isFirstPrompt || hasTitleSignal || thisHas80pChanceOfBeingTrue;
3539
3553
  const cleanedFullResponse = fullAgentTextRaw.replace(/<think>[\s\S]*?<\/think>/g, "").trim();
3540
3554
  const janitorPrompt = getJanitorInstruction(
3541
- agentText,
3542
- cleanedFullResponse,
3543
3555
  janitorUserMemories,
3544
3556
  isMemoryEnabled,
3545
- true
3557
+ needTitle
3546
3558
  );
3547
3559
  let agentRes = `${cleanedFullResponse.replace(/\[tool:functions\..*?\]/g, "").replace(/<think>.*<\/think>/g, "").replace(/\[Prompted on:.*?\]/g, "").replace(/\[turn: continue\]/g, "").replace(/\[turn: finish\]/g, "").replace(/\[TOOL RESULTS\]/g, "").replace(/\[tool results\]/g, "").substring(0, AGENT_CONTEXT_LENGTH)}`;
3548
3560
  if (agentRes.length > AGENT_CONTEXT_LENGTH) {
@@ -3556,7 +3568,7 @@ ${originalTextProcessed.length > USER_CONTEXT_LENGTH ? "... (truncated) ...\n\n"
3556
3568
  janitorContents.push({ role: "user", parts: [{ text: userPrompt }] });
3557
3569
  let finalSynthesis = "";
3558
3570
  let attempts = 0;
3559
- const MAX_JANITOR_RETRIES = 5;
3571
+ const MAX_JANITOR_RETRIES = 12;
3560
3572
  while (attempts <= MAX_JANITOR_RETRIES) {
3561
3573
  if (process.stdout.isTTY) {
3562
3574
  process.stdout.write(`\x1B]0;Retrying Memory (${attempts + 1})...\x07`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluxflow-cli",
3
- "version": "1.12.5",
3
+ "version": "1.12.6",
4
4
  "date": "2026-05-22",
5
5
  "description": "A high-fidelity agentic terminal assistant for the Flux Era.",
6
6
  "keywords": [