@agent-native/core 0.134.0 → 0.135.0

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 (493) hide show
  1. package/corpus/README.md +3 -3
  2. package/corpus/core/CHANGELOG.md +113 -0
  3. package/corpus/core/docs/content/template-content-developers.mdx +1 -1
  4. package/corpus/core/package.json +3 -2
  5. package/corpus/core/src/automations/service.ts +41 -4
  6. package/corpus/core/src/cli/mcp-config-writers.ts +27 -21
  7. package/corpus/core/src/client/agent-page/AgentJobsTab.tsx +187 -85
  8. package/corpus/core/src/client/agent-page/AutomationDetailsDialog.tsx +208 -0
  9. package/corpus/core/src/client/agent-page/AutomationScheduleDialog.tsx +180 -0
  10. package/corpus/core/src/client/agent-page/TimezoneSelect.tsx +241 -0
  11. package/corpus/core/src/client/agent-page/use-jobs.ts +50 -10
  12. package/corpus/core/src/client/org/OrgSwitcher.tsx +26 -0
  13. package/corpus/core/src/client/settings/AccountSettingsCard.tsx +35 -31
  14. package/corpus/core/src/client/settings/SchedulingTimezoneField.tsx +71 -0
  15. package/corpus/core/src/client/settings/SettingsRow.tsx +113 -0
  16. package/corpus/core/src/client/settings/agent-settings-search.ts +2 -1
  17. package/corpus/core/src/client/settings/index.ts +6 -0
  18. package/corpus/core/src/integrations/identity.ts +2 -12
  19. package/corpus/core/src/jobs/actions/list-automation-runs.ts +33 -0
  20. package/corpus/core/src/jobs/actions/list-recurring-jobs.ts +27 -6
  21. package/corpus/core/src/jobs/actions/manage-recurring-job.ts +41 -9
  22. package/corpus/core/src/jobs/background-automation-runner.ts +88 -0
  23. package/corpus/core/src/jobs/cron.ts +52 -6
  24. package/corpus/core/src/jobs/frontmatter.ts +20 -0
  25. package/corpus/core/src/jobs/run-history.ts +242 -0
  26. package/corpus/core/src/jobs/scheduler.ts +73 -18
  27. package/corpus/core/src/jobs/tools.ts +54 -6
  28. package/corpus/core/src/localization/actions/get-localization-preference.ts +2 -2
  29. package/corpus/core/src/localization/actions/set-localization-preference.ts +49 -11
  30. package/corpus/core/src/localization/default-messages.ts +27 -0
  31. package/corpus/core/src/localization/shared.ts +39 -6
  32. package/corpus/core/src/localization/user-timezone.ts +36 -0
  33. package/corpus/core/src/org/app-roles-handlers.ts +1 -9
  34. package/corpus/core/src/org/index.ts +2 -0
  35. package/corpus/core/src/org/membership.ts +18 -0
  36. package/corpus/core/src/review/actions/create-review-comment.ts +4 -1
  37. package/corpus/core/src/review/actions/reply-review-comment.ts +4 -1
  38. package/corpus/core/src/review/index.ts +5 -0
  39. package/corpus/core/src/review/notifications.ts +163 -0
  40. package/corpus/core/src/review/types.ts +7 -0
  41. package/corpus/core/src/server/action-discovery.ts +4 -0
  42. package/corpus/core/src/server/activity-notifications.ts +174 -0
  43. package/corpus/core/src/server/app-name.ts +31 -0
  44. package/corpus/core/src/server/better-auth-instance.ts +4 -4
  45. package/corpus/core/src/server/email-templates.ts +70 -14
  46. package/corpus/core/src/server/email.ts +66 -3
  47. package/corpus/core/src/server/index.ts +10 -0
  48. package/corpus/core/src/sharing/index.ts +5 -0
  49. package/corpus/core/src/sharing/recipients.ts +67 -0
  50. package/corpus/core/src/triggers/actions/list-automations.ts +27 -8
  51. package/corpus/core/src/triggers/actions/manage-automation.ts +17 -6
  52. package/corpus/core/src/triggers/actions.ts +16 -4
  53. package/corpus/core/src/triggers/dispatcher.ts +44 -30
  54. package/corpus/core/src/triggers/routes.ts +19 -6
  55. package/corpus/core/src/vitest-config.ts +68 -0
  56. package/corpus/core/vitest.config.ts +5 -0
  57. package/corpus/templates/analytics/app/pages/Settings.tsx +37 -53
  58. package/corpus/templates/analytics/changelog/2026-08-01-new-error-alerts-now-reach-you-by-email-and-a-scheduled-dash.md +6 -0
  59. package/corpus/templates/analytics/server/jobs/dashboard-report.ts +43 -0
  60. package/corpus/templates/analytics/server/lib/error-capture.ts +5 -1
  61. package/corpus/templates/analytics/vitest.config.ts +16 -12
  62. package/corpus/templates/assets/actions/refresh-generation-run.ts +3 -0
  63. package/corpus/templates/assets/app/components/ui/switch.tsx +1 -0
  64. package/corpus/templates/assets/app/hooks/use-assets-prefs.ts +55 -0
  65. package/corpus/templates/assets/app/i18n-data.ts +30 -0
  66. package/corpus/templates/assets/app/routes/settings.tsx +58 -55
  67. package/corpus/templates/assets/changelog/2026-08-01-get-an-email-when-a-generation-you-started-finishes-or-fails.md +6 -0
  68. package/corpus/templates/assets/server/lib/generation-run-notifications.ts +89 -0
  69. package/corpus/templates/assets/server/lib/video-runs.ts +8 -1
  70. package/corpus/templates/assets/server/routes/_agent-native/assets/user-prefs.get.ts +17 -0
  71. package/corpus/templates/assets/server/routes/_agent-native/assets/user-prefs.put.ts +36 -0
  72. package/corpus/templates/assets/shared/assets-user-prefs.ts +10 -0
  73. package/corpus/templates/assets/vitest.config.ts +16 -12
  74. package/corpus/templates/brain/app/routes/settings.tsx +15 -15
  75. package/corpus/templates/brain/vitest.config.ts +16 -12
  76. package/corpus/templates/calendar/app/pages/Settings.tsx +32 -40
  77. package/corpus/templates/calendar/changelog/2026-08-01-language-and-appearance-now-sit-together-in-one-preferences-.md +6 -0
  78. package/corpus/templates/calendar/vitest.config.ts +16 -12
  79. package/corpus/templates/chat/app/routes/settings.tsx +14 -22
  80. package/corpus/templates/chat/vitest.config.ts +9 -0
  81. package/corpus/templates/clips/.agents/skills/video-editing/SKILL.md +31 -0
  82. package/corpus/templates/clips/AGENTS.md +1 -0
  83. package/corpus/templates/clips/actions/add-comment.ts +12 -1
  84. package/corpus/templates/clips/actions/create-meeting.ts +2 -2
  85. package/corpus/templates/clips/actions/create-recording.ts +2 -2
  86. package/corpus/templates/clips/actions/finalize-recording.ts +42 -6
  87. package/corpus/templates/clips/actions/generate-filmstrip.ts +154 -0
  88. package/corpus/templates/clips/actions/get-recording-player-data.ts +6 -0
  89. package/corpus/templates/clips/actions/import-loom-recording.ts +2 -2
  90. package/corpus/templates/clips/actions/lib/ensure-recording-filmstrip.ts +258 -0
  91. package/corpus/templates/clips/actions/lib/ensure-seekable-video.ts +11 -3
  92. package/corpus/templates/clips/actions/react-to-comment.ts +13 -0
  93. package/corpus/templates/clips/actions/react-to-recording.ts +10 -1
  94. package/corpus/templates/clips/actions/reply-to-comment.ts +12 -1
  95. package/corpus/templates/clips/actions/stitch-recordings.ts +2 -2
  96. package/corpus/templates/clips/app/components/editor/editor-layout.tsx +152 -23
  97. package/corpus/templates/clips/app/components/editor/waveform.tsx +237 -75
  98. package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +23 -1
  99. package/corpus/templates/clips/app/components/settings/ai-setup-section.tsx +441 -0
  100. package/corpus/templates/clips/app/components/settings/slack-section.tsx +329 -0
  101. package/corpus/templates/clips/app/components/settings/types.ts +14 -0
  102. package/corpus/templates/clips/app/components/settings/video-storage-section.tsx +443 -0
  103. package/corpus/templates/clips/app/hooks/use-secret-status.ts +69 -0
  104. package/corpus/templates/clips/app/i18n/en-US.ts +9 -1
  105. package/corpus/templates/clips/app/lib/video-filmstrip.ts +262 -0
  106. package/corpus/templates/clips/app/routes/_app.settings._index.tsx +165 -1351
  107. package/corpus/templates/clips/changelog/2026-07-27-saved-clips-now-resume-from-the-last-uploaded-byte-after-an-.md +6 -0
  108. package/corpus/templates/clips/changelog/2026-07-29-meeting-notes-no-longer-transcribe-the-other-side-twice-when.md +6 -0
  109. package/corpus/templates/clips/changelog/2026-07-31-editor-timeline-now-shows-video-frames-behind-the-waveform-g.md +6 -0
  110. package/corpus/templates/clips/changelog/2026-07-31-email-notifications-now-go-out-when-someone-comments-on-or-r.md +6 -0
  111. package/corpus/templates/clips/changelog/2026-07-31-you-can-now-set-a-default-visibility-for-new-recordings-in-s.md +6 -0
  112. package/corpus/templates/clips/changelog/2026-08-01-email-notifications-for-comments-and-reactions-now-actually-.md +6 -0
  113. package/corpus/templates/clips/changelog/2026-08-03-the-desktop-app-now-opens-directly-beneath-its-tray-icon-on-.md +6 -0
  114. package/corpus/templates/clips/chrome-extension/package.json +1 -0
  115. package/corpus/templates/clips/chrome-extension/vitest.config.ts +9 -0
  116. package/corpus/templates/clips/desktop/package.json +1 -0
  117. package/corpus/templates/clips/desktop/src/app.tsx +17 -1
  118. package/corpus/templates/clips/desktop/src/hooks/useMeetingTranscription.ts +37 -48
  119. package/corpus/templates/clips/desktop/src/lib/recorder.ts +331 -36
  120. package/corpus/templates/clips/desktop/src/lib/transcription-capture.ts +7 -5
  121. package/corpus/templates/clips/desktop/src/lib/transcription-engine.ts +182 -106
  122. package/corpus/templates/clips/desktop/src/lib/upload-recovery.ts +129 -0
  123. package/corpus/templates/clips/desktop/src/overlays/live-transcript.tsx +43 -14
  124. package/corpus/templates/clips/desktop/src/overlays/recording-pill.tsx +3 -3
  125. package/corpus/templates/clips/desktop/src-tauri/src/echo_guard.rs +443 -0
  126. package/corpus/templates/clips/desktop/src-tauri/src/lib.rs +1 -0
  127. package/corpus/templates/clips/desktop/src-tauri/src/native_screen.rs +815 -15
  128. package/corpus/templates/clips/desktop/src-tauri/src/tray.rs +61 -11
  129. package/corpus/templates/clips/desktop/src-tauri/src/whisper_speech.rs +125 -16
  130. package/corpus/templates/clips/desktop/vitest.config.ts +9 -0
  131. package/corpus/templates/clips/server/db/schema.ts +17 -0
  132. package/corpus/templates/clips/server/jobs/media-verification.ts +4 -0
  133. package/corpus/templates/clips/server/lib/activity-notifications.ts +185 -0
  134. package/corpus/templates/clips/server/lib/recording-media-cleanup.ts +2 -0
  135. package/corpus/templates/clips/server/lib/recording-upload-state.ts +46 -9
  136. package/corpus/templates/clips/server/lib/recordings.ts +24 -0
  137. package/corpus/templates/clips/server/lib/resumable-session.ts +10 -4
  138. package/corpus/templates/clips/server/lib/transactional-email-templates.ts +109 -0
  139. package/corpus/templates/clips/server/lib/upload-interruption.ts +8 -0
  140. package/corpus/templates/clips/server/lib/upload-lease.ts +50 -4
  141. package/corpus/templates/clips/server/lib/video-filmstrip-sprite.ts +207 -0
  142. package/corpus/templates/clips/server/lib/video-remux.ts +13 -4
  143. package/corpus/templates/clips/server/plugins/db.ts +16 -0
  144. package/corpus/templates/clips/server/routes/api/_agent-native-background/post-finalize-worker.post.ts +4 -0
  145. package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/abort.post.ts +123 -36
  146. package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/chunk.post.ts +159 -29
  147. package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/interrupt.post.ts +197 -0
  148. package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/reset-chunks.post.ts +193 -39
  149. package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/resume.get.ts +191 -12
  150. package/corpus/templates/clips/shared/clips-ai-prefs.ts +6 -0
  151. package/corpus/templates/clips/shared/feature-flags.ts +12 -0
  152. package/corpus/templates/clips/shared/recording-core.ts +4 -0
  153. package/corpus/templates/clips/vitest.config.ts +23 -19
  154. package/corpus/templates/content/.agents/skills/document-editing/references/databases.md +6 -4
  155. package/corpus/templates/content/actions/_database-membership-lock.ts +25 -0
  156. package/corpus/templates/content/actions/_database-row-batch.ts +6 -2
  157. package/corpus/templates/content/actions/_database-source-utils.ts +289 -129
  158. package/corpus/templates/content/actions/_database-utils.ts +12 -3
  159. package/corpus/templates/content/actions/add-comment.ts +15 -1
  160. package/corpus/templates/content/actions/add-content-database-source-field-property.ts +39 -21
  161. package/corpus/templates/content/actions/attach-content-database-source.ts +4 -1
  162. package/corpus/templates/content/actions/change-content-database-source-role.ts +3 -5
  163. package/corpus/templates/content/actions/duplicate-document-property.ts +59 -46
  164. package/corpus/templates/content/actions/execute-builder-source-execution.ts +77 -71
  165. package/corpus/templates/content/actions/list-documents.ts +1 -0
  166. package/corpus/templates/content/actions/materialize-builder-required-fields.ts +7 -0
  167. package/corpus/templates/content/actions/remove-database-items.ts +183 -0
  168. package/corpus/templates/content/actions/set-document-property.ts +57 -39
  169. package/corpus/templates/content/actions/sync-local-folder-source.ts +7 -0
  170. package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +5 -2
  171. package/corpus/templates/content/app/components/editor/DocumentToolbar.tsx +50 -1
  172. package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +471 -329
  173. package/corpus/templates/content/app/components/editor/database/row-access.ts +45 -0
  174. package/corpus/templates/content/app/components/editor/database/shared.tsx +141 -38
  175. package/corpus/templates/content/app/components/ui/switch.tsx +1 -0
  176. package/corpus/templates/content/app/hooks/use-content-database.ts +2 -2
  177. package/corpus/templates/content/app/hooks/use-content-prefs.ts +55 -0
  178. package/corpus/templates/content/app/i18n-data.ts +170 -0
  179. package/corpus/templates/content/app/routes/_app.settings.tsx +47 -18
  180. package/corpus/templates/content/changelog/2026-07-30-breadcrumb-menus-now-hide-internal-system-pages.md +6 -0
  181. package/corpus/templates/content/changelog/2026-07-30-database-rows-can-now-be-removed-without-deleting-their-page.md +6 -0
  182. package/corpus/templates/content/changelog/2026-08-01-get-an-email-when-someone-comments-on-replies-in-or-mentions.md +6 -0
  183. package/corpus/templates/content/parity/eval-scenarios.ts +2 -2
  184. package/corpus/templates/content/parity/matrix.md +1 -1
  185. package/corpus/templates/content/parity/matrix.ts +4 -5
  186. package/corpus/templates/content/server/lib/comment-notifications.ts +146 -0
  187. package/corpus/templates/content/server/routes/_agent-native/content/user-prefs.get.ts +17 -0
  188. package/corpus/templates/content/server/routes/_agent-native/content/user-prefs.put.ts +36 -0
  189. package/corpus/templates/content/shared/api.ts +4 -0
  190. package/corpus/templates/content/shared/content-user-prefs.ts +11 -0
  191. package/corpus/templates/content/vitest.config.ts +20 -16
  192. package/corpus/templates/crm/app/routes/settings.tsx +14 -22
  193. package/corpus/templates/crm/vitest.config.ts +8 -4
  194. package/corpus/templates/design/.generated/bridge/editor-chrome.generated.ts +26 -11
  195. package/corpus/templates/design/actions/take-design-screenshot.ts +7 -0
  196. package/corpus/templates/design/app/components/design/DesignCanvas.tsx +11 -3
  197. package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +4 -1
  198. package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +54 -17
  199. package/corpus/templates/design/app/components/design/design-canvas/local-runtime.ts +126 -0
  200. package/corpus/templates/design/app/components/templates/TemplatePreview.tsx +2 -0
  201. package/corpus/templates/design/app/pages/Index.tsx +3 -1
  202. package/corpus/templates/design/app/pages/Present.tsx +2 -1
  203. package/corpus/templates/design/app/routes/settings.tsx +14 -22
  204. package/corpus/templates/design/changelog/2026-07-30-a-broken-inline-script-in-a-generated-screen-is-now-caught-o.md +6 -0
  205. package/corpus/templates/design/changelog/2026-07-30-design-html-is-now-validated-with-a-spec-grade-html-parser-i.md +6 -0
  206. package/corpus/templates/design/changelog/2026-07-30-designs-now-load-their-tailwind-and-alpine-runtimes-from-the.md +6 -0
  207. package/corpus/templates/design/changelog/2026-07-30-designs-with-a-broken-alpine-expression-are-now-caught-on-sa.md +6 -0
  208. package/corpus/templates/design/changelog/2026-07-30-editing-a-design-no-longer-strips-its-styling-the-canvas-kep.md +6 -0
  209. package/corpus/templates/design/changelog/2026-08-01-review-comments-replies-and-mentions-now-send-an-email-to-th.md +6 -0
  210. package/corpus/templates/design/package.json +4 -0
  211. package/corpus/templates/design/shared/html-integrity.ts +802 -556
  212. package/corpus/templates/design/vitest.config.ts +18 -12
  213. package/corpus/templates/dispatch/app/routes/settings.tsx +26 -40
  214. package/corpus/templates/dispatch/vitest.config.ts +11 -7
  215. package/corpus/templates/factory/app/routes/settings.tsx +14 -22
  216. package/corpus/templates/factory/vitest.config.ts +9 -0
  217. package/corpus/templates/forms/app/routes/_app.settings.tsx +14 -22
  218. package/corpus/templates/forms/vitest.config.ts +27 -23
  219. package/corpus/templates/macros/app/routes/settings.tsx +14 -22
  220. package/corpus/templates/macros/vitest.config.ts +16 -12
  221. package/corpus/templates/mail/app/pages/SettingsPage.tsx +14 -16
  222. package/corpus/templates/mail/vitest.config.ts +16 -12
  223. package/corpus/templates/plan/app/routes/settings.tsx +30 -44
  224. package/corpus/templates/plan/vitest.config.ts +24 -20
  225. package/corpus/templates/slides/actions/add-slide-comment.ts +12 -1
  226. package/corpus/templates/slides/app/components/ui/switch.tsx +1 -0
  227. package/corpus/templates/slides/app/hooks/use-slides-prefs.ts +55 -0
  228. package/corpus/templates/slides/app/i18n/en-US.ts +4 -0
  229. package/corpus/templates/slides/app/routes/settings.tsx +45 -22
  230. package/corpus/templates/slides/changelog/2026-08-01-get-an-email-when-someone-comments-on-or-replies-in-your-dec.md +6 -0
  231. package/corpus/templates/slides/server/lib/comment-notifications.ts +182 -0
  232. package/corpus/templates/slides/server/routes/_agent-native/slides/user-prefs.get.ts +16 -0
  233. package/corpus/templates/slides/server/routes/_agent-native/slides/user-prefs.put.ts +36 -0
  234. package/corpus/templates/slides/shared/slides-user-prefs.ts +11 -0
  235. package/corpus/templates/slides/vitest.config.ts +17 -13
  236. package/corpus/templates/tasks/app/components/layout/Sidebar.tsx +2 -0
  237. package/corpus/templates/tasks/app/routes/settings.tsx +14 -22
  238. package/corpus/templates/tasks/vitest.config.ts +17 -13
  239. package/corpus/toolkit/CHANGELOG.md +9 -0
  240. package/corpus/toolkit/package.json +1 -1
  241. package/corpus/toolkit/vitest.config.ts +3 -0
  242. package/dist/automations/service.d.ts +2 -0
  243. package/dist/automations/service.d.ts.map +1 -1
  244. package/dist/automations/service.js +29 -4
  245. package/dist/automations/service.js.map +1 -1
  246. package/dist/cli/mcp-config-writers.d.ts.map +1 -1
  247. package/dist/cli/mcp-config-writers.js +24 -23
  248. package/dist/cli/mcp-config-writers.js.map +1 -1
  249. package/dist/client/agent-page/AgentJobsTab.d.ts.map +1 -1
  250. package/dist/client/agent-page/AgentJobsTab.js +86 -29
  251. package/dist/client/agent-page/AgentJobsTab.js.map +1 -1
  252. package/dist/client/agent-page/AutomationDetailsDialog.d.ts +21 -0
  253. package/dist/client/agent-page/AutomationDetailsDialog.d.ts.map +1 -0
  254. package/dist/client/agent-page/AutomationDetailsDialog.js +33 -0
  255. package/dist/client/agent-page/AutomationDetailsDialog.js.map +1 -0
  256. package/dist/client/agent-page/AutomationScheduleDialog.d.ts +15 -0
  257. package/dist/client/agent-page/AutomationScheduleDialog.d.ts.map +1 -0
  258. package/dist/client/agent-page/AutomationScheduleDialog.js +46 -0
  259. package/dist/client/agent-page/AutomationScheduleDialog.js.map +1 -0
  260. package/dist/client/agent-page/TimezoneSelect.d.ts +17 -0
  261. package/dist/client/agent-page/TimezoneSelect.d.ts.map +1 -0
  262. package/dist/client/agent-page/TimezoneSelect.js +107 -0
  263. package/dist/client/agent-page/TimezoneSelect.js.map +1 -0
  264. package/dist/client/agent-page/use-jobs.d.ts +20 -7
  265. package/dist/client/agent-page/use-jobs.d.ts.map +1 -1
  266. package/dist/client/agent-page/use-jobs.js +24 -4
  267. package/dist/client/agent-page/use-jobs.js.map +1 -1
  268. package/dist/client/org/OrgSwitcher.d.ts +8 -1
  269. package/dist/client/org/OrgSwitcher.d.ts.map +1 -1
  270. package/dist/client/org/OrgSwitcher.js +8 -2
  271. package/dist/client/org/OrgSwitcher.js.map +1 -1
  272. package/dist/client/settings/AccountSettingsCard.d.ts.map +1 -1
  273. package/dist/client/settings/AccountSettingsCard.js +10 -9
  274. package/dist/client/settings/AccountSettingsCard.js.map +1 -1
  275. package/dist/client/settings/SchedulingTimezoneField.d.ts +10 -0
  276. package/dist/client/settings/SchedulingTimezoneField.d.ts.map +1 -0
  277. package/dist/client/settings/SchedulingTimezoneField.js +30 -0
  278. package/dist/client/settings/SchedulingTimezoneField.js.map +1 -0
  279. package/dist/client/settings/SettingsRow.d.ts +36 -0
  280. package/dist/client/settings/SettingsRow.d.ts.map +1 -0
  281. package/dist/client/settings/SettingsRow.js +15 -0
  282. package/dist/client/settings/SettingsRow.js.map +1 -0
  283. package/dist/client/settings/agent-settings-search.d.ts.map +1 -1
  284. package/dist/client/settings/agent-settings-search.js +1 -1
  285. package/dist/client/settings/agent-settings-search.js.map +1 -1
  286. package/dist/client/settings/index.d.ts +1 -0
  287. package/dist/client/settings/index.d.ts.map +1 -1
  288. package/dist/client/settings/index.js +1 -0
  289. package/dist/client/settings/index.js.map +1 -1
  290. package/dist/collab/struct-routes.d.ts +1 -1
  291. package/dist/file-upload/actions/upload-image.d.ts +1 -1
  292. package/dist/integrations/identity.d.ts.map +1 -1
  293. package/dist/integrations/identity.js +2 -11
  294. package/dist/integrations/identity.js.map +1 -1
  295. package/dist/jobs/actions/list-automation-runs.d.ts +8 -0
  296. package/dist/jobs/actions/list-automation-runs.d.ts.map +1 -0
  297. package/dist/jobs/actions/list-automation-runs.js +29 -0
  298. package/dist/jobs/actions/list-automation-runs.js.map +1 -0
  299. package/dist/jobs/actions/list-recurring-jobs.d.ts +2 -0
  300. package/dist/jobs/actions/list-recurring-jobs.d.ts.map +1 -1
  301. package/dist/jobs/actions/list-recurring-jobs.js +20 -7
  302. package/dist/jobs/actions/list-recurring-jobs.js.map +1 -1
  303. package/dist/jobs/actions/manage-recurring-job.d.ts +2 -0
  304. package/dist/jobs/actions/manage-recurring-job.js +30 -9
  305. package/dist/jobs/actions/manage-recurring-job.js.map +1 -1
  306. package/dist/jobs/background-automation-runner.d.ts.map +1 -1
  307. package/dist/jobs/background-automation-runner.js +60 -0
  308. package/dist/jobs/background-automation-runner.js.map +1 -1
  309. package/dist/jobs/cron.d.ts +16 -2
  310. package/dist/jobs/cron.d.ts.map +1 -1
  311. package/dist/jobs/cron.js +43 -6
  312. package/dist/jobs/cron.js.map +1 -1
  313. package/dist/jobs/frontmatter.d.ts +12 -0
  314. package/dist/jobs/frontmatter.d.ts.map +1 -1
  315. package/dist/jobs/frontmatter.js +8 -0
  316. package/dist/jobs/frontmatter.js.map +1 -1
  317. package/dist/jobs/run-history.d.ts +56 -0
  318. package/dist/jobs/run-history.d.ts.map +1 -0
  319. package/dist/jobs/run-history.js +169 -0
  320. package/dist/jobs/run-history.js.map +1 -0
  321. package/dist/jobs/scheduler.d.ts.map +1 -1
  322. package/dist/jobs/scheduler.js +51 -18
  323. package/dist/jobs/scheduler.js.map +1 -1
  324. package/dist/jobs/tools.d.ts.map +1 -1
  325. package/dist/jobs/tools.js +37 -6
  326. package/dist/jobs/tools.js.map +1 -1
  327. package/dist/localization/actions/get-localization-preference.d.ts +1 -2
  328. package/dist/localization/actions/get-localization-preference.d.ts.map +1 -1
  329. package/dist/localization/actions/get-localization-preference.js.map +1 -1
  330. package/dist/localization/actions/set-localization-preference.d.ts +3 -3
  331. package/dist/localization/actions/set-localization-preference.d.ts.map +1 -1
  332. package/dist/localization/actions/set-localization-preference.js +33 -8
  333. package/dist/localization/actions/set-localization-preference.js.map +1 -1
  334. package/dist/localization/default-messages.d.ts +25 -0
  335. package/dist/localization/default-messages.d.ts.map +1 -1
  336. package/dist/localization/default-messages.js +25 -0
  337. package/dist/localization/default-messages.js.map +1 -1
  338. package/dist/localization/shared.d.ts +16 -1
  339. package/dist/localization/shared.d.ts.map +1 -1
  340. package/dist/localization/shared.js +22 -4
  341. package/dist/localization/shared.js.map +1 -1
  342. package/dist/localization/user-timezone.d.ts +11 -0
  343. package/dist/localization/user-timezone.d.ts.map +1 -0
  344. package/dist/localization/user-timezone.js +31 -0
  345. package/dist/localization/user-timezone.js.map +1 -0
  346. package/dist/notifications/routes.d.ts +2 -2
  347. package/dist/observability/routes.d.ts +1 -1
  348. package/dist/org/app-roles-handlers.d.ts.map +1 -1
  349. package/dist/org/app-roles-handlers.js +1 -8
  350. package/dist/org/app-roles-handlers.js.map +1 -1
  351. package/dist/org/index.d.ts +1 -0
  352. package/dist/org/index.d.ts.map +1 -1
  353. package/dist/org/index.js +1 -0
  354. package/dist/org/index.js.map +1 -1
  355. package/dist/org/membership.d.ts +6 -0
  356. package/dist/org/membership.d.ts.map +1 -0
  357. package/dist/org/membership.js +16 -0
  358. package/dist/org/membership.js.map +1 -0
  359. package/dist/provider-api/actions/custom-provider-registration.d.ts +10 -10
  360. package/dist/provider-api/actions/provider-api.d.ts +8 -8
  361. package/dist/provider-api/corpus-jobs.d.ts +2 -2
  362. package/dist/resources/handlers.d.ts +1 -1
  363. package/dist/review/actions/create-review-comment.d.ts +32 -1
  364. package/dist/review/actions/create-review-comment.d.ts.map +1 -1
  365. package/dist/review/actions/create-review-comment.js +3 -1
  366. package/dist/review/actions/create-review-comment.js.map +1 -1
  367. package/dist/review/actions/reply-review-comment.d.ts +32 -1
  368. package/dist/review/actions/reply-review-comment.d.ts.map +1 -1
  369. package/dist/review/actions/reply-review-comment.js +3 -1
  370. package/dist/review/actions/reply-review-comment.js.map +1 -1
  371. package/dist/review/index.d.ts +1 -0
  372. package/dist/review/index.d.ts.map +1 -1
  373. package/dist/review/index.js +1 -0
  374. package/dist/review/index.js.map +1 -1
  375. package/dist/review/notifications.d.ts +24 -0
  376. package/dist/review/notifications.d.ts.map +1 -0
  377. package/dist/review/notifications.js +123 -0
  378. package/dist/review/notifications.js.map +1 -0
  379. package/dist/review/types.d.ts +5 -0
  380. package/dist/review/types.d.ts.map +1 -1
  381. package/dist/review/types.js.map +1 -1
  382. package/dist/server/action-discovery.d.ts.map +1 -1
  383. package/dist/server/action-discovery.js +4 -0
  384. package/dist/server/action-discovery.js.map +1 -1
  385. package/dist/server/activity-notifications.d.ts +61 -0
  386. package/dist/server/activity-notifications.d.ts.map +1 -0
  387. package/dist/server/activity-notifications.js +103 -0
  388. package/dist/server/activity-notifications.js.map +1 -0
  389. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  390. package/dist/server/app-name.d.ts +18 -0
  391. package/dist/server/app-name.d.ts.map +1 -1
  392. package/dist/server/app-name.js +31 -0
  393. package/dist/server/app-name.js.map +1 -1
  394. package/dist/server/better-auth-instance.js +4 -4
  395. package/dist/server/better-auth-instance.js.map +1 -1
  396. package/dist/server/email-templates.d.ts +12 -0
  397. package/dist/server/email-templates.d.ts.map +1 -1
  398. package/dist/server/email-templates.js +57 -14
  399. package/dist/server/email-templates.js.map +1 -1
  400. package/dist/server/email.d.ts +12 -0
  401. package/dist/server/email.d.ts.map +1 -1
  402. package/dist/server/email.js +52 -5
  403. package/dist/server/email.js.map +1 -1
  404. package/dist/server/index.d.ts +1 -0
  405. package/dist/server/index.d.ts.map +1 -1
  406. package/dist/server/index.js +1 -0
  407. package/dist/server/index.js.map +1 -1
  408. package/dist/sharing/index.d.ts +1 -0
  409. package/dist/sharing/index.d.ts.map +1 -1
  410. package/dist/sharing/index.js +1 -0
  411. package/dist/sharing/index.js.map +1 -1
  412. package/dist/sharing/recipients.d.ts +31 -0
  413. package/dist/sharing/recipients.d.ts.map +1 -0
  414. package/dist/sharing/recipients.js +40 -0
  415. package/dist/sharing/recipients.js.map +1 -0
  416. package/dist/templates/chat/app/routes/settings.tsx +14 -22
  417. package/dist/templates/chat/vitest.config.ts +9 -0
  418. package/dist/triggers/actions/list-automations.d.ts +2 -0
  419. package/dist/triggers/actions/list-automations.d.ts.map +1 -1
  420. package/dist/triggers/actions/list-automations.js +19 -8
  421. package/dist/triggers/actions/list-automations.js.map +1 -1
  422. package/dist/triggers/actions/manage-automation.d.ts +6 -0
  423. package/dist/triggers/actions/manage-automation.js +12 -6
  424. package/dist/triggers/actions/manage-automation.js.map +1 -1
  425. package/dist/triggers/actions.d.ts.map +1 -1
  426. package/dist/triggers/actions.js +15 -4
  427. package/dist/triggers/actions.js.map +1 -1
  428. package/dist/triggers/dispatcher.d.ts.map +1 -1
  429. package/dist/triggers/dispatcher.js +19 -17
  430. package/dist/triggers/dispatcher.js.map +1 -1
  431. package/dist/triggers/routes.d.ts.map +1 -1
  432. package/dist/triggers/routes.js +6 -6
  433. package/dist/triggers/routes.js.map +1 -1
  434. package/dist/vitest-config.d.ts +10 -0
  435. package/dist/vitest-config.d.ts.map +1 -0
  436. package/dist/vitest-config.js +55 -0
  437. package/dist/vitest-config.js.map +1 -0
  438. package/docs/content/template-content-developers.mdx +1 -1
  439. package/package.json +5 -4
  440. package/src/automations/service.ts +41 -4
  441. package/src/cli/mcp-config-writers.ts +27 -21
  442. package/src/client/agent-page/AgentJobsTab.tsx +187 -85
  443. package/src/client/agent-page/AutomationDetailsDialog.tsx +208 -0
  444. package/src/client/agent-page/AutomationScheduleDialog.tsx +180 -0
  445. package/src/client/agent-page/TimezoneSelect.tsx +241 -0
  446. package/src/client/agent-page/use-jobs.ts +50 -10
  447. package/src/client/org/OrgSwitcher.tsx +26 -0
  448. package/src/client/settings/AccountSettingsCard.tsx +35 -31
  449. package/src/client/settings/SchedulingTimezoneField.tsx +71 -0
  450. package/src/client/settings/SettingsRow.tsx +113 -0
  451. package/src/client/settings/agent-settings-search.ts +2 -1
  452. package/src/client/settings/index.ts +6 -0
  453. package/src/integrations/identity.ts +2 -12
  454. package/src/jobs/actions/list-automation-runs.ts +33 -0
  455. package/src/jobs/actions/list-recurring-jobs.ts +27 -6
  456. package/src/jobs/actions/manage-recurring-job.ts +41 -9
  457. package/src/jobs/background-automation-runner.ts +88 -0
  458. package/src/jobs/cron.ts +52 -6
  459. package/src/jobs/frontmatter.ts +20 -0
  460. package/src/jobs/run-history.ts +242 -0
  461. package/src/jobs/scheduler.ts +73 -18
  462. package/src/jobs/tools.ts +54 -6
  463. package/src/localization/actions/get-localization-preference.ts +2 -2
  464. package/src/localization/actions/set-localization-preference.ts +49 -11
  465. package/src/localization/default-messages.ts +27 -0
  466. package/src/localization/shared.ts +39 -6
  467. package/src/localization/user-timezone.ts +36 -0
  468. package/src/org/app-roles-handlers.ts +1 -9
  469. package/src/org/index.ts +2 -0
  470. package/src/org/membership.ts +18 -0
  471. package/src/review/actions/create-review-comment.ts +4 -1
  472. package/src/review/actions/reply-review-comment.ts +4 -1
  473. package/src/review/index.ts +5 -0
  474. package/src/review/notifications.ts +163 -0
  475. package/src/review/types.ts +7 -0
  476. package/src/server/action-discovery.ts +4 -0
  477. package/src/server/activity-notifications.ts +174 -0
  478. package/src/server/app-name.ts +31 -0
  479. package/src/server/better-auth-instance.ts +4 -4
  480. package/src/server/email-templates.ts +70 -14
  481. package/src/server/email.ts +66 -3
  482. package/src/server/index.ts +10 -0
  483. package/src/sharing/index.ts +5 -0
  484. package/src/sharing/recipients.ts +67 -0
  485. package/src/templates/chat/app/routes/settings.tsx +14 -22
  486. package/src/templates/chat/vitest.config.ts +9 -0
  487. package/src/triggers/actions/list-automations.ts +27 -8
  488. package/src/triggers/actions/manage-automation.ts +17 -6
  489. package/src/triggers/actions.ts +16 -4
  490. package/src/triggers/dispatcher.ts +44 -30
  491. package/src/triggers/routes.ts +19 -6
  492. package/src/vitest-config.ts +68 -0
  493. package/corpus/templates/content/actions/delete-database-items.ts +0 -89
