@agent-native/core 0.121.2 → 0.122.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (460) hide show
  1. package/corpus/README.md +2 -2
  2. package/corpus/core/CHANGELOG.md +139 -0
  3. package/corpus/core/docs/content/actions.mdx +2 -2
  4. package/corpus/core/docs/content/agent-surfaces.mdx +1 -1
  5. package/corpus/core/docs/content/authentication.mdx +2 -0
  6. package/corpus/core/docs/content/deployment.mdx +36 -0
  7. package/corpus/core/docs/content/http-api.mdx +266 -0
  8. package/corpus/core/docs/content/syncing-template-changes.mdx +159 -0
  9. package/corpus/core/package.json +2 -1
  10. package/corpus/core/src/a2a/activity.ts +38 -27
  11. package/corpus/core/src/agent/engine/builder-engine.ts +35 -4
  12. package/corpus/core/src/agent/run-manager.ts +20 -1
  13. package/corpus/core/src/agent/run-store.ts +4 -1
  14. package/corpus/core/src/agent/types.ts +28 -8
  15. package/corpus/core/src/chat-threads/store.ts +45 -0
  16. package/corpus/core/src/checkpoints/index.ts +2 -0
  17. package/corpus/core/src/checkpoints/route-match.ts +13 -0
  18. package/corpus/core/src/cli/create.ts +105 -17
  19. package/corpus/core/src/cli/index.ts +20 -0
  20. package/corpus/core/src/cli/template-baseline.ts +410 -0
  21. package/corpus/core/src/cli/template-sync.ts +1004 -0
  22. package/corpus/core/src/cli/templates-meta.ts +1 -0
  23. package/corpus/core/src/client/AssistantChat.tsx +38 -12
  24. package/corpus/core/src/client/NewWorkspaceAppFlow.tsx +75 -10
  25. package/corpus/core/src/client/chat/message-components.tsx +127 -66
  26. package/corpus/core/src/client/chat/tool-call-display.tsx +29 -5
  27. package/corpus/core/src/client/error-format.ts +18 -0
  28. package/corpus/core/src/client/org/OrgSwitcher.tsx +30 -8
  29. package/corpus/core/src/client/org/TeamPage.tsx +7 -6
  30. package/corpus/core/src/client/sse-event-processor.ts +3 -0
  31. package/corpus/core/src/data-widgets/index.ts +41 -0
  32. package/corpus/core/src/deploy/build.ts +11 -9
  33. package/corpus/core/src/integrations/webhook-handler.ts +63 -9
  34. package/corpus/core/src/org/auto-join-domain.ts +4 -3
  35. package/corpus/core/src/org/context.ts +108 -39
  36. package/corpus/core/src/org/index.ts +5 -0
  37. package/corpus/core/src/org/service-identity.ts +60 -0
  38. package/corpus/core/src/provider-api/index.ts +22 -1
  39. package/corpus/core/src/scripts/docs/search.ts +12 -1
  40. package/corpus/core/src/server/agent-chat/context-tools.ts +9 -4
  41. package/corpus/core/src/server/agent-chat/framework-prompts.ts +38 -66
  42. package/corpus/core/src/server/agent-chat-plugin.ts +17 -10
  43. package/corpus/core/src/server/agents-bundle.ts +84 -5
  44. package/corpus/core/src/server/auth.ts +4 -3
  45. package/corpus/core/src/server/builder-browser.ts +47 -19
  46. package/corpus/core/src/server/core-routes-plugin.ts +2 -2
  47. package/corpus/core/src/server/credential-provider.ts +209 -68
  48. package/corpus/core/src/server/index.ts +3 -0
  49. package/corpus/core/src/server/prompts/framework-core-compact.ts +6 -13
  50. package/corpus/core/src/server/prompts/framework-core.ts +9 -21
  51. package/corpus/core/src/server/prompts/index.ts +0 -1
  52. package/corpus/core/src/server/prompts/shared-rules.ts +19 -11
  53. package/corpus/core/src/server/ssr-handler.ts +13 -2
  54. package/corpus/core/src/settings/user-settings.ts +13 -1
  55. package/corpus/core/src/shared/cache-control.ts +141 -0
  56. package/corpus/core/src/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +24 -2
  57. package/corpus/core/src/templates/chat/_gitignore +1 -0
  58. package/corpus/core/src/templates/default/.agents/skills/upgrade-agent-native/SKILL.md +24 -2
  59. package/corpus/core/src/templates/headless/.agents/skills/upgrade-agent-native/SKILL.md +24 -2
  60. package/corpus/core/src/templates/workspace-core/.agents/skills/performance/SKILL.md +19 -0
  61. package/corpus/core/src/templates/workspace-core/.agents/skills/upgrade-agent-native/SKILL.md +24 -2
  62. package/corpus/core/src/templates/workspace-core/.agents/skills/visual-answer/SKILL.md +1 -0
  63. package/corpus/core/src/vite/agents-bundle-plugin.ts +7 -6
  64. package/corpus/core/src/vite/client.ts +5 -0
  65. package/corpus/templates/analytics/.agents/skills/adhoc-analysis/SKILL.md +4 -5
  66. package/corpus/templates/analytics/.agents/skills/admin-surfaces/SKILL.md +55 -0
  67. package/corpus/templates/analytics/.agents/skills/dashboard-management/SKILL.md +10 -0
  68. package/corpus/templates/analytics/.agents/skills/dashboard-management/references/template-catalog-and-demo.md +62 -0
  69. package/corpus/templates/analytics/.agents/skills/dashboard-ops/SKILL.md +85 -0
  70. package/corpus/templates/analytics/.agents/skills/data-querying/SKILL.md +27 -2
  71. package/corpus/templates/analytics/.agents/skills/data-querying/references/inline-chart-embeds.md +139 -0
  72. package/corpus/templates/analytics/.agents/skills/monitoring/SKILL.md +77 -0
  73. package/corpus/templates/analytics/.agents/skills/upgrade-agent-native/SKILL.md +24 -2
  74. package/corpus/templates/analytics/AGENTS.md +91 -563
  75. package/corpus/templates/analytics/_gitignore +1 -0
  76. package/corpus/templates/analytics/actions/bigquery.ts +12 -4
  77. package/corpus/templates/analytics/actions/generate-chart.ts +5 -5
  78. package/corpus/templates/analytics/app/components/dashboard/SqlChart.tsx +30 -1
  79. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/DashboardFilterBar.tsx +3 -0
  80. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/SqlChartCard.tsx +1 -1
  81. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/index.tsx +1 -0
  82. package/corpus/templates/analytics/changelog/2026-07-24-analytics-finds-saved-dashboards-and-queries-far-more-reliab.md +6 -0
  83. package/corpus/templates/analytics/changelog/2026-07-24-notion-access-errors-now-explain-that-a-page-needs-sharing-w.md +6 -0
  84. package/corpus/templates/analytics/server/lib/agent-chat-plan-mode.ts +7 -0
  85. package/corpus/templates/analytics/server/lib/analytics-query-catalog.ts +191 -30
  86. package/corpus/templates/analytics/server/lib/bigquery.ts +11 -1
  87. package/corpus/templates/analytics/server/lib/notion.ts +15 -4
  88. package/corpus/templates/analytics/server/plugins/agent-chat.ts +10 -0
  89. package/corpus/templates/assets/.agents/skills/upgrade-agent-native/SKILL.md +24 -2
  90. package/corpus/templates/brain/.agents/skills/upgrade-agent-native/SKILL.md +24 -2
  91. package/corpus/templates/brain/_gitignore +1 -0
  92. package/corpus/templates/calendar/.agents/skills/upgrade-agent-native/SKILL.md +24 -2
  93. package/corpus/templates/calendar/_gitignore +1 -0
  94. package/corpus/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +24 -2
  95. package/corpus/templates/chat/_gitignore +1 -0
  96. package/corpus/templates/clips/.agents/skills/upgrade-agent-native/SKILL.md +24 -2
  97. package/corpus/templates/clips/.agents/skills/video-sharing/SKILL.md +34 -0
  98. package/corpus/templates/clips/AGENTS.md +5 -4
  99. package/corpus/templates/clips/_gitignore +1 -0
  100. package/corpus/templates/clips/actions/cleanup-transcript.ts +5 -0
  101. package/corpus/templates/clips/actions/get-recording-insights.ts +44 -8
  102. package/corpus/templates/clips/actions/get-recording-player-data.ts +39 -70
  103. package/corpus/templates/clips/actions/list-clip-views.ts +2 -4
  104. package/corpus/templates/clips/actions/list-recordings.ts +69 -19
  105. package/corpus/templates/clips/actions/list-viewers.ts +5 -2
  106. package/corpus/templates/clips/actions/regenerate-summary.ts +5 -1
  107. package/corpus/templates/clips/actions/request-transcript.ts +28 -1
  108. package/corpus/templates/clips/app/components/editor/stitch-manager.tsx +21 -1
  109. package/corpus/templates/clips/app/components/meetings/quick-ask-sidebar.tsx +14 -1
  110. package/corpus/templates/clips/app/components/player/insights-panel.tsx +8 -20
  111. package/corpus/templates/clips/app/components/player/recording-views-badge.tsx +335 -0
  112. package/corpus/templates/clips/app/components/player/video-player.tsx +13 -8
  113. package/corpus/templates/clips/app/components/sharing/share-ui.tsx +2 -1
  114. package/corpus/templates/clips/app/i18n/en-US.ts +13 -2
  115. package/corpus/templates/clips/app/lib/capture-permissions.ts +110 -0
  116. package/corpus/templates/clips/app/lib/recording-link.ts +32 -0
  117. package/corpus/templates/clips/app/routes/_app.meetings.$meetingId.tsx +27 -0
  118. package/corpus/templates/clips/app/routes/r.$recordingId.tsx +46 -15
  119. package/corpus/templates/clips/app/routes/record.tsx +77 -31
  120. package/corpus/templates/clips/app/routes/share.$shareId.tsx +42 -31
  121. package/corpus/templates/clips/changelog/2026-07-24-clip-pages-now-show-a-view-count-with-viewer-avatars-next-to.md +6 -0
  122. package/corpus/templates/clips/changelog/2026-07-24-clip-summaries-read-like-a-description-you-d-write-yourself-.md +6 -0
  123. package/corpus/templates/clips/changelog/2026-07-24-clip-view-counts-now-separate-human-views-from-agent-views-s.md +6 -0
  124. package/corpus/templates/clips/changelog/2026-07-24-clips-actions-can-now-be-called-by-org-service-tokens-so-ext.md +6 -0
  125. package/corpus/templates/clips/changelog/2026-07-24-clips-no-longer-briefly-shows-a-dock-icon-while-launching.md +6 -0
  126. package/corpus/templates/clips/changelog/2026-07-24-fixed-owner-and-editor-share-links-redirecting-to-the-record.md +6 -0
  127. package/corpus/templates/clips/changelog/2026-07-24-meeting-and-note-recordings-now-start-as-a-compact-pill-on-t.md +6 -0
  128. package/corpus/templates/clips/changelog/2026-07-24-new-clips-now-copy-a-shareable-link-instead-of-the-owner-onl.md +6 -0
  129. package/corpus/templates/clips/changelog/2026-07-24-opening-a-share-link-as-the-clip-s-owner-now-goes-straight-t.md +6 -0
  130. package/corpus/templates/clips/changelog/2026-07-24-permissions-and-rewind-controls-now-use-compact-consistent-h.md +6 -0
  131. package/corpus/templates/clips/changelog/2026-07-24-quitting-the-desktop-app-no-longer-shows-a-false-macos-crash.md +6 -0
  132. package/corpus/templates/clips/changelog/2026-07-24-screen-recording-permission-errors-now-name-the-exact-app-to.md +6 -0
  133. package/corpus/templates/clips/changelog/2026-07-24-the-desktop-app-now-copies-a-new-clip-s-share-link-to-your-c.md +6 -0
  134. package/corpus/templates/clips/changelog/2026-07-24-the-recording-toolbar-now-stays-above-other-apps-including-o.md +6 -0
  135. package/corpus/templates/clips/changelog/2026-07-24-transcript-captions-now-use-real-speech-timings-instead-of-a.md +6 -0
  136. package/corpus/templates/clips/changelog/2026-07-24-video-playback-no-longer-stutters-and-replays-the-last-momen.md +6 -0
  137. package/corpus/templates/clips/chrome-extension/src/background.ts +17 -1
  138. package/corpus/templates/clips/desktop/package.json +2 -0
  139. package/corpus/templates/clips/desktop/src/app.tsx +89 -0
  140. package/corpus/templates/clips/desktop/src/hooks/useMeetingTranscription.ts +9 -3
  141. package/corpus/templates/clips/desktop/src/lib/audio-meter.ts +51 -0
  142. package/corpus/templates/clips/desktop/src/lib/native-notification.ts +44 -0
  143. package/corpus/templates/clips/desktop/src/lib/recording-link.ts +67 -0
  144. package/corpus/templates/clips/desktop/src/overlays/live-audio-bars.tsx +35 -35
  145. package/corpus/templates/clips/desktop/src/overlays/live-transcript.tsx +3 -2
  146. package/corpus/templates/clips/desktop/src/overlays/recording-pill.tsx +47 -46
  147. package/corpus/templates/clips/desktop/src/styles.css +127 -78
  148. package/corpus/templates/clips/desktop/src-tauri/Cargo.toml +7 -0
  149. package/corpus/templates/clips/desktop/src-tauri/Info.plist +6 -0
  150. package/corpus/templates/clips/desktop/src-tauri/capabilities/default.json +1 -0
  151. package/corpus/templates/clips/desktop/src-tauri/src/clips/mod.rs +7 -3
  152. package/corpus/templates/clips/desktop/src-tauri/src/lib.rs +4 -1
  153. package/corpus/templates/clips/desktop/src-tauri/src/main.rs +8 -0
  154. package/corpus/templates/clips/desktop/src-tauri/src/recording_indicator.rs +21 -10
  155. package/corpus/templates/clips/desktop/src-tauri/src/util.rs +40 -0
  156. package/corpus/templates/clips/server/db/schema.ts +25 -0
  157. package/corpus/templates/clips/server/lib/agent-views.ts +145 -0
  158. package/corpus/templates/clips/server/lib/public-agent-context.ts +7 -0
  159. package/corpus/templates/clips/server/lib/recording-share-grant.ts +79 -0
  160. package/corpus/templates/clips/server/lib/recordings.ts +51 -3
  161. package/corpus/templates/clips/server/plugins/db.ts +23 -0
  162. package/corpus/templates/clips/server/routes/api/public-recording.get.ts +49 -17
  163. package/corpus/templates/clips/shared/recording-link.ts +43 -0
  164. package/corpus/templates/clips/shared/share-attribution.ts +4 -0
  165. package/corpus/templates/clips/shared/share-dashboard-redirect.ts +42 -0
  166. package/corpus/templates/clips/shared/view-analytics.ts +26 -0
  167. package/corpus/templates/content/.agents/skills/content/SKILL.md +5 -0
  168. package/corpus/templates/content/.agents/skills/content/references/local-file-mode.md +135 -0
  169. package/corpus/templates/content/.agents/skills/document-editing/SKILL.md +12 -0
  170. package/corpus/templates/content/.agents/skills/document-editing/references/databases.md +238 -0
  171. package/corpus/templates/content/.agents/skills/document-editing/references/document-behavior.md +91 -0
  172. package/corpus/templates/content/.agents/skills/upgrade-agent-native/SKILL.md +24 -2
  173. package/corpus/templates/content/AGENTS.md +62 -583
  174. package/corpus/templates/content/_gitignore +1 -0
  175. package/corpus/templates/design/.agents/skills/creative-context/SKILL.md +11 -0
  176. package/corpus/templates/design/.agents/skills/design-generation/SKILL.md +50 -8
  177. package/corpus/templates/design/.agents/skills/design-generation/references/code-layers.md +81 -0
  178. package/corpus/templates/design/.agents/skills/design-generation/references/code-workspace.md +42 -0
  179. package/corpus/templates/design/.agents/skills/design-generation/references/editor-extensions.md +34 -0
  180. package/corpus/templates/design/.agents/skills/responsive-breakpoints/SKILL.md +4 -1
  181. package/corpus/templates/design/.agents/skills/upgrade-agent-native/SKILL.md +24 -2
  182. package/corpus/templates/design/.agents/skills/visual-edit/SKILL.md +17 -0
  183. package/corpus/templates/design/.generated/bridge/editor-chrome.generated.ts +8196 -0
  184. package/corpus/templates/design/.generated/bridge/embedded-wheel.generated.ts +265 -0
  185. package/corpus/templates/design/.generated/bridge/hit-test.generated.ts +642 -0
  186. package/corpus/templates/design/.generated/bridge/motion-preview.generated.ts +571 -0
  187. package/corpus/templates/design/.generated/bridge/nav.generated.ts +91 -0
  188. package/corpus/templates/design/.generated/bridge/sample.generated.ts +23 -0
  189. package/corpus/templates/design/.generated/bridge/shader-fill-preview.generated.ts +263 -0
  190. package/corpus/templates/design/.generated/bridge/shader-runtime.generated.ts +518 -0
  191. package/corpus/templates/design/.generated/bridge/tweak.generated.ts +20 -0
  192. package/corpus/templates/design/.generated/bridge/zoom.generated.ts +32 -0
  193. package/corpus/templates/design/AGENTS.md +88 -503
  194. package/corpus/templates/design/_gitignore +1 -0
  195. package/corpus/templates/dispatch/.agents/skills/upgrade-agent-native/SKILL.md +24 -2
  196. package/corpus/templates/dispatch/_gitignore +1 -0
  197. package/corpus/templates/dispatch/changelog/2026-07-24-signing-in-now-puts-you-in-your-companys-workspace.md +6 -0
  198. package/corpus/templates/forms/.agents/skills/upgrade-agent-native/SKILL.md +24 -2
  199. package/corpus/templates/forms/_gitignore +1 -0
  200. package/corpus/templates/forms/server/lib/public-form-ssr.ts +2 -2
  201. package/corpus/templates/macros/.agents/skills/upgrade-agent-native/SKILL.md +24 -2
  202. package/corpus/templates/macros/_gitignore +1 -0
  203. package/corpus/templates/mail/.agents/skills/upgrade-agent-native/SKILL.md +24 -2
  204. package/corpus/templates/mail/_gitignore +1 -0
  205. package/corpus/templates/plan/.agents/skills/upgrade-agent-native/SKILL.md +24 -2
  206. package/corpus/templates/plan/_gitignore +1 -0
  207. package/corpus/templates/slides/.agents/skills/upgrade-agent-native/SKILL.md +24 -2
  208. package/corpus/templates/slides/_gitignore +1 -0
  209. package/corpus/templates/slides/server/plugins/db.ts +4 -0
  210. package/corpus/templates/tasks/.agents/skills/upgrade-agent-native/SKILL.md +24 -2
  211. package/corpus/templates/tasks/AGENTS.md +1 -1
  212. package/corpus/templates/tasks/_gitignore +1 -0
  213. package/dist/a2a/activity.d.ts +4 -1
  214. package/dist/a2a/activity.d.ts.map +1 -1
  215. package/dist/a2a/activity.js +27 -16
  216. package/dist/a2a/activity.js.map +1 -1
  217. package/dist/agent/engine/builder-engine.d.ts +1 -0
  218. package/dist/agent/engine/builder-engine.d.ts.map +1 -1
  219. package/dist/agent/engine/builder-engine.js +31 -4
  220. package/dist/agent/engine/builder-engine.js.map +1 -1
  221. package/dist/agent/run-manager.d.ts.map +1 -1
  222. package/dist/agent/run-manager.js +18 -1
  223. package/dist/agent/run-manager.js.map +1 -1
  224. package/dist/agent/run-store.d.ts +1 -0
  225. package/dist/agent/run-store.d.ts.map +1 -1
  226. package/dist/agent/run-store.js +2 -1
  227. package/dist/agent/run-store.js.map +1 -1
  228. package/dist/agent/types.d.ts +12 -1
  229. package/dist/agent/types.d.ts.map +1 -1
  230. package/dist/agent/types.js +21 -1
  231. package/dist/agent/types.js.map +1 -1
  232. package/dist/chat-threads/store.d.ts +10 -0
  233. package/dist/chat-threads/store.d.ts.map +1 -1
  234. package/dist/chat-threads/store.js +41 -0
  235. package/dist/chat-threads/store.js.map +1 -1
  236. package/dist/checkpoints/index.d.ts +1 -0
  237. package/dist/checkpoints/index.d.ts.map +1 -1
  238. package/dist/checkpoints/index.js +1 -0
  239. package/dist/checkpoints/index.js.map +1 -1
  240. package/dist/checkpoints/route-match.d.ts +8 -0
  241. package/dist/checkpoints/route-match.d.ts.map +1 -0
  242. package/dist/checkpoints/route-match.js +13 -0
  243. package/dist/checkpoints/route-match.js.map +1 -0
  244. package/dist/cli/create.d.ts +35 -4
  245. package/dist/cli/create.d.ts.map +1 -1
  246. package/dist/cli/create.js +69 -19
  247. package/dist/cli/create.js.map +1 -1
  248. package/dist/cli/index.js +19 -0
  249. package/dist/cli/index.js.map +1 -1
  250. package/dist/cli/template-baseline.d.ts +54 -0
  251. package/dist/cli/template-baseline.d.ts.map +1 -0
  252. package/dist/cli/template-baseline.js +334 -0
  253. package/dist/cli/template-baseline.js.map +1 -0
  254. package/dist/cli/template-sync.d.ts +57 -0
  255. package/dist/cli/template-sync.d.ts.map +1 -0
  256. package/dist/cli/template-sync.js +787 -0
  257. package/dist/cli/template-sync.js.map +1 -0
  258. package/dist/cli/templates-meta.d.ts.map +1 -1
  259. package/dist/cli/templates-meta.js +1 -0
  260. package/dist/cli/templates-meta.js.map +1 -1
  261. package/dist/client/AssistantChat.d.ts +2 -1
  262. package/dist/client/AssistantChat.d.ts.map +1 -1
  263. package/dist/client/AssistantChat.js +38 -10
  264. package/dist/client/AssistantChat.js.map +1 -1
  265. package/dist/client/NewWorkspaceAppFlow.d.ts.map +1 -1
  266. package/dist/client/NewWorkspaceAppFlow.js +32 -2
  267. package/dist/client/NewWorkspaceAppFlow.js.map +1 -1
  268. package/dist/client/chat/message-components.d.ts +20 -0
  269. package/dist/client/chat/message-components.d.ts.map +1 -1
  270. package/dist/client/chat/message-components.js +81 -46
  271. package/dist/client/chat/message-components.js.map +1 -1
  272. package/dist/client/chat/tool-call-display.d.ts.map +1 -1
  273. package/dist/client/chat/tool-call-display.js +14 -6
  274. package/dist/client/chat/tool-call-display.js.map +1 -1
  275. package/dist/client/error-format.d.ts.map +1 -1
  276. package/dist/client/error-format.js +13 -0
  277. package/dist/client/error-format.js.map +1 -1
  278. package/dist/client/org/OrgSwitcher.d.ts +8 -1
  279. package/dist/client/org/OrgSwitcher.d.ts.map +1 -1
  280. package/dist/client/org/OrgSwitcher.js +3 -2
  281. package/dist/client/org/OrgSwitcher.js.map +1 -1
  282. package/dist/client/org/TeamPage.d.ts.map +1 -1
  283. package/dist/client/org/TeamPage.js +1 -1
  284. package/dist/client/org/TeamPage.js.map +1 -1
  285. package/dist/client/sse-event-processor.d.ts.map +1 -1
  286. package/dist/client/sse-event-processor.js +3 -0
  287. package/dist/client/sse-event-processor.js.map +1 -1
  288. package/dist/collab/awareness.d.ts +2 -2
  289. package/dist/collab/awareness.d.ts.map +1 -1
  290. package/dist/data-widgets/index.d.ts +3 -0
  291. package/dist/data-widgets/index.d.ts.map +1 -1
  292. package/dist/data-widgets/index.js +33 -0
  293. package/dist/data-widgets/index.js.map +1 -1
  294. package/dist/deploy/build.d.ts.map +1 -1
  295. package/dist/deploy/build.js +11 -7
  296. package/dist/deploy/build.js.map +1 -1
  297. package/dist/eject/provider-api-definitions.d.ts +1 -0
  298. package/dist/eject/provider-api-definitions.d.ts.map +1 -1
  299. package/dist/integrations/webhook-handler.d.ts.map +1 -1
  300. package/dist/integrations/webhook-handler.js +46 -9
  301. package/dist/integrations/webhook-handler.js.map +1 -1
  302. package/dist/org/auto-join-domain.d.ts +3 -2
  303. package/dist/org/auto-join-domain.d.ts.map +1 -1
  304. package/dist/org/auto-join-domain.js +1 -1
  305. package/dist/org/auto-join-domain.js.map +1 -1
  306. package/dist/org/context.d.ts.map +1 -1
  307. package/dist/org/context.js +84 -28
  308. package/dist/org/context.js.map +1 -1
  309. package/dist/org/index.d.ts +1 -0
  310. package/dist/org/index.d.ts.map +1 -1
  311. package/dist/org/index.js +1 -0
  312. package/dist/org/index.js.map +1 -1
  313. package/dist/org/service-identity.d.ts +43 -0
  314. package/dist/org/service-identity.d.ts.map +1 -0
  315. package/dist/org/service-identity.js +34 -0
  316. package/dist/org/service-identity.js.map +1 -0
  317. package/dist/provider-api/actions/custom-provider-registration.d.ts +14 -14
  318. package/dist/provider-api/actions/provider-api.d.ts +13 -11
  319. package/dist/provider-api/actions/provider-api.d.ts.map +1 -1
  320. package/dist/provider-api/index.d.ts +4 -0
  321. package/dist/provider-api/index.d.ts.map +1 -1
  322. package/dist/provider-api/index.js +17 -1
  323. package/dist/provider-api/index.js.map +1 -1
  324. package/dist/resources/handlers.d.ts +1 -1
  325. package/dist/scripts/docs/search.d.ts.map +1 -1
  326. package/dist/scripts/docs/search.js +12 -1
  327. package/dist/scripts/docs/search.js.map +1 -1
  328. package/dist/server/agent-chat/context-tools.d.ts.map +1 -1
  329. package/dist/server/agent-chat/context-tools.js +3 -3
  330. package/dist/server/agent-chat/context-tools.js.map +1 -1
  331. package/dist/server/agent-chat/framework-prompts.d.ts +8 -3
  332. package/dist/server/agent-chat/framework-prompts.d.ts.map +1 -1
  333. package/dist/server/agent-chat/framework-prompts.js +33 -62
  334. package/dist/server/agent-chat/framework-prompts.js.map +1 -1
  335. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  336. package/dist/server/agent-chat-plugin.js +16 -10
  337. package/dist/server/agent-chat-plugin.js.map +1 -1
  338. package/dist/server/agents-bundle.d.ts +18 -0
  339. package/dist/server/agents-bundle.d.ts.map +1 -1
  340. package/dist/server/agents-bundle.js +70 -4
  341. package/dist/server/agents-bundle.js.map +1 -1
  342. package/dist/server/auth.d.ts.map +1 -1
  343. package/dist/server/auth.js +4 -3
  344. package/dist/server/auth.js.map +1 -1
  345. package/dist/server/builder-browser.d.ts.map +1 -1
  346. package/dist/server/builder-browser.js +43 -19
  347. package/dist/server/builder-browser.js.map +1 -1
  348. package/dist/server/core-routes-plugin.js +2 -2
  349. package/dist/server/core-routes-plugin.js.map +1 -1
  350. package/dist/server/credential-provider.d.ts +38 -2
  351. package/dist/server/credential-provider.d.ts.map +1 -1
  352. package/dist/server/credential-provider.js +142 -64
  353. package/dist/server/credential-provider.js.map +1 -1
  354. package/dist/server/index.d.ts +1 -1
  355. package/dist/server/index.d.ts.map +1 -1
  356. package/dist/server/index.js +1 -1
  357. package/dist/server/index.js.map +1 -1
  358. package/dist/server/prompts/framework-core-compact.d.ts +1 -1
  359. package/dist/server/prompts/framework-core-compact.d.ts.map +1 -1
  360. package/dist/server/prompts/framework-core-compact.js +7 -13
  361. package/dist/server/prompts/framework-core-compact.js.map +1 -1
  362. package/dist/server/prompts/framework-core.d.ts +1 -1
  363. package/dist/server/prompts/framework-core.d.ts.map +1 -1
  364. package/dist/server/prompts/framework-core.js +10 -21
  365. package/dist/server/prompts/framework-core.js.map +1 -1
  366. package/dist/server/prompts/index.d.ts +1 -1
  367. package/dist/server/prompts/index.d.ts.map +1 -1
  368. package/dist/server/prompts/index.js +1 -1
  369. package/dist/server/prompts/index.js.map +1 -1
  370. package/dist/server/prompts/shared-rules.d.ts +16 -10
  371. package/dist/server/prompts/shared-rules.d.ts.map +1 -1
  372. package/dist/server/prompts/shared-rules.js +19 -10
  373. package/dist/server/prompts/shared-rules.js.map +1 -1
  374. package/dist/server/ssr-handler.d.ts +1 -1
  375. package/dist/server/ssr-handler.d.ts.map +1 -1
  376. package/dist/server/ssr-handler.js +10 -3
  377. package/dist/server/ssr-handler.js.map +1 -1
  378. package/dist/settings/user-settings.d.ts.map +1 -1
  379. package/dist/settings/user-settings.js +13 -1
  380. package/dist/settings/user-settings.js.map +1 -1
  381. package/dist/shared/cache-control.d.ts +52 -0
  382. package/dist/shared/cache-control.d.ts.map +1 -1
  383. package/dist/shared/cache-control.js +107 -0
  384. package/dist/shared/cache-control.js.map +1 -1
  385. package/dist/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +24 -2
  386. package/dist/templates/chat/_gitignore +1 -0
  387. package/dist/templates/default/.agents/skills/upgrade-agent-native/SKILL.md +24 -2
  388. package/dist/templates/headless/.agents/skills/upgrade-agent-native/SKILL.md +24 -2
  389. package/dist/templates/workspace-core/.agents/skills/performance/SKILL.md +19 -0
  390. package/dist/templates/workspace-core/.agents/skills/upgrade-agent-native/SKILL.md +24 -2
  391. package/dist/templates/workspace-core/.agents/skills/visual-answer/SKILL.md +1 -0
  392. package/dist/vite/agents-bundle-plugin.d.ts.map +1 -1
  393. package/dist/vite/agents-bundle-plugin.js +8 -7
  394. package/dist/vite/agents-bundle-plugin.js.map +1 -1
  395. package/dist/vite/client.d.ts.map +1 -1
  396. package/dist/vite/client.js +2 -0
  397. package/dist/vite/client.js.map +1 -1
  398. package/docs/content/actions.mdx +2 -2
  399. package/docs/content/agent-surfaces.mdx +1 -1
  400. package/docs/content/authentication.mdx +2 -0
  401. package/docs/content/deployment.mdx +36 -0
  402. package/docs/content/http-api.mdx +266 -0
  403. package/docs/content/syncing-template-changes.mdx +159 -0
  404. package/package.json +4 -3
  405. package/src/a2a/activity.ts +38 -27
  406. package/src/agent/engine/builder-engine.ts +35 -4
  407. package/src/agent/run-manager.ts +20 -1
  408. package/src/agent/run-store.ts +4 -1
  409. package/src/agent/types.ts +28 -8
  410. package/src/chat-threads/store.ts +45 -0
  411. package/src/checkpoints/index.ts +2 -0
  412. package/src/checkpoints/route-match.ts +13 -0
  413. package/src/cli/create.ts +105 -17
  414. package/src/cli/index.ts +20 -0
  415. package/src/cli/template-baseline.ts +410 -0
  416. package/src/cli/template-sync.ts +1004 -0
  417. package/src/cli/templates-meta.ts +1 -0
  418. package/src/client/AssistantChat.tsx +38 -12
  419. package/src/client/NewWorkspaceAppFlow.tsx +75 -10
  420. package/src/client/chat/message-components.tsx +127 -66
  421. package/src/client/chat/tool-call-display.tsx +29 -5
  422. package/src/client/error-format.ts +18 -0
  423. package/src/client/org/OrgSwitcher.tsx +30 -8
  424. package/src/client/org/TeamPage.tsx +7 -6
  425. package/src/client/sse-event-processor.ts +3 -0
  426. package/src/data-widgets/index.ts +41 -0
  427. package/src/deploy/build.ts +11 -9
  428. package/src/integrations/webhook-handler.ts +63 -9
  429. package/src/org/auto-join-domain.ts +4 -3
  430. package/src/org/context.ts +108 -39
  431. package/src/org/index.ts +5 -0
  432. package/src/org/service-identity.ts +60 -0
  433. package/src/provider-api/index.ts +22 -1
  434. package/src/scripts/docs/search.ts +12 -1
  435. package/src/server/__snapshots__/agent-chat-plugin.surface.spec.ts.snap +25 -36
  436. package/src/server/agent-chat/context-tools.ts +9 -4
  437. package/src/server/agent-chat/framework-prompts.ts +38 -66
  438. package/src/server/agent-chat-plugin.ts +17 -10
  439. package/src/server/agents-bundle.ts +84 -5
  440. package/src/server/auth.ts +4 -3
  441. package/src/server/builder-browser.ts +47 -19
  442. package/src/server/core-routes-plugin.ts +2 -2
  443. package/src/server/credential-provider.ts +209 -68
  444. package/src/server/index.ts +3 -0
  445. package/src/server/prompts/framework-core-compact.ts +6 -13
  446. package/src/server/prompts/framework-core.ts +9 -21
  447. package/src/server/prompts/index.ts +0 -1
  448. package/src/server/prompts/shared-rules.ts +19 -11
  449. package/src/server/ssr-handler.ts +13 -2
  450. package/src/settings/user-settings.ts +13 -1
  451. package/src/shared/cache-control.ts +141 -0
  452. package/src/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +24 -2
  453. package/src/templates/chat/_gitignore +1 -0
  454. package/src/templates/default/.agents/skills/upgrade-agent-native/SKILL.md +24 -2
  455. package/src/templates/headless/.agents/skills/upgrade-agent-native/SKILL.md +24 -2
  456. package/src/templates/workspace-core/.agents/skills/performance/SKILL.md +19 -0
  457. package/src/templates/workspace-core/.agents/skills/upgrade-agent-native/SKILL.md +24 -2
  458. package/src/templates/workspace-core/.agents/skills/visual-answer/SKILL.md +1 -0
  459. package/src/vite/agents-bundle-plugin.ts +7 -6
  460. package/src/vite/client.ts +5 -0
