@rubytech/create-realagent-code 0.1.592 → 0.1.594

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 (289) hide show
  1. package/package.json +2 -2
  2. package/payload/platform/package.json +1 -0
  3. package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +11 -5
  4. package/payload/platform/plugins/admin/skills/whats-new/SKILL.md +11 -0
  5. package/payload/platform/plugins/cloudflare/PLUGIN.md +2 -0
  6. package/payload/platform/plugins/docs/references/internals.md +5 -3
  7. package/payload/platform/plugins/docs/references/telegram-guide.md +5 -1
  8. package/payload/platform/plugins/scheduling/PLUGIN.md +1 -1
  9. package/payload/platform/plugins/scheduling/mcp/dist/scripts/__tests__/agent-turn-dispatch.test.js +15 -2
  10. package/payload/platform/plugins/scheduling/mcp/dist/scripts/__tests__/agent-turn-dispatch.test.js.map +1 -1
  11. package/payload/platform/plugins/scheduling/mcp/dist/scripts/agent-turn-dispatch.d.ts.map +1 -1
  12. package/payload/platform/plugins/scheduling/mcp/dist/scripts/agent-turn-dispatch.js +7 -2
  13. package/payload/platform/plugins/scheduling/mcp/dist/scripts/agent-turn-dispatch.js.map +1 -1
  14. package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/scheduling-gate.test.js +125 -1
  15. package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/scheduling-gate.test.js.map +1 -1
  16. package/payload/platform/plugins/scheduling/mcp/dist/tools/scheduling-gate.d.ts +28 -0
  17. package/payload/platform/plugins/scheduling/mcp/dist/tools/scheduling-gate.d.ts.map +1 -1
  18. package/payload/platform/plugins/scheduling/mcp/dist/tools/scheduling-gate.js +72 -12
  19. package/payload/platform/plugins/scheduling/mcp/dist/tools/scheduling-gate.js.map +1 -1
  20. package/payload/platform/scripts/__tests__/agent-identity-reconcile.test.sh +110 -0
  21. package/payload/platform/scripts/__tests__/check-orphan-dist.test.sh +87 -0
  22. package/payload/platform/scripts/check-orphan-dist.mjs +143 -0
  23. package/payload/platform/scripts/lib/agent-identity-reconcile.sh +122 -0
  24. package/payload/platform/scripts/lib/provision-account-dir.sh +8 -26
  25. package/payload/platform/scripts/setup-account.sh +15 -0
  26. package/payload/platform/services/claude-session-manager/dist/http-server.d.ts +37 -0
  27. package/payload/platform/services/claude-session-manager/dist/http-server.d.ts.map +1 -1
  28. package/payload/platform/services/claude-session-manager/dist/http-server.js +178 -13
  29. package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
  30. package/payload/platform/services/claude-session-manager/dist/index.js +5 -0
  31. package/payload/platform/services/claude-session-manager/dist/index.js.map +1 -1
  32. package/payload/platform/services/claude-session-manager/dist/public-agent-reachability.d.ts +5 -0
  33. package/payload/platform/services/claude-session-manager/dist/public-agent-reachability.d.ts.map +1 -1
  34. package/payload/platform/services/claude-session-manager/dist/public-agent-reachability.js +42 -1
  35. package/payload/platform/services/claude-session-manager/dist/public-agent-reachability.js.map +1 -1
  36. package/payload/platform/services/claude-session-manager/dist/rc-public-lockdown.d.ts +13 -5
  37. package/payload/platform/services/claude-session-manager/dist/rc-public-lockdown.d.ts.map +1 -1
  38. package/payload/platform/services/claude-session-manager/dist/rc-public-lockdown.js +23 -9
  39. package/payload/platform/services/claude-session-manager/dist/rc-public-lockdown.js.map +1 -1
  40. package/payload/platform/services/claude-session-manager/dist/telegram-channel-mcp.d.ts +7 -4
  41. package/payload/platform/services/claude-session-manager/dist/telegram-channel-mcp.d.ts.map +1 -1
  42. package/payload/platform/services/claude-session-manager/dist/telegram-channel-mcp.js +5 -3
  43. package/payload/platform/services/claude-session-manager/dist/telegram-channel-mcp.js.map +1 -1
  44. package/payload/platform/services/claude-session-manager/dist/telegram-channel-store.d.ts +15 -1
  45. package/payload/platform/services/claude-session-manager/dist/telegram-channel-store.d.ts.map +1 -1
  46. package/payload/platform/services/claude-session-manager/dist/telegram-channel-store.js +16 -7
  47. package/payload/platform/services/claude-session-manager/dist/telegram-channel-store.js.map +1 -1
  48. package/payload/platform/services/claude-session-manager/dist/telegram-plugin-mcp.d.ts +28 -0
  49. package/payload/platform/services/claude-session-manager/dist/telegram-plugin-mcp.d.ts.map +1 -0
  50. package/payload/platform/services/claude-session-manager/dist/telegram-plugin-mcp.js +53 -0
  51. package/payload/platform/services/claude-session-manager/dist/telegram-plugin-mcp.js.map +1 -0
  52. package/payload/platform/services/claude-session-manager/dist/wa-channel-mcp.d.ts +9 -5
  53. package/payload/platform/services/claude-session-manager/dist/wa-channel-mcp.d.ts.map +1 -1
  54. package/payload/platform/services/claude-session-manager/dist/wa-channel-mcp.js +12 -6
  55. package/payload/platform/services/claude-session-manager/dist/wa-channel-mcp.js.map +1 -1
  56. package/payload/platform/services/claude-session-manager/dist/webchat-channel-mcp.d.ts +7 -3
  57. package/payload/platform/services/claude-session-manager/dist/webchat-channel-mcp.d.ts.map +1 -1
  58. package/payload/platform/services/claude-session-manager/dist/webchat-channel-mcp.js +5 -1
  59. package/payload/platform/services/claude-session-manager/dist/webchat-channel-mcp.js.map +1 -1
  60. package/payload/platform/services/telegram-channel/dist/instructions.d.ts +14 -2
  61. package/payload/platform/services/telegram-channel/dist/instructions.d.ts.map +1 -1
  62. package/payload/platform/services/telegram-channel/dist/instructions.js +34 -3
  63. package/payload/platform/services/telegram-channel/dist/instructions.js.map +1 -1
  64. package/payload/platform/templates/agents/public/IDENTITY.md +3 -3
  65. package/payload/server/server.js +74 -9
  66. package/payload/platform/lib/anthropic-key/dist/index.d.ts +0 -22
  67. package/payload/platform/lib/anthropic-key/dist/index.d.ts.map +0 -1
  68. package/payload/platform/lib/anthropic-key/dist/index.js +0 -232
  69. package/payload/platform/lib/anthropic-key/dist/index.js.map +0 -1
  70. package/payload/platform/lib/graph-search/dist/query-expansion.d.ts +0 -37
  71. package/payload/platform/lib/graph-search/dist/query-expansion.d.ts.map +0 -1
  72. package/payload/platform/lib/graph-search/dist/query-expansion.js +0 -101
  73. package/payload/platform/lib/graph-search/dist/query-expansion.js.map +0 -1
  74. package/payload/platform/lib/oauth-llm/dist/index.d.ts +0 -116
  75. package/payload/platform/lib/oauth-llm/dist/index.d.ts.map +0 -1
  76. package/payload/platform/lib/oauth-llm/dist/index.js +0 -386
  77. package/payload/platform/lib/oauth-llm/dist/index.js.map +0 -1
  78. package/payload/platform/lib/screening-patterns/dist/index.d.ts +0 -29
  79. package/payload/platform/lib/screening-patterns/dist/index.d.ts.map +0 -1
  80. package/payload/platform/lib/screening-patterns/dist/index.js +0 -48
  81. package/payload/platform/lib/screening-patterns/dist/index.js.map +0 -1
  82. package/payload/platform/plugins/admin/mcp/dist/__tests__/admin-identity-authenticate.test.d.ts +0 -2
  83. package/payload/platform/plugins/admin/mcp/dist/__tests__/admin-identity-authenticate.test.d.ts.map +0 -1
  84. package/payload/platform/plugins/admin/mcp/dist/__tests__/admin-identity-authenticate.test.js +0 -34
  85. package/payload/platform/plugins/admin/mcp/dist/__tests__/admin-identity-authenticate.test.js.map +0 -1
  86. package/payload/platform/plugins/admin/mcp/dist/lib/onboarding.d.ts +0 -39
  87. package/payload/platform/plugins/admin/mcp/dist/lib/onboarding.d.ts.map +0 -1
  88. package/payload/platform/plugins/admin/mcp/dist/lib/onboarding.js +0 -249
  89. package/payload/platform/plugins/admin/mcp/dist/lib/onboarding.js.map +0 -1
  90. package/payload/platform/plugins/admin/mcp/dist/tools/admin-identity-authenticate.d.ts +0 -6
  91. package/payload/platform/plugins/admin/mcp/dist/tools/admin-identity-authenticate.d.ts.map +0 -1
  92. package/payload/platform/plugins/admin/mcp/dist/tools/admin-identity-authenticate.js +0 -32
  93. package/payload/platform/plugins/admin/mcp/dist/tools/admin-identity-authenticate.js.map +0 -1
  94. package/payload/platform/plugins/cloudflare/mcp/dist/lib/cloudflared.d.ts +0 -283
  95. package/payload/platform/plugins/cloudflare/mcp/dist/lib/cloudflared.d.ts.map +0 -1
  96. package/payload/platform/plugins/cloudflare/mcp/dist/lib/cloudflared.js +0 -1155
  97. package/payload/platform/plugins/cloudflare/mcp/dist/lib/cloudflared.js.map +0 -1
  98. package/payload/platform/plugins/cloudflare/mcp/dist/lib/setup-orchestrator.d.ts +0 -90
  99. package/payload/platform/plugins/cloudflare/mcp/dist/lib/setup-orchestrator.d.ts.map +0 -1
  100. package/payload/platform/plugins/cloudflare/mcp/dist/lib/setup-orchestrator.js +0 -551
  101. package/payload/platform/plugins/cloudflare/mcp/dist/lib/setup-orchestrator.js.map +0 -1
  102. package/payload/platform/plugins/email/mcp/dist/lib/claude-bridge.d.ts +0 -17
  103. package/payload/platform/plugins/email/mcp/dist/lib/claude-bridge.d.ts.map +0 -1
  104. package/payload/platform/plugins/email/mcp/dist/lib/claude-bridge.js +0 -186
  105. package/payload/platform/plugins/email/mcp/dist/lib/claude-bridge.js.map +0 -1
  106. package/payload/platform/plugins/email/mcp/dist/lib/screening.d.ts +0 -29
  107. package/payload/platform/plugins/email/mcp/dist/lib/screening.d.ts.map +0 -1
  108. package/payload/platform/plugins/email/mcp/dist/lib/screening.js +0 -105
  109. package/payload/platform/plugins/email/mcp/dist/lib/screening.js.map +0 -1
  110. package/payload/platform/plugins/email/mcp/dist/scripts/email-auto-respond.d.ts +0 -38
  111. package/payload/platform/plugins/email/mcp/dist/scripts/email-auto-respond.d.ts.map +0 -1
  112. package/payload/platform/plugins/email/mcp/dist/scripts/email-auto-respond.js +0 -817
  113. package/payload/platform/plugins/email/mcp/dist/scripts/email-auto-respond.js.map +0 -1
  114. package/payload/platform/plugins/email/mcp/dist/scripts/email-fetch.d.ts +0 -30
  115. package/payload/platform/plugins/email/mcp/dist/scripts/email-fetch.d.ts.map +0 -1
  116. package/payload/platform/plugins/email/mcp/dist/scripts/email-fetch.js +0 -215
  117. package/payload/platform/plugins/email/mcp/dist/scripts/email-fetch.js.map +0 -1
  118. package/payload/platform/plugins/email/mcp/dist/tools/email-auto-respond-config.d.ts +0 -19
  119. package/payload/platform/plugins/email/mcp/dist/tools/email-auto-respond-config.d.ts.map +0 -1
  120. package/payload/platform/plugins/email/mcp/dist/tools/email-auto-respond-config.js +0 -151
  121. package/payload/platform/plugins/email/mcp/dist/tools/email-auto-respond-config.js.map +0 -1
  122. package/payload/platform/plugins/email/mcp/dist/tools/email-classify.d.ts +0 -6
  123. package/payload/platform/plugins/email/mcp/dist/tools/email-classify.d.ts.map +0 -1
  124. package/payload/platform/plugins/email/mcp/dist/tools/email-classify.js +0 -89
  125. package/payload/platform/plugins/email/mcp/dist/tools/email-classify.js.map +0 -1
  126. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/compiled-truth-rewriter-operator-hint.test.d.ts +0 -2
  127. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/compiled-truth-rewriter-operator-hint.test.d.ts.map +0 -1
  128. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/compiled-truth-rewriter-operator-hint.test.js +0 -90
  129. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/compiled-truth-rewriter-operator-hint.test.js.map +0 -1
  130. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/llm-classifier.test.d.ts +0 -2
  131. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/llm-classifier.test.d.ts.map +0 -1
  132. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/llm-classifier.test.js +0 -226
  133. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/llm-classifier.test.js.map +0 -1
  134. package/payload/platform/plugins/memory/mcp/dist/lib/compiled-truth-rewriter.d.ts +0 -60
  135. package/payload/platform/plugins/memory/mcp/dist/lib/compiled-truth-rewriter.d.ts.map +0 -1
  136. package/payload/platform/plugins/memory/mcp/dist/lib/compiled-truth-rewriter.js +0 -169
  137. package/payload/platform/plugins/memory/mcp/dist/lib/compiled-truth-rewriter.js.map +0 -1
  138. package/payload/platform/plugins/memory/mcp/dist/lib/llm-classifier.d.ts +0 -248
  139. package/payload/platform/plugins/memory/mcp/dist/lib/llm-classifier.d.ts.map +0 -1
  140. package/payload/platform/plugins/memory/mcp/dist/lib/llm-classifier.js +0 -824
  141. package/payload/platform/plugins/memory/mcp/dist/lib/llm-classifier.js.map +0 -1
  142. package/payload/platform/plugins/memory/mcp/dist/lib/llm-ranker.d.ts +0 -63
  143. package/payload/platform/plugins/memory/mcp/dist/lib/llm-ranker.d.ts.map +0 -1
  144. package/payload/platform/plugins/memory/mcp/dist/lib/llm-ranker.js +0 -210
  145. package/payload/platform/plugins/memory/mcp/dist/lib/llm-ranker.js.map +0 -1
  146. package/payload/platform/plugins/memory/mcp/dist/lib/typed-edge-pass.d.ts +0 -35
  147. package/payload/platform/plugins/memory/mcp/dist/lib/typed-edge-pass.d.ts.map +0 -1
  148. package/payload/platform/plugins/memory/mcp/dist/lib/typed-edge-pass.js +0 -28
  149. package/payload/platform/plugins/memory/mcp/dist/lib/typed-edge-pass.js.map +0 -1
  150. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-archive-derive-insights-emit.test.d.ts +0 -2
  151. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-archive-derive-insights-emit.test.d.ts.map +0 -1
  152. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-archive-derive-insights-emit.test.js +0 -68
  153. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-archive-derive-insights-emit.test.js.map +0 -1
  154. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-archive-write-emit.test.d.ts +0 -2
  155. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-archive-write-emit.test.d.ts.map +0 -1
  156. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-archive-write-emit.test.js +0 -88
  157. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-archive-write-emit.test.js.map +0 -1
  158. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-classify-emit.test.d.ts +0 -2
  159. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-classify-emit.test.d.ts.map +0 -1
  160. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-classify-emit.test.js +0 -58
  161. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-classify-emit.test.js.map +0 -1
  162. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-delete-emit.test.d.ts +0 -2
  163. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-delete-emit.test.d.ts.map +0 -1
  164. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-delete-emit.test.js +0 -64
  165. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-delete-emit.test.js.map +0 -1
  166. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-edit-attachment-emit.test.d.ts +0 -2
  167. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-edit-attachment-emit.test.d.ts.map +0 -1
  168. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-edit-attachment-emit.test.js +0 -70
  169. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-edit-attachment-emit.test.js.map +0 -1
  170. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-empty-trash-emit.test.d.ts +0 -2
  171. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-empty-trash-emit.test.d.ts.map +0 -1
  172. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-empty-trash-emit.test.js +0 -48
  173. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-empty-trash-emit.test.js.map +0 -1
  174. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-emit.test.d.ts +0 -2
  175. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-emit.test.d.ts.map +0 -1
  176. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-emit.test.js +0 -74
  177. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-emit.test.js.map +0 -1
  178. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-extract-emit.test.d.ts +0 -2
  179. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-extract-emit.test.d.ts.map +0 -1
  180. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-extract-emit.test.js +0 -47
  181. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-extract-emit.test.js.map +0 -1
  182. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-web-emit.test.d.ts +0 -2
  183. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-web-emit.test.d.ts.map +0 -1
  184. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-web-emit.test.js +0 -65
  185. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-web-emit.test.js.map +0 -1
  186. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-reindex-emit.test.d.ts +0 -2
  187. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-reindex-emit.test.d.ts.map +0 -1
  188. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-reindex-emit.test.js +0 -43
  189. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-reindex-emit.test.js.map +0 -1
  190. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-rename-attachment-emit.test.d.ts +0 -2
  191. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-rename-attachment-emit.test.d.ts.map +0 -1
  192. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-rename-attachment-emit.test.js +0 -65
  193. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-rename-attachment-emit.test.js.map +0 -1
  194. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-restore-emit.test.d.ts +0 -2
  195. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-restore-emit.test.d.ts.map +0 -1
  196. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-restore-emit.test.js +0 -49
  197. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-restore-emit.test.js.map +0 -1
  198. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-emit.test.d.ts +0 -2
  199. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-emit.test.d.ts.map +0 -1
  200. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-emit.test.js +0 -79
  201. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-emit.test.js.map +0 -1
  202. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-operator-hint.test.d.ts +0 -2
  203. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-operator-hint.test.d.ts.map +0 -1
  204. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-operator-hint.test.js +0 -329
  205. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-operator-hint.test.js.map +0 -1
  206. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-write-emit.test.d.ts +0 -2
  207. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-write-emit.test.d.ts.map +0 -1
  208. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-write-emit.test.js +0 -81
  209. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-write-emit.test.js.map +0 -1
  210. package/payload/platform/plugins/memory/mcp/dist/tools/memory-classify.d.ts +0 -34
  211. package/payload/platform/plugins/memory/mcp/dist/tools/memory-classify.d.ts.map +0 -1
  212. package/payload/platform/plugins/memory/mcp/dist/tools/memory-classify.js +0 -62
  213. package/payload/platform/plugins/memory/mcp/dist/tools/memory-classify.js.map +0 -1
  214. package/payload/platform/plugins/memory/mcp/dist/tools/memory-rank.d.ts +0 -61
  215. package/payload/platform/plugins/memory/mcp/dist/tools/memory-rank.d.ts.map +0 -1
  216. package/payload/platform/plugins/memory/mcp/dist/tools/memory-rank.js +0 -102
  217. package/payload/platform/plugins/memory/mcp/dist/tools/memory-rank.js.map +0 -1
  218. package/payload/platform/plugins/memory/mcp/dist/tools/memory-signals-recent.d.ts +0 -35
  219. package/payload/platform/plugins/memory/mcp/dist/tools/memory-signals-recent.d.ts.map +0 -1
  220. package/payload/platform/plugins/memory/mcp/dist/tools/memory-signals-recent.js +0 -73
  221. package/payload/platform/plugins/memory/mcp/dist/tools/memory-signals-recent.js.map +0 -1
  222. package/payload/platform/plugins/memory/mcp/dist/tools/memory-typed-edge-pass.d.ts +0 -29
  223. package/payload/platform/plugins/memory/mcp/dist/tools/memory-typed-edge-pass.d.ts.map +0 -1
  224. package/payload/platform/plugins/memory/mcp/dist/tools/memory-typed-edge-pass.js +0 -22
  225. package/payload/platform/plugins/memory/mcp/dist/tools/memory-typed-edge-pass.js.map +0 -1
  226. package/payload/platform/plugins/memory/mcp/dist/tools/session-retrospective-skip-rate.d.ts +0 -30
  227. package/payload/platform/plugins/memory/mcp/dist/tools/session-retrospective-skip-rate.d.ts.map +0 -1
  228. package/payload/platform/plugins/memory/mcp/dist/tools/session-retrospective-skip-rate.js +0 -130
  229. package/payload/platform/plugins/memory/mcp/dist/tools/session-retrospective-skip-rate.js.map +0 -1
  230. package/payload/platform/plugins/outlook/mcp/dist/auth/pkce-flow.d.ts +0 -65
  231. package/payload/platform/plugins/outlook/mcp/dist/auth/pkce-flow.d.ts.map +0 -1
  232. package/payload/platform/plugins/outlook/mcp/dist/auth/pkce-flow.js +0 -262
  233. package/payload/platform/plugins/outlook/mcp/dist/auth/pkce-flow.js.map +0 -1
  234. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/normalise-start-date.test.d.ts +0 -2
  235. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/normalise-start-date.test.d.ts.map +0 -1
  236. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/normalise-start-date.test.js +0 -100
  237. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/normalise-start-date.test.js.map +0 -1
  238. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/scheduled-seat-id.test.d.ts +0 -2
  239. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/scheduled-seat-id.test.d.ts.map +0 -1
  240. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/scheduled-seat-id.test.js +0 -22
  241. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/scheduled-seat-id.test.js.map +0 -1
  242. package/payload/platform/plugins/scheduling/mcp/dist/lib/scheduled-seat-id.d.ts +0 -11
  243. package/payload/platform/plugins/scheduling/mcp/dist/lib/scheduled-seat-id.d.ts.map +0 -1
  244. package/payload/platform/plugins/scheduling/mcp/dist/lib/scheduled-seat-id.js +0 -19
  245. package/payload/platform/plugins/scheduling/mcp/dist/lib/scheduled-seat-id.js.map +0 -1
  246. package/payload/platform/plugins/url-get/mcp/dist/lib/summarise.d.ts +0 -8
  247. package/payload/platform/plugins/url-get/mcp/dist/lib/summarise.d.ts.map +0 -1
  248. package/payload/platform/plugins/url-get/mcp/dist/lib/summarise.js +0 -83
  249. package/payload/platform/plugins/url-get/mcp/dist/lib/summarise.js.map +0 -1
  250. package/payload/platform/plugins/workflows/mcp/dist/lib/llm-call.d.ts +0 -151
  251. package/payload/platform/plugins/workflows/mcp/dist/lib/llm-call.d.ts.map +0 -1
  252. package/payload/platform/plugins/workflows/mcp/dist/lib/llm-call.js +0 -299
  253. package/payload/platform/plugins/workflows/mcp/dist/lib/llm-call.js.map +0 -1
  254. package/payload/platform/services/claude-session-manager/dist/account-admin-census.d.ts +0 -39
  255. package/payload/platform/services/claude-session-manager/dist/account-admin-census.d.ts.map +0 -1
  256. package/payload/platform/services/claude-session-manager/dist/account-admin-census.js +0 -122
  257. package/payload/platform/services/claude-session-manager/dist/account-admin-census.js.map +0 -1
  258. package/payload/platform/services/claude-session-manager/dist/admin-identity-audit.d.ts +0 -39
  259. package/payload/platform/services/claude-session-manager/dist/admin-identity-audit.d.ts.map +0 -1
  260. package/payload/platform/services/claude-session-manager/dist/admin-identity-audit.js +0 -133
  261. package/payload/platform/services/claude-session-manager/dist/admin-identity-audit.js.map +0 -1
  262. package/payload/platform/services/claude-session-manager/dist/input-postcondition.d.ts +0 -22
  263. package/payload/platform/services/claude-session-manager/dist/input-postcondition.d.ts.map +0 -1
  264. package/payload/platform/services/claude-session-manager/dist/input-postcondition.js +0 -50
  265. package/payload/platform/services/claude-session-manager/dist/input-postcondition.js.map +0 -1
  266. package/payload/platform/services/claude-session-manager/dist/jsonl-observer.d.ts +0 -30
  267. package/payload/platform/services/claude-session-manager/dist/jsonl-observer.d.ts.map +0 -1
  268. package/payload/platform/services/claude-session-manager/dist/jsonl-observer.js +0 -204
  269. package/payload/platform/services/claude-session-manager/dist/jsonl-observer.js.map +0 -1
  270. package/payload/platform/services/claude-session-manager/dist/rc-script-spawn.d.ts +0 -80
  271. package/payload/platform/services/claude-session-manager/dist/rc-script-spawn.d.ts.map +0 -1
  272. package/payload/platform/services/claude-session-manager/dist/rc-script-spawn.js +0 -306
  273. package/payload/platform/services/claude-session-manager/dist/rc-script-spawn.js.map +0 -1
  274. package/payload/platform/services/claude-session-manager/dist/session-store.d.ts +0 -49
  275. package/payload/platform/services/claude-session-manager/dist/session-store.d.ts.map +0 -1
  276. package/payload/platform/services/claude-session-manager/dist/session-store.js +0 -52
  277. package/payload/platform/services/claude-session-manager/dist/session-store.js.map +0 -1
  278. package/payload/platform/services/claude-session-manager/dist/systemd-spawn.d.ts +0 -83
  279. package/payload/platform/services/claude-session-manager/dist/systemd-spawn.d.ts.map +0 -1
  280. package/payload/platform/services/claude-session-manager/dist/systemd-spawn.js +0 -345
  281. package/payload/platform/services/claude-session-manager/dist/systemd-spawn.js.map +0 -1
  282. package/payload/platform/services/telegram-channel/dist/turn-follow.d.ts +0 -104
  283. package/payload/platform/services/telegram-channel/dist/turn-follow.d.ts.map +0 -1
  284. package/payload/platform/services/telegram-channel/dist/turn-follow.js +0 -408
  285. package/payload/platform/services/telegram-channel/dist/turn-follow.js.map +0 -1
  286. package/payload/platform/services/whatsapp-channel/dist/turn-follow.d.ts +0 -104
  287. package/payload/platform/services/whatsapp-channel/dist/turn-follow.d.ts.map +0 -1
  288. package/payload/platform/services/whatsapp-channel/dist/turn-follow.js +0 -393
  289. package/payload/platform/services/whatsapp-channel/dist/turn-follow.js.map +0 -1
