@agent-native/core 0.14.8 → 0.15.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 (420) hide show
  1. package/README.md +1 -1
  2. package/dist/agent/engine/builder-engine.d.ts.map +1 -1
  3. package/dist/agent/engine/builder-engine.js +30 -9
  4. package/dist/agent/engine/builder-engine.js.map +1 -1
  5. package/dist/agent/engine/registry.d.ts.map +1 -1
  6. package/dist/agent/engine/registry.js +14 -4
  7. package/dist/agent/engine/registry.js.map +1 -1
  8. package/dist/agent/production-agent.d.ts.map +1 -1
  9. package/dist/agent/production-agent.js +71 -4
  10. package/dist/agent/production-agent.js.map +1 -1
  11. package/dist/agent/types.d.ts +9 -0
  12. package/dist/agent/types.d.ts.map +1 -1
  13. package/dist/agent/types.js.map +1 -1
  14. package/dist/appearance/actions/change-appearance.d.ts +3 -0
  15. package/dist/appearance/actions/change-appearance.d.ts.map +1 -0
  16. package/dist/appearance/actions/change-appearance.js +29 -0
  17. package/dist/appearance/actions/change-appearance.js.map +1 -0
  18. package/dist/chat-threads/store.d.ts +53 -2
  19. package/dist/chat-threads/store.d.ts.map +1 -1
  20. package/dist/chat-threads/store.js +172 -12
  21. package/dist/chat-threads/store.js.map +1 -1
  22. package/dist/cli/create.d.ts.map +1 -1
  23. package/dist/cli/create.js +114 -37
  24. package/dist/cli/create.js.map +1 -1
  25. package/dist/cli/index.js +30 -4
  26. package/dist/cli/index.js.map +1 -1
  27. package/dist/cli/workspace-dev.d.ts +25 -1
  28. package/dist/cli/workspace-dev.d.ts.map +1 -1
  29. package/dist/cli/workspace-dev.js +275 -49
  30. package/dist/cli/workspace-dev.js.map +1 -1
  31. package/dist/client/AgentPanel.d.ts +23 -4
  32. package/dist/client/AgentPanel.d.ts.map +1 -1
  33. package/dist/client/AgentPanel.js +276 -53
  34. package/dist/client/AgentPanel.js.map +1 -1
  35. package/dist/client/AppearancePicker.d.ts +11 -0
  36. package/dist/client/AppearancePicker.d.ts.map +1 -0
  37. package/dist/client/AppearancePicker.js +16 -0
  38. package/dist/client/AppearancePicker.js.map +1 -0
  39. package/dist/client/AssistantChat.d.ts +35 -0
  40. package/dist/client/AssistantChat.d.ts.map +1 -1
  41. package/dist/client/AssistantChat.js +315 -32
  42. package/dist/client/AssistantChat.js.map +1 -1
  43. package/dist/client/ConnectBuilderCard.d.ts.map +1 -1
  44. package/dist/client/ConnectBuilderCard.js +5 -2
  45. package/dist/client/ConnectBuilderCard.js.map +1 -1
  46. package/dist/client/ErrorBoundary.d.ts.map +1 -1
  47. package/dist/client/ErrorBoundary.js +8 -10
  48. package/dist/client/ErrorBoundary.js.map +1 -1
  49. package/dist/client/FeedbackButton.d.ts.map +1 -1
  50. package/dist/client/FeedbackButton.js +1 -1
  51. package/dist/client/FeedbackButton.js.map +1 -1
  52. package/dist/client/MultiTabAssistantChat.d.ts +13 -1
  53. package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
  54. package/dist/client/MultiTabAssistantChat.js +217 -38
  55. package/dist/client/MultiTabAssistantChat.js.map +1 -1
  56. package/dist/client/NewWorkspaceAppFlow.d.ts.map +1 -1
  57. package/dist/client/NewWorkspaceAppFlow.js +37 -14
  58. package/dist/client/NewWorkspaceAppFlow.js.map +1 -1
  59. package/dist/client/agent-chat-adapter.d.ts +5 -0
  60. package/dist/client/agent-chat-adapter.d.ts.map +1 -1
  61. package/dist/client/agent-chat-adapter.js +4 -0
  62. package/dist/client/agent-chat-adapter.js.map +1 -1
  63. package/dist/client/agent-sidebar-state.d.ts +12 -0
  64. package/dist/client/agent-sidebar-state.d.ts.map +1 -1
  65. package/dist/client/agent-sidebar-state.js +8 -0
  66. package/dist/client/agent-sidebar-state.js.map +1 -1
  67. package/dist/client/analytics.d.ts.map +1 -1
  68. package/dist/client/analytics.js +175 -3
  69. package/dist/client/analytics.js.map +1 -1
  70. package/dist/client/appearance.d.ts +40 -0
  71. package/dist/client/appearance.d.ts.map +1 -0
  72. package/dist/client/appearance.js +114 -0
  73. package/dist/client/appearance.js.map +1 -0
  74. package/dist/client/builder-frame.d.ts +1 -0
  75. package/dist/client/builder-frame.d.ts.map +1 -1
  76. package/dist/client/builder-frame.js +19 -9
  77. package/dist/client/builder-frame.js.map +1 -1
  78. package/dist/client/components/CodeRequiredDialog.d.ts.map +1 -1
  79. package/dist/client/components/CodeRequiredDialog.js +10 -2
  80. package/dist/client/components/CodeRequiredDialog.js.map +1 -1
  81. package/dist/client/components/ui/dropdown-menu.js +2 -2
  82. package/dist/client/components/ui/dropdown-menu.js.map +1 -1
  83. package/dist/client/components/ui/hover-card.js +1 -1
  84. package/dist/client/components/ui/hover-card.js.map +1 -1
  85. package/dist/client/components/ui/popover.js +1 -1
  86. package/dist/client/components/ui/popover.js.map +1 -1
  87. package/dist/client/composer/PromptComposer.d.ts +7 -0
  88. package/dist/client/composer/PromptComposer.d.ts.map +1 -1
  89. package/dist/client/composer/PromptComposer.js +63 -32
  90. package/dist/client/composer/PromptComposer.js.map +1 -1
  91. package/dist/client/composer/TiptapComposer.d.ts +5 -0
  92. package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
  93. package/dist/client/composer/TiptapComposer.js +36 -6
  94. package/dist/client/composer/TiptapComposer.js.map +1 -1
  95. package/dist/client/composer/useVoiceDictation.d.ts.map +1 -1
  96. package/dist/client/composer/useVoiceDictation.js +13 -1
  97. package/dist/client/composer/useVoiceDictation.js.map +1 -1
  98. package/dist/client/error-format.d.ts +3 -2
  99. package/dist/client/error-format.d.ts.map +1 -1
  100. package/dist/client/error-format.js +9 -2
  101. package/dist/client/error-format.js.map +1 -1
  102. package/dist/client/extensions/ExtensionViewer.d.ts.map +1 -1
  103. package/dist/client/extensions/ExtensionViewer.js +24 -2
  104. package/dist/client/extensions/ExtensionViewer.js.map +1 -1
  105. package/dist/client/index.d.ts +8 -1
  106. package/dist/client/index.d.ts.map +1 -1
  107. package/dist/client/index.js +7 -0
  108. package/dist/client/index.js.map +1 -1
  109. package/dist/client/onboarding/OnboardingPanel.js +1 -0
  110. package/dist/client/onboarding/OnboardingPanel.js.map +1 -1
  111. package/dist/client/org/InvitationBanner.d.ts.map +1 -1
  112. package/dist/client/org/InvitationBanner.js +23 -2
  113. package/dist/client/org/InvitationBanner.js.map +1 -1
  114. package/dist/client/org/OrgSwitcher.d.ts +5 -4
  115. package/dist/client/org/OrgSwitcher.d.ts.map +1 -1
  116. package/dist/client/org/OrgSwitcher.js +57 -9
  117. package/dist/client/org/OrgSwitcher.js.map +1 -1
  118. package/dist/client/org/hooks.d.ts.map +1 -1
  119. package/dist/client/org/hooks.js +10 -6
  120. package/dist/client/org/hooks.js.map +1 -1
  121. package/dist/client/org/workspace-app-links.d.ts +31 -0
  122. package/dist/client/org/workspace-app-links.d.ts.map +1 -0
  123. package/dist/client/org/workspace-app-links.js +268 -0
  124. package/dist/client/org/workspace-app-links.js.map +1 -0
  125. package/dist/client/resources/ResourcesPanel.d.ts.map +1 -1
  126. package/dist/client/resources/ResourcesPanel.js +18 -5
  127. package/dist/client/resources/ResourcesPanel.js.map +1 -1
  128. package/dist/client/resources/use-resources.d.ts +18 -13
  129. package/dist/client/resources/use-resources.d.ts.map +1 -1
  130. package/dist/client/resources/use-resources.js +24 -6
  131. package/dist/client/resources/use-resources.js.map +1 -1
  132. package/dist/client/settings/BackgroundAgentSection.d.ts.map +1 -1
  133. package/dist/client/settings/BackgroundAgentSection.js +9 -1
  134. package/dist/client/settings/BackgroundAgentSection.js.map +1 -1
  135. package/dist/client/settings/BrowserSection.d.ts.map +1 -1
  136. package/dist/client/settings/BrowserSection.js +16 -1
  137. package/dist/client/settings/BrowserSection.js.map +1 -1
  138. package/dist/client/settings/SettingsPanel.d.ts.map +1 -1
  139. package/dist/client/settings/SettingsPanel.js +4 -1
  140. package/dist/client/settings/SettingsPanel.js.map +1 -1
  141. package/dist/client/settings/VoiceTranscriptionSection.d.ts.map +1 -1
  142. package/dist/client/settings/VoiceTranscriptionSection.js +5 -5
  143. package/dist/client/settings/VoiceTranscriptionSection.js.map +1 -1
  144. package/dist/client/settings/useBuilderStatus.d.ts +8 -0
  145. package/dist/client/settings/useBuilderStatus.d.ts.map +1 -1
  146. package/dist/client/settings/useBuilderStatus.js +50 -13
  147. package/dist/client/settings/useBuilderStatus.js.map +1 -1
  148. package/dist/client/settings/useBuilderStatus.spec.d.ts +2 -0
  149. package/dist/client/settings/useBuilderStatus.spec.d.ts.map +1 -0
  150. package/dist/client/settings/useBuilderStatus.spec.js +64 -0
  151. package/dist/client/settings/useBuilderStatus.spec.js.map +1 -0
  152. package/dist/client/sharing/ShareButton.d.ts +5 -0
  153. package/dist/client/sharing/ShareButton.d.ts.map +1 -1
  154. package/dist/client/sharing/ShareButton.js +60 -6
  155. package/dist/client/sharing/ShareButton.js.map +1 -1
  156. package/dist/client/theme.js +1 -1
  157. package/dist/client/theme.js.map +1 -1
  158. package/dist/client/transcription/BuilderTranscriptionCta.d.ts.map +1 -1
  159. package/dist/client/transcription/BuilderTranscriptionCta.js +2 -3
  160. package/dist/client/transcription/BuilderTranscriptionCta.js.map +1 -1
  161. package/dist/client/use-change-version.d.ts +46 -0
  162. package/dist/client/use-change-version.d.ts.map +1 -0
  163. package/dist/client/use-change-version.js +135 -0
  164. package/dist/client/use-change-version.js.map +1 -0
  165. package/dist/client/use-chat-threads.d.ts +16 -2
  166. package/dist/client/use-chat-threads.d.ts.map +1 -1
  167. package/dist/client/use-chat-threads.js +87 -12
  168. package/dist/client/use-chat-threads.js.map +1 -1
  169. package/dist/client/use-chat-threads.spec.d.ts +2 -0
  170. package/dist/client/use-chat-threads.spec.d.ts.map +1 -0
  171. package/dist/client/use-chat-threads.spec.js +85 -0
  172. package/dist/client/use-chat-threads.spec.js.map +1 -0
  173. package/dist/client/use-db-sync.d.ts +5 -2
  174. package/dist/client/use-db-sync.d.ts.map +1 -1
  175. package/dist/client/use-db-sync.js +41 -16
  176. package/dist/client/use-db-sync.js.map +1 -1
  177. package/dist/client/use-pinch-zoom.d.ts +35 -0
  178. package/dist/client/use-pinch-zoom.d.ts.map +1 -0
  179. package/dist/client/use-pinch-zoom.js +105 -0
  180. package/dist/client/use-pinch-zoom.js.map +1 -0
  181. package/dist/deploy/workspace-deploy.d.ts.map +1 -1
  182. package/dist/deploy/workspace-deploy.js +99 -5
  183. package/dist/deploy/workspace-deploy.js.map +1 -1
  184. package/dist/extensions/actions.d.ts.map +1 -1
  185. package/dist/extensions/actions.js +3 -0
  186. package/dist/extensions/actions.js.map +1 -1
  187. package/dist/extensions/store.d.ts +5 -0
  188. package/dist/extensions/store.d.ts.map +1 -1
  189. package/dist/extensions/store.js +16 -1
  190. package/dist/extensions/store.js.map +1 -1
  191. package/dist/file-upload/actions/upload-image.d.ts +3 -0
  192. package/dist/file-upload/actions/upload-image.d.ts.map +1 -0
  193. package/dist/file-upload/actions/upload-image.js +145 -0
  194. package/dist/file-upload/actions/upload-image.js.map +1 -0
  195. package/dist/file-upload/builder.d.ts.map +1 -1
  196. package/dist/file-upload/builder.js +31 -11
  197. package/dist/file-upload/builder.js.map +1 -1
  198. package/dist/file-upload/index.d.ts +1 -0
  199. package/dist/file-upload/index.d.ts.map +1 -1
  200. package/dist/file-upload/index.js +1 -0
  201. package/dist/file-upload/index.js.map +1 -1
  202. package/dist/file-upload/pre-upload-attachments.d.ts +39 -0
  203. package/dist/file-upload/pre-upload-attachments.d.ts.map +1 -0
  204. package/dist/file-upload/pre-upload-attachments.js +110 -0
  205. package/dist/file-upload/pre-upload-attachments.js.map +1 -0
  206. package/dist/file-upload/registry.d.ts.map +1 -1
  207. package/dist/file-upload/registry.js +8 -7
  208. package/dist/file-upload/registry.js.map +1 -1
  209. package/dist/onboarding/default-steps.js +1 -1
  210. package/dist/onboarding/default-steps.js.map +1 -1
  211. package/dist/org/context.d.ts +15 -1
  212. package/dist/org/context.d.ts.map +1 -1
  213. package/dist/org/context.js +25 -0
  214. package/dist/org/context.js.map +1 -1
  215. package/dist/org/handlers.d.ts +2 -2
  216. package/dist/org/handlers.d.ts.map +1 -1
  217. package/dist/org/handlers.js +3 -17
  218. package/dist/org/handlers.js.map +1 -1
  219. package/dist/org/index.d.ts +1 -1
  220. package/dist/org/index.d.ts.map +1 -1
  221. package/dist/org/index.js +1 -1
  222. package/dist/org/index.js.map +1 -1
  223. package/dist/resources/handlers.d.ts +6 -0
  224. package/dist/resources/handlers.d.ts.map +1 -1
  225. package/dist/resources/handlers.js +30 -6
  226. package/dist/resources/handlers.js.map +1 -1
  227. package/dist/resources/script-helpers.d.ts +11 -2
  228. package/dist/resources/script-helpers.d.ts.map +1 -1
  229. package/dist/resources/script-helpers.js +20 -3
  230. package/dist/resources/script-helpers.js.map +1 -1
  231. package/dist/resources/store.d.ts +28 -3
  232. package/dist/resources/store.d.ts.map +1 -1
  233. package/dist/resources/store.js +170 -20
  234. package/dist/resources/store.js.map +1 -1
  235. package/dist/scripts/resources/list.d.ts +1 -1
  236. package/dist/scripts/resources/list.d.ts.map +1 -1
  237. package/dist/scripts/resources/list.js +16 -4
  238. package/dist/scripts/resources/list.js.map +1 -1
  239. package/dist/scripts/resources/write.d.ts +1 -1
  240. package/dist/scripts/resources/write.d.ts.map +1 -1
  241. package/dist/scripts/resources/write.js +47 -3
  242. package/dist/scripts/resources/write.js.map +1 -1
  243. package/dist/server/action-discovery.d.ts.map +1 -1
  244. package/dist/server/action-discovery.js +8 -3
  245. package/dist/server/action-discovery.js.map +1 -1
  246. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  247. package/dist/server/agent-chat-plugin.js +214 -25
  248. package/dist/server/agent-chat-plugin.js.map +1 -1
  249. package/dist/server/agent-discovery.d.ts +35 -0
  250. package/dist/server/agent-discovery.d.ts.map +1 -1
  251. package/dist/server/agent-discovery.js +139 -8
  252. package/dist/server/agent-discovery.js.map +1 -1
  253. package/dist/server/app-url.d.ts +12 -6
  254. package/dist/server/app-url.d.ts.map +1 -1
  255. package/dist/server/app-url.js +58 -11
  256. package/dist/server/app-url.js.map +1 -1
  257. package/dist/server/auth.d.ts +22 -0
  258. package/dist/server/auth.d.ts.map +1 -1
  259. package/dist/server/auth.js +272 -59
  260. package/dist/server/auth.js.map +1 -1
  261. package/dist/server/better-auth-instance.d.ts +0 -4
  262. package/dist/server/better-auth-instance.d.ts.map +1 -1
  263. package/dist/server/better-auth-instance.js +0 -3
  264. package/dist/server/better-auth-instance.js.map +1 -1
  265. package/dist/server/builder-browser.d.ts.map +1 -1
  266. package/dist/server/builder-browser.js +23 -0
  267. package/dist/server/builder-browser.js.map +1 -1
  268. package/dist/server/core-routes-plugin.d.ts.map +1 -1
  269. package/dist/server/core-routes-plugin.js +29 -14
  270. package/dist/server/core-routes-plugin.js.map +1 -1
  271. package/dist/server/credential-provider.d.ts +14 -0
  272. package/dist/server/credential-provider.d.ts.map +1 -1
  273. package/dist/server/credential-provider.js +88 -11
  274. package/dist/server/credential-provider.js.map +1 -1
  275. package/dist/server/google-auth-plugin.d.ts.map +1 -1
  276. package/dist/server/google-auth-plugin.js +53 -13
  277. package/dist/server/google-auth-plugin.js.map +1 -1
  278. package/dist/server/google-oauth.d.ts.map +1 -1
  279. package/dist/server/google-oauth.js +47 -17
  280. package/dist/server/google-oauth.js.map +1 -1
  281. package/dist/server/index.d.ts +1 -1
  282. package/dist/server/index.d.ts.map +1 -1
  283. package/dist/server/index.js +1 -1
  284. package/dist/server/index.js.map +1 -1
  285. package/dist/server/oauth-public-origin.d.ts.map +1 -1
  286. package/dist/server/oauth-public-origin.js +19 -1
  287. package/dist/server/oauth-public-origin.js.map +1 -1
  288. package/dist/server/onboarding-html.d.ts.map +1 -1
  289. package/dist/server/onboarding-html.js +62 -15
  290. package/dist/server/onboarding-html.js.map +1 -1
  291. package/dist/server/poll.d.ts.map +1 -1
  292. package/dist/server/poll.js +20 -5
  293. package/dist/server/poll.js.map +1 -1
  294. package/dist/server/request-context.d.ts +8 -0
  295. package/dist/server/request-context.d.ts.map +1 -1
  296. package/dist/server/request-context.js.map +1 -1
  297. package/dist/shared/index.d.ts +2 -0
  298. package/dist/shared/index.d.ts.map +1 -1
  299. package/dist/shared/index.js +2 -0
  300. package/dist/shared/index.js.map +1 -1
  301. package/dist/shared/llm-connection.d.ts +10 -0
  302. package/dist/shared/llm-connection.d.ts.map +1 -0
  303. package/dist/shared/llm-connection.js +29 -0
  304. package/dist/shared/llm-connection.js.map +1 -0
  305. package/dist/shared/workspace-app-audience.d.ts +25 -0
  306. package/dist/shared/workspace-app-audience.d.ts.map +1 -0
  307. package/dist/shared/workspace-app-audience.js +126 -0
  308. package/dist/shared/workspace-app-audience.js.map +1 -0
  309. package/dist/shared/workspace-app-id.d.ts +1 -1
  310. package/dist/shared/workspace-app-id.d.ts.map +1 -1
  311. package/dist/shared/workspace-app-id.js +1 -0
  312. package/dist/shared/workspace-app-id.js.map +1 -1
  313. package/dist/sharing/access.d.ts.map +1 -1
  314. package/dist/sharing/access.js +46 -5
  315. package/dist/sharing/access.js.map +1 -1
  316. package/dist/sharing/actions/list-resource-shares.d.ts.map +1 -1
  317. package/dist/sharing/actions/list-resource-shares.js +8 -1
  318. package/dist/sharing/actions/list-resource-shares.js.map +1 -1
  319. package/dist/sharing/actions/set-resource-visibility.d.ts.map +1 -1
  320. package/dist/sharing/actions/set-resource-visibility.js +12 -3
  321. package/dist/sharing/actions/set-resource-visibility.js.map +1 -1
  322. package/dist/sharing/actions/share-resource.d.ts.map +1 -1
  323. package/dist/sharing/actions/share-resource.js +50 -1
  324. package/dist/sharing/actions/share-resource.js.map +1 -1
  325. package/dist/sharing/registry.d.ts +26 -0
  326. package/dist/sharing/registry.d.ts.map +1 -1
  327. package/dist/sharing/registry.js.map +1 -1
  328. package/dist/styles/agent-native.css +91 -0
  329. package/dist/templates/default/.agents/skills/adding-a-feature/SKILL.md +72 -0
  330. package/dist/templates/default/.agents/skills/frontend-design/SKILL.md +60 -37
  331. package/dist/templates/default/.agents/skills/real-time-sync/SKILL.md +28 -17
  332. package/dist/templates/default/.agents/skills/shadcn-ui/SKILL.md +79 -0
  333. package/dist/templates/default/AGENTS.md +22 -19
  334. package/dist/templates/default/actions/navigate.ts +3 -0
  335. package/dist/templates/default/app/hooks/use-navigation-state.ts +29 -5
  336. package/dist/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +251 -0
  337. package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +264 -0
  338. package/dist/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +130 -0
  339. package/dist/templates/workspace-core/.agents/skills/address-feedback/SKILL.md +112 -0
  340. package/dist/templates/workspace-core/.agents/skills/authentication/SKILL.md +88 -0
  341. package/dist/templates/workspace-core/.agents/skills/automations/SKILL.md +191 -0
  342. package/dist/templates/workspace-core/.agents/skills/capture-learnings/SKILL.md +74 -0
  343. package/dist/templates/workspace-core/.agents/skills/client-side-routing/SKILL.md +75 -0
  344. package/dist/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +190 -0
  345. package/dist/templates/workspace-core/.agents/skills/create-skill/SKILL.md +168 -0
  346. package/dist/templates/workspace-core/.agents/skills/delegate-to-agent/SKILL.md +163 -0
  347. package/dist/templates/workspace-core/.agents/skills/extension-points/SKILL.md +205 -0
  348. package/dist/templates/workspace-core/.agents/skills/extensions/SKILL.md +720 -0
  349. package/dist/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +92 -0
  350. package/dist/templates/workspace-core/.agents/skills/integration-webhooks/SKILL.md +285 -0
  351. package/dist/templates/workspace-core/.agents/skills/observability/SKILL.md +192 -0
  352. package/dist/templates/workspace-core/.agents/skills/onboarding/SKILL.md +43 -0
  353. package/dist/templates/workspace-core/.agents/skills/portability/SKILL.md +84 -0
  354. package/dist/templates/workspace-core/.agents/skills/qa/SKILL.md +313 -0
  355. package/dist/templates/workspace-core/.agents/skills/real-time-collab/SKILL.md +112 -0
  356. package/dist/templates/workspace-core/.agents/skills/real-time-sync/SKILL.md +165 -0
  357. package/dist/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +41 -0
  358. package/dist/templates/workspace-core/.agents/skills/secrets/SKILL.md +239 -0
  359. package/dist/templates/workspace-core/.agents/skills/security/SKILL.md +191 -0
  360. package/dist/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +79 -0
  361. package/dist/templates/workspace-core/.agents/skills/server-plugins/SKILL.md +73 -0
  362. package/dist/templates/workspace-core/.agents/skills/shadcn-ui/SKILL.md +79 -0
  363. package/dist/templates/workspace-core/.agents/skills/sharing/SKILL.md +217 -0
  364. package/dist/templates/workspace-core/.agents/skills/storing-data/SKILL.md +132 -0
  365. package/dist/templates/workspace-core/.agents/skills/tracking/SKILL.md +150 -0
  366. package/dist/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +124 -0
  367. package/dist/templates/workspace-core/AGENTS.md +16 -1
  368. package/dist/templates/workspace-root/AGENTS.md +35 -0
  369. package/dist/templates/workspace-root/README.md +7 -0
  370. package/dist/vite/action-types-plugin.d.ts.map +1 -1
  371. package/dist/vite/action-types-plugin.js +4 -0
  372. package/dist/vite/action-types-plugin.js.map +1 -1
  373. package/docs/content/authentication.md +36 -0
  374. package/docs/content/creating-templates.md +15 -0
  375. package/docs/content/dispatch.md +3 -3
  376. package/docs/content/multi-app-workspace.md +5 -0
  377. package/docs/content/tracking.md +12 -0
  378. package/docs/content/workspace-management.md +39 -4
  379. package/package.json +15 -12
  380. package/src/templates/default/.agents/skills/adding-a-feature/SKILL.md +72 -0
  381. package/src/templates/default/.agents/skills/frontend-design/SKILL.md +60 -37
  382. package/src/templates/default/.agents/skills/real-time-sync/SKILL.md +28 -17
  383. package/src/templates/default/.agents/skills/shadcn-ui/SKILL.md +79 -0
  384. package/src/templates/default/AGENTS.md +22 -19
  385. package/src/templates/default/actions/navigate.ts +3 -0
  386. package/src/templates/default/app/hooks/use-navigation-state.ts +29 -5
  387. package/src/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +251 -0
  388. package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +264 -0
  389. package/src/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +130 -0
  390. package/src/templates/workspace-core/.agents/skills/address-feedback/SKILL.md +112 -0
  391. package/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +88 -0
  392. package/src/templates/workspace-core/.agents/skills/automations/SKILL.md +191 -0
  393. package/src/templates/workspace-core/.agents/skills/capture-learnings/SKILL.md +74 -0
  394. package/src/templates/workspace-core/.agents/skills/client-side-routing/SKILL.md +75 -0
  395. package/src/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +190 -0
  396. package/src/templates/workspace-core/.agents/skills/create-skill/SKILL.md +168 -0
  397. package/src/templates/workspace-core/.agents/skills/delegate-to-agent/SKILL.md +163 -0
  398. package/src/templates/workspace-core/.agents/skills/extension-points/SKILL.md +205 -0
  399. package/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +720 -0
  400. package/src/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +92 -0
  401. package/src/templates/workspace-core/.agents/skills/integration-webhooks/SKILL.md +285 -0
  402. package/src/templates/workspace-core/.agents/skills/observability/SKILL.md +192 -0
  403. package/src/templates/workspace-core/.agents/skills/onboarding/SKILL.md +43 -0
  404. package/src/templates/workspace-core/.agents/skills/portability/SKILL.md +84 -0
  405. package/src/templates/workspace-core/.agents/skills/qa/SKILL.md +313 -0
  406. package/src/templates/workspace-core/.agents/skills/real-time-collab/SKILL.md +112 -0
  407. package/src/templates/workspace-core/.agents/skills/real-time-sync/SKILL.md +165 -0
  408. package/src/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +41 -0
  409. package/src/templates/workspace-core/.agents/skills/secrets/SKILL.md +239 -0
  410. package/src/templates/workspace-core/.agents/skills/security/SKILL.md +191 -0
  411. package/src/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +79 -0
  412. package/src/templates/workspace-core/.agents/skills/server-plugins/SKILL.md +73 -0
  413. package/src/templates/workspace-core/.agents/skills/shadcn-ui/SKILL.md +79 -0
  414. package/src/templates/workspace-core/.agents/skills/sharing/SKILL.md +217 -0
  415. package/src/templates/workspace-core/.agents/skills/storing-data/SKILL.md +132 -0
  416. package/src/templates/workspace-core/.agents/skills/tracking/SKILL.md +150 -0
  417. package/src/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +124 -0
  418. package/src/templates/workspace-core/AGENTS.md +16 -1
  419. package/src/templates/workspace-root/AGENTS.md +35 -0
  420. package/src/templates/workspace-root/README.md +7 -0
