@zqagent/core 0.3.12 → 0.3.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 (43) hide show
  1. package/dist/{TurnEngine-BU4R7q_0.d.ts → TurnEngine-C8qqbilC.d.ts} +29 -3
  2. package/dist/{TurnEngine-BSciNywD.d.cts → TurnEngine-DKSczYaA.d.cts} +29 -3
  3. package/dist/{conflictGuard-BBOOIxxK.d.cts → conflictGuard-BuICnWEI.d.cts} +8 -0
  4. package/dist/{conflictGuard-BBOOIxxK.d.ts → conflictGuard-BuICnWEI.d.ts} +8 -0
  5. package/dist/index.cjs +3364 -1107
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +221 -6
  8. package/dist/index.d.ts +221 -6
  9. package/dist/index.js +3414 -1157
  10. package/dist/index.js.map +1 -1
  11. package/dist/internal/engine/FileLogHook.d.cts +1 -1
  12. package/dist/internal/engine/FileLogHook.d.ts +1 -1
  13. package/dist/internal/llmConfig.cjs +15 -5
  14. package/dist/internal/llmConfig.cjs.map +1 -1
  15. package/dist/internal/llmConfig.d.cts +17 -1
  16. package/dist/internal/llmConfig.d.ts +17 -1
  17. package/dist/internal/llmConfig.js +15 -5
  18. package/dist/internal/llmConfig.js.map +1 -1
  19. package/dist/internal/update/controller.cjs +1 -1
  20. package/dist/internal/update/controller.js +1 -1
  21. package/dist/internal/update/platform.cjs +1 -1
  22. package/dist/internal/update/platform.js +1 -1
  23. package/dist/tools/diff.d.cts +1 -1
  24. package/dist/tools/diff.d.ts +1 -1
  25. package/dist/tools/explore.cjs +504 -127
  26. package/dist/tools/explore.cjs.map +1 -1
  27. package/dist/tools/explore.d.cts +1 -1
  28. package/dist/tools/explore.d.ts +1 -1
  29. package/dist/tools/explore.js +504 -127
  30. package/dist/tools/explore.js.map +1 -1
  31. package/dist/tools/files.cjs +267 -47
  32. package/dist/tools/files.cjs.map +1 -1
  33. package/dist/tools/files.d.cts +1 -1
  34. package/dist/tools/files.d.ts +1 -1
  35. package/dist/tools/files.js +267 -47
  36. package/dist/tools/files.js.map +1 -1
  37. package/dist/tools/search.cjs +103 -24
  38. package/dist/tools/search.cjs.map +1 -1
  39. package/dist/tools/search.d.cts +8 -2
  40. package/dist/tools/search.d.ts +8 -2
  41. package/dist/tools/search.js +103 -24
  42. package/dist/tools/search.js.map +1 -1
  43. package/package.json +6 -5