@@ -0,0 +1,107 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, } from "@agent-native/toolkit/ui/command";
3
+ import { Popover, PopoverContent, PopoverTrigger, } from "@agent-native/toolkit/ui/popover";
4
+ import { IconCheck, IconChevronDown } from "@tabler/icons-react";
5
+ import { useMemo, useState } from "react";
6
+ const SYSTEM_VALUE = "system";
7
+ /** The browser's IANA zone, or UTC when the runtime cannot report one. */
8
+ export function browserTimezone() {
9
+ try {
10
+ return Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
11
+ }
12
+ catch {
13
+ return "UTC";
14
+ }
15
+ }
16
+ function supportedTimezones() {
17
+ const supported = Intl.supportedValuesOf;
18
+ const zones = supported ? supported("timeZone") : [];
19
+ // Older runtimes omit supportedValuesOf; the browser zone plus UTC still
20
+ // covers the common case rather than leaving an empty, unusable menu.
21
+ const base = zones.length ? zones : [browserTimezone()];
22
+ return [...new Set(["UTC", ...base])];
23
+ }
24
+ function describeZone(zone, now) {
25
+ let parts;
26
+ try {
27
+ parts = new Intl.DateTimeFormat("en-US", {
28
+ timeZone: zone,
29
+ hour: "numeric",
30
+ minute: "2-digit",
31
+ hour12: true,
32
+ timeZoneName: "longOffset",
33
+ }).formatToParts(now);
34
+ }
35
+ catch {
36
+ // A zone this runtime cannot resolve would otherwise throw during render.
37
+ return null;
38
+ }
39
+ const part = (type) => parts.find((p) => p.type === type)?.value ?? "";
40
+ // `longOffset` collapses to a bare "GMT" at zero rather than "GMT+00:00".
41
+ const raw = part("timeZoneName");
42
+ const offsetLabel = raw === "GMT" ? "GMT+00:00" : raw;
43
+ const match = /^GMT([+-])(\d{2}):(\d{2})$/.exec(offsetLabel);
44
+ const offsetMinutes = match
45
+ ? (match[1] === "-" ? -1 : 1) * (Number(match[2]) * 60 + Number(match[3]))
46
+ : 0;
47
+ return {
48
+ zone,
49
+ offsetMinutes,
50
+ offsetLabel,
51
+ timeLabel: `${part("hour")}:${part("minute")}${part("dayPeriod").toLowerCase()}`,
52
+ placeLabel: zone.replace(/_/g, " "),
53
+ };
54
+ }
55
+ function zoneOptions(extra, now) {
56
+ const zones = [...new Set([...extra, ...supportedTimezones()])];
57
+ return zones
58
+ .map((zone) => describeZone(zone, now))
59
+ .filter((option) => option !== null)
60
+ .sort((a, b) => a.offsetMinutes - b.offsetMinutes ||
61
+ a.placeLabel.localeCompare(b.placeLabel));
62
+ }
63
+ export function TimezoneSelect({ value, disabled, onChange, suggested = [], systemLabel, id, }) {
64
+ const [open, setOpen] = useState(false);
65
+ const detected = browserTimezone();
66
+ // 418 zones each need their own formatter, so only pay for that once the
67
+ // list is actually on screen. Reopening re-reads the clock.
68
+ const options = useMemo(() => {
69
+ if (!open)
70
+ return [];
71
+ const pinned = [...suggested, value].filter((zone) => zone && zone !== SYSTEM_VALUE);
72
+ return zoneOptions(pinned, new Date());
73
+ }, [open, suggested, value]);
74
+ const selected = useMemo(() => (value === SYSTEM_VALUE ? null : describeZone(value, new Date())), [value]);
75
+ const triggerLabel = value === SYSTEM_VALUE
76
+ ? (systemLabel ?? SYSTEM_VALUE)
77
+ : selected
78
+ ? `(${selected.offsetLabel}) ${selected.placeLabel}`
79
+ : value;
80
+ function choose(zone) {
81
+ setOpen(false);
82
+ if (zone !== value)
83
+ onChange(zone);
84
+ }
85
+ function renderZone(option, key) {
86
+ return (_jsxs(CommandItem, {
87
+ // Searched text: place and offset both need to match what users type.
88
+ // The key is folded in because the detected zone is listed twice, and
89
+ // cmdk treats two items with the same value as the same item.
90
+ value: `${option.placeLabel} ${option.offsetLabel} ${option.zone} ${key}`, onSelect: () => choose(option.zone), className: "gap-2", children: [_jsx(IconCheck, { className: `size-4 shrink-0 ${option.zone === value ? "opacity-100" : "opacity-0"}` }), _jsxs("span", { className: "w-24 shrink-0 tabular-nums text-muted-foreground", children: ["(", option.offsetLabel, ")"] }), _jsx("span", { className: "truncate", children: option.placeLabel }), _jsx("span", { className: "ms-auto shrink-0 tabular-nums text-muted-foreground", children: option.timeLabel })] }, key));
91
+ }
92
+ const detectedOption = options.find((option) => option.zone === detected);
93
+ return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { id: id, type: "button", role: "combobox", "aria-expanded": open, disabled: disabled,
94
+ // Matches the text inputs it sits beside, not a button.
95
+ className: "flex h-10 w-full items-center justify-between gap-2 rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", children: [_jsx("span", { className: "truncate", children: triggerLabel }), _jsx(IconChevronDown, { className: "size-4 shrink-0 opacity-50" })] }) }), _jsx(PopoverContent, { align: "start", className: "w-[--radix-popover-trigger-width] p-0", children: _jsxs(Command
96
+ // cmdk's default scorer matches loose subsequences, so "Perth" would
97
+ // otherwise surface most of the list.
98
+ , {
99
+ // cmdk's default scorer matches loose subsequences, so "Perth" would
100
+ // otherwise surface most of the list.
101
+ filter: (itemValue, search) => itemValue.toLowerCase().includes(search.toLowerCase().trim())
102
+ ? 1
103
+ : 0, children: [_jsx(CommandInput, { placeholder: "Search a city or region\u2026" }), _jsxs(CommandList, { className: "max-h-72", children: [_jsx(CommandEmpty, { children: "No matching timezone." }), systemLabel || detectedOption ? (_jsxs(_Fragment, { children: [_jsxs(CommandGroup, { children: [systemLabel ? (_jsxs(CommandItem, { value: `${systemLabel} follow browser automatic`, onSelect: () => choose(SYSTEM_VALUE), className: "gap-2", children: [_jsx(IconCheck, { className: `size-4 shrink-0 ${value === SYSTEM_VALUE ? "opacity-100" : "opacity-0"}` }), _jsx("span", { className: "truncate", children: systemLabel })] })) : null, detectedOption
104
+ ? renderZone(detectedOption, "detected")
105
+ : null] }), _jsx(CommandSeparator, {})] })) : null, _jsx(CommandGroup, { children: options.map((option) => renderZone(option, option.zone)) })] })] }) })] }));
106
+ }
107
+ //# sourceMappingURL=TimezoneSelect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimezoneSelect.js","sourceRoot":"","sources":["../../../src/client/agent-page/TimezoneSelect.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,gBAAgB,GACjB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,GACf,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1C,MAAM,YAAY,GAAG,QAAQ,CAAC;AAE9B,0EAA0E;AAC1E,MAAM,UAAU,eAAe;IAC7B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,cAAc,EAAE,CAAC,eAAe,EAAE,CAAC,QAAQ,IAAI,KAAK,CAAC;IACnE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,SAAS,kBAAkB;IACzB,MAAM,SAAS,GACb,IACD,CAAC,iBAAiB,CAAC;IACpB,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACrD,yEAAyE;IACzE,sEAAsE;IACtE,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,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AU,aAC/B,KAAC,YAAY,wCAAqC,EACjD,WAAW,IAAI,cAAc,CAAC,CAAC,CAAC,CAC/B,8BACE,MAAC,YAAY,eACV,WAAW,CAAC,CAAC,CAAC,CACb,MAAC,WAAW,IACV,KAAK,EAAE,GAAG,WAAW,2BAA2B,EAChD,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,EACpC,SAAS,EAAC,OAAO,aAEjB,KAAC,SAAS,IACR,SAAS,EAAE,mBACT,KAAK,KAAK,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,WAC3C,EAAE,GACF,EACF,eAAM,SAAS,EAAC,UAAU,YAAE,WAAW,GAAQ,IACnC,CACf,CAAC,CAAC,CAAC,IAAI,EACP,cAAc;oDACb,CAAC,CAAC,UAAU,CAAC,cAAc,EAAE,UAAU,CAAC;oDACxC,CAAC,CAAC,IAAI,IACK,EACf,KAAC,gBAAgB,KAAG,IACnB,CACJ,CAAC,CAAC,CAAC,IAAI,EACR,KAAC,YAAY,cACV,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,GAC5C,IACH,IACN,GACK,IACT,CACX,CAAC;AACJ,CAAC","sourcesContent":["import {\n Command,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n} from \"@agent-native/toolkit/ui/command\";\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@agent-native/toolkit/ui/popover\";\nimport { IconCheck, IconChevronDown } from \"@tabler/icons-react\";\nimport { useMemo, useState } from \"react\";\n\nconst SYSTEM_VALUE = \"system\";\n\n/** The browser's IANA zone, or UTC when the runtime cannot report one. */\nexport function browserTimezone(): string {\n try {\n return Intl.DateTimeFormat().resolvedOptions().timeZone || \"UTC\";\n } catch {\n return \"UTC\";\n }\n}\n\nfunction supportedTimezones(): string[] {\n const supported = (\n Intl as unknown as { supportedValuesOf?: (key: string) => string[] }\n ).supportedValuesOf;\n const zones = supported ? supported(\"timeZone\") : [];\n // Older runtimes omit supportedValuesOf; the browser zone plus UTC still\n // covers the common case rather than leaving an empty, unusable menu.\n const base = zones.length ? zones : [browserTimezone()];\n return [...new Set([\"UTC\", ...base])];\n}\n\ninterface ZoneOption {\n zone: string;\n /** Minutes east of GMT, used to order the list the way a map reads. */\n offsetMinutes: number;\n offsetLabel: string;\n timeLabel: string;\n placeLabel: string;\n}\n\nfunction describeZone(zone: string, now: Date): ZoneOption | null {\n let parts: Intl.DateTimeFormatPart[];\n try {\n parts = new Intl.DateTimeFormat(\"en-US\", {\n timeZone: zone,\n hour: \"numeric\",\n minute: \"2-digit\",\n hour12: true,\n timeZoneName: \"longOffset\",\n }).formatToParts(now);\n } catch {\n // A zone this runtime cannot resolve would otherwise throw during render.\n return null;\n }\n\n const part = (type: Intl.DateTimeFormatPartTypes) =>\n parts.find((p) => p.type === type)?.value ?? \"\";\n\n // `longOffset` collapses to a bare \"GMT\" at zero rather than \"GMT+00:00\".\n const raw = part(\"timeZoneName\");\n const offsetLabel = raw === \"GMT\" ? \"GMT+00:00\" : raw;\n const match = /^GMT([+-])(\\d{2}):(\\d{2})$/.exec(offsetLabel);\n const offsetMinutes = match\n ? (match[1] === \"-\" ? -1 : 1) * (Number(match[2]) * 60 + Number(match[3]))\n : 0;\n\n return {\n zone,\n offsetMinutes,\n offsetLabel,\n timeLabel: `${part(\"hour\")}:${part(\"minute\")}${part(\"dayPeriod\").toLowerCase()}`,\n placeLabel: zone.replace(/_/g, \" \"),\n };\n}\n\nfunction zoneOptions(extra: string[], now: Date): ZoneOption[] {\n const zones = [...new Set([...extra, ...supportedTimezones()])];\n return zones\n .map((zone) => describeZone(zone, now))\n .filter((option): option is ZoneOption => option !== null)\n .sort(\n (a, b) =>\n a.offsetMinutes - b.offsetMinutes ||\n a.placeLabel.localeCompare(b.placeLabel),\n );\n}\n\nexport interface TimezoneSelectProps {\n value: string;\n disabled?: boolean;\n onChange: (timezone: string) => void;\n /** Zones to surface above the full list, e.g. the currently stored one. */\n suggested?: string[];\n /**\n * Label for a leading `system` choice. Settings offer it so the preference\n * stays revertible; a schedule must name a concrete zone and omits it.\n */\n systemLabel?: string;\n id?: string;\n}\n\nexport function TimezoneSelect({\n value,\n disabled,\n onChange,\n suggested = [],\n systemLabel,\n id,\n}: TimezoneSelectProps) {\n const [open, setOpen] = useState(false);\n const detected = browserTimezone();\n\n // 418 zones each need their own formatter, so only pay for that once the\n // list is actually on screen. Reopening re-reads the clock.\n const options = useMemo(() => {\n if (!open) return [];\n const pinned = [...suggested, value].filter(\n (zone) => zone && zone !== SYSTEM_VALUE,\n );\n return zoneOptions(pinned, new Date());\n }, [open, suggested, value]);\n\n const selected = useMemo(\n () => (value === SYSTEM_VALUE ? null : describeZone(value, new Date())),\n [value],\n );\n\n const triggerLabel =\n value === SYSTEM_VALUE\n ? (systemLabel ?? SYSTEM_VALUE)\n : selected\n ? `(${selected.offsetLabel}) ${selected.placeLabel}`\n : value;\n\n function choose(zone: string) {\n setOpen(false);\n if (zone !== value) onChange(zone);\n }\n\n function renderZone(option: ZoneOption, key: string) {\n return (\n <CommandItem\n key={key}\n // Searched text: place and offset both need to match what users type.\n // The key is folded in because the detected zone is listed twice, and\n // cmdk treats two items with the same value as the same item.\n value={`${option.placeLabel} ${option.offsetLabel} ${option.zone} ${key}`}\n onSelect={() => choose(option.zone)}\n className=\"gap-2\"\n >\n <IconCheck\n className={`size-4 shrink-0 ${\n option.zone === value ? \"opacity-100\" : \"opacity-0\"\n }`}\n />\n <span className=\"w-24 shrink-0 tabular-nums text-muted-foreground\">\n ({option.offsetLabel})\n </span>\n <span className=\"truncate\">{option.placeLabel}</span>\n <span className=\"ms-auto shrink-0 tabular-nums text-muted-foreground\">\n {option.timeLabel}\n </span>\n </CommandItem>\n );\n }\n\n const detectedOption = options.find((option) => option.zone === detected);\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <button\n id={id}\n type=\"button\"\n role=\"combobox\"\n aria-expanded={open}\n disabled={disabled}\n // Matches the text inputs it sits beside, not a button.\n className=\"flex h-10 w-full items-center justify-between gap-2 rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\"\n >\n <span className=\"truncate\">{triggerLabel}</span>\n <IconChevronDown className=\"size-4 shrink-0 opacity-50\" />\n </button>\n </PopoverTrigger>\n <PopoverContent\n align=\"start\"\n className=\"w-[--radix-popover-trigger-width] p-0\"\n >\n <Command\n // cmdk's default scorer matches loose subsequences, so \"Perth\" would\n // otherwise surface most of the list.\n filter={(itemValue, search) =>\n itemValue.toLowerCase().includes(search.toLowerCase().trim())\n ? 1\n : 0\n }\n >\n <CommandInput placeholder=\"Search a city or region…\" />\n <CommandList className=\"max-h-72\">\n <CommandEmpty>No matching timezone.</CommandEmpty>\n {systemLabel || detectedOption ? (\n <>\n <CommandGroup>\n {systemLabel ? (\n <CommandItem\n value={`${systemLabel} follow browser automatic`}\n onSelect={() => choose(SYSTEM_VALUE)}\n className=\"gap-2\"\n >\n <IconCheck\n className={`size-4 shrink-0 ${\n value === SYSTEM_VALUE ? \"opacity-100\" : \"opacity-0\"\n }`}\n />\n <span className=\"truncate\">{systemLabel}</span>\n </CommandItem>\n ) : null}\n {detectedOption\n ? renderZone(detectedOption, \"detected\")\n : null}\n </CommandGroup>\n <CommandSeparator />\n </>\n ) : null}\n <CommandGroup>\n {options.map((option) => renderZone(option, option.zone))}\n </CommandGroup>\n </CommandList>\n </Command>\n </PopoverContent>\n </Popover>\n );\n}\n"]}
@@ -5,10 +5,12 @@ export interface RecurringJob {
5
5
  path: string;
6
6
  scope: "personal" | "organization";
7
7
  schedule: string;
8
+ timezone: string;
8
9
  scheduleDescription: string;
9
10
  instructions: string;
10
11
  enabled: boolean;
11
12
  lastRun: string | null;
13
+ lastCheck: string | null;
12
14
  lastStatus: string | null;
13
15
  lastError: string | null;
14
16
  nextRun: string | null;
@@ -24,11 +26,13 @@ export interface Automation {
24
26
  triggerType: "event" | "schedule";
25
27
  event: string | null;
26
28
  schedule: string | null;
29
+ timezone: string | null;
27
30
  scheduleDescription: string | null;
28
31
  condition: string | null;
29
32
  body: string;
30
33
  enabled: boolean;
31
34
  lastRun: string | null;
35
+ lastCheck: string | null;
32
36
  lastStatus: string | null;
33
37
  lastError: string | null;
34
38
  nextRun: string | null;
@@ -47,13 +51,21 @@ export type ManageJobInput = {
47
51
  name: string;
48
52
  scope: "personal" | "organization";
49
53
  enabled?: boolean;
54
+ schedule?: string;
55
+ timezone?: string;
50
56
  };
51
- export type ManageAutomationInput = {
52
- operation: "update" | "delete";
53
- name: string;
54
- scope: "personal" | "organization";
55
- enabled?: boolean;
56
- };
57
+ export type ManageAutomationInput = ManageJobInput;
58
+ export interface AutomationRun {
59
+ id: string;
60
+ automation: string;
61
+ scope: string | null;
62
+ runId: string | null;
63
+ threadId: string | null;
64
+ status: "running" | "success" | "error" | "interrupted";
65
+ startedAt: number;
66
+ finishedAt: number | null;
67
+ error: string | null;
68
+ }
57
69
  export declare function useRecurringJobs(scope: JobsScope): import("@tanstack/react-query").UseQueryResult<NoInfer<RecurringJob[]>, Error>;
58
70
  export declare function useAutomations(scope: JobsScope): import("@tanstack/react-query").UseQueryResult<NoInfer<Automation[]>, Error>;
59
71
  export declare function useManageRecurringJob(scope: JobsScope): import("@tanstack/react-query").UseMutationResult<{
@@ -65,5 +77,6 @@ export declare function useManageAutomation(scope: JobsScope): import("@tanstack
65
77
  deleted?: boolean;
66
78
  name: string;
67
79
  enabled?: boolean;
68
- }, Error, ManageAutomationInput, unknown>;
80
+ }, Error, ManageJobInput, unknown>;
81
+ export declare function useAutomationRuns(scope: JobsScope, name: string | null, active: boolean): import("@tanstack/react-query").UseQueryResult<NoInfer<AutomationRun[]>, Error>;
69
82
  //# sourceMappingURL=use-jobs.d.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AAC;CACtB;AAUD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,kFAMhD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,gFAM9C;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,SAAS;cAMtC,OAAO;UAAQ,MAAM;cAAY,OAAO;mCA0BvD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS;cAMpC,OAAO;UAAQ,MAAM;cAAY,OAAO;mCA4BvD;AAcD,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,MAAM,EAAE,OAAO,mFAUhB"}
@@ -26,8 +26,8 @@ export function useManageRecurringJob(scope) {
26
26
  if (variables.operation === "delete") {
27
27
  return current.filter((job) => job.name !== variables.name);
28
28
  }
29
- return current.map((job) => job.name === variables.name && variables.enabled !== undefined
30
- ? { ...job, enabled: variables.enabled }
29
+ return current.map((job) => job.name === variables.name
30
+ ? { ...job, ...optimisticPatch(variables) }
31
31
  : job);
32
32
  });
33
33
  return { previous };
@@ -54,8 +54,8 @@ export function useManageAutomation(scope) {
54
54
  if (variables.operation === "delete") {
55
55
  return current.filter((automation) => automation.name !== variables.name);
56
56
  }
57
- return current.map((automation) => automation.name === variables.name && variables.enabled !== undefined
58
- ? { ...automation, enabled: variables.enabled }
57
+ return current.map((automation) => automation.name === variables.name
58
+ ? { ...automation, ...optimisticPatch(variables) }
59
59
  : automation);
60
60
  });
61
61
  return { previous };
@@ -68,4 +68,24 @@ export function useManageAutomation(scope) {
68
68
  },
69
69
  });
