fluxflow-cli 1.8.15 → 1.8.16

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 +74 -40
  2. package/package.json +1 -1
package/dist/fluxflow.js CHANGED
@@ -740,7 +740,7 @@ var init_janitor_tools = __esm({
740
740
  JANITOR_TOOLS_PROTOCOL = (isMemoryEnabled = true, needTitle = false) => `
741
741
  ${needTitle ? `-- START CHAT MANAGEMENT TOOLS --
742
742
  1. YOU MUST UPDATE CHAT TITLE (URGENT PRIORITY):
743
- tool:functions.chat(title='<short summary of conversation in 3-5 words>')
743
+ tool:functions.chat(title='<short summary of conversation context in 3-5 words>')
744
744
  -- END CHAT MANAGEMENT TOOLS --
745
745
 
746
746
  ` : ""}
@@ -3061,6 +3061,9 @@ ${boxBottom}
3061
3061
  const agentErrDir = path16.join(LOGS_DIR, "agent");
3062
3062
  if (!fs16.existsSync(agentErrDir)) fs16.mkdirSync(agentErrDir, { recursive: true });
3063
3063
  fs16.appendFileSync(path16.join(agentErrDir, "error.log"), `ERROR [${date}]: ${errLog}
3064
+
3065
+ ----------------------------------------------------------------------
3066
+
3064
3067
  `);
3065
3068
  if (retryCount < MAX_RETRIES) {
3066
3069
  retryCount++;
@@ -3112,7 +3115,7 @@ ${boxBottom}
3112
3115
  cleanedFullResponse,
3113
3116
  janitorUserMemories,
3114
3117
  isMemoryEnabled,
3115
- needTitle
3118
+ true
3116
3119
  );
3117
3120
  janitorContents.push({ role: "user", parts: [{ text: janitorPrompt }] });
3118
3121
  let finalSynthesis = "";
@@ -3121,52 +3124,75 @@ ${boxBottom}
3121
3124
  console.warn("Quota Exhausted for Background Model. Skipping refinement.");
3122
3125
  throw new Error("QUOTA_BLOCKED");
3123
3126
  }
3124
- const janitorResult = await client.models.generateContent({
3125
- model: janitorModel || "gemma-4-26b-a4b-it",
3126
- contents: janitorContents,
3127
- config: {
3128
- maxOutputTokens: 384,
3129
- temperature: 0.69,
3130
- safetySettings: [
3131
- {
3132
- category: HarmCategory.HARM_CATEGORY_HARASSMENT,
3133
- threshold: HarmBlockThreshold.BLOCK_NONE
3134
- },
3135
- {
3136
- category: HarmCategory.HARM_CATEGORY_HATE_SPEECH,
3137
- threshold: HarmBlockThreshold.BLOCK_NONE
3138
- },
3139
- {
3140
- category: HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT,
3141
- threshold: HarmBlockThreshold.BLOCK_NONE
3142
- },
3143
- {
3144
- category: HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT,
3145
- threshold: HarmBlockThreshold.BLOCK_NONE
3127
+ yield { type: "spinner", content: false };
3128
+ let fullContent = "";
3129
+ let lastUsage2 = null;
3130
+ try {
3131
+ const timeoutPromise = new Promise(
3132
+ (_, reject) => setTimeout(() => reject(new Error("JANITOR_TIMEOUT")), 15e3)
3133
+ );
3134
+ const streamPromise = (async () => {
3135
+ const stream2 = await client.models.generateContentStream({
3136
+ model: janitorModel || "gemma-4-26b-a4b-it",
3137
+ contents: janitorContents,
3138
+ config: {
3139
+ maxOutputTokens: 384,
3140
+ temperature: 0.69,
3141
+ safetySettings: [
3142
+ { category: HarmCategory.HARM_CATEGORY_HARASSMENT, threshold: HarmBlockThreshold.BLOCK_NONE },
3143
+ { category: HarmCategory.HARM_CATEGORY_HATE_SPEECH, threshold: HarmBlockThreshold.BLOCK_NONE },
3144
+ { category: HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT, threshold: HarmBlockThreshold.BLOCK_NONE },
3145
+ { category: HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT, threshold: HarmBlockThreshold.BLOCK_NONE }
3146
+ ],
3147
+ thinkingConfig: { includeThoughts: false, thinkingLevel: ThinkingLevel.MINIMAL }
3146
3148
  }
3147
- ],
3148
- thinkingConfig: {
3149
- includeThoughts: false,
3150
- thinkingLevel: ThinkingLevel.MINIMAL
3149
+ });
3150
+ await incrementUsage("background");
3151
+ const iterator2 = stream2[Symbol.asyncIterator]();
3152
+ const firstResult2 = await iterator2.next();
3153
+ return { iterator: iterator2, firstResult: firstResult2 };
3154
+ })();
3155
+ const { iterator, firstResult } = await Promise.race([streamPromise, timeoutPromise]);
3156
+ let { value: firstChunk, done: firstDone } = firstResult;
3157
+ if (!firstDone && firstChunk) {
3158
+ const parts = firstChunk.candidates?.[0]?.content?.parts;
3159
+ const chunkText = parts?.[1]?.text || parts?.[0]?.text || (typeof firstChunk.text === "function" ? firstChunk.text() : "");
3160
+ if (chunkText) {
3161
+ fullContent += chunkText;
3162
+ yield { type: "status", content: "Finishing..." };
3163
+ }
3164
+ lastUsage2 = firstChunk.usageMetadata;
3165
+ for await (const chunk of { [Symbol.asyncIterator]: () => iterator }) {
3166
+ const p = chunk.candidates?.[0]?.content?.parts;
3167
+ const t = p?.[1]?.text || p?.[0]?.text || (typeof chunk.text === "function" ? chunk.text() : "");
3168
+ if (t) {
3169
+ fullContent += t;
3170
+ }
3171
+ lastUsage2 = chunk.usageMetadata;
3151
3172
  }
3152
3173
  }
3153
- });
3154
- const parts = janitorResult.candidates?.[0]?.content?.parts;
3155
- if (parts && parts[1]?.text) {
3156
- finalSynthesis = parts[1].text;
3174
+ } catch (e) {
3175
+ if (e.message === "JANITOR_TIMEOUT") {
3176
+ throw new Error("Janitor API Timeout: No tokens received within 15s.");
3177
+ }
3178
+ throw e;
3179
+ }
3180
+ yield { type: "spinner", content: true };
3181
+ if (fullContent) {
3182
+ finalSynthesis = fullContent;
3183
+ if (lastUsage2) {
3184
+ await addToUsage("tokens", lastUsage2.totalTokenCount || 0);
3185
+ }
3157
3186
  const date = (/* @__PURE__ */ new Date()).toLocaleString();
3158
3187
  const janitorLogDir = path16.join(LOGS_DIR, "janitor");
3159
3188
  if (!fs16.existsSync(janitorLogDir)) {
3160
3189
  fs16.mkdirSync(janitorLogDir, { recursive: true });
3161
3190
  }
3162
3191
  fs16.appendFileSync(path16.join(janitorLogDir, "debug.log"), `DEBUG [${date}]: ${finalSynthesis}
3192
+
3163
3193
  `);
3164
- } else if (parts && parts[0]?.text) finalSynthesis = parts[0].text;
3165
- else if (janitorResult.response && janitorResult.response.text) finalSynthesis = janitorResult.response.text();
3166
- else throw new Error("No synthesis generated by Janitor.");
3167
- await incrementUsage("background");
3168
- if (janitorResult.usageMetadata) {
3169
- await addToUsage("tokens", janitorResult.usageMetadata.totalTokenCount || 0);
3194
+ } else {
3195
+ throw new Error("No synthesis generated by Janitor.");
3170
3196
  }
3171
3197
  yield { type: "background_increment" };
3172
3198
  const janitorToolCalls = detectToolCalls(finalSynthesis);
@@ -3176,6 +3202,10 @@ ${boxBottom}
3176
3202
  const date = (/* @__PURE__ */ new Date()).toLocaleString();
3177
3203
  const janitorLogDir = path16.join(LOGS_DIR, "janitor");
3178
3204
  fs16.appendFileSync(path16.join(janitorLogDir, "debug.log"), `DEBUG [${date}]: RESULT [${janitorToolCall.toolName}]: ${result}
3205
+
3206
+ ----------------------------------------------------------------------
3207
+
3208
+
3179
3209
  `);
3180
3210
  if (janitorToolCall.toolName === "memory" && !janitorToolCall.args.includes("action='temp'")) {
3181
3211
  yield { type: "memory_updated" };
@@ -3188,6 +3218,10 @@ ${boxBottom}
3188
3218
  fs16.mkdirSync(janitorErrDir, { recursive: true });
3189
3219
  }
3190
3220
  fs16.appendFileSync(path16.join(janitorErrDir, "error.log"), `ERROR [${date}]: ${String(janitorErr)}
3221
+
3222
+ ----------------------------------------------------------------------
3223
+
3224
+
3191
3225
  `);
3192
3226
  console.error("Janitor Background Tasks Failed:", janitorErr.message);
3193
3227
  }
@@ -3982,7 +4016,7 @@ ${hintText}`, color: "magenta" }];
3982
4016
  resumedMsgs.unshift({ id: "welcome-" + Date.now(), role: "system", text: FLUX_LOGO + "\n\n\u{1F30A}\u26A1 Resuming Flux Flow Session...\n" });
