@fieldwangai/agentflow 0.1.107 → 0.1.110
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/bin/lib/agent-runners.mjs +15 -2
- package/bin/lib/model-config.mjs +6 -1
- package/builtin/web-ui/dist/assets/index-C3aw8qTz.js +348 -0
- package/builtin/web-ui/dist/assets/index-TQK269PM.css +1 -0
- package/builtin/web-ui/dist/index.html +2 -2
- package/package.json +1 -1
- package/builtin/web-ui/dist/assets/index-BZMWrBdo.css +0 -1
- package/builtin/web-ui/dist/assets/index-Ds1YW25U.js +0 -348
|
@@ -305,6 +305,17 @@ function codexFailureMessage(code, stderrTail, { flowName = "", uuid = "" } = {}
|
|
|
305
305
|
return `Codex CLI exited ${code}. ${tail || "No result event received."}${suffix}`;
|
|
306
306
|
}
|
|
307
307
|
|
|
308
|
+
export function summarizeCursorStderr(stderr, maxChars = 1200) {
|
|
309
|
+
const text = String(stderr || "").trim();
|
|
310
|
+
if (!text) return "";
|
|
311
|
+
const invalidModel = text.match(/Cannot use this model:\s*(.+?)(?:\.\s*Available models:|[\r\n]|$)/is);
|
|
312
|
+
if (invalidModel?.[1]) {
|
|
313
|
+
return `Cannot use this model: ${invalidModel[1].trim()}. Available models omitted; inspect the run log for the full list.`;
|
|
314
|
+
}
|
|
315
|
+
const limit = Math.max(1, Number(maxChars) || 1200);
|
|
316
|
+
return text.length <= limit ? text : text.slice(-limit);
|
|
317
|
+
}
|
|
318
|
+
|
|
308
319
|
/**
|
|
309
320
|
* Run Cursor CLI with stream-json, forward events to stdout, return success/failure.
|
|
310
321
|
*/
|
|
@@ -577,6 +588,7 @@ export function runCursorAgentForNode(
|
|
|
577
588
|
const stderr = Buffer.concat(stderrChunks).toString("utf-8");
|
|
578
589
|
const stderrTail = stderr ? stderr.trim().slice(-1200) : "";
|
|
579
590
|
if (retryCursorQuota(stderrTail)) return;
|
|
591
|
+
const stderrSummary = summarizeCursorStderr(stderr);
|
|
580
592
|
const autoOnly =
|
|
581
593
|
/named models unavailable/i.test(stderrTail) ||
|
|
582
594
|
(/free plans?/i.test(stderrTail) && /only use auto/i.test(stderrTail)) ||
|
|
@@ -594,7 +606,7 @@ export function runCursorAgentForNode(
|
|
|
594
606
|
flowName && uuid
|
|
595
607
|
? ` 检查 run 目录 logs/log.txt 查看完整 Cursor stderr;常见原因:未登录 Cursor、模型不可用、网络/权限。若无报错内容,可设置 AGENTFLOW_CURSOR_STDERR_INHERIT=1 后重跑,使 Cursor 的 stderr 直接输出到终端。`
|
|
596
608
|
: "";
|
|
597
|
-
const err = new Error(`Cursor CLI exited ${code}. ${
|
|
609
|
+
const err = new Error(`Cursor CLI exited ${code}. ${stderrSummary || "No result event received."}${logHint}`);
|
|
598
610
|
err.cursorStderrTail = stderrTail;
|
|
599
611
|
reject(err);
|
|
600
612
|
return;
|
|
@@ -1525,7 +1537,8 @@ export function runCursorAgentWithPrompt(cliWorkspace, promptText, options = {})
|
|
|
1525
1537
|
const stderr = Buffer.concat(stderrChunks).toString("utf-8");
|
|
1526
1538
|
const stderrTail = stderr ? stderr.trim().slice(-1200) : "";
|
|
1527
1539
|
if (retryCursorQuota(stderrTail)) return;
|
|
1528
|
-
const
|
|
1540
|
+
const stderrSummary = summarizeCursorStderr(stderr);
|
|
1541
|
+
const err = new Error(`Cursor CLI exited ${code}. ${stderrSummary || "No result event received."}`);
|
|
1529
1542
|
err.cursorStderrTail = stderrTail;
|
|
1530
1543
|
emit({ type: "status", line: truncateComposerLine(err.message) });
|
|
1531
1544
|
reject(err);
|
package/bin/lib/model-config.mjs
CHANGED
|
@@ -5,11 +5,16 @@ import { LEGACY_MODEL_CONFIG_REL, MODEL_CONFIG_REL } from "./paths.mjs";
|
|
|
5
5
|
|
|
6
6
|
const modelConfigCache = new Map();
|
|
7
7
|
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* UI 格式为「模型 ID - 描述」,传参只用前面的模型 ID。
|
|
10
|
+
* Workspace 的统一模型选择器会为 Cursor 值加上 `cursor:` 后端标识;
|
|
11
|
+
* 调用 Cursor CLI 前必须移除该标识。若为 "auto" 则规范为 Cursor 可识别的 "Auto"。
|
|
12
|
+
*/
|
|
9
13
|
export function normalizeCursorModelForCli(value) {
|
|
10
14
|
if (value == null || value === false || value === "") return "Auto";
|
|
11
15
|
let s = String(value).trim();
|
|
12
16
|
if (!s) return "Auto";
|
|
17
|
+
s = s.replace(/^cursor\s*:\s*/i, "").trim();
|
|
13
18
|
const dashIdx = s.indexOf(" - ");
|
|
14
19
|
if (dashIdx >= 0) s = s.slice(0, dashIdx).trim();
|
|
15
20
|
if (!s) return "Auto";
|