slackhive 0.1.41 → 0.1.43

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 (534) hide show
  1. package/cli/dist/index.js +15786 -52
  2. package/package.json +9 -3
  3. package/.dockerignore +0 -14
  4. package/.env.example +0 -44
  5. package/.github/ISSUE_TEMPLATE/bug_report.yml +0 -65
  6. package/.github/ISSUE_TEMPLATE/config.yml +0 -5
  7. package/.github/ISSUE_TEMPLATE/feature_request.yml +0 -38
  8. package/.github/PULL_REQUEST_TEMPLATE.md +0 -27
  9. package/.github/dependabot.yml +0 -20
  10. package/.github/workflows/audit.yml +0 -149
  11. package/.github/workflows/ci.yml +0 -135
  12. package/CHANGELOG.md +0 -52
  13. package/CODE_OF_CONDUCT.md +0 -37
  14. package/CONTRIBUTING.md +0 -204
  15. package/SECURITY.md +0 -47
  16. package/apps/runner/Dockerfile +0 -33
  17. package/apps/runner/dist/__tests__/channel-restrictions.test.d.ts +0 -8
  18. package/apps/runner/dist/__tests__/channel-restrictions.test.js +0 -63
  19. package/apps/runner/dist/__tests__/channel-restrictions.test.js.map +0 -1
  20. package/apps/runner/dist/__tests__/claude-handler-resolve.test.d.ts +0 -20
  21. package/apps/runner/dist/__tests__/claude-handler-resolve.test.js +0 -178
  22. package/apps/runner/dist/__tests__/claude-handler-resolve.test.js.map +0 -1
  23. package/apps/runner/dist/__tests__/compile-claude-md.test.d.ts +0 -13
  24. package/apps/runner/dist/__tests__/compile-claude-md.test.js +0 -144
  25. package/apps/runner/dist/__tests__/compile-claude-md.test.js.map +0 -1
  26. package/apps/runner/dist/__tests__/memory-sync.test.d.ts +0 -11
  27. package/apps/runner/dist/__tests__/memory-sync.test.js +0 -56
  28. package/apps/runner/dist/__tests__/memory-sync.test.js.map +0 -1
  29. package/apps/runner/dist/__tests__/slack-file-support.test.d.ts +0 -9
  30. package/apps/runner/dist/__tests__/slack-file-support.test.js +0 -271
  31. package/apps/runner/dist/__tests__/slack-file-support.test.js.map +0 -1
  32. package/apps/runner/dist/__tests__/slack-formatting.test.d.ts +0 -12
  33. package/apps/runner/dist/__tests__/slack-formatting.test.js +0 -400
  34. package/apps/runner/dist/__tests__/slack-formatting.test.js.map +0 -1
  35. package/apps/runner/dist/__tests__/thread-context.test.d.ts +0 -12
  36. package/apps/runner/dist/__tests__/thread-context.test.js +0 -182
  37. package/apps/runner/dist/__tests__/thread-context.test.js.map +0 -1
  38. package/apps/runner/dist/agent-runner.d.ts +0 -118
  39. package/apps/runner/dist/agent-runner.js +0 -352
  40. package/apps/runner/dist/agent-runner.js.map +0 -1
  41. package/apps/runner/dist/claude-handler.d.ts +0 -122
  42. package/apps/runner/dist/claude-handler.js +0 -402
  43. package/apps/runner/dist/claude-handler.js.map +0 -1
  44. package/apps/runner/dist/compile-claude-md.d.ts +0 -59
  45. package/apps/runner/dist/compile-claude-md.js +0 -291
  46. package/apps/runner/dist/compile-claude-md.js.map +0 -1
  47. package/apps/runner/dist/correction-handler.d.ts +0 -46
  48. package/apps/runner/dist/correction-handler.js +0 -162
  49. package/apps/runner/dist/correction-handler.js.map +0 -1
  50. package/apps/runner/dist/correction-manager.d.ts +0 -53
  51. package/apps/runner/dist/correction-manager.js +0 -241
  52. package/apps/runner/dist/correction-manager.js.map +0 -1
  53. package/apps/runner/dist/db.d.ts +0 -193
  54. package/apps/runner/dist/db.js +0 -492
  55. package/apps/runner/dist/db.js.map +0 -1
  56. package/apps/runner/dist/index.d.ts +0 -9
  57. package/apps/runner/dist/index.js +0 -43
  58. package/apps/runner/dist/index.js.map +0 -1
  59. package/apps/runner/dist/job-scheduler.d.ts +0 -57
  60. package/apps/runner/dist/job-scheduler.js +0 -150
  61. package/apps/runner/dist/job-scheduler.js.map +0 -1
  62. package/apps/runner/dist/logger.d.ts +0 -32
  63. package/apps/runner/dist/logger.js +0 -52
  64. package/apps/runner/dist/logger.js.map +0 -1
  65. package/apps/runner/dist/mcp-process-manager.d.ts +0 -38
  66. package/apps/runner/dist/mcp-process-manager.js +0 -189
  67. package/apps/runner/dist/mcp-process-manager.js.map +0 -1
  68. package/apps/runner/dist/memory-mcp.d.ts +0 -14
  69. package/apps/runner/dist/memory-mcp.js +0 -88
  70. package/apps/runner/dist/memory-mcp.js.map +0 -1
  71. package/apps/runner/dist/memory-watcher.d.ts +0 -78
  72. package/apps/runner/dist/memory-watcher.js +0 -220
  73. package/apps/runner/dist/memory-watcher.js.map +0 -1
  74. package/apps/runner/dist/slack-handler.d.ts +0 -120
  75. package/apps/runner/dist/slack-handler.js +0 -843
  76. package/apps/runner/dist/slack-handler.js.map +0 -1
  77. package/apps/runner/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  78. package/apps/runner/package.json +0 -42
  79. package/apps/runner/src/__tests__/channel-restrictions.test.ts +0 -75
  80. package/apps/runner/src/__tests__/claude-handler-resolve.test.ts +0 -160
  81. package/apps/runner/src/__tests__/compile-claude-md.test.ts +0 -139
  82. package/apps/runner/src/__tests__/memory-sync.test.ts +0 -59
  83. package/apps/runner/src/__tests__/slack-file-support.test.ts +0 -376
  84. package/apps/runner/src/__tests__/slack-formatting.test.ts +0 -495
  85. package/apps/runner/src/__tests__/thread-context.test.ts +0 -215
  86. package/apps/runner/src/agent-runner.ts +0 -397
  87. package/apps/runner/src/claude-handler.ts +0 -475
  88. package/apps/runner/src/compile-claude-md.ts +0 -283
  89. package/apps/runner/src/correction-handler.ts +0 -191
  90. package/apps/runner/src/correction-manager.ts +0 -285
  91. package/apps/runner/src/db.ts +0 -604
  92. package/apps/runner/src/index.ts +0 -46
  93. package/apps/runner/src/job-scheduler.ts +0 -165
  94. package/apps/runner/src/logger.ts +0 -49
  95. package/apps/runner/src/mcp-process-manager.ts +0 -195
  96. package/apps/runner/src/memory-mcp.ts +0 -85
  97. package/apps/runner/src/memory-watcher.ts +0 -215
  98. package/apps/runner/src/slack-handler.ts +0 -929
  99. package/apps/runner/tsconfig.json +0 -17
  100. package/apps/runner/vitest.config.mts +0 -17
  101. package/apps/web/.eslintrc.json +0 -3
  102. package/apps/web/.next/app-build-manifest.json +0 -323
  103. package/apps/web/.next/app-path-routes-manifest.json +0 -46
  104. package/apps/web/.next/build-manifest.json +0 -33
  105. package/apps/web/.next/cache/.previewinfo +0 -1
  106. package/apps/web/.next/cache/.rscinfo +0 -1
  107. package/apps/web/.next/cache/webpack/client-production/0.pack +0 -0
  108. package/apps/web/.next/cache/webpack/client-production/1.pack +0 -0
  109. package/apps/web/.next/cache/webpack/client-production/2.pack +0 -0
  110. package/apps/web/.next/cache/webpack/client-production/3.pack +0 -0
  111. package/apps/web/.next/cache/webpack/client-production/4.pack +0 -0
  112. package/apps/web/.next/cache/webpack/client-production/index.pack +0 -0
  113. package/apps/web/.next/cache/webpack/client-production/index.pack.old +0 -0
  114. package/apps/web/.next/cache/webpack/edge-server-production/0.pack +0 -0
  115. package/apps/web/.next/cache/webpack/edge-server-production/1.pack +0 -0
  116. package/apps/web/.next/cache/webpack/edge-server-production/index.pack +0 -0
  117. package/apps/web/.next/cache/webpack/edge-server-production/index.pack.old +0 -0
  118. package/apps/web/.next/cache/webpack/server-production/0.pack +0 -0
  119. package/apps/web/.next/cache/webpack/server-production/1.pack +0 -0
  120. package/apps/web/.next/cache/webpack/server-production/2.pack +0 -0
  121. package/apps/web/.next/cache/webpack/server-production/index.pack +0 -0
  122. package/apps/web/.next/cache/webpack/server-production/index.pack.old +0 -0
  123. package/apps/web/.next/diagnostics/build-diagnostics.json +0 -6
  124. package/apps/web/.next/diagnostics/framework.json +0 -1
  125. package/apps/web/.next/package.json +0 -1
  126. package/apps/web/.next/react-loadable-manifest.json +0 -1
  127. package/apps/web/.next/server/app/_not-found/page.js +0 -2
  128. package/apps/web/.next/server/app/_not-found/page.js.nft.json +0 -1
  129. package/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +0 -1
  130. package/apps/web/.next/server/app/agents/[slug]/page.js +0 -4
  131. package/apps/web/.next/server/app/agents/[slug]/page.js.nft.json +0 -1
  132. package/apps/web/.next/server/app/agents/[slug]/page_client-reference-manifest.js +0 -1
  133. package/apps/web/.next/server/app/agents/new/page.js +0 -2
  134. package/apps/web/.next/server/app/agents/new/page.js.nft.json +0 -1
  135. package/apps/web/.next/server/app/agents/new/page_client-reference-manifest.js +0 -1
  136. package/apps/web/.next/server/app/api/agents/[id]/access/route.js +0 -1
  137. package/apps/web/.next/server/app/api/agents/[id]/access/route.js.nft.json +0 -1
  138. package/apps/web/.next/server/app/api/agents/[id]/access/route_client-reference-manifest.js +0 -1
  139. package/apps/web/.next/server/app/api/agents/[id]/claude-md/route.js +0 -6
  140. package/apps/web/.next/server/app/api/agents/[id]/claude-md/route.js.nft.json +0 -1
  141. package/apps/web/.next/server/app/api/agents/[id]/claude-md/route_client-reference-manifest.js +0 -1
  142. package/apps/web/.next/server/app/api/agents/[id]/logs/route.js +0 -3
  143. package/apps/web/.next/server/app/api/agents/[id]/logs/route.js.nft.json +0 -1
  144. package/apps/web/.next/server/app/api/agents/[id]/logs/route_client-reference-manifest.js +0 -1
  145. package/apps/web/.next/server/app/api/agents/[id]/manifest/route.js +0 -1
  146. package/apps/web/.next/server/app/api/agents/[id]/manifest/route.js.nft.json +0 -1
  147. package/apps/web/.next/server/app/api/agents/[id]/manifest/route_client-reference-manifest.js +0 -1
  148. package/apps/web/.next/server/app/api/agents/[id]/mcps/route.js +0 -1
  149. package/apps/web/.next/server/app/api/agents/[id]/mcps/route.js.nft.json +0 -1
  150. package/apps/web/.next/server/app/api/agents/[id]/mcps/route_client-reference-manifest.js +0 -1
  151. package/apps/web/.next/server/app/api/agents/[id]/memories/[memId]/route.js +0 -1
  152. package/apps/web/.next/server/app/api/agents/[id]/memories/[memId]/route.js.nft.json +0 -1
  153. package/apps/web/.next/server/app/api/agents/[id]/memories/[memId]/route_client-reference-manifest.js +0 -1
  154. package/apps/web/.next/server/app/api/agents/[id]/memories/route.js +0 -1
  155. package/apps/web/.next/server/app/api/agents/[id]/memories/route.js.nft.json +0 -1
  156. package/apps/web/.next/server/app/api/agents/[id]/memories/route_client-reference-manifest.js +0 -1
  157. package/apps/web/.next/server/app/api/agents/[id]/permissions/route.js +0 -1
  158. package/apps/web/.next/server/app/api/agents/[id]/permissions/route.js.nft.json +0 -1
  159. package/apps/web/.next/server/app/api/agents/[id]/permissions/route_client-reference-manifest.js +0 -1
  160. package/apps/web/.next/server/app/api/agents/[id]/reload/route.js +0 -1
  161. package/apps/web/.next/server/app/api/agents/[id]/reload/route.js.nft.json +0 -1
  162. package/apps/web/.next/server/app/api/agents/[id]/reload/route_client-reference-manifest.js +0 -1
  163. package/apps/web/.next/server/app/api/agents/[id]/restrictions/route.js +0 -1
  164. package/apps/web/.next/server/app/api/agents/[id]/restrictions/route.js.nft.json +0 -1
  165. package/apps/web/.next/server/app/api/agents/[id]/restrictions/route_client-reference-manifest.js +0 -1
  166. package/apps/web/.next/server/app/api/agents/[id]/route.js +0 -33
  167. package/apps/web/.next/server/app/api/agents/[id]/route.js.nft.json +0 -1
  168. package/apps/web/.next/server/app/api/agents/[id]/route_client-reference-manifest.js +0 -1
  169. package/apps/web/.next/server/app/api/agents/[id]/skills/[skillId]/route.js +0 -1
  170. package/apps/web/.next/server/app/api/agents/[id]/skills/[skillId]/route.js.nft.json +0 -1
  171. package/apps/web/.next/server/app/api/agents/[id]/skills/[skillId]/route_client-reference-manifest.js +0 -1
  172. package/apps/web/.next/server/app/api/agents/[id]/skills/route.js +0 -1
  173. package/apps/web/.next/server/app/api/agents/[id]/skills/route.js.nft.json +0 -1
  174. package/apps/web/.next/server/app/api/agents/[id]/skills/route_client-reference-manifest.js +0 -1
  175. package/apps/web/.next/server/app/api/agents/[id]/slack-info/route.js +0 -1
  176. package/apps/web/.next/server/app/api/agents/[id]/slack-info/route.js.nft.json +0 -1
  177. package/apps/web/.next/server/app/api/agents/[id]/slack-info/route_client-reference-manifest.js +0 -1
  178. package/apps/web/.next/server/app/api/agents/[id]/snapshots/[sid]/restore/route.js +0 -1
  179. package/apps/web/.next/server/app/api/agents/[id]/snapshots/[sid]/restore/route.js.nft.json +0 -1
  180. package/apps/web/.next/server/app/api/agents/[id]/snapshots/[sid]/restore/route_client-reference-manifest.js +0 -1
  181. package/apps/web/.next/server/app/api/agents/[id]/snapshots/[sid]/route.js +0 -1
  182. package/apps/web/.next/server/app/api/agents/[id]/snapshots/[sid]/route.js.nft.json +0 -1
  183. package/apps/web/.next/server/app/api/agents/[id]/snapshots/[sid]/route_client-reference-manifest.js +0 -1
  184. package/apps/web/.next/server/app/api/agents/[id]/snapshots/route.js +0 -1
  185. package/apps/web/.next/server/app/api/agents/[id]/snapshots/route.js.nft.json +0 -1
  186. package/apps/web/.next/server/app/api/agents/[id]/snapshots/route_client-reference-manifest.js +0 -1
  187. package/apps/web/.next/server/app/api/agents/[id]/start/route.js +0 -1
  188. package/apps/web/.next/server/app/api/agents/[id]/start/route.js.nft.json +0 -1
  189. package/apps/web/.next/server/app/api/agents/[id]/start/route_client-reference-manifest.js +0 -1
  190. package/apps/web/.next/server/app/api/agents/[id]/stop/route.js +0 -1
  191. package/apps/web/.next/server/app/api/agents/[id]/stop/route.js.nft.json +0 -1
  192. package/apps/web/.next/server/app/api/agents/[id]/stop/route_client-reference-manifest.js +0 -1
  193. package/apps/web/.next/server/app/api/agents/route.js +0 -91
  194. package/apps/web/.next/server/app/api/agents/route.js.nft.json +0 -1
  195. package/apps/web/.next/server/app/api/agents/route_client-reference-manifest.js +0 -1
  196. package/apps/web/.next/server/app/api/auth/login/route.js +0 -1
  197. package/apps/web/.next/server/app/api/auth/login/route.js.nft.json +0 -1
  198. package/apps/web/.next/server/app/api/auth/login/route_client-reference-manifest.js +0 -1
  199. package/apps/web/.next/server/app/api/auth/logout/route.js +0 -1
  200. package/apps/web/.next/server/app/api/auth/logout/route.js.nft.json +0 -1
  201. package/apps/web/.next/server/app/api/auth/logout/route_client-reference-manifest.js +0 -1
  202. package/apps/web/.next/server/app/api/auth/me/route.js +0 -1
  203. package/apps/web/.next/server/app/api/auth/me/route.js.nft.json +0 -1
  204. package/apps/web/.next/server/app/api/auth/me/route_client-reference-manifest.js +0 -1
  205. package/apps/web/.next/server/app/api/auth/users/[id]/route.js +0 -1
  206. package/apps/web/.next/server/app/api/auth/users/[id]/route.js.nft.json +0 -1
  207. package/apps/web/.next/server/app/api/auth/users/[id]/route_client-reference-manifest.js +0 -1
  208. package/apps/web/.next/server/app/api/auth/users/route.js +0 -1
  209. package/apps/web/.next/server/app/api/auth/users/route.js.nft.json +0 -1
  210. package/apps/web/.next/server/app/api/auth/users/route_client-reference-manifest.js +0 -1
  211. package/apps/web/.next/server/app/api/env-vars/[key]/route.js +0 -1
  212. package/apps/web/.next/server/app/api/env-vars/[key]/route.js.nft.json +0 -1
  213. package/apps/web/.next/server/app/api/env-vars/[key]/route_client-reference-manifest.js +0 -1
  214. package/apps/web/.next/server/app/api/env-vars/route.js +0 -1
  215. package/apps/web/.next/server/app/api/env-vars/route.js.nft.json +0 -1
  216. package/apps/web/.next/server/app/api/env-vars/route_client-reference-manifest.js +0 -1
  217. package/apps/web/.next/server/app/api/jobs/[id]/route.js +0 -1
  218. package/apps/web/.next/server/app/api/jobs/[id]/route.js.nft.json +0 -1
  219. package/apps/web/.next/server/app/api/jobs/[id]/route_client-reference-manifest.js +0 -1
  220. package/apps/web/.next/server/app/api/jobs/[id]/runs/route.js +0 -1
  221. package/apps/web/.next/server/app/api/jobs/[id]/runs/route.js.nft.json +0 -1
  222. package/apps/web/.next/server/app/api/jobs/[id]/runs/route_client-reference-manifest.js +0 -1
  223. package/apps/web/.next/server/app/api/jobs/route.js +0 -1
  224. package/apps/web/.next/server/app/api/jobs/route.js.nft.json +0 -1
  225. package/apps/web/.next/server/app/api/jobs/route_client-reference-manifest.js +0 -1
  226. package/apps/web/.next/server/app/api/mcps/[id]/route.js +0 -1
  227. package/apps/web/.next/server/app/api/mcps/[id]/route.js.nft.json +0 -1
  228. package/apps/web/.next/server/app/api/mcps/[id]/route_client-reference-manifest.js +0 -1
  229. package/apps/web/.next/server/app/api/mcps/[id]/test/route.js +0 -1
  230. package/apps/web/.next/server/app/api/mcps/[id]/test/route.js.nft.json +0 -1
  231. package/apps/web/.next/server/app/api/mcps/[id]/test/route_client-reference-manifest.js +0 -1
  232. package/apps/web/.next/server/app/api/mcps/route.js +0 -1
  233. package/apps/web/.next/server/app/api/mcps/route.js.nft.json +0 -1
  234. package/apps/web/.next/server/app/api/mcps/route_client-reference-manifest.js +0 -1
  235. package/apps/web/.next/server/app/api/settings/route.js +0 -1
  236. package/apps/web/.next/server/app/api/settings/route.js.nft.json +0 -1
  237. package/apps/web/.next/server/app/api/settings/route_client-reference-manifest.js +0 -1
  238. package/apps/web/.next/server/app/icon.svg/route.js +0 -1
  239. package/apps/web/.next/server/app/icon.svg/route.js.nft.json +0 -1
  240. package/apps/web/.next/server/app/jobs/page.js +0 -2
  241. package/apps/web/.next/server/app/jobs/page.js.nft.json +0 -1
  242. package/apps/web/.next/server/app/jobs/page_client-reference-manifest.js +0 -1
  243. package/apps/web/.next/server/app/login/page.js +0 -2
  244. package/apps/web/.next/server/app/login/page.js.nft.json +0 -1
  245. package/apps/web/.next/server/app/login/page_client-reference-manifest.js +0 -1
  246. package/apps/web/.next/server/app/page.js +0 -2
  247. package/apps/web/.next/server/app/page.js.nft.json +0 -1
  248. package/apps/web/.next/server/app/page_client-reference-manifest.js +0 -1
  249. package/apps/web/.next/server/app/settings/env-vars/page.js +0 -2
  250. package/apps/web/.next/server/app/settings/env-vars/page.js.nft.json +0 -1
  251. package/apps/web/.next/server/app/settings/env-vars/page_client-reference-manifest.js +0 -1
  252. package/apps/web/.next/server/app/settings/mcps/page.js +0 -2
  253. package/apps/web/.next/server/app/settings/mcps/page.js.nft.json +0 -1
  254. package/apps/web/.next/server/app/settings/mcps/page_client-reference-manifest.js +0 -1
  255. package/apps/web/.next/server/app/settings/page.js +0 -2
  256. package/apps/web/.next/server/app/settings/page.js.nft.json +0 -1
  257. package/apps/web/.next/server/app/settings/page_client-reference-manifest.js +0 -1
  258. package/apps/web/.next/server/app-paths-manifest.json +0 -46
  259. package/apps/web/.next/server/chunks/1157.js +0 -9
  260. package/apps/web/.next/server/chunks/2287.js +0 -1
  261. package/apps/web/.next/server/chunks/3444.js +0 -1
  262. package/apps/web/.next/server/chunks/383.js +0 -6
  263. package/apps/web/.next/server/chunks/4012.js +0 -58
  264. package/apps/web/.next/server/chunks/6791.js +0 -1
  265. package/apps/web/.next/server/chunks/7171.js +0 -1
  266. package/apps/web/.next/server/chunks/8819.js +0 -22
  267. package/apps/web/.next/server/edge-runtime-webpack.js +0 -2
  268. package/apps/web/.next/server/edge-runtime-webpack.js.map +0 -1
  269. package/apps/web/.next/server/interception-route-rewrite-manifest.js +0 -1
  270. package/apps/web/.next/server/middleware-build-manifest.js +0 -1
  271. package/apps/web/.next/server/middleware-manifest.json +0 -32
  272. package/apps/web/.next/server/middleware-react-loadable-manifest.js +0 -1
  273. package/apps/web/.next/server/next-font-manifest.js +0 -1
  274. package/apps/web/.next/server/next-font-manifest.json +0 -1
  275. package/apps/web/.next/server/pages/_app.js +0 -1
  276. package/apps/web/.next/server/pages/_app.js.nft.json +0 -1
  277. package/apps/web/.next/server/pages/_document.js +0 -1
  278. package/apps/web/.next/server/pages/_document.js.nft.json +0 -1
  279. package/apps/web/.next/server/pages/_error.js +0 -19
  280. package/apps/web/.next/server/pages/_error.js.nft.json +0 -1
  281. package/apps/web/.next/server/pages-manifest.json +0 -5
  282. package/apps/web/.next/server/server-reference-manifest.js +0 -1
  283. package/apps/web/.next/server/server-reference-manifest.json +0 -1
  284. package/apps/web/.next/server/src/middleware.js +0 -14
  285. package/apps/web/.next/server/src/middleware.js.map +0 -1
  286. package/apps/web/.next/server/webpack-runtime.js +0 -1
  287. package/apps/web/.next/static/chunks/18-90b700ea37b686a2.js +0 -1
  288. package/apps/web/.next/static/chunks/87c73c54-24122e7b92478d00.js +0 -1
  289. package/apps/web/.next/static/chunks/9664-af80478aa73ba424.js +0 -1
  290. package/apps/web/.next/static/chunks/app/_not-found/page-b9cee17ed89ca24a.js +0 -1
  291. package/apps/web/.next/static/chunks/app/agents/[slug]/page-18369fc3fe1a9a7b.js +0 -1
  292. package/apps/web/.next/static/chunks/app/agents/new/page-bf11cf8901c7e2cd.js +0 -1
  293. package/apps/web/.next/static/chunks/app/api/agents/[id]/access/route-07f0f73ac9839899.js +0 -1
  294. package/apps/web/.next/static/chunks/app/api/agents/[id]/claude-md/route-07f0f73ac9839899.js +0 -1
  295. package/apps/web/.next/static/chunks/app/api/agents/[id]/logs/route-07f0f73ac9839899.js +0 -1
  296. package/apps/web/.next/static/chunks/app/api/agents/[id]/manifest/route-07f0f73ac9839899.js +0 -1
  297. package/apps/web/.next/static/chunks/app/api/agents/[id]/mcps/route-07f0f73ac9839899.js +0 -1
  298. package/apps/web/.next/static/chunks/app/api/agents/[id]/memories/[memId]/route-07f0f73ac9839899.js +0 -1
  299. package/apps/web/.next/static/chunks/app/api/agents/[id]/memories/route-07f0f73ac9839899.js +0 -1
  300. package/apps/web/.next/static/chunks/app/api/agents/[id]/permissions/route-07f0f73ac9839899.js +0 -1
  301. package/apps/web/.next/static/chunks/app/api/agents/[id]/reload/route-07f0f73ac9839899.js +0 -1
  302. package/apps/web/.next/static/chunks/app/api/agents/[id]/restrictions/route-07f0f73ac9839899.js +0 -1
  303. package/apps/web/.next/static/chunks/app/api/agents/[id]/route-07f0f73ac9839899.js +0 -1
  304. package/apps/web/.next/static/chunks/app/api/agents/[id]/skills/[skillId]/route-07f0f73ac9839899.js +0 -1
  305. package/apps/web/.next/static/chunks/app/api/agents/[id]/skills/route-07f0f73ac9839899.js +0 -1
  306. package/apps/web/.next/static/chunks/app/api/agents/[id]/slack-info/route-07f0f73ac9839899.js +0 -1
  307. package/apps/web/.next/static/chunks/app/api/agents/[id]/snapshots/[sid]/restore/route-07f0f73ac9839899.js +0 -1
  308. package/apps/web/.next/static/chunks/app/api/agents/[id]/snapshots/[sid]/route-07f0f73ac9839899.js +0 -1
  309. package/apps/web/.next/static/chunks/app/api/agents/[id]/snapshots/route-07f0f73ac9839899.js +0 -1
  310. package/apps/web/.next/static/chunks/app/api/agents/[id]/start/route-07f0f73ac9839899.js +0 -1
  311. package/apps/web/.next/static/chunks/app/api/agents/[id]/stop/route-07f0f73ac9839899.js +0 -1
  312. package/apps/web/.next/static/chunks/app/api/agents/route-07f0f73ac9839899.js +0 -1
  313. package/apps/web/.next/static/chunks/app/api/auth/login/route-07f0f73ac9839899.js +0 -1
  314. package/apps/web/.next/static/chunks/app/api/auth/logout/route-07f0f73ac9839899.js +0 -1
  315. package/apps/web/.next/static/chunks/app/api/auth/me/route-07f0f73ac9839899.js +0 -1
  316. package/apps/web/.next/static/chunks/app/api/auth/users/[id]/route-07f0f73ac9839899.js +0 -1
  317. package/apps/web/.next/static/chunks/app/api/auth/users/route-07f0f73ac9839899.js +0 -1
  318. package/apps/web/.next/static/chunks/app/api/env-vars/[key]/route-07f0f73ac9839899.js +0 -1
  319. package/apps/web/.next/static/chunks/app/api/env-vars/route-07f0f73ac9839899.js +0 -1
  320. package/apps/web/.next/static/chunks/app/api/jobs/[id]/route-07f0f73ac9839899.js +0 -1
  321. package/apps/web/.next/static/chunks/app/api/jobs/[id]/runs/route-07f0f73ac9839899.js +0 -1
  322. package/apps/web/.next/static/chunks/app/api/jobs/route-07f0f73ac9839899.js +0 -1
  323. package/apps/web/.next/static/chunks/app/api/mcps/[id]/route-07f0f73ac9839899.js +0 -1
  324. package/apps/web/.next/static/chunks/app/api/mcps/[id]/test/route-07f0f73ac9839899.js +0 -1
  325. package/apps/web/.next/static/chunks/app/api/mcps/route-07f0f73ac9839899.js +0 -1
  326. package/apps/web/.next/static/chunks/app/api/settings/route-07f0f73ac9839899.js +0 -1
  327. package/apps/web/.next/static/chunks/app/jobs/page-f5aa89a47c50efd8.js +0 -1
  328. package/apps/web/.next/static/chunks/app/layout-2079f4964aa7314e.js +0 -1
  329. package/apps/web/.next/static/chunks/app/login/layout-07f0f73ac9839899.js +0 -1
  330. package/apps/web/.next/static/chunks/app/login/page-aa259283dc38e8f9.js +0 -1
  331. package/apps/web/.next/static/chunks/app/page-e83437b608104dff.js +0 -1
  332. package/apps/web/.next/static/chunks/app/settings/env-vars/page-06479dbdfb78b76b.js +0 -1
  333. package/apps/web/.next/static/chunks/app/settings/mcps/page-75650686ed6490c7.js +0 -1
  334. package/apps/web/.next/static/chunks/app/settings/page-e1e62fc41ff6cddd.js +0 -1
  335. package/apps/web/.next/static/chunks/framework-811407f832a33072.js +0 -1
  336. package/apps/web/.next/static/chunks/main-3f1cddbdd67b1546.js +0 -1
  337. package/apps/web/.next/static/chunks/main-app-cebd8a6a5ccbf72d.js +0 -1
  338. package/apps/web/.next/static/chunks/pages/_app-50fa07b56b2d29ac.js +0 -1
  339. package/apps/web/.next/static/chunks/pages/_error-fed8688bdd23f211.js +0 -1
  340. package/apps/web/.next/static/chunks/polyfills-42372ed130431b0a.js +0 -1
  341. package/apps/web/.next/static/chunks/webpack-6c05566dba553c97.js +0 -1
  342. package/apps/web/.next/static/css/15371687405525e2.css +0 -5
  343. package/apps/web/.next/static/ikfNbLhuw7jntn35bz0lk/_buildManifest.js +0 -1
  344. package/apps/web/.next/static/ikfNbLhuw7jntn35bz0lk/_ssgManifest.js +0 -1
  345. package/apps/web/.next/trace +0 -5
  346. package/apps/web/.next/types/app/agents/[slug]/page.ts +0 -84
  347. package/apps/web/.next/types/app/agents/new/page.ts +0 -84
  348. package/apps/web/.next/types/app/api/agents/[id]/access/route.ts +0 -347
  349. package/apps/web/.next/types/app/api/agents/[id]/claude-md/route.ts +0 -347
  350. package/apps/web/.next/types/app/api/agents/[id]/logs/route.ts +0 -347
  351. package/apps/web/.next/types/app/api/agents/[id]/manifest/route.ts +0 -347
  352. package/apps/web/.next/types/app/api/agents/[id]/mcps/route.ts +0 -347
  353. package/apps/web/.next/types/app/api/agents/[id]/memories/[memId]/route.ts +0 -347
  354. package/apps/web/.next/types/app/api/agents/[id]/memories/route.ts +0 -347
  355. package/apps/web/.next/types/app/api/agents/[id]/permissions/route.ts +0 -347
  356. package/apps/web/.next/types/app/api/agents/[id]/reload/route.ts +0 -347
  357. package/apps/web/.next/types/app/api/agents/[id]/restrictions/route.ts +0 -347
  358. package/apps/web/.next/types/app/api/agents/[id]/route.ts +0 -347
  359. package/apps/web/.next/types/app/api/agents/[id]/skills/[skillId]/route.ts +0 -347
  360. package/apps/web/.next/types/app/api/agents/[id]/skills/route.ts +0 -347
  361. package/apps/web/.next/types/app/api/agents/[id]/slack-info/route.ts +0 -347
  362. package/apps/web/.next/types/app/api/agents/[id]/snapshots/[sid]/restore/route.ts +0 -347
  363. package/apps/web/.next/types/app/api/agents/[id]/snapshots/[sid]/route.ts +0 -347
  364. package/apps/web/.next/types/app/api/agents/[id]/snapshots/route.ts +0 -347
  365. package/apps/web/.next/types/app/api/agents/[id]/start/route.ts +0 -347
  366. package/apps/web/.next/types/app/api/agents/[id]/stop/route.ts +0 -347
  367. package/apps/web/.next/types/app/api/agents/route.ts +0 -347
  368. package/apps/web/.next/types/app/api/auth/login/route.ts +0 -347
  369. package/apps/web/.next/types/app/api/auth/logout/route.ts +0 -347
  370. package/apps/web/.next/types/app/api/auth/me/route.ts +0 -347
  371. package/apps/web/.next/types/app/api/auth/users/[id]/route.ts +0 -347
  372. package/apps/web/.next/types/app/api/auth/users/route.ts +0 -347
  373. package/apps/web/.next/types/app/api/env-vars/[key]/route.ts +0 -347
  374. package/apps/web/.next/types/app/api/env-vars/route.ts +0 -347
  375. package/apps/web/.next/types/app/api/jobs/[id]/route.ts +0 -347
  376. package/apps/web/.next/types/app/api/jobs/[id]/runs/route.ts +0 -347
  377. package/apps/web/.next/types/app/api/jobs/route.ts +0 -347
  378. package/apps/web/.next/types/app/api/mcps/[id]/route.ts +0 -347
  379. package/apps/web/.next/types/app/api/mcps/[id]/test/route.ts +0 -347
  380. package/apps/web/.next/types/app/api/mcps/route.ts +0 -347
  381. package/apps/web/.next/types/app/api/settings/route.ts +0 -347
  382. package/apps/web/.next/types/app/jobs/page.ts +0 -84
  383. package/apps/web/.next/types/app/login/layout.ts +0 -84
  384. package/apps/web/.next/types/app/login/page.ts +0 -84
  385. package/apps/web/.next/types/app/page.ts +0 -84
  386. package/apps/web/.next/types/app/settings/env-vars/page.ts +0 -84
  387. package/apps/web/.next/types/app/settings/mcps/page.ts +0 -84
  388. package/apps/web/.next/types/app/settings/page.ts +0 -84
  389. package/apps/web/.next/types/cache-life.d.ts +0 -141
  390. package/apps/web/.next/types/package.json +0 -1
  391. package/apps/web/.next/types/routes.d.ts +0 -114
  392. package/apps/web/.next/types/validator.ts +0 -448
  393. package/apps/web/Dockerfile +0 -37
  394. package/apps/web/next-env.d.ts +0 -6
  395. package/apps/web/next.config.js +0 -6
  396. package/apps/web/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  397. package/apps/web/package.json +0 -48
  398. package/apps/web/postcss.config.js +0 -3
  399. package/apps/web/public/logo.svg +0 -17
  400. package/apps/web/src/app/agents/[slug]/page.tsx +0 -2235
  401. package/apps/web/src/app/agents/new/page.tsx +0 -1161
  402. package/apps/web/src/app/api/agents/[id]/access/route.ts +0 -76
  403. package/apps/web/src/app/api/agents/[id]/claude-md/route.ts +0 -111
  404. package/apps/web/src/app/api/agents/[id]/logs/route.ts +0 -84
  405. package/apps/web/src/app/api/agents/[id]/manifest/route.ts +0 -32
  406. package/apps/web/src/app/api/agents/[id]/mcps/route.ts +0 -73
  407. package/apps/web/src/app/api/agents/[id]/memories/[memId]/route.ts +0 -31
  408. package/apps/web/src/app/api/agents/[id]/memories/route.ts +0 -56
  409. package/apps/web/src/app/api/agents/[id]/permissions/route.ts +0 -74
  410. package/apps/web/src/app/api/agents/[id]/reload/route.ts +0 -33
  411. package/apps/web/src/app/api/agents/[id]/restrictions/route.ts +0 -85
  412. package/apps/web/src/app/api/agents/[id]/route.ts +0 -81
  413. package/apps/web/src/app/api/agents/[id]/skills/[skillId]/route.ts +0 -52
  414. package/apps/web/src/app/api/agents/[id]/skills/route.ts +0 -80
  415. package/apps/web/src/app/api/agents/[id]/slack-info/route.ts +0 -38
  416. package/apps/web/src/app/api/agents/[id]/snapshots/[sid]/restore/route.ts +0 -61
  417. package/apps/web/src/app/api/agents/[id]/snapshots/[sid]/route.ts +0 -53
  418. package/apps/web/src/app/api/agents/[id]/snapshots/route.ts +0 -84
  419. package/apps/web/src/app/api/agents/[id]/start/route.ts +0 -35
  420. package/apps/web/src/app/api/agents/[id]/stop/route.ts +0 -35
  421. package/apps/web/src/app/api/agents/route.ts +0 -99
  422. package/apps/web/src/app/api/auth/login/route.ts +0 -39
  423. package/apps/web/src/app/api/auth/logout/route.ts +0 -21
  424. package/apps/web/src/app/api/auth/me/route.ts +0 -24
  425. package/apps/web/src/app/api/auth/users/[id]/route.ts +0 -48
  426. package/apps/web/src/app/api/auth/users/route.ts +0 -63
  427. package/apps/web/src/app/api/env-vars/[key]/route.ts +0 -66
  428. package/apps/web/src/app/api/env-vars/route.ts +0 -59
  429. package/apps/web/src/app/api/jobs/[id]/route.ts +0 -51
  430. package/apps/web/src/app/api/jobs/[id]/runs/route.ts +0 -24
  431. package/apps/web/src/app/api/jobs/route.ts +0 -42
  432. package/apps/web/src/app/api/mcps/[id]/route.ts +0 -60
  433. package/apps/web/src/app/api/mcps/[id]/test/route.ts +0 -195
  434. package/apps/web/src/app/api/mcps/route.ts +0 -72
  435. package/apps/web/src/app/api/settings/route.ts +0 -42
  436. package/apps/web/src/app/globals.css +0 -124
  437. package/apps/web/src/app/icon.svg +0 -17
  438. package/apps/web/src/app/jobs/page.tsx +0 -543
  439. package/apps/web/src/app/layout-shell.tsx +0 -89
  440. package/apps/web/src/app/layout.tsx +0 -18
  441. package/apps/web/src/app/login/layout.tsx +0 -9
  442. package/apps/web/src/app/login/page.tsx +0 -150
  443. package/apps/web/src/app/page.tsx +0 -573
  444. package/apps/web/src/app/settings/env-vars/page.tsx +0 -216
  445. package/apps/web/src/app/settings/mcps/page.tsx +0 -763
  446. package/apps/web/src/app/settings/page.tsx +0 -528
  447. package/apps/web/src/app/sidebar.tsx +0 -345
  448. package/apps/web/src/lib/__tests__/api-guard.test.ts +0 -189
  449. package/apps/web/src/lib/__tests__/auth.test.ts +0 -262
  450. package/apps/web/src/lib/__tests__/boss-registry.test.ts +0 -323
  451. package/apps/web/src/lib/__tests__/compile.test.ts +0 -161
  452. package/apps/web/src/lib/__tests__/db-agent-hierarchy.test.ts +0 -136
  453. package/apps/web/src/lib/__tests__/db-env-vars.test.ts +0 -216
  454. package/apps/web/src/lib/__tests__/db-restrictions.test.ts +0 -117
  455. package/apps/web/src/lib/__tests__/db.integration.test.ts +0 -271
  456. package/apps/web/src/lib/__tests__/diff.test.ts +0 -102
  457. package/apps/web/src/lib/__tests__/mcp-mask.test.ts +0 -274
  458. package/apps/web/src/lib/__tests__/skill-templates.test.ts +0 -237
  459. package/apps/web/src/lib/__tests__/slack-manifest.test.ts +0 -105
  460. package/apps/web/src/lib/api-guard.ts +0 -68
  461. package/apps/web/src/lib/auth-context.tsx +0 -71
  462. package/apps/web/src/lib/auth.ts +0 -128
  463. package/apps/web/src/lib/boss-registry.ts +0 -90
  464. package/apps/web/src/lib/compile.ts +0 -51
  465. package/apps/web/src/lib/db.ts +0 -1196
  466. package/apps/web/src/lib/diff.ts +0 -43
  467. package/apps/web/src/lib/mcp-mask.ts +0 -91
  468. package/apps/web/src/lib/portal.tsx +0 -23
  469. package/apps/web/src/lib/skill-templates.ts +0 -148
  470. package/apps/web/src/lib/slack-manifest.ts +0 -85
  471. package/apps/web/src/middleware.ts +0 -68
  472. package/apps/web/tailwind.config.js +0 -6
  473. package/apps/web/tsconfig.json +0 -23
  474. package/apps/web/vitest.config.mts +0 -21
  475. package/cli/.claude/settings.local.json +0 -6
  476. package/cli/node_modules/.package-lock.json +0 -427
  477. package/cli/node_modules/commander/LICENSE +0 -22
  478. package/cli/node_modules/commander/Readme.md +0 -1157
  479. package/cli/node_modules/commander/esm.mjs +0 -16
  480. package/cli/node_modules/commander/index.js +0 -24
  481. package/cli/node_modules/commander/lib/argument.js +0 -149
  482. package/cli/node_modules/commander/lib/command.js +0 -2509
  483. package/cli/node_modules/commander/lib/error.js +0 -39
  484. package/cli/node_modules/commander/lib/help.js +0 -520
  485. package/cli/node_modules/commander/lib/option.js +0 -330
  486. package/cli/node_modules/commander/lib/suggestSimilar.js +0 -101
  487. package/cli/node_modules/commander/package-support.json +0 -16
  488. package/cli/node_modules/commander/package.json +0 -84
  489. package/cli/node_modules/commander/typings/esm.d.mts +0 -3
  490. package/cli/node_modules/commander/typings/index.d.ts +0 -969
  491. package/cli/package-lock.json +0 -449
  492. package/cli/package.json +0 -44
  493. package/cli/src/commands/init.ts +0 -514
  494. package/cli/src/commands/manage.ts +0 -115
  495. package/cli/src/index.ts +0 -63
  496. package/cli/tsconfig.json +0 -14
  497. package/docker-compose.yml +0 -122
  498. package/docs/agents/boss-agents.mdx +0 -108
  499. package/docs/agents/creating-agents.mdx +0 -132
  500. package/docs/agents/memory.mdx +0 -113
  501. package/docs/agents/tools.mdx +0 -103
  502. package/docs/configuration/env-vars.mdx +0 -166
  503. package/docs/configuration/mcp-servers.mdx +0 -203
  504. package/docs/configuration/slack-app.mdx +0 -175
  505. package/docs/docs.json +0 -79
  506. package/docs/favicon.svg +0 -17
  507. package/docs/features/history.mdx +0 -60
  508. package/docs/features/import-export.mdx +0 -77
  509. package/docs/features/logs.mdx +0 -131
  510. package/docs/features/multi-workspace.mdx +0 -90
  511. package/docs/features/scheduled-jobs.mdx +0 -231
  512. package/docs/features/users.mdx +0 -92
  513. package/docs/introduction.mdx +0 -160
  514. package/docs/logo/dark.svg +0 -17
  515. package/docs/logo/light.svg +0 -17
  516. package/docs/logo/wide-dark.svg +0 -12
  517. package/docs/logo/wide-light.svg +0 -12
  518. package/docs/quickstart.mdx +0 -270
  519. package/docs/self-hosting/docker.mdx +0 -151
  520. package/docs/self-hosting/production.mdx +0 -176
  521. package/packages/shared/dist/index.d.ts +0 -8
  522. package/packages/shared/dist/index.d.ts.map +0 -1
  523. package/packages/shared/dist/index.js +0 -24
  524. package/packages/shared/dist/index.js.map +0 -1
  525. package/packages/shared/dist/types.d.ts +0 -584
  526. package/packages/shared/dist/types.d.ts.map +0 -1
  527. package/packages/shared/dist/types.js +0 -39
  528. package/packages/shared/dist/types.js.map +0 -1
  529. package/packages/shared/package.json +0 -15
  530. package/packages/shared/src/db/schema.sql +0 -354
  531. package/packages/shared/src/index.ts +0 -8
  532. package/packages/shared/src/types.ts +0 -683
  533. package/packages/shared/tsconfig.json +0 -17
  534. package/scripts/dev.sh +0 -45
@@ -1,291 +0,0 @@
1
- "use strict";
2
- /**
3
- * @fileoverview Agent workspace compiler for the runner service.
4
- *
5
- * Writes two things to the agent's temporary working directory:
6
- *
7
- * 1. CLAUDE.md — the agent's main instruction/identity file.
8
- * Source: agents.claude_md column (or auto-generated for boss agents).
9
- * Memories are appended at the end.
10
- *
11
- * 2. .claude/commands/{filename} — Claude Code slash commands.
12
- * Source: skills table rows for this agent.
13
- * Each skill becomes an invokable /<filename> command.
14
- *
15
- * Directory layout:
16
- * /tmp/agents/{slug}/
17
- * CLAUDE.md ← identity + memories
18
- * .claude/
19
- * commands/
20
- * {filename}.md ← one file per skill
21
- * memory/
22
- * {type}_{name}.md ← materialized memory files
23
- *
24
- * @module runner/compile-claude-md
25
- */
26
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
27
- if (k2 === undefined) k2 = k;
28
- var desc = Object.getOwnPropertyDescriptor(m, k);
29
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
30
- desc = { enumerable: true, get: function() { return m[k]; } };
31
- }
32
- Object.defineProperty(o, k2, desc);
33
- }) : (function(o, m, k, k2) {
34
- if (k2 === undefined) k2 = k;
35
- o[k2] = m[k];
36
- }));
37
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
38
- Object.defineProperty(o, "default", { enumerable: true, value: v });
39
- }) : function(o, v) {
40
- o["default"] = v;
41
- });
42
- var __importStar = (this && this.__importStar) || (function () {
43
- var ownKeys = function(o) {
44
- ownKeys = Object.getOwnPropertyNames || function (o) {
45
- var ar = [];
46
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
47
- return ar;
48
- };
49
- return ownKeys(o);
50
- };
51
- return function (mod) {
52
- if (mod && mod.__esModule) return mod;
53
- var result = {};
54
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
55
- __setModuleDefault(result, mod);
56
- return result;
57
- };
58
- })();
59
- Object.defineProperty(exports, "__esModule", { value: true });
60
- exports.getAgentWorkDir = getAgentWorkDir;
61
- exports.getClaudeMdPath = getClaudeMdPath;
62
- exports.compileClaudeMd = compileClaudeMd;
63
- exports.materializeMemoryFiles = materializeMemoryFiles;
64
- const fs = __importStar(require("fs"));
65
- const path = __importStar(require("path"));
66
- const db_1 = require("./db");
67
- const logger_1 = require("./logger");
68
- /** Base directory for ephemeral agent workspaces. */
69
- const AGENTS_TMP_DIR = process.env.AGENTS_TMP_DIR ?? '/tmp/agents';
70
- /**
71
- * Built-in /recall skill — injected for every agent automatically.
72
- * Reads memory files from the agent's memory directory on disk.
73
- */
74
- const RECALL_SKILL = `Search your memory files for context relevant to: $ARGUMENTS
75
-
76
- Use the Read tool to read files from the \`memory/\` directory (relative to your working directory).
77
- First read \`memory/MEMORY.md\` to see the index, then read specific memory files that match the topic.
78
- Apply what you find — past preferences, corrections, and patterns — so you don't repeat previous mistakes or ask questions you've already had answered.
79
- If no relevant memories are found, say so briefly and continue.`;
80
- /**
81
- * Memory system instructions injected into every agent's CLAUDE.md.
82
- * Tells the agent to persist learned facts to .claude/memory/ in its cwd.
83
- */
84
- /**
85
- * Slack formatting rules injected into every agent's CLAUDE.md.
86
- * Built-in at the framework level — not visible in the Skills tab.
87
- */
88
- const SLACK_FORMATTING_SECTION = `# Slack Formatting
89
-
90
- You are responding in Slack. Follow these rules for every message:
91
-
92
- **Text formatting:**
93
- - Bold: \`*bold*\` — NOT \`**bold**\`
94
- - Italic: \`_italic_\` — NOT \`*italic*\`
95
- - Section headers: \`*Header Text*\` on its own line — NOT \`#\`, \`##\`, \`###\`
96
- - Inline code: \`` + '`' + `code\`` + '`' + `
97
- - Code blocks: triple backticks with language hint (\`\`\`sql ... \`\`\`)
98
- - Lists: \`- item\` or \`1. item\`
99
- - Links: \`<url|text>\`
100
- - Horizontal rules: just a blank line — NOT \`---\` or \`***\`
101
- - Blockquotes: use plain text or \`_italic_\` — NOT \`>\`
102
-
103
- **Tables — use standard Markdown pipe format:**
104
- - Every row MUST start and end with \`|\`
105
- - Always include a separator row: \`|---|---|---|\`
106
- - Do NOT wrap tables in code blocks
107
-
108
- Good:
109
- \`\`\`
110
- | Name | Count |
111
- |---|---|
112
- | Alpha | 42 |
113
- \`\`\`
114
-
115
- **Never use:** \`## headings\`, \`**double asterisks**\`, \`> blockquotes\`, \`---\` rules`;
116
- /**
117
- * Returns the temporary working directory path for an agent.
118
- *
119
- * @param {string} slug - Agent slug (e.g., "gilfoyle").
120
- * @returns {string} Absolute path to the agent's temp workspace.
121
- */
122
- function getAgentWorkDir(slug) {
123
- return path.join(AGENTS_TMP_DIR, slug);
124
- }
125
- /**
126
- * Returns the path to the CLAUDE.md file for an agent.
127
- *
128
- * @param {string} slug - Agent slug.
129
- * @returns {string} Absolute path to CLAUDE.md.
130
- */
131
- function getClaudeMdPath(slug) {
132
- return path.join(getAgentWorkDir(slug), 'CLAUDE.md');
133
- }
134
- /**
135
- * Compiles the agent workspace: writes CLAUDE.md and skill command files.
136
- *
137
- * - CLAUDE.md = agent.claudeMd (identity/instructions) + memory system + memories
138
- * - .claude/commands/{filename}.md = one file per skill (Claude Code slash commands)
139
- *
140
- * For boss agents, CLAUDE.md is auto-generated from the team registry instead of
141
- * agent.claudeMd (the boss-registry.ts module sets this before calling compileClaudeMd).
142
- *
143
- * @param {Agent} agent - The agent to compile for.
144
- * @param {string} [overrideClaudeMd] - Optional override for CLAUDE.md content (used by boss registry).
145
- * @returns {Promise<string>} The path to the agent's working directory (pass as cwd to SDK).
146
- * @throws {Error} If writing to the filesystem fails.
147
- */
148
- async function compileClaudeMd(agent, overrideClaudeMd) {
149
- const workDir = getAgentWorkDir(agent.slug);
150
- const claudeMdPath = getClaudeMdPath(agent.slug);
151
- fs.mkdirSync(workDir, { recursive: true });
152
- const skills = await (0, db_1.getAgentSkills)(agent.id);
153
- logger_1.logger.info('Compiling agent workspace', {
154
- agent: agent.slug,
155
- skills: skills.length,
156
- });
157
- // -------------------------------------------------------------------------
158
- // 1. Write CLAUDE.md (identity + memory system instructions)
159
- // -------------------------------------------------------------------------
160
- const claudeMdContent = buildClaudeMd(agent, overrideClaudeMd);
161
- fs.writeFileSync(claudeMdPath, claudeMdContent, 'utf-8');
162
- logger_1.logger.debug('CLAUDE.md written', {
163
- agent: agent.slug,
164
- path: claudeMdPath,
165
- bytes: Buffer.byteLength(claudeMdContent, 'utf-8'),
166
- });
167
- // -------------------------------------------------------------------------
168
- // 2. Write skills as .claude/commands/{filename}.md
169
- // -------------------------------------------------------------------------
170
- const commandsDir = path.join(workDir, '.claude', 'commands');
171
- fs.mkdirSync(commandsDir, { recursive: true });
172
- // Remove old command files before rewriting (handles deleted skills)
173
- for (const existing of fs.readdirSync(commandsDir)) {
174
- fs.rmSync(path.join(commandsDir, existing), { force: true });
175
- }
176
- // Built-in recall skill — always injected, not user-visible in Skills tab
177
- fs.writeFileSync(path.join(commandsDir, 'recall.md'), RECALL_SKILL, 'utf-8');
178
- for (const skill of skills) {
179
- const filename = skill.filename.endsWith('.md') ? skill.filename : `${skill.filename}.md`;
180
- fs.writeFileSync(path.join(commandsDir, filename), skill.content, 'utf-8');
181
- }
182
- logger_1.logger.debug('Skill commands written', {
183
- agent: agent.slug,
184
- commands: skills.map(s => s.filename),
185
- dir: commandsDir,
186
- });
187
- // -------------------------------------------------------------------------
188
- // 3. Propagate updates to all existing per-session directories
189
- // -------------------------------------------------------------------------
190
- const sessionsDir = path.join(workDir, 'sessions');
191
- if (fs.existsSync(sessionsDir)) {
192
- for (const entry of fs.readdirSync(sessionsDir)) {
193
- const sessionDir = path.join(sessionsDir, entry);
194
- if (!fs.statSync(sessionDir).isDirectory())
195
- continue;
196
- // Update CLAUDE.md
197
- fs.writeFileSync(path.join(sessionDir, 'CLAUDE.md'), claudeMdContent, 'utf8');
198
- // Update .claude/commands/
199
- const sessionCommandsDir = path.join(sessionDir, '.claude', 'commands');
200
- fs.mkdirSync(sessionCommandsDir, { recursive: true });
201
- for (const existing of fs.readdirSync(sessionCommandsDir)) {
202
- fs.rmSync(path.join(sessionCommandsDir, existing), { force: true });
203
- }
204
- fs.writeFileSync(path.join(sessionCommandsDir, 'recall.md'), RECALL_SKILL, 'utf-8');
205
- for (const skill of skills) {
206
- const filename = skill.filename.endsWith('.md') ? skill.filename : `${skill.filename}.md`;
207
- fs.writeFileSync(path.join(sessionCommandsDir, filename), skill.content, 'utf-8');
208
- }
209
- }
210
- }
211
- return workDir;
212
- }
213
- /**
214
- * Materializes memory files from the database to the agent's temp workspace.
215
- * These files are read by the /recall skill when the agent needs past context.
216
- */
217
- function materializeMemoryFiles(agent, memories) {
218
- const memoryDir = path.join(getAgentWorkDir(agent.slug), 'memory');
219
- fs.mkdirSync(memoryDir, { recursive: true });
220
- const index = ['# Memory Index', ''];
221
- for (const memory of memories) {
222
- const filename = `${memory.type}_${sanitizeFilename(memory.name)}.md`;
223
- fs.writeFileSync(path.join(memoryDir, filename), memory.content, 'utf-8');
224
- index.push(`- [${memory.name}](${filename}) — ${memory.type}`);
225
- }
226
- fs.writeFileSync(path.join(memoryDir, 'MEMORY.md'), index.join('\n'), 'utf-8');
227
- logger_1.logger.debug('Memory files materialized', { agent: agent.slug, count: memories.length });
228
- }
229
- // =============================================================================
230
- // Private helpers
231
- // =============================================================================
232
- /**
233
- * Builds the CLAUDE.md content for an agent.
234
- * Structure: identity → Slack formatting rules → memory system instructions.
235
- *
236
- * @param {Agent} agent - The agent.
237
- * @param {string} [overrideClaudeMd] - Override for identity content (boss registry use).
238
- * @returns {string} Full CLAUDE.md content.
239
- */
240
- function buildClaudeMd(agent, overrideClaudeMd) {
241
- const sections = [];
242
- // Identity / instructions
243
- const identity = overrideClaudeMd ?? agent.claudeMd;
244
- if (identity.trim()) {
245
- sections.push(identity.trim());
246
- }
247
- else {
248
- const lines = [`# ${agent.name}`];
249
- if (agent.persona)
250
- lines.push('', agent.persona);
251
- if (agent.description)
252
- lines.push('', agent.description);
253
- sections.push(lines.join('\n'));
254
- }
255
- // Slack formatting rules (framework-level, not a skill)
256
- sections.push(SLACK_FORMATTING_SECTION);
257
- // Memory instructions — internal, not shown in UI
258
- sections.push(`# Memory
259
-
260
- Use /recall <topic> proactively — at the start of each conversation and whenever the topic shifts. Don't wait to be asked. Past memories contain user preferences, corrections, and learned patterns that let you pick up where you left off instead of starting from scratch.
261
-
262
- **When to save a memory** — use the Write tool to create \`memory/{type}_{name}.md\` (IMPORTANT: you MUST actually call the Write tool — do not just say you saved it). Include this frontmatter at the top, followed by the memory content:
263
- \`\`\`
264
- ---
265
- name: {name}
266
- type: {type}
267
- description: {one line summary}
268
- ---
269
- {memory content}
270
- \`\`\`
271
- Valid types: user|feedback|project|reference. Save when:
272
- - User explicitly corrects or guides you ("don't do X", "always do Y")
273
- - You notice a recurring pattern: same question asked repeatedly, same mistake made, same preference shown — save it so you don't start from scratch next time
274
- - You learn something concrete about the user's role, goals, or working style
275
- - A project decision or constraint is established that will affect future work
276
-
277
- **When NOT to save** — one-off tasks, ephemeral state, things already in the code or git history.
278
-
279
- Keep memories concise and actionable. Bad memory: "user asked about SQL". Good memory: "user prefers CTEs over subqueries — confirmed multiple times".`);
280
- return sections.join('\n\n---\n\n');
281
- }
282
- /**
283
- * Sanitizes a string for use as a filename.
284
- *
285
- * @param {string} name - Raw name string.
286
- * @returns {string} Filesystem-safe filename fragment.
287
- */
288
- function sanitizeFilename(name) {
289
- return name.toLowerCase().replace(/[^a-z0-9_-]/g, '_').slice(0, 64);
290
- }
291
- //# sourceMappingURL=compile-claude-md.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compile-claude-md.js","sourceRoot":"","sources":["../src/compile-claude-md.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEH,0CAEC;AAQD,0CAEC;AAgBD,0CA6EC;AAOD,wDAaC;AA7LD,uCAAyB;AACzB,2CAA6B;AAE7B,6BAAsC;AACtC,qCAAkC;AAElC,qDAAqD;AACrD,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,aAAa,CAAC;AAEnE;;;GAGG;AACH,MAAM,YAAY,GAAG;;;;;gEAK2C,CAAC;AAEjE;;;GAGG;AACH;;;GAGG;AACH,MAAM,wBAAwB,GAAG;;;;;;;;kBAQf,GAAG,GAAG,GAAG,QAAQ,GAAG,GAAG,GAAG;;;;;;;;;;;;;;;;;;;2FAmB+C,CAAC;AAG5F;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,IAAY;IAC1C,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC;AAED;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,IAAY;IAC1C,OAAO,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,CAAC;AACvD,CAAC;AAED;;;;;;;;;;;;;GAaG;AACI,KAAK,UAAU,eAAe,CAAC,KAAY,EAAE,gBAAyB;IAC3E,MAAM,OAAO,GAAG,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5C,MAAM,YAAY,GAAG,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAEjD,EAAE,CAAC,SA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AAE,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;QACzD,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAClC,CAAC;IAED,wDAAwD;IACxD,QAAQ,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;IAExC,kDAAkD;IAClD,QAAQ,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;uJAqBuI,CAAC,CAAC;IAEvJ,OAAO,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AACtC,CAAC;AAED;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,IAAY;IACpC,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACtE,CAAC"}
@@ -1,46 +0,0 @@
1
- /**
2
- * @fileoverview Generic Slack command handler for agent corrections.
3
- *
4
- * Commands use the agent's slug as prefix so any agent can have corrections:
5
- * @GILFOYLE gilfoyle:correct "always use UTC"
6
- * @GILFOYLE gilfoyle:corrections
7
- * @GILFOYLE gilfoyle:corrections remove 3
8
- * @GILFOYLE gilfoyle:help
9
- *
10
- * Commands are intercepted before normal message processing in slack-handler.ts.
11
- *
12
- * Adapted from nlq-claude-slack-bot/src/correction-handler.ts.
13
- * Key changes: NLQ-specific -> generic per-agent, slug-prefixed commands.
14
- *
15
- * @module runner/correction-handler
16
- */
17
- import type { Agent } from '@slackhive/shared';
18
- interface SlackContext {
19
- userId: string;
20
- channelId: string;
21
- threadTs?: string;
22
- messageTs: string;
23
- }
24
- export declare class CorrectionHandler {
25
- private correctionManager;
26
- private agent;
27
- private prefix;
28
- private reviewerAllowlist;
29
- private log;
30
- constructor(agent: Agent);
31
- /**
32
- * Returns true if the given text is a command for this agent.
33
- * Checks for `{slug}:correct`, `{slug}:corrections`, or `{slug}:help`.
34
- */
35
- isCommand(text: string): boolean;
36
- /**
37
- * Routes a command to the appropriate handler.
38
- */
39
- handle(ctx: SlackContext, text: string, client: any): Promise<void>;
40
- private isAuthorized;
41
- private fetchThreadContext;
42
- private handleAdd;
43
- private handleShow;
44
- private handleRemove;
45
- }
46
- export {};
@@ -1,162 +0,0 @@
1
- "use strict";
2
- /**
3
- * @fileoverview Generic Slack command handler for agent corrections.
4
- *
5
- * Commands use the agent's slug as prefix so any agent can have corrections:
6
- * @GILFOYLE gilfoyle:correct "always use UTC"
7
- * @GILFOYLE gilfoyle:corrections
8
- * @GILFOYLE gilfoyle:corrections remove 3
9
- * @GILFOYLE gilfoyle:help
10
- *
11
- * Commands are intercepted before normal message processing in slack-handler.ts.
12
- *
13
- * Adapted from nlq-claude-slack-bot/src/correction-handler.ts.
14
- * Key changes: NLQ-specific -> generic per-agent, slug-prefixed commands.
15
- *
16
- * @module runner/correction-handler
17
- */
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.CorrectionHandler = void 0;
20
- const correction_manager_1 = require("./correction-manager");
21
- const logger_1 = require("./logger");
22
- const MAX_CORRECTIONS = 30;
23
- class CorrectionHandler {
24
- correctionManager;
25
- agent;
26
- prefix;
27
- reviewerAllowlist;
28
- log;
29
- constructor(agent) {
30
- this.agent = agent;
31
- this.prefix = `${agent.slug}:`;
32
- this.correctionManager = new correction_manager_1.CorrectionManager(agent);
33
- this.reviewerAllowlist = (process.env.CORRECTION_REVIEWERS || '').split(',').filter(Boolean);
34
- this.log = (0, logger_1.agentLogger)(agent.slug);
35
- }
36
- /**
37
- * Returns true if the given text is a command for this agent.
38
- * Checks for `{slug}:correct`, `{slug}:corrections`, or `{slug}:help`.
39
- */
40
- isCommand(text) {
41
- return text.startsWith(`${this.prefix}correct`) || text.startsWith(`${this.prefix}help`);
42
- }
43
- /**
44
- * Routes a command to the appropriate handler.
45
- */
46
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
47
- async handle(ctx, text, client) {
48
- const threadTs = ctx.threadTs ?? ctx.messageTs;
49
- const slug = this.agent.slug;
50
- const postReply = async (msg) => {
51
- await client.chat.postMessage({
52
- channel: ctx.channelId,
53
- thread_ts: threadTs,
54
- text: msg,
55
- });
56
- };
57
- // {slug}:help
58
- if (text === `${this.prefix}help`) {
59
- await postReply(`*${this.agent.name} Commands*\n\n` +
60
- `\u2022 \`${slug}:correct <text>\` \u2014 Add a correction rule\n` +
61
- `\u2022 \`${slug}:corrections\` \u2014 View all stored corrections\n` +
62
- `\u2022 \`${slug}:corrections remove <N>\` \u2014 Remove correction #N\n` +
63
- `\u2022 \`${slug}:help\` \u2014 Show this help message`);
64
- return;
65
- }
66
- // {slug}:corrections (show all)
67
- if (text === `${this.prefix}corrections` || text === `${this.prefix}correction`) {
68
- return this.handleShow(postReply);
69
- }
70
- // {slug}:corrections remove N
71
- const removePrefix = `${this.prefix}corrections remove `;
72
- if (text.startsWith(removePrefix)) {
73
- const numStr = text.slice(removePrefix.length).trim();
74
- const num = parseInt(numStr, 10);
75
- if (isNaN(num) || num < 1) {
76
- await postReply(`Usage: \`${slug}:corrections remove <number>\``);
77
- return;
78
- }
79
- return this.handleRemove(ctx, num, postReply);
80
- }
81
- // {slug}:correct <text>
82
- const correctPrefix = `${this.prefix}correct `;
83
- if (text.startsWith(correctPrefix)) {
84
- const correctionText = text.slice(correctPrefix.length).trim();
85
- if (!correctionText) {
86
- await postReply(`Usage: \`${slug}:correct <correction text>\``);
87
- return;
88
- }
89
- return this.handleAdd(ctx, correctionText, client, postReply);
90
- }
91
- // Unrecognized {slug}: command
92
- await postReply(`Available commands:\n` +
93
- `\u2022 \`${slug}:correct <text>\` \u2014 Add a correction\n` +
94
- `\u2022 \`${slug}:corrections\` \u2014 Show current corrections\n` +
95
- `\u2022 \`${slug}:corrections remove <N>\` \u2014 Remove correction #N`);
96
- }
97
- isAuthorized(userId) {
98
- if (this.reviewerAllowlist.length === 0)
99
- return true;
100
- return this.reviewerAllowlist.includes(userId);
101
- }
102
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
103
- async fetchThreadContext(client, channelId, threadTs) {
104
- try {
105
- const result = await client.conversations.replies({
106
- channel: channelId,
107
- ts: threadTs,
108
- limit: 20,
109
- });
110
- const messages = result.messages ?? [];
111
- if (messages.length < 2)
112
- return undefined;
113
- const userQuestion = (messages[0].text || '').substring(0, 500);
114
- const botReplyText = messages[1].text || '';
115
- const sqlMatch = botReplyText.match(/```sql[\s\S]*?```/);
116
- const botExcerpt = sqlMatch
117
- ? sqlMatch[0].substring(0, 800)
118
- : botReplyText.substring(0, 500);
119
- return `User question: "${userQuestion}"\nBot answer (excerpt): ${botExcerpt}`;
120
- }
121
- catch (error) {
122
- this.log.error('Failed to fetch thread context', { error });
123
- return undefined;
124
- }
125
- }
126
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
127
- async handleAdd(ctx, correctionText, client, postReply) {
128
- if (!this.isAuthorized(ctx.userId)) {
129
- await postReply("You don't have permission to submit corrections.");
130
- return;
131
- }
132
- this.log.info('Processing correction', { user: ctx.userId, text: correctionText.substring(0, 100) });
133
- await postReply('_Processing correction..._');
134
- let threadContext;
135
- if (ctx.threadTs) {
136
- threadContext = await this.fetchThreadContext(client, ctx.channelId, ctx.threadTs);
137
- }
138
- const result = await this.correctionManager.addCorrection(correctionText, ctx.userId, threadContext);
139
- const emoji = result.success ? ':white_check_mark:' : ':warning:';
140
- await postReply(`${emoji} ${result.message}`);
141
- }
142
- async handleShow(postReply) {
143
- const raw = await this.correctionManager.getRaw();
144
- if (!raw) {
145
- await postReply('No corrections on file.');
146
- return;
147
- }
148
- const count = await this.correctionManager.getCount();
149
- await postReply(`*Current Corrections* (${count}/${MAX_CORRECTIONS}):\n\n${raw}`);
150
- }
151
- async handleRemove(ctx, index, postReply) {
152
- if (!this.isAuthorized(ctx.userId)) {
153
- await postReply("You don't have permission to modify corrections.");
154
- return;
155
- }
156
- const result = await this.correctionManager.removeCorrection(index);
157
- const emoji = result.success ? ':white_check_mark:' : ':warning:';
158
- await postReply(`${emoji} ${result.message}`);
159
- }
160
- }
161
- exports.CorrectionHandler = CorrectionHandler;
162
- //# sourceMappingURL=correction-handler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"correction-handler.js","sourceRoot":"","sources":["../src/correction-handler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAGH,6DAAyD;AACzD,qCAAuC;AAEvC,MAAM,eAAe,GAAG,EAAE,CAAC;AAS3B,MAAa,iBAAiB;IACpB,iBAAiB,CAAoB;IACrC,KAAK,CAAQ;IACb,MAAM,CAAS;IACf,iBAAiB,CAAW;IAC5B,GAAG,CAAC;IAEZ,YAAY,KAAY;QACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,GAAG,CAAC;QAC/B,IAAI,CAAC,iBAAiB,GAAG,IAAI,sCAAiB,CAAC,KAAK,CAAC,CAAC;QACtD,IAAI,CAAC,iBAAiB,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7F,IAAI,CAAC,GAAG,GAAG,IAAA,oBAAW,EAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAED;;;OAGG;IACH,SAAS,CAAC,IAAY;QACpB,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,MAAM,SAAS,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,MAAM,MAAM,CAAC,CAAC;IAC3F,CAAC;IAED;;OAEG;IACH,8DAA8D;IAC9D,KAAK,CAAC,MAAM,CAAC,GAAiB,EAAE,IAAY,EAAE,MAAW;QACvD,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,SAAS,CAAC;QAC/C,MAAM,IAA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E,MAAM,SAAS,CAAC,GAAG,KAAK,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IAChD,CAAC;CACF;AAhKD,8CAgKC"}
@@ -1,53 +0,0 @@
1
- /**
2
- * @fileoverview Generic correction manager for any SlackHive agent.
3
- *
4
- * Corrections are stored as a skill in the database (category: '99-corrections',
5
- * filename: 'corrections.md') so they:
6
- * - Persist across container restarts (Postgres)
7
- * - Are visible/editable in the SlackHive web UI Skills tab
8
- * - Are automatically compiled into the agent's CLAUDE.md
9
- *
10
- * Uses Claude to intelligently consolidate new corrections (dedup, categorize).
11
- *
12
- * Adapted from nlq-claude-slack-bot/src/correction-manager.ts.
13
- * Key changes: flat file -> Postgres skill, NLQ-specific -> generic agent.
14
- *
15
- * @module runner/correction-manager
16
- */
17
- import type { Agent } from '@slackhive/shared';
18
- export interface AddResult {
19
- success: boolean;
20
- message: string;
21
- count: number;
22
- }
23
- export declare class CorrectionManager {
24
- private agent;
25
- private log;
26
- private writeChain;
27
- constructor(agent: Agent);
28
- /**
29
- * Reads the current corrections content from the database.
30
- */
31
- readCorrections(): Promise<string>;
32
- /**
33
- * Counts the number of corrections (lines starting with digits followed by a dot).
34
- */
35
- getCount(): Promise<number>;
36
- /**
37
- * Adds a new correction, using Claude to consolidate and deduplicate.
38
- * Serializes writes to prevent race conditions.
39
- */
40
- addCorrection(text: string, reviewerId: string, threadContext?: string): Promise<AddResult>;
41
- private _addCorrection;
42
- /**
43
- * Removes a correction by its number and renumbers the rest.
44
- */
45
- removeCorrection(index: number): Promise<{
46
- success: boolean;
47
- message: string;
48
- }>;
49
- /**
50
- * Returns the raw corrections content.
51
- */
52
- getRaw(): Promise<string>;
53
- }