agentroam-runtime-darwin-arm64 0.2.0-preview.74 → 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 (386) 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 -0
  42. package/runtime/.next/server/app/api/calendar/route.js.nft.json +1 -0
  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 +34 -21
  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-53531bb27b3b87f8.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-93c452d518291b1c.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 +942 -12
  197. package/runtime/node_modules/@agent/native-runtime/dist/index.js +37966 -19280
  198. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/README.md +1 -1
  199. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/bridge.mjs +94 -98
  200. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/browser-sdk.js +77 -74
  201. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-25bstexa.mjs +17 -0
  202. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-4ps8vwh1.mjs +42 -0
  203. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-9a7zb9bm.mjs +53 -0
  204. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-zg882d22.mjs → core-a8ty0dnc.mjs} +2 -2
  205. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-ae73vzp2.mjs +18 -0
  206. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-fxa8mwbm.mjs → core-dsa3p77h.mjs} +4 -4
  207. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-9je8ee1j.mjs → core-e93r8awg.mjs} +2 -2
  208. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-eqz9ara6.mjs +18 -0
  209. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-esw7xtkz.mjs +17 -0
  210. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-ey906mbk.mjs +20 -0
  211. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-k19jejpn.mjs +16 -0
  212. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-x3hc9abc.mjs → core-kag24kjr.mjs} +3 -3
  213. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-mhczx7zp.mjs +18 -0
  214. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-nfa6p2rw.mjs +17 -0
  215. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-v6sp3qjw.mjs +18 -0
  216. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core.mjs +12 -11
  217. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.json +22 -22
  218. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.zst.json +26 -26
  219. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/package.json +25 -21
  220. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +87 -88
  221. package/runtime/package-lock.json +35 -35
  222. package/runtime/server.js +1 -1
  223. package/runtime/webapp/dist/assets/AIHubView-DF0D5qd2.js +1 -0
  224. package/runtime/webapp/dist/assets/{AgentManager-BLHvEA2d.js → AgentManager-Ccj6ZefC.js} +2 -2
  225. package/runtime/webapp/dist/assets/{AiHubPane-CWvL3HSl.js → AiHubPane-3PRSxzO0.js} +1 -1
  226. package/runtime/webapp/dist/assets/App-CtLZIOFu.css +1 -0
  227. package/runtime/webapp/dist/assets/App-HomcUet2.js +63 -0
  228. package/runtime/webapp/dist/assets/BrowserLivePanel-BZDtF0ne.js +66 -0
  229. package/runtime/webapp/dist/assets/CalendarPage-B8Jo-3Da.js +1 -0
  230. package/runtime/webapp/dist/assets/CalendarView-BD7GhA0i.js +36 -0
  231. package/runtime/webapp/dist/assets/CalendarView-DHi-mzjY.css +1 -0
  232. package/runtime/webapp/dist/assets/CollaborationCreateDialog-CU1t0iYL.js +1 -0
  233. package/runtime/webapp/dist/assets/CollaborationDashboard-BZhWQXzn.js +1 -0
  234. package/runtime/webapp/dist/assets/CollaborationPage-BwRJN55v.js +6 -0
  235. package/runtime/webapp/dist/assets/{FilePreview-BItgMeyP.js → FilePreview-Oo8sZH0t.js} +5 -5
  236. package/runtime/webapp/dist/assets/FileTree-qJTRdDPQ.js +6 -0
  237. package/runtime/webapp/dist/assets/FileWorkspaceDrawer-D40WNAqC.js +1 -0
  238. package/runtime/webapp/dist/assets/FlowStudioPane-C1tgSbGo.js +5 -0
  239. package/runtime/webapp/dist/assets/HostProjectPicker-BEfXuqxT.js +1 -0
  240. package/runtime/webapp/dist/assets/{LSPServerList-CB2Cwqw_.js → LSPServerList-DQRv04aP.js} +1 -1
  241. package/runtime/webapp/dist/assets/{MCPServerList-DUpgIcHk.js → MCPServerList-BmsejJC9.js} +1 -1
  242. package/runtime/webapp/dist/assets/{MemoryViewer-DCFueBdK.js → MemoryViewer-qZMdVrli.js} +1 -1
  243. package/runtime/webapp/dist/assets/NewSessionWindow-BOCZ0mXT.css +1 -0
  244. package/runtime/webapp/dist/assets/NewSessionWindow-uzVK5LVS.js +1 -0
  245. package/runtime/webapp/dist/assets/{RemoteDesktopPage-DD9aNe8m.js → RemoteDesktopPage-Dz_6-rOL.js} +1 -1
  246. package/runtime/webapp/dist/assets/{RunningSessionsIcon-CKKjZfu_.js → RunningSessionsIcon-DJxTmxZn.js} +5 -5
  247. package/runtime/webapp/dist/assets/SessionDashboard-DuR9r_ZP.js +16 -0
  248. package/runtime/webapp/dist/assets/{SessionDashboardBridge-DG1fQUEQ.js → SessionDashboardBridge-BHVjvDHa.js} +1 -1
  249. package/runtime/webapp/dist/assets/{SettingsPanel-CA0Pj7qk.js → SettingsPanel-B-g919uV.js} +2 -2
  250. package/runtime/webapp/dist/assets/{SkillManager-BzgAJlVW.js → SkillManager-nrWIOtEO.js} +1 -1
  251. package/runtime/webapp/dist/assets/{TerminalPane-Bc4cGUmA.js → TerminalPane-C4HiD2IC.js} +2 -2
  252. package/runtime/webapp/dist/assets/TodoPage-Bn6j6kR6.js +1 -0
  253. package/runtime/webapp/dist/assets/{abnfDiagram-VCTEODGH-Dsp6XgB7.js → abnfDiagram-VCTEODGH-BXRYzdBT.js} +1 -1
  254. package/runtime/webapp/dist/assets/{arc-DROGDR5M.js → arc-BeG7yjCw.js} +1 -1
  255. package/runtime/webapp/dist/assets/{architectureDiagram-5GKGNRK7-S8c_fFRN.js → architectureDiagram-5GKGNRK7-DIQbpqn7.js} +1 -1
  256. package/runtime/webapp/dist/assets/{arrow-right-CUDfCOna.js → arrow-right-B03zMFiC.js} +1 -1
  257. package/runtime/webapp/dist/assets/artifact-links-4m1A00GO.js +2 -0
  258. package/runtime/webapp/dist/assets/{blockDiagram-I7D4REHJ-DrTz3v2B.js → blockDiagram-I7D4REHJ-DvgKV01C.js} +3 -3
  259. package/runtime/webapp/dist/assets/{c4Diagram-7LVT6UL2-wuHRphdr.js → c4Diagram-7LVT6UL2-DIr7nDIg.js} +1 -1
  260. package/runtime/webapp/dist/assets/calendar-days-D1OJEOKr.js +6 -0
  261. package/runtime/webapp/dist/assets/channel-Cchxg6Fx.js +1 -0
  262. package/runtime/webapp/dist/assets/check-BDiCDSY5.js +6 -0
  263. package/runtime/webapp/dist/assets/{chevron-down-fUU2ZKzR.js → chevron-down-DIt_NscV.js} +1 -1
  264. package/runtime/webapp/dist/assets/chevron-right-DVhYkZeF.js +6 -0
  265. package/runtime/webapp/dist/assets/{chunk-2Q5K7J3B-BpV5cOX0.js → chunk-2Q5K7J3B-Cykdc4to.js} +1 -1
  266. package/runtime/webapp/dist/assets/{chunk-5VM5RSS4-1_IZosIm.js → chunk-5VM5RSS4-DL-gBU30.js} +1 -1
  267. package/runtime/webapp/dist/assets/chunk-F27PBJKO-z0F9O96j.js +1 -0
  268. package/runtime/webapp/dist/assets/{chunk-IMKFNOWR-BuicwmZn.js → chunk-IMKFNOWR-DcSgatN1.js} +1 -1
  269. package/runtime/webapp/dist/assets/{chunk-JWPE2WC7-CfNSj3eC.js → chunk-JWPE2WC7-BmG1ozp9.js} +1 -1
  270. package/runtime/webapp/dist/assets/{chunk-POPQ4Y6H-Bxryudz4.js → chunk-POPQ4Y6H-BK2jifSN.js} +1 -1
  271. package/runtime/webapp/dist/assets/{chunk-SVP7TREG-DSZbEEd6.js → chunk-SVP7TREG-DtInGjiG.js} +3 -3
  272. package/runtime/webapp/dist/assets/{chunk-TICWLB2K-CHqUfDzl.js → chunk-TICWLB2K-DWdiL4Y6.js} +1 -1
  273. package/runtime/webapp/dist/assets/{chunk-XXDRQBXY-CPbMDiSF.js → chunk-XXDRQBXY-w8UYxZUB.js} +1 -1
  274. package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-BGv4sK1I.js +1 -0
  275. package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-BGv4sK1I.js +1 -0
  276. package/runtime/webapp/dist/assets/{codeSyntax-BENnBdX2.js → codeSyntax-Cprr1Nm9.js} +3 -3
  277. package/runtime/webapp/dist/assets/{collaboration-DwgXZbHy.js → collaboration-acdqOxaY.js} +1 -1
  278. package/runtime/webapp/dist/assets/composer-file-routing-BsSxfxUa.js +6 -0
  279. package/runtime/webapp/dist/assets/{cose-bilkent-JH36ORCC-BPzEzfJw.js → cose-bilkent-JH36ORCC-BJgwy7Y5.js} +1 -1
  280. package/runtime/webapp/dist/assets/{cynefin-OW5HDTMX-BZgzPIdr.js → cynefin-OW5HDTMX-BssWa1kU.js} +1 -1
  281. package/runtime/webapp/dist/assets/{cynefinDiagram-5FMLGOSQ-CyNjL-LN.js → cynefinDiagram-5FMLGOSQ-Bv_-fuG_.js} +2 -2
  282. package/runtime/webapp/dist/assets/{dagre-GXQ25YYZ-QqLmAYnp.js → dagre-GXQ25YYZ-BjA5n2Zi.js} +1 -1
  283. package/runtime/webapp/dist/assets/{diagram-S7CK7UJ4-DrIIbhV6.js → diagram-S7CK7UJ4-CCT38L0E.js} +3 -3
  284. package/runtime/webapp/dist/assets/{diagram-UQ7AKVKN-B7JON90e.js → diagram-UQ7AKVKN-4fLw8kje.js} +1 -1
  285. package/runtime/webapp/dist/assets/{diagram-VSXAHHWV-C1Fzjcgp.js → diagram-VSXAHHWV-43_Qj0Se.js} +3 -3
  286. package/runtime/webapp/dist/assets/{diagram-VX7I27RA-HmkXh54q.js → diagram-VX7I27RA-BHEXgMDZ.js} +1 -1
  287. package/runtime/webapp/dist/assets/{diagram-Z3DM3KII-Ca5jnESS.js → diagram-Z3DM3KII-BRTSiXVr.js} +2 -2
  288. package/runtime/webapp/dist/assets/{download-CKrjXoG9.js → download-CuYS63Ny.js} +1 -1
  289. package/runtime/webapp/dist/assets/{ebnfDiagram-PWID7BFC-a3qnPIiF.js → ebnfDiagram-PWID7BFC-B4GImY-o.js} +1 -1
  290. package/runtime/webapp/dist/assets/{erDiagram-RLTQ6QDP-EZKQ4NYt.js → erDiagram-RLTQ6QDP-EmEsAxWS.js} +1 -1
  291. package/runtime/webapp/dist/assets/{external-link-C9AwR_tM.js → external-link-Baeyco26.js} +1 -1
  292. package/runtime/webapp/dist/assets/{file-types-BlRT2KnS.js → file-types-CykGmGsd.js} +2 -2
  293. package/runtime/webapp/dist/assets/{flowDiagram-HODETNUW-C4U9dCin.js → flowDiagram-HODETNUW-sky_wmbX.js} +1 -1
  294. package/runtime/webapp/dist/assets/{ganttDiagram-EL5Y4UJY-B5iyiF0_.js → ganttDiagram-EL5Y4UJY-Cc71xV1j.js} +1 -1
  295. package/runtime/webapp/dist/assets/{gitGraphDiagram-WWUBYQGX-D9CfK-tl.js → gitGraphDiagram-WWUBYQGX-z7uQ8-8z.js} +7 -7
  296. package/runtime/webapp/dist/assets/history-C7WUwl_W.js +6 -0
  297. package/runtime/webapp/dist/assets/{image-plus-DsCC5WAa.js → image-plus-B2RK1ogI.js} +1 -1
  298. package/runtime/webapp/dist/assets/index-B_fTpc5K.css +1 -0
  299. package/runtime/webapp/dist/assets/index-d8fS3JdV.js +489 -0
  300. package/runtime/webapp/dist/assets/{infoDiagram-27XIBGKW-DBcCijd6.js → infoDiagram-27XIBGKW-DXLEePz0.js} +1 -1
  301. package/runtime/webapp/dist/assets/{ishikawaDiagram-5VMMS53U-D_m8F4n9.js → ishikawaDiagram-5VMMS53U-DCFXm_zQ.js} +4 -4
  302. package/runtime/webapp/dist/assets/{journeyDiagram-3NMN7TZE-4oy2R7XW.js → journeyDiagram-3NMN7TZE-DHWCpvY6.js} +1 -1
  303. package/runtime/webapp/dist/assets/{kanban-definition-UXKFOSKX-O6jHSf0E.js → kanban-definition-UXKFOSKX-D_uP81aw.js} +7 -7
  304. package/runtime/webapp/dist/assets/{layout-P82L_S-q.js → layout-Bcu83-1p.js} +1 -1
  305. package/runtime/webapp/dist/assets/{linear-B-Cl5K73.js → linear-CPim5SQa.js} +1 -1
  306. package/runtime/webapp/dist/assets/list-todo-F1W4yBLx.js +6 -0
  307. package/runtime/webapp/dist/assets/{loader-circle--s-WzZxC.js → loader-circle-DesEGpVH.js} +1 -1
  308. package/runtime/webapp/dist/assets/locate-fixed-UXM91vCS.js +6 -0
  309. package/runtime/webapp/dist/assets/{mermaid.core-BEmIap6p.js → mermaid.core-CyzKk3O2.js} +6 -6
  310. package/runtime/webapp/dist/assets/{mindmap-definition-YA3MSWOX-Bnlqql-j.js → mindmap-definition-YA3MSWOX-0MHQpQro.js} +1 -1
  311. package/runtime/webapp/dist/assets/new-session-window-B4BJYrds.css +1 -0
  312. package/runtime/webapp/dist/assets/new-session-window-fsYu53Ht.js +188 -0
  313. package/runtime/webapp/dist/assets/page-C2e368Dx.js +86 -0
  314. package/runtime/webapp/dist/assets/pause-_h6c8qPD.js +6 -0
  315. package/runtime/webapp/dist/assets/{pegDiagram-XKGWAZYB-AbRjuoUM.js → pegDiagram-XKGWAZYB-BNinoE-7.js} +1 -1
  316. package/runtime/webapp/dist/assets/{pieDiagram-E7YTZNPT-5-ms1WT0.js → pieDiagram-E7YTZNPT-CfPzV9yb.js} +3 -3
  317. package/runtime/webapp/dist/assets/pin-BcXr5230.js +6 -0
  318. package/runtime/webapp/dist/assets/play-BdB0D0rZ.js +6 -0
  319. package/runtime/webapp/dist/assets/{quadrantDiagram-AXDQQJYC-BXr5BqtQ.js → quadrantDiagram-AXDQQJYC-0qLb33lM.js} +1 -1
  320. package/runtime/webapp/dist/assets/{railroadDiagram-O6MQD6OU-DqBC-aod.js → railroadDiagram-O6MQD6OU-DNU4eRJt.js} +1 -1
  321. package/runtime/webapp/dist/assets/{requirementDiagram-BXWQKSXE-VOUcatZG.js → requirementDiagram-BXWQKSXE-BWJRwKX8.js} +3 -3
  322. package/runtime/webapp/dist/assets/{rotate-ccw-CSiD4c4O.js → rotate-ccw-BdZpOTYP.js} +1 -1
  323. package/runtime/webapp/dist/assets/{rotate-cw-CclBpLSU.js → rotate-cw-D-zPMe4i.js} +1 -1
  324. package/runtime/webapp/dist/assets/{sankeyDiagram-P5KCCOFB-Bs23XmVr.js → sankeyDiagram-P5KCCOFB-CGW9pvun.js} +2 -2
  325. package/runtime/webapp/dist/assets/{send-CfzPXlfx.js → send-DCVOqOap.js} +1 -1
  326. package/runtime/webapp/dist/assets/{sequenceDiagram-WJ2MYXX4-DO-oDX3L.js → sequenceDiagram-WJ2MYXX4-CeVAD519.js} +4 -4
  327. package/runtime/webapp/dist/assets/session-dashboard-BAYi5acZ.js +1 -0
  328. package/runtime/webapp/dist/assets/{shield-check-Dsex8w1k.js → shield-check-DrxVJwVC.js} +1 -1
  329. package/runtime/webapp/dist/assets/{sizeCapture-INFHLROL-hCQ98eA9.js → sizeCapture-INFHLROL-Dj5SukiO.js} +1 -1
  330. package/runtime/webapp/dist/assets/{stateDiagram-D77RDMKH-DLODIaTQ.js → stateDiagram-D77RDMKH-UtRSslyd.js} +1 -1
  331. package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-Se3lznH6.js +1 -0
  332. package/runtime/webapp/dist/assets/{swimlanes-42K2YHIH-B3Qg_5tW.js → swimlanes-42K2YHIH-DKbrz8SF.js} +1 -1
  333. package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-C-Zsmae7.js +8 -0
  334. package/runtime/webapp/dist/assets/{timeline-definition-24CTP7MA-BdFnRV4K.js → timeline-definition-24CTP7MA-mtVdMOBL.js} +1 -1
  335. package/runtime/webapp/dist/assets/{trash-2-CZp_yMDT.js → trash-2-Bbhd8-xd.js} +4 -9
  336. package/runtime/webapp/dist/assets/{types-BWTyn3Bs.js → types-CMhUwzwJ.js} +1 -1
  337. package/runtime/webapp/dist/assets/{vennDiagram-4TSXK5OY-CRU6BY1c.js → vennDiagram-4TSXK5OY-ZcuGEhJx.js} +5 -5
  338. package/runtime/webapp/dist/assets/{wardleyDiagram-VM6X3IG4-CXK3g3al.js → wardleyDiagram-VM6X3IG4-CnAYI2ZE.js} +1 -1
  339. package/runtime/webapp/dist/assets/{web-JmfGsfI_.js → web-BH9JgWsL.js} +1 -1
  340. package/runtime/webapp/dist/assets/{web-Den_EYDz.js → web-CBiaPgEe.js} +1 -1
  341. package/runtime/webapp/dist/assets/{x-CLvev0bC.js → x-1GQMVfza.js} +1 -1
  342. package/runtime/webapp/dist/assets/{xychartDiagram-S5SC5T6Z-CeISrKUm.js → xychartDiagram-S5SC5T6Z-B_uJt0Bg.js} +3 -3
  343. package/runtime/webapp/dist/assets/zoom-out-BNKdrTFD.js +11 -0
  344. package/runtime/webapp/dist/index.html +2 -2
  345. package/runtime/ws-server.mjs +12 -4
  346. package/runtime/.next/server/chunks/1614.js +0 -1
  347. package/runtime/.next/server/chunks/7519.js +0 -15
  348. package/runtime/.next/static/chunks/333-9881c3d2c558a28d.js +0 -1
  349. package/runtime/.next/static/chunks/app/web/layout-88328c61ec0589af.js +0 -1
  350. package/runtime/.next/static/chunks/app/web/page-84b5f00b4c9cd4ce.js +0 -1
  351. package/runtime/.next/static/chunks/main-app-ba2527534563adfe.js +0 -1
  352. package/runtime/lib/voice-tts-gateway.mjs +0 -96
  353. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-0a66n3e7.mjs +0 -16
  354. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-0bmnpbz2.mjs +0 -45
  355. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-ds2jqcef.mjs +0 -19
  356. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-gbbw9cgm.mjs +0 -17
  357. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-msnqqcc2.mjs +0 -42
  358. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-wadgcjfh.mjs +0 -18
  359. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-x20yarwf.mjs +0 -17
  360. package/runtime/webapp/dist/assets/AIHubView-DBOyOZzW.js +0 -1
  361. package/runtime/webapp/dist/assets/App-CrZstnCH.css +0 -1
  362. package/runtime/webapp/dist/assets/App-DGtdMfGk.js +0 -179
  363. package/runtime/webapp/dist/assets/BrowserLivePanel-Cl5kMDJF.js +0 -56
  364. package/runtime/webapp/dist/assets/CollaborationCreateDialog-DPs4doOz.js +0 -1
  365. package/runtime/webapp/dist/assets/CollaborationDashboard-ChUaJ5xA.js +0 -1
  366. package/runtime/webapp/dist/assets/CollaborationPage-Cg22tJGB.js +0 -6
  367. package/runtime/webapp/dist/assets/FileTree-t-YjjCDU.js +0 -11
  368. package/runtime/webapp/dist/assets/FileWorkspaceDrawer-BnOoPJA6.js +0 -1
  369. package/runtime/webapp/dist/assets/FlowStudioPane-DHrpQpBA.js +0 -5
  370. package/runtime/webapp/dist/assets/SessionDashboard-CCpxslxg.js +0 -21
  371. package/runtime/webapp/dist/assets/artifact-links-C7zYRJaC.js +0 -7
  372. package/runtime/webapp/dist/assets/channel-C_3UNQvo.js +0 -1
  373. package/runtime/webapp/dist/assets/chunk-F27PBJKO-IZ7w-WCZ.js +0 -1
  374. package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-j9nJ5DUm.js +0 -1
  375. package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-j9nJ5DUm.js +0 -1
  376. package/runtime/webapp/dist/assets/composer-file-routing-CKLnrVkP.js +0 -11
  377. package/runtime/webapp/dist/assets/index-DBNVLOBM.js +0 -489
  378. package/runtime/webapp/dist/assets/index-DrzCwyPu.css +0 -1
  379. package/runtime/webapp/dist/assets/page-BtLq1udo.js +0 -91
  380. package/runtime/webapp/dist/assets/session-dashboard-D-0Cip5Y.js +0 -6
  381. package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-CTpD-7Re.js +0 -1
  382. package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-v5rUeqtL.js +0 -8
  383. package/runtime/webapp/dist/assets/zoom-out-CSyjX26v.js +0 -21
  384. package/runtime/webapp/dist/pcm-audio-worklet.js +0 -126
  385. /package/runtime/.next/static/{5l3_g1bKM6rXvoGoMh_OC → q4ez_w8bVMUW1e57Cd7GC}/_buildManifest.js +0 -0
  386. /package/runtime/.next/static/{5l3_g1bKM6rXvoGoMh_OC → q4ez_w8bVMUW1e57Cd7GC}/_ssgManifest.js +0 -0
