@zqagent/core 0.2.15 → 0.2.20
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/README.oss.en.md +13 -0
- package/README.oss.md +11 -0
- package/README.oss.zh-TW.md +11 -0
- package/dist/cli/index.cjs +1832 -130
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.js +1833 -131
- package/dist/cli/index.js.map +1 -1
- package/dist/{explore-COqHKDoK.d.cts → explore-BgRhj6SP.d.cts} +10 -0
- package/dist/{explore-B_bIPzmB.d.ts → explore-RtZtb-V6.d.ts} +10 -0
- package/dist/index.cjs +31 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +31 -1
- package/dist/index.js.map +1 -1
- package/dist/server/index.cjs +1766 -105
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.js +1772 -111
- package/dist/server/index.js.map +1 -1
- package/dist/tools/explore.cjs +15 -0
- package/dist/tools/explore.cjs.map +1 -1
- package/dist/tools/explore.d.cts +1 -1
- package/dist/tools/explore.d.ts +1 -1
- package/dist/tools/explore.js +15 -0
- package/dist/tools/explore.js.map +1 -1
- package/package.json +1 -1
|
@@ -609,6 +609,16 @@ declare class TurnEngine {
|
|
|
609
609
|
setSystemPrompt(prompt: string): void;
|
|
610
610
|
/** 排队 steering 消息(下一迭代间隙注入为 user 消息) */
|
|
611
611
|
queueSteering(text: string): void;
|
|
612
|
+
/**
|
|
613
|
+
* 撤销一条尚未注入的 steering。
|
|
614
|
+
*
|
|
615
|
+
* 按文本删第一条匹配项:调用方(SessionManager)已按索引删掉了自己那份队列,
|
|
616
|
+
* 这里只需保证引擎不再注入同样的内容。用文本而非索引,是因为引擎会在迭代
|
|
617
|
+
* 间隙批量清空 `_steering`,索引可能已经漂移;文本相同则删哪条都等价。
|
|
618
|
+
*
|
|
619
|
+
* @returns 是否真的删掉了(已注入的项返回 false,调用方据此提示用户)
|
|
620
|
+
*/
|
|
621
|
+
removeSteering(text: string): boolean;
|
|
612
622
|
/**
|
|
613
623
|
* 运行一轮 Turn
|
|
614
624
|
*
|
|
@@ -609,6 +609,16 @@ declare class TurnEngine {
|
|
|
609
609
|
setSystemPrompt(prompt: string): void;
|
|
610
610
|
/** 排队 steering 消息(下一迭代间隙注入为 user 消息) */
|
|
611
611
|
queueSteering(text: string): void;
|
|
612
|
+
/**
|
|
613
|
+
* 撤销一条尚未注入的 steering。
|
|
614
|
+
*
|
|
615
|
+
* 按文本删第一条匹配项:调用方(SessionManager)已按索引删掉了自己那份队列,
|
|
616
|
+
* 这里只需保证引擎不再注入同样的内容。用文本而非索引,是因为引擎会在迭代
|
|
617
|
+
* 间隙批量清空 `_steering`,索引可能已经漂移;文本相同则删哪条都等价。
|
|
618
|
+
*
|
|
619
|
+
* @returns 是否真的删掉了(已注入的项返回 false,调用方据此提示用户)
|
|
620
|
+
*/
|
|
621
|
+
removeSteering(text: string): boolean;
|
|
612
622
|
/**
|
|
613
623
|
* 运行一轮 Turn
|
|
614
624
|
*
|
package/dist/index.cjs
CHANGED
|
@@ -266,15 +266,27 @@ function networkErrorHints(message, errorType = "") {
|
|
|
266
266
|
hints.push("\u2464 IPv6 \u6296\u52A8\u53EF\u8BD5\uFF1ANODE_OPTIONS=--dns-result-order=ipv4first");
|
|
267
267
|
return hints;
|
|
268
268
|
}
|
|
269
|
+
function authErrorHints(message, code = "") {
|
|
270
|
+
const text = `${message} ${code}`;
|
|
271
|
+
if (!/401|403|unauthorized|forbidden|invalid[_\s]*api[_\s]*key|api[\s_-]*key\s*(?:无效|invalid)|管理令牌无效/i.test(text)) {
|
|
272
|
+
return [];
|
|
273
|
+
}
|
|
274
|
+
return [
|
|
275
|
+
"\u51ED\u636E\u65E0\u6548\uFF1A\u82E5\u7528\u7684\u662F\u300C\u5FD7\u524D\u5927\u6A21\u578B\uFF08\u5185\u7F6E\uFF09\u300D\uFF0C\u5728\u8282\u70B9\u8BBE\u7F6E\u7684\u6A21\u578B\u9875\u70B9\u300C\u5237\u65B0\u5185\u7F6E\u6A21\u578B\u300D\u91CD\u65B0\u9886\u53D6 Key\uFF08\u5728\u63A7\u5236\u53F0\u91CD\u7F6E\u8FC7 Key \u540E\u9700\u8981\u8FD9\u4E00\u6B65\uFF09\uFF1B\u82E5\u662F\u81EA\u586B\u7684\u4F9B\u5E94\u5546\uFF0C\u8BF7\u68C0\u67E5 Key \u662F\u5426\u6B63\u786E\u6216\u5DF2\u8FC7\u671F"
|
|
276
|
+
];
|
|
277
|
+
}
|
|
269
278
|
function paramErrorHints(message, code = "") {
|
|
270
279
|
const text = `${message} ${code}`;
|
|
271
280
|
const hints = [];
|
|
272
|
-
if (/not[_\s]*(activated|enabled|purchased)|arrearage|quota|subscription|insufficient
|
|
281
|
+
if (/not[_\s]*(activated|enabled|purchased)|arrearage|quota|subscription|insufficient|未开通|欠费|额度|余额不足/i.test(
|
|
273
282
|
text
|
|
274
283
|
)) {
|
|
275
284
|
hints.push(
|
|
276
285
|
"\u8BE5\u6A21\u578B\u5728\u6B64 **API Key/\u8D26\u53F7** \u4E0B\u672A\u5F00\u901A\uFF08\u6216\u8D26\u53F7\u6B20\u8D39\u3001\u989D\u5EA6\u7528\u5C3D\uFF09\uFF1A\u5230\u7F51\u5173\u63A7\u5236\u53F0\u5F00\u901A\u8BE5\u6A21\u578B\uFF0C\u6216\u6362\u4E00\u4E2A\u5DF2\u5F00\u901A\u7684\u6A21\u578B"
|
|
277
286
|
);
|
|
287
|
+
hints.push(
|
|
288
|
+
"\u5982\u679C\u4F60\u7528\u7684\u662F\u300C\u5FD7\u524D\u5927\u6A21\u578B\uFF08\u5185\u7F6E\uFF09\u300D\uFF1A\u5230 https://hub.cd-zq.com \u67E5\u770B\u4F59\u989D\u5E76\u5145\u503C\uFF1B\u4E5F\u53EF\u4EE5\u5148\u5207\u6362\u5230\u4F60\u81EA\u5DF1\u914D\u7F6E\u7684\u5176\u5B83\u6A21\u578B\u7EE7\u7EED\uFF08\u8282\u70B9\u8BBE\u7F6E \u2192 \u6A21\u578B \u2192 \u8BBE\u4E3A\u9ED8\u8BA4\uFF09"
|
|
289
|
+
);
|
|
278
290
|
}
|
|
279
291
|
if (/invalid[_\s]*parameter|invalidparameter|required[_\s]+parameter|missing[_\s]+parameter|invalid[_\s]*model|model[_\s]*not[_\s]*found|not[_\s]*support|unsupported/i.test(
|
|
280
292
|
text
|
|
@@ -1464,6 +1476,21 @@ var TurnEngine = class _TurnEngine {
|
|
|
1464
1476
|
queueSteering(text) {
|
|
1465
1477
|
this._steering.push(text);
|
|
1466
1478
|
}
|
|
1479
|
+
/**
|
|
1480
|
+
* 撤销一条尚未注入的 steering。
|
|
1481
|
+
*
|
|
1482
|
+
* 按文本删第一条匹配项:调用方(SessionManager)已按索引删掉了自己那份队列,
|
|
1483
|
+
* 这里只需保证引擎不再注入同样的内容。用文本而非索引,是因为引擎会在迭代
|
|
1484
|
+
* 间隙批量清空 `_steering`,索引可能已经漂移;文本相同则删哪条都等价。
|
|
1485
|
+
*
|
|
1486
|
+
* @returns 是否真的删掉了(已注入的项返回 false,调用方据此提示用户)
|
|
1487
|
+
*/
|
|
1488
|
+
removeSteering(text) {
|
|
1489
|
+
const i = this._steering.indexOf(text);
|
|
1490
|
+
if (i < 0) return false;
|
|
1491
|
+
this._steering.splice(i, 1);
|
|
1492
|
+
return true;
|
|
1493
|
+
}
|
|
1467
1494
|
// ===================== 主入口 =====================
|
|
1468
1495
|
/**
|
|
1469
1496
|
* 运行一轮 Turn
|
|
@@ -4490,6 +4517,9 @@ var ConsoleHook = class {
|
|
|
4490
4517
|
for (const hint of networkErrorHints(error, errorType)) {
|
|
4491
4518
|
cliLog(` \u{1F4A1} ${hint}`);
|
|
4492
4519
|
}
|
|
4520
|
+
for (const hint of authErrorHints(error, errorType)) {
|
|
4521
|
+
cliLog(` \u{1F4A1} ${hint}`);
|
|
4522
|
+
}
|
|
4493
4523
|
for (const hint of paramErrorHints(error)) {
|
|
4494
4524
|
cliLog(` \u{1F4A1} ${hint}`);
|
|
4495
4525
|
}
|