@vellumai/assistant 0.11.9 → 0.11.10-dev.202609091114.7b6342c

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 (433) hide show
  1. package/ARCHITECTURE.md +2 -2
  2. package/Dockerfile +6 -12
  3. package/docs/architecture/memory.md +17 -9
  4. package/docs/guardian-request-flow.md +7 -4
  5. package/docs/runbook-trusted-contacts.md +13 -2
  6. package/node_modules/@vellumai/ces-client/node_modules/@vellumai/service-contracts/package.json +3 -1
  7. package/node_modules/@vellumai/ces-client/node_modules/@vellumai/service-contracts/src/__tests__/plan-credit.test.ts +51 -0
  8. package/node_modules/@vellumai/ces-client/node_modules/@vellumai/service-contracts/src/__tests__/secret-detection.test.ts +2 -0
  9. package/node_modules/@vellumai/ces-client/node_modules/@vellumai/service-contracts/src/desktop-presence.ts +11 -0
  10. package/node_modules/@vellumai/ces-client/node_modules/@vellumai/service-contracts/src/index.ts +1 -0
  11. package/node_modules/@vellumai/ces-client/node_modules/@vellumai/service-contracts/src/plan-credit.ts +66 -0
  12. package/node_modules/@vellumai/ces-client/node_modules/@vellumai/service-contracts/src/secret-detection.ts +7 -0
  13. package/node_modules/@vellumai/gateway-client/node_modules/@vellumai/service-contracts/package.json +3 -1
  14. package/node_modules/@vellumai/gateway-client/node_modules/@vellumai/service-contracts/src/__tests__/plan-credit.test.ts +51 -0
  15. package/node_modules/@vellumai/gateway-client/node_modules/@vellumai/service-contracts/src/__tests__/secret-detection.test.ts +2 -0
  16. package/node_modules/@vellumai/gateway-client/node_modules/@vellumai/service-contracts/src/desktop-presence.ts +11 -0
  17. package/node_modules/@vellumai/gateway-client/node_modules/@vellumai/service-contracts/src/index.ts +1 -0
  18. package/node_modules/@vellumai/gateway-client/node_modules/@vellumai/service-contracts/src/plan-credit.ts +66 -0
  19. package/node_modules/@vellumai/gateway-client/node_modules/@vellumai/service-contracts/src/secret-detection.ts +7 -0
  20. package/node_modules/@vellumai/gateway-client/src/gateway-ipc-contracts.ts +72 -0
  21. package/node_modules/@vellumai/service-contracts/package.json +3 -1
  22. package/node_modules/@vellumai/service-contracts/src/__tests__/plan-credit.test.ts +51 -0
  23. package/node_modules/@vellumai/service-contracts/src/__tests__/secret-detection.test.ts +2 -0
  24. package/node_modules/@vellumai/service-contracts/src/desktop-presence.ts +11 -0
  25. package/node_modules/@vellumai/service-contracts/src/index.ts +1 -0
  26. package/node_modules/@vellumai/service-contracts/src/plan-credit.ts +66 -0
  27. package/node_modules/@vellumai/service-contracts/src/secret-detection.ts +7 -0
  28. package/openapi.yaml +729 -63
  29. package/package.json +1 -1
  30. package/src/__tests__/agent-loop-mutable-latest-user-message.test.ts +19 -21
  31. package/src/__tests__/assistant-event-hub-machine-name.test.ts +40 -0
  32. package/src/__tests__/assistant-event-hub.test.ts +45 -0
  33. package/src/__tests__/cli-memory-v2-reembed-skills.test.ts +0 -1
  34. package/src/__tests__/compactor-assistant-tail-preview.test.ts +111 -0
  35. package/src/__tests__/compactor-tail-resolution.test.ts +116 -0
  36. package/src/__tests__/computer-use-native-history.test.ts +30 -0
  37. package/src/__tests__/computer-use-window-schema.test.ts +24 -0
  38. package/src/__tests__/config-get-vision-flag.test.ts +36 -0
  39. package/src/__tests__/config-loader-validation-reset-notice.test.ts +47 -15
  40. package/src/__tests__/context-search-conversations-source.test.ts +27 -5
  41. package/src/__tests__/conversation-agent-loop-overflow.test.ts +189 -195
  42. package/src/__tests__/conversation-agent-loop.test.ts +690 -50
  43. package/src/__tests__/conversation-fork-crud.test.ts +132 -45
  44. package/src/__tests__/conversation-fork-retrospective.test.ts +9 -7
  45. package/src/__tests__/conversation-lifecycle.test.ts +684 -10
  46. package/src/__tests__/conversation-pairing.test.ts +10 -9
  47. package/src/__tests__/conversation-runtime-assembly.test.ts +288 -1
  48. package/src/__tests__/conversation-surfaces-history-restored-completion.test.ts +21 -4
  49. package/src/__tests__/conversation-surfaces-point-at-budget.test.ts +150 -0
  50. package/src/__tests__/conversation-surfaces-point-at-capability.test.ts +161 -0
  51. package/src/__tests__/copy-composer-tc-templates.test.ts +2 -2
  52. package/src/__tests__/credential-security-invariants.test.ts +1 -0
  53. package/src/__tests__/delivered-post-record.test.ts +107 -0
  54. package/src/__tests__/guardian-action-service-scope.test.ts +53 -0
  55. package/src/__tests__/guardian-question-mode.test.ts +88 -138
  56. package/src/__tests__/headless-browser-mode.test.ts +63 -13
  57. package/src/__tests__/heartbeat-disk-pressure.test.ts +2 -0
  58. package/src/__tests__/heartbeat-service.test.ts +118 -27
  59. package/src/__tests__/host-cu-proxy.test.ts +159 -1
  60. package/src/__tests__/host-proxy-interface.test.ts +15 -0
  61. package/src/__tests__/host-proxy-preactivation.test.ts +61 -0
  62. package/src/__tests__/injector-chain.test.ts +3 -3
  63. package/src/__tests__/injector-registry-order-guard.test.ts +1 -1
  64. package/src/__tests__/injector-v3-suppression.test.ts +587 -45
  65. package/src/__tests__/llm-schema.test.ts +70 -2
  66. package/src/__tests__/logger.test.ts +33 -32
  67. package/src/__tests__/mcp-config-secret-boundary.test.ts +2 -0
  68. package/src/__tests__/memory-config-file-parity.test.ts +18 -0
  69. package/src/__tests__/memory-retrieval-hook.test.ts +53 -3
  70. package/src/__tests__/messages-read-boundary-guard.test.ts +0 -1
  71. package/src/__tests__/messaging-send-tool.test.ts +251 -128
  72. package/src/__tests__/messaging-shared.test.ts +19 -0
  73. package/src/__tests__/notification-decision-fallback.test.ts +98 -76
  74. package/src/__tests__/notification-decision-strategy.test.ts +10 -38
  75. package/src/__tests__/notification-events-source-context-probe.test.ts +211 -0
  76. package/src/__tests__/openai-responses-prompt-cache.test.ts +7 -2
  77. package/src/__tests__/openai-responses-provider.test.ts +42 -0
  78. package/src/__tests__/outlook-messaging-provider.test.ts +9 -0
  79. package/src/__tests__/platform-callback-registration.test.ts +162 -3
  80. package/src/__tests__/plugin-api-webhook-url.test.ts +66 -4
  81. package/src/__tests__/plugin-import-boundary-guard.test.ts +1 -0
  82. package/src/__tests__/pricing.test.ts +29 -0
  83. package/src/__tests__/prompt-cache-cross-turn-stability.test.ts +63 -3
  84. package/src/__tests__/scheduler-result-notification.test.ts +209 -0
  85. package/src/__tests__/strip-memory-injections.test.ts +75 -27
  86. package/src/__tests__/tool-approval-seed-content-blocks.test.ts +4 -13
  87. package/src/acp/auto-install.test.ts +35 -1
  88. package/src/acp/resolve-agent.test.ts +3 -3
  89. package/src/agent/loop.ts +116 -45
  90. package/src/api/constants/personality-sliders.test.ts +21 -0
  91. package/src/api/constants/personality-sliders.ts +64 -0
  92. package/src/api/events/contact-record-request.ts +16 -4
  93. package/src/api/events/contact-request.ts +10 -1
  94. package/src/api/index.ts +12 -0
  95. package/src/api/responses/memory-v3-selection-log.ts +64 -13
  96. package/src/api/surfaces.ts +6 -5
  97. package/src/background-wake/next-wake.test.ts +13 -0
  98. package/src/background-wake/next-wake.ts +4 -2
  99. package/src/calls/__tests__/voice-session-bridge.test.ts +166 -0
  100. package/src/calls/__tests__/voice-turn-sight-hold.test.ts +301 -0
  101. package/src/calls/voice-session-bridge.ts +162 -1
  102. package/src/calls/voice-triage-escalate.ts +1 -1
  103. package/src/channels/types.ts +14 -0
  104. package/src/cli/__tests__/catalog-search-help.test.ts +1 -0
  105. package/src/cli/__tests__/contacts-address-prompt-cli.test.ts +701 -0
  106. package/src/cli/__tests__/contacts-record-prompt-cli.test.ts +276 -15
  107. package/src/cli/__tests__/roadmap-cli.test.ts +313 -0
  108. package/src/cli/__tests__/run-assistant-command.ts +59 -20
  109. package/src/cli/commands/__tests__/conversations-slack.test.ts +12 -0
  110. package/src/cli/commands/__tests__/plugins-search.test.ts +81 -0
  111. package/src/cli/commands/config.help.ts +3 -1
  112. package/src/cli/commands/contacts.help.ts +179 -12
  113. package/src/cli/commands/contacts.ts +442 -47
  114. package/src/cli/commands/memory/worker.ts +1 -1
  115. package/src/cli/commands/platform/__tests__/credits-format.test.ts +152 -0
  116. package/src/cli/commands/platform/__tests__/credits.test.ts +20 -0
  117. package/src/cli/commands/platform/credits-format.ts +108 -0
  118. package/src/cli/commands/platform/index.help.ts +33 -11
  119. package/src/cli/commands/platform/index.ts +7 -18
  120. package/src/cli/commands/plugins.help.ts +4 -1
  121. package/src/cli/commands/plugins.ts +2 -1
  122. package/src/cli/commands/roadmap.help.ts +171 -0
  123. package/src/cli/commands/roadmap.ts +358 -0
  124. package/src/cli/index.help.ts +2 -0
  125. package/src/cli/lib/__tests__/cli-output.test.ts +5 -0
  126. package/src/cli/lib/cli-output.ts +6 -6
  127. package/src/cli/program.ts +2 -0
  128. package/src/config/__tests__/webhook-routing.test.ts +42 -0
  129. package/src/config/acp-defaults.test.ts +3 -3
  130. package/src/config/acp-defaults.ts +5 -5
  131. package/src/config/bundled-skills/acp/SKILL.md +8 -11
  132. package/src/config/bundled-skills/computer-use/SKILL.md +21 -0
  133. package/src/config/bundled-skills/computer-use/TOOLS.json +6 -0
  134. package/src/config/bundled-skills/contacts/SKILL.md +61 -11
  135. package/src/config/bundled-skills/messaging/SKILL.md +2 -0
  136. package/src/config/bundled-skills/messaging/TOOLS.json +4 -4
  137. package/src/config/bundled-skills/messaging/tools/messaging-send.ts +160 -36
  138. package/src/config/bundled-skills/messaging/tools/shared.ts +6 -0
  139. package/src/config/bundled-skills/schedule/SKILL.md +10 -2
  140. package/src/config/bundled-skills/screen-annotation/SKILL.md +80 -0
  141. package/src/config/bundled-skills/screen-annotation/TOOLS.json +73 -0
  142. package/src/config/bundled-skills/screen-annotation/tools/screen-annotation.test.ts +74 -0
  143. package/src/config/bundled-skills/screen-annotation/tools/screen-clear-marks.ts +33 -0
  144. package/src/config/bundled-skills/screen-annotation/tools/screen-point-at.ts +25 -0
  145. package/src/config/env-registry.ts +2 -0
  146. package/src/config/feature-flag-registry.json +39 -7
  147. package/src/config/input-modalities.test.ts +71 -0
  148. package/src/config/input-modalities.ts +95 -0
  149. package/src/config/loader.ts +2 -0
  150. package/src/config/schemas/__tests__/memory-v3.test.ts +58 -15
  151. package/src/config/schemas/heartbeat.ts +3 -3
  152. package/src/config/schemas/llm.ts +47 -10
  153. package/src/config/schemas/memory-storage.test.ts +39 -0
  154. package/src/config/schemas/memory-storage.ts +21 -0
  155. package/src/config/schemas/memory-v3.ts +73 -46
  156. package/src/config/schemas/services.ts +18 -0
  157. package/src/config/webhook-routing.ts +12 -2
  158. package/src/context/compactor.ts +12 -13
  159. package/src/context/strip-injections.ts +29 -25
  160. package/src/context/token-estimator.ts +2 -2
  161. package/src/daemon/__tests__/embedding-reconcile.test.ts +77 -0
  162. package/src/daemon/__tests__/lifecycle-embedding-reconcile.test.ts +3 -0
  163. package/src/daemon/__tests__/turn-actor.test.ts +68 -0
  164. package/src/daemon/conversation-agent-loop-handlers.ts +152 -22
  165. package/src/daemon/conversation-agent-loop.ts +19 -3
  166. package/src/daemon/conversation-messaging.ts +3 -2
  167. package/src/daemon/conversation-runtime-assembly.ts +191 -69
  168. package/src/daemon/conversation-surfaces.ts +32 -62
  169. package/src/daemon/conversation.ts +153 -46
  170. package/src/daemon/embedding-reconcile.ts +64 -1
  171. package/src/daemon/handlers/config-embeddings.ts +31 -0
  172. package/src/daemon/host-cu-proxy.ts +66 -50
  173. package/src/daemon/host-cu-target.ts +139 -0
  174. package/src/daemon/host-proxy-preactivation.ts +29 -1
  175. package/src/daemon/mcp-reload-service.ts +6 -0
  176. package/src/daemon/providers-setup.ts +5 -26
  177. package/src/daemon/trust-context.ts +1 -1
  178. package/src/daemon/turn-actor.ts +46 -0
  179. package/src/heartbeat/heartbeat-service.ts +72 -13
  180. package/src/inbound/platform-callback-registration.ts +77 -11
  181. package/src/inbound/pod-webhook-claim.ts +35 -0
  182. package/src/inbound/velay-webhooks-gate.ts +20 -0
  183. package/src/ipc/gateway-client.ts +91 -0
  184. package/src/live-voice/__tests__/live-voice-photo.test.ts +174 -0
  185. package/src/live-voice/__tests__/live-voice-session-guardian.test.ts +127 -0
  186. package/src/live-voice/__tests__/live-voice-session-telemetry.test.ts +42 -2
  187. package/src/live-voice/__tests__/live-voice-sight-frame.test.ts +81 -0
  188. package/src/live-voice/__tests__/protocol.test.ts +67 -0
  189. package/src/live-voice/live-voice-connection.ts +14 -1
  190. package/src/live-voice/live-voice-photo.ts +109 -4
  191. package/src/live-voice/live-voice-session-manager.ts +10 -1
  192. package/src/live-voice/live-voice-session.ts +196 -31
  193. package/src/live-voice/protocol.ts +134 -1
  194. package/src/mcp/__tests__/reload-signal-emission.test.ts +54 -0
  195. package/src/mcp/__tests__/reload-signal.test.ts +57 -0
  196. package/src/mcp/__tests__/startup.test.ts +150 -0
  197. package/src/mcp/reload-signal.ts +50 -0
  198. package/src/mcp/startup.ts +101 -0
  199. package/src/messaging/providers/outlook/adapter.ts +2 -13
  200. package/src/messaging/providers/outlook/client.ts +13 -1
  201. package/src/messaging/providers/outlook/types.ts +3 -0
  202. package/src/messaging/providers/telegram-bot/adapter.ts +9 -2
  203. package/src/messaging/providers/telegram-bot/client.ts +8 -2
  204. package/src/messaging/providers/whatsapp/adapter.ts +9 -2
  205. package/src/messaging/providers/whatsapp/client.ts +8 -2
  206. package/src/notifications/AGENTS.md +5 -0
  207. package/src/notifications/README.md +21 -7
  208. package/src/notifications/__tests__/assistant-reply-producer.test.ts +3 -10
  209. package/src/notifications/__tests__/background-failure-signal.test.ts +96 -0
  210. package/src/notifications/__tests__/broadcaster.test.ts +171 -7
  211. package/src/notifications/__tests__/decision-engine.test.ts +79 -6
  212. package/src/notifications/__tests__/edit-notification.test.ts +59 -0
  213. package/src/notifications/__tests__/resolve-visible-in-source.test.ts +96 -0
  214. package/src/notifications/__tests__/schedule-result-producer.test.ts +397 -0
  215. package/src/notifications/access-request-copy.ts +5 -5
  216. package/src/notifications/approval-card-data.ts +29 -13
  217. package/src/notifications/assistant-reply-producer.ts +0 -4
  218. package/src/notifications/background-failure-signal.ts +13 -1
  219. package/src/notifications/broadcaster.ts +65 -2
  220. package/src/notifications/conversation-pairing.ts +263 -155
  221. package/src/notifications/copy-composer.ts +38 -22
  222. package/src/notifications/decision-engine.ts +89 -61
  223. package/src/notifications/delivered-post-record.ts +81 -0
  224. package/src/notifications/deliveries-store.ts +8 -1
  225. package/src/notifications/edit-notification.ts +16 -0
  226. package/src/notifications/events-store.ts +68 -2
  227. package/src/notifications/guardian-question-mode.ts +24 -232
  228. package/src/notifications/home-feed-side-effect.ts +1 -0
  229. package/src/notifications/notification-utils.ts +13 -5
  230. package/src/notifications/resolve-visible-in-source.ts +56 -0
  231. package/src/notifications/schedule-result-producer.ts +275 -0
  232. package/src/notifications/signal.ts +5 -0
  233. package/src/oauth/__tests__/seed-providers-managed.test.ts +82 -0
  234. package/src/oauth/seed-providers.ts +201 -3
  235. package/src/onboarding/onboarding-events-store.ts +14 -8
  236. package/src/persistence/conversation-crud.ts +68 -19
  237. package/src/persistence/embeddings/embedding-backend.test.ts +162 -0
  238. package/src/persistence/embeddings/embedding-backend.ts +148 -11
  239. package/src/persistence/embeddings/embedding-gemini.test.ts +328 -9
  240. package/src/persistence/embeddings/embedding-gemini.ts +211 -27
  241. package/src/persistence/embeddings/embedding-openai.test.ts +113 -0
  242. package/src/persistence/embeddings/embedding-openai.ts +55 -4
  243. package/src/persistence/embeddings/embedding-types.test.ts +24 -0
  244. package/src/persistence/embeddings/embedding-types.ts +25 -1
  245. package/src/persistence/job-utils.ts +6 -2
  246. package/src/persistence/message-metadata.ts +20 -0
  247. package/src/persistence/migrations/283-memory-v3-selections-message-id-and-sections.ts +2 -1
  248. package/src/persistence/migrations/376-notification-deliveries-canonical-message-id.ts +37 -0
  249. package/src/persistence/schema/memory-injection.ts +31 -9
  250. package/src/persistence/schema/notifications.ts +8 -0
  251. package/src/persistence/steps.ts +2 -0
  252. package/src/plugin-api/index.ts +2 -1
  253. package/src/plugin-api/vision-support.test.ts +81 -0
  254. package/src/plugin-api/vision-support.ts +57 -10
  255. package/src/plugin-api/webhook-url.ts +18 -4
  256. package/src/plugins/AGENTS.md +1 -1
  257. package/src/plugins/defaults/channel/injectors.ts +3 -1
  258. package/src/plugins/defaults/injector-order.ts +2 -2
  259. package/src/plugins/defaults/memory/AGENTS.md +263 -30
  260. package/src/plugins/defaults/memory/__tests__/conversation-memory-orphan-sweep.test.ts +4 -0
  261. package/src/plugins/defaults/memory/__tests__/conversation-memory-purge.test.ts +6 -0
  262. package/src/plugins/defaults/memory/__tests__/db-memory-attach.test.ts +9 -3
  263. package/src/plugins/defaults/memory/__tests__/memory-log-stores-degraded.test.ts +3 -7
  264. package/src/plugins/defaults/memory/__tests__/relocated-memory-test-rows.ts +18 -0
  265. package/src/plugins/defaults/memory/context-search/sources/conversations.ts +16 -2
  266. package/src/plugins/defaults/memory/conversation-memory-purge.ts +2 -0
  267. package/src/plugins/defaults/memory/fork-conversation-memory.ts +13 -13
  268. package/src/plugins/defaults/memory/graph/__tests__/conversation-graph-memory-v2-routing.test.ts +19 -12
  269. package/src/plugins/defaults/memory/graph/conversation-graph-memory.ts +17 -15
  270. package/src/plugins/defaults/memory/graph-topology/build-memory-graph.ts +1 -1
  271. package/src/plugins/defaults/memory/hooks/__tests__/post-compact.test.ts +121 -0
  272. package/src/plugins/defaults/memory/hooks/init.ts +10 -0
  273. package/src/plugins/defaults/memory/hooks/injection-metadata.ts +100 -0
  274. package/src/plugins/defaults/memory/hooks/post-compact.ts +19 -7
  275. package/src/plugins/defaults/memory/hooks/user-prompt-submit.ts +11 -83
  276. package/src/plugins/defaults/memory/injectors.ts +4 -4
  277. package/src/plugins/defaults/memory/job-handlers.ts +4 -1
  278. package/src/plugins/defaults/memory/jobs/__tests__/embed-concept-page.test.ts +1 -0
  279. package/src/plugins/defaults/memory/jobs/embed-concept-page.ts +11 -3
  280. package/src/plugins/defaults/memory/memory-db.ts +4 -0
  281. package/src/plugins/defaults/memory/memory-marker.ts +28 -17
  282. package/src/plugins/defaults/memory/src/__tests__/memory-v2-simulate-route.test.ts +0 -1
  283. package/src/plugins/defaults/memory/src/__tests__/memory-worker-routes.test.ts +20 -0
  284. package/src/plugins/defaults/memory/src/memory-item-routes.test.ts +0 -1
  285. package/src/plugins/defaults/memory/src/memory-worker-routes.ts +3 -1
  286. package/src/plugins/defaults/memory/substrate/__tests__/cli-command-store.test.ts +1 -1
  287. package/src/plugins/defaults/memory/substrate/__tests__/consolidation-job.test.ts +66 -0
  288. package/src/plugins/defaults/memory/substrate/__tests__/injected-block-slugs.test.ts +345 -0
  289. package/src/plugins/defaults/memory/substrate/__tests__/page-index.test.ts +0 -1
  290. package/src/plugins/defaults/memory/substrate/__tests__/prompts-consolidation.test.ts +170 -1
  291. package/src/plugins/defaults/memory/substrate/__tests__/reembed-job.test.ts +1 -0
  292. package/src/plugins/defaults/memory/substrate/capability-slugs.ts +53 -0
  293. package/src/plugins/defaults/memory/substrate/cli-command-store.ts +4 -18
  294. package/src/plugins/defaults/memory/substrate/consolidation-job.ts +40 -1
  295. package/src/plugins/defaults/memory/substrate/ingest.ts +11 -9
  296. package/src/plugins/defaults/memory/substrate/injected-block-slugs.ts +426 -42
  297. package/src/plugins/defaults/memory/substrate/page-index.ts +5 -4
  298. package/src/plugins/defaults/memory/substrate/prompts/consolidation.ts +127 -14
  299. package/src/plugins/defaults/memory/substrate/skill-store.ts +1 -18
  300. package/src/plugins/defaults/memory/v2/__tests__/backfill-jobs.test.ts +1 -0
  301. package/src/plugins/defaults/memory/v2/__tests__/injection.test.ts +2 -8
  302. package/src/plugins/defaults/memory/v2/__tests__/router.test.ts +0 -1
  303. package/src/plugins/defaults/memory/v2/injection.ts +4 -4
  304. package/src/plugins/defaults/memory/v3/__tests__/capabilities.test.ts +16 -0
  305. package/src/plugins/defaults/memory/v3/__tests__/carry-integration.test.ts +1004 -319
  306. package/src/plugins/defaults/memory/v3/__tests__/dense.test.ts +227 -4
  307. package/src/plugins/defaults/memory/v3/__tests__/injection.test.ts +836 -263
  308. package/src/plugins/defaults/memory/v3/__tests__/live-integration.test.ts +65 -38
  309. package/src/plugins/defaults/memory/v3/__tests__/maintain-job.test.ts +354 -3
  310. package/src/plugins/defaults/memory/v3/__tests__/orchestrate.test.ts +688 -104
  311. package/src/plugins/defaults/memory/v3/__tests__/overlong-sections.test.ts +109 -0
  312. package/src/plugins/defaults/memory/v3/__tests__/page-content.test.ts +144 -0
  313. package/src/plugins/defaults/memory/v3/__tests__/plugin-schema.test.ts +534 -0
  314. package/src/plugins/defaults/memory/v3/__tests__/pool-log-store.test.ts +449 -0
  315. package/src/plugins/defaults/memory/v3/__tests__/pool-select.test.ts +265 -27
  316. package/src/plugins/defaults/memory/v3/__tests__/render-injection.test.ts +34 -117
  317. package/src/plugins/defaults/memory/v3/__tests__/section-dense-store.test.ts +491 -4
  318. package/src/plugins/defaults/memory/v3/__tests__/section-needle.test.ts +124 -1
  319. package/src/plugins/defaults/memory/v3/__tests__/sections.test.ts +264 -4
  320. package/src/plugins/defaults/memory/v3/__tests__/selection-log-store.test.ts +560 -22
  321. package/src/plugins/defaults/memory/v3/__tests__/shadow-integration.test.ts +40 -33
  322. package/src/plugins/defaults/memory/v3/__tests__/shadow-plugin.test.ts +718 -63
  323. package/src/plugins/defaults/memory/v3/__tests__/types.test.ts +83 -2
  324. package/src/plugins/defaults/memory/v3/candidate-match.ts +1 -1
  325. package/src/plugins/defaults/memory/v3/capabilities.ts +90 -14
  326. package/src/plugins/defaults/memory/v3/card.test.ts +15 -16
  327. package/src/plugins/defaults/memory/v3/card.ts +16 -15
  328. package/src/plugins/defaults/memory/v3/dense.ts +10 -0
  329. package/src/plugins/defaults/memory/v3/ever-injected-store.test.ts +643 -140
  330. package/src/plugins/defaults/memory/v3/ever-injected-store.ts +462 -212
  331. package/src/plugins/defaults/memory/v3/hot-set.test.ts +2 -2
  332. package/src/plugins/defaults/memory/v3/injector.ts +366 -278
  333. package/src/plugins/defaults/memory/v3/learned-edges.test.ts +2 -2
  334. package/src/plugins/defaults/memory/v3/maintain-job.ts +299 -73
  335. package/src/plugins/defaults/memory/v3/orchestrate.ts +327 -214
  336. package/src/plugins/defaults/memory/v3/overlong-sections.ts +83 -0
  337. package/src/plugins/defaults/memory/v3/page-content.ts +72 -92
  338. package/src/plugins/defaults/memory/v3/plugin-schema.ts +346 -0
  339. package/src/plugins/defaults/memory/v3/pool-log-store.ts +291 -0
  340. package/src/plugins/defaults/memory/v3/pool-select.test.ts +2 -2
  341. package/src/plugins/defaults/memory/v3/pool-select.ts +160 -60
  342. package/src/plugins/defaults/memory/v3/prune.test.ts +1042 -329
  343. package/src/plugins/defaults/memory/v3/prune.ts +433 -270
  344. package/src/plugins/defaults/memory/v3/rare-term-lane.test.ts +269 -0
  345. package/src/plugins/defaults/memory/v3/rare-term-lane.ts +141 -0
  346. package/src/plugins/defaults/memory/v3/render-injection.ts +43 -82
  347. package/src/plugins/defaults/memory/v3/section-dense-store.ts +316 -28
  348. package/src/plugins/defaults/memory/v3/section-needle.ts +145 -11
  349. package/src/plugins/defaults/memory/v3/sections.ts +103 -16
  350. package/src/plugins/defaults/memory/v3/selection-log-store.ts +243 -78
  351. package/src/plugins/defaults/memory/v3/shadow-plugin.ts +189 -68
  352. package/src/plugins/defaults/memory/v3/tuning-profile.ts +6 -0
  353. package/src/plugins/defaults/memory/v3/types.ts +169 -23
  354. package/src/plugins/defaults/memory/v3-eval/__tests__/eval-packets.test.ts +21 -4
  355. package/src/plugins/defaults/memory/v3-eval/eval-packets.ts +77 -26
  356. package/src/plugins/types.ts +14 -0
  357. package/src/providers/__tests__/connection-model-compat.test.ts +1 -0
  358. package/src/providers/__tests__/provider-secret-catalog.test.ts +4 -0
  359. package/src/providers/__tests__/xml-tool-call-salvage.test.ts +172 -0
  360. package/src/providers/inline-audio-support.test.ts +34 -0
  361. package/src/providers/inline-audio-support.ts +27 -0
  362. package/src/providers/model-catalog.ts +102 -0
  363. package/src/providers/openai/__tests__/chat-completions-extra-body.test.ts +51 -0
  364. package/src/providers/openai/__tests__/chat-completions-provider-xml-salvage.test.ts +291 -0
  365. package/src/providers/openai/chat-completions-provider.ts +114 -14
  366. package/src/providers/openai/codex-models.ts +1 -0
  367. package/src/providers/openai/responses-provider.ts +65 -15
  368. package/src/providers/opencode/client.test.ts +24 -0
  369. package/src/providers/opencode/client.ts +6 -1
  370. package/src/providers/provider-secret-catalog.ts +11 -1
  371. package/src/providers/retry.ts +6 -0
  372. package/src/providers/vellum/client.ts +14 -1
  373. package/src/providers/vellum/personality-directions.test.ts +163 -0
  374. package/src/providers/vellum/personality-directions.ts +120 -0
  375. package/src/providers/xml-tool-call-salvage.ts +212 -0
  376. package/src/runtime/AGENTS.md +7 -2
  377. package/src/runtime/__tests__/background-job-runner.test.ts +115 -0
  378. package/src/runtime/__tests__/guardian-form-registry.test.ts +0 -32
  379. package/src/runtime/__tests__/host-observe.test.ts +44 -0
  380. package/src/runtime/assistant-event-hub.ts +14 -9
  381. package/src/runtime/auth/__tests__/guard-tests.test.ts +1 -4
  382. package/src/runtime/auth/__tests__/route-policy.test.ts +65 -0
  383. package/src/runtime/auth/same-actor.ts +4 -3
  384. package/src/runtime/background-job-runner.ts +10 -0
  385. package/src/runtime/channel-reply-delivery.ts +1 -162
  386. package/src/runtime/guardian-action-service.ts +20 -1
  387. package/src/runtime/host-observe.ts +56 -6
  388. package/src/runtime/http-server.ts +35 -0
  389. package/src/runtime/outbound-post-reconciliation.ts +183 -0
  390. package/src/runtime/routes/__tests__/contact-address-prompt-route.test.ts +231 -0
  391. package/src/runtime/routes/__tests__/contact-record-prompt-route.test.ts +59 -3
  392. package/src/runtime/routes/__tests__/guardian-form-routes.test.ts +85 -0
  393. package/src/runtime/routes/__tests__/heartbeat-routes.test.ts +24 -0
  394. package/src/runtime/routes/__tests__/platform-credits-routes.test.ts +239 -0
  395. package/src/runtime/routes/__tests__/roadmap-routes.test.ts +469 -0
  396. package/src/runtime/routes/__tests__/watch-routes.test.ts +70 -1
  397. package/src/runtime/routes/__tests__/webhook-routes.test.ts +83 -0
  398. package/src/runtime/routes/contact-prompt-routes.ts +177 -28
  399. package/src/runtime/routes/conversation-query-routes.ts +53 -11
  400. package/src/runtime/routes/events-routes.ts +13 -3
  401. package/src/runtime/routes/guardian-action-routes.ts +7 -0
  402. package/src/runtime/routes/guardian-form-routes.ts +6 -4
  403. package/src/runtime/routes/heartbeat-routes.ts +41 -53
  404. package/src/runtime/routes/index.ts +2 -2
  405. package/src/runtime/routes/integrations/a2a.ts +12 -3
  406. package/src/runtime/routes/integrations/vercel.ts +13 -3
  407. package/src/runtime/routes/platform-routes.ts +175 -23
  408. package/src/runtime/routes/roadmap-routes.ts +744 -0
  409. package/src/runtime/routes/watch-routes.ts +50 -0
  410. package/src/runtime/routes/webhook-routes.ts +24 -2
  411. package/src/runtime/web-presence.ts +13 -9
  412. package/src/schedule/__tests__/schedule-timezone.test.ts +21 -3
  413. package/src/schedule/__tests__/worker-mcp-tools.test.ts +88 -0
  414. package/src/schedule/schedule-timezone.ts +25 -0
  415. package/src/schedule/scheduler.ts +19 -0
  416. package/src/schedule/worker.ts +119 -2
  417. package/src/telemetry/__tests__/live-voice-funnel.test.ts +32 -0
  418. package/src/telemetry/live-voice-funnel.ts +33 -0
  419. package/src/tools/acp/list-agents.test.ts +1 -1
  420. package/src/tools/browser/__tests__/browser-status.test.ts +3 -0
  421. package/src/tools/browser/browser-execution.ts +117 -53
  422. package/src/tools/browser/browser-status-constants.ts +6 -6
  423. package/src/tools/capability-offer.test.ts +87 -0
  424. package/src/tools/capability-offer.ts +93 -0
  425. package/src/tools/computer-use/definitions.ts +6 -0
  426. package/src/tools/computer-use/skill-proxy-bridge.ts +10 -0
  427. package/src/tools/terminal/safe-env.ts +2 -0
  428. package/src/watch/__tests__/watch-retro.test.ts +11 -10
  429. package/src/watch/__tests__/watch-session-manager.test.ts +75 -1
  430. package/src/watch/watch-retro.ts +10 -9
  431. package/src/watch/watch-session-manager.ts +17 -0
  432. package/src/runtime/routes/__tests__/sight-frame-routes.test.ts +0 -487
  433. package/src/runtime/routes/sight-frame-routes.ts +0 -136
