@zqagent/core 0.3.13 → 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 (37) hide show
  1. package/dist/{TurnEngine-BZjUGic_.d.ts → TurnEngine-C8qqbilC.d.ts} +18 -3
  2. package/dist/{TurnEngine-CMGdcSdp.d.cts → TurnEngine-DKSczYaA.d.cts} +18 -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 +3372 -1136
  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 +3391 -1155
  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/update/controller.cjs +1 -1
  14. package/dist/internal/update/controller.js +1 -1
  15. package/dist/internal/update/platform.cjs +1 -1
  16. package/dist/internal/update/platform.js +1 -1
  17. package/dist/tools/diff.d.cts +1 -1
  18. package/dist/tools/diff.d.ts +1 -1
  19. package/dist/tools/explore.cjs +504 -127
  20. package/dist/tools/explore.cjs.map +1 -1
  21. package/dist/tools/explore.d.cts +1 -1
  22. package/dist/tools/explore.d.ts +1 -1
  23. package/dist/tools/explore.js +504 -127
  24. package/dist/tools/explore.js.map +1 -1
  25. package/dist/tools/files.cjs +267 -47
  26. package/dist/tools/files.cjs.map +1 -1
  27. package/dist/tools/files.d.cts +1 -1
  28. package/dist/tools/files.d.ts +1 -1
  29. package/dist/tools/files.js +267 -47
  30. package/dist/tools/files.js.map +1 -1
  31. package/dist/tools/search.cjs +103 -24
  32. package/dist/tools/search.cjs.map +1 -1
  33. package/dist/tools/search.d.cts +8 -2
  34. package/dist/tools/search.d.ts +8 -2
  35. package/dist/tools/search.js +103 -24
  36. package/dist/tools/search.js.map +1 -1
  37. package/package.json +6 -5