@@ -4777,8 +4777,8 @@ class LiveViewProducer {
4777
4777
  }
4778
4778
  }
4779
4779
  // src/domain/web-console/computer-settings.ts
4780
- var COMPUTER_TOOLS = ["refresh", "dashboard", "collaboration", "remote", "theme", "files", "ai-hub", "flow", "install"];
4781
- var DEFAULT_COMPUTER_TOOLS = ["refresh", "remote", "theme", "files"];
4780
+ var COMPUTER_TOOLS = ["refresh", "dashboard", "collaboration", "remote", "theme", "files", "ai-hub", "flow", "install", "calendar"];
4781
+ var DEFAULT_COMPUTER_TOOLS = ["refresh", "remote", "theme", "files", "calendar"];
4782
4782
  function defaultComputerSettings(userId) {
4783
4783
  return { userId, revision: 0, visibleTools: [...DEFAULT_COMPUTER_TOOLS], savedPages: null, updatedAt: "" };
4784
4784
  }
@@ -11375,7 +11375,8 @@ class TodoAddTool {
11375
11375
  todos: exports_external.array(exports_external.object({
11376
11376
  title: exports_external.string().describe("Task description"),
11377
11377
  agentName: exports_external.string().optional().describe("Name of the agent responsible for this task"),
11378
- dependsOn: exports_external.array(exports_external.string()).optional().describe("Titles of other tasks in this batch that must be completed before this one")
11378
+ dependsOn: exports_external.array(exports_external.string()).optional().describe("Titles of other tasks in this batch that must be completed before this one"),
11379
+ dueAt: exports_external.number().optional().describe("Optional deadline as a UTC millisecond timestamp")
11379
11380
  })).min(1).describe("List of tasks to add")
11380
11381
  });