@@ -16,11 +16,15 @@ Manage the user's contacts, relationship graph, access control (trusted contacts
16
16
 
17
17
  ## Contact Management
18
18
 
19
- > **Every contact write goes through the guardian.** You can list, search, and merge contacts on your own. To create, edit, or delete one, run the matching command below: each opens a form in the guardian's app, and the write happens only if they submit it. You are proposing, not writing. Say so: "I'll put that up for you to confirm," not "Done."
19
+ > **Every contact write goes through the guardian.** You can list and search contacts on your own. To create, edit, delete, merge, or bind a channel to one, run the matching command below: each opens a form in the guardian's app, and the write happens only if they submit it. You are proposing, not writing. Say so: "I'll put that up for you to confirm," not "Done."
20
20
  >
21
- > Two things a contact record does **not** do: it grants no access (a record has no channels, so nobody can message the assistant through it), and it is not a channel. Use `assistant contacts prompt` to bind an address, or `assistant contacts invites create` to let someone bind their own.
21
+ > Two things a contact record does **not** do: it grants no access (a record has no channels, so nobody can message the assistant through it), and it is not a channel. Use `assistant contacts channels add <contact_id>` to bind an address to a contact that already exists, or `assistant contacts invites create` to let someone bind their own.
22
22
  >
23
23
  > The form needs the guardian's desktop or web app to be open. If a command reports that it timed out, nobody answered: tell the user, and do not retry in a loop.
