fluxflow-cli 2.13.2 → 2.13.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/fluxflow.js +84 -52
- package/package.json +1 -1
package/dist/fluxflow.js
CHANGED
|
@@ -4452,7 +4452,8 @@ var init_main_tools = __esm({
|
|
|
4452
4452
|
};
|
|
4453
4453
|
TOOL_PROTOCOL = (mode, osDetected, isMultiModal, aiProvider) => `
|
|
4454
4454
|
-- TOOL DEFINITIONS --
|
|
4455
|
-
Internal tools. MUST use the EXACT syntax
|
|
4455
|
+
Internal tools. **MUST use the EXACT syntax** [tool:functions.ToolName(args)]. **NO OTHER SYNTAX/MARKERS/BOUNDARY ALLOWED**
|
|
4456
|
+
NO TOOL CALL INSIDE THINKING
|
|
4456
4457
|
|
|
4457
4458
|
**TOOL USAGE POLICY:**
|
|
4458
4459
|
- **MAX 3 TOOL CALLS PER TURN${mode === "Flux" ? " (EXCEPTION FOR Todo TOOL: 3+ CALLS ALLOWED, Run: Limit 1 OR 2 CONSECUTIVE Run)" : ""}. Next Turn, verify tool results, plan next**
|
|
@@ -5751,7 +5752,8 @@ ${projectContextBlock}
|
|
|
5751
5752
|
- Temporal Awareness: RELATIVE TIME REFERENCE eg. few mins ago
|
|
5752
5753
|
|
|
5753
5754
|
-- SECURITY RULES --${systemSettings.allowExternalAccess ? "" : "\n- ACCESS CONTROL: CWD only"}
|
|
5754
|
-
- Sensitive files? Ask before Read${isSystemDir ? "\
|
|
5755
|
+
- Sensitive files? Ask before Read${isSystemDir ? "\n- PROTECTED DIRECTORY: ASK BEFORE MODIFYING" : ""}
|
|
5756
|
+
- No thinking leak in chat output
|
|
5755
5757
|
|
|
5756
5758
|
-- FORMATTING --
|
|
5757
5759
|
- GFM Supported
|
|
@@ -8486,16 +8488,62 @@ var init_todo = __esm({
|
|
|
8486
8488
|
return `- [ ] ${trimmed}`;
|
|
8487
8489
|
}).filter(Boolean).join("\n") + "\n";
|
|
8488
8490
|
};
|
|
8491
|
+
const applyMarkDone = (content, markDone2) => {
|
|
8492
|
+
if (!markDone2) return { content, markedCount: 0 };
|
|
8493
|
+
const rawTargets = parseMessyArray(markDone2);
|
|
8494
|
+
const targets = (Array.isArray(rawTargets) ? rawTargets : [rawTargets]).map((t) => String(t).replace(/^- \[[xX ]\]\s*/i, "").trim()).filter(Boolean);
|
|
8495
|
+
const lines = content.split("\n");
|
|
8496
|
+
let markedCount = 0;
|
|
8497
|
+
let fileUpdated = false;
|
|
8498
|
+
for (const searchStr of targets) {
|
|
8499
|
+
let updatedThisTarget = false;
|
|
8500
|
+
for (let i = 0; i < lines.length; i++) {
|
|
8501
|
+
if (lines[i].includes(searchStr) && /^- \[\s\]/.test(lines[i].trim())) {
|
|
8502
|
+
lines[i] = lines[i].replace("- [ ]", "- [x]");
|
|
8503
|
+
updatedThisTarget = true;
|
|
8504
|
+
fileUpdated = true;
|
|
8505
|
+
markedCount++;
|
|
8506
|
+
break;
|
|
8507
|
+
}
|
|
8508
|
+
}
|
|
8509
|
+
if (!updatedThisTarget) {
|
|
8510
|
+
for (let i = 0; i < lines.length; i++) {
|
|
8511
|
+
if (lines[i].toLowerCase().includes(searchStr.toLowerCase()) && /^- \[\s\]/.test(lines[i].trim())) {
|
|
8512
|
+
lines[i] = lines[i].replace("- [ ]", "- [x]");
|
|
8513
|
+
updatedThisTarget = true;
|
|
8514
|
+
fileUpdated = true;
|
|
8515
|
+
markedCount++;
|
|
8516
|
+
break;
|
|
8517
|
+
}
|
|
8518
|
+
}
|
|
8519
|
+
}
|
|
8520
|
+
}
|
|
8521
|
+
return {
|
|
8522
|
+
content: fileUpdated ? lines.join("\n") : content,
|
|
8523
|
+
markedCount
|
|
8524
|
+
};
|
|
8525
|
+
};
|
|
8489
8526
|
try {
|
|
8490
8527
|
if (!fs19.existsSync(todoDir)) {
|
|
8491
8528
|
fs19.mkdirSync(todoDir, { recursive: true });
|
|
8492
8529
|
}
|
|
8493
8530
|
if (method === "create") {
|
|
8494
8531
|
if (!tasks) return 'ERROR: Missing "tasks" for create method.';
|
|
8495
|
-
|
|
8532
|
+
let content = getTasksString(tasks);
|
|
8533
|
+
let markedCount = 0;
|
|
8534
|
+
if (markDone) {
|
|
8535
|
+
const result = applyMarkDone(content, markDone);
|
|
8536
|
+
content = result.content;
|
|
8537
|
+
markedCount = result.markedCount;
|
|
8538
|
+
}
|
|
8496
8539
|
await RevertManager.recordFileChange(todoFile);
|
|
8497
8540
|
fs19.writeFileSync(todoFile, content, "utf8");
|
|
8498
8541
|
const total = content.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.startsWith("- [ ]") || l.startsWith("- [x]") || l.startsWith("- [X]")).length;
|
|
8542
|
+
if (markedCount > 0) {
|
|
8543
|
+
const completed = content.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.startsWith("- [x]") || l.startsWith("- [X]")).length;
|
|
8544
|
+
return `SUCCESS: TASK LIST CREATED (${markedCount} marked done, ${completed} completed, ${total - completed} left)
|
|
8545
|
+
${content}`;
|
|
8546
|
+
}
|
|
8499
8547
|
return `SUCCESS: TASK LIST CREATED (${total} total)
|
|
8500
8548
|
${content}`;
|
|
8501
8549
|
}
|
|
@@ -8519,35 +8567,10 @@ ${fullContent}`;
|
|
|
8519
8567
|
let content = fs19.readFileSync(todoFile, "utf8");
|
|
8520
8568
|
let markedCount = 0;
|
|
8521
8569
|
if (markDone) {
|
|
8522
|
-
const
|
|
8523
|
-
|
|
8524
|
-
|
|
8525
|
-
|
|
8526
|
-
for (const searchStr of targets) {
|
|
8527
|
-
let updatedThisTarget = false;
|
|
8528
|
-
for (let i = 0; i < lines.length; i++) {
|
|
8529
|
-
if (lines[i].includes(searchStr) && /^- \[\s\]/.test(lines[i].trim())) {
|
|
8530
|
-
lines[i] = lines[i].replace("- [ ]", "- [x]");
|
|
8531
|
-
updatedThisTarget = true;
|
|
8532
|
-
fileUpdated = true;
|
|
8533
|
-
markedCount++;
|
|
8534
|
-
break;
|
|
8535
|
-
}
|
|
8536
|
-
}
|
|
8537
|
-
if (!updatedThisTarget) {
|
|
8538
|
-
for (let i = 0; i < lines.length; i++) {
|
|
8539
|
-
if (lines[i].toLowerCase().includes(searchStr.toLowerCase()) && /^- \[\s\]/.test(lines[i].trim())) {
|
|
8540
|
-
lines[i] = lines[i].replace("- [ ]", "- [x]");
|
|
8541
|
-
updatedThisTarget = true;
|
|
8542
|
-
fileUpdated = true;
|
|
8543
|
-
markedCount++;
|
|
8544
|
-
break;
|
|
8545
|
-
}
|
|
8546
|
-
}
|
|
8547
|
-
}
|
|
8548
|
-
}
|
|
8549
|
-
if (fileUpdated) {
|
|
8550
|
-
content = lines.join("\n");
|
|
8570
|
+
const result = applyMarkDone(content, markDone);
|
|
8571
|
+
if (result.markedCount > 0) {
|
|
8572
|
+
content = result.content;
|
|
8573
|
+
markedCount = result.markedCount;
|
|
8551
8574
|
await RevertManager.recordFileChange(todoFile);
|
|
8552
8575
|
fs19.writeFileSync(todoFile, content, "utf8");
|
|
8553
8576
|
}
|
|
@@ -10601,8 +10624,8 @@ ${ideCtx.warnings}
|
|
|
10601
10624
|
const boxTop = `${" ".repeat(boxWidth)}`;
|
|
10602
10625
|
const boxMid = boxLines.map((line) => `${line.padEnd(boxWidth - 2).substring(0, boxWidth - 2)}`).join("\n");
|
|
10603
10626
|
const boxBottom = `${" ".repeat(boxWidth)}`;
|
|
10604
|
-
yield { type: "visual_feedback", content: colorMainWords(`${
|
|
10605
|
-
${
|
|
10627
|
+
yield { type: "visual_feedback", content: colorMainWords(`${boxBottom}
|
|
10628
|
+
${boxMid}`) };
|
|
10606
10629
|
continue;
|
|
10607
10630
|
}
|
|
10608
10631
|
const finalStart = startLine !== null ? startLine : 1;
|
|
@@ -10659,8 +10682,8 @@ ${boxBottom}`) };
|
|
|
10659
10682
|
const boxWidth = Math.min(maxLen + 4, terminalWidth);
|
|
10660
10683
|
const boxMid = boxLines.map((line) => `${line.padEnd(boxWidth - 2).substring(0, boxWidth - 2)}`).join("\n");
|
|
10661
10684
|
const boxBottom = `${" ".repeat(boxWidth)}`;
|
|
10662
|
-
yield { type: "visual_feedback", content: colorMainWords(`${
|
|
10663
|
-
${
|
|
10685
|
+
yield { type: "visual_feedback", content: colorMainWords(`${boxBottom}
|
|
10686
|
+
${boxMid}`) };
|
|
10664
10687
|
}
|
|
10665
10688
|
}
|
|
10666
10689
|
}
|
|
@@ -11614,8 +11637,8 @@ ${ideErr} [/ERROR]`;
|
|
|
11614
11637
|
const boxWidth = Math.min(deniedLabel.length + 4, terminalWidth);
|
|
11615
11638
|
const boxMid = `${deniedLabel.padEnd(boxWidth - 2).substring(0, boxWidth - 2)}`;
|
|
11616
11639
|
const boxBottom = ` ${" ".repeat(boxWidth)} `;
|
|
11617
|
-
yield { type: "visual_feedback", content: colorMainWords(`${
|
|
11618
|
-
${
|
|
11640
|
+
yield { type: "visual_feedback", content: colorMainWords(`${boxBottom}
|
|
11641
|
+
${boxMid}`) };
|
|
11619
11642
|
}
|
|
11620
11643
|
toolResults.push({ role: "user", text: `[TOOL RESULT]: ERROR: ${denyMsg}` });
|
|
11621
11644
|
yield { type: "tool_result", content: `[TOOL RESULT]: ERROR: ${denyMsg}` };
|
|
@@ -11838,8 +11861,8 @@ ${failures.map((f) => ` \u2022 ${f.error}`).join("\n")}`;
|
|
|
11838
11861
|
const boxWidth = Math.min(errorLabel.length + 4, terminalWidth);
|
|
11839
11862
|
const boxMid = `${errorLabel.padEnd(boxWidth - 2).substring(0, boxWidth - 2)}`;
|
|
11840
11863
|
const boxBottom = ` ${" ".repeat(boxWidth)} `;
|
|
11841
|
-
yield { type: "visual_feedback", content: colorMainWords(`${
|
|
11842
|
-
${
|
|
11864
|
+
yield { type: "visual_feedback", content: colorMainWords(`${boxBottom}
|
|
11865
|
+
${boxMid}}`) };
|
|
11843
11866
|
toolResults.push({ role: "user", text: errorMsg });
|
|
11844
11867
|
await incrementUsage("toolFailure");
|
|
11845
11868
|
if (settings.onToolResult) settings.onToolResult("failure", normToolName);
|
|
@@ -11989,7 +12012,8 @@ ${snippet2}
|
|
|
11989
12012
|
}
|
|
11990
12013
|
const boxWidth = Math.min(feedbackLabel.length + 4, terminalWidth);
|
|
11991
12014
|
const boxMid = `${feedbackLabel.padEnd(boxWidth - 2).substring(0, boxWidth - 2)}`;
|
|
11992
|
-
yield { type: "visual_feedback", content: colorMainWords(
|
|
12015
|
+
yield { type: "visual_feedback", content: colorMainWords(`
|
|
12016
|
+
${boxMid}`) };
|
|
11993
12017
|
const toolEnd2 = Date.now();
|
|
11994
12018
|
lastToolFinishedAt = toolEnd2;
|
|
11995
12019
|
yield { type: "tool_time", content: toolEnd2 - executionStart };
|
|
@@ -12023,8 +12047,8 @@ ${snippet2}
|
|
|
12023
12047
|
const boxWidth = Math.min(deniedLabel.length + 4, terminalWidth);
|
|
12024
12048
|
const boxMid = `${deniedLabel.padEnd(boxWidth - 2).substring(0, boxWidth - 2)}`;
|
|
12025
12049
|
const boxBottom = ` ${" ".repeat(boxWidth)} `;
|
|
12026
|
-
yield { type: "visual_feedback", content: colorMainWords(`${
|
|
12027
|
-
${
|
|
12050
|
+
yield { type: "visual_feedback", content: colorMainWords(`${boxBottom}
|
|
12051
|
+
${boxMid}`) };
|
|
12028
12052
|
}
|
|
12029
12053
|
if (normToolName === "exec_command") {
|
|
12030
12054
|
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
@@ -12049,7 +12073,8 @@ ${boxBottom}`) };
|
|
|
12049
12073
|
const boxWidth = Math.min(label2.length + 4, terminalWidth);
|
|
12050
12074
|
const boxMid = `${label2.padEnd(boxWidth - 2).substring(0, boxWidth - 2)}`;
|
|
12051
12075
|
const boxBottom = ` ${" ".repeat(boxWidth)} `;
|
|
12052
|
-
yield { type: "visual_feedback", content: colorMainWords(
|
|
12076
|
+
yield { type: "visual_feedback", content: colorMainWords(`
|
|
12077
|
+
${boxMid}${boxMid.includes("Created") || boxMid.includes("Edited") || boxMid.includes("Written") ? "" : `
|
|
12053
12078
|
${boxBottom}`}`) };
|
|
12054
12079
|
}
|
|
12055
12080
|
if (lastToolFinishedAt > 0) {
|
|
@@ -12119,8 +12144,8 @@ ${boxBottom}`}`) };
|
|
|
12119
12144
|
const boxWidth = Math.min(postLabel.length + 4, terminalWidth);
|
|
12120
12145
|
const boxMid = `${postLabel.padEnd(boxWidth - 2).substring(0, boxWidth - 2)}`;
|
|
12121
12146
|
const boxBottom = ` ${" ".repeat(boxWidth)} `;
|
|
12122
|
-
yield { type: "visual_feedback", content: colorMainWords(`${
|
|
12123
|
-
${
|
|
12147
|
+
yield { type: "visual_feedback", content: colorMainWords(`${boxBottom}
|
|
12148
|
+
${boxMid}`) };
|
|
12124
12149
|
}
|
|
12125
12150
|
if (normToolName === "todo") {
|
|
12126
12151
|
const { method, tasks, markDone } = parseArgs(toolCall.args);
|
|
@@ -12173,7 +12198,8 @@ ${boxBottom}`) };
|
|
|
12173
12198
|
""
|
|
12174
12199
|
// Bottom padding spacing
|
|
12175
12200
|
].join("\n");
|
|
12176
|
-
yield { type: "visual_feedback", content:
|
|
12201
|
+
yield { type: "visual_feedback", content: `
|
|
12202
|
+
${colorMainWords(output)}` };
|
|
12177
12203
|
}
|
|
12178
12204
|
}
|
|
12179
12205
|
if (normToolName === "exec_command" && settings.onExecEnd) {
|
|
@@ -14163,9 +14189,13 @@ function App({ args = [] }) {
|
|
|
14163
14189
|
}
|
|
14164
14190
|
if (isTerminalFocused && activeCommand) {
|
|
14165
14191
|
if (key.return) {
|
|
14166
|
-
|
|
14167
|
-
|
|
14168
|
-
|
|
14192
|
+
if (isActiveCommandPty) {
|
|
14193
|
+
writeToActiveCommand("\r");
|
|
14194
|
+
} else {
|
|
14195
|
+
const isWin = process.platform === "win32";
|
|
14196
|
+
writeToActiveCommand(isWin ? "\r\n" : "\n");
|
|
14197
|
+
setExecOutput((prev) => prev + "\n");
|
|
14198
|
+
}
|
|
14169
14199
|
} else if (key.backspace || key.delete) {
|
|
14170
14200
|
if (isActiveCommandPty) {
|
|
14171
14201
|
writeToActiveCommand("\x7F");
|
|
@@ -14980,7 +15010,7 @@ function App({ args = [] }) {
|
|
|
14980
15010
|
setCompletedIndex(prev.length + 1);
|
|
14981
15011
|
const isBtw = hintText.startsWith("/btw");
|
|
14982
15012
|
const cleanText = isBtw ? hintText.replace(/^\/btw\s*/, "") : hintText;
|
|
14983
|
-
const prefix = isBtw ? "[QUESTION
|
|
15013
|
+
const prefix = isBtw ? "[QUESTION]" : "[STEERING HINT]";
|
|
14984
15014
|
return [...prev, { id: "hint-" + Date.now(), role: "user", text: `${prefix}
|
|
14985
15015
|
${cleanText}`, color: "magenta" }];
|
|
14986
15016
|
});
|
|
@@ -15885,7 +15915,7 @@ ${timestamp}` };
|
|
|
15885
15915
|
setMessages((prev) => {
|
|
15886
15916
|
const hasAskRecord = prev.some((m) => m.isAskRecord && m.text?.includes(`Selection: ${val}`));
|
|
15887
15917
|
if (hasAskRecord) return prev;
|
|
15888
|
-
|
|
15918
|
+
const newMsgs = [
|
|
15889
15919
|
...prev,
|
|
15890
15920
|
{
|
|
15891
15921
|
id: "ask-" + Date.now(),
|
|
@@ -15895,6 +15925,8 @@ Selection: ${val}`,
|
|
|
15895
15925
|
isAskRecord: true
|
|
15896
15926
|
}
|
|
15897
15927
|
];
|
|
15928
|
+
setCompletedIndex(newMsgs.length);
|
|
15929
|
+
return newMsgs;
|
|
15898
15930
|
});
|
|
15899
15931
|
resolve(val);
|
|
15900
15932
|
}
|