11381
11382
  parameters = {
@@ -11392,7 +11393,8 @@ class TodoAddTool {
11392
11393
  type: "array",
11393
11394
  items: { type: "string" },
11394
11395
  description: "Titles of other tasks that must complete before this task can start"
11395
- }
11396
+ },
11397
+ dueAt: { type: "number", description: "Optional deadline as a UTC millisecond timestamp" }
11396
11398
  },
11397
11399
  required: ["title"]
11398
11400
  },
@@ -11416,7 +11418,8 @@ class TodoAddTool {
11416
11418
  title: t.title,
11417
11419
  agentName: t.agentName,
11418
11420
  status: "pending",
11419
- dependsOn: t.dependsOn?.length ? t.dependsOn : undefined
11421
+ dependsOn: t.dependsOn?.length ? t.dependsOn : undefined,
11422
+ dueAt: t.dueAt
11420
11423
  }));
11421
11424
  const sorted = topoSort([...current, ...newItems]);
11422
11425
  this.setTodos(sorted);
@@ -11435,7 +11438,8 @@ class TodoUpdateTool {
11435
11438
  schema = exports_external.object({
11436
11439
  id: exports_external.string().optional().describe("Todo item ID (exact match)"),
11437
11440
  title: exports_external.string().optional().describe("Todo item title (partial case-insensitive match)"),
11438
- status: exports_external.enum(["pending", "in-progress", "completed"]).describe("New status")
11441
+ status: exports_external.enum(["pending", "in-progress", "completed"]).describe("New status"),
11442
+ dueAt: exports_external.number().nullable().optional().describe("New deadline as a UTC millisecond timestamp; null clears it")
11439
11443
  }).refine((d) => d.id !== undefined || d.title !== undefined, {
11440
11444
  message: "Provide either id or title"
11441
11445
  });
@@ -11448,7 +11452,8 @@ class TodoUpdateTool {
11448
11452
  type: "string",
11449
11453
  enum: ["pending", "in-progress", "completed"],
11450
11454
  description: "New status"
11451
- }
11455
+ },
11456
+ dueAt: { type: ["number", "null"], description: "New deadline as a UTC millisecond timestamp; null clears it" }
11452
11457
  },