24
+ >
25
+ > One exception you must not take: the `contact_merge` tool writes immediately, with no confirmation. Use `assistant contacts merge` instead, so the guardian sees what is being combined before the donor record is deleted.
26
+ >
27
+ > A form the guardian closes without answering is not a failure. The command prints `Cancelled: nothing was written`, exits 130, and writes nothing. Report that as "the guardian did not confirm", not as an error, and do not retry in a loop.
24
28
 
25
29
  ### Create a contact
26
30
 
@@ -33,11 +37,50 @@ Opens an add-contact form prefilled with what you pass. The guardian can edit th
33
37
  Optional flags:
34
38
 
35
39
  - `--notes` -- proposed notes, prefilled into the form
40
+ - `--channel` -- also bind a channel on the same form (`email`, `phone`, `telegram`, `whatsapp`, `slack`). Requires `--name`.
41
+ - `--address` -- address to pre-fill for that channel; the guardian can edit it before submitting. Requires `--channel`.
42
+ - `--verify` -- pre-check the form's "mark verified" box. Requires `--channel`.
36
43
  - `--label` / `--description` -- what the form says about why you are asking
37
44
  - `--timeout` -- how long the form stays open, in ms (default 300000)
38
45
 
46
+ With `--channel`, the record and the channel are one form and one guardian confirmation:
47
+
48
+ ```bash
49
+ assistant contacts create --name "Alice" --channel email --address "alice@example.com" --json
50
+ ```
51
+
52
+ `--name` is required in that mode, because the contact is created under it. The form shows `--notes` but does not let the guardian edit them, so they are written as passed; use `assistant contacts update` to change them afterwards. `--address` and `--verify` each need `--channel`, so either one without it is refused rather than ignored.
53
+
54
+ The `--json` shape follows the mode: without `--channel` it is `{ok, contact}`, so the new id is `contact.id`; with `--channel` it is the address form's `{ok, contactId, channelId, channelType, address, verified}`, so the id is `contactId`. Read the right one before passing it to `contacts invites create --contact-id`.
55
+
39
56
  Use this before creating an invite for someone who is not in the contact graph yet.