@@ -1,90 +0,0 @@
1
- // Task 413 / Task 420 — operator-hint folding in the compiled-truth rewriter.
2
- //
3
- // Validates: hint appears verbatim in the user message in both admin and
4
- // public modes; empty/oversize hints throw; the no-events refusal yields
5
- // when a hint is supplied (operator correction is sufficient justification).
6
- import { describe, it, expect, vi, beforeEach } from "vitest";
7
- const callOauthLlmMock = vi.fn();
8
- vi.mock("../../../../../../lib/oauth-llm/dist/index.js", () => ({
9
- callOauthLlm: (...args) => callOauthLlmMock(...args),
10
- }));
11
- import { rewriteCompiledTruth, OPERATOR_HINT_MAX_CHARS } from "../compiled-truth-rewriter.js";
12
- describe("compiled-truth-rewriter — operator hint (Task 413)", () => {
13
- beforeEach(() => {
14
- callOauthLlmMock.mockReset();
15
- callOauthLlmMock.mockResolvedValue({ kind: "ok", text: "Rewritten summary." });
16
- });
17
- it("folds the operator hint into the user message with precedence wording", async () => {
18
- await rewriteCompiledTruth({
19
- subjectLabel: "Person",
20
- subjectName: "Adam Langley",
21
- currentTruth: "Adam used to work at Acme.",
22
- events: [
23
- { occurredAt: "2026-05-01T00:00:00Z", kind: "mentioned", summary: "Mentioned in chat" },
24
- ],
25
- operatorHint: "Adam now works at Anthropic, not Acme.",
26
- });
27
- const call = callOauthLlmMock.mock.calls[0][0];
28
- expect(call.userMessage).toContain("Operator correction");
29
- expect(call.userMessage).toContain("Adam now works at Anthropic, not Acme.");
30
- expect(call.system).toContain("Operator correction is supplied and contradicts the timeline");
31
- });
32
- it("folds the operator hint into public-mode user message and uses the public-voice system prompt", async () => {
33
- await rewriteCompiledTruth({
34
- mode: "public",
35
- subjectLabel: "Organization",
36
- subjectName: "Acme",
37
- currentTruth: "",
38
- events: [
39
- { occurredAt: "2026-05-01T00:00:00Z", kind: "mentioned", summary: "ev" },
40
- ],
41
- operatorHint: "Acme acquired BetaCo in 2026.",
42
- });
43
- const call = callOauthLlmMock.mock.calls[0][0];
44
- expect(call.userMessage).toContain("Operator correction");
45
- expect(call.userMessage).toContain("Acme acquired BetaCo in 2026.");
46
- // Public-voice rules carry through — operator-voice phrasings remain banned.
47
- expect(call.system).toContain("public-facing");
48
- expect(call.system).toContain("No operator-voice constructions");
49
- expect(call.system).toContain("Operator correction is supplied");
50
- });
51
- it("rejects empty operatorHint", async () => {
52
- await expect(rewriteCompiledTruth({
53
- subjectLabel: "Person",
54
- subjectName: "Adam",
55
- currentTruth: "",
56
- events: [],
57
- operatorHint: " ",
58
- })).rejects.toThrow(/non-empty/);
59
- });
60
- it("rejects operatorHint over the cap", async () => {
61
- await expect(rewriteCompiledTruth({
62
- subjectLabel: "Person",
63
- subjectName: "Adam",
64
- currentTruth: "",
65
- events: [],
66
- operatorHint: "x".repeat(OPERATOR_HINT_MAX_CHARS + 1),
67
- })).rejects.toThrow(/exceeds cap/);
68
- });
69
- it("no-events refusal yields when an operator hint is supplied", async () => {
70
- // Without a hint, an empty timeline refuses.
71
- const refused = await rewriteCompiledTruth({
72
- subjectLabel: "Person",
73
- subjectName: "Adam",
74
- currentTruth: "",
75
- events: [],
76
- });
77
- expect(refused).toEqual({ kind: "refused", reason: "no-events" });
78
- // With a hint, the rewriter proceeds even with an empty timeline —
79
- // the operator correction is sufficient new material.
80
- const result = await rewriteCompiledTruth({
81
- subjectLabel: "Person",
82
- subjectName: "Adam",
83
- currentTruth: "",
84
- events: [],
85
- operatorHint: "Adam joined Anthropic in 2025.",
86
- });
87
- expect(result.kind).toBe("ok");
88
- });
89
- });
90
- //# sourceMappingURL=compiled-truth-rewriter-operator-hint.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compiled-truth-rewriter-operator-hint.test.js","sourceRoot":"","sources":["../../../src/lib/__tests__/compiled-truth-rewriter-operator-hint.test.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9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oot":"","sources":["../../../src/lib/__tests__/llm-classifier.test.ts"],"names":[],"mappings":""}
@@ -1,226 +0,0 @@
1
- import test from "node:test";
2
- import assert from "node:assert/strict";
3
- import { readFileSync, statSync } from "node:fs";
4
- import { dirname, resolve } from "node:path";
5
- import { fileURLToPath } from "node:url";
6
- // ESM equivalents of CommonJS __filename / __dirname — package.json carries
7
- // "type": "module" so .js files compile to ESM and the CommonJS globals are
8
- // not defined at runtime.
9
- const __filename = fileURLToPath(import.meta.url);
10
- const __dirname = dirname(__filename);
11
- // Regression coverage — memory-classify Haiku timeout cliff.
12
- //
13
- // The 60_000 ms default in `oauth-llm` fits short admin classifiers
14
- // (commitment, query — <2K input, <500 output) but is hostile
15
- // to document classification: a 15K-char input at 8K maxTokens has been
16
- // observed at 56s p99 on Haiku 4.5, which is on the cliff and tipped over
17
- // to a fallback timeout in a real ingest. The fix is a per-call override
18
- // at the long-output caller, NOT a wrapper-default change — short
19
- // classifiers must keep 60s.
20
- //
21
- // These tests assert the contract by reading source. The brief's first
22
- // verification step is literally `grep -n "timeoutMs" llm-classifier.ts
23
- // returns 180_000`; this file formalises that grep so a future refactor
24
- // that drops the override re-fails the test on `main` pre-fix.
25
- // Tests read source files via grep, so paths must resolve to source whether
26
- // the test runs from `src/lib/__tests__/` (tsx) or `dist/lib/__tests__/`
27
- // (compiled). `__dirname` points to one or the other; walking up three levels
28
- // reaches the memory MCP package root in either case.
29
- const PACKAGE_ROOT = resolve(__dirname, "..", "..", "..");
30
- const CLASSIFIER_PATH = resolve(PACKAGE_ROOT, "src/lib/llm-classifier.ts");
31
- const OAUTH_LLM_PATH = resolve(PACKAGE_ROOT, "../../../lib/oauth-llm/src/index.ts");
32
- const SKILL_MD_PATH = resolve(PACKAGE_ROOT, "../skills/document-ingest/SKILL.md");
33
- const FIXTURE_PATH = resolve(PACKAGE_ROOT, "../../../../.docs/maxy_investor_thesis.md");
34
- function readClassifier() {
35
- return readFileSync(CLASSIFIER_PATH, "utf-8");
36
- }
37
- test("memory-classify passes timeoutMs: 180_000 to callOauthLlm", () => {
38
- const source = readClassifier();
39
- const callMatch = source.match(/callOauthLlm\(\{[\s\S]*?\}\)/);
40
- assert.ok(callMatch, "expected to find callOauthLlm({...}) call site");
41
- assert.match(callMatch[0], /timeoutMs:\s*180_000/, "classifier MUST pass timeoutMs: 180_000 explicitly — the wrapper's 60s default is too tight for 8K-maxToken Haiku calls on >=10K-char inputs");
42
- });
43
- test("oauth-llm wrapper default stays 60_000 — short classifiers keep the safety net", () => {
44
- const source = readFileSync(OAUTH_LLM_PATH, "utf-8");
45
- assert.match(source, /timeoutMs\s*=\s*60_000/, "wrapper default must remain 60_000; long-output callers override per-call (doctrine)");
46
- });
47
- test("[memory-classify] calling haiku log includes timeoutMs", () => {
48
- const source = readClassifier();
49
- assert.match(source, /\[memory-classify\][^\n]*calling haiku[^\n]*timeoutMs=/, "calling-haiku log line must surface the timeout budget so size→latency is grep-able from server.log");
50
- });
51
- test("[memory-classify] haiku ok log includes elapsedMs", () => {
52
- const source = readClassifier();
53
- assert.match(source, /\[memory-classify\][^\n]*haiku ok[^\n]*elapsedMs=/, "haiku-ok log line must surface elapsed wall-clock ms so size→latency curve is grep-able");
54
- });
55
- test("document-ingest SKILL.md Step 1 carries the chars→latency estimate", () => {
56
- const source = readFileSync(SKILL_MD_PATH, "utf-8");
57
- // The estimate is a chars→seconds table the agent reads and emits to chat
58
- // after extract returns. The >525K chunked-path band sits on top of
59
- // the original four; the test now asserts the full ladder up through
60
- // chunked.
61
- assert.match(source, /<5K[\s\S]*?5K.{0,10}10K[\s\S]*?10K.{0,10}20K[\s\S]*?20K.{0,10}525K[\s\S]*?>525K/, "SKILL.md Step 1 must declare the chars→latency estimate including the chunked-path band so the operator narrative names the expected wait window");
62
- });
63
- // ---------------------------------------------------------------------------
64
- // classifier prompt must broaden documentEdges beyond contracts.
65
- //
66
- // earlier, the prompt at line ~254 said: "Currently used for contracts:
67
- // when a Parties section is detected, emit one or more { type: 'PARTY', … }
68
- // entries." That gating made every multi-party document (meetings, calls,
69
- // emails, voice-notes) ingest as an island anchored to one node, with no
70
- // KD-level edge to the Persons/Organizations involved. The fix expands the
71
- // prompt to a per-document-shape table naming all five edge types the writer
72
- // now accepts (PARTY/PARTICIPANT/FROM/TO/CC/SPEAKER) so the classifier emits
73
- // them on the right shape of document.
74
- // ---------------------------------------------------------------------------
75
- test("classifier prompt no longer says 'Currently used for contracts'", () => {
76
- const source = readClassifier();
77
- assert.doesNotMatch(source, /Currently used for contracts/, "documentEdges instruction must not gate to contracts only — meetings/calls/emails/voice-notes need KD-level edges too");
78
- });
79
- test("classifier prompt names every supported KD-level edge type", () => {
80
- const source = readClassifier();
81
- for (const edgeType of ["PARTY", "PARTICIPANT", "FROM", "TO", "CC", "SPEAKER"]) {
82
- assert.match(source, new RegExp(`'${edgeType}'`), `documentEdges instruction must name '${edgeType}' so the classifier emits it on the matching document shape`);
83
- }
84
- });
85
- test("classifier prompt names every supported document shape", () => {
86
- const source = readClassifier();
87
- for (const shape of ["contract", "meeting", "email", "voice-note"]) {
88
- assert.match(source, new RegExp(shape, "i"), `documentEdges instruction must name '${shape}' so the classifier picks the right edge type per shape`);
89
- }
90
- });
91
- // ---------------------------------------------------------------------------
92
- // chat-mode classifier (mode: 'chat').
93
- //
94
- // Adds `Conversation` to the section-kind enumeration and routes to a
95
- // dedicated chat-mode system prompt that restricts output to a single kind,
96
- // drops anchor/related/documentEdges/orphan logic, and instructs Haiku to
97
- // preserve `[ts] Sender:` prefixes in chunk bodies for downstream provenance
98
- // recovery. These tests assert the contract by reading source — same pattern
99
- // as the grep-the-prompt tests above.
100
- // ---------------------------------------------------------------------------
101
- test("classifier exports a `Conversation` section kind", () => {
102
- const source = readClassifier();
103
- // Asserted via the STRUCTURAL_SECTION_KINDS array — Conversation joins the
104
- // closed enumeration so the validator accepts it.
105
- assert.match(source, /STRUCTURAL_SECTION_KINDS[\s\S]{0,400}["']Conversation["']/, "Conversation must be a member of STRUCTURAL_SECTION_KINDS so the validator accepts it");
106
- });
107
- test("ClassifyParams accepts an optional `mode: 'document' | 'chat'`", () => {
108
- const source = readClassifier();
109
- assert.match(source, /mode\??:\s*["']document["']\s*\|\s*["']chat["']/, "ClassifyParams must declare `mode?: 'document' | 'chat'` so callers can opt into chat-mode chunking");
110
- });
111
- test("chat-mode prompt restricts output to the `Conversation` kind", () => {
112
- const source = readClassifier();
113
- const chatPromptMatch = source.match(/CHAT_SYSTEM_PROMPT[\s\S]*?\.join\("\\n"\);/);
114
- assert.ok(chatPromptMatch, "expected to find a CHAT_SYSTEM_PROMPT array literal");
115
- assert.match(chatPromptMatch[0], /['"]Conversation['"]/, "chat-mode prompt must restrict output to `kind: 'Conversation'`");
116
- });
117
- test("chat-mode prompt instructs Haiku to preserve [ts] Sender: prefixes verbatim in chunk bodies", () => {
118
- const source = readClassifier();
119
- const chatPromptMatch = source.match(/CHAT_SYSTEM_PROMPT[\s\S]*?\.join\("\\n"\);/);
120
- assert.ok(chatPromptMatch);
121
- assert.match(chatPromptMatch[0], /verbatim/i, "chat-mode prompt must use the word 'verbatim' so Haiku preserves the prefixes — downstream provenance recovery depends on byte equality");
122
- assert.match(chatPromptMatch[0], /prefix/i, "chat-mode prompt must explicitly name the `[ts] Sender:` prefix preservation rule");
123
- });
124
- test("chat-mode prompt forbids anchorEdge / related / documentEdges proposals", () => {
125
- const source = readClassifier();
126
- const chatPromptMatch = source.match(/CHAT_SYSTEM_PROMPT[\s\S]*?\.join\("\\n"\);/);
127
- assert.ok(chatPromptMatch);
128
- assert.match(chatPromptMatch[0], /anchorEdge[\s\S]*?(?:MUST be null|null)/, "chat-mode prompt must require anchorEdge: null on every chunk");
129
- });
130
- test("chat-mode requires firstMessageAt + lastMessageAt + participantNames + messageCount on each chunk", () => {
131
- const source = readClassifier();
132
- const chatPromptMatch = source.match(/CHAT_SYSTEM_PROMPT[\s\S]*?\.join\("\\n"\);/);
133
- assert.ok(chatPromptMatch);
134
- for (const prop of ["firstMessageAt", "lastMessageAt", "participantNames", "messageCount", "summary", "keywords"]) {
135
- assert.match(chatPromptMatch[0], new RegExp(prop), `chat-mode prompt must instruct Haiku to emit the '${prop}' chunk property`);
136
- }
137
- });
138
- test("classifyDocument logs `mode=` for grep parity", () => {
139
- const source = readClassifier();
140
- assert.match(source, /\[memory-classify\][^\n]*calling haiku[^\n]*mode=/, "calling-haiku log line must include `mode=<document|chat>` for grep parity");
141
- });
142
- // ---------------------------------------------------------------------------
143
- // classifier + ranker structured tool-use migration.
144
- //
145
- // The classifier and ranker now force Haiku to emit `tool_use.input` matching
146
- // a typed `input_schema`. The migration deletes `extractJson` (used to strip
147
- // markdown fences from a free-form text response) and the malformed-JSON
148
- // fallback path entirely — Anthropic enforces the schema at the API boundary,
149
- // so structural failures (missing fields, wrong types, truncation mid-tool-input)
150
- // surface as fallback responses or as the existing missing-offsets loud-fail.
151
- //
152
- // These tests grep source so a future refactor that reverts to free-form text
153
- // re-fails the test suite on `main` pre-fix.
154
- // ---------------------------------------------------------------------------
155
- const RANKER_PATH = resolve(PACKAGE_ROOT, "src/lib/llm-ranker.ts");
156
- function readRanker() {
157
- return readFileSync(RANKER_PATH, "utf-8");
158
- }
159
- test("classifier defines a ClassifierOutputTool with input_schema", () => {
160
- const source = readClassifier();
161
- assert.match(source, /ClassifierOutputTool[\s\S]{0,200}name:\s*["']emit_classifier_output["']/, "classifier must export a ClassifierOutputTool whose name is 'emit_classifier_output'");
162
- assert.match(source, /ClassifierOutputTool[\s\S]*?input_schema/, "ClassifierOutputTool must declare an input_schema");
163
- });
164
- test("classifier call site forces tool selection", () => {
165
- const source = readClassifier();
166
- const callMatch = source.match(/callOauthLlm\(\{[\s\S]*?\}\)/);
167
- assert.ok(callMatch, "expected to find callOauthLlm({...}) call site");
168
- assert.match(callMatch[0], /tools:\s*\[ClassifierOutputTool\]/, "classifier MUST pass `tools: [ClassifierOutputTool]` so Haiku emits structured output");
169
- assert.match(callMatch[0], /toolChoiceName:\s*ClassifierOutputTool\.name/, "classifier MUST force the tool by name — Anthropic only validates the schema when forced");
170
- });
171
- test("classifier `kind` schema is enforced as an enum (closed enumeration)", () => {
172
- const source = readClassifier();
173
- // The schema must declare `kind` with an `enum` whose membership is sourced
174
- // from ALL_SECTION_KINDS. We check the structural shape rather than the
175
- // exact list — the list is exported and tested elsewhere.
176
- assert.match(source, /kind:\s*\{\s*type:\s*["']string["'],\s*enum:\s*ALL_SECTION_KINDS_LIST/, "ClassifierOutputTool.input_schema must enforce `kind` as an enum sourced from ALL_SECTION_KINDS — schema-level enforcement is what makes hallucinated kinds impossible");
177
- });
178
- test("classifier no longer references extractJson (dead code removed)", () => {
179
- const source = readClassifier();
180
- assert.doesNotMatch(source, /extractJson/, "extractJson is unreachable on the structured-output path and was deleted; reintroducing it is the regression");
181
- });
182
- test("classifier no longer collapses unknown kinds to Other (unreachable on structured path)", () => {
183
- const source = readClassifier();
184
- // `isKnownKind ? rawKind : SECTION_KIND_OTHER` is the fingerprint of an
185
- // unknown-kind collapse. With a strict schema enum on `kind`, the
186
- // collapse is unreachable; reintroducing the branch weakens the
187
- // schema-as-enforcement contract.
188
- assert.doesNotMatch(source, /isKnownKind/, "the `isKnownKind` collapse is dead code on the structured path; reintroducing it weakens the schema-as-enforcement contract");
189
- });
190
- test("classifier emits `structured-output ok` log line per call", () => {
191
- const source = readClassifier();
192
- assert.match(source, /\[memory-classify\][^\n]*structured-output ok[^\n]*stop-reason=/, "classifier must log `structured-output ok stop-reason=...` per call so observability names the structured path");
193
- });
194
- test("ranker defines a RankerOutputTool with input_schema", () => {
195
- const source = readRanker();
196
- assert.match(source, /RankerOutputTool[\s\S]{0,200}name:\s*["']emit_ranker_output["']/, "ranker must export a RankerOutputTool whose name is 'emit_ranker_output'");
197
- assert.match(source, /RankerOutputTool[\s\S]*?input_schema/, "RankerOutputTool must declare an input_schema");
198
- });
199
- test("ranker call site forces tool selection", () => {
200
- const source = readRanker();
201
- const callMatch = source.match(/callOauthLlm\(\{[\s\S]*?\}\)/);
202
- assert.ok(callMatch, "expected to find callOauthLlm({...}) call site");
203
- assert.match(callMatch[0], /tools:\s*\[RankerOutputTool\]/, "ranker MUST pass `tools: [RankerOutputTool]`");
204
- assert.match(callMatch[0], /toolChoiceName:\s*RankerOutputTool\.name/, "ranker MUST force the tool by name");
205
- });
206
- test("ranker no longer references extractJson", () => {
207
- const source = readRanker();
208
- assert.doesNotMatch(source, /extractJson/, "extractJson is unreachable on the structured-output path and was deleted");
209
- });
210
- test("ranker no longer parses JSON.parse on response text", () => {
211
- const source = readRanker();
212
- assert.doesNotMatch(source, /JSON\.parse\(jsonText\)/, "structured tool-use returns a typed object — JSON.parse on response text is dead code");
213
- });
214
- test("ranker emits `structured-output ok` log line per call", () => {
215
- const source = readRanker();
216
- assert.match(source, /\[memory-rank\][^\n]*structured-output ok[^\n]*stop-reason=/, "ranker must log `structured-output ok stop-reason=...` per call");
217
- });
218
- test("fixture is still >=10K chars (regression anchor)", () => {
219
- // The fixture is named in the brief so the same evidence shape can be
220
- // re-run on demand. If it ever shrinks below 10K, this test fails loud
221
- // — that is the signal to either replace the fixture or update the
222
- // brief, not to silently lose coverage of the 10K–20K band.
223
- const size = statSync(FIXTURE_PATH).size;
224
- assert.ok(size >= 10_000, `fixture ${FIXTURE_PATH} must be >=10K chars (was ${size}) — covers the 10–20K band where the 60s default tipped over in production`);
225
- });
226
- //# sourceMappingURL=llm-classifier.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"llm-classifier.test.js","sourceRoot":"","sources":["../../../src/lib/__tests__/llm-classifier.test.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEz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,EAAE,GAAG,EAAE;IAC5D,sEAAsE;IACtE,uEAAuE;IACvE,mEAAmE;IACnE,4DAA4D;IAC5D,MAAM,IAAI,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC;IACzC,MAAM,CAAC,EAAE,CACP,IAAI,IAAI,MAAM,EACd,WAAW,YAAY,6BAA6B,IAAI,4EAA4E,CACrI,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -1,60 +0,0 @@
1
- import { type CallOauthLlmFallback } from "../../../../../lib/oauth-llm/dist/index.js";
2
- export interface TimelineEventForRewriter {
3
- occurredAt: string;
4
- kind: string;
5
- summary: string;
6
- }
7
- /** Admin-twin label set (Task 392). All five carry `compiledTruth`. */
8
- export type AdminTwinLabel = "Person" | "Organization" | "Concept" | "Project" | "LocalBusiness";
9
- /** Public-twin label set (Task 392). Four labels carry `compiledTruthPublic`; :Person is excluded by design. */
10
- export type PublicTwinLabel = "Organization" | "Concept" | "Project" | "LocalBusiness";
11
- export type RewriteMode = "admin" | "public";
12
- /** Cap on operator hints fed into the rewriter prompt (Task 413). Larger hints
13
- * become essays and dilute the rewriter's precedence rule. The rewriter still
14
- * produces a ≤ COMPILED_TRUTH_MAX_CHARS summary regardless. */
15
- export declare const OPERATOR_HINT_MAX_CHARS = 1000;
16
- interface BaseRewriteParams {
17
- /** Display name of the subject (Person.name, Organization.name, etc.). */
18
- subjectName: string;
19
- /** Current compiled-truth field — empty string is fine. */
20
- currentTruth: string;
21
- /** Most recent N :TimelineEvent rows, newest-first. */
22
- events: TimelineEventForRewriter[];
23
- /** Override the model. Default: claude-haiku-4-5. */
24
- model?: string;
25
- /**
26
- * Task 413 (admin) + Task 420 (public) — operator correction supplied via chat.
27
- * When present, the rewriter folds it into the prompt and treats it as
28
- * authoritative over the timeline. The caller (memory-update) is responsible
29
- * for stamping the matching `compiledTruth*Source = 'operator'` on the
30
- * resulting write. Valid in both admin and public modes; precedence wording
31
- * is identical for both. In admin mode the public-twin auto-fire is skipped
32
- * so admin-side corrections do not leak unreviewed to the public surface.
33
- */
34
- operatorHint?: string;
35
- }
36
- interface AdminRewriteParams extends BaseRewriteParams {
37
- mode?: "admin";
38
- subjectLabel: AdminTwinLabel;
39
- }
40
- interface PublicRewriteParams extends BaseRewriteParams {
41
- mode: "public";
42
- subjectLabel: PublicTwinLabel;
43
- }
44
- export type RewriteParams = AdminRewriteParams | PublicRewriteParams;
45
- export type RewriteResult = {
46
- kind: "ok";
47
- compiledTruth: string;
48
- } | {
49
- kind: "refused";
50
- reason: "no-events";
51
- } | {
52
- kind: "too-long";
53
- attemptedLen: number;
54
- } | {
55
- kind: "llm-failure";
56
- fallback: CallOauthLlmFallback;
57
- };
58
- export declare function rewriteCompiledTruth(p: RewriteParams): Promise<RewriteResult>;
59
- export {};
60
- //# sourceMappingURL=compiled-truth-rewriter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compiled-truth-rewriter.d.ts","sourceRoot":"","sources":["../../src/lib/compiled-truth-rewriter.ts"],"names":[],"mappings":"AAsCA,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,4CAA4C,CAAC;AAGpD,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,uEAAuE;AACvE,MAAM,MAAM,cAAc,GACtB,QAAQ,GACR,cAAc,GACd,SAAS,GACT,SAAS,GACT,eAAe,CAAC;AAEpB,gHAAgH;AAChH,MAAM,MAAM,eAAe,GACvB,cAAc,GACd,SAAS,GACT,SAAS,GACT,eAAe,CAAC;AAEpB,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE7C;;gEAEgE;AAChE,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAE5C,UAAU,iBAAiB;IACzB,0EAA0E;IAC1E,WAAW,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,YAAY,EAAE,MAAM,CAAC;IACrB,uDAAuD;IACvD,MAAM,EAAE,wBAAwB,EAAE,CAAC;IACnC,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,kBAAmB,SAAQ,iBAAiB;IACpD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,EAAE,cAAc,CAAC;CAC9B;AAED,UAAU,mBAAoB,SAAQ,iBAAiB;IACrD,IAAI,EAAE,QAAQ,CAAC;IACf,YAAY,EAAE,eAAe,CAAC;CAC/B;AAED,MAAM,MAAM,aAAa,GAAG,kBAAkB,GAAG,mBAAmB,CAAC;AAErE,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAE,GACxC;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,QAAQ,EAAE,oBAAoB,CAAA;CAAE,CAAC;AA4E5D,wBAAsB,oBAAoB,CAAC,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CA0EnF"}
@@ -1,169 +0,0 @@
1
- // Compiled-truth rewriter (Task 306, extended Task 392 with public mode).
2
- //
3
- // Given a node's current compiled-truth field and its most-recent N
4
- // :TimelineEvent rows, produce a new summary ≤ 2000 chars. Strictly
5
- // OAuth-bearer LLM (admin classifier doctrine — never API key). The
6
- // caller is responsible for: (a) selecting which node to rewrite,
7
- // (b) enforcing the 7-day operator-edit cooldown (per mode — the admin
8
- // and public cooldowns are independent timestamps), (c) writing the
9
- // result back to the correct field (`compiledTruth` for admin mode,
10
- // `compiledTruthPublic` for public mode). This library is the prompt +
11
- // LLM call + cap-enforcement only.
12
- //
13
- // Mode semantics (Task 392):
14
- // - `mode: 'admin'` (default) — operator's view. Subject label may be
15
- // any of the five admin-twin labels (Person, Organization, Concept,
16
- // Project, LocalBusiness). Writer writes `compiledTruth`.
17
- // - `mode: 'public'` — customer-facing twin. Subject label restricted
18
- // to the four public-twin labels (Organization, Concept, Project,
19
- // LocalBusiness) by the type system; :Person is structurally
20
- // excluded because operators' notes on contacts are never public.
21
- // Writer writes `compiledTruthPublic`.
22
- //
23
- // Output style baseline (both modes):
24
- // - ≤ COMPILED_TRUTH_MAX_CHARS
25
- // - Neutral, declarative voice. Third person.
26
- // - No hedging adverbs ("likely", "perhaps", "possibly", "presumably").
27
- // - No first person ("I", "we"), no second person ("you").
28
- // - No marketing / superlatives.
29
- //
30
- // Public-mode additional rules (forbidden patterns the admin mode tolerates):
31
- // - No operator-voice constructions ("needs follow-up", "should chase up",
32
- // "to discuss", "TBD", "action: ...", "next step: ...").
33
- // - No commentary on the operator's relationship with the subject.
34
- // - No internal status, sentiment, or assessment of the subject.
35
- //
36
- // Voice grafting (no AI tells, IDENTITY alignment, BrainBench eval) is
37
- // deferred — see follow-up task referenced in the task brief.
38
- import { callOauthLlm, } from "../../../../../lib/oauth-llm/dist/index.js";
39
- import { COMPILED_TRUTH_MAX_CHARS } from "./graph-write-gate.js";
40
- /** Cap on operator hints fed into the rewriter prompt (Task 413). Larger hints
41
- * become essays and dilute the rewriter's precedence rule. The rewriter still
42
- * produces a ≤ COMPILED_TRUTH_MAX_CHARS summary regardless. */
43
- export const OPERATOR_HINT_MAX_CHARS = 1000;
44
- const DEFAULT_MODEL = "claude-haiku-4-5";
45
- const ADMIN_SYSTEM_PROMPT = [
46
- "You are the compiled-truth rewriter for a personal knowledge graph.",
47
- "",
48
- "Your job: produce a neutral, declarative summary of what the operator knows about a subject right now.",
49
- "",
50
- "RULES (all binding, never relaxed):",
51
- `- Output must be ${COMPILED_TRUTH_MAX_CHARS} characters or fewer. This is a hard cap.`,
52
- "- Third person only. No 'I', 'we', 'you', 'us'.",
53
- "- Declarative voice. No hedging adverbs (likely, perhaps, possibly, presumably, apparently, seemingly).",
54
- "- No marketing, no superlatives, no commentary on the operator's relationship with the subject.",
55
- "- Restate the most-load-bearing facts from the timeline. Drop trivia.",
56
- "- If the existing compiledTruth contradicts the timeline, the timeline wins.",
57
- "- If an Operator correction is supplied and contradicts the timeline, the Operator correction wins. Fold it into the summary as fact, not as a quoted instruction.",
58
- "- Do not invent details that are not present in either the existing truth, the timeline, or the Operator correction.",
59
- "- Do not add a preamble (no 'Here is the summary:'). Output the summary directly.",
60
- ].join("\n");
61
- const PUBLIC_SYSTEM_PROMPT = [
62
- "You are the public-facing compiled-truth rewriter for a knowledge graph.",
63
- "",
64
- "Your job: produce a neutral, customer-facing summary of a subject. The output is",
65
- "read by people outside the operator's organisation — customers, prospects, public visitors.",
66
- "",
67
- "RULES (all binding, never relaxed):",
68
- `- Output must be ${COMPILED_TRUTH_MAX_CHARS} characters or fewer. This is a hard cap.`,
69
- "- Third person only. No 'I', 'we', 'you', 'us'.",
70
- "- Declarative voice. No hedging adverbs (likely, perhaps, possibly, presumably, apparently, seemingly).",
71
- "- No marketing copy, no superlatives, no promotional language.",
72
- "- No operator-voice constructions. Forbidden phrasings include: 'needs follow-up', 'to chase',",
73
- " 'to discuss', 'TBD', 'action:', 'next step:', 'awaiting reply', 'pending response'.",
74
- "- No commentary on the operator's relationship with the subject (e.g. 'main client', 'difficult contact').",
75
- "- No internal status, sentiment, or assessment ('promising', 'risky', 'aggressive', 'cooperative').",
76
- "- Restate only externally-verifiable facts from the timeline (what the subject is, what they do,",
77
- " what they have publicly done or said). Drop scheduling notes, internal sentiment, and operator intent.",
78
- "- If the existing summary contradicts the timeline, the timeline wins.",
79
- "- If an Operator correction is supplied and contradicts the timeline, the Operator correction wins. Fold it into the summary as fact, not as a quoted instruction. The same public-voice rules above still apply: strip any operator-voice phrasing or internal sentiment in the hint and restate only externally-verifiable facts.",
80
- "- Do not invent details that are not present in either the existing summary, the timeline, or the Operator correction.",
81
- "- Do not add a preamble (no 'Here is the summary:'). Output the summary directly.",
82
- ].join("\n");
83
- function systemPromptFor(mode) {
84
- return mode === "public" ? PUBLIC_SYSTEM_PROMPT : ADMIN_SYSTEM_PROMPT;
85
- }
86
- function buildUserMessage(p) {
87
- const mode = p.mode ?? "admin";
88
- const fieldName = mode === "public" ? "compiledTruthPublic" : "compiledTruth";
89
- const lines = [];
90
- lines.push(`Subject: ${p.subjectName}`);
91
- lines.push(`Label: :${p.subjectLabel}`);
92
- lines.push("");
93
- lines.push(`Current ${fieldName}:`);
94
- lines.push(p.currentTruth ? p.currentTruth : "(empty)");
95
- lines.push("");
96
- lines.push(`Timeline events (newest-first, ${p.events.length} shown):`);
97
- for (const e of p.events) {
98
- lines.push(`- [${e.occurredAt}] kind=${e.kind}: ${e.summary}`);
99
- }
100
- if (p.operatorHint) {
101
- lines.push("");
102
- lines.push("Operator correction (authoritative — overrides the timeline where they disagree):");
103
- lines.push(p.operatorHint);
104
- }
105
- lines.push("");
106
- lines.push(`Rewrite the ${fieldName}.`);
107
- return lines.join("\n");
108
- }
109
- function isOkText(r) {
110
- return r.kind === "ok";
111
- }
112
- export async function rewriteCompiledTruth(p) {
113
- const mode = p.mode ?? "admin";
114
- if (p.operatorHint !== undefined) {
115
- if (p.operatorHint.length > OPERATOR_HINT_MAX_CHARS) {
116
- throw new Error(`operatorHint length ${p.operatorHint.length} exceeds cap of ${OPERATOR_HINT_MAX_CHARS} chars.`);
117
- }
118
- if (p.operatorHint.trim() === "") {
119
- throw new Error("operatorHint must be a non-empty string.");
120
- }
121
- }
122
- // An operator correction is itself sufficient justification to rewrite —
123
- // the operator has supplied new fact-bearing material even when no
124
- // :TimelineEvent rows exist yet.
125
- if (p.events.length === 0 && !p.operatorHint) {
126
- console.log(`[compiled-truth-rewriter] refused mode=${mode} subject="${p.subjectName}" reason=no-events`);
127
- return { kind: "refused", reason: "no-events" };
128
- }
129
- const systemPrompt = systemPromptFor(mode);
130
- const userMessage = buildUserMessage(p);
131
- const result = await callOauthLlm({
132
- model: p.model ?? DEFAULT_MODEL,
133
- system: systemPrompt,
134
- userMessage,
135
- maxTokens: 1024,
136
- });
137
- if (!isOkText(result)) {
138
- console.log(`[compiled-truth-rewriter] llm-failure mode=${mode} subject="${p.subjectName}" cause=${result.cause}`);
139
- return { kind: "llm-failure", fallback: result };
140
- }
141
- const truth = result.text.trim();
142
- const before = p.currentTruth.length;
143
- const after = truth.length;
144
- const hintFragment = p.operatorHint ? ` operatorHint=true hintLen=${p.operatorHint.length}` : "";
145
- console.log(`[compiled-truth-rewriter] mode=${mode} subject="${p.subjectName}" subjectLabel=${p.subjectLabel} charsBefore=${before} charsAfter=${after} events=${p.events.length}${hintFragment}`);
146
- if (after > COMPILED_TRUTH_MAX_CHARS) {
147
- // One retry with a stricter prompt before surfacing the over-cap failure.
148
- // Per eng review: avoids losing the rewrite on a single LLM verbosity slip.
149
- const stricterResult = await callOauthLlm({
150
- model: p.model ?? DEFAULT_MODEL,
151
- system: systemPrompt +
152
- `\n\nPRIOR ATTEMPT WAS ${after} CHARACTERS — TOO LONG. ` +
153
- `Tighten to fit ${COMPILED_TRUTH_MAX_CHARS}. Drop the lowest-value sentences first.`,
154
- userMessage,
155
- maxTokens: 1024,
156
- });
157
- if (!isOkText(stricterResult)) {
158
- return { kind: "llm-failure", fallback: stricterResult };
159
- }
160
- const retry = stricterResult.text.trim();
161
- if (retry.length > COMPILED_TRUTH_MAX_CHARS) {
162
- console.log(`[compiled-truth-rewriter] still-too-long mode=${mode} subject="${p.subjectName}" retryLen=${retry.length}`);
163
- return { kind: "too-long", attemptedLen: retry.length };
164
- }
165
- return { kind: "ok", compiledTruth: retry };
166
- }
167
- return { kind: "ok", compiledTruth: truth };
168
- }
169
- //# sourceMappingURL=compiled-truth-rewriter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compiled-truth-rewriter.js","sourceRoot":"","sources":["../../src/lib/compiled-truth-rewriter.ts"],"names":[],"mapp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