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,14 +0,0 @@
1
- export interface MemoryRecallSource {
2
- getRootPath(): string;
3
- searchLocal(query: string): Promise<Array<{
4
- file: string;
5
- snippet: string;
6
- score: number;
7
- mtimeMs: number;
8
- }>>;
9
- readFile(name: string): Promise<{
10
- ok: boolean;
11
- content?: string;
12
- message: string;
13
- }>;
14
- }
@@ -1,70 +0,0 @@
1
- import type { HostMemoryExtractionTurnInput, HostPendingMemoryExtractionTurn, MemoryClaimRelation } from "../../host-contract/index.js";
2
- export interface MemoryWriteMetadata {
3
- source?: string;
4
- category?: string;
5
- importance?: number;
6
- eventDate?: string;
7
- sessionId?: string;
8
- [key: string]: unknown;
9
- }
10
- export interface StructuredMemoryClaim {
11
- scope: "global" | "project" | "session";
12
- entity: string;
13
- predicate: string;
14
- relation: MemoryClaimRelation;
15
- value: Record<string, unknown>;
16
- }
17
- export interface MemoryWriterExtractionItem {
18
- text: string;
19
- category?: string;
20
- importance?: number;
21
- confidence?: number;
22
- event_date?: string;
23
- tags?: string[];
24
- claim?: StructuredMemoryClaim;
25
- evidence?: {
26
- kind: string;
27
- refs: string[];
28
- idempotencyKey: string;
29
- quote?: string;
30
- };
31
- /** The source turn explicitly retracts or replaces an earlier decision. */
32
- correction?: boolean;
33
- }
34
- export interface MemoryWriter {
35
- ingestExtracted?(items: MemoryWriterExtractionItem[], userId: string, metadata?: MemoryWriteMetadata): Promise<{
36
- memoriesAdded?: number;
37
- items?: Array<{
38
- outcome: "created" | "merged" | "conflicted" | "pending" | "rejected";
39
- }>;
40
- }>;
41
- proposeExtracted?(items: MemoryWriterExtractionItem[], userId: string, metadata?: MemoryWriteMetadata): Promise<{
42
- proposalsAdded?: number;
43
- }>;
44
- findRelatedEvents?(text: string, userId: string): Promise<Array<{
45
- id: string;
46
- }>>;
47
- feedback?(ids: string[], signal: "useful" | "irrelevant" | "outdated" | "wrong", context?: {
48
- sessionId?: string;
49
- silent?: boolean;
50
- }): Promise<unknown>;
51
- }
52
- export interface MemoryExtractionQueue {
53
- enqueueExtractionTurn(input: HostMemoryExtractionTurnInput, userId: string): Promise<{
54
- jobId: string;
55
- created: boolean;
56
- }>;
57
- claimPendingExtractionTurns(userId: string, workerId: string, options?: {
58
- limit?: number;
59
- leaseMs?: number;
60
- }): Promise<HostPendingMemoryExtractionTurn[]>;
61
- completeExtractionTurn(jobId: string, userId: string, workerId: string): Promise<{
62
- deleted: boolean;
63
- }>;
64
- releaseExtractionTurn(jobId: string, userId: string, workerId: string): Promise<{
65
- released: boolean;
66
- }>;
67
- recordExtractionTurnFailure(jobId: string, userId: string, workerId: string, error: string): Promise<{
68
- updated: boolean;
69
- }>;
70
- }
@@ -1,49 +0,0 @@
1
- export interface ProjectMemoryFileInfo {
2
- name: string;
3
- size: number;
4
- modifiedAt: string;
5
- preview?: string;
6
- }
7
- export interface ProjectMemoryResult {
8
- ok: boolean;
9
- message: string;
10
- file?: string;
11
- indexUsage?: string;
12
- }
13
- export interface ProjectMemoryStore {
14
- getRootPath(): string;
15
- ensureInitialized(): void | Promise<void>;
16
- /** Re-read the Host-owned INDEX snapshot before a later turn assembles its prompt. */
17
- refreshIndex(): Promise<void>;
18
- getIndexForPrompt(): string;
19
- getIndexRaw(): string;
20
- getIndexUsage(): {
21
- chars: number;
22
- lines: number;
23
- percent: number;
24
- };
25
- addToIndex(content: string): Promise<ProjectMemoryResult>;
26
- replaceInIndex(oldText: string, newText: string): Promise<ProjectMemoryResult>;
27
- removeFromIndex(oldText: string): Promise<ProjectMemoryResult>;
28
- createFile(name: string, content: string): Promise<ProjectMemoryResult>;
29
- writeFile(name: string, content: string): Promise<ProjectMemoryResult>;
30
- readFile(name: string): Promise<{
31
- ok: boolean;
32
- content?: string;
33
- message: string;
34
- }>;
35
- deleteFile(name: string): Promise<ProjectMemoryResult>;
36
- listFiles(): Promise<ProjectMemoryFileInfo[]>;
37
- searchLocal(query: string): Promise<Array<{
38
- file: string;
39
- snippet: string;
40
- score: number;
41
- mtimeMs: number;
42
- }>>;
43
- }
44
- export interface ProjectMemoryStoreFactory {
45
- getRootPath(projectRoot: string): string;
46
- create(projectRoot: string): ProjectMemoryStore;
47
- /** Read the user-level global memory INDEX for prompt injection (null when absent/empty). */
48
- readUserIndexForPrompt(): string | null;
49
- }
@@ -1,16 +0,0 @@
1
- import type { ToolDefinition } from "../../agent/types.js";
2
- export type HostSkillDirectoryProjection = {
3
- tools: ToolDefinition[];
4
- prompt?: undefined;
5
- revision?: undefined;
6
- } | {
7
- tools: ToolDefinition[];
8
- prompt: string;
9
- revision: string;
10
- };
11
- /**
12
- * Promote the Host's standard MCP Skill directory metadata into first-class model context.
13
- * The Host remains the catalog authority and the model remains the selector; this adapter
14
- * only prevents a large directory from being buried inside one generic tool description.
15
- */
16
- export declare function projectHostSkillDirectory(tools: readonly ToolDefinition[]): HostSkillDirectoryProjection;
@@ -1,38 +0,0 @@
1
- /**
2
- * Group Session Auto-Split — detects idle group sessions and creates successor sessions.
3
- *
4
- * When a group chat message arrives and the last session activity was > N hours ago,
5
- * the old session is sealed and a new session is created with:
6
- * - previousSessionId linking to the predecessor
7
- * - carryoverSummary (from predecessor's taskSummary or last messages)
8
- * - Same groupKey, groupName, groupPlatform, projectId
9
- *
10
- * This prevents unbounded context growth in long-lived group chats.
11
- */
12
- import { type SessionMetadata } from "./session-persistence.js";
13
- export interface GroupSplitResult {
14
- /** Whether a split occurred */
15
- split: boolean;
16
- /** The session ID to use for the current turn (new or existing) */
17
- activeSessionId: string;
18
- /** If split, the sealed predecessor session ID */
19
- sealedSessionId?: string;
20
- }
21
- /**
22
- * Check whether a group session should be auto-split due to idle timeout.
23
- * If yes, seal the old session and create a new successor.
24
- *
25
- * @param currentSession - The existing group session metadata
26
- * @param projectRoot - The project workspace directory
27
- * @returns Split result with the session ID to use
28
- */
29
- export declare function maybeAutoSplitGroupSession(currentSession: SessionMetadata, projectRoot: string): Promise<GroupSplitResult>;
30
- /**
31
- * Check whether a group session has exceeded MAX_TURNS hard limit.
32
- * Called AFTER turn.end — soft-splits without interrupting the current turn.
33
- *
34
- * @param currentSession - The session that just finished a turn
35
- * @param projectRoot - The project workspace directory
36
- * @returns Split result (new session ready for next message, or no-op)
37
- */
38
- export declare function maybeHardLimitSplit(currentSession: SessionMetadata, projectRoot: string): Promise<GroupSplitResult>;
@@ -1,47 +0,0 @@
1
- /**
2
- * Inbound Upload Persistence (decision A) — the agent owns its companion data, so user-uploaded
3
- * attachments are persisted by the AGENT (not the gateway) into the session's projectData uploads
4
- * dir, where they become part of the session record and are cleaned up on session/project delete.
5
- *
6
- * The gateway puts an inbound attachment in its short-lived transport cache and hands the agent a
7
- * `http://127.0.0.1:<port>/media/<id>` URL. We fetch those bytes once, write them under
8
- * projectData/<projectId>/uploads/<sessionId>/, and rewrite the reference to a gateway local-media
9
- * proxy URL pointing at the persisted file (same `/api/media/local?src=file://…` shape the gateway
10
- * used before — provider-core still sees a 127.0.0.1 local URL for cloud upload, and the frontend
11
- * still GETs it). Any failure degrades gracefully to the original URL (the turn still works off the
12
- * transport cache; only long-term persistence is skipped).
13
- */
14
- import type { ChatMessage } from "../../protocol/wire/index.js";
15
- export interface PersistedUpload {
16
- url: string;
17
- localPath?: string;
18
- /**
19
- * Whether the bytes were actually written to durable storage. `true` on success, `false` when a
20
- * transport upload was found but persisting it FAILED (fetch error / non-ok / write error) — the
21
- * returned `url` is then the short-lived transport URL that dies with the turn. `undefined` means
22
- * the input was not a transport upload to begin with (already-persisted / remote / file://), which
23
- * is not a failure. Honesty over silence: callers use `false` to warn instead of pretending it saved.
24
- */
25
- persisted?: boolean;
26
- }
27
- /** 同 persistInboundUploadUrl,但返回持久化后的本地绝对路径(供模型直接 read/exec)。 */
28
- export declare function persistInboundUploadUrlDetailed(url: string, projectId: string, sessionId: string): Promise<PersistedUpload>;
29
- /**
30
- * Persist a single inbound upload URL to projectData uploads and return the rewritten proxy URL.
31
- * Non-transport URLs (already-persisted, remote, file://) and any failure return the input unchanged.
32
- */
33
- export declare function persistInboundUploadUrl(url: string, projectId: string, sessionId: string): Promise<string>;
34
- /**
35
- * Persist + rewrite the inbound uploads on the LAST user message of a turn (the new message;
36
- * resumed history already carries persisted local URLs). Mutates and returns the message array.
37
- *
38
- * Failure parity with the document path (appendLocalDocumentNotesToText): when a media upload
39
- * could NOT be persisted, the message gets a model-visible note instead of silently keeping a
40
- * transport URL that expires with the turn — the model must know the reference is short-lived.
41
- */
42
- export declare function persistInboundUploadsForTurn(messages: ChatMessage[], projectId: string | undefined, sessionId: string | undefined): Promise<ChatMessage[]>;
43
- /**
44
- * 在任意模型可见文本中查找文档类传输 URL,落盘并追加本地路径注记。
45
- * 供 turn-handler 的 attachmentModelContext 使用;持久会话正文不包含该清单。
46
- */
47
- export declare function appendLocalDocumentNotesToText(text: string, projectId: string | undefined, sessionId: string | undefined): Promise<string>;
@@ -1,12 +0,0 @@
1
- import type { SessionListEntry } from "./session-types.js";
2
- export declare function listSessions(limit: number | undefined, projectRoot: string): Promise<SessionListEntry[]>;
3
- export declare function deleteSession(sessionId: string, projectRoot: string): Promise<void>;
4
- /**
5
- * ⚠️ Destructive cascade with NO user-visible confirmation: every pruned session goes through
6
- * deleteSession, which permanently removes its transcript + metadata + checkpoints + uploads.
7
- * Currently has NO caller. If you wire this up, the deletions must be surfaced to the user
8
- * (count + which sessions) — silently reaping MAX_SESSIONS-overflow would be exactly the kind of
9
- * invisible data loss docs/judgment-over-mechanism.md forbids. Also note listSessions skips
10
- * unreadable-metadata sessions, so a prune pass under fs errors could mis-rank what "oldest" is.
11
- */
12
- export declare function pruneOldSessions(projectRoot: string): Promise<number>;
@@ -1,4 +0,0 @@
1
- export declare function markSessionDeleted(sessionId: string, projectRoot: string): Promise<void>;
2
- export declare function isSessionDeleted(sessionId: string, projectRoot: string): Promise<boolean>;
3
- export declare function isSessionDeletedSync(sessionId: string, projectRoot: string): boolean;
4
- export declare function listDeletedSessionIds(projectRoot: string): Promise<string[]>;
@@ -1,26 +0,0 @@
1
- /**
2
- * SessionLocator — resolves session storage paths from projectId.
3
- *
4
- * Every session operation uses this locator to determine the correct
5
- * filesystem path based on the session's owning projectId.
6
- * When projectId is missing, falls back to scanning all projects.
7
- */
8
- export declare class SessionLocator {
9
- /** Get sessions root directory for a given projectId. */
10
- getSessionsRoot(projectId: string): string;
11
- /** Get the workspace dir for a project. */
12
- getProjectWorkspaceDir(projectId: string): string;
13
- /** Get the session directory path for a given projectId + sessionId. */
14
- getSessionDir(projectId: string, sessionId: string): string;
15
- /**
16
- * Resolve the workspaceDir for a session given its projectId.
17
- * If projectId is not provided, scans all projects for the session directory.
18
- */
19
- resolveWorkspaceDir(sessionId: string, projectId?: string): string;
20
- /** Get the active project's workspace dir (for new session creation when no projectId specified). */
21
- getActiveProjectWorkspaceDir(): string;
22
- /** Get the active project's ID. */
23
- getActiveProjectId(): string;
24
- /** Get the default project's ID for external personal channel sessions. */
25
- getDefaultProjectId(): string;
26
- }
@@ -1,8 +0,0 @@
1
- import type { SessionMetadata, SessionMetadataPatch, SessionStateSaveMetadata, SessionUsageSnapshot } from "./session-types.js";
2
- export declare function getSessionMetadata(sessionId: string, projectRoot: string): SessionMetadata | null;
3
- export declare function readSessionMetadata(sessionId: string, projectRoot: string, defaults?: {
4
- messageCount?: number;
5
- }): Promise<SessionMetadata>;
6
- export declare function saveSessionState(sessionId: string, usageSnapshot: SessionUsageSnapshot, metadata: SessionStateSaveMetadata, projectRoot: string): Promise<void>;
7
- export declare function updateSessionMetadata(sessionId: string, patch: SessionMetadataPatch, projectRoot: string): Promise<SessionMetadata | null>;
8
- export declare function persistTaskSummary(sessionId: string, projectRoot: string, summary: string, generatedAtTurn: number): Promise<void>;
@@ -1,8 +0,0 @@
1
- export declare const TRANSCRIPT_FILE = "transcript.jsonl";
2
- export declare const METADATA_FILE = "metadata.json";
3
- export declare function sanitizeSessionId(sessionId: string): string;
4
- export declare function getSessionsRoot(projectRoot: string): string;
5
- export declare function getSessionDir(sessionId: string, projectRoot: string): string;
6
- export declare function getMetadataPath(sessionId: string, projectRoot: string): string;
7
- export declare function getTranscriptPath(sessionId: string, projectRoot: string): string;
8
- export declare function findExistingSessionDir(sessionId: string, projectRoot: string): string | undefined;
@@ -1,6 +0,0 @@
1
- export interface SessionPermissionStorePathOptions {
2
- /** Test-only path override; production always uses the centralized session directory. */
3
- sessionDir?: string;
4
- }
5
- export declare function loadSessionAllowedDirectories(sessionId: string, projectRoot: string, options?: SessionPermissionStorePathOptions): string[];
6
- export declare function appendSessionAllowedDirectory(sessionId: string, projectRoot: string, pathPrefix: string, options?: SessionPermissionStorePathOptions): Promise<void>;
@@ -1,37 +0,0 @@
1
- /**
2
- * Session persistence authority facade.
3
- *
4
- * Every durable read/write goes through HostSessionClient. Standalone/local persistence is not a
5
- * supported runtime mode after the S3 state-inversion cut.
6
- */
7
- import type { ChatMessage } from "../../protocol/wire/index.js";
8
- import type { HostSessionClient } from "../../transport/host-session-client.js";
9
- import type { AppendMessageOutcome } from "./session-transcript-store.js";
10
- import { getSessionMetadata, readSessionMetadata } from "./session-metadata-store.js";
11
- import type { MessageDisplayMetadata, PersistedSession, SessionMetadataPatch, SessionStateSaveMetadata, SessionUsageSnapshot, TokenUsage } from "./session-types.js";
12
- export declare class SessionAppendDrainTimeoutError extends Error {
13
- constructor(sessionId: string, timeoutMs: number);
14
- }
15
- export declare function configureHostSessionPersistence(resolver: () => HostSessionClient | undefined): void;
16
- export declare function isHostSessionPersistenceActive(): boolean;
17
- export declare function requestHostGroupSplit(sessionId: string, operationId: string, reason: "idle" | "turn-limit", cas?: {
18
- expectedLastActiveAt?: string;
19
- expectedTurnCount?: number;
20
- }): Promise<{
21
- status: "updated" | "duplicate" | "session-deleted";
22
- nextSessionId?: string;
23
- } | undefined>;
24
- export declare function appendMessage(sessionId: string, message: ChatMessage, projectRoot: string, turnId?: string, metadata?: {
25
- usage?: TokenUsage;
26
- displayMetadata?: MessageDisplayMetadata;
27
- }): Promise<AppendMessageOutcome>;
28
- export declare function waitForSessionPersistenceAppends(sessionId: string, projectRoot: string, timeoutMs?: number): Promise<void>;
29
- export declare function loadSessionForResume(sessionId: string, projectRoot: string, options?: {
30
- includeDisplayMetadata?: boolean;
31
- }): Promise<PersistedSession | null>;
32
- export declare function saveSessionState(sessionId: string, usageSnapshot: SessionUsageSnapshot, metadata: SessionStateSaveMetadata, projectRoot: string): Promise<void>;
33
- export declare function updateSessionMetadata(sessionId: string, patch: SessionMetadataPatch, projectRoot: string): Promise<import("./session-types.js").SessionMetadata | null>;
34
- export { getSessionMetadata, readSessionMetadata };
35
- export { deleteSession, listSessions, pruneOldSessions } from "./session-catalog.js";
36
- export { generateSessionTitle, maybeGenerateTaskSummary, shouldGenerateTaskSummary, } from "./session-summary.js";
37
- export { SESSION_SCHEMA_VERSION, type MessageDisplayMetadata, type PersistedChatMessage, type PersistedSession, type SessionListEntry, type SessionMetadata, type TaskSummaryDeps, } from "./session-types.js";
@@ -1,62 +0,0 @@
1
- export declare function isSideEffectTool(name: string): boolean;
2
- /** 取最后一条 user 消息的纯文本前若干字,供崩溃恢复 UI 提示(多模态/空则无预览)。 */
3
- export declare function extractLastUserPreview(messages: ReadonlyArray<{
4
- role: string;
5
- content: unknown;
6
- }>): string | undefined;
7
- /**
8
- * turn 开始:写 in-flight 标记。fire-and-forget 语义 —— 绝不阻塞或抛错打断 turn。
9
- * projectRoot 未解析(无项目上下文)时静默跳过。
10
- */
11
- export declare function markTurnInflight(sessionId: string, projectRoot: string | undefined, turnId: string, messages: ReadonlyArray<{
12
- role: string;
13
- content: unknown;
14
- }>): Promise<void>;
15
- /**
16
- * 首个副作用工具执行时置位 hadSideEffectTool(仅首次,避免每次工具调用写盘)。
17
- * 安全档不据此自动续,仅用于 L4 的"继续可能重复"提示 + 为智能档铺路。
18
- */
19
- export declare function markInflightSideEffect(sessionId: string, projectRoot: string | undefined): Promise<void>;
20
- /**
21
- * turn 结束(finally 到达 = 有始有终,哪怕失败/用户中断):清标记 + 中断计数归零。
22
- * finally 未到达(进程被硬杀/崩溃)→ 标记残留,由 L3 启动扫描接住。
23
- */
24
- export declare function clearTurnInflight(sessionId: string, projectRoot: string | undefined): Promise<void>;
25
- interface SessionMetaLocation {
26
- sessionId: string;
27
- metadataPath: string;
28
- }
29
- /**
30
- * 遍历当前 owner profile 下所有 project 的所有 session 的 metadata.json 绝对路径。
31
- * 直接扫 projectData/<projectId>/sessions/<sessionId>/ —— 用绝对路径,绕开 projectRoot↔projectId
32
- * 解析歧义(未注册 project 的残留 session 也覆盖到)。L2 清标记 + L3 启动扫描共用。
33
- */
34
- export declare function enumerateSessionMetadataFiles(): Promise<SessionMetaLocation[]>;
35
- /**
36
- * L2 优雅关闭:清所有 session 残留的 in-flight 标记 + 中断计数归零。
37
- * 优雅关闭 == 主动清标记 == hermes 的 .clean_shutdown 语义(更简、单一事实源)。
38
- * 直接原子改写 metadata.json(不经 updateSessionMetadata 的 projectRoot 解析)。返回清理数。
39
- */
40
- export declare function clearAllInflightMarkers(): Promise<number>;
41
- /** 读同目录 transcript.jsonl 最后一条 assistant 消息的 ts(毫秒)。无则 null。 */
42
- declare function readLastAssistantTs(metadataPath: string): Promise<number | null>;
43
- export interface CrashedTurnInfo {
44
- sessionId: string;
45
- turnId: string;
46
- startedAt: string;
47
- lastUserPreview?: string;
48
- hadSideEffectTool: boolean;
49
- }
50
- /**
51
- * L3 启动扫描:找崩溃残留的 in-flight 标记,处理双校验/熔断,返回待恢复列表。
52
- * agent 每次 initialize 调用 —— gateway 重启 or agent respawn 都覆盖(标记本身是事实源)。
53
- *
54
- * - 双校验(借鉴 codex #12382,spec §7):transcript 最后一条 assistant ts ≥ marker.startedAt →
55
- * 该轮其实已完成、只是清标记那步没落盘 → 静默清、不误报。
56
- * - 熔断:连续崩溃中断达 MAX_INTERRUPTED_RECOVERY → 放弃(清标记 + recoveryAbandonedAt + fail-loud)。
57
- * - 否则:保留标记 + 递增中断计数,收进待恢复列表(交给 UI 让用户手动续)。
58
- */
59
- export declare function scanForCrashedTurns(): Promise<CrashedTurnInfo[]>;
60
- /** Test-only escape hatch: readLastAssistantTs is otherwise module-private (Cut 5.2). */
61
- export declare const __test_readLastAssistantTs: typeof readLastAssistantTs;
62
- export {};
@@ -1,28 +0,0 @@
1
- /**
2
- * Single source of truth for session resource keys (canonical identity) and the derived
3
- * resident-pool / delegation keys. Forbids scattered ad-hoc string concatenation of session keys
4
- * (invariant I2, docs/session-identity-alignment-spec.md). Leaf module — imports nothing.
5
- */
6
- /** Canonical session identity: our-minted, stable-from-creation id + its owning agent + project. */
7
- export interface SessionResource {
8
- /** Owning agent kind: own ("qlogicagent") / codex / claude / … (= SessionMetadata.agentId). */
9
- agentId: string;
10
- /** Owning project id (path-derived / opaque; not minted here). */
11
- projectId: string;
12
- /** Our-minted session id, stable from creation; native identity is held by Gateway Host state. */
13
- canonicalSessionId: string;
14
- }
15
- /** Serialize the canonical session resource to its single opaque key string. */
16
- export declare function buildSessionResourceKey(r: SessionResource): string;
17
- /** Parse a key produced by {@link buildSessionResourceKey}; throws on a malformed key. */
18
- export declare function parseSessionResourceKey(key: string): SessionResource;
19
- /**
20
- * Resident external-agent pool key: same agent + workspace + session ⇒ same resident process.
21
- * `sessionId` may be a canonical id, the WARM_SESSION token, or undefined (defaults to "default").
22
- * Byte-identical to the historical inline pool key it replaces.
23
- */
24
- export declare function buildAgentPoolKey(agentId: string, cwd: string, sessionId?: string): string;
25
- /** Prefix matching every pool key for `agentId` (agent-scoped eviction, exact id-boundary). */
26
- export declare function agentPoolKeyPrefix(agentId: string): string;
27
- /** @mention delegation serialization key for one (agent × conversation) pair. */
28
- export declare function buildConvKey(agentId: string, canonicalSessionId: string): string;
@@ -1,9 +0,0 @@
1
- import type { PersistedSession } from "./session-types.js";
2
- /** Coded error: the session's project root cannot be read at all (deleted dir, unplugged drive,
3
- * permissions). Distinguishable from the `null` return, which strictly means "this session has no
4
- * persisted transcript" — conflating the two made every caller silently start a NEW empty session
5
- * on a read failure (docs/judgment-over-mechanism.md: "read failed" ≠ "does not exist"). */
6
- export declare const PROJECT_ROOT_UNAVAILABLE = "PROJECT_ROOT_UNAVAILABLE";
7
- export declare function loadSessionForResume(sessionId: string, projectRoot: string, options?: {
8
- includeDisplayMetadata?: boolean;
9
- }): Promise<PersistedSession | null>;
@@ -1,10 +0,0 @@
1
- import type { SessionMetadata } from "./session-types.js";
2
- export interface SessionMetadataDefaults {
3
- projectId?: string;
4
- createdAt?: string;
5
- lastActiveAt?: string;
6
- turnCount?: number;
7
- messageCount?: number;
8
- }
9
- export declare function normalizeSessionMetadata(sessionId: string, input: Partial<SessionMetadata> | null | undefined, defaults?: SessionMetadataDefaults): SessionMetadata;
10
- export declare function metadataNeedsMigration(input: Partial<SessionMetadata> | null | undefined): boolean;
@@ -1,7 +0,0 @@
1
- import type { ChatMessage } from "../../protocol/wire/index.js";
2
- import type { SessionMetadata, TaskSummaryDeps } from "./session-types.js";
3
- export declare function shouldGenerateTaskSummary(metadata: SessionMetadata): boolean;
4
- export declare function generateSessionTitle(userMessage: string, deps: TaskSummaryDeps): Promise<string | null>;
5
- export declare function maybeGenerateTaskSummary(sessionId: string, metadata: SessionMetadata, recentMessages: ChatMessage[], deps: TaskSummaryDeps, projectRoot: string, persist?: (summary: string, generatedAtTurn: number) => Promise<void>): Promise<string | null>;
6
- declare function buildDigestContext(recentMessages: ChatMessage[]): string;
7
- export { buildDigestContext as __test_buildDigestContext };
@@ -1,9 +0,0 @@
1
- export declare function hasLikelyMojibake(text: string): boolean;
2
- export declare function cleanSessionTitleCandidate(title: string | undefined | null, options?: {
3
- maxLength?: number;
4
- }): string | undefined;
5
- export declare function titleFromPromptFallback(prompt: string, fallback: string, options?: {
6
- maxLength?: number;
7
- ellipsis?: string;
8
- }): string;
9
- export declare function deterministicSessionTitleForPrompt(prompt: string): string | null;
@@ -1,30 +0,0 @@
1
- import type { ChatMessage } from "../../protocol/wire/index.js";
2
- import type { MessageDisplayMetadata, PersistedChatMessage, TokenUsage } from "./session-types.js";
3
- export interface TranscriptLoadResult {
4
- messages: PersistedChatMessage[];
5
- corruptLines: number;
6
- /** 1-based line numbers that failed to parse (bounded to the first MAX_REPORTED_CORRUPT_LINES). */
7
- corruptLineNumbers: number[];
8
- }
9
- /**
10
- * Outcome of an appendMessage call. "skipped-deleted" (the session was deleted — a LEGAL late-write
11
- * no-op) is deliberately distinguishable from "failed" (the write itself failed — the message is
12
- * LOST and callers must leave a trace / surface it), per docs/judgment-over-mechanism.md:
13
- * "does not exist" and "write failed" must never be conflated into one silent boolean.
14
- */
15
- export type AppendMessageOutcome = "appended" | "skipped-deleted" | "failed";
16
- export declare function appendMessage(sessionId: string, message: ChatMessage, projectRoot: string, turnId?: string, metadata?: {
17
- usage?: TokenUsage;
18
- displayMetadata?: MessageDisplayMetadata;
19
- }): Promise<AppendMessageOutcome>;
20
- /**
21
- * Public drain: await all queued transcript appends for one session to hit disk. Wraps the
22
- * composite-key `waitForTranscriptAppends` (the queue is keyed by projectRoot+sessionId, not
23
- * sessionId alone). Call before a process kill / cold-restart test — reading the file does NOT
24
- * flush a same-process fire-and-forget tail (Cut 8).
25
- */
26
- export declare function waitForSessionTranscriptAppends(sessionId: string, projectRoot: string): Promise<void>;
27
- export declare function countTranscriptMessages(sessionId: string, projectRoot: string): Promise<number | null>;
28
- export declare function loadTranscript(sessionId: string, projectRoot: string, options?: {
29
- includeDisplayMetadata?: boolean;
30
- }): Promise<TranscriptLoadResult | null>;
@@ -1,113 +0,0 @@
1
- import type { ChatMessage } from "../../protocol/wire/index.js";
2
- import type { TokenUsage } from "../../agent/types.js";
3
- import type { SessionUsageSnapshot } from "./session-state.js";
4
- export declare const SESSION_SCHEMA_VERSION = 1;
5
- /** 熔断阈值:连续崩溃中断达此次数后放弃自动恢复(对齐 hermes stuck-loop 的 3)。 */
6
- export declare const MAX_INTERRUPTED_RECOVERY = 3;
7
- /**
8
- * 在飞轮次标记。turn 开始写入 SessionMetadata.inflightTurn,正常完成/用户主动中断时清除。
9
- * 崩溃/非优雅退出时它残留在磁盘上 —— 这就是"上次这轮没跑完"的显式信号
10
- * (对照 codex CLI 靠时间戳隐式推断、坏了要手动裁 JSONL,见 docs/session-lifecycle-recovery-spec.md §7)。
11
- */
12
- export interface InflightTurnMarker {
13
- turnId: string;
14
- /** turn 开始时间(ISO)。启动扫描用它与 transcript 最后一条 assistant 消息的 ts 做双校验。 */
15
- startedAt: string;
16
- /** 最后一条 user 消息前若干字(UI 提示用,不含敏感全文)。 */
17
- lastUserPreview?: string;
18
- /** 该轮是否已执行过有副作用的工具(写文件/发消息/外部 API)。安全档不据此自动续,仅用于 UI"可能重复"提示 + 为智能档铺路。 */
19
- hadSideEffectTool?: boolean;
20
- }
21
- export interface SessionMetadata {
22
- schemaVersion?: number;
23
- sessionId: string;
24
- projectId: string;
25
- createdAt: string;
26
- lastActiveAt: string;
27
- model?: string;
28
- /** Agent that owns this session (e.g. "qlogicagent", "codex"). */
29
- agentId?: string;
30
- cwd?: string;
31
- turnCount: number;
32
- messageCount: number;
33
- title?: string;
34
- taskSummary?: string;
35
- taskSummaryGeneratedAt?: number;
36
- pinnedAt?: string;
37
- archivedAt?: string;
38
- sealedAt?: string;
39
- previousSessionId?: string;
40
- carryoverSummary?: string;
41
- type?: "personal" | "group";
42
- ownerPlatform?: string;
43
- ownerId?: string;
44
- groupKey?: string;
45
- groupName?: string;
46
- groupPlatform?: string;
47
- totalInputTokens?: number;
48
- totalOutputTokens?: number;
49
- /** 在飞轮次标记:存在即"上次这轮没跑完"(崩溃残留)。turn 开始写、正常完成/中断清。 */
50
- inflightTurn?: InflightTurnMarker;
51
- /** 连续崩溃中断计数;turn 正常完成清零;达 MAX_INTERRUPTED_RECOVERY 熔断放弃恢复。 */
52
- interruptedTurnCount?: number;
53
- /** 达熔断阈值放弃恢复的时间戳(UI 显示"多次中断已停止自动恢复")。 */
54
- recoveryAbandonedAt?: string;
55
- }
56
- export interface PersistedSession {
57
- metadata: SessionMetadata;
58
- messages: PersistedChatMessage[];
59
- /**
60
- * Count of transcript lines that failed to parse and were skipped on load. Surfaced so the UI can
61
- * tell the user "N 条消息无法读取" instead of silently resuming a conversation with holes in it.
62
- * Omitted/0 for a clean transcript.
63
- */
64
- corruptLines?: number;
65
- }
66
- export interface MessageDisplayMetadata {
67
- messageId?: string;
68
- platform?: string;
69
- sourceChannel?: string;
70
- source?: string;
71
- chatId?: string;
72
- userId?: string;
73
- userName?: string;
74
- /**
75
- * Presentation kind for a persisted message whose ROLE alone doesn't capture how
76
- * the UI should render it. Currently: "mid_turn_guidance" — a user-authored message
77
- * injected into a running turn (运行中引导). It stays role:"user" (the model must see
78
- * it as the user's words), but the desktop renders it as an agent-side "收到引导"
79
- * receipt line rather than a standalone user bubble.
80
- */
81
- kind?: string;
82
- }
83
- export interface PersistedChatMessage extends ChatMessage {
84
- timestamp?: string;
85
- turnId?: string;
86
- usage?: TokenUsage;
87
- displayMetadata?: MessageDisplayMetadata;
88
- }
89
- export interface SessionListEntry {
90
- sessionId: string;
91
- title?: string;
92
- lastActiveAt: string;
93
- messageCount: number;
94
- model?: string;
95
- agentId?: string;
96
- pinnedAt?: string;
97
- archivedAt?: string;
98
- sealedAt?: string;
99
- projectId: string;
100
- type?: "personal" | "group";
101
- createdAt: string;
102
- groupKey?: string;
103
- previousSessionId?: string;
104
- carryoverSummary?: string | null;
105
- }
106
- export interface TaskSummaryDeps {
107
- transport: import("../ports/index.js").LLMTransport;
108
- apiKey: string;
109
- model: string;
110
- }
111
- export type SessionMetadataPatch = Partial<Record<keyof SessionMetadata, SessionMetadata[keyof SessionMetadata] | null>>;
112
- export type SessionStateSaveMetadata = Partial<SessionMetadata>;
113
- export type { ChatMessage, SessionUsageSnapshot, TokenUsage };
@@ -1,3 +0,0 @@
1
- export declare function withSessionWriteLimit<T>(fn: () => Promise<T>): Promise<T>;
2
- export declare function withTranscriptAppendOrder<T>(sessionKey: string, fn: () => Promise<T>): Promise<T>;
3
- export declare function waitForTranscriptAppends(sessionKey: string): Promise<void>;