@@ -28,14 +28,17 @@ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuShortc
28
28
  import { IconMessageCircle, IconMessageDots, IconTerminal2, IconSettings, IconLayoutSidebarRightCollapse, IconLayoutGrid, IconCheck, IconPlus, IconX, IconDotsVertical, IconHistory, IconArrowsMaximize, IconArrowsMinimize, IconExternalLink, } from "@tabler/icons-react";
29
29
  import { FeedbackButton } from "./FeedbackButton.js";
30
30
  import { MultiTabAssistantChat, } from "./MultiTabAssistantChat.js";
31
+ import { isAssistantUiStaleIndexError, } from "./AssistantChat.js";
31
32
  import { useDevMode } from "./use-dev-mode.js";
32
33
  import { useScreenRefreshKey } from "./use-db-sync.js";
33
34
  import { useQuery, useQueryClient } from "@tanstack/react-query";
34
35
  import { useLocation, useNavigate } from "react-router";
35
36
  import { cn } from "./utils.js";
36
37
  import { agentNativePath } from "./api-path.js";
38
+ import { trackEvent } from "./analytics.js";
37
39
  import { getFrameOrigin, isInFrame, isTrustedFrameMessage } from "./frame.js";
38
- import { getInitialAgentSidebarOpen, SIDEBAR_OPEN_KEY, } from "./agent-sidebar-state.js";
40
+ import { shouldParentFrameOwnAgentPanel } from "./builder-frame.js";
41
+ import { dispatchAgentSidebarStateChange, getInitialAgentSidebarOpen, SIDEBAR_OPEN_KEY, } from "./agent-sidebar-state.js";
39
42
  // Lazy-load AgentTerminal to avoid bundling xterm.js when not needed