11453
11458
  required: ["status"]
11454
11459
  };
@@ -11468,7 +11473,8 @@ class TodoUpdateTool {
11468
11473
  const byTitle = parsed.data.title !== undefined && t.title.toLowerCase().includes(parsed.data.title.toLowerCase());
11469
11474
  if (byId || byTitle) {
11470
11475
  matched = true;
11471
- return { ...t, status: parsed.data.status };
11476
+ const dueAt = parsed.data.dueAt === undefined ? t.dueAt : parsed.data.dueAt ?? undefined;
11477
+ return { ...t, status: parsed.data.status, dueAt };
11472
11478
  }
11473
11479
  return t;
11474
11480
  });
@@ -11800,6 +11806,38 @@ function describeCron(cron) {
11800
11806
  return `每天 ${hour.padStart(2, "0")}:00`;
11801
11807
  return `cron: ${cron}`;
11802
11808
  }
11809
+ function listCronFires(cron, fromMs, toMs, opts = {}) {
11810
+ const limit = opts.limit ?? 500;
11811
+ if (toMs < fromMs || limit <= 0)
11812
+ return [];
11813
+ const intervalMs = parseIntervalMs(cron);
11814
+ if (intervalMs !== null) {
11815
+ if (intervalMs <= 0)
11816
+ return [];
11817
+ const anchor = opts.anchorMs ?? fromMs;
11818
+ const fires2 = [];
11819
+ let t2 = anchor;
11820
+ if (t2 < fromMs)
11821
+ t2 += Math.ceil((fromMs - t2) / intervalMs) * intervalMs;
11822
+ for (;t2 <= toMs && fires2.length < limit; t2 += intervalMs)
11823
+ fires2.push(t2);
11824
+ return fires2;
11825
+ }
11826
+ if (!isCronExpression(cron))
11827
+ return [];
11828
+ const [minExpr, hourExpr, domExpr, monExpr, dowExpr] = cron.trim().split(/\s+/);
11829
+ const fires = [];
11830
+ const start = new Date(fromMs);
11831
+ start.setSeconds(0, 0);
11832
+ let t = start.getTime();
11833
+ const end = Math.min(toMs, fromMs + 366 * 86400000);
11834
+ for (;t <= end && fires.length < limit; t += 60000) {
11835
+ const d = new Date(t);
11836
+ if (matchField(d.getMinutes(), minExpr) && matchField(d.getHours(), hourExpr) && matchField(d.getDate(), domExpr) && matchField(d.getMonth() + 1, monExpr) && matchField(d.getDay(), dowExpr))
11837
+ fires.push(t);
11838
+ }
11839
+ return fires;
11840
+ }
11803
11841
  // src/domain/cron/CronTasks.ts
