@agent-native/core 0.128.4 → 0.129.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 (343) hide show
  1. package/corpus/README.md +2 -2
  2. package/corpus/core/CHANGELOG.md +84 -0
  3. package/corpus/core/docs/content/template-design-collaboration-and-full-apps.mdx +3 -1
  4. package/corpus/core/package.json +6 -3
  5. package/corpus/core/src/a2a/client.ts +18 -4
  6. package/corpus/core/src/a2a/server.ts +19 -3
  7. package/corpus/core/src/a2a/types.ts +7 -0
  8. package/corpus/core/src/action.ts +43 -16
  9. package/corpus/core/src/agent/engine/ai-sdk-engine.ts +14 -10
  10. package/corpus/core/src/agent/production-agent.ts +41 -3
  11. package/corpus/core/src/agent/thread-data-builder.ts +5 -0
  12. package/corpus/core/src/chat-threads/migrations.ts +53 -0
  13. package/corpus/core/src/cli/create.ts +4 -0
  14. package/corpus/core/src/cli/skills-content/design-visual-edit-skill.ts +36 -16
  15. package/corpus/core/src/cli/skills.ts +16 -0
  16. package/corpus/core/src/client/AgentPanel.tsx +9 -5
  17. package/corpus/core/src/client/AssistantChat.tsx +138 -46
  18. package/corpus/core/src/client/MultiTabAssistantChat.tsx +16 -10
  19. package/corpus/core/src/client/agent-chat-adapter.ts +21 -3
  20. package/corpus/core/src/client/analytics.ts +159 -102
  21. package/corpus/core/src/client/chat/message-components.tsx +12 -5
  22. package/corpus/core/src/client/chat/runtime.ts +2 -1
  23. package/corpus/core/src/client/chat/tool-call-display.tsx +25 -2
  24. package/corpus/core/src/client/chat-model-groups.ts +3 -0
  25. package/corpus/core/src/client/client-status-requests.ts +161 -0
  26. package/corpus/core/src/client/settings/VoiceTranscriptionSection.tsx +2 -2
  27. package/corpus/core/src/client/sse-event-processor.ts +15 -3
  28. package/corpus/core/src/client/use-agent-engine-configured.ts +54 -50
  29. package/corpus/core/src/client/use-chat-models.ts +16 -11
  30. package/corpus/core/src/client/use-chat-threads.ts +32 -9
  31. package/corpus/core/src/client/use-session.ts +4 -5
  32. package/corpus/core/src/db/client.ts +83 -8
  33. package/corpus/core/src/db/ensure-additive-columns.ts +31 -20
  34. package/corpus/core/src/db/migrations.ts +22 -2
  35. package/corpus/core/src/mcp/approval-store.ts +99 -0
  36. package/corpus/core/src/mcp/build-server.ts +579 -303
  37. package/corpus/core/src/mcp/embed-app.ts +1 -1
  38. package/corpus/core/src/mcp/oauth-client-metadata.ts +380 -0
  39. package/corpus/core/src/mcp/oauth-route.ts +57 -52
  40. package/corpus/core/src/mcp/screen-memory-stdio.ts +400 -378
  41. package/corpus/core/src/mcp/server.ts +29 -145
  42. package/corpus/core/src/mcp/stdio.ts +72 -80
  43. package/corpus/core/src/mcp-client/manager.ts +6 -10
  44. package/corpus/core/src/mcp-client/oauth-client.ts +127 -36
  45. package/corpus/core/src/mcp-client/oauth-routes.ts +16 -6
  46. package/corpus/core/src/mcp-client/routes.ts +6 -5
  47. package/corpus/core/src/server/agent-capabilities.ts +20 -0
  48. package/corpus/core/src/server/agent-chat/action-filters-a2a.ts +27 -0
  49. package/corpus/core/src/server/agent-chat-plugin.ts +18 -0
  50. package/corpus/core/src/server/transcribe-voice.ts +14 -5
  51. package/corpus/core/src/templates/default/.agents/skills/security/SKILL.md +13 -2
  52. package/corpus/core/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +5 -2
  53. package/corpus/core/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +18 -0
  54. package/corpus/core/src/templates/workspace-core/.agents/skills/security/SKILL.md +13 -2
  55. package/corpus/templates/analytics/.agents/skills/security/SKILL.md +13 -2
  56. package/corpus/templates/analytics/app/components/dashboard/DashboardPanelSkeleton.tsx +1 -10
  57. package/corpus/templates/analytics/app/global.css +0 -31
  58. package/corpus/templates/analytics/app/lib/sql-query.ts +46 -20
  59. package/corpus/templates/analytics/changelog/2026-07-28-analytics-dashboard-loading-states-now-use-a-simpler-standar.md +6 -0
  60. package/corpus/templates/analytics/changelog/2026-07-28-analytics-dashboards-now-load-first-party-charts-reliably-in.md +6 -0
  61. package/corpus/templates/analytics/server/lib/first-party-analytics-cache.ts +42 -16
  62. package/corpus/templates/analytics/server/lib/first-party-analytics.ts +4 -2
  63. package/corpus/templates/analytics/shared/sql-query-limits.ts +1 -0
  64. package/corpus/templates/assets/.agents/skills/security/SKILL.md +13 -2
  65. package/corpus/templates/brain/.agents/skills/security/SKILL.md +13 -2
  66. package/corpus/templates/calendar/.agents/skills/security/SKILL.md +13 -2
  67. package/corpus/templates/chat/.agents/skills/security/SKILL.md +13 -2
  68. package/corpus/templates/chat/README.md +0 -2
  69. package/corpus/templates/clips/.agents/skills/security/SKILL.md +13 -2
  70. package/corpus/templates/clips/app/components/player/player-controls.tsx +3 -6
  71. package/corpus/templates/clips/app/routes/r.$recordingId.tsx +6 -2
  72. package/corpus/templates/clips/app/routes/share.$shareId.tsx +3 -1
  73. package/corpus/templates/clips/changelog/2026-07-28-copied-share-links-no-longer-leave-an-unnecessary-confirmati.md +6 -0
  74. package/corpus/templates/clips/changelog/2026-07-28-playback-skip-controls-no-longer-show-overlapping-numbers.md +6 -0
  75. package/corpus/templates/clips/changelog/2026-07-28-public-clips-share-buttons-now-use-a-clean-text-only-label.md +6 -0
  76. package/corpus/templates/clips/desktop/src/app.tsx +14 -17
  77. package/corpus/templates/clips/desktop/src/overlays/live-audio-bars.tsx +3 -1
  78. package/corpus/templates/clips/desktop/src/styles.css +13 -10
  79. package/corpus/templates/clips/desktop/src-tauri/src/recording_indicator.rs +2 -2
  80. package/corpus/templates/clips/desktop/src-tauri/src/whisper_speech.rs +36 -0
  81. package/corpus/templates/content/.agents/skills/security/SKILL.md +13 -2
  82. package/corpus/templates/content/actions/_builder-cms-read-client.ts +155 -34
  83. package/corpus/templates/content/actions/_builder-docs-client.ts +151 -30
  84. package/corpus/templates/content/actions/stage-builder-source-bulk-update.ts +5 -2
  85. package/corpus/templates/content/app/root.tsx +35 -14
  86. package/corpus/templates/content/changelog/2026-07-28-builder-backed-files-media-fields-now-accept-direct-file-url.md +6 -0
  87. package/corpus/templates/content/changelog/2026-07-28-builder-content-reads-now-negotiate-the-newest-mcp-protocol-.md +6 -0
  88. package/corpus/templates/content/changelog/2026-07-28-public-content-pages-load-faster-before-the-optional-ask-sid.md +6 -0
  89. package/corpus/templates/design/.agents/skills/security/SKILL.md +13 -2
  90. package/corpus/templates/design/.agents/skills/visual-edit/SKILL.md +36 -16
  91. package/corpus/templates/design/.generated/bridge/editor-chrome.generated.ts +42 -3
  92. package/corpus/templates/design/actions/open-visual-edit.ts +2 -1
  93. package/corpus/templates/design/app/components/design/CanvasContextMenu.tsx +2 -2
  94. package/corpus/templates/design/app/components/design/DesignCanvas.tsx +14 -15
  95. package/corpus/templates/design/app/components/design/ResponsiveInteractBar.tsx +314 -0
  96. package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +88 -3
  97. package/corpus/templates/design/app/components/design/keyboard-shortcuts.ts +1 -1
  98. package/corpus/templates/design/app/hooks/useDesignHotkeys.ts +7 -6
  99. package/corpus/templates/design/app/i18n-data.ts +56 -11
  100. package/corpus/templates/design/app/i18n-responsive-interact.ts +183 -0
  101. package/corpus/templates/design/app/lib/agent-chat.ts +60 -0
  102. package/corpus/templates/design/app/pages/design-editor/responsive-interact.ts +89 -0
  103. package/corpus/templates/design/changelog/2026-07-28-design-edits-can-be-applied-through-the-host-coding-agent-fr.md +6 -0
  104. package/corpus/templates/design/changelog/2026-07-28-interact-mode-can-preview-designs-in-responsive-device-sizes.md +6 -0
  105. package/corpus/templates/design/changelog/2026-07-28-interact-mode-now-opens-a-full-screen-responsive-preview-wit.md +6 -0
  106. package/corpus/templates/design/changelog/2026-07-28-show-or-hide-design-editing-chrome-with-cmd-on-apple-devices.md +2 -2
  107. package/corpus/templates/design/changelog/2026-07-28-visual-edit-now-always-shows-the-live-running-app-in-the-can.md +6 -0
  108. package/corpus/templates/dispatch/.agents/skills/security/SKILL.md +13 -2
  109. package/corpus/templates/forms/.agents/skills/security/SKILL.md +13 -2
  110. package/corpus/templates/macros/.agents/skills/security/SKILL.md +13 -2
  111. package/corpus/templates/mail/.agents/skills/security/SKILL.md +13 -2
  112. package/corpus/templates/plan/.agents/skills/security/SKILL.md +13 -2
  113. package/corpus/templates/slides/.agents/skills/security/SKILL.md +13 -2
  114. package/corpus/templates/tasks/.agents/skills/security/SKILL.md +13 -2
  115. package/corpus/toolkit/CHANGELOG.md +13 -0
  116. package/corpus/toolkit/package.json +1 -1
  117. package/corpus/toolkit/src/chat-history.css +1 -2
  118. package/corpus/toolkit/src/composer/TiptapComposer.tsx +45 -0
  119. package/dist/a2a/client.d.ts +7 -0
  120. package/dist/a2a/client.d.ts.map +1 -1
  121. package/dist/a2a/client.js +8 -3
  122. package/dist/a2a/client.js.map +1 -1
  123. package/dist/a2a/server.d.ts.map +1 -1
  124. package/dist/a2a/server.js +18 -3
  125. package/dist/a2a/server.js.map +1 -1
  126. package/dist/a2a/types.d.ts +7 -0
  127. package/dist/a2a/types.d.ts.map +1 -1
  128. package/dist/a2a/types.js.map +1 -1
  129. package/dist/action.d.ts +15 -1
  130. package/dist/action.d.ts.map +1 -1
  131. package/dist/action.js +39 -16
  132. package/dist/action.js.map +1 -1
  133. package/dist/agent/engine/ai-sdk-engine.d.ts.map +1 -1
  134. package/dist/agent/engine/ai-sdk-engine.js +14 -10
  135. package/dist/agent/engine/ai-sdk-engine.js.map +1 -1
  136. package/dist/agent/production-agent.d.ts.map +1 -1
  137. package/dist/agent/production-agent.js +35 -7
  138. package/dist/agent/production-agent.js.map +1 -1
  139. package/dist/agent/thread-data-builder.d.ts +2 -0
  140. package/dist/agent/thread-data-builder.d.ts.map +1 -1
  141. package/dist/agent/thread-data-builder.js +3 -0
  142. package/dist/agent/thread-data-builder.js.map +1 -1
  143. package/dist/chat-threads/migrations.d.ts +21 -0
  144. package/dist/chat-threads/migrations.d.ts.map +1 -0
  145. package/dist/chat-threads/migrations.js +45 -0
  146. package/dist/chat-threads/migrations.js.map +1 -0
  147. package/dist/cli/create.d.ts.map +1 -1
  148. package/dist/cli/create.js +4 -0
  149. package/dist/cli/create.js.map +1 -1
  150. package/dist/cli/skills-content/design-visual-edit-skill.d.ts +1 -1
  151. package/dist/cli/skills-content/design-visual-edit-skill.d.ts.map +1 -1
  152. package/dist/cli/skills-content/design-visual-edit-skill.js +36 -16
  153. package/dist/cli/skills-content/design-visual-edit-skill.js.map +1 -1
  154. package/dist/cli/skills.d.ts.map +1 -1
  155. package/dist/cli/skills.js +15 -0
  156. package/dist/cli/skills.js.map +1 -1
  157. package/dist/client/AgentPanel.d.ts.map +1 -1
  158. package/dist/client/AgentPanel.js +6 -5
  159. package/dist/client/AgentPanel.js.map +1 -1
  160. package/dist/client/AssistantChat.d.ts +37 -0
  161. package/dist/client/AssistantChat.d.ts.map +1 -1
  162. package/dist/client/AssistantChat.js +41 -8
  163. package/dist/client/AssistantChat.js.map +1 -1
  164. package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
  165. package/dist/client/MultiTabAssistantChat.js +11 -10
  166. package/dist/client/MultiTabAssistantChat.js.map +1 -1
  167. package/dist/client/agent-chat-adapter.d.ts.map +1 -1
  168. package/dist/client/agent-chat-adapter.js +19 -3
  169. package/dist/client/agent-chat-adapter.js.map +1 -1
  170. package/dist/client/analytics.d.ts.map +1 -1
  171. package/dist/client/analytics.js +150 -101
  172. package/dist/client/analytics.js.map +1 -1
  173. package/dist/client/chat/message-components.d.ts +2 -1
  174. package/dist/client/chat/message-components.d.ts.map +1 -1
  175. package/dist/client/chat/message-components.js +11 -4
  176. package/dist/client/chat/message-components.js.map +1 -1
  177. package/dist/client/chat/runtime.d.ts.map +1 -1
  178. package/dist/client/chat/runtime.js +2 -1
  179. package/dist/client/chat/runtime.js.map +1 -1
  180. package/dist/client/chat/tool-call-display.d.ts +4 -1
  181. package/dist/client/chat/tool-call-display.d.ts.map +1 -1
  182. package/dist/client/chat/tool-call-display.js +14 -8
  183. package/dist/client/chat/tool-call-display.js.map +1 -1
  184. package/dist/client/chat-model-groups.d.ts.map +1 -1
  185. package/dist/client/chat-model-groups.js +3 -0
  186. package/dist/client/chat-model-groups.js.map +1 -1
  187. package/dist/client/client-status-requests.d.ts +14 -0
  188. package/dist/client/client-status-requests.d.ts.map +1 -0
  189. package/dist/client/client-status-requests.js +126 -0
  190. package/dist/client/client-status-requests.js.map +1 -0
  191. package/dist/client/settings/VoiceTranscriptionSection.js +1 -1
  192. package/dist/client/settings/VoiceTranscriptionSection.js.map +1 -1
  193. package/dist/client/sse-event-processor.d.ts +7 -0
  194. package/dist/client/sse-event-processor.d.ts.map +1 -1
  195. package/dist/client/sse-event-processor.js +8 -3
  196. package/dist/client/sse-event-processor.js.map +1 -1
  197. package/dist/client/use-agent-engine-configured.d.ts.map +1 -1
  198. package/dist/client/use-agent-engine-configured.js +29 -43
  199. package/dist/client/use-agent-engine-configured.js.map +1 -1
  200. package/dist/client/use-chat-models.d.ts.map +1 -1
  201. package/dist/client/use-chat-models.js +11 -11
  202. package/dist/client/use-chat-models.js.map +1 -1
  203. package/dist/client/use-chat-threads.d.ts.map +1 -1
  204. package/dist/client/use-chat-threads.js +23 -7
  205. package/dist/client/use-chat-threads.js.map +1 -1
  206. package/dist/client/use-session.d.ts.map +1 -1
  207. package/dist/client/use-session.js +4 -4
  208. package/dist/client/use-session.js.map +1 -1
  209. package/dist/collab/awareness.d.ts +2 -2
  210. package/dist/collab/awareness.d.ts.map +1 -1
  211. package/dist/collab/struct-routes.d.ts +1 -1
  212. package/dist/db/client.d.ts.map +1 -1
  213. package/dist/db/client.js +48 -4
  214. package/dist/db/client.js.map +1 -1
  215. package/dist/db/ensure-additive-columns.d.ts.map +1 -1
  216. package/dist/db/ensure-additive-columns.js +32 -21
  217. package/dist/db/ensure-additive-columns.js.map +1 -1
  218. package/dist/db/migrations.d.ts +9 -0
  219. package/dist/db/migrations.d.ts.map +1 -1
  220. package/dist/db/migrations.js +14 -3
  221. package/dist/db/migrations.js.map +1 -1
  222. package/dist/file-upload/actions/upload-image.d.ts +1 -1
  223. package/dist/mcp/approval-store.d.ts +16 -0
  224. package/dist/mcp/approval-store.d.ts.map +1 -0
  225. package/dist/mcp/approval-store.js +85 -0
  226. package/dist/mcp/approval-store.js.map +1 -0
  227. package/dist/mcp/build-server.d.ts +1 -34
  228. package/dist/mcp/build-server.d.ts.map +1 -1
  229. package/dist/mcp/build-server.js +220 -23
  230. package/dist/mcp/build-server.js.map +1 -1
  231. package/dist/mcp/embed-app.js +1 -1
  232. package/dist/mcp/embed-app.js.map +1 -1
  233. package/dist/mcp/oauth-client-metadata.d.ts +15 -0
  234. package/dist/mcp/oauth-client-metadata.d.ts.map +1 -0
  235. package/dist/mcp/oauth-client-metadata.js +297 -0
  236. package/dist/mcp/oauth-client-metadata.js.map +1 -0
  237. package/dist/mcp/oauth-route.d.ts.map +1 -1
  238. package/dist/mcp/oauth-route.js +39 -53
  239. package/dist/mcp/oauth-route.js.map +1 -1
  240. package/dist/mcp/screen-memory-stdio.d.ts.map +1 -1
  241. package/dist/mcp/screen-memory-stdio.js +304 -296
  242. package/dist/mcp/screen-memory-stdio.js.map +1 -1
  243. package/dist/mcp/server.d.ts +12 -25
  244. package/dist/mcp/server.d.ts.map +1 -1
  245. package/dist/mcp/server.js +24 -133
  246. package/dist/mcp/server.js.map +1 -1
  247. package/dist/mcp/stdio.d.ts.map +1 -1
  248. package/dist/mcp/stdio.js +36 -35
  249. package/dist/mcp/stdio.js.map +1 -1
  250. package/dist/mcp-client/manager.d.ts.map +1 -1
  251. package/dist/mcp-client/manager.js +6 -6
  252. package/dist/mcp-client/manager.js.map +1 -1
  253. package/dist/mcp-client/oauth-client.d.ts +13 -17
  254. package/dist/mcp-client/oauth-client.d.ts.map +1 -1
  255. package/dist/mcp-client/oauth-client.js +74 -16
  256. package/dist/mcp-client/oauth-client.js.map +1 -1
  257. package/dist/mcp-client/oauth-routes.d.ts +2 -2
  258. package/dist/mcp-client/oauth-routes.d.ts.map +1 -1
  259. package/dist/mcp-client/oauth-routes.js +16 -6
  260. package/dist/mcp-client/oauth-routes.js.map +1 -1
  261. package/dist/mcp-client/routes.js +5 -5
  262. package/dist/mcp-client/routes.js.map +1 -1
  263. package/dist/notifications/routes.d.ts +1 -1
  264. package/dist/observability/routes.d.ts +3 -3
  265. package/dist/progress/routes.d.ts +1 -1
  266. package/dist/provider-api/actions/custom-provider-registration.d.ts +14 -14
  267. package/dist/provider-api/actions/provider-api.d.ts +8 -8
  268. package/dist/resources/handlers.d.ts +1 -1
  269. package/dist/secrets/routes.d.ts +9 -9
  270. package/dist/server/agent-capabilities.d.ts.map +1 -1
  271. package/dist/server/agent-capabilities.js +21 -0
  272. package/dist/server/agent-capabilities.js.map +1 -1
  273. package/dist/server/agent-chat/action-filters-a2a.d.ts +14 -0
  274. package/dist/server/agent-chat/action-filters-a2a.d.ts.map +1 -1
  275. package/dist/server/agent-chat/action-filters-a2a.js +16 -0
  276. package/dist/server/agent-chat/action-filters-a2a.js.map +1 -1
  277. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  278. package/dist/server/agent-chat-plugin.js +11 -1
  279. package/dist/server/agent-chat-plugin.js.map +1 -1
  280. package/dist/server/realtime-token.d.ts +1 -1
  281. package/dist/server/transcribe-voice.d.ts +1 -1
  282. package/dist/server/transcribe-voice.js +12 -6
  283. package/dist/server/transcribe-voice.js.map +1 -1
  284. package/dist/templates/chat/.agents/skills/security/SKILL.md +13 -2
  285. package/dist/templates/chat/README.md +0 -2
  286. package/dist/templates/default/.agents/skills/security/SKILL.md +13 -2
  287. package/dist/templates/workspace-core/.agents/skills/authentication/SKILL.md +5 -2
  288. package/dist/templates/workspace-core/.agents/skills/external-agents/SKILL.md +18 -0
  289. package/dist/templates/workspace-core/.agents/skills/security/SKILL.md +13 -2
  290. package/docs/content/template-design-collaboration-and-full-apps.mdx +3 -1
  291. package/package.json +7 -4
  292. package/src/a2a/client.ts +18 -4
  293. package/src/a2a/server.ts +19 -3
  294. package/src/a2a/types.ts +7 -0
  295. package/src/action.ts +43 -16
  296. package/src/agent/engine/ai-sdk-engine.ts +14 -10
  297. package/src/agent/production-agent.ts +41 -3
  298. package/src/agent/thread-data-builder.ts +5 -0
  299. package/src/chat-threads/migrations.ts +53 -0
  300. package/src/cli/create.ts +4 -0
  301. package/src/cli/skills-content/design-visual-edit-skill.ts +36 -16
  302. package/src/cli/skills.ts +16 -0
  303. package/src/client/AgentPanel.tsx +9 -5
  304. package/src/client/AssistantChat.tsx +138 -46
  305. package/src/client/MultiTabAssistantChat.tsx +16 -10
  306. package/src/client/agent-chat-adapter.ts +21 -3
  307. package/src/client/analytics.ts +159 -102
  308. package/src/client/chat/message-components.tsx +12 -5
  309. package/src/client/chat/runtime.ts +2 -1
  310. package/src/client/chat/tool-call-display.tsx +25 -2
  311. package/src/client/chat-model-groups.ts +3 -0
  312. package/src/client/client-status-requests.ts +161 -0
  313. package/src/client/settings/VoiceTranscriptionSection.tsx +2 -2
  314. package/src/client/sse-event-processor.ts +15 -3
  315. package/src/client/use-agent-engine-configured.ts +54 -50
  316. package/src/client/use-chat-models.ts +16 -11
  317. package/src/client/use-chat-threads.ts +32 -9
  318. package/src/client/use-session.ts +4 -5
  319. package/src/db/client.ts +83 -8
  320. package/src/db/ensure-additive-columns.ts +31 -20
  321. package/src/db/migrations.ts +22 -2
  322. package/src/mcp/approval-store.ts +99 -0
  323. package/src/mcp/build-server.ts +579 -303
  324. package/src/mcp/embed-app.ts +1 -1
  325. package/src/mcp/oauth-client-metadata.ts +380 -0
  326. package/src/mcp/oauth-route.ts +57 -52
  327. package/src/mcp/screen-memory-stdio.ts +400 -378
  328. package/src/mcp/server.ts +29 -145
  329. package/src/mcp/stdio.ts +72 -80
  330. package/src/mcp-client/manager.ts +6 -10
  331. package/src/mcp-client/oauth-client.ts +127 -36
  332. package/src/mcp-client/oauth-routes.ts +16 -6
  333. package/src/mcp-client/routes.ts +6 -5
  334. package/src/server/agent-capabilities.ts +20 -0
  335. package/src/server/agent-chat/action-filters-a2a.ts +27 -0
  336. package/src/server/agent-chat-plugin.ts +18 -0
  337. package/src/server/transcribe-voice.ts +14 -5
  338. package/src/templates/chat/.agents/skills/security/SKILL.md +13 -2
  339. package/src/templates/chat/README.md +0 -2
  340. package/src/templates/default/.agents/skills/security/SKILL.md +13 -2
  341. package/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +5 -2
  342. package/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +18 -0
  343. package/src/templates/workspace-core/.agents/skills/security/SKILL.md +13 -2
