@aitne/daemon 0.1.3 → 0.1.6

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 (421) hide show
  1. package/dist/adapters/notification-manager.d.ts +12 -0
  2. package/dist/adapters/notification-manager.d.ts.map +1 -1
  3. package/dist/adapters/notification-manager.js +39 -1
  4. package/dist/adapters/notification-manager.js.map +1 -1
  5. package/dist/adapters/whatsapp-adapter.d.ts.map +1 -1
  6. package/dist/adapters/whatsapp-adapter.js +0 -1
  7. package/dist/adapters/whatsapp-adapter.js.map +1 -1
  8. package/dist/api/integration-route-gate.d.ts +15 -11
  9. package/dist/api/integration-route-gate.d.ts.map +1 -1
  10. package/dist/api/integration-route-gate.js +60 -23
  11. package/dist/api/integration-route-gate.js.map +1 -1
  12. package/dist/api/json-body.d.ts +22 -7
  13. package/dist/api/json-body.d.ts.map +1 -1
  14. package/dist/api/json-body.js +27 -8
  15. package/dist/api/json-body.js.map +1 -1
  16. package/dist/api/routes/agent.d.ts.map +1 -1
  17. package/dist/api/routes/agent.js +25 -0
  18. package/dist/api/routes/agent.js.map +1 -1
  19. package/dist/api/routes/backends.d.ts.map +1 -1
  20. package/dist/api/routes/backends.js +96 -1
  21. package/dist/api/routes/backends.js.map +1 -1
  22. package/dist/api/routes/books.js +1 -1
  23. package/dist/api/routes/books.js.map +1 -1
  24. package/dist/api/routes/commands.d.ts.map +1 -1
  25. package/dist/api/routes/commands.js +16 -13
  26. package/dist/api/routes/commands.js.map +1 -1
  27. package/dist/api/routes/context.d.ts.map +1 -1
  28. package/dist/api/routes/context.js +26 -3
  29. package/dist/api/routes/context.js.map +1 -1
  30. package/dist/api/routes/dashboard.d.ts.map +1 -1
  31. package/dist/api/routes/dashboard.js +103 -5
  32. package/dist/api/routes/dashboard.js.map +1 -1
  33. package/dist/api/routes/fs.d.ts +23 -0
  34. package/dist/api/routes/fs.d.ts.map +1 -0
  35. package/dist/api/routes/fs.js +156 -0
  36. package/dist/api/routes/fs.js.map +1 -0
  37. package/dist/api/routes/fs.logic.d.ts +62 -0
  38. package/dist/api/routes/fs.logic.d.ts.map +1 -0
  39. package/dist/api/routes/fs.logic.js +137 -0
  40. package/dist/api/routes/fs.logic.js.map +1 -0
  41. package/dist/api/routes/github.d.ts.map +1 -1
  42. package/dist/api/routes/github.js +38 -5
  43. package/dist/api/routes/github.js.map +1 -1
  44. package/dist/api/routes/health.d.ts.map +1 -1
  45. package/dist/api/routes/health.js +4 -2
  46. package/dist/api/routes/health.js.map +1 -1
  47. package/dist/api/routes/integrations.d.ts +35 -6
  48. package/dist/api/routes/integrations.d.ts.map +1 -1
  49. package/dist/api/routes/integrations.js +192 -15
  50. package/dist/api/routes/integrations.js.map +1 -1
  51. package/dist/api/routes/mail.d.ts.map +1 -1
  52. package/dist/api/routes/mail.js +112 -46
  53. package/dist/api/routes/mail.js.map +1 -1
  54. package/dist/api/routes/metrics.d.ts +1 -0
  55. package/dist/api/routes/metrics.d.ts.map +1 -1
  56. package/dist/api/routes/metrics.js +24 -0
  57. package/dist/api/routes/metrics.js.map +1 -1
  58. package/dist/api/routes/observations.d.ts.map +1 -1
  59. package/dist/api/routes/observations.js +696 -30
  60. package/dist/api/routes/observations.js.map +1 -1
  61. package/dist/api/routes/setup-migrate.d.ts +9 -1
  62. package/dist/api/routes/setup-migrate.d.ts.map +1 -1
  63. package/dist/api/routes/setup-migrate.js +4 -2
  64. package/dist/api/routes/setup-migrate.js.map +1 -1
  65. package/dist/api/routes/skills.d.ts +9 -1
  66. package/dist/api/routes/skills.d.ts.map +1 -1
  67. package/dist/api/routes/skills.js +77 -17
  68. package/dist/api/routes/skills.js.map +1 -1
  69. package/dist/api/routes/voice.d.ts.map +1 -1
  70. package/dist/api/routes/voice.js +62 -4
  71. package/dist/api/routes/voice.js.map +1 -1
  72. package/dist/api/routes/wiki.d.ts +4 -0
  73. package/dist/api/routes/wiki.d.ts.map +1 -0
  74. package/dist/api/routes/wiki.js +1075 -0
  75. package/dist/api/routes/wiki.js.map +1 -0
  76. package/dist/api/server.d.ts +13 -0
  77. package/dist/api/server.d.ts.map +1 -1
  78. package/dist/api/server.js +27 -1
  79. package/dist/api/server.js.map +1 -1
  80. package/dist/bootstrap/adapters.d.ts +109 -0
  81. package/dist/bootstrap/adapters.d.ts.map +1 -0
  82. package/dist/bootstrap/adapters.js +237 -0
  83. package/dist/bootstrap/adapters.js.map +1 -0
  84. package/dist/bootstrap/catchup.d.ts +23 -0
  85. package/dist/bootstrap/catchup.d.ts.map +1 -0
  86. package/dist/bootstrap/catchup.js +124 -0
  87. package/dist/bootstrap/catchup.js.map +1 -0
  88. package/dist/bootstrap/schedule-helpers.d.ts +18 -0
  89. package/dist/bootstrap/schedule-helpers.d.ts.map +1 -0
  90. package/dist/bootstrap/schedule-helpers.js +96 -0
  91. package/dist/bootstrap/schedule-helpers.js.map +1 -0
  92. package/dist/bootstrap/services.d.ts +60 -0
  93. package/dist/bootstrap/services.d.ts.map +1 -0
  94. package/dist/bootstrap/services.js +209 -0
  95. package/dist/bootstrap/services.js.map +1 -0
  96. package/dist/config.d.ts.map +1 -1
  97. package/dist/config.js +26 -0
  98. package/dist/config.js.map +1 -1
  99. package/dist/core/agent-core.d.ts +25 -0
  100. package/dist/core/agent-core.d.ts.map +1 -1
  101. package/dist/core/agent-core.js.map +1 -1
  102. package/dist/core/backends/backend-router.d.ts +28 -1
  103. package/dist/core/backends/backend-router.d.ts.map +1 -1
  104. package/dist/core/backends/backend-router.js +58 -4
  105. package/dist/core/backends/backend-router.js.map +1 -1
  106. package/dist/core/backends/claude-auth.d.ts +70 -0
  107. package/dist/core/backends/claude-auth.d.ts.map +1 -0
  108. package/dist/core/backends/claude-auth.js +198 -0
  109. package/dist/core/backends/claude-auth.js.map +1 -0
  110. package/dist/core/backends/claude-code-core.d.ts +47 -119
  111. package/dist/core/backends/claude-code-core.d.ts.map +1 -1
  112. package/dist/core/backends/claude-code-core.js +166 -1561
  113. package/dist/core/backends/claude-code-core.js.map +1 -1
  114. package/dist/core/backends/claude-delegated.d.ts +86 -0
  115. package/dist/core/backends/claude-delegated.d.ts.map +1 -0
  116. package/dist/core/backends/claude-delegated.js +801 -0
  117. package/dist/core/backends/claude-delegated.js.map +1 -0
  118. package/dist/core/backends/claude-errors.d.ts +39 -0
  119. package/dist/core/backends/claude-errors.d.ts.map +1 -0
  120. package/dist/core/backends/claude-errors.js +71 -0
  121. package/dist/core/backends/claude-errors.js.map +1 -0
  122. package/dist/core/backends/claude-probe.d.ts +103 -0
  123. package/dist/core/backends/claude-probe.d.ts.map +1 -0
  124. package/dist/core/backends/claude-probe.js +336 -0
  125. package/dist/core/backends/claude-probe.js.map +1 -0
  126. package/dist/core/backends/claude-tool-collection.d.ts +135 -0
  127. package/dist/core/backends/claude-tool-collection.d.ts.map +1 -0
  128. package/dist/core/backends/claude-tool-collection.js +1093 -0
  129. package/dist/core/backends/claude-tool-collection.js.map +1 -0
  130. package/dist/core/backends/codex-core.d.ts.map +1 -1
  131. package/dist/core/backends/codex-core.js +36 -0
  132. package/dist/core/backends/codex-core.js.map +1 -1
  133. package/dist/core/backends/gemini-cli-core.d.ts +45 -5
  134. package/dist/core/backends/gemini-cli-core.d.ts.map +1 -1
  135. package/dist/core/backends/gemini-cli-core.js +146 -36
  136. package/dist/core/backends/gemini-cli-core.js.map +1 -1
  137. package/dist/core/backends/plan-presets.d.ts +3 -1
  138. package/dist/core/backends/plan-presets.d.ts.map +1 -1
  139. package/dist/core/backends/plan-presets.js +42 -2
  140. package/dist/core/backends/plan-presets.js.map +1 -1
  141. package/dist/core/backends/prompt-utils.d.ts +1 -0
  142. package/dist/core/backends/prompt-utils.d.ts.map +1 -1
  143. package/dist/core/backends/prompt-utils.js +60 -3
  144. package/dist/core/backends/prompt-utils.js.map +1 -1
  145. package/dist/core/bang-commands/commands-help.d.ts +5 -0
  146. package/dist/core/bang-commands/commands-help.d.ts.map +1 -0
  147. package/dist/core/bang-commands/commands-help.js +69 -0
  148. package/dist/core/bang-commands/commands-help.js.map +1 -0
  149. package/dist/core/bang-commands/commands-wiki.d.ts +75 -0
  150. package/dist/core/bang-commands/commands-wiki.d.ts.map +1 -0
  151. package/dist/core/bang-commands/commands-wiki.js +574 -0
  152. package/dist/core/bang-commands/commands-wiki.js.map +1 -0
  153. package/dist/core/bang-commands/index.d.ts +4 -2
  154. package/dist/core/bang-commands/index.d.ts.map +1 -1
  155. package/dist/core/bang-commands/index.js +15 -1
  156. package/dist/core/bang-commands/index.js.map +1 -1
  157. package/dist/core/bang-commands/registry.d.ts +47 -4
  158. package/dist/core/bang-commands/registry.d.ts.map +1 -1
  159. package/dist/core/bang-commands/registry.js +85 -15
  160. package/dist/core/bang-commands/registry.js.map +1 -1
  161. package/dist/core/context-builder.d.ts +53 -12
  162. package/dist/core/context-builder.d.ts.map +1 -1
  163. package/dist/core/context-builder.js +240 -92
  164. package/dist/core/context-builder.js.map +1 -1
  165. package/dist/core/daemon-api-cli.d.ts.map +1 -1
  166. package/dist/core/daemon-api-cli.js +50 -2
  167. package/dist/core/daemon-api-cli.js.map +1 -1
  168. package/dist/core/dispatcher-date-utils.d.ts +49 -0
  169. package/dist/core/dispatcher-date-utils.d.ts.map +1 -0
  170. package/dist/core/dispatcher-date-utils.js +132 -0
  171. package/dist/core/dispatcher-date-utils.js.map +1 -0
  172. package/dist/core/dispatcher-error-handling.d.ts +159 -0
  173. package/dist/core/dispatcher-error-handling.d.ts.map +1 -0
  174. package/dist/core/dispatcher-error-handling.js +393 -0
  175. package/dist/core/dispatcher-error-handling.js.map +1 -0
  176. package/dist/core/dispatcher-hourly-check.d.ts +150 -0
  177. package/dist/core/dispatcher-hourly-check.d.ts.map +1 -0
  178. package/dist/core/dispatcher-hourly-check.js +665 -0
  179. package/dist/core/dispatcher-hourly-check.js.map +1 -0
  180. package/dist/core/dispatcher-message-handler.d.ts +170 -0
  181. package/dist/core/dispatcher-message-handler.d.ts.map +1 -0
  182. package/dist/core/dispatcher-message-handler.js +1064 -0
  183. package/dist/core/dispatcher-message-handler.js.map +1 -0
  184. package/dist/core/dispatcher-morning-routine.d.ts +169 -0
  185. package/dist/core/dispatcher-morning-routine.d.ts.map +1 -0
  186. package/dist/core/dispatcher-morning-routine.js +449 -0
  187. package/dist/core/dispatcher-morning-routine.js.map +1 -0
  188. package/dist/core/dispatcher-prompt.d.ts +107 -0
  189. package/dist/core/dispatcher-prompt.d.ts.map +1 -0
  190. package/dist/core/dispatcher-prompt.js +227 -0
  191. package/dist/core/dispatcher-prompt.js.map +1 -0
  192. package/dist/core/dispatcher-repository-helpers.d.ts +39 -0
  193. package/dist/core/dispatcher-repository-helpers.d.ts.map +1 -0
  194. package/dist/core/dispatcher-repository-helpers.js +86 -0
  195. package/dist/core/dispatcher-repository-helpers.js.map +1 -0
  196. package/dist/core/dispatcher-result-processor.d.ts +168 -0
  197. package/dist/core/dispatcher-result-processor.d.ts.map +1 -0
  198. package/dist/core/dispatcher-result-processor.js +533 -0
  199. package/dist/core/dispatcher-result-processor.js.map +1 -0
  200. package/dist/core/dispatcher-scheduled-tasks.d.ts +406 -0
  201. package/dist/core/dispatcher-scheduled-tasks.d.ts.map +1 -0
  202. package/dist/core/dispatcher-scheduled-tasks.js +1032 -0
  203. package/dist/core/dispatcher-scheduled-tasks.js.map +1 -0
  204. package/dist/core/dispatcher-types.d.ts +411 -0
  205. package/dist/core/dispatcher-types.d.ts.map +1 -0
  206. package/dist/core/dispatcher-types.js +106 -0
  207. package/dist/core/dispatcher-types.js.map +1 -0
  208. package/dist/core/dispatcher.d.ts +122 -610
  209. package/dist/core/dispatcher.d.ts.map +1 -1
  210. package/dist/core/dispatcher.js +365 -3521
  211. package/dist/core/dispatcher.js.map +1 -1
  212. package/dist/core/integration-health.d.ts +18 -10
  213. package/dist/core/integration-health.d.ts.map +1 -1
  214. package/dist/core/integration-health.js +31 -1
  215. package/dist/core/integration-health.js.map +1 -1
  216. package/dist/core/integration-lifecycle.d.ts +65 -0
  217. package/dist/core/integration-lifecycle.d.ts.map +1 -1
  218. package/dist/core/integration-lifecycle.js +163 -14
  219. package/dist/core/integration-lifecycle.js.map +1 -1
  220. package/dist/core/integration-main-backend.d.ts +40 -0
  221. package/dist/core/integration-main-backend.d.ts.map +1 -1
  222. package/dist/core/integration-main-backend.js +89 -2
  223. package/dist/core/integration-main-backend.js.map +1 -1
  224. package/dist/core/management-md.d.ts +51 -17
  225. package/dist/core/management-md.d.ts.map +1 -1
  226. package/dist/core/management-md.js +233 -56
  227. package/dist/core/management-md.js.map +1 -1
  228. package/dist/core/metrics.d.ts +127 -0
  229. package/dist/core/metrics.d.ts.map +1 -1
  230. package/dist/core/metrics.js +256 -1
  231. package/dist/core/metrics.js.map +1 -1
  232. package/dist/core/output-language-policy.d.ts +74 -0
  233. package/dist/core/output-language-policy.d.ts.map +1 -0
  234. package/dist/core/output-language-policy.js +194 -0
  235. package/dist/core/output-language-policy.js.map +1 -0
  236. package/dist/core/prompts.d.ts +3 -1
  237. package/dist/core/prompts.d.ts.map +1 -1
  238. package/dist/core/prompts.js +161 -3
  239. package/dist/core/prompts.js.map +1 -1
  240. package/dist/core/repository-management-docs.d.ts +24 -0
  241. package/dist/core/repository-management-docs.d.ts.map +1 -1
  242. package/dist/core/repository-management-docs.js +210 -26
  243. package/dist/core/repository-management-docs.js.map +1 -1
  244. package/dist/core/roadmap-validate.js +13 -1
  245. package/dist/core/roadmap-validate.js.map +1 -1
  246. package/dist/core/routine-acquisition-plan.d.ts +182 -0
  247. package/dist/core/routine-acquisition-plan.d.ts.map +1 -0
  248. package/dist/core/routine-acquisition-plan.js +367 -0
  249. package/dist/core/routine-acquisition-plan.js.map +1 -0
  250. package/dist/core/routine-fetch-window-retry.d.ts +109 -0
  251. package/dist/core/routine-fetch-window-retry.d.ts.map +1 -0
  252. package/dist/core/routine-fetch-window-retry.js +210 -0
  253. package/dist/core/routine-fetch-window-retry.js.map +1 -0
  254. package/dist/core/routine-fetch-window-runner.d.ts +427 -0
  255. package/dist/core/routine-fetch-window-runner.d.ts.map +1 -0
  256. package/dist/core/routine-fetch-window-runner.js +1591 -0
  257. package/dist/core/routine-fetch-window-runner.js.map +1 -0
  258. package/dist/core/routine-windows.d.ts +171 -0
  259. package/dist/core/routine-windows.d.ts.map +1 -0
  260. package/dist/core/routine-windows.js +377 -0
  261. package/dist/core/routine-windows.js.map +1 -0
  262. package/dist/core/scheduler.d.ts +50 -2
  263. package/dist/core/scheduler.d.ts.map +1 -1
  264. package/dist/core/scheduler.js +88 -7
  265. package/dist/core/scheduler.js.map +1 -1
  266. package/dist/core/skill-curation/declarations.d.ts.map +1 -1
  267. package/dist/core/skill-curation/declarations.js +11 -12
  268. package/dist/core/skill-curation/declarations.js.map +1 -1
  269. package/dist/core/skill-source-paths.d.ts +14 -0
  270. package/dist/core/skill-source-paths.d.ts.map +1 -0
  271. package/dist/core/skill-source-paths.js +82 -0
  272. package/dist/core/skill-source-paths.js.map +1 -0
  273. package/dist/core/skills-compiler.d.ts +29 -0
  274. package/dist/core/skills-compiler.d.ts.map +1 -1
  275. package/dist/core/skills-compiler.js +166 -30
  276. package/dist/core/skills-compiler.js.map +1 -1
  277. package/dist/core/skills-manifest.d.ts.map +1 -1
  278. package/dist/core/skills-manifest.js +72 -0
  279. package/dist/core/skills-manifest.js.map +1 -1
  280. package/dist/core/system-reset.d.ts +25 -0
  281. package/dist/core/system-reset.d.ts.map +1 -1
  282. package/dist/core/system-reset.js +72 -2
  283. package/dist/core/system-reset.js.map +1 -1
  284. package/dist/core/wiki/approval-queue.d.ts +31 -0
  285. package/dist/core/wiki/approval-queue.d.ts.map +1 -0
  286. package/dist/core/wiki/approval-queue.js +44 -0
  287. package/dist/core/wiki/approval-queue.js.map +1 -0
  288. package/dist/core/wiki/bridge.d.ts +74 -0
  289. package/dist/core/wiki/bridge.d.ts.map +1 -0
  290. package/dist/core/wiki/bridge.js +405 -0
  291. package/dist/core/wiki/bridge.js.map +1 -0
  292. package/dist/core/wiki/compile-lock.d.ts +42 -0
  293. package/dist/core/wiki/compile-lock.d.ts.map +1 -0
  294. package/dist/core/wiki/compile-lock.js +55 -0
  295. package/dist/core/wiki/compile-lock.js.map +1 -0
  296. package/dist/core/wiki/compile-preview.d.ts +8 -0
  297. package/dist/core/wiki/compile-preview.d.ts.map +1 -0
  298. package/dist/core/wiki/compile-preview.js +200 -0
  299. package/dist/core/wiki/compile-preview.js.map +1 -0
  300. package/dist/core/wiki/cost-estimate.d.ts +30 -0
  301. package/dist/core/wiki/cost-estimate.d.ts.map +1 -0
  302. package/dist/core/wiki/cost-estimate.js +243 -0
  303. package/dist/core/wiki/cost-estimate.js.map +1 -0
  304. package/dist/core/wiki/dispatcher.d.ts +48 -0
  305. package/dist/core/wiki/dispatcher.d.ts.map +1 -0
  306. package/dist/core/wiki/dispatcher.js +92 -0
  307. package/dist/core/wiki/dispatcher.js.map +1 -0
  308. package/dist/core/wiki/git-precompile.d.ts +86 -0
  309. package/dist/core/wiki/git-precompile.d.ts.map +1 -0
  310. package/dist/core/wiki/git-precompile.js +96 -0
  311. package/dist/core/wiki/git-precompile.js.map +1 -0
  312. package/dist/core/wiki/import-migrate.d.ts +38 -0
  313. package/dist/core/wiki/import-migrate.d.ts.map +1 -0
  314. package/dist/core/wiki/import-migrate.js +310 -0
  315. package/dist/core/wiki/import-migrate.js.map +1 -0
  316. package/dist/core/wiki/import-probe.d.ts +76 -0
  317. package/dist/core/wiki/import-probe.d.ts.map +1 -0
  318. package/dist/core/wiki/import-probe.js +245 -0
  319. package/dist/core/wiki/import-probe.js.map +1 -0
  320. package/dist/core/wiki/index-cache.d.ts +39 -0
  321. package/dist/core/wiki/index-cache.d.ts.map +1 -0
  322. package/dist/core/wiki/index-cache.js +152 -0
  323. package/dist/core/wiki/index-cache.js.map +1 -0
  324. package/dist/core/wiki/multi-url-dispatch.d.ts +52 -0
  325. package/dist/core/wiki/multi-url-dispatch.d.ts.map +1 -0
  326. package/dist/core/wiki/multi-url-dispatch.js +72 -0
  327. package/dist/core/wiki/multi-url-dispatch.js.map +1 -0
  328. package/dist/core/wiki/wiki-fts.d.ts +75 -0
  329. package/dist/core/wiki/wiki-fts.d.ts.map +1 -0
  330. package/dist/core/wiki/wiki-fts.js +265 -0
  331. package/dist/core/wiki/wiki-fts.js.map +1 -0
  332. package/dist/core/wiki/workspaces.d.ts +101 -0
  333. package/dist/core/wiki/workspaces.d.ts.map +1 -0
  334. package/dist/core/wiki/workspaces.js +352 -0
  335. package/dist/core/wiki/workspaces.js.map +1 -0
  336. package/dist/core/wiki/write-strategy.d.ts +70 -0
  337. package/dist/core/wiki/write-strategy.d.ts.map +1 -0
  338. package/dist/core/wiki/write-strategy.js +112 -0
  339. package/dist/core/wiki/write-strategy.js.map +1 -0
  340. package/dist/core/workdir.d.ts +8 -1
  341. package/dist/core/workdir.d.ts.map +1 -1
  342. package/dist/core/workdir.js +4 -1
  343. package/dist/core/workdir.js.map +1 -1
  344. package/dist/db/observations.d.ts +45 -2
  345. package/dist/db/observations.d.ts.map +1 -1
  346. package/dist/db/observations.js +112 -14
  347. package/dist/db/observations.js.map +1 -1
  348. package/dist/db/schema.d.ts.map +1 -1
  349. package/dist/db/schema.js +135 -25
  350. package/dist/db/schema.js.map +1 -1
  351. package/dist/db/wiki-store.d.ts +3 -0
  352. package/dist/db/wiki-store.d.ts.map +1 -0
  353. package/dist/db/wiki-store.js +7 -0
  354. package/dist/db/wiki-store.js.map +1 -0
  355. package/dist/index.js +159 -610
  356. package/dist/index.js.map +1 -1
  357. package/dist/messaging/url-extract.d.ts +8 -0
  358. package/dist/messaging/url-extract.d.ts.map +1 -0
  359. package/dist/messaging/url-extract.js +41 -0
  360. package/dist/messaging/url-extract.js.map +1 -0
  361. package/dist/observers/delegated-sync-worker.d.ts +52 -1
  362. package/dist/observers/delegated-sync-worker.d.ts.map +1 -1
  363. package/dist/observers/delegated-sync-worker.js +75 -18
  364. package/dist/observers/delegated-sync-worker.js.map +1 -1
  365. package/dist/observers/imminent-event-scheduler.d.ts +20 -7
  366. package/dist/observers/imminent-event-scheduler.d.ts.map +1 -1
  367. package/dist/observers/imminent-event-scheduler.js +134 -29
  368. package/dist/observers/imminent-event-scheduler.js.map +1 -1
  369. package/dist/observers/mail-poller.d.ts +12 -5
  370. package/dist/observers/mail-poller.d.ts.map +1 -1
  371. package/dist/observers/mail-poller.js +36 -14
  372. package/dist/observers/mail-poller.js.map +1 -1
  373. package/dist/observers/manager.d.ts +37 -5
  374. package/dist/observers/manager.d.ts.map +1 -1
  375. package/dist/observers/manager.js +28 -10
  376. package/dist/observers/manager.js.map +1 -1
  377. package/dist/safety/always-disallowed.d.ts +65 -0
  378. package/dist/safety/always-disallowed.d.ts.map +1 -1
  379. package/dist/safety/always-disallowed.js +106 -10
  380. package/dist/safety/always-disallowed.js.map +1 -1
  381. package/dist/safety/audit.d.ts +46 -1
  382. package/dist/safety/audit.d.ts.map +1 -1
  383. package/dist/safety/audit.js +79 -16
  384. package/dist/safety/audit.js.map +1 -1
  385. package/dist/safety/risk-classifier.d.ts.map +1 -1
  386. package/dist/safety/risk-classifier.js +29 -0
  387. package/dist/safety/risk-classifier.js.map +1 -1
  388. package/dist/services/delegated-backend-invoker.d.ts +1 -51
  389. package/dist/services/delegated-backend-invoker.d.ts.map +1 -1
  390. package/dist/services/delegated-backend-invoker.js +41 -480
  391. package/dist/services/delegated-backend-invoker.js.map +1 -1
  392. package/dist/services/delegated-invoker-audit.d.ts +94 -0
  393. package/dist/services/delegated-invoker-audit.d.ts.map +1 -0
  394. package/dist/services/delegated-invoker-audit.js +238 -0
  395. package/dist/services/delegated-invoker-audit.js.map +1 -0
  396. package/dist/services/delegated-invoker-cache-hits.d.ts +34 -0
  397. package/dist/services/delegated-invoker-cache-hits.d.ts.map +1 -0
  398. package/dist/services/delegated-invoker-cache-hits.js +104 -0
  399. package/dist/services/delegated-invoker-cache-hits.js.map +1 -0
  400. package/dist/services/delegated-invoker-janitors.d.ts +28 -0
  401. package/dist/services/delegated-invoker-janitors.d.ts.map +1 -0
  402. package/dist/services/delegated-invoker-janitors.js +104 -0
  403. package/dist/services/delegated-invoker-janitors.js.map +1 -0
  404. package/dist/services/delegated-invoker-utils.d.ts +42 -0
  405. package/dist/services/delegated-invoker-utils.d.ts.map +1 -0
  406. package/dist/services/delegated-invoker-utils.js +100 -0
  407. package/dist/services/delegated-invoker-utils.js.map +1 -0
  408. package/dist/services/delegated-task-runtime.d.ts +1 -1
  409. package/dist/services/delegated-task-runtime.js +1 -1
  410. package/dist/services/integrations/snapshot-partitions.d.ts +5 -0
  411. package/dist/services/integrations/snapshot-partitions.d.ts.map +1 -1
  412. package/dist/services/integrations/snapshot-partitions.js +12 -0
  413. package/dist/services/integrations/snapshot-partitions.js.map +1 -1
  414. package/dist/services/voice/transcriber-impl.d.ts.map +1 -1
  415. package/dist/services/voice/transcriber-impl.js +7 -8
  416. package/dist/services/voice/transcriber-impl.js.map +1 -1
  417. package/dist/settings/runtime-settings.d.ts +12 -1
  418. package/dist/settings/runtime-settings.d.ts.map +1 -1
  419. package/dist/settings/runtime-settings.js +59 -1
  420. package/dist/settings/runtime-settings.js.map +1 -1
  421. package/package.json +2 -2