@@ -353,6 +353,17 @@ declare class OpenAIProvider implements ProviderClient {
353
353
  */
354
354
  private _apiMode;
355
355
  constructor(opts: {
356
+ /**
357
+ * API Key。
358
+ *
359
+ * - 显式 `""`(含纯空白):**明确表示该端点不需要鉴权**(本地 Ollama /
360
+ * llama.cpp、内网网关),不会回落到环境变量,SDK 收到占位 Key。
361
+ * - `undefined`:回落到 `OPENAI_API_KEY`;两者都没有时抛错(多数情况是
362
+ * 真的没配,早点给出可读提示好过让用户对着 401 猜)。
363
+ *
364
+ * 调用方不要用「配置里 Key 为空」来推断无需鉴权:那也可能只是还没填,
365
+ * 见 `LlmProviderEntry.noApiKey`。
366
+ */
356
367
  apiKey?: string;
357
368
  baseURL?: string;
358
369
  /** LLM 请求日志根目录,按日期分目录,不传则不记录 */
@@ -570,6 +581,17 @@ interface CompactionState {
570
581
  * 外部通过消费生成器产出的事件流来渲染实时进度、执行审批等。
571
582
  */
572
583
 
584
+ /** 待注入的 steering 项(文本 + 可选的附件) */
585
+ /**
586
+ * 一轮 / 一条用户消息的发起人(控制面用户)。
587
+ *
588
+ * 设备被共享时,同一会话里会有多个账号发起的任务;节点本地直连、桌面端与
589
+ * 未接入控制面的场景没有这个信息,此时为 undefined。
590
+ */
591
+ interface TurnActor {
592
+ /** 控制面用户 id */
593
+ id: string;
594
+ }
573
595
  /** TurnEngine 构造参数 */
574
596
  interface TurnEngineOpts {
575
597
  /** LLM Provider(流式调用) */
@@ -664,6 +686,8 @@ declare class TurnEngine {
664
686
  private _lastContextTokens;
665
687
  /** 压缩无进展时的消息条数快照;-1 表示无冷却 */
666
688
  private _compactStalledAt;
689
+ /** 溢出兜底:已 400 时无条件淘汰旧工具结果(下一次成功调用后复位) */
690
+ private _overflowElide;
667
691
  /** 显式配置的上下文窗口大小(token 数),未设置时为 undefined(走自动检测) */
668
692
  private _contextWindow;
669
693
  /** 压缩触发阈值比例(默认 0.8) */
@@ -716,7 +740,7 @@ declare class TurnEngine {
716
740
  */
717
741
  private _routeAttachments;
718
742
  /** 排队 steering 消息(下一迭代间隙注入为 user 消息) */
719
- queueSteering(text: string, attachments?: MessageAttachment[], attachmentRefs?: StoredAttachment[]): void;
743
+ queueSteering(text: string, attachments?: MessageAttachment[], attachmentRefs?: StoredAttachment[], actor?: TurnActor): void;
720
744
  /**
721
745
  * 撤销一条尚未注入的 steering。
722
746
  *
@@ -735,7 +759,9 @@ declare class TurnEngine {
735
759
  */
736
760
  run(userInput: string, taskId?: string, attachments?: MessageAttachment[],
737
761
  /** 附件落盘引用(由会话层先存盘再传入):消息与事件只带它,不带 base64 */
738
- attachmentRefs?: StoredAttachment[]): AsyncGenerator<WsEvent>;
762
+ attachmentRefs?: StoredAttachment[],
763
+ /** 发起人(控制面用户):设备共享时用于区分是谁发起的本轮 */
764
+ actor?: TurnActor): AsyncGenerator<WsEvent>;
739
765
  /** 重试 (仅在 Provider 错误后可用) */
740
766
  retry(): AsyncGenerator<WsEvent>;
741
767
  /** 从持久化的挂起点恢复 Turn (对齐 Python 版 resume) */
@@ -844,4 +870,4 @@ declare class TurnEngine {
844
870
  private _scanRecentFiles;
845
871
  }
846
872
 
847
- export { ApprovalOutcome as A, type CompactionStartInfo as C, type Decision as D, type EngineHook as E, Mode as M, OpenAIProvider as O, type ProviderClient as P, type ShellPolicy as S, TurnEngine as T, type WsEvent as W, type CompactionDoneInfo as a, EventType as b, type EngineErrorInfo as c, type Approver as d, type CompactionTrigger as e, PermissionEngine as f, type PermissionRequest as g, type ShellSandboxStatus as h, type TurnEngineOpts as i };
873
+ export { ApprovalOutcome as A, type CompactionStartInfo as C, type Decision as D, type EngineHook as E, Mode as M, OpenAIProvider as O, type ProviderClient as P, type ShellPolicy as S, TurnEngine as T, type WsEvent as W, type CompactionDoneInfo as a, EventType as b, type EngineErrorInfo as c, type Approver as d, type CompactionTrigger as e, PermissionEngine as f, type PermissionRequest as g, type ShellSandboxStatus as h, type TurnActor as i, type TurnEngineOpts as j };
@@ -353,6 +353,17 @@ declare class OpenAIProvider implements ProviderClient {
353
353
  */
354
354
  private _apiMode;
355
355
  constructor(opts: {
356
+ /**
357
+ * API Key。
358
+ *
359
+ * - 显式 `""`(含纯空白):**明确表示该端点不需要鉴权**(本地 Ollama /
360
+ * llama.cpp、内网网关),不会回落到环境变量,SDK 收到占位 Key。
361
+ * - `undefined`:回落到 `OPENAI_API_KEY`;两者都没有时抛错(多数情况是
362
+ * 真的没配,早点给出可读提示好过让用户对着 401 猜)。
363
+ *
364
+ * 调用方不要用「配置里 Key 为空」来推断无需鉴权:那也可能只是还没填,
365
+ * 见 `LlmProviderEntry.noApiKey`。
366
+ */
356
367
  apiKey?: string;
357
368
  baseURL?: string;
358
369
  /** LLM 请求日志根目录,按日期分目录,不传则不记录 */
@@ -570,6 +581,17 @@ interface CompactionState {
570
581
  * 外部通过消费生成器产出的事件流来渲染实时进度、执行审批等。
571
582
  */
572
583
 
584
+ /** 待注入的 steering 项(文本 + 可选的附件) */
585
+ /**
586
+ * 一轮 / 一条用户消息的发起人(控制面用户)。
587
+ *
588
+ * 设备被共享时,同一会话里会有多个账号发起的任务;节点本地直连、桌面端与
589
+ * 未接入控制面的场景没有这个信息,此时为 undefined。
590
+ */
591
+ interface TurnActor {
592
+ /** 控制面用户 id */
593
+ id: string;
594
+ }
573
595
  /** TurnEngine 构造参数 */
574
596
  interface TurnEngineOpts {
575
597
  /** LLM Provider(流式调用) */
@@ -664,6 +686,8 @@ declare class TurnEngine {
664
686
  private _lastContextTokens;
665
687
  /** 压缩无进展时的消息条数快照;-1 表示无冷却 */
666
688
  private _compactStalledAt;
689
+ /** 溢出兜底:已 400 时无条件淘汰旧工具结果(下一次成功调用后复位) */
690
+ private _overflowElide;
667
691
  /** 显式配置的上下文窗口大小(token 数),未设置时为 undefined(走自动检测) */
668
692
  private _contextWindow;
669
693
  /** 压缩触发阈值比例(默认 0.8) */
@@ -716,7 +740,7 @@ declare class TurnEngine {
716
740
  */
717
741
  private _routeAttachments;
718
742
  /** 排队 steering 消息(下一迭代间隙注入为 user 消息) */
719
- queueSteering(text: string, attachments?: MessageAttachment[], attachmentRefs?: StoredAttachment[]): void;
743
+ queueSteering(text: string, attachments?: MessageAttachment[], attachmentRefs?: StoredAttachment[], actor?: TurnActor): void;
720
744
  /**
721
745
  * 撤销一条尚未注入的 steering。
722
746
  *
@@ -735,7 +759,9 @@ declare class TurnEngine {
735
759
  */
736
760
  run(userInput: string, taskId?: string, attachments?: MessageAttachment[],
737
761
  /** 附件落盘引用(由会话层先存盘再传入):消息与事件只带它,不带 base64 */
738
- attachmentRefs?: StoredAttachment[]): AsyncGenerator<WsEvent>;
762
+ attachmentRefs?: StoredAttachment[],
763
+ /** 发起人(控制面用户):设备共享时用于区分是谁发起的本轮 */
764
+ actor?: TurnActor): AsyncGenerator<WsEvent>;
739
765
  /** 重试 (仅在 Provider 错误后可用) */
740
766
  retry(): AsyncGenerator<WsEvent>;
741
767
  /** 从持久化的挂起点恢复 Turn (对齐 Python 版 resume) */
@@ -844,4 +870,4 @@ declare class TurnEngine {
844
870
  private _scanRecentFiles;
845
871
  }
846
872
 
847
- export { ApprovalOutcome as A, type CompactionStartInfo as C, type Decision as D, type EngineHook as E, Mode as M, OpenAIProvider as O, type ProviderClient as P, type ShellPolicy as S, TurnEngine as T, type WsEvent as W, type CompactionDoneInfo as a, EventType as b, type EngineErrorInfo as c, type Approver as d, type CompactionTrigger as e, PermissionEngine as f, type PermissionRequest as g, type ShellSandboxStatus as h, type TurnEngineOpts as i };
873
+ export { ApprovalOutcome as A, type CompactionStartInfo as C, type Decision as D, type EngineHook as E, Mode as M, OpenAIProvider as O, type ProviderClient as P, type ShellPolicy as S, TurnEngine as T, type WsEvent as W, type CompactionDoneInfo as a, EventType as b, type EngineErrorInfo as c, type Approver as d, type CompactionTrigger as e, PermissionEngine as f, type PermissionRequest as g, type ShellSandboxStatus as h, type TurnActor as i, type TurnEngineOpts as j };
@@ -21,6 +21,14 @@ declare class ConflictGuard {
21
21
  private readonly digests;
22
22
  /** 记录一次读取:后续写入将以这个版本为基准 */
23
23
  noteRead(absPath: string, content: string): void;
24
+ /**
25
+ * 记录一次读取,指纹由调用方流式计算。
26
+ *
27
+ * 大文件不该为了算指纹而把整篇内容读进内存:`read_file` 用流式读取时
28
+ * 逐块 update 哈希,最后把结果交进来。指纹算法必须与 {@link contentDigest}
29
+ * 一致(sha256 hex 前 16 位),否则同一文件在读/写两侧会得出不同值。
30
+ */
31
+ noteReadDigest(absPath: string, digest: string): void;
24
32
  /** 记录一次自己的写入:更新基准,避免同会话连续写触发误报 */
25
33
  noteWrite(absPath: string, content: string): void;
26
34
  /** 是否读过该文件(用于判断「有没有保护」) */
@@ -21,6 +21,14 @@ declare class ConflictGuard {
21
21
  private readonly digests;
22
22
  /** 记录一次读取:后续写入将以这个版本为基准 */
23
23
  noteRead(absPath: string, content: string): void;
24
+ /**
25
+ * 记录一次读取,指纹由调用方流式计算。
26
+ *
27
+ * 大文件不该为了算指纹而把整篇内容读进内存:`read_file` 用流式读取时
28
+ * 逐块 update 哈希,最后把结果交进来。指纹算法必须与 {@link contentDigest}
29
+ * 一致(sha256 hex 前 16 位),否则同一文件在读/写两侧会得出不同值。
30
+ */
31
+ noteReadDigest(absPath: string, digest: string): void;
24
32
  /** 记录一次自己的写入:更新基准,避免同会话连续写触发误报 */
25
33
  noteWrite(absPath: string, content: string): void;
26
34
  /** 是否读过该文件(用于判断「有没有保护」) */