qlogicagent 2.24.1 → 2.24.2

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 (297) hide show
  1. package/README.md +52 -324
  2. package/dist/agent.js +38 -43
  3. package/dist/cli.js +7 -7
  4. package/dist/default-project-knowledge/INSTRUCTIONS.md +7 -7
  5. package/dist/default-project-knowledge/rules/project-workflow.md +6 -6
  6. package/dist/index.js +265 -1018
  7. package/dist/orchestration.js +10 -10
  8. package/dist/types/agent/runtime-vars.d.ts +1 -16
  9. package/dist/types/agent/tool-loop/compression-pipeline.d.ts +0 -2
  10. package/dist/types/agent/tool-loop.d.ts +0 -6
  11. package/dist/types/agent/types.d.ts +3 -22
  12. package/dist/types/cli/acp-commands.d.ts +4 -5
  13. package/dist/types/cli/acp-message-router.d.ts +1 -2
  14. package/dist/types/cli/acp-session-handlers.d.ts +6 -12
  15. package/dist/types/cli/acp-session-host.d.ts +5 -48
  16. package/dist/types/cli/adapter-launch-config.d.ts +14 -0
  17. package/dist/types/cli/agent-runtime-bootstrap.d.ts +2 -23
  18. package/dist/types/cli/agent-runtime-session-state.d.ts +1 -6
  19. package/dist/types/cli/base-tool-bootstrap.d.ts +0 -2
  20. package/dist/types/cli/cli-acp-request-handler.d.ts +3 -5
  21. package/dist/types/cli/core-tool-coordinator.d.ts +0 -4
  22. package/dist/types/cli/core-tools/agent-tool-service.d.ts +0 -3
  23. package/dist/types/cli/core-tools/fork-system-prompt.d.ts +1 -5
  24. package/dist/types/cli/handlers/files-handler.d.ts +0 -6
  25. package/dist/types/cli/handlers/turn-handler.d.ts +7 -83
  26. package/dist/types/cli/main.d.ts +2 -4
  27. package/dist/types/cli/permission-approval-bridge.d.ts +2 -6
  28. package/dist/types/cli/permission-bootstrap.d.ts +2 -12
  29. package/dist/types/cli/plugin-bootstrap.d.ts +2 -4
  30. package/dist/types/cli/runtime-hook-bootstrap.d.ts +0 -21
  31. package/dist/types/cli/session-context.d.ts +4 -14
  32. package/dist/types/cli/session-coordinator.d.ts +1 -9
  33. package/dist/types/cli/stdio-acp-protocol-coordinator.d.ts +2 -9
  34. package/dist/types/cli/stdio-acp-request-host.d.ts +3 -15
  35. package/dist/types/cli/stdio-agent-session-bootstrap.d.ts +3 -23
  36. package/dist/types/cli/stdio-runtime-bootstrap.d.ts +0 -8
  37. package/dist/types/cli/stdio-runtime-services.d.ts +2 -13
  38. package/dist/types/cli/stdio-server.d.ts +6 -128
  39. package/dist/types/cli/tool-bootstrap.d.ts +4 -8
  40. package/dist/types/cli/tool-catalog.d.ts +2 -2
  41. package/dist/types/cli/tool-invoker-factory.d.ts +0 -2
  42. package/dist/types/cli/tool-registry-adapter.d.ts +3 -7
  43. package/dist/types/cli/tool-result-processor.d.ts +0 -1
  44. package/dist/types/cli/turn-core.d.ts +6 -10
  45. package/dist/types/cli/turn-event-forwarder.d.ts +6 -3
  46. package/dist/types/cli/turn-lifecycle.d.ts +0 -3
  47. package/dist/types/cli/turn-project-router.d.ts +0 -7
  48. package/dist/types/contracts/hooks.d.ts +1 -20
  49. package/dist/types/contracts/tool-execution-evidence.d.ts +20 -1
  50. package/dist/types/contracts/turn-event.d.ts +2 -2
  51. package/dist/types/orchestration/index.d.ts +1 -1
  52. package/dist/types/protocol/notifications.d.ts +2 -9
  53. package/dist/types/protocol/wire/acp-protocol.d.ts +12 -186
  54. package/dist/types/protocol/wire/capability-transport.d.ts +0 -2
  55. package/dist/types/protocol/wire/index.d.ts +2 -10
  56. package/dist/types/protocol/wire/notification-payloads.d.ts +4 -989
  57. package/dist/types/protocol/wire/thread-protocol.d.ts +24 -3
  58. package/dist/types/runtime/config/tunable-defaults.d.ts +3 -75
  59. package/dist/types/runtime/execution/forked-agent.d.ts +2 -5
  60. package/dist/types/runtime/execution/streaming-tool-executor.d.ts +0 -2
  61. package/dist/types/runtime/execution/tool-result-storage.d.ts +13 -4
  62. package/dist/types/runtime/infra/agent-paths.d.ts +4 -54
  63. package/dist/types/runtime/infra/agent-project-projection.d.ts +20 -0
  64. package/dist/types/runtime/infra/background-tasks.d.ts +3 -3
  65. package/dist/types/runtime/infra/default-path-service.d.ts +0 -7
  66. package/dist/types/runtime/infra/llmrouter-catalog.d.ts +1 -1
  67. package/dist/types/runtime/infra/model-registry.d.ts +6 -9
  68. package/dist/types/runtime/infra/project-store.d.ts +3 -3
  69. package/dist/types/runtime/infra/subagent-turn-snapshot.d.ts +54 -7
  70. package/dist/types/runtime/infra/task-runtime.d.ts +1 -1
  71. package/dist/types/runtime/ports/agent-runtime-ports.d.ts +1 -3
  72. package/dist/types/runtime/ports/index.d.ts +0 -4
  73. package/dist/types/runtime/ports/path-service.d.ts +1 -9
  74. package/dist/types/runtime/ports/tool-contracts.d.ts +0 -1
  75. package/dist/types/runtime/session/agent-session-projection.d.ts +37 -0
  76. package/dist/types/runtime/tasks/task-types.d.ts +2 -25
  77. package/dist/types/skills/mcp/mcp-manager.d.ts +2 -2
  78. package/dist/types/skills/plugins/plugin-loader.d.ts +1 -1
  79. package/dist/types/skills/skill-system/skill-category.d.ts +4 -2
  80. package/dist/types/skills/tools.d.ts +1 -18
  81. package/dist/types/test-support/project-store-fixture.d.ts +4 -4
  82. package/dist/types/transport/acp-event-emitter.d.ts +1 -20
  83. package/dist/types/transport/acp-server.d.ts +8 -88
  84. package/package.json +4 -96
  85. package/dist/agent-contract.js +0 -1
  86. package/dist/host-contract.js +0 -1
  87. package/dist/host-session-collection-contract.js +0 -1
  88. package/dist/memory-category-contract.js +0 -1
  89. package/dist/permissions.js +0 -1
  90. package/dist/plugin-marketplace-compute.js +0 -1
  91. package/dist/project-memory-host.js +0 -38
  92. package/dist/protocol.js +0 -1
  93. package/dist/skill-category-contract.js +0 -1
  94. package/dist/tunables.js +0 -1
  95. package/dist/types/agent/memory-recall-context.d.ts +0 -22
  96. package/dist/types/agent/memory-recall-injection.d.ts +0 -32
  97. package/dist/types/cli/acp-extended-handlers.d.ts +0 -110
  98. package/dist/types/cli/acp-extended-host-adapter.d.ts +0 -20
  99. package/dist/types/cli/community-resource-installer.d.ts +0 -39
  100. package/dist/types/cli/community-skill-installer.d.ts +0 -18
  101. package/dist/types/cli/community-workflow-installer.d.ts +0 -29
  102. package/dist/types/cli/default-project-bootstrap.d.ts +0 -12
  103. package/dist/types/cli/dream-host-adapter.d.ts +0 -24
  104. package/dist/types/cli/gateway-rpc-connection.d.ts +0 -50
  105. package/dist/types/cli/handlers/community-handler.d.ts +0 -14
  106. package/dist/types/cli/handlers/config-handler.d.ts +0 -19
  107. package/dist/types/cli/handlers/control-handler.d.ts +0 -29
  108. package/dist/types/cli/handlers/dream-handler.d.ts +0 -41
  109. package/dist/types/cli/handlers/goal-handler.d.ts +0 -66
  110. package/dist/types/cli/handlers/memory-handler.d.ts +0 -23
  111. package/dist/types/cli/handlers/product-handler.d.ts +0 -35
  112. package/dist/types/cli/handlers/session-handler.d.ts +0 -29
  113. package/dist/types/cli/handlers/skill-curator-handler.d.ts +0 -8
  114. package/dist/types/cli/handlers/solo-handler.d.ts +0 -25
  115. package/dist/types/cli/handlers/turn-baseline-handler.d.ts +0 -8
  116. package/dist/types/cli/handlers/workflow-compute-handler.d.ts +0 -8
  117. package/dist/types/cli/handlers/working-materials-handler.d.ts +0 -9
  118. package/dist/types/cli/idle-dream-coordinator.d.ts +0 -57
  119. package/dist/types/cli/memory-background-coordinator.d.ts +0 -26
  120. package/dist/types/cli/memory-candidate-service.d.ts +0 -75
  121. package/dist/types/cli/memory-coordinator.d.ts +0 -40
  122. package/dist/types/cli/multi-agent-handler-host.d.ts +0 -16
  123. package/dist/types/cli/multi-agent-state-coordinator.d.ts +0 -8
  124. package/dist/types/cli/orchestration-memory-context.d.ts +0 -23
  125. package/dist/types/cli/product-acp-params.d.ts +0 -30
  126. package/dist/types/cli/product-coordinator.d.ts +0 -21
  127. package/dist/types/cli/project-memory-store-factory.d.ts +0 -12
  128. package/dist/types/cli/project-template-seeder.d.ts +0 -5
  129. package/dist/types/cli/rpc-registry.d.ts +0 -56
  130. package/dist/types/cli/session-history-coordinator.d.ts +0 -8
  131. package/dist/types/cli/session-query-service.d.ts +0 -27
  132. package/dist/types/cli/stdio-rpc-handler-hosts.d.ts +0 -56
  133. package/dist/types/cli/stdio-session-runtime-coordinator.d.ts +0 -17
  134. package/dist/types/cli/task-distillation-coordinator.d.ts +0 -146
  135. package/dist/types/cli/turn-ask-user-setup.d.ts +0 -24
  136. package/dist/types/cli/turn-suggestion-generator.d.ts +0 -15
  137. package/dist/types/contracts/memory-recall-packet.d.ts +0 -31
  138. package/dist/types/contracts/memory-response-contract.d.ts +0 -2
  139. package/dist/types/host-contract/fts-segment.d.ts +0 -20
  140. package/dist/types/host-contract/index.d.ts +0 -1819
  141. package/dist/types/host-contract/memory-category.d.ts +0 -8
  142. package/dist/types/host-contract/skill-category.d.ts +0 -5
  143. package/dist/types/host-session-collection-contract.d.ts +0 -65
  144. package/dist/types/orchestration/agent-instance.d.ts +0 -215
  145. package/dist/types/orchestration/agent-roster.d.ts +0 -32
  146. package/dist/types/orchestration/dag-scheduler.d.ts +0 -219
  147. package/dist/types/orchestration/delegate-approval-policy.d.ts +0 -8
  148. package/dist/types/orchestration/delegate-bridge.d.ts +0 -8
  149. package/dist/types/orchestration/goal-acceptance.d.ts +0 -17
  150. package/dist/types/orchestration/goal-context-envelope.d.ts +0 -7
  151. package/dist/types/orchestration/goal-loop-coordinator.d.ts +0 -151
  152. package/dist/types/orchestration/goal-mode-adapters.d.ts +0 -152
  153. package/dist/types/orchestration/goal-run-persistence.d.ts +0 -21
  154. package/dist/types/orchestration/goal-run-types.d.ts +0 -225
  155. package/dist/types/orchestration/planner-memory-brief.d.ts +0 -39
  156. package/dist/types/orchestration/product-budget.d.ts +0 -94
  157. package/dist/types/orchestration/product-checkpoint.d.ts +0 -50
  158. package/dist/types/orchestration/product-dag-mutation-applier.d.ts +0 -10
  159. package/dist/types/orchestration/product-persistence.d.ts +0 -90
  160. package/dist/types/orchestration/product-planner.d.ts +0 -332
  161. package/dist/types/orchestration/product-run-coordinator.d.ts +0 -49
  162. package/dist/types/orchestration/product-worktree.d.ts +0 -19
  163. package/dist/types/orchestration/run-state-host-authority.d.ts +0 -7
  164. package/dist/types/orchestration/solo-evaluator.d.ts +0 -179
  165. package/dist/types/orchestration/solo-persistence.d.ts +0 -47
  166. package/dist/types/orchestration/solo-spec-builder.d.ts +0 -58
  167. package/dist/types/orchestration/testing/delegate-test-bridge.d.ts +0 -23
  168. package/dist/types/orchestration/testing/host-agent-provider-directory-fixture.d.ts +0 -7
  169. package/dist/types/orchestration/testing/run-state-client-double.d.ts +0 -13
  170. package/dist/types/orchestration/workflow/budget-permission-gate.d.ts +0 -94
  171. package/dist/types/orchestration/workflow/builtin-capabilities.d.ts +0 -3
  172. package/dist/types/orchestration/workflow/builtin-executors.d.ts +0 -18
  173. package/dist/types/orchestration/workflow/capability-catalog.d.ts +0 -72
  174. package/dist/types/orchestration/workflow/cron-schedule.d.ts +0 -36
  175. package/dist/types/orchestration/workflow/data-item.d.ts +0 -39
  176. package/dist/types/orchestration/workflow/expression.d.ts +0 -60
  177. package/dist/types/orchestration/workflow/host-executors.d.ts +0 -15
  178. package/dist/types/orchestration/workflow/n8n-expression.d.ts +0 -48
  179. package/dist/types/orchestration/workflow/n8n-import.d.ts +0 -64
  180. package/dist/types/orchestration/workflow/n8n-template-compat.d.ts +0 -5
  181. package/dist/types/orchestration/workflow/node-registry.d.ts +0 -32
  182. package/dist/types/orchestration/workflow/node-schema.d.ts +0 -249
  183. package/dist/types/orchestration/workflow/params-schema.d.ts +0 -69
  184. package/dist/types/orchestration/workflow/qla-executor-host.d.ts +0 -63
  185. package/dist/types/orchestration/workflow/run-checkpoint-store.d.ts +0 -53
  186. package/dist/types/orchestration/workflow/run-history-store.d.ts +0 -103
  187. package/dist/types/orchestration/workflow/semantic-acceptance.d.ts +0 -65
  188. package/dist/types/orchestration/workflow/trigger-validation.d.ts +0 -22
  189. package/dist/types/orchestration/workflow/workflow-audit-store.d.ts +0 -31
  190. package/dist/types/orchestration/workflow/workflow-authoring.d.ts +0 -74
  191. package/dist/types/orchestration/workflow/workflow-bundle.d.ts +0 -51
  192. package/dist/types/orchestration/workflow/workflow-controller.d.ts +0 -237
  193. package/dist/types/orchestration/workflow/workflow-edit-context.d.ts +0 -46
  194. package/dist/types/orchestration/workflow/workflow-error.d.ts +0 -28
  195. package/dist/types/orchestration/workflow/workflow-intent-contract.d.ts +0 -56
  196. package/dist/types/orchestration/workflow/workflow-patch.d.ts +0 -122
  197. package/dist/types/orchestration/workflow/workflow-render.d.ts +0 -40
  198. package/dist/types/orchestration/workflow/workflow-runtime.d.ts +0 -184
  199. package/dist/types/orchestration/workflow/workflow-scheduler.d.ts +0 -122
  200. package/dist/types/orchestration/workflow/workflow-store.d.ts +0 -85
  201. package/dist/types/orchestration/workflow/workflow-template-setup.d.ts +0 -65
  202. package/dist/types/orchestration/workflow/workflow-trigger.d.ts +0 -43
  203. package/dist/types/orchestration/workflow-chat-builder.d.ts +0 -152
  204. package/dist/types/orchestration/worktree-task-prompt.d.ts +0 -1
  205. package/dist/types/permissions.d.ts +0 -4
  206. package/dist/types/project-memory-host.d.ts +0 -4
  207. package/dist/types/protocol/agent-contract.d.ts +0 -93
  208. package/dist/types/protocol/methods.d.ts +0 -645
  209. package/dist/types/protocol/wire/acp-agent-management.d.ts +0 -533
  210. package/dist/types/protocol/wire/agent-events.d.ts +0 -1
  211. package/dist/types/protocol/wire/agent-methods.d.ts +0 -500
  212. package/dist/types/protocol/wire/agent-rpc.d.ts +0 -100
  213. package/dist/types/protocol/wire/gateway-contract.d.ts +0 -61
  214. package/dist/types/protocol/wire/gateway-rpc.d.ts +0 -1177
  215. package/dist/types/protocol/wire/memory-provider-lifecycle.d.ts +0 -31
  216. package/dist/types/protocol/wire/turn.d.ts +0 -208
  217. package/dist/types/runtime/community/autonomy-budget.d.ts +0 -26
  218. package/dist/types/runtime/community/community-consent-client.d.ts +0 -55
  219. package/dist/types/runtime/community/package-materialize.d.ts +0 -19
  220. package/dist/types/runtime/community/ranged-download.d.ts +0 -21
  221. package/dist/types/runtime/community/registry-signature.d.ts +0 -48
  222. package/dist/types/runtime/execution/dream-agent.d.ts +0 -273
  223. package/dist/types/runtime/execution/dream-category-context.d.ts +0 -47
  224. package/dist/types/runtime/execution/memory-decay.d.ts +0 -73
  225. package/dist/types/runtime/execution/turn-progress-notifier.d.ts +0 -16
  226. package/dist/types/runtime/hooks/memory-hooks.d.ts +0 -111
  227. package/dist/types/runtime/infra/acp-host-handler.d.ts +0 -31
  228. package/dist/types/runtime/infra/acp-protocol-adapter.d.ts +0 -209
  229. package/dist/types/runtime/infra/acp-usage-tracker.d.ts +0 -46
  230. package/dist/types/runtime/infra/cloud-auth-host-authority.d.ts +0 -4
  231. package/dist/types/runtime/infra/feedback-distillation-worker.d.ts +0 -20
  232. package/dist/types/runtime/infra/feedback-distillation.d.ts +0 -32
  233. package/dist/types/runtime/infra/feedback-event-store.d.ts +0 -179
  234. package/dist/types/runtime/infra/feedback-host-authority.d.ts +0 -4
  235. package/dist/types/runtime/infra/feedback-outbox.d.ts +0 -26
  236. package/dist/types/runtime/infra/feedback-redaction.d.ts +0 -71
  237. package/dist/types/runtime/infra/feedback-upload-client.d.ts +0 -39
  238. package/dist/types/runtime/infra/feedback-upload-worker.d.ts +0 -11
  239. package/dist/types/runtime/infra/host-agent-provider-directory.d.ts +0 -17
  240. package/dist/types/runtime/infra/project-authority-facade.d.ts +0 -11
  241. package/dist/types/runtime/infra/project-data-paths.d.ts +0 -24
  242. package/dist/types/runtime/infra/project-host-authority.d.ts +0 -11
  243. package/dist/types/runtime/infra/project-instructions-store.d.ts +0 -30
  244. package/dist/types/runtime/infra/turn-baseline-store.d.ts +0 -102
  245. package/dist/types/runtime/infra/turn-telemetry-store.d.ts +0 -100
  246. package/dist/types/runtime/infra/working-materials-store.d.ts +0 -29
  247. package/dist/types/runtime/memory/find-relevant-memories.d.ts +0 -26
  248. package/dist/types/runtime/memory/implicit-extraction.d.ts +0 -69
  249. package/dist/types/runtime/memory/memory-recall-attribution.d.ts +0 -24
  250. package/dist/types/runtime/ports/memory-provider.d.ts +0 -219
  251. package/dist/types/runtime/ports/memory-recall-source.d.ts +0 -14
  252. package/dist/types/runtime/ports/memory-writer.d.ts +0 -70
  253. package/dist/types/runtime/ports/project-memory-store.d.ts +0 -49
  254. package/dist/types/runtime/prompt/host-skill-directory.d.ts +0 -16
  255. package/dist/types/runtime/session/group-session-split.d.ts +0 -38
  256. package/dist/types/runtime/session/inbound-upload-persistence.d.ts +0 -47
  257. package/dist/types/runtime/session/session-catalog.d.ts +0 -12
  258. package/dist/types/runtime/session/session-deletion-guard.d.ts +0 -4
  259. package/dist/types/runtime/session/session-locator.d.ts +0 -26
  260. package/dist/types/runtime/session/session-metadata-store.d.ts +0 -8
  261. package/dist/types/runtime/session/session-paths.d.ts +0 -8
  262. package/dist/types/runtime/session/session-permission-store.d.ts +0 -6
  263. package/dist/types/runtime/session/session-persistence.d.ts +0 -37
  264. package/dist/types/runtime/session/session-recovery.d.ts +0 -62
  265. package/dist/types/runtime/session/session-resource-key.d.ts +0 -28
  266. package/dist/types/runtime/session/session-resume.d.ts +0 -9
  267. package/dist/types/runtime/session/session-schema.d.ts +0 -10
  268. package/dist/types/runtime/session/session-summary.d.ts +0 -7
  269. package/dist/types/runtime/session/session-title.d.ts +0 -9
  270. package/dist/types/runtime/session/session-transcript-store.d.ts +0 -30
  271. package/dist/types/runtime/session/session-types.d.ts +0 -113
  272. package/dist/types/runtime/session/session-write-queue.d.ts +0 -3
  273. package/dist/types/skills/memory/host-memory-provider.d.ts +0 -235
  274. package/dist/types/skills/memory/memdir.d.ts +0 -111
  275. package/dist/types/skills/memory/memory-content-safety.d.ts +0 -1
  276. package/dist/types/skills/memory/memory-vector-utils.d.ts +0 -2
  277. package/dist/types/skills/memory/task-distillation.d.ts +0 -183
  278. package/dist/types/skills/plugins/plugin-marketplace.d.ts +0 -43
  279. package/dist/types/skills/skill-system/skill-bundles.d.ts +0 -8
  280. package/dist/types/skills/skill-system/skill-lifecycle.d.ts +0 -89
  281. package/dist/types/test-support/run-state-authority-setup.d.ts +0 -1
  282. package/dist/types/transport/delegate-client.d.ts +0 -82
  283. package/dist/types/transport/host-capability-client.d.ts +0 -21
  284. package/dist/types/transport/host-cloud-auth-client.d.ts +0 -10
  285. package/dist/types/transport/host-community-client.d.ts +0 -7
  286. package/dist/types/transport/host-feedback-client.d.ts +0 -25
  287. package/dist/types/transport/host-profile-client.d.ts +0 -19
  288. package/dist/types/transport/host-project-client.d.ts +0 -16
  289. package/dist/types/transport/host-request-client.d.ts +0 -42
  290. package/dist/types/transport/host-run-state-client.d.ts +0 -23
  291. package/dist/types/transport/host-session-client.d.ts +0 -30
  292. package/dist/types/tunables.d.ts +0 -2
  293. package/dist/types/workflow-host.d.ts +0 -38
  294. package/dist/workflow-host.js +0 -11
  295. /package/dist/types/{host-contract → protocol/wire}/acp-content.d.ts +0 -0
  296. /package/dist/types/{host-contract → runtime/infra}/project-id.d.ts +0 -0
  297. /package/dist/types/{host-contract → runtime/infra}/provider-profile.d.ts +0 -0
