@agent-native/core 0.130.1 → 0.131.2

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 (909) hide show
  1. package/corpus/README.md +2 -2
  2. package/corpus/core/CHANGELOG.md +57 -0
  3. package/corpus/core/docs/content/agent-surfaces.mdx +4 -4
  4. package/corpus/core/docs/content/automations.mdx +61 -12
  5. package/corpus/core/docs/content/deployment.mdx +11 -4
  6. package/corpus/core/docs/content/extensions.mdx +39 -33
  7. package/corpus/core/docs/content/recurring-jobs.mdx +41 -19
  8. package/corpus/core/docs/content/template-dispatch-operations.mdx +19 -7
  9. package/corpus/core/package.json +3 -1
  10. package/corpus/core/src/action.ts +55 -0
  11. package/corpus/core/src/agent/engine/builder-engine.ts +8 -4
  12. package/corpus/core/src/agent/production-agent.ts +175 -100
  13. package/corpus/core/src/agent/tool-search.ts +36 -0
  14. package/corpus/core/src/automations/service.ts +506 -0
  15. package/corpus/core/src/browser-context/index.ts +392 -0
  16. package/corpus/core/src/client/AgentPanel.tsx +2 -1
  17. package/corpus/core/src/client/FeedbackButton.tsx +37 -4
  18. package/corpus/core/src/client/MultiTabAssistantChat.tsx +21 -0
  19. package/corpus/core/src/client/agent-chat.ts +31 -3
  20. package/corpus/core/src/client/agent-page/AgentJobsTab.tsx +438 -310
  21. package/corpus/core/src/client/agent-page/AgentTabsPage.tsx +4 -4
  22. package/corpus/core/src/client/agent-page/use-jobs.ts +7 -0
  23. package/corpus/core/src/client/analytics-session.ts +13 -0
  24. package/corpus/core/src/client/extensions/ExtensionViewer.tsx +67 -0
  25. package/corpus/core/src/client/settings/AutomationsSection.tsx +27 -499
  26. package/corpus/core/src/client/settings/SettingsPanel.tsx +32 -11
  27. package/corpus/core/src/client/settings/index.ts +2 -0
  28. package/corpus/core/src/client/use-agent-chat.ts +35 -3
  29. package/corpus/core/src/client/use-chat-threads.ts +8 -25
  30. package/corpus/core/src/deploy/build.ts +2 -0
  31. package/corpus/core/src/deploy/workspace-deploy.ts +2 -0
  32. package/corpus/core/src/extensions/actions.ts +115 -3
  33. package/corpus/core/src/extensions/fetch-tool.ts +11 -0
  34. package/corpus/core/src/extensions/routes.ts +16 -1
  35. package/corpus/core/src/extensions/web-content.ts +96 -1
  36. package/corpus/core/src/integrations/computer-supervision.ts +33 -1
  37. package/corpus/core/src/integrations/index.ts +6 -0
  38. package/corpus/core/src/integrations/integration-durable-dispatch-config.ts +10 -0
  39. package/corpus/core/src/integrations/integration-durable-dispatch.ts +4 -0
  40. package/corpus/core/src/integrations/plugin.ts +94 -41
  41. package/corpus/core/src/integrations/remote-browser-actions.ts +621 -0
  42. package/corpus/core/src/jobs/actions/list-recurring-jobs.ts +5 -7
  43. package/corpus/core/src/jobs/actions/manage-recurring-job.ts +3 -7
  44. package/corpus/core/src/jobs/background-automation-runner.ts +437 -0
  45. package/corpus/core/src/jobs/frontmatter.ts +308 -0
  46. package/corpus/core/src/jobs/scheduler.ts +89 -598
  47. package/corpus/core/src/jobs/tools.ts +22 -3
  48. package/corpus/core/src/localization/default-messages.ts +45 -45
  49. package/corpus/core/src/mcp-client/index.ts +6 -0
  50. package/corpus/core/src/notifications/actions.ts +5 -0
  51. package/corpus/core/src/progress/actions.ts +5 -0
  52. package/corpus/core/src/provider-api/actions/github-repo-files.ts +11 -0
  53. package/corpus/core/src/provider-api/actions/provider-api.ts +13 -0
  54. package/corpus/core/src/server/action-discovery.ts +7 -0
  55. package/corpus/core/src/server/agent-chat/browser-team-tools.ts +126 -3
  56. package/corpus/core/src/server/agent-chat/framework-prompts.ts +7 -11
  57. package/corpus/core/src/server/agent-chat/plugin-options.ts +3 -3
  58. package/corpus/core/src/server/agent-chat/script-entries.ts +52 -1
  59. package/corpus/core/src/server/agent-chat-plugin.ts +25 -5
  60. package/corpus/core/src/server/attribution.ts +22 -0
  61. package/corpus/core/src/server/auth.ts +20 -6
  62. package/corpus/core/src/server/better-auth-instance.ts +10 -2
  63. package/corpus/core/src/server/core-routes-plugin.ts +10 -1
  64. package/corpus/core/src/server/csrf.ts +25 -0
  65. package/corpus/core/src/server/email-template.ts +43 -13
  66. package/corpus/core/src/server/google-oauth.ts +21 -1
  67. package/corpus/core/src/server/onboarding-html.ts +18 -0
  68. package/corpus/core/src/server/prompts/framework-core-compact.ts +3 -3
  69. package/corpus/core/src/server/prompts/framework-core.ts +3 -3
  70. package/corpus/core/src/server/prompts/shared-rules.ts +3 -3
  71. package/corpus/core/src/settings/index.ts +1 -0
  72. package/corpus/core/src/shared/analytics-anonymous-id.ts +35 -0
  73. package/corpus/core/src/sharing/actions/share-resource.ts +26 -4
  74. package/corpus/core/src/sharing/index.ts +1 -0
  75. package/corpus/core/src/sharing/registry.ts +23 -0
  76. package/corpus/core/src/templates/default/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  77. package/corpus/core/src/templates/default/app/i18n/ar-SA.ts +26 -0
  78. package/corpus/core/src/templates/default/app/i18n/de-DE.ts +28 -0
  79. package/corpus/core/src/templates/default/app/i18n/en-US.ts +27 -0
  80. package/corpus/core/src/templates/default/app/i18n/es-ES.ts +28 -0
  81. package/corpus/core/src/templates/default/app/i18n/fr-FR.ts +28 -0
  82. package/corpus/core/src/templates/default/app/i18n/hi-IN.ts +25 -0
  83. package/corpus/core/src/templates/default/app/i18n/ja-JP.ts +27 -0
  84. package/corpus/core/src/templates/default/app/i18n/ko-KR.ts +27 -0
  85. package/corpus/core/src/templates/default/app/i18n/pt-BR.ts +27 -0
  86. package/corpus/core/src/templates/default/app/i18n/zh-CN.ts +24 -0
  87. package/corpus/core/src/templates/default/app/i18n/zh-TW.ts +24 -0
  88. package/corpus/core/src/templates/headless/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  89. package/corpus/core/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  90. package/corpus/core/src/templates/workspace-core/.agents/skills/agent-page/SKILL.md +10 -7
  91. package/corpus/core/src/templates/workspace-core/.agents/skills/automations/SKILL.md +53 -8
  92. package/corpus/core/src/templates/workspace-core/.agents/skills/browser-sessions/SKILL.md +131 -0
  93. package/corpus/core/src/templates/workspace-core/.agents/skills/extension-points/SKILL.md +13 -4
  94. package/corpus/core/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +23 -15
  95. package/corpus/core/src/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +33 -18
  96. package/corpus/core/src/tracking/providers.ts +1 -0
  97. package/corpus/core/src/tracking/registry.ts +2 -1
  98. package/corpus/core/src/tracking/types.ts +1 -0
  99. package/corpus/core/src/triggers/actions/list-automations.ts +43 -44
  100. package/corpus/core/src/triggers/actions/manage-automation.ts +17 -48
  101. package/corpus/core/src/triggers/actions.ts +218 -127
  102. package/corpus/core/src/triggers/dispatcher.ts +181 -367
  103. package/corpus/core/src/triggers/routes.ts +84 -27
  104. package/corpus/core/src/triggers/types.ts +9 -23
  105. package/corpus/templates/analytics/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  106. package/corpus/templates/analytics/actions/install-dashboard-template.ts +13 -4
  107. package/corpus/templates/analytics/actions/rename-dashboard.ts +8 -3
  108. package/corpus/templates/analytics/actions/restore-dashboard-revision.ts +8 -3
  109. package/corpus/templates/analytics/actions/update-dashboard.ts +22 -5
  110. package/corpus/templates/analytics/app/components/dashboard/DashboardPanelSkeleton.tsx +7 -1
  111. package/corpus/templates/analytics/app/components/layout/CommandPalette.tsx +1 -82
  112. package/corpus/templates/analytics/app/components/layout/NewDashboardDialog.tsx +4 -4
  113. package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +23 -13
  114. package/corpus/templates/analytics/app/global.css +21 -0
  115. package/corpus/templates/analytics/app/i18n-data.ts +165 -101
  116. package/corpus/templates/analytics/app/lib/custom-block-promotion.ts +62 -0
  117. package/corpus/templates/analytics/app/pages/adhoc/explorer-dashboard/index.tsx +17 -2
  118. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/PanelEditorDialog.tsx +3 -1
  119. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/SqlChartCard.tsx +77 -12
  120. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/dashboard-save-queue.ts +34 -0
  121. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/index.tsx +42 -26
  122. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/types.ts +15 -0
  123. package/corpus/templates/analytics/app/pages/analyses/AnalysisDetail.tsx +1 -1
  124. package/corpus/templates/analytics/changelog/2026-07-29-chat-history-now-closes-smoothly-and-stays-ready-when-you-re.md +6 -0
  125. package/corpus/templates/analytics/changelog/2026-07-29-chat-history-stays-visible-when-you-return-to-the-dashboard.md +6 -0
  126. package/corpus/templates/analytics/changelog/2026-07-29-custom-dashboard-blocks-now-identify-one-off-agent-patches-a.md +6 -0
  127. package/corpus/templates/analytics/changelog/2026-07-29-dashboard-chart-deletions-now-save-in-order-so-removed-rows-.md +6 -0
  128. package/corpus/templates/analytics/changelog/2026-07-29-dashboard-chart-loaders-are-easier-to-see-and-animate-more-s.md +6 -0
  129. package/corpus/templates/analytics/changelog/2026-07-29-plan-mode-can-now-query-connected-analytics-sources-while-ke.md +6 -0
  130. package/corpus/templates/analytics/changelog/2026-07-29-plan-mode-can-use-clips-as-read-only-prompt-context.md +6 -0
  131. package/corpus/templates/analytics/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
  132. package/corpus/templates/analytics/changelog/2026-07-29-signup-entry-pages-now-show-the-first-page-viewed-before-eac.md +6 -0
  133. package/corpus/templates/analytics/seeds/dashboards/agent-native-templates-first-party.json +26 -1
  134. package/corpus/templates/analytics/server/lib/agent-chat-plan-mode.ts +0 -33
  135. package/corpus/templates/analytics/server/lib/canonical-first-party-dashboard-repair.ts +13 -3
  136. package/corpus/templates/analytics/server/lib/dashboard-catalog.ts +9 -1
  137. package/corpus/templates/analytics/server/lib/first-party-analytics.ts +44 -1
  138. package/corpus/templates/analytics/server/lib/first-party-metric-catalog.ts +96 -16
  139. package/corpus/templates/analytics/server/plugins/agent-chat.ts +18 -27
  140. package/corpus/templates/analytics/server/plugins/core-routes.ts +1 -0
  141. package/corpus/templates/assets/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  142. package/corpus/templates/assets/app/components/layout/Sidebar.tsx +4 -8
  143. package/corpus/templates/assets/changelog/2026-07-29-chat-history-now-closes-smoothly-and-stays-ready-when-you-re.md +6 -0
  144. package/corpus/templates/assets/changelog/2026-07-29-chat-history-stays-visible-when-you-return-to-the-workspace.md +6 -0
  145. package/corpus/templates/assets/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
  146. package/corpus/templates/brain/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  147. package/corpus/templates/brain/app/components/layout/Sidebar.tsx +3 -7
  148. package/corpus/templates/brain/app/root.tsx +0 -3
  149. package/corpus/templates/brain/changelog/2026-07-29-chat-history-now-closes-smoothly-and-stays-ready-when-you-re.md +6 -0
  150. package/corpus/templates/brain/changelog/2026-07-29-chat-history-stays-visible-when-you-return-to-ask-brain.md +6 -0
  151. package/corpus/templates/brain/changelog/2026-07-29-extensions-are-no-longer-shown-as-a-default-command-menu-des.md +6 -0
  152. package/corpus/templates/brain/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
  153. package/corpus/templates/calendar/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  154. package/corpus/templates/calendar/.agents/skills/event-management/SKILL.md +25 -5
  155. package/corpus/templates/calendar/AGENTS.md +5 -0
  156. package/corpus/templates/calendar/actions/create-event.ts +43 -13
  157. package/corpus/templates/calendar/actions/event-action-helpers.ts +131 -1
  158. package/corpus/templates/calendar/actions/manage-event-draft.ts +65 -2
  159. package/corpus/templates/calendar/app/components/calendar/CreateEventDialog.tsx +437 -258
  160. package/corpus/templates/calendar/app/components/calendar/DayView.tsx +19 -3
  161. package/corpus/templates/calendar/app/components/calendar/MonthView.tsx +24 -0
  162. package/corpus/templates/calendar/app/components/calendar/WeekView.tsx +15 -2
  163. package/corpus/templates/calendar/app/components/layout/Sidebar.tsx +1 -5
  164. package/corpus/templates/calendar/app/hooks/use-events.ts +44 -5
  165. package/corpus/templates/calendar/app/i18n-data.ts +50 -0
  166. package/corpus/templates/calendar/app/lib/all-day-layout.ts +9 -2
  167. package/corpus/templates/calendar/app/lib/event-form-initialization.ts +4 -8
  168. package/corpus/templates/calendar/app/lib/event-form-utils.ts +30 -8
  169. package/corpus/templates/calendar/app/lib/location-suggestions.ts +36 -0
  170. package/corpus/templates/calendar/app/lib/out-of-office.ts +87 -1
  171. package/corpus/templates/calendar/app/pages/CalendarView.tsx +68 -13
  172. package/corpus/templates/calendar/changelog/2026-07-26-out-of-office-events-now-default-to-full-days-with-a-ready.md +6 -0
  173. package/corpus/templates/calendar/changelog/2026-07-29-recent-calendar-locations-now-appear-as-address-suggestions-.md +6 -0
  174. package/corpus/templates/calendar/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
  175. package/corpus/templates/calendar/server/lib/find-time.ts +29 -5
  176. package/corpus/templates/calendar/shared/api.ts +2 -0
  177. package/corpus/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  178. package/corpus/templates/chat/app/components/layout/Sidebar.tsx +1 -5
  179. package/corpus/templates/chat/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
  180. package/corpus/templates/clips/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  181. package/corpus/templates/clips/app/components/editor/editor-toolbar.tsx +3 -1
  182. package/corpus/templates/clips/app/components/library/library-layout.tsx +2 -6
  183. package/corpus/templates/clips/app/components/meetings/day-header.tsx +1 -1
  184. package/corpus/templates/clips/app/components/meetings/transcript-bubbles.tsx +1 -22
  185. package/corpus/templates/clips/app/components/workspace/branding-editor.tsx +26 -1
  186. package/corpus/templates/clips/app/components/workspace/organization-identity-card.tsx +107 -0
  187. package/corpus/templates/clips/app/i18n/en-US.ts +3 -4
  188. package/corpus/templates/clips/app/routes/_app.meetings.$meetingId.tsx +0 -10
  189. package/corpus/templates/clips/app/routes/_app.settings._index.tsx +23 -51
  190. package/corpus/templates/clips/app/routes/share.meeting.$meetingId.tsx +1 -8
  191. package/corpus/templates/clips/changelog/2026-07-29-clearing-all-recording-edits-no-longer-leaves-the-editor-unr.md +6 -0
  192. package/corpus/templates/clips/changelog/2026-07-29-clip-share-emails-now-open-with-who-shared-the-clip-add-a-su.md +6 -0
  193. package/corpus/templates/clips/changelog/2026-07-29-finished-meeting-pills-now-have-a-clear-close-button.md +6 -0
  194. package/corpus/templates/clips/changelog/2026-07-29-fixed-system-audio-recordings-picking-up-your-microphone-in-.md +6 -0
  195. package/corpus/templates/clips/changelog/2026-07-29-meeting-cards-no-longer-flicker-or-disappear-when-hovered-in.md +6 -0
  196. package/corpus/templates/clips/changelog/2026-07-29-organization-name-logo-brand-color-and-default-visibility-no.md +6 -0
  197. package/corpus/templates/clips/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
  198. package/corpus/templates/clips/changelog/2026-07-29-the-desktop-camera-preview-now-closes-after-a-recording-fin.md +6 -0
  199. package/corpus/templates/clips/changelog/2026-07-29-transcript-lines-on-the-meeting-page-no-longer-jump-to-the-r.md +6 -0
  200. package/corpus/templates/clips/changelog/2026-07-29-when-a-meeting-wraps-up-the-recording-pill-now-shows-a-green.md +6 -0
  201. package/corpus/templates/clips/desktop/src/app.tsx +14 -15
  202. package/corpus/templates/clips/desktop/src/hooks/useMeetingTranscription.ts +6 -3
  203. package/corpus/templates/clips/desktop/src/lib/bubble-session.ts +11 -0
  204. package/corpus/templates/clips/desktop/src/lib/recorder.ts +9 -4
  205. package/corpus/templates/clips/desktop/src/lib/transcription-capture.ts +11 -0
  206. package/corpus/templates/clips/desktop/src/overlays/recording-pill.tsx +112 -32
  207. package/corpus/templates/clips/desktop/src/styles.css +42 -2
  208. package/corpus/templates/clips/server/db/index.ts +6 -0
  209. package/corpus/templates/clips/server/jobs/transactional-emails.ts +47 -23
  210. package/corpus/templates/clips/server/lib/share-email-hero.ts +33 -0
  211. package/corpus/templates/clips/server/lib/transactional-email-store.ts +16 -6
  212. package/corpus/templates/clips/shared/clips-ai-prefs.ts +0 -1
  213. package/corpus/templates/content/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  214. package/corpus/templates/content/.agents/skills/content-product-development/SKILL.md +103 -0
  215. package/corpus/templates/content/.agents/skills/content-product-development/references/verification.md +57 -0
  216. package/corpus/templates/content/AGENTS.md +2 -0
  217. package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +1 -6
  218. package/corpus/templates/content/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
  219. package/corpus/templates/content/docs/product/README.md +115 -0
  220. package/corpus/templates/content/docs/product/architecture.md +98 -0
  221. package/corpus/templates/content/docs/product/capabilities/content.access.page-database.md +76 -0
  222. package/corpus/templates/content/docs/product/capabilities/content.access.row-private.md +75 -0
  223. package/corpus/templates/content/docs/product/capabilities/content.access.safe-aggregate.md +75 -0
  224. package/corpus/templates/content/docs/product/capabilities/content.access.visibility-closure.md +79 -0
  225. package/corpus/templates/content/docs/product/capabilities/content.action.button.md +67 -0
  226. package/corpus/templates/content/docs/product/capabilities/content.agent.action-parity.md +73 -0
  227. package/corpus/templates/content/docs/product/capabilities/content.agent.audience-safe.md +91 -0
  228. package/corpus/templates/content/docs/product/capabilities/content.agent.automation.md +67 -0
  229. package/corpus/templates/content/docs/product/capabilities/content.agent.expression-authoring.md +71 -0
  230. package/corpus/templates/content/docs/product/capabilities/content.agent.presence.md +103 -0
  231. package/corpus/templates/content/docs/product/capabilities/content.agent.resource-consent.md +90 -0
  232. package/corpus/templates/content/docs/product/capabilities/content.agent.skill-catalog.md +67 -0
  233. package/corpus/templates/content/docs/product/capabilities/content.api.cms.md +70 -0
  234. package/corpus/templates/content/docs/product/capabilities/content.author.code.md +71 -0
  235. package/corpus/templates/content/docs/product/capabilities/content.author.document-editor.md +71 -0
  236. package/corpus/templates/content/docs/product/capabilities/content.author.footnotes.md +71 -0
  237. package/corpus/templates/content/docs/product/capabilities/content.author.math.md +71 -0
  238. package/corpus/templates/content/docs/product/capabilities/content.author.media.md +71 -0
  239. package/corpus/templates/content/docs/product/capabilities/content.author.mermaid.md +71 -0
  240. package/corpus/templates/content/docs/product/capabilities/content.automation.scheduled.md +67 -0
  241. package/corpus/templates/content/docs/product/capabilities/content.capture.enrich.md +75 -0
  242. package/corpus/templates/content/docs/product/capabilities/content.command.fabric.md +67 -0
  243. package/corpus/templates/content/docs/product/capabilities/content.comment.page-owned.md +75 -0
  244. package/corpus/templates/content/docs/product/capabilities/content.diff.ai-assist.md +75 -0
  245. package/corpus/templates/content/docs/product/capabilities/content.diff.filtered-review.md +79 -0
  246. package/corpus/templates/content/docs/product/capabilities/content.diff.in-place.md +80 -0
  247. package/corpus/templates/content/docs/product/capabilities/content.discussion.page.md +80 -0
  248. package/corpus/templates/content/docs/product/capabilities/content.embed.host-grant.md +70 -0
  249. package/corpus/templates/content/docs/product/capabilities/content.embed.mcp-app.md +69 -0
  250. package/corpus/templates/content/docs/product/capabilities/content.embed.surface.md +74 -0
  251. package/corpus/templates/content/docs/product/capabilities/content.event.committed.md +85 -0
  252. package/corpus/templates/content/docs/product/capabilities/content.expression.cached-result.md +71 -0
  253. package/corpus/templates/content/docs/product/capabilities/content.expression.catalog.md +71 -0
  254. package/corpus/templates/content/docs/product/capabilities/content.expression.language.md +76 -0
  255. package/corpus/templates/content/docs/product/capabilities/content.feedback.signal.md +67 -0
  256. package/corpus/templates/content/docs/product/capabilities/content.form.shared-engine.md +72 -0
  257. package/corpus/templates/content/docs/product/capabilities/content.history.queryable.md +79 -0
  258. package/corpus/templates/content/docs/product/capabilities/content.home.global.md +80 -0
  259. package/corpus/templates/content/docs/product/capabilities/content.job.durable.md +76 -0
  260. package/corpus/templates/content/docs/product/capabilities/content.knowledge.graph.md +67 -0
  261. package/corpus/templates/content/docs/product/capabilities/content.knowledge.links.md +67 -0
  262. package/corpus/templates/content/docs/product/capabilities/content.knowledge.search.md +67 -0
  263. package/corpus/templates/content/docs/product/capabilities/content.layout.responsive.md +80 -0
  264. package/corpus/templates/content/docs/product/capabilities/content.navigation.sidebar.md +86 -0
  265. package/corpus/templates/content/docs/product/capabilities/content.notification.source.md +71 -0
  266. package/corpus/templates/content/docs/product/capabilities/content.object.block.md +76 -0
  267. package/corpus/templates/content/docs/product/capabilities/content.object.blocks-field.md +79 -0
  268. package/corpus/templates/content/docs/product/capabilities/content.object.database.md +92 -0
  269. package/corpus/templates/content/docs/product/capabilities/content.object.multi-membership.md +75 -0
  270. package/corpus/templates/content/docs/product/capabilities/content.object.page.md +76 -0
  271. package/corpus/templates/content/docs/product/capabilities/content.object.reference.md +75 -0
  272. package/corpus/templates/content/docs/product/capabilities/content.object.transclusion.md +75 -0
  273. package/corpus/templates/content/docs/product/capabilities/content.organization.teams.md +71 -0
  274. package/corpus/templates/content/docs/product/capabilities/content.portability.pdf-export.md +78 -0
  275. package/corpus/templates/content/docs/product/capabilities/content.portability.roundtrip.md +154 -0
  276. package/corpus/templates/content/docs/product/capabilities/content.portability.source-representation.md +70 -0
  277. package/corpus/templates/content/docs/product/capabilities/content.portability.vault-export.md +80 -0
  278. package/corpus/templates/content/docs/product/capabilities/content.presentation.mode.md +76 -0
  279. package/corpus/templates/content/docs/product/capabilities/content.preset.catalog.md +71 -0
  280. package/corpus/templates/content/docs/product/capabilities/content.property.actor.md +75 -0
  281. package/corpus/templates/content/docs/product/capabilities/content.property.catalog.md +76 -0
  282. package/corpus/templates/content/docs/product/capabilities/content.property.constraints.md +75 -0
  283. package/corpus/templates/content/docs/product/capabilities/content.property.guarded-change.md +76 -0
  284. package/corpus/templates/content/docs/product/capabilities/content.property.location.md +71 -0
  285. package/corpus/templates/content/docs/product/capabilities/content.property.typed.md +71 -0
  286. package/corpus/templates/content/docs/product/capabilities/content.publish.public.md +75 -0
  287. package/corpus/templates/content/docs/product/capabilities/content.publish.reading.md +74 -0
  288. package/corpus/templates/content/docs/product/capabilities/content.query.object.md +114 -0
  289. package/corpus/templates/content/docs/product/capabilities/content.reader.documents.md +69 -0
  290. package/corpus/templates/content/docs/product/capabilities/content.reader.surface.md +75 -0
  291. package/corpus/templates/content/docs/product/capabilities/content.relationship.edge.md +183 -0
  292. package/corpus/templates/content/docs/product/capabilities/content.renderer.artifact-block.md +71 -0
  293. package/corpus/templates/content/docs/product/capabilities/content.renderer.custom-block.md +81 -0
  294. package/corpus/templates/content/docs/product/capabilities/content.renderer.graph.md +71 -0
  295. package/corpus/templates/content/docs/product/capabilities/content.renderer.typed.md +92 -0
  296. package/corpus/templates/content/docs/product/capabilities/content.research.annotation.md +75 -0
  297. package/corpus/templates/content/docs/product/capabilities/content.research.citation.md +70 -0
  298. package/corpus/templates/content/docs/product/capabilities/content.review.code.md +67 -0
  299. package/corpus/templates/content/docs/product/capabilities/content.revision.suggestions.md +76 -0
  300. package/corpus/templates/content/docs/product/capabilities/content.rule.deterministic.md +79 -0
  301. package/corpus/templates/content/docs/product/capabilities/content.schedule.constraints.md +81 -0
  302. package/corpus/templates/content/docs/product/capabilities/content.security.private-vault.md +71 -0
  303. package/corpus/templates/content/docs/product/capabilities/content.share.views.md +140 -0
  304. package/corpus/templates/content/docs/product/capabilities/content.source.adapters.md +154 -0
  305. package/corpus/templates/content/docs/product/capabilities/content.source.builder-codec.md +70 -0
  306. package/corpus/templates/content/docs/product/capabilities/content.source.catalog.md +149 -0
  307. package/corpus/templates/content/docs/product/capabilities/content.source.file-folder.md +71 -0
  308. package/corpus/templates/content/docs/product/capabilities/content.source.local-bridge.md +156 -0
  309. package/corpus/templates/content/docs/product/capabilities/content.source.local-project.md +70 -0
  310. package/corpus/templates/content/docs/product/capabilities/content.source.page-link.md +70 -0
  311. package/corpus/templates/content/docs/product/capabilities/content.source.row-union.md +69 -0
  312. package/corpus/templates/content/docs/product/capabilities/content.source.spaces-files.md +75 -0
  313. package/corpus/templates/content/docs/product/capabilities/content.source.sync-policy.md +161 -0
  314. package/corpus/templates/content/docs/product/capabilities/content.system.dependencies.md +80 -0
  315. package/corpus/templates/content/docs/product/capabilities/content.system.my-tasks.md +75 -0
  316. package/corpus/templates/content/docs/product/capabilities/content.system.project-status.md +77 -0
  317. package/corpus/templates/content/docs/product/capabilities/content.system.research-workspace.md +80 -0
  318. package/corpus/templates/content/docs/product/capabilities/content.system.task-project.md +76 -0
  319. package/corpus/templates/content/docs/product/capabilities/content.template.governance.md +76 -0
  320. package/corpus/templates/content/docs/product/capabilities/content.template.graph.md +76 -0
  321. package/corpus/templates/content/docs/product/capabilities/content.template.item-body.md +71 -0
  322. package/corpus/templates/content/docs/product/capabilities/content.template.update.md +71 -0
  323. package/corpus/templates/content/docs/product/capabilities/content.time.types.md +85 -0
  324. package/corpus/templates/content/docs/product/capabilities/content.version.branching.md +151 -0
  325. package/corpus/templates/content/docs/product/capabilities/content.version.field-history.md +103 -0
  326. package/corpus/templates/content/docs/product/capabilities/content.view.canvas.md +94 -0
  327. package/corpus/templates/content/docs/product/capabilities/content.view.chart.md +91 -0
  328. package/corpus/templates/content/docs/product/capabilities/content.view.dynamic-create.md +137 -0
  329. package/corpus/templates/content/docs/product/capabilities/content.view.fast-capture.md +82 -0
  330. package/corpus/templates/content/docs/product/capabilities/content.view.graph.md +95 -0
  331. package/corpus/templates/content/docs/product/capabilities/content.view.grouping-aggregation.md +83 -0
  332. package/corpus/templates/content/docs/product/capabilities/content.view.map.md +77 -0
  333. package/corpus/templates/content/docs/product/capabilities/content.view.personal-state.md +99 -0
  334. package/corpus/templates/content/docs/product/capabilities/content.view.pivot.md +76 -0
  335. package/corpus/templates/content/docs/product/capabilities/content.view.query.md +106 -0
  336. package/corpus/templates/content/docs/product/capabilities/content.view.renderer-conformance.md +77 -0
  337. package/corpus/templates/content/docs/product/capabilities/content.view.scale.md +77 -0
  338. package/corpus/templates/content/docs/product/capabilities/content.view.source-query.md +159 -0
  339. package/corpus/templates/content/docs/product/capabilities/content.view.timeline.md +86 -0
  340. package/corpus/templates/content/docs/product/capabilities/content.view.tree.md +77 -0
  341. package/corpus/templates/content/docs/product/capabilities/content.workspace.multi-scope.md +80 -0
  342. package/corpus/templates/content/docs/product/capabilities/content.workspace.session-restore.md +76 -0
  343. package/corpus/templates/content/docs/product/capabilities/content.workspace.view-instance.md +76 -0
  344. package/corpus/templates/content/docs/product/capabilities/content.workspace.working-set.md +77 -0
  345. package/corpus/templates/content/docs/product/chapters/content.chapter.capture-research.md +20 -0
  346. package/corpus/templates/content/docs/product/chapters/content.chapter.connected-sources.md +20 -0
  347. package/corpus/templates/content/docs/product/chapters/content.chapter.consensus.md +19 -0
  348. package/corpus/templates/content/docs/product/chapters/content.chapter.durable-home.md +21 -0
  349. package/corpus/templates/content/docs/product/chapters/content.chapter.publishing-portability.md +21 -0
  350. package/corpus/templates/content/docs/product/chapters/content.chapter.working-systems.md +27 -0
  351. package/corpus/templates/content/docs/product/encyclopedia.md +559 -0
  352. package/corpus/templates/content/docs/product/features/content.feature.bring-your-local-work.md +39 -0
  353. package/corpus/templates/content/docs/product/features/content.feature.build-living-dashboards.md +34 -0
  354. package/corpus/templates/content/docs/product/features/content.feature.build-new-surfaces.md +33 -0
  355. package/corpus/templates/content/docs/product/features/content.feature.capture-into-action.md +34 -0
  356. package/corpus/templates/content/docs/product/features/content.feature.cite-what-you-found.md +34 -0
  357. package/corpus/templates/content/docs/product/features/content.feature.collaborate-in-context.md +59 -0
  358. package/corpus/templates/content/docs/product/features/content.feature.collect-structured-input.md +38 -0
  359. package/corpus/templates/content/docs/product/features/content.feature.connect-your-sources.md +38 -0
  360. package/corpus/templates/content/docs/product/features/content.feature.data-that-keeps-itself-right.md +45 -0
  361. package/corpus/templates/content/docs/product/features/content.feature.durable-foundations.md +48 -0
  362. package/corpus/templates/content/docs/product/features/content.feature.evolve-systems-safely.md +38 -0
  363. package/corpus/templates/content/docs/product/features/content.feature.explore-alternatives-safely.md +39 -0
  364. package/corpus/templates/content/docs/product/features/content.feature.find-your-place-again.md +40 -0
  365. package/corpus/templates/content/docs/product/features/content.feature.keep-your-private-vault-private.md +39 -0
  366. package/corpus/templates/content/docs/product/features/content.feature.living-references.md +38 -0
  367. package/corpus/templates/content/docs/product/features/content.feature.make-the-workspace-yours.md +40 -0
  368. package/corpus/templates/content/docs/product/features/content.feature.move-without-starting-over.md +38 -0
  369. package/corpus/templates/content/docs/product/features/content.feature.plan-work-across-time.md +39 -0
  370. package/corpus/templates/content/docs/product/features/content.feature.publish-with-confidence.md +43 -0
  371. package/corpus/templates/content/docs/product/features/content.feature.put-your-organizations-know-how-to-work.md +38 -0
  372. package/corpus/templates/content/docs/product/features/content.feature.read-and-annotate-anything.md +38 -0
  373. package/corpus/templates/content/docs/product/features/content.feature.review-changes-in-place.md +39 -0
  374. package/corpus/templates/content/docs/product/features/content.feature.run-projects-your-way.md +44 -0
  375. package/corpus/templates/content/docs/product/features/content.feature.see-your-information-your-way.md +44 -0
  376. package/corpus/templates/content/docs/product/features/content.feature.share-how-your-organization-works.md +38 -0
  377. package/corpus/templates/content/docs/product/features/content.feature.sketch-connections-keep-whats-true.md +39 -0
  378. package/corpus/templates/content/docs/product/features/content.feature.take-the-whole-vault-with-you.md +39 -0
  379. package/corpus/templates/content/docs/product/features/content.feature.trust-your-connected-sources.md +40 -0
  380. package/corpus/templates/content/docs/product/features/content.feature.understand-what-your-data-says.md +39 -0
  381. package/corpus/templates/content/docs/product/features/content.feature.when-this-happens-that-follows.md +43 -0
  382. package/corpus/templates/content/docs/product/features/content.feature.work-across-every-workspace.md +37 -0
  383. package/corpus/templates/content/docs/product/features/content.feature.work-on-content-inside-another-application.md +37 -0
  384. package/corpus/templates/content/docs/product/roadmap.md +878 -0
  385. package/corpus/templates/crm/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  386. package/corpus/templates/crm/app/components/layout/CrmSidebar.tsx +1 -7
  387. package/corpus/templates/crm/app/i18n/en-US.ts +4 -0
  388. package/corpus/templates/crm/app/routes/settings.tsx +33 -8
  389. package/corpus/templates/crm/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
  390. package/corpus/templates/design/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  391. package/corpus/templates/design/.generated/bridge/editor-chrome.generated.ts +133 -63
  392. package/corpus/templates/design/.generated/bridge/embedded-wheel.generated.ts +19 -2
  393. package/corpus/templates/design/app/components/design/DesignCanvas.tsx +51 -14
  394. package/corpus/templates/design/app/components/design/DesignExtensionsPanel.tsx +41 -26
  395. package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +22 -4
  396. package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +216 -116
  397. package/corpus/templates/design/app/components/design/bridge/embedded-wheel.bridge.ts +21 -2
  398. package/corpus/templates/design/app/components/design/code-workbench/CodeWorkbench.tsx +5 -1
  399. package/corpus/templates/design/app/components/design/code-workbench/CodeWorkbenchLoader.tsx +10 -2
  400. package/corpus/templates/design/app/components/design/code-workbench/code-workbench-shell.ts +2 -0
  401. package/corpus/templates/design/app/components/design/code-workbench/explorer/ExplorerView.tsx +60 -55
  402. package/corpus/templates/design/app/components/design/design-canvas/content-size-report.ts +88 -2
  403. package/corpus/templates/design/app/components/design/multi-screen/board-surface-html.ts +3 -2
  404. package/corpus/templates/design/app/components/design/types.ts +4 -0
  405. package/corpus/templates/design/app/components/layout/Sidebar.tsx +1 -5
  406. package/corpus/templates/design/app/pages/design-editor/clipboard-layer-source.ts +28 -0
  407. package/corpus/templates/design/app/pages/design-editor/clone-and-pen-edit.ts +117 -0
  408. package/corpus/templates/design/app/pages/design-editor/code-layer-state.ts +3 -1
  409. package/corpus/templates/design/app/pages/design-editor/pending-edits.ts +120 -74
  410. package/corpus/templates/design/app/pages/design-editor/pending-structure-verification.ts +11 -0
  411. package/corpus/templates/design/app/pages/design-editor/react-semantic-handoff.ts +2 -0
  412. package/corpus/templates/design/app/pages/design-editor/source-location.ts +1 -1
  413. package/corpus/templates/design/changelog/2026-07-29-copy-rendered-ui-between-live-local-apps-and-design-files-wh.md +6 -0
  414. package/corpus/templates/design/changelog/2026-07-29-design-boards-stay-dark-and-viewport-height-content-keeps-it.md +6 -0
  415. package/corpus/templates/design/changelog/2026-07-29-design-frames-no-longer-grow-continuously-when-their-content.md +6 -0
  416. package/corpus/templates/design/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
  417. package/corpus/templates/design/changelog/2026-07-29-the-code-panel-and-apply-design-update-control-now-use-clear.md +6 -0
  418. package/corpus/templates/design/changelog/2026-07-29-the-tools-panel-now-keeps-extension-creation-and-discovery-h.md +6 -0
  419. package/corpus/templates/design/shared/source-mode.ts +7 -1
  420. package/corpus/templates/dispatch/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  421. package/corpus/templates/dispatch/app/i18n-data.ts +171 -0
  422. package/corpus/templates/dispatch/app/routes/browser-chat.tsx +4 -0
  423. package/corpus/templates/dispatch/app/routes/browser-connect.tsx +4 -0
  424. package/corpus/templates/dispatch/changelog/2026-07-29-browser-chat-can-securely-connect-the-agent-native-chrome-ex.md +6 -0
  425. package/corpus/templates/forms/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  426. package/corpus/templates/forms/app/components/layout/Sidebar.tsx +1 -6
  427. package/corpus/templates/forms/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
  428. package/corpus/templates/macros/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  429. package/corpus/templates/macros/app/components/layout/AppLayout.tsx +1 -5
  430. package/corpus/templates/macros/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
  431. package/corpus/templates/mail/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  432. package/corpus/templates/mail/app/components/layout/AppLayout.tsx +1 -9
  433. package/corpus/templates/mail/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
  434. package/corpus/templates/plan/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  435. package/corpus/templates/plan/app/components/layout/Sidebar.tsx +3 -7
  436. package/corpus/templates/plan/app/pages/PlansPage.tsx +2 -2
  437. package/corpus/templates/plan/changelog/2026-07-29-chat-history-now-closes-smoothly-and-stays-ready-when-you-re.md +6 -0
  438. package/corpus/templates/plan/changelog/2026-07-29-chat-history-stays-visible-when-you-return-to-ask-plan.md +6 -0
  439. package/corpus/templates/plan/changelog/2026-07-29-fixed-plan-pages-crashing-when-recent-activity-is-unavailabl.md +6 -0
  440. package/corpus/templates/plan/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
  441. package/corpus/templates/slides/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  442. package/corpus/templates/slides/.agents/skills/create-deck/SKILL.md +60 -4
  443. package/corpus/templates/slides/.agents/skills/design-systems/SKILL.md +20 -0
  444. package/corpus/templates/slides/.agents/skills/slide-editing/SKILL.md +30 -1
  445. package/corpus/templates/slides/.agents/skills/slide-images/SKILL.md +3 -1
  446. package/corpus/templates/slides/AGENTS.md +22 -24
  447. package/corpus/templates/slides/actions/check-image-gen.ts +8 -2
  448. package/corpus/templates/slides/actions/create-deck.ts +4 -12
  449. package/corpus/templates/slides/actions/export-pptx.ts +25 -3
  450. package/corpus/templates/slides/actions/generate-image-api.ts +4 -2
  451. package/corpus/templates/slides/actions/generate-slides-ai.ts +1 -1
  452. package/corpus/templates/slides/actions/get-deck-reference-context.ts +136 -0
  453. package/corpus/templates/slides/actions/get-workspace-defaults.ts +55 -0
  454. package/corpus/templates/slides/actions/image-gen-status.ts +10 -1
  455. package/corpus/templates/slides/actions/import-file.ts +53 -38
  456. package/corpus/templates/slides/actions/list-decks.ts +2 -0
  457. package/corpus/templates/slides/actions/patch-deck.ts +2 -0
  458. package/corpus/templates/slides/actions/set-workspace-defaults.ts +50 -0
  459. package/corpus/templates/slides/actions/view-screen.ts +6 -0
  460. package/corpus/templates/slides/app/components/comments/SlideCommentsPanel.tsx +1 -1
  461. package/corpus/templates/slides/app/components/deck/DeckCard.tsx +67 -3
  462. package/corpus/templates/slides/app/components/deck/SlideRenderer.tsx +40 -8
  463. package/corpus/templates/slides/app/components/design-system/DesignSystemCard.tsx +33 -8
  464. package/corpus/templates/slides/app/components/editor/EditorSidebar.tsx +6 -2
  465. package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +114 -128
  466. package/corpus/templates/slides/app/components/editor/ExportMenu.tsx +2 -1
  467. package/corpus/templates/slides/app/components/editor/ImageGenPanel.tsx +1 -1
  468. package/corpus/templates/slides/app/components/editor/SlideEditor.tsx +1193 -267
  469. package/corpus/templates/slides/app/components/editor/SlideStyleInspector.tsx +302 -102
  470. package/corpus/templates/slides/app/components/editor/rich-text-selection.ts +270 -0
  471. package/corpus/templates/slides/app/components/editor/slide-escape-arbiter.ts +34 -0
  472. package/corpus/templates/slides/app/components/editor/slide-object-interactions.ts +368 -0
  473. package/corpus/templates/slides/app/components/editor/slide-presence.ts +13 -0
  474. package/corpus/templates/slides/app/components/layout/AgentWorkIndicator.tsx +23 -3
  475. package/corpus/templates/slides/app/components/layout/Layout.tsx +39 -6
  476. package/corpus/templates/slides/app/components/layout/Sidebar.tsx +1 -6
  477. package/corpus/templates/slides/app/components/layout/layout-route-policy.ts +23 -0
  478. package/corpus/templates/slides/app/components/visual-editor/DrawOverlay.tsx +0 -2
  479. package/corpus/templates/slides/app/context/DeckContext.tsx +2 -0
  480. package/corpus/templates/slides/app/global.css +60 -0
  481. package/corpus/templates/slides/app/hooks/use-agent-generating.ts +76 -5
  482. package/corpus/templates/slides/app/hooks/use-workspace-defaults.ts +26 -0
  483. package/corpus/templates/slides/app/i18n/en-US.ts +38 -3
  484. package/corpus/templates/slides/app/lib/generation-state.ts +13 -3
  485. package/corpus/templates/slides/app/lib/slide-image-replacement.ts +27 -6
  486. package/corpus/templates/slides/app/lib/text-tool-shortcut.ts +62 -0
  487. package/corpus/templates/slides/app/pages/DeckEditor.tsx +197 -83
  488. package/corpus/templates/slides/app/pages/DesignSystems.tsx +95 -0
  489. package/corpus/templates/slides/app/pages/Index.tsx +348 -53
  490. package/corpus/templates/slides/changelog/2026-07-28-pick-an-existing-deck-as-a-style-reference-when-creating-a-n.md +6 -0
  491. package/corpus/templates/slides/changelog/2026-07-29-ai-editing-status-is-now-quieter-and-only-shows-slide-presen.md +6 -0
  492. package/corpus/templates/slides/changelog/2026-07-29-design-systems-and-reference-decks-are-easier-to-choose-toge.md +6 -0
  493. package/corpus/templates/slides/changelog/2026-07-29-generated-decks-now-receive-a-concise-relevant-title-before-.md +6 -0
  494. package/corpus/templates/slides/changelog/2026-07-29-new-deck-prompts-reuse-empty-chats.md +6 -0
  495. package/corpus/templates/slides/changelog/2026-07-29-new-deck-setup-now-stays-in-the-editor-with-closable-style-a.md +6 -0
  496. package/corpus/templates/slides/changelog/2026-07-29-selected-words-and-text-runs-can-now-be-styled-independently.md +6 -0
  497. package/corpus/templates/slides/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
  498. package/corpus/templates/slides/changelog/2026-07-29-slide-annotation-tools-are-clearer-and-escape-now-exits-anno.md +6 -0
  499. package/corpus/templates/slides/changelog/2026-07-29-slide-editing-now-opens-with-the-app-navigation-collapsed-fo.md +6 -0
  500. package/corpus/templates/slides/changelog/2026-07-29-slide-editing-stays-visually-clean-on-hover-without-a-canvas.md +6 -0
  501. package/corpus/templates/slides/changelog/2026-07-29-slides-now-appear-one-by-one-while-ai-builds-a-deck-with-ste.md +6 -0
  502. package/corpus/templates/slides/changelog/2026-07-29-text-boxes-now-select-move-duplicate-resize-and-style-like-a.md +6 -0
  503. package/corpus/templates/slides/changelog/2026-07-29-untitled-decks-now-use-a-clearer-this-deck-label-in-the-agen.md +6 -0
  504. package/corpus/templates/slides/server/handlers/image-providers/builder.ts +305 -0
  505. package/corpus/templates/slides/server/handlers/image-providers/index.ts +6 -3
  506. package/corpus/templates/slides/server/plugins/agent-chat.ts +1 -0
  507. package/corpus/templates/slides/server/workspace-defaults.ts +169 -0
  508. package/corpus/templates/tasks/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  509. package/corpus/templates/tasks/app/components/layout/Sidebar.tsx +31 -8
  510. package/corpus/templates/tasks/app/i18n/en-US.ts +7 -0
  511. package/corpus/templates/tasks/app/routes/settings.tsx +25 -2
  512. package/corpus/templates/tasks/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
  513. package/corpus/toolkit/CHANGELOG.md +15 -0
  514. package/corpus/toolkit/README.md +2 -2
  515. package/corpus/toolkit/package.json +1 -1
  516. package/corpus/toolkit/src/app-shell/sidebar-footer-actions.tsx +0 -3
  517. package/corpus/toolkit/src/chat-history.css +1 -0
  518. package/corpus/toolkit/src/composer/ComposerPlusMenu.tsx +35 -14
  519. package/corpus/toolkit/src/composer/PromptComposer.tsx +6 -0
  520. package/corpus/toolkit/src/composer/TiptapComposer.tsx +11 -3
  521. package/corpus/toolkit/src/design-tweaks/visual-style-controls.tsx +64 -11
  522. package/dist/action.d.ts +44 -0
  523. package/dist/action.d.ts.map +1 -1
  524. package/dist/action.js +9 -0
  525. package/dist/action.js.map +1 -1
  526. package/dist/agent/engine/builder-engine.js +6 -4
  527. package/dist/agent/engine/builder-engine.js.map +1 -1
  528. package/dist/agent/production-agent.d.ts +11 -1
  529. package/dist/agent/production-agent.d.ts.map +1 -1
  530. package/dist/agent/production-agent.js +131 -90
  531. package/dist/agent/production-agent.js.map +1 -1
  532. package/dist/agent/tool-search.d.ts +4 -0
  533. package/dist/agent/tool-search.d.ts.map +1 -1
  534. package/dist/agent/tool-search.js +30 -0
  535. package/dist/agent/tool-search.js.map +1 -1
  536. package/dist/automations/service.d.ts +85 -0
  537. package/dist/automations/service.d.ts.map +1 -0
  538. package/dist/automations/service.js +332 -0
  539. package/dist/automations/service.js.map +1 -0
  540. package/dist/browser-context/index.d.ts +579 -0
  541. package/dist/browser-context/index.d.ts.map +1 -0
  542. package/dist/browser-context/index.js +331 -0
  543. package/dist/browser-context/index.js.map +1 -0
  544. package/dist/client/AgentPanel.d.ts.map +1 -1
  545. package/dist/client/AgentPanel.js +1 -1
  546. package/dist/client/AgentPanel.js.map +1 -1
  547. package/dist/client/FeedbackButton.d.ts +6 -2
  548. package/dist/client/FeedbackButton.d.ts.map +1 -1
  549. package/dist/client/FeedbackButton.js +20 -3
  550. package/dist/client/FeedbackButton.js.map +1 -1
  551. package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
  552. package/dist/client/MultiTabAssistantChat.js +19 -2
  553. package/dist/client/MultiTabAssistantChat.js.map +1 -1
  554. package/dist/client/agent-chat.d.ts +15 -0
  555. package/dist/client/agent-chat.d.ts.map +1 -1
  556. package/dist/client/agent-chat.js +13 -3
  557. package/dist/client/agent-chat.js.map +1 -1
  558. package/dist/client/agent-page/AgentJobsTab.d.ts +1 -0
  559. package/dist/client/agent-page/AgentJobsTab.d.ts.map +1 -1
  560. package/dist/client/agent-page/AgentJobsTab.js +186 -98
  561. package/dist/client/agent-page/AgentJobsTab.js.map +1 -1
  562. package/dist/client/agent-page/AgentTabsPage.js +4 -4
  563. package/dist/client/agent-page/AgentTabsPage.js.map +1 -1
  564. package/dist/client/agent-page/use-jobs.d.ts +7 -0
  565. package/dist/client/agent-page/use-jobs.d.ts.map +1 -1
  566. package/dist/client/agent-page/use-jobs.js.map +1 -1
  567. package/dist/client/analytics-session.d.ts.map +1 -1
  568. package/dist/client/analytics-session.js +13 -0
  569. package/dist/client/analytics-session.js.map +1 -1
  570. package/dist/client/extensions/ExtensionViewer.d.ts.map +1 -1
  571. package/dist/client/extensions/ExtensionViewer.js +29 -6
  572. package/dist/client/extensions/ExtensionViewer.js.map +1 -1
  573. package/dist/client/settings/AutomationsSection.d.ts +0 -9
  574. package/dist/client/settings/AutomationsSection.d.ts.map +1 -1
  575. package/dist/client/settings/AutomationsSection.js +9 -168
  576. package/dist/client/settings/AutomationsSection.js.map +1 -1
  577. package/dist/client/settings/SettingsPanel.d.ts +9 -1
  578. package/dist/client/settings/SettingsPanel.d.ts.map +1 -1
  579. package/dist/client/settings/SettingsPanel.js +19 -11
  580. package/dist/client/settings/SettingsPanel.js.map +1 -1
  581. package/dist/client/settings/index.d.ts +1 -1
  582. package/dist/client/settings/index.d.ts.map +1 -1
  583. package/dist/client/settings/index.js +1 -1
  584. package/dist/client/settings/index.js.map +1 -1
  585. package/dist/client/use-agent-chat.d.ts.map +1 -1
  586. package/dist/client/use-agent-chat.js +20 -3
  587. package/dist/client/use-agent-chat.js.map +1 -1
  588. package/dist/client/use-chat-threads.d.ts.map +1 -1
  589. package/dist/client/use-chat-threads.js +4 -17
  590. package/dist/client/use-chat-threads.js.map +1 -1
  591. package/dist/collab/struct-routes.d.ts +1 -1
  592. package/dist/deploy/build.d.ts.map +1 -1
  593. package/dist/deploy/build.js +2 -1
  594. package/dist/deploy/build.js.map +1 -1
  595. package/dist/deploy/workspace-deploy.d.ts.map +1 -1
  596. package/dist/deploy/workspace-deploy.js +2 -1
  597. package/dist/deploy/workspace-deploy.js.map +1 -1
  598. package/dist/extensions/actions.d.ts.map +1 -1
  599. package/dist/extensions/actions.js +82 -6
  600. package/dist/extensions/actions.js.map +1 -1
  601. package/dist/extensions/fetch-tool.d.ts.map +1 -1
  602. package/dist/extensions/fetch-tool.js +11 -0
  603. package/dist/extensions/fetch-tool.js.map +1 -1
  604. package/dist/extensions/routes.d.ts +5 -1
  605. package/dist/extensions/routes.d.ts.map +1 -1
  606. package/dist/extensions/routes.js +7 -1
  607. package/dist/extensions/routes.js.map +1 -1
  608. package/dist/extensions/web-content.d.ts +1 -0
  609. package/dist/extensions/web-content.d.ts.map +1 -1
  610. package/dist/extensions/web-content.js +82 -1
  611. package/dist/extensions/web-content.js.map +1 -1
  612. package/dist/integrations/computer-supervision.d.ts.map +1 -1
  613. package/dist/integrations/computer-supervision.js +22 -1
  614. package/dist/integrations/computer-supervision.js.map +1 -1
  615. package/dist/integrations/index.d.ts +3 -2
  616. package/dist/integrations/index.d.ts.map +1 -1
  617. package/dist/integrations/index.js +3 -2
  618. package/dist/integrations/index.js.map +1 -1
  619. package/dist/integrations/integration-durable-dispatch-config.d.ts +2 -0
  620. package/dist/integrations/integration-durable-dispatch-config.d.ts.map +1 -1
  621. package/dist/integrations/integration-durable-dispatch-config.js +4 -0
  622. package/dist/integrations/integration-durable-dispatch-config.js.map +1 -1
  623. package/dist/integrations/integration-durable-dispatch.d.ts +2 -2
  624. package/dist/integrations/integration-durable-dispatch.d.ts.map +1 -1
  625. package/dist/integrations/integration-durable-dispatch.js +2 -2
  626. package/dist/integrations/integration-durable-dispatch.js.map +1 -1
  627. package/dist/integrations/plugin.d.ts.map +1 -1
  628. package/dist/integrations/plugin.js +84 -39
  629. package/dist/integrations/plugin.js.map +1 -1
  630. package/dist/integrations/remote-browser-actions.d.ts +7 -0
  631. package/dist/integrations/remote-browser-actions.d.ts.map +1 -0
  632. package/dist/integrations/remote-browser-actions.js +482 -0
  633. package/dist/integrations/remote-browser-actions.js.map +1 -0
  634. package/dist/jobs/actions/list-recurring-jobs.d.ts.map +1 -1
  635. package/dist/jobs/actions/list-recurring-jobs.js +4 -6
  636. package/dist/jobs/actions/list-recurring-jobs.js.map +1 -1
  637. package/dist/jobs/actions/manage-recurring-job.js +3 -6
  638. package/dist/jobs/actions/manage-recurring-job.js.map +1 -1
  639. package/dist/jobs/background-automation-runner.d.ts +76 -0
  640. package/dist/jobs/background-automation-runner.d.ts.map +1 -0
  641. package/dist/jobs/background-automation-runner.js +288 -0
  642. package/dist/jobs/background-automation-runner.js.map +1 -0
  643. package/dist/jobs/frontmatter.d.ts +63 -0
  644. package/dist/jobs/frontmatter.d.ts.map +1 -0
  645. package/dist/jobs/frontmatter.js +216 -0
  646. package/dist/jobs/frontmatter.js.map +1 -0
  647. package/dist/jobs/scheduler.d.ts +6 -60
  648. package/dist/jobs/scheduler.d.ts.map +1 -1
  649. package/dist/jobs/scheduler.js +67 -484
  650. package/dist/jobs/scheduler.js.map +1 -1
  651. package/dist/jobs/tools.d.ts.map +1 -1
  652. package/dist/jobs/tools.js +24 -3
  653. package/dist/jobs/tools.js.map +1 -1
  654. package/dist/localization/default-messages.d.ts +28 -33
  655. package/dist/localization/default-messages.d.ts.map +1 -1
  656. package/dist/localization/default-messages.js +34 -39
  657. package/dist/localization/default-messages.js.map +1 -1
  658. package/dist/mcp-client/index.d.ts.map +1 -1
  659. package/dist/mcp-client/index.js +4 -0
  660. package/dist/mcp-client/index.js.map +1 -1
  661. package/dist/notifications/actions.d.ts.map +1 -1
  662. package/dist/notifications/actions.js +5 -0
  663. package/dist/notifications/actions.js.map +1 -1
  664. package/dist/notifications/routes.d.ts +6 -6
  665. package/dist/observability/routes.d.ts +3 -3
  666. package/dist/progress/actions.d.ts.map +1 -1
  667. package/dist/progress/actions.js +5 -0
  668. package/dist/progress/actions.js.map +1 -1
  669. package/dist/provider-api/actions/custom-provider-registration.d.ts +14 -14
  670. package/dist/provider-api/actions/github-repo-files.d.ts.map +1 -1
  671. package/dist/provider-api/actions/github-repo-files.js +9 -0
  672. package/dist/provider-api/actions/github-repo-files.js.map +1 -1
  673. package/dist/provider-api/actions/provider-api.d.ts +16 -16
  674. package/dist/provider-api/actions/provider-api.d.ts.map +1 -1
  675. package/dist/provider-api/actions/provider-api.js +14 -0
  676. package/dist/provider-api/actions/provider-api.js.map +1 -1
  677. package/dist/provider-api/corpus-jobs.d.ts +2 -2
  678. package/dist/resources/handlers.d.ts +1 -1
  679. package/dist/secrets/routes.d.ts +9 -9
  680. package/dist/server/action-discovery.d.ts.map +1 -1
  681. package/dist/server/action-discovery.js +5 -0
  682. package/dist/server/action-discovery.js.map +1 -1
  683. package/dist/server/agent-chat/browser-team-tools.d.ts.map +1 -1
  684. package/dist/server/agent-chat/browser-team-tools.js +90 -3
  685. package/dist/server/agent-chat/browser-team-tools.js.map +1 -1
  686. package/dist/server/agent-chat/framework-prompts.d.ts.map +1 -1
  687. package/dist/server/agent-chat/framework-prompts.js +7 -11
  688. package/dist/server/agent-chat/framework-prompts.js.map +1 -1
  689. package/dist/server/agent-chat/plugin-options.d.ts +3 -3
  690. package/dist/server/agent-chat/plugin-options.js.map +1 -1
  691. package/dist/server/agent-chat/script-entries.d.ts.map +1 -1
  692. package/dist/server/agent-chat/script-entries.js +43 -1
  693. package/dist/server/agent-chat/script-entries.js.map +1 -1
  694. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  695. package/dist/server/agent-chat-plugin.js +24 -5
  696. package/dist/server/agent-chat-plugin.js.map +1 -1
  697. package/dist/server/attribution.d.ts +6 -0
  698. package/dist/server/attribution.d.ts.map +1 -1
  699. package/dist/server/attribution.js +14 -14
  700. package/dist/server/attribution.js.map +1 -1
  701. package/dist/server/auth.d.ts.map +1 -1
  702. package/dist/server/auth.js +5 -2
  703. package/dist/server/auth.js.map +1 -1
  704. package/dist/server/better-auth-instance.d.ts +2 -1
  705. package/dist/server/better-auth-instance.d.ts.map +1 -1
  706. package/dist/server/better-auth-instance.js +6 -3
  707. package/dist/server/better-auth-instance.js.map +1 -1
  708. package/dist/server/core-routes-plugin.d.ts +7 -0
  709. package/dist/server/core-routes-plugin.d.ts.map +1 -1
  710. package/dist/server/core-routes-plugin.js +3 -1
  711. package/dist/server/core-routes-plugin.js.map +1 -1
  712. package/dist/server/csrf.d.ts.map +1 -1
  713. package/dist/server/csrf.js +25 -0
  714. package/dist/server/csrf.js.map +1 -1
  715. package/dist/server/email-template.d.ts +4 -0
  716. package/dist/server/email-template.d.ts.map +1 -1
  717. package/dist/server/email-template.js +25 -8
  718. package/dist/server/email-template.js.map +1 -1
  719. package/dist/server/google-oauth.d.ts +3 -0
  720. package/dist/server/google-oauth.d.ts.map +1 -1
  721. package/dist/server/google-oauth.js +12 -1
  722. package/dist/server/google-oauth.js.map +1 -1
  723. package/dist/server/onboarding-html.d.ts.map +1 -1
  724. package/dist/server/onboarding-html.js +18 -0
  725. package/dist/server/onboarding-html.js.map +1 -1
  726. package/dist/server/prompts/framework-core-compact.js +3 -3
  727. package/dist/server/prompts/framework-core-compact.js.map +1 -1
  728. package/dist/server/prompts/framework-core.js +3 -3
  729. package/dist/server/prompts/framework-core.js.map +1 -1
  730. package/dist/server/prompts/shared-rules.js +3 -3
  731. package/dist/server/prompts/shared-rules.js.map +1 -1
  732. package/dist/server/realtime-token.d.ts +1 -1
  733. package/dist/server/transcribe-voice.d.ts +1 -1
  734. package/dist/settings/index.d.ts +1 -1
  735. package/dist/settings/index.d.ts.map +1 -1
  736. package/dist/settings/index.js +1 -1
  737. package/dist/settings/index.js.map +1 -1
  738. package/dist/shared/analytics-anonymous-id.d.ts +12 -0
  739. package/dist/shared/analytics-anonymous-id.d.ts.map +1 -0
  740. package/dist/shared/analytics-anonymous-id.js +29 -0
  741. package/dist/shared/analytics-anonymous-id.js.map +1 -0
  742. package/dist/sharing/actions/share-resource.d.ts.map +1 -1
  743. package/dist/sharing/actions/share-resource.js +23 -4
  744. package/dist/sharing/actions/share-resource.js.map +1 -1
  745. package/dist/sharing/index.d.ts +1 -1
  746. package/dist/sharing/index.d.ts.map +1 -1
  747. package/dist/sharing/index.js.map +1 -1
  748. package/dist/sharing/registry.d.ts +23 -0
  749. package/dist/sharing/registry.d.ts.map +1 -1
  750. package/dist/sharing/registry.js.map +1 -1
  751. package/dist/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  752. package/dist/templates/chat/app/components/layout/Sidebar.tsx +1 -5
  753. package/dist/templates/chat/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
  754. package/dist/templates/default/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  755. package/dist/templates/default/app/i18n/ar-SA.ts +26 -0
  756. package/dist/templates/default/app/i18n/de-DE.ts +28 -0
  757. package/dist/templates/default/app/i18n/en-US.ts +27 -0
  758. package/dist/templates/default/app/i18n/es-ES.ts +28 -0
  759. package/dist/templates/default/app/i18n/fr-FR.ts +28 -0
  760. package/dist/templates/default/app/i18n/hi-IN.ts +25 -0
  761. package/dist/templates/default/app/i18n/ja-JP.ts +27 -0
  762. package/dist/templates/default/app/i18n/ko-KR.ts +27 -0
  763. package/dist/templates/default/app/i18n/pt-BR.ts +27 -0
  764. package/dist/templates/default/app/i18n/zh-CN.ts +24 -0
  765. package/dist/templates/default/app/i18n/zh-TW.ts +24 -0
  766. package/dist/templates/headless/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  767. package/dist/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  768. package/dist/templates/workspace-core/.agents/skills/agent-page/SKILL.md +10 -7
  769. package/dist/templates/workspace-core/.agents/skills/automations/SKILL.md +53 -8
  770. package/dist/templates/workspace-core/.agents/skills/browser-sessions/SKILL.md +131 -0
  771. package/dist/templates/workspace-core/.agents/skills/extension-points/SKILL.md +13 -4
  772. package/dist/templates/workspace-core/.agents/skills/extensions/SKILL.md +23 -15
  773. package/dist/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +33 -18
  774. package/dist/tracking/providers.d.ts.map +1 -1
  775. package/dist/tracking/providers.js +1 -0
  776. package/dist/tracking/providers.js.map +1 -1
  777. package/dist/tracking/registry.d.ts +1 -0
  778. package/dist/tracking/registry.d.ts.map +1 -1
  779. package/dist/tracking/registry.js +1 -0
  780. package/dist/tracking/registry.js.map +1 -1
  781. package/dist/tracking/types.d.ts +1 -0
  782. package/dist/tracking/types.d.ts.map +1 -1
  783. package/dist/tracking/types.js.map +1 -1
  784. package/dist/triggers/actions/list-automations.d.ts +7 -0
  785. package/dist/triggers/actions/list-automations.d.ts.map +1 -1
  786. package/dist/triggers/actions/list-automations.js +29 -41
  787. package/dist/triggers/actions/list-automations.js.map +1 -1
  788. package/dist/triggers/actions/manage-automation.js +15 -33
  789. package/dist/triggers/actions/manage-automation.js.map +1 -1
  790. package/dist/triggers/actions.d.ts.map +1 -1
  791. package/dist/triggers/actions.js +184 -95
  792. package/dist/triggers/actions.js.map +1 -1
  793. package/dist/triggers/dispatcher.d.ts +3 -9
  794. package/dist/triggers/dispatcher.d.ts.map +1 -1
  795. package/dist/triggers/dispatcher.js +134 -304
  796. package/dist/triggers/dispatcher.js.map +1 -1
  797. package/dist/triggers/routes.d.ts.map +1 -1
  798. package/dist/triggers/routes.js +76 -17
  799. package/dist/triggers/routes.js.map +1 -1
  800. package/dist/triggers/types.d.ts +4 -23
  801. package/dist/triggers/types.d.ts.map +1 -1
  802. package/dist/triggers/types.js.map +1 -1
  803. package/docs/content/agent-surfaces.mdx +4 -4
  804. package/docs/content/automations.mdx +61 -12
  805. package/docs/content/deployment.mdx +11 -4
  806. package/docs/content/extensions.mdx +39 -33
  807. package/docs/content/recurring-jobs.mdx +41 -19
  808. package/docs/content/template-dispatch-operations.mdx +19 -7
  809. package/package.json +4 -2
  810. package/src/action.ts +55 -0
  811. package/src/agent/engine/builder-engine.ts +8 -4
  812. package/src/agent/production-agent.ts +175 -100
  813. package/src/agent/tool-search.ts +36 -0
  814. package/src/automations/service.ts +506 -0
  815. package/src/browser-context/index.ts +392 -0
  816. package/src/client/AgentPanel.tsx +2 -1
  817. package/src/client/FeedbackButton.tsx +37 -4
  818. package/src/client/MultiTabAssistantChat.tsx +21 -0
  819. package/src/client/agent-chat.ts +31 -3
  820. package/src/client/agent-page/AgentJobsTab.tsx +438 -310
  821. package/src/client/agent-page/AgentTabsPage.tsx +4 -4
  822. package/src/client/agent-page/use-jobs.ts +7 -0
  823. package/src/client/analytics-session.ts +13 -0
  824. package/src/client/extensions/ExtensionViewer.tsx +67 -0
  825. package/src/client/settings/AutomationsSection.tsx +27 -499
  826. package/src/client/settings/SettingsPanel.tsx +32 -11
  827. package/src/client/settings/index.ts +2 -0
  828. package/src/client/use-agent-chat.ts +35 -3
  829. package/src/client/use-chat-threads.ts +8 -25
  830. package/src/deploy/build.ts +2 -0
  831. package/src/deploy/workspace-deploy.ts +2 -0
  832. package/src/extensions/actions.ts +115 -3
  833. package/src/extensions/fetch-tool.ts +11 -0
  834. package/src/extensions/routes.ts +16 -1
  835. package/src/extensions/web-content.ts +96 -1
  836. package/src/integrations/computer-supervision.ts +33 -1
  837. package/src/integrations/index.ts +6 -0
  838. package/src/integrations/integration-durable-dispatch-config.ts +10 -0
  839. package/src/integrations/integration-durable-dispatch.ts +4 -0
  840. package/src/integrations/plugin.ts +94 -41
  841. package/src/integrations/remote-browser-actions.ts +621 -0
  842. package/src/jobs/actions/list-recurring-jobs.ts +5 -7
  843. package/src/jobs/actions/manage-recurring-job.ts +3 -7
  844. package/src/jobs/background-automation-runner.ts +437 -0
  845. package/src/jobs/frontmatter.ts +308 -0
  846. package/src/jobs/scheduler.ts +89 -598
  847. package/src/jobs/tools.ts +22 -3
  848. package/src/localization/default-messages.ts +45 -45
  849. package/src/mcp-client/index.ts +6 -0
  850. package/src/notifications/actions.ts +5 -0
  851. package/src/progress/actions.ts +5 -0
  852. package/src/provider-api/actions/github-repo-files.ts +11 -0
  853. package/src/provider-api/actions/provider-api.ts +13 -0
  854. package/src/server/__snapshots__/agent-chat-plugin.surface.spec.ts.snap +4 -4
  855. package/src/server/action-discovery.ts +7 -0
  856. package/src/server/agent-chat/browser-team-tools.ts +126 -3
  857. package/src/server/agent-chat/framework-prompts.ts +7 -11
  858. package/src/server/agent-chat/plugin-options.ts +3 -3
  859. package/src/server/agent-chat/script-entries.ts +52 -1
  860. package/src/server/agent-chat-plugin.ts +25 -5
  861. package/src/server/attribution.ts +22 -0
  862. package/src/server/auth.ts +20 -6
  863. package/src/server/better-auth-instance.ts +10 -2
  864. package/src/server/core-routes-plugin.ts +10 -1
  865. package/src/server/csrf.ts +25 -0
  866. package/src/server/email-template.ts +43 -13
  867. package/src/server/google-oauth.ts +21 -1
  868. package/src/server/onboarding-html.ts +18 -0
  869. package/src/server/prompts/framework-core-compact.ts +3 -3
  870. package/src/server/prompts/framework-core.ts +3 -3
  871. package/src/server/prompts/shared-rules.ts +3 -3
  872. package/src/settings/index.ts +1 -0
  873. package/src/shared/analytics-anonymous-id.ts +35 -0
  874. package/src/sharing/actions/share-resource.ts +26 -4
  875. package/src/sharing/index.ts +1 -0
  876. package/src/sharing/registry.ts +23 -0
  877. package/src/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  878. package/src/templates/chat/app/components/layout/Sidebar.tsx +1 -5
  879. package/src/templates/chat/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
  880. package/src/templates/default/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  881. package/src/templates/default/app/i18n/ar-SA.ts +26 -0
  882. package/src/templates/default/app/i18n/de-DE.ts +28 -0
  883. package/src/templates/default/app/i18n/en-US.ts +27 -0
  884. package/src/templates/default/app/i18n/es-ES.ts +28 -0
  885. package/src/templates/default/app/i18n/fr-FR.ts +28 -0
  886. package/src/templates/default/app/i18n/hi-IN.ts +25 -0
  887. package/src/templates/default/app/i18n/ja-JP.ts +27 -0
  888. package/src/templates/default/app/i18n/ko-KR.ts +27 -0
  889. package/src/templates/default/app/i18n/pt-BR.ts +27 -0
  890. package/src/templates/default/app/i18n/zh-CN.ts +24 -0
  891. package/src/templates/default/app/i18n/zh-TW.ts +24 -0
  892. package/src/templates/headless/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  893. package/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  894. package/src/templates/workspace-core/.agents/skills/agent-page/SKILL.md +10 -7
  895. package/src/templates/workspace-core/.agents/skills/automations/SKILL.md +53 -8
  896. package/src/templates/workspace-core/.agents/skills/browser-sessions/SKILL.md +131 -0
  897. package/src/templates/workspace-core/.agents/skills/extension-points/SKILL.md +13 -4
  898. package/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +23 -15
  899. package/src/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +33 -18
  900. package/src/tracking/providers.ts +1 -0
  901. package/src/tracking/registry.ts +2 -1
  902. package/src/tracking/types.ts +1 -0
  903. package/src/triggers/actions/list-automations.ts +43 -44
  904. package/src/triggers/actions/manage-automation.ts +17 -48
  905. package/src/triggers/actions.ts +218 -127
  906. package/src/triggers/dispatcher.ts +181 -367
  907. package/src/triggers/routes.ts +84 -27
  908. package/src/triggers/types.ts +9 -23
  909. package/corpus/templates/clips/app/routes/_app.settings.organization.tsx +0 -232
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-options.js","sourceRoot":"","sources":["../../../src/server/agent-chat/plugin-options.ts"],"names":[],"mappings":"","sourcesContent":["import type { ActionEntry } from \"../../agent/production-agent.js\";\nimport type { AgentLoopFinalResponseGuard } from \"../../agent/production-agent.js\";\nimport type {\n AgentChatAttachment,\n AgentChatReference,\n MentionProvider,\n} from \"../../agent/types.js\";\nimport type { ExternalAgentPolicy } from \"../../mcp/external-agent-policy.js\";\nimport type { DatabaseToolsOption } from \"../../scripts/db/tool-mode.js\";\nimport type { PromptExamples } from \"../prompts/index.js\";\n\n/** Shape of a Nitro plugin function: receives the Nitro app instance at\n * startup and may register routes/hooks synchronously or asynchronously. */\nexport type NitroPluginDef = (nitroApp: any) => void | Promise<void>;\n\nexport interface AgentChatPluginOptions {\n /** Template-specific actions (email ops, booking ops, etc.) */\n actions?:\n | Record<string, ActionEntry>\n | (() =>\n | Record<string, ActionEntry>\n | Promise<Record<string, ActionEntry>>);\n /** @deprecated Use `actions` instead */\n scripts?:\n | Record<string, ActionEntry>\n | (() =>\n | Record<string, ActionEntry>\n | Promise<Record<string, ActionEntry>>);\n /** System prompt for the agent. A sensible default is provided. */\n systemPrompt?: string;\n /** Additional system prompt prepended in dev mode */\n devSystemPrompt?: string;\n /** Model to use. Defaults to the resolved engine's default model. */\n model?: string;\n /** Optional per-app agent run chunk budget in milliseconds. Defaults to\n * AGENT_RUN_SOFT_TIMEOUT_MS when set, otherwise no framework-imposed\n * timeout. When reached, long runs continue through the hidden continuation\n * path instead of surfacing a timeout warning. */\n runSoftTimeoutMs?: number;\n /** Optional per-app run-manager no-progress watchdog in milliseconds. */\n runNoProgressTimeoutMs?: number;\n /**\n * Opt this app into Netlify durable background-function agent-chat runs. This\n * gives hosted agent turns the 15-minute async-function budget when the app's\n * Netlify build also emits the background function. Set this to `false` to\n * explicitly disable a stale deploy-wide `AGENT_CHAT_DURABLE_BACKGROUND`\n * flag for this app.\n */\n durableBackgroundRuns?: boolean;\n /** Anthropic API key. Falls back to ANTHROPIC_API_KEY env var */\n apiKey?: string;\n /**\n * Agent engine to use. Can be a pre-constructed AgentEngine, a registered\n * engine name (e.g. \"anthropic\", \"ai-sdk:openai\"), or an object with name\n * and config. Defaults to the \"anthropic\" engine using ANTHROPIC_API_KEY.\n */\n engine?:\n | import(\"../../agent/engine/types.js\").AgentEngine\n | string\n | { name: string; config: Record<string, unknown> };\n /** Route path. Default: /_agent-native/agent-chat */\n path?: string;\n /** Custom mention providers for @-tagging template entities */\n mentionProviders?:\n | Record<string, MentionProvider>\n | (() =>\n | Record<string, MentionProvider>\n | Promise<Record<string, MentionProvider>>);\n /** App ID used to exclude self from agent discovery (e.g., \"mail\", \"calendar\") */\n appId?: string;\n /** Optional MCP server branding surfaced during the initialize handshake. */\n mcpServerInfo?: {\n /** Human-facing title. Defaults to the capitalized app id/name. */\n title?: string;\n /** Host-facing description. Defaults to \"Agent-native <app> agent\". */\n description?: string;\n /** Canonical app URL. Relative URLs are resolved against the request origin. */\n websiteUrl?: string;\n /** App icons. Relative `src` values are resolved against the request origin. */\n icons?: Array<{\n src: string;\n mimeType?: string;\n sizes?: string[];\n theme?: \"light\" | \"dark\";\n }>;\n };\n /**\n * Optional callback to resolve the org ID for the current request.\n * When provided, the resolved value is set as AGENT_ORG_ID env var so\n * that db-query/db-exec automatically scope by org_id in addition to\n * owner_email.\n *\n * If not provided, the framework automatically uses `session.orgId` from\n * Better Auth's active organization. Only provide this callback when you\n * need custom org resolution logic (e.g., Atlassian org mapping).\n */\n resolveOrgId?: (event: any) => string | null | Promise<string | null>;\n /**\n * Optional owner resolver for public/anonymous chat surfaces. When the\n * normal app session is missing, this callback may return a synthetic\n * owner id for a narrowly-scoped public request (for example, a public\n * shared document page). Anonymous requests use a read-only tool set by\n * default so public viewers cannot mutate app data through the agent.\n */\n anonymousOwner?: (event: any) => string | null | Promise<string | null>;\n /**\n * Keep anonymous-owner requests on read-only template actions. Defaults to\n * true. Only disable for single-tenant apps that intentionally allow public\n * agent mutations.\n */\n anonymousReadOnly?: boolean;\n /**\n * Optional auth adapter for the HTTP action route\n * (`/_agent-native/actions/*`). Its `resolveCaller` runs before the\n * cookie/bearer `getSession` chain, letting an app accept caller identities\n * `getSession` doesn't understand (e.g. an A2A JWT verified with\n * `verifyA2AToken`) declaratively, instead of pre-seeding request context\n * from a Nitro `request` hook.\n *\n * Returning `null` defers to the normal chain; THROWING hard-rejects with a\n * 401 (an invalid/forged credential must not fall through to a same-origin\n * session cookie). A resolved caller's org comes exclusively from the\n * verified credential — the returned `orgId` or the owner-email membership\n * lookup — never from the request's session cookie.\n * See {@link import(\"../action-routes.js\").ActionRouteAuthAdapter}.\n */\n actionRouteAuth?: import(\"../action-routes.js\").ActionRouteAuthAdapter;\n /**\n * Optional callback to append template-specific context to the system\n * prompt on each request. Runs after AGENTS.md / skills / memory are\n * loaded and before the schema block — use it to inject dynamic SQL\n * context like a data dictionary, active feature flags, or whatever\n * the agent should know about *right now* for this user/org.\n *\n * Return `null` or an empty string to skip. The string you return is\n * appended verbatim, so wrap it in your own XML tags (e.g.\n * `<data-dictionary>…</data-dictionary>`) to keep the prompt scannable.\n *\n * Called on every request in every prompt variant (lean, lazy, full).\n * Templates that want to suppress it in a particular mode should return\n * `null` from the callback based on their own logic.\n */\n extraContext?: (\n event: any,\n owner: string,\n ) => string | null | Promise<string | null>;\n /**\n * Optional final-answer guard. Templates can use this to require a\n * corrective retry before accepting a text-only final answer, e.g. forcing\n * real data-source tool calls for analytics requests.\n */\n finalResponseGuard?: AgentLoopFinalResponseGuard;\n /**\n * Optional per-template request normalizer. Runs after authentication and\n * before the model sees the message, so apps can translate chat attachments\n * into template-native file handles while preserving the user's visible text.\n */\n prepareRequest?: (details: {\n event: any;\n ownerEmail: string | null;\n message: string;\n displayMessage?: string;\n attachments: AgentChatAttachment[];\n references: AgentChatReference[];\n threadId?: string;\n internalContinuation?: boolean;\n mode: \"act\" | \"plan\";\n }) =>\n | void\n | {\n message?: string;\n displayMessage?: string;\n attachments?: AgentChatAttachment[];\n }\n | Promise<void | {\n message?: string;\n displayMessage?: string;\n attachments?: AgentChatAttachment[];\n }>;\n /**\n * Use ONLY the template's `systemPrompt` and the actions list — skip the\n * framework prompt wrapper, resource loading (AGENTS.md/LEARNINGS.md/\n * memory), the SQL schema block, and the workspace files/skills/agents\n * inventory. Intended for minimal or voice-first apps where a long,\n * generic preamble adds latency and iteration noise without adding value.\n *\n * When set, the same lean prompt is used in both dev and prod modes. In\n * dev mode the tool registry is ALSO swapped to the template's actions\n * (same set as prod) — the dev-only bash/db-exec/file-system tools\n * and the resource/docs/chat/team/job/browser scripts are dropped. The\n * lean system prompt has no bash-usage guidance, so routing actions\n * through bash would break. If you need the full dev tool surface,\n * leave this off.\n */\n leanPrompt?: boolean;\n /**\n * Skip auto-injecting the workspace files/skills/agents inventory on the\n * first message of a conversation while keeping the normal prompt, resources,\n * and tool surface. Use this for domain-focused apps where broad workspace\n * inventory is mostly latency/noise unless the user explicitly references it.\n *\n * `leanPrompt: true` and the default `lazyContext` mode imply this because\n * those catalogs are already discoverable through resources, docs-search,\n * tool-search, and the compact resource indexes. Set `false` explicitly only\n * when a workspace-wide inventory is central to the app's first-turn job.\n */\n skipFilesContext?: boolean;\n /**\n * Initial native tool schemas to send to the LLM provider. When set, the\n * agent starts with only these tools plus `tool-search`; the live registry\n * remains searchable, and matching schemas from `tool-search` results are\n * loaded into the next model request. Use this for domain-focused apps that\n * have a few common actions and many rare framework utilities. Common\n * discovery and resource-reading tools are promoted automatically when\n * present. Provider, MCP, extension, and code-execution schemas stay behind\n * tool-search unless the app explicitly includes them in this list.\n */\n initialToolNames?: string[];\n /**\n * Controls whether broad provider/corpus tools and their workflow prompt are\n * loaded into the first model request. Use `\"lazy\"` for apps that can answer\n * ordinary lookups from a compact curated tool set; corpus tools remain\n * discoverable through tool-search and the full retry surface.\n *\n * @default \"initial\"\n */\n corpusTools?: \"initial\" | \"lazy\";\n /**\n * Use a compact system prompt with on-demand context loading. The system\n * prompt includes essential behavioral rules and action signatures, but\n * defers verbose framework details, SQL schema, skills, learnings, and\n * memory behind tools (`get-framework-context`, `db-schema`,\n * `resources` (action: read)). The agent fetches these on-demand when needed.\n *\n * This reduces the system prompt by ~60-70%, significantly improving\n * time-to-first-token and reducing \"thinking\" time. The agent retains\n * all capabilities — it just loads context lazily instead of upfront.\n *\n * Defaults to `true`. Set to `false` to use the original full prompt.\n * Ignored when `leanPrompt` is set (lean mode is even more minimal).\n */\n lazyContext?: boolean;\n /**\n * In dev mode, register the template's actions as native tools the agent\n * can call directly with structured JSON args — skipping the default\n * `bash(command=\"pnpm action <name> ...\")` indirection.\n *\n * The default dev behavior shells out because it \"mirrors how Claude Code\n * works locally\" and reduces empty-object tool calls for templates with\n * simple string args. But templates whose actions take structured data\n * (objects, arrays, nested JSON) can't round-trip those cleanly through\n * the CLI parser — stringified JSON on the way in, loss of type fidelity\n * on the way out.\n *\n * Set to `true` to get the same tool surface in dev that production uses.\n * `leanPrompt: true` implies this already (lean mode has no bash-usage\n * guidance, so actions must be native). Set this flag without\n * `leanPrompt` when you want native actions AND the full system prompt.\n *\n * Defaults to `false`.\n */\n nativeActionsInDev?: boolean;\n /**\n * Expose raw SQL/native database tools to the app agent.\n *\n * Defaults to `\"read\"`: `db-schema`/`db-query` are available for inspection,\n * while writes route through typed app actions. Set to `\"write\"` (also\n * `true`) to expose `db-exec`/`db-patch` for scoped raw SQL maintenance.\n * Set to `\"off\"` (also `false`) for chat-first apps that want agents to use\n * typed actions only.\n */\n databaseTools?: DatabaseToolsOption;\n /**\n * Expose framework extension management actions (`create-extension`,\n * `update-extension`, `list-extensions`, etc.) to the app agent. Defaults to\n * true. Set to false for apps that do not want the LLM to create or manage\n * sandboxed extension mini-apps, even though the core extension routes may\n * still be mounted for other surfaces.\n */\n extensionTools?: boolean;\n /**\n * Optional A2A-only deterministic response path. Runs after inbound A2A text\n * and user context are resolved, but before an agent engine/model is loaded.\n * Return a message to complete the A2A task without invoking the LLM, or\n * null/undefined to continue through the normal agent loop.\n */\n a2aMessageFallback?: (details: {\n message: import(\"../../a2a/types.js\").Message;\n text: string;\n context: import(\"../../a2a/types.js\").A2AHandlerContext;\n userEmail: string | undefined;\n }) =>\n | import(\"../../a2a/types.js\").Message\n | string\n | null\n | undefined\n | Promise<import(\"../../a2a/types.js\").Message | string | null | undefined>;\n /**\n * Optional injectable prompt examples for core rules (rule 5 auto-refresh\n * examples and rule 8 external provider names). When absent, generic\n * placeholders are used so no template-specific names appear in the core\n * prompt by default.\n *\n * - `providerActions`: external provider action names this template exposes\n * (e.g. `[\"warehouse-query\", \"crm-records\"]` for a template).\n * - `appActions`: representative template action names for rule 5's refresh\n * examples (e.g. `[\"log-meal\", \"update-form\"]` for a forms template).\n */\n promptExamples?: PromptExamples;\n /**\n * Curated allow-list of action names to serve external **connector** clients\n * on a hosted multi-tenant deployment.\n *\n * Whenever this list is non-empty it is active by default for **every**\n * caller (hosted connectors, code/stdio clients, and the local CLI): external\n * MCP clients see (and can call) only these actions plus the builtin\n * cross-app tools (`list_apps`, `open_app`, `ask_app`, `create_embed_session`).\n * Calls to any tool outside the list are rejected with \"Unknown tool\".\n * This prevents the full ~105-tool catalog from bloating external-agent\n * context windows and removes footguns (db-exec, seed-*, extension suite,\n * browser-session tools) from connectors. It is no longer gated behind an\n * environment variable, and the catalog is never inferred from the client.\n *\n * `tool-search` stays available for discovery; a trimmed action still needs\n * the connector catalog, authenticated-read policy, or full-catalog opt-in\n * before an external caller can execute it.\n * Callers who need the full surface up front opt in explicitly with\n * `agent-native connect --full-catalog` (embeds a `catalog_scope: \"full\"`\n * claim in their connect-minted JWT) or the deployment-wide\n * `AGENT_NATIVE_MCP_FULL_CATALOG=1` env override.\n *\n * Declare here rather than in MCPConfig directly; the plugin copies it through.\n */\n connectorCatalog?: string[];\n\n /**\n * Default authenticated external-agent policy. In `auto` read mode, every\n * action explicitly marked as GET + readOnly + publicAgent.requiresAuth is\n * added to the connector surface automatically. Writes remain ask_app-only\n * unless `writes: \"allowlisted\"` is explicitly selected.\n */\n externalAgents?: ExternalAgentPolicy;\n\n /**\n * Skip mounting the remote MCP protocol route.\n *\n * Most apps should leave this off so agent chat, A2A, and MCP share one\n * runtime. Hosted apps with a dedicated early MCP plugin can set this to\n * true so their external connector does not depend on the heavier chat\n * plugin initialization path.\n */\n disableMcp?: boolean;\n\n /**\n * Code-execution capability for the production agent.\n *\n * - `\"off\"` (default) — no code-execution tools in production.\n * - `\"sandboxed\"` — registers the `run-code` tool (isolated Node.js sandbox\n * with a bridge to allowlisted registered tools). Safe for shared or\n * hosted deployments.\n * - `\"trusted\"` — registers both the full coding tool registry\n * (bash / read / edit / write) and the `run-code` sandbox. Only use in\n * single-tenant or operator-controlled deployments where full shell access\n * to the host machine is intentional.\n *\n * The `AGENT_PROD_CODE_EXECUTION` environment variable (`\"trusted\"`,\n * `\"sandboxed\"`, or `\"off\"`) takes precedence over this option, allowing\n * per-deployment overrides without code changes.\n *\n * Dev-mode behavior is unchanged — both the coding tools and `run-code` are\n * always available when the environment allows toggling.\n */\n codeExecution?: {\n production?: \"off\" | \"sandboxed\" | \"trusted\";\n /**\n * Extra registered-tool names the sandbox bridge may forward (beyond the\n * default allowlist: provider-api-request, provider-api-docs,\n * provider-api-catalog, web-request).\n */\n bridgeTools?: string[];\n };\n\n /**\n * App-level default tool-call limits. Individual actions override these with\n * their own `timeoutMs` / `maxResultChars` declarations.\n */\n toolLimits?: { timeoutMs?: number; maxResultChars?: number };\n}\n"]}
1
+ {"version":3,"file":"plugin-options.js","sourceRoot":"","sources":["../../../src/server/agent-chat/plugin-options.ts"],"names":[],"mappings":"","sourcesContent":["import type { ActionEntry } from \"../../agent/production-agent.js\";\nimport type { AgentLoopFinalResponseGuard } from \"../../agent/production-agent.js\";\nimport type {\n AgentChatAttachment,\n AgentChatReference,\n MentionProvider,\n} from \"../../agent/types.js\";\nimport type { ExternalAgentPolicy } from \"../../mcp/external-agent-policy.js\";\nimport type { DatabaseToolsOption } from \"../../scripts/db/tool-mode.js\";\nimport type { PromptExamples } from \"../prompts/index.js\";\n\n/** Shape of a Nitro plugin function: receives the Nitro app instance at\n * startup and may register routes/hooks synchronously or asynchronously. */\nexport type NitroPluginDef = (nitroApp: any) => void | Promise<void>;\n\nexport interface AgentChatPluginOptions {\n /** Template-specific actions (email ops, booking ops, etc.) */\n actions?:\n | Record<string, ActionEntry>\n | (() =>\n | Record<string, ActionEntry>\n | Promise<Record<string, ActionEntry>>);\n /** @deprecated Use `actions` instead */\n scripts?:\n | Record<string, ActionEntry>\n | (() =>\n | Record<string, ActionEntry>\n | Promise<Record<string, ActionEntry>>);\n /** System prompt for the agent. A sensible default is provided. */\n systemPrompt?: string;\n /** Additional system prompt prepended in dev mode */\n devSystemPrompt?: string;\n /** Model to use. Defaults to the resolved engine's default model. */\n model?: string;\n /** Optional per-app agent run chunk budget in milliseconds. Defaults to\n * AGENT_RUN_SOFT_TIMEOUT_MS when set, otherwise no framework-imposed\n * timeout. When reached, long runs continue through the hidden continuation\n * path instead of surfacing a timeout warning. */\n runSoftTimeoutMs?: number;\n /** Optional per-app run-manager no-progress watchdog in milliseconds. */\n runNoProgressTimeoutMs?: number;\n /**\n * Opt this app into Netlify durable background-function agent-chat runs. This\n * gives hosted agent turns the 15-minute async-function budget when the app's\n * Netlify build also emits the background function. Set this to `false` to\n * explicitly disable a stale deploy-wide `AGENT_CHAT_DURABLE_BACKGROUND`\n * flag for this app.\n */\n durableBackgroundRuns?: boolean;\n /** Anthropic API key. Falls back to ANTHROPIC_API_KEY env var */\n apiKey?: string;\n /**\n * Agent engine to use. Can be a pre-constructed AgentEngine, a registered\n * engine name (e.g. \"anthropic\", \"ai-sdk:openai\"), or an object with name\n * and config. Defaults to the \"anthropic\" engine using ANTHROPIC_API_KEY.\n */\n engine?:\n | import(\"../../agent/engine/types.js\").AgentEngine\n | string\n | { name: string; config: Record<string, unknown> };\n /** Route path. Default: /_agent-native/agent-chat */\n path?: string;\n /** Custom mention providers for @-tagging template entities */\n mentionProviders?:\n | Record<string, MentionProvider>\n | (() =>\n | Record<string, MentionProvider>\n | Promise<Record<string, MentionProvider>>);\n /** App ID used to exclude self from agent discovery (e.g., \"mail\", \"calendar\") */\n appId?: string;\n /** Optional MCP server branding surfaced during the initialize handshake. */\n mcpServerInfo?: {\n /** Human-facing title. Defaults to the capitalized app id/name. */\n title?: string;\n /** Host-facing description. Defaults to \"Agent-native <app> agent\". */\n description?: string;\n /** Canonical app URL. Relative URLs are resolved against the request origin. */\n websiteUrl?: string;\n /** App icons. Relative `src` values are resolved against the request origin. */\n icons?: Array<{\n src: string;\n mimeType?: string;\n sizes?: string[];\n theme?: \"light\" | \"dark\";\n }>;\n };\n /**\n * Optional callback to resolve the org ID for the current request.\n * When provided, the resolved value is set as AGENT_ORG_ID env var so\n * that db-query/db-exec automatically scope by org_id in addition to\n * owner_email.\n *\n * If not provided, the framework automatically uses `session.orgId` from\n * Better Auth's active organization. Only provide this callback when you\n * need custom org resolution logic (e.g., Atlassian org mapping).\n */\n resolveOrgId?: (event: any) => string | null | Promise<string | null>;\n /**\n * Optional owner resolver for public/anonymous chat surfaces. When the\n * normal app session is missing, this callback may return a synthetic\n * owner id for a narrowly-scoped public request (for example, a public\n * shared document page). Anonymous requests use a read-only tool set by\n * default so public viewers cannot mutate app data through the agent.\n */\n anonymousOwner?: (event: any) => string | null | Promise<string | null>;\n /**\n * Keep anonymous-owner requests on read-only template actions. Defaults to\n * true. Only disable for single-tenant apps that intentionally allow public\n * agent mutations.\n */\n anonymousReadOnly?: boolean;\n /**\n * Optional auth adapter for the HTTP action route\n * (`/_agent-native/actions/*`). Its `resolveCaller` runs before the\n * cookie/bearer `getSession` chain, letting an app accept caller identities\n * `getSession` doesn't understand (e.g. an A2A JWT verified with\n * `verifyA2AToken`) declaratively, instead of pre-seeding request context\n * from a Nitro `request` hook.\n *\n * Returning `null` defers to the normal chain; THROWING hard-rejects with a\n * 401 (an invalid/forged credential must not fall through to a same-origin\n * session cookie). A resolved caller's org comes exclusively from the\n * verified credential — the returned `orgId` or the owner-email membership\n * lookup — never from the request's session cookie.\n * See {@link import(\"../action-routes.js\").ActionRouteAuthAdapter}.\n */\n actionRouteAuth?: import(\"../action-routes.js\").ActionRouteAuthAdapter;\n /**\n * Optional callback to append template-specific context to the system\n * prompt on each request. Runs after AGENTS.md / skills / memory are\n * loaded and before the schema block — use it to inject dynamic SQL\n * context like a data dictionary, active feature flags, or whatever\n * the agent should know about *right now* for this user/org.\n *\n * Return `null` or an empty string to skip. The string you return is\n * appended verbatim, so wrap it in your own XML tags (e.g.\n * `<data-dictionary>…</data-dictionary>`) to keep the prompt scannable.\n *\n * Called on every request in every prompt variant (lean, lazy, full).\n * Templates that want to suppress it in a particular mode should return\n * `null` from the callback based on their own logic.\n */\n extraContext?: (\n event: any,\n owner: string,\n ) => string | null | Promise<string | null>;\n /**\n * Optional final-answer guard. Templates can use this to require a\n * corrective retry before accepting a text-only final answer, e.g. forcing\n * real data-source tool calls for analytics requests.\n */\n finalResponseGuard?: AgentLoopFinalResponseGuard;\n /**\n * Optional per-template request normalizer. Runs after authentication and\n * before the model sees the message, so apps can translate chat attachments\n * into template-native file handles while preserving the user's visible text.\n */\n prepareRequest?: (details: {\n event: any;\n ownerEmail: string | null;\n message: string;\n displayMessage?: string;\n attachments: AgentChatAttachment[];\n references: AgentChatReference[];\n threadId?: string;\n internalContinuation?: boolean;\n mode: \"act\" | \"plan\";\n }) =>\n | void\n | {\n message?: string;\n displayMessage?: string;\n attachments?: AgentChatAttachment[];\n }\n | Promise<void | {\n message?: string;\n displayMessage?: string;\n attachments?: AgentChatAttachment[];\n }>;\n /**\n * Use ONLY the template's `systemPrompt` and the actions list — skip the\n * framework prompt wrapper, resource loading (AGENTS.md/LEARNINGS.md/\n * memory), the SQL schema block, and the workspace files/skills/agents\n * inventory. Intended for minimal or voice-first apps where a long,\n * generic preamble adds latency and iteration noise without adding value.\n *\n * When set, the same lean prompt is used in both dev and prod modes. In\n * dev mode the tool registry is ALSO swapped to the template's actions\n * (same set as prod) — the dev-only bash/db-exec/file-system tools\n * and the resource/docs/chat/team/job/browser scripts are dropped. The\n * lean system prompt has no bash-usage guidance, so routing actions\n * through bash would break. If you need the full dev tool surface,\n * leave this off.\n */\n leanPrompt?: boolean;\n /**\n * Skip auto-injecting the workspace files/skills/agents inventory on the\n * first message of a conversation while keeping the normal prompt, resources,\n * and tool surface. Use this for domain-focused apps where broad workspace\n * inventory is mostly latency/noise unless the user explicitly references it.\n *\n * `leanPrompt: true` and the default `lazyContext` mode imply this because\n * those catalogs are already discoverable through resources, docs-search,\n * tool-search, and the compact resource indexes. Set `false` explicitly only\n * when a workspace-wide inventory is central to the app's first-turn job.\n */\n skipFilesContext?: boolean;\n /**\n * Initial native tool schemas to send to the LLM provider. When set, the\n * agent starts with only these tools plus `tool-search`; the live registry\n * remains searchable, and matching schemas from `tool-search` results are\n * loaded into the next model request. Use this for domain-focused apps that\n * have a few common actions and many rare framework utilities. Common\n * discovery and resource-reading tools are promoted automatically when\n * present. Provider, MCP, extension, and code-execution schemas stay behind\n * tool-search unless the app explicitly includes them in this list.\n */\n initialToolNames?: string[];\n /**\n * Controls whether broad provider/corpus tools and their workflow prompt are\n * loaded into the first model request. Use `\"lazy\"` for apps that can answer\n * ordinary lookups from a compact curated tool set; corpus tools remain\n * discoverable through tool-search and the full retry surface.\n *\n * @default \"initial\"\n */\n corpusTools?: \"initial\" | \"lazy\";\n /**\n * Use a compact system prompt with on-demand context loading. The system\n * prompt includes essential behavioral rules and action signatures, but\n * defers verbose framework details, SQL schema, skills, learnings, and\n * memory behind tools (`get-framework-context`, `db-schema`,\n * `resources` (action: read)). The agent fetches these on-demand when needed.\n *\n * This reduces the system prompt by ~60-70%, significantly improving\n * time-to-first-token and reducing \"thinking\" time. The agent retains\n * all capabilities — it just loads context lazily instead of upfront.\n *\n * Defaults to `true`. Set to `false` to use the original full prompt.\n * Ignored when `leanPrompt` is set (lean mode is even more minimal).\n */\n lazyContext?: boolean;\n /**\n * In dev mode, register the template's actions as native tools the agent\n * can call directly with structured JSON args — skipping the default\n * `bash(command=\"pnpm action <name> ...\")` indirection.\n *\n * The default dev behavior shells out because it \"mirrors how Claude Code\n * works locally\" and reduces empty-object tool calls for templates with\n * simple string args. But templates whose actions take structured data\n * (objects, arrays, nested JSON) can't round-trip those cleanly through\n * the CLI parser — stringified JSON on the way in, loss of type fidelity\n * on the way out.\n *\n * Set to `true` to get the same tool surface in dev that production uses.\n * `leanPrompt: true` implies this already (lean mode has no bash-usage\n * guidance, so actions must be native). Set this flag without\n * `leanPrompt` when you want native actions AND the full system prompt.\n *\n * Defaults to `false`.\n */\n nativeActionsInDev?: boolean;\n /**\n * Expose raw SQL/native database tools to the app agent.\n *\n * Defaults to `\"read\"`: `db-schema`/`db-query` are available for inspection,\n * while writes route through typed app actions. Set to `\"write\"` (also\n * `true`) to expose `db-exec`/`db-patch` for scoped raw SQL maintenance.\n * Set to `\"off\"` (also `false`) for chat-first apps that want agents to use\n * typed actions only.\n */\n databaseTools?: DatabaseToolsOption;\n /**\n * Expose framework extension management actions (`create-extension`,\n * `update-extension`, `list-extensions`, etc.) to the app agent. Defaults to\n * false. Set to true for apps that intentionally let the LLM create or\n * manage sandboxed extension mini-apps. Core extension routes may still be\n * mounted for compatibility and app-owned surfaces.\n */\n extensionTools?: boolean;\n /**\n * Optional A2A-only deterministic response path. Runs after inbound A2A text\n * and user context are resolved, but before an agent engine/model is loaded.\n * Return a message to complete the A2A task without invoking the LLM, or\n * null/undefined to continue through the normal agent loop.\n */\n a2aMessageFallback?: (details: {\n message: import(\"../../a2a/types.js\").Message;\n text: string;\n context: import(\"../../a2a/types.js\").A2AHandlerContext;\n userEmail: string | undefined;\n }) =>\n | import(\"../../a2a/types.js\").Message\n | string\n | null\n | undefined\n | Promise<import(\"../../a2a/types.js\").Message | string | null | undefined>;\n /**\n * Optional injectable prompt examples for core rules (rule 5 auto-refresh\n * examples and rule 8 external provider names). When absent, generic\n * placeholders are used so no template-specific names appear in the core\n * prompt by default.\n *\n * - `providerActions`: external provider action names this template exposes\n * (e.g. `[\"warehouse-query\", \"crm-records\"]` for a template).\n * - `appActions`: representative template action names for rule 5's refresh\n * examples (e.g. `[\"log-meal\", \"update-form\"]` for a forms template).\n */\n promptExamples?: PromptExamples;\n /**\n * Curated allow-list of action names to serve external **connector** clients\n * on a hosted multi-tenant deployment.\n *\n * Whenever this list is non-empty it is active by default for **every**\n * caller (hosted connectors, code/stdio clients, and the local CLI): external\n * MCP clients see (and can call) only these actions plus the builtin\n * cross-app tools (`list_apps`, `open_app`, `ask_app`, `create_embed_session`).\n * Calls to any tool outside the list are rejected with \"Unknown tool\".\n * This prevents the full ~105-tool catalog from bloating external-agent\n * context windows and removes footguns (db-exec, seed-*, extension suite,\n * browser-session tools) from connectors. It is no longer gated behind an\n * environment variable, and the catalog is never inferred from the client.\n *\n * `tool-search` stays available for discovery; a trimmed action still needs\n * the connector catalog, authenticated-read policy, or full-catalog opt-in\n * before an external caller can execute it.\n * Callers who need the full surface up front opt in explicitly with\n * `agent-native connect --full-catalog` (embeds a `catalog_scope: \"full\"`\n * claim in their connect-minted JWT) or the deployment-wide\n * `AGENT_NATIVE_MCP_FULL_CATALOG=1` env override.\n *\n * Declare here rather than in MCPConfig directly; the plugin copies it through.\n */\n connectorCatalog?: string[];\n\n /**\n * Default authenticated external-agent policy. In `auto` read mode, every\n * action explicitly marked as GET + readOnly + publicAgent.requiresAuth is\n * added to the connector surface automatically. Writes remain ask_app-only\n * unless `writes: \"allowlisted\"` is explicitly selected.\n */\n externalAgents?: ExternalAgentPolicy;\n\n /**\n * Skip mounting the remote MCP protocol route.\n *\n * Most apps should leave this off so agent chat, A2A, and MCP share one\n * runtime. Hosted apps with a dedicated early MCP plugin can set this to\n * true so their external connector does not depend on the heavier chat\n * plugin initialization path.\n */\n disableMcp?: boolean;\n\n /**\n * Code-execution capability for the production agent.\n *\n * - `\"off\"` (default) — no code-execution tools in production.\n * - `\"sandboxed\"` — registers the `run-code` tool (isolated Node.js sandbox\n * with a bridge to allowlisted registered tools). Safe for shared or\n * hosted deployments.\n * - `\"trusted\"` — registers both the full coding tool registry\n * (bash / read / edit / write) and the `run-code` sandbox. Only use in\n * single-tenant or operator-controlled deployments where full shell access\n * to the host machine is intentional.\n *\n * The `AGENT_PROD_CODE_EXECUTION` environment variable (`\"trusted\"`,\n * `\"sandboxed\"`, or `\"off\"`) takes precedence over this option, allowing\n * per-deployment overrides without code changes.\n *\n * Dev-mode behavior is unchanged — both the coding tools and `run-code` are\n * always available when the environment allows toggling.\n */\n codeExecution?: {\n production?: \"off\" | \"sandboxed\" | \"trusted\";\n /**\n * Extra registered-tool names the sandbox bridge may forward (beyond the\n * default allowlist: provider-api-request, provider-api-docs,\n * provider-api-catalog, web-request).\n */\n bridgeTools?: string[];\n };\n\n /**\n * App-level default tool-call limits. Individual actions override these with\n * their own `timeoutMs` / `maxResultChars` declarations.\n */\n toolLimits?: { timeoutMs?: number; maxResultChars?: number };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"script-entries.d.ts","sourceRoot":"","sources":["../../../src/server/agent-chat/script-entries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAQnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAyDvE;;;;;;;;;;GAUG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,GAAE,iBAA0B,EAChC,OAAO,GAAE;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAO,GACzC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAkJtC;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CACtD,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAC5B,CA2EA;AAED;;GAEG;AACH,wBAAgB,qCAAqC,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAW3E;AAED,wBAAsB,2BAA2B,IAAI,OAAO,CAC1D,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAC5B,CAuPA;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CACtD,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAC5B,CAqJA;AAED;;;GAGG;AACH,wBAAsB,8BAA8B,CAClD,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAqBtC;AAED;;;GAGG;AACH,wBAAsB,oCAAoC,IAAI,OAAO,CACnE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAC5B,CAUA;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,CAC9C,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAwBtC"}
1
+ {"version":3,"file":"script-entries.d.ts","sourceRoot":"","sources":["../../../src/server/agent-chat/script-entries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAQnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAyDvE;;;;;;;;;;GAUG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,GAAE,iBAA0B,EAChC,OAAO,GAAE;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAO,GACzC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAkJtC;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CACtD,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAC5B,CA2EA;AAED;;GAEG;AACH,wBAAgB,qCAAqC,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAW3E;AAED,wBAAsB,2BAA2B,IAAI,OAAO,CAC1D,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAC5B,CAkQA;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CACtD,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAC5B,CA0JA;AAED;;;GAGG;AACH,wBAAsB,8BAA8B,CAClD,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CA0BtC;AAED;;;GAGG;AACH,wBAAsB,oCAAoC,IAAI,OAAO,CACnE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAC5B,CAUA;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,CAC9C,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAsDtC"}
@@ -54,7 +54,7 @@ export async function createDbScriptEntries(mode = "read", options = {}) {
54
54
  try {
55
55
  if (mode === "off")
56
56
  return {};
57
- const extensionQueryGuidance = options.extensionTools === false
57
+ const extensionQueryGuidance = options.extensionTools !== true
58
58
  ? "Extension management tools are disabled for this app; do not query or mutate the legacy tools table as a workaround."
59
59
  : "For extension management, use list-extensions, update-extension, hide-extension, or delete-extension instead of querying the legacy tools table.";
60
60
  const [schemaMod, queryMod] = await Promise.all([
@@ -337,6 +337,15 @@ export async function createResourceScriptEntries() {
337
337
  required: ["action"],
338
338
  },
339
339
  },
340
+ planMode: {
341
+ effect: (args) => args.action === "list" ||
342
+ args.action === "read" ||
343
+ args.action === "effective"
344
+ ? "read"
345
+ : "write",
346
+ allowedValues: { action: ["list", "read", "effective"] },
347
+ description: "Plan mode allows listing and reading workspace resources.",
348
+ },
340
349
  run: async (args) => {
341
350
  const { action: a, ...rest } = args;
342
351
  if (a === "list")
@@ -539,6 +548,11 @@ export async function createChatScriptEntries() {
539
548
  required: ["action"],
540
549
  },
541
550
  },
551
+ planMode: {
552
+ effect: (args) => (args.action === "search" ? "read" : "write"),
553
+ allowedValues: { action: ["search"] },
554
+ description: "Plan mode allows searching chat history.",
555
+ },
542
556
  run: async (args) => {
543
557
  if (args?.action === "open") {
544
558
  return openEntry.run(args);
@@ -601,6 +615,11 @@ export async function createAgentEngineScriptEntries(appId) {
601
615
  return {
602
616
  "manage-agent-engine": {
603
617
  tool: mod.tool,
618
+ planMode: {
619
+ effect: (args) => (args.action === "list" ? "read" : "write"),
620
+ allowedValues: { action: ["list"] },
621
+ description: "Plan mode allows listing available agent engines.",
622
+ },
604
623
  run: (args) => mod.run({
605
624
  ...args,
606
625
  appId: typeof args.appId === "string" && args.appId.trim()
@@ -639,6 +658,28 @@ export async function createCallAgentScriptEntry(selfAppId) {
639
658
  const mod = await import("../../scripts/call-agent.js");
640
659
  entries["call-agent"] = {
641
660
  tool: mod.tool,
661
+ planMode: {
662
+ effect: (args) => {
663
+ const keys = Object.keys(args);
664
+ if (keys.some((key) => key !== "agent" && key !== "action" && key !== "input")) {
665
+ return "write";
666
+ }
667
+ if (typeof args.agent !== "string" ||
668
+ !args.agent.trim() ||
669
+ typeof args.action !== "string" ||
670
+ !args.action.trim() ||
671
+ !Object.hasOwn(args, "input") ||
672
+ args.input === null ||
673
+ typeof args.input !== "object" ||
674
+ Array.isArray(args.input)) {
675
+ return "unknown";
676
+ }
677
+ return "read";
678
+ },
679
+ allowedProperties: ["agent", "action", "input"],
680
+ requiredProperties: ["agent", "action"],
681
+ description: "Plan mode allows only exact read-only cross-app action calls with agent, action, and input.",
682
+ },
642
683
  run: (args, context) => mod.run(args, context, selfAppId),
643
684
  };
644
685
  }
@@ -650,6 +691,7 @@ export async function createCallAgentScriptEntry(selfAppId) {
650
691
  entries["describe-workspace-apps"] = {
651
692
  tool: mod.tool,
652
693
  run: (args, context) => mod.run(args, context, selfAppId),
694
+ readOnly: true,
653
695
  };
654
696
  }
655
697
  catch {
@@ -1 +1 @@
1
- {"version":3,"file":"script-entries.js","sourceRoot":"","sources":["../../../src/server/agent-chat/script-entries.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,GAChB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAE/B,8EAA8E;AAC9E,qEAAqE;AACrE,0EAA0E;AAC1E,2EAA2E;AAC3E,sEAAsE;AACtE,8EAA8E;AAE9E;;;;;GAKG;AACH,SAAS,aAAa,CACpB,IAAgB,EAChB,UAA6C,EAC7C,IAGC;IAED,OAAO;QACL,IAAI;QACJ,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACtD,GAAG,EAAE,KAAK,EAAE,IAA4B,EAAmB,EAAE;YAC3D,MAAM,OAAO,GAAa,EAAE,CAAC;YAC7B,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC1C,kEAAkE;gBAClE,uEAAuE;gBACvE,uEAAuE;gBACvE,sEAAsE;gBACtE,wDAAwD;gBACxD,IAAI,IAAI,EAAE,WAAW,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;oBACvD,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,EAA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0CAA0C,CAAC,CAAC;QACrE,OAAO,CAAC,yBAAyB,CAAC,GAAG;YACnC,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,GAAG,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC;SAC1D,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,4DAA4D;IAC9D,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import type { ActionEntry } from \"../../agent/production-agent.js\";\nimport type { ActionTool } from \"../../agent/types.js\";\nimport {\n renameThread,\n resolveThreadAccess,\n setThreadArchived,\n setThreadPinned,\n} from \"../../chat-threads/store.js\";\nimport type { DatabaseToolsMode } from \"../../scripts/db/tool-mode.js\";\nimport { dbExecToolParameters } from \"../../scripts/db/tool-schemas.js\";\nimport { captureCliOutput } from \"../cli-capture.js\";\nimport {\n getAmbientUserEmail,\n getRequestOrgId,\n getRequestRunContext,\n getRequestUserEmail,\n} from \"../request-context.js\";\n\n// ---------------------------------------------------------------------------\n// CLI-script-backed action entries: db-*, docs-search/source-search,\n// resources/save-memory/delete-memory, chat-history, manage-agent-engine,\n// manage-agent-loop-settings, and call-agent. Each wraps a core CLI script\n// (that writes to console.log) as an ActionEntry via `wrapCliScript`.\n// ---------------------------------------------------------------------------\n\n/**\n * Wraps a core CLI script (that writes to console.log) as a ActionEntry\n * by capturing stdout. Uses an AsyncLocalStorage-backed capture so\n * concurrent tool calls do not corrupt the global console/stdout pointers\n * (see `cli-capture.ts`).\n */\nfunction wrapCliScript(\n tool: ActionTool,\n cliDefault: (args: string[]) => Promise<void>,\n opts?: {\n allowedArgs?: readonly string[];\n readOnly?: boolean;\n },\n): ActionEntry {\n return {\n tool,\n ...(opts?.readOnly ? { readOnly: true as const } : {}),\n run: async (args: Record<string, string>): Promise<string> => {\n const cliArgs: string[] = [];\n for (const [k, v] of Object.entries(args)) {\n // MCP input schemas are descriptive and some hosts can still send\n // undeclared keys. The externally exposed DB readers must never accept\n // the CLI-only `--db` escape hatch, which could point at another local\n // SQLite file. Keep their runtime surface identical to the advertised\n // schema instead of trusting the client to validate it.\n if (opts?.allowedArgs && !opts.allowedArgs.includes(k)) {\n throw new Error(`Unknown argument: ${k}`);\n }\n const raw = v as unknown;\n const value =\n raw != null && typeof raw === \"object\"\n ? JSON.stringify(raw)\n : String(raw);\n cliArgs.push(`--${k}`, value);\n }\n return captureCliOutput(() => cliDefault(cliArgs));\n },\n };\n}\n\n/**\n * Creates db-* tools (db-query, db-exec, db-patch, db-schema) as native tools.\n * By default these let the agent inspect the app's own SQL database; raw SQL\n * writes are only exposed when the app explicitly opts into write mode.\n * Scoping to the current user/org is enforced automatically in production via\n * temp views.\n *\n * In dev mode template actions are invoked via bash and the agent can call\n * `pnpm action db-query ...` — but in production there is no bash, so these\n * must be registered as native tools for the agent to reach the app DB at all.\n */\nexport async function createDbScriptEntries(\n mode: DatabaseToolsMode = \"read\",\n options: { extensionTools?: boolean } = {},\n): Promise<Record<string, ActionEntry>> {\n try {\n if (mode === \"off\") return {};\n const extensionQueryGuidance =\n options.extensionTools === false\n ? \"Extension management tools are disabled for this app; do not query or mutate the legacy tools table as a workaround.\"\n : \"For extension management, use list-extensions, update-extension, hide-extension, or delete-extension instead of querying the legacy tools table.\";\n const [schemaMod, queryMod] = await Promise.all([\n import(\"../../scripts/db/schema.js\"),\n import(\"../../scripts/db/query.js\"),\n ]);\n const [execMod, patchMod] =\n mode === \"write\"\n ? await Promise.all([\n import(\"../../scripts/db/exec.js\"),\n import(\"../../scripts/db/patch.js\"),\n ])\n : [null, null];\n\n const entries: Record<string, ActionEntry> = {\n \"db-schema\": wrapCliScript(\n {\n description:\n \"Show the app's SQL schema — all tables, columns, types, indexes, and foreign keys. Use this to understand the data model before querying.\",\n parameters: {\n type: \"object\",\n properties: {\n format: {\n type: \"string\",\n description: 'Output format: \"json\" or \"text\" (default: text)',\n enum: [\"json\", \"text\"],\n },\n },\n },\n },\n schemaMod.default,\n {\n allowedArgs: [\"format\"],\n readOnly: true,\n },\n ),\n \"db-query\": wrapCliScript(\n {\n description: `Read from the app's own SQL database ONLY. Runs a SELECT against the app's internal tables (settings, application_state, template tables). Results are auto-scoped to the current user/org. IMPORTANT: This tool CANNOT access external data sources like data warehouses, CRMs, issue trackers, analytics platforms, calendars, mail, docs, or other third-party services. For those, use the relevant template/provider action, MCP connector, or provider-api-catalog/provider-api-docs/provider-api-request when available. If the user names a provider, that named provider wins; do not substitute a warehouse or app database copy unless they explicitly ask for it. If a table isn't in the app schema, don't try db-query — use the data-source-specific action. ${extensionQueryGuidance}`,\n parameters: {\n type: \"object\",\n properties: {\n sql: {\n type: \"string\",\n description:\n \"SELECT query to run, e.g. \\\"SELECT key, value FROM settings WHERE key LIKE 'sql-dashboard-%'\\\"\",\n },\n args: {\n type: \"string\",\n description:\n 'Optional JSON array of positional bind args for parameterized placeholders. Example: \\'[\"draft\",\"form-123\"]\\'',\n },\n format: {\n type: \"string\",\n description: 'Output format: \"json\" or \"text\" (default: text)',\n enum: [\"json\", \"text\"],\n },\n limit: {\n type: \"string\",\n description:\n \"Append LIMIT N if the query doesn't already have one\",\n },\n },\n required: [\"sql\"],\n },\n },\n queryMod.default,\n {\n allowedArgs: [\"sql\", \"args\", \"format\", \"limit\"],\n readOnly: true,\n },\n ),\n };\n\n if (execMod && patchMod) {\n entries[\"db-exec\"] = wrapCliScript(\n {\n description:\n \"Write to the app's own SQL database ONLY. Runs INSERT / UPDATE / DELETE / REPLACE against the app's internal tables. For multiple related writes, pass `statements` so they run sequentially in one transaction instead of issuing several db-exec calls. Writes are auto-scoped to the current user/org, and `owner_email` / `org_id` are auto-injected on INSERT. Schema changes (CREATE/ALTER/DROP) are blocked. Never use this to backfill missing data for a read/analysis request or to create/modify users, members, roles, permissions, admin flags, or ownership; use a dedicated app action or reviewed code. IMPORTANT: This tool CANNOT write to external data sources like BigQuery, HubSpot, etc. For external services, use the appropriate template action.\",\n parameters: dbExecToolParameters(),\n },\n execMod.default,\n );\n entries[\"db-patch\"] = wrapCliScript(\n {\n description:\n \"Surgical patch on a large text/JSON column in the app's SQL database. Two modes: (1) text find/replace via `find`/`replace`/`edits` — best for small edits to documents, slide HTML, etc. (2) structural JSON ops via `json-ops` — STRONGLY PREFERRED when the column is JSON (dashboard configs, form schemas, slide decks) because it avoids all the brace/quote/comma surgery that text find/replace requires. Use `json-ops` to set/remove values at a JSON Pointer path, or to move/insert array items — e.g. reorder dashboard panels, add a filter, rename a field. Targets exactly one row (narrow `where` by primary key). Same per-user/org scoping as db-exec.\",\n parameters: {\n type: \"object\",\n properties: {\n table: {\n type: \"string\",\n description: \"Table name (e.g. 'settings')\",\n },\n column: {\n type: \"string\",\n description:\n \"Text/JSON column to patch (e.g. 'value' for settings)\",\n },\n where: {\n type: \"string\",\n description:\n \"WHERE clause that matches exactly one row (e.g. \\\"key = 'o:org1:sql-dashboard-foo'\\\")\",\n },\n find: {\n type: \"string\",\n description:\n \"Text mode: substring to find. Must match EXACTLY ONE occurrence by default (like Claude Code's Edit tool). If 0 matches, you get 'NOT FOUND'. If >1 matches, you get surrounding context for each match — widen `find` with unique context and retry. Use `all: \\\"true\\\"` to replace every occurrence.\",\n },\n replace: {\n type: \"string\",\n description: \"Text mode: replacement substring\",\n },\n edits: {\n type: \"string\",\n description:\n 'Text mode batch: JSON array of {find, replace} pairs. Same uniqueness rule applies to each `find`. Example: \\'[{\"find\":\"a\",\"replace\":\"b\"}]\\'',\n },\n \"json-ops\": {\n type: \"string\",\n description:\n 'JSON mode: JSON array of structural ops. Each op is {op, path, value?, from?}. `op` is one of \"set\", \"remove\", \"insert\", \"move\", \"move-before\". `path` / `from` use JSON Pointer (\"/panels/3/title\"). Examples — reorder: \\'[{\"op\":\"move\",\"from\":\"/panels/7\",\"path\":\"/panels/1\"}]\\'; edit field: \\'[{\"op\":\"set\",\"path\":\"/panels/0/title\",\"value\":\"New\"}]\\'; delete filter: \\'[{\"op\":\"remove\",\"path\":\"/filters/2\"}]\\'; add panel: \\'[{\"op\":\"insert\",\"path\":\"/panels/0\",\"value\":{\"id\":\"p\",\"title\":\"...\"}}]\\'. Much safer than text find/replace for JSON columns.',\n },\n all: {\n type: \"string\",\n description:\n 'Text mode: set to \"true\" to replace every occurrence of each `find` (default requires exactly one match)',\n enum: [\"true\"],\n },\n },\n required: [\"table\", \"column\", \"where\"],\n },\n },\n patchMod.default,\n );\n }\n\n return entries;\n } catch {\n return {};\n }\n}\n\n/**\n * Creates read-only package lookup tools so agents can inspect version-matched\n * framework docs and source bundled in @agent-native/core at runtime.\n */\nexport async function createDocsScriptEntries(): Promise<\n Record<string, ActionEntry>\n> {\n const entries: Record<string, ActionEntry> = {};\n\n try {\n const mod = await import(\"../../scripts/docs/search.js\");\n entries[\"docs-search\"] = wrapCliScript(\n {\n description:\n \"Search and read agent-native framework documentation, bundled AGENTS.md, and codebase skills. Use --list to see all pages, --query to search, --slug to read a specific page. Codebase skill pages use slugs like skill-<name>.\",\n parameters: {\n type: \"object\",\n properties: {\n query: {\n type: \"string\",\n description:\n \"Search term to find relevant docs (e.g. 'actions', 'authentication', 'database')\",\n },\n slug: {\n type: \"string\",\n description:\n \"Read a specific doc page by slug (e.g. 'actions', 'authentication', 'database')\",\n },\n list: {\n type: \"string\",\n description: 'Set to \"true\" to list all available doc pages',\n enum: [\"true\"],\n },\n },\n },\n },\n mod.default,\n { readOnly: true },\n );\n } catch {\n // Keep source-search available if docs-search fails during a partial build.\n }\n\n try {\n const mod = await import(\"../../scripts/docs/source-search.js\");\n if (!mod.hasSourceCorpus()) {\n return entries;\n }\n entries[\"source-search\"] = wrapCliScript(\n {\n description:\n \"Search and read the packaged Agent Native source corpus under node_modules/@agent-native/core/corpus. Use --list for sections, --query to search core/template source, and --path to read a file.\",\n parameters: {\n type: \"object\",\n properties: {\n query: {\n type: \"string\",\n description:\n \"Search term to find relevant core or template source (e.g. 'defineAction', 'useActionQuery', 'view-screen').\",\n },\n path: {\n type: \"string\",\n description:\n \"Read a specific corpus file or list a directory (e.g. 'templates/plan/AGENTS.md' or 'core/src/action.ts').\",\n },\n list: {\n type: \"string\",\n description: 'Set to \"true\" to list corpus sections',\n enum: [\"true\"],\n },\n },\n },\n },\n mod.default,\n { readOnly: true },\n );\n } catch {\n // Older package installs may not have the corpus/search script yet.\n }\n\n return entries;\n}\n\n/**\n * Creates resource ScriptEntries available in both prod and dev modes.\n */\nexport function shouldDefaultResourceWriteToWorkspace(path: string): boolean {\n const normalized = path.replace(/^\\/+/, \"\");\n return (\n normalized === \"AGENTS.md\" ||\n normalized === \"LEARNINGS.md\" ||\n normalized.startsWith(\"memory/\") ||\n normalized.startsWith(\"skills/\") ||\n normalized.startsWith(\"jobs/\") ||\n normalized.startsWith(\"agents/\") ||\n normalized.startsWith(\"remote-agents/\")\n );\n}\n\nexport async function createResourceScriptEntries(): Promise<\n Record<string, ActionEntry>\n> {\n try {\n const [list, read, effective, write, del, saveMem, delMem, store] =\n await Promise.all([\n import(\"../../scripts/resources/list.js\"),\n import(\"../../scripts/resources/read.js\"),\n import(\"../../scripts/resources/effective.js\"),\n import(\"../../scripts/resources/write.js\"),\n import(\"../../scripts/resources/delete.js\"),\n import(\"../../scripts/resources/save-memory.js\"),\n import(\"../../scripts/resources/delete-memory.js\"),\n import(\"../../resources/store.js\"),\n ]);\n\n // Wrap each CLI runner so it captures stdout and converts args properly\n const listEntry = wrapCliScript(\n {\n description: \"\",\n parameters: { type: \"object\" as const, properties: {} },\n },\n list.default,\n { readOnly: true },\n );\n const readEntry = wrapCliScript(\n {\n description: \"\",\n parameters: { type: \"object\" as const, properties: {} },\n },\n read.default,\n { readOnly: true },\n );\n const writeEntry = wrapCliScript(\n {\n description: \"\",\n parameters: { type: \"object\" as const, properties: {} },\n },\n write.default,\n );\n const effectiveEntry = wrapCliScript(\n {\n description: \"\",\n parameters: { type: \"object\" as const, properties: {} },\n },\n effective.default,\n { readOnly: true },\n );\n const deleteEntry = wrapCliScript(\n {\n description: \"\",\n parameters: { type: \"object\" as const, properties: {} },\n },\n del.default,\n );\n\n return {\n resources: {\n tool: {\n description:\n 'Manage workspace resources. Actions: \"list\" (browse visible files), \"read\" (get contents), \"effective\" (show workspace -> organization/app -> personal inheritance for a path), \"write\" (create/update personal or shared; workspace only for local file mode control files), \"promote\" (make agent scratch visible), \"delete\" (remove personal or shared; workspace only for local file mode control files). Agent scratch writes are hidden from the Workspace view by default; use visibility=\"workspace\" only for files the user explicitly wants to keep/manage.',\n parameters: {\n type: \"object\",\n properties: {\n action: {\n type: \"string\",\n description: \"The operation to perform\",\n enum: [\n \"list\",\n \"read\",\n \"effective\",\n \"write\",\n \"promote\",\n \"delete\",\n ],\n },\n path: {\n type: \"string\",\n description:\n \"Resource path (e.g. 'LEARNINGS.md', 'notes/ideas.md'). Required for read/write/delete.\",\n },\n content: {\n type: \"string\",\n description: \"Content to write. Required for write.\",\n },\n scope: {\n type: \"string\",\n description:\n \"personal, shared, workspace, or all (default varies by action). Workspace is read-only when inherited from Dispatch; in local file mode AGENTS.md, agent-native.json, mcp.config.json, .mcp.json, and skills/ are writable.\",\n enum: [\"personal\", \"shared\", \"workspace\", \"all\"],\n },\n prefix: {\n type: \"string\",\n description:\n \"Filter by path prefix when listing (e.g. 'notes/')\",\n },\n mime: {\n type: \"string\",\n description:\n \"MIME type for write (default: inferred from extension)\",\n },\n format: {\n type: \"string\",\n description:\n 'Output format for list: \"json\" or \"text\" (default: text)',\n enum: [\"json\", \"text\"],\n },\n visibility: {\n type: \"string\",\n description:\n 'Visibility for write: \"agent_scratch\" for internal working files, \"workspace\" for user-requested files. Defaults to agent_scratch except durable instruction/skill/job/memory paths.',\n enum: [\"workspace\", \"agent_scratch\"],\n },\n includeAgentScratch: {\n type: \"boolean\",\n description: \"Include hidden agent scratch files when listing.\",\n },\n },\n required: [\"action\"],\n },\n },\n run: async (args: Record<string, string>) => {\n const { action: a, ...rest } = args;\n if (a === \"list\") return listEntry.run(rest);\n if (a === \"read\") {\n if (!rest.path) return \"Error: path is required for read\";\n return readEntry.run(rest);\n }\n if (a === \"effective\") {\n if (!rest.path) return \"Error: path is required for effective\";\n return effectiveEntry.run(rest);\n }\n if (a === \"write\") {\n if (\n !rest.path ||\n rest.content === undefined ||\n rest.content === null\n )\n return \"Error: path and content are required for write\";\n rest.createdBy = \"agent\";\n rest.visibility =\n rest.visibility ??\n (shouldDefaultResourceWriteToWorkspace(String(rest.path))\n ? \"workspace\"\n : \"agent_scratch\");\n const runCtx = getRequestRunContext();\n if (runCtx?.threadId) rest.threadId = runCtx.threadId;\n return writeEntry.run(rest);\n }\n if (a === \"promote\") {\n if (!rest.path) return \"Error: path is required for promote\";\n const scope = rest.scope ?? \"personal\";\n if (scope === \"workspace\" || scope === \"all\") {\n return \"Error: promote supports personal or shared scope only\";\n }\n const owner =\n scope === \"shared\"\n ? store.sharedResourceOwner(getRequestOrgId())\n : (getRequestRunContext()?.owner ??\n getRequestUserEmail() ??\n getAmbientUserEmail());\n if (!owner) {\n return \"Error: promote requires an authenticated user\";\n }\n const resource = await store.resourceGetByPath(\n owner,\n String(rest.path),\n );\n if (!resource) {\n return `Resource not found: ${rest.path}`;\n }\n const promoted = await store.resourcePut(\n owner,\n resource.path,\n resource.content,\n resource.mimeType,\n {\n createdBy: resource.createdBy,\n visibility: \"workspace\",\n threadId: resource.threadId,\n runId: resource.runId,\n expiresAt: null,\n metadata: resource.metadata,\n },\n );\n return `Promoted resource: ${promoted.path}`;\n }\n if (a === \"delete\") {\n if (!rest.path) return \"Error: path is required for delete\";\n return deleteEntry.run(rest);\n }\n return `Error: unknown action \"${a}\". Use: list, read, write, promote, delete`;\n },\n },\n \"save-memory\": wrapCliScript(\n {\n description:\n \"Save a memory for future conversations. Creates or updates a memory file and its index entry. Use proactively when you learn preferences, corrections, project context, or references.\",\n parameters: {\n type: \"object\",\n properties: {\n name: {\n type: \"string\",\n description:\n \"Short kebab-case identifier (e.g. 'coding-style', 'deploy-process'). Used as the filename.\",\n },\n type: {\n type: \"string\",\n description: \"Memory category\",\n enum: [\"user\", \"feedback\", \"project\", \"reference\"],\n },\n description: {\n type: \"string\",\n description:\n \"One-line summary shown in the memory index (keep under 80 chars)\",\n },\n content: {\n type: \"string\",\n description:\n \"The memory content in markdown. For updates, read first and provide full updated content.\",\n },\n },\n required: [\"name\", \"type\", \"description\", \"content\"],\n },\n },\n saveMem.default,\n ),\n \"delete-memory\": wrapCliScript(\n {\n description:\n \"Delete a memory entry and remove it from the memory index.\",\n parameters: {\n type: \"object\",\n properties: {\n name: {\n type: \"string\",\n description: \"The memory name to delete (e.g. 'coding-style')\",\n },\n },\n required: [\"name\"],\n },\n },\n delMem.default,\n ),\n };\n } catch {\n // Resources not available — skip silently\n return {};\n }\n}\n\n/**\n * Creates a unified chat-history ActionEntry that dispatches to search, open,\n * rename, or lightweight organization actions.\n */\nexport async function createChatScriptEntries(): Promise<\n Record<string, ActionEntry>\n> {\n try {\n const [searchMod, openMod] = await Promise.all([\n import(\"../../scripts/chat/search-chats.js\"),\n import(\"../../scripts/chat/open-chat.js\"),\n ]);\n\n const searchEntry = wrapCliScript(\n {\n description: \"Search or list past agent chat threads.\",\n parameters: {\n type: \"object\",\n properties: {\n query: {\n type: \"string\",\n description:\n \"Search term to find chats by title, preview, or content\",\n },\n limit: {\n type: \"string\",\n description: \"Max number of results (default: 20)\",\n },\n format: {\n type: \"string\",\n description: \"Output format\",\n enum: [\"json\", \"text\"],\n },\n includeArchived: {\n type: \"boolean\",\n description:\n \"Also include archived chats in the results. Archived chats are excluded by default.\",\n },\n },\n },\n },\n searchMod.default,\n );\n\n const openEntry = wrapCliScript(\n {\n description: \"Open a chat thread in the UI.\",\n parameters: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n description: \"The chat thread ID to open\",\n },\n },\n required: [\"id\"],\n },\n },\n openMod.default,\n );\n\n return {\n \"chat-history\": {\n tool: {\n description:\n \"Manage past agent chat threads. Use action 'search' to find previous conversations by keyword, 'open' to open a thread in the UI, or 'rename'/'pin'/'unpin'/'archive' to organize history.\",\n parameters: {\n type: \"object\",\n properties: {\n action: {\n type: \"string\",\n description: \"The operation to perform\",\n enum: [\"search\", \"open\", \"rename\", \"pin\", \"unpin\", \"archive\"],\n },\n query: {\n type: \"string\",\n description:\n \"(search) Search term to find chats by title, preview, or content\",\n },\n limit: {\n type: \"string\",\n description: \"(search) Max number of results (default: 20)\",\n },\n format: {\n type: \"string\",\n description: \"(search) Output format\",\n enum: [\"json\", \"text\"],\n },\n includeArchived: {\n type: \"boolean\",\n description:\n \"(search) Also include archived chats in the results. Archived chats are excluded by default, matching the 'archive' action's effect on the chat list.\",\n },\n id: {\n type: \"string\",\n description:\n \"(open, rename, pin, unpin, archive) The chat thread ID to manage\",\n },\n title: {\n type: \"string\",\n description: \"(rename) New chat title\",\n },\n },\n required: [\"action\"],\n },\n },\n run: async (args) => {\n if (args?.action === \"open\") {\n return openEntry.run(args);\n }\n if (\n args?.action === \"rename\" ||\n args?.action === \"pin\" ||\n args?.action === \"unpin\" ||\n args?.action === \"archive\"\n ) {\n const id = typeof args?.id === \"string\" ? args.id : \"\";\n if (!id) return \"Missing required id.\";\n const owner =\n getRequestRunContext()?.owner ?? getRequestUserEmail() ?? \"\";\n if (!owner) return \"No authenticated user is available.\";\n const thread = await resolveThreadAccess(owner, id, \"editor\", {\n orgId: getRequestOrgId(),\n });\n if (!thread) {\n return `Chat thread \"${id}\" not found.`;\n }\n const title = thread.title || thread.preview || \"(untitled)\";\n if (args.action === \"rename\") {\n const nextTitle =\n typeof args?.title === \"string\"\n ? args.title.replace(/\\s+/g, \" \").trim().slice(0, 160)\n : \"\";\n if (!nextTitle) return \"Missing required title.\";\n const renamed = await renameThread(id, nextTitle);\n if (!renamed) return `Chat thread \"${id}\" could not be renamed.`;\n return `Renamed chat \"${title}\" to \"${nextTitle}\".`;\n }\n if (args.action === \"archive\") {\n const archived = await setThreadArchived(id, true);\n if (!archived)\n return `Chat thread \"${id}\" could not be archived.`;\n return `Archived chat: ${title}`;\n }\n const pinned = await setThreadPinned(id, args.action === \"pin\");\n if (!pinned) return `Chat thread \"${id}\" could not be updated.`;\n return `${args.action === \"pin\" ? \"Pinned\" : \"Unpinned\"} chat: ${title}`;\n }\n return searchEntry.run(args);\n },\n },\n };\n } catch {\n return {};\n }\n}\n\n/**\n * Creates the consolidated manage-agent-engine tool (list / set / test).\n * Let the agent inspect and configure the active LLM engine.\n */\nexport async function createAgentEngineScriptEntries(\n appId?: string,\n): Promise<Record<string, ActionEntry>> {\n try {\n const mod =\n await import(\"../../scripts/agent-engines/manage-agent-engine.js\");\n\n return {\n \"manage-agent-engine\": {\n tool: mod.tool,\n run: (args) =>\n mod.run({\n ...args,\n appId:\n typeof args.appId === \"string\" && args.appId.trim()\n ? args.appId\n : (appId ?? \"\"),\n }),\n },\n };\n } catch {\n return {};\n }\n}\n\n/**\n * Creates the manage-agent-loop-settings tool. Lets the agent inspect and\n * configure the loop step limit it may hit on long-running work.\n */\nexport async function createAgentLoopSettingsScriptEntries(): Promise<\n Record<string, ActionEntry>\n> {\n try {\n const mod = await import(\"../../scripts/manage-agent-loop-settings.js\");\n\n return {\n \"manage-agent-loop-settings\": { tool: mod.tool, run: mod.run },\n };\n } catch {\n return {};\n }\n}\n\n/**\n * Creates the call-agent ActionEntry for cross-agent A2A communication.\n * Binds selfAppId so the agent cannot call itself via call-agent.\n */\nexport async function createCallAgentScriptEntry(\n selfAppId?: string,\n): Promise<Record<string, ActionEntry>> {\n const entries: Record<string, ActionEntry> = {};\n\n try {\n const mod = await import(\"../../scripts/call-agent.js\");\n entries[\"call-agent\"] = {\n tool: mod.tool,\n run: (args, context) => mod.run(args, context, selfAppId),\n };\n } catch {\n // A missing built-in leaves the rest of the toolset usable.\n }\n\n try {\n const mod = await import(\"../../scripts/describe-workspace-apps.js\");\n entries[\"describe-workspace-apps\"] = {\n tool: mod.tool,\n run: (args, context) => mod.run(args, context, selfAppId),\n };\n } catch {\n // A missing built-in leaves the rest of the toolset usable.\n }\n\n return entries;\n}\n"]}
1
+ {"version":3,"file":"script-entries.js","sourceRoot":"","sources":["../../../src/server/agent-chat/script-entries.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,GAChB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAE/B,8EAA8E;AAC9E,qEAAqE;AACrE,0EAA0E;AAC1E,2EAA2E;AAC3E,sEAAsE;AACtE,8EAA8E;AAE9E;;;;;GAKG;AACH,SAAS,aAAa,CACpB,IAAgB,EAChB,UAA6C,EAC7C,IAGC;IAED,OAAO;QACL,IAAI;QACJ,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACtD,GAAG,EAAE,KAAK,EAAE,IAA4B,EAAmB,EAAE;YAC3D,MAAM,OAAO,GAAa,EAAE,CAAC;YAC7B,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC1C,kEAAkE;gBAClE,uEAAuE;gBACvE,uEAAuE;gBACvE,sEAAsE;gBACtE,wDAAwD;gBACxD,IAAI,IAAI,EAAE,WAAW,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;oBACvD,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,EAAE,CAAC,CAAC;gBAC5C,CAAC;gBACD,MAAM,GAAG,GAAG,CAAY,CAAC;gBACzB,MAAM,KAAK,GACT,GAAG,IAAI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OAAO,SAAS,CAAC;oBACnB,CAAC;oBACD,OAAO,MAAM,CAAC;gBAChB,CAAC;gBACD,iBAAiB,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC;gBAC/C,kBAAkB,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC;gBACvC,WAAW,EACT,6FAA6F;aAChG;YACD,GAAG,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC;SAC1D,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,4DAA4D;IAC9D,CAAC;IAED,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,0CAA0C,CAAC,CAAC;QACrE,OAAO,CAAC,yBAAyB,CAAC,GAAG;YACnC,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,GAAG,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC;YACzD,QAAQ,EAAE,IAAI;SACf,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,4DAA4D;IAC9D,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import type { ActionEntry } from \"../../agent/production-agent.js\";\nimport type { ActionTool } from \"../../agent/types.js\";\nimport {\n renameThread,\n resolveThreadAccess,\n setThreadArchived,\n setThreadPinned,\n} from \"../../chat-threads/store.js\";\nimport type { DatabaseToolsMode } from \"../../scripts/db/tool-mode.js\";\nimport { dbExecToolParameters } from \"../../scripts/db/tool-schemas.js\";\nimport { captureCliOutput } from \"../cli-capture.js\";\nimport {\n getAmbientUserEmail,\n getRequestOrgId,\n getRequestRunContext,\n getRequestUserEmail,\n} from \"../request-context.js\";\n\n// ---------------------------------------------------------------------------\n// CLI-script-backed action entries: db-*, docs-search/source-search,\n// resources/save-memory/delete-memory, chat-history, manage-agent-engine,\n// manage-agent-loop-settings, and call-agent. Each wraps a core CLI script\n// (that writes to console.log) as an ActionEntry via `wrapCliScript`.\n// ---------------------------------------------------------------------------\n\n/**\n * Wraps a core CLI script (that writes to console.log) as a ActionEntry\n * by capturing stdout. Uses an AsyncLocalStorage-backed capture so\n * concurrent tool calls do not corrupt the global console/stdout pointers\n * (see `cli-capture.ts`).\n */\nfunction wrapCliScript(\n tool: ActionTool,\n cliDefault: (args: string[]) => Promise<void>,\n opts?: {\n allowedArgs?: readonly string[];\n readOnly?: boolean;\n },\n): ActionEntry {\n return {\n tool,\n ...(opts?.readOnly ? { readOnly: true as const } : {}),\n run: async (args: Record<string, string>): Promise<string> => {\n const cliArgs: string[] = [];\n for (const [k, v] of Object.entries(args)) {\n // MCP input schemas are descriptive and some hosts can still send\n // undeclared keys. The externally exposed DB readers must never accept\n // the CLI-only `--db` escape hatch, which could point at another local\n // SQLite file. Keep their runtime surface identical to the advertised\n // schema instead of trusting the client to validate it.\n if (opts?.allowedArgs && !opts.allowedArgs.includes(k)) {\n throw new Error(`Unknown argument: ${k}`);\n }\n const raw = v as unknown;\n const value =\n raw != null && typeof raw === \"object\"\n ? JSON.stringify(raw)\n : String(raw);\n cliArgs.push(`--${k}`, value);\n }\n return captureCliOutput(() => cliDefault(cliArgs));\n },\n };\n}\n\n/**\n * Creates db-* tools (db-query, db-exec, db-patch, db-schema) as native tools.\n * By default these let the agent inspect the app's own SQL database; raw SQL\n * writes are only exposed when the app explicitly opts into write mode.\n * Scoping to the current user/org is enforced automatically in production via\n * temp views.\n *\n * In dev mode template actions are invoked via bash and the agent can call\n * `pnpm action db-query ...` — but in production there is no bash, so these\n * must be registered as native tools for the agent to reach the app DB at all.\n */\nexport async function createDbScriptEntries(\n mode: DatabaseToolsMode = \"read\",\n options: { extensionTools?: boolean } = {},\n): Promise<Record<string, ActionEntry>> {\n try {\n if (mode === \"off\") return {};\n const extensionQueryGuidance =\n options.extensionTools !== true\n ? \"Extension management tools are disabled for this app; do not query or mutate the legacy tools table as a workaround.\"\n : \"For extension management, use list-extensions, update-extension, hide-extension, or delete-extension instead of querying the legacy tools table.\";\n const [schemaMod, queryMod] = await Promise.all([\n import(\"../../scripts/db/schema.js\"),\n import(\"../../scripts/db/query.js\"),\n ]);\n const [execMod, patchMod] =\n mode === \"write\"\n ? await Promise.all([\n import(\"../../scripts/db/exec.js\"),\n import(\"../../scripts/db/patch.js\"),\n ])\n : [null, null];\n\n const entries: Record<string, ActionEntry> = {\n \"db-schema\": wrapCliScript(\n {\n description:\n \"Show the app's SQL schema — all tables, columns, types, indexes, and foreign keys. Use this to understand the data model before querying.\",\n parameters: {\n type: \"object\",\n properties: {\n format: {\n type: \"string\",\n description: 'Output format: \"json\" or \"text\" (default: text)',\n enum: [\"json\", \"text\"],\n },\n },\n },\n },\n schemaMod.default,\n {\n allowedArgs: [\"format\"],\n readOnly: true,\n },\n ),\n \"db-query\": wrapCliScript(\n {\n description: `Read from the app's own SQL database ONLY. Runs a SELECT against the app's internal tables (settings, application_state, template tables). Results are auto-scoped to the current user/org. IMPORTANT: This tool CANNOT access external data sources like data warehouses, CRMs, issue trackers, analytics platforms, calendars, mail, docs, or other third-party services. For those, use the relevant template/provider action, MCP connector, or provider-api-catalog/provider-api-docs/provider-api-request when available. If the user names a provider, that named provider wins; do not substitute a warehouse or app database copy unless they explicitly ask for it. If a table isn't in the app schema, don't try db-query — use the data-source-specific action. ${extensionQueryGuidance}`,\n parameters: {\n type: \"object\",\n properties: {\n sql: {\n type: \"string\",\n description:\n \"SELECT query to run, e.g. \\\"SELECT key, value FROM settings WHERE key LIKE 'sql-dashboard-%'\\\"\",\n },\n args: {\n type: \"string\",\n description:\n 'Optional JSON array of positional bind args for parameterized placeholders. Example: \\'[\"draft\",\"form-123\"]\\'',\n },\n format: {\n type: \"string\",\n description: 'Output format: \"json\" or \"text\" (default: text)',\n enum: [\"json\", \"text\"],\n },\n limit: {\n type: \"string\",\n description:\n \"Append LIMIT N if the query doesn't already have one\",\n },\n },\n required: [\"sql\"],\n },\n },\n queryMod.default,\n {\n allowedArgs: [\"sql\", \"args\", \"format\", \"limit\"],\n readOnly: true,\n },\n ),\n };\n\n if (execMod && patchMod) {\n entries[\"db-exec\"] = wrapCliScript(\n {\n description:\n \"Write to the app's own SQL database ONLY. Runs INSERT / UPDATE / DELETE / REPLACE against the app's internal tables. For multiple related writes, pass `statements` so they run sequentially in one transaction instead of issuing several db-exec calls. Writes are auto-scoped to the current user/org, and `owner_email` / `org_id` are auto-injected on INSERT. Schema changes (CREATE/ALTER/DROP) are blocked. Never use this to backfill missing data for a read/analysis request or to create/modify users, members, roles, permissions, admin flags, or ownership; use a dedicated app action or reviewed code. IMPORTANT: This tool CANNOT write to external data sources like BigQuery, HubSpot, etc. For external services, use the appropriate template action.\",\n parameters: dbExecToolParameters(),\n },\n execMod.default,\n );\n entries[\"db-patch\"] = wrapCliScript(\n {\n description:\n \"Surgical patch on a large text/JSON column in the app's SQL database. Two modes: (1) text find/replace via `find`/`replace`/`edits` — best for small edits to documents, slide HTML, etc. (2) structural JSON ops via `json-ops` — STRONGLY PREFERRED when the column is JSON (dashboard configs, form schemas, slide decks) because it avoids all the brace/quote/comma surgery that text find/replace requires. Use `json-ops` to set/remove values at a JSON Pointer path, or to move/insert array items — e.g. reorder dashboard panels, add a filter, rename a field. Targets exactly one row (narrow `where` by primary key). Same per-user/org scoping as db-exec.\",\n parameters: {\n type: \"object\",\n properties: {\n table: {\n type: \"string\",\n description: \"Table name (e.g. 'settings')\",\n },\n column: {\n type: \"string\",\n description:\n \"Text/JSON column to patch (e.g. 'value' for settings)\",\n },\n where: {\n type: \"string\",\n description:\n \"WHERE clause that matches exactly one row (e.g. \\\"key = 'o:org1:sql-dashboard-foo'\\\")\",\n },\n find: {\n type: \"string\",\n description:\n \"Text mode: substring to find. Must match EXACTLY ONE occurrence by default (like Claude Code's Edit tool). If 0 matches, you get 'NOT FOUND'. If >1 matches, you get surrounding context for each match — widen `find` with unique context and retry. Use `all: \\\"true\\\"` to replace every occurrence.\",\n },\n replace: {\n type: \"string\",\n description: \"Text mode: replacement substring\",\n },\n edits: {\n type: \"string\",\n description:\n 'Text mode batch: JSON array of {find, replace} pairs. Same uniqueness rule applies to each `find`. Example: \\'[{\"find\":\"a\",\"replace\":\"b\"}]\\'',\n },\n \"json-ops\": {\n type: \"string\",\n description:\n 'JSON mode: JSON array of structural ops. Each op is {op, path, value?, from?}. `op` is one of \"set\", \"remove\", \"insert\", \"move\", \"move-before\". `path` / `from` use JSON Pointer (\"/panels/3/title\"). Examples — reorder: \\'[{\"op\":\"move\",\"from\":\"/panels/7\",\"path\":\"/panels/1\"}]\\'; edit field: \\'[{\"op\":\"set\",\"path\":\"/panels/0/title\",\"value\":\"New\"}]\\'; delete filter: \\'[{\"op\":\"remove\",\"path\":\"/filters/2\"}]\\'; add panel: \\'[{\"op\":\"insert\",\"path\":\"/panels/0\",\"value\":{\"id\":\"p\",\"title\":\"...\"}}]\\'. Much safer than text find/replace for JSON columns.',\n },\n all: {\n type: \"string\",\n description:\n 'Text mode: set to \"true\" to replace every occurrence of each `find` (default requires exactly one match)',\n enum: [\"true\"],\n },\n },\n required: [\"table\", \"column\", \"where\"],\n },\n },\n patchMod.default,\n );\n }\n\n return entries;\n } catch {\n return {};\n }\n}\n\n/**\n * Creates read-only package lookup tools so agents can inspect version-matched\n * framework docs and source bundled in @agent-native/core at runtime.\n */\nexport async function createDocsScriptEntries(): Promise<\n Record<string, ActionEntry>\n> {\n const entries: Record<string, ActionEntry> = {};\n\n try {\n const mod = await import(\"../../scripts/docs/search.js\");\n entries[\"docs-search\"] = wrapCliScript(\n {\n description:\n \"Search and read agent-native framework documentation, bundled AGENTS.md, and codebase skills. Use --list to see all pages, --query to search, --slug to read a specific page. Codebase skill pages use slugs like skill-<name>.\",\n parameters: {\n type: \"object\",\n properties: {\n query: {\n type: \"string\",\n description:\n \"Search term to find relevant docs (e.g. 'actions', 'authentication', 'database')\",\n },\n slug: {\n type: \"string\",\n description:\n \"Read a specific doc page by slug (e.g. 'actions', 'authentication', 'database')\",\n },\n list: {\n type: \"string\",\n description: 'Set to \"true\" to list all available doc pages',\n enum: [\"true\"],\n },\n },\n },\n },\n mod.default,\n { readOnly: true },\n );\n } catch {\n // Keep source-search available if docs-search fails during a partial build.\n }\n\n try {\n const mod = await import(\"../../scripts/docs/source-search.js\");\n if (!mod.hasSourceCorpus()) {\n return entries;\n }\n entries[\"source-search\"] = wrapCliScript(\n {\n description:\n \"Search and read the packaged Agent Native source corpus under node_modules/@agent-native/core/corpus. Use --list for sections, --query to search core/template source, and --path to read a file.\",\n parameters: {\n type: \"object\",\n properties: {\n query: {\n type: \"string\",\n description:\n \"Search term to find relevant core or template source (e.g. 'defineAction', 'useActionQuery', 'view-screen').\",\n },\n path: {\n type: \"string\",\n description:\n \"Read a specific corpus file or list a directory (e.g. 'templates/plan/AGENTS.md' or 'core/src/action.ts').\",\n },\n list: {\n type: \"string\",\n description: 'Set to \"true\" to list corpus sections',\n enum: [\"true\"],\n },\n },\n },\n },\n mod.default,\n { readOnly: true },\n );\n } catch {\n // Older package installs may not have the corpus/search script yet.\n }\n\n return entries;\n}\n\n/**\n * Creates resource ScriptEntries available in both prod and dev modes.\n */\nexport function shouldDefaultResourceWriteToWorkspace(path: string): boolean {\n const normalized = path.replace(/^\\/+/, \"\");\n return (\n normalized === \"AGENTS.md\" ||\n normalized === \"LEARNINGS.md\" ||\n normalized.startsWith(\"memory/\") ||\n normalized.startsWith(\"skills/\") ||\n normalized.startsWith(\"jobs/\") ||\n normalized.startsWith(\"agents/\") ||\n normalized.startsWith(\"remote-agents/\")\n );\n}\n\nexport async function createResourceScriptEntries(): Promise<\n Record<string, ActionEntry>\n> {\n try {\n const [list, read, effective, write, del, saveMem, delMem, store] =\n await Promise.all([\n import(\"../../scripts/resources/list.js\"),\n import(\"../../scripts/resources/read.js\"),\n import(\"../../scripts/resources/effective.js\"),\n import(\"../../scripts/resources/write.js\"),\n import(\"../../scripts/resources/delete.js\"),\n import(\"../../scripts/resources/save-memory.js\"),\n import(\"../../scripts/resources/delete-memory.js\"),\n import(\"../../resources/store.js\"),\n ]);\n\n // Wrap each CLI runner so it captures stdout and converts args properly\n const listEntry = wrapCliScript(\n {\n description: \"\",\n parameters: { type: \"object\" as const, properties: {} },\n },\n list.default,\n { readOnly: true },\n );\n const readEntry = wrapCliScript(\n {\n description: \"\",\n parameters: { type: \"object\" as const, properties: {} },\n },\n read.default,\n { readOnly: true },\n );\n const writeEntry = wrapCliScript(\n {\n description: \"\",\n parameters: { type: \"object\" as const, properties: {} },\n },\n write.default,\n );\n const effectiveEntry = wrapCliScript(\n {\n description: \"\",\n parameters: { type: \"object\" as const, properties: {} },\n },\n effective.default,\n { readOnly: true },\n );\n const deleteEntry = wrapCliScript(\n {\n description: \"\",\n parameters: { type: \"object\" as const, properties: {} },\n },\n del.default,\n );\n\n return {\n resources: {\n tool: {\n description:\n 'Manage workspace resources. Actions: \"list\" (browse visible files), \"read\" (get contents), \"effective\" (show workspace -> organization/app -> personal inheritance for a path), \"write\" (create/update personal or shared; workspace only for local file mode control files), \"promote\" (make agent scratch visible), \"delete\" (remove personal or shared; workspace only for local file mode control files). Agent scratch writes are hidden from the Workspace view by default; use visibility=\"workspace\" only for files the user explicitly wants to keep/manage.',\n parameters: {\n type: \"object\",\n properties: {\n action: {\n type: \"string\",\n description: \"The operation to perform\",\n enum: [\n \"list\",\n \"read\",\n \"effective\",\n \"write\",\n \"promote\",\n \"delete\",\n ],\n },\n path: {\n type: \"string\",\n description:\n \"Resource path (e.g. 'LEARNINGS.md', 'notes/ideas.md'). Required for read/write/delete.\",\n },\n content: {\n type: \"string\",\n description: \"Content to write. Required for write.\",\n },\n scope: {\n type: \"string\",\n description:\n \"personal, shared, workspace, or all (default varies by action). Workspace is read-only when inherited from Dispatch; in local file mode AGENTS.md, agent-native.json, mcp.config.json, .mcp.json, and skills/ are writable.\",\n enum: [\"personal\", \"shared\", \"workspace\", \"all\"],\n },\n prefix: {\n type: \"string\",\n description:\n \"Filter by path prefix when listing (e.g. 'notes/')\",\n },\n mime: {\n type: \"string\",\n description:\n \"MIME type for write (default: inferred from extension)\",\n },\n format: {\n type: \"string\",\n description:\n 'Output format for list: \"json\" or \"text\" (default: text)',\n enum: [\"json\", \"text\"],\n },\n visibility: {\n type: \"string\",\n description:\n 'Visibility for write: \"agent_scratch\" for internal working files, \"workspace\" for user-requested files. Defaults to agent_scratch except durable instruction/skill/job/memory paths.',\n enum: [\"workspace\", \"agent_scratch\"],\n },\n includeAgentScratch: {\n type: \"boolean\",\n description: \"Include hidden agent scratch files when listing.\",\n },\n },\n required: [\"action\"],\n },\n },\n planMode: {\n effect: (args) =>\n args.action === \"list\" ||\n args.action === \"read\" ||\n args.action === \"effective\"\n ? \"read\"\n : \"write\",\n allowedValues: { action: [\"list\", \"read\", \"effective\"] },\n description:\n \"Plan mode allows listing and reading workspace resources.\",\n },\n run: async (args: Record<string, string>) => {\n const { action: a, ...rest } = args;\n if (a === \"list\") return listEntry.run(rest);\n if (a === \"read\") {\n if (!rest.path) return \"Error: path is required for read\";\n return readEntry.run(rest);\n }\n if (a === \"effective\") {\n if (!rest.path) return \"Error: path is required for effective\";\n return effectiveEntry.run(rest);\n }\n if (a === \"write\") {\n if (\n !rest.path ||\n rest.content === undefined ||\n rest.content === null\n )\n return \"Error: path and content are required for write\";\n rest.createdBy = \"agent\";\n rest.visibility =\n rest.visibility ??\n (shouldDefaultResourceWriteToWorkspace(String(rest.path))\n ? \"workspace\"\n : \"agent_scratch\");\n const runCtx = getRequestRunContext();\n if (runCtx?.threadId) rest.threadId = runCtx.threadId;\n return writeEntry.run(rest);\n }\n if (a === \"promote\") {\n if (!rest.path) return \"Error: path is required for promote\";\n const scope = rest.scope ?? \"personal\";\n if (scope === \"workspace\" || scope === \"all\") {\n return \"Error: promote supports personal or shared scope only\";\n }\n const owner =\n scope === \"shared\"\n ? store.sharedResourceOwner(getRequestOrgId())\n : (getRequestRunContext()?.owner ??\n getRequestUserEmail() ??\n getAmbientUserEmail());\n if (!owner) {\n return \"Error: promote requires an authenticated user\";\n }\n const resource = await store.resourceGetByPath(\n owner,\n String(rest.path),\n );\n if (!resource) {\n return `Resource not found: ${rest.path}`;\n }\n const promoted = await store.resourcePut(\n owner,\n resource.path,\n resource.content,\n resource.mimeType,\n {\n createdBy: resource.createdBy,\n visibility: \"workspace\",\n threadId: resource.threadId,\n runId: resource.runId,\n expiresAt: null,\n metadata: resource.metadata,\n },\n );\n return `Promoted resource: ${promoted.path}`;\n }\n if (a === \"delete\") {\n if (!rest.path) return \"Error: path is required for delete\";\n return deleteEntry.run(rest);\n }\n return `Error: unknown action \"${a}\". Use: list, read, write, promote, delete`;\n },\n },\n \"save-memory\": wrapCliScript(\n {\n description:\n \"Save a memory for future conversations. Creates or updates a memory file and its index entry. Use proactively when you learn preferences, corrections, project context, or references.\",\n parameters: {\n type: \"object\",\n properties: {\n name: {\n type: \"string\",\n description:\n \"Short kebab-case identifier (e.g. 'coding-style', 'deploy-process'). Used as the filename.\",\n },\n type: {\n type: \"string\",\n description: \"Memory category\",\n enum: [\"user\", \"feedback\", \"project\", \"reference\"],\n },\n description: {\n type: \"string\",\n description:\n \"One-line summary shown in the memory index (keep under 80 chars)\",\n },\n content: {\n type: \"string\",\n description:\n \"The memory content in markdown. For updates, read first and provide full updated content.\",\n },\n },\n required: [\"name\", \"type\", \"description\", \"content\"],\n },\n },\n saveMem.default,\n ),\n \"delete-memory\": wrapCliScript(\n {\n description:\n \"Delete a memory entry and remove it from the memory index.\",\n parameters: {\n type: \"object\",\n properties: {\n name: {\n type: \"string\",\n description: \"The memory name to delete (e.g. 'coding-style')\",\n },\n },\n required: [\"name\"],\n },\n },\n delMem.default,\n ),\n };\n } catch {\n // Resources not available — skip silently\n return {};\n }\n}\n\n/**\n * Creates a unified chat-history ActionEntry that dispatches to search, open,\n * rename, or lightweight organization actions.\n */\nexport async function createChatScriptEntries(): Promise<\n Record<string, ActionEntry>\n> {\n try {\n const [searchMod, openMod] = await Promise.all([\n import(\"../../scripts/chat/search-chats.js\"),\n import(\"../../scripts/chat/open-chat.js\"),\n ]);\n\n const searchEntry = wrapCliScript(\n {\n description: \"Search or list past agent chat threads.\",\n parameters: {\n type: \"object\",\n properties: {\n query: {\n type: \"string\",\n description:\n \"Search term to find chats by title, preview, or content\",\n },\n limit: {\n type: \"string\",\n description: \"Max number of results (default: 20)\",\n },\n format: {\n type: \"string\",\n description: \"Output format\",\n enum: [\"json\", \"text\"],\n },\n includeArchived: {\n type: \"boolean\",\n description:\n \"Also include archived chats in the results. Archived chats are excluded by default.\",\n },\n },\n },\n },\n searchMod.default,\n );\n\n const openEntry = wrapCliScript(\n {\n description: \"Open a chat thread in the UI.\",\n parameters: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n description: \"The chat thread ID to open\",\n },\n },\n required: [\"id\"],\n },\n },\n openMod.default,\n );\n\n return {\n \"chat-history\": {\n tool: {\n description:\n \"Manage past agent chat threads. Use action 'search' to find previous conversations by keyword, 'open' to open a thread in the UI, or 'rename'/'pin'/'unpin'/'archive' to organize history.\",\n parameters: {\n type: \"object\",\n properties: {\n action: {\n type: \"string\",\n description: \"The operation to perform\",\n enum: [\"search\", \"open\", \"rename\", \"pin\", \"unpin\", \"archive\"],\n },\n query: {\n type: \"string\",\n description:\n \"(search) Search term to find chats by title, preview, or content\",\n },\n limit: {\n type: \"string\",\n description: \"(search) Max number of results (default: 20)\",\n },\n format: {\n type: \"string\",\n description: \"(search) Output format\",\n enum: [\"json\", \"text\"],\n },\n includeArchived: {\n type: \"boolean\",\n description:\n \"(search) Also include archived chats in the results. Archived chats are excluded by default, matching the 'archive' action's effect on the chat list.\",\n },\n id: {\n type: \"string\",\n description:\n \"(open, rename, pin, unpin, archive) The chat thread ID to manage\",\n },\n title: {\n type: \"string\",\n description: \"(rename) New chat title\",\n },\n },\n required: [\"action\"],\n },\n },\n planMode: {\n effect: (args) => (args.action === \"search\" ? \"read\" : \"write\"),\n allowedValues: { action: [\"search\"] },\n description: \"Plan mode allows searching chat history.\",\n },\n run: async (args) => {\n if (args?.action === \"open\") {\n return openEntry.run(args);\n }\n if (\n args?.action === \"rename\" ||\n args?.action === \"pin\" ||\n args?.action === \"unpin\" ||\n args?.action === \"archive\"\n ) {\n const id = typeof args?.id === \"string\" ? args.id : \"\";\n if (!id) return \"Missing required id.\";\n const owner =\n getRequestRunContext()?.owner ?? getRequestUserEmail() ?? \"\";\n if (!owner) return \"No authenticated user is available.\";\n const thread = await resolveThreadAccess(owner, id, \"editor\", {\n orgId: getRequestOrgId(),\n });\n if (!thread) {\n return `Chat thread \"${id}\" not found.`;\n }\n const title = thread.title || thread.preview || \"(untitled)\";\n if (args.action === \"rename\") {\n const nextTitle =\n typeof args?.title === \"string\"\n ? args.title.replace(/\\s+/g, \" \").trim().slice(0, 160)\n : \"\";\n if (!nextTitle) return \"Missing required title.\";\n const renamed = await renameThread(id, nextTitle);\n if (!renamed) return `Chat thread \"${id}\" could not be renamed.`;\n return `Renamed chat \"${title}\" to \"${nextTitle}\".`;\n }\n if (args.action === \"archive\") {\n const archived = await setThreadArchived(id, true);\n if (!archived)\n return `Chat thread \"${id}\" could not be archived.`;\n return `Archived chat: ${title}`;\n }\n const pinned = await setThreadPinned(id, args.action === \"pin\");\n if (!pinned) return `Chat thread \"${id}\" could not be updated.`;\n return `${args.action === \"pin\" ? \"Pinned\" : \"Unpinned\"} chat: ${title}`;\n }\n return searchEntry.run(args);\n },\n },\n };\n } catch {\n return {};\n }\n}\n\n/**\n * Creates the consolidated manage-agent-engine tool (list / set / test).\n * Let the agent inspect and configure the active LLM engine.\n */\nexport async function createAgentEngineScriptEntries(\n appId?: string,\n): Promise<Record<string, ActionEntry>> {\n try {\n const mod =\n await import(\"../../scripts/agent-engines/manage-agent-engine.js\");\n\n return {\n \"manage-agent-engine\": {\n tool: mod.tool,\n planMode: {\n effect: (args) => (args.action === \"list\" ? \"read\" : \"write\"),\n allowedValues: { action: [\"list\"] },\n description: \"Plan mode allows listing available agent engines.\",\n },\n run: (args) =>\n mod.run({\n ...args,\n appId:\n typeof args.appId === \"string\" && args.appId.trim()\n ? args.appId\n : (appId ?? \"\"),\n }),\n },\n };\n } catch {\n return {};\n }\n}\n\n/**\n * Creates the manage-agent-loop-settings tool. Lets the agent inspect and\n * configure the loop step limit it may hit on long-running work.\n */\nexport async function createAgentLoopSettingsScriptEntries(): Promise<\n Record<string, ActionEntry>\n> {\n try {\n const mod = await import(\"../../scripts/manage-agent-loop-settings.js\");\n\n return {\n \"manage-agent-loop-settings\": { tool: mod.tool, run: mod.run },\n };\n } catch {\n return {};\n }\n}\n\n/**\n * Creates the call-agent ActionEntry for cross-agent A2A communication.\n * Binds selfAppId so the agent cannot call itself via call-agent.\n */\nexport async function createCallAgentScriptEntry(\n selfAppId?: string,\n): Promise<Record<string, ActionEntry>> {\n const entries: Record<string, ActionEntry> = {};\n\n try {\n const mod = await import(\"../../scripts/call-agent.js\");\n entries[\"call-agent\"] = {\n tool: mod.tool,\n planMode: {\n effect: (args) => {\n const keys = Object.keys(args);\n if (\n keys.some(\n (key) => key !== \"agent\" && key !== \"action\" && key !== \"input\",\n )\n ) {\n return \"write\";\n }\n if (\n typeof args.agent !== \"string\" ||\n !args.agent.trim() ||\n typeof args.action !== \"string\" ||\n !args.action.trim() ||\n !Object.hasOwn(args, \"input\") ||\n args.input === null ||\n typeof args.input !== \"object\" ||\n Array.isArray(args.input)\n ) {\n return \"unknown\";\n }\n return \"read\";\n },\n allowedProperties: [\"agent\", \"action\", \"input\"],\n requiredProperties: [\"agent\", \"action\"],\n description:\n \"Plan mode allows only exact read-only cross-app action calls with agent, action, and input.\",\n },\n run: (args, context) => mod.run(args, context, selfAppId),\n };\n } catch {\n // A missing built-in leaves the rest of the toolset usable.\n }\n\n try {\n const mod = await import(\"../../scripts/describe-workspace-apps.js\");\n entries[\"describe-workspace-apps\"] = {\n tool: mod.tool,\n run: (args, context) => mod.run(args, context, selfAppId),\n readOnly: true,\n };\n } catch {\n // A missing built-in leaves the rest of the toolset usable.\n }\n\n return entries;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"agent-chat-plugin.d.ts","sourceRoot":"","sources":["../../src/server/agent-chat-plugin.ts"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC;AA2H7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAEvE,OAAO,EACL,yBAAyB,EACzB,KAAK,6BAA6B,EACnC,MAAM,+BAA+B,CAAC;AAkCvC,OAAO,EAAE,yBAAyB,EAAE,CAAC;AACrC,YAAY,EAAE,6BAA6B,EAAE,CAAC;AAwE9C,OAAO,EACL,0BAA0B,EAM1B,eAAe,EACf,eAAe,EACf,wBAAwB,EACxB,yBAAyB,EAG1B,MAAM,oCAAoC,CAAC;AAW5C,OAAO,EACL,gCAAgC,EAOjC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,yCAAyC,EAAE,MAAM,qCAAqC,CAAC;AAChG,OAAO,EACL,sBAAsB,EAGvB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAC;AAC3F,OAAO,EAEL,sCAAsC,EACvC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAYxE,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAClC,OAAO,EAAE,gCAAgC,EAAE,CAAC;AAC5C,OAAO,EAAE,yBAAyB,EAAE,CAAC;AACrC,OAAO,EAAE,wBAAwB,EAAE,CAAC;AACpC,YAAY,EAAE,sBAAsB,EAAE,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,CAAC;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AA6B,EAAE,MAAM,EACrC,sBAAsB,EAAE,MAAM,GAC7B,MAAM,CAER;AAaD;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,aAKlC,CAAC;AAEH;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,oBAAoB,EAAE,GAAG,SAAS,EAChD,KAAK,EAAE,MAAM,EACb,IAAI,EAAE;IACJ,eAAe,EAAE,CACf,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,KACZ,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;IAC9B,uBAAuB,EAAE,CACvB,GAAG,EAAE,oBAAoB,KACtB,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;CAC/B,GACA,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAI1B;AAED,wBAAgB,qBAAqB,CACnC,OAAO,CAAC,EAAE,sBAAsB,GAC/B,cAAc,CAw+KhB;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,cAAwC,CAAC;AAE9E,OAAO,EAEL,mBAAmB,EACnB,uBAAuB,EAGxB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAC/B,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
@@ -322,7 +322,7 @@ export function createAgentChatPlugin(options) {
322
322
  });
323
323
  const missing = requested.filter((toolName) => !entries[toolName]);
324
324
  if (missing.length > 0) {
325
- throw new Error(`Configured MCP tools are unavailable in this run: ${missing.join(", ")}. Reconnect the MCP server or update the job's capability list.`);
325
+ throw new Error(`Configured MCP tools are unavailable in this run: ${missing.join(", ")}. Reconnect the MCP server or update the automation's capability list.`);
326
326
  }
327
327
  return entries;
328
328
  };
@@ -397,7 +397,7 @@ export function createAgentChatPlugin(options) {
397
397
  const databaseToolsMode = normalizeDatabaseToolsMode(options?.databaseTools);
398
398
  const databaseToolsEnabled = databaseToolsMode !== "off";
399
399
  const databaseWriteToolsEnabled = databaseToolsMode === "write";
400
- const extensionToolsEnabled = options?.extensionTools !== false;
400
+ const extensionToolsEnabled = options?.extensionTools === true;
401
401
  const dbScripts = databaseToolsEnabled
402
402
  ? await createDbScriptEntries(databaseToolsMode, {
403
403
  extensionTools: extensionToolsEnabled,
@@ -420,7 +420,7 @@ export function createAgentChatPlugin(options) {
420
420
  const browserTools = createBuilderBrowserTool({
421
421
  getOrigin: () => getRequestRunContext()?.requestOrigin ?? "http://localhost:3000",
422
422
  getOwner: () => getRequestRunContext()?.owner ?? getRequestUserEmail(),
423
- extensionTools: options?.extensionTools,
423
+ extensionTools: extensionToolsEnabled,
424
424
  });
425
425
  // Auto-mount A2A protocol endpoints so every app is discoverable
426
426
  // and callable by other agents via the standard protocol.
@@ -459,6 +459,7 @@ export function createAgentChatPlugin(options) {
459
459
  .readdirSync(actionsDir)
460
460
  .filter((f) => f.endsWith(".ts") &&
461
461
  !f.startsWith("_") &&
462
+ !/\.(test|spec)\.ts$/.test(f) &&
462
463
  !skipFiles.has(f.replace(/\.ts$/, "")));
463
464
  for (const file of files) {
464
465
  const name = file.replace(/\.ts$/, "");
@@ -728,6 +729,15 @@ export function createAgentChatPlugin(options) {
728
729
  });
729
730
  }
730
731
  catch { }
732
+ let remoteBrowserTools = {};
733
+ try {
734
+ const { createRemoteBrowserActionEntries } = await import("../integrations/remote-browser-actions.js");
735
+ remoteBrowserTools = createRemoteBrowserActionEntries({
736
+ getOwnerEmail: () => requireCurrentRunOwner("use a remote browser session"),
737
+ getOrgId: () => getRequestOrgId() ?? null,
738
+ });
739
+ }
740
+ catch { }
731
741
  // Core send-email tool — only registered when RESEND_API_KEY or
732
742
  // SENDGRID_API_KEY is set. Keyed "core-send-email" to avoid colliding
733
743
  // with the mail template's richer "send-email" action (template wins
@@ -882,6 +892,7 @@ export function createAgentChatPlugin(options) {
882
892
  ...workspaceFileActions,
883
893
  ...toolActions,
884
894
  ...browserSessionTools,
895
+ ...remoteBrowserTools,
885
896
  ...coreEmailTools,
886
897
  ...coreAttachmentTools,
887
898
  ...browserTools,
@@ -908,6 +919,7 @@ export function createAgentChatPlugin(options) {
908
919
  ...workspaceFileActions,
909
920
  ...toolActions,
910
921
  ...browserSessionTools,
922
+ ...remoteBrowserTools,
911
923
  ...coreEmailTools,
912
924
  ...coreAttachmentTools,
913
925
  ...browserTools,
@@ -946,6 +958,7 @@ export function createAgentChatPlugin(options) {
946
958
  ...workspaceFileActions,
947
959
  ...toolActions,
948
960
  ...browserSessionTools,
961
+ ...remoteBrowserTools,
949
962
  ...coreEmailTools,
950
963
  ...coreAttachmentTools,
951
964
  ...browserTools,
@@ -1245,6 +1258,7 @@ export function createAgentChatPlugin(options) {
1245
1258
  ...workspaceFileActions,
1246
1259
  ...toolActions,
1247
1260
  ...browserSessionTools,
1261
+ ...remoteBrowserTools,
1248
1262
  ...coreEmailTools,
1249
1263
  ...coreAttachmentTools,
1250
1264
  ...browserTools,
@@ -1267,6 +1281,7 @@ export function createAgentChatPlugin(options) {
1267
1281
  ...workspaceFileActions,
1268
1282
  ...toolActions,
1269
1283
  ...browserSessionTools,
1284
+ ...remoteBrowserTools,
1270
1285
  ...coreEmailTools,
1271
1286
  ...coreAttachmentTools,
1272
1287
  ...browserTools,
@@ -2097,6 +2112,7 @@ export function createAgentChatPlugin(options) {
2097
2112
  ...workspaceFileActions,
2098
2113
  ...toolActions,
2099
2114
  ...browserSessionTools,
2115
+ ...remoteBrowserTools,
2100
2116
  ...coreEmailTools,
2101
2117
  ...coreAttachmentTools,
2102
2118
  ...browserTools,
@@ -2561,6 +2577,7 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
2561
2577
  ...workspaceFileActions,
2562
2578
  ...toolActions,
2563
2579
  ...browserSessionTools,
2580
+ ...remoteBrowserTools,
2564
2581
  ...coreEmailTools,
2565
2582
  ...coreAttachmentTools,
2566
2583
  ...browserTools,
@@ -4836,7 +4853,7 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
4836
4853
  try {
4837
4854
  const { initTriggerDispatcher } = await import("../triggers/dispatcher.js");
4838
4855
  await initTriggerDispatcher({
4839
- getActions: () => ({
4856
+ getActions: (automation) => ({
4840
4857
  ...templateScripts,
4841
4858
  ...resourceScripts,
4842
4859
  ...docsScripts,
@@ -4849,6 +4866,7 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
4849
4866
  ...fetchTool,
4850
4867
  ...webSearchTool,
4851
4868
  ...toolActions,
4869
+ ...getJobMcpActionEntries(automation),
4852
4870
  }),
4853
4871
  getSystemPrompt: async (owner) => {
4854
4872
  const resources = await loadResourcesForPrompt(owner, lazyContext, options?.appId);
@@ -4859,10 +4877,11 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
4859
4877
  },
4860
4878
  // See the matching comment on schedulerDeps.getInitialToolNames
4861
4879
  // above — same shared `basePrompt`, same reasoning.
4862
- getInitialToolNames: () => [
4880
+ getInitialToolNames: (automation) => [
4863
4881
  ...effectiveInitialToolNames,
4864
4882
  "manage-jobs",
4865
4883
  "manage-progress",
4884
+ ...(automation?.meta.mcpTools ?? []),
4866
4885
  ],
4867
4886
  apiKey: options?.apiKey,
4868
4887
  model: options?.model,