70
70
  }
71
+ function optimisticPatch(variables) {
72
+ const patch = {};
73
+ if (variables.enabled !== undefined)
74
+ patch.enabled = variables.enabled;
75
+ if (variables.schedule !== undefined)
76
+ patch.schedule = variables.schedule;
77
+ if (variables.timezone !== undefined)
78
+ patch.timezone = variables.timezone;
79
+ return patch;
80
+ }
81
+ export function useAutomationRuns(scope, name, active) {
82
+ const params = {
83
+ scope: scope === "org" ? "organization" : "personal",
84
+ name: name || "",
85
+ };
86
+ return useActionQuery("list-automation-runs", params, {
87
+ staleTime: 5_000,
88
+ enabled: active && Boolean(name),
89
+ });
90
+ }
71
91
  //# sourceMappingURL=use-jobs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-jobs.js","sourceRoot":"","sources":["../../../src/client/agent-page/use-jobs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AA+DrE,SAAS,eAAe,CAAC,KAAgB;IACvC,OAAO,EAAE,KAAK,EAAE,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,UAAU,EAAW,CAAC;AAC3E,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAgB;IACxC,OAAO,EAAE,KAAK,EAAE,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,UAAU,EAAW,CAAC;AAC3E,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAgB;IAC/C,OAAO,cAAc,CACnB,qBAAqB,EACrB,eAAe,CAAC,KAAK,CAAC,EACtB,EAAE,SAAS,EAAE,KAAK,EAAE,CACrB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAgB;IAC7C,OAAO,cAAc,CACnB,kBAAkB,EAClB,gBAAgB,CAAC,KAAK,CAAC,EACvB,EAAE,SAAS,EAAE,KAAK,EAAE,CACrB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,KAAgB;IACpD,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IACtC,MAAM,QAAQ,GAAG,CAAC,QAAQ,EAAE,qBAAqB,EAAE,MAAM,CAAU,CAAC;IAEpE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AAC,QAAQ,CAAC,CAAC;YACxD,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { useQueryClient } from \"@tanstack/react-query\";\n\nimport { useActionMutation, useActionQuery } from \"../use-action.js\";\n\nexport type JobsScope = \"user\" | \"org\";\n\nexport interface RecurringJob {\n id: string;\n name: string;\n path: string;\n scope: \"personal\" | \"organization\";\n schedule: string;\n scheduleDescription: string;\n instructions: string;\n enabled: boolean;\n lastRun: string | null;\n lastStatus: string | null;\n lastError: string | null;\n nextRun: string | null;\n createdBy: string | null;\n mcpTools: string[];\n canUpdate: boolean;\n}\n\nexport interface Automation {\n id: string;\n name: string;\n path: string;\n scope: \"personal\" | \"organization\";\n triggerType: \"event\" | \"schedule\";\n event: string | null;\n schedule: string | null;\n scheduleDescription: string | null;\n condition: string | null;\n body: string;\n enabled: boolean;\n lastRun: string | null;\n lastStatus: string | null;\n lastError: string | null;\n nextRun: string | null;\n createdBy: string | null;\n model: string | null;\n mcpTools: string[];\n originScopeId: string | null;\n deliveryPlatform: string | null;\n deliveryDestination: string | null;\n deliveryThreadRef: string | null;\n deliveryTenantId: string | null;\n canUpdate: boolean;\n}\n\nexport type ManageJobInput = {\n operation: \"update\" | \"delete\";\n name: string;\n scope: \"personal\" | \"organization\";\n enabled?: boolean;\n};\n\nexport type ManageAutomationInput = {\n operation: \"update\" | \"delete\";\n name: string;\n scope: \"personal\" | \"organization\";\n enabled?: boolean;\n};\n\nfunction recurringParams(scope: JobsScope) {\n return { scope: scope === \"org\" ? \"organization\" : \"personal\" } as const;\n}\n\nfunction automationParams(scope: JobsScope) {\n return { scope: scope === \"org\" ? \"organization\" : \"personal\" } as const;\n}\n\nexport function useRecurringJobs(scope: JobsScope) {\n return useActionQuery<RecurringJob[]>(\n \"list-recurring-jobs\",\n recurringParams(scope),\n { staleTime: 5_000 },\n );\n}\n\nexport function useAutomations(scope: JobsScope) {\n return useActionQuery<Automation[]>(\n \"list-automations\",\n automationParams(scope),\n { staleTime: 5_000 },\n );\n}\n\nexport function useManageRecurringJob(scope: JobsScope) {\n const queryClient = useQueryClient();\n const params = recurringParams(scope);\n const queryKey = [\"action\", \"list-recurring-jobs\", params] as const;\n\n return useActionMutation<\n { deleted?: boolean; name: string; enabled?: boolean },\n ManageJobInput\n >(\"manage-recurring-job\", {\n onMutate: async (variables) => {\n await queryClient.cancelQueries({ queryKey });\n const previous = queryClient.getQueryData<RecurringJob[]>(queryKey);\n queryClient.setQueryData<RecurringJob[]>(queryKey, (current) => {\n if (!current) return current;\n if (variables.operation === \"delete\") {\n return current.filter((job) => job.name !== variables.name);\n }\n return current.map((job) =>\n job.name === variables.name && variables.enabled !== undefined\n ? { ...job, enabled: variables.enabled }\n : job,\n );\n });\n return { previous };\n },\n onError: (_error, _variables, context) => {\n const rollback = context as { previous?: RecurringJob[] } | undefined;\n if (rollback && \"previous\" in rollback) {\n queryClient.setQueryData(queryKey, rollback.previous);\n }\n },\n });\n}\n\nexport function useManageAutomation(scope: JobsScope) {\n const queryClient = useQueryClient();\n const params = automationParams(scope);\n const queryKey = [\"action\", \"list-automations\", params] as const;\n\n return useActionMutation<\n { deleted?: boolean; name: string; enabled?: boolean },\n ManageAutomationInput\n >(\"manage-automation\", {\n onMutate: async (variables) => {\n await queryClient.cancelQueries({ queryKey });\n const previous = queryClient.getQueryData<Automation[]>(queryKey);\n queryClient.setQueryData<Automation[]>(queryKey, (current) => {\n if (!current) return current;\n if (variables.operation === \"delete\") {\n return current.filter(\n (automation) => automation.name !== variables.name,\n );\n }\n return current.map((automation) =>\n automation.name === variables.name && variables.enabled !== undefined\n ? { ...automation, enabled: variables.enabled }\n : automation,\n );\n });\n return { previous };\n },\n onError: (_error, _variables, context) => {\n const rollback = context as { previous?: Automation[] } | undefined;\n if (rollback && \"previous\" in rollback) {\n queryClient.setQueryData(queryKey, rollback.previous);\n }\n },\n });\n}\n"]}