@@ -15,7 +15,6 @@ import {
15
15
  FRAMEWORK_CONTEXT_SECTIONS,
16
16
  } from "./context-tools.js";
17
17
  import { lazyFs } from "./lazy-fs.js";
18
- import { compactPromptLine } from "./prompt-resources.js";
19
18
 
20
19
  // ---------------------------------------------------------------------------
21
20
  // Framework-level system prompt assembly (production/dev, full/compact),
@@ -23,8 +22,6 @@ import { compactPromptLine } from "./prompt-resources.js";
23
22
  // block, and the codebase file-tree walker used by a few dev-mode tools.
24
23
  // ---------------------------------------------------------------------------
25
24
 
26
- const MAX_ACTION_SUMMARY_DESCRIPTION_CHARS = 140;
27
-
28
25
  /**
29
26
  * Framework-level instructions injected into every agent's system prompt.
30
27
  * Prompt text lives in packages/core/src/server/prompts/ so this file stays
@@ -60,68 +57,30 @@ export function buildFrameworkPrompts(
60
57
  const extensionInstructionsFull = extensionToolsEnabled
61
58
  ? `### Generative UI and Extensions (Mini-Apps)
62
59
 
63
- In Act mode, if the user asks for generated interactive UI in chat, choose the smallest extension action that matches the lifetime:
64
-
65
- - For a **one-time inline UI** that answers the current chat turn (knobs, controls, pickers, calculators, temporary dashboards, visualizers), call \`render-inline-extension\` immediately with a self-contained Alpine.js HTML body. It renders inside the transcript and is not saved.
66
- - For a **reusable or saved UI** (an extension/widget/dashboard/calculator/mini-app the user can reopen from Extensions), call \`create-extension\` with a self-contained Alpine.js HTML body. It saves to the Extensions view and also renders inline in chat.
67
- - To **reuse an existing saved extension inline**, call \`show-extension-inline\` with its id, or a search string when the id is unknown.
68
-
69
- These are **NOT** source-code changes and do **NOT** go through \`connect-builder\`. Extensions are sandboxed mini-apps — no source files are touched, no PR is opened, no build is required. Saved extensions can be edited later via \`update-extension\`.
60
+ In Act mode, if the user asks for generated interactive UI in chat, choose the smallest extension action for the lifetime: \`render-inline-extension\` (one-off, chat-only), \`create-extension\` (saved/reusable), \`show-extension-inline\` (reopen a saved one), or \`update-extension\` (edit an existing one) — call the right one directly, without a "let me build…" preamble. Each tool's own description covers its exact use case, arguments, and available helpers (appAction, dbQuery, extensionData, agentNative.ui.output, etc.). Extensions are sandboxed mini-apps, not source-code changes, and never go through \`connect-builder\`.
70
61
 
71
62
  If the app exposes native actions or instructions for dashboards, reports, analyses, charts, documents, decks, or other domain artifacts, use those app-native actions first. Choose an extension only when the user explicitly asks for an extension/custom mini-app, or when the app's native artifact format cannot faithfully express the requested interaction.
72
63
 
73
- Keep \`create-extension\` payloads compact enough to finish quickly. For complex extensions, create a useful working v1 first, then call \`update-extension\` with focused edits for refinements instead of trying to assemble one enormous initial tool input.
74
-
75
- Generated UI content can use appAction(), appFetch(), dbQuery(), extensionFetch(), extensionData, agentNative.ui.output(value, opts?), and agentNative.chat.send(...)/sendToAgentChat(...). Use appAction() for app data writes, and dbQuery() only for read-only inspection of known app SQL tables. It can receive chat inputs through slotContext/window.onSlotContext. Use agentNative.ui.output for passive current values from knobs, sliders, selections, and controls; it writes application state at \`inline-ui:<extensionId>:output\` scoped to the inline extension id returned by \`render-inline-extension\` or \`show-extension-inline\`. When the user later says "use that value", "apply the current setting", or similar, read it with \`readAppState("inline-ui:<id>:output")\` instead of asking them to send it again. Use agentNative.chat.send for visible submit/apply actions that should put a message into chat. Transient extensionData is browser-local and not agent-readable, synced, promoted, or garbage-collected; use application_state/appFetch, appAction, ui.output, or chat.send for anything the agent or app must observe. Use semantic Tailwind classes like bg-background, text-foreground, bg-primary, border-border, and text-muted-foreground so the UI inherits the parent app theme.
76
-
77
- If the user asks to change, edit, fix, style, rename, or add behavior to an existing extension/widget/dashboard/calculator/mini-app, use the current extension id from \`<current-screen>\` or \`<current-url>\` when present. Call \`get-extension\` only if you need to inspect its content, then call \`update-extension\` with exactly \`id\`, \`operation\`, and \`payloadJson\`; encode the operation payload as a JSON string and never send empty placeholder fields. After one content read, keep the body in working memory and use \`operation="edit"\` with focused \`edits\`/\`patches\` inside \`payloadJson\`; do not loop on repeated \`get-extension\` + \`run-code\` string scans before writing. For a data-only repair, preserve the existing layout, CSS, copy, and interactions. Use \`operation="replace"\` only when the user explicitly requests a broad visual rewrite or supplies a complete replacement body. Use \`operation="metadata"\` for name/description/icon, and use \`set-resource-visibility\` for sharing changes. If a focused patch fails, read the current body and change the target rather than retrying identical arguments. Use \`list-extensions\` only when no current id/name is available. Existing extension edits are SQL data updates, not source-code changes, even when the request says "change the UI" or "fix this". Do **NOT** call \`connect-builder\` for existing extension edits.
78
-
79
- In Act mode, when in doubt — if the request asks for a new small interactive utility and does not need reuse, choose \`render-inline-extension\`; if it mentions saving/reuse or asks for an extension/widget/dashboard/calculator/mini-app, choose \`create-extension\`. If it references an existing one or the current extension page, choose \`update-extension\`. Do **not** preface the call with planning text like "let me build the dashboard…" — just call the right extension action directly.
80
-
81
- Note: "extension" is the user-facing primitive (the sandboxed Alpine.js mini-app). Don't confuse it with the LLM concept of "tools" (function calls) — those are how you invoke ANY action, including \`create-extension\` itself.
82
-
83
- For existing extensions, use \`get-extension\` or \`update-extension\` directly when \`<current-screen>\` or \`<current-url>\` provides an \`extensionId\`. Use \`list-extensions\` only to browse or resolve an unknown name. If the user wants a shared extension removed only from their view, use \`hide-extension\` — do not query or mutate the legacy \`tools\` table directly.
84
-
85
- ### Extensions vs. Code Changes — Pick the Right Path
86
-
87
- Route by the exact outcome, not by whether the user calls it an extension. Extensions render in their own sandboxed iframe, either on their own page or inside an existing named slot. They CANNOT change the host app's nav, restyle or inject elements into existing native components, replace built-in views, or render at an arbitrary location that has no slot.
64
+ Editing an existing extension (fix, restyle, rename, add behavior) is a SQL data update call \`update-extension\` directly using the extensionId from \`<current-screen>\`/\`<current-url>\` when present; never call \`connect-builder\` for it.
88
65
 
89
- <routing>
90
- | The request is for… | Path |
91
- | ---------------------------------------------------------------- | ------------------------------ |
92
- | A one-off interactive answer inside chat (controls, picker, calculator, temporary visualizer) | \`render-inline-extension\` — inline only |
93
- | A new self-contained surface (widget, dashboard, calculator, viewer, list, tracker) | \`create-extension\` — ships instantly, no PR |
94
- | Loading a saved extension inside chat | \`show-extension-inline\` |
95
- | Editing an existing extension (fix, restyle, rename, add behavior) | \`update-extension\` |
96
- | The host app's own chrome (nav bar, sidebar, layout, routes, shipped components, existing styles, business logic) | \`connect-builder\` — a real source-code change |
97
- | UI inside or beside a native component where no named slot exists | \`connect-builder\` — add the native UI or a suitable slot in source |
98
- | Ambiguous, satisfiable either way (e.g. "give me an unread view") | \`render-inline-extension\` for chat-only, \`create-extension\` for reusable |
99
- </routing>
66
+ Extensions render only on their own page or inside an existing named slot; they cannot inject UI into arbitrary native components. If an extension could only approximate the request in a different location, do not silently downgrade the requirement and do not end with "extensions cannot do that." Briefly explain the boundary, then follow the normal source-code handoff so the app can still be customized fully.
100
67
 
101
- If an extension could only approximate the request in a different location, do not silently downgrade the requirement and do not end with "extensions cannot do that." Briefly explain the boundary, then follow the normal source-code handoff so the app can still be customized fully.
102
-
103
- Worked examples: "a widget showing unread emails grouped by sender", "a tracker for my newsletter subscriptions", "a custom kanban board with drag-and-drop rules the app does not have" → \`create-extension\`. "Add an Unread tab to the left navigation", "show local time beside every native Calendar attendee row", "make the subject lines wrap", "change the inbox grouping logic", "add a field to the compose form" → \`connect-builder\`.`
68
+ For helper APIs, Alpine.js patterns, the extension-vs-code-change boundary, and worked examples, read the \`extensions\` and \`generative-ui\` skills.`
104
69
  : `### Extensions Disabled
105
70
 
106
71
  Extension creation and management tools are disabled for this app. Do not claim you can create, edit, hide, or delete Agent-Native extensions unless the template exposes its own typed action for that workflow. For requests that would otherwise be handled as an extension/widget/dashboard/calculator mini-app, explain that this app has disabled extension tools and use the app's available actions instead.`;
107
72
  const extensionInstructionsCompact = extensionToolsEnabled
108
73
  ? `### Generative UI and Extensions (Mini-Apps)
109
74
 
110
- In Act mode, if the user asks for generated interactive UI in chat, call \`render-inline-extension\` for one-time inline controls/knobs/calculators/visualizers that do not need saving. If the user asks for an **extension**, **widget**, **dashboard**, **calculator**, or **mini-app** that should be reusable or saved, call \`create-extension\` with a self-contained Alpine.js HTML body. To load a saved extension inline, call \`show-extension-inline\`. These are NOT code changes extensions are sandboxed mini-apps. Do not preface with "let me build…" — just call the right extension action.
75
+ In Act mode, choose the smallest extension action for the lifetime: \`render-inline-extension\` (one-off, chat-only), \`create-extension\` (saved/reusable), \`show-extension-inline\` (reopen a saved one), or \`update-extension\` (edit an existing one) each tool's own description covers its use case and helpers. These are sandboxed mini-apps, not code changes; never route them through \`connect-builder\`. Do not preface with "let me build…" — just call the right extension action.
111
76
 
112
77
  Use app-native artifact actions first when they exist for dashboards, reports, analyses, charts, documents, decks, or similar domain artifacts. Pick \`create-extension\` only for explicit extension/custom mini-app requests or for behavior the native artifact format cannot support.
113
78
 
114
- Keep the first \`create-extension\` call compact and working. If the request is complex, create the v1 first and then refine with focused \`update-extension\` edits.
115
-
116
- Generated UI can read chat inputs from slotContext/window.onSlotContext, see/update app state through appFetch/appAction, use extensionData, record passive current values through agentNative.ui.output(value, opts?), and send visible results through agentNative.chat.send(...) or sendToAgentChat(...). ui.output writes \`inline-ui:<extensionId>:output\` in application state; when the user asks to use the current slider/selection/value, read \`readAppState("inline-ui:<id>:output")\`. Transient extensionData is browser-local only, so do not rely on it for values the agent or app must observe. Use semantic Tailwind theme classes.
117
-
118
- If the user asks to change, edit, fix, style, rename, or add behavior to an existing extension/widget/dashboard/calculator/mini-app, use the current extension id from \`<current-screen>\` or \`<current-url>\` when present. Call \`get-extension\` only if you need to inspect its content, then call \`update-extension\` with exactly \`id\`, \`operation\`, and \`payloadJson\`; encode the operation payload as a JSON string and never send empty placeholder fields. After one content read, use \`operation="edit"\` with focused \`edits\`/\`patches\` inside \`payloadJson\`; do not repeatedly re-read and scan the same HTML with \`run-code\` before writing. For a data-only repair, preserve the existing layout, CSS, copy, and interactions. Use \`operation="replace"\` only when the user explicitly requests a broad visual rewrite or supplies a complete replacement body. Use \`operation="metadata"\` for name/description/icon, and use \`set-resource-visibility\` for sharing changes. If a focused patch fails, read the current body and change the target rather than retrying identical arguments. Use \`list-extensions\` only when no current id/name is available. Existing extension edits are SQL data updates, not source-code changes. Do NOT call \`connect-builder\` for them.
79
+ Editing an existing extension is a data update call \`update-extension\` directly using the extensionId from \`<current-screen>\`/\`<current-url>\` when present; never \`connect-builder\`.
119
80
 
120
- For existing extensions, use \`get-extension\` or \`update-extension\` directly when \`<current-screen>\` or \`<current-url>\` provides an \`extensionId\`. Use \`list-extensions\` only to browse or resolve an unknown name. Use \`hide-extension\` when the user wants a shared extension removed only from their own view. Do not query the legacy \`tools\` table directly.
81
+ Extensions can render only on their own page or in an existing named slot; they cannot inject UI into arbitrary native components. If the exact request changes host chrome, native components, layout, styles, routes, business logic, or needs placement where no slot exists, treat it as a source-code change and use the normal \`connect-builder\` flow even if the user called it an extension. Never stop at "extensions cannot do that" or silently offer a different placement; explain the boundary briefly and continue the code-change handoff.
121
82
 
122
- ### Extensions vs. Code Changes Pick the Right Path
123
-
124
- If the user wants a **one-off interactive answer in chat**, use \`render-inline-extension\`. If they want a **new reusable self-contained surface** (custom widget, dashboard, list, viewer, calculator), use \`create-extension\` — extensions ship instantly without a PR. Extensions can render only on their own page or in an existing named slot; they cannot inject UI into arbitrary native components. If the exact request changes host chrome, native components, layout, styles, routes, business logic, or needs placement where no slot exists, treat it as a source-code change and use the normal \`connect-builder\` flow even if the user called it an extension. Never stop at "extensions cannot do that" or silently offer a different placement; explain the boundary briefly and continue the code-change handoff.`
83
+ See the \`extensions\` and \`generative-ui\` skills for helper APIs, Alpine.js patterns, and worked examples.`
125
84
  : `### Extensions Disabled
126
85
 
127
86
  Extension creation and management tools are disabled for this app. Do not claim you can create, edit, hide, or delete Agent-Native extensions unless the template exposes its own typed action for that workflow.`;
@@ -265,15 +224,20 @@ export async function buildSchemaBlock(
265
224
 
266
225
  /**
267
226
  * Generates a system prompt section describing registered template actions.
268
- * This helps the agent prefer template-specific actions over raw db-query/db-exec.
269
227
  *
270
228
  * Two output modes:
271
229
  *
272
230
  * - `"tool"` — used in production, where template actions are registered
273
- * as native Anthropic tools. Output reads `name(arg*: type; ...) desc`.
231
+ * as native Anthropic tools. The native tool schema already carries each
232
+ * action's name, full description, and parameters, so this mode does NOT
233
+ * re-list every action — it only surfaces what the tool list can't:
234
+ * native-chat-widget annotations and a `tool-search` pointer for actions
235
+ * omitted from the initial tool set.
274
236
  * - `"cli"` — used in dev, where template actions are NOT registered as
275
237
  * native tools and must be invoked via `bash(command="pnpm action ...")`.
276
- * Output reads `pnpm action name --arg <type> [--opt <type>] desc`.
238
+ * This listing is load-bearing here (there is no tool schema to fall
239
+ * back on), so it still emits the full
240
+ * `pnpm action name --arg <type> [--opt <type>] — desc` line per action.
277
241
  */