40
43
  const AgentTerminal = lazy(() => import("./terminal/index.js").then((m) => ({ default: m.AgentTerminal })));
41
44
  function parentFrameTargetOrigin() {
@@ -126,21 +129,94 @@ function IconTooltip({ content, children, }) {
126
129
  }
127
130
  function useBuilderConnectUrl() {
128
131
  const [connectUrl, setConnectUrl] = useState(null);
132
+ const [configured, setConfigured] = useState(false);
129
133
  useEffect(() => {
130
134
  let cancelled = false;
131
- fetch(agentNativePath("/_agent-native/builder/status"))
132
- .then((res) => (res.ok ? res.json() : null))
133
- .then((data) => {
134
- if (!cancelled && data?.connectUrl) {
135
- setConnectUrl(data.connectUrl);
136
- }
137
- })
138
- .catch(() => { });
135
+ // Track previous configured state so we only fanout the
136
+ // `agent-engine:configured-changed` event on a real false→true
137
+ // transition. Without this, every `/builder/status` response with
138
+ // `configured: true` dispatched the event, our own `onConfigured`
139
+ // listener caught it (because we both fire AND listen on the same
140
+ // global), refresh fired again, and we'd loop forever.
141
+ let lastConfigured = false;
142
+ const refresh = () => {
143
+ fetch(agentNativePath("/_agent-native/builder/status"))
144
+ .then((res) => (res.ok ? res.json() : null))
145
+ .then((data) => {
146
+ if (cancelled || !data)
147
+ return;
148
+ if (data.connectUrl)
149
+ setConnectUrl(data.connectUrl);
150
+ const nextConfigured = !!data.configured;
151
+ setConfigured(nextConfigured);
152
+ if (nextConfigured && !lastConfigured) {
153
+ lastConfigured = true;
154
+ // Tell other listeners (the agent panel's "Use Builder" CTA
155
+ // lives in a different React tree than the connect-flow popup
156
+ // poller, so a fresh status read here is the only thing that
157
+ // flips its UI). Dispatch only on transition so listeners
158
+ // that share this hook don't bounce the event back here.
159
+ window.dispatchEvent(new CustomEvent("agent-engine:configured-changed", {
160
+ detail: { source: "builder-status" },
161
+ }));
162
+ }
163
+ else if (!nextConfigured) {
164
+ lastConfigured = false;
165
+ }
166
+ })
167
+ .catch(() => { });
168
+ };
169
+ refresh();
170
+ // The "Use Builder" CTA opens Builder in a `<a target="_blank">` tab
171
+ // (not a popup), so the previous one-shot fetch never noticed the
172
+ // connect succeeded when the user came back to the original tab.
173
+ const onFocus = () => refresh();
174
+ const onVisibility = () => {
175
+ if (document.visibilityState === "visible")
176
+ refresh();
177
+ };
178
+ const onConfigured = (e) => {
179
+ // Ignore our own dispatch — refresh() already wrote the new state.
180
+ // Other dispatchers (the connect-flow popup poller, an external
181
+ // tab that completed connect, etc.) get the refresh they need.
182
+ const detail = e.detail;
183
+ if (detail?.source === "builder-status")
184
+ return;
185
+ refresh();
186
+ };
187
+ window.addEventListener("focus", onFocus);
188
+ document.addEventListener("visibilitychange", onVisibility);
189
+ window.addEventListener("agent-engine:configured-changed", onConfigured);
190
+ let channel = null;
191
+ try {
192
+ channel = new BroadcastChannel(`builder-connect:${window.location.host}`);
193
+ channel.onmessage = (e) => {
194
+ const data = e.data;
195
+ if (data?.type === "builder-connect-success")
196
+ refresh();
197
+ };
198
+ }
199
+ catch {
200
+ // BroadcastChannel missing — focus/visibility refresh still covers it.
201
+ }
202
+ const onMessage = (e) => {
203
+ if (e.origin !== window.location.origin)
204
+ return;
205
+ const data = e.data;
206
+ if (data?.type === "builder-connect-success")
207
+ refresh();
208
+ };
209
+ window.addEventListener("message", onMessage);
139
210
  return () => {
140
211
  cancelled = true;
212
+ window.removeEventListener("focus", onFocus);
213
+ document.removeEventListener("visibilitychange", onVisibility);
214
+ window.removeEventListener("agent-engine:configured-changed", onConfigured);
215
+ window.removeEventListener("message", onMessage);
216
+ channel?.close();
141
217
  };
142
218
  }, []);
143
- return connectUrl;
219
+ return { connectUrl, configured };
144
220
  }
145
221
  function useClientOnly() {
146
222
  const [mounted, setMounted] = useState(false);
@@ -148,11 +224,18 @@ function useClientOnly() {
148
224
  return mounted;
149
225
  }
150
226
  function CodeAccessUnavailablePanel({ title, description, ctaLabel, ctaHref, secondaryCtaLabel = "Use Builder", secondaryCtaHref, compact = false, }) {
151
- const builderConnectUrl = useBuilderConnectUrl();
227
+ const { connectUrl: builderConnectUrl } = useBuilderConnectUrl();
152
228
  const builderHref = secondaryCtaHref ?? builderConnectUrl ?? "https://builder.io";
153
- return (_jsxs("div", { className: cn("rounded-lg border border-border bg-muted/35 text-center", compact ? "mx-3 mt-2 px-3 py-2.5" : "max-w-[300px] px-4 py-4"), children: [_jsx("div", { className: cn("mx-auto flex items-center justify-center rounded-full bg-background text-muted-foreground", compact ? "mb-2 h-8 w-8" : "mb-3 h-10 w-10"), children: _jsx(IconTerminal2, { className: compact ? "h-4 w-4" : "h-5 w-5" }) }), _jsx("p", { className: "text-sm font-medium text-foreground", children: title }), _jsx("p", { className: cn("mt-1 text-muted-foreground", compact ? "text-[11px] leading-snug" : "text-xs leading-relaxed"), children: description }), _jsxs("div", { className: "mt-3 flex flex-wrap items-center justify-center gap-2", children: [ctaHref ? (_jsxs("a", { href: ctaHref, target: "_blank", rel: "noreferrer", className: "inline-flex items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs font-medium text-background hover:opacity-90", children: [ctaLabel, _jsx(IconExternalLink, { className: "h-3 w-3" })] })) : null, _jsxs("a", { href: builderHref, target: "_blank", rel: "noreferrer", className: "inline-flex items-center gap-1.5 rounded-md border border-border bg-background px-3 py-1.5 text-xs font-medium text-foreground hover:bg-accent", children: [secondaryCtaLabel, _jsx(IconExternalLink, { className: "h-3 w-3" })] })] })] }));
229
+ return (_jsxs("div", { className: cn("rounded-lg border border-border bg-muted/35 text-center", compact ? "mx-3 mt-2 px-3 py-2.5" : "max-w-[300px] px-4 py-4"), children: [_jsx("div", { className: cn("mx-auto flex items-center justify-center rounded-full bg-background text-muted-foreground", compact ? "mb-2 h-8 w-8" : "mb-3 h-10 w-10"), children: _jsx(IconTerminal2, { className: compact ? "h-4 w-4" : "h-5 w-5" }) }), _jsx("p", { className: "text-sm font-medium text-foreground", children: title }), _jsx("p", { className: cn("mt-1 text-muted-foreground", compact ? "text-[11px] leading-snug" : "text-xs leading-relaxed"), children: description }), _jsxs("div", { className: "mt-3 flex flex-wrap items-center justify-center gap-2", children: [ctaHref ? (_jsxs("a", { href: ctaHref, target: "_blank", rel: "noreferrer", className: "inline-flex items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs font-medium text-background hover:opacity-90", children: [ctaLabel, _jsx(IconExternalLink, { className: "h-3 w-3" })] })) : null, _jsxs("a", { href: builderHref, target: "_blank", rel: "noreferrer", onClick: () => {
230
+ trackEvent("builder connect clicked", {
231
+ feature: "builder",
232
+ stage: "client",
233
+ source: "code_access_unavailable_panel",
234
+ connect_url_kind: builderConnectUrl ? "provided" : "fallback",
235
+ });
236
+ }, className: "inline-flex items-center gap-1.5 rounded-md border border-border bg-background px-3 py-1.5 text-xs font-medium text-foreground hover:bg-accent", children: [secondaryCtaLabel, _jsx(IconExternalLink, { className: "h-3 w-3" })] })] })] }));
154
237
  }
155
- function AgentPanelInner({ defaultMode = "chat", className, apiUrl, emptyStateText, suggestions, showHeader = true, onCollapse, isFullscreen, onToggleFullscreen, devAppUrl, storageKey, chatNotice, codeAccess, }) {
238
+ function AgentPanelInner({ defaultMode = "chat", className, apiUrl, emptyStateText, suggestions, showHeader = true, onCollapse, isFullscreen, onToggleFullscreen, devAppUrl, storageKey, scope, browserTabId, chatNotice, codeAccess, }) {
156
239
  const mounted = useClientOnly();
157
240
  const keyPrefix = storageKey ? `:${storageKey}` : "";
158
241
  const execModeKey = `${EXEC_MODE_KEY}${keyPrefix}`;
@@ -269,9 +352,10 @@ function AgentPanelInner({ defaultMode = "chat", className, apiUrl, emptyStateTe
269
352
  // Tab close shortcuts. Avoid Cmd+W (browser/OS) and (on Windows) Ctrl+W.
270
353
  // Mac: Ctrl+W → close tab, Ctrl+Alt+W → close all
271
354
  // Windows/Linux: Alt+W → close tab, Ctrl+Alt+W → close all
355
+ // Use e.code (physical key) — on Mac, Alt+W inserts ∑ and e.key isn't "w".
272
356
  useEffect(() => {
273
357
  const handleKeyDown = (e) => {
274
- if (e.key.toLowerCase() !== "w" || e.metaKey || e.shiftKey)
358
+ if (e.code !== "KeyW" || e.metaKey || e.shiftKey)
275
359
  return;
276
360
  const isCloseAll = e.ctrlKey && e.altKey;
277
361
  const isCloseOne = isMac
@@ -303,7 +387,7 @@ function AgentPanelInner({ defaultMode = "chat", className, apiUrl, emptyStateTe
303
387
  const codeAccessEnabled = codeAccess?.enabled ?? inferredCodeAccessEnabled;
304
388
  const codeUnavailableTitle = codeAccess?.unavailableTitle ?? "Open Desktop to edit code";
305
389
  const codeUnavailableDescription = codeAccess?.unavailableDescription ??
306
- "Source-code changes, workspace files, and CLI access are available in the Agent Native Desktop app.";
390
+ "Source-code changes and CLI access are available in the Agent Native Desktop app.";
307
391
  const codeUnavailableCtaLabel = codeAccess?.unavailableCtaLabel ?? "Download Desktop";
308
392
  const codeUnavailableCtaHref = codeAccess?.unavailableCtaHref ?? "https://www.agent-native.com/download";
309
393
  const codeUnavailableSecondaryCtaLabel = codeAccess?.unavailableSecondaryCtaLabel ?? "Use Builder";
@@ -343,15 +427,13 @@ function AgentPanelInner({ defaultMode = "chat", className, apiUrl, emptyStateTe
343
427
  ? "bg-accent text-foreground"
344
428
  : "text-muted-foreground hover:bg-accent/50 hover:text-foreground"), style: AGENT_PANEL_CONTROL_STYLE, children: [_jsx(IconMessageCircle, { size: 14 }), "Chat"] }) }), _jsx(TooltipContent, { children: "Chat mode" })] }), showCliMode && (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs("button", { onClick: () => switchMode("cli"), "aria-label": "CLI terminal mode", className: cn("flex items-center gap-1 rounded-md px-2 py-1 text-[12px] leading-none", activeMode === "cli"
345
429
  ? "bg-accent text-foreground"
346
- : "text-muted-foreground hover:bg-accent/50 hover:text-foreground"), style: AGENT_PANEL_CONTROL_STYLE, children: [_jsx(IconTerminal2, { size: 14 }), "CLI"] }) }), _jsx(TooltipContent, { children: codeAccessEnabled
430
+ : "text-muted-foreground hover:bg-accent/50 hover:text-foreground"), style: AGENT_PANEL_CONTROL_STYLE, children: [_jsx(IconTerminal2, { size: 14 }), "CLI"] }) }), _jsx(TooltipContent, { className: "max-w-[260px]", children: codeAccessEnabled
347
431
  ? "CLI terminal mode"
348
- : "Open Desktop to use CLI" })] })), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs("button", { onClick: () => switchMode("resources"), "aria-label": "Workspace files, agents, skills, and tasks", className: cn("flex items-center gap-1 rounded-md px-2 py-1 text-[12px] leading-none", activeMode === "resources"
432
+ : codeUnavailableDescription })] })), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs("button", { onClick: () => switchMode("resources"), "aria-label": "Workspace files, agents, skills, and tasks", className: cn("flex items-center gap-1 rounded-md px-2 py-1 text-[12px] leading-none", activeMode === "resources"
349
433
  ? "bg-accent text-foreground"
350
- : "text-muted-foreground hover:bg-accent/50 hover:text-foreground"), style: AGENT_PANEL_CONTROL_STYLE, children: [_jsx(IconLayoutGrid, { size: 14 }), "Workspace"] }) }), _jsx(TooltipContent, { children: codeAccessEnabled
351
- ? "Workspace files, agents, skills, and tasks"
352
- : "Open Desktop to use Workspace" })] }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { onClick: () => switchMode("settings"), "aria-label": "Setup and configuration", className: cn("flex items-center justify-center rounded-md px-1.5 py-1", activeMode === "settings"
434
+ : "text-muted-foreground hover:bg-accent/50 hover:text-foreground"), style: AGENT_PANEL_CONTROL_STYLE, children: [_jsx(IconLayoutGrid, { size: 14 }), "Workspace"] }) }), _jsx(TooltipContent, { children: "Workspace files, agents, skills, and tasks" })] }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { onClick: () => switchMode("settings"), "aria-label": "Setup and configuration", className: cn("flex items-center justify-center rounded-md px-1.5 py-1", activeMode === "settings"
353
435
  ? "bg-accent text-foreground"
354
- : "text-muted-foreground hover:bg-accent/50 hover:text-foreground"), children: _jsx(IconSettings, { size: 14 }) }) }), _jsx(TooltipContent, { children: "Setup and configuration" })] })] }) })), [codeAccessEnabled, showCliMode]);
436
+ : "text-muted-foreground hover:bg-accent/50 hover:text-foreground"), children: _jsx(IconSettings, { size: 14 }) }) }), _jsx(TooltipContent, { children: "Setup and configuration" })] })] }) })), [codeAccessEnabled, codeUnavailableDescription, showCliMode]);
355
437
  const renderHeaderActions = useCallback(() => (_jsxs("div", { className: "flex shrink-0 items-center gap-1.5", children: [SHOW_ONBOARDING && canUseCodeTools && (_jsx(Suspense, { fallback: null, children: _jsx(SetupButton, {}) })), _jsx(FeedbackButton, { variant: "icon", side: "bottom", align: "end" }), onToggleFullscreen && (_jsx(IconTooltip, { content: isFullscreen ? "Exit fullscreen" : "Fullscreen", children: _jsx("button", { onClick: onToggleFullscreen, "aria-label": isFullscreen ? "Exit fullscreen" : "Enter fullscreen", className: "flex h-6 w-6 items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent/50", children: isFullscreen ? (_jsx(IconArrowsMinimize, { size: 14 })) : (_jsx(IconArrowsMaximize, { size: 14 })) }) })), onCollapse && (_jsx(IconTooltip, { content: "Collapse sidebar", children: _jsx("button", { onClick: onCollapse, "aria-label": "Collapse sidebar", className: "flex h-6 w-6 items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent/50", children: _jsx(IconLayoutSidebarRightCollapse, { size: 14 }) }) }))] })), [onCollapse, canUseCodeTools, onToggleFullscreen, isFullscreen]);