1
+ {"version":3,"file":"use-jobs.js","sourceRoot":"","sources":["../../../src/client/agent-page/use-jobs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AAC,QAAQ,CAAC;IAC1E,IAAI,SAAS,CAAC,QAAQ,KAAK,SAAS;QAAE,KAAK,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;IAC1E,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,KAAgB,EAChB,IAAmB,EACnB,MAAe;IAEf,MAAM,MAAM,GAAG;QACb,KAAK,EAAE,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,UAAU;QACpD,IAAI,EAAE,IAAI,IAAI,EAAE;KACR,CAAC;IACX,OAAO,cAAc,CAAkB,sBAAsB,EAAE,MAAM,EAAE;QACrE,SAAS,EAAE,KAAK;QAChB,OAAO,EAAE,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;KACjC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { useQueryClient } from \"@tanstack/react-query\";\n\nimport { useActionMutation, useActionQuery } from \"../use-action.js\";\n\nexport type JobsScope = \"user\" | \"org\";\n\nexport interface RecurringJob {\n id: string;\n name: string;\n path: string;\n scope: \"personal\" | \"organization\";\n schedule: string;\n timezone: string;\n scheduleDescription: string;\n instructions: string;\n enabled: boolean;\n lastRun: string | null;\n lastCheck: string | null;\n lastStatus: string | null;\n lastError: string | null;\n nextRun: string | null;\n createdBy: string | null;\n mcpTools: string[];\n canUpdate: boolean;\n}\n\nexport interface Automation {\n id: string;\n name: string;\n path: string;\n scope: \"personal\" | \"organization\";\n triggerType: \"event\" | \"schedule\";\n event: string | null;\n schedule: string | null;\n timezone: string | null;\n scheduleDescription: string | null;\n condition: string | null;\n body: string;\n enabled: boolean;\n lastRun: string | null;\n lastCheck: string | null;\n lastStatus: string | null;\n lastError: string | null;\n nextRun: string | null;\n createdBy: string | null;\n model: string | null;\n mcpTools: string[];\n originScopeId: string | null;\n deliveryPlatform: string | null;\n deliveryDestination: string | null;\n deliveryThreadRef: string | null;\n deliveryTenantId: string | null;\n canUpdate: boolean;\n}\n\nexport type ManageJobInput = {\n operation: \"update\" | \"delete\";\n name: string;\n scope: \"personal\" | \"organization\";\n enabled?: boolean;\n schedule?: string;\n timezone?: string;\n};\n\nexport type ManageAutomationInput = ManageJobInput;\n\nexport interface AutomationRun {\n id: string;\n automation: string;\n scope: string | null;\n runId: string | null;\n threadId: string | null;\n status: \"running\" | \"success\" | \"error\" | \"interrupted\";\n startedAt: number;\n finishedAt: number | null;\n error: string | null;\n}\n\nfunction recurringParams(scope: JobsScope) {\n return { scope: scope === \"org\" ? \"organization\" : \"personal\" } as const;\n}\n\nfunction automationParams(scope: JobsScope) {\n return { scope: scope === \"org\" ? \"organization\" : \"personal\" } as const;\n}\n\nexport function useRecurringJobs(scope: JobsScope) {\n return useActionQuery<RecurringJob[]>(\n \"list-recurring-jobs\",\n recurringParams(scope),\n { staleTime: 5_000 },\n );\n}\n\nexport function useAutomations(scope: JobsScope) {\n return useActionQuery<Automation[]>(\n \"list-automations\",\n automationParams(scope),\n { staleTime: 5_000 },\n );\n}\n\nexport function useManageRecurringJob(scope: JobsScope) {\n const queryClient = useQueryClient();\n const params = recurringParams(scope);\n const queryKey = [\"action\", \"list-recurring-jobs\", params] as const;\n\n return useActionMutation<\n { deleted?: boolean; name: string; enabled?: boolean },\n ManageJobInput\n >(\"manage-recurring-job\", {\n onMutate: async (variables) => {\n await queryClient.cancelQueries({ queryKey });\n const previous = queryClient.getQueryData<RecurringJob[]>(queryKey);\n queryClient.setQueryData<RecurringJob[]>(queryKey, (current) => {\n if (!current) return current;\n if (variables.operation === \"delete\") {\n return current.filter((job) => job.name !== variables.name);\n }\n return current.map((job) =>\n job.name === variables.name\n ? { ...job, ...optimisticPatch(variables) }\n : job,\n );\n });\n return { previous };\n },\n onError: (_error, _variables, context) => {\n const rollback = context as { previous?: RecurringJob[] } | undefined;\n if (rollback && \"previous\" in rollback) {\n queryClient.setQueryData(queryKey, rollback.previous);\n }\n },\n });\n}\n\nexport function useManageAutomation(scope: JobsScope) {\n const queryClient = useQueryClient();\n const params = automationParams(scope);\n const queryKey = [\"action\", \"list-automations\", params] as const;\n\n return useActionMutation<\n { deleted?: boolean; name: string; enabled?: boolean },\n ManageAutomationInput\n >(\"manage-automation\", {\n onMutate: async (variables) => {\n await queryClient.cancelQueries({ queryKey });\n const previous = queryClient.getQueryData<Automation[]>(queryKey);\n queryClient.setQueryData<Automation[]>(queryKey, (current) => {\n if (!current) return current;\n if (variables.operation === \"delete\") {\n return current.filter(\n (automation) => automation.name !== variables.name,\n );\n }\n return current.map((automation) =>\n automation.name === variables.name\n ? { ...automation, ...optimisticPatch(variables) }\n : automation,\n );\n });\n return { previous };\n },\n onError: (_error, _variables, context) => {\n const rollback = context as { previous?: Automation[] } | undefined;\n if (rollback && \"previous\" in rollback) {\n queryClient.setQueryData(queryKey, rollback.previous);\n }\n },\n });\n}\n\nfunction optimisticPatch(variables: ManageJobInput) {\n const patch: {\n enabled?: boolean;\n schedule?: string;\n timezone?: string;\n } = {};\n if (variables.enabled !== undefined) patch.enabled = variables.enabled;\n if (variables.schedule !== undefined) patch.schedule = variables.schedule;\n if (variables.timezone !== undefined) patch.timezone = variables.timezone;\n return patch;\n}\n\nexport function useAutomationRuns(\n scope: JobsScope,\n name: string | null,\n active: boolean,\n) {\n const params = {\n scope: scope === \"org\" ? \"organization\" : \"personal\",\n name: name || \"\",\n } as const;\n return useActionQuery<AutomationRun[]>(\"list-automation-runs\", params, {\n staleTime: 5_000,\n enabled: active && Boolean(name),\n });\n}\n"]}
@@ -20,6 +20,13 @@ export interface OrgSwitcherProps {
20
20
  settingsPath?: string | null;
21
21
  /** Path to navigate to when the user clicks "Profile". Defaults to the shared Account settings section. */
22
22
  profilePath?: string | null;
23
+ /**
24
+ * Path to the Manage agent page. Settings links here too, but the switcher
25
+ * is the only always-visible surface, so omitting it leaves Files,
26
+ * Instructions, Memory, Skills and Automations reachable only from Settings.
27
+ * Pass `null` for apps that do not mount the Agent page.
28
+ */
29
+ agentPath?: string | null;
23
30
  }