@@ -0,0 +1,406 @@
1
+ /**
2
+ * `ScheduledTaskRunner` — owns every non-message dispatch path that
3
+ * routes through the dispatcher's main `dispatch` switch:
4
+ * - `scheduled.task` (generic + repository run + git project doc +
5
+ * today_refresh + morning-routine retry);
6
+ * - `routine.morning_routine` retries (the wake-task fast path);
7
+ * - `routine.roadmap_refresh` (with the cross-request roadmap write
8
+ * lock + skip-on-conflict semantics);
9
+ * - `routine.skill_curation` (P22 §3.4 — optimizer workdir
10
+ * materialization + hard-clamped tool envelope);
11
+ * - the catch-all `executeDefault` for every routine that doesn't
12
+ * have its own dedicated runner method (today_refresh,
13
+ * evening_review, weekly_review, …).
14
+ *
15
+ * Plus the today.md utilities the morning-routine path consults
16
+ * through callbacks: `rotateDayFiles`, `diagnoseTodayMdState`,
17
+ * `hasCurrentAgentDayTodayMd`.
18
+ *
19
+ * Extracted from `core/dispatcher.ts` as part of phase D-2 of
20
+ * `docs/design/appendices/file-split-plan.md`. Pattern B (stateful
21
+ * coordinator): the runner has no mutable state of its own; it
22
+ * borrows lazy accessors for the dispatcher's optimizer hooks
23
+ * (set by `setSkillCurationHooks` after construction) and bridges
24
+ * back into `MorningRoutineRunner.executeMorningRoutine` when a
25
+ * morning-routine retry wake-task fires.
26
+ *
27
+ * Dispatcher entry points served:
28
+ * - `EventDispatcher.dispatch` switches on event type; each non-
29
+ * message branch now calls into a `runner.X()` method here
30
+ * (`executeScheduledTask`, `executeRoadmapRefresh`,
31
+ * `executeSkillCurationRoutine`, `executeDefault`);
32
+ * - `MorningRoutineRunner` uses `rotateDayFiles` /
33
+ * `diagnoseTodayMdState` via the dep callbacks the dispatcher
34
+ * wires at construction time.
35
+ *
36
+ * Shared-state references held:
37
+ * - `getMaterializeOptimizerWorkdir` / `getTeardownOptimizerWorkdir`
38
+ * — lazy accessors; the optimizer hooks are wired by
39
+ * `setSkillCurationHooks` after the dispatcher is constructed.
40
+ * Reading through the closures means the runner sees the current
41
+ * value at call time.
42
+ * - `roadmapWriteLock` — read-only reference to the dispatcher's
43
+ * write-lock manager. The runner calls `acquire` / `release` but
44
+ * does not own the manager's lifecycle.
45
+ */
46
+ import type Database from "better-sqlite3";
47
+ import type { AgentTaskEvent, BackendId, Event } from "@aitne/shared";
48
+ import type { AgentConfig } from "../config.js";
49
+ import type { IAgentRouter } from "./backends/backend-router.js";
50
+ import type { RoadmapWriteLockManager } from "./roadmap-write-lock.js";
51
+ import type { AgentWriteTracker } from "../safety/agent-write-tracker.js";
52
+ import type { MailAccount } from "../services/mail/provider.js";
53
+ import type { IContextBuilder } from "./dispatcher-types.js";
54
+ import type { PromptAssembler } from "./dispatcher-prompt.js";
55
+ import type { DispatcherErrorRouter } from "./dispatcher-error-handling.js";
56
+ import type { ResultProcessor } from "./dispatcher-result-processor.js";
57
+ import type { MorningRoutineRunner } from "./dispatcher-morning-routine.js";
58
+ import type { RoutineFetchWindowRunner } from "./routine-fetch-window-runner.js";
59
+ import { type RepositoryRunTaskContext } from "./dispatcher-repository-helpers.js";
60
+ /**
61
+ * Mirror of the `MorningRoutineRunner.diagnoseTodayMdState` return
62
+ * shape. Re-declared here because this runner owns the underlying
63
+ * implementation; the morning-routine runner consumes it via the
64
+ * dep callback the dispatcher wires at construction time.
65
+ */
66
+ export type TodayMdState = {
67
+ kind: "fresh";
68
+ } | {
69
+ kind: "missing";
70
+ } | {
71
+ kind: "no_h1_date";
72
+ } | {
73
+ kind: "wrong_date";
74
+ writtenDate: string;
75
+ expectedAgentDay: string;
76
+ };
77
+ /**
78
+ * P22 §3.4 step 4 — the optimizer-only allowedTools envelope. Every
79
+ * `routine.skill_curation` event runs the agent with exactly these tools
80
+ * and nothing else. The curl glob is anchored on the daemon's loopback URL
81
+ * so a hook-bypassed request still hits the curation API's chokepoint
82
+ * (Zod, run-token, smoke test); `Read` is required for the agent to
83
+ * consume the inlined data dump under the workdir's `data/` subtree.
84
+ *
85
+ * Kept narrow on purpose: adding any other tool here widens the optimizer's
86
+ * blast radius. If a future signal source needs the agent to write to a
87
+ * different surface, add a new curation API endpoint and let the curl glob
88
+ * cover it — do NOT add `Bash(*)` or `Write` here.
89
+ */
90
+ export declare const SKILL_CURATION_OPTIMIZER_ALLOWED_TOOLS: readonly ["Read", "Bash(curl http://localhost:8321/api/skill-curation/*)"];
91
+ /**
92
+ * Read-only tool envelope for `git.project.refresh_architecture`. This agent
93
+ * walks the user's local git worktree at `<task_context.localPath>` to compose
94
+ * the `## Architecture` section of `git/<slug>/overview.md`, and lands the
95
+ * result through `PUT /api/repositories/:id/architecture-section` — the one
96
+ * daemon-side chokepoint. Without this clamp the session would inherit
97
+ * `CLAUDE_DEFAULT_ALLOWED_TOOLS` (Write/Edit/`Bash(git *)`/`Bash(curl *)`),
98
+ * which would let a prompt-injected README or a misbehaving turn mutate the
99
+ * user's repository (e.g. `git reset --hard`, `git push --force`, arbitrary
100
+ * `Write` to source files) OR exfiltrate via other Autonomous daemon APIs
101
+ * (`POST /api/notify` to DM the owner with attacker content, `POST
102
+ * /api/observations` to inject fake observations, `PUT /api/obsidian/notes`
103
+ * to overwrite vault notes, etc.). The Architecture analysis itself only
104
+ * needs to *read* the worktree.
105
+ *
106
+ * What is INCLUDED and why:
107
+ * - `Read` / `Glob` / `Grep` — the task-flow's only durable need (README,
108
+ * manifests, source files, design docs). `Glob` covers the literal
109
+ * `ls <localPath>` step without giving the agent shell access.
110
+ * - `Bash(curl http://localhost:8321/api/repositories/*\/architecture-section*)`
111
+ * — endpoint-pinned write path. The SDK's prefix-glob layer forbids the
112
+ * command from reaching ANY other host, port, or daemon-API namespace.
113
+ * The curl PreToolUse hook adds defense-in-depth (rechecks host/port,
114
+ * denies connection-override flags); the API risk classifier supplies
115
+ * the floor (only `PUT .../architecture-section` is Autonomous under
116
+ * `/api/repositories/`; everything else inherits Approve and 401s a
117
+ * tokenless agent curl). Port is hardcoded to the daemon's default
118
+ * `8321` matching the optimizer-clamp convention; operators who change
119
+ * `PA_API_PORT` accept the gap consciously (the same constraint applies
120
+ * to `SKILL_CURATION_OPTIMIZER_ALLOWED_TOOLS`).
121
+ * - `Bash(jq *)` — body construction. The PUT body is
122
+ * `{"markdown":"..."}` and the markdown contains arbitrary characters
123
+ * that must be JSON-escaped; `jq -n --arg md "$body" '{markdown:$md}'`
124
+ * is the only robust escape path under a no-`Write` envelope. The jq
125
+ * hook denies `--slurpfile` / `--rawfile` / `-L` / `env`-filter
126
+ * exfiltration.
127
+ *
128
+ * What is INTENTIONALLY EXCLUDED:
129
+ * - `Write` / `Edit` — would let the agent write anywhere, including the
130
+ * user's checked-out worktree. The chokepoint is the daemon API.
131
+ * - `Bash(git *)` — even read-only verbs let the agent chain into
132
+ * `git push --force`, `git reset --hard`, `git checkout --`, etc. via
133
+ * shell separators; the `always-disallowed.ts` classifier hook catches
134
+ * `rm -rf` / `sudo` / pipe-to-shell but does NOT classify mutating git
135
+ * subcommands. The Architecture analysis doesn't need git CLI:
136
+ * filesystem reads via `Read` / `Glob` suffice for module / data-flow /
137
+ * build / test-surface description.
138
+ * - `Bash(ls *)` — `Glob` covers directory enumeration without shell
139
+ * access.
140
+ * - `Skill` / `WebSearch` — not referenced by the task-flow; smaller
141
+ * surface is better.
142
+ *
143
+ * Defense-in-depth layering:
144
+ * - SDK `allowedTools` (this list) — first gate. Prefix glob forces the
145
+ * curl command to literally begin with the architecture-section URL.
146
+ * - SDK `disallowedTools` — `ALWAYS_DISALLOWED_TOOLS` +
147
+ * `config.disallowedTools` still merge on top.
148
+ * - PreToolUse hooks — curl localhost-only + jq exfil bans + Write/Edit
149
+ * context-dir chokepoint stay armed. `claude-code-core.ts` forces
150
+ * strict hook mode (curl + jq hooks re-enabled) whenever any
151
+ * `allowedToolsOverride` is active, so Allow-mode operators do not
152
+ * inadvertently widen this surface — see the `optimizerClampActive`
153
+ * branch.
154
+ * - Allow mode bypass — `claude-code-core.ts` detects the non-empty
155
+ * `allowedToolsOverride` and forces `permissionMode: "dontAsk"` for
156
+ * this run, stripping `bypassPermissions` even if the operator has
157
+ * Allow mode globally enabled.
158
+ * - API risk classifier — `PUT /api/repositories/:id/architecture-section`
159
+ * is RiskTier.Autonomous (agent-callable, no Bearer required) but
160
+ * enforces marker-bracketed body validation and 64KB size cap
161
+ * server-side. All sibling routes under `/api/repositories/` inherit
162
+ * the blanket Approve tier and 401 a tokenless agent curl.
163
+ *
164
+ * Multi-request defenses (closed in `claude-tool-collection.ts:bashCurlHook`,
165
+ * benefit every clamped session inheriting the curl hook):
166
+ * 1. **Shell-chained second curl** — `curl ARCH_URL ; curl
167
+ * http://localhost:8321/api/notify -d @evil` and the `&&` / `||` /
168
+ * `|` / newline / backtick / `$(…)` variants. The hook counts
169
+ * `curl` tokens anchored at command-start positions (mirroring the
170
+ * `cmdStart` regex in `safety/always-disallowed.ts`) and blocks any
171
+ * command with more than one anchored `curl`. A single
172
+ * `jq -n '{markdown:$md}' | curl URL -d @-` pipeline still counts
173
+ * as ONE curl token and is allowed.
174
+ * 2. **`--next` / `-:` URL multiplexing** — curl's same-process URL
175
+ * separator that resets option state per transaction. Hook-blocked
176
+ * via flag regex (covers `--next`, `--next=URL`, and the `-:`
177
+ * short form).
178
+ * 3. **Multi-positional URLs** — `curl URL1 URL2 -X PUT -d @body`
179
+ * sends identical options to both URLs sequentially. The hook
180
+ * tokenizes the command at the top level (outside paired single /
181
+ * double quotes) and blocks when more than one URL appears as a
182
+ * top-level token. URLs that legitimately appear inside `-d '…'`
183
+ * / `-H "…"` strings — e.g. external links inside the architecture
184
+ * markdown body — are not counted and not host-checked, so the
185
+ * agent can reference external code in its analysis.
186
+ *
187
+ * Per-backend support:
188
+ * - Claude (`ClaudeCodeCore`) — consumes this list verbatim.
189
+ * - Codex / Gemini — no per-execute allowedTools surface today (mirrors
190
+ * `AgentExecuteParams.allowedToolsOverride` JSDoc). The default
191
+ * `process_backend_config` seed binds `git.project.refresh_architecture`
192
+ * to the medium tier (Sonnet), so the realistic risk surface today is
193
+ * Claude-only. An operator who reroutes this process key to a
194
+ * non-Claude backend via `/settings/models` accepts the gap
195
+ * consciously.
196
+ */
197
+ export declare const REFRESH_ARCHITECTURE_ALLOWED_TOOLS: readonly ["Read", "Glob", "Grep", "Bash(curl http://localhost:8321/api/repositories/*/architecture-section*)", "Bash(jq *)"];
198
+ /**
199
+ * Backends that honor the per-execute `allowedToolsOverride` clamp end-to-
200
+ * end. Claude consumes the list verbatim through the SDK's `dontAsk` +
201
+ * `allowedTools` posture and the dispatcher swaps Allow mode back to
202
+ * strict for the run. Codex / Gemini have no per-execute allowedTools
203
+ * surface today (see `AgentExecuteParams.allowedToolsOverride` JSDoc),
204
+ * so the clamp would silently drop and the read-only contract would
205
+ * become a no-op. We refuse-at-execute rather than silently widen the
206
+ * envelope; the operator sees an `agent_actions` row of action_type
207
+ * `scheduled_task_clamp_unsupported` and a clear log line.
208
+ *
209
+ * Add a backend here only after verifying its core threads
210
+ * `allowedToolsOverride` through to its concrete deny enforcement layer
211
+ * — NOT just into the CLI flag set.
212
+ */
213
+ export declare const TOOL_CLAMP_SUPPORTING_BACKENDS: ReadonlySet<BackendId>;
214
+ export interface ScheduledTaskRunnerDeps {
215
+ db: Database.Database;
216
+ config: AgentConfig;
217
+ contextBuilder: IContextBuilder;
218
+ agentRouter: IAgentRouter;
219
+ prompt: PromptAssembler;
220
+ errorRouter: DispatcherErrorRouter;
221
+ resultProcessor: ResultProcessor;
222
+ morningRoutine: MorningRoutineRunner;
223
+ /**
224
+ * ROUTINE_DATA_ACQUISITION_DESIGN.md Phase 4 / D4 — pre-pass runner
225
+ * spawned by `executeDefault` for routine events whose ProcessKey is
226
+ * in `ROUTINE_WINDOWS` (today_refresh / evening_review / weekly_review;
227
+ * monthly_review is registered but has zero rows so the runner
228
+ * short-circuits without dispatching a session). Idempotent against
229
+ * the morning_routine + hourly_check paths: when the upstream
230
+ * dispatcher already attached a `fetchReportBlock`, `executeDefault`
231
+ * skips re-running the pre-pass.
232
+ */
233
+ fetchWindowRunner: RoutineFetchWindowRunner;
234
+ roadmapWriteLock: RoadmapWriteLockManager | undefined;
235
+ writeTracker: AgentWriteTracker | undefined;
236
+ /**
237
+ * Returns the dispatcher's currently-configured "services" the
238
+ * agent's prompt should disclose. Read at call time so the hand-
239
+ * off through index.ts's lazy ServiceRegistry stays correct.
240
+ */
241
+ getConfiguredServices: () => ReadonlySet<string>;
242
+ /**
243
+ * Returns the live mail-account list the workdir materializer
244
+ * should bake into the session.
245
+ */
246
+ getActiveMailAccounts: () => readonly MailAccount[];
247
+ /**
248
+ * Lazy accessor for the optimizer materializer hook. Returns null
249
+ * until `EventDispatcher.setSkillCurationHooks` has been called.
250
+ */
251
+ getMaterializeOptimizerWorkdir: () => ((opts?: {
252
+ manual?: boolean;
253
+ targetSkillsOverride?: string[];
254
+ }) => Promise<{
255
+ runId: string;
256
+ runToken: string;
257
+ workdirPath: string;
258
+ targetSkills: string[];
259
+ }>) | null;
260
+ /** Lazy accessor for the optimizer teardown hook. */
261
+ getTeardownOptimizerWorkdir: () => ((workdirPath: string) => void) | null;
262
+ }
263
+ export declare class ScheduledTaskRunner {
264
+ private readonly db;
265
+ private readonly config;
266
+ private readonly contextBuilder;
267
+ private readonly agentRouter;
268
+ private readonly prompt;
269
+ private readonly errorRouter;
270
+ private readonly resultProcessor;
271
+ private readonly morningRoutine;
272
+ private readonly fetchWindowRunner;
273
+ private readonly roadmapWriteLock;
274
+ private readonly writeTracker;
275
+ private readonly getConfiguredServices;
276
+ private readonly getActiveMailAccounts;
277
+ private readonly getMaterializeOptimizerWorkdir;
278
+ private readonly getTeardownOptimizerWorkdir;
279
+ constructor(deps: ScheduledTaskRunnerDeps);
280
+ buildRepositoryRunPrompt(ctx: RepositoryRunTaskContext): string;
281
+ prepareRepositoryRunSessionDir(ctx: RepositoryRunTaskContext, backendId: BackendId): {
282
+ sessionDir: string;
283
+ cleanup: boolean;
284
+ };
285
+ executeRepositoryRunTask(event: AgentTaskEvent, ctx: RepositoryRunTaskContext): Promise<void>;
286
+ /**
287
+ * Execute a scheduled task with the model specified when the task was
288
+ * registered via POST /api/schedule.
289
+ *
290
+ * Morning-routine retry tasks take a dedicated fast path: they skip
291
+ * the generic scheduled.task prompt and run the *real* morning routine
292
+ * flow via executeMorningRoutine, so the retry carries the same rotateDayFiles
293
+ * / prompt selection / roadmap-refresh chain as the cron-fired path.
294
+ */
295
+ executeScheduledTask(event: AgentTaskEvent): Promise<void>;
296
+ /**
297
+ * Legacy git project documentation tasks used to run as autonomous Claude
298
+ * task-flows. That made file creation probabilistic: the backend could
299
+ * finish "successfully" without calling the daemon context API, or fail
300
+ * before receiving the `<task_context>` block. The daemon now owns these
301
+ * writes directly, matching the manual Daily git management buttons and
302
+ * the repository-management cron.
303
+ */
304
+ private executeGitProjectDocTaskIfApplicable;
305
+ private resolveGitProjectDocProcessKey;
306
+ private resolveRepositoryForGitProjectDocTask;
307
+ private markScheduledTaskCompleted;
308
+ /**
309
+ * Defense-in-depth gate for per-execute tool clamps. When the
310
+ * dispatcher pins an `allowedToolsOverride` for a known-safe envelope
311
+ * (refresh_architecture, skill_curation) the clamp MUST hold; if the
312
+ * router resolves to a backend that ignores per-execute clamps the
313
+ * call would silently widen back to the default tool surface and the
314
+ * read-only contract documented in the clamp's JSDoc would dissolve.
315
+ *
316
+ * Returns `true` when the resolved main backend honors clamps (the
317
+ * caller should pass the override through to `execute`). Returns
318
+ * `false` when the operator has rebound the process key to a backend
319
+ * we cannot trust — the caller bails out of the execute, an
320
+ * `agent_actions` row records the refusal for the audit log, and an
321
+ * error-level log line surfaces the misconfiguration immediately.
322
+ *
323
+ * Implementation note: the audit row uses `result = 'failed'` to
324
+ * match the `blocked_absolute` precedent — the `agent_actions.result`
325
+ * CHECK constraint only permits the canonical settle states
326
+ * (success / failed / partial / skipped / in_progress); a literal
327
+ * `"blocked"` here would silently violate the constraint and the
328
+ * try/catch would swallow the audit. The `action_type` is the
329
+ * discriminator that lets dashboards / queries distinguish a "blocked
330
+ * by clamp" row from a real agent failure.
331
+ */
332
+ private clampSupportedByBackend;
333
+ private executeScheduledRoutine;
334
+ /**
335
+ * Handle a morning-routine retry wake task.
336
+ *
337
+ * Steps:
338
+ * 1. Early skip: if today.md already exists (e.g., the cron-fired
339
+ * morning routine raced us to it), mark this wake task completed
340
+ * without running the agent — saves one Opus session.
341
+ * 2. Synthesize a RoutineEvent with `event.data.retryCount` carrying
342
+ * the current attempt number, so that the recursive
343
+ * scheduleMorningRetry call from executeMorningRoutine can increment the
344
+ * retry chain naturally via the event.data code path.
345
+ * 3. Invoke executeMorningRoutine — this reuses the full morning-routine flow
346
+ * (rotateDayFiles, prompt selection, agent execute, post-result
347
+ * today.md check, roadmap_refresh emission).
348
+ * 4. Mark the wake task row completed. processResult inside the
349
+ * executeMorningRoutine call operates on the synthetic RoutineEvent, which
350
+ * is not an AgentTaskEvent, so it does not touch scheduleId — we
351
+ * must do it ourselves.
352
+ */
353
+ private handleMorningRoutineRetry;
354
+ hasCurrentAgentDayTodayMd(): boolean;
355
+ /**
356
+ * Inspect today.md and report its state relative to the current agent-day.
357
+ * Used by the post-routine retry gate so the log can distinguish between
358
+ * "file is missing" and "file has stale H1 date", which are different
359
+ * failure modes (process crash vs. format-confusion bug).
360
+ */
361
+ diagnoseTodayMdState(): TodayMdState;
362
+ /**
363
+ * Rotate day files before Morning Routine:
364
+ * 1. today.md → schedule/YYYY-MM-DD.md (archive)
365
+ * 2. today.md → yesterday.md (rename for context injection)
366
+ *
367
+ * After this, ContextBuilder will read yesterday.md as <yesterday>
368
+ * and today.md will not exist (agent generates it fresh).
369
+ */
370
+ rotateDayFiles(): void;
371
+ /**
372
+ * Roadmap-refresh execution with an exclusive cross-request write
373
+ * lock. The lockId is surfaced to the session context as
374
+ * `<roadmap_write_lock_id>` so the task-flow PUT / PATCH calls can
375
+ * pass `X-Lock-Id` and other concurrent flows (DM handler, evening
376
+ * sweeper) that attempt to write `/api/context/roadmap` during the
377
+ * refresh receive a 409.
378
+ *
379
+ * If the lock cannot be acquired (another session is mid-write), the
380
+ * refresh is skipped — `emitRoadmapRefresh` will retry on the next
381
+ * qualifying signal (dedup window permitting). This is the correct
382
+ * behaviour: the holder is already producing a fresher roadmap than
383
+ * anything we would emit right now.
384
+ */
385
+ executeRoadmapRefresh(event: Event): Promise<void>;
386
+ /**
387
+ * P22 §3.4 — skill curation routine. Provisions an isolated optimizer
388
+ * workdir, hands the runId + runToken into the agent's task context via
389
+ * `event.data`, and tears the workdir down regardless of success/failure.
390
+ *
391
+ * The standard `executeDefault` path produces the agent session itself —
392
+ * the only differences from a normal routine are: (a) the workdir is the
393
+ * pre-built optimizer dir (built by `materializeOptimizerWorkdir`), and
394
+ * (b) `executeDefault` recognises `routine.skill_curation` events and
395
+ * pins `allowedToolsOverride` to `SKILL_CURATION_OPTIMIZER_ALLOWED_TOOLS`,
396
+ * which the Claude SDK consumes verbatim and which suspends Allow-mode
397
+ * `bypassPermissions`. The curation API's run-token + Zod chokepoint
398
+ * remains the safety floor for the rare case the override is bypassed
399
+ * (e.g. a future backend that doesn't read `allowedTools`).
400
+ */
401
+ executeSkillCurationRoutine(event: Event): Promise<void>;
402
+ executeDefault(event: Event): Promise<void>;
403
+ /** Bridge for `MorningRoutineRunner`'s `formatSqliteDatetime` use. */
404
+ static formatScheduledFor(date: Date): string;
405
+ }
406
+ //# sourceMappingURL=dispatcher-scheduled-tasks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dispatcher-scheduled-tasks.d.ts","sourceRoot":"","sources":["../../src/core/dispatcher-scheduled-tasks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,KAAK,EAGN,MAAM,eAAe,CAAC;AAoBvB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAmBhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAIjF,OAAO,EAOL,KAAK,w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