fluxflow-cli 1.7.5 → 1.7.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.
- package/dist/fluxflow.js +95 -17
- package/package.json +1 -1
package/dist/fluxflow.js
CHANGED
|
@@ -986,7 +986,7 @@ var init_usage = __esm({
|
|
|
986
986
|
try {
|
|
987
987
|
if (await fs5.exists(USAGE_FILE)) {
|
|
988
988
|
const data = await fs5.readJson(USAGE_FILE);
|
|
989
|
-
if (data.date === today) {
|
|
989
|
+
if (data && data.date === today && data.stats) {
|
|
990
990
|
const s = data.stats;
|
|
991
991
|
const normalized = {
|
|
992
992
|
agent: s.agent || 0,
|
|
@@ -998,10 +998,11 @@ var init_usage = __esm({
|
|
|
998
998
|
tokens: s.tokens || 0
|
|
999
999
|
};
|
|
1000
1000
|
return normalized;
|
|
1001
|
+
} else if (data && data.date !== today) {
|
|
1002
|
+
} else {
|
|
1001
1003
|
}
|
|
1002
1004
|
}
|
|
1003
1005
|
} catch (err) {
|
|
1004
|
-
console.error("Failed to read usage:", err);
|
|
1005
1006
|
}
|
|
1006
1007
|
const defaultStats = {
|
|
1007
1008
|
agent: 0,
|
|
@@ -1012,8 +1013,16 @@ var init_usage = __esm({
|
|
|
1012
1013
|
duration: 0,
|
|
1013
1014
|
tokens: 0
|
|
1014
1015
|
};
|
|
1015
|
-
|
|
1016
|
-
|
|
1016
|
+
try {
|
|
1017
|
+
await fs5.ensureDir(path5.dirname(USAGE_FILE));
|
|
1018
|
+
const tempFile = USAGE_FILE + ".tmp";
|
|
1019
|
+
await fs5.writeJson(tempFile, { date: today, stats: defaultStats }, { spaces: 2 });
|
|
1020
|
+
const fd = await fs5.open(tempFile, "r+");
|
|
1021
|
+
await fs5.fsync(fd);
|
|
1022
|
+
await fs5.close(fd);
|
|
1023
|
+
await fs5.rename(tempFile, USAGE_FILE);
|
|
1024
|
+
} catch (e) {
|
|
1025
|
+
}
|
|
1017
1026
|
return defaultStats;
|
|
1018
1027
|
};
|
|
1019
1028
|
incrementUsage = async (key) => {
|
|
@@ -1022,8 +1031,16 @@ var init_usage = __esm({
|
|
|
1022
1031
|
const data = { date: today, stats };
|
|
1023
1032
|
if (data.stats[key] !== void 0) {
|
|
1024
1033
|
data.stats[key]++;
|
|
1025
|
-
|
|
1026
|
-
|
|
1034
|
+
try {
|
|
1035
|
+
await fs5.ensureDir(path5.dirname(USAGE_FILE));
|
|
1036
|
+
const tempFile = USAGE_FILE + ".tmp";
|
|
1037
|
+
await fs5.writeJson(tempFile, data, { spaces: 2 });
|
|
1038
|
+
const fd = await fs5.open(tempFile, "r+");
|
|
1039
|
+
await fs5.fsync(fd);
|
|
1040
|
+
await fs5.close(fd);
|
|
1041
|
+
await fs5.rename(tempFile, USAGE_FILE);
|
|
1042
|
+
} catch (e) {
|
|
1043
|
+
}
|
|
1027
1044
|
}
|
|
1028
1045
|
};
|
|
1029
1046
|
addToUsage = async (key, amount) => {
|
|
@@ -1032,8 +1049,16 @@ var init_usage = __esm({
|
|
|
1032
1049
|
const data = { date: today, stats };
|
|
1033
1050
|
if (data.stats[key] !== void 0) {
|
|
1034
1051
|
data.stats[key] += Math.floor(amount);
|
|
1035
|
-
|
|
1036
|
-
|
|
1052
|
+
try {
|
|
1053
|
+
await fs5.ensureDir(path5.dirname(USAGE_FILE));
|
|
1054
|
+
const tempFile = USAGE_FILE + ".tmp";
|
|
1055
|
+
await fs5.writeJson(tempFile, data, { spaces: 2 });
|
|
1056
|
+
const fd = await fs5.open(tempFile, "r+");
|
|
1057
|
+
await fs5.fsync(fd);
|
|
1058
|
+
await fs5.close(fd);
|
|
1059
|
+
await fs5.rename(tempFile, USAGE_FILE);
|
|
1060
|
+
} catch (e) {
|
|
1061
|
+
}
|
|
1037
1062
|
}
|
|
1038
1063
|
};
|
|
1039
1064
|
checkQuota = async (key, settings) => {
|
|
@@ -1604,9 +1629,34 @@ ${lines.map((l, i) => `${i + 1} | ${l}`).join("\n")}
|
|
|
1604
1629
|
if (!fs10.existsSync(parentDir)) {
|
|
1605
1630
|
fs10.mkdirSync(parentDir, { recursive: true });
|
|
1606
1631
|
}
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1632
|
+
let processedContent = "";
|
|
1633
|
+
let inString = null;
|
|
1634
|
+
for (let i = 0; i < content.length; i++) {
|
|
1635
|
+
const char = content[i];
|
|
1636
|
+
const next2 = content.substring(i, i + 2);
|
|
1637
|
+
if (!inString) {
|
|
1638
|
+
if (char === '"' || char === "'" || char === "`") {
|
|
1639
|
+
inString = char;
|
|
1640
|
+
processedContent += char;
|
|
1641
|
+
} else if (next2 === "\\\\n") {
|
|
1642
|
+
processedContent += "\\n";
|
|
1643
|
+
i++;
|
|
1644
|
+
} else if (next2 === "\\n") {
|
|
1645
|
+
processedContent += "\n";
|
|
1646
|
+
i++;
|
|
1647
|
+
} else {
|
|
1648
|
+
processedContent += char;
|
|
1649
|
+
}
|
|
1650
|
+
} else {
|
|
1651
|
+
if (char === inString && content[i - 1] !== "\\") {
|
|
1652
|
+
inString = null;
|
|
1653
|
+
}
|
|
1654
|
+
processedContent += char;
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
const lineCount = processedContent.split(/\r?\n/).length;
|
|
1658
|
+
const originalSize = Buffer.byteLength(processedContent, "utf8");
|
|
1659
|
+
fs10.writeFileSync(absolutePath, processedContent, "utf8");
|
|
1610
1660
|
let verifiedContent = fs10.readFileSync(absolutePath, "utf8");
|
|
1611
1661
|
const verifiedSize = Buffer.byteLength(verifiedContent, "utf8");
|
|
1612
1662
|
const verifiedLines = verifiedContent.split(/\r?\n/);
|
|
@@ -1628,7 +1678,7 @@ ${lines.map((l, i) => `${i + 1} | ${l}`).join("\n")}
|
|
|
1628
1678
|
${tail}`;
|
|
1629
1679
|
}
|
|
1630
1680
|
verifiedContent = null;
|
|
1631
|
-
return `SUCCESS: File [${targetPath}]
|
|
1681
|
+
return `SUCCESS: File [${targetPath}] saved.
|
|
1632
1682
|
|
|
1633
1683
|
- Stats: [${verifiedLineCount} lines, ${(verifiedSize / 1024).toFixed(1)} KB]
|
|
1634
1684
|
${ancestry}- Content Preview:
|
|
@@ -1655,8 +1705,36 @@ var init_update_file = __esm({
|
|
|
1655
1705
|
if (content_to_replace === void 0) return 'ERROR: Missing "content_to_replace" argument.';
|
|
1656
1706
|
if (content_to_add === void 0) return 'ERROR: Missing "content_to_add" argument.';
|
|
1657
1707
|
const strip = (t) => t.replace(/^```[\w]*\n?/, "").replace(/```\s*$/, "").replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
1658
|
-
|
|
1659
|
-
|
|
1708
|
+
const unescapeContent = (content) => {
|
|
1709
|
+
let processedContent = "";
|
|
1710
|
+
let inString = null;
|
|
1711
|
+
for (let i = 0; i < content.length; i++) {
|
|
1712
|
+
const char = content[i];
|
|
1713
|
+
const next2 = content.substring(i, i + 2);
|
|
1714
|
+
if (!inString) {
|
|
1715
|
+
if (char === '"' || char === "'" || char === "`") {
|
|
1716
|
+
inString = char;
|
|
1717
|
+
processedContent += char;
|
|
1718
|
+
} else if (next2 === "\\\\n") {
|
|
1719
|
+
processedContent += "\\n";
|
|
1720
|
+
i++;
|
|
1721
|
+
} else if (next2 === "\\n") {
|
|
1722
|
+
processedContent += "\n";
|
|
1723
|
+
i++;
|
|
1724
|
+
} else {
|
|
1725
|
+
processedContent += char;
|
|
1726
|
+
}
|
|
1727
|
+
} else {
|
|
1728
|
+
if (char === inString && content[i - 1] !== "\\") {
|
|
1729
|
+
inString = null;
|
|
1730
|
+
}
|
|
1731
|
+
processedContent += char;
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
return processedContent;
|
|
1735
|
+
};
|
|
1736
|
+
content_to_replace = unescapeContent(strip(content_to_replace));
|
|
1737
|
+
content_to_add = unescapeContent(strip(content_to_add));
|
|
1660
1738
|
const absolutePath = path11.resolve(process.cwd(), targetPath);
|
|
1661
1739
|
try {
|
|
1662
1740
|
if (!fs11.existsSync(absolutePath)) {
|
|
@@ -3300,7 +3378,7 @@ Check what's new using \`/changelog\` command.`,
|
|
|
3300
3378
|
flush();
|
|
3301
3379
|
const timer = setTimeout(() => {
|
|
3302
3380
|
process.exit(0);
|
|
3303
|
-
},
|
|
3381
|
+
}, 1700);
|
|
3304
3382
|
return () => clearTimeout(timer);
|
|
3305
3383
|
}
|
|
3306
3384
|
}, [activeView]);
|
|
@@ -3314,7 +3392,7 @@ Check what's new using \`/changelog\` command.`,
|
|
|
3314
3392
|
lastSavedTimeRef.current += deltaSecs * 1e3;
|
|
3315
3393
|
}
|
|
3316
3394
|
}
|
|
3317
|
-
},
|
|
3395
|
+
}, 1500);
|
|
3318
3396
|
return () => clearInterval(interval);
|
|
3319
3397
|
}, [isInitializing]);
|
|
3320
3398
|
const COMMANDS = [
|
|
@@ -4581,7 +4659,7 @@ var init_app = __esm({
|
|
|
4581
4659
|
init_setup();
|
|
4582
4660
|
SESSION_START_TIME = Date.now();
|
|
4583
4661
|
CHANGELOG_URL = "https://fluxflow-cli.onrender.com/changelog.html";
|
|
4584
|
-
versionFluxflow = "1.7.
|
|
4662
|
+
versionFluxflow = "1.7.6";
|
|
4585
4663
|
updatedOn = "2026-05-03";
|
|
4586
4664
|
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 (turn: finish) 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(
|
|
4587
4665
|
CommandMenu,
|