11804
11842
  import { readFileSync as readFileSync2, writeFileSync, mkdirSync, existsSync as existsSync2 } from "node:fs";
11805
11843
  import { join as join5, dirname as dirname2 } from "node:path";
@@ -16939,6 +16977,284 @@ class SQLiteRemoteToolStore {
16939
16977
  return { id: row.id, projectId: row.project_id, scheme: row.scheme, requestPayload: parseObject(row.request_payload), status: row.status, responsePayload: row.response_payload ? parseObject(row.response_payload) : null, error: row.error, createdAt: row.created, updatedAt: row.updated };
16940
16978
  }
16941
16979
  }
16980
+ // src/domain/calendar/entities.ts
16981
+ var CALENDAR_SOURCES = [
16982
+ "customer-agent",
16983
+ "codex",
16984
+ "claude",
16985
+ "workbuddy",
16986
+ "zcode",
16987
+ "opencode",
16988
+ "deepseek"
16989
+ ];
16990
+ var CALENDAR_SOURCE_LABELS = {
16991
+ "customer-agent": "AgentRoam",
16992
+ codex: "Codex",
16993
+ claude: "Claude Code",
16994
+ workbuddy: "WorkBuddy",
16995
+ zcode: "ZCode",
16996
+ opencode: "OpenCode",
16997
+ deepseek: "DeepSeek"
16998
+ };
16999
+ function localDateKey(ms) {
17000
+ const d = new Date(ms);
17001
+ const month = `${d.getMonth() + 1}`.padStart(2, "0");
17002
+ const day = `${d.getDate()}`.padStart(2, "0");
17003
+ return `${d.getFullYear()}-${month}-${day}`;
17004
+ }
17005
+ function todoState(status, dueAt, nowMs) {
17006
+ if (status === "completed")
17007
+ return "completed";
17008
+ if (status === "in-progress" || status === "in_progress")
17009
+ return "in-progress";
17010
+ if (dueAt !== undefined && dueAt < nowMs)
17011
+ return "overdue";
17012
+ return "pending";
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
+ }
16942
17258
  // src/application/goal/ThreadGoalService.ts