@@ -1,273 +0,0 @@
1
- /**
2
- * Dream Sub-agent — CC autoDream parity.
3
- *
4
- * Memory consolidation runs as a restricted sub-agent:
5
- * - Read-only tool access (bash: ls/grep/cat/find/stat/wc/head/tail)
6
- * - File writes restricted to memory directory
7
- * - 4-phase system prompt: Orient → Gather → Consolidate → Prune
8
- * - Trigger gates: time (24h) + session count (5)
9
- * - PID-based consolidation lock
10
- *
11
- * Reference: claude-code src/services/autoDream/
12
- */
13
- import type { DreamTaskState, DreamTurn } from "../tasks/task-types.js";
14
- import type { ToolDefinition, ToolInvoker, AgentLogger, HookRegistry, ForkedAgentRunnerFactory } from "../ports/agent-execution-contracts.js";
15
- import type { LLMTransport } from "../ports/index.js";
16
- import type { TaskStore } from "../infra/task-runtime.js";
17
- export interface DreamTriggerConfig {
18
- /** Minimum hours since last consolidation. Default: 24. */
19
- minHours: number;
20
- /** Minimum sessions since last consolidation. Default: 5. */
21
- minSessions: number;
22
- /** Minimum turns in current session as alternative gate. Default: 20. */
23
- minTurnsInSession: number;
24
- /** Scan throttle interval (ms). Default: 600_000 (10 min). */
25
- scanIntervalMs: number;
26
- /** Force run, ignoring gates. */
27
- force?: boolean;
28
- }
29
- export interface DreamContext {
30
- /** Root directory where memory files live. */
31
- memoryRoot: string;
32
- /** Directory containing session transcript JSONL files. */
33
- transcriptDir: string;
34
- /** Current agent session ID (excluded from session count). */
35
- currentSessionId: string;
36
- /** Callback to list session IDs touched since a timestamp. */
37
- listSessionsSince: (sinceMs: number) => Promise<string[]>;
38
- /** Turn count in current session (for single-session users). */
39
- currentSessionTurnCount?: number;
40
- }
41
- export interface DreamToolRestriction {
42
- toolName: string;
43
- input: Record<string, unknown>;
44
- }
45
- export type DreamToolVerdict = {
46
- allowed: true;
47
- } | {
48
- allowed: false;
49
- reason: string;
50
- };
51
- /** Result of a dream consolidation run. */
52
- export interface DreamRunResult {
53
- /** Whether dream ran successfully. */
54
- ok: boolean;
55
- /** Number of sessions reviewed. */
56
- sessionsReviewed: number;
57
- /** Memory files touched. */
58
- filesTouched: string[];
59
- /** Dream turns produced. */
60
- turns: DreamTurn[];
61
- /** Total duration (ms). */
62
- durationMs: number;
63
- /** Error message if failed. */
64
- error?: string;
65
- }
66
- /**
67
- * Check if a tool invocation is allowed during dream consolidation.
68
- *
69
- * Allowed:
70
- * - read_file, grep, glob, search — unrestricted read-only tools
71
- * - bash — only read-only commands (ls, grep, cat, find, stat, wc, head, tail)
72
- * - Host project_memory MCP tool — the sole project-memory writer
73
- * - raw write/edit/patch — denied (project-memory writes stay Host-owned)
74
- * - Everything else — denied
75
- */
76
- export declare function canUseDreamTool(memoryRoot: string, restriction: DreamToolRestriction): DreamToolVerdict;
77
- /**
78
- * Canonical catalog tool names advertised to the dream sub-agent. This trims the
79
- * full manifest (dozens of irrelevant tools) down to what dream actually uses.
80
- * Every name here MUST be allowed by canUseDreamTool — raw write/edit/patch are
81
- * intentionally absent (canUseDreamTool hard-denies them); Host project memory
82
- * is the sole sanctioned memdir writer.
83
- */
84
- export declare const DREAM_ALLOWED_TOOLS: Set<string>;
85
- /**
86
- * Build the 4-phase memory consolidation prompt.
87
- *
88
- * Adapted from CC's consolidationPrompt.ts with our project context.
89
- * P5: Enhanced with category-aware merge rules from write gate taxonomy.
90
- */
91
- export declare function buildConsolidationPrompt(memoryRoot: string, transcriptDir: string, sessionIds: string[], opts?: {
92
- hasQMemory?: boolean;
93
- categoryContext?: string;
94
- temporalContext?: string;
95
- profileContext?: string;
96
- sessionDigest?: string;
97
- }): string;
98
- /**
99
- * Check whether dream consolidation should run.
100
- *
101
- * Gate order (cheapest first):
102
- * 1. Time gate — hours since lastConsolidatedAt >= minHours
103
- * 2. Scan throttle — 10-minute interval to suppress redundant scans
104
- * 3. Session gate — session count since lastConsolidatedAt >= minSessions
105
- *
106
- * @returns Session IDs to review, or null if gates failed.
107
- */
108
- export declare function shouldTriggerDream(ctx: DreamContext, config?: Partial<DreamTriggerConfig>): Promise<{
109
- sessionIds: string[];
110
- } | null>;
111
- /**
112
- * Attempt to acquire the consolidation liveness lock.
113
- *
114
- * A held lock is "live" only if its mtime is fresh (< MAX_DREAM_RUN_MS) AND the
115
- * recorded PID is alive. A stale mtime reclaims unconditionally — this defends
116
- * against a crashed holder whose PID was reused by an unrelated process (the old
117
- * pure-PID check would falsely see it as alive and deadlock for up to an hour).
118
- *
119
- * @returns 0 on acquisition, or null if blocked by a live holder.
120
- */
121
- export declare function tryAcquireConsolidationLock(memoryRoot: string): Promise<number | null>;
122
- /**
123
- * Refresh the lock mtime so a long-but-legitimate dream is not reclaimed.
124
- * Called periodically by the dream runner. No-op if we no longer own the lock.
125
- */
126
- export declare function heartbeatConsolidationLock(memoryRoot: string): Promise<void>;
127
- /** Release the liveness lock explicitly (on failure, abort, or shutdown). */
128
- export declare function releaseConsolidationLock(memoryRoot: string): Promise<void>;
129
- /**
130
- * Rollback after a FAILED dream run: release the lock. The gate marker is NOT
131
- * touched (only success advances it), so a failed run never delays the next gate.
132
- * `_priorMtime` is retained for call-site compatibility and ignored.
133
- */
134
- export declare function rollbackConsolidationLock(memoryRoot: string, _priorMtime: number): Promise<void>;
135
- /**
136
- * Record a SUCCESSFUL consolidation: advance the gate marker (mtime = now) and
137
- * release the liveness lock.
138
- */
139
- export declare function markConsolidationComplete(memoryRoot: string): Promise<void>;
140
- /** Create initial DreamTaskState. */
141
- export declare function createDreamTaskState(opts: {
142
- sessionId: string;
143
- sessionsReviewing: number;
144
- priorLockMtime: number;
145
- parentTaskId?: string;
146
- }): DreamTaskState;
147
- /** Add a turn to the dream state. */
148
- export declare function addDreamTurn(state: DreamTaskState, turn: DreamTurn, touchedPaths: string[]): DreamTaskState;
149
- /** Mark dream as completed. */
150
- export declare function completeDreamState(state: DreamTaskState): DreamTaskState;
151
- /** Mark dream as failed. */
152
- export declare function failDreamState(state: DreamTaskState): DreamTaskState;
153
- /**
154
- * Full dream orchestration entry point.
155
- *
156
- * This coordinates the entire dream lifecycle:
157
- * 1. Check trigger gates
158
- * 2. Acquire consolidation lock
159
- * 3. Build consolidation prompt
160
- * 4. Return dream context for the caller to run through agent loop
161
- *
162
- * The caller (stdio-server) is responsible for:
163
- * - Running the prompt through the agent's tool loop
164
- * - Applying canUseDreamTool() restrictions via tool.before_invoke hook
165
- * - Calling markConsolidationComplete() on success
166
- * - Calling rollbackConsolidationLock() on failure
167
- */
168
- export declare function prepareDreamRun(ctx: DreamContext, config?: Partial<DreamTriggerConfig>): Promise<{
169
- prompt: string;
170
- taskState: DreamTaskState;
171
- sessionIds: string[];
172
- } | null>;
173
- export interface DreamRunDeps {
174
- /** Dream context (memoryRoot, transcriptDir, etc.) */
175
- context: DreamContext;
176
- /** Trigger configuration */
177
- triggerConfig?: Partial<DreamTriggerConfig>;
178
- /** LLM transport */
179
- transport: LLMTransport;
180
- /** Tool invoker */
181
- toolInvoker: ToolInvoker;
182
- /** Concrete agent runner factory injected by CLI/app layer. */
183
- createAgentRunner: ForkedAgentRunnerFactory;
184
- /** Available tools (will be filtered by canUseDreamTool) */
185
- tools: ToolDefinition[];
186
- /** Task store — when provided, the dream registers as a `dream` task (lifecycle visible to host + LLM). */
187
- taskStore?: TaskStore;
188
- /** API key */
189
- apiKey: string;
190
- /** Model for dream */
191
- model: string;
192
- /** Logger */
193
- log: AgentLogger;
194
- /** Hook registry */
195
- hooks?: HookRegistry;
196
- /** Parent abort signal */
197
- parentSignal?: AbortSignal;
198
- /**
199
- * Memory provider — when provided, Dream Agent acts as the "hippocampus":
200
- * reads existing long-term memories, writes classified session insights,
201
- * and submits feedback on outdated/contradicted memories.
202
- */
203
- memoryProvider?: {
204
- search(query: string, userId: string, options?: {
205
- limit?: number;
206
- }): Promise<Array<{
207
- id: string;
208
- content: string;
209
- score: number;
210
- }>>;
211
- proposeExtracted?(items: Array<{
212
- text: string;
213
- category?: string;
214
- importance?: number;
215
- }>, userId: string, options?: {
216
- sessionId?: string;
217
- source?: string;
218
- }): Promise<{
219
- proposalsAdded?: number;
220
- }>;
221
- feedback?(memoryIds: string[], signal: "useful" | "irrelevant" | "outdated" | "wrong", context?: {
222
- sessionId?: string;
223
- silent?: boolean;
224
- }): Promise<{
225
- affected: number;
226
- }>;
227
- /** Recent activity summary for temporal context injection into Dream.
228
- * B3(X7)异步化:Host 契约方法(host 模式经 x/host.request 跨进程)。 */
229
- getActivitySummary?(userId: string, days?: number): Promise<{
230
- dailyCounts: Array<{
231
- date: string;
232
- count: number;
233
- }>;
234
- highlights: Array<{
235
- text: string;
236
- category: string;
237
- importance: number;
238
- date: string;
239
- }>;
240
- }>;
241
- /** Synthesize a timeline narrative for a time range. B3(X7)异步化。 */
242
- synthesizeTimeline?(userId: string, startMs: number, endMs: number): Promise<string>;
243
- /** Get/set user profile entries. B3(X7):setProfile/getAllProfiles 异步化;getProfile 为本地同步读取。 */
244
- getProfile?(userId: string, key: string): string | null;
245
- setProfile?(userId: string, key: string, value: string): Promise<void>;
246
- getAllProfiles?(userId: string): Promise<Record<string, string>>;
247
- /** Drain consolidation backlog: resolve conflicts + promote corroborated pending claims. */
248
- resolveConflicts?(userId: string, opts?: {
249
- minEvidenceToPromote?: number;
250
- }): Promise<{
251
- conflictsResolved: number;
252
- claimsPromoted: number;
253
- }>;
254
- };
255
- /** User ID for memory operations. */
256
- memoryUserId?: string;
257
- }
258
- /**
259
- * Run a complete dream consolidation using an isolated forked agent.
260
- *
261
- * CC parity: This uses runForkedAgent() for true isolation instead of
262
- * hook-based tool restriction on the shared agent loop. The dream runs
263
- * in its own message history with its own AbortController.
264
- *
265
- * Full lifecycle:
266
- * 1. Check trigger gates
267
- * 2. Acquire consolidation lock
268
- * 3. Build consolidation prompt
269
- * 4. Fork sub-agent with restricted tools
270
- * 5. Run to completion
271
- * 6. Mark consolidation complete (or rollback on failure)
272
- */
273
- export declare function runDream(deps: DreamRunDeps): Promise<DreamRunResult>;
@@ -1,47 +0,0 @@
1
- import type { LongTermMemoryCategory } from "../../host-contract/memory-category.js";
2
- /** A memory file with its inferred category and metadata. */
3
- export interface CategorizedMemoryFile {
4
- filename: string;
5
- category: LongTermMemoryCategory | "uncategorized";
6
- /** First line description. */
7
- description: string;
8
- /** File size bytes. */
9
- sizeBytes: number;
10
- /** Count of entries/bullets in the file. */
11
- entryCount: number;
12
- }
13
- /** Category statistics for the dream prompt. */
14
- export interface CategoryManifest {
15
- /** Per-category file groups. */
16
- categories: Record<string, CategorizedMemoryFile[]>;
17
- /** Total files scanned. */
18
- totalFiles: number;
19
- /** Files that couldn't be classified. */
20
- uncategorizedCount: number;
21
- }
22
- /**
23
- * Scan MEMDIR and classify all topic files by category.
24
- *
25
- * @param memoryRoot - The MEMDIR root directory
26
- * @returns Category manifest with grouped files
27
- */
28
- export declare function scanCategoryManifest(memoryRoot: string): Promise<CategoryManifest>;
29
- /**
30
- * Category-specific merge/conflict rules for the dream prompt.
31
- *
32
- * These rules tell the dream agent how to handle each category:
33
- * - facts: supersede (newer replaces older when same topic)
34
- * - lessons: accumulate (append new insights, don't delete old)
35
- * - preferences: overwrite (latest preference wins)
36
- * - patterns: merge (consolidate duplicates into one authoritative entry)
37
- * - decisions: update (add "update" section if decision changed)
38
- */
39
- export declare const CATEGORY_MERGE_RULES: Record<LongTermMemoryCategory | "uncategorized", string>;
40
- /**
41
- * Format the category manifest and merge rules as an injection block
42
- * for the dream consolidation prompt.
43
- *
44
- * This replaces the blind "grep transcripts" approach with structured
45
- * guidance about what exists and how to handle each category.
46
- */
47
- export declare function formatCategoryContextBlock(manifest: CategoryManifest): string;
@@ -1,73 +0,0 @@
1
- /** Options for triggering a decay cycle. */
2
- export interface DecayOptions {
3
- temporalExpiry?: boolean;
4
- stalenessDecay?: boolean;
5
- noiseArchival?: boolean;
6
- }
7
- /** Result of a decay cycle. */
8
- export interface DecayResult {
9
- decayed: number;
10
- archived: number;
11
- }
12
- export interface DecayConfig {
13
- /** Minimum hours between decay cycles. Default: 24. */
14
- minIntervalHours: number;
15
- /** Enable temporal expiry (event/plan memories past grace period). Default: true. */
16
- temporalExpiry: boolean;
17
- /** Enable staleness decay (reduce importance of unaccessed memories). Default: true. */
18
- stalenessDecay: boolean;
19
- /** Enable noise archival (archive memories below threshold). Default: true. */
20
- noiseArchival: boolean;
21
- }
22
- export declare const DEFAULT_DECAY_CONFIG: DecayConfig;
23
- /**
24
- * Check whether enough time has elapsed since last decay.
25
- * Returns true if decay should run.
26
- */
27
- export declare function shouldTriggerDecay(memoryRoot: string, config?: Partial<DecayConfig>): Promise<boolean>;
28
- /**
29
- * Mark decay as having just run (persist timestamp).
30
- */
31
- export declare function markDecayComplete(memoryRoot: string): Promise<void>;
32
- export interface DecayCycleDeps {
33
- /** Memory provider with triggerDecay method. */
34
- adapter: {
35
- triggerDecay(userId: string): Promise<{
36
- decayed: number;
37
- }>;
38
- };
39
- /** User ID for memory operations. */
40
- userId: string;
41
- /** Memory root directory (for gate marker). */
42
- memoryRoot: string;
43
- /** Decay configuration overrides. */
44
- config?: Partial<DecayConfig>;
45
- /** Logger. */
46
- log?: {
47
- info(msg: string): void;
48
- debug?(msg: string): void;
49
- };
50
- }
51
- export interface DecayCycleResult {
52
- /** Whether decay actually ran (false = skipped by gate OR failed — see `failed`). */
53
- ran: boolean;
54
- /** True when the cycle was ATTEMPTED and errored — distinguishes a failure from a cooldown skip. */
55
- failed?: boolean;
56
- /** Failure reason, present when failed=true. */
57
- error?: string;
58
- /** Number of memories whose importance was reduced. */
59
- decayed: number;
60
- /** Number of memories archived (below threshold). */
61
- archived: number;
62
- /** Duration in ms. */
63
- durationMs: number;
64
- }
65
- /**
66
- * Run a full decay cycle with gate check.
67
- *
68
- * Lifecycle:
69
- * 1. Check time gate (24h default)
70
- * 2. Call the Host-backed memory provider
71
- * 3. Mark completion timestamp
72
- */
73
- export declare function runDecayCycle(deps: DecayCycleDeps): Promise<DecayCycleResult>;
@@ -1,16 +0,0 @@
1
- /**
2
- * 长任务进度通知(IM 渠道体验):IM 里看不到工具流,超过 minIntervalMs 的轮次
3
- * 以节流方式发 turn.progress,由 gateway/IM 桥接渲染成一条简短进度文本。
4
- * 桌面端 UI 已有工具流展示,gateway 可按渠道选择忽略此通知。
5
- */
6
- export interface TurnProgressNotifierOptions {
7
- turnId: string;
8
- send: (method: string, params: Record<string, unknown>) => void;
9
- /** 两条进度通知的最小间隔;默认 10s。 */
10
- minIntervalMs?: number;
11
- now?: () => number;
12
- }
13
- export interface TurnProgressNotifier {
14
- onToolResult(toolName: string): void;
15
- }
16
- export declare function createTurnProgressNotifier(options: TurnProgressNotifierOptions): TurnProgressNotifier;
@@ -1,111 +0,0 @@
1
- import type { HookRegistry } from "../../contracts/hooks.js";
2
- import type { MemoryProvider } from "../ports/memory-provider.js";
3
- import type { MemoryExtractionQueue, MemoryWriter } from "../ports/memory-writer.js";
4
- import type { MemoryRecallSource } from "../ports/memory-recall-source.js";
5
- export declare const MEMORY_PREFETCH_CONFIG: {
6
- readonly MAX_SESSION_BYTES: number;
7
- readonly LIMIT_PER_RECALL: 10;
8
- readonly MAX_SURFACED_ENTRIES: 100;
9
- };
10
- /**
11
- * Fallback for hosts that don't inject deps.procedureTag. MUST stay equal to
12
- * skills/memory/task-distillation PROCEDURE_TAG (runtime cannot import skills
13
- * per the architecture boundary; task-distillation.test.ts asserts equality).
14
- */
15
- export interface MemoryHooksDeps {
16
- /** QMemory adapter (MemoryProvider with search/health). */
17
- memoryProvider?: MemoryProvider;
18
- /** Local memory provider for direct writes (auto-extract). */
19
- localMemoryProvider?: MemoryWriter;
20
- /** Host-owned durable hand-off for completed turns awaiting semantic extraction. */
21
- memoryExtractionQueue?: MemoryExtractionQueue;
22
- /** User ID for memory lookups. */
23
- userId: string;
24
- /** Logger. */
25
- log: {
26
- debug(msg: string): void;
27
- warn(msg: string): void;
28
- };
29
- /** Access to recent messages (for auto-extract). Set externally per turn. */
30
- getLastUserMessage?: () => string | undefined;
31
- /** Access to last assistant response (for implicit extraction). Set externally per turn. */
32
- getLastAssistantMessage?: () => string | undefined;
33
- /** Background LLM for implicit extraction. If provided, enables Layer 2. */
34
- llmExtract?: (prompt: string, signal?: AbortSignal) => Promise<string | null>;
35
- /** Shared process lane: queues learning work and aborts it for foreground turns. */
36
- scheduleBackgroundMemoryWork(label: string, work: (signal: AbortSignal) => Promise<void>): Promise<boolean>;
37
- /** Part B write visibility: forwards turn.memory_written on auto-extract commits. */
38
- sendNotification?: (method: string, params: Record<string, unknown>) => void;
39
- /** V3.2 usage 仪表:procedure 复用的 session 维度与负反馈计数落盘目录。 */
40
- /** Tag marking a distilled procedure memory. CLI injects it to preserve the runtime/skills boundary. */
41
- procedureTag: string;
42
- /** V3.2: record distilled procedures whose text reached the prompt (positive reuse signal). cli-injected.
43
- * [A7] Called from memory.after_recall with the post-cap injected subset — NOT from
44
- * before_recall: search hits the model never saw must not build promotion evidence. */
45
- recordProcedureRecalls(procedureIds: string[], sessionId: string): void;
46
- /** V3.2: record negative feedback against distilled procedures (failed turn). cli-injected. */
47
- recordProcedureNegatives(procedureIds: string[]): void;
48
- /** [A7] Host-side access ledger (memories.access_count/last_accessed_at): report the L2 ids
49
- * actually injected this turn. cli-injected (fire-and-forget; Host stays the single writer —
50
- * search() no longer counts hits, so skipping this call means the memory goes uncounted). */
51
- recordInjectedAccess(memoryIds: string[], context: {
52
- sessionId: string;
53
- turnId: string;
54
- }): void;
55
- /** Host-owned recall outcome ledger. Best-effort accounting must never block a turn. */
56
- recordRecallOutcome(input: {
57
- sessionId: string;
58
- turnId: string;
59
- event: "used" | "helped" | "harmed" | "unattributed";
60
- }): void;
61
- }
62
- /** Session-scoped state for dedup and byte budget (CC parity). */
63
- export interface MemoryPrefetchState {
64
- /** Paths already surfaced this session (CC readFileState LRU parity). */
65
- surfacedPaths: Set<string>;
66
- /** Total bytes injected this session. */
67
- sessionBytes: number;
68
- }
69
- /**
70
- * Create a fresh memory prefetch state (once per session).
71
- */
72
- export declare function createMemoryPrefetchState(): MemoryPrefetchState;
73
- /**
74
- * Register memory lifecycle hooks on the HookRegistry.
75
- *
76
- * Hook points wired:
77
- * - memory.before_recall: prefetch context from qmemory (query-based); NO reuse
78
- * accounting here ([A7]: retrieval hits the model never saw are not evidence)
79
- * - memory.after_recall: reuse accounting off the post-cap injected ids + log
80
- *
81
- * CC parity additions:
82
- * - Repeated L2 evidence remains available on every turn; surfacedPaths only
83
- * prevents charging the unique-session byte budget twice for the same id
84
- * - Unique session byte limit (MAX_SESSION_BYTES = 60KB)
85
- * - Async prefetch (non-blocking promise, abort-aware)
86
- *
87
- * Returns a cleanup function to unregister.
88
- */
89
- export declare const RESIDENT_TAG_GROUPS: string[][];
90
- export declare function registerMemoryHooks(hooks: HookRegistry, deps: MemoryHooksDeps,
91
- /** Shared statepass the same object across hook re-registrations in a session. */
92
- prefetchState?: MemoryPrefetchState): () => void;
93
- export interface MemdirRecallHookDeps {
94
- /** Project memory recall source (lazy: may be null at registration time). */
95
- getMemorySource: () => MemoryRecallSource | null;
96
- /** Logger. */
97
- log: {
98
- debug(msg: string): void;
99
- warn(msg: string): void;
100
- };
101
- }
102
- /**
103
- * Register the MEMDIR cross-file recall hook on `memory.before_recall`.
104
- *
105
- * - Priority 40 (before QMemory at 50)
106
- * - Scans topic files, selects top-5 relevant
107
- * - Injects content into recalledMemories (merged with QMemory results)
108
- * - Respects session byte budget from shared MemoryPrefetchState
109
- * - Dedup via surfacedPaths (shared with QMemory hook)
110
- */
111
- export declare function registerMemdirRecallHook(hooks: HookRegistry, deps: MemdirRecallHookDeps, prefetchState?: MemoryPrefetchState): () => void;
@@ -1,31 +0,0 @@
1
- import type { AcpHostRequestHandler } from "./acp-protocol-adapter.js";
2
- interface HostHandlerOpts {
3
- cwd: string;
4
- /**
5
- * Optional interactive permission resolver. When provided, session/request_permission is routed
6
- * here (forwarded to the user) instead of auto-allowing. Returning a chosen optionId responds to
7
- * the external agent. If omitted, permissions auto-allow (host-trust baseline for sub-agents).
8
- */
9
- requestPermission?: (params: Record<string, unknown>) => Promise<{
10
- optionId: string;
11
- }>;
12
- }
13
- /**
14
- * Host-side reverse-RPC handler for an EXTERNAL ACP agent (codex/copilot/…).
15
- *
16
- * Auto-allows permissions (the external agent runs under the qlogicagent host's
17
- * trust, matching the internal sub-agent baseline), serves fs read/write confined
18
- * to the agent cwd, and runs terminals as real child processes. Terminals are
19
- * tracked in a Map so the agent process lifecycle (detach/kill) can reap them via
20
- * disposeAll().
21
- *
22
- * Terminal response shapes align with the official ACP schema
23
- * (@agentclientprotocol/sdk):
24
- * - createTerminal -> { terminalId }
25
- * - terminalOutput -> { output, truncated, exitStatus: {exitCode, signal} | null }
26
- * - waitForTerminalExit -> { exitCode, signal }
27
- */
28
- export declare function createAcpHostHandler(opts: HostHandlerOpts): AcpHostRequestHandler & {
29
- disposeAll(): void;
30
- };
31
- export {};