agentroam-runtime-darwin-arm64 0.2.0-preview.75 → 0.2.0-preview.76

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 (381) hide show
  1. package/manifest.json +2 -2
  2. package/package.json +1 -1
  3. package/runtime/.next/BUILD_ID +1 -1
  4. package/runtime/.next/app-build-manifest.json +9 -9
  5. package/runtime/.next/app-path-routes-manifest.json +1 -1
  6. package/runtime/.next/build-manifest.json +5 -5
  7. package/runtime/.next/prerender-manifest.json +1 -1
  8. package/runtime/.next/required-server-files.json +1 -1
  9. package/runtime/.next/routes-manifest.json +1 -1
  10. package/runtime/.next/server/app/_not-found/page.js +1 -1
  11. package/runtime/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  12. package/runtime/.next/server/app/_not-found.html +1 -1
  13. package/runtime/.next/server/app/_not-found.rsc +1 -1
  14. package/runtime/.next/server/app/api/agent/abort/route.js +1 -1
  15. package/runtime/.next/server/app/api/agent/abort/route.js.nft.json +1 -1
  16. package/runtime/.next/server/app/api/agent/answer/route.js +1 -1
  17. package/runtime/.next/server/app/api/agent/answer/route.js.nft.json +1 -1
  18. package/runtime/.next/server/app/api/agent/codex-sharing/route.js +1 -1
  19. package/runtime/.next/server/app/api/agent/codex-sharing/route.js.nft.json +1 -1
  20. package/runtime/.next/server/app/api/agent/harness/status/route.js +1 -1
  21. package/runtime/.next/server/app/api/agent/harness/status/route.js.nft.json +1 -1
  22. package/runtime/.next/server/app/api/agent/model/route.js +1 -1
  23. package/runtime/.next/server/app/api/agent/model/route.js.nft.json +1 -1
  24. package/runtime/.next/server/app/api/agent/models/route.js +1 -1
  25. package/runtime/.next/server/app/api/agent/models/route.js.nft.json +1 -1
  26. package/runtime/.next/server/app/api/agent/run/route.js +1 -1
  27. package/runtime/.next/server/app/api/agent/run/route.js.nft.json +1 -1
  28. package/runtime/.next/server/app/api/agent/runtime-health/route.js +1 -1
  29. package/runtime/.next/server/app/api/agent/runtime-health/route.js.nft.json +1 -1
  30. package/runtime/.next/server/app/api/agent/steer/route.js +1 -1
  31. package/runtime/.next/server/app/api/agent/steer/route.js.nft.json +1 -1
  32. package/runtime/.next/server/app/api/agent/stream/route.js +4 -4
  33. package/runtime/.next/server/app/api/agent/stream/route.js.nft.json +1 -1
  34. package/runtime/.next/server/app/api/agent-workspaces/[workspaceId]/sessions/route.js +1 -1
  35. package/runtime/.next/server/app/api/agent-workspaces/[workspaceId]/sessions/route.js.nft.json +1 -1
  36. package/runtime/.next/server/app/api/agent-workspaces/route.js +1 -1
  37. package/runtime/.next/server/app/api/agent-workspaces/route.js.nft.json +1 -1
  38. package/runtime/.next/server/app/api/auth/verify/route.js +1 -1
  39. package/runtime/.next/server/app/api/business/route.js +1 -1
  40. package/runtime/.next/server/app/api/business/route.js.nft.json +1 -1
  41. package/runtime/.next/server/app/api/calendar/route.js +2 -3
  42. package/runtime/.next/server/app/api/calendar/route.js.nft.json +1 -1
  43. package/runtime/.next/server/app/api/client-logs/route.js +1 -1
  44. package/runtime/.next/server/app/api/collaboration/route.js +9 -9
  45. package/runtime/.next/server/app/api/collaboration/route.js.nft.json +1 -1
  46. package/runtime/.next/server/app/api/engine-threads/route.js +1 -1
  47. package/runtime/.next/server/app/api/engine-threads/route.js.nft.json +1 -1
  48. package/runtime/.next/server/app/api/engine-threads.body +1 -1
  49. package/runtime/.next/server/app/api/flow/v1/catalog/route.js +1 -1
  50. package/runtime/.next/server/app/api/flow/v1/catalog/route.js.nft.json +1 -1
  51. package/runtime/.next/server/app/api/flow/v1/runs/[runId]/cancel/route.js +1 -1
  52. package/runtime/.next/server/app/api/flow/v1/runs/[runId]/cancel/route.js.nft.json +1 -1
  53. package/runtime/.next/server/app/api/flow/v1/runs/[runId]/events/route.js +2 -2
  54. package/runtime/.next/server/app/api/flow/v1/runs/[runId]/events/route.js.nft.json +1 -1
  55. package/runtime/.next/server/app/api/flow/v1/runs/route.js +1 -1
  56. package/runtime/.next/server/app/api/flow/v1/runs/route.js.nft.json +1 -1
  57. package/runtime/.next/server/app/api/flow-studio/config/route.js +1 -1
  58. package/runtime/.next/server/app/api/internal/todo-bootstrap/route.js +4 -0
  59. package/runtime/.next/server/app/api/internal/todo-bootstrap/route.js.nft.json +1 -0
  60. package/runtime/.next/server/app/api/internal/todo-mcp/route.js +1 -0
  61. package/runtime/.next/server/app/api/internal/todo-mcp/route.js.nft.json +1 -0
  62. package/runtime/.next/server/app/api/mcp/connect/route.js +1 -1
  63. package/runtime/.next/server/app/api/mcp/disconnect/route.js +1 -1
  64. package/runtime/.next/server/app/api/mcp/servers/route.js +1 -1
  65. package/runtime/.next/server/app/api/mcp/servers.body +1 -1
  66. package/runtime/.next/server/app/api/memory/[key]/route.js +1 -1
  67. package/runtime/.next/server/app/api/memory/route.js +1 -1
  68. package/runtime/.next/server/app/api/messaging/route.js +1 -1
  69. package/runtime/.next/server/app/api/notifications/[id]/ack/route.js +1 -0
  70. package/runtime/.next/server/app/api/notifications/[id]/ack/route.js.nft.json +1 -0
  71. package/runtime/.next/server/app/api/notifications/[id]/route.js +1 -0
  72. package/runtime/.next/server/app/api/notifications/[id]/route.js.nft.json +1 -0
  73. package/runtime/.next/server/app/api/notifications/route.js +1 -0
  74. package/runtime/.next/server/app/api/notifications/route.js.nft.json +1 -0
  75. package/runtime/.next/server/app/api/notifications/stream/route.js +4 -0
  76. package/runtime/.next/server/app/api/notifications/stream/route.js.nft.json +1 -0
  77. package/runtime/.next/server/app/api/plugins/load/route.js +1 -1
  78. package/runtime/.next/server/app/api/plugins/load/route.js.nft.json +1 -1
  79. package/runtime/.next/server/app/api/projects/[id]/route.js +1 -1
  80. package/runtime/.next/server/app/api/projects/check/route.js +1 -1
  81. package/runtime/.next/server/app/api/projects/directories/route.js +1 -1
  82. package/runtime/.next/server/app/api/projects/roots/route.js +1 -1
  83. package/runtime/.next/server/app/api/projects/route.js +1 -1
  84. package/runtime/.next/server/app/api/push/subscribe/route.js +2 -2
  85. package/runtime/.next/server/app/api/push/subscribe/route.js.nft.json +1 -1
  86. package/runtime/.next/server/app/api/push/unsubscribe/route.js +2 -2
  87. package/runtime/.next/server/app/api/push/vapid/route.js +2 -2
  88. package/runtime/.next/server/app/api/push/vapid/route.js.nft.json +1 -1
  89. package/runtime/.next/server/app/api/push/vapid.body +1 -1
  90. package/runtime/.next/server/app/api/remote-tools/register/route.js +1 -1
  91. package/runtime/.next/server/app/api/remote-tools/register/route.js.nft.json +1 -1
  92. package/runtime/.next/server/app/api/session-images/[id]/route.js +1 -0
  93. package/runtime/.next/server/app/api/session-images/[id]/route.js.nft.json +1 -0
  94. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/route.js +1 -1
  95. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/route.js.nft.json +1 -1
  96. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/stop/route.js +1 -1
  97. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/stop/route.js.nft.json +1 -1
  98. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/route.js +1 -1
  99. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/route.js.nft.json +1 -1
  100. package/runtime/.next/server/app/api/sessions/[id]/changes/route.js +2 -2
  101. package/runtime/.next/server/app/api/sessions/[id]/changes/route.js.nft.json +1 -1
  102. package/runtime/.next/server/app/api/sessions/[id]/engine-switches/route.js +1 -1
  103. package/runtime/.next/server/app/api/sessions/[id]/engine-switches/route.js.nft.json +1 -1
  104. package/runtime/.next/server/app/api/sessions/[id]/fork/route.js +1 -1
  105. package/runtime/.next/server/app/api/sessions/[id]/fork/route.js.nft.json +1 -1
  106. package/runtime/.next/server/app/api/sessions/[id]/fork-at/route.js +1 -1
  107. package/runtime/.next/server/app/api/sessions/[id]/fork-at/route.js.nft.json +1 -1
  108. package/runtime/.next/server/app/api/sessions/[id]/goals/route.js +1 -1
  109. package/runtime/.next/server/app/api/sessions/[id]/goals/route.js.nft.json +1 -1
  110. package/runtime/.next/server/app/api/sessions/[id]/handoff/route.js +1 -1
  111. package/runtime/.next/server/app/api/sessions/[id]/handoff/route.js.nft.json +1 -1
  112. package/runtime/.next/server/app/api/sessions/[id]/native-goal/route.js +1 -1
  113. package/runtime/.next/server/app/api/sessions/[id]/native-goal/route.js.nft.json +1 -1
  114. package/runtime/.next/server/app/api/sessions/[id]/query-index/route.js +1 -1
  115. package/runtime/.next/server/app/api/sessions/[id]/query-index/route.js.nft.json +1 -1
  116. package/runtime/.next/server/app/api/sessions/[id]/release/route.js +1 -1
  117. package/runtime/.next/server/app/api/sessions/[id]/release/route.js.nft.json +1 -1
  118. package/runtime/.next/server/app/api/sessions/[id]/route.js +1 -1
  119. package/runtime/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
  120. package/runtime/.next/server/app/api/sessions/[id]/switch-engine/route.js +1 -1
  121. package/runtime/.next/server/app/api/sessions/[id]/switch-engine/route.js.nft.json +1 -1
  122. package/runtime/.next/server/app/api/sessions/[id]/thread-goal/route.js +1 -1
  123. package/runtime/.next/server/app/api/sessions/[id]/thread-goal/route.js.nft.json +1 -1
  124. package/runtime/.next/server/app/api/sessions/[id]/thread-history/route.js +1 -1
  125. package/runtime/.next/server/app/api/sessions/[id]/thread-history/route.js.nft.json +1 -1
  126. package/runtime/.next/server/app/api/sessions/[id]/tool-result/route.js +1 -1
  127. package/runtime/.next/server/app/api/sessions/[id]/tool-result/route.js.nft.json +1 -1
  128. package/runtime/.next/server/app/api/sessions/parallel/route.js +1 -1
  129. package/runtime/.next/server/app/api/sessions/parallel/route.js.nft.json +1 -1
  130. package/runtime/.next/server/app/api/sessions/route.js +1 -1
  131. package/runtime/.next/server/app/api/sessions/route.js.nft.json +1 -1
  132. package/runtime/.next/server/app/api/settings/route.js +1 -1
  133. package/runtime/.next/server/app/api/skills/route.js +1 -1
  134. package/runtime/.next/server/app/api/todos/[id]/commands/route.js +1 -0
  135. package/runtime/.next/server/app/api/todos/[id]/commands/route.js.nft.json +1 -0
  136. package/runtime/.next/server/app/api/todos/[id]/executions/route.js +1 -0
  137. package/runtime/.next/server/app/api/todos/[id]/executions/route.js.nft.json +1 -0
  138. package/runtime/.next/server/app/api/todos/[id]/route.js +1 -0
  139. package/runtime/.next/server/app/api/todos/[id]/route.js.nft.json +1 -0
  140. package/runtime/.next/server/app/api/todos/route.js +1 -0
  141. package/runtime/.next/server/app/api/todos/route.js.nft.json +1 -0
  142. package/runtime/.next/server/app/api/tool-policies/[policyId]/route.js +1 -1
  143. package/runtime/.next/server/app/api/tool-policies/[policyId]/route.js.nft.json +1 -1
  144. package/runtime/.next/server/app/api/tool-policies/route.js +1 -1
  145. package/runtime/.next/server/app/api/tool-policies/route.js.nft.json +1 -1
  146. package/runtime/.next/server/app/api/tools/route.js +1 -1
  147. package/runtime/.next/server/app/api/tools/route.js.nft.json +1 -1
  148. package/runtime/.next/server/app/api/update/check/route.js +1 -1
  149. package/runtime/.next/server/app/api/update/install/route.js +1 -1
  150. package/runtime/.next/server/app/api/update/status/route.js +1 -1
  151. package/runtime/.next/server/app/api/web-auth/login/route.js +1 -1
  152. package/runtime/.next/server/app/api/web-auth/logout/route.js +1 -1
  153. package/runtime/.next/server/app/api/web-auth/revoke-all/route.js +1 -1
  154. package/runtime/.next/server/app/api/web-auth/setup/route.js +1 -1
  155. package/runtime/.next/server/app/api/web-auth/status/route.js +1 -1
  156. package/runtime/.next/server/app/api/web-console/bootstrap/route.js +1 -1
  157. package/runtime/.next/server/app/api/web-console/computer-settings/route.js +1 -1
  158. package/runtime/.next/server/app/api/web-console/computers/route.js +1 -1
  159. package/runtime/.next/server/app/api/web-console/device-state/route.js +1 -1
  160. package/runtime/.next/server/app/api/web-console/history/route.js +1 -1
  161. package/runtime/.next/server/app/api/web-console/preferences/route.js +1 -1
  162. package/runtime/.next/server/app/api/workspace-changes/route.js +1 -0
  163. package/runtime/.next/server/app/api/workspace-changes/route.js.nft.json +1 -0
  164. package/runtime/.next/server/app/web/page.js +4 -4
  165. package/runtime/.next/server/app/web/page_client-reference-manifest.js +1 -1
  166. package/runtime/.next/server/app-paths-manifest.json +38 -26
  167. package/runtime/.next/server/chunks/1298.js +1 -0
  168. package/runtime/.next/server/chunks/1973.js +1 -0
  169. package/runtime/.next/server/chunks/2480.js +4 -0
  170. package/runtime/.next/server/chunks/3604.js +4 -0
  171. package/runtime/.next/server/chunks/4621.js +1 -1
  172. package/runtime/.next/server/chunks/5303.js +1 -1
  173. package/runtime/.next/server/chunks/5762.js +1 -1
  174. package/runtime/.next/server/chunks/5801.js +1 -0
  175. package/runtime/.next/server/chunks/6977.js +1 -1
  176. package/runtime/.next/server/chunks/732.js +1 -1
  177. package/runtime/.next/server/chunks/7788.js +1 -1
  178. package/runtime/.next/server/chunks/9119.js +15 -0
  179. package/runtime/.next/server/chunks/9457.js +4 -0
  180. package/runtime/.next/server/middleware-build-manifest.js +1 -1
  181. package/runtime/.next/server/pages/404.html +1 -1
  182. package/runtime/.next/server/pages/500.html +1 -1
  183. package/runtime/.next/server/server-reference-manifest.json +1 -1
  184. package/runtime/.next/static/chunks/753-90c7dd1ba08be9be.js +1 -0
  185. package/runtime/.next/static/chunks/app/web/{error-3cae58f0f14f0b4f.js → error-828d278147a0619d.js} +1 -1
  186. package/runtime/.next/static/chunks/app/web/layout-a8b7565989c1c063.js +1 -0
  187. package/runtime/.next/static/chunks/app/web/page-8ff95d45a0160843.js +1 -0
  188. package/runtime/.next/static/chunks/{main-d8ef9def37924b01.js → main-7240085c0ba42e9a.js} +1 -1
  189. package/runtime/.next/static/chunks/main-app-07d67f2d4e96ecb8.js +1 -0
  190. package/runtime/lib/desktop-discovery.mjs +12 -3
  191. package/runtime/lib/service-identity.mjs +17 -0
  192. package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/MacOS/agentroam-remote-desktop +0 -0
  193. package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/Resources/agentroam-component.json +1 -1
  194. package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/_CodeSignature/CodeResources +2 -2
  195. package/runtime/node_modules/.package-lock.json +11 -11
  196. package/runtime/node_modules/@agent/core/dist/index.js +857 -4
  197. package/runtime/node_modules/@agent/native-runtime/dist/index.js +37982 -19298
  198. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/bridge.mjs +74 -78
  199. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/browser-sdk.js +52 -51
  200. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-rn7tc54w.mjs → core-25bstexa.mjs} +3 -3
  201. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-4ps8vwh1.mjs +42 -0
  202. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-9a7zb9bm.mjs +53 -0
  203. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-ba5rrckm.mjs → core-a8ty0dnc.mjs} +2 -2
  204. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-2h2qc9qv.mjs → core-ae73vzp2.mjs} +4 -4
  205. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-ya1m7gzj.mjs → core-dsa3p77h.mjs} +3 -3
  206. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-h6r54bwv.mjs → core-e93r8awg.mjs} +2 -2
  207. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-eqz9ara6.mjs +18 -0
  208. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-td7rt8zt.mjs → core-esw7xtkz.mjs} +3 -3
  209. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-k67vj6j9.mjs → core-ey906mbk.mjs} +5 -5
  210. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-x4kwpwv9.mjs → core-k19jejpn.mjs} +2 -2
  211. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-tf03rfab.mjs → core-kag24kjr.mjs} +3 -3
  212. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-qbjntcdf.mjs → core-mhczx7zp.mjs} +4 -4
  213. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-qj4dtgyt.mjs → core-nfa6p2rw.mjs} +3 -3
  214. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-sstebd83.mjs → core-v6sp3qjw.mjs} +4 -4
  215. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core.mjs +12 -11
  216. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.json +21 -21
  217. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.zst.json +25 -25
  218. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/package.json +25 -25
  219. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +80 -84
  220. package/runtime/package-lock.json +35 -35
  221. package/runtime/server.js +1 -1
  222. package/runtime/webapp/dist/assets/AIHubView-DF0D5qd2.js +1 -0
  223. package/runtime/webapp/dist/assets/{AgentManager-CrN2B-tH.js → AgentManager-Ccj6ZefC.js} +2 -2
  224. package/runtime/webapp/dist/assets/{AiHubPane-Du6ajSsx.js → AiHubPane-3PRSxzO0.js} +1 -1
  225. package/runtime/webapp/dist/assets/App-CtLZIOFu.css +1 -0
  226. package/runtime/webapp/dist/assets/App-HomcUet2.js +63 -0
  227. package/runtime/webapp/dist/assets/BrowserLivePanel-BZDtF0ne.js +66 -0
  228. package/runtime/webapp/dist/assets/CalendarPage-B8Jo-3Da.js +1 -0
  229. package/runtime/webapp/dist/assets/CalendarView-BD7GhA0i.js +36 -0
  230. package/runtime/webapp/dist/assets/CalendarView-DHi-mzjY.css +1 -0
  231. package/runtime/webapp/dist/assets/CollaborationCreateDialog-CU1t0iYL.js +1 -0
  232. package/runtime/webapp/dist/assets/CollaborationDashboard-BZhWQXzn.js +1 -0
  233. package/runtime/webapp/dist/assets/CollaborationPage-BwRJN55v.js +6 -0
  234. package/runtime/webapp/dist/assets/{FilePreview-CevPpP6E.js → FilePreview-Oo8sZH0t.js} +5 -5
  235. package/runtime/webapp/dist/assets/FileTree-qJTRdDPQ.js +6 -0
  236. package/runtime/webapp/dist/assets/FileWorkspaceDrawer-D40WNAqC.js +1 -0
  237. package/runtime/webapp/dist/assets/FlowStudioPane-C1tgSbGo.js +5 -0
  238. package/runtime/webapp/dist/assets/HostProjectPicker-BEfXuqxT.js +1 -0
  239. package/runtime/webapp/dist/assets/{LSPServerList-BMY6dFfG.js → LSPServerList-DQRv04aP.js} +1 -1
  240. package/runtime/webapp/dist/assets/{MCPServerList-c91QNM-g.js → MCPServerList-BmsejJC9.js} +1 -1
  241. package/runtime/webapp/dist/assets/{MemoryViewer-C9IfWwzW.js → MemoryViewer-qZMdVrli.js} +1 -1
  242. package/runtime/webapp/dist/assets/NewSessionWindow-BOCZ0mXT.css +1 -0
  243. package/runtime/webapp/dist/assets/NewSessionWindow-uzVK5LVS.js +1 -0
  244. package/runtime/webapp/dist/assets/{RemoteDesktopPage-w8aL061W.js → RemoteDesktopPage-Dz_6-rOL.js} +1 -1
  245. package/runtime/webapp/dist/assets/{RunningSessionsIcon-B8Cr2-hp.js → RunningSessionsIcon-DJxTmxZn.js} +5 -5
  246. package/runtime/webapp/dist/assets/SessionDashboard-DuR9r_ZP.js +16 -0
  247. package/runtime/webapp/dist/assets/{SessionDashboardBridge-Bx4EXtos.js → SessionDashboardBridge-BHVjvDHa.js} +1 -1
  248. package/runtime/webapp/dist/assets/{SettingsPanel-CS4XL2sd.js → SettingsPanel-B-g919uV.js} +2 -2
  249. package/runtime/webapp/dist/assets/{SkillManager-5FZnR9My.js → SkillManager-nrWIOtEO.js} +1 -1
  250. package/runtime/webapp/dist/assets/{TerminalPane-CRrbd0i4.js → TerminalPane-C4HiD2IC.js} +2 -2
  251. package/runtime/webapp/dist/assets/TodoPage-Bn6j6kR6.js +1 -0
  252. package/runtime/webapp/dist/assets/{abnfDiagram-VCTEODGH-DBioGYiE.js → abnfDiagram-VCTEODGH-BXRYzdBT.js} +1 -1
  253. package/runtime/webapp/dist/assets/{arc-BRj_RXHL.js → arc-BeG7yjCw.js} +1 -1
  254. package/runtime/webapp/dist/assets/{architectureDiagram-5GKGNRK7-CoCdq67U.js → architectureDiagram-5GKGNRK7-DIQbpqn7.js} +1 -1
  255. package/runtime/webapp/dist/assets/{arrow-right-Cqqb1zqH.js → arrow-right-B03zMFiC.js} +1 -1
  256. package/runtime/webapp/dist/assets/artifact-links-4m1A00GO.js +2 -0
  257. package/runtime/webapp/dist/assets/{blockDiagram-I7D4REHJ-CLisIPjq.js → blockDiagram-I7D4REHJ-DvgKV01C.js} +3 -3
  258. package/runtime/webapp/dist/assets/{c4Diagram-7LVT6UL2-BoLCIVW8.js → c4Diagram-7LVT6UL2-DIr7nDIg.js} +1 -1
  259. package/runtime/webapp/dist/assets/calendar-days-D1OJEOKr.js +6 -0
  260. package/runtime/webapp/dist/assets/channel-Cchxg6Fx.js +1 -0
  261. package/runtime/webapp/dist/assets/check-BDiCDSY5.js +6 -0
  262. package/runtime/webapp/dist/assets/{chevron-down-DhZV290h.js → chevron-down-DIt_NscV.js} +1 -1
  263. package/runtime/webapp/dist/assets/chevron-right-DVhYkZeF.js +6 -0
  264. package/runtime/webapp/dist/assets/{chunk-2Q5K7J3B-CIQxwzU0.js → chunk-2Q5K7J3B-Cykdc4to.js} +1 -1
  265. package/runtime/webapp/dist/assets/{chunk-5VM5RSS4-Buiv0MCN.js → chunk-5VM5RSS4-DL-gBU30.js} +1 -1
  266. package/runtime/webapp/dist/assets/chunk-F27PBJKO-z0F9O96j.js +1 -0
  267. package/runtime/webapp/dist/assets/{chunk-IMKFNOWR-C0NrkJOc.js → chunk-IMKFNOWR-DcSgatN1.js} +1 -1
  268. package/runtime/webapp/dist/assets/{chunk-JWPE2WC7-CGON_UvB.js → chunk-JWPE2WC7-BmG1ozp9.js} +1 -1
  269. package/runtime/webapp/dist/assets/{chunk-POPQ4Y6H-BXvOsc9g.js → chunk-POPQ4Y6H-BK2jifSN.js} +1 -1
  270. package/runtime/webapp/dist/assets/{chunk-SVP7TREG-ZD_qn-NK.js → chunk-SVP7TREG-DtInGjiG.js} +3 -3
  271. package/runtime/webapp/dist/assets/{chunk-TICWLB2K-DrB8f6RG.js → chunk-TICWLB2K-DWdiL4Y6.js} +1 -1
  272. package/runtime/webapp/dist/assets/{chunk-XXDRQBXY-CYgLMn5t.js → chunk-XXDRQBXY-w8UYxZUB.js} +1 -1
  273. package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-BGv4sK1I.js +1 -0
  274. package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-BGv4sK1I.js +1 -0
  275. package/runtime/webapp/dist/assets/{codeSyntax-DfQ5rLir.js → codeSyntax-Cprr1Nm9.js} +3 -3
  276. package/runtime/webapp/dist/assets/{collaboration-CQhzjwS_.js → collaboration-acdqOxaY.js} +1 -1
  277. package/runtime/webapp/dist/assets/composer-file-routing-BsSxfxUa.js +6 -0
  278. package/runtime/webapp/dist/assets/{cose-bilkent-JH36ORCC-CDPnTlcy.js → cose-bilkent-JH36ORCC-BJgwy7Y5.js} +1 -1
  279. package/runtime/webapp/dist/assets/{cynefin-OW5HDTMX-DDCxhkA5.js → cynefin-OW5HDTMX-BssWa1kU.js} +1 -1
  280. package/runtime/webapp/dist/assets/{cynefinDiagram-5FMLGOSQ-CIJ1KBPA.js → cynefinDiagram-5FMLGOSQ-Bv_-fuG_.js} +2 -2
  281. package/runtime/webapp/dist/assets/{dagre-GXQ25YYZ-CFX8O3IJ.js → dagre-GXQ25YYZ-BjA5n2Zi.js} +1 -1
  282. package/runtime/webapp/dist/assets/{diagram-S7CK7UJ4-B8UX2IBH.js → diagram-S7CK7UJ4-CCT38L0E.js} +3 -3
  283. package/runtime/webapp/dist/assets/{diagram-UQ7AKVKN-Ce34DNrv.js → diagram-UQ7AKVKN-4fLw8kje.js} +1 -1
  284. package/runtime/webapp/dist/assets/{diagram-VSXAHHWV-CVL_erWD.js → diagram-VSXAHHWV-43_Qj0Se.js} +3 -3
  285. package/runtime/webapp/dist/assets/{diagram-VX7I27RA-DBFHI7Dk.js → diagram-VX7I27RA-BHEXgMDZ.js} +1 -1
  286. package/runtime/webapp/dist/assets/{diagram-Z3DM3KII-Bw_QcSQY.js → diagram-Z3DM3KII-BRTSiXVr.js} +2 -2
  287. package/runtime/webapp/dist/assets/{download-D3xZPWnZ.js → download-CuYS63Ny.js} +1 -1
  288. package/runtime/webapp/dist/assets/{ebnfDiagram-PWID7BFC-DRly04dj.js → ebnfDiagram-PWID7BFC-B4GImY-o.js} +1 -1
  289. package/runtime/webapp/dist/assets/{erDiagram-RLTQ6QDP-DTm817hG.js → erDiagram-RLTQ6QDP-EmEsAxWS.js} +1 -1
  290. package/runtime/webapp/dist/assets/{external-link-Cwu5rEgp.js → external-link-Baeyco26.js} +1 -1
  291. package/runtime/webapp/dist/assets/{file-types-DKkhMnUV.js → file-types-CykGmGsd.js} +2 -2
  292. package/runtime/webapp/dist/assets/{flowDiagram-HODETNUW-tc8ygZtG.js → flowDiagram-HODETNUW-sky_wmbX.js} +1 -1
  293. package/runtime/webapp/dist/assets/{ganttDiagram-EL5Y4UJY-CsQFf1IN.js → ganttDiagram-EL5Y4UJY-Cc71xV1j.js} +1 -1
  294. package/runtime/webapp/dist/assets/{gitGraphDiagram-WWUBYQGX-DAIxbmPX.js → gitGraphDiagram-WWUBYQGX-z7uQ8-8z.js} +7 -7
  295. package/runtime/webapp/dist/assets/history-C7WUwl_W.js +6 -0
  296. package/runtime/webapp/dist/assets/{image-plus-nplydLA5.js → image-plus-B2RK1ogI.js} +1 -1
  297. package/runtime/webapp/dist/assets/index-B_fTpc5K.css +1 -0
  298. package/runtime/webapp/dist/assets/index-d8fS3JdV.js +489 -0
  299. package/runtime/webapp/dist/assets/{infoDiagram-27XIBGKW-CVcMW4UM.js → infoDiagram-27XIBGKW-DXLEePz0.js} +1 -1
  300. package/runtime/webapp/dist/assets/{ishikawaDiagram-5VMMS53U-zzlEtZ1l.js → ishikawaDiagram-5VMMS53U-DCFXm_zQ.js} +4 -4
  301. package/runtime/webapp/dist/assets/{journeyDiagram-3NMN7TZE-q7NuIMSl.js → journeyDiagram-3NMN7TZE-DHWCpvY6.js} +1 -1
  302. package/runtime/webapp/dist/assets/{kanban-definition-UXKFOSKX-DLYFZlKO.js → kanban-definition-UXKFOSKX-D_uP81aw.js} +7 -7
  303. package/runtime/webapp/dist/assets/{layout-PFWssIkE.js → layout-Bcu83-1p.js} +1 -1
  304. package/runtime/webapp/dist/assets/{linear-ZRVcojb1.js → linear-CPim5SQa.js} +1 -1
  305. package/runtime/webapp/dist/assets/list-todo-F1W4yBLx.js +6 -0
  306. package/runtime/webapp/dist/assets/{loader-circle-DIW9tlEz.js → loader-circle-DesEGpVH.js} +1 -1
  307. package/runtime/webapp/dist/assets/locate-fixed-UXM91vCS.js +6 -0
  308. package/runtime/webapp/dist/assets/{mermaid.core-C8Dl0Nah.js → mermaid.core-CyzKk3O2.js} +6 -6
  309. package/runtime/webapp/dist/assets/{mindmap-definition-YA3MSWOX-BcbqtwVk.js → mindmap-definition-YA3MSWOX-0MHQpQro.js} +1 -1
  310. package/runtime/webapp/dist/assets/new-session-window-B4BJYrds.css +1 -0
  311. package/runtime/webapp/dist/assets/new-session-window-fsYu53Ht.js +188 -0
  312. package/runtime/webapp/dist/assets/page-C2e368Dx.js +86 -0
  313. package/runtime/webapp/dist/assets/pause-_h6c8qPD.js +6 -0
  314. package/runtime/webapp/dist/assets/{pegDiagram-XKGWAZYB-BQN3zQuy.js → pegDiagram-XKGWAZYB-BNinoE-7.js} +1 -1
  315. package/runtime/webapp/dist/assets/{pieDiagram-E7YTZNPT-pOgxh3os.js → pieDiagram-E7YTZNPT-CfPzV9yb.js} +3 -3
  316. package/runtime/webapp/dist/assets/pin-BcXr5230.js +6 -0
  317. package/runtime/webapp/dist/assets/play-BdB0D0rZ.js +6 -0
  318. package/runtime/webapp/dist/assets/{quadrantDiagram-AXDQQJYC-BOg7ujzG.js → quadrantDiagram-AXDQQJYC-0qLb33lM.js} +1 -1
  319. package/runtime/webapp/dist/assets/{railroadDiagram-O6MQD6OU-CWsN3juJ.js → railroadDiagram-O6MQD6OU-DNU4eRJt.js} +1 -1
  320. package/runtime/webapp/dist/assets/{requirementDiagram-BXWQKSXE-B0yrO7Oy.js → requirementDiagram-BXWQKSXE-BWJRwKX8.js} +3 -3
  321. package/runtime/webapp/dist/assets/{rotate-ccw-O4wnfQP7.js → rotate-ccw-BdZpOTYP.js} +1 -1
  322. package/runtime/webapp/dist/assets/{rotate-cw-CCJtlAtB.js → rotate-cw-D-zPMe4i.js} +1 -1
  323. package/runtime/webapp/dist/assets/{sankeyDiagram-P5KCCOFB-5MS_e-3E.js → sankeyDiagram-P5KCCOFB-CGW9pvun.js} +2 -2
  324. package/runtime/webapp/dist/assets/{send-Cdg4ZVlp.js → send-DCVOqOap.js} +1 -1
  325. package/runtime/webapp/dist/assets/{sequenceDiagram-WJ2MYXX4-C1w8qYSu.js → sequenceDiagram-WJ2MYXX4-CeVAD519.js} +4 -4
  326. package/runtime/webapp/dist/assets/session-dashboard-BAYi5acZ.js +1 -0
  327. package/runtime/webapp/dist/assets/{shield-check-CrjI2wPR.js → shield-check-DrxVJwVC.js} +1 -1
  328. package/runtime/webapp/dist/assets/{sizeCapture-INFHLROL-BonKTynC.js → sizeCapture-INFHLROL-Dj5SukiO.js} +1 -1
  329. package/runtime/webapp/dist/assets/{stateDiagram-D77RDMKH-D3mn6ZK5.js → stateDiagram-D77RDMKH-UtRSslyd.js} +1 -1
  330. package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-Se3lznH6.js +1 -0
  331. package/runtime/webapp/dist/assets/{swimlanes-42K2YHIH-Bn9KWChU.js → swimlanes-42K2YHIH-DKbrz8SF.js} +1 -1
  332. package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-C-Zsmae7.js +8 -0
  333. package/runtime/webapp/dist/assets/{timeline-definition-24CTP7MA-BfuhI7EF.js → timeline-definition-24CTP7MA-mtVdMOBL.js} +1 -1
  334. package/runtime/webapp/dist/assets/{trash-2-BrfgMjfL.js → trash-2-Bbhd8-xd.js} +4 -9
  335. package/runtime/webapp/dist/assets/{types-VnQ_cKrp.js → types-CMhUwzwJ.js} +1 -1
  336. package/runtime/webapp/dist/assets/{vennDiagram-4TSXK5OY-CUFs5JyR.js → vennDiagram-4TSXK5OY-ZcuGEhJx.js} +5 -5
  337. package/runtime/webapp/dist/assets/{wardleyDiagram-VM6X3IG4-C27HHz1A.js → wardleyDiagram-VM6X3IG4-CnAYI2ZE.js} +1 -1
  338. package/runtime/webapp/dist/assets/{web-CeCHmdwO.js → web-BH9JgWsL.js} +1 -1
  339. package/runtime/webapp/dist/assets/{web-BOzkL-0Z.js → web-CBiaPgEe.js} +1 -1
  340. package/runtime/webapp/dist/assets/{x-DP1nC4qG.js → x-1GQMVfza.js} +1 -1
  341. package/runtime/webapp/dist/assets/{xychartDiagram-S5SC5T6Z-CQwRrSTf.js → xychartDiagram-S5SC5T6Z-B_uJt0Bg.js} +3 -3
  342. package/runtime/webapp/dist/assets/zoom-out-BNKdrTFD.js +11 -0
  343. package/runtime/webapp/dist/index.html +2 -2
  344. package/runtime/ws-server.mjs +12 -4
  345. package/runtime/.next/server/chunks/1614.js +0 -1
  346. package/runtime/.next/server/chunks/7519.js +0 -15
  347. package/runtime/.next/static/chunks/333-9881c3d2c558a28d.js +0 -1
  348. package/runtime/.next/static/chunks/app/web/layout-d5d7d1c5c74eef3c.js +0 -1
  349. package/runtime/.next/static/chunks/app/web/page-7afa4cb0119e90b7.js +0 -1
  350. package/runtime/.next/static/chunks/main-app-7a6902a607752446.js +0 -1
  351. package/runtime/lib/voice-tts-gateway.mjs +0 -96
  352. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-9sxfsmzx.mjs +0 -18
  353. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-dnsvg8nc.mjs +0 -53
  354. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-y6bhrwmk.mjs +0 -47
  355. package/runtime/webapp/dist/assets/AIHubView-BMeOfqfm.js +0 -1
  356. package/runtime/webapp/dist/assets/App-CrZstnCH.css +0 -1
  357. package/runtime/webapp/dist/assets/App-zihaYk1L.js +0 -179
  358. package/runtime/webapp/dist/assets/BrowserLivePanel-CU_X6OU2.js +0 -56
  359. package/runtime/webapp/dist/assets/CollaborationCreateDialog-BmgYdwe7.js +0 -1
  360. package/runtime/webapp/dist/assets/CollaborationDashboard-mHU8iJYg.js +0 -1
  361. package/runtime/webapp/dist/assets/CollaborationPage-Br5fhNce.js +0 -6
  362. package/runtime/webapp/dist/assets/FileTree-CagcHV1N.js +0 -11
  363. package/runtime/webapp/dist/assets/FileWorkspaceDrawer-CWVndCXp.js +0 -1
  364. package/runtime/webapp/dist/assets/FlowStudioPane-BZA-qvBj.js +0 -5
  365. package/runtime/webapp/dist/assets/SessionDashboard-CFXXTm_4.js +0 -21
  366. package/runtime/webapp/dist/assets/artifact-links-73OZyi5W.js +0 -7
  367. package/runtime/webapp/dist/assets/channel-JGVZzkSo.js +0 -1
  368. package/runtime/webapp/dist/assets/chunk-F27PBJKO-XBMwIl6X.js +0 -1
  369. package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-BnctJ00R.js +0 -1
  370. package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-BnctJ00R.js +0 -1
  371. package/runtime/webapp/dist/assets/composer-file-routing-D9orqwzY.js +0 -11
  372. package/runtime/webapp/dist/assets/index-B-d1Vs9E.css +0 -1
  373. package/runtime/webapp/dist/assets/index-DKm9ESDq.js +0 -489
  374. package/runtime/webapp/dist/assets/page-BG97oPXr.js +0 -91
  375. package/runtime/webapp/dist/assets/session-dashboard-BigU92sz.js +0 -6
  376. package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-WEfEW-mH.js +0 -1
  377. package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-D26_Nmko.js +0 -8
  378. package/runtime/webapp/dist/assets/zoom-out-Dg7YyzcP.js +0 -21
  379. package/runtime/webapp/dist/pcm-audio-worklet.js +0 -126
  380. /package/runtime/.next/static/{xuZ1UJWVNJ-rxb5YgETmd → q4ez_w8bVMUW1e57Cd7GC}/_buildManifest.js +0 -0
  381. /package/runtime/.next/static/{xuZ1UJWVNJ-rxb5YgETmd → q4ez_w8bVMUW1e57Cd7GC}/_ssgManifest.js +0 -0
