@agent-native/core 0.96.0 → 0.98.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 (1241) hide show
  1. package/README.md +6 -0
  2. package/corpus/README.md +2 -2
  3. package/corpus/core/CHANGELOG.md +71 -0
  4. package/corpus/core/docs/content/audit-log.mdx +2 -1
  5. package/corpus/core/docs/content/authentication.mdx +3 -3
  6. package/corpus/core/docs/content/automations.mdx +7 -7
  7. package/corpus/core/docs/content/creating-templates.mdx +1 -1
  8. package/corpus/core/docs/content/doctor.mdx +170 -0
  9. package/corpus/core/docs/content/external-agents.mdx +8 -7
  10. package/corpus/core/docs/content/internationalization.mdx +2 -1
  11. package/corpus/core/docs/content/locales/ar-SA/audit-log.mdx +2 -1
  12. package/corpus/core/docs/content/locales/ar-SA/authentication.mdx +2 -2
  13. package/corpus/core/docs/content/locales/ar-SA/automations.mdx +7 -7
  14. package/corpus/core/docs/content/locales/ar-SA/external-agents.mdx +8 -7
  15. package/corpus/core/docs/content/locales/ar-SA/getting-started.mdx +7 -1
  16. package/corpus/core/docs/content/locales/ar-SA/internationalization.mdx +1 -1
  17. package/corpus/core/docs/content/locales/ar-SA/mcp-protocol.mdx +1 -1
  18. package/corpus/core/docs/content/locales/ar-SA/package-lifecycle.mdx +19 -0
  19. package/corpus/core/docs/content/locales/ar-SA/sandbox-adapters.mdx +18 -7
  20. package/corpus/core/docs/content/locales/ar-SA/security.mdx +10 -0
  21. package/corpus/core/docs/content/locales/de-DE/audit-log.mdx +2 -1
  22. package/corpus/core/docs/content/locales/de-DE/authentication.mdx +1 -1
  23. package/corpus/core/docs/content/locales/de-DE/automations.mdx +7 -7
  24. package/corpus/core/docs/content/locales/de-DE/external-agents.mdx +8 -7
  25. package/corpus/core/docs/content/locales/de-DE/getting-started.mdx +7 -1
  26. package/corpus/core/docs/content/locales/de-DE/internationalization.mdx +1 -1
  27. package/corpus/core/docs/content/locales/de-DE/mcp-protocol.mdx +1 -1
  28. package/corpus/core/docs/content/locales/de-DE/package-lifecycle.mdx +22 -0
  29. package/corpus/core/docs/content/locales/de-DE/sandbox-adapters.mdx +18 -7
  30. package/corpus/core/docs/content/locales/de-DE/security.mdx +10 -0
  31. package/corpus/core/docs/content/locales/es-ES/audit-log.mdx +2 -1
  32. package/corpus/core/docs/content/locales/es-ES/authentication.mdx +2 -2
  33. package/corpus/core/docs/content/locales/es-ES/automations.mdx +7 -7
  34. package/corpus/core/docs/content/locales/es-ES/external-agents.mdx +8 -7
  35. package/corpus/core/docs/content/locales/es-ES/getting-started.mdx +7 -1
  36. package/corpus/core/docs/content/locales/es-ES/internationalization.mdx +1 -1
  37. package/corpus/core/docs/content/locales/es-ES/mcp-protocol.mdx +1 -1
  38. package/corpus/core/docs/content/locales/es-ES/package-lifecycle.mdx +22 -0
  39. package/corpus/core/docs/content/locales/es-ES/sandbox-adapters.mdx +18 -7
  40. package/corpus/core/docs/content/locales/es-ES/security.mdx +10 -0
  41. package/corpus/core/docs/content/locales/fr-FR/audit-log.mdx +2 -1
  42. package/corpus/core/docs/content/locales/fr-FR/authentication.mdx +1 -1
  43. package/corpus/core/docs/content/locales/fr-FR/automations.mdx +7 -7
  44. package/corpus/core/docs/content/locales/fr-FR/external-agents.mdx +8 -7
  45. package/corpus/core/docs/content/locales/fr-FR/getting-started.mdx +7 -1
  46. package/corpus/core/docs/content/locales/fr-FR/internationalization.mdx +1 -1
  47. package/corpus/core/docs/content/locales/fr-FR/mcp-protocol.mdx +1 -1
  48. package/corpus/core/docs/content/locales/fr-FR/package-lifecycle.mdx +21 -0
  49. package/corpus/core/docs/content/locales/fr-FR/sandbox-adapters.mdx +19 -8
  50. package/corpus/core/docs/content/locales/fr-FR/security.mdx +10 -0
  51. package/corpus/core/docs/content/locales/hi-IN/audit-log.mdx +2 -1
  52. package/corpus/core/docs/content/locales/hi-IN/authentication.mdx +2 -2
  53. package/corpus/core/docs/content/locales/hi-IN/automations.mdx +7 -7
  54. package/corpus/core/docs/content/locales/hi-IN/external-agents.mdx +8 -7
  55. package/corpus/core/docs/content/locales/hi-IN/getting-started.mdx +7 -1
  56. package/corpus/core/docs/content/locales/hi-IN/internationalization.mdx +1 -1
  57. package/corpus/core/docs/content/locales/hi-IN/mcp-protocol.mdx +1 -1
  58. package/corpus/core/docs/content/locales/hi-IN/package-lifecycle.mdx +20 -0
  59. package/corpus/core/docs/content/locales/hi-IN/sandbox-adapters.mdx +18 -7
  60. package/corpus/core/docs/content/locales/hi-IN/security.mdx +10 -0
  61. package/corpus/core/docs/content/locales/ja-JP/audit-log.mdx +2 -1
  62. package/corpus/core/docs/content/locales/ja-JP/authentication.mdx +2 -2
  63. package/corpus/core/docs/content/locales/ja-JP/automations.mdx +7 -7
  64. package/corpus/core/docs/content/locales/ja-JP/external-agents.mdx +8 -7
  65. package/corpus/core/docs/content/locales/ja-JP/getting-started.mdx +7 -1
  66. package/corpus/core/docs/content/locales/ja-JP/internationalization.mdx +1 -1
  67. package/corpus/core/docs/content/locales/ja-JP/mcp-protocol.mdx +1 -1
  68. package/corpus/core/docs/content/locales/ja-JP/package-lifecycle.mdx +21 -0
  69. package/corpus/core/docs/content/locales/ja-JP/sandbox-adapters.mdx +17 -6
  70. package/corpus/core/docs/content/locales/ja-JP/security.mdx +10 -0
  71. package/corpus/core/docs/content/locales/ko-KR/audit-log.mdx +2 -1
  72. package/corpus/core/docs/content/locales/ko-KR/authentication.mdx +2 -2
  73. package/corpus/core/docs/content/locales/ko-KR/automations.mdx +7 -7
  74. package/corpus/core/docs/content/locales/ko-KR/external-agents.mdx +8 -7
  75. package/corpus/core/docs/content/locales/ko-KR/getting-started.mdx +7 -1
  76. package/corpus/core/docs/content/locales/ko-KR/internationalization.mdx +1 -1
  77. package/corpus/core/docs/content/locales/ko-KR/mcp-protocol.mdx +1 -1
  78. package/corpus/core/docs/content/locales/ko-KR/package-lifecycle.mdx +20 -0
  79. package/corpus/core/docs/content/locales/ko-KR/sandbox-adapters.mdx +17 -6
  80. package/corpus/core/docs/content/locales/ko-KR/security.mdx +10 -0
  81. package/corpus/core/docs/content/locales/pt-BR/audit-log.mdx +2 -1
  82. package/corpus/core/docs/content/locales/pt-BR/authentication.mdx +2 -2
  83. package/corpus/core/docs/content/locales/pt-BR/automations.mdx +7 -7
  84. package/corpus/core/docs/content/locales/pt-BR/external-agents.mdx +8 -7
  85. package/corpus/core/docs/content/locales/pt-BR/getting-started.mdx +7 -1
  86. package/corpus/core/docs/content/locales/pt-BR/internationalization.mdx +1 -1
  87. package/corpus/core/docs/content/locales/pt-BR/mcp-protocol.mdx +1 -1
  88. package/corpus/core/docs/content/locales/pt-BR/package-lifecycle.mdx +21 -0
  89. package/corpus/core/docs/content/locales/pt-BR/sandbox-adapters.mdx +18 -7
  90. package/corpus/core/docs/content/locales/pt-BR/security.mdx +10 -0
  91. package/corpus/core/docs/content/locales/zh-CN/audit-log.mdx +2 -1
  92. package/corpus/core/docs/content/locales/zh-CN/authentication.mdx +2 -2
  93. package/corpus/core/docs/content/locales/zh-CN/automations.mdx +7 -7
  94. package/corpus/core/docs/content/locales/zh-CN/external-agents.mdx +8 -7
  95. package/corpus/core/docs/content/locales/zh-CN/getting-started.mdx +6 -4
  96. package/corpus/core/docs/content/locales/zh-CN/internationalization.mdx +1 -1
  97. package/corpus/core/docs/content/locales/zh-CN/mcp-protocol.mdx +1 -1
  98. package/corpus/core/docs/content/locales/zh-CN/package-lifecycle.mdx +19 -0
  99. package/corpus/core/docs/content/locales/zh-CN/sandbox-adapters.mdx +17 -6
  100. package/corpus/core/docs/content/locales/zh-CN/security.mdx +10 -0
  101. package/corpus/core/docs/content/locales/zh-TW/audit-log.mdx +2 -1
  102. package/corpus/core/docs/content/locales/zh-TW/authentication.mdx +2 -2
  103. package/corpus/core/docs/content/locales/zh-TW/automations.mdx +7 -7
  104. package/corpus/core/docs/content/locales/zh-TW/external-agents.mdx +8 -7
  105. package/corpus/core/docs/content/locales/zh-TW/getting-started.mdx +6 -4
  106. package/corpus/core/docs/content/locales/zh-TW/internationalization.mdx +1 -1
  107. package/corpus/core/docs/content/locales/zh-TW/mcp-protocol.mdx +1 -1
  108. package/corpus/core/docs/content/locales/zh-TW/package-lifecycle.mdx +19 -0
  109. package/corpus/core/docs/content/locales/zh-TW/sandbox-adapters.mdx +18 -7
  110. package/corpus/core/docs/content/locales/zh-TW/security.mdx +10 -0
  111. package/corpus/core/docs/content/mcp-protocol.mdx +1 -1
  112. package/corpus/core/docs/content/package-lifecycle.mdx +51 -0
  113. package/corpus/core/docs/content/sandbox-adapters.mdx +16 -5
  114. package/corpus/core/docs/content/security.mdx +2 -0
  115. package/corpus/core/package.json +13 -2
  116. package/corpus/core/scripts/finalize-build.mjs +63 -3
  117. package/corpus/core/scripts/materialize-source-corpus.mjs +101 -15
  118. package/corpus/core/src/a2a/auth-policy.ts +33 -0
  119. package/corpus/core/src/action.ts +42 -0
  120. package/corpus/core/src/agent/durable-background.ts +15 -7
  121. package/corpus/core/src/agent/engine/builder-engine.ts +3 -0
  122. package/corpus/core/src/agent/engine/context-directives-transform.ts +69 -0
  123. package/corpus/core/src/agent/engine/continuation-dispatch-retry.ts +168 -0
  124. package/corpus/core/src/agent/engine/tool-call-journal-seed.ts +85 -0
  125. package/corpus/core/src/agent/production-agent.ts +129 -244
  126. package/corpus/core/src/agent/run-store.ts +13 -4
  127. package/corpus/core/src/audit/actions/export-audit-events.ts +162 -0
  128. package/corpus/core/src/audit/store.ts +8 -3
  129. package/corpus/core/src/audit/types.ts +3 -0
  130. package/corpus/core/src/cli/doctor.ts +402 -0
  131. package/corpus/core/src/cli/index.ts +56 -0
  132. package/corpus/core/src/cli/info.ts +3 -3
  133. package/corpus/core/src/cli/package-lifecycle.ts +821 -0
  134. package/corpus/core/src/cli/plan-local.ts +10 -2
  135. package/corpus/core/src/cli/skills-content/assets-skill.ts +83 -0
  136. package/corpus/core/src/cli/skills-content/canvas.ts +153 -0
  137. package/corpus/core/src/cli/skills-content/connection.ts +52 -0
  138. package/corpus/core/src/cli/skills-content/content-skill.ts +109 -0
  139. package/corpus/core/src/cli/skills-content/design-exploration-skill.ts +118 -0
  140. package/corpus/core/src/cli/skills-content/design-visual-edit-skill.ts +228 -0
  141. package/corpus/core/src/cli/skills-content/document-quality.ts +196 -0
  142. package/corpus/core/src/cli/skills-content/exemplar.ts +69 -0
  143. package/corpus/core/src/cli/skills-content/help.ts +77 -0
  144. package/corpus/core/src/cli/skills-content/index.ts +22 -0
  145. package/corpus/core/src/cli/skills-content/local-files.ts +95 -0
  146. package/corpus/core/src/cli/skills-content/plan-setup-auth.ts +80 -0
  147. package/corpus/core/src/cli/skills-content/visual-plan-skill.ts +470 -0
  148. package/corpus/core/src/cli/skills-content/visual-recap-skill.ts +547 -0
  149. package/corpus/core/src/cli/skills-content/visualize-repo-skill.ts +93 -0
  150. package/corpus/core/src/cli/skills-content/wireframe.ts +349 -0
  151. package/corpus/core/src/cli/skills.ts +27 -2733
  152. package/corpus/core/src/client/AgentPanel.tsx +6 -5
  153. package/corpus/core/src/client/CommandMenu.tsx +16 -5
  154. package/corpus/core/src/client/FeedbackButton.tsx +2 -2
  155. package/corpus/core/src/client/agent-chat-adapter.ts +9 -9
  156. package/corpus/core/src/client/app-providers.tsx +18 -5
  157. package/corpus/core/src/client/chat/tool-call-display.tsx +3 -3
  158. package/corpus/core/src/client/composer/PastedTextChip.tsx +1 -1
  159. package/corpus/core/src/client/composer/RealtimeVoiceMode.tsx +143 -45
  160. package/corpus/core/src/client/composer/TiptapComposer.tsx +1 -1
  161. package/corpus/core/src/client/composer/VoiceButton.tsx +21 -5
  162. package/corpus/core/src/client/composer/useRealtimeVoiceMode.tsx +107 -10
  163. package/corpus/core/src/client/context-xray/ContextXRayPanel.tsx +5 -2
  164. package/corpus/core/src/client/extensions/ExtensionEditor.tsx +37 -4
  165. package/corpus/core/src/client/extensions/ExtensionQueryErrorState.tsx +47 -0
  166. package/corpus/core/src/client/extensions/ExtensionSlot.tsx +39 -10
  167. package/corpus/core/src/client/extensions/ExtensionViewer.tsx +44 -6
  168. package/corpus/core/src/client/extensions/ExtensionsListPage.tsx +12 -3
  169. package/corpus/core/src/client/extensions/ExtensionsSidebarSection.tsx +49 -11
  170. package/corpus/core/src/client/index.ts +0 -13
  171. package/corpus/core/src/client/progress/RunsTray.tsx +10 -3
  172. package/corpus/core/src/client/settings/SettingsTabsPage.tsx +7 -0
  173. package/corpus/core/src/client/settings/useBuilderStatus.ts +6 -0
  174. package/corpus/core/src/client/tool-cells/EditCell.tsx +19 -16
  175. package/corpus/core/src/client/tool-cells/FilesChangedSummary.tsx +26 -23
  176. package/corpus/core/src/client/tool-cells/WriteCell.tsx +19 -16
  177. package/corpus/core/src/client/visual-style-controls.tsx +1 -1
  178. package/corpus/core/src/deploy/build.ts +36 -14
  179. package/corpus/core/src/guards/db-tool-scoping.ts +129 -0
  180. package/corpus/core/src/guards/index.ts +23 -0
  181. package/corpus/core/src/guards/no-drizzle-push.ts +116 -0
  182. package/corpus/core/src/guards/no-env-credentials.ts +229 -0
  183. package/corpus/core/src/guards/no-env-mutation.ts +114 -0
  184. package/corpus/core/src/guards/no-localhost-fallback.ts +124 -0
  185. package/corpus/core/src/guards/no-unscoped-credentials.ts +227 -0
  186. package/corpus/core/src/guards/no-unscoped-queries.ts +834 -0
  187. package/corpus/core/src/guards/scan-utils.ts +105 -0
  188. package/corpus/core/src/guards/types.ts +30 -0
  189. package/corpus/core/src/integrations/google-docs-poller.ts +23 -2
  190. package/corpus/core/src/integrations/plugin.ts +10 -0
  191. package/corpus/core/src/integrations/webhook-handler.ts +27 -2
  192. package/corpus/core/src/jobs/scheduler.ts +28 -2
  193. package/corpus/core/src/localization/default-messages.ts +8 -1
  194. package/corpus/core/src/mcp/oauth-token.ts +6 -1
  195. package/corpus/core/src/observability/routes.ts +36 -0
  196. package/corpus/core/src/observability/sentiment.ts +261 -0
  197. package/corpus/core/src/observability/store.ts +23 -0
  198. package/corpus/core/src/observability/traces.ts +49 -63
  199. package/corpus/core/src/observability/tracking-identity.ts +55 -0
  200. package/corpus/core/src/observability/types.ts +13 -0
  201. package/corpus/core/src/org/accept-pending.ts +9 -1
  202. package/corpus/core/src/org/migrations.ts +41 -0
  203. package/corpus/core/src/package-lifecycle/index.ts +1 -0
  204. package/corpus/core/src/package-lifecycle/manifest.ts +120 -0
  205. package/corpus/core/src/provider-api/custom-registry.ts +56 -0
  206. package/corpus/core/src/provider-api/index.ts +2 -0
  207. package/corpus/core/src/secrets/storage.ts +114 -30
  208. package/corpus/core/src/server/action-discovery.ts +4 -0
  209. package/corpus/core/src/server/agent-chat/action-filters-a2a.ts +199 -0
  210. package/corpus/core/src/server/agent-chat/browser-team-tools.ts +510 -0
  211. package/corpus/core/src/server/agent-chat/context-tools.ts +595 -0
  212. package/corpus/core/src/server/agent-chat/framework-prompts.ts +470 -0
  213. package/corpus/core/src/server/agent-chat/lazy-fs.ts +11 -0
  214. package/corpus/core/src/server/agent-chat/mcp-glue.ts +91 -0
  215. package/corpus/core/src/server/agent-chat/plugin-options.ts +350 -0
  216. package/corpus/core/src/server/agent-chat/process-run-failure.ts +62 -0
  217. package/corpus/core/src/server/agent-chat/prompt-resources.ts +688 -0
  218. package/corpus/core/src/server/agent-chat/recurring-jobs-runtime.ts +80 -0
  219. package/corpus/core/src/server/agent-chat/request-surface.ts +71 -0
  220. package/corpus/core/src/server/agent-chat/run-code-tools.ts +67 -0
  221. package/corpus/core/src/server/agent-chat/script-entries.ts +779 -0
  222. package/corpus/core/src/server/agent-chat/shared-thread.ts +301 -0
  223. package/corpus/core/src/server/agent-chat/skill-frontmatter.ts +41 -0
  224. package/corpus/core/src/server/agent-chat-plugin.ts +403 -4179
  225. package/corpus/core/src/server/agent-teams.ts +26 -3
  226. package/corpus/core/src/server/auth.ts +55 -57
  227. package/corpus/core/src/server/core-routes-plugin.ts +30 -14
  228. package/corpus/core/src/server/credential-provider.ts +22 -25
  229. package/corpus/core/src/server/csrf.ts +24 -5
  230. package/corpus/core/src/server/edge.ts +1 -0
  231. package/corpus/core/src/server/framework-request-handler.ts +34 -0
  232. package/corpus/core/src/server/google-realtime-session.ts +1 -36
  233. package/corpus/core/src/server/onboarding-html.ts +1 -16
  234. package/corpus/core/src/server/poll.ts +24 -2
  235. package/corpus/core/src/server/realtime-voice.ts +49 -5
  236. package/corpus/core/src/server/request-origin.ts +67 -0
  237. package/corpus/core/src/server/ssr-handler.ts +55 -2
  238. package/corpus/core/src/server/transcribe-voice.ts +1 -50
  239. package/corpus/core/src/sharing/access.ts +155 -11
  240. package/corpus/core/src/sharing/registry.ts +7 -0
  241. package/corpus/core/src/styles/agent-native.css +15 -14
  242. package/corpus/core/src/templates/default/.agents/skills/frontend-design/SKILL.md +1 -1
  243. package/corpus/core/src/templates/default/app/i18n/ar-SA.ts +6 -0
  244. package/corpus/core/src/templates/default/app/i18n/de-DE.ts +6 -0
  245. package/corpus/core/src/templates/default/app/i18n/en-US.ts +6 -0
  246. package/corpus/core/src/templates/default/app/i18n/es-ES.ts +6 -0
  247. package/corpus/core/src/templates/default/app/i18n/fr-FR.ts +6 -0
  248. package/corpus/core/src/templates/default/app/i18n/hi-IN.ts +6 -0
  249. package/corpus/core/src/templates/default/app/i18n/ja-JP.ts +6 -0
  250. package/corpus/core/src/templates/default/app/i18n/ko-KR.ts +6 -0
  251. package/corpus/core/src/templates/default/app/i18n/pt-BR.ts +6 -0
  252. package/corpus/core/src/templates/default/app/i18n/zh-CN.ts +6 -0
  253. package/corpus/core/src/templates/default/app/i18n/zh-TW.ts +6 -0
  254. package/corpus/core/src/templates/default/package.json +2 -2
  255. package/corpus/core/src/templates/headless/package.json +0 -1
  256. package/corpus/core/src/templates/workspace-core/.agents/skills/audit-log/SKILL.md +3 -0
  257. package/corpus/core/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +27 -29
  258. package/corpus/core/src/templates/workspace-core/.agents/skills/automations/SKILL.md +1 -1
  259. package/corpus/core/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +2 -1
  260. package/corpus/core/src/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +1 -1
  261. package/corpus/core/src/templates/workspace-core/.agents/skills/observability/SKILL.md +32 -0
  262. package/corpus/core/src/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +25 -0
  263. package/corpus/core/src/templates/workspace-core/package.json +0 -1
  264. package/corpus/core/src/templates/workspace-core/src/server/index.ts +4 -2
  265. package/corpus/core/src/templates/workspace-root/package.json +0 -1
  266. package/corpus/core/src/testing.ts +26 -0
  267. package/corpus/core/src/triggers/actions.ts +11 -3
  268. package/corpus/core/src/triggers/dispatcher.ts +23 -2
  269. package/corpus/core/src/triggers/types.ts +7 -1
  270. package/corpus/core/src/vite/client.ts +126 -2
  271. package/corpus/core/tsconfig.cli.json +1 -1
  272. package/corpus/core/tsconfig.json +5 -1
  273. package/corpus/templates/analytics/.agents/skills/bigquery/SKILL.md +2 -2
  274. package/corpus/templates/analytics/.agents/skills/frontend-design/SKILL.md +1 -1
  275. package/corpus/templates/analytics/AGENTS.md +19 -6
  276. package/corpus/templates/analytics/actions/compose-dashboard.ts +65 -37
  277. package/corpus/templates/analytics/actions/install-dashboard-template.ts +79 -43
  278. package/corpus/templates/analytics/actions/list-explorer-dashboards.ts +3 -3
  279. package/corpus/templates/analytics/actions/list-sql-dashboards.ts +8 -3
  280. package/corpus/templates/analytics/actions/mutate-dashboard.ts +73 -24
  281. package/corpus/templates/analytics/actions/rename-analysis.ts +8 -2
  282. package/corpus/templates/analytics/actions/rename-dashboard.ts +8 -7
  283. package/corpus/templates/analytics/actions/reorder-dashboard-panels.ts +16 -13
  284. package/corpus/templates/analytics/actions/update-dashboard.ts +53 -42
  285. package/corpus/templates/analytics/actions/view-screen.ts +4 -23
  286. package/corpus/templates/analytics/app/components/ResourceLoadError.tsx +42 -0
  287. package/corpus/templates/analytics/app/components/layout/CommandPalette.tsx +85 -70
  288. package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +107 -89
  289. package/corpus/templates/analytics/app/components/layout/SidebarLoadError.tsx +24 -0
  290. package/corpus/templates/analytics/app/hooks/use-dashboard-views.ts +15 -5
  291. package/corpus/templates/analytics/app/i18n/zh-TW.ts +4 -0
  292. package/corpus/templates/analytics/app/i18n-data.ts +40 -0
  293. package/corpus/templates/analytics/app/pages/Settings.tsx +6 -2
  294. package/corpus/templates/analytics/app/pages/adhoc/explorer/components/SqlPreview.tsx +36 -20
  295. package/corpus/templates/analytics/app/pages/adhoc/explorer/index.tsx +34 -20
  296. package/corpus/templates/analytics/app/pages/adhoc/explorer/use-explorer-config.ts +42 -41
  297. package/corpus/templates/analytics/app/pages/adhoc/explorer-dashboard/index.tsx +43 -36
  298. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/ViewsMenu.tsx +11 -2
  299. package/corpus/templates/analytics/app/root.tsx +13 -1
  300. package/corpus/templates/analytics/app/routes/_index.tsx +14 -2
  301. package/corpus/templates/analytics/changelog/2026-07-03-agent-llm-observability-dashboard.md +1 -1
  302. package/corpus/templates/analytics/changelog/2026-07-10-dashboard-edits-from-the-agent-and-the-ui-at-the-same-time-n.md +6 -0
  303. package/corpus/templates/analytics/changelog/2026-07-10-timed-out-bigquery-jobs-are-now-cancelled-so-they-stop-consu.md +6 -0
  304. package/corpus/templates/analytics/changelog/2026-07-11-agent-feedback-sentiment-dashboard.md +6 -0
  305. package/corpus/templates/analytics/changelog/2026-07-11-analytics-chats-now-start-faster-by-loading-metric-definitio.md +6 -0
  306. package/corpus/templates/analytics/changelog/2026-07-11-command-and-sql-previews-now-respond-without-lag.md +6 -0
  307. package/corpus/templates/analytics/changelog/2026-07-11-command-search-now-reports-loading-failures-and-lets-you-ret.md +6 -0
  308. package/corpus/templates/analytics/changelog/2026-07-11-dashboard-navigation-now-loads-faster-and-reports-request-fa.md +6 -0
  309. package/corpus/templates/analytics/changelog/2026-07-11-inferred-message-sentiment-dashboard.md +6 -0
  310. package/corpus/templates/analytics/changelog/2026-07-11-microphone-settings-from-realtime-voice-mode-now-open-the-vo.md +6 -0
  311. package/corpus/templates/analytics/changelog/2026-07-11-more-dashboard-edit-paths-are-now-safe-against-simultaneous-.md +6 -0
  312. package/corpus/templates/analytics/changelog/2026-07-11-renaming-a-dashboard-is-now-safe-against-simultaneous-agent-.md +6 -0
  313. package/corpus/templates/analytics/changelog/2026-07-11-renaming-an-analysis-is-now-safe-against-simultaneous-edits.md +6 -0
  314. package/corpus/templates/analytics/changelog/2026-07-11-workspace-mounted-analytics-now-opens-ask-reliably-and-route.md +6 -0
  315. package/corpus/templates/analytics/docs/schemas/first-party-analytics.md +37 -3
  316. package/corpus/templates/analytics/package.json +1 -2
  317. package/corpus/templates/analytics/seeds/dashboards/agent-native-templates-first-party.json +339 -1
  318. package/corpus/templates/analytics/server/lib/bigquery.ts +3 -2
  319. package/corpus/templates/analytics/server/lib/dashboard-catalog.ts +1 -24
  320. package/corpus/templates/analytics/server/lib/dashboard-seeds.ts +0 -5
  321. package/corpus/templates/analytics/server/lib/dashboards-store.ts +443 -31
  322. package/corpus/templates/analytics/server/lib/data-dictionary-context.ts +106 -34
  323. package/corpus/templates/analytics/server/lib/demo-dashboards.ts +4 -1
  324. package/corpus/templates/analytics/server/plugins/agent-chat.ts +11 -39
  325. package/corpus/templates/assets/.agents/skills/frontend-design/SKILL.md +1 -1
  326. package/corpus/templates/assets/app/components/create/RecentDraftsSection.tsx +30 -4
  327. package/corpus/templates/assets/app/routes/library.tsx +49 -5
  328. package/corpus/templates/assets/changelog/2026-07-11-library-load-failures-now-show-a-retry-action.md +6 -0
  329. package/corpus/templates/assets/package.json +1 -2
  330. package/corpus/templates/brain/.agents/skills/frontend-design/SKILL.md +1 -1
  331. package/corpus/templates/brain/package.json +1 -2
  332. package/corpus/templates/calendar/.agents/skills/frontend-design/SKILL.md +1 -1
  333. package/corpus/templates/calendar/.env.example +5 -0
  334. package/corpus/templates/calendar/app/components/calendar/EventCard.tsx +2 -2
  335. package/corpus/templates/calendar/app/i18n/zh-TW.ts +2 -0
  336. package/corpus/templates/calendar/app/i18n-data.ts +20 -0
  337. package/corpus/templates/calendar/app/pages/BookingLinksPage.tsx +37 -1
  338. package/corpus/templates/calendar/app/pages/BookingsList.tsx +20 -3
  339. package/corpus/templates/calendar/changelog/2026-07-11-booking-load-failures-now-show-a-retry-action.md +6 -0
  340. package/corpus/templates/calendar/changelog/2026-07-11-event-cards-give-subtle-press-feedback-and-smoother-hover.md +6 -0
  341. package/corpus/templates/calendar/package.json +1 -2
  342. package/corpus/templates/chat/.agents/skills/frontend-design/SKILL.md +1 -1
  343. package/corpus/templates/chat/package.json +1 -2
  344. package/corpus/templates/clips/.agents/skills/frontend-design/SKILL.md +1 -1
  345. package/corpus/templates/clips/actions/decline-invite.ts +8 -0
  346. package/corpus/templates/clips/app/components/library/folder-tree.tsx +209 -187
  347. package/corpus/templates/clips/app/components/meetings/meeting-card.tsx +2 -2
  348. package/corpus/templates/clips/app/components/player/reactions-tray.tsx +17 -5
  349. package/corpus/templates/clips/app/components/player/scrubber.tsx +5 -3
  350. package/corpus/templates/clips/app/components/recorder/pre-record-panel.tsx +2 -2
  351. package/corpus/templates/clips/app/components/workspace/insights-hub.tsx +119 -95
  352. package/corpus/templates/clips/app/global.css +45 -0
  353. package/corpus/templates/clips/app/root.tsx +4 -0
  354. package/corpus/templates/clips/app/routes/_app.notifications.tsx +23 -2
  355. package/corpus/templates/clips/app/routes/_app.trash.tsx +24 -2
  356. package/corpus/templates/clips/changelog/2026-07-10-atomic-view-tracking.md +6 -0
  357. package/corpus/templates/clips/changelog/2026-07-11-controls-and-folders-now-move-more-smoothly.md +6 -0
  358. package/corpus/templates/clips/changelog/2026-07-11-declining-an-invitation-now-requires-being-its-recipient.md +6 -0
  359. package/corpus/templates/clips/changelog/2026-07-11-recording-overlays-are-lighter-weight-and-no-longer-cause-pa.md +6 -0
  360. package/corpus/templates/clips/changelog/2026-07-11-workspace-load-failures-now-show-a-retry-action.md +6 -0
  361. package/corpus/templates/clips/chrome-extension/package.json +3 -2
  362. package/corpus/templates/clips/chrome-extension/src/overlay.css +34 -5
  363. package/corpus/templates/clips/chrome-extension/src/styles.css +2 -2
  364. package/corpus/templates/clips/desktop/package.json +6 -4
  365. package/corpus/templates/clips/desktop/src/lib/recorder.ts +26 -13
  366. package/corpus/templates/clips/desktop/src/lib/voice-dictation.ts +4 -1
  367. package/corpus/templates/clips/desktop/src/styles.css +71 -26
  368. package/corpus/templates/clips/package.json +1 -2
  369. package/corpus/templates/clips/server/db/schema.ts +29 -17
  370. package/corpus/templates/clips/server/plugins/db.ts +8 -0
  371. package/corpus/templates/clips/server/routes/api/view-event.post.ts +260 -105
  372. package/corpus/templates/content/.agents/skills/frontend-design/SKILL.md +1 -1
  373. package/corpus/templates/content/.agents/skills/notion-integration/SKILL.md +16 -0
  374. package/corpus/templates/content/AGENTS.md +72 -62
  375. package/corpus/templates/content/actions/_content-database-source-adapters.ts +84 -0
  376. package/corpus/templates/content/actions/_database-source-utils.ts +206 -96
  377. package/corpus/templates/content/actions/_notion-database-source-adapter.ts +216 -0
  378. package/corpus/templates/content/actions/_position-utils.ts +76 -0
  379. package/corpus/templates/content/actions/_property-utils.ts +31 -20
  380. package/corpus/templates/content/actions/add-database-item.ts +52 -39
  381. package/corpus/templates/content/actions/attach-content-database-source.ts +95 -11
  382. package/corpus/templates/content/actions/change-content-database-source-role.ts +24 -1
  383. package/corpus/templates/content/actions/configure-document-property.ts +36 -27
  384. package/corpus/templates/content/actions/create-content-database.ts +40 -30
  385. package/corpus/templates/content/actions/create-document.ts +39 -32
  386. package/corpus/templates/content/actions/duplicate-document-property.ts +37 -28
  387. package/corpus/templates/content/actions/list-notion-database-sources.ts +80 -0
  388. package/corpus/templates/content/actions/move-document.ts +93 -61
  389. package/corpus/templates/content/actions/refresh-content-database-source.ts +42 -3
  390. package/corpus/templates/content/actions/share-local-file-document.ts +36 -27
  391. package/corpus/templates/content/actions/suggest-source-join-key.ts +39 -16
  392. package/corpus/templates/content/app/components/QueryErrorState.tsx +39 -0
  393. package/corpus/templates/content/app/components/editor/LinkHoverPreview.tsx +1 -1
  394. package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +323 -1467
  395. package/corpus/templates/content/app/components/editor/database/GalleryView.tsx +368 -0
  396. package/corpus/templates/content/app/components/editor/database/ListView.tsx +353 -0
  397. package/corpus/templates/content/app/components/editor/database/TimelineView.tsx +580 -0
  398. package/corpus/templates/content/app/components/editor/database/settings.tsx +1 -1
  399. package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +11 -2
  400. package/corpus/templates/content/app/global.css +19 -19
  401. package/corpus/templates/content/app/hooks/use-content-database.ts +18 -1
  402. package/corpus/templates/content/app/i18n/zh-TW.ts +4 -0
  403. package/corpus/templates/content/app/i18n-data.ts +40 -0
  404. package/corpus/templates/content/app/root.tsx +2 -2
  405. package/corpus/templates/content/app/routes/_app._index.tsx +11 -1
  406. package/corpus/templates/content/changelog/2026-07-10-failed-row-creation-and-source-attach-now-show-an-error-inst.md +6 -0
  407. package/corpus/templates/content/changelog/2026-07-10-items-added-at-the-same-time-no-longer-end-up-with-identical.md +6 -0
  408. package/corpus/templates/content/changelog/2026-07-10-notion-databases-can-add-read-only-details-to-content-tables.md +6 -0
  409. package/corpus/templates/content/changelog/2026-07-11-document-load-failures-now-show-a-retry-action.md +6 -0
  410. package/corpus/templates/content/changelog/2026-07-11-editor-toggle-feedback-now-feels-more-responsive.md +6 -0
  411. package/corpus/templates/content/changelog/2026-07-11-moving-documents-at-the-same-time-no-longer-scrambles-their-.md +6 -0
  412. package/corpus/templates/content/changelog/2026-07-11-public-document-chats-now-start-faster-while-keeping-full-do.md +6 -0
  413. package/corpus/templates/content/changelog/2026-07-11-reopening-a-comment-now-uses-consistent-permissions-everywhe.md +6 -0
  414. package/corpus/templates/content/changelog/2026-07-11-sidebar-resizing-now-tracks-your-cursor-instantly-instead-of.md +6 -0
  415. package/corpus/templates/content/package.json +1 -2
  416. package/corpus/templates/content/parity/matrix.md +25 -25
  417. package/corpus/templates/content/parity/matrix.ts +1 -0
  418. package/corpus/templates/content/server/lib/public-documents.ts +47 -10
  419. package/corpus/templates/content/server/routes/api/comments/[id].patch.ts +24 -24
  420. package/corpus/templates/content/server/routes/api/documents/[id]/move.patch.ts +43 -26
  421. package/corpus/templates/content/shared/api.ts +16 -1
  422. package/corpus/templates/design/.agents/skills/frontend-design/SKILL.md +1 -1
  423. package/corpus/templates/design/.agents/skills/visual-edit/SKILL.md +8 -4
  424. package/corpus/templates/design/AGENTS.md +12 -2
  425. package/corpus/templates/design/DEVELOPING.md +10 -6
  426. package/corpus/templates/design/actions/apply-visual-edit.ts +191 -6
  427. package/corpus/templates/design/actions/duplicate-design.ts +31 -25
  428. package/corpus/templates/design/app/components/QueryErrorState.tsx +24 -0
  429. package/corpus/templates/design/app/components/design/CanvasContextMenu.tsx +1 -1
  430. package/corpus/templates/design/app/components/design/DesignImportPanel.tsx +5 -2
  431. package/corpus/templates/design/app/components/design/EditPanel.tsx +326 -319
  432. package/corpus/templates/design/app/components/design/LayersPanel.tsx +198 -193
  433. package/corpus/templates/design/app/components/design/edit-panel/panel-primitives.tsx +11 -4
  434. package/corpus/templates/design/app/components/design/inspector/DesignColorPicker.tsx +1 -1
  435. package/corpus/templates/design/app/components/layout/Layout.tsx +1 -1
  436. package/corpus/templates/design/app/pages/DesignSystems.tsx +7 -1
  437. package/corpus/templates/design/app/pages/Index.tsx +14 -2
  438. package/corpus/templates/design/app/pages/Present.tsx +16 -3
  439. package/corpus/templates/design/app/pages/Templates.tsx +10 -4
  440. package/corpus/templates/design/app/pages/design-editor/canvas-primitive-insert.ts +484 -0
  441. package/corpus/templates/design/app/pages/design-editor/clone-and-pen-edit.ts +378 -0
  442. package/corpus/templates/design/app/pages/design-editor/design-data-geometry-utils.ts +138 -0
  443. package/corpus/templates/design/app/pages/design-editor/dom-utils.ts +15 -0
  444. package/corpus/templates/design/app/pages/design-editor/generation-prompt-directives.ts +180 -0
  445. package/corpus/templates/design/app/pages/design-editor/html-layer-positioning.ts +226 -0
  446. package/corpus/templates/design/app/pages/design-editor/pending-edits.ts +5 -1
  447. package/corpus/templates/design/app/pages/design-editor/png-export-render.ts +348 -0
  448. package/corpus/templates/design/app/pages/design-editor/screen-command-utils.ts +160 -0
  449. package/corpus/templates/design/app/pages/design-editor/text-edit-utils.ts +238 -0
  450. package/corpus/templates/design/app/pages/design-editor/tool-state.ts +23 -1
  451. package/corpus/templates/design/app/pages/design-editor/types.ts +25 -0
  452. package/corpus/templates/design/app/root.tsx +10 -1
  453. package/corpus/templates/design/changelog/2026-07-10-duplicating-a-design-can-no-longer-produce-a-copy-with-missi.md +6 -0
  454. package/corpus/templates/design/changelog/2026-07-10-local-visual-edits-can-now-save-safe-leaf-text-class-and.md +6 -0
  455. package/corpus/templates/design/changelog/2026-07-11-canvas-context-menus-now-open-without-motion-jitter.md +6 -0
  456. package/corpus/templates/design/changelog/2026-07-11-design-load-failures-now-show-a-retry-action.md +6 -0
  457. package/corpus/templates/design/changelog/2026-07-11-inspector-tooltips-appear-instantly-as-you-sweep-across-icon.md +6 -0
  458. package/corpus/templates/design/package.json +1 -1
  459. package/corpus/templates/design/shared/local-jsx-visual-edit.ts +388 -0
  460. package/corpus/templates/dispatch/.agents/skills/frontend-design/SKILL.md +1 -1
  461. package/corpus/templates/dispatch/app/i18n/zh-TW.ts +10 -0
  462. package/corpus/templates/dispatch/app/i18n-data.ts +123 -0
  463. package/corpus/templates/dispatch/app/routes/integrations.tsx +163 -144
  464. package/corpus/templates/dispatch/changelog/2026-07-11-dispatch-mcp-connections-now-start-with-safer-app-access-and.md +6 -0
  465. package/corpus/templates/dispatch/changelog/2026-07-11-overview-and-chat-now-share-a-cleaner-more-stable-flow.md +6 -0
  466. package/corpus/templates/dispatch/changelog/2026-07-11-query-errors-now-show-a-retry-option.md +6 -0
  467. package/corpus/templates/dispatch/package.json +1 -2
  468. package/corpus/templates/forms/.agents/skills/frontend-design/SKILL.md +1 -1
  469. package/corpus/templates/forms/actions/patch-form-fields.ts +82 -44
  470. package/corpus/templates/forms/app/components/layout/Sidebar.tsx +3 -3
  471. package/corpus/templates/forms/app/root.tsx +34 -8
  472. package/corpus/templates/forms/changelog/2026-07-10-simultaneous-edits-to-different-form-fields-no-longer-overwr.md +6 -0
  473. package/corpus/templates/forms/package.json +1 -2
  474. package/corpus/templates/macros/.agents/skills/frontend-design/SKILL.md +1 -1
  475. package/corpus/templates/macros/app/components/DailyProgress.tsx +25 -5
  476. package/corpus/templates/macros/app/components/QueryErrorState.tsx +31 -0
  477. package/corpus/templates/macros/app/components/WeightTracker.tsx +5 -1
  478. package/corpus/templates/macros/app/components/ui/button.tsx +1 -1
  479. package/corpus/templates/macros/app/components/ui/progress.tsx +1 -1
  480. package/corpus/templates/macros/app/components/ui/tabs.tsx +1 -1
  481. package/corpus/templates/macros/app/i18n/ar-SA.ts +2 -0
  482. package/corpus/templates/macros/app/i18n/de-DE.ts +2 -0
  483. package/corpus/templates/macros/app/i18n/en-US.ts +2 -0
  484. package/corpus/templates/macros/app/i18n/es-ES.ts +2 -0
  485. package/corpus/templates/macros/app/i18n/fr-FR.ts +2 -0
  486. package/corpus/templates/macros/app/i18n/hi-IN.ts +2 -0
  487. package/corpus/templates/macros/app/i18n/ja-JP.ts +2 -0
  488. package/corpus/templates/macros/app/i18n/ko-KR.ts +2 -0
  489. package/corpus/templates/macros/app/i18n/pt-BR.ts +2 -0
  490. package/corpus/templates/macros/app/i18n/zh-CN.ts +2 -0
  491. package/corpus/templates/macros/app/i18n/zh-TW.ts +2 -0
  492. package/corpus/templates/macros/app/routes/_index.tsx +22 -12
  493. package/corpus/templates/macros/app/routes/analytics.tsx +31 -10
  494. package/corpus/templates/macros/changelog/2026-07-11-daily-tracking-now-loads-and-updates-more-quickly.md +6 -0
  495. package/corpus/templates/macros/changelog/2026-07-11-data-load-failures-now-show-a-clear-error-with-a-retry-actio.md +6 -0
  496. package/corpus/templates/macros/package.json +1 -2
  497. package/corpus/templates/mail/.agents/skills/frontend-design/SKILL.md +1 -1
  498. package/corpus/templates/mail/.env.example +16 -11
  499. package/corpus/templates/mail/actions/list-emails.ts +39 -35
  500. package/corpus/templates/mail/app/components/email/ComposeModal.tsx +58 -6
  501. package/corpus/templates/mail/app/components/email/EmailListItem.tsx +35 -2
  502. package/corpus/templates/mail/app/components/email/EmailThread.tsx +3 -1
  503. package/corpus/templates/mail/app/components/layout/AppLayout.tsx +113 -104
  504. package/corpus/templates/mail/app/root.tsx +8 -10
  505. package/corpus/templates/mail/changelog/2026-07-10-fixed-calendar-rsvp-buttons-in-emails-firing-duplicate-respo.md +6 -0
  506. package/corpus/templates/mail/changelog/2026-07-11-compose-and-navigation-motion-now-feel-faster-and-smoother.md +6 -0
  507. package/corpus/templates/mail/changelog/2026-07-11-swipe-to-archive-or-snooze-now-responds-to-quick-flicks-not-.md +6 -0
  508. package/corpus/templates/mail/changelog/2026-07-11-the-assistant-now-sees-the-same-inbox-you-do-snoozed-mail-st.md +6 -0
  509. package/corpus/templates/mail/package.json +1 -2
  510. package/corpus/templates/mail/server/handlers/emails.ts +25 -69
  511. package/corpus/templates/mail/server/lib/list-inbox-emails.ts +169 -0
  512. package/corpus/templates/plan/.agents/skills/frontend-design/SKILL.md +1 -1
  513. package/corpus/templates/plan/.env.example +4 -0
  514. package/corpus/templates/plan/actions/create-plan-design.ts +89 -81
  515. package/corpus/templates/plan/actions/create-prototype-plan.ts +72 -59
  516. package/corpus/templates/plan/actions/create-ui-plan.ts +70 -55
  517. package/corpus/templates/plan/actions/create-visual-plan.ts +65 -51
  518. package/corpus/templates/plan/actions/restore-plan-version.ts +126 -96
  519. package/corpus/templates/plan/actions/update-local-plan-folder.ts +43 -30
  520. package/corpus/templates/plan/actions/update-visual-plan.ts +81 -64
  521. package/corpus/templates/plan/app/components/layout/Sidebar.tsx +17 -0
  522. package/corpus/templates/plan/app/components/ui/tabs.tsx +1 -1
  523. package/corpus/templates/plan/app/i18n/ar-SA.ts +10 -0
  524. package/corpus/templates/plan/app/i18n/de-DE.ts +10 -0
  525. package/corpus/templates/plan/app/i18n/en-US.ts +10 -0
  526. package/corpus/templates/plan/app/i18n/es-ES.ts +10 -0
  527. package/corpus/templates/plan/app/i18n/fr-FR.ts +10 -0
  528. package/corpus/templates/plan/app/i18n/hi-IN.ts +10 -0
  529. package/corpus/templates/plan/app/i18n/ja-JP.ts +10 -0
  530. package/corpus/templates/plan/app/i18n/ko-KR.ts +10 -0
  531. package/corpus/templates/plan/app/i18n/pt-BR.ts +10 -0
  532. package/corpus/templates/plan/app/i18n/zh-CN.ts +10 -0
  533. package/corpus/templates/plan/app/i18n/zh-TW.ts +10 -0
  534. package/corpus/templates/plan/app/lib/plan-local-bridge.ts +80 -1
  535. package/corpus/templates/plan/app/pages/PlansPage.tsx +152 -4
  536. package/corpus/templates/plan/app/root.tsx +11 -0
  537. package/corpus/templates/plan/changelog/2026-07-10-restoring-a-plan-version-can-no-longer-leave-a-plan-half-res.md +6 -0
  538. package/corpus/templates/plan/changelog/2026-07-11-local-plans-now-explain-and-recover-from-browser-permission-.md +6 -0
  539. package/corpus/templates/plan/changelog/2026-07-11-plan-edits-now-save-atomically-and-can-no-longer-partially-a.md +6 -0
  540. package/corpus/templates/plan/changelog/2026-07-11-plan-lists-now-show-a-clear-error-with-a-retry-action-when-t.md +6 -0
  541. package/corpus/templates/plan/package.json +1 -2
  542. package/corpus/templates/plan/server/plans.ts +9 -2
  543. package/corpus/templates/plan/shared/plan-content.ts +546 -260
  544. package/corpus/templates/slides/.agents/skills/frontend-design/SKILL.md +1 -1
  545. package/corpus/templates/slides/actions/delete-slide-comment.ts +49 -0
  546. package/corpus/templates/slides/actions/list-decks.ts +28 -0
  547. package/corpus/templates/slides/actions/update-slide-comment.ts +93 -0
  548. package/corpus/templates/slides/actions/view-screen.ts +14 -6
  549. package/corpus/templates/slides/app/components/comments/SlideCommentsPanel.tsx +33 -10
  550. package/corpus/templates/slides/app/components/deck/MermaidRenderer.tsx +41 -26
  551. package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +4 -8
  552. package/corpus/templates/slides/app/components/editor/EditorSidebar.tsx +3 -5
  553. package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +5 -9
  554. package/corpus/templates/slides/app/components/editor/ExportMenu.tsx +5 -12
  555. package/corpus/templates/slides/app/components/editor/GenerateSlidesDialog.tsx +2 -2
  556. package/corpus/templates/slides/app/components/editor/HistoryPanel.tsx +3 -6
  557. package/corpus/templates/slides/app/components/editor/ImageDropPromptPopover.tsx +3 -6
  558. package/corpus/templates/slides/app/components/editor/PromptDialog.tsx +2 -5
  559. package/corpus/templates/slides/app/components/presentation/PresentationView.tsx +4 -2
  560. package/corpus/templates/slides/app/components/visual-editor/CanvasCommentPins.tsx +4 -3
  561. package/corpus/templates/slides/app/context/DeckContext.tsx +56 -4
  562. package/corpus/templates/slides/app/i18n/ar-SA.ts +6 -0
  563. package/corpus/templates/slides/app/i18n/de-DE.ts +6 -0
  564. package/corpus/templates/slides/app/i18n/en-US.ts +6 -0
  565. package/corpus/templates/slides/app/i18n/es-ES.ts +6 -0
  566. package/corpus/templates/slides/app/i18n/fr-FR.ts +6 -0
  567. package/corpus/templates/slides/app/i18n/hi-IN.ts +6 -0
  568. package/corpus/templates/slides/app/i18n/ja-JP.ts +6 -0
  569. package/corpus/templates/slides/app/i18n/ko-KR.ts +6 -0
  570. package/corpus/templates/slides/app/i18n/pt-BR.ts +6 -0
  571. package/corpus/templates/slides/app/i18n/zh-CN.ts +5 -0
  572. package/corpus/templates/slides/app/i18n/zh-TW.ts +5 -0
  573. package/corpus/templates/slides/app/pages/DeckEditor.tsx +11 -30
  574. package/corpus/templates/slides/app/pages/DesignSystems.tsx +23 -2
  575. package/corpus/templates/slides/app/pages/Index.tsx +31 -4
  576. package/corpus/templates/slides/app/root.tsx +0 -5
  577. package/corpus/templates/slides/changelog/2026-07-10-deck-lists-load-much-faster-and-no-longer-re-download-slide-.md +6 -0
  578. package/corpus/templates/slides/changelog/2026-07-11-comment-load-failures-now-show-a-retry-action-instead-of-say.md +6 -0
  579. package/corpus/templates/slides/changelog/2026-07-11-comment-pins-now-clear-with-a-faster-smoother-confirmation.md +6 -0
  580. package/corpus/templates/slides/changelog/2026-07-11-deck-and-design-system-load-failures-now-show-a-retry-action.md +6 -0
  581. package/corpus/templates/slides/changelog/2026-07-11-editor-toggles-and-toolbar-menus-now-animate-smoothly.md +6 -0
  582. package/corpus/templates/slides/changelog/2026-07-11-the-assistant-can-now-resolve-reopen-and-delete-slide-commen.md +6 -0
  583. package/corpus/templates/slides/changelog/2026-07-11-viewing-slides-no-longer-loads-every-deck-s-full-contents-in.md +6 -0
  584. package/corpus/templates/slides/package.json +1 -2
  585. package/corpus/templates/slides/server/routes/api/comments/[id].delete.ts +29 -48
  586. package/corpus/templates/slides/server/routes/api/comments/[id].patch.ts +29 -65
  587. package/dist/a2a/auth-policy.d.ts +19 -0
  588. package/dist/a2a/auth-policy.d.ts.map +1 -1
  589. package/dist/a2a/auth-policy.js +32 -0
  590. package/dist/a2a/auth-policy.js.map +1 -1
  591. package/dist/action.d.ts +23 -0
  592. package/dist/action.d.ts.map +1 -1
  593. package/dist/action.js +13 -0
  594. package/dist/action.js.map +1 -1
  595. package/dist/agent/durable-background.d.ts +8 -5
  596. package/dist/agent/durable-background.d.ts.map +1 -1
  597. package/dist/agent/durable-background.js +15 -8
  598. package/dist/agent/durable-background.js.map +1 -1
  599. package/dist/agent/engine/builder-engine.d.ts.map +1 -1
  600. package/dist/agent/engine/builder-engine.js +3 -0
  601. package/dist/agent/engine/builder-engine.js.map +1 -1
  602. package/dist/agent/engine/context-directives-transform.d.ts +25 -0
  603. package/dist/agent/engine/context-directives-transform.d.ts.map +1 -0
  604. package/dist/agent/engine/context-directives-transform.js +53 -0
  605. package/dist/agent/engine/context-directives-transform.js.map +1 -0
  606. package/dist/agent/engine/continuation-dispatch-retry.d.ts +40 -0
  607. package/dist/agent/engine/continuation-dispatch-retry.d.ts.map +1 -0
  608. package/dist/agent/engine/continuation-dispatch-retry.js +109 -0
  609. package/dist/agent/engine/continuation-dispatch-retry.js.map +1 -0
  610. package/dist/agent/engine/tool-call-journal-seed.d.ts +46 -0
  611. package/dist/agent/engine/tool-call-journal-seed.d.ts.map +1 -0
  612. package/dist/agent/engine/tool-call-journal-seed.js +60 -0
  613. package/dist/agent/engine/tool-call-journal-seed.js.map +1 -0
  614. package/dist/agent/production-agent.d.ts +7 -0
  615. package/dist/agent/production-agent.d.ts.map +1 -1
  616. package/dist/agent/production-agent.js +102 -222
  617. package/dist/agent/production-agent.js.map +1 -1
  618. package/dist/agent/run-store.d.ts.map +1 -1
  619. package/dist/agent/run-store.js +9 -4
  620. package/dist/agent/run-store.js.map +1 -1
  621. package/dist/audit/actions/export-audit-events.d.ts +27 -0
  622. package/dist/audit/actions/export-audit-events.d.ts.map +1 -0
  623. package/dist/audit/actions/export-audit-events.js +144 -0
  624. package/dist/audit/actions/export-audit-events.js.map +1 -0
  625. package/dist/audit/store.d.ts +1 -0
  626. package/dist/audit/store.d.ts.map +1 -1
  627. package/dist/audit/store.js +8 -3
  628. package/dist/audit/store.js.map +1 -1
  629. package/dist/audit/types.d.ts +3 -0
  630. package/dist/audit/types.d.ts.map +1 -1
  631. package/dist/audit/types.js.map +1 -1
  632. package/dist/cli/doctor.d.ts +83 -0
  633. package/dist/cli/doctor.d.ts.map +1 -0
  634. package/dist/cli/doctor.js +281 -0
  635. package/dist/cli/doctor.js.map +1 -0
  636. package/dist/cli/index.js +50 -0
  637. package/dist/cli/index.js.map +1 -1
  638. package/dist/cli/info.js +3 -3
  639. package/dist/cli/info.js.map +1 -1
  640. package/dist/cli/package-lifecycle.d.ts +50 -0
  641. package/dist/cli/package-lifecycle.d.ts.map +1 -0
  642. package/dist/cli/package-lifecycle.js +560 -0
  643. package/dist/cli/package-lifecycle.js.map +1 -0
  644. package/dist/cli/plan-local.d.ts.map +1 -1
  645. package/dist/cli/plan-local.js +8 -2
  646. package/dist/cli/plan-local.js.map +1 -1
  647. package/dist/cli/skills-content/assets-skill.d.ts +2 -0
  648. package/dist/cli/skills-content/assets-skill.d.ts.map +1 -0
  649. package/dist/cli/skills-content/assets-skill.js +84 -0
  650. package/dist/cli/skills-content/assets-skill.js.map +1 -0
  651. package/dist/cli/skills-content/canvas.d.ts +4 -0
  652. package/dist/cli/skills-content/canvas.d.ts.map +1 -0
  653. package/dist/cli/skills-content/canvas.js +152 -0
  654. package/dist/cli/skills-content/canvas.js.map +1 -0
  655. package/dist/cli/skills-content/connection.d.ts +2 -0
  656. package/dist/cli/skills-content/connection.d.ts.map +1 -0
  657. package/dist/cli/skills-content/connection.js +53 -0
  658. package/dist/cli/skills-content/connection.js.map +1 -0
  659. package/dist/cli/skills-content/content-skill.d.ts +2 -0
  660. package/dist/cli/skills-content/content-skill.d.ts.map +1 -0
  661. package/dist/cli/skills-content/content-skill.js +110 -0
  662. package/dist/cli/skills-content/content-skill.js.map +1 -0
  663. package/dist/cli/skills-content/design-exploration-skill.d.ts +2 -0
  664. package/dist/cli/skills-content/design-exploration-skill.d.ts.map +1 -0
  665. package/dist/cli/skills-content/design-exploration-skill.js +119 -0
  666. package/dist/cli/skills-content/design-exploration-skill.js.map +1 -0
  667. package/dist/cli/skills-content/design-visual-edit-skill.d.ts +2 -0
  668. package/dist/cli/skills-content/design-visual-edit-skill.d.ts.map +1 -0
  669. package/dist/cli/skills-content/design-visual-edit-skill.js +229 -0
  670. package/dist/cli/skills-content/design-visual-edit-skill.js.map +1 -0
  671. package/dist/cli/skills-content/document-quality.d.ts +4 -0
  672. package/dist/cli/skills-content/document-quality.d.ts.map +1 -0
  673. package/dist/cli/skills-content/document-quality.js +195 -0
  674. package/dist/cli/skills-content/document-quality.js.map +1 -0
  675. package/dist/cli/skills-content/exemplar.d.ts +4 -0
  676. package/dist/cli/skills-content/exemplar.d.ts.map +1 -0
  677. package/dist/cli/skills-content/exemplar.js +68 -0
  678. package/dist/cli/skills-content/exemplar.js.map +1 -0
  679. package/dist/cli/skills-content/help.d.ts +2 -0
  680. package/dist/cli/skills-content/help.d.ts.map +1 -0
  681. package/dist/cli/skills-content/help.js +78 -0
  682. package/dist/cli/skills-content/help.js.map +1 -0
  683. package/dist/cli/skills-content/index.d.ts +23 -0
  684. package/dist/cli/skills-content/index.d.ts.map +1 -0
  685. package/dist/cli/skills-content/index.js +23 -0
  686. package/dist/cli/skills-content/index.js.map +1 -0
  687. package/dist/cli/skills-content/local-files.d.ts +2 -0
  688. package/dist/cli/skills-content/local-files.d.ts.map +1 -0
  689. package/dist/cli/skills-content/local-files.js +96 -0
  690. package/dist/cli/skills-content/local-files.js.map +1 -0
  691. package/dist/cli/skills-content/plan-setup-auth.d.ts +9 -0
  692. package/dist/cli/skills-content/plan-setup-auth.d.ts.map +1 -0
  693. package/dist/cli/skills-content/plan-setup-auth.js +81 -0
  694. package/dist/cli/skills-content/plan-setup-auth.js.map +1 -0
  695. package/dist/cli/skills-content/visual-plan-skill.d.ts +2 -0
  696. package/dist/cli/skills-content/visual-plan-skill.d.ts.map +1 -0
  697. package/dist/cli/skills-content/visual-plan-skill.js +471 -0
  698. package/dist/cli/skills-content/visual-plan-skill.js.map +1 -0
  699. package/dist/cli/skills-content/visual-recap-skill.d.ts +2 -0
  700. package/dist/cli/skills-content/visual-recap-skill.d.ts.map +1 -0
  701. package/dist/cli/skills-content/visual-recap-skill.js +548 -0
  702. package/dist/cli/skills-content/visual-recap-skill.js.map +1 -0
  703. package/dist/cli/skills-content/visualize-repo-skill.d.ts +2 -0
  704. package/dist/cli/skills-content/visualize-repo-skill.d.ts.map +1 -0
  705. package/dist/cli/skills-content/visualize-repo-skill.js +94 -0
  706. package/dist/cli/skills-content/visualize-repo-skill.js.map +1 -0
  707. package/dist/cli/skills-content/wireframe.d.ts +4 -0
  708. package/dist/cli/skills-content/wireframe.d.ts.map +1 -0
  709. package/dist/cli/skills-content/wireframe.js +347 -0
  710. package/dist/cli/skills-content/wireframe.js.map +1 -0
  711. package/dist/cli/skills.d.ts +2 -10
  712. package/dist/cli/skills.d.ts.map +1 -1
  713. package/dist/cli/skills.js +2 -2710
  714. package/dist/cli/skills.js.map +1 -1
  715. package/dist/client/AgentPanel.d.ts.map +1 -1
  716. package/dist/client/AgentPanel.js +4 -2
  717. package/dist/client/AgentPanel.js.map +1 -1
  718. package/dist/client/CommandMenu.d.ts.map +1 -1
  719. package/dist/client/CommandMenu.js +15 -3
  720. package/dist/client/CommandMenu.js.map +1 -1
  721. package/dist/client/FeedbackButton.js +2 -2
  722. package/dist/client/FeedbackButton.js.map +1 -1
  723. package/dist/client/agent-chat-adapter.js +7 -3
  724. package/dist/client/agent-chat-adapter.js.map +1 -1
  725. package/dist/client/app-providers.d.ts +13 -5
  726. package/dist/client/app-providers.d.ts.map +1 -1
  727. package/dist/client/app-providers.js +9 -6
  728. package/dist/client/app-providers.js.map +1 -1
  729. package/dist/client/chat/tool-call-display.d.ts +4 -0
  730. package/dist/client/chat/tool-call-display.d.ts.map +1 -1
  731. package/dist/client/chat/tool-call-display.js +3 -3
  732. package/dist/client/chat/tool-call-display.js.map +1 -1
  733. package/dist/client/composer/PastedTextChip.js +1 -1
  734. package/dist/client/composer/PastedTextChip.js.map +1 -1
  735. package/dist/client/composer/RealtimeVoiceMode.d.ts +3 -1
  736. package/dist/client/composer/RealtimeVoiceMode.d.ts.map +1 -1
  737. package/dist/client/composer/RealtimeVoiceMode.js +35 -14
  738. package/dist/client/composer/RealtimeVoiceMode.js.map +1 -1
  739. package/dist/client/composer/TiptapComposer.js +1 -1
  740. package/dist/client/composer/TiptapComposer.js.map +1 -1
  741. package/dist/client/composer/VoiceButton.d.ts +2 -0
  742. package/dist/client/composer/VoiceButton.d.ts.map +1 -1
  743. package/dist/client/composer/VoiceButton.js +9 -3
  744. package/dist/client/composer/VoiceButton.js.map +1 -1
  745. package/dist/client/composer/useRealtimeVoiceMode.d.ts +5 -0
  746. package/dist/client/composer/useRealtimeVoiceMode.d.ts.map +1 -1
  747. package/dist/client/composer/useRealtimeVoiceMode.js +91 -12
  748. package/dist/client/composer/useRealtimeVoiceMode.js.map +1 -1
  749. package/dist/client/context-xray/ContextXRayPanel.d.ts.map +1 -1
  750. package/dist/client/context-xray/ContextXRayPanel.js +4 -1
  751. package/dist/client/context-xray/ContextXRayPanel.js.map +1 -1
  752. package/dist/client/extensions/ExtensionEditor.d.ts.map +1 -1
  753. package/dist/client/extensions/ExtensionEditor.js +15 -5
  754. package/dist/client/extensions/ExtensionEditor.js.map +1 -1
  755. package/dist/client/extensions/ExtensionQueryErrorState.d.ts +8 -0
  756. package/dist/client/extensions/ExtensionQueryErrorState.d.ts.map +1 -0
  757. package/dist/client/extensions/ExtensionQueryErrorState.js +11 -0
  758. package/dist/client/extensions/ExtensionQueryErrorState.js.map +1 -0
  759. package/dist/client/extensions/ExtensionSlot.d.ts.map +1 -1
  760. package/dist/client/extensions/ExtensionSlot.js +17 -7
  761. package/dist/client/extensions/ExtensionSlot.js.map +1 -1
  762. package/dist/client/extensions/ExtensionViewer.d.ts.map +1 -1
  763. package/dist/client/extensions/ExtensionViewer.js +17 -7
  764. package/dist/client/extensions/ExtensionViewer.js.map +1 -1
  765. package/dist/client/extensions/ExtensionsListPage.d.ts.map +1 -1
  766. package/dist/client/extensions/ExtensionsListPage.js +5 -3
  767. package/dist/client/extensions/ExtensionsListPage.js.map +1 -1
  768. package/dist/client/extensions/ExtensionsSidebarSection.d.ts.map +1 -1
  769. package/dist/client/extensions/ExtensionsSidebarSection.js +21 -8
  770. package/dist/client/extensions/ExtensionsSidebarSection.js.map +1 -1
  771. package/dist/client/index.d.ts +0 -2
  772. package/dist/client/index.d.ts.map +1 -1
  773. package/dist/client/index.js +0 -5
  774. package/dist/client/index.js.map +1 -1
  775. package/dist/client/progress/RunsTray.d.ts.map +1 -1
  776. package/dist/client/progress/RunsTray.js +7 -3
  777. package/dist/client/progress/RunsTray.js.map +1 -1
  778. package/dist/client/settings/SettingsTabsPage.d.ts.map +1 -1
  779. package/dist/client/settings/SettingsTabsPage.js +4 -0
  780. package/dist/client/settings/SettingsTabsPage.js.map +1 -1
  781. package/dist/client/settings/useBuilderStatus.d.ts +2 -0
  782. package/dist/client/settings/useBuilderStatus.d.ts.map +1 -1
  783. package/dist/client/settings/useBuilderStatus.js +4 -0
  784. package/dist/client/settings/useBuilderStatus.js.map +1 -1
  785. package/dist/client/tool-cells/EditCell.d.ts.map +1 -1
  786. package/dist/client/tool-cells/EditCell.js +2 -1
  787. package/dist/client/tool-cells/EditCell.js.map +1 -1
  788. package/dist/client/tool-cells/FilesChangedSummary.d.ts.map +1 -1
  789. package/dist/client/tool-cells/FilesChangedSummary.js +2 -1
  790. package/dist/client/tool-cells/FilesChangedSummary.js.map +1 -1
  791. package/dist/client/tool-cells/WriteCell.d.ts.map +1 -1
  792. package/dist/client/tool-cells/WriteCell.js +2 -1
  793. package/dist/client/tool-cells/WriteCell.js.map +1 -1
  794. package/dist/client/visual-style-controls.js +1 -1
  795. package/dist/client/visual-style-controls.js.map +1 -1
  796. package/dist/collab/routes.d.ts +1 -1
  797. package/dist/collab/struct-routes.d.ts +1 -1
  798. package/dist/deploy/build.d.ts.map +1 -1
  799. package/dist/deploy/build.js +36 -14
  800. package/dist/deploy/build.js.map +1 -1
  801. package/dist/guards/db-tool-scoping.d.ts +38 -0
  802. package/dist/guards/db-tool-scoping.d.ts.map +1 -0
  803. package/dist/guards/db-tool-scoping.js +114 -0
  804. package/dist/guards/db-tool-scoping.js.map +1 -0
  805. package/dist/guards/index.d.ts +23 -0
  806. package/dist/guards/index.d.ts.map +1 -0
  807. package/dist/guards/index.js +19 -0
  808. package/dist/guards/index.js.map +1 -0
  809. package/dist/guards/no-drizzle-push.d.ts +14 -0
  810. package/dist/guards/no-drizzle-push.d.ts.map +1 -0
  811. package/dist/guards/no-drizzle-push.js +97 -0
  812. package/dist/guards/no-drizzle-push.js.map +1 -0
  813. package/dist/guards/no-env-credentials.d.ts +36 -0
  814. package/dist/guards/no-env-credentials.d.ts.map +1 -0
  815. package/dist/guards/no-env-credentials.js +204 -0
  816. package/dist/guards/no-env-credentials.js.map +1 -0
  817. package/dist/guards/no-env-mutation.d.ts +23 -0
  818. package/dist/guards/no-env-mutation.d.ts.map +1 -0
  819. package/dist/guards/no-env-mutation.js +90 -0
  820. package/dist/guards/no-env-mutation.js.map +1 -0
  821. package/dist/guards/no-localhost-fallback.d.ts +30 -0
  822. package/dist/guards/no-localhost-fallback.d.ts.map +1 -0
  823. package/dist/guards/no-localhost-fallback.js +105 -0
  824. package/dist/guards/no-localhost-fallback.js.map +1 -0
  825. package/dist/guards/no-unscoped-credentials.d.ts +28 -0
  826. package/dist/guards/no-unscoped-credentials.d.ts.map +1 -0
  827. package/dist/guards/no-unscoped-credentials.js +199 -0
  828. package/dist/guards/no-unscoped-credentials.js.map +1 -0
  829. package/dist/guards/no-unscoped-queries.d.ts +32 -0
  830. package/dist/guards/no-unscoped-queries.d.ts.map +1 -0
  831. package/dist/guards/no-unscoped-queries.js +720 -0
  832. package/dist/guards/no-unscoped-queries.js.map +1 -0
  833. package/dist/guards/scan-utils.d.ts +28 -0
  834. package/dist/guards/scan-utils.d.ts.map +1 -0
  835. package/dist/guards/scan-utils.js +92 -0
  836. package/dist/guards/scan-utils.js.map +1 -0
  837. package/dist/guards/types.d.ts +28 -0
  838. package/dist/guards/types.d.ts.map +1 -0
  839. package/dist/guards/types.js +11 -0
  840. package/dist/guards/types.js.map +1 -0
  841. package/dist/integrations/google-docs-poller.d.ts +7 -0
  842. package/dist/integrations/google-docs-poller.d.ts.map +1 -1
  843. package/dist/integrations/google-docs-poller.js +13 -3
  844. package/dist/integrations/google-docs-poller.js.map +1 -1
  845. package/dist/integrations/plugin.d.ts.map +1 -1
  846. package/dist/integrations/plugin.js +10 -0
  847. package/dist/integrations/plugin.js.map +1 -1
  848. package/dist/integrations/webhook-handler.d.ts +11 -0
  849. package/dist/integrations/webhook-handler.d.ts.map +1 -1
  850. package/dist/integrations/webhook-handler.js +16 -4
  851. package/dist/integrations/webhook-handler.js.map +1 -1
  852. package/dist/jobs/scheduler.d.ts +12 -0
  853. package/dist/jobs/scheduler.d.ts.map +1 -1
  854. package/dist/jobs/scheduler.js +13 -3
  855. package/dist/jobs/scheduler.js.map +1 -1
  856. package/dist/localization/default-messages.d.ts +7 -0
  857. package/dist/localization/default-messages.d.ts.map +1 -1
  858. package/dist/localization/default-messages.js +8 -1
  859. package/dist/localization/default-messages.js.map +1 -1
  860. package/dist/mcp/oauth-token.d.ts +1 -1
  861. package/dist/mcp/oauth-token.d.ts.map +1 -1
  862. package/dist/mcp/oauth-token.js +6 -1
  863. package/dist/mcp/oauth-token.js.map +1 -1
  864. package/dist/notifications/routes.d.ts +2 -2
  865. package/dist/observability/routes.d.ts.map +1 -1
  866. package/dist/observability/routes.js +32 -0
  867. package/dist/observability/routes.js.map +1 -1
  868. package/dist/observability/sentiment.d.ts +42 -0
  869. package/dist/observability/sentiment.d.ts.map +1 -0
  870. package/dist/observability/sentiment.js +196 -0
  871. package/dist/observability/sentiment.js.map +1 -0
  872. package/dist/observability/store.d.ts +5 -0
  873. package/dist/observability/store.d.ts.map +1 -1
  874. package/dist/observability/store.js +17 -0
  875. package/dist/observability/store.js.map +1 -1
  876. package/dist/observability/traces.d.ts +2 -0
  877. package/dist/observability/traces.d.ts.map +1 -1
  878. package/dist/observability/traces.js +42 -57
  879. package/dist/observability/traces.js.map +1 -1
  880. package/dist/observability/tracking-identity.d.ts +3 -0
  881. package/dist/observability/tracking-identity.d.ts.map +1 -0
  882. package/dist/observability/tracking-identity.js +51 -0
  883. package/dist/observability/tracking-identity.js.map +1 -0
  884. package/dist/observability/types.d.ts +10 -0
  885. package/dist/observability/types.d.ts.map +1 -1
  886. package/dist/observability/types.js +3 -0
  887. package/dist/observability/types.js.map +1 -1
  888. package/dist/org/accept-pending.d.ts.map +1 -1
  889. package/dist/org/accept-pending.js +9 -1
  890. package/dist/org/accept-pending.js.map +1 -1
  891. package/dist/org/migrations.d.ts +7 -2
  892. package/dist/org/migrations.d.ts.map +1 -1
  893. package/dist/org/migrations.js +41 -0
  894. package/dist/org/migrations.js.map +1 -1
  895. package/dist/package-lifecycle/index.d.ts +2 -0
  896. package/dist/package-lifecycle/index.d.ts.map +1 -0
  897. package/dist/package-lifecycle/index.js +2 -0
  898. package/dist/package-lifecycle/index.js.map +1 -0
  899. package/dist/package-lifecycle/manifest.d.ts +24 -0
  900. package/dist/package-lifecycle/manifest.d.ts.map +1 -0
  901. package/dist/package-lifecycle/manifest.js +81 -0
  902. package/dist/package-lifecycle/manifest.js.map +1 -0
  903. package/dist/provider-api/corpus-jobs.d.ts +2 -2
  904. package/dist/provider-api/custom-registry.d.ts +32 -1
  905. package/dist/provider-api/custom-registry.d.ts.map +1 -1
  906. package/dist/provider-api/custom-registry.js +41 -1
  907. package/dist/provider-api/custom-registry.js.map +1 -1
  908. package/dist/provider-api/index.d.ts +1 -1
  909. package/dist/provider-api/index.d.ts.map +1 -1
  910. package/dist/provider-api/index.js +1 -1
  911. package/dist/provider-api/index.js.map +1 -1
  912. package/dist/resources/handlers.d.ts +1 -1
  913. package/dist/secrets/storage.d.ts +6 -0
  914. package/dist/secrets/storage.d.ts.map +1 -1
  915. package/dist/secrets/storage.js +105 -29
  916. package/dist/secrets/storage.js.map +1 -1
  917. package/dist/server/action-discovery.d.ts.map +1 -1
  918. package/dist/server/action-discovery.js +4 -0
  919. package/dist/server/action-discovery.js.map +1 -1
  920. package/dist/server/agent-chat/action-filters-a2a.d.ts +50 -0
  921. package/dist/server/agent-chat/action-filters-a2a.d.ts.map +1 -0
  922. package/dist/server/agent-chat/action-filters-a2a.js +127 -0
  923. package/dist/server/agent-chat/action-filters-a2a.js.map +1 -0
  924. package/dist/server/agent-chat/browser-team-tools.d.ts +21 -0
  925. package/dist/server/agent-chat/browser-team-tools.d.ts.map +1 -0
  926. package/dist/server/agent-chat/browser-team-tools.js +417 -0
  927. package/dist/server/agent-chat/browser-team-tools.js.map +1 -0
  928. package/dist/server/agent-chat/context-tools.d.ts +33 -0
  929. package/dist/server/agent-chat/context-tools.d.ts.map +1 -0
  930. package/dist/server/agent-chat/context-tools.js +520 -0
  931. package/dist/server/agent-chat/context-tools.js.map +1 -0
  932. package/dist/server/agent-chat/framework-prompts.d.ts +65 -0
  933. package/dist/server/agent-chat/framework-prompts.d.ts.map +1 -0
  934. package/dist/server/agent-chat/framework-prompts.js +403 -0
  935. package/dist/server/agent-chat/framework-prompts.js.map +1 -0
  936. package/dist/server/agent-chat/lazy-fs.d.ts +2 -0
  937. package/dist/server/agent-chat/lazy-fs.d.ts.map +1 -0
  938. package/dist/server/agent-chat/lazy-fs.js +11 -0
  939. package/dist/server/agent-chat/lazy-fs.js.map +1 -0
  940. package/dist/server/agent-chat/mcp-glue.d.ts +9 -0
  941. package/dist/server/agent-chat/mcp-glue.d.ts.map +1 -0
  942. package/dist/server/agent-chat/mcp-glue.js +63 -0
  943. package/dist/server/agent-chat/mcp-glue.js.map +1 -0
  944. package/dist/server/agent-chat/plugin-options.d.ts +322 -0
  945. package/dist/server/agent-chat/plugin-options.d.ts.map +1 -0
  946. package/dist/server/agent-chat/plugin-options.js +2 -0
  947. package/dist/server/agent-chat/plugin-options.js.map +1 -0
  948. package/dist/server/agent-chat/process-run-failure.d.ts +12 -0
  949. package/dist/server/agent-chat/process-run-failure.d.ts.map +1 -0
  950. package/dist/server/agent-chat/process-run-failure.js +24 -0
  951. package/dist/server/agent-chat/process-run-failure.js.map +1 -0
  952. package/dist/server/agent-chat/prompt-resources.d.ts +28 -0
  953. package/dist/server/agent-chat/prompt-resources.d.ts.map +1 -0
  954. package/dist/server/agent-chat/prompt-resources.js +514 -0
  955. package/dist/server/agent-chat/prompt-resources.js.map +1 -0
  956. package/dist/server/agent-chat/recurring-jobs-runtime.d.ts +5 -0
  957. package/dist/server/agent-chat/recurring-jobs-runtime.d.ts.map +1 -0
  958. package/dist/server/agent-chat/recurring-jobs-runtime.js +53 -0
  959. package/dist/server/agent-chat/recurring-jobs-runtime.js.map +1 -0
  960. package/dist/server/agent-chat/request-surface.d.ts +8 -0
  961. package/dist/server/agent-chat/request-surface.d.ts.map +1 -0
  962. package/dist/server/agent-chat/request-surface.js +56 -0
  963. package/dist/server/agent-chat/request-surface.js.map +1 -0
  964. package/dist/server/agent-chat/run-code-tools.d.ts +17 -0
  965. package/dist/server/agent-chat/run-code-tools.d.ts.map +1 -0
  966. package/dist/server/agent-chat/run-code-tools.js +55 -0
  967. package/dist/server/agent-chat/run-code-tools.js.map +1 -0
  968. package/dist/server/agent-chat/script-entries.d.ts +47 -0
  969. package/dist/server/agent-chat/script-entries.d.ts.map +1 -0
  970. package/dist/server/agent-chat/script-entries.js +633 -0
  971. package/dist/server/agent-chat/script-entries.js.map +1 -0
  972. package/dist/server/agent-chat/shared-thread.d.ts +33 -0
  973. package/dist/server/agent-chat/shared-thread.d.ts.map +1 -0
  974. package/dist/server/agent-chat/shared-thread.js +242 -0
  975. package/dist/server/agent-chat/shared-thread.js.map +1 -0
  976. package/dist/server/agent-chat/skill-frontmatter.d.ts +7 -0
  977. package/dist/server/agent-chat/skill-frontmatter.d.ts.map +1 -0
  978. package/dist/server/agent-chat/skill-frontmatter.js +26 -0
  979. package/dist/server/agent-chat/skill-frontmatter.js.map +1 -0
  980. package/dist/server/agent-chat-plugin.d.ts +45 -486
  981. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  982. package/dist/server/agent-chat-plugin.js +217 -3015
  983. package/dist/server/agent-chat-plugin.js.map +1 -1
  984. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  985. package/dist/server/agent-teams.d.ts +10 -0
  986. package/dist/server/agent-teams.d.ts.map +1 -1
  987. package/dist/server/agent-teams.js +13 -3
  988. package/dist/server/agent-teams.js.map +1 -1
  989. package/dist/server/auth.d.ts.map +1 -1
  990. package/dist/server/auth.js +50 -52
  991. package/dist/server/auth.js.map +1 -1
  992. package/dist/server/core-routes-plugin.d.ts.map +1 -1
  993. package/dist/server/core-routes-plugin.js +23 -12
  994. package/dist/server/core-routes-plugin.js.map +1 -1
  995. package/dist/server/credential-provider.d.ts.map +1 -1
  996. package/dist/server/credential-provider.js +22 -21
  997. package/dist/server/credential-provider.js.map +1 -1
  998. package/dist/server/csrf.d.ts.map +1 -1
  999. package/dist/server/csrf.js +18 -5
  1000. package/dist/server/csrf.js.map +1 -1
  1001. package/dist/server/edge.d.ts +1 -0
  1002. package/dist/server/edge.d.ts.map +1 -1
  1003. package/dist/server/edge.js +1 -0
  1004. package/dist/server/edge.js.map +1 -1
  1005. package/dist/server/framework-request-handler.d.ts.map +1 -1
  1006. package/dist/server/framework-request-handler.js +34 -0
  1007. package/dist/server/framework-request-handler.js.map +1 -1
  1008. package/dist/server/google-realtime-session.d.ts.map +1 -1
  1009. package/dist/server/google-realtime-session.js +2 -34
  1010. package/dist/server/google-realtime-session.js.map +1 -1
  1011. package/dist/server/onboarding-html.d.ts.map +1 -1
  1012. package/dist/server/onboarding-html.js +1 -16
  1013. package/dist/server/onboarding-html.js.map +1 -1
  1014. package/dist/server/poll.d.ts.map +1 -1
  1015. package/dist/server/poll.js +24 -2
  1016. package/dist/server/poll.js.map +1 -1
  1017. package/dist/server/realtime-voice.d.ts +3 -0
  1018. package/dist/server/realtime-voice.d.ts.map +1 -1
  1019. package/dist/server/realtime-voice.js +38 -5
  1020. package/dist/server/realtime-voice.js.map +1 -1
  1021. package/dist/server/request-origin.d.ts +10 -0
  1022. package/dist/server/request-origin.d.ts.map +1 -0
  1023. package/dist/server/request-origin.js +63 -0
  1024. package/dist/server/request-origin.js.map +1 -0
  1025. package/dist/server/ssr-handler.d.ts.map +1 -1
  1026. package/dist/server/ssr-handler.js +47 -2
  1027. package/dist/server/ssr-handler.js.map +1 -1
  1028. package/dist/server/transcribe-voice.d.ts.map +1 -1
  1029. package/dist/server/transcribe-voice.js +2 -48
  1030. package/dist/server/transcribe-voice.js.map +1 -1
  1031. package/dist/sharing/access.d.ts +63 -3
  1032. package/dist/sharing/access.d.ts.map +1 -1
  1033. package/dist/sharing/access.js +53 -15
  1034. package/dist/sharing/access.js.map +1 -1
  1035. package/dist/sharing/registry.d.ts +7 -0
  1036. package/dist/sharing/registry.d.ts.map +1 -1
  1037. package/dist/sharing/registry.js.map +1 -1
  1038. package/dist/styles/agent-native.css +15 -14
  1039. package/dist/templates/default/.agents/skills/frontend-design/SKILL.md +1 -1
  1040. package/dist/templates/default/app/i18n/ar-SA.ts +6 -0
  1041. package/dist/templates/default/app/i18n/de-DE.ts +6 -0
  1042. package/dist/templates/default/app/i18n/en-US.ts +6 -0
  1043. package/dist/templates/default/app/i18n/es-ES.ts +6 -0
  1044. package/dist/templates/default/app/i18n/fr-FR.ts +6 -0
  1045. package/dist/templates/default/app/i18n/hi-IN.ts +6 -0
  1046. package/dist/templates/default/app/i18n/ja-JP.ts +6 -0
  1047. package/dist/templates/default/app/i18n/ko-KR.ts +6 -0
  1048. package/dist/templates/default/app/i18n/pt-BR.ts +6 -0
  1049. package/dist/templates/default/app/i18n/zh-CN.ts +6 -0
  1050. package/dist/templates/default/app/i18n/zh-TW.ts +6 -0
  1051. package/dist/templates/default/package.json +2 -2
  1052. package/dist/templates/headless/package.json +0 -1
  1053. package/dist/templates/workspace-core/.agents/skills/audit-log/SKILL.md +3 -0
  1054. package/dist/templates/workspace-core/.agents/skills/authentication/SKILL.md +27 -29
  1055. package/dist/templates/workspace-core/.agents/skills/automations/SKILL.md +1 -1
  1056. package/dist/templates/workspace-core/.agents/skills/external-agents/SKILL.md +2 -1
  1057. package/dist/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +1 -1
  1058. package/dist/templates/workspace-core/.agents/skills/observability/SKILL.md +32 -0
  1059. package/dist/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +25 -0
  1060. package/dist/templates/workspace-core/package.json +0 -1
  1061. package/dist/templates/workspace-core/src/server/index.ts +4 -2
  1062. package/dist/templates/workspace-root/package.json +0 -1
  1063. package/dist/testing.d.ts +16 -0
  1064. package/dist/testing.d.ts.map +1 -0
  1065. package/dist/testing.js +16 -0
  1066. package/dist/testing.js.map +1 -0
  1067. package/dist/triggers/actions.d.ts.map +1 -1
  1068. package/dist/triggers/actions.js +8 -3
  1069. package/dist/triggers/actions.js.map +1 -1
  1070. package/dist/triggers/dispatcher.d.ts +7 -0
  1071. package/dist/triggers/dispatcher.d.ts.map +1 -1
  1072. package/dist/triggers/dispatcher.js +13 -3
  1073. package/dist/triggers/dispatcher.js.map +1 -1
  1074. package/dist/triggers/types.d.ts +7 -1
  1075. package/dist/triggers/types.d.ts.map +1 -1
  1076. package/dist/triggers/types.js.map +1 -1
  1077. package/dist/vite/client.d.ts +16 -1
  1078. package/dist/vite/client.d.ts.map +1 -1
  1079. package/dist/vite/client.js +105 -2
  1080. package/dist/vite/client.js.map +1 -1
  1081. package/docs/content/audit-log.mdx +2 -1
  1082. package/docs/content/authentication.mdx +3 -3
  1083. package/docs/content/automations.mdx +7 -7
  1084. package/docs/content/creating-templates.mdx +1 -1
  1085. package/docs/content/doctor.mdx +170 -0
  1086. package/docs/content/external-agents.mdx +8 -7
  1087. package/docs/content/internationalization.mdx +2 -1
  1088. package/docs/content/locales/ar-SA/audit-log.mdx +2 -1
  1089. package/docs/content/locales/ar-SA/authentication.mdx +2 -2
  1090. package/docs/content/locales/ar-SA/automations.mdx +7 -7
  1091. package/docs/content/locales/ar-SA/external-agents.mdx +8 -7
  1092. package/docs/content/locales/ar-SA/getting-started.mdx +7 -1
  1093. package/docs/content/locales/ar-SA/internationalization.mdx +1 -1
  1094. package/docs/content/locales/ar-SA/mcp-protocol.mdx +1 -1
  1095. package/docs/content/locales/ar-SA/package-lifecycle.mdx +19 -0
  1096. package/docs/content/locales/ar-SA/sandbox-adapters.mdx +18 -7
  1097. package/docs/content/locales/ar-SA/security.mdx +10 -0
  1098. package/docs/content/locales/de-DE/audit-log.mdx +2 -1
  1099. package/docs/content/locales/de-DE/authentication.mdx +1 -1
  1100. package/docs/content/locales/de-DE/automations.mdx +7 -7
  1101. package/docs/content/locales/de-DE/external-agents.mdx +8 -7
  1102. package/docs/content/locales/de-DE/getting-started.mdx +7 -1
  1103. package/docs/content/locales/de-DE/internationalization.mdx +1 -1
  1104. package/docs/content/locales/de-DE/mcp-protocol.mdx +1 -1
  1105. package/docs/content/locales/de-DE/package-lifecycle.mdx +22 -0
  1106. package/docs/content/locales/de-DE/sandbox-adapters.mdx +18 -7
  1107. package/docs/content/locales/de-DE/security.mdx +10 -0
  1108. package/docs/content/locales/es-ES/audit-log.mdx +2 -1
  1109. package/docs/content/locales/es-ES/authentication.mdx +2 -2
  1110. package/docs/content/locales/es-ES/automations.mdx +7 -7
  1111. package/docs/content/locales/es-ES/external-agents.mdx +8 -7
  1112. package/docs/content/locales/es-ES/getting-started.mdx +7 -1
  1113. package/docs/content/locales/es-ES/internationalization.mdx +1 -1
  1114. package/docs/content/locales/es-ES/mcp-protocol.mdx +1 -1
  1115. package/docs/content/locales/es-ES/package-lifecycle.mdx +22 -0
  1116. package/docs/content/locales/es-ES/sandbox-adapters.mdx +18 -7
  1117. package/docs/content/locales/es-ES/security.mdx +10 -0
  1118. package/docs/content/locales/fr-FR/audit-log.mdx +2 -1
  1119. package/docs/content/locales/fr-FR/authentication.mdx +1 -1
  1120. package/docs/content/locales/fr-FR/automations.mdx +7 -7
  1121. package/docs/content/locales/fr-FR/external-agents.mdx +8 -7
  1122. package/docs/content/locales/fr-FR/getting-started.mdx +7 -1
  1123. package/docs/content/locales/fr-FR/internationalization.mdx +1 -1
  1124. package/docs/content/locales/fr-FR/mcp-protocol.mdx +1 -1
  1125. package/docs/content/locales/fr-FR/package-lifecycle.mdx +21 -0
  1126. package/docs/content/locales/fr-FR/sandbox-adapters.mdx +19 -8
  1127. package/docs/content/locales/fr-FR/security.mdx +10 -0
  1128. package/docs/content/locales/hi-IN/audit-log.mdx +2 -1
  1129. package/docs/content/locales/hi-IN/authentication.mdx +2 -2
  1130. package/docs/content/locales/hi-IN/automations.mdx +7 -7
  1131. package/docs/content/locales/hi-IN/external-agents.mdx +8 -7
  1132. package/docs/content/locales/hi-IN/getting-started.mdx +7 -1
  1133. package/docs/content/locales/hi-IN/internationalization.mdx +1 -1
  1134. package/docs/content/locales/hi-IN/mcp-protocol.mdx +1 -1
  1135. package/docs/content/locales/hi-IN/package-lifecycle.mdx +20 -0
  1136. package/docs/content/locales/hi-IN/sandbox-adapters.mdx +18 -7
  1137. package/docs/content/locales/hi-IN/security.mdx +10 -0
  1138. package/docs/content/locales/ja-JP/audit-log.mdx +2 -1
  1139. package/docs/content/locales/ja-JP/authentication.mdx +2 -2
  1140. package/docs/content/locales/ja-JP/automations.mdx +7 -7
  1141. package/docs/content/locales/ja-JP/external-agents.mdx +8 -7
  1142. package/docs/content/locales/ja-JP/getting-started.mdx +7 -1
  1143. package/docs/content/locales/ja-JP/internationalization.mdx +1 -1
  1144. package/docs/content/locales/ja-JP/mcp-protocol.mdx +1 -1
  1145. package/docs/content/locales/ja-JP/package-lifecycle.mdx +21 -0
  1146. package/docs/content/locales/ja-JP/sandbox-adapters.mdx +17 -6
  1147. package/docs/content/locales/ja-JP/security.mdx +10 -0
  1148. package/docs/content/locales/ko-KR/audit-log.mdx +2 -1
  1149. package/docs/content/locales/ko-KR/authentication.mdx +2 -2
  1150. package/docs/content/locales/ko-KR/automations.mdx +7 -7
  1151. package/docs/content/locales/ko-KR/external-agents.mdx +8 -7
  1152. package/docs/content/locales/ko-KR/getting-started.mdx +7 -1
  1153. package/docs/content/locales/ko-KR/internationalization.mdx +1 -1
  1154. package/docs/content/locales/ko-KR/mcp-protocol.mdx +1 -1
  1155. package/docs/content/locales/ko-KR/package-lifecycle.mdx +20 -0
  1156. package/docs/content/locales/ko-KR/sandbox-adapters.mdx +17 -6
  1157. package/docs/content/locales/ko-KR/security.mdx +10 -0
  1158. package/docs/content/locales/pt-BR/audit-log.mdx +2 -1
  1159. package/docs/content/locales/pt-BR/authentication.mdx +2 -2
  1160. package/docs/content/locales/pt-BR/automations.mdx +7 -7
  1161. package/docs/content/locales/pt-BR/external-agents.mdx +8 -7
  1162. package/docs/content/locales/pt-BR/getting-started.mdx +7 -1
  1163. package/docs/content/locales/pt-BR/internationalization.mdx +1 -1
  1164. package/docs/content/locales/pt-BR/mcp-protocol.mdx +1 -1
  1165. package/docs/content/locales/pt-BR/package-lifecycle.mdx +21 -0
  1166. package/docs/content/locales/pt-BR/sandbox-adapters.mdx +18 -7
  1167. package/docs/content/locales/pt-BR/security.mdx +10 -0
  1168. package/docs/content/locales/zh-CN/audit-log.mdx +2 -1
  1169. package/docs/content/locales/zh-CN/authentication.mdx +2 -2
  1170. package/docs/content/locales/zh-CN/automations.mdx +7 -7
  1171. package/docs/content/locales/zh-CN/external-agents.mdx +8 -7
  1172. package/docs/content/locales/zh-CN/getting-started.mdx +6 -4
  1173. package/docs/content/locales/zh-CN/internationalization.mdx +1 -1
  1174. package/docs/content/locales/zh-CN/mcp-protocol.mdx +1 -1
  1175. package/docs/content/locales/zh-CN/package-lifecycle.mdx +19 -0
  1176. package/docs/content/locales/zh-CN/sandbox-adapters.mdx +17 -6
  1177. package/docs/content/locales/zh-CN/security.mdx +10 -0
  1178. package/docs/content/locales/zh-TW/audit-log.mdx +2 -1
  1179. package/docs/content/locales/zh-TW/authentication.mdx +2 -2
  1180. package/docs/content/locales/zh-TW/automations.mdx +7 -7
  1181. package/docs/content/locales/zh-TW/external-agents.mdx +8 -7
  1182. package/docs/content/locales/zh-TW/getting-started.mdx +6 -4
  1183. package/docs/content/locales/zh-TW/internationalization.mdx +1 -1
  1184. package/docs/content/locales/zh-TW/mcp-protocol.mdx +1 -1
  1185. package/docs/content/locales/zh-TW/package-lifecycle.mdx +19 -0
  1186. package/docs/content/locales/zh-TW/sandbox-adapters.mdx +18 -7
  1187. package/docs/content/locales/zh-TW/security.mdx +10 -0
  1188. package/docs/content/mcp-protocol.mdx +1 -1
  1189. package/docs/content/package-lifecycle.mdx +51 -0
  1190. package/docs/content/sandbox-adapters.mdx +16 -5
  1191. package/docs/content/security.mdx +2 -0
  1192. package/package.json +14 -3
  1193. package/src/templates/default/.agents/skills/frontend-design/SKILL.md +1 -1
  1194. package/src/templates/default/app/i18n/ar-SA.ts +6 -0
  1195. package/src/templates/default/app/i18n/de-DE.ts +6 -0
  1196. package/src/templates/default/app/i18n/en-US.ts +6 -0
  1197. package/src/templates/default/app/i18n/es-ES.ts +6 -0
  1198. package/src/templates/default/app/i18n/fr-FR.ts +6 -0
  1199. package/src/templates/default/app/i18n/hi-IN.ts +6 -0
  1200. package/src/templates/default/app/i18n/ja-JP.ts +6 -0
  1201. package/src/templates/default/app/i18n/ko-KR.ts +6 -0
  1202. package/src/templates/default/app/i18n/pt-BR.ts +6 -0
  1203. package/src/templates/default/app/i18n/zh-CN.ts +6 -0
  1204. package/src/templates/default/app/i18n/zh-TW.ts +6 -0
  1205. package/src/templates/default/package.json +2 -2
  1206. package/src/templates/headless/package.json +0 -1
  1207. package/src/templates/workspace-core/.agents/skills/audit-log/SKILL.md +3 -0
  1208. package/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +27 -29
  1209. package/src/templates/workspace-core/.agents/skills/automations/SKILL.md +1 -1
  1210. package/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +2 -1
  1211. package/src/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +1 -1
  1212. package/src/templates/workspace-core/.agents/skills/observability/SKILL.md +32 -0
  1213. package/src/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +25 -0
  1214. package/src/templates/workspace-core/package.json +0 -1
  1215. package/src/templates/workspace-core/src/server/index.ts +4 -2
  1216. package/src/templates/workspace-root/package.json +0 -1
  1217. package/corpus/core/src/client/ProductionAgentPanel.tsx +0 -9
  1218. package/corpus/core/src/client/auth-redirect-url.ts +0 -23
  1219. package/corpus/core/src/client/useProductionAgent.ts +0 -253
  1220. package/corpus/core/src/shared/auth-redirect-url.ts +0 -1
  1221. package/corpus/templates/analytics/app/pages/Index.tsx +0 -16
  1222. package/corpus/templates/analytics/seeds/dashboards/agent-observability-llm.json +0 -173
  1223. package/corpus/templates/slides/app/components/ui/toast.tsx +0 -1
  1224. package/corpus/templates/slides/app/components/ui/toaster.tsx +0 -1
  1225. package/corpus/templates/slides/app/hooks/use-toast.ts +0 -1
  1226. package/dist/client/ProductionAgentPanel.d.ts +0 -6
  1227. package/dist/client/ProductionAgentPanel.d.ts.map +0 -1
  1228. package/dist/client/ProductionAgentPanel.js +0 -6
  1229. package/dist/client/ProductionAgentPanel.js.map +0 -1
  1230. package/dist/client/auth-redirect-url.d.ts +0 -2
  1231. package/dist/client/auth-redirect-url.d.ts.map +0 -1
  1232. package/dist/client/auth-redirect-url.js +0 -19
  1233. package/dist/client/auth-redirect-url.js.map +0 -1
  1234. package/dist/client/useProductionAgent.d.ts +0 -24
  1235. package/dist/client/useProductionAgent.d.ts.map +0 -1
  1236. package/dist/client/useProductionAgent.js +0 -179
  1237. package/dist/client/useProductionAgent.js.map +0 -1
  1238. package/dist/shared/auth-redirect-url.d.ts +0 -2
  1239. package/dist/shared/auth-redirect-url.d.ts.map +0 -1
  1240. package/dist/shared/auth-redirect-url.js +0 -2
  1241. package/dist/shared/auth-redirect-url.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"access.js","sourceRoot":"","sources":["../../src/sharing/access.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAY,MAAM,aAAa,CAAC;AAEzD,OAAO,EACL,mBAAmB,EACnB,eAAe,GAChB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,sBAAsB,EACtB,wBAAwB,GAEzB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAkB,MAAM,aAAa,CAAC;AAExD;;;;;;;GAOG;AACH,SAAS,uBAAuB,CAC9B,aAAkB;IAElB,KAAK,MAAM,GAAG,IAAI,sBAAsB,EAAE,EAAE,CAAC;QAC3C,IAAI,GAAG,CAAC,aAAa,KAAK,aAAa;YAAE,OAAO,GAAG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E,CAAC,CAAC;IACzE,CAAC;IACD,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,cAAc,CACtB,YAAY,OAAO,YAAY,YAAY,IAAI,UAAU,UAAU,MAAM,CAAC,IAAI,GAAG,CAClF,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/**\n * Access-control helpers for shareable resources.\n *\n * The access model combines:\n * 1. Direct ownership — `owner_email = currentUser`.\n * 2. Visibility — `'private' | 'org' | 'public'`. `org` grants read to anyone\n * in the same org; `public` grants read to any authenticated user.\n * 3. Share rows — per-user or per-org grants in the `{type}_shares` table\n * with a role (`viewer | editor | admin`).\n *\n * Use `applyAccessFilter()` on list/read queries to filter rows the current\n * user can see. Use `assertAccess()` at the top of write actions to reject\n * callers who lack the required role.\n */\n\nimport { and, eq, or, sql, type SQL } from \"drizzle-orm\";\n\nimport {\n getRequestUserEmail,\n getRequestOrgId,\n} from \"../server/request-context.js\";\nimport {\n listShareableResources,\n requireShareableResource,\n type ShareableResourceRegistration,\n} from \"./registry.js\";\nimport { ROLE_RANK, type ShareRole } from \"./schema.js\";\n\n/**\n * Find a registration by its drizzle table identity. Used to look up\n * per-resource policy flags (e.g. `allowPublic`) inside `accessFilter`,\n * which receives only the table — not the resource-type name.\n *\n * Identity is stable within a single bundle (Vite dedupes module instances);\n * the SSR/server side is the only caller, so per-bundle identity is fine.\n */\nfunction findRegistrationByTable(\n resourceTable: any,\n): ShareableResourceRegistration | undefined {\n for (const reg of listShareableResources()) {\n if (reg.resourceTable === resourceTable) return reg;\n }\n return undefined;\n}\n\nexport class ForbiddenError extends Error {\n statusCode = 403;\n constructor(message = \"Forbidden\") {\n super(message);\n this.name = \"ForbiddenError\";\n }\n}\n\nexport interface AccessContext {\n userEmail?: string;\n orgId?: string;\n}\n\n/** Current request's access context. Pulls from request-context ALS. */\nexport function currentAccess(): AccessContext {\n return {\n userEmail: getRequestUserEmail(),\n orgId: getRequestOrgId(),\n };\n}\n\nexport function resolveRegisteredAccessContext(\n reg: ShareableResourceRegistration | undefined,\n ctx: AccessContext,\n): AccessContext {\n return reg?.resolveAccessContext ? reg.resolveAccessContext(ctx) : ctx;\n}\n\nfunction normalizeEmailForAccess(email: string | undefined): string | null {\n const normalized = email?.trim().toLowerCase();\n return normalized || null;\n}\n\nfunction emailColumnMatches(column: any, email: string): SQL {\n return sql`lower(${column}) = ${email}`;\n}\n\n/**\n * Build a Drizzle `WHERE` clause that admits rows the current user can see.\n * Pass the ownable resource table and its shares table; optional min role\n * (defaults to 'viewer') gates which share rows count.\n *\n * `visibility = 'public'` is intentionally NOT admitted by default. Public\n * means \"anyone with the link can view\" (still honoured by `resolveAccess`\n * for read-by-id), not \"appears in every signed-in user's list/sidebar.\"\n * Pass `{ includePublic: true }` for the rare list endpoint that wants\n * cross-user public discovery (a public template gallery, for example).\n *\n * Example:\n *\n * const rows = await db\n * .select()\n * .from(schema.documents)\n * .where(accessFilter(schema.documents, schema.documentShares));\n */\nexport function accessFilter(\n resourceTable: any,\n sharesTable: any,\n rawCtx: AccessContext = currentAccess(),\n minRole: ShareRole = \"viewer\",\n options: { includePublic?: boolean } = {},\n): SQL {\n // Defense in depth — resources registered with `allowPublic: false` must\n // never participate in cross-user \"public\" discovery, even if a caller\n // accidentally passes `includePublic: true` or if a stale public row sits\n // in the DB.\n const reg = findRegistrationByTable(resourceTable);\n const ctx = resolveRegisteredAccessContext(reg, rawCtx);\n const { userEmail, orgId } = ctx;\n const normalizedUserEmail = normalizeEmailForAccess(userEmail);\n const publicAllowed = reg?.allowPublic !== false;\n const includePublic = (options.includePublic ?? false) && publicAllowed;\n const clauses: SQL[] = [];\n\n if (normalizedUserEmail) {\n clauses.push(\n and(\n emailColumnMatches(resourceTable.ownerEmail, normalizedUserEmail),\n ownerScopeFilter(reg, resourceTable, ctx),\n )!,\n );\n }\n if (minRole === \"viewer\") {\n if (includePublic) {\n clauses.push(eq(resourceTable.visibility, \"public\"));\n }\n if (orgId) {\n clauses.push(\n and(\n eq(resourceTable.visibility, \"org\"),\n eq(resourceTable.orgId, orgId),\n )!,\n );\n }\n }\n if (normalizedUserEmail) {\n const shareScope = restrictedShareScopeSql(reg, resourceTable, ctx);\n clauses.push(\n sql`exists (select 1 from ${sharesTable}\n where ${sharesTable.resourceId} = ${resourceTable.id}\n and ${sharesTable.principalType} = 'user'\n and lower(${sharesTable.principalId}) = ${normalizedUserEmail}\n and ${shareScope}\n and ${minRoleSql(minRole)})`,\n );\n }\n if (orgId) {\n const shareScope = restrictedShareScopeSql(reg, resourceTable, ctx);\n clauses.push(\n sql`exists (select 1 from ${sharesTable}\n where ${sharesTable.resourceId} = ${resourceTable.id}\n and ${sharesTable.principalType} = 'org'\n and ${sharesTable.principalId} = ${orgId}\n and ${shareScope}\n and ${minRoleSql(minRole)})`,\n );\n }\n\n return or(...clauses) ?? sql`1=0`;\n}\n\nfunction ownerScopeFilter(\n reg: ShareableResourceRegistration | undefined,\n resourceTable: any,\n ctx: AccessContext,\n): SQL {\n if (reg?.ownerAccessIgnoresOrg === true) return sql`1=1`;\n if (ctx.orgId) {\n // Rows created before org-scoping, or in solo mode, have no org_id. Keep\n // them manageable by their owner after the owner joins or switches into an\n // organization, while still keeping rows from other orgs out of scope.\n return or(\n eq(resourceTable.orgId, ctx.orgId),\n sql`${resourceTable.orgId} IS NULL`,\n )!;\n }\n return sql`${resourceTable.orgId} IS NULL`;\n}\n\nfunction ownerMatchesActiveScope(\n reg: ShareableResourceRegistration | undefined,\n resource: any,\n ctx: AccessContext,\n): boolean {\n if (reg?.ownerAccessIgnoresOrg === true) return true;\n const resourceOrgId = resource?.orgId ?? null;\n if (!resourceOrgId) return true;\n return ctx.orgId === resourceOrgId;\n}\n\nfunction minRoleSql(minRole: ShareRole): SQL {\n if (minRole === \"viewer\") {\n // any role satisfies viewer\n return sql`1=1`;\n }\n if (minRole === \"editor\") {\n return sql`role in ('editor','admin')`;\n }\n return sql`role = 'admin'`;\n}\n\nfunction restrictedShareScopeSql(\n reg: ShareableResourceRegistration | undefined,\n resourceTable: any,\n ctx: AccessContext,\n): SQL {\n // Restricted resources (extensions) must stay inside their resource org even\n // if stale cross-org share rows already exist from older code or bad data.\n if (reg?.requireOrgMemberForUserShares !== true) return sql`1=1`;\n if (!ctx.orgId) return sql`1=0`;\n return eq(resourceTable.orgId, ctx.orgId);\n}\n\nfunction explicitSharesAllowedForResource(\n reg: ShareableResourceRegistration,\n resource: any,\n ctx: AccessContext,\n): boolean {\n if (reg.requireOrgMemberForUserShares !== true) return true;\n const resourceOrgId = resource?.orgId ?? null;\n return !!resourceOrgId && !!ctx.orgId && resourceOrgId === ctx.orgId;\n}\n\nexport interface ResolvedAccess {\n /** Effective role: 'owner' for the resource owner, or the share role. */\n role: \"owner\" | ShareRole;\n /** The resource row (already loaded). */\n resource: any;\n}\n\nasync function publicAccessRoleForResource(\n reg: ShareableResourceRegistration,\n resource: any,\n ctx: AccessContext,\n): Promise<ShareRole> {\n const roleResolver = reg.publicAccessRole;\n if (!roleResolver) return \"viewer\";\n return typeof roleResolver === \"function\"\n ? await roleResolver(resource, ctx)\n : roleResolver;\n}\n\nfunction higherShareRole(a: ShareRole, b: ShareRole | null): ShareRole {\n if (!b) return a;\n return ROLE_RANK[b] > ROLE_RANK[a] ? b : a;\n}\n\nfunction columnName(column: unknown): string | null {\n const candidate = column as\n | {\n name?: unknown;\n config?: { name?: unknown };\n _: { name?: unknown };\n }\n | undefined;\n const name = candidate?.name ?? candidate?.config?.name ?? candidate?._?.name;\n return typeof name === \"string\" && name ? name : null;\n}\n\nfunction missingColumnName(err: unknown): string | null {\n const error = err as { code?: string; message?: string } | undefined;\n const message = error?.message ?? \"\";\n if (\n error?.code !== \"42703\" &&\n !/no such column|does not exist/i.test(message)\n ) {\n return null;\n }\n const quoted = message.match(/column\\s+\"([^\"]+)\"\\s+does not exist/i)?.[1];\n if (quoted) return quoted;\n const sqlite = message.match(/no such column:\\s+[\"`]?([\\w.]+)[\"`]?/i)?.[1];\n if (sqlite) return sqlite.split(\".\").pop() ?? sqlite;\n return null;\n}\n\nfunction selectAllExistingResourceColumns(\n resourceTable: any,\n omittedColumnNames: Set<string>,\n): Record<string, unknown> {\n const selection: Record<string, unknown> = {};\n for (const [key, column] of Object.entries(resourceTable)) {\n const name = columnName(column);\n if (!name || omittedColumnNames.has(name)) continue;\n selection[key] = column;\n }\n return selection;\n}\n\nasync function loadResourceForAccess(\n reg: ShareableResourceRegistration,\n resourceId: string,\n): Promise<any | null> {\n const db = reg.getDb() as any;\n const omittedColumnNames = new Set<string>();\n\n for (let attempt = 0; attempt < 12; attempt++) {\n try {\n const query =\n omittedColumnNames.size === 0\n ? db.select()\n : db.select(\n selectAllExistingResourceColumns(\n reg.resourceTable,\n omittedColumnNames,\n ),\n );\n const [resource] = await query\n .from(reg.resourceTable)\n .where(eq(reg.resourceTable.id, resourceId));\n return resource ?? null;\n } catch (err) {\n const missing = missingColumnName(err);\n if (!missing || omittedColumnNames.has(missing)) throw err;\n omittedColumnNames.add(missing);\n console.warn(\n `[sharing] ${reg.type} access lookup omitted missing column ${missing}`,\n );\n }\n }\n\n throw new Error(\n `Could not load ${reg.type} ${resourceId}: too many missing resource columns`,\n );\n}\n\n/**\n * Return the effective role the current user has on a specific resource, or\n * null if they have no access. Loads the resource and relevant share rows.\n */\nexport async function resolveAccess(\n resourceType: string,\n resourceId: string,\n rawCtx: AccessContext = currentAccess(),\n): Promise<ResolvedAccess | null> {\n const reg = requireShareableResource(resourceType);\n const ctx = resolveRegisteredAccessContext(reg, rawCtx);\n\n const resource = await loadResourceForAccess(reg, resourceId);\n if (!resource) return null;\n\n const { userEmail, orgId } = ctx;\n const normalizedUserEmail = normalizeEmailForAccess(userEmail);\n\n if (\n normalizedUserEmail &&\n normalizeEmailForAccess(resource.ownerEmail) === normalizedUserEmail &&\n ownerMatchesActiveScope(reg, resource, ctx)\n ) {\n return { role: \"owner\", resource };\n }\n if (resource.visibility === \"public\" && reg.allowPublic !== false) {\n // No share row needed; default viewer unless the resource registration\n // deliberately grants a stronger public-by-link role or explicit shares\n // upgrade the current principal.\n const publicRole = await publicAccessRoleForResource(reg, resource, ctx);\n const role = await highestShareRole(reg, resourceId, ctx, resource);\n return { role: higherShareRole(publicRole, role), resource };\n }\n // `visibility === \"public\"` on an `allowPublic: false` resource is treated\n // as private: only owner + explicit shares grant access. Falls through to\n // the explicit-share lookup below.\n if (resource.visibility === \"org\" && orgId && resource.orgId === orgId) {\n const role = await highestShareRole(reg, resourceId, ctx, resource);\n return { role: role ?? \"viewer\", resource };\n }\n const role = await highestShareRole(reg, resourceId, ctx, resource);\n if (role) return { role, resource };\n return null;\n}\n\nasync function highestShareRole(\n reg: ShareableResourceRegistration,\n resourceId: string,\n ctx: AccessContext,\n resource: any,\n): Promise<ShareRole | null> {\n const { userEmail, orgId } = ctx;\n const normalizedUserEmail = normalizeEmailForAccess(userEmail);\n if (!normalizedUserEmail && !orgId) return null;\n if (!explicitSharesAllowedForResource(reg, resource, ctx)) return null;\n const db = reg.getDb() as any;\n\n const principalClauses: ReturnType<typeof and>[] = [];\n if (normalizedUserEmail) {\n principalClauses.push(\n and(\n eq(reg.sharesTable.principalType, \"user\"),\n emailColumnMatches(reg.sharesTable.principalId, normalizedUserEmail),\n ),\n );\n }\n if (orgId) {\n principalClauses.push(\n and(\n eq(reg.sharesTable.principalType, \"org\"),\n eq(reg.sharesTable.principalId, orgId),\n ),\n );\n }\n\n const rows = await db\n .select({ role: reg.sharesTable.role })\n .from(reg.sharesTable)\n .where(\n and(eq(reg.sharesTable.resourceId, resourceId), or(...principalClauses)),\n )\n .limit(10);\n\n let best: ShareRole | null = null;\n for (const r of rows as Array<{ role: ShareRole }>) {\n if (!best || ROLE_RANK[r.role] > ROLE_RANK[best]) best = r.role;\n }\n return best;\n}\n\n/**\n * Throw ForbiddenError if the current user can't act on this resource with at\n * least the given role. Used at the top of update/delete actions.\n */\nexport async function assertAccess(\n resourceType: string,\n resourceId: string,\n minRole: ShareRole | \"owner\" = \"viewer\",\n ctx: AccessContext = currentAccess(),\n): Promise<ResolvedAccess> {\n const access = await resolveAccess(resourceType, resourceId, ctx);\n if (!access) {\n throw new ForbiddenError(`No access to ${resourceType} ${resourceId}`);\n }\n if (ROLE_RANK[access.role] < ROLE_RANK[minRole]) {\n throw new ForbiddenError(\n `Requires ${minRole} role on ${resourceType} ${resourceId} (have ${access.role})`,\n );\n }\n return access;\n}\n"]}