278
242
  export function generateActionsPrompt(
279
243
  registry: Record<string, ActionEntry>,
@@ -294,23 +258,31 @@ export function generateActionsPrompt(
294
258
  : "";
295
259
 
296
260
  if (mode === "tool") {
297
- const summaryLines = actionEntries.map(([name, entry]) => {
298
- const desc = compactPromptLine(
299
- entry.tool.description,
300
- MAX_ACTION_SUMMARY_DESCRIPTION_CHARS,
261
+ // Native tool schemas already carry name + full description + params
262
+ // for every action, so this section only needs to surface what the tool
263
+ // list itself can't: which actions render a native chat widget, and
264
+ // which actions exist but aren't loaded as initial tools yet.
265
+ const widgetLines = actionEntries
266
+ .filter(([, entry]) => typeof entry.chatUI?.renderer === "string")
267
+ .map(
268
+ ([name, entry]) =>
269
+ `- \`${name}\` — Native chat widget: \`${entry.chatUI?.renderer ?? ""}\`.`,
301
270
  );
302
- return `- \`${name}\` — ${desc}${nativeWidgetNote(entry)}`;
303
- });
304
271
 
305
- return `\n\n## Available Actions
306
-
307
- **Use these actions directly as tool calls.** They handle database access, validation, and business logic internally. The native tool schemas contain the full parameter details.
272
+ const sections: string[] = [];
273
+ if (widgetLines.length > 0) {
274
+ sections.push(
275
+ `**Actions that render a native chat widget** — call these directly for their table/chart/insights view instead of recreating it in prose:\n\n${widgetLines.join("\n")}`,
276
+ );
277
+ }
278
+ if (omittedActionCount > 0) {
279
+ sections.push(
280
+ `${omittedActionCount} less-common app action${omittedActionCount === 1 ? " is" : "s are"} available on demand. Use \`tool-search\` with a specific capability query to load the matching schemas when needed.`,
281
+ );
282
+ }
283
+ if (sections.length === 0) return "";
308
284
 
309
- ${summaryLines.join("\n")}${
310
- omittedActionCount > 0
311
- ? `\n\n${omittedActionCount} less-common app action${omittedActionCount === 1 ? " is" : "s are"} available on demand. Use \`tool-search\` with a specific capability query to load the matching schemas when needed.`
312
- : ""
313
- }`;
285
+ return `\n\n## Available Actions\n\n${sections.join("\n\n")}`;
314
286
  }
315
287
 
316
288
  const lines = actionEntries.map(([name, entry]) => {
@@ -123,6 +123,7 @@ import {
123
123
  type ChatThreadScope,
124
124
  type ForkThreadSourceSnapshot,
125
125
  } from "../chat-threads/store.js";
126
+ import { isCheckpointRestorePath } from "../checkpoints/route-match.js";
126
127
  import { createDbAdminAgentTools } from "../db-admin/agent-tools.js";
127
128
  import { isTransientDatabaseError } from "../db/client.js";
128
129
  import {
@@ -4770,11 +4771,9 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
4770
4771
  }
4771
4772
  }
4772
4773
 
4773
- // POST /checkpoints — restore to a checkpoint
4774
- // h3 prefix-matches, so /checkpoints/restore hits this handler with
4775
- // event.path containing "/restore".
4776
- const remainder = (event.path || "").replace(/^\/+/, "");
4777
- if (method === "POST" && remainder.startsWith("restore")) {
4774
+ // POST /checkpoints/restore — restore to a checkpoint.
4775
+ const restorePath = event.path || event.node?.req?.url || "";
4776
+ if (method === "POST" && isCheckpointRestorePath(restorePath)) {
4778
4777
  if (!canToggle) {
4779
4778
  setResponseStatus(event, 403);
4780
4779
  return { error: "Checkpoints only available in dev mode" };
@@ -4785,17 +4784,25 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
4785
4784
  }
4786
4785
  const body = await readBody(event);
4787
4786
  const checkpointId = body?.checkpointId;
4788
- if (!checkpointId) {
4787
+ const restoreRunId =
4788
+ typeof body?.runId === "string" ? body.runId : "";
4789
+ if (!checkpointId && !restoreRunId) {
4789
4790
  setResponseStatus(event, 400);
4790
- return { error: "checkpointId is required" };
4791
+ return { error: "checkpointId or runId is required" };
4791
4792
  }
4792
4793
  try {
4793
- const { getCheckpointById } =
4794
+ const { getCheckpointById, getCheckpointByRunId } =
4794
4795
  await import("../checkpoints/store.js");
4795
- const checkpoint = await getCheckpointById(checkpointId);
4796
+ const checkpoint = checkpointId
4797
+ ? await getCheckpointById(checkpointId)
4798
+ : await getCheckpointByRunId(restoreRunId);
4796
4799
  if (!checkpoint) {
4797
4800
  setResponseStatus(event, 404);
4798
- return { error: "Checkpoint not found" };
4801
+ return {
4802
+ error: restoreRunId
4803
+ ? "No checkpoint was saved for this turn, so there is nothing to restore."
4804
+ : "Checkpoint not found",
4805
+ };
4799
4806
  }
4800
4807
  const owner = await getOwnerFromEvent(event);
4801
4808
  const thread = await getThread(checkpoint.threadId);
@@ -60,6 +60,16 @@ export interface Skill {
60
60
  * `ls` call. Empty array if the skill is single-file.
61
61
  */
62
62
  extraFiles: string[];
63
+ /**
64
+ * Text content of eligible sub-files (progressive-disclosure references),
65
+ * keyed by the same skill-dir-relative path used in `extraFiles`. Only
66
+ * populated for text extensions under the per-file/per-skill caps in
67
+ * `readSkillsDir` — files that exist but were skipped for size still show
68
+ * up in `extraFiles`, just not here. This is what makes reference content
69
+ * actually readable by the runtime agent (via docs-search); it is never
70
+ * injected into a prompt.
71
+ */
72
+ files: Record<string, string>;
63
73
  }
64
74
 
65
75
  export interface AgentsBundle {
@@ -176,6 +186,23 @@ const TEMPLATE_SKILLS_DIRS = [
176
186
  path.join(".agent", "skills"),
177
187
  ] as const;
178
188
 
189
+ /**
190
+ * Extensions eligible to have their content inlined into `Skill.files`.
191
+ * Binary/asset sub-files (images, scripts, etc.) are always listed in
192
+ * `extraFiles` but never read into memory.
193
+ */
194
+ const READABLE_SUBFILE_EXTENSIONS = new Set([".md", ".txt", ".json"]);
195
+ /**
196
+ * Per-file and per-skill caps on inlined reference content. This content is
197
+ * bundled into the virtual module (and therefore the server bundle) for
198
+ * every deployment target, so it must stay small even though it's never
199
+ * added to a prompt — only fetched on demand via docs-search. Measured
200
+ * against this repo's skills (largest single sub-file ~20KB, largest
201
+ * per-skill sub-file total ~83KB), these caps have generous headroom.
202
+ */
203
+ const MAX_SUBFILE_BYTES = 64 * 1024;
204
+ const MAX_SKILL_FILES_BYTES = 256 * 1024;
205
+
179
206
  /**
180
207
  * Paths to a workspace-core's agent resources, for merging into a template's
181
208
  * bundle. All fields optional — pass null for any missing piece.
@@ -217,6 +244,8 @@ function readSkillsDir(
217
244
  if (skipExistingNames && out[name]) continue; // Template wins
218
245
 
219
246
  const extraFiles: string[] = [];
247
+ const files: Record<string, string> = {};
248
+ let skillFilesBytes = 0;
220
249
  try {
221
250
  const walk = (subdir: string, prefix: string) => {
222
251
  for (const e of fs.readdirSync(subdir, { withFileTypes: true })) {
@@ -229,6 +258,17 @@ function readSkillsDir(
229
258
  } catch {}
230
259
  } else if (e.isFile() && e.name !== "SKILL.md") {
231
260
  extraFiles.push(rel);
261
+ const ext = path.extname(e.name).toLowerCase();
262
+ if (!READABLE_SUBFILE_EXTENSIONS.has(ext)) continue;
263
+ try {
264
+ const stat = fs.statSync(abs);
265
+ if (stat.size > MAX_SUBFILE_BYTES) continue;
266
+ if (skillFilesBytes + stat.size > MAX_SKILL_FILES_BYTES) {
267
+ continue;
268
+ }
269
+ files[rel] = fs.readFileSync(abs, "utf-8");
270
+ skillFilesBytes += stat.size;
271
+ } catch {}
232
272
  }
233
273
  }
234
274
  };
@@ -245,6 +285,7 @@ function readSkillsDir(
245
285
  content,
246
286
  dir: path.relative(rootForRelative, skillDirAbs).replace(/\\/g, "/"),
247
287
  extraFiles,
288
+ files,
248
289
  };
249
290
  } catch {
250
291
  // Skip unreadable skills
@@ -397,7 +438,7 @@ export function getDevelopmentSkills(bundle: AgentsBundle): Skill[] {
397
438
  );
398
439
  }
399
440
 
400
- function skillDocsSlug(name: string): string {
441
+ export function skillDocsSlug(name: string): string {
401
442
  return `skill-${name
402
443
  .trim()
403
444
  .toLowerCase()
@@ -405,6 +446,28 @@ function skillDocsSlug(name: string): string {
405
446
  .replace(/^-+|-+$/g, "")}`;
406
447
  }
407
448
 
449
+ function subfileSlugSuffix(relPath: string): string {
450
+ return relPath
451
+ .replace(/\.[^./]+$/, "")
452
+ .trim()
453
+ .toLowerCase()
454
+ .replace(/[^a-z0-9]+/g, "-")
455
+ .replace(/^-+|-+$/g, "");
456
+ }
457
+
458
+ /**
459
+ * Slug docs-search resolves a skill sub-file (reference) content by. Kept in
460
+ * sync with the `skill-<name>--<subpath-slug>` docs it emits in
461
+ * `scripts/docs/search.ts` so the prompt hint always points at something the
462
+ * agent can actually read.
463
+ */
464
+ export function skillSubfileDocsSlug(
465
+ skillName: string,
466
+ relPath: string,
467
+ ): string {
468
+ return `${skillDocsSlug(skillName)}--${subfileSlugSuffix(relPath)}`;
469
+ }
470
+
408
471
  function generateSkillsPromptBlockForEntries(
409
472
  entries: Skill[],
410
473
  mode: "runtime" | "development",
@@ -412,10 +475,26 @@ function generateSkillsPromptBlockForEntries(
412
475
  if (entries.length === 0) return "";
413
476
 
414
477
  const lines = entries.map((s) => {
415
- const extras =
416
- s.extraFiles.length > 0
417
- ? ` (also contains: ${s.extraFiles.join(", ")})`
418
- : "";
478
+ let extras = "";
479
+ if (s.extraFiles.length > 0) {
480
+ if (mode === "runtime") {
481
+ const readable = s.extraFiles.filter((f) => f in s.files);
482
+ const unreadable = s.extraFiles.filter((f) => !(f in s.files));
483
+ const parts: string[] = [];
484
+ if (readable.length > 0) {
485
+ const refIds = readable.map((f) => subfileSlugSuffix(f)).join(", ");
486
+ parts.push(
487
+ `refs via docs-search --slug "${skillDocsSlug(s.meta.name)}--<ref>": ${refIds}`,
488
+ );
489
+ }
490
+ if (unreadable.length > 0) {
491
+ parts.push(`also contains: ${unreadable.join(", ")}`);
492
+ }
493
+ extras = ` (${parts.join("; ")})`;
494
+ } else {
495
+ extras = ` (also contains: ${s.extraFiles.join(", ")})`;
496
+ }
497
+ }
419
498
  const runtimeHint =
420
499
  mode === "runtime"
421
500
  ? ` Read with \`docs-search --slug "${skillDocsSlug(s.meta.name)}"\` before starting a task it applies to.`
@@ -81,7 +81,7 @@ import {
81
81
  } from "../mcp/route-paths.js";
82
82
  import { readBody } from "../server/h3-helpers.js";
83
83
  import { putSetting } from "../settings/store.js";
84
- import { DEFAULT_SSR_CACHE_HEADERS } from "../shared/cache-control.js";
84
+ import { resolveSsrCacheHeaders } from "../shared/cache-control.js";
85
85
  import { extractOAuthStateAppId } from "../shared/oauth-state.js";
86
86
  import {
87
87
  AGENT_NATIVE_SOCIAL_IMAGE_ALT,
@@ -1658,8 +1658,9 @@ function loginHtmlResponse(loginHtml: string, event: H3Event): Response {
1658
1658
  // template roots do not invoke origin just to render anonymous login UI.
1659
1659
  // The login markup is env-INDEPENDENT (a Google-only app always renders
1660
1660
  // a working button); the analytics script is public build configuration,
1661
- // not user/session state. Never downgrade this to private/no-store.
1662
- ...DEFAULT_SSR_CACHE_HEADERS,
1661
+ // not user/session state. Never vary this per request — the
1662
+ // deployment-wide override inside the resolver is the only knob.
1663
+ ...resolveSsrCacheHeaders(),
1663
1664
  "X-Robots-Tag": "noindex, nofollow",
1664
1665
  },
1665
1666
  },
@@ -1630,8 +1630,16 @@ export async function runBuilderAgent(
1630
1630
  "Builder project ID is not configured. Set DISPATCH_BUILDER_PROJECT_ID, BUILDER_BRANCH_PROJECT_ID, or BUILDER_PROJECT_ID.",
1631
1631
  );
1632
1632
  }
1633
- const builderUserId = args.userId || creds.userId || undefined;
1634
- const builderUserEmail = builderUserId ? undefined : args.userEmail;
1633
+ // The requesting user's email must win over any stored BUILDER_USER_ID.
1634
+ // The connect flow always persists BUILDER_USER_ID, so preferring it here
1635
+ // attributed every branch to whoever connected the credential — at org scope
1636
+ // that is the admin, not the person who asked. Builder resolves userEmail
1637
+ // against Space membership, so fall back to the credential's user id when
1638
+ // there is no session email or the email is not a member.
1639
+ const requestedEmail = args.userEmail?.trim() || undefined;
1640
+ const fallbackUserId = args.userId || creds.userId || undefined;
1641
+ const builderUserEmail = requestedEmail;
1642
+ const builderUserId = requestedEmail ? undefined : fallbackUserId;
1635
1643
  if (!builderUserEmail && !builderUserId) {
1636
1644
  throw new Error("userEmail or userId is required");
1637
1645
  }
@@ -1639,27 +1647,47 @@ export async function runBuilderAgent(
1639
1647
  const url = new URL("/agents/run", getBuilderApiHost());
1640
1648
  url.searchParams.set("apiKey", creds.publicKey);
1641
1649
 
1642
- const body: Record<string, unknown> = {
1643
- userMessage: { userPrompt: args.prompt },
1644
- projectId,
1650
+ const postRun = async (actor: { userEmail?: string; userId?: string }) => {
1651
+ const body: Record<string, unknown> = {
1652
+ userMessage: { userPrompt: args.prompt },
1653
+ projectId,
1654
+ };
1655
+ if (args.branchName) body.branchName = args.branchName;
1656
+ if (actor.userEmail) body.userEmail = actor.userEmail;
1657
+ if (actor.userId) body.userId = actor.userId;
1658
+
1659
+ const response = await fetch(url, {
1660
+ method: "POST",
1661
+ headers: {
1662
+ Authorization: `Bearer ${creds.privateKey}`,
1663
+ "Content-Type": "application/json",
1664
+ },
1665
+ body: JSON.stringify(body),
1666
+ });
1667
+ const parsed = (await response.json().catch(() => ({}))) as Record<
1668
+ string,
1669
+ unknown
1670
+ >;
1671
+ return { response, parsed };
1645
1672
  };
1646
- if (args.branchName) body.branchName = args.branchName;
1647
- if (builderUserEmail) body.userEmail = builderUserEmail;
1648
- if (builderUserId) body.userId = builderUserId;
1649
1673
 
1650
- const response = await fetch(url, {
1651
- method: "POST",
1652
- headers: {
1653
- Authorization: `Bearer ${creds.privateKey}`,
1654
- "Content-Type": "application/json",
1655
- },
1656
- body: JSON.stringify(body),
1674
+ let { response, parsed } = await postRun({
1675
+ userEmail: builderUserEmail,
1676
+ userId: builderUserId,
1657
1677
  });
1658
1678
 
1659
- const parsed = (await response.json().catch(() => ({}))) as Record<
1660
- string,
1661
- unknown
1662
- >;
1679
+ // Builder rejects an email that is not a member of the Space (403/404). Retry
1680
+ // once as the connected credential's user so a non-member still gets a branch,
1681
+ // rather than losing the run entirely.
1682
+ if (
1683
+ !response.ok &&
1684
+ (response.status === 403 || response.status === 404) &&
1685
+ builderUserEmail &&
1686
+ fallbackUserId
1687
+ ) {
1688
+ ({ response, parsed } = await postRun({ userId: fallbackUserId }));
1689
+ }
1690
+
1663
1691
  if (!response.ok) {
1664
1692
  const msg =
1665
1693
  typeof parsed.error === "string"
@@ -86,8 +86,8 @@ import {
86
86
  deleteUserSetting,
87
87
  } from "../settings/user-settings.js";
88
88
  import {
89
- DEFAULT_SSR_CACHE_HEADERS,
90
89
  EMPTY_SPECULATION_RULES,
90
+ resolveSsrCacheHeaders,
91
91
  } from "../shared/cache-control.js";
92
92
  import { EMBED_TARGET_HEADER } from "../shared/embed-auth.js";
93
93
  import { llmConnectionTrackingProperties } from "../shared/llm-connection.js";
@@ -1614,7 +1614,7 @@ export function createCoreRoutesPlugin(
1614
1614
  "application/speculationrules+json; charset=utf-8",
1615
1615
  );
1616
1616
  for (const [name, value] of Object.entries(
1617
- DEFAULT_SSR_CACHE_HEADERS,
1617
+ resolveSsrCacheHeaders(),
1618
1618
  )) {
1619
1619
  setResponseHeader(event, name, value);
1620
1620
  }