@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/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { E as EngineHook, C as CompactionStartInfo, a as CompactionDoneInfo, b as EventType, c as EngineErrorInfo, T as TurnEngine, P as ProviderClient, M as Mode } from './explore-COqHKDoK.cjs';
2
- export { A as ApprovalOutcome, d as Approver, e as CompactionTrigger, D as Decision, O as OpenAIProvider, f as PermissionEngine, g as PermissionRequest, h as TurnEngineOpts, W as WsEvent, r as registerExploreTool } from './explore-COqHKDoK.cjs';
1
+ import { E as EngineHook, C as CompactionStartInfo, a as CompactionDoneInfo, b as EventType, c as EngineErrorInfo, T as TurnEngine, P as ProviderClient, M as Mode } from './explore-BgRhj6SP.cjs';
2
+ export { A as ApprovalOutcome, d as Approver, e as CompactionTrigger, D as Decision, O as OpenAIProvider, f as PermissionEngine, g as PermissionRequest, h as TurnEngineOpts, W as WsEvent, r as registerExploreTool } from './explore-BgRhj6SP.cjs';
3
3
  import { a as TokenUsage, M as Message, T as ToolRegistry, R as ReasoningEffort } from './ToolRegistry-C3pTFiaJ.cjs';
4
4
  export { A as AssistantTurn, d as RiskClass, S as StreamChunk, e as ToolCall, b as ToolMetadata, c as ToolSchema, f as ToolSpec } from './ToolRegistry-C3pTFiaJ.cjs';
5
5
  export { registerFileTools, registerReadOnlyFileTools } from './tools/files.cjs';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { E as EngineHook, C as CompactionStartInfo, a as CompactionDoneInfo, b as EventType, c as EngineErrorInfo, T as TurnEngine, P as ProviderClient, M as Mode } from './explore-B_bIPzmB.js';
2
- export { A as ApprovalOutcome, d as Approver, e as CompactionTrigger, D as Decision, O as OpenAIProvider, f as PermissionEngine, g as PermissionRequest, h as TurnEngineOpts, W as WsEvent, r as registerExploreTool } from './explore-B_bIPzmB.js';
1
+ import { E as EngineHook, C as CompactionStartInfo, a as CompactionDoneInfo, b as EventType, c as EngineErrorInfo, T as TurnEngine, P as ProviderClient, M as Mode } from './explore-RtZtb-V6.js';
2
+ export { A as ApprovalOutcome, d as Approver, e as CompactionTrigger, D as Decision, O as OpenAIProvider, f as PermissionEngine, g as PermissionRequest, h as TurnEngineOpts, W as WsEvent, r as registerExploreTool } from './explore-RtZtb-V6.js';
3
3
  import { a as TokenUsage, M as Message, T as ToolRegistry, R as ReasoningEffort } from './ToolRegistry-C3pTFiaJ.js';
4
4
  export { A as AssistantTurn, d as RiskClass, S as StreamChunk, e as ToolCall, b as ToolMetadata, c as ToolSchema, f as ToolSpec } from './ToolRegistry-C3pTFiaJ.js';
5
5
  export { registerFileTools, registerReadOnlyFileTools } from './tools/files.js';
package/dist/index.js CHANGED
@@ -183,15 +183,27 @@ function networkErrorHints(message, errorType = "") {
183
183
  hints.push("\u2464 IPv6 \u6296\u52A8\u53EF\u8BD5\uFF1ANODE_OPTIONS=--dns-result-order=ipv4first");
184
184
  return hints;
185
185
  }
186
+ function authErrorHints(message, code = "") {
187
+ const text = `${message} ${code}`;
188
+ if (!/401|403|unauthorized|forbidden|invalid[_\s]*api[_\s]*key|api[\s_-]*key\s*(?:无效|invalid)|管理令牌无效/i.test(text)) {
189
+ return [];
190
+ }
191
+ return [
192
+ "\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"
193
+ ];
194
+ }
186
195
  function paramErrorHints(message, code = "") {
187
196
  const text = `${message} ${code}`;
188
197
  const hints = [];
189
- if (/not[_\s]*(activated|enabled|purchased)|arrearage|quota|subscription|insufficient|未开通|欠费|额度/i.test(
198
+ if (/not[_\s]*(activated|enabled|purchased)|arrearage|quota|subscription|insufficient|未开通|欠费|额度|余额不足/i.test(
190
199
  text
191
200
  )) {
192
201
  hints.push(
193
202
  "\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"
194
203
  );
204
+ hints.push(
205
+ "\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"
206
+ );
195
207
  }
196
208
  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(
197
209
  text
@@ -1381,6 +1393,21 @@ var TurnEngine = class _TurnEngine {
1381
1393
  queueSteering(text) {
1382
1394
  this._steering.push(text);
1383
1395
  }
1396
+ /**
1397
+ * 撤销一条尚未注入的 steering。
1398
+ *
1399
+ * 按文本删第一条匹配项:调用方(SessionManager)已按索引删掉了自己那份队列,
1400
+ * 这里只需保证引擎不再注入同样的内容。用文本而非索引,是因为引擎会在迭代
1401
+ * 间隙批量清空 `_steering`,索引可能已经漂移;文本相同则删哪条都等价。
1402
+ *
1403
+ * @returns 是否真的删掉了(已注入的项返回 false,调用方据此提示用户)
1404
+ */
1405
+ removeSteering(text) {
1406
+ const i = this._steering.indexOf(text);
1407
+ if (i < 0) return false;
1408
+ this._steering.splice(i, 1);
1409
+ return true;
1410
+ }
1384
1411
  // ===================== 主入口 =====================
1385
1412
  /**
1386
1413
  * 运行一轮 Turn
@@ -4407,6 +4434,9 @@ var ConsoleHook = class {
4407
4434
  for (const hint of networkErrorHints(error, errorType)) {
4408
4435
  cliLog(` \u{1F4A1} ${hint}`);
4409
4436
  }
4437
+ for (const hint of authErrorHints(error, errorType)) {
4438
+ cliLog(` \u{1F4A1} ${hint}`);
4439
+ }
4410
4440
  for (const hint of paramErrorHints(error)) {
4411
4441
  cliLog(` \u{1F4A1} ${hint}`);
4412
4442
  }