1
+ {"version":3,"file":"access.js","sourceRoot":"","sources":["../../src/sharing/access.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAY,MAAM,aAAa,CAAC;AAEzD,OAAO,EACL,mBAAmB,EACnB,eAAe,GAChB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,sBAAsB,EACtB,wBAAwB,GAEzB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAmC,MAAM,aAAa,CAAC;AAEzE;;;;;;;GAOG;AACH,SAAS,uBAAuB,CAC9B,aAAkB;IAElB,KAAK,MAAM,GAAG,IAAI,sBAAsB,EAAE,EAAE,CAAC;QAC3C,IAAI,GAAG,CAAC,aAAa,KAAK,aAAa;YAAE,OAAO,GAAG,CAAC;IACtD,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,OAAO,cAAe,SAAQ,KAAK;IACvC,UAAU,GAAG,GAAG,CAAC;IACjB,YAAY,OAAO,GAAG,WAAW;QAC/B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AAOD,wEAAwE;AACxE,MAAM,UAAU,aAAa;IAC3B,OAAO;QACL,SAAS,EAAE,mBAAmB,EAAE;QAChC,KAAK,EAAE,eAAe,EAAE;KACzB,CAAC;AACJ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;QACnD,IAAI,CAAC,IAAI,IAAI,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC;YAAE,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC;IAClE,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAwBD,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,YAAoB,EACpB,UAAkB,EAClB,OAAO,GAAwB,QAAQ,EACvC,GAAG,GAAkB,aAAa,EAAE,EACpC,OAAO,GAAyB,EAAE;IAElC,MAAM,MAAM,GAAG,MAAM,iBAAiB,CACpC,YAAY,EACZ,UAAU,EACV,GAAG,EACH,OAAO,CACR,CAAC;IACF,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,cAAc,CAAC,gBAAgB,YAAY,IAAI,UAAU,EAAE,CAAC,CAAC;IACzE,CAAC;IACD,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,cAAc,CACtB,YAAY,OAAO,YAAY,YAAY,IAAI,UAAU,UAAU,MAAM,CAAC,IAAI,GAAG,CAClF,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/**\n * Access-control helpers for shareable resources.\n *\n * The access model combines:\n * 1. Direct ownership — `owner_email = currentUser`.\n * 2. Visibility — `'private' | 'org' | 'public'`. `org` grants read to anyone\n * in the same org; `public` grants read to any authenticated user.\n * 3. Share rows — per-user or per-org grants in the `{type}_shares` table\n * with a role (`viewer | editor | admin`).\n *\n * Use `applyAccessFilter()` on list/read queries to filter rows the current\n * user can see. Use `assertAccess()` at the top of write actions to reject\n * callers who lack the required role.\n */\n\nimport { and, eq, or, sql, type SQL } from \"drizzle-orm\";\n\nimport {\n getRequestUserEmail,\n getRequestOrgId,\n} from \"../server/request-context.js\";\nimport {\n listShareableResources,\n requireShareableResource,\n type ShareableResourceRegistration,\n} from \"./registry.js\";\nimport { ROLE_RANK, type ShareRole, type Visibility } from \"./schema.js\";\n\n/**\n * Find a registration by its drizzle table identity. Used to look up\n * per-resource policy flags (e.g. `allowPublic`) inside `accessFilter`,\n * which receives only the table — not the resource-type name.\n *\n * Identity is stable within a single bundle (Vite dedupes module instances);\n * the SSR/server side is the only caller, so per-bundle identity is fine.\n */\nfunction findRegistrationByTable(\n resourceTable: any,\n): ShareableResourceRegistration | undefined {\n for (const reg of listShareableResources()) {\n if (reg.resourceTable === resourceTable) return reg;\n }\n return undefined;\n}\n\nexport class ForbiddenError extends Error {\n statusCode = 403;\n constructor(message = \"Forbidden\") {\n super(message);\n this.name = \"ForbiddenError\";\n }\n}\n\nexport interface AccessContext {\n userEmail?: string;\n orgId?: string;\n}\n\n/** Current request's access context. Pulls from request-context ALS. */\nexport function currentAccess(): AccessContext {\n return {\n userEmail: getRequestUserEmail(),\n orgId: getRequestOrgId(),\n };\n}\n\nexport function resolveRegisteredAccessContext(\n reg: ShareableResourceRegistration | undefined,\n ctx: AccessContext,\n): AccessContext {\n return reg?.resolveAccessContext ? reg.resolveAccessContext(ctx) : ctx;\n}\n\nfunction normalizeEmailForAccess(email: string | undefined): string | null {\n const normalized = email?.trim().toLowerCase();\n return normalized || null;\n}\n\nfunction emailColumnMatches(column: any, email: string): SQL {\n return sql`lower(${column}) = ${email}`;\n}\n\n/**\n * Build a Drizzle `WHERE` clause that admits rows the current user can see.\n * Pass the ownable resource table and its shares table; optional min role\n * (defaults to 'viewer') gates which share rows count.\n *\n * `visibility = 'public'` is intentionally NOT admitted by default. Public\n * means \"anyone with the link can view\" (still honoured by `resolveAccess`\n * for read-by-id), not \"appears in every signed-in user's list/sidebar.\"\n * Pass `{ includePublic: true }` for the rare list endpoint that wants\n * cross-user public discovery (a public template gallery, for example).\n *\n * Example:\n *\n * const rows = await db\n * .select()\n * .from(schema.documents)\n * .where(accessFilter(schema.documents, schema.documentShares));\n */\nexport function accessFilter(\n resourceTable: any,\n sharesTable: any,\n rawCtx: AccessContext = currentAccess(),\n minRole: ShareRole = \"viewer\",\n options: { includePublic?: boolean } = {},\n): SQL {\n // Defense in depth — resources registered with `allowPublic: false` must\n // never participate in cross-user \"public\" discovery, even if a caller\n // accidentally passes `includePublic: true` or if a stale public row sits\n // in the DB.\n const reg = findRegistrationByTable(resourceTable);\n const ctx = resolveRegisteredAccessContext(reg, rawCtx);\n const { userEmail, orgId } = ctx;\n const normalizedUserEmail = normalizeEmailForAccess(userEmail);\n const publicAllowed = reg?.allowPublic !== false;\n const includePublic = (options.includePublic ?? false) && publicAllowed;\n const clauses: SQL[] = [];\n\n if (normalizedUserEmail) {\n clauses.push(\n and(\n emailColumnMatches(resourceTable.ownerEmail, normalizedUserEmail),\n ownerScopeFilter(reg, resourceTable, ctx),\n )!,\n );\n }\n if (minRole === \"viewer\") {\n if (includePublic) {\n clauses.push(eq(resourceTable.visibility, \"public\"));\n }\n if (orgId) {\n clauses.push(\n and(\n eq(resourceTable.visibility, \"org\"),\n eq(resourceTable.orgId, orgId),\n )!,\n );\n }\n }\n if (normalizedUserEmail) {\n const shareScope = restrictedShareScopeSql(reg, resourceTable, ctx);\n clauses.push(\n sql`exists (select 1 from ${sharesTable}\n where ${sharesTable.resourceId} = ${resourceTable.id}\n and ${sharesTable.principalType} = 'user'\n and lower(${sharesTable.principalId}) = ${normalizedUserEmail}\n and ${shareScope}\n and ${minRoleSql(minRole)})`,\n );\n }\n if (orgId) {\n const shareScope = restrictedShareScopeSql(reg, resourceTable, ctx);\n clauses.push(\n sql`exists (select 1 from ${sharesTable}\n where ${sharesTable.resourceId} = ${resourceTable.id}\n and ${sharesTable.principalType} = 'org'\n and ${sharesTable.principalId} = ${orgId}\n and ${shareScope}\n and ${minRoleSql(minRole)})`,\n );\n }\n\n return or(...clauses) ?? sql`1=0`;\n}\n\nfunction ownerScopeFilter(\n reg: ShareableResourceRegistration | undefined,\n resourceTable: any,\n ctx: AccessContext,\n): SQL {\n if (reg?.ownerAccessIgnoresOrg === true) return sql`1=1`;\n if (ctx.orgId) {\n // Rows created before org-scoping, or in solo mode, have no org_id. Keep\n // them manageable by their owner after the owner joins or switches into an\n // organization, while still keeping rows from other orgs out of scope.\n return or(\n eq(resourceTable.orgId, ctx.orgId),\n sql`${resourceTable.orgId} IS NULL`,\n )!;\n }\n return sql`${resourceTable.orgId} IS NULL`;\n}\n\nfunction ownerMatchesActiveScope(\n reg: ShareableResourceRegistration | undefined,\n resource: any,\n ctx: AccessContext,\n): boolean {\n if (reg?.ownerAccessIgnoresOrg === true) return true;\n const resourceOrgId = resource?.orgId ?? null;\n if (!resourceOrgId) return true;\n return ctx.orgId === resourceOrgId;\n}\n\nfunction minRoleSql(minRole: ShareRole): SQL {\n if (minRole === \"viewer\") {\n // any role satisfies viewer\n return sql`1=1`;\n }\n if (minRole === \"editor\") {\n return sql`role in ('editor','admin')`;\n }\n return sql`role = 'admin'`;\n}\n\nfunction restrictedShareScopeSql(\n reg: ShareableResourceRegistration | undefined,\n resourceTable: any,\n ctx: AccessContext,\n): SQL {\n // Restricted resources (extensions) must stay inside their resource org even\n // if stale cross-org share rows already exist from older code or bad data.\n if (reg?.requireOrgMemberForUserShares !== true) return sql`1=1`;\n if (!ctx.orgId) return sql`1=0`;\n return eq(resourceTable.orgId, ctx.orgId);\n}\n\nfunction explicitSharesAllowedForResource(\n reg: ShareableResourceRegistration,\n resource: any,\n ctx: AccessContext,\n): boolean {\n if (reg.requireOrgMemberForUserShares !== true) return true;\n const resourceOrgId = resource?.orgId ?? null;\n return !!resourceOrgId && !!ctx.orgId && resourceOrgId === ctx.orgId;\n}\n\nexport interface ResolvedAccess {\n /** Effective role: 'owner' for the resource owner, or the share role. */\n role: \"owner\" | ShareRole;\n /** The resource row (already loaded). */\n resource: any;\n}\n\n/**\n * Minimal resource shape returned when a caller opts into a projected access\n * load via `{ skipResourceBody: true }`. Contains exactly the columns the\n * access-decision logic itself reads — identity, ownership, org scope, and\n * visibility — never a resource type's heavy body columns (`data`,\n * `content`, and similar blobs).\n */\nexport interface AccessProjectedResource {\n id: string;\n ownerEmail: string;\n orgId: string | null;\n visibility: Visibility;\n}\n\nexport interface ResolvedAccessProjected {\n /** Effective role: 'owner' for the resource owner, or the share role. */\n role: \"owner\" | ShareRole;\n /** Only the access-decision columns — not the full resource row. */\n resource: AccessProjectedResource;\n}\n\nexport interface ResolveAccessOptions {\n /**\n * When true, load only the columns the access decision itself needs\n * (`id`, `ownerEmail`, `orgId`, `visibility`) instead of the full resource\n * row. Use this when the caller only needs the access decision — not the\n * resource body — and wants to skip fetching heavy type-specific columns\n * (e.g. `data`/`content` blobs) on every `assertAccess`/`resolveAccess`\n * call.\n *\n * Silently ignored (falls back to a full row load) for any resource type\n * registered with a `publicAccessRole` *function* resolver, since that\n * callback can read arbitrary resource fields the projection would have\n * omitted — see `hasDynamicPublicAccessRoleResolver` below.\n *\n * Default: `false` — the full row is loaded, matching historical behavior.\n * Callers that need resource body fields (most call sites today — for\n * many resource types `resolveAccess().resource` doubles as the action's\n * primary data read) must NOT pass this.\n */\n skipResourceBody?: boolean;\n}\n\nasync function publicAccessRoleForResource(\n reg: ShareableResourceRegistration,\n resource: any,\n ctx: AccessContext,\n): Promise<ShareRole> {\n const roleResolver = reg.publicAccessRole;\n if (!roleResolver) return \"viewer\";\n return typeof roleResolver === \"function\"\n ? await roleResolver(resource, ctx)\n : roleResolver;\n}\n\nfunction higherShareRole(a: ShareRole, b: ShareRole | null): ShareRole {\n if (!b) return a;\n return ROLE_RANK[b] > ROLE_RANK[a] ? b : a;\n}\n\nfunction columnName(column: unknown): string | null {\n const candidate = column as\n | {\n name?: unknown;\n config?: { name?: unknown };\n _: { name?: unknown };\n }\n | undefined;\n const name = candidate?.name ?? candidate?.config?.name ?? candidate?._?.name;\n return typeof name === \"string\" && name ? name : null;\n}\n\nfunction missingColumnName(err: unknown): string | null {\n const error = err as { code?: string; message?: string } | undefined;\n const message = error?.message ?? \"\";\n if (\n error?.code !== \"42703\" &&\n !/no such column|does not exist/i.test(message)\n ) {\n return null;\n }\n const quoted = message.match(/column\\s+\"([^\"]+)\"\\s+does not exist/i)?.[1];\n if (quoted) return quoted;\n const sqlite = message.match(/no such column:\\s+[\"`]?([\\w.]+)[\"`]?/i)?.[1];\n if (sqlite) return sqlite.split(\".\").pop() ?? sqlite;\n return null;\n}\n\nfunction selectExistingColumns(\n columns: Record<string, unknown>,\n omittedColumnNames: Set<string>,\n): Record<string, unknown> {\n const selection: Record<string, unknown> = {};\n for (const [key, column] of Object.entries(columns)) {\n const name = columnName(column);\n if (!name || omittedColumnNames.has(name)) continue;\n selection[key] = column;\n }\n return selection;\n}\n\n/**\n * The fixed column set the access-decision logic in `resolveAccess` itself\n * reads: identity (`id`), ownership (`ownerEmail`, `orgId`), and the coarse\n * `visibility` flag. This is intentionally NOT caller-configurable — an\n * arbitrary caller-supplied column list could omit a column the access\n * checks below depend on and silently break authorization. Every ownable\n * resource table has these columns (`ownableColumns()` + a primary key\n * named `id`), so this projection is safe for any registration that\n * doesn't also read the row through a dynamic resolver (see below).\n */\nfunction projectedAccessColumns(resourceTable: any): Record<string, unknown> {\n return {\n id: resourceTable.id,\n ownerEmail: resourceTable.ownerEmail,\n orgId: resourceTable.orgId,\n visibility: resourceTable.visibility,\n };\n}\n\n/**\n * True when this registration's `publicAccessRole` is a callback rather than\n * a fixed role string. Callbacks receive the loaded `resource` and may read\n * arbitrary fields on it (see e.g. `templates/design`'s\n * `publicDesignAccessRole`, which inspects design-specific data). The\n * projected access load must never be used for these registrations — always\n * fall back to a full row load so the resolver sees the complete resource.\n */\nfunction hasDynamicPublicAccessRoleResolver(\n reg: ShareableResourceRegistration,\n): boolean {\n return typeof reg.publicAccessRole === \"function\";\n}\n\nasync function loadResourceForAccess(\n reg: ShareableResourceRegistration,\n resourceId: string,\n options: ResolveAccessOptions = {},\n): Promise<any | null> {\n const db = reg.getDb() as any;\n const useProjection =\n options.skipResourceBody === true &&\n !hasDynamicPublicAccessRoleResolver(reg);\n const projectedColumns = useProjection\n ? projectedAccessColumns(reg.resourceTable)\n : null;\n const omittedColumnNames = new Set<string>();\n\n for (let attempt = 0; attempt < 12; attempt++) {\n try {\n const query =\n !projectedColumns && omittedColumnNames.size === 0\n ? db.select()\n : db.select(\n selectExistingColumns(\n projectedColumns ?? reg.resourceTable,\n omittedColumnNames,\n ),\n );\n const [resource] = await query\n .from(reg.resourceTable)\n .where(eq(reg.resourceTable.id, resourceId));\n return resource ?? null;\n } catch (err) {\n const missing = missingColumnName(err);\n if (!missing || omittedColumnNames.has(missing)) throw err;\n omittedColumnNames.add(missing);\n console.warn(\n `[sharing] ${reg.type} access lookup omitted missing column ${missing}`,\n );\n }\n }\n\n throw new Error(\n `Could not load ${reg.type} ${resourceId}: too many missing resource columns`,\n );\n}\n\n/**\n * Return the effective role the current user has on a specific resource, or\n * null if they have no access. Loads the resource and relevant share rows.\n *\n * By default the full resource row is loaded (unchanged historical\n * behavior — for most resource types `.resource` here doubles as the\n * action's primary data read). Pass `{ skipResourceBody: true }` when the\n * caller only needs the access decision to load just the access-decision\n * columns instead — see `ResolveAccessOptions`.\n */\nexport async function resolveAccess(\n resourceType: string,\n resourceId: string,\n rawCtx?: AccessContext,\n options?: { skipResourceBody?: false },\n): Promise<ResolvedAccess | null>;\nexport async function resolveAccess(\n resourceType: string,\n resourceId: string,\n rawCtx: AccessContext | undefined,\n options: { skipResourceBody: true },\n): Promise<ResolvedAccessProjected | null>;\nexport async function resolveAccess(\n resourceType: string,\n resourceId: string,\n rawCtx: AccessContext = currentAccess(),\n options: ResolveAccessOptions = {},\n): Promise<ResolvedAccess | ResolvedAccessProjected | null> {\n return resolveAccessImpl(resourceType, resourceId, rawCtx, options);\n}\n\n/**\n * Un-overloaded implementation shared by the `resolveAccess` overloads and\n * called directly by `assertAccess` below. Kept separate from the exported\n * `resolveAccess` so internal callers passing a widened\n * `ResolveAccessOptions` (rather than a `{ skipResourceBody: true }` /\n * `{ skipResourceBody?: false }` literal) don't have to satisfy TypeScript's\n * overload resolution, which only matches against the declared overload\n * signatures, not the implementation signature.\n */\nasync function resolveAccessImpl(\n resourceType: string,\n resourceId: string,\n rawCtx: AccessContext = currentAccess(),\n options: ResolveAccessOptions = {},\n): Promise<ResolvedAccess | ResolvedAccessProjected | null> {\n const reg = requireShareableResource(resourceType);\n const ctx = resolveRegisteredAccessContext(reg, rawCtx);\n\n const resource = await loadResourceForAccess(reg, resourceId, options);\n if (!resource) return null;\n\n const { userEmail, orgId } = ctx;\n const normalizedUserEmail = normalizeEmailForAccess(userEmail);\n\n if (\n normalizedUserEmail &&\n normalizeEmailForAccess(resource.ownerEmail) === normalizedUserEmail &&\n ownerMatchesActiveScope(reg, resource, ctx)\n ) {\n return { role: \"owner\", resource };\n }\n if (resource.visibility === \"public\" && reg.allowPublic !== false) {\n // No share row needed; default viewer unless the resource registration\n // deliberately grants a stronger public-by-link role or explicit shares\n // upgrade the current principal.\n const publicRole = await publicAccessRoleForResource(reg, resource, ctx);\n const role = await highestShareRole(reg, resourceId, ctx, resource);\n return { role: higherShareRole(publicRole, role), resource };\n }\n // `visibility === \"public\"` on an `allowPublic: false` resource is treated\n // as private: only owner + explicit shares grant access. Falls through to\n // the explicit-share lookup below.\n if (resource.visibility === \"org\" && orgId && resource.orgId === orgId) {\n const role = await highestShareRole(reg, resourceId, ctx, resource);\n return { role: role ?? \"viewer\", resource };\n }\n const role = await highestShareRole(reg, resourceId, ctx, resource);\n if (role) return { role, resource };\n return null;\n}\n\nasync function highestShareRole(\n reg: ShareableResourceRegistration,\n resourceId: string,\n ctx: AccessContext,\n resource: any,\n): Promise<ShareRole | null> {\n const { userEmail, orgId } = ctx;\n const normalizedUserEmail = normalizeEmailForAccess(userEmail);\n if (!normalizedUserEmail && !orgId) return null;\n if (!explicitSharesAllowedForResource(reg, resource, ctx)) return null;\n const db = reg.getDb() as any;\n\n const principalClauses: ReturnType<typeof and>[] = [];\n if (normalizedUserEmail) {\n principalClauses.push(\n and(\n eq(reg.sharesTable.principalType, \"user\"),\n emailColumnMatches(reg.sharesTable.principalId, normalizedUserEmail),\n ),\n );\n }\n if (orgId) {\n principalClauses.push(\n and(\n eq(reg.sharesTable.principalType, \"org\"),\n eq(reg.sharesTable.principalId, orgId),\n ),\n );\n }\n\n const rows = await db\n .select({ role: reg.sharesTable.role })\n .from(reg.sharesTable)\n .where(\n and(eq(reg.sharesTable.resourceId, resourceId), or(...principalClauses)),\n )\n .limit(10);\n\n let best: ShareRole | null = null;\n for (const r of rows as Array<{ role: ShareRole }>) {\n if (!best || ROLE_RANK[r.role] > ROLE_RANK[best]) best = r.role;\n }\n return best;\n}\n\n/**\n * Throw ForbiddenError if the current user can't act on this resource with at\n * least the given role. Used at the top of update/delete actions.\n *\n * By default the full resource row is loaded (unchanged historical\n * behavior). Pass `{ skipResourceBody: true }` as the fifth argument when\n * the caller only needs the access decision — see `ResolveAccessOptions`.\n */\nexport async function assertAccess(\n resourceType: string,\n resourceId: string,\n minRole?: ShareRole | \"owner\",\n ctx?: AccessContext,\n options?: { skipResourceBody?: false },\n): Promise<ResolvedAccess>;\nexport async function assertAccess(\n resourceType: string,\n resourceId: string,\n minRole: ShareRole | \"owner\" | undefined,\n ctx: AccessContext | undefined,\n options: { skipResourceBody: true },\n): Promise<ResolvedAccessProjected>;\nexport async function assertAccess(\n resourceType: string,\n resourceId: string,\n minRole: ShareRole | \"owner\" = \"viewer\",\n ctx: AccessContext = currentAccess(),\n options: ResolveAccessOptions = {},\n): Promise<ResolvedAccess | ResolvedAccessProjected> {\n const access = await resolveAccessImpl(\n resourceType,\n resourceId,\n ctx,\n options,\n );\n if (!access) {\n throw new ForbiddenError(`No access to ${resourceType} ${resourceId}`);\n }\n if (ROLE_RANK[access.role] < ROLE_RANK[minRole]) {\n throw new ForbiddenError(\n `Requires ${minRole} role on ${resourceType} ${resourceId} (have ${access.role})`,\n );\n }\n return access;\n}\n"]}
@@ -60,6 +60,13 @@ export interface ShareableResourceRegistration {
60
60
  * this so public visibility remains viewer-only. Use narrowly for local or
61
61
  * otherwise constrained resources where the resource owner intentionally wants
62
62
  * unauthenticated link holders to do more than view.
63
+ *
64
+ * When this is a function, it may read arbitrary fields on the resource row
65
+ * (not just the ownership/visibility columns). Because of that,
66
+ * `resolveAccess`/`assertAccess`'s opt-in `{ skipResourceBody: true }`
67
+ * projected load (see `access.ts`) is automatically ignored for this
68
+ * registration and always loads the full row instead — a fixed role string
69
+ * has no such requirement and is compatible with the projection.
63
70
  */
64
71
  publicAccessRole?: "viewer" | "editor" | "admin" | ((resource: any, ctx: {
65
72
  userEmail?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/sharing/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,6BAA6B;IAC5C,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAC;IACb,0EAA0E;IAC1E,aAAa,EAAE,GAAG,CAAC;IACnB,qDAAqD;IACrD,WAAW,EAAE,GAAG,CAAC;IACjB,+DAA+D;IAC/D,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,MAAM,GAAG,SAAS,CAAC;IACxD;;;;OAIG;IACH,KAAK,EAAE,MAAM,GAAG,CAAC;IACjB;;;;;;;;;;;;OAYG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;OAKG;IACH,gBAAgB,CAAC,EACb,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,CAAC,CACC,QAAQ,EAAE,GAAG,EACb,GAAG,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,KAEzC,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,OAAO,CAAC,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC,CA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C,CAAC;AACX,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,KAAoC;IAEpC,IAAI,CAAC,aAAa,EAAE,IAAI,4BAA4B,EAAE;QAAE,OAAO;IAC/D,WAAW,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,IAAY;IAEZ,OAAO,WAAW,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,IAAY;IAEZ,MAAM,GAAG,GAAG,WAAW,EAAE,CAAC;IAC1B,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACb,qCAAqC,IAAI,gDAAgD,CAC1F,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,sBAAsB;IACpC,OAAO,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["/**\n * Registry of shareable resources.\n *\n * Each template registers its ownable resource(s) once on module load so the\n * framework-level share actions (`share-resource`, `list-resource-shares`,\n * etc.) can dispatch to the correct tables.\n *\n * import { registerShareableResource } from \"@agent-native/core/sharing\";\n * import * as schema from \"./schema.js\";\n *\n * registerShareableResource({\n * type: \"document\",\n * resourceTable: schema.documents,\n * sharesTable: schema.documentShares,\n * displayName: \"Document\",\n * titleColumn: \"title\",\n * });\n */\n\nexport interface ShareableResourceRegistration {\n /** Stable identifier used across actions, UI, and analytics. e.g. \"document\". */\n type: string;\n /** Drizzle table for the parent resource (must have ownableColumns()). */\n resourceTable: any;\n /** Drizzle table produced by createSharesTable(). */\n sharesTable: any;\n /** Human-readable singular label shown in the share dialog. */\n displayName: string;\n /**\n * Column on the resource table that holds a human-readable title for\n * display in the share UI. Default: \"title\".\n */\n titleColumn?: string;\n /**\n * Optional app-relative path to this resource. Used by share notifications\n * when the caller does not pass a more specific resourceUrl.\n */\n getResourcePath?: (resource: any) => string | undefined;\n /**\n * Drizzle DB accessor from the template's server/db/index.ts. Required —\n * the framework-level share actions and access helpers call this to reach\n * the right DB instance (schema is template-specific).\n */\n getDb: () => any;\n /**\n * When `false`, `visibility: \"public\"` is rejected by `set-resource-visibility`,\n * and `accessFilter` / `resolveAccess` treat any stored public row as private\n * (defense in depth — only owner + explicit shares grant access).\n *\n * Use this for resources that execute code or expose privileged data and must\n * never be reachable by a random authenticated user. Extensions set this:\n * extension HTML runs inside an iframe that calls actions / DB / proxied APIs\n * as the *viewer*, so a public extension would be arbitrary code with the\n * viewer's credentials.\n *\n * Default: `true` (matches the historical behavior — most resources can be public).\n */\n allowPublic?: boolean;\n /**\n * Optional role granted by a public-by-link read. Most resources should omit\n * this so public visibility remains viewer-only. Use narrowly for local or\n * otherwise constrained resources where the resource owner intentionally wants\n * unauthenticated link holders to do more than view.\n */\n publicAccessRole?:\n | \"viewer\"\n | \"editor\"\n | \"admin\"\n | ((\n resource: any,\n ctx: { userEmail?: string; orgId?: string },\n ) =>\n | \"viewer\"\n | \"editor\"\n | \"admin\"\n | Promise<\"viewer\" | \"editor\" | \"admin\">);\n /**\n * When `true`, individual user shares (`principalType: \"user\"`) must target\n * an email that is already a member of the same org as the resource, OR has\n * a pending invitation to that org. Cross-org user shares are rejected.\n *\n * Pair with `allowPublic: false` for resources that need a hard \"this org\n * only\" trust boundary. Extensions set this so a malicious caller can't\n * widen reach by sharing a code-executing extension to an outsider email.\n *\n * Default: `false` (matches the historical behavior — any email can be granted).\n */\n requireOrgMemberForUserShares?: boolean;\n /**\n * Optional per-resource access-context adapter. Most resources should use the\n * request user/org unchanged. Templates with an intentional alternate local\n * identity can normalize here so the generic framework sharing actions and\n * access helpers stay in sync with template-owned actions.\n */\n resolveAccessContext?: (ctx: { userEmail?: string; orgId?: string }) => {\n userEmail?: string;\n orgId?: string;\n };\n /**\n * When true, direct ownership is recognized by owner_email regardless of the\n * caller's active org. Use this only for resource types where the template's\n * own actions already treat owner_email as the cross-org authority and list\n * views add their own org filters.\n *\n * Default: `false`.\n */\n ownerAccessIgnoresOrg?: boolean;\n /**\n * Optional external-agent read handoff. When set, the framework-level\n * `create-agent-resource-link` action can mint a short-lived, read-only\n * `agent_access` URL for this resource. The context endpoint is owned by the\n * template so it can expose the same intentionally shareable shape as the\n * public page, not a generic raw database row.\n */\n agentReadable?:\n | false\n | {\n /** Token scope. Include the app name to avoid cross-app collisions. */\n resourceKind: string;\n /** App-relative JSON endpoint that accepts `id` + `agent_access`. */\n getContextPath: (resource: any) => string | undefined;\n /** Optional override for the page URL. Defaults to getResourcePath. */\n getPagePath?: (resource: any) => string | undefined;\n /** Optional override for the default two-hour token lifetime. */\n ttlSeconds?: number;\n };\n}\n\n// Stash the registry on globalThis so it survives SSR bundle duplication.\n// Vite SSR's `noExternal: /^(?!node:)/` policy means @agent-native/core gets\n// inlined into every server bundle that imports it — and each bundle gets its\n// own module-level state. A plain `new Map()` here would create one Map per\n// bundle, so the template's `registerShareableResource()` (called from the\n// Nitro plugin graph) wouldn't be visible to the framework's auto-mounted\n// share-resource action (loaded via `import(\"../sharing/actions/...js\")` in a\n// different module instance). Using globalThis collapses them back to one Map.\nconst REGISTRY_KEY = \"__agentNativeShareableResources__\";\ntype RegistryStore = Map<string, ShareableResourceRegistration>;\nconst globalRegistry: { [K in typeof REGISTRY_KEY]?: RegistryStore } =\n globalThis as any;\n\nfunction isTestRuntime(): boolean {\n return (\n process.env.NODE_ENV === \"test\" ||\n process.env.VITEST === \"true\" ||\n process.env.VITEST === \"1\"\n );\n}\n\nfunction registrationCameFromTestFile(): boolean {\n const stack = new Error().stack ?? \"\";\n return /[./\\\\](?:[^/\\\\]+[.-])(?:test|spec)\\.[cm]?[jt]sx?(?::\\d+)?(?::\\d+)?/.test(\n stack,\n );\n}\n\nfunction getRegistry(): RegistryStore {\n let r = globalRegistry[REGISTRY_KEY];\n if (!r) {\n r = new Map<string, ShareableResourceRegistration>();\n globalRegistry[REGISTRY_KEY] = r;\n }\n return r;\n}\n\nexport function registerShareableResource(\n entry: ShareableResourceRegistration,\n): void {\n if (!isTestRuntime() && registrationCameFromTestFile()) return;\n getRegistry().set(entry.type, entry);\n}\n\nexport function getShareableResource(\n type: string,\n): ShareableResourceRegistration | undefined {\n return getRegistry().get(type);\n}\n\nexport function requireShareableResource(\n type: string,\n): ShareableResourceRegistration {\n const reg = getRegistry();\n const entry = reg.get(type);\n if (!entry) {\n throw new Error(\n `Unknown shareable resource type: \"${type}\". Did you forget registerShareableResource()?`,\n );\n }\n return entry;\n}\n\nexport function listShareableResources(): ShareableResourceRegistration[] {\n return Array.from(getRegistry().values());\n}\n"]}
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/sharing/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAsHH,0EAA0E;AAC1E,6EAA6E;AAC7E,8EAA8E;AAC9E,4EAA4E;AAC5E,2EAA2E;AAC3E,0EAA0E;AAC1E,8EAA8E;AAC9E,+EAA+E;AAC/E,MAAM,YAAY,GAAG,mCAAmC,CAAC;AAEzD,MAAM,cAAc,GAClB,UAAiB,CAAC;AAEpB,SAAS,aAAa;IACpB,OAAO,CACL,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM;QAC/B,OAAO,CAAC,GAAG,CAAC,MAAM,KAAK,MAAM;QAC7B,OAAO,CAAC,GAAG,CAAC,MAAM,KAAK,GAAG,CAC3B,CAAC;AACJ,CAAC;AAED,SAAS,4BAA4B;IACnC,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC;IACtC,OAAO,oEAAoE,CAAC,IAAI,CAC9E,KAAK,CACN,CAAC;AACJ,CAAC;AAED,SAAS,WAAW;IAClB,IAAI,CAAC,GAAG,cAAc,CAAC,YAAY,CAAC,CAAC;IACrC,IAAI,CAAC,CAAC,EAAE,CAAC;QACP,CAAC,GAAG,IAAI,GAAG,EAAyC,CAAC;QACrD,cAAc,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,KAAoC;IAEpC,IAAI,CAAC,aAAa,EAAE,IAAI,4BAA4B,EAAE;QAAE,OAAO;IAC/D,WAAW,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,IAAY;IAEZ,OAAO,WAAW,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,IAAY;IAEZ,MAAM,GAAG,GAAG,WAAW,EAAE,CAAC;IAC1B,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACb,qCAAqC,IAAI,gDAAgD,CAC1F,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,sBAAsB;IACpC,OAAO,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["/**\n * Registry of shareable resources.\n *\n * Each template registers its ownable resource(s) once on module load so the\n * framework-level share actions (`share-resource`, `list-resource-shares`,\n * etc.) can dispatch to the correct tables.\n *\n * import { registerShareableResource } from \"@agent-native/core/sharing\";\n * import * as schema from \"./schema.js\";\n *\n * registerShareableResource({\n * type: \"document\",\n * resourceTable: schema.documents,\n * sharesTable: schema.documentShares,\n * displayName: \"Document\",\n * titleColumn: \"title\",\n * });\n */\n\nexport interface ShareableResourceRegistration {\n /** Stable identifier used across actions, UI, and analytics. e.g. \"document\". */\n type: string;\n /** Drizzle table for the parent resource (must have ownableColumns()). */\n resourceTable: any;\n /** Drizzle table produced by createSharesTable(). */\n sharesTable: any;\n /** Human-readable singular label shown in the share dialog. */\n displayName: string;\n /**\n * Column on the resource table that holds a human-readable title for\n * display in the share UI. Default: \"title\".\n */\n titleColumn?: string;\n /**\n * Optional app-relative path to this resource. Used by share notifications\n * when the caller does not pass a more specific resourceUrl.\n */\n getResourcePath?: (resource: any) => string | undefined;\n /**\n * Drizzle DB accessor from the template's server/db/index.ts. Required —\n * the framework-level share actions and access helpers call this to reach\n * the right DB instance (schema is template-specific).\n */\n getDb: () => any;\n /**\n * When `false`, `visibility: \"public\"` is rejected by `set-resource-visibility`,\n * and `accessFilter` / `resolveAccess` treat any stored public row as private\n * (defense in depth — only owner + explicit shares grant access).\n *\n * Use this for resources that execute code or expose privileged data and must\n * never be reachable by a random authenticated user. Extensions set this:\n * extension HTML runs inside an iframe that calls actions / DB / proxied APIs\n * as the *viewer*, so a public extension would be arbitrary code with the\n * viewer's credentials.\n *\n * Default: `true` (matches the historical behavior — most resources can be public).\n */\n allowPublic?: boolean;\n /**\n * Optional role granted by a public-by-link read. Most resources should omit\n * this so public visibility remains viewer-only. Use narrowly for local or\n * otherwise constrained resources where the resource owner intentionally wants\n * unauthenticated link holders to do more than view.\n *\n * When this is a function, it may read arbitrary fields on the resource row\n * (not just the ownership/visibility columns). Because of that,\n * `resolveAccess`/`assertAccess`'s opt-in `{ skipResourceBody: true }`\n * projected load (see `access.ts`) is automatically ignored for this\n * registration and always loads the full row instead — a fixed role string\n * has no such requirement and is compatible with the projection.\n */\n publicAccessRole?:\n | \"viewer\"\n | \"editor\"\n | \"admin\"\n | ((\n resource: any,\n ctx: { userEmail?: string; orgId?: string },\n ) =>\n | \"viewer\"\n | \"editor\"\n | \"admin\"\n | Promise<\"viewer\" | \"editor\" | \"admin\">);\n /**\n * When `true`, individual user shares (`principalType: \"user\"`) must target\n * an email that is already a member of the same org as the resource, OR has\n * a pending invitation to that org. Cross-org user shares are rejected.\n *\n * Pair with `allowPublic: false` for resources that need a hard \"this org\n * only\" trust boundary. Extensions set this so a malicious caller can't\n * widen reach by sharing a code-executing extension to an outsider email.\n *\n * Default: `false` (matches the historical behavior — any email can be granted).\n */\n requireOrgMemberForUserShares?: boolean;\n /**\n * Optional per-resource access-context adapter. Most resources should use the\n * request user/org unchanged. Templates with an intentional alternate local\n * identity can normalize here so the generic framework sharing actions and\n * access helpers stay in sync with template-owned actions.\n */\n resolveAccessContext?: (ctx: { userEmail?: string; orgId?: string }) => {\n userEmail?: string;\n orgId?: string;\n };\n /**\n * When true, direct ownership is recognized by owner_email regardless of the\n * caller's active org. Use this only for resource types where the template's\n * own actions already treat owner_email as the cross-org authority and list\n * views add their own org filters.\n *\n * Default: `false`.\n */\n ownerAccessIgnoresOrg?: boolean;\n /**\n * Optional external-agent read handoff. When set, the framework-level\n * `create-agent-resource-link` action can mint a short-lived, read-only\n * `agent_access` URL for this resource. The context endpoint is owned by the\n * template so it can expose the same intentionally shareable shape as the\n * public page, not a generic raw database row.\n */\n agentReadable?:\n | false\n | {\n /** Token scope. Include the app name to avoid cross-app collisions. */\n resourceKind: string;\n /** App-relative JSON endpoint that accepts `id` + `agent_access`. */\n getContextPath: (resource: any) => string | undefined;\n /** Optional override for the page URL. Defaults to getResourcePath. */\n getPagePath?: (resource: any) => string | undefined;\n /** Optional override for the default two-hour token lifetime. */\n ttlSeconds?: number;\n };\n}\n\n// Stash the registry on globalThis so it survives SSR bundle duplication.\n// Vite SSR's `noExternal: /^(?!node:)/` policy means @agent-native/core gets\n// inlined into every server bundle that imports it — and each bundle gets its\n// own module-level state. A plain `new Map()` here would create one Map per\n// bundle, so the template's `registerShareableResource()` (called from the\n// Nitro plugin graph) wouldn't be visible to the framework's auto-mounted\n// share-resource action (loaded via `import(\"../sharing/actions/...js\")` in a\n// different module instance). Using globalThis collapses them back to one Map.\nconst REGISTRY_KEY = \"__agentNativeShareableResources__\";\ntype RegistryStore = Map<string, ShareableResourceRegistration>;\nconst globalRegistry: { [K in typeof REGISTRY_KEY]?: RegistryStore } =\n globalThis as any;\n\nfunction isTestRuntime(): boolean {\n return (\n process.env.NODE_ENV === \"test\" ||\n process.env.VITEST === \"true\" ||\n process.env.VITEST === \"1\"\n );\n}\n\nfunction registrationCameFromTestFile(): boolean {\n const stack = new Error().stack ?? \"\";\n return /[./\\\\](?:[^/\\\\]+[.-])(?:test|spec)\\.[cm]?[jt]sx?(?::\\d+)?(?::\\d+)?/.test(\n stack,\n );\n}\n\nfunction getRegistry(): RegistryStore {\n let r = globalRegistry[REGISTRY_KEY];\n if (!r) {\n r = new Map<string, ShareableResourceRegistration>();\n globalRegistry[REGISTRY_KEY] = r;\n }\n return r;\n}\n\nexport function registerShareableResource(\n entry: ShareableResourceRegistration,\n): void {\n if (!isTestRuntime() && registrationCameFromTestFile()) return;\n getRegistry().set(entry.type, entry);\n}\n\nexport function getShareableResource(\n type: string,\n): ShareableResourceRegistration | undefined {\n return getRegistry().get(type);\n}\n\nexport function requireShareableResource(\n type: string,\n): ShareableResourceRegistration {\n const reg = getRegistry();\n const entry = reg.get(type);\n if (!entry) {\n throw new Error(\n `Unknown shareable resource type: \"${type}\". Did you forget registerShareableResource()?`,\n );\n }\n return entry;\n}\n\nexport function listShareableResources(): ShareableResourceRegistration[] {\n return Array.from(getRegistry().values());\n}\n"]}
@@ -109,8 +109,7 @@
109
109
  .agent-layout-left-drawer[data-collapsed] {
110
110
  overflow: clip;
111
111
  width: var(--agent-layout-left-drawer-width, auto);
112
- will-change: width;
113
- transition: width 260ms cubic-bezier(0.32, 0.72, 0, 1);
112
+ transition: width 260ms var(--ease-drawer);
114
113
  }
115
114
 
116
115
  .agent-layout-left-drawer[data-collapsed="true"] {
@@ -151,9 +150,9 @@
151
150
  container: agent-native-main / inline-size;
152
151
  background: var(--agent-native-raised-surface);
153
152
  transition:
154
- border-radius 260ms cubic-bezier(0.32, 0.72, 0, 1),
155
- border-color 260ms cubic-bezier(0.32, 0.72, 0, 1),
156
- box-shadow 260ms cubic-bezier(0.32, 0.72, 0, 1);
153
+ border-radius 260ms var(--ease-drawer),
154
+ border-color 260ms var(--ease-drawer),
155
+ box-shadow 260ms var(--ease-drawer);
157
156
  }
158
157
 
159
158
  .agent-native-app-main {
@@ -235,8 +234,7 @@
235
234
  .agent-sidebar-panel[data-agent-sidebar-animation="desktop"] {
236
235
  width: 0;
237
236
  overflow: clip;
238
- will-change: width;
239
- transition: width 260ms cubic-bezier(0.32, 0.72, 0, 1);
237
+ transition: width 260ms var(--ease-drawer);
240
238
  }
241
239
 
242
240
  .agent-sidebar-panel[data-agent-sidebar-animation="desktop"][data-agent-sidebar-state="open"] {
@@ -251,7 +249,7 @@
251
249
  height: 100%;
252
250
  transform: var(--agent-sidebar-inner-closed-transform, translateX(100%));
253
251
  will-change: transform;
254
- transition: transform 260ms cubic-bezier(0.32, 0.72, 0, 1);
252
+ transition: transform 260ms var(--ease-drawer);
255
253
  }
256
254
 
257
255
  .agent-sidebar-panel[data-agent-sidebar-animation="desktop"][data-agent-sidebar-state="open"]
@@ -265,7 +263,7 @@
265
263
  translateX(calc(100% + 1px))
266
264
  );
267
265
  will-change: transform;
268
- transition: transform 260ms cubic-bezier(0.32, 0.72, 0, 1);
266
+ transition: transform 260ms var(--ease-drawer);
269
267
  }
270
268
 
271
269
  .agent-sidebar-panel[data-agent-sidebar-animation="mobile"][data-agent-sidebar-state="open"] {
@@ -357,6 +355,9 @@
357
355
  --animate-accordion-down: accordion-down 0.2s ease-out;
358
356
  --animate-accordion-up: accordion-up 0.2s ease-out;
359
357
  --animate-bounce-once: bounce-once 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
358
+ --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
359
+ --ease-collapse: cubic-bezier(0.2, 0, 0, 1);
360
+ --ease-out-strong: cubic-bezier(0.23, 1, 0.32, 1);
360
361
 
361
362
  @keyframes accordion-down {
362
363
  from {
@@ -516,9 +517,9 @@
516
517
  clip-path: inset(0);
517
518
  interpolate-size: allow-keywords;
518
519
  transition:
519
- height 200ms cubic-bezier(0.2, 0, 0, 1),
520
+ height 200ms var(--ease-collapse),
520
521
  opacity 150ms ease,
521
- clip-path 200ms cubic-bezier(0.2, 0, 0, 1);
522
+ clip-path 200ms var(--ease-collapse);
522
523
  }
523
524
 
524
525
  .agent-native-settings-section-body[data-state="closed"] {
@@ -541,9 +542,9 @@
541
542
  height: auto;
542
543
  max-height: 64rem;
543
544
  transition:
544
- max-height 200ms cubic-bezier(0.2, 0, 0, 1),
545
+ max-height 200ms var(--ease-collapse),
545
546
  opacity 150ms ease,
546
- clip-path 200ms cubic-bezier(0.2, 0, 0, 1);
547
+ clip-path 200ms var(--ease-collapse);
547
548
  }
548
549
 
549
550
  .agent-native-settings-section-body[data-state="closed"] {
@@ -553,7 +554,7 @@
553
554
 
554
555
  @media (prefers-reduced-motion: reduce) {
555
556
  .agent-native-settings-section-body {
556
- transition: none;
557
+ transition: opacity 150ms ease;
557
558
  }
558
559
  }
559
560
 
@@ -48,7 +48,7 @@ Default to Apple/Linear-level restraint: make the primary workflow obvious, then
48
48
 
49
49
  - **Typography**: Use the product's existing type system first. For net-new public pages, choose characterful but readable type and keep sizing appropriate to the surface.
50
50
  - **Color and theme**: Use semantic tokens and CSS variables. Avoid one-note palettes and default purple/blue gradients unless the brand demands them.
51
- - **Motion**: Prefer purposeful transitions and small state changes. Use CSS transitions/keyframes unless the app already uses a motion library.
51
+ - **Motion**: Prefer purposeful transitions and small state changes. Use CSS transitions/keyframes unless the app already uses a motion library. Never `transition-all` — list the properties that actually change (e.g. `transition-[opacity,transform]`). Use the shared easing tokens defined in `packages/core/src/styles/agent-native.css` instead of hand-typing curves: `var(--ease-drawer)` (260ms, drawers/app chrome), `var(--ease-collapse)` (200ms, expand/collapse), `var(--ease-out-strong)` (snappy entrances) — in Tailwind, `ease-[var(--ease-collapse)]`. Enter/exit with ease-out, never `ease-in`. Overlays that zoom in must set the Radix origin var (e.g. `origin-[--radix-popover-content-transform-origin]`). Animate `transform`/`opacity`, not width/height/padding/box-shadow. Gate looping or large-movement animations with `motion-reduce:`. Command palettes and keyboard-triggered actions get no animation.
52
52
  - **Composition**: Match the workflow. Operational apps should be dense and scannable; marketing or portfolio pages can be more immersive.
53
53
  - **Visual assets**: Websites, games, and object-focused pages need real or generated media when images help users understand the subject.
54
54
  - **Responsive fit**: Text must not overflow buttons, cards, tabs, sidebars, or fixed-format tools. Use stable dimensions for boards, grids, toolbars, and counters.
@@ -391,6 +391,12 @@ const messages = {
391
391
  contentLabel: "المحتوى",
392
392
  previewTitle: "معاينة الامتداد",
393
393
  previewEmpty: "ستظهر المعاينة هنا",
394
+ loadError: "تعذر تحميل الإضافات.",
395
+ widgetsLoadError: "تعذر تحميل الأدوات.",
396
+ widgetAreasLoadError: "تعذر تحميل مناطق الأدوات.",
397
+ historyLoadError: "تعذر تحميل سجل الإضافة.",
398
+ versionLoadError: "تعذر تحميل إصدار الإضافة هذا.",
399
+ retry: "إعادة المحاولة",
394
400
  },
395
401
  org: {
396
402
  createTitle: "قم بإنشاء مؤسستك",
@@ -378,6 +378,12 @@ const messages = {
378
378
  contentLabel: "Inhalt",
379
379
  previewTitle: "Erweiterungsvorschau",
380
380
  previewEmpty: "Hier wird eine Vorschau angezeigt",
381
+ loadError: "Erweiterungen konnten nicht geladen werden.",
382
+ widgetsLoadError: "Widgets konnten nicht geladen werden.",
383
+ widgetAreasLoadError: "Widget-Bereiche konnten nicht geladen werden.",
384
+ historyLoadError: "Der Erweiterungsverlauf konnte nicht geladen werden.",
385
+ versionLoadError: "Diese Erweiterungsversion konnte nicht geladen werden.",
386
+ retry: "Erneut versuchen",
381
387
  },
382
388
  org: {
383
389
  createTitle: "Erstellen Sie Ihre Organisation",
@@ -369,6 +369,12 @@ const messages = {
369
369
  contentLabel: "Content",
370
370
  previewTitle: "Extension preview",
371
371
  previewEmpty: "Preview will appear here",
372
+ loadError: "Couldn't load extensions.",
373
+ widgetsLoadError: "Couldn't load widgets.",
374
+ widgetAreasLoadError: "Couldn't load widget areas.",
375
+ historyLoadError: "Couldn't load extension history.",
376
+ versionLoadError: "Couldn't load this extension version.",
377
+ retry: "Retry",
372
378
  },
373
379
  org: {
374
380
  createTitle: "Create your organization",
@@ -385,6 +385,12 @@ const messages = {
385
385
  contentLabel: "Contenido",
386
386
  previewTitle: "Vista previa de la extensión",
387
387
  previewEmpty: "La vista previa aparecerá aquí",
388
+ loadError: "No se pudieron cargar las extensiones.",
389
+ widgetsLoadError: "No se pudieron cargar los widgets.",
390
+ widgetAreasLoadError: "No se pudieron cargar las áreas de widgets.",
391
+ historyLoadError: "No se pudo cargar el historial de la extensión.",
392
+ versionLoadError: "No se pudo cargar esta versión de la extensión.",
393
+ retry: "Reintentar",
388
394
  },
389
395
  org: {
390
396
  createTitle: "Crea tu organización",
@@ -383,6 +383,12 @@ const messages = {
383
383
  contentLabel: "Contenu",
384
384
  previewTitle: "Aperçu des extensions",
385
385
  previewEmpty: "L'aperçu apparaîtra ici",
386
+ loadError: "Impossible de charger les extensions.",
387
+ widgetsLoadError: "Impossible de charger les widgets.",
388
+ widgetAreasLoadError: "Impossible de charger les zones de widgets.",
389
+ historyLoadError: "Impossible de charger l'historique de l'extension.",
390
+ versionLoadError: "Impossible de charger cette version de l'extension.",
391
+ retry: "Réessayer",
386
392
  },
387
393
  org: {
388
394
  createTitle: "Créez votre organisation",
@@ -365,6 +365,12 @@ const messages = {
365
365
  contentLabel: "कॉन्टेंट",
366
366
  previewTitle: "एक्सटेंशन पूर्वावलोकन",
367
367
  previewEmpty: "पूर्वावलोकन यहां दिखाई देगा",
368
+ loadError: "एक्सटेंशन लोड नहीं हो सके।",
369
+ widgetsLoadError: "विजेट लोड नहीं हो सके।",
370
+ widgetAreasLoadError: "विजेट क्षेत्र लोड नहीं हो सके।",
371
+ historyLoadError: "एक्सटेंशन इतिहास लोड नहीं हो सका।",
372
+ versionLoadError: "यह एक्सटेंशन संस्करण लोड नहीं हो सका।",
373
+ retry: "पुनः प्रयास करें",
368
374
  },
369
375
  org: {
370
376
  createTitle: "अपना संगठन बनाएं",
@@ -370,6 +370,12 @@ const messages = {
370
370
  contentLabel: "コンテンツ",
371
371
  previewTitle: "拡張機能のプレビュー",
372
372
  previewEmpty: "ここにプレビューが表示されます",
373
+ loadError: "拡張機能を読み込めませんでした。",
374
+ widgetsLoadError: "ウィジェットを読み込めませんでした。",
375
+ widgetAreasLoadError: "ウィジェット領域を読み込めませんでした。",
376
+ historyLoadError: "拡張機能の履歴を読み込めませんでした。",
377
+ versionLoadError: "この拡張機能のバージョンを読み込めませんでした。",
378
+ retry: "再試行",
373
379
  },
374
380
  org: {
375
381
  createTitle: "組織を作成する",
@@ -363,6 +363,12 @@ const messages = {
363
363
  contentLabel: "콘텐츠",
364
364
  previewTitle: "확장 프로그램 미리보기",
365
365
  previewEmpty: "미리보기가 여기에 표시됩니다.",
366
+ loadError: "확장 프로그램을 불러올 수 없습니다.",
367
+ widgetsLoadError: "위젯을 불러올 수 없습니다.",
368
+ widgetAreasLoadError: "위젯 영역을 불러올 수 없습니다.",
369
+ historyLoadError: "확장 프로그램 기록을 불러올 수 없습니다.",
370
+ versionLoadError: "이 확장 프로그램 버전을 불러올 수 없습니다.",
371
+ retry: "다시 시도",
366
372
  },
367
373
  org: {
368
374
  createTitle: "조직 만들기",
@@ -382,6 +382,12 @@ const messages = {
382
382
  contentLabel: "Conteúdo",
383
383
  previewTitle: "Visualização da extensão",
384
384
  previewEmpty: "A visualização aparecerá aqui",
385
+ loadError: "Não foi possível carregar as extensões.",
386
+ widgetsLoadError: "Não foi possível carregar os widgets.",
387
+ widgetAreasLoadError: "Não foi possível carregar as áreas de widgets.",
388
+ historyLoadError: "Não foi possível carregar o histórico da extensão.",
389
+ versionLoadError: "Não foi possível carregar esta versão da extensão.",
390
+ retry: "Tentar novamente",
385
391
  },
386
392
  org: {
387
393
  createTitle: "Crie sua organização",
@@ -352,6 +352,12 @@ const messages = {
352
352
  contentLabel: "内容",
353
353
  previewTitle: "扩展预览",
354
354
  previewEmpty: "预览将出现在这里",
355
+ loadError: "无法加载扩展。",
356
+ widgetsLoadError: "无法加载小部件。",
357
+ widgetAreasLoadError: "无法加载小部件区域。",
358
+ historyLoadError: "无法加载扩展历史记录。",
359
+ versionLoadError: "无法加载此扩展版本。",
360
+ retry: "重试",
355
361
  },
356
362
  org: {
357
363
  createTitle: "创建您的组织",
@@ -350,6 +350,12 @@ const messages = {
350
350
  contentLabel: "內容",
351
351
  previewTitle: "擴充功能預覽",
352
352
  previewEmpty: "預覽將出現在這裡",
353
+ loadError: "無法載入擴充功能。",
354
+ widgetsLoadError: "無法載入小工具。",
355
+ widgetAreasLoadError: "無法載入小工具區域。",
356
+ historyLoadError: "無法載入擴充功能歷史記錄。",
357
+ versionLoadError: "無法載入此擴充功能版本。",
358
+ retry: "重試",
353
359
  },
354
360
  org: {
355
361
  createTitle: "建立您的組織",
@@ -7,6 +7,7 @@
7
7
  "build": "agent-native build",
8
8
  "start": "agent-native start",
9
9
  "typecheck": "agent-native typecheck",
10
+ "doctor": "agent-native doctor",
10
11
  "action": "agent-native action",
11
12
  "script": "agent-native script",
12
13
  "skills:update": "agent-native skills update scaffold --project",
@@ -43,8 +44,7 @@
43
44
  "tailwind-merge": "^3.5.0",
44
45
  "tailwindcss": "^4.1.18",
45
46
  "tsx": "^4.20.3",
46
- "typescript": "catalog:",
47
47
  "typescript-7": "catalog:",
48
- "vite": "^8.0.0"
48
+ "vite": "8.1.0"
49
49
  }
50
50
  }
@@ -19,7 +19,6 @@
19
19
  "@types/node": "^24.2.1",
20
20
  "oxfmt": "catalog:",
21
21
  "tsx": "^4.20.3",
22
- "typescript": "catalog:",
23
22
  "typescript-7": "catalog:"
24
23
  }
25
24
  }
@@ -77,6 +77,9 @@ SQL to the caller — they never leak another tenant's rows:
77
77
  (`agent` | `human` | `system`), `status`, `threadId`/`turnId`, `action`,
78
78
  `sinceMs`, `limit`.
79
79
  - `get-audit-event` — one event by id, with its redacted input payload.
80
+ - `export-audit-events` — bulk CSV/NDJSON export (same filters minus `limit`,
81
+ plus `format` and `maxRows`) for offline/compliance pulls; itself audited
82
+ via `onRead`.
80
83
 
81
84
  Call them from the UI with `useActionQuery` to build an activity feed or a
82
85
  "who changed this" line — never hand-write a fetch to the audit table.
@@ -13,7 +13,7 @@ metadata:
13
13
 
14
14
  ## Rule
15
15
 
16
- Auth is powered by **Better Auth** with account-first design. Every new user creates an account on first visit. Use `getSession(event)` to authenticate custom routes; actions are auto-protected.
16
+ Auth is powered by **Better Auth** with account-first design. Every new user creates an account on first visit. Use `getSession(event)` to authenticate custom routes; actions are auto-protected. Normal app HTML and React Router page-data responses are one impersonal, public-cacheable shell for every visitor. The client decides whether to render private UI or redirect to sign-in.
17
17
 
18
18
  ## Auth Modes
19
19
 
@@ -43,8 +43,9 @@ and `/.well-known/oauth-authorization-server`, dynamically register a public
43
43
  client, and complete authorization-code + PKCE at
44
44
  `/_agent-native/mcp/oauth/authorize` / `/_agent-native/mcp/oauth/token`.
45
45
  Access tokens are audience-bound to the exact MCP URL and carry user/org
46
- identity plus `mcp:read`, `mcp:write`, and/or `mcp:apps`; refresh tokens are
47
- stored hashed and rotate. Keep `ACCESS_TOKEN` and `pnpm exec agent-native connect` for
46
+ identity plus `mcp:read`, `mcp:write`, `mcp:apps`, and/or `offline_access`;
47
+ advertising `offline_access` lets hosts such as ChatGPT retain refresh access.
48
+ Refresh tokens are stored hashed and rotate. Keep `ACCESS_TOKEN` and `pnpm exec agent-native connect` for
48
49
  local stdio proxying and fallback clients. The CLI
49
50
  uses the OAuth-native URL-only entry for Claude Code/Claude Code CLI by
50
51
  default; use the Connect page or `npx @agent-native/core@latest connect --token <token>` when a
@@ -129,44 +130,41 @@ window.location.href =
129
130
  "/_agent-native/sign-in?return=" + encodeURIComponent(ret);
130
131
  ```
131
132
 
132
- After successful sign-in (token / email-password / Google OAuth), the framework 302s to `return`. The path is validated as same-origin via the URL parser — open-redirect / header-injection inputs fall back to `/`.
133
+ After successful sign-in (token / email-password / Google OAuth), the framework redirects to `return`. The path is validated as same-origin via the URL parser — open-redirect / header-injection inputs fall back to `/`.
133
134
 
134
- Bookmarked private paths already work _when the request reaches the server_ the auth guard serves the login page at the requested URL and post-login reload returns the user there.
135
+ Bookmarked private paths work through the client session gate: the shared shell hydrates, `AppProviders` redirects the signed-out visitor to the framework sign-in entrypoint with the current path as `return`, and successful sign-in sends them back.
135
136
 
136
137
  ## Gating the App Shell (avoid the logged-out infinite spinner)
137
138
 
138
- The server auth guard only protects requests that actually reach the Nitro
139
- function. A statically-served / CDN-cached SPA shell, or a client-side (React
140
- Router) navigation made after the session expired, never re-hits the guard — so
141
- the app boots with **no session**, every data query 401s, and the UI sticks on
142
- its loading state forever. Server-side protection alone is not enough; gate on
143
- the client too.
139
+ Normal app HTML and React Router page-data responses deliberately bypass the
140
+ server session guard. They are rendered impersonally and cached as one shared
141
+ shell; APIs, actions, and framework data routes remain server-protected. The
142
+ client session gate is therefore the authoritative decision point for whether
143
+ private app UI renders.
144
144
 
145
- For a fully private app (every page requires auth, like mail), wrap the routed
146
- shell with the framework's `RequireSession`. It resolves the session on the
147
- client and redirects signed-out visitors to `/_agent-native/sign-in?return=…`
148
- instead of spinning:
145
+ `AppProviders` applies `RequireSession` automatically on its private branch. It
146
+ resolves the session on the client and redirects signed-out visitors to
147
+ `/_agent-native/sign-in?return=…` before mounting the routed shell:
149
148
 
150
149
  ```tsx
151
- import { AppProviders, RequireSession } from "@agent-native/core/client";
150
+ import { AppProviders } from "@agent-native/core/client";
152
151
 
153
152
  <AppProviders queryClient={queryClient}>
154
- <RequireSession bypass={isMcpEmbedSurface()}>
155
- <AppLayout>
156
- <Outlet />
157
- </AppLayout>
158
- </RequireSession>
153
+ <AppLayout>
154
+ <Outlet />
155
+ </AppLayout>
159
156
  </AppProviders>;
160
157
  ```
161
158
 
162
- - Place it **inside** `AppProviders` (so the loading fallback is themed) and
163
- **around** the layout/outlet also around any always-mounted effects (poll,
164
- automation trigger) so they don't fire 401s for logged-out visitors.
165
- - Pass `bypass` for surfaces that authenticate by another mechanism (embed /
166
- popout iframes carrying their own token) so they are never bounced to sign-in.
167
- - Apps with public/anonymous routes (share pages) must **not** wrap the whole
168
- app gate only the private subtree, or use the `redirect={false}` +
169
- `signedOut` props to render an inline call-to-action instead of redirecting.
159
+ - Keep the layout/outlet and always-mounted effects (poll, automation trigger)
160
+ inside `AppProviders` so they do not fire 401s before the gate resolves.
161
+ - Pass `sessionBypass` to `AppProviders` only for a private-looking surface that
162
+ authenticates by another mechanism (for example, an embed iframe carrying
163
+ its own scoped token).
164
+ - Pass `isPublicPath` for public/anonymous and SEO routes. That branch does not
165
+ mount `RequireSession` and SSRs real content.
166
+ - Use `RequireSession` directly only when a nested subtree needs custom
167
+ `redirect={false}` / `signedOut` behavior.
170
168
 
171
169
  ## Related Skills
172
170
 
@@ -61,7 +61,7 @@ Use the web-request tool with ${keys.SLACK_WEBHOOK}.
61
61
  | `triggerType` | `"schedule" \| "event"` | How the automation fires |
62
62
  | `event` | `string?` | Event name to subscribe to (event triggers) |
63
63
  | `condition` | `string?` | Natural-language condition evaluated before dispatch |
64
- | `mode` | `"agentic" \| "deterministic"` | Full agent loop vs. fixed action set |
64
+ | `mode` | `"agentic"` | Full agent loop (only supported mode; `"deterministic"` was removed never implemented, rejected at define time) |
65
65
  | `model` | `string?` | Override the model for this trigger's agent loop |
66
66
  | `domain` | `string?` | Grouping tag (mail, calendar, clips, etc.) |
67
67
  | `createdBy` | `string?` | Owner email |