24
31
  /**
25
32
  * Compact org switcher button. Shows the active org (or "Personal" when the
@@ -27,5 +34,5 @@ export interface OrgSwitcherProps {
27
34
  * invitations, inline forms to create a new org / invite a teammate, and a
28
35
  * sign-out item. Renders nothing in dev / no-auth mode.
29
36
  */
30
- export declare function OrgSwitcher({ className, hideWhenSingle, reserveSpace, compact, settingsPath, profilePath, }: OrgSwitcherProps): import("react").JSX.Element | null;
37
+ export declare function OrgSwitcher({ className, hideWhenSingle, reserveSpace, compact, settingsPath, profilePath, agentPath, }: OrgSwitcherProps): import("react").JSX.Element | null;
31
38
  //# sourceMappingURL=OrgSwitcher.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"OrgSwitcher.d.ts","sourceRoot":"","sources":["../../../src/client/org/OrgSwitcher.tsx"],"names":[],"mappings":"AA+DA,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,2GAA2G;IAC3G,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAuND;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,EAC1B,SAAS,EACT,cAAc,EACd,YAAY,EACZ,OAAO,EACP,YAAiD,EACjD,WAAkC,GACnC,EAAE,gBAAgB,sCAyflB"}
1
+ {"version":3,"file":"OrgSwitcher.d.ts","sourceRoot":"","sources":["../../../src/client/org/OrgSwitcher.tsx"],"names":[],"mappings":"AA+DA,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,2GAA2G;IAC3G,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAwND;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,EAC1B,SAAS,EACT,cAAc,EACd,YAAY,EACZ,OAAO,EACP,YAAiD,EACjD,WAAkC,EAClC,SAA8B,GAC/B,EAAE,gBAAgB,sCA0gBlB"}
@@ -30,6 +30,7 @@ const SWITCHER_BUTTON_CLASS = "flex w-full items-center gap-2 rounded-md border-
30
30
  const COMPACT_SWITCHER_BUTTON_CLASS = "flex items-center justify-center rounded-md border-0 bg-accent/50 p-1.5 text-muted-foreground hover:bg-accent/70 hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-60 cursor-pointer";