356
438
  const [tabMenuOpen, setTabMenuOpen] = useState(null);
357
439
  const [cliPickerOpen, setCliPickerOpen] = useState(false);
@@ -471,7 +553,7 @@ function AgentPanelInner({ defaultMode = "chat", className, apiUrl, emptyStateTe
471
553
  `[data-agent-fullscreen='true'] .agent-composer-area{` +
472
554
  `max-width:${FULLSCREEN_CONTENT_MAX_PX}px;` +
473
555
  `margin-left:auto;margin-right:auto;width:100%;}`,
474
- } }), SHOW_ONBOARDING && mounted && canUseCodeTools && (_jsx(Suspense, { fallback: null, children: _jsx(OnboardingPanel, {}) })), _jsx("div", { className: cn("flex flex-col min-h-0", mode === "chat" ? "flex-1" : "shrink-0"), children: mounted && (_jsx(MultiTabAssistantChat, { apiUrl: apiUrl, showHeader: false, renderHeader: showHeader ? renderChatHeader : undefined, renderOverlay: undefined, contentHidden: mode !== "chat", emptyStateText: emptyStateText, suggestions: suggestions, onSwitchToCli: () => switchMode("cli"), execMode: execMode, onExecModeChange: switchExecMode, storageKey: storageKey })) }), canUseCodeTools
556
+ } }), SHOW_ONBOARDING && mounted && canUseCodeTools && (_jsx(Suspense, { fallback: null, children: _jsx(OnboardingPanel, {}) })), _jsx("div", { className: cn("flex flex-col min-h-0", mode === "chat" ? "flex-1" : "shrink-0"), children: mounted && (_jsx(MultiTabAssistantChat, { apiUrl: apiUrl, showHeader: false, renderHeader: showHeader ? renderChatHeader : undefined, renderOverlay: undefined, contentHidden: mode !== "chat", emptyStateText: emptyStateText, suggestions: suggestions, onSwitchToCli: () => switchMode("cli"), execMode: execMode, onExecModeChange: switchExecMode, storageKey: storageKey, scope: scope, browserTabId: browserTabId })) }), canUseCodeTools
475
557
  ? mode === "cli" &&
476
558
  cliTabs.map((id) => (_jsx("div", { className: "min-h-0 relative flex-1", style: {
477
559
  display: id === activeCliTab ? undefined : "none",
@@ -480,7 +562,7 @@ function AgentPanelInner({ defaultMode = "chat", className, apiUrl, emptyStateTe
480
562
  ? "CLI requires dev mode"
481
563
  : codeUnavailableTitle, description: codeAccessEnabled
482
564
  ? "Run this app locally with pnpm dev or use Builder.io to access the CLI terminal."
483
- : codeUnavailableDescription, ctaLabel: codeUnavailableCtaLabel, ctaHref: codeAccessEnabled ? undefined : codeUnavailableCtaHref, secondaryCtaLabel: codeUnavailableSecondaryCtaLabel, secondaryCtaHref: codeUnavailableSecondaryCtaHref }) })), mode === "resources" && (_jsx("div", { className: "flex-1 min-h-0", children: codeAccessEnabled ? (_jsx(Suspense, { fallback: _jsx("div", { className: "flex h-full flex-col min-h-0", children: _jsx("div", { className: "flex shrink-0 items-center justify-between border-b border-border px-2 py-1.5", children: _jsxs("div", { className: "flex items-center gap-1", children: [_jsx("div", { className: "h-5 w-16 rounded bg-muted animate-pulse" }), _jsx("div", { className: "h-5 w-14 rounded bg-muted animate-pulse" })] }) }) }), children: _jsx(ResourcesPanel, {}) })) : (_jsx("div", { className: "flex h-full items-center justify-center px-6", children: _jsx(CodeAccessUnavailablePanel, { title: "Open Desktop to use Workspace", description: codeUnavailableDescription, ctaLabel: codeUnavailableCtaLabel, ctaHref: codeUnavailableCtaHref, secondaryCtaLabel: codeUnavailableSecondaryCtaLabel, secondaryCtaHref: codeUnavailableSecondaryCtaHref }) })) })), mode === "settings" && (_jsx("div", { className: "flex flex-col flex-1 min-h-0", children: _jsx(Suspense, { fallback: _jsxs("div", { className: "p-3 space-y-2", children: [_jsx("div", { className: "h-10 w-full rounded-lg bg-muted animate-pulse" }), _jsx("div", { className: "h-10 w-full rounded-lg bg-muted animate-pulse" }), _jsx("div", { className: "h-10 w-full rounded-lg bg-muted animate-pulse" })] }), children: _jsx(SettingsPanel, { isDevMode: isDevMode, onToggleDevMode: () => setDevMode(!isDevMode), showDevToggle: showDevToggle, devAppUrl: devAppUrl, initialSection: settingsSection.section, sectionRequestKey: settingsSection.requestKey }) }) }))] }));
565
+ : codeUnavailableDescription, ctaLabel: codeUnavailableCtaLabel, ctaHref: codeAccessEnabled ? undefined : codeUnavailableCtaHref, secondaryCtaLabel: codeUnavailableSecondaryCtaLabel, secondaryCtaHref: codeUnavailableSecondaryCtaHref }) })), mode === "resources" && (_jsx("div", { className: "flex-1 min-h-0", children: _jsx(Suspense, { fallback: _jsx("div", { className: "flex h-full flex-col min-h-0", children: _jsx("div", { className: "flex shrink-0 items-center justify-between border-b border-border px-2 py-1.5", children: _jsxs("div", { className: "flex items-center gap-1", children: [_jsx("div", { className: "h-5 w-16 rounded bg-muted animate-pulse" }), _jsx("div", { className: "h-5 w-14 rounded bg-muted animate-pulse" })] }) }) }), children: _jsx(ResourcesPanel, {}) }) })), mode === "settings" && (_jsx("div", { className: "flex flex-col flex-1 min-h-0", children: _jsx(Suspense, { fallback: _jsxs("div", { className: "p-3 space-y-2", children: [_jsx("div", { className: "h-10 w-full rounded-lg bg-muted animate-pulse" }), _jsx("div", { className: "h-10 w-full rounded-lg bg-muted animate-pulse" }), _jsx("div", { className: "h-10 w-full rounded-lg bg-muted animate-pulse" })] }), children: _jsx(SettingsPanel, { isDevMode: isDevMode, onToggleDevMode: () => setDevMode(!isDevMode), showDevToggle: showDevToggle, devAppUrl: devAppUrl, initialSection: settingsSection.section, sectionRequestKey: settingsSection.requestKey }) }) }))] }));
484
566
  }
485
567
  // ─── Resize handle ──────────────────────────────────────────────────────────
486
568
  const SIDEBAR_STORAGE_KEY = "agent-native-sidebar-width";
@@ -593,10 +675,19 @@ function ResizeHandle({ position, onDrag, }) {
593
675
  * the command, applies it via react-router, then deletes
594
676
  * the key. The UI reacts in one tick, no page reload.
595
677
  */
596
- function URLSync() {
678
+ const SAFE_BROWSER_TAB_ID_RE = /^[A-Za-z0-9_-]{1,96}$/;
679
+ function URLSync({ browserTabId }) {
597
680
  const location = useLocation();
598
681
  const navigate = useNavigate();
599
682
  const queryClient = useQueryClient();
683
+ const normalizedBrowserTabId = React.useMemo(() => {
684
+ if (typeof browserTabId !== "string")
685
+ return undefined;
686
+ const trimmed = browserTabId.trim();
687
+ return SAFE_BROWSER_TAB_ID_RE.test(trimmed) ? trimmed : undefined;
688
+ }, [browserTabId]);
689
+ const appStateKey = React.useCallback((key) => normalizedBrowserTabId ? `${key}:${normalizedBrowserTabId}` : key, [normalizedBrowserTabId]);
690
+ const setUrlQueryKey = React.useMemo(() => ["__set_url__", normalizedBrowserTabId ?? "global"], [normalizedBrowserTabId]);
600
691
  // Outbound: write the current URL to app-state whenever it changes.
601
692
  React.useEffect(() => {
602
693
  const searchParams = {};
@@ -609,46 +700,87 @@ function URLSync() {
609
700
  hash: location.hash,
610
701
  searchParams,
611
702
  };
612
- fetch(agentNativePath("/_agent-native/application-state/__url__"), {
703
+ const write = (key) => fetch(agentNativePath(`/_agent-native/application-state/${key}`), {
613
704
  method: "PUT",
614
705
  keepalive: true,
615
706
  headers: { "Content-Type": "application/json" },
616
707
  body: JSON.stringify(body),
617
708
  }).catch(() => { });
618
- }, [location.pathname, location.search, location.hash]);
619
- // Inbound: poll for URL-update commands from the agent. We piggyback on
620
- // the same 2-second cadence useDbSync uses so there's no extra timer.
709
+ write(appStateKey("__url__"));
710
+ if (normalizedBrowserTabId)
711
+ write("__url__");
712
+ }, [
713
+ appStateKey,
714
+ location.pathname,
715
+ location.search,
716
+ location.hash,
717
+ normalizedBrowserTabId,
718
+ ]);
719
+ // Inbound: poll for URL-update commands from the agent. `useDbSync`
720
+ // invalidates this key on every relevant app-state event, so default
721
+ // `structuralSharing: true` is critical — without it, repeated reads of the
722
+ // same stale command (when the consume-DELETE below races against the next
723
+ // invalidation) churned the useEffect and re-applied the navigation in a
724
+ // tight loop. With structural sharing on, the previous reference is reused
725
+ // when the JSON is unchanged so the useEffect only fires when the command
726
+ // actually changes; the `lastProcessedDedupKeyRef` below covers the residual
727
+ // race window after the cache is cleared to `null`.
621
728
  const { data: command } = useQuery({
622
- queryKey: ["__set_url__"],
729
+ queryKey: setUrlQueryKey,
623
730
  queryFn: async () => {
624
- try {
625
- const res = await fetch(agentNativePath("/_agent-native/application-state/__set_url__"));
731
+ const read = async (key) => {
732
+ const res = await fetch(agentNativePath(`/_agent-native/application-state/${key}`));
626
733
  if (!res.ok || res.status === 204)
627
734
  return null;
628
735
  const text = await res.text();
629
736
  if (!text)
630
737
  return null;
631
738
  const data = JSON.parse(text);
632
- return data ? { ...data, _ts: Date.now() } : null;
739
+ return data ? { key, command: data } : null;
740
+ };
741
+ try {
742
+ return ((normalizedBrowserTabId
743
+ ? await read(appStateKey("__set_url__"))
744
+ : null) ?? (await read("__set_url__")));
633
745
  }
634
746
  catch {
635
747
  return null;
636
748
  }
637
749
  },
638
750
  refetchInterval: 2_000,
639
- structuralSharing: false,
640
751
  retry: false,
641
752
  });
753
+ const lastProcessedDedupKeyRef = React.useRef(null);
642
754
  React.useEffect(() => {
643
755
  if (!command)
644
756
  return;
757
+ const cmd = command.command;
758
+ const dedupKey = cmd._writeId ??
759
+ JSON.stringify({
760
+ pathname: cmd.pathname,
761
+ searchParams: cmd.searchParams,
762
+ mergeSearchParams: cmd.mergeSearchParams,
763
+ hash: cmd.hash,
764
+ });
765
+ if (lastProcessedDedupKeyRef.current === dedupKey) {
766
+ // Same command we already handled — the DELETE below races against the
767
+ // next polling refetch, so when it loses the same command can show up
768
+ // again on the next tick. Re-fire DELETE and bail rather than navigate
769
+ // again.
770
+ fetch(agentNativePath(`/_agent-native/application-state/${command.key}`), {
771
+ method: "DELETE",
772
+ headers: { "X-Agent-Native-CSRF": "1" },
773
+ }).catch(() => { });
774
+ queryClient.setQueryData(setUrlQueryKey, null);
775
+ return;
776
+ }
777
+ lastProcessedDedupKeyRef.current = dedupKey;
645
778
  // Delete the one-shot command before applying so duplicate events
646
779
  // don't cause repeated navigation.
647
- fetch(agentNativePath("/_agent-native/application-state/__set_url__"), {
780
+ fetch(agentNativePath(`/_agent-native/application-state/${command.key}`), {
648
781
  method: "DELETE",
649
782
  headers: { "X-Agent-Native-CSRF": "1" },
650
783
  }).catch(() => { });
651
- const cmd = command;
652
784
  try {
653
785
  const current = new URL(window.location.href);
654
786
  const nextPath = cmd.pathname ?? current.pathname;
@@ -682,7 +814,7 @@ function URLSync() {
682
814
  }
683
815
  const currentUrl = current.pathname + (current.search || "") + (current.hash || "");
684
816
  if (url === currentUrl) {
685
- queryClient.setQueryData(["__set_url__"], null);
817
+ queryClient.setQueryData(setUrlQueryKey, null);
686
818
  return;
687
819
  }
688
820
  // Replace rather than push so repeated agent URL updates don't
@@ -693,8 +825,8 @@ function URLSync() {
693
825
  catch {
694
826
  // Malformed command — ignore.
695
827
  }
696
- queryClient.setQueryData(["__set_url__"], null);
697
- }, [command, navigate, queryClient]);
828
+ queryClient.setQueryData(setUrlQueryKey, null);
829
+ }, [command, navigate, queryClient, setUrlQueryKey]);
698
830
  return null;
699
831
  }
700
832
  function ScreenRefreshBoundary({ children }) {
@@ -711,18 +843,66 @@ function ScreenRefreshBoundary({ children }) {
711
843
  return _jsx(React.Fragment, { children: children }, key);
712
844
  }
713
845
  class AgentPanelErrorBoundary extends React.Component {
714
- state = { error: null };
846
+ state = {
847
+ error: null,
848
+ staleIndexRecoveryCount: 0,
849
+ };
850
+ recoveryTimer = null;
851
+ recoveryCooldownTimer = null;
715
852
  static getDerivedStateFromError(error) {
716
853
  return { error };
717
854
  }
718
855
  componentDidCatch(error, errorInfo) {
856
+ if (isAssistantUiStaleIndexError(error)) {
857
+ console.warn("[agent-native] Recovering agent panel after stale UI index");
858
+ if (this.state.staleIndexRecoveryCount >= 2) {
859
+ console.error("[agent-native] Agent panel stale-index recovery failed", error, errorInfo);
860
+ return;
861
+ }
862
+ if (!this.recoveryTimer) {
863
+ this.recoveryTimer = setTimeout(() => {
864
+ this.recoveryTimer = null;
865
+ this.setState((state) => ({
866
+ error: null,
867
+ staleIndexRecoveryCount: state.staleIndexRecoveryCount + 1,
868
+ }));
869
+ this.props.onReset();
870
+ }, 0);
871
+ }
872
+ return;
873
+ }
719
874
  console.error("[agent-native] Agent panel crashed", error, errorInfo);
720
875
  }
876
+ componentDidUpdate(_prevProps, prevState) {
877
+ if (prevState.error &&
878
+ !this.state.error &&
879
+ this.state.staleIndexRecoveryCount > 0) {
880
+ if (this.recoveryCooldownTimer) {
881
+ clearTimeout(this.recoveryCooldownTimer);
882
+ }
883
+ this.recoveryCooldownTimer = setTimeout(() => {
884
+ this.recoveryCooldownTimer = null;
885
+ this.setState((state) => state.error ? null : { staleIndexRecoveryCount: 0 });
886
+ }, 2_000);
887
+ }
888
+ }
889
+ componentWillUnmount() {
890
+ if (this.recoveryTimer) {
891
+ clearTimeout(this.recoveryTimer);
892
+ }
893
+ if (this.recoveryCooldownTimer) {
894
+ clearTimeout(this.recoveryCooldownTimer);
895
+ }
896
+ }
721
897
  render() {
722
898
  if (!this.state.error)
723
899
  return this.props.children;
900
+ if (isAssistantUiStaleIndexError(this.state.error) &&
901
+ this.state.staleIndexRecoveryCount < 2) {
902
+ return (_jsx("div", { className: "flex h-full items-center justify-center p-6 text-center text-xs text-muted-foreground", children: "Reloading chat UI..." }));
903
+ }
724
904
  return (_jsxs("div", { className: "flex h-full flex-col items-center justify-center gap-3 p-6 text-center", children: [_jsxs("div", { className: "max-w-[260px] space-y-1", children: [_jsx("p", { className: "text-sm font-medium text-foreground", children: "Agent panel hit an internal UI error." }), _jsx("p", { className: "text-xs leading-relaxed text-muted-foreground", children: "The app is still usable. Reset the panel to reload the chat UI." })] }), _jsx("button", { type: "button", className: "rounded-md border border-border bg-background px-3 py-1.5 text-xs font-medium text-foreground hover:bg-accent", onClick: () => {
725
- this.setState({ error: null });
905
+ this.setState({ error: null, staleIndexRecoveryCount: 0 });
726
906
  this.props.onReset();
727
907
  }, children: "Reset agent panel" })] }));
728
908
  }
@@ -743,7 +923,7 @@ export function AgentPanel(props) {
743
923
  * Wraps app content with a toggleable agent sidebar.
744
924
  * Use AgentToggleButton in your header to open/close it.
745
925
  */
746
- export function AgentSidebar({ children, emptyStateText = "How can I help you?", suggestions, defaultSidebarWidth, sidebarWidth, position = "right", defaultOpen = false, animateMobile = false, }) {
926
+ export function AgentSidebar({ children, emptyStateText = "How can I help you?", suggestions, defaultSidebarWidth, sidebarWidth, position = "right", defaultOpen = false, animateMobile = false, scope, browserTabId, }) {
747
927
  const initialWidth = defaultSidebarWidth ?? sidebarWidth ?? 380;
748
928
  const [open, setOpen] = useState(() => getInitialAgentSidebarOpen(defaultOpen));
749
929
  const [presentationMode, setPresentationMode] = useState(false);
@@ -805,10 +985,44 @@ export function AgentSidebar({ children, emptyStateText = "How can I help you?",
805
985
  // Track whether the frame is controlling the sidebar (code mode = frame active).
806
986
  // Default to true when inside an iframe — assume the frame sidebar is active
807
987
  // until told otherwise. This prevents both sidebars flashing after hot reloads.
808
- const [frameCodeMode, setFrameCodeMode] = useState(() => typeof window !== "undefined" && window.parent !== window);
988
+ const [frameCodeMode, setFrameCodeMode] = useState(() => shouldParentFrameOwnAgentPanel());
989
+ // Frame sidebar visibility: we don't know the frame's open/closed state at
990
+ // mount, so start at false and wait for the frame to dispatch its real
991
+ // state via the message handler below. Initializing to
992
+ // `shouldParentFrameOwnAgentPanel()` here was a category error — that
993
+ // helper reports ownership (which side renders the sidebar), not whether
994
+ // the sidebar is currently open. Mixing them up dispatched a stale
995
+ // "open: true" before the first frame message arrived.
996
+ const [frameSidebarOpen, setFrameSidebarOpen] = useState(false);
997
+ // Has the frame told us its sidebar state yet? In frame-owned mode we
998
+ // don't know whether the sidebar is open or closed until the parent frame
999
+ // dispatches `agentNative.sidebarMode`. Emitting a synthetic
1000
+ // `{ open: false }` before that message arrives makes downstream listeners
1001
+ // flip a moment later when the real state lands, which is the same
1002
+ // ownership-vs-open-state confusion the previous fix addressed.
1003
+ const [hasFrameSidebarState, setHasFrameSidebarState] = useState(false);
1004
+ useEffect(() => {
1005
+ const frameOwned = frameCodeMode && shouldParentFrameOwnAgentPanel();
1006
+ // Skip the initial emit in frame-owned mode — wait until the frame has
1007
+ // sent us its real sidebar state. Once we know, this effect re-runs and
1008
+ // dispatches the correct value.
1009
+ if (frameOwned && !hasFrameSidebarState)
1010
+ return;
1011
+ dispatchAgentSidebarStateChange({
1012
+ open: !presentationMode && (frameOwned ? frameSidebarOpen : open),
1013
+ source: frameOwned ? "frame" : "app",
1014
+ mode: frameOwned ? "code" : "app",
1015
+ });
1016
+ }, [
1017
+ frameCodeMode,
1018
+ frameSidebarOpen,
1019
+ open,
1020
+ presentationMode,
1021
+ hasFrameSidebarState,
1022
+ ]);
809
1023
  useEffect(() => {
810
1024
  const toggleHandler = () => {
811
- if (frameCodeMode && window.parent !== window) {
1025
+ if (frameCodeMode && shouldParentFrameOwnAgentPanel()) {
812
1026
  // Forward toggle to frame parent — the frame sidebar handles it
813
1027
  window.parent.postMessage({ type: "agentNative.toggleSidebar" }, parentFrameTargetOrigin());
814
1028
  }
@@ -817,7 +1031,7 @@ export function AgentSidebar({ children, emptyStateText = "How can I help you?",
817
1031
  }
818
1032
  };
819
1033
  const openHandler = () => {
820
- if (frameCodeMode && window.parent !== window) {
1034
+ if (frameCodeMode && shouldParentFrameOwnAgentPanel()) {
821
1035
  window.parent.postMessage({ type: "agentNative.toggleSidebar", data: { open: true } }, parentFrameTargetOrigin());
822
1036
  }
823
1037
  else {
@@ -825,7 +1039,7 @@ export function AgentSidebar({ children, emptyStateText = "How can I help you?",
825
1039
  }
826
1040
  };
827
1041
  const closeHandler = () => {
828
- if (frameCodeMode && window.parent !== window) {
1042
+ if (frameCodeMode && shouldParentFrameOwnAgentPanel()) {
829
1043
  window.parent.postMessage({ type: "agentNative.toggleSidebar", data: { open: false } }, parentFrameTargetOrigin());
830
1044
  }
831
1045
  else {
@@ -856,14 +1070,16 @@ export function AgentSidebar({ children, emptyStateText = "How can I help you?",
856
1070
  if (mode === "code") {
857
1071
  // Frame is showing its own sidebar — hide the app's
858
1072
  setFrameCodeMode(true);
1073
+ setFrameSidebarOpen(frameOpen !== false);
1074
+ setHasFrameSidebarState(true);
859
1075
  setOpenPersisted(false);
860
1076
  }
861
1077
  else if (mode === "app") {
862
1078
  // Frame deferred to the app — show and sync width + mode
863
1079
  setFrameCodeMode(false);
864
- if (frameOpen !== false) {
865
- setOpenPersisted(true);
866
- }
1080
+ setFrameSidebarOpen(false);
1081
+ setHasFrameSidebarState(true);
1082
+ setOpenPersisted(frameOpen !== false);
867
1083
  if (frameWidth &&
868
1084
  frameWidth >= SIDEBAR_MIN &&
869
1085
  frameWidth <= SIDEBAR_MAX) {
@@ -882,11 +1098,18 @@ export function AgentSidebar({ children, emptyStateText = "How can I help you?",
882
1098
  window.addEventListener("message", handleMessage);
883
1099
  return () => window.removeEventListener("message", handleMessage);
884
1100
  }, [setOpenPersisted]);
885
- // Cmd+I / Ctrl+I to focus the agent chat. If the user has selected text,
886
- // capture it into application_state under `pending-selection-context` so
887
- // the agent's next turn includes it as immediate context to act on.
1101
+ // Cmd+\ / Ctrl+\ toggles the agent sidebar globally. Cmd+I / Ctrl+I focuses
1102
+ // chat and attaches selected page text as one-shot context for the next turn.
888
1103
  useEffect(() => {
889
1104
  const handleKeyDown = (e) => {
1105
+ if ((e.metaKey || e.ctrlKey) &&
1106
+ !e.altKey &&
1107
+ !e.shiftKey &&
1108
+ (e.key === "\\" || e.code === "Backslash")) {
1109
+ e.preventDefault();
1110
+ window.dispatchEvent(new Event("agent-panel:toggle"));
1111
+ return;
1112
+ }
890
1113
  if ((e.metaKey || e.ctrlKey) && e.key === "i") {
891
1114
  e.preventDefault();
892
1115
  let selectionText = "";
@@ -1000,9 +1223,9 @@ export function AgentSidebar({ children, emptyStateText = "How can I help you?",
1000
1223
  // any in-progress or completed conversations.
1001
1224
  const sidebar = (_jsxs(_Fragment, { children: [showResizeHandle && !isLeft && (_jsx(ResizeHandle, { position: position, onDrag: handleDrag })), _jsx("div", { className: cn("agent-sidebar-panel flex shrink-0 flex-col overflow-hidden text-[13px] leading-[1.2] antialiased", animateMobile &&
1002
1225
  isMobile &&
1003
- "shadow-2xl transition-transform duration-[260ms] ease-[cubic-bezier(0.32,0.72,0,1)] motion-reduce:transition-none"), style: panelStyle, inert: isMobile && !open ? true : undefined, "aria-hidden": isMobile && !open ? true : undefined, children: _jsx(AgentPanel, { emptyStateText: emptyStateText, suggestions: suggestions, onCollapse: () => setOpenPersisted(false), isFullscreen: effectiveFullscreen, onToggleFullscreen: isMobile ? undefined : toggleFullscreen }) }), showResizeHandle && isLeft && (_jsx(ResizeHandle, { position: position, onDrag: handleDrag }))] }));
1226
+ "shadow-2xl transition-transform duration-[260ms] ease-[cubic-bezier(0.32,0.72,0,1)] motion-reduce:transition-none"), style: panelStyle, inert: isMobile && !open ? true : undefined, "aria-hidden": isMobile && !open ? true : undefined, children: _jsx(AgentPanel, { emptyStateText: emptyStateText, suggestions: suggestions, onCollapse: () => setOpenPersisted(false), isFullscreen: effectiveFullscreen, onToggleFullscreen: isMobile ? undefined : toggleFullscreen, scope: scope, browserTabId: browserTabId }) }), showResizeHandle && isLeft && (_jsx(ResizeHandle, { position: position, onDrag: handleDrag }))] }));
1004
1227
  return (_jsxs("div", { className: "flex min-w-0 flex-1 h-screen overflow-hidden", children: [isMobile && !presentationMode && (animateMobile || open) && (_jsx("div", { className: cn("fixed inset-0 bg-black/40", animateMobile &&
1005
- "transition-opacity duration-200 motion-reduce:transition-none", animateMobile && !open && "pointer-events-none opacity-0", animateMobile && open && "opacity-100"), style: { zIndex: SIDEBAR_OVERLAY_Z_INDEX - 1 }, onClick: () => setOpenPersisted(false) })), _jsx(URLSync, {}), isLeft && !presentationMode ? sidebar : null, _jsx("div", { className: "flex flex-1 flex-col overflow-auto min-w-0", children: _jsx(ScreenRefreshBoundary, { children: children }) }), !isLeft && !presentationMode ? sidebar : null] }));
1228
+ "transition-opacity duration-200 motion-reduce:transition-none", animateMobile && !open && "pointer-events-none opacity-0", animateMobile && open && "opacity-100"), style: { zIndex: SIDEBAR_OVERLAY_Z_INDEX - 1 }, onClick: () => setOpenPersisted(false) })), _jsx(URLSync, { browserTabId: browserTabId }), isLeft && !presentationMode ? sidebar : null, _jsx("div", { className: "flex flex-1 flex-col overflow-auto min-w-0", children: _jsx(ScreenRefreshBoundary, { children: children }) }), !isLeft && !presentationMode ? sidebar : null] }));
1006
1229
  }
1007
1230
  /**
1008
1231
  * Focus the agent chat composer input.