40
57
 
58
+ ### Bind a channel to an existing contact
59
+
60
+ ```bash
61
+ assistant contacts channels add "<contact_id>" --channel email --address "alice@example.com" --json
62
+ ```
63
+
64
+ Opens an address form naming that contact, so the guardian can see where the channel is going. Whatever address they submit binds to that contact: one confirmation, and no second record. This is how you add an address to somebody who is already in the graph. `--channel` is required.
65
+
66
+ Optional flags:
67
+
68
+ - `--address` -- address to pre-fill; the guardian can edit it before submitting
69
+ - `--verify` -- pre-check the form's "mark verified" box. The guardian decides: unchecked, the channel stays unverified and cannot message the assistant.
70
+ - `--label` / `--description` -- what the form says about why you are asking
71
+ - `--timeout` -- how long the form stays open, in ms (default 300000)
72
+
73
+ Two contacts cannot share one address. An address held by a different contact when the form is submitted is refused, the refusal names that contact, and nothing is written. Passing `--address` also checks up front and warns when the address looks taken, without refusing.
74
+
75
+ For an address that belongs to nobody yet, `assistant contacts prompt` is the create-or-bind path:
76
+
77
+ ```bash
78
+ assistant contacts prompt --channel email --json
79
+ assistant contacts prompt --contact-id "<contact_id>" --channel email --json
80
+ ```
81
+
82
+ On its own it looks up the `(channel type, address)` pair the guardian submits: a match reuses that contact and channel, and no match creates a new contact named after the address. `--contact-id` targets an existing contact instead, the same bind `channels add` does under its own verb.
83
+
41
84
  ### Update a contact