3983
4017
  }
3984
4018
  setMessages(resumedMsgs);
3985
- setMessages((prev) => [...prev, { id: "sys-" + Date.now(), role: "system", text: `\u{1F4E1} SESSION RESUMED: [${targetId}]` }]);
4019
+ setMessages((prev) => [...prev, { id: "sys-" + Date.now(), role: "system", text: `\u{1F4E1} SESSION RESUMED: [${targetId}]`, isMeta: true }]);
3986
4020
  setCompletedIndex(0);
3987
4021
  } else {
3988
4022
  setMessages((prev) => [...prev, { id: "err-" + Date.now(), role: "system", text: `\u274C ERROR: Session [${targetId}] not found.` }]);
@@ -5162,7 +5196,7 @@ var init_app = __esm({
5162
5196
  init_text();
5163
5197
  SESSION_START_TIME = Date.now();
5164
5198
  CHANGELOG_URL = "https://fluxflow-cli.onrender.com/changelog.html";
5165
- versionFluxflow = "1.8.15";
5199
+ versionFluxflow = "1.8.16";
5166
5200
  updatedOn = "2026-05-09";
5167
5201
  ResolutionModal = ({ data, onResolve, onEdit }) => /* @__PURE__ */ React10.createElement(Box10, { flexDirection: "column", borderStyle: "round", borderColor: "magenta", paddingX: 2, paddingY: 1, width: "100%" }, /* @__PURE__ */ React10.createElement(Text10, { color: "magenta", bold: true, underline: true }, "\u{1F7E3} STEERING HINT RESOLUTION"), /* @__PURE__ */ React10.createElement(Text10, { marginTop: 1 }, "The agent already finished the task before your hint was consumed."), /* @__PURE__ */ React10.createElement(Box10, { marginTop: 1, backgroundColor: "#222", paddingX: 1, width: "100%" }, /* @__PURE__ */ React10.createElement(Text10, { italic: true, color: "gray" }, '"', data, '"')), /* @__PURE__ */ React10.createElement(Box10, { marginTop: 1 }, /* @__PURE__ */ React10.createElement(Text10, { color: "cyan" }, "How would you like to proceed?")), /* @__PURE__ */ React10.createElement(Box10, { marginTop: 1 }, /* @__PURE__ */ React10.createElement(
5168
5202
  CommandMenu,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluxflow-cli",
3
- "version": "1.8.15",
3
+ "version": "1.8.16",
4
4
  "description": "A high-fidelity agentic terminal assistant for the Flux Era.",
5
5
  "keywords": [
6
6
  "ai",