package/src/mcp/server.ts CHANGED
@@ -46,33 +46,6 @@ export {
46
46
  };
47
47
  export type { MCPConfig, MCPCallerIdentity, MCPRequestMeta };
48
48
 
49
- // ---------------------------------------------------------------------------
50
- // Runtime detection — Node fast-path vs. web-standard fallback
51
- // ---------------------------------------------------------------------------
52
-
53
- /**
54
- * Resolve the underlying Node `http` req/res pair if (and only if) we're
55
- * running on a real Node HTTP server (local dev, `node` Nitro preset). On the
56
- * web-standard runtime (Nitro 3 / Netlify web runtime, Cloudflare, Deno, Bun)
57
- * BOTH of these are undefined — that's the signal to take the web fallback
58
- * instead of returning 501.
59
- */
60
- function getNodeReqRes(event: H3Event): {
61
- nodeReq: any | undefined;
62
- nodeRes: any | undefined;
63
- } {
64
- const e = event as any;
65
- const nodeReq = e.node?.req ?? e.req?.runtime?.node?.req;
66
- const nodeRes = e.node?.res ?? e.req?.runtime?.node?.res;
67
- return { nodeReq, nodeRes };
68
- }
69
-
70
- function shouldUseNodeFastPath(event: H3Event): boolean {
71
- if (process.env.AGENT_NATIVE_MCP_NODE_FAST_PATH !== "1") return false;
72
- const { nodeReq, nodeRes } = getNodeReqRes(event);
73
- return Boolean(nodeReq && nodeRes);
74
- }
75
-
76
49
  /**
77
50
  * Derive the request origin + the markdown deep-link target from the inbound
78
51
  * headers. Identical logic for both the Node and web paths so the absolute
@@ -254,29 +227,20 @@ function buildUnauthorizedBody(event: H3Event): {
254
227
  /**
255
228
  * Handle a single `{routePrefix}/mcp` request on either runtime.
256
229
  *
257
- * - **Default path:** build the SAME MCP `Server`
258
- * from the SAME config + identity, drive it through the SDK's
259
- * `WebStandardStreamableHTTPServerTransport` (which the Node transport is
260
- * itself just a thin wrapper around), and return the resulting Web
261
- * `Response` as a normal h3 return value. This is used for Nitro local dev
262
- * too; the direct Node writer can otherwise race h3 and double-write.
263
- * - **Opt-in Node fast-path:** set `AGENT_NATIVE_MCP_NODE_FAST_PATH=1` to
264
- * delegate directly to the SDK's `StreamableHTTPServerTransport`.
230
+ * Builds one request-scoped MCP `Server` from the verified caller identity and
231
+ * drives it through the SDK's v2 `createMcpHandler`. That entry serves native
232
+ * 2026-07-28 envelopes and stateless 2025-era traffic from the same factory,
233
+ * so protocol generations cannot drift apart.
265
234
  *
266
- * Auth, the `runWithRequestContext` identity wrap, the deep-link `_meta` /
267
- * markdown append, `requestMeta` origin/target derivation and the stateless
268
- * semantics are IDENTICAL on both paths because both build the same server
269
- * via `createMCPServerForRequest` and both transports funnel into the same
270
- * `WebStandardStreamableHTTPServerTransport.handleRequest(webRequest, {
271
- * parsedBody })` with the same options.
235
+ * The handler is Web Standard on every runtime. H3 owns the Node response when
236
+ * one exists, avoiding the double-write race from a transport writing directly
237
+ * to `node.res`.
272
238
  *
273
239
  * Returns:
274
240
  * - `undefined` when the request targets a sub-route (so management/status
275
241
  * routes mounted under `/_agent-native/mcp/*` handle it themselves) — the
276
242
  * h3 mount falls through to the next handler.
277
- * - a Web `Response` (web fallback) or a string/object (Node path /
278
- * auth-error path) otherwise. The Node path also sets `_handled` so h3
279
- * doesn't double-write.
243
+ * - a Web `Response` or an auth-error object otherwise.
280
244
  */