42
85
 
43
86
  ```bash
@@ -53,7 +96,7 @@ Opens an edit form showing the current name next to the proposed change. At leas
53
96
  assistant contacts delete "<contact_id>" --json
54
97
  ```
55
98
 
56
- Opens a confirmation showing the contact and its channels. Deleting a contact deletes its channels too, so anyone reaching the assistant through them loses access. A guardian contact cannot be deleted. When two records are the same person, merge them with the `contact_merge` tool instead: merging keeps the surviving contact's channels.
99
+ Opens a confirmation showing the contact and its channels. Deleting a contact deletes its channels too, so anyone reaching the assistant through them loses access. A guardian contact cannot be deleted. When two records are the same person, run `assistant contacts merge <surviving_contact_id> <donor_contact_id>` instead: the donor's channels move to the survivor rather than being destroyed with it.
57
100
 
58
101
  ### Search contacts
59
102
 
@@ -72,17 +115,24 @@ Optional flags:
72
115
 
73
116
  ### Merge contacts
74
117
 
75
- When you discover two contacts are the same person (e.g. same person on email and Slack), merge them to consolidate. Merging:
76
-
77
- - Combines all channels from both contacts
78
- - Merges notes from both contacts
79
- - Sums interaction counts
80
- - Deletes the donor contact
118
+ When you discover two contacts are the same person (e.g. same person on email and Slack), merge them to consolidate.
81
119
 
82
120
  ```bash
83
121
  assistant contacts merge <surviving_contact_id> <donor_contact_id> --json
84
122
  ```
85
123
 
124
+ Opens a confirmation naming both contacts and listing the channels that move. Nothing is merged unless the guardian submits it. On submit:
125
+
126
+ - The donor's channels move to the surviving contact
127
+ - Notes from both contacts are combined
128
+ - The donor record is deleted
129
+
130
+ A contact's interaction count is the sum over its channels, so a moved channel brings its history with it. An address the survivor already holds is left where it is, and its donor-side history goes with the deleted record.
131
+
132
+ Nobody loses access: every address that reached the donor reaches the survivor afterwards. A guardian contact cannot be the donor, so keep the guardian as the survivor.
133
+
134
+ The survivor keeps its own name unless the guardian edits it on the form. `--keep-donor-name` seeds that field with the donor's name, for when the donor is the better-named record of the two.
135
+
86
136
  ## Access Control (Trusted Contacts)