@@ -17011,6 +17011,250 @@ function todoState(status, dueAt, nowMs) {
17011
17011
  return "overdue";
17012
17012
  return "pending";
17013
17013
  }
17014
+ // src/domain/calendar/ports.ts
17015
+ var EMPTY_RESULT = { entries: [], groups: [] };
17016
+ function sourceError(source, error) {
17017
+ const message = error instanceof Error ? error.message : String(error);
17018
+ return `${source}: ${message}`.slice(0, 240);
17019
+ }
17020
+ // src/domain/calendar/schedule-expand.ts
17021
+ var DAY_CODES = { SU: 0, MO: 1, TU: 2, WE: 3, TH: 4, FR: 5, SA: 6 };
17022
+ var DAY_NAMES = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
17023
+ var MAX_SPAN_MS = 366 * 86400000;
17024
+ function numList(value) {
17025
+ if (!value)
17026
+ return [];
17027
+ return value.split(",").map((part) => parseInt(part.trim(), 10)).filter(Number.isFinite);
17028
+ }
17029
+ function parseByDay(value) {
17030
+ const match = /^([+-]?\d+)?([A-Z]{2})$/.exec(value.trim().toUpperCase());
17031
+ if (!match || DAY_CODES[match[2]] === undefined)
17032
+ return null;
17033
+ return { ...match[1] ? { ordinal: parseInt(match[1], 10) } : {}, day: DAY_CODES[match[2]] };
17034
+ }
17035
+ function parseUntil(value) {
17036
+ if (!value)
17037
+ return;
17038
+ const compact2 = /^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z?$/.exec(value.trim());
17039
+ const iso = compact2 ? `${compact2[1]}-${compact2[2]}-${compact2[3]}T${compact2[4]}:${compact2[5]}:${compact2[6]}Z` : value.trim();
17040
+ const ms = Date.parse(iso);
17041
+ return Number.isFinite(ms) ? ms : undefined;
17042
+ }
17043
+ function startOfDay(ms) {
17044
+ const d = new Date(ms);
17045
+ d.setHours(0, 0, 0, 0);
17046
+ return d.getTime();
17047
+ }
17048
+ function pad(n) {
17049
+ return `${n}`.padStart(2, "0");
17050
+ }
17051
+ function expandRRule(rule, fromMs, toMs, opts = {}) {
17052
+ const text2 = rule.trim().replace(/^RRULE:/i, "");
17053
+ if (!text2 || toMs < fromMs)
17054
+ return [];
17055
+ const parts = new Map;
17056
+ for (const piece of text2.split(";")) {
17057
+ const eq = piece.indexOf("=");
17058
+ if (eq > 0)
17059
+ parts.set(piece.slice(0, eq).trim().toUpperCase(), piece.slice(eq + 1).trim());
17060
+ }
17061
+ const freq = (parts.get("FREQ") ?? "").toUpperCase();
17062
+ const interval = Math.max(1, parseInt(parts.get("INTERVAL") ?? "1", 10) || 1);
17063
+ const limit = opts.limit ?? 400;
17064
+ const until = parseUntil(parts.get("UNTIL"));
17065
+ const end = Math.min(toMs, until ?? toMs, fromMs + MAX_SPAN_MS);
17066
+ if (end < fromMs)
17067
+ return [];
17068
+ const byHour = numList(parts.get("BYHOUR"));
17069
+ const byMinute = numList(parts.get("BYMINUTE"));
17070
+ const byMonth = numList(parts.get("BYMONTH"));
17071
+ const byMonthDay = numList(parts.get("BYMONTHDAY"));
17072
+ const byDay = (parts.get("BYDAY") ?? "").split(",").map(parseByDay).filter((d) => d !== null);
17073
+ const anchor = new Date(opts.anchorMs ?? fromMs);
17074
+ const fires = [];
17075
+ const push = (ms) => {
17076
+ if (ms >= fromMs && ms <= end && fires.length < limit)
17077
+ fires.push(ms);
17078
+ };
17079
+ const hours = byHour.length ? byHour : [0];
17080
+ const minutes = byMinute.length ? byMinute : [0];
17081
+ const times = hours.flatMap((h) => minutes.map((m) => [h, m]));
17082
+ if (freq === "MINUTELY" || freq === "HOURLY") {
17083
+ const step = interval * (freq === "MINUTELY" ? 60000 : 3600000);
17084
+ let t = Math.floor(anchor.getTime() / 60000) * 60000;
17085
+ if (t < fromMs)
17086
+ t += Math.ceil((fromMs - t) / step) * step;
17087
+ for (;t <= end && fires.length < limit; t += step) {
17088
+ const d = new Date(t);
17089
+ if (byHour.length && !byHour.includes(d.getHours()))
17090
+ continue;
17091
+ if (byMinute.length && !byMinute.includes(d.getMinutes()))
17092
+ continue;
17093
+ if (byDay.length && !byDay.some((b) => b.day === d.getDay()))
17094
+ continue;
17095
+ push(t);
17096
+ }
17097
+ return fires;
17098
+ }
17099
+ const anchorDay = startOfDay(anchor.getTime());
17100
+ const anchorWeek = anchorDay - anchor.getDay() * 86400000;
17101
+ const day = new Date(startOfDay(fromMs));
17102
+ for (let guard = 0;day.getTime() <= end && guard < 400; guard++, day.setDate(day.getDate() + 1)) {
17103
+ const dayStart = day.getTime();
17104
+ const weekday = day.getDay();
17105
+ const month = day.getMonth() + 1;
17106
+ const monthDay = day.getDate();
17107
+ let matches = false;
17108
+ if (freq === "DAILY") {
17109
+ matches = Math.round((dayStart - anchorDay) / 86400000) % interval === 0;
17110
+ } else if (freq === "WEEKLY") {
17111
+ const weekDiff = Math.round((dayStart - anchorWeek) / (7 * 86400000));
17112
+ matches = weekDiff % interval === 0 && (byDay.length ? byDay.some((b) => b.day === weekday && !b.ordinal) : weekday === anchor.getDay());
17113
+ } else if (freq === "MONTHLY") {
17114
+ const monthDiff = (day.getFullYear() - anchor.getFullYear()) * 12 + day.getMonth() - anchor.getMonth();
17115
+ if (monthDiff % interval !== 0)
17116
+ continue;
17117
+ if (byMonthDay.length)
17118
+ matches = byMonthDay.includes(monthDay);
17119
+ else if (byDay.length)
17120
+ matches = byDay.some((b) => b.day === weekday && (!b.ordinal || nthWeekdayOfMonth(day, b.ordinal) === b.ordinal));
17121
+ else
17122
+ matches = monthDay === anchor.getDate();
17123
+ } else if (freq === "YEARLY") {
17124
+ if ((day.getFullYear() - anchor.getFullYear()) % interval !== 0)
17125
+ continue;
17126
+ if (byMonth.length && !byMonth.includes(month))
17127
+ continue;
17128
+ if (byMonthDay.length)
17129
+ matches = byMonthDay.includes(monthDay);
17130
+ else if (byDay.length)
17131
+ matches = byDay.some((b) => b.day === weekday && (!b.ordinal || nthWeekdayOfMonth(day, b.ordinal) === b.ordinal));
17132
+ else
17133
+ matches = month === anchor.getMonth() + 1 && monthDay === anchor.getDate();
17134
+ } else {
17135
+ return [];
17136
+ }
17137
+ if (!matches)
17138
+ continue;
17139
+ if (byMonth.length && freq !== "YEARLY" && !byMonth.includes(month))
17140
+ continue;
17141
+ for (const [h, m] of times) {
17142
+ const fire = new Date(day.getFullYear(), day.getMonth(), day.getDate(), h, m, 0, 0);
17143
+ push(fire.getTime());
17144
+ }
17145
+ }
17146
+ return fires;
17147
+ }
17148
+ function nthWeekdayOfMonth(day, ordinal) {
17149
+ const weekday = day.getDay();
17150
+ const monthDay = day.getDate();
17151
+ const nth = Math.floor((monthDay - 1) / 7) + 1;
17152
+ if (ordinal > 0)
17153
+ return nth;
17154
+ const daysInMonth = new Date(day.getFullYear(), day.getMonth() + 1, 0).getDate();
17155
+ const fromEnd = Math.floor((daysInMonth - monthDay) / 7) + 1;
17156
+ return -fromEnd === ordinal ? ordinal : nth;
17157
+ }
17158
+ function describeRRule(rule) {
17159
+ const text2 = rule.trim().replace(/^RRULE:/i, "");
17160
+ const parts = new Map;
17161
+ for (const piece of text2.split(";")) {
17162
+ const eq = piece.indexOf("=");
17163
+ if (eq > 0)
17164
+ parts.set(piece.slice(0, eq).trim().toUpperCase(), piece.slice(eq + 1).trim());
17165
+ }
17166
+ const freq = (parts.get("FREQ") ?? "").toUpperCase();
17167
+ const interval = Math.max(1, parseInt(parts.get("INTERVAL") ?? "1", 10) || 1);
17168
+ const hours = numList(parts.get("BYHOUR"));
17169
+ const minutes = numList(parts.get("BYMINUTE"));
17170
+ const time = hours.length ? `${pad(hours[0])}:${pad(minutes[0] ?? 0)}` : "";
17171
+ const days = (parts.get("BYDAY") ?? "").split(",").map(parseByDay).filter((d) => d !== null && !d.ordinal);
17172
+ if (freq === "MINUTELY")
17173
+ return `每 ${interval} 分钟`;
17174
+ if (freq === "HOURLY")
17175
+ return `每 ${interval} 小时`;
17176
+ if (freq === "DAILY")
17177
+ return `每天${time ? ` ${time}` : ""}`;
17178
+ if (freq === "WEEKLY" && days.length)
17179
+ return `每${days.map((d) => DAY_NAMES[d.day].replace("周", "周")).join("、")}${time ? ` ${time}` : ""}`;
17180
+ if (freq === "MONTHLY") {
17181
+ const monthDays = numList(parts.get("BYMONTHDAY"));
17182
+ if (monthDays.length)
17183
+ return `每月 ${monthDays.join("、")} 日${time ? ` ${time}` : ""}`;
17184
+ const ord = (parts.get("BYDAY") ?? "").split(",").map(parseByDay).filter((d) => d !== null && !!d.ordinal);
17185
+ if (ord.length)
17186
+ return `每月第 ${ord[0].ordinal} 个${DAY_NAMES[ord[0].day].replace("周", "周")}${time ? ` ${time}` : ""}`;
17187
+ return `每月${time ? ` ${time}` : ""}`;
17188
+ }
17189
+ if (freq === "YEARLY")
17190
+ return `每年${time ? ` ${time}` : ""}`;
17191
+ return text2;
17192
+ }
17193
+ function expandWhen(when, fromMs, toMs, opts = {}) {
17194
+ const text2 = when.trim();
17195
+ if (!text2)
17196
+ return { fires: [], label: "", oneShot: false };
17197
+ if (/^RRULE:/i.test(text2) || /FREQ=/i.test(text2)) {
17198
+ return { fires: expandRRule(text2, fromMs, toMs, opts), label: describeRRule(text2), oneShot: false };
17199
+ }
17200
+ const iso = Date.parse(text2);
17201
+ if (Number.isFinite(iso) && /\d{4}-\d{2}-\d{2}/.test(text2)) {
17202
+ return { fires: iso >= fromMs && iso <= toMs ? [iso] : [], label: `一次性 ${text2.slice(0, 16).replace("T", " ")}`, oneShot: true };
17203
+ }
17204
+ if (/^[\d*/,\-\s]+$/.test(text2) && text2.trim().split(/\s+/).length === 5) {
17205
+ return { fires: listCronFires(text2, fromMs, toMs, opts), label: describeCron(text2), oneShot: false };
17206
+ }
17207
+ const intervalMs = parseIntervalMs(text2);
17208
+ if (intervalMs !== null) {
17209
+ return { fires: listCronFires(text2, fromMs, toMs, opts), label: describeCron(text2), oneShot: false };
17210
+ }
17211
+ return { fires: [], label: text2, oneShot: false };
17212
+ }
17213
+ // src/domain/calendar/reconcile.ts
17214
+ function reconcileCalendarEntries(entries, nowMs) {
17215
+ const key = (entry) => entry.scheduleId && entry.scheduledAt !== undefined ? `${entry.source}:${entry.scheduleId}:${entry.scheduledAt}` : undefined;
17216
+ const runs = new Map;
17217
+ for (const entry of entries) {
17218
+ const id = key(entry);
17219
+ if (entry.kind !== "run" || !id)
17220
+ continue;
17221
+ const previous = runs.get(id);
17222
+ if (!previous || (entry.executedAt ?? entry.at) > (previous.executedAt ?? previous.at))
17223
+ runs.set(id, entry);
17224
+ }
17225
+ const merged = new Set;
17226
+ const result = [];
17227
+ for (const entry of entries) {
17228
+ if (entry.kind === "run")
17229
+ continue;
17230
+ const id = key(entry);
17231
+ const run = id ? runs.get(id) : undefined;
17232
+ if (entry.kind === "cron" && run) {
17233
+ merged.add(id);
17234
+ result.push({
17235
+ ...entry,
17236
+ state: run.state,
17237
+ executedAt: run.executedAt ?? run.at,
17238
+ sessionId: run.sessionId ?? entry.sessionId,
17239
+ detail: run.detail ?? entry.detail
17240
+ });
17241
+ } else {
17242
+ result.push(entry.kind === "cron" && entry.state === "upcoming" && entry.at < nowMs ? { ...entry, state: "overdue" } : entry);
17243
+ }
17244
+ }
17245
+ const emitted = new Set;
17246
+ for (const entry of entries) {
17247
+ if (entry.kind !== "run")
17248
+ continue;
17249
+ const id = key(entry);
17250
+ if (id && (merged.has(id) || emitted.has(id) || runs.get(id) !== entry))
17251
+ continue;
17252
+ if (id)
17253
+ emitted.add(id);
17254
+ result.push(entry);
17255
+ }
17256
+ return result;
17257
+ }
17014
17258
  // src/application/goal/ThreadGoalService.ts
17015
17259
  class ThreadGoalService {
17016
17260
  store;
@@ -17731,6 +17975,8 @@ class EngineSwitchDelivery {
17731
17975
  }
17732
17976
  // src/application/notification/task-completion.ts
17733
17977
  var DEFAULT_TASK_NOTIFICATION_PREFERENCES = {
17978
+ approvalEnabled: true,
17979
+ todoEnabled: true,
17734
17980
  completionEnabled: true,
17735
17981
  soundEnabled: true,
17736
17982
  notifyWhileForeground: false
@@ -17741,6 +17987,8 @@ function truncateCodePoints(value, max) {
17741
17987
  }
17742
17988
  function resolveTaskNotificationPreferences(value) {
17743
17989
  return {
17990
+ approvalEnabled: value?.approvalEnabled ?? true,
17991
+ todoEnabled: value?.todoEnabled ?? true,
17744
17992
  completionEnabled: value?.completionEnabled ?? DEFAULT_TASK_NOTIFICATION_PREFERENCES.completionEnabled,
17745
17993
  soundEnabled: value?.soundEnabled ?? DEFAULT_TASK_NOTIFICATION_PREFERENCES.soundEnabled,
17746
17994
  notifyWhileForeground: value?.notifyWhileForeground ?? DEFAULT_TASK_NOTIFICATION_PREFERENCES.notifyWhileForeground
@@ -18721,6 +18969,41 @@ import Database from "better-sqlite3";
18721
18969
  import { join as join12 } from "node:path";
18722
18970
  import { mkdirSync as mkdirSync3 } from "node:fs";
18723
18971
 
18972
+ // src/infrastructure/SQLiteTodoUnitOfWork.ts
18973
+ var tables = ["todo_tasks", "todo_reminder_schedules", "todo_schedule_links", "todo_reminder_occurrences", "todo_execution_schedules", "todo_executions", "todo_execution_reports", "todo_command_receipts", "notifications", "notification_deliveries"];
18974
+ function migrateTodoTables(db) {
18975
+ for (const table of tables)
18976
+ db.exec(`CREATE TABLE IF NOT EXISTS ${table} (
18977
+ ${table === "notifications" ? "sequence INTEGER PRIMARY KEY AUTOINCREMENT, id TEXT NOT NULL UNIQUE" : "id TEXT PRIMARY KEY"},
18978
+ owner_id TEXT NOT NULL, data TEXT NOT NULL, next_at INTEGER, dedupe_key TEXT,
18979
+ UNIQUE(owner_id, dedupe_key));
18980
+ CREATE INDEX IF NOT EXISTS ${table}_owner ON ${table}(owner_id);
18981
+ CREATE INDEX IF NOT EXISTS ${table}_next ON ${table}(next_at);`);
18982
+ }
18983
+
18984
+ class SQLiteTodoUnitOfWork {
18985
+ db;
18986
+ repositories;
18987
+ constructor(db) {
18988
+ this.db = db;
18989
+ migrateTodoTables(db);
18990
+ this.repositories = Object.fromEntries(tables.map((table) => {
18991
+ const decode = (row) => row ? { ...JSON.parse(row.data), ...row.sequence !== undefined ? { cursor: row.sequence } : {} } : undefined;
18992
+ return [table, {
18993
+ get: (owner, id) => decode(db.prepare(`SELECT * FROM ${table} WHERE id=? AND owner_id=?`).get(id, owner)),
18994
+ list: (owner) => (owner === undefined ? db.prepare(`SELECT * FROM ${table}`).all() : db.prepare(`SELECT * FROM ${table} WHERE owner_id=?`).all(owner)).map((row) => decode(row)),
18995
+ put: (record, dedupeKey) => {
18996
+ db.prepare(`INSERT INTO ${table}(id,owner_id,data,next_at,dedupe_key) VALUES(?,?,?,?,?) ON CONFLICT(id) DO UPDATE SET data=excluded.data,next_at=excluded.next_at WHERE owner_id=excluded.owner_id`).run(record.id, record.ownerId, JSON.stringify(record), record.nextFireAt ?? null, dedupeKey ?? null);
18997
+ }
18998
+ }];
18999
+ }));
19000
+ }
19001
+ run(work) {
19002
+ return this.db.transaction(() => work(this.repositories)).immediate();
19003
+ }
19004
+ }
19005
+
19006
+ // src/infrastructure/SQLiteDatabase.ts
18724
19007
  class SQLiteDatabase {
18725
19008
  db;
18726
19009
  constructor(baseDir) {
@@ -18730,7 +19013,7 @@ class SQLiteDatabase {
18730
19013
  try {
18731
19014
  this.db.pragma("journal_mode = WAL");
18732
19015
  this.db.pragma("foreign_keys = ON");
18733
- this.migrate();
19016
+ this.db.transaction(() => this.migrate()).immediate();
18734
19017
  } catch (error) {
18735
19018
  this.db.close();
18736
19019
  throw error;
@@ -19043,6 +19326,7 @@ class SQLiteDatabase {
19043
19326
  this.migratePinnedCommands();
19044
19327
  this.migrateCommandHistoryExitCode();
19045
19328
  this.migrateEngineSwitch();
19329
+ migrateTodoTables(this.db);
19046
19330
  }
19047
19331
  migrateCommandHistoryExitCode() {
19048
19332
  const cols = this.db.prepare("PRAGMA table_info(command_history)").all();
@@ -20861,8 +21145,10 @@ class SQLiteSettingsStore {
20861
21145
  }
20862
21146
  // src/infrastructure/SQLiteSessionStore.ts
20863
21147
  class SQLiteSessionStore {
21148
+ eventCommit;
20864
21149
  baseDir;
20865
- constructor(baseDir) {
21150
+ constructor(baseDir, eventCommit) {
21151
+ this.eventCommit = eventCommit;
20866
21152
  this.baseDir = baseDir;
20867
21153
  getDatabase(baseDir);
20868
21154
  }
@@ -20973,7 +21259,11 @@ class SQLiteSessionStore {
20973
21259
  }
20974
21260
  async addEvent(sessionId, event) {
20975
21261
  const db = getDatabase(this.baseDir);
20976
- db.db.prepare("INSERT INTO events (session_id, type, data, timestamp) VALUES (?,?,?,?)").run(sessionId, event.type, JSON.stringify(event), Date.now());
21262
+ db.db.transaction(() => {
21263
+ const at = Date.now();
21264
+ db.db.prepare("INSERT INTO events (session_id, type, data, timestamp) VALUES (?,?,?,?)").run(sessionId, event.type, JSON.stringify(event), at);
21265
+ this.eventCommit?.(db.db, sessionId, event, at);
21266
+ })();
20977
21267
  }
20978
21268
  async replaceMessages(sessionId, messages) {
20979
21269
  const db = getDatabase(this.baseDir);
@@ -22892,12 +23182,556 @@ class HarnessServiceClient {
22892
23182
  this.current = { state: "stopped" };
22893
23183
  }
22894
23184
  }
23185
+ // src/domain/todo/entities.ts
23186
+ class TodoError extends Error {
23187
+ code;
23188
+ constructor(code, message) {
23189
+ super(message);
23190
+ this.code = code;
23191
+ this.name = "TodoError";
23192
+ }
23193
+ }
23194
+ var isTodoTerminal = (task) => task.status === "completed" || task.status === "cancelled";
23195
+ function assertVersion(task, version) {
23196
+ if (!Number.isSafeInteger(version) || task.version !== version)
23197
+ throw new TodoError("VERSION_CONFLICT", "待办已被其他会话更新,请刷新后重试");
23198
+ }
23199
+ function validateTimestamp(value) {
23200
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0 || value > 8640000000000000)
23201
+ throw new TodoError("INVALID_ARGUMENT", "时间必须是有效的 UTC 毫秒时间戳");
23202
+ }
23203
+ // src/domain/todo/ReminderScheduleCalculator.ts
23204
+ function field(text2, min, max, dow = false) {
23205
+ const values = new Set;
23206
+ for (const item of text2.split(",")) {
23207
+ const match = /^(\*|\d+(?:-\d+)?)(?:\/(\d+))?$/.exec(item);
23208
+ if (!match)
23209
+ throw new TodoError("INVALID_ARGUMENT", "cron 只支持五字段数字、范围、列表及步长");
23210
+ const step = Number(match[2] ?? 1);
23211
+ const bounds = match[1] === "*" ? [min, max] : match[1].split("-").map(Number);
23212
+ const [lo, hi = match[2] ? max : lo] = bounds;
23213
+ if (step < 1 || step > max + 1 || lo < min || hi > max || lo > hi)
23214
+ throw new TodoError("INVALID_ARGUMENT", "cron 字段超出范围");
23215
+ for (let n = lo;n <= hi; n += step)
23216
+ values.add(dow && n === 7 ? 0 : n);
23217
+ }
23218
+ return { values: [...values].sort((a, b) => a - b), wildcard: text2 === "*" };
23219
+ }
23220
+
23221
+ class ReminderScheduleCalculator {
23222
+ next(trigger, timeZone, afterMs) {
23223
+ return this.calculate(trigger, timeZone, afterMs, 1);
23224
+ }
23225
+ previous(trigger, timeZone, atOrBeforeMs) {
23226
+ return this.calculate(trigger, timeZone, atOrBeforeMs, -1);
23227
+ }
23228
+ calculate(trigger, timeZone, afterMs, direction) {
23229
+ validateTimestamp(afterMs);
23230
+ let fmt;
23231
+ try {
23232
+ fmt = new Intl.DateTimeFormat("en-GB", { timeZone, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", hourCycle: "h23" });
23233
+ } catch {
23234
+ throw new TodoError("INVALID_ARGUMENT", "无效的 IANA 时区");
23235
+ }
23236
+ if (!trigger || !["once", "cron"].includes(trigger.kind))
23237
+ throw new TodoError("INVALID_ARGUMENT", "请指定一次性或 cron 触发规则");
23238
+ if (trigger.kind === "once") {
23239
+ validateTimestamp(trigger.at);
23240
+ return (direction === 1 ? trigger.at > afterMs : trigger.at <= afterMs) ? trigger.at : null;
23241
+ }
23242
+ if (typeof trigger.expression !== "string")
23243
+ throw new TodoError("INVALID_ARGUMENT", "cron 表达式不能为空");
23244
+ const tokens = trigger.expression.trim().split(/\s+/);
23245
+ if (tokens.length !== 5)
23246
+ throw new TodoError("INVALID_ARGUMENT", "cron 必须为五字段");
23247
+ const [minutes, hours, dom, months, dow] = [field(tokens[0], 0, 59), field(tokens[1], 0, 23), field(tokens[2], 1, 31), field(tokens[3], 1, 12), field(tokens[4], 0, 7, true)];
23248
+ const parts = (ms) => Object.fromEntries(fmt.formatToParts(ms).filter((p) => p.type !== "literal").map((p) => [p.type, Number(p.value)]));
23249
+ const local = parts(afterMs);
23250
+ const start = Date.UTC(local.year, local.month - 1, local.day);
23251
+ for (let index = 0;index < 366 * 8; index++) {
23252
+ const day = start + direction * index * 86400000;
23253
+ const date = new Date(day), d = date.getUTCDate(), w = date.getUTCDay();
23254
+ if (!months.values.includes(date.getUTCMonth() + 1))
23255
+ continue;
23256
+ const matchesDay = dom.wildcard ? dow.values.includes(w) : dow.wildcard ? dom.values.includes(d) : dom.values.includes(d) || dow.values.includes(w);
23257
+ if (!matchesDay)
23258
+ continue;
23259
+ const offsets = new Set;
23260
+ for (const delta of [-86400000, 0, 86400000]) {
23261
+ const probe = day + 43200000 + delta, p = parts(probe);
23262
+ offsets.add(Date.UTC(p.year, p.month - 1, p.day, p.hour, p.minute, p.second) - probe);
23263
+ }
23264
+ for (const hour of direction === 1 ? hours.values : [...hours.values].reverse())
23265
+ for (const minute of direction === 1 ? minutes.values : [...minutes.values].reverse()) {
23266
+ const wall = day + hour * 3600000 + minute * 60000;
23267
+ const candidates = [...offsets].map((offset) => wall - offset).filter((ms) => {
23268
+ const p = parts(ms);
23269
+ return p.year === date.getUTCFullYear() && p.month === date.getUTCMonth() + 1 && p.day === d && p.hour === hour && p.minute === minute;
23270
+ }).sort((a, b) => a - b);
23271
+ if (candidates[0] !== undefined && (direction === 1 ? candidates[0] > afterMs : candidates[0] <= afterMs))
23272
+ return candidates[0];
23273
+ }
23274
+ }
23275
+ return null;
23276
+ }
23277
+ }
23278
+ // src/application/todo/TodoApplicationService.ts
23279
+ import { randomUUID as randomUUID5, createHash as createHash5 } from "node:crypto";
23280
+
23281
+ // src/application/notification/NotificationService.ts
23282
+ import { createHash as createHash4 } from "node:crypto";
23283
+ function dismissTaskReminders(tx, ownerId, taskId, at) {
23284
+ for (const notification of tx.notifications.list(ownerId))
23285
+ if (notification.taskId === taskId && notification.kind === "todo_reminder" && !notification.dismissedAt)
23286
+ tx.notifications.put({ ...notification, dismissedAt: at });
23287
+ }
23288
+ function persistNotification(tx, intent) {
23289
+ const id = createHash4("sha256").update(`${intent.ownerId}\x00${intent.sourceEventId}`).digest("hex");
23290
+ const existing = tx.notifications.get(intent.ownerId, id);
23291
+ if (existing)
23292
+ return existing;
23293
+ tx.notifications.put({ ...intent, id }, intent.sourceEventId);
23294
+ return tx.notifications.get(intent.ownerId, id);
23295
+ }
23296
+
23297
+ class PersistentNotificationService {
23298
+ uow;
23299
+ clock;
23300
+ constructor(uow, clock = Date.now) {
23301
+ this.uow = uow;
23302
+ this.clock = clock;
23303
+ }
23304
+ ingest(intent) {
23305
+ return this.uow.run((tx) => persistNotification(tx, intent));
23306
+ }
23307
+ get(ownerId, id) {
23308
+ return this.uow.run((tx) => {
23309
+ const n = tx.notifications.get(ownerId, id);
23310
+ if (!n)
23311
+ throw new TodoError("NOT_FOUND", "通知不存在");
23312
+ return n;
23313
+ });
23314
+ }
23315
+ list(ownerId, afterCursor = 0) {
23316
+ return this.uow.run((tx) => tx.notifications.list(ownerId).filter((n) => (n.cursor ?? 0) > afterCursor).sort((a, b) => (a.cursor ?? 0) - (b.cursor ?? 0)).slice(afterCursor ? 0 : -200, afterCursor ? 200 : undefined));
23317
+ }
23318
+ claim(ownerId, deviceId, afterCursor = 0) {
23319
+ if (!deviceId || deviceId.length > 200)
23320
+ throw new TodoError("INVALID_ARGUMENT", "设备标识无效");
23321
+ return this.uow.run((tx) => {
23322
+ const now2 = this.clock();
23323
+ const all = tx.notifications.list(ownerId).filter((n) => (n.cursor ?? 0) > afterCursor).sort((a, b) => (a.cursor ?? 0) - (b.cursor ?? 0));
23324
+ const items = [];
23325
+ let cursor = afterCursor;
23326
+ for (const n of all.slice(0, 200)) {
23327
+ const id = createHash4("sha256").update(`${n.id}\x00${deviceId}`).digest("hex");
23328
+ const delivery = tx.notification_deliveries.get(ownerId, id);
23329
+ if (delivery && !delivery.acknowledgedAt && !delivery.displayedAt && delivery.leasedUntil > now2)
23330
+ break;
23331
+ cursor = n.cursor;
23332
+ const task = n.taskId ? tx.todo_tasks.get(ownerId, n.taskId) : undefined;
23333
+ if (n.reminderScheduleId && tx.todo_reminder_schedules.get(ownerId, n.reminderScheduleId)?.generation !== n.reminderGeneration)
23334
+ continue;
23335
+ if (n.readAt || n.dismissedAt || n.kind === "todo_reminder" && (!task || isTodoTerminal(task)))
23336
+ continue;
23337
+ if ((n.kind === "completion" || n.kind === "todo_execution") && now2 - n.createdAt > 600000)
23338
+ continue;
23339
+ if (delivery?.displayedAt || delivery?.acknowledgedAt)
23340
+ continue;
23341
+ if ((n.kind === "todo_reminder" || n.kind === "todo_execution") && all.some((other) => other.taskId === n.taskId && other.kind === n.kind && other.createdAt > n.createdAt))
23342
+ continue;
23343
+ tx.notification_deliveries.put({ id, ownerId, notificationId: n.id, deviceId, leasedUntil: now2 + 30000 });
23344
+ items.push(n);
23345
+ }
23346
+ return { items, cursor };
23347
+ });
23348
+ }
23349
+ ack(ownerId, id, deviceId, read = false, displayed = true) {
23350
+ return this.uow.run((tx) => {
23351
+ const notification = tx.notifications.get(ownerId, id);
23352
+ if (!notification)
23353
+ throw new TodoError("NOT_FOUND", "通知不存在");
23354
+ if (read)
23355
+ tx.notifications.put({ ...notification, readAt: this.clock() });
23356
+ else {
23357
+ const key = createHash4("sha256").update(`${id}\x00${deviceId}`).digest("hex");
23358
+ tx.notification_deliveries.put({ id: key, ownerId, notificationId: id, deviceId, leasedUntil: 0, acknowledgedAt: this.clock(), ...displayed ? { displayedAt: this.clock() } : {} });
23359
+ }
23360
+ return { ok: true };
23361
+ });
23362
+ }
23363
+ resolveApproval(ownerId, sessionId, questionId) {
23364
+ this.uow.run((tx) => {
23365
+ for (const n of tx.notifications.list(ownerId))
23366
+ if (n.kind === "approval" && n.sessionId === sessionId && (!questionId || n.questionId === questionId))
23367
+ tx.notifications.put({ ...n, dismissedAt: this.clock() });
23368
+ });
23369
+ }
23370
+ }
23371
+
23372
+ // src/application/todo/TodoApplicationService.ts
23373
+ var canonical = (v) => v && typeof v === "object" ? Array.isArray(v) ? `[${v.map(canonical).join(",")}]` : `{${Object.entries(v).filter(([, x]) => x !== undefined).sort(([a], [b]) => a.localeCompare(b)).map(([k, x]) => `${JSON.stringify(k)}:${canonical(x)}`).join(",")}}` : JSON.stringify(v);
23374
+ function todoDetail(tx, ownerId, id) {
23375
+ const task = tx.todo_tasks.get(ownerId, id);
23376
+ if (!task)
23377
+ throw new TodoError("NOT_FOUND", "待办不存在");
23378
+ const executions = tx.todo_executions.list(ownerId).filter((x) => x.taskId === id).sort((a, b) => b.scheduledAt - a.scheduledAt || b.id.localeCompare(a.id));
23379
+ return { task, reminders: tx.todo_reminder_schedules.list(ownerId).filter((x) => x.taskId === id), links: tx.todo_schedule_links.list(ownerId).filter((x) => x.taskId === id), schedule: tx.todo_execution_schedules.list(ownerId).find((x) => x.taskId === id), executions: executions.slice(0, 10), ...executions.length > 10 ? { executionCursor: executions[9].id } : {} };
23380
+ }
23381
+
23382
+ class TodoApplicationService {
23383
+ uow;
23384
+ clock;
23385
+ calculator;
23386
+ constructor(uow, clock = Date.now, calculator = new ReminderScheduleCalculator) {
23387
+ this.uow = uow;
23388
+ this.clock = clock;
23389
+ this.calculator = calculator;
23390
+ }
23391
+ get(id, ownerId) {
23392
+ return this.uow.run((tx) => todoDetail(tx, ownerId, id));
23393
+ }
23394
+ list(query, ownerId) {
23395
+ return this.uow.run((tx) => {
23396
+ let tasks = tx.todo_tasks.list(ownerId).filter((t) => (!query.status || t.status === query.status) && (!query.kind || t.kind === query.kind)).sort((a, b) => b.createdAt - a.createdAt || b.id.localeCompare(a.id));
23397
+ if (query.cursor) {
23398
+ const at = tasks.findIndex((t) => t.id === query.cursor);
23399
+ tasks = at < 0 ? [] : tasks.slice(at + 1);
23400
+ }
23401
+ const limit = Math.max(1, Math.min(200, Number(query.limit) || 50)), page = tasks.slice(0, limit);
23402
+ return { items: page.map((t) => todoDetail(tx, ownerId, t.id)), ...tasks.length > limit ? { cursor: page[page.length - 1].id } : {} };
23403
+ });
23404
+ }
23405
+ executions(id, ownerId, cursor) {
23406
+ return this.uow.run((tx) => {
23407
+ todoDetail(tx, ownerId, id);
23408
+ let all = tx.todo_executions.list(ownerId).filter((x) => x.taskId === id).sort((a, b) => b.scheduledAt - a.scheduledAt || b.id.localeCompare(a.id));
23409
+ if (cursor) {
23410
+ const at = all.findIndex((x) => x.id === cursor);
23411
+ all = at < 0 ? [] : all.slice(at + 1);
23412
+ }
23413
+ return { items: all.slice(0, 10), ...all.length > 10 ? { cursor: all[9].id } : {} };
23414
+ });
23415
+ }
23416
+ execute(command, context) {
23417
+ if (!command || !["create", "update", "start", "complete", "cancel", "reopen", "remind", "linkSchedule", "schedule"].includes(command.type))
23418
+ throw new TodoError("INVALID_ARGUMENT", "未知待办操作");
23419
+ if (command.type !== "create")
23420
+ text2(command.taskId, 200);
23421
+ if (!context.ownerId || typeof context.requestId !== "string" || context.requestId.length < 1 || context.requestId.length > 200)
23422
+ throw new TodoError("INVALID_ARGUMENT", "写操作需要稳定的 requestId");
23423
+ const fingerprint = createHash5("sha256").update(canonical(command)).digest("hex");
23424
+ const receiptId = createHash5("sha256").update(`${context.ownerId}\x00${context.requestId}`).digest("hex");
23425
+ return this.uow.run((tx) => {
23426
+ const receipt = tx.todo_command_receipts.get(context.ownerId, receiptId);
23427
+ if (receipt) {
23428
+ if (receipt.fingerprint !== fingerprint)
23429
+ throw new TodoError("IDEMPOTENCY_CONFLICT", "同一 requestId 不能用于不同操作");
23430
+ return receipt.result;
23431
+ }
23432
+ const now2 = this.clock();
23433
+ let task;
23434
+ if (command.type === "create") {
23435
+ if (command.kind && !["normal", "scheduled"].includes(command.kind))
23436
+ throw new TodoError("INVALID_ARGUMENT", "无效的待办类型");
23437
+ if (command.dueAt !== undefined)
23438
+ validateTimestamp(command.dueAt);
23439
+ task = { id: randomUUID5(), ownerId: context.ownerId, title: text2(command.title, 300), description: text2(command.description ?? "", 20000, true), kind: command.kind ?? "normal", status: "pending", timeZone: command.timeZone ?? "Asia/Shanghai", version: 1, controlRevision: 0, createdAt: now2, updatedAt: now2, ...command.dueAt !== undefined ? { dueAt: command.dueAt } : {}, ...command.projectId ? { projectId: text2(command.projectId, 200) } : {}, ...context.sourceSessionRef ? { sourceSessionRef: context.sourceSessionRef } : {} };
23440
+ this.calculator.next({ kind: "once", at: now2 + 1 }, task.timeZone, now2);
23441
+ const reminder = command.reminder === undefined ? command.dueAt !== undefined && command.dueAt > now2 ? { kind: "once", at: command.dueAt } : undefined : command.reminder;
23442
+ if (reminder)
23443
+ tx.todo_reminder_schedules.put({ id: randomUUID5(), ownerId: task.ownerId, taskId: task.id, trigger: reminder, timeZone: task.timeZone, enabled: true, generation: 1, nextFireAt: this.next(reminder, task.timeZone, now2), origin: command.reminder === undefined ? "due" : "custom" });
23444
+ else if (command.reminder === null)
23445
+ tx.todo_reminder_schedules.put({ id: randomUUID5(), ownerId: task.ownerId, taskId: task.id, trigger: { kind: "once", at: task.dueAt ?? now2 }, timeZone: task.timeZone, enabled: false, generation: 1, nextFireAt: null, origin: "custom" });
23446
+ if (command.executionSchedule) {
23447
+ if (task.kind !== "scheduled")
23448
+ throw new TodoError("INVALID_ARGUMENT", "只有定时任务类型可以设置自动执行计划");
23449
+ const schedule = command.executionSchedule, timeZone = schedule.timeZone ?? task.timeZone, target = schedule.target;
23450
+ if (!target)
23451
+ throw new TodoError("INVALID_ARGUMENT", "执行计划缺少 Agent 配置");
23452
+ text2(target.agentType, 100);
23453
+ text2(target.cwd, 4000);
23454
+ if (!["default", "acceptEdits", "bypassPermissions"].includes(target.permissionMode))
23455
+ throw new TodoError("INVALID_ARGUMENT", "无效的权限设置");
23456
+ const nextFireAt = this.next(schedule.trigger, timeZone, now2);
23457
+ tx.todo_execution_schedules.put({ id: randomUUID5(), ownerId: task.ownerId, taskId: task.id, trigger: schedule.trigger, target, timeZone, enabled: schedule.enabled !== false, generation: 1, nextFireAt: schedule.enabled === false ? null : nextFireAt });
23458
+ }
23459
+ if (command.scheduleRef)
23460
+ tx.todo_schedule_links.put({ id: randomUUID5(), ownerId: task.ownerId, taskId: task.id, scheduleRef: text2(command.scheduleRef, 2000) });
23461
+ } else {
23462
+ task = tx.todo_tasks.get(context.ownerId, command.taskId);
23463
+ if (!task)
23464
+ throw new TodoError("NOT_FOUND", "待办不存在");
23465
+ assertVersion(task, command.expectedVersion);
23466
+ if (command.type === "update") {
23467
+ const oldDueAt = task.dueAt;
23468
+ if (!command.patch || typeof command.patch !== "object")
23469
+ throw new TodoError("INVALID_ARGUMENT", "缺少修改内容");
23470
+ if (command.patch.title !== undefined)
23471
+ task.title = text2(command.patch.title, 300);
23472
+ if (command.patch.description !== undefined)
23473
+ task.description = text2(command.patch.description, 20000, true);
23474
+ if (command.patch.dueAt === null)
23475
+ delete task.dueAt;
23476
+ else if (command.patch.dueAt !== undefined) {
23477
+ validateTimestamp(command.patch.dueAt);
23478
+ task.dueAt = command.patch.dueAt;
23479
+ }
23480
+ if (command.patch.projectId !== undefined)
23481
+ task.projectId = text2(command.patch.projectId, 200, true);
23482
+ if (task.dueAt !== oldDueAt && !isTodoTerminal(task)) {
23483
+ const old = tx.todo_reminder_schedules.list(context.ownerId).find((s) => s.taskId === task.id);
23484
+ if (!old || old.origin === "due") {
23485
+ dismissTaskReminders(tx, context.ownerId, task.id, now2);
23486
+ const enabled = task.dueAt !== undefined && task.dueAt > now2;
23487
+ tx.todo_reminder_schedules.put({ id: old?.id ?? randomUUID5(), ownerId: task.ownerId, taskId: task.id, trigger: { kind: "once", at: task.dueAt ?? now2 }, timeZone: task.timeZone ?? "Asia/Shanghai", enabled, nextFireAt: enabled ? task.dueAt : null, generation: (old?.generation ?? 0) + 1, origin: "due" });
23488
+ }
23489
+ }
23490
+ } else if (["start", "complete", "cancel", "reopen"].includes(command.type)) {
23491
+ if (isTodoTerminal(task) && command.type === "start")
23492
+ throw new TodoError("INVALID_ARGUMENT", "请先重新打开待办");
23493
+ task.status = { start: "in_progress", complete: "completed", cancel: "cancelled", reopen: "pending" }[command.type];
23494
+ task.controlRevision++;
23495
+ if (command.type !== "start") {
23496
+ dismissTaskReminders(tx, context.ownerId, task.id, now2);
23497
+ delete task.activeExecutionId;
23498
+ for (const schedule of tx.todo_reminder_schedules.list(context.ownerId).filter((s) => s.taskId === task.id))
23499
+ tx.todo_reminder_schedules.put({ ...schedule, enabled: false, generation: schedule.generation + 1, nextFireAt: null });
23500
+ for (const schedule of tx.todo_execution_schedules.list(context.ownerId).filter((s) => s.taskId === task.id))
23501
+ tx.todo_execution_schedules.put({ ...schedule, enabled: false, generation: schedule.generation + 1, nextFireAt: null });
23502
+ }
23503
+ } else if (command.type === "remind") {
23504
+ dismissTaskReminders(tx, context.ownerId, task.id, now2);
23505
+ if (isTodoTerminal(task) && command.trigger)
23506
+ throw new TodoError("INVALID_ARGUMENT", "已结束待办不能设置提醒");
23507
+ const old = tx.todo_reminder_schedules.list(context.ownerId).find((s) => s.taskId === task.id);
23508
+ const timeZone = command.timeZone ?? old?.timeZone ?? "Asia/Shanghai";
23509
+ const nextFireAt = command.trigger ? this.next(command.trigger, timeZone, now2) : null;
23510
+ tx.todo_reminder_schedules.put({ id: old?.id ?? randomUUID5(), ownerId: context.ownerId, taskId: task.id, trigger: command.trigger ?? old?.trigger ?? { kind: "once", at: now2 }, timeZone, enabled: !!command.trigger, generation: (old?.generation ?? 0) + 1, nextFireAt, origin: "custom" });
23511
+ } else if (command.type === "linkSchedule") {
23512
+ const scheduleRef = text2(command.scheduleRef, 2000);
23513
+ const id = createHash5("sha256").update(`${task.id}:${scheduleRef}`).digest("hex");
23514
+ tx.todo_schedule_links.put({ id, ownerId: context.ownerId, taskId: task.id, scheduleRef, ...command.label ? { label: text2(command.label, 300) } : {} });
23515
+ } else if (command.type === "schedule") {
23516
+ if (task.kind !== "scheduled")
23517
+ throw new TodoError("INVALID_ARGUMENT", "只有定时任务类型可以自动执行;提醒和关联不会改变待办类型");
23518
+ if (typeof command.enabled !== "boolean")
23519
+ throw new TodoError("INVALID_ARGUMENT", "请指定是否启用执行计划");
23520
+ if (isTodoTerminal(task) && command.enabled)
23521
+ throw new TodoError("INVALID_ARGUMENT", "请先重新打开待办");
23522
+ const old = tx.todo_execution_schedules.list(context.ownerId).find((s) => s.taskId === task.id);
23523
+ if (task.activeExecutionId && (command.trigger || command.target || command.timeZone))
23524
+ throw new TodoError("BUSY", "执行中不能更换触发规则或 Agent,可暂停后续执行");
23525
+ const target = command.target ?? old?.target, trigger = command.trigger ?? old?.trigger;
23526
+ if (!target || !trigger)
23527
+ throw new TodoError("INVALID_ARGUMENT", "执行计划需要触发规则和 Agent 配置");
23528
+ text2(target.agentType, 100);
23529
+ text2(target.cwd, 4000);
23530
+ if (!["default", "acceptEdits", "bypassPermissions"].includes(target.permissionMode))
23531
+ throw new TodoError("INVALID_ARGUMENT", "无效的权限设置");
23532
+ const timeZone = command.timeZone ?? old?.timeZone ?? "Asia/Shanghai";
23533
+ tx.todo_execution_schedules.put({ id: old?.id ?? randomUUID5(), ownerId: context.ownerId, taskId: task.id, trigger, timeZone, target, generation: (old?.generation ?? 0) + 1, enabled: command.enabled, nextFireAt: command.enabled ? this.next(trigger, timeZone, now2) : null });
23534
+ } else
23535
+ throw new TodoError("INVALID_ARGUMENT", "未知待办操作");
23536
+ task.version++;
23537
+ task.updatedAt = now2;
23538
+ }
23539
+ tx.todo_tasks.put(task);
23540
+ const result = todoDetail(tx, context.ownerId, task.id);
23541
+ tx.todo_command_receipts.put({ id: receiptId, ownerId: context.ownerId, fingerprint, result });
23542
+ return result;
23543
+ });
23544
+ }
23545
+ next(trigger, timeZone, now2) {
23546
+ const next = this.calculator.next(trigger, timeZone, now2);
23547
+ if (next === null)
23548
+ throw new TodoError("INVALID_ARGUMENT", "触发时间必须在未来且有有效的下一次触发");
23549
+ return next;
23550
+ }
23551
+ }
23552
+ function text2(value, limit, empty = false) {
23553
+ if (typeof value !== "string" || !empty && !value.trim() || value.length > limit)
23554
+ throw new TodoError("INVALID_ARGUMENT", `文本不能为空且不能超过 ${limit} 字符`);
23555
+ return value.trim();
23556
+ }
23557
+ // src/application/todo/TodoScheduler.ts
23558
+ import { createHash as createHash6 } from "node:crypto";
23559
+ var occurrenceId = (id, generation, at) => createHash6("sha256").update(`${id}:${generation}:${at}`).digest("hex");
23560
+
23561
+ class TodoScheduler {
23562
+ uow;
23563
+ calculator;
23564
+ constructor(uow, calculator = new ReminderScheduleCalculator) {
23565
+ this.uow = uow;
23566
+ this.calculator = calculator;
23567
+ }
23568
+ tick(now2) {
23569
+ return this.uow.run((tx) => {
23570
+ let reminded = 0, queued = 0, missed = 0, skipped = 0;
23571
+ for (const s of tx.todo_reminder_schedules.list()) {
23572
+ if (!s.enabled || s.nextFireAt === null || s.nextFireAt > now2)
23573
+ continue;
23574
+ const task = tx.todo_tasks.get(s.ownerId, s.taskId);
23575
+ if (!task || isTodoTerminal(task))
23576
+ continue;
23577
+ const scheduledAt = this.calculator.previous(s.trigger, s.timeZone, now2) ?? s.nextFireAt;
23578
+ const id = occurrenceId(s.id, s.generation, scheduledAt);
23579
+ if (!tx.todo_reminder_occurrences.get(s.ownerId, id)) {
23580
+ tx.todo_reminder_occurrences.put({ id, ownerId: s.ownerId, taskId: task.id, scheduleId: s.id, generation: s.generation, scheduledAt });
23581
+ persistNotification(tx, { ownerId: s.ownerId, sourceEventId: `reminder:${id}`, kind: "todo_reminder", taskId: task.id, reminderScheduleId: s.id, reminderGeneration: s.generation, title: "待办提醒", body: task.title, createdAt: now2 });
23582
+ reminded++;
23583
+ }
23584
+ s.nextFireAt = this.calculator.next(s.trigger, s.timeZone, now2);
23585
+ if (s.nextFireAt === null)
23586
+ s.enabled = false;
23587
+ tx.todo_reminder_schedules.put(s);
23588
+ }
23589
+ for (const s of tx.todo_execution_schedules.list()) {
23590
+ if (!s.enabled || s.nextFireAt === null || s.nextFireAt > now2)
23591
+ continue;
23592
+ const task = tx.todo_tasks.get(s.ownerId, s.taskId);
23593
+ if (!task || task.kind !== "scheduled" || isTodoTerminal(task))
23594
+ continue;
23595
+ const id = occurrenceId(s.id, s.generation, s.nextFireAt);
23596
+ if (!tx.todo_executions.get(s.ownerId, id)) {
23597
+ const late2 = now2 - s.nextFireAt > 300000;
23598
+ const busy = !!task.activeExecutionId;
23599
+ const execution = { id, ownerId: s.ownerId, taskId: task.id, scheduleId: s.id, generation: s.generation, scheduledAt: s.nextFireAt, controlRevision: task.controlRevision, status: busy ? "skipped" : late2 ? "missed" : "queued", target: s.target };
23600
+ tx.todo_executions.put(execution);
23601
+ if (busy)
23602
+ skipped++;
23603
+ else if (late2) {
23604
+ missed++;
23605
+ persistNotification(tx, { ownerId: task.ownerId, sourceEventId: `execution:${id}:missed`, kind: "todo_execution", taskId: task.id, executionId: id, title: "定时待办错过执行", body: task.title, createdAt: now2 });
23606
+ } else {
23607
+ task.activeExecutionId = id;
23608
+ task.version++;
23609
+ task.updatedAt = now2;
23610
+ tx.todo_tasks.put(task);
23611
+ queued++;
23612
+ }
23613
+ }
23614
+ s.nextFireAt = this.calculator.next(s.trigger, s.timeZone, now2);
23615
+ if (s.nextFireAt === null)
23616
+ s.enabled = false;
23617
+ tx.todo_execution_schedules.put(s);
23618
+ }
23619
+ return { reminded, queued, missed, skipped };
23620
+ });
23621
+ }
23622
+ }
23623
+
23624
+ class TodoExecutionService {
23625
+ uow;
23626
+ clock;
23627
+ constructor(uow, clock = Date.now) {
23628
+ this.uow = uow;
23629
+ this.clock = clock;
23630
+ }
23631
+ pending() {
23632
+ return this.uow.run((tx) => tx.todo_executions.list().filter((e) => ["queued", "running", "waiting_for_human"].includes(e.status)));
23633
+ }
23634
+ bind(ownerId, executionId, sessionId, runId) {
23635
+ return this.uow.run((tx) => {
23636
+ const e = tx.todo_executions.get(ownerId, executionId);
23637
+ if (!e)
23638
+ throw new TodoError("NOT_FOUND", "执行不存在");
23639
+ if (e.sessionId && e.sessionId !== sessionId || e.runId && runId && e.runId !== runId)
23640
+ throw new TodoError("VERSION_CONFLICT", "执行已绑定其他运行");
23641
+ if (runId && !e.runId) {
23642
+ const current = tx.todo_tasks.get(ownerId, e.taskId);
23643
+ if (!current || current.activeExecutionId !== e.id || current.controlRevision !== e.controlRevision || isTodoTerminal(current))
23644
+ throw new TodoError("VERSION_CONFLICT", "用户已更改待办,禁止启动过期执行");
23645
+ if (this.clock() - e.scheduledAt > 300000)
23646
+ throw new TodoError("VERSION_CONFLICT", "执行启动已超过五分钟宽限期");
23647
+ }
23648
+ if (!["queued", "running", "waiting_for_human"].includes(e.status))
23649
+ return e;
23650
+ if (e.sessionId === sessionId && e.runId === runId)
23651
+ return e;
23652
+ e.sessionId = sessionId;
23653
+ if (runId)
23654
+ e.runId = runId;
23655
+ if (runId) {
23656
+ e.status = "running";
23657
+ e.startedAt ??= this.clock();
23658
+ }
23659
+ tx.todo_executions.put(e);
23660
+ const task = tx.todo_tasks.get(ownerId, e.taskId);
23661
+ if (runId && task?.activeExecutionId === e.id && task.controlRevision === e.controlRevision && !isTodoTerminal(task)) {
23662
+ task.status = "in_progress";
23663
+ task.version++;
23664
+ task.updatedAt = this.clock();
23665
+ tx.todo_tasks.put(task);
23666
+ }
23667
+ return e;
23668
+ });
23669
+ }
23670
+ report(ownerId, executionId, runId, requestId, outcome, summary) {
23671
+ if (!requestId || requestId.length > 200 || !["progress", "succeeded", "failed"].includes(outcome) || typeof summary !== "string" || summary.length > 20000)
23672
+ throw new TodoError("INVALID_ARGUMENT", "执行报告参数无效");
23673
+ return this.uow.run((tx) => {
23674
+ const e = tx.todo_executions.get(ownerId, executionId);
23675
+ if (!e || !e.runId || e.runId !== runId)
23676
+ throw new TodoError("FORBIDDEN", "报告仅限当前已绑定的执行");
23677
+ const id = occurrenceId(executionId, 0, 0) + createHash6("sha256").update(requestId).digest("hex");
23678
+ const old = tx.todo_execution_reports.get(ownerId, id);
23679
+ if (old) {
23680
+ if (old.outcome !== outcome || old.summary !== summary)
23681
+ throw new TodoError("IDEMPOTENCY_CONFLICT", "报告 requestId 已被使用");
23682
+ return old;
23683
+ }
23684
+ if (!["running", "waiting_for_human"].includes(e.status))
23685
+ throw new TodoError("VERSION_CONFLICT", "该次执行已结束");
23686
+ const task = tx.todo_tasks.get(ownerId, e.taskId);
23687
+ if (!task || task.activeExecutionId !== executionId || task.controlRevision !== e.controlRevision || isTodoTerminal(task))
23688
+ throw new TodoError("VERSION_CONFLICT", "待办已由用户更改,本次执行不能继续更新");
23689
+ const report = { id, ownerId, executionId, outcome, summary: summary.trim(), createdAt: this.clock() };
23690
+ tx.todo_execution_reports.put(report);
23691
+ e.status = "running";
23692
+ e.report = outcome;
23693
+ e.summary = report.summary;
23694
+ tx.todo_executions.put(e);
23695
+ return report;
23696
+ });
23697
+ }
23698
+ settle(ownerId, executionId, runtimeStatus, error) {
23699
+ return this.uow.run((tx) => {
23700
+ const e = tx.todo_executions.get(ownerId, executionId);
23701
+ if (!e)
23702
+ throw new TodoError("NOT_FOUND", "执行不存在");
23703
+ if (!["queued", "running", "waiting_for_human"].includes(e.status))
23704
+ return e;
23705
+ e.status = runtimeStatus === "completed" ? e.report === "succeeded" ? "succeeded" : e.report === "failed" ? "failed" : "needs_review" : runtimeStatus === "cancelled" ? "cancelled" : "failed";
23706
+ e.finishedAt = this.clock();
23707
+ e.error = error;
23708
+ tx.todo_executions.put(e);
23709
+ const task = tx.todo_tasks.get(ownerId, e.taskId);
23710
+ if (task && task.activeExecutionId === e.id && task.controlRevision === e.controlRevision && !isTodoTerminal(task)) {
23711
+ const schedule = tx.todo_execution_schedules.get(ownerId, e.scheduleId);
23712
+ task.status = e.status === "succeeded" ? schedule?.trigger.kind === "cron" ? "pending" : "completed" : "failed";
23713
+ if (task.status === "completed") {
23714
+ dismissTaskReminders(tx, ownerId, task.id, this.clock());
23715
+ for (const reminder of tx.todo_reminder_schedules.list(ownerId).filter((r) => r.taskId === task.id))
23716
+ tx.todo_reminder_schedules.put({ ...reminder, enabled: false, generation: reminder.generation + 1, nextFireAt: null });
23717
+ }
23718
+ delete task.activeExecutionId;
23719
+ task.version++;
23720
+ task.updatedAt = this.clock();
23721
+ tx.todo_tasks.put(task);
23722
+ persistNotification(tx, { ownerId, sourceEventId: `execution:${e.id}:result`, kind: "todo_execution", taskId: task.id, sessionId: e.sessionId, executionId: e.id, title: e.status === "succeeded" ? "定时待办执行完成" : e.status === "needs_review" ? "定时待办需要核实" : "定时待办执行未完成", body: `${task.title}${e.summary ? `:${e.summary}` : error ? `:${error}` : ""}`.slice(0, 500), createdAt: this.clock() });
23723
+ }
23724
+ return e;
23725
+ });
23726
+ }
23727
+ }
22895
23728
  export {
22896
23729
  writeSessionGoalState,
22897
23730
  withPendingAutoTitle,
22898
23731
  visibleWorkspaceIds,
22899
23732
  verifyPassword,
22900
23733
  validateToolExecutionPolicy,
23734
+ validateTimestamp,
22901
23735
  validateSavedComputerPages,
22902
23736
  validateReleaseManifest,
22903
23737
  validatePinnedCommands,
@@ -22912,11 +23746,13 @@ export {
22912
23746
  toolExecutionPolicySummary,
22913
23747
  toolApprovalDecisionFromAnswer,
22914
23748
  todoState,
23749
+ todoDetail,
22915
23750
  threadDisplayMessages,
22916
23751
  textLines,
22917
23752
  textLineStats,
22918
23753
  summarizeFileChanges,
22919
23754
  splitCompoundVideoBitRate,
23755
+ sourceError,
22920
23756
  shouldContinueThreadGoal,
22921
23757
  setSessionPermissionMode,
22922
23758
  sessionQueueItemKind,
@@ -22941,6 +23777,7 @@ export {
22941
23777
  registerBuiltinTools,
22942
23778
  reduceRuntimeProgress,
22943
23779
  recordThreadGoalUsage,
23780
+ reconcileCalendarEntries,
22944
23781
  readWebShellOpenBrowserLive,
22945
23782
  readWebProjectRequest,
22946
23783
  readWebBrowserRequest,
@@ -22953,6 +23790,7 @@ export {
22953
23790
  promoteNextSessionQueueItem,
22954
23791
  projectSessionGoals,
22955
23792
  projectSessionActivity,
23793
+ persistNotification,
22956
23794
  parseWebShellOpenBrowserLive,
22957
23795
  parseWebProjectResponse,
22958
23796
  parseWebProjectRequest,
@@ -22980,6 +23818,7 @@ export {
22980
23818
  newSessionMetadata,
22981
23819
  navigationLayoutSwitchTitle,
22982
23820
  monitoringConfiguration,
23821
+ migrateTodoTables,
22983
23822
  mergeReasoningSummaryDelta,
22984
23823
  logGlobal,
22985
23824
  localDateKey,
@@ -22987,6 +23826,7 @@ export {
22987
23826
  isWebMediaUrl,
22988
23827
  isVersionAtLeast,
22989
23828
  isToolPermissionMode,
23829
+ isTodoTerminal,
22990
23830
  isThreadGoalStatus,
22991
23831
  isPathInsideRoot,
22992
23832
  isNavigationLayout,
@@ -23014,6 +23854,8 @@ export {
23014
23854
  extractReplyAfterBaseline,
23015
23855
  extractReplyAfterAnchor,
23016
23856
  expectedUpdateFileName,
23857
+ expandWhen,
23858
+ expandRRule,
23017
23859
  estimateTextTokens,
23018
23860
  estimateRequestTokens,
23019
23861
  enqueueSessionMessage,
@@ -23022,7 +23864,9 @@ export {
23022
23864
  encodeSessionHistoryAnchor,
23023
23865
  encodeLiveFramePacket,
23024
23866
  encodeCompoundTiles,
23867
+ dismissTaskReminders,
23025
23868
  desktopOfflineError,
23869
+ describeRRule,
23026
23870
  describeCron,
23027
23871
  defaultPinnedCommands,
23028
23872
  defaultComputerSettings,
@@ -23059,6 +23903,7 @@ export {
23059
23903
  buildCliInstallScriptUrl,
23060
23904
  buildCliInstallManifestUrl,
23061
23905
  buildBudgetExhaustedMessage,
23906
+ assertVersion,
23062
23907
  WriteFileTool,
23063
23908
  WebSearchTool,
23064
23909
  WebFetchTool,
@@ -23081,7 +23926,11 @@ export {
23081
23926
  ToolPermissionGate,
23082
23927
  ToolExecutionPolicyError,
23083
23928
  TodoUpdateTool,
23929
+ TodoScheduler,
23084
23930
  TodoListTool,
23931
+ TodoExecutionService,
23932
+ TodoError,
23933
+ TodoApplicationService,
23085
23934
  TodoAddTool,
23086
23935
  ThreadGoalService,
23087
23936
  TerminalSession,
@@ -23104,6 +23953,7 @@ export {
23104
23953
  SQLiteWebConsoleStore,
23105
23954
  SQLiteUploadStore,
23106
23955
  SQLiteToolExecutionPolicyStore,
23956
+ SQLiteTodoUnitOfWork,
23107
23957
  SQLiteThreadGoalStore,
23108
23958
  SQLiteSupervisionRepository,
23109
23959
  SQLiteSkillStore,
@@ -23141,6 +23991,7 @@ export {
23141
23991
  RemoteCompoundQualityPolicy,
23142
23992
  RemoteCompoundBudgetPolicy,
23143
23993
  RemoteAudioSession,
23994
+ ReminderScheduleCalculator,
23144
23995
  ReadFileTool,
23145
23996
  REMOTE_VIDEO_STALL_TIMEOUT_MS,
23146
23997
  REMOTE_VIDEO_PROFILES,
@@ -23148,6 +23999,7 @@ export {
23148
23999
  REMOTE_COMPOUND_VIDEO,
23149
24000
  PolicyAwareToolExecutor,
23150
24001
  PluginManager,
24002
+ PersistentNotificationService,
23151
24003
  PermissionAwareToolExecutor,
23152
24004
  PASSWORD_VERSION,
23153
24005
  OpenAIProvider,
@@ -23199,6 +24051,7 @@ export {
23199
24051
  EngineSwitchError,
23200
24052
  EngineSwitchDelivery,
23201
24053
  EMPTY_SESSION_GOAL_STATE,
24054
+ EMPTY_RESULT,
23202
24055
  DispatchAgentTool,
23203
24056
  DeepSeekProvider,
23204
24057
  DailyFileLogger,
@@ -23250,4 +24103,4 @@ export {
23250
24103
  AGENTROAM_CLI_INSTALL_BASE
23251
24104
  };
23252
24105
 
23253
- //# debugId=157270166F9E746C64756E2164756E21
24106
+ //# debugId=526200D0CD2019A964756E2164756E21