@@ -581,6 +581,17 @@ interface CompactionState {
581
581
  * 外部通过消费生成器产出的事件流来渲染实时进度、执行审批等。
582
582
  */
583
583
 
584
+ /** 待注入的 steering 项(文本 + 可选的附件) */
585
+ /**
586
+ * 一轮 / 一条用户消息的发起人(控制面用户)。
587
+ *
588
+ * 设备被共享时,同一会话里会有多个账号发起的任务;节点本地直连、桌面端与
589
+ * 未接入控制面的场景没有这个信息,此时为 undefined。
590
+ */
591
+ interface TurnActor {
592
+ /** 控制面用户 id */
593
+ id: string;
594
+ }
584
595
  /** TurnEngine 构造参数 */
585
596
  interface TurnEngineOpts {
586
597
  /** LLM Provider(流式调用) */
@@ -675,6 +686,8 @@ declare class TurnEngine {
675
686
  private _lastContextTokens;
676
687
  /** 压缩无进展时的消息条数快照;-1 表示无冷却 */
677
688
  private _compactStalledAt;
689
+ /** 溢出兜底:已 400 时无条件淘汰旧工具结果(下一次成功调用后复位) */
690
+ private _overflowElide;
678
691
  /** 显式配置的上下文窗口大小(token 数),未设置时为 undefined(走自动检测) */
679
692
  private _contextWindow;
680
693
  /** 压缩触发阈值比例(默认 0.8) */
@@ -727,7 +740,7 @@ declare class TurnEngine {
727
740
  */
728
741
  private _routeAttachments;
729
742
  /** 排队 steering 消息(下一迭代间隙注入为 user 消息) */
730
- queueSteering(text: string, attachments?: MessageAttachment[], attachmentRefs?: StoredAttachment[]): void;
743
+ queueSteering(text: string, attachments?: MessageAttachment[], attachmentRefs?: StoredAttachment[], actor?: TurnActor): void;
731
744
  /**
732
745
  * 撤销一条尚未注入的 steering。
733
746
  *
@@ -746,7 +759,9 @@ declare class TurnEngine {
746
759
  */
747
760
  run(userInput: string, taskId?: string, attachments?: MessageAttachment[],
748
761
  /** 附件落盘引用(由会话层先存盘再传入):消息与事件只带它,不带 base64 */
749
- attachmentRefs?: StoredAttachment[]): AsyncGenerator<WsEvent>;
762
+ attachmentRefs?: StoredAttachment[],
763
+ /** 发起人(控制面用户):设备共享时用于区分是谁发起的本轮 */
764
+ actor?: TurnActor): AsyncGenerator<WsEvent>;
750
765
  /** 重试 (仅在 Provider 错误后可用) */
751
766
  retry(): AsyncGenerator<WsEvent>;
752
767
  /** 从持久化的挂起点恢复 Turn (对齐 Python 版 resume) */
@@ -855,4 +870,4 @@ declare class TurnEngine {
855
870
  private _scanRecentFiles;
856
871
  }
857
872
 
858
- 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 };
@@ -581,6 +581,17 @@ interface CompactionState {
581
581
  * 外部通过消费生成器产出的事件流来渲染实时进度、执行审批等。
582
582
  */
583
583
 
584
+ /** 待注入的 steering 项(文本 + 可选的附件) */
585
+ /**
586
+ * 一轮 / 一条用户消息的发起人(控制面用户)。
587
+ *
588
+ * 设备被共享时,同一会话里会有多个账号发起的任务;节点本地直连、桌面端与
589
+ * 未接入控制面的场景没有这个信息,此时为 undefined。
590
+ */
591
+ interface TurnActor {
592
+ /** 控制面用户 id */
593
+ id: string;
594
+ }
584
595
  /** TurnEngine 构造参数 */
585
596
  interface TurnEngineOpts {
586
597
  /** LLM Provider(流式调用) */
@@ -675,6 +686,8 @@ declare class TurnEngine {
675
686
  private _lastContextTokens;
676
687
  /** 压缩无进展时的消息条数快照;-1 表示无冷却 */
677
688
  private _compactStalledAt;
689
+ /** 溢出兜底:已 400 时无条件淘汰旧工具结果(下一次成功调用后复位) */
690
+ private _overflowElide;
678
691
  /** 显式配置的上下文窗口大小(token 数),未设置时为 undefined(走自动检测) */
679
692
  private _contextWindow;
680
693
  /** 压缩触发阈值比例(默认 0.8) */
@@ -727,7 +740,7 @@ declare class TurnEngine {
727
740
  */
728
741
  private _routeAttachments;
729
742
  /** 排队 steering 消息(下一迭代间隙注入为 user 消息) */
730
- queueSteering(text: string, attachments?: MessageAttachment[], attachmentRefs?: StoredAttachment[]): void;
743
+ queueSteering(text: string, attachments?: MessageAttachment[], attachmentRefs?: StoredAttachment[], actor?: TurnActor): void;
731
744
  /**
732
745
  * 撤销一条尚未注入的 steering。
733
746
  *
@@ -746,7 +759,9 @@ declare class TurnEngine {
746
759
  */
747
760
  run(userInput: string, taskId?: string, attachments?: MessageAttachment[],
748
761
  /** 附件落盘引用(由会话层先存盘再传入):消息与事件只带它,不带 base64 */
749
- attachmentRefs?: StoredAttachment[]): AsyncGenerator<WsEvent>;
762
+ attachmentRefs?: StoredAttachment[],
763
+ /** 发起人(控制面用户):设备共享时用于区分是谁发起的本轮 */
764
+ actor?: TurnActor): AsyncGenerator<WsEvent>;
750
765
  /** 重试 (仅在 Provider 错误后可用) */
751
766
  retry(): AsyncGenerator<WsEvent>;
752
767
  /** 从持久化的挂起点恢复 Turn (对齐 Python 版 resume) */
@@ -855,4 +870,4 @@ declare class TurnEngine {
855
870
  private _scanRecentFiles;
856
871
  }
857
872
 
858
- 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
  /** 是否读过该文件(用于判断「有没有保护」) */