281
245
  export async function handleMcpRequest(
282
246
  event: H3Event,
@@ -330,26 +294,9 @@ export async function handleMcpRequest(
330
294
  return buildUnauthorizedBody(event);
331
295
  }
332
296
 
333
- // Stateless mode: only POST is meaningful. A stateless, per-request transport
334
- // on serverless cannot keep the standalone GET SSE stream (server->client
335
- // channel) alive across invocations once the function returns and freezes,
336
- // that stream dies and the client reports "session expired" / "not
337
- // connected". The spec lets a server that offers no GET stream answer 405, so
338
- // the client falls back to plain POST request/response. Reject GET here
339
- // instead of letting the SDK open a doomed stream.
340
- if (method === "DELETE") {
341
- setResponseStatus(event, 204);
342
- return "";
343
- }
344
-
345
- if (method !== "POST") {
346
- setResponseStatus(event, 405);
347
- return { error: "Method not allowed" };
348
- }
349
-
350
- // Read body for POST (GET has no body). Read it via the h3 helper exactly
351
- // once; both transports accept it as a pre-parsed body so the request
352
- // stream is never consumed twice.
297
+ // Read POST bodies through h3 exactly once. `createMcpHandler` accepts the
298
+ // parsed value, so neither its modern classifier nor its legacy fallback
299
+ // consumes the request stream a second time.
353
300
  const body = method === "POST" ? await readBody(event) : undefined;
354
301
 
355
302
  // Optional diagnostics for host capability negotiation. Keep disabled by
@@ -372,13 +319,7 @@ export async function handleMcpRequest(
372
319
  }
373
320
  }
374
321
 
375
- // Per-request stateless transport + server. Both runtimes build the SAME
376
- // server from the SAME config + verified identity + request meta, so
377
- // tools/list, tools/call, and the deep-link `_meta` are identical. A
378
- // connected real caller (connect-minted token / `mcp install` /
379
- // ACCESS_TOKEN / production) gets the full action surface even in local
380
- // dev; unauthenticated dev probes stay sparse. See `external-agents` skill.
381
- const server = await createMCPServerForRequest(config, authResult.identity, {
322
+ const serverRequestMeta: MCPRequestMeta = {
382
323
  ...requestMeta,
383
324
  fullSurface: authResult.fullSurface === true,
384
325
  inlineMcpApps:
@@ -389,76 +330,23 @@ export async function handleMcpRequest(
389
330
  // When the caller minted their token with --full-catalog (catalog_scope:
390
331
  // "full" JWT claim), bypass the connector-catalog tier filter.
391
332
  ...(authResult.fullCatalog === true ? { fullCatalog: true } : {}),
392
- });
393
-
394
- if (shouldUseNodeFastPath(event)) {
395
- const { nodeReq, nodeRes } = getNodeReqRes(event);
396
- // ---- Opt-in Node fast-path ---------------------------------------------
397
- const { StreamableHTTPServerTransport } =
398
- await import("@modelcontextprotocol/sdk/server/streamableHttp.js");
399
- const transport = new StreamableHTTPServerTransport({
400
- sessionIdGenerator: undefined, // stateless
401
- // Return JSON request/response instead of SSE. A stateless serverless
402
- // instance can freeze right after returning a streaming Response, before
403
- // the deferred SSE result event is flushed — the client then never gets
404
- // the tools/call result and reports "session expired". JSON mode awaits
405
- // the result inside the request lifecycle and returns it as one body.
406
- enableJsonResponse: true,
407
- });
408
- await server.connect(transport);
409
- try {
410
- // The SDK transport writes directly to the Node response. Node-only by
411
- // construction; we only reach here when real Node req/res exist.
412
- await transport.handleRequest(nodeReq, nodeRes, body);
413
- } catch (err: any) {
414
- // The SDK transport writes directly to the Node response. If the socket
415
- // is already closed/ended (client disconnected, or the host stream
416
- // layer also flushed), Node throws ERR_STREAM_WRITE_AFTER_END *after*
417
- // the MCP payload was already delivered correctly. Swallow that benign
418
- // post-flush write so an external agent disconnecting mid-stream can
419
- // never take down the server process; rethrow anything else.
420
- if (err?.code !== "ERR_STREAM_WRITE_AFTER_END") throw err;
421
- if (process.env.DEBUG)
422
- console.log(
423
- "[mcp] ignored post-flush ERR_STREAM_WRITE_AFTER_END (client disconnected)",
424
- );
425
- }
426
- // Prevent H3 from double-writing the response
427
- (event as any)._handled = true;
428
- return undefined;
429
- }
430
-
431
- // ---- Web-standard response path (Nitro local dev, Netlify web runtime, CF,
432
- // Deno, Bun) ---------------------------------------------------------------
433
- //
434
- // `StreamableHTTPServerTransport` is itself just a thin wrapper that
435
- // converts the Node req/res to a web Request/Response and delegates to
436
- // `WebStandardStreamableHTTPServerTransport.handleRequest(webRequest, {
437
- // parsedBody })`. Using the web transport directly with the SAME options +
438
- // the same pre-read `parsedBody` produces byte-identical protocol output
439
- // (including the deep-link `_meta` built inside createMCPServerForRequest),
440
- // and works on every web runtime because it returns a Web `Response`
441
- // (JSON for request/response, or an SSE `ReadableStream` body which h3
442
- // streams natively).
443
- const { WebStandardStreamableHTTPServerTransport } =
444
- await import("@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js");
445
- const transport = new WebStandardStreamableHTTPServerTransport({
446
- sessionIdGenerator: undefined, // stateless — same as the Node path
447
- // JSON request/response (not SSE) — see the Node fast-path note above.
448
- // This is the serverless-safe framing: the result is computed and returned
449
- // within the request, never pushed onto a stream after the instance froze.
450
- enableJsonResponse: true,
451
- });
452
- await server.connect(transport);
333
+ };
334
+ const { createMcpHandler } = await import("@modelcontextprotocol/server");
335
+ const handler = createMcpHandler(
336
+ () =>
337
+ createMCPServerForRequest(config, authResult.identity, serverRequestMeta),
338
+ {
339
+ legacy: "stateless",
340
+ // Ordinary calls stay single-body JSON unless a handler emits a related
341
+ // message before its result. Subscription/listen remains SSE.
342
+ responseMode: "auto",
343
+ },
344
+ );
453
345
  const webRequest = buildWebRequest(event, method);
454
- // `parsedBody: undefined` would make the SDK try to read `req.json()`; our
455
- // synthesized request has no body, so only pass the option for POST (where
456
- // we actually have a parsed body). For GET the transport reads no body.
457
- const response = await transport.handleRequest(
346
+ return handler.fetch(
458
347
  webRequest,
459
348
  method === "POST" ? { parsedBody: body } : undefined,
460
349
  );
461
- return response;
462
350
  }
463
351
 
464
352
  // ---------------------------------------------------------------------------
@@ -471,14 +359,10 @@ export async function handleMcpRequest(
471
359
  * Endpoints: `/mcp` (public) and `/_agent-native/mcp` (compatibility).
472
360
  * A custom route prefix only mounts that custom endpoint.
473
361
  *
474
- * Uses stateless Streamable HTTP transport no in-memory sessions, JSON
475
- * request/response (no SSE), and no standalone GET stream, so it survives
476
- * serverless instances that freeze between invocations (SSE framing there
477
- * drops the result and clients report "session expired"). Runtime-agnostic: a real Node
478
- * server uses the SDK's Node transport; the web-standard runtime (Nitro 3 /
479
- * Netlify web runtime, Cloudflare, Deno, Bun) uses the SDK's web-standard
480
- * transport. Both build the same server and produce identical JSON-RPC
481
- * output.
362
+ * Uses the v2 Web Standard per-request handler with native 2026-07-28 serving
363
+ * and stateless 2025-era fallback. It carries no in-memory protocol session
364
+ * across invocations and works unchanged on Node, Nitro/Netlify web runtimes,
365
+ * Cloudflare, Deno, and Bun.
482
366
  *
483
367
  * Auth: Bearer token matching ACCESS_TOKEN/ACCESS_TOKENS or JWT via A2A_SECRET.
484
368
  * No auth required when neither is configured (dev mode).
package/src/mcp/stdio.ts CHANGED
@@ -24,8 +24,6 @@
24
24
  * of the serverless bundle.
25
25
  */
26
26
 
27
- import type { ServerCapabilities } from "@modelcontextprotocol/sdk/types.js";
28
-
29
27
  import {
30
28
  MCP_LEGACY_ROUTE_PREFIX,
31
29
  MCP_PUBLIC_ROUTE_PREFIX,
@@ -143,19 +141,10 @@ async function runProxy(opts: RunMCPStdioOptions): Promise<void> {
143
141
  }
144
142
  const target = `${origin}${mcpSubpath}`;
145
143
 
146
- const { Client } = await import("@modelcontextprotocol/sdk/client/index.js");
147
- const { StreamableHTTPClientTransport } =
148
- await import("@modelcontextprotocol/sdk/client/streamableHttp.js");
149
- const { Server } = await import("@modelcontextprotocol/sdk/server/index.js");
150
- const { StdioServerTransport } =
151
- await import("@modelcontextprotocol/sdk/server/stdio.js");
152
- const {
153
- ListToolsRequestSchema,
154
- CallToolRequestSchema,
155
- ListResourcesRequestSchema,
156
- ReadResourceRequestSchema,
157
- ListResourceTemplatesRequestSchema,
158
- } = await import("@modelcontextprotocol/sdk/types.js");
144
+ const { Client, StreamableHTTPClientTransport } =
145
+ await import("@modelcontextprotocol/client");
146
+ const { Server } = await import("@modelcontextprotocol/server");
147
+ const { serveStdio } = await import("@modelcontextprotocol/server/stdio");
159
148
 
160
149
  // --- Upstream HTTP client -------------------------------------------------
161
150
  const clientTransport = new StreamableHTTPClientTransport(new URL(target), {
@@ -163,69 +152,72 @@ async function runProxy(opts: RunMCPStdioOptions): Promise<void> {
163
152
  });
164
153
  const client = new Client(
165
154
  { name: "agent-native-mcp-proxy", version: "1.0.0" },
166
- { capabilities: {} },
155
+ {
156
+ capabilities: {},
157
+ versionNegotiation: { mode: "auto" },
158
+ },
167
159
  );
168
160
  await client.connect(clientTransport);
169
161
  log(`Proxying stdio ⇄ ${target} (app: ${appId})`);
170
162
 
171
163
  // --- Downstream stdio server ---------------------------------------------
172
164
  const upstreamCapabilities = client.getServerCapabilities();
173
- const capabilities: ServerCapabilities = { tools: {} };
165
+ const capabilities: NonNullable<
166
+ ReturnType<typeof client.getServerCapabilities>
167
+ > = { tools: {} };
174
168
  if (upstreamCapabilities?.resources) capabilities.resources = {};
175
169
  if (upstreamCapabilities?.extensions) {
176
170
  capabilities.extensions = upstreamCapabilities.extensions;
177
171
  }
178
172
 
179
- const server = new Server(
180
- { name: `agent-native-${appId}`, version: "1.0.0" },
181
- { capabilities },
182
- );
173
+ const stdio = serveStdio(
174
+ () => {
175
+ const server = new Server(
176
+ { name: `agent-native-${appId}`, version: "1.0.0" },
177
+ { capabilities },
178
+ );
183
179
 
184
- server.setRequestHandler(ListToolsRequestSchema, async (request: any) => {
185
- return client.listTools(request.params);
186
- });
180
+ server.setRequestHandler("tools/list", async (request: any) => {
181
+ return client.listTools(request.params);
182
+ });
187
183
 
188
- server.setRequestHandler(CallToolRequestSchema, async (request: any) => {
189
- // Forward the call verbatim; the upstream appends the deep-link block.
190
- return client.callTool(request.params);
191
- });
184
+ server.setRequestHandler("tools/call", async (request: any) => {
185
+ // Forward the call verbatim; the upstream appends the deep-link block.
186
+ return client.callTool(request.params);
187
+ });
192
188
 
193
- if (upstreamCapabilities?.resources) {
194
- server.setRequestHandler(
195
- ListResourcesRequestSchema,
196
- async (request: any) => {
197
- return client.listResources(request.params);
198
- },
199
- );
200
-
201
- server.setRequestHandler(
202
- ListResourceTemplatesRequestSchema,
203
- async (request: any) => {
204
- return client.listResourceTemplates(request.params);
205
- },
206
- );
189
+ if (upstreamCapabilities?.resources) {
190
+ server.setRequestHandler("resources/list", async (request: any) => {
191
+ return client.listResources(request.params);
192
+ });
207
193
 
208
- server.setRequestHandler(
209
- ReadResourceRequestSchema,
210
- async (request: any) => {
211
- return client.readResource(request.params);
212
- },
213
- );
214
- }
194
+ server.setRequestHandler(
195
+ "resources/templates/list",
196
+ async (request: any) => {
197
+ return client.listResourceTemplates(request.params);
198
+ },
199
+ );
215
200
 
216
- const stdioTransport = new StdioServerTransport();
217
- await server.connect(stdioTransport);
201
+ server.setRequestHandler("resources/read", async (request: any) => {
202
+ return client.readResource(request.params);
203
+ });
204
+ }
205
+ return server;
206
+ },
207
+ { legacy: "serve" },
208
+ );
218
209
 
219
210
  // Keep the proxy alive until the client/transport closes.
220
211
  await new Promise<void>((resolve) => {
221
212
  const done = () => resolve();
222
- stdioTransport.onclose = done;
223
213
  clientTransport.onclose = done;
214
+ process.stdin.once("end", done);
224
215
  process.once("SIGINT", done);
225
216
  process.once("SIGTERM", done);
226
217
  });
227
218
 
228
219
  try {
220
+ await stdio.close();
229
221
  await client.close();
230
222
  } catch {
231
223
  // best-effort
@@ -264,44 +256,44 @@ async function runStandalone(opts: RunMCPStdioOptions): Promise<void> {
264
256
 
265
257
  const { autoDiscoverActions } = await import("../server/action-discovery.js");
266
258
  const { createMCPServerForRequest } = await import("./build-server.js");
267
- const { StdioServerTransport } =
268
- await import("@modelcontextprotocol/sdk/server/stdio.js");
259
+ const { serveStdio } = await import("@modelcontextprotocol/server/stdio");
269
260
 
270
261
  const actions = await autoDiscoverActions(cwd);
271
262
  log(
272
263
  `Standalone: discovered ${Object.keys(actions).length} action(s) in ${cwd}`,
273
264
  );
274
265
 
275
- const server = await createMCPServerForRequest(
276
- {
277
- name: appId.charAt(0).toUpperCase() + appId.slice(1),
278
- appId,
279
- description: `Agent-native ${appId} app (standalone MCP)`,
280
- actions,
281
- // No askAgent in standalone — there is no running engine/runtime here.
282
- // builtin cross-app tools stay on so `list_apps` / `open_app` /
283
- // `create_workspace_app` / `list_templates` still work from disk.
284
- },
285
- // No verified identity in standalone (no inbound auth header). Runs with
286
- // platform-default scope, same as a tokenless local HTTP mount.
287
- undefined,
288
- {
289
- origin,
290
- clientName: "agent-native-mcp-standalone",
291
- // Compact by default; opt into the full catalog with the env flag.
292
- fullCatalog: process.env.AGENT_NATIVE_MCP_FULL_CATALOG === "1",
293
- },
266
+ const stdio = serveStdio(
267
+ () =>
268
+ createMCPServerForRequest(
269
+ {
270
+ name: appId.charAt(0).toUpperCase() + appId.slice(1),
271
+ appId,
272
+ description: `Agent-native ${appId} app (standalone MCP)`,
273
+ actions,
274
+ // No askAgent in standalone there is no running engine/runtime here.
275
+ // builtin cross-app tools stay on so `list_apps` / `open_app` /
276
+ // `create_workspace_app` / `list_templates` still work from disk.
277
+ },
278
+ // No verified identity in standalone (no inbound auth header). Runs with
279
+ // platform-default scope, same as a tokenless local HTTP mount.
280
+ undefined,
281
+ {
282
+ origin,
283
+ clientName: "agent-native-mcp-standalone",
284
+ // Compact by default; opt into the full catalog with the env flag.
285
+ fullCatalog: process.env.AGENT_NATIVE_MCP_FULL_CATALOG === "1",
286
+ },
287
+ ),
288
+ { legacy: "serve" },
294
289
  );
295
290
 
296
- const transport = new StdioServerTransport();
297
- await server.connect(transport);
298
-
299
291
  await new Promise<void>((resolve) => {
300
- const done = () => resolve();
301
- transport.onclose = done;
302
- process.once("SIGINT", done);
303
- process.once("SIGTERM", done);
292
+ process.stdin.once("end", resolve);
293
+ process.once("SIGINT", resolve);
294
+ process.once("SIGTERM", resolve);
304
295
  });
296
+ await stdio.close();
305
297
  }
306
298
 
307
299
  /**
@@ -228,8 +228,7 @@ export class McpClientManager {
228
228
  // If we previously loaded without stdio and now need it, top up.
229
229
  if (needStdio && !this.sdk.StdioClientTransport && isNode()) {
230
230
  try {
231
- const stdioMod =
232
- await import("@modelcontextprotocol/sdk/client/stdio.js");
231
+ const stdioMod = await import("@modelcontextprotocol/client/stdio");
233
232
  this.sdk.StdioClientTransport = stdioMod.StdioClientTransport;
234
233
  } catch (err: any) {
235
234
  console.warn(
@@ -240,15 +239,11 @@ export class McpClientManager {
240
239
  return this.sdk;
241
240
  }
242
241
  try {
243
- const clientMod =
244
- await import("@modelcontextprotocol/sdk/client/index.js");
245
- const httpMod =
246
- await import("@modelcontextprotocol/sdk/client/streamableHttp.js");
242
+ const clientMod = await import("@modelcontextprotocol/client");
247
243
  let StdioClientTransport: any = null;
248
244
  if (needStdio && isNode()) {
249
245
  try {
250
- const stdioMod =
251
- await import("@modelcontextprotocol/sdk/client/stdio.js");
246
+ const stdioMod = await import("@modelcontextprotocol/client/stdio");
252
247
  StdioClientTransport = stdioMod.StdioClientTransport;
253
248
  } catch (err: any) {
254
249
  console.warn(
@@ -259,7 +254,7 @@ export class McpClientManager {
259
254
  this.sdk = {
260
255
  Client: clientMod.Client,
261
256
  StdioClientTransport,
262
- StreamableHTTPClientTransport: httpMod.StreamableHTTPClientTransport,
257
+ StreamableHTTPClientTransport: clientMod.StreamableHTTPClientTransport,
263
258
  };
264
259
  return this.sdk;
265
260
  } catch (err: any) {
@@ -450,6 +445,7 @@ export class McpClientManager {
450
445
  },
451
446
  },
452
447
  },
448
+ versionNegotiation: { mode: "auto" },
453
449
  } as any,
454
450
  );
455
451
  const recordConnectionError: ErrorSink = () => {};
@@ -459,7 +455,7 @@ export class McpClientManager {
459
455
  // Attach a transport-level error handler before connect() so the SDK's
460
456
  // internal fire-and-forget paths (initial SSE stream open, scheduled
461
457
  // reconnects, message-handler-triggered reconnects — see processStream()
462
- // in @modelcontextprotocol/sdk/client/streamableHttp.js) cannot leak as
458
+ // in @modelcontextprotocol/client) cannot leak as
463
459
  // unhandled promise rejections. On AWS Lambda the long-lived socket
464
460
  // gets reaped ~60s after the function returns; without this handler the
465
461
  // resulting `socket hang up` surfaces as an unhandledRejection and