16943
17259
  class ThreadGoalService {
16944
17260
  store;
@@ -17659,6 +17975,8 @@ class EngineSwitchDelivery {
17659
17975
  }
17660
17976
  // src/application/notification/task-completion.ts
17661
17977
  var DEFAULT_TASK_NOTIFICATION_PREFERENCES = {
17978
+ approvalEnabled: true,
17979
+ todoEnabled: true,
17662
17980
  completionEnabled: true,
17663
17981
  soundEnabled: true,
17664
17982
  notifyWhileForeground: false
@@ -17669,6 +17987,8 @@ function truncateCodePoints(value, max) {
17669
17987
  }
17670
17988
  function resolveTaskNotificationPreferences(value) {
17671
17989
  return {
17990
+ approvalEnabled: value?.approvalEnabled ?? true,
17991
+ todoEnabled: value?.todoEnabled ?? true,
17672
17992
  completionEnabled: value?.completionEnabled ?? DEFAULT_TASK_NOTIFICATION_PREFERENCES.completionEnabled,
17673
17993
  soundEnabled: value?.soundEnabled ?? DEFAULT_TASK_NOTIFICATION_PREFERENCES.soundEnabled,
17674
17994
  notifyWhileForeground: value?.notifyWhileForeground ?? DEFAULT_TASK_NOTIFICATION_PREFERENCES.notifyWhileForeground
@@ -18649,6 +18969,41 @@ import Database from "better-sqlite3";
18649
18969
  import { join as join12 } from "node:path";
18650
18970
  import { mkdirSync as mkdirSync3 } from "node:fs";
18651
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
18652
19007
  class SQLiteDatabase {
18653
19008
  db;
18654
19009
  constructor(baseDir) {
@@ -18658,7 +19013,7 @@ class SQLiteDatabase {
18658
19013
  try {
18659
19014
  this.db.pragma("journal_mode = WAL");
18660
19015
  this.db.pragma("foreign_keys = ON");
18661
- this.migrate();
19016
+ this.db.transaction(() => this.migrate()).immediate();
18662
19017
  } catch (error) {
18663
19018
  this.db.close();
18664
19019
  throw error;
@@ -18971,6 +19326,7 @@ class SQLiteDatabase {
18971
19326
  this.migratePinnedCommands();
18972
19327
  this.migrateCommandHistoryExitCode();
18973
19328
  this.migrateEngineSwitch();
19329
+ migrateTodoTables(this.db);
18974
19330
  }
18975
19331
  migrateCommandHistoryExitCode() {
18976
19332
  const cols = this.db.prepare("PRAGMA table_info(command_history)").all();
@@ -20789,8 +21145,10 @@ class SQLiteSettingsStore {
20789
21145
  }
20790
21146
  // src/infrastructure/SQLiteSessionStore.ts
20791
21147
  class SQLiteSessionStore {
21148
+ eventCommit;
20792
21149
  baseDir;
20793
- constructor(baseDir) {
21150
+ constructor(baseDir, eventCommit) {
21151
+ this.eventCommit = eventCommit;
20794
21152
  this.baseDir = baseDir;
20795
21153
  getDatabase(baseDir);
20796
21154
  }
@@ -20901,7 +21259,11 @@ class SQLiteSessionStore {
20901
21259
  }
20902
21260
  async addEvent(sessionId, event) {
20903
21261
  const db = getDatabase(this.baseDir);
20904
- 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
+ })();
20905
21267
  }
20906
21268
  async replaceMessages(sessionId, messages) {
20907
21269
  const db = getDatabase(this.baseDir);
@@ -22820,12 +23182,556 @@ class HarnessServiceClient {
22820
23182
  this.current = { state: "stopped" };
22821
23183
  }
22822
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
+ }
22823
23728
  export {
22824
23729
  writeSessionGoalState,
22825
23730
  withPendingAutoTitle,
22826
23731
  visibleWorkspaceIds,
22827
23732
  verifyPassword,
22828
23733
  validateToolExecutionPolicy,
23734
+ validateTimestamp,
22829
23735
  validateSavedComputerPages,
22830
23736
  validateReleaseManifest,
22831
23737
  validatePinnedCommands,
@@ -22839,11 +23745,14 @@ export {
22839
23745
  truncateToTokenBudget,
22840
23746
  toolExecutionPolicySummary,
22841
23747
  toolApprovalDecisionFromAnswer,
23748
+ todoState,
23749
+ todoDetail,
22842
23750
  threadDisplayMessages,
22843
23751
  textLines,
22844
23752
  textLineStats,
22845
23753
  summarizeFileChanges,
22846
23754
  splitCompoundVideoBitRate,
23755
+ sourceError,
22847
23756
  shouldContinueThreadGoal,
22848
23757
  setSessionPermissionMode,
22849
23758
  sessionQueueItemKind,
@@ -22868,6 +23777,7 @@ export {
22868
23777
  registerBuiltinTools,
22869
23778
  reduceRuntimeProgress,
22870
23779
  recordThreadGoalUsage,
23780
+ reconcileCalendarEntries,
22871
23781
  readWebShellOpenBrowserLive,
22872
23782
  readWebProjectRequest,
22873
23783
  readWebBrowserRequest,
@@ -22880,6 +23790,7 @@ export {
22880
23790
  promoteNextSessionQueueItem,
22881
23791
  projectSessionGoals,
22882
23792
  projectSessionActivity,
23793
+ persistNotification,
22883
23794
  parseWebShellOpenBrowserLive,
22884
23795
  parseWebProjectResponse,
22885
23796
  parseWebProjectRequest,
@@ -22907,11 +23818,15 @@ export {
22907
23818
  newSessionMetadata,
22908
23819
  navigationLayoutSwitchTitle,
22909
23820
  monitoringConfiguration,
23821
+ migrateTodoTables,
22910
23822
  mergeReasoningSummaryDelta,
22911
23823
  logGlobal,
23824
+ localDateKey,
23825
+ listCronFires,
22912
23826
  isWebMediaUrl,
22913
23827
  isVersionAtLeast,
22914
23828
  isToolPermissionMode,
23829
+ isTodoTerminal,
22915
23830
  isThreadGoalStatus,
22916
23831
  isPathInsideRoot,
22917
23832
  isNavigationLayout,
@@ -22939,6 +23854,8 @@ export {
22939
23854
  extractReplyAfterBaseline,
22940
23855
  extractReplyAfterAnchor,
22941
23856
  expectedUpdateFileName,
23857
+ expandWhen,
23858
+ expandRRule,
22942
23859
  estimateTextTokens,
22943
23860
  estimateRequestTokens,
22944
23861
  enqueueSessionMessage,
@@ -22947,7 +23864,9 @@ export {
22947
23864
  encodeSessionHistoryAnchor,
22948
23865
  encodeLiveFramePacket,
22949
23866
  encodeCompoundTiles,
23867
+ dismissTaskReminders,
22950
23868
  desktopOfflineError,
23869
+ describeRRule,
22951
23870
  describeCron,
22952
23871
  defaultPinnedCommands,
22953
23872
  defaultComputerSettings,
@@ -22984,6 +23903,7 @@ export {
22984
23903
  buildCliInstallScriptUrl,
22985
23904
  buildCliInstallManifestUrl,
22986
23905
  buildBudgetExhaustedMessage,
23906
+ assertVersion,
22987
23907
  WriteFileTool,
22988
23908
  WebSearchTool,
22989
23909
  WebFetchTool,
@@ -23006,7 +23926,11 @@ export {
23006
23926
  ToolPermissionGate,
23007
23927
  ToolExecutionPolicyError,
23008
23928
  TodoUpdateTool,
23929
+ TodoScheduler,
23009
23930
  TodoListTool,
23931
+ TodoExecutionService,
23932
+ TodoError,
23933
+ TodoApplicationService,
23010
23934
  TodoAddTool,
23011
23935
  ThreadGoalService,
23012
23936
  TerminalSession,
@@ -23029,6 +23953,7 @@ export {
23029
23953
  SQLiteWebConsoleStore,
23030
23954
  SQLiteUploadStore,
23031
23955
  SQLiteToolExecutionPolicyStore,
23956
+ SQLiteTodoUnitOfWork,
23032
23957
  SQLiteThreadGoalStore,
23033
23958
  SQLiteSupervisionRepository,
23034
23959
  SQLiteSkillStore,
@@ -23066,6 +23991,7 @@ export {
23066
23991
  RemoteCompoundQualityPolicy,
23067
23992
  RemoteCompoundBudgetPolicy,
23068
23993
  RemoteAudioSession,
23994
+ ReminderScheduleCalculator,
23069
23995
  ReadFileTool,
23070
23996
  REMOTE_VIDEO_STALL_TIMEOUT_MS,
23071
23997
  REMOTE_VIDEO_PROFILES,
@@ -23073,6 +23999,7 @@ export {
23073
23999
  REMOTE_COMPOUND_VIDEO,
23074
24000
  PolicyAwareToolExecutor,
23075
24001
  PluginManager,
24002
+ PersistentNotificationService,
23076
24003
  PermissionAwareToolExecutor,
23077
24004
  PASSWORD_VERSION,
23078
24005
  OpenAIProvider,
@@ -23124,6 +24051,7 @@ export {
23124
24051
  EngineSwitchError,
23125
24052
  EngineSwitchDelivery,
23126
24053
  EMPTY_SESSION_GOAL_STATE,
24054
+ EMPTY_RESULT,
23127
24055
  DispatchAgentTool,
23128
24056
  DeepSeekProvider,
23129
24057
  DailyFileLogger,
@@ -23150,6 +24078,8 @@ export {
23150
24078
  COLLABORATION_AGENTS,
23151
24079
  CODEX_MINIMUM_VERSION,
23152
24080
  CLI_INSTALL_FILE_NAMES,
24081
+ CALENDAR_SOURCE_LABELS,
24082
+ CALENDAR_SOURCES,
23153
24083
  LiveViewRegistry as BrowserLiveRegistry,
23154
24084
  BashTool,
23155
24085
  AskUserTool,
@@ -23173,4 +24103,4 @@ export {
23173
24103
  AGENTROAM_CLI_INSTALL_BASE
23174
24104
  };
23175
24105
 
23176
- //# debugId=E20549CD96B1BAF164756E2164756E21
24106
+ //# debugId=526200D0CD2019A964756E2164756E21