31
31
  const DEFAULT_ORGANIZATION_SETTINGS_PATH = "/settings#organization";
32
32
  const DEFAULT_PROFILE_PATH = "/settings#account";
33
+ const DEFAULT_AGENT_PATH = "/agent";
33
34
  const APP_ICON_MAP = {
34
35
  Mail: IconMail,
35
36
  CalendarDays: IconCalendar,
@@ -103,7 +104,7 @@ function OrgSwitcherLoadingPlaceholder({ className }) {
103
104
  * invitations, inline forms to create a new org / invite a teammate, and a
104
105
  * sign-out item. Renders nothing in dev / no-auth mode.
105
106
  */
106
- export function OrgSwitcher({ className, hideWhenSingle, reserveSpace, compact, settingsPath = DEFAULT_ORGANIZATION_SETTINGS_PATH, profilePath = DEFAULT_PROFILE_PATH, }) {
107
+ export function OrgSwitcher({ className, hideWhenSingle, reserveSpace, compact, settingsPath = DEFAULT_ORGANIZATION_SETTINGS_PATH, profilePath = DEFAULT_PROFILE_PATH, agentPath = DEFAULT_AGENT_PATH, }) {
107
108
  const { data: org, isLoading } = useOrg();
108
109
  const { session } = useSession();
109
110
  const t = useT();
@@ -212,7 +213,12 @@ export function OrgSwitcher({ className, hideWhenSingle, reserveSpace, compact,
212
213
  })] })), _jsx("div", { className: "my-1 h-px bg-border" }), _jsx(AppsSubmenu, { apps: appLinks.apps, isLoading: appLinks.isLoading, dispatchHref: appLinks.dispatchHref, dispatchAllAppsHref: appLinks.dispatchAllAppsHref, onNavigate: () => setOpen(false) }), profilePath && (_jsxs("button", { type: "button", onClick: () => {
213
214
  setOpen(false);
214
215
  navigate(profilePath);
215
- }, className: `${ITEM_CLASS} cursor-pointer`, children: [_jsx(IconUserCircle, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }), _jsx("span", { className: "flex-1 text-start", children: t("settings.profileMenuItem") })] })), inOrg && (_jsxs("button", { type: "button", onClick: () => {
216
+ }, className: `${ITEM_CLASS} cursor-pointer`, children: [_jsx(IconUserCircle, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }), _jsx("span", { className: "flex-1 text-start", children: t("settings.profileMenuItem") })] })), agentPath && (_jsxs("button", { type: "button", onClick: () => {
217
+ setOpen(false);
218
+ navigate(agentPath);
219
+ }, className: `${ITEM_CLASS} cursor-pointer`, children: [_jsx(IconBrain, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }), _jsx("span", { className: "flex-1 text-start", children: t("settings.manageAgentMenuItem", {
220
+ defaultValue: "Manage agent",
221
+ }) })] })), inOrg && (_jsxs("button", { type: "button", onClick: () => {
216
222
  setOpen(false);
217
223
  if (organizationSettingsHref) {
218
224
  navigate(organizationSettingsHref);