fluxflow-cli 1.18.14 → 1.18.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 +135 -96
  2. package/package.json +1 -1
package/dist/fluxflow.js CHANGED
@@ -1033,15 +1033,27 @@ var init_arg_parser = __esm({
1033
1033
  while (searchIndex < argsString.length) {
1034
1034
  let qIdx = argsString.indexOf(quote, searchIndex);
1035
1035
  if (qIdx === -1) break;
1036
- if (argsString[qIdx - 1] === "\\" && argsString[qIdx - 2] !== "\\") {
1036
+ let backslashCount = 0;
1037
+ for (let k = qIdx - 1; k >= 0 && argsString[k] === "\\"; k--) {
1038
+ backslashCount++;
1039
+ }
1040
+ if (backslashCount % 2 !== 0) {
1037
1041
  searchIndex = qIdx + 1;
1038
1042
  continue;
1039
1043
  }
1040
- const after = argsString.substring(qIdx + 1).trim();
1044
+ const afterRaw = argsString.substring(qIdx + 1);
1045
+ const after = afterRaw.trim();
1041
1046
  const isLogicalEnd = after === "" || // End of entire string
1042
1047
  after.startsWith(",") || // Next argument separator
1043
1048
  /^(\w+)\s*=/.test(after) || // Next argument key=
1044
1049
  after.startsWith(")") && (after.length === 1 || /^\)\s*([,\]\s]|tool:)/i.test(after));
1050
+ if (isLogicalEnd && afterRaw.startsWith("\n")) {
1051
+ const nextLine = after.split("\n")[0];
1052
+ if (!nextLine.includes("=") && !nextLine.includes(")")) {
1053
+ searchIndex = qIdx + 1;
1054
+ continue;
1055
+ }
1056
+ }
1045
1057
  if (isLogicalEnd) {
1046
1058
  end = qIdx;
1047
1059
  break;
@@ -1056,18 +1068,21 @@ var init_arg_parser = __esm({
1056
1068
  i = argsString.length;
1057
1069
  }
1058
1070
  const isPathKey = key.toLowerCase().includes("path") || ["dest", "source", "to", "from"].includes(key.toLowerCase());
1059
- if (isPathKey) {
1060
- value = value.replace(/\\"/g, '"').replace(/\\'/g, "'").replace(/\\`/g, "`").replace(/\\\\/g, "\\");
1061
- } else {
1062
- try {
1063
- if (value.includes("\\")) {
1064
- const surgicalValue = value.replace(/(^|[^\\])"/g, '$1\\"');
1065
- value = JSON.parse(`"${surgicalValue.replace(/\n/g, "\\n").replace(/\r/g, "\\r")}"`);
1066
- }
1067
- } catch (e) {
1068
- value = value.replace(/\\"/g, '"').replace(/\\'/g, "'").replace(/\\`/g, "`").replace(/\\\\/g, "\\").replace(/\\n/g, "\n");
1071
+ value = value.replace(/\\(.)/g, (match, char) => {
1072
+ switch (char) {
1073
+ case "n":
1074
+ return "\n";
1075
+ case "r":
1076
+ return "\r";
1077
+ case "t":
1078
+ return " ";
1079
+ case "\\":
1080
+ return "\\";
1081
+ default:
1082
+ if (char === quote) return quote;
1083
+ return match;
1069
1084
  }
1070
- }
1085
+ });
1071
1086
  } else if (i < argsString.length && argsString[i] === "[") {
1072
1087
  let balance = 0;
1073
1088
  let inString = null;
@@ -1075,10 +1090,16 @@ var init_arg_parser = __esm({
1075
1090
  let end = -1;
1076
1091
  for (let j = i; j < argsString.length; j++) {
1077
1092
  const char = argsString[j];
1078
- if (!inString && (char === '"' || char === "'" || char === "`")) {
1093
+ if (inString && char === inString) {
1094
+ let backslashCount = 0;
1095
+ for (let k = j - 1; k >= 0 && argsString[k] === "\\"; k--) {
1096
+ backslashCount++;
1097
+ }
1098
+ if (backslashCount % 2 === 0) {
1099
+ inString = null;
1100
+ }
1101
+ } else if (!inString && (char === '"' || char === "'" || char === "`")) {
1079
1102
  inString = char;
1080
- } else if (inString && char === inString && argsString[j - 1] !== "\\") {
1081
- inString = null;
1082
1103
  }
1083
1104
  if (!inString) {
1084
1105
  if (char === "[") balance++;
@@ -1152,8 +1173,8 @@ STRICT POLICY
1152
1173
  Suggest best options; don't ask for preferences
1153
1174
 
1154
1175
  - WEB TOOLS -
1155
- 1. [tool:functions.WebSearch(query="...", limit=number)]. Limit 3-10. Proactive use for unknown topics${mode === "Flux" ? " or docs" : ""}
1156
- 2. [tool:functions.WebScrape(url="...")]. Visit URL
1176
+ 1. [tool:functions.WebSearch(query="...", limit=number)]. Limit 3-10. Proactive use for unknown topics
1177
+ 2. [tool:functions.WebScrape(url="...")]. Proactive use for specific webpage/docs/api
1157
1178
 
1158
1179
  ${mode === "Flux" ? `- PROJECT TOOLS (path = relative to CWD) -
1159
1180
  1. [tool:functions.ReadFile(path="...", startLine=number, endLine=number)]. Supports images/docs. User gives image/doc: VIEW FIRST
@@ -5106,30 +5127,36 @@ ${originalTextProcessed.length > USER_CONTEXT_LENGTH ? "... (truncated) ...\n\n"
5106
5127
  const startIdx = match.index + match[0].length - 1;
5107
5128
  let balance = 0;
5108
5129
  let inString = null;
5109
- let isEscaped = false;
5110
5130
  let endIdx = -1;
5111
5131
  for (let i = startIdx; i < text.length; i++) {
5112
5132
  const char = text[i];
5113
- if (!inString && (char === '"' || char === "'" || char === "`")) {
5114
- inString = char;
5115
- isEscaped = false;
5116
- } else if (inString && char === inString && !isEscaped) {
5117
- inString = null;
5118
- }
5119
- if (!inString) {
5120
- if (char === "(") balance++;
5121
- else if (char === ")") balance--;
5122
- if (balance === 0) {
5123
- let j = i + 1;
5124
- while (j < text.length && /\s/.test(text[j])) j++;
5125
- if (j < text.length && text[j] === "]") {
5126
- endIdx = j;
5127
- break;
5133
+ if (inString) {
5134
+ if (char === inString) {
5135
+ let backslashCount = 0;
5136
+ for (let j = i - 1; j >= 0 && text[j] === "\\"; j--) {
5137
+ backslashCount++;
5138
+ }
5139
+ if (backslashCount % 2 === 0) {
5140
+ inString = null;
5141
+ }
5142
+ }
5143
+ } else {
5144
+ if (char === '"' || char === "'" || char === "`") {
5145
+ inString = char;
5146
+ } else if (char === "(") {
5147
+ balance++;
5148
+ } else if (char === ")") {
5149
+ balance--;
5150
+ if (balance === 0) {
5151
+ let j = i + 1;
5152
+ while (j < text.length && /\s/.test(text[j])) j++;
5153
+ if (j < text.length && text[j] === "]") {
5154
+ endIdx = j;
5155
+ break;
5156
+ }
5128
5157
  }
5129
5158
  }
5130
5159
  }
5131
- if (char === "\\") isEscaped = !isEscaped;
5132
- else isEscaped = false;
5133
5160
  }
5134
5161
  if (endIdx !== -1) {
5135
5162
  result += "[tool:functions." + match[1] + "()]";
@@ -5157,30 +5184,36 @@ ${originalTextProcessed.length > USER_CONTEXT_LENGTH ? "... (truncated) ...\n\n"
5157
5184
  const startIdx = match.index + match[0].length - 1;
5158
5185
  let balance = 0;
5159
5186
  let inString = null;
5160
- let isEscaped = false;
5161
5187
  let endIdx = -1;
5162
5188
  for (let i = startIdx; i < text.length; i++) {
5163
5189
  const char = text[i];
5164
- if (!inString && (char === '"' || char === "'" || char === "`")) {
5165
- inString = char;
5166
- isEscaped = false;
5167
- } else if (inString && char === inString && !isEscaped) {
5168
- inString = null;
5169
- }
5170
- if (!inString) {
5171
- if (char === "(") balance++;
5172
- else if (char === ")") balance--;
5173
- if (balance === 0) {
5174
- let j = i + 1;
5175
- while (j < text.length && /\s/.test(text[j])) j++;
5176
- if (j < text.length && text[j] === "]") {
5177
- endIdx = j;
5178
- break;
5190
+ if (inString) {
5191
+ if (char === inString) {
5192
+ let backslashCount = 0;
5193
+ for (let j = i - 1; j >= 0 && text[j] === "\\"; j--) {
5194
+ backslashCount++;
5195
+ }
5196
+ if (backslashCount % 2 === 0) {
5197
+ inString = null;
5198
+ }
5199
+ }
5200
+ } else {
5201
+ if (char === '"' || char === "'" || char === "`") {
5202
+ inString = char;
5203
+ } else if (char === "(") {
5204
+ balance++;
5205
+ } else if (char === ")") {
5206
+ balance--;
5207
+ if (balance === 0) {
5208
+ let j = i + 1;
5209
+ while (j < text.length && /\s/.test(text[j])) j++;
5210
+ if (j < text.length && text[j] === "]") {
5211
+ endIdx = j;
5212
+ break;
5213
+ }
5179
5214
  }
5180
5215
  }
5181
5216
  }
5182
- if (char === "\\") isEscaped = !isEscaped;
5183
- else isEscaped = false;
5184
5217
  }
5185
5218
  if (endIdx !== -1) {
5186
5219
  result += text.substring(match.index, endIdx + 1);
@@ -5209,34 +5242,37 @@ ${originalTextProcessed.length > USER_CONTEXT_LENGTH ? "... (truncated) ...\n\n"
5209
5242
  const startIdx = match.index + match[0].length - 1;
5210
5243
  let balance = 0;
5211
5244
  let inString = null;
5212
- let isEscaped = false;
5213
5245
  let endIdx = -1;
5214
5246
  let closingParenIdx = -1;
5215
5247
  for (let i = startIdx; i < text.length; i++) {
5216
5248
  const char = text[i];
5217
- if (!inString && (char === '"' || char === "'" || char === "`")) {
5218
- inString = char;
5219
- isEscaped = false;
5220
- } else if (inString && char === inString && !isEscaped) {
5221
- inString = null;
5222
- }
5223
- if (!inString) {
5224
- if (char === "(") balance++;
5225
- else if (char === ")") balance--;
5226
- if (balance === 0) {
5227
- closingParenIdx = i;
5228
- let j = i + 1;
5229
- while (j < text.length && /\s/.test(text[j])) j++;
5230
- if (j < text.length && text[j] === "]") {
5231
- endIdx = j;
5232
- break;
5249
+ if (inString) {
5250
+ if (char === inString) {
5251
+ let backslashCount = 0;
5252
+ for (let j = i - 1; j >= 0 && text[j] === "\\"; j--) {
5253
+ backslashCount++;
5254
+ }
5255
+ if (backslashCount % 2 === 0) {
5256
+ inString = null;
5233
5257
  }
5234
5258
  }
5235
- }
5236
- if (char === "\\") {
5237
- isEscaped = !isEscaped;
5238
5259
  } else {
5239
- isEscaped = false;
5260
+ if (char === '"' || char === "'" || char === "`") {
5261
+ inString = char;
5262
+ } else if (char === "(") {
5263
+ balance++;
5264
+ } else if (char === ")") {
5265
+ balance--;
5266
+ if (balance === 0) {
5267
+ closingParenIdx = i;
5268
+ let j = i + 1;
5269
+ while (j < text.length && /\s/.test(text[j])) j++;
5270
+ if (j < text.length && text[j] === "]") {
5271
+ endIdx = j;
5272
+ break;
5273
+ }
5274
+ }
5275
+ }
5240
5276
  }
5241
5277
  }
5242
5278
  if (endIdx !== -1) {
@@ -9355,34 +9391,37 @@ var init_app = __esm({
9355
9391
  const startIdx = match.index + match[0].length - 1;
9356
9392
  let balance = 0;
9357
9393
  let inString = null;
9358
- let isEscaped = false;
9359
9394
  let endIdx = -1;
9360
9395
  let closingParenIdx = -1;
9361
9396
  for (let i = startIdx; i < text.length; i++) {
9362
9397
  const char = text[i];
9363
- if (!inString && (char === '"' || char === "'" || char === "`")) {
9364
- inString = char;
9365
- isEscaped = false;
9366
- } else if (inString && char === inString && !isEscaped) {
9367
- inString = null;
9368
- }
9369
- if (!inString) {
9370
- if (char === "(") balance++;
9371
- else if (char === ")") balance--;
9372
- if (balance === 0) {
9373
- closingParenIdx = i;
9374
- let j = i + 1;
9375
- while (j < text.length && /\s/.test(text[j])) j++;
9376
- if (j < text.length && text[j] === "]") {
9377
- endIdx = j;
9378
- break;
9398
+ if (inString) {
9399
+ if (char === inString) {
9400
+ let backslashCount = 0;
9401
+ for (let j = i - 1; j >= 0 && text[j] === "\\"; j--) {
9402
+ backslashCount++;
9403
+ }
9404
+ if (backslashCount % 2 === 0) {
9405
+ inString = null;
9379
9406
  }
9380
9407
  }
9381
- }
9382
- if (char === "\\") {
9383
- isEscaped = !isEscaped;
9384
9408
  } else {
9385
- isEscaped = false;
9409
+ if (char === '"' || char === "'" || char === "`") {
9410
+ inString = char;
9411
+ } else if (char === "(") {
9412
+ balance++;
9413
+ } else if (char === ")") {
9414
+ balance--;
9415
+ if (balance === 0) {
9416
+ closingParenIdx = i;
9417
+ let j = i + 1;
9418
+ while (j < text.length && /\s/.test(text[j])) j++;
9419
+ if (j < text.length && text[j] === "]") {
9420
+ endIdx = j;
9421
+ break;
9422
+ }
9423
+ }
9424
+ }
9386
9425
  }
9387
9426
  }
9388
9427
  if (endIdx !== -1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluxflow-cli",
3
- "version": "1.18.14",
3
+ "version": "1.18.16",
4
4
  "date": "2026-06-01",
5
5
  "description": "A high-fidelity agentic terminal assistant for the Flux Era.",
6
6
  "keywords": [