87
137
 
88
138
  Trusted contacts control who is allowed to send messages to the assistant through external channels like Telegram and voice (phone calls).
@@ -138,7 +188,7 @@ Access is granted per channel, not per contact, and it always takes proof that t
138
188
 
139
189
  1. **Contact record** -- if they are not in the graph yet, `assistant contacts create --name "<name>"`. The guardian confirms it. This alone grants nothing.
140
190
  2. **Invite link** -- `assistant contacts invites create --source-channel <channel> --contact-id <contact_id>`. The invitee redeems it from the address they actually control, which is what makes the channel trusted. This is the path to prefer: it works even when nobody knows the invitee's handle on that channel up front.
141
- 3. **Address the guardian already knows** -- `assistant contacts prompt --channel <channel>` opens a form for them to type it in. The channel lands unverified unless the guardian checks the verify box on that form, and an unverified channel cannot message the assistant.
191
+ 3. **Address the guardian already knows** -- for someone already in the graph, `assistant contacts channels add <contact_id> --channel <channel>` opens a form naming that contact and binds the address there. For a brand new address with no record behind it, `assistant contacts prompt --channel <channel>` creates the contact from what the guardian types. Either way the channel lands unverified unless the guardian checks the verify box on that form, and an unverified channel cannot message the assistant.
142
192
 
143
193
  Only the guardian's own submission can complete any of these, so never promise access is live until the command returns.
144
194
 
@@ -501,7 +551,7 @@ Each channel has:
501
551
 
502
552
  **"Rename [name]"** / **"Update [name]'s notes"** -- Find the contact with `assistant contacts list --json`, then `assistant contacts update <contact_id> --name ... --notes ...`.
503
553
 
504
- **"Delete [name]"** / **"Remove [name] from my contacts"** -- Find the contact, then `assistant contacts delete <contact_id>`. Mention that this drops their channels too. If the user actually means two records are the same person, merge instead with the `contact_merge` tool.
554
+ **"Delete [name]"** / **"Remove [name] from my contacts"** -- Find the contact, then `assistant contacts delete <contact_id>`. Mention that this drops their channels too. If the user actually means two records are the same person, run `assistant contacts merge <surviving_contact_id> <donor_contact_id>` instead.
505
555
 
506
556
  **"Add my friend to Telegram"** -- Create the contact with `assistant contacts create --name "<their name>"` and wait for the guardian to confirm the form. Then create an invite with `assistant contacts invites create --source-channel telegram --contact-id <contact_id>` and present the deep link. You never need their Telegram user ID: redeeming the invite is what binds their account.
507
557
 
@@ -32,6 +32,8 @@ Reading, searching, or summarizing the user's inbox is a **messaging task** —
32
32
 
33
33
  When a platform is connected (auth test succeeds), always use the messaging API tools for that platform. Never fall back to browser automation, shell commands (bash, curl), or any other approach for operations that messaging tools can handle. The messaging tools handle authentication internally - never try to access tokens or call APIs directly. Browser automation is only appropriate for initial credential setup (OAuth consent screens), not for day-to-day messaging operations.
34
34
 
35
+ On Gmail and Outlook, `messaging_send` creates a real mailbox draft for review. It does not send. Recipients are optional on Outlook: if the user has not named a To address, still create the draft (use a non-email `conversation_id` such as `drafts`) and tell them only after the tool returns a draft ID. If draft creation fails or is interrupted, say so and offer the email copy in chat. Do not claim a draft exists until the tool succeeds.
36
+
35
37
  **Exception: Slack.** Slack messaging should use the Slack Web API directly via CLI, not messaging tools. See the **slack** skill for details.
36
38
 
37
39
  ## Connection Setup
@@ -125,7 +125,7 @@
125
125
  },
126
126
  {
127
127
  "name": "messaging_send",
128
- "description": "Send a message, reply to a thread, or create a draft. On Gmail, always creates a draft for review. Supports replies (via thread_id), attachments (via attachment_paths, Gmail and Outlook), and all messaging platforms.",
128
+ "description": "Send a message, reply to a thread, or create a draft. On Gmail and Outlook, always creates a real mailbox draft for review (recipients optional on Outlook). Supports replies (via thread_id), attachments (via attachment_paths, Gmail and Outlook), and all messaging platforms.",
129
129
  "category": "messaging",
130
130
  "risk": "high",
131
131
  "input_schema": {
@@ -141,7 +141,7 @@
141
141
  },
142
142
  "conversation_id": {
143
143
  "type": "string",
144
- "description": "Conversation/channel ID. For Gmail new messages, use the recipient email address."
144
+ "description": "Conversation/channel ID. For Gmail or Outlook new messages, use the recipient email address. On Outlook, a non-email placeholder still creates a Drafts-folder draft with no To address."
145
145
  },
146
146
  "text": {
147
147
  "type": "string",
@@ -149,11 +149,11 @@
149
149
  },
150
150
  "subject": {
151
151
  "type": "string",
152
- "description": "Email subject line (Gmail only)"
152
+ "description": "Email subject line (Gmail and Outlook)"
153
153
  },
154
154
  "in_reply_to": {
155
155
  "type": "string",
156
- "description": "Message-ID header for replies (Gmail only)"
156
+ "description": "Message ID to reply to. Gmail: RFC 822 Message-ID header. Outlook: Graph message ID, creates a reply draft."
157
157
  },
158
158
  "attachment_paths": {
159
159
  "type": "array",
@@ -1,6 +1,7 @@
1
1
  import { readFile } from "node:fs/promises";
2
2
  import { basename } from "node:path";
3
3
 
4
+ import { isChannelId } from "../../../../channels/types.js";
4
5
  import type { OutboundAttachment } from "../../../../messaging/provider-types.js";
5
6
  import {
6
7
  createDraft,
@@ -10,11 +11,15 @@ import {
10
11
  } from "../../../../messaging/providers/gmail/client.js";
11
12
  import { buildMultipartMime } from "../../../../messaging/providers/gmail/mime-builder.js";
12
13
  import {
13
- addMessage,
14
- getConversation,
15
- } from "../../../../persistence/conversation-crud.js";
14
+ createDraft as createOutlookDraft,
15
+ createReplyDraft as createOutlookReplyDraft,
16
+ toOutlookFileAttachments,
17
+ } from "../../../../messaging/providers/outlook/client.js";
18
+ import type { OutlookDraftMessage } from "../../../../messaging/providers/outlook/types.js";
19
+ import { resolveProactiveHomeConversation } from "../../../../notifications/conversation-pairing.js";
20
+ import { recordDeliveredChannelPost } from "../../../../notifications/delivered-post-record.js";
21
+ import { getConversation } from "../../../../persistence/conversation-crud.js";
16
22
  import { syncMessageToDisk } from "../../../../persistence/conversation-disk-view.js";
17
- import { getBindingByChannelChat } from "../../../../persistence/external-conversation-store.js";
18
23
  import type {
19
24
  ToolContext,
20
25
  ToolExecutionResult,
@@ -26,6 +31,7 @@ import {
26
31
  extractEmail,
27
32
  extractHeader,
28
33
  getProviderConnection,
34
+ isMailboxAddress,
29
35
  ok,
30
36
  parseAddressList,
31
37
  resolveProvider,
@@ -47,6 +53,71 @@ async function readAttachments(paths: string[]): Promise<OutboundAttachment[]> {
47
53
  /** Email providers that accept file attachments on outbound sends. */
48
54
  const ATTACHMENT_CAPABLE_PLATFORMS = new Set(["gmail", "outlook"]);
49
55
 
56
+ /**
57
+ * Record a message the provider just accepted where the chat's proactive
58
+ * posts live, so the chat's own conversation and `recall` can see what was
59
+ * sent from elsewhere (a scheduled run, another conversation).
60
+ *
61
+ * Only channel providers have such a home; an email send is tool-mediated
62
+ * and has no chat conversation. The row is written after the provider
63
+ * returned the message id, never before, and carries that id on its
64
+ * envelope and in `channel_outbound_posts` like every other post the daemon
65
+ * makes.
66
+ *
67
+ * A send made from inside the home conversation itself writes no row: its
68
+ * tool call and result already sit in that conversation's history, and a
69
+ * second assistant row beside the tool pair would break history repair. The
70
+ * post is then in the outbound index only through no path, which is the
71
+ * same class as a raw API send and is deferred with it.
72
+ *
73
+ * Failures here never fail the send: the message is already out.
74
+ */
75
+ async function recordSentChannelPost(params: {
76
+ providerId: string;
77
+ externalChatId: string;
78
+ text: string;
79
+ providerMessageId: string;
80
+ senderConversationId: string;
81
+ }): Promise<void> {
82
+ const { providerId, externalChatId } = params;
83
+ if (!isChannelId(providerId) || !params.providerMessageId) {
84
+ return;
85
+ }
86
+ try {
87
+ const home = await resolveProactiveHomeConversation({
88
+ sourceChannel: providerId,
89
+ externalChatId,
90
+ source: "notification",
91
+ conversationType: "background",
92
+ title: `Messages to ${externalChatId}`,
93
+ });
94
+ if (home.conversationId === params.senderConversationId) {
95
+ return;
96
+ }
97
+ const recorded = await recordDeliveredChannelPost({
98
+ conversationId: home.conversationId,
99
+ channel: providerId,
100
+ externalChatId,
101
+ text: params.text,
102
+ providerMessageId: params.providerMessageId,
103
+ crossPostedFrom: params.senderConversationId,
104
+ });
105
+ const homeConversation = getConversation(home.conversationId);
106
+ if (homeConversation) {
107
+ syncMessageToDisk(
108
+ home.conversationId,
109
+ recorded.messageId,
110
+ homeConversation.createdAt,
111
+ );
112
+ }
113
+ } catch (e) {
114
+ log.warn(
115
+ { err: e, provider: providerId, externalChatId },
116
+ "Failed to record the sent message in the chat's conversation",
117
+ );
118
+ }
119
+ }
120
+
50
121
  export async function run(
51
122
  input: Record<string, unknown>,
52
123
  context: ToolContext,
@@ -223,7 +294,66 @@ export async function run(
223
294
  );
224
295
  }
225
296
 
226
- // Non-Gmail platforms
297
+ // Outlook: create a Graph draft instead of sending. Recipients are
298
+ // optional so a voice-composed email can land in Drafts before the user
299
+ // names a To address.
300
+ if (provider.id === "outlook") {
301
+ if (!conn) {
302
+ return err(
303
+ "Outlook requires an OAuth connection. Is the account connected?",
304
+ );
305
+ }
306
+
307
+ const attachments = attachmentPaths?.length
308
+ ? await readAttachments(attachmentPaths)
309
+ : undefined;
310
+ const graphAttachments = attachments?.length
311
+ ? toOutlookFileAttachments(attachments)
312
+ : undefined;
313
+ const toAddress = isMailboxAddress(conversationId)
314
+ ? extractEmail(conversationId)
315
+ : undefined;
316
+
317
+ if (inReplyTo) {
318
+ const draft = await createOutlookReplyDraft(
319
+ conn,
320
+ inReplyTo,
321
+ text,
322
+ );
323
+ const recipientSummary = toAddress ? `To: ${toAddress}` : undefined;
324
+ return ok(
325
+ formatOutlookDraftCreated({
326
+ draftId: draft.id,
327
+ webLink: draft.webLink,
328
+ recipientSummary,
329
+ attachmentCount: attachments?.length,
330
+ filenames: attachments?.map((a) => a.filename).join(", "),
331
+ }),
332
+ );
333
+ }
334
+
335
+ const draftBody: OutlookDraftMessage = {
336
+ subject: subject ?? "",
337
+ body: { contentType: "text", content: text },
338
+ ...(toAddress
339
+ ? { toRecipients: [{ emailAddress: { address: toAddress } }] }
340
+ : {}),
341
+ ...(graphAttachments ? { attachments: graphAttachments } : {}),
342
+ };
343
+ const draft = await createOutlookDraft(conn, draftBody);
344
+ const recipientSummary = toAddress ? `To: ${toAddress}` : undefined;
345
+ return ok(
346
+ formatOutlookDraftCreated({
347
+ draftId: draft.id,
348
+ webLink: draft.webLink,
349
+ recipientSummary,
350
+ attachmentCount: attachments?.length,
351
+ filenames: attachments?.map((a) => a.filename).join(", "),
352
+ }),
353
+ );
354
+ }
355
+
356
+ // Non-email platforms
227
357
  const attachments = attachmentPaths?.length
228
358
  ? await readAttachments(attachmentPaths)
229
359
  : undefined;
@@ -239,40 +369,34 @@ export async function run(
239
369
  ? `, "thread_id": "${result.threadId}"`
240
370
  : "";
241
371
 
242
- // Cross-post to the conversation bound to this channel so replies have context.
243
- try {
244
- const binding = getBindingByChannelChat(provider.id, conversationId);
245
- if (binding && binding.conversationId !== context.conversationId) {
246
- const boundConv = getConversation(binding.conversationId);
247
- if (boundConv) {
248
- const crossPosted = await addMessage(
249
- binding.conversationId,
250
- "assistant",
251
- JSON.stringify([{ type: "text", text }]),
252
- {
253
- metadata: {
254
- automated: true,
255
- crossPostedFrom: context.conversationId,
256
- },
257
- skipIndexing: true,
258
- },
259
- );
260
- syncMessageToDisk(
261
- binding.conversationId,
262
- crossPosted.id,
263
- boundConv.createdAt,
264
- );
265
- }
266
- }
267
- } catch (e) {
268
- log.warn(
269
- { err: e, provider: provider.id, externalChatId: conversationId },
270
- "Failed to cross-post outbound message to bound conversation",
271
- );
272
- }
372
+ await recordSentChannelPost({
373
+ providerId: provider.id,
374
+ externalChatId: conversationId,
375
+ text,
376
+ providerMessageId: result.id,
377
+ senderConversationId: context.conversationId,
378
+ });
273
379
 
274
380
  return ok(`Message sent (ID: ${result.id}${threadSuffix}).`);
275
381
  } catch (e) {
276
382
  return err(e instanceof Error ? e.message : String(e));
277
383
  }
278
384
  }
385
+
386
+ function formatOutlookDraftCreated(opts: {
387
+ draftId: string;
388
+ webLink?: string;
389
+ recipientSummary?: string;
390
+ attachmentCount?: number;
391
+ filenames?: string;
392
+ }): string {
393
+ const attachmentBit =
394
+ opts.attachmentCount && opts.filenames
395
+ ? ` with ${opts.attachmentCount} attachment(s): ${opts.filenames}`
396
+ : "";
397
+ const recipientBit = opts.recipientSummary
398
+ ? ` ${opts.recipientSummary}.`
399
+ : " No recipient set. Open the draft in Outlook to add one.";
400
+ const linkBit = opts.webLink ? ` Open it: ${opts.webLink}` : "";
401
+ return `Outlook draft created${attachmentBit} (Draft ID: ${opts.draftId}).${recipientBit}${linkBit} Review it in your Outlook Drafts, then tell me to send it or send it yourself from Outlook.`;
402
+ }
@@ -106,6 +106,12 @@ export function extractEmail(address: string): string {
106
106
  .toLowerCase();
107
107
  }
108
108
 
109
+ /** True when `value` contains a usable mailbox (has `@`, no spaces). */
110
+ export function isMailboxAddress(value: string): boolean {
111
+ const email = extractEmail(value);
112
+ return email.includes("@") && !email.includes(" ");
113
+ }
114
+
109
115
  /**
110
116
  * Resolve the messaging provider from user input.
111
117
  * If platform is specified, look it up directly.
@@ -146,7 +146,7 @@ Conversations created by a schedule's runs land in the sidebar's Scheduled secti
146
146
 
147
147
  ## Conversation Reuse
148
148
 
149
- Recurring schedules reuse the same conversation across runs by default — subsequent runs continue the conversation from the last successful run, preserving context and channel thread continuity. Set `reuse_conversation: false` explicitly if each run should start with a fresh conversation (e.g. independent reports that shouldn't accumulate prior context). One-shot schedules always create a fresh conversation.
149
+ Each run of a recurring schedule starts a fresh conversation unless `reuse_conversation: true` is set, in which case subsequent runs continue the conversation from the last successful run and keep its context (for example a `thread_ts` the run posted to earlier, so it can post into the same Slack thread again). Reuse is a property of the run's own conversation: a run never posts to a channel on its own, so what reaches Slack, Telegram, or Discord is only what the run sends explicitly (see Delivering Results). One-shot schedules always create a fresh conversation.
150
150
 
151
151
  - Only applies to **recurring** schedules; ignored for one-shot schedules.
152
152
  - If the prior conversation has been deleted, a new one is created automatically.
@@ -238,7 +238,15 @@ If any required capability is missing:
238
238
 
239
239
  ## Delivering Results
240
240
 
241
- Scheduled messages run without user interaction. If the task produces output that the user should see (e.g. a digest, summary, or report), the scheduled message **must** include an explicit instruction to deliver the results. Without this, the output only lives in the conversation log and never reaches the user.
241
+ Scheduled messages run without user interaction, in a conversation nobody has open. If the task produces output the user should see (a digest, summary, report, or a check whose answer is "nothing changed"), the scheduled message **must** end with an explicit instruction to deliver it. Without one, the output lives in a conversation log the user never opens.
242
+
243
+ Write the delivery step into the `message` when you create the schedule — not as a vague "let me know", but as the actual call, with a real title:
244
+
245
+ > "…then send the summary with `assistant notifications send --title \"Inbox digest\" --message \"<the summary>\"`."
246
+
247
+ A schedule whose message has no delivery step is not finished. Before calling `schedule_create` in `execute` mode, read your own message back and check that it says where the output goes.
248
+
249
+ There is a safety net, and it is not a substitute for the above. When an execute-mode run finishes with user-facing output and delivered nothing — no `assistant notifications send`, no `messaging_send`, no Slack `chat.postMessage` — the assistant sends a notification carrying the run's final reply, so a schedule can no longer run and leave no trace. It fires on the raw reply — whatever the run happened to end on, at whatever length. An authored delivery step gets a title and body you chose, sent at the moment you chose. Rely on the net and you get the machine's guess instead.
242
250
 
243
251
  Choose the right delivery tool based on the content:
244
252
 
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: screen-annotation
3
+ description: Point at things on the screen the user is showing you
4
+ compatibility: "Designed for Vellum personal assistants"
5
+ metadata:
6
+ emoji: "🫵"
7
+ vellum:
8
+ display-name: "Screen Annotation"
9
+ category: "system"
10
+ activation-hints:
11
+ - "User asks where something is, or how to do something, in an app they are sharing on a call"
12
+ - "User wants to be shown how rather than have it done for them"
13
+ - "The answer to a question is a place on the user's screen"
14
+ avoid-when:
15
+ - "User wants the assistant to do the thing rather than be shown it (use computer-use)"
16
+ - "Nothing is being shared, so there is no surface to point at"
17
+ ---
18
+
19
+ Drawing on the screen the user is showing you, so they can go and do the
20
+ thing themselves.
21
+
22
+ This is the opposite errand from computer use. Nothing here clicks, types or
23
+ drives anything: the marks are a way of pointing while you talk, for someone
24
+ who wants to learn where a control is rather than have it operated for them.
25
+ The ring is drawn outside the bounds you give and never takes the mouse, so
26
+ what you point at stays visible and clickable the whole time.
27
+
28
+ ## Requires a screen share
29
+
30
+ Marks are drawn on the frame around the surface the user is sharing with the
31
+ call. With nothing shared there is nowhere to draw, and `screen_point_at`
32
+ fails saying so. Ask them to share their screen from the call, then point.
33
+
34
+ ## Coordinates
35
+
36
+ Fractions of the shared surface, `0` to `1`, measured against **the picture of
37
+ that surface you were last shown**. `x` and `y` are the top-left corner,
38
+ `width` and `height` the size.
39
+
40
+ Give the bounds of the thing itself. The ring is drawn around them, so a box
41
+ tight on a button reads as a ring around that button; a box drawn where you
42
+ think the ring should go puts the ring outside that instead.
43
+
44
+ Your picture is only as fresh as the last frame you were sent. If the user has
45
+ scrolled or moved a window since, say what you are pointing at as well as
46
+ drawing it, so a mark that has drifted is still recoverable in words.
47
+
48
+ Moving the share is the one kind of drift that is caught for you. A mark
49
+ measured against the surface before the move is refused rather than drawn,
50
+ because those fractions land somewhere arbitrary on the surface that replaced
51
+ it. Wait for a frame of the new one and point again.
52
+
53
+ ## How to point
54
+
55
+ **One thing at a time.** A mark is where to look next. A screen with four
56
+ rings on it is not four times as helpful; it is a diagram, and nobody knows
57
+ which one to start with. Point at the current step, talk, then point at the
58
+ next one.
59
+
60
+ **Captions are imperatives, not explanations.** "Click Share", "Type the name
61
+ here", "This is the tempo". Whatever else needs saying, say out loud: the
62
+ caption is drawn over the user's own work in a window they cannot scroll or
63
+ dismiss, and it is capped at 80 characters for that reason.
64
+
65
+ **Say it as well as draw it.** The marks are a gesture that accompanies
66
+ speech, the way a person points while explaining. A ring with no words is a
67
+ riddle.
68
+
69
+ **Take them down when they stop being true.** Call `screen_clear_marks` when
70
+ the step is done, when the user has moved on, or when the conversation has
71
+ left the screen behind. Marks come down on their own if the share ends or
72
+ moves, but a ring left standing over a finished step is one the user has to
73
+ work out is stale.
74
+
75
+ ## Shapes
76
+
77
+ Today a mark is a rectangle, drawn as a ring around whatever it encloses. To
78
+ point at something that is not rectangular, give the bounds of the area it
79
+ sits in rather than trying to trace it: a ring around a slider's track, or
80
+ around the corner of a canvas where a handle lives.
@@ -0,0 +1,73 @@
1
+ {
2
+ "version": 1,
3
+ "tools": [
4
+ {
5
+ "name": "screen_point_at",
6
+ "description": "Point at something on the screen the user is sharing with the call: draws a ring around it, with a short caption beside it. Replaces whatever is currently drawn.\n\nCoordinates are fractions of the shared surface, 0 to 1, measured against the picture of that surface you were last shown. Give the bounds of the thing itself; the ring is drawn around them.\n\nRequires the user to be sharing their screen. If nothing is shared this fails, and the right move is to ask them to share before pointing again.",
7
+ "category": "screen-annotation",
8
+ "risk": "low",
9
+ "input_schema": {
10
+ "type": "object",
11
+ "properties": {
12
+ "marks": {
13
+ "type": "array",
14
+ "description": "What to point at now, replacing whatever is on screen. Point at one thing at a time unless a step genuinely needs more.",
15
+ "maxItems": 4,
16
+ "items": {
17
+ "type": "object",
18
+ "properties": {
19
+ "x": {
20
+ "type": "number",
21
+ "description": "Left edge, as a fraction of the shared surface's width (0 to 1)."
22
+ },
23
+ "y": {
24
+ "type": "number",
25
+ "description": "Top edge, as a fraction of the shared surface's height (0 to 1)."
26
+ },
27
+ "width": {
28
+ "type": "number",
29
+ "description": "Width, as a fraction of the surface's width."
30
+ },
31
+ "height": {
32
+ "type": "number",
33
+ "description": "Height, as a fraction of the surface's height."
34
+ },
35
+ "caption": {
36
+ "type": "string",
37
+ "maxLength": 80,
38
+ "description": "A short imperative for what to do with it, e.g. \"Click Share\". Say the rest out loud."
39
+ }
40
+ },
41
+ "required": ["x", "y", "width", "height"]
42
+ }
43
+ },
44
+ "target_client_id": {
45
+ "type": "string",
46
+ "description": "ID of the specific client to target. Required when multiple clients support host_cu; omit when only one is connected."
47
+ }
48
+ },
49
+ "required": ["marks"]
50
+ },
51
+ "executor": "tools/screen-point-at.ts",
52
+ "execution_target": "host"
53
+ },
54
+ {
55
+ "name": "screen_clear_marks",
56
+ "description": "Take down whatever is drawn on the user's shared screen. Use it when the step is done, when the user has moved on, or when the conversation has left the screen behind. Marks come down on their own when the share ends or moves to another surface.",
57
+ "category": "screen-annotation",
58
+ "risk": "low",
59
+ "input_schema": {
60
+ "type": "object",
61
+ "properties": {
62
+ "target_client_id": {
63
+ "type": "string",
64
+ "description": "ID of the specific client to target. Required when multiple clients support host_cu; omit when only one is connected."
65
+ }
66
+ },
67
+ "required": []
68
+ },
69
+ "executor": "tools/screen-clear-marks.ts",
70
+ "execution_target": "host"
71
+ }
72
+ ]
73
+ }