@vellumai/assistant 0.10.3-dev.202606291342.c7a83ea → 0.10.3-dev.202606291709.2b4d83d

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 (417) hide show
  1. package/ARCHITECTURE.md +13 -13
  2. package/openapi.yaml +60 -0
  3. package/package.json +1 -1
  4. package/scripts/generate-openapi.ts +69 -4
  5. package/src/__tests__/app-builder-tool-scripts.test.ts +2 -2
  6. package/src/__tests__/app-bundler.test.ts +1 -1
  7. package/src/__tests__/app-conversation-ids-backfill.test.ts +2 -2
  8. package/src/__tests__/app-conversation-ids.test.ts +1 -1
  9. package/src/__tests__/app-dir-path-guard.test.ts +2 -2
  10. package/src/__tests__/app-executors.test.ts +1 -1
  11. package/src/__tests__/app-git-history.test.ts +2 -2
  12. package/src/__tests__/app-git-service.test.ts +2 -2
  13. package/src/__tests__/app-routes-csp.test.ts +2 -2
  14. package/src/__tests__/app-source-watcher.test.ts +1 -1
  15. package/src/__tests__/app-store-dir-names.test.ts +1 -1
  16. package/src/__tests__/approval-cascade.test.ts +1 -1
  17. package/src/__tests__/attachments-store.test.ts +2 -2
  18. package/src/__tests__/audit-log-rotation.test.ts +3 -3
  19. package/src/__tests__/auth-fallback-events-store.test.ts +4 -4
  20. package/src/__tests__/auto-analysis-end-to-end.test.ts +1 -1
  21. package/src/__tests__/background-workers-disk-pressure.test.ts +2 -2
  22. package/src/__tests__/btw-routes.test.ts +1 -1
  23. package/src/__tests__/call-controller.test.ts +2 -2
  24. package/src/__tests__/call-domain.test.ts +1 -1
  25. package/src/__tests__/cancel-resolves-conversation-key.test.ts +1 -1
  26. package/src/__tests__/canonical-guardian-store.test.ts +1 -1
  27. package/src/__tests__/channel-approval-routes.test.ts +3 -3
  28. package/src/__tests__/channel-delivery-store.test.ts +1 -1
  29. package/src/__tests__/channel-guardian.test.ts +7 -7
  30. package/src/__tests__/channel-retry-sweep.test.ts +45 -0
  31. package/src/__tests__/compaction-events.test.ts +2 -2
  32. package/src/__tests__/config-watcher-cleanup-throttle.test.ts +2 -2
  33. package/src/__tests__/config-watcher-skill-reseed.test.ts +1 -1
  34. package/src/__tests__/confirmation-request-guardian-bridge.test.ts +2 -2
  35. package/src/__tests__/context-search-conversations-source.test.ts +1 -1
  36. package/src/__tests__/conversation-abort-tool-results.test.ts +1 -1
  37. package/src/__tests__/conversation-agent-loop-inference-profile.test.ts +33 -5
  38. package/src/__tests__/conversation-agent-loop-overflow.test.ts +2 -2
  39. package/src/__tests__/conversation-agent-loop.test.ts +7 -7
  40. package/src/__tests__/conversation-analysis-routes.test.ts +1 -1
  41. package/src/__tests__/conversation-app-control-instantiation.test.ts +1 -1
  42. package/src/__tests__/conversation-app-control-lifecycle.test.ts +2 -2
  43. package/src/__tests__/conversation-attention-store.test.ts +1 -1
  44. package/src/__tests__/conversation-attention-telegram.test.ts +1 -1
  45. package/src/__tests__/conversation-confirmation-signals.test.ts +1 -1
  46. package/src/__tests__/conversation-directories-parse.test.ts +1 -1
  47. package/src/__tests__/conversation-disk-view-integration.test.ts +4 -4
  48. package/src/__tests__/conversation-disk-view.test.ts +12 -12
  49. package/src/__tests__/conversation-evictor.test.ts +32 -7
  50. package/src/__tests__/conversation-fork-crud.test.ts +6 -6
  51. package/src/__tests__/conversation-fork-retrospective.test.ts +1 -1
  52. package/src/__tests__/conversation-key-store-disk-view.test.ts +1 -1
  53. package/src/__tests__/conversation-process-app-control-preactivation.test.ts +2 -2
  54. package/src/__tests__/conversation-process-callsite.test.ts +1 -1
  55. package/src/__tests__/conversation-provider-retry-repair.test.ts +1 -1
  56. package/src/__tests__/conversation-queue.test.ts +6 -3
  57. package/src/__tests__/conversation-routes-disk-view.test.ts +7 -7
  58. package/src/__tests__/conversation-routes-guardian-reply.test.ts +2 -2
  59. package/src/__tests__/conversation-routes-slash-commands.test.ts +6 -4
  60. package/src/__tests__/conversation-runtime-workspace.test.ts +1 -1
  61. package/src/__tests__/conversation-skill-tools.test.ts +2 -2
  62. package/src/__tests__/conversation-slash-queue.test.ts +2 -2
  63. package/src/__tests__/conversation-slash-unknown.test.ts +2 -2
  64. package/src/__tests__/conversation-speed-override.test.ts +1 -1
  65. package/src/__tests__/conversation-surfaces-activation-emit.test.ts +1 -1
  66. package/src/__tests__/conversation-sync-tags.test.ts +1 -1
  67. package/src/__tests__/conversation-title-service.test.ts +1 -1
  68. package/src/__tests__/conversation-tool-setup-app-refresh.test.ts +1 -1
  69. package/src/__tests__/conversation-tool-setup-attribution.test.ts +1 -1
  70. package/src/__tests__/conversation-unread-route.test.ts +2 -2
  71. package/src/__tests__/conversation-workspace-cache-state.test.ts +2 -2
  72. package/src/__tests__/conversation-workspace-injection.test.ts +2 -2
  73. package/src/__tests__/conversation-workspace-tool-tracking.test.ts +2 -2
  74. package/src/__tests__/db-conversation-inference-profile-migration.test.ts +2 -2
  75. package/src/__tests__/deterministic-verification-control-plane.test.ts +2 -2
  76. package/src/__tests__/dm-persistence.test.ts +1 -1
  77. package/src/__tests__/edit-propagation.test.ts +1 -1
  78. package/src/__tests__/empty-state-greeting-cache.test.ts +1 -1
  79. package/src/__tests__/exploration-drift-hook.test.ts +7 -24
  80. package/src/__tests__/filing-service.test.ts +1 -1
  81. package/src/__tests__/guardian-card-withdrawal.test.ts +1 -1
  82. package/src/__tests__/guardian-decision-primitive-canonical.test.ts +1 -1
  83. package/src/__tests__/guardian-expiry-notifier.test.ts +2 -2
  84. package/src/__tests__/guardian-principal-id-roundtrip.test.ts +1 -1
  85. package/src/__tests__/guardian-routing-invariants.test.ts +1 -1
  86. package/src/__tests__/guardian-verification-voice-binding.test.ts +2 -2
  87. package/src/__tests__/handlers-user-message-approval-consumption.test.ts +2 -2
  88. package/src/__tests__/heartbeat-disk-pressure.test.ts +1 -1
  89. package/src/__tests__/heartbeat-service.test.ts +1 -1
  90. package/src/__tests__/helpers/create-guardian-binding.ts +1 -1
  91. package/src/__tests__/http-conversation-lineage.test.ts +1 -1
  92. package/src/__tests__/http-user-message-parity.test.ts +2 -2
  93. package/src/__tests__/identity-routes.test.ts +113 -25
  94. package/src/__tests__/inbound-slack-persistence.test.ts +1 -1
  95. package/src/__tests__/internal-telemetry-routes.test.ts +1 -1
  96. package/src/__tests__/media-stream-server-integration.test.ts +1 -1
  97. package/src/__tests__/memory-jobs-worker-lanes.test.ts +1 -1
  98. package/src/__tests__/messaging-send-tool.test.ts +1 -1
  99. package/src/__tests__/non-member-access-request.test.ts +1 -1
  100. package/src/__tests__/notification-candidate-guardian-context.test.ts +1 -1
  101. package/src/__tests__/oauth-provider-visibility.test.ts +1 -1
  102. package/src/__tests__/oauth-store.test.ts +1 -1
  103. package/src/__tests__/outbound-slack-persistence.test.ts +2 -2
  104. package/src/__tests__/persistence-layering-guard.test.ts +3 -43
  105. package/src/__tests__/persistence-secret-redaction.test.ts +1 -1
  106. package/src/__tests__/platform-bash-auto-approve.test.ts +2 -2
  107. package/src/__tests__/plugin-import-boundary-guard.test.ts +3 -8
  108. package/src/__tests__/process-message-background-slack.test.ts +2 -2
  109. package/src/__tests__/process-message-display-content.test.ts +1 -1
  110. package/src/__tests__/processing-flag-persist-failure.test.ts +1 -1
  111. package/src/__tests__/prune-jobs-changes-parser.test.ts +1 -1
  112. package/src/__tests__/prune-old-conversations-job.test.ts +1 -1
  113. package/src/__tests__/published-app-updater.test.ts +3 -3
  114. package/src/__tests__/reaction-persistence.test.ts +2 -2
  115. package/src/__tests__/relay-server.test.ts +7 -7
  116. package/src/__tests__/require-fresh-approval.test.ts +1 -1
  117. package/src/__tests__/resolve-app-id.test.ts +3 -3
  118. package/src/__tests__/runtime-attachment-metadata.test.ts +2 -2
  119. package/src/__tests__/runtime-events-sse-bilingual.test.ts +1 -1
  120. package/src/__tests__/runtime-events-sse-parity.test.ts +1 -1
  121. package/src/__tests__/runtime-events-sse-reconnect.test.ts +1 -1
  122. package/src/__tests__/runtime-events-sse.test.ts +1 -1
  123. package/src/__tests__/schedule-routes.test.ts +1 -1
  124. package/src/__tests__/scoped-approval-grants.test.ts +1 -1
  125. package/src/__tests__/scoped-grant-security-matrix.test.ts +1 -1
  126. package/src/__tests__/secret-ingress-channel.test.ts +1 -1
  127. package/src/__tests__/secret-ingress-http.test.ts +2 -2
  128. package/src/__tests__/send-endpoint-busy.test.ts +4 -4
  129. package/src/__tests__/skill-projection-feature-flag.test.ts +1 -1
  130. package/src/__tests__/skill-projection.benchmark.test.ts +1 -1
  131. package/src/__tests__/slack-messaging-token-resolution.test.ts +1 -1
  132. package/src/__tests__/slack-reaction-canonical-approval.test.ts +2 -2
  133. package/src/__tests__/slack-share-routes.test.ts +1 -1
  134. package/src/__tests__/starter-task-flow.test.ts +1 -1
  135. package/src/__tests__/subagent-tool-gate-mode.test.ts +1 -1
  136. package/src/__tests__/suggestion-routes.test.ts +1 -1
  137. package/src/__tests__/task-progress-nudge-hook.test.ts +65 -101
  138. package/src/__tests__/title-generate-hook.test.ts +2 -2
  139. package/src/__tests__/tool-audit-listener.test.ts +1 -1
  140. package/src/__tests__/tool-error-hook.test.ts +2 -1
  141. package/src/__tests__/tool-executor-lifecycle-events.test.ts +2 -2
  142. package/src/__tests__/tool-executor.test.ts +2 -2
  143. package/src/__tests__/tool-grant-request-escalation.test.ts +1 -1
  144. package/src/__tests__/tool-preview-lifecycle.test.ts +1 -1
  145. package/src/__tests__/tool-result-truncate-hook.test.ts +2 -1
  146. package/src/__tests__/tool-side-effects-slack-dm.test.ts +1 -1
  147. package/src/__tests__/trace-emitter.test.ts +1 -1
  148. package/src/__tests__/trust-context-guards.test.ts +1 -1
  149. package/src/__tests__/trusted-contact-inline-approval-integration.test.ts +2 -2
  150. package/src/__tests__/trusted-contact-lifecycle-notifications.test.ts +1 -1
  151. package/src/__tests__/turn-call-site.test.ts +29 -0
  152. package/src/__tests__/turn-events-store.test.ts +1 -1
  153. package/src/__tests__/usage-cache-backfill-migration.test.ts +1 -1
  154. package/src/__tests__/usage-grouped-buckets.test.ts +1 -1
  155. package/src/__tests__/verification-control-plane-policy.test.ts +2 -2
  156. package/src/__tests__/voice-scoped-grant-consumer.test.ts +5 -5
  157. package/src/__tests__/workspace-migration-009-backfill-conversation-disk-view.test.ts +1 -1
  158. package/src/__tests__/workspace-migration-013-repair-conversation-disk-view.test.ts +2 -2
  159. package/src/__tests__/workspace-migration-backfill-installation-id.test.ts +1 -1
  160. package/src/a2a/task-store.ts +1 -1
  161. package/src/agent/loop.ts +9 -2
  162. package/src/approvals/approval-primitive.ts +1 -1
  163. package/src/approvals/guardian-card-withdrawal.ts +2 -2
  164. package/src/approvals/guardian-decision-primitive.ts +1 -1
  165. package/src/approvals/guardian-expiry-notifier.ts +1 -1
  166. package/src/approvals/guardian-request-resolvers.ts +4 -4
  167. package/src/{memory → approvals}/scoped-approval-grants.ts +1 -1
  168. package/src/{memory → apps}/app-store.ts +1 -1
  169. package/src/{memory → apps}/shared-app-links-store.ts +1 -1
  170. package/src/bundler/app-bundler.ts +1 -1
  171. package/src/calls/call-controller.ts +5 -5
  172. package/src/calls/call-domain.ts +3 -3
  173. package/src/calls/call-store.ts +1 -1
  174. package/src/calls/guardian-dispatch.ts +5 -5
  175. package/src/calls/media-stream-server.ts +1 -1
  176. package/src/calls/relay-access-wait.ts +1 -1
  177. package/src/calls/relay-server.ts +2 -2
  178. package/src/cli.ts +5 -5
  179. package/src/config/bundled-skills/app-builder/tools/app-create.ts +2 -2
  180. package/src/config/bundled-skills/app-builder/tools/app-delete.ts +2 -2
  181. package/src/config/bundled-skills/app-builder/tools/app-generate-icon.ts +2 -2
  182. package/src/config/bundled-skills/app-builder/tools/app-list.ts +1 -1
  183. package/src/config/bundled-skills/app-builder/tools/app-refresh.ts +2 -2
  184. package/src/config/bundled-skills/app-builder/tools/app-update.ts +2 -2
  185. package/src/config/bundled-skills/messaging/tools/messaging-send.ts +1 -1
  186. package/src/{memory → contacts}/canonical-guardian-store.ts +1 -1
  187. package/src/daemon/__tests__/conversation-lifecycle-auto-analyze.test.ts +7 -7
  188. package/src/daemon/__tests__/conversation-surfaces-launch.test.ts +3 -2
  189. package/src/daemon/__tests__/daemon-readiness.test.ts +51 -0
  190. package/src/daemon/app-source-watcher.ts +2 -2
  191. package/src/daemon/channel-ui-capability.ts +25 -0
  192. package/src/daemon/config-watcher.ts +1 -1
  193. package/src/daemon/conversation-agent-loop-handlers.ts +3 -3
  194. package/src/daemon/conversation-agent-loop.ts +15 -11
  195. package/src/daemon/conversation-evictor.ts +42 -9
  196. package/src/daemon/conversation-launch.ts +1 -1
  197. package/src/daemon/conversation-lifecycle.ts +2 -2
  198. package/src/daemon/conversation-messaging.ts +4 -4
  199. package/src/daemon/conversation-process.ts +1 -1
  200. package/src/daemon/conversation-runtime-assembly.ts +6 -6
  201. package/src/daemon/conversation-skill-tools.ts +1 -1
  202. package/src/daemon/conversation-store.ts +9 -48
  203. package/src/daemon/conversation-surfaces.ts +3 -3
  204. package/src/daemon/conversation-workspace.ts +1 -1
  205. package/src/daemon/conversation.ts +2 -2
  206. package/src/daemon/daemon-readiness.ts +33 -0
  207. package/src/daemon/event-loop-watchdog.ts +1 -1
  208. package/src/daemon/handlers/conversations.ts +3 -3
  209. package/src/daemon/handlers/recording.ts +1 -1
  210. package/src/daemon/lifecycle.ts +37 -10
  211. package/src/daemon/process-message.ts +1 -1
  212. package/src/daemon/shutdown-handlers.ts +3 -5
  213. package/src/daemon/tool-side-effects.ts +1 -1
  214. package/src/daemon/trace-emitter.ts +1 -1
  215. package/src/daemon/turn-call-site.ts +25 -0
  216. package/src/daemon/wake-conversation-ops.ts +1 -1
  217. package/src/documents/document-comments-store.test.ts +1 -1
  218. package/src/documents/document-comments-store.ts +1 -1
  219. package/src/documents/document-store.ts +1 -1
  220. package/src/events/tool-audit-listener.ts +4 -4
  221. package/src/heartbeat/heartbeat-run-store.ts +1 -1
  222. package/src/home/__tests__/suggested-prompts.test.ts +1 -1
  223. package/src/{memory → home}/conversation-starter-checkpoints.ts +1 -1
  224. package/src/home/feed-source-enrichment.ts +1 -1
  225. package/src/home/home-greeting-cache.ts +1 -1
  226. package/src/{memory → home}/job-handlers/conversation-starters.ts +16 -16
  227. package/src/home/suggested-prompts.ts +1 -1
  228. package/src/{memory → jobs}/register-job-handlers.ts +29 -29
  229. package/src/live-voice/__tests__/live-voice-archive.test.ts +1 -1
  230. package/src/live-voice/live-voice-archive.ts +1 -1
  231. package/src/media/app-icon-generator.ts +1 -1
  232. package/src/memory/__tests__/conversation-queries.test.ts +1 -1
  233. package/src/memory/__tests__/db-maintenance.test.ts +3 -2
  234. package/src/memory/__tests__/jobs-store-enqueue-gate.test.ts +3 -3
  235. package/src/memory/__tests__/jobs-worker-v2-graph-trigger-embed.test.ts +1 -1
  236. package/src/memory/__tests__/jobs-worker-v2-schedule.test.ts +2 -2
  237. package/src/memory/context-search/sources/conversations.ts +2 -2
  238. package/src/memory/graph/bootstrap.test.ts +7 -2
  239. package/src/memory/graph/bootstrap.ts +5 -2
  240. package/src/memory/graph/extraction-job.ts +4 -1
  241. package/src/memory/graph/extraction.ts +1 -1
  242. package/src/memory/graph/image-ref-utils.ts +1 -1
  243. package/src/memory/graph/retriever.test.ts +1 -1
  244. package/src/memory/graph/store.test.ts +1 -1
  245. package/src/memory/indexer.ts +10 -7
  246. package/src/memory/job-handlers/backfill.ts +5 -5
  247. package/src/memory/job-handlers/embedding.ts +1 -1
  248. package/src/memory/job-handlers/index-maintenance.ts +1 -1
  249. package/src/memory/memory-v2-concept-frequency.ts +1 -1
  250. package/src/memory/task-memory-cleanup.ts +6 -1
  251. package/src/memory/v2/__tests__/backfill-jobs.test.ts +1 -1
  252. package/src/memory/v2/backfill-jobs.ts +1 -1
  253. package/src/memory/v2/sweep-job.ts +1 -1
  254. package/src/memory/v3-eval/eval-packets.ts +1 -1
  255. package/src/memory/worker.ts +1 -1
  256. package/src/messaging/providers/telegram-bot/adapter.ts +1 -1
  257. package/src/messaging/providers/whatsapp/adapter.ts +1 -1
  258. package/src/notifications/canonical-delivery-recorder.ts +1 -1
  259. package/src/notifications/conversation-candidates.ts +1 -1
  260. package/src/notifications/deliveries-store.ts +1 -1
  261. package/src/oauth/oauth-store.ts +1 -1
  262. package/src/persistence/__tests__/db-init-migrations-ok.test.ts +20 -0
  263. package/src/persistence/attachments-store.ts +2 -2
  264. package/src/persistence/bookmark-crud.ts +1 -1
  265. package/src/{memory → persistence}/checkpoints.ts +2 -2
  266. package/src/{memory → persistence}/conversation-attention-store.ts +3 -3
  267. package/src/persistence/conversation-bootstrap.ts +2 -2
  268. package/src/persistence/conversation-crud.ts +16 -16
  269. package/src/{memory → persistence}/conversation-disk-view.ts +3 -3
  270. package/src/{memory/__tests__ → persistence}/conversation-group-migration.test.ts +4 -4
  271. package/src/{memory → persistence}/conversation-key-store.ts +2 -5
  272. package/src/persistence/conversation-queries.ts +3 -3
  273. package/src/{memory → persistence}/conversation-title-service.ts +6 -6
  274. package/src/persistence/db-init.ts +12 -2
  275. package/src/persistence/db-maintenance.ts +1 -4
  276. package/src/persistence/delivery-crud.ts +4 -4
  277. package/src/persistence/group-crud.ts +2 -2
  278. package/src/{memory → persistence}/job-handlers/cleanup.ts +1 -1
  279. package/src/persistence/jobs-store.ts +1 -1
  280. package/src/persistence/jobs-worker.ts +6 -9
  281. package/src/persistence/llm-usage-store.ts +12 -12
  282. package/src/{memory/__tests__ → persistence}/message-content.test.ts +1 -1
  283. package/src/{memory → persistence}/raw-query.ts +1 -5
  284. package/src/persistence/steps.ts +1 -1
  285. package/src/{memory → persistence}/usage-buckets.ts +1 -4
  286. package/src/{memory → persistence}/usage-grouped-buckets.ts +1 -1
  287. package/src/{memory → persistence}/worker-control.ts +1 -1
  288. package/src/plugin-api/types.ts +19 -9
  289. package/src/plugins/defaults/exploration-drift/hooks/post-tool-use.ts +5 -8
  290. package/src/plugins/defaults/memory/v3/maintain-job.ts +3 -3
  291. package/src/plugins/defaults/memory/v3/shadow-plugin.ts +1 -1
  292. package/src/plugins/defaults/task-progress-nudge/hooks/post-tool-use.ts +33 -41
  293. package/src/plugins/defaults/title-generate/hooks/stop.ts +3 -3
  294. package/src/plugins/defaults/title-generate/hooks/user-prompt-submit.ts +2 -2
  295. package/src/runtime/__tests__/agent-wake.test.ts +1 -1
  296. package/src/runtime/__tests__/pre-first-message-gate.test.ts +1 -1
  297. package/src/runtime/access-request-helper.ts +3 -3
  298. package/src/runtime/agent-wake.ts +4 -1
  299. package/src/runtime/assistant-event-hub.ts +1 -1
  300. package/src/runtime/background-job-runner.ts +1 -1
  301. package/src/runtime/channel-retry-sweep.ts +20 -0
  302. package/src/runtime/channel-verification-service.ts +9 -9
  303. package/src/runtime/confirmation-request-guardian-bridge.ts +1 -1
  304. package/src/runtime/guardian-action-service.ts +1 -2
  305. package/src/runtime/guardian-reply-router.ts +1 -1
  306. package/src/runtime/pre-first-message-gate.ts +1 -1
  307. package/src/runtime/routes/__tests__/backup-routes.test.ts +1 -1
  308. package/src/runtime/routes/__tests__/consolidation-routes.test.ts +1 -1
  309. package/src/runtime/routes/__tests__/conversation-list-routes.test.ts +1 -1
  310. package/src/runtime/routes/__tests__/memory-worker-routes.test.ts +1 -1
  311. package/src/runtime/routes/__tests__/retrospective-routes.test.ts +1 -1
  312. package/src/runtime/routes/__tests__/surface-action-routes.test.ts +1 -1
  313. package/src/runtime/routes/__tests__/surface-content-routes.test.ts +1 -1
  314. package/src/runtime/routes/acp-routes.ts +1 -1
  315. package/src/runtime/routes/app-management-routes.ts +9 -9
  316. package/src/runtime/routes/app-routes.ts +3 -7
  317. package/src/runtime/routes/approval-routes.ts +2 -4
  318. package/src/runtime/routes/audit-routes.ts +2 -3
  319. package/src/runtime/routes/backup-routes.ts +1 -1
  320. package/src/runtime/routes/btw-routes.ts +1 -1
  321. package/src/runtime/routes/canonical-guardian-expiry-sweep.ts +1 -1
  322. package/src/runtime/routes/consolidation-routes.ts +1 -1
  323. package/src/runtime/routes/conversation-attention-routes.ts +1 -1
  324. package/src/runtime/routes/conversation-cli-routes.ts +1 -1
  325. package/src/runtime/routes/conversation-list-routes.ts +3 -3
  326. package/src/runtime/routes/conversation-management-routes.ts +5 -5
  327. package/src/runtime/routes/conversation-query-routes.ts +1 -1
  328. package/src/runtime/routes/conversation-routes.ts +10 -10
  329. package/src/runtime/routes/conversation-starter-routes.ts +2 -2
  330. package/src/runtime/routes/conversations-import-routes.ts +4 -4
  331. package/src/runtime/routes/debug-routes.ts +1 -1
  332. package/src/runtime/routes/documents-routes.ts +1 -1
  333. package/src/runtime/routes/empty-state-greeting-cache.ts +1 -1
  334. package/src/runtime/routes/events-routes.ts +1 -1
  335. package/src/runtime/routes/global-search-routes.ts +1 -1
  336. package/src/runtime/routes/guardian-action-routes.ts +1 -1
  337. package/src/runtime/routes/identity-routes.ts +31 -12
  338. package/src/runtime/routes/inbound-conversation.ts +1 -1
  339. package/src/runtime/routes/inbound-message-handler.ts +4 -4
  340. package/src/runtime/routes/inbound-stages/background-dispatch.test.ts +2 -2
  341. package/src/runtime/routes/inbound-stages/background-dispatch.ts +8 -8
  342. package/src/runtime/routes/inbound-stages/escalation-intercept.ts +1 -1
  343. package/src/runtime/routes/inbound-stages/guardian-reply-intercept.test.ts +1 -1
  344. package/src/runtime/routes/inbound-stages/guardian-reply-intercept.ts +1 -1
  345. package/src/runtime/routes/inbound-stages/secret-ingress-check.ts +1 -1
  346. package/src/runtime/routes/inference-profile-session-handler.ts +1 -1
  347. package/src/runtime/routes/integrations/slack/__tests__/share.test.ts +3 -4
  348. package/src/runtime/routes/integrations/slack/share.ts +1 -1
  349. package/src/runtime/routes/internal-telemetry-routes.ts +1 -1
  350. package/src/runtime/routes/log-export/__tests__/workspace-allowlist-error-contract.test.ts +1 -1
  351. package/src/runtime/routes/log-export/workspace-allowlist.ts +1 -1
  352. package/src/runtime/routes/memory-worker-routes.ts +1 -1
  353. package/src/runtime/routes/publish-routes.ts +3 -3
  354. package/src/runtime/routes/surface-conversation-resolver.ts +1 -1
  355. package/src/runtime/routes/trace-event-routes.ts +1 -1
  356. package/src/runtime/routes/usage-routes.ts +1 -1
  357. package/src/runtime/services/__tests__/analyze-conversation.test.ts +1 -1
  358. package/src/{memory → runtime/services}/__tests__/auto-analysis-enqueue.test.ts +5 -5
  359. package/src/{memory → runtime/services}/__tests__/auto-analysis-guard.test.ts +6 -6
  360. package/src/{memory → runtime/services}/__tests__/conversation-analyze-job.test.ts +5 -5
  361. package/src/runtime/services/analyze-conversation.ts +3 -3
  362. package/src/{memory → runtime/services}/auto-analysis-enqueue.ts +7 -7
  363. package/src/{memory → runtime/services}/auto-analysis-guard.ts +2 -6
  364. package/src/{memory → runtime/services}/conversation-analyze-job.ts +4 -4
  365. package/src/runtime/services/conversation-serializer.ts +2 -2
  366. package/src/runtime/tool-grant-request-helper.ts +1 -1
  367. package/src/schedule/schedule-store.ts +1 -1
  368. package/src/schedule/schedule-usage-store.ts +2 -2
  369. package/src/sequence/store.ts +1 -1
  370. package/src/services/published-app-updater.ts +2 -2
  371. package/src/signals/cancel.ts +1 -1
  372. package/src/signals/user-message.ts +1 -1
  373. package/src/subagent/manager.ts +3 -2
  374. package/src/telemetry/usage-telemetry-reporter.test.ts +6 -6
  375. package/src/telemetry/usage-telemetry-reporter.ts +11 -11
  376. package/src/tools/apps/executors.ts +2 -2
  377. package/src/tools/apps/resolve-app-id.ts +1 -1
  378. package/src/tools/document/document-comment-tool.test.ts +1 -1
  379. package/src/tools/filesystem/write.ts +3 -2
  380. package/src/tools/tool-approval-handler.ts +1 -1
  381. package/src/watcher/__tests__/telemetry.test.ts +1 -1
  382. package/src/watcher/telemetry.ts +1 -1
  383. package/src/watcher/watcher-store.ts +1 -1
  384. package/src/workflows/journal-store.ts +1 -1
  385. package/src/workspace/migrations/011-backfill-installation-id.ts +1 -1
  386. package/src/workspace/migrations/041-backfill-google-gmail-settings-scope.ts +1 -1
  387. package/src/workspace/migrations/rebuild-conversation-disk-view.ts +2 -2
  388. /package/src/{memory → apps}/app-git-service.ts +0 -0
  389. /package/src/{memory → apps}/published-pages-store.ts +0 -0
  390. /package/src/{memory → channels}/channel-verification-sessions.ts +0 -0
  391. /package/src/{memory → channels}/slack-thread-store.ts +0 -0
  392. /package/src/{memory → contacts}/guardian-rate-limits.ts +0 -0
  393. /package/src/{memory → conversations}/job-handlers/summarization.ts +0 -0
  394. /package/src/{memory → home}/conversation-starter-validation.ts +0 -0
  395. /package/src/{memory → media}/job-handlers/media-processing.ts +0 -0
  396. /package/src/{memory → onboarding}/__tests__/onboarding-events-store.test.ts +0 -0
  397. /package/src/{memory → onboarding}/onboarding-events-store.ts +0 -0
  398. /package/src/{memory → persistence}/__tests__/worker-control.test.ts +0 -0
  399. /package/src/{memory → persistence}/auto-analysis-constants.ts +0 -0
  400. /package/src/{memory → persistence}/cleanup-schedule-state.ts +0 -0
  401. /package/src/{memory → persistence}/conversation-directories.ts +0 -0
  402. /package/src/{memory → persistence}/conversation-display-order-migration.ts +0 -0
  403. /package/src/{memory → persistence}/conversation-group-migration.ts +0 -0
  404. /package/src/{memory → persistence}/message-content.ts +0 -0
  405. /package/src/{memory → persistence}/schedule-attribution-sql.ts +0 -0
  406. /package/src/{memory → security}/auth-fallback-events-store.ts +0 -0
  407. /package/src/{memory → telemetry}/__tests__/watchdog-events-store.test.ts +0 -0
  408. /package/src/{memory → telemetry}/skill-loaded-events-store.test.ts +0 -0
  409. /package/src/{memory → telemetry}/skill-loaded-events-store.ts +0 -0
  410. /package/src/{memory → telemetry}/tool-executed-events-store.test.ts +0 -0
  411. /package/src/{memory → telemetry}/tool-executed-events-store.ts +0 -0
  412. /package/src/{memory → telemetry}/tool-usage-store.ts +0 -0
  413. /package/src/{memory → telemetry}/trace-event-store.ts +0 -0
  414. /package/src/{memory → telemetry}/turn-events-store.ts +0 -0
  415. /package/src/{memory → telemetry}/turn-trace-store.test.ts +0 -0
  416. /package/src/{memory → telemetry}/turn-trace-store.ts +0 -0
  417. /package/src/{memory → telemetry}/watchdog-events-store.ts +0 -0
package/ARCHITECTURE.md CHANGED
@@ -99,7 +99,7 @@ All HTTP API requests use a single `Authorization: Bearer <jwt>` header for auth
99
99
  | `src/runtime/routes/guardian-bootstrap-routes.ts` | `POST /v1/guardian/init` (initial JWT issuance) |
100
100
  | `src/runtime/routes/guardian-refresh-routes.ts` | `POST /v1/guardian/refresh` (token rotation) |
101
101
  | `src/runtime/local-actor-identity.ts` | `resolveLocalGuardianContext` — deterministic local identity |
102
- | `src/memory/channel-verification-sessions.ts` | Guardian binding types, verification session management |
102
+ | `src/channels/channel-verification-sessions.ts` | Guardian binding types, verification session management |
103
103
 
104
104
  ### Channel-Agnostic Scoped Approval Grants
105
105
 
@@ -178,7 +178,7 @@ The canonical guardian request system provides a channel-agnostic, unified domai
178
178
 
179
179
  **Architecture layers:**
180
180
 
181
- 1. **Canonical domain (single source of truth):** All guardian requests — tool approvals, pending questions, access requests — are persisted in the `canonical_guardian_requests` table (`src/memory/canonical-guardian-store.js`). Each request has a unique ID, a short human-readable request code, and a status that follows a CAS (compare-and-swap) lifecycle: `pending` -> `approved` | `denied` | `expired` | `cancelled`. Deliveries (notifications sent to guardians) are tracked in `canonical_guardian_deliveries`.
181
+ 1. **Canonical domain (single source of truth):** All guardian requests — tool approvals, pending questions, access requests — are persisted in the `canonical_guardian_requests` table (`src/contacts/canonical-guardian-store.js`). Each request has a unique ID, a short human-readable request code, and a status that follows a CAS (compare-and-swap) lifecycle: `pending` -> `approved` | `denied` | `expired` | `cancelled`. Deliveries (notifications sent to guardians) are tracked in `canonical_guardian_deliveries`.
182
182
 
183
183
  2. **Unified apply primitive (single write path):** `applyCanonicalGuardianDecision()` in `src/approvals/guardian-decision-primitive.ts` is the single write path for all guardian decisions. It enforces identity validation, expiry checks, CAS resolution, `approve_always` downgrade (guardian-on-behalf invariant), kind-specific resolver dispatch via the resolver registry, and scoped grant minting. All callers — HTTP API, inbound channel router, desktop session — route decisions through this function.
184
184
 
@@ -200,7 +200,7 @@ The canonical guardian request system provides a channel-agnostic, unified domai
200
200
 
201
201
  | File | Purpose |
202
202
  | ------------------------------------------------------- | ------------------------------------------------------------------------------------- |
203
- | `src/memory/canonical-guardian-store.ts` | Canonical request and delivery persistence (CRUD, CAS resolve, list with filters) |
203
+ | `src/contacts/canonical-guardian-store.ts` | Canonical request and delivery persistence (CRUD, CAS resolve, list with filters) |
204
204
  | `src/approvals/guardian-decision-primitive.ts` | Canonical decision primitive: `applyCanonicalGuardianDecision` + scoped grant minting |
205
205
  | `src/approvals/guardian-request-resolvers.ts` | Resolver registry: kind-specific side-effect dispatch after CAS resolution |
206
206
  | `src/runtime/guardian-reply-router.ts` | Shared inbound router: callback -> code -> NL classification pipeline |
@@ -434,7 +434,7 @@ External users who are not the guardian can gain access to the assistant through
434
434
  | `src/runtime/invite-service.ts` | Business logic for invite operations |
435
435
  | `src/contacts/contact-store.ts` | Contact read queries — lookup, search, list, and channel operations |
436
436
  | `src/memory/guardian-approvals.ts` | Approval request persistence |
437
- | `src/memory/channel-verification-sessions.ts` | Verification challenge persistence |
437
+ | `src/channels/channel-verification-sessions.ts` | Verification challenge persistence |
438
438
  | `src/config/bundled-skills/contacts/SKILL.md` | Unified skill for contact management, access control, and invite links |
439
439
 
440
440
  ### Guardian-Initiated Invite Links
@@ -594,7 +594,7 @@ All guardian decisions for voice access requests flow through:
594
594
  | `src/approvals/guardian-decision-primitive.ts` | `applyCanonicalGuardianDecision` — unified decision primitive |
595
595
  | `src/approvals/guardian-request-resolvers.ts` | `access_request` resolver — voice direct activation, text-channel verification session |
596
596
  | `src/runtime/actor-trust-resolver.ts` | `resolveActorTrust` — caller trust classification |
597
- | `src/memory/canonical-guardian-store.ts` | Canonical request persistence and CAS resolution |
597
+ | `src/contacts/canonical-guardian-store.ts` | Canonical request persistence and CAS resolution |
598
598
 
599
599
  ### Speech-to-Text (STT) Boundaries
600
600
 
@@ -2152,7 +2152,7 @@ The guardian trust system uses a three-valued `TrustClass` — `'guardian'`, `'t
2152
2152
 
2153
2153
  **Explicit trust gates:** `trustClass` is a **required** field in `ToolContext` (in `src/tools/types.ts`). Every tool execution must carry a trust classification — the field is not optional. This ensures trust-gated tool policies (guardian control-plane restrictions, host-tool blocking for untrusted actors) cannot be bypassed by omitting the classification.
2154
2154
 
2155
- **Guardian bindings** (in `src/memory/channel-verification-sessions.ts`) always carry `guardianPrincipalId: string` as a required, non-null field. A binding without a principal ID is invalid and cannot be created.
2155
+ **Guardian bindings** (in `src/channels/channel-verification-sessions.ts`) always carry `guardianPrincipalId: string` as a required, non-null field. A binding without a principal ID is invalid and cannot be created.
2156
2156
 
2157
2157
  **Strict retry sweep parsing:** The channel retry sweep (`src/runtime/channel-retry-sweep.ts`) uses `parseTrustRuntimeContext()` which validates `trustClass` against the canonical three-value set. There is no fallback to a legacy `actorRole` field — stored payloads that lack a valid `trustClass` are rejected deterministically to prevent silent privilege escalation. When `trustCtx` is entirely absent from a stored payload (pre-guardian events), the sweep synthesizes an explicit `trustClass: 'unknown'` context so that replay never proceeds without a trust classification.
2158
2158
 
@@ -2160,13 +2160,13 @@ The guardian trust system uses a three-valued `TrustClass` — `'guardian'`, `'t
2160
2160
 
2161
2161
  **Key files:**
2162
2162
 
2163
- | File | Purpose |
2164
- | --------------------------------------------- | ----------------------------------------------------- |
2165
- | `src/daemon/conversation-runtime-assembly.ts` | `TrustContext` type definition |
2166
- | `src/tools/types.ts` | `ToolContext.trustClass` (required trust gate) |
2167
- | `src/runtime/channel-retry-sweep.ts` | Strict `trustClass` parser for retry sweep |
2168
- | `src/memory/channel-verification-sessions.ts` | `GuardianBinding` with required `guardianPrincipalId` |
2169
- | `src/__tests__/trust-context-guards.test.ts` | Guard tests enforcing trust-context type invariants |
2163
+ | File | Purpose |
2164
+ | ----------------------------------------------- | ----------------------------------------------------- |
2165
+ | `src/daemon/conversation-runtime-assembly.ts` | `TrustContext` type definition |
2166
+ | `src/tools/types.ts` | `ToolContext.trustClass` (required trust gate) |
2167
+ | `src/runtime/channel-retry-sweep.ts` | Strict `trustClass` parser for retry sweep |
2168
+ | `src/channels/channel-verification-sessions.ts` | `GuardianBinding` with required `guardianPrincipalId` |
2169
+ | `src/__tests__/trust-context-guards.test.ts` | Guard tests enforcing trust-context type invariants |
2170
2170
 
2171
2171
  ### TTS Provider Abstraction (`services.tts`)
2172
2172
 
package/openapi.yaml CHANGED
@@ -12,9 +12,26 @@ paths:
12
12
  /healthz:
13
13
  get:
14
14
  operationId: healthz_get
15
+ summary: Liveness probe
16
+ description:
17
+ Trivial liveness/startup probe. Returns { status, version } the instant the HTTP server is up, with zero
18
+ DB/CES/lifecycle access.
15
19
  responses:
16
20
  "200":
17
21
  description: Successful response
22
+ content:
23
+ application/json:
24
+ schema:
25
+ type: object
26
+ properties:
27
+ status:
28
+ type: string
29
+ version:
30
+ type: string
31
+ required:
32
+ - status
33
+ - version
34
+ additionalProperties: false
18
35
  /pages/{id}:
19
36
  get:
20
37
  operationId: pages__id__get
@@ -30,9 +47,52 @@ paths:
30
47
  /readyz:
31
48
  get:
32
49
  operationId: readyz_get
50
+ summary: Readiness probe
51
+ description:
52
+ Strict readiness probe. Returns 503 with { status, ready, notReady } until the daemon's synchronous startup
53
+ latches (isStartupComplete() && isDbReady()) are set, then a stable 200. notReady lists the gates still failing
54
+ ("startup", "db"). CES is informational and never gates readiness.
33
55
  responses:
34
56
  "200":
35
57
  description: Successful response
58
+ content:
59
+ application/json:
60
+ schema:
61
+ type: object
62
+ properties:
63
+ status:
64
+ type: string
65
+ ready:
66
+ type: boolean
67
+ notReady:
68
+ type: array
69
+ items:
70
+ type: string
71
+ required:
72
+ - status
73
+ - ready
74
+ - notReady
75
+ additionalProperties: false
76
+ "503":
77
+ description: Not ready — startup incomplete or database not ready.
78
+ content:
79
+ application/json:
80
+ schema:
81
+ type: object
82
+ properties:
83
+ status:
84
+ type: string
85
+ ready:
86
+ type: boolean
87
+ notReady:
88
+ type: array
89
+ items:
90
+ type: string
91
+ required:
92
+ - status
93
+ - ready
94
+ - notReady
95
+ additionalProperties: false
36
96
  /v1/acp/{id}/cancel:
37
97
  post:
38
98
  operationId: acp_by_id_cancel_post
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/assistant",
3
- "version": "0.10.3-dev.202606291342.c7a83ea",
3
+ "version": "0.10.3-dev.202606291709.2b4d83d",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -216,13 +216,69 @@ async function collectRoutesFromModules(): Promise<RouteEntry[]> {
216
216
  return routes;
217
217
  }
218
218
 
219
+ /**
220
+ * Trivial liveness/startup probe response. `/healthz` is the k8s startup +
221
+ * liveness target and stays intentionally minimal: a static `{ status, version }`
222
+ * answered the instant the HTTP server is up, with zero DB/CES/lifecycle access.
223
+ */
224
+ const trivialHealthSchema = z.object({
225
+ status: z.string(),
226
+ version: z.string(),
227
+ });
228
+
229
+ /**
230
+ * Strict readiness probe response. `/readyz` gates on the daemon's synchronous
231
+ * startup latches (`isStartupComplete() && isDbReady()`), returning 503 with
232
+ * `ready: false` until both are set, then a stable 200. `notReady` lists the
233
+ * gates still failing (`"startup"`, `"db"`). CES is never consulted.
234
+ */
235
+ const readyzSchema = z.object({
236
+ status: z.string(),
237
+ ready: z.boolean(),
238
+ notReady: z.array(z.string()),
239
+ });
240
+
219
241
  /**
220
242
  * Top-level routes outside the /v1/ namespace.
221
243
  * These are added to the spec separately.
222
244
  */
223
- const NON_V1_ROUTES: Array<{ method: string; path: string }> = [
224
- { method: "GET", path: "/healthz" },
225
- { method: "GET", path: "/readyz" },
245
+ const NON_V1_ROUTES: Array<{
246
+ method: string;
247
+ path: string;
248
+ summary?: string;
249
+ description?: string;
250
+ responseBody?: z.ZodType;
251
+ additionalResponses?: Record<
252
+ string,
253
+ { description: string; schema?: unknown }
254
+ >;
255
+ }> = [
256
+ {
257
+ method: "GET",
258
+ path: "/healthz",
259
+ summary: "Liveness probe",
260
+ description:
261
+ "Trivial liveness/startup probe. Returns { status, version } the instant " +
262
+ "the HTTP server is up, with zero DB/CES/lifecycle access.",
263
+ responseBody: trivialHealthSchema,
264
+ },
265
+ {
266
+ method: "GET",
267
+ path: "/readyz",
268
+ summary: "Readiness probe",
269
+ description:
270
+ "Strict readiness probe. Returns 503 with { status, ready, notReady } until " +
271
+ "the daemon's synchronous startup latches (isStartupComplete() && isDbReady()) " +
272
+ "are set, then a stable 200. notReady lists the gates still failing " +
273
+ '("startup", "db"). CES is informational and never gates readiness.',
274
+ responseBody: readyzSchema,
275
+ additionalResponses: {
276
+ "503": {
277
+ description: "Not ready — startup incomplete or database not ready.",
278
+ schema: readyzSchema,
279
+ },
280
+ },
281
+ },
226
282
  { method: "GET", path: "/pages/{id}" },
227
283
  ];
228
284
 
@@ -322,7 +378,16 @@ function buildSpec(
322
378
  path: r.path,
323
379
  method: r.method,
324
380
  endpoint: r.path,
325
- entry: { method: r.method, endpoint: r.path },
381
+ entry: {
382
+ method: r.method,
383
+ endpoint: r.path,
384
+ ...(r.summary ? { summary: r.summary } : {}),
385
+ ...(r.description ? { description: r.description } : {}),
386
+ ...(r.responseBody ? { responseBody: r.responseBody } : {}),
387
+ ...(r.additionalResponses
388
+ ? { additionalResponses: r.additionalResponses }
389
+ : {}),
390
+ },
326
391
  });
327
392
  }
328
393
  }
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, mock, test } from "bun:test";
2
2
 
3
- import type { AppDefinition } from "../memory/app-store.js";
3
+ import type { AppDefinition } from "../apps/app-store.js";
4
4
  import type { AppStore } from "../tools/apps/executors.js";
5
5
  import type { ToolContext } from "../tools/types.js";
6
6
 
@@ -53,7 +53,7 @@ function makeContext(overrides: Partial<ToolContext> = {}): ToolContext {
53
53
 
54
54
  const mockStore = makeMockStore();
55
55
 
56
- mock.module("../memory/app-store.js", () => ({
56
+ mock.module("../apps/app-store.js", () => ({
57
57
  ...mockStore,
58
58
  getAppsDir: () => "/tmp/test-apps",
59
59
  getAppDirPath: (appId: string) => `/tmp/test-apps/${appId}`,
@@ -25,7 +25,7 @@ const testAppsDir = join(tmpdir(), `app-bundler-test-${Date.now()}`);
25
25
 
26
26
  // Mock app-store so packageApp can find our test apps
27
27
  const mockApps = new Map<string, Record<string, unknown>>();
28
- mock.module("../memory/app-store.js", () => ({
28
+ mock.module("../apps/app-store.js", () => ({
29
29
  getApp: (id: string) => mockApps.get(id) ?? null,
30
30
  getAppsDir: () => testAppsDir,
31
31
  getAppDirPath: (id: string) => join(testAppsDir, id),
@@ -15,10 +15,10 @@ import {
15
15
  backfillAppConversationIds,
16
16
  createApp,
17
17
  getApp,
18
- } from "../memory/app-store.js";
19
- import { rawRun } from "../memory/raw-query.js";
18
+ } from "../apps/app-store.js";
20
19
  import { getDb } from "../persistence/db-connection.js";
21
20
  import { initializeDb } from "../persistence/db-init.js";
21
+ import { rawRun } from "../persistence/raw-query.js";
22
22
 
23
23
  // Initialize db once for all tests
24
24
  await initializeDb();
@@ -8,7 +8,7 @@ import {
8
8
  createApp,
9
9
  getApp,
10
10
  listAppsByConversation,
11
- } from "../memory/app-store.js";
11
+ } from "../apps/app-store.js";
12
12
 
13
13
  // ---------------------------------------------------------------------------
14
14
  // Helpers
@@ -16,8 +16,8 @@ import { describe, expect, test } from "bun:test";
16
16
 
17
17
  /** Files that are permitted to import getAppsDir. */
18
18
  const ALLOWLIST = new Set([
19
- "assistant/src/memory/app-store.ts", // defines getAppsDir
20
- "assistant/src/memory/app-git-service.ts", // uses getAppsDir for git repo root, not per-app paths
19
+ "assistant/src/apps/app-store.ts", // defines getAppsDir
20
+ "assistant/src/apps/app-git-service.ts", // uses getAppsDir for git repo root, not per-app paths
21
21
  "assistant/src/daemon/app-source-watcher.ts", // uses getAppsDir for recursive fs.watch root, not per-app paths
22
22
  "assistant/src/tools/filesystem/write.ts", // uses getAppsDir as an exemption root for the artifact-HTML guard, not per-app paths
23
23
  ]);
@@ -27,7 +27,7 @@ beforeEach(() => {
27
27
  };
28
28
  });
29
29
 
30
- import type { AppDefinition } from "../memory/app-store.js";
30
+ import type { AppDefinition } from "../apps/app-store.js";
31
31
  import type { AppStore } from "../tools/apps/executors.js";
32
32
  import {
33
33
  executeAppCreate,
@@ -13,8 +13,8 @@ import {
13
13
  getAppFileAtVersion,
14
14
  getAppHistory,
15
15
  restoreAppVersion,
16
- } from "../memory/app-git-service.js";
17
- import { createApp, getAppDirPath, updateApp } from "../memory/app-store.js";
16
+ } from "../apps/app-git-service.js";
17
+ import { createApp, getAppDirPath, updateApp } from "../apps/app-store.js";
18
18
 
19
19
  describe("App Git History", () => {
20
20
  beforeEach(() => {
@@ -4,7 +4,7 @@ import { tmpdir } from "node:os";
4
4
  import { join } from "node:path";
5
5
  import { afterEach, beforeEach, describe, expect, test } from "bun:test";
6
6
 
7
- import { commitAppTurnChanges } from "../memory/app-git-service.js";
7
+ import { commitAppTurnChanges } from "../apps/app-git-service.js";
8
8
  import {
9
9
  createApp,
10
10
  deleteApp,
@@ -12,7 +12,7 @@ import {
12
12
  getAppsDir,
13
13
  updateApp,
14
14
  writeAppFile,
15
- } from "../memory/app-store.js";
15
+ } from "../apps/app-store.js";
16
16
  import { _resetGitServiceRegistry } from "../workspace/git-service.js";
17
17
 
18
18
  let testDataDir: string;
@@ -34,7 +34,7 @@ const apps = new Map<string, typeof legacyApp | typeof multifileApp>([
34
34
  ["multi-1", multifileApp],
35
35
  ]);
36
36
 
37
- mock.module("../memory/app-store.js", () => ({
37
+ mock.module("../apps/app-store.js", () => ({
38
38
  getApp: (id: string) => apps.get(id) ?? null,
39
39
  getAppsDir: () => "/fake/apps",
40
40
  getAppDirPath: (appId: string) => `/fake/apps/${appId}`,
@@ -42,7 +42,7 @@ mock.module("../memory/app-store.js", () => ({
42
42
  }));
43
43
 
44
44
  // Mock shared-app-links-store (imported by app-routes but unused here)
45
- mock.module("../memory/shared-app-links-store.js", () => ({
45
+ mock.module("../apps/shared-app-links-store.js", () => ({
46
46
  createSharedAppLink: () => ({ shareToken: "tok" }),
47
47
  getSharedAppLink: () => null,
48
48
  incrementDownloadCount: () => {},
@@ -44,7 +44,7 @@ mock.module("node:fs", () => {
44
44
  };
45
45
  });
46
46
 
47
- mock.module("../memory/app-store.js", () => ({
47
+ mock.module("../apps/app-store.js", () => ({
48
48
  getAppsDir: mock(() => TEST_APPS_DIR),
49
49
  resolveAppIdByDirName: mock(
50
50
  (dirName: string) => testDirNameMap.get(dirName) ?? null,
@@ -22,7 +22,7 @@ import {
22
22
  slugify,
23
23
  updateApp,
24
24
  validateDirName,
25
- } from "../memory/app-store.js";
25
+ } from "../apps/app-store.js";
26
26
 
27
27
  // ---------------------------------------------------------------------------
28
28
  // Helpers
@@ -222,7 +222,7 @@ mock.module("../agent/loop.js", () => ({
222
222
  },
223
223
  }));
224
224
 
225
- mock.module("../memory/canonical-guardian-store.js", () => ({
225
+ mock.module("../contacts/canonical-guardian-store.js", () => ({
226
226
  listPendingCanonicalGuardianRequestsByDestinationConversation: () => [],
227
227
  listCanonicalGuardianRequests: () => [],
228
228
  listPendingRequestsByConversationScope: () => [],
@@ -20,8 +20,6 @@ mock.module("../config/loader.js", () => ({
20
20
  }),
21
21
  }));
22
22
 
23
- import { getConversationDirPath } from "../memory/conversation-disk-view.js";
24
- import { rawGet, rawRun } from "../memory/raw-query.js";
25
23
  import {
26
24
  AttachmentUploadError,
27
25
  deleteAttachment,
@@ -41,8 +39,10 @@ import {
41
39
  addMessage,
42
40
  createConversation,
43
41
  } from "../persistence/conversation-crud.js";
42
+ import { getConversationDirPath } from "../persistence/conversation-disk-view.js";
44
43
  import { getDb } from "../persistence/db-connection.js";
45
44
  import { initializeDb } from "../persistence/db-init.js";
45
+ import { rawGet, rawRun } from "../persistence/raw-query.js";
46
46
  import { getConversationsDir } from "../util/platform.js";
47
47
 
48
48
  await initializeDb();
@@ -12,12 +12,12 @@ mock.module("../util/logger.js", () => ({
12
12
  }),
13
13
  }));
14
14
 
15
+ import { getSqlite } from "../persistence/db-connection.js";
16
+ import { initializeDb } from "../persistence/db-init.js";
15
17
  import {
16
18
  getRecentInvocations,
17
19
  rotateToolInvocations,
18
- } from "../memory/tool-usage-store.js";
19
- import { getSqlite } from "../persistence/db-connection.js";
20
- import { initializeDb } from "../persistence/db-init.js";
20
+ } from "../telemetry/tool-usage-store.js";
21
21
  import { resetDbForTesting } from "./db-test-helpers.js";
22
22
 
23
23
  // ---------------------------------------------------------------------------
@@ -13,14 +13,14 @@ mock.module("../platform/consent-cache.js", () => ({
13
13
  getCachedShareAnalytics: () => shareAnalytics,
14
14
  }));
15
15
 
16
+ import { getDb } from "../persistence/db-connection.js";
17
+ import { initializeDb } from "../persistence/db-init.js";
18
+ import { authFallbackEvents } from "../persistence/schema/index.js";
16
19
  import {
17
20
  type AuthFallbackCount,
18
21
  queryUnreportedAuthFallbackEvents,
19
22
  recordAuthFallbackCounts,
20
- } from "../memory/auth-fallback-events-store.js";
21
- import { getDb } from "../persistence/db-connection.js";
22
- import { initializeDb } from "../persistence/db-init.js";
23
- import { authFallbackEvents } from "../persistence/schema/index.js";
23
+ } from "../security/auth-fallback-events-store.js";
24
24
 
25
25
  await initializeDb();
26
26
 
@@ -130,7 +130,6 @@ mock.module("../runtime/services/analyze-conversation.js", () => ({
130
130
 
131
131
  // ── Real imports ──────────────────────────────────────────────────
132
132
 
133
- import { conversationAnalyzeJob } from "../memory/conversation-analyze-job.js";
134
133
  import { indexMessageNow } from "../memory/indexer.js";
135
134
  import { createConversation } from "../persistence/conversation-crud.js";
136
135
  import { getDb, getMemoryDb } from "../persistence/db-connection.js";
@@ -141,6 +140,7 @@ import {
141
140
  memoryJobs,
142
141
  messages,
143
142
  } from "../persistence/schema/index.js";
143
+ import { conversationAnalyzeJob } from "../runtime/services/conversation-analyze-job.js";
144
144
  import { setOverridesForTesting } from "./feature-flag-test-helpers.js";
145
145
 
146
146
  // ── Helpers ───────────────────────────────────────────────────────
@@ -165,7 +165,7 @@ mock.module("../persistence/conversation-crud.js", () => ({
165
165
  extractImageSourcePaths: () => undefined,
166
166
  }));
167
167
 
168
- mock.module("../memory/conversation-title-service.js", () => ({
168
+ mock.module("../persistence/conversation-title-service.js", () => ({
169
169
  GENERATING_TITLE: "Generating title...",
170
170
  AUTO_TITLE_DETERMINISTIC: 2,
171
171
  deriveDeterministicTitle: (context: { systemHint?: string }) =>
@@ -207,7 +207,7 @@ mock.module("../persistence/db-maintenance.js", () => ({
207
207
  maybeRunDbMaintenance: mockMaybeRunDbMaintenance,
208
208
  }));
209
209
 
210
- mock.module("../memory/cleanup-schedule-state.js", () => ({
210
+ mock.module("../persistence/cleanup-schedule-state.js", () => ({
211
211
  getLastScheduledCleanupEnqueueMs: () => 0,
212
212
  markScheduledCleanupEnqueued: mock(() => {}),
213
213
  }));
@@ -31,7 +31,7 @@ const mockGetConversationByKey = mock(
31
31
  }),
32
32
  );
33
33
 
34
- mock.module("../memory/conversation-key-store.js", () => ({
34
+ mock.module("../persistence/conversation-key-store.js", () => ({
35
35
  getConversationByKey: mockGetConversationByKey,
36
36
  getOrCreateConversation: () => {
37
37
  throw new Error(
@@ -269,11 +269,11 @@ import { loadConfig } from "../config/loader.js";
269
269
  import {
270
270
  getCanonicalGuardianRequest,
271
271
  getPendingCanonicalRequestByCallSessionId,
272
- } from "../memory/canonical-guardian-store.js";
273
- import { resetTestTables } from "../memory/raw-query.js";
272
+ } from "../contacts/canonical-guardian-store.js";
274
273
  import { getMessages } from "../persistence/conversation-crud.js";
275
274
  import { getDb } from "../persistence/db-connection.js";
276
275
  import { initializeDb } from "../persistence/db-init.js";
276
+ import { resetTestTables } from "../persistence/raw-query.js";
277
277
  import { conversations } from "../persistence/schema/index.js";
278
278
  import { resetDbForTesting } from "./db-test-helpers.js";
279
279
  import { createGuardianBinding } from "./helpers/create-guardian-binding.js";
@@ -95,7 +95,7 @@ mock.module("../inbound/public-ingress-urls.js", () => ({
95
95
  "https://test.example.com/webhooks/twilio/status",
96
96
  }));
97
97
 
98
- mock.module("../memory/conversation-title-service.js", () => ({
98
+ mock.module("../persistence/conversation-title-service.js", () => ({
99
99
  queueGenerateConversationTitle: () => {},
100
100
  }));
101
101
 
@@ -54,7 +54,7 @@ mock.module("../daemon/handlers/conversations.js", () => ({
54
54
  regenerateResponse: async () => null,
55
55
  }));
56
56
 
57
- import { getOrCreateConversation } from "../memory/conversation-key-store.js";
57
+ import { getOrCreateConversation } from "../persistence/conversation-key-store.js";
58
58
  import { initializeDb } from "../persistence/db-init.js";
59
59
  import { ROUTES } from "../runtime/routes/conversation-management-routes.js";
60
60
  import { routeDefinitionsToHTTPRoutes } from "../runtime/routes/http-adapter.js";
@@ -21,7 +21,7 @@ import {
21
21
  resolveCanonicalGuardianRequest,
22
22
  updateCanonicalGuardianDelivery,
23
23
  updateCanonicalGuardianRequest,
24
- } from "../memory/canonical-guardian-store.js";
24
+ } from "../contacts/canonical-guardian-store.js";
25
25
  import { getDb } from "../persistence/db-connection.js";
26
26
  import { initializeDb } from "../persistence/db-init.js";
27
27
  await initializeDb();
@@ -69,16 +69,16 @@ mock.module("../daemon/approval-generators.js", () => ({
69
69
  createApprovalConversationGenerator: () => _testApprovalConversationGenerator,
70
70
  }));
71
71
 
72
- import type { Conversation } from "../daemon/conversation.js";
73
72
  import {
74
73
  createCanonicalGuardianDelivery,
75
74
  createCanonicalGuardianRequest,
76
75
  getCanonicalGuardianRequest,
77
- } from "../memory/canonical-guardian-store.js";
78
- import { resetTestTables } from "../memory/raw-query.js";
76
+ } from "../contacts/canonical-guardian-store.js";
77
+ import type { Conversation } from "../daemon/conversation.js";
79
78
  import { getDb } from "../persistence/db-connection.js";
80
79
  import { initializeDb } from "../persistence/db-init.js";
81
80
  import * as deliveryChannels from "../persistence/delivery-channels.js";
81
+ import { resetTestTables } from "../persistence/raw-query.js";
82
82
  import { conversations } from "../persistence/schema/index.js";
83
83
  import { initAuthSigningKey } from "../runtime/auth/token-service.js";
84
84
  import * as gatewayClient from "../runtime/gateway-client.js";
@@ -21,7 +21,7 @@ import { eq } from "drizzle-orm";
21
21
  import {
22
22
  getConversationByKey,
23
23
  setConversationKey,
24
- } from "../memory/conversation-key-store.js";
24
+ } from "../persistence/conversation-key-store.js";
25
25
  import { getDb } from "../persistence/db-connection.js";
26
26
  import { initializeDb } from "../persistence/db-init.js";
27
27
  import {
@@ -112,11 +112,6 @@ mock.module("../contacts/guardian-delivery-reader.js", () => ({
112
112
  ) => list.find((g) => g.channelType === channelType && g.status === "active"),
113
113
  }));
114
114
 
115
- import { handleChannelVerificationSession } from "../daemon/handlers/config-channels.js";
116
- import type {
117
- ChannelVerificationSessionRequest,
118
- ChannelVerificationSessionResponse,
119
- } from "../daemon/message-protocol.js";
120
115
  import {
121
116
  bindSessionIdentity as _storeBindSessionIdentity,
122
117
  consumeSession,
@@ -129,12 +124,17 @@ import {
129
124
  findSessionByIdentity as _storeFindSessionByIdentity,
130
125
  updateSessionDelivery as storeUpdateSessionDelivery,
131
126
  updateSessionStatus as _storeUpdateSessionStatus,
132
- } from "../memory/channel-verification-sessions.js";
127
+ } from "../channels/channel-verification-sessions.js";
133
128
  import {
134
129
  getRateLimit,
135
130
  recordInvalidAttempt,
136
131
  resetRateLimit,
137
- } from "../memory/guardian-rate-limits.js";
132
+ } from "../contacts/guardian-rate-limits.js";
133
+ import { handleChannelVerificationSession } from "../daemon/handlers/config-channels.js";
134
+ import type {
135
+ ChannelVerificationSessionRequest,
136
+ ChannelVerificationSessionResponse,
137
+ } from "../daemon/message-protocol.js";
138
138
  import { getDb } from "../persistence/db-connection.js";
139
139
  import { initializeDb } from "../persistence/db-init.js";
140
140
  import { upsertBinding as upsertExternalBinding } from "../persistence/external-conversation-store.js";