@xenosystem/agent-interface-ui 0.1.3

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 (384) hide show
  1. package/LICENSE +67 -0
  2. package/dist/adapters/agentHostPlatformBridge.d.ts +24 -0
  3. package/dist/adapters/agentHostPlatformBridge.d.ts.map +1 -0
  4. package/dist/adapters/agentHostPlatformBridge.js +1244 -0
  5. package/dist/adapters/agentHostPlatformBridge.js.map +1 -0
  6. package/dist/adapters/hubAgentPlatformBridge.d.ts +17 -0
  7. package/dist/adapters/hubAgentPlatformBridge.d.ts.map +1 -0
  8. package/dist/adapters/hubAgentPlatformBridge.js +109 -0
  9. package/dist/adapters/hubAgentPlatformBridge.js.map +1 -0
  10. package/dist/adapters/xenoAgentCompatibilityBridge.d.ts +14 -0
  11. package/dist/adapters/xenoAgentCompatibilityBridge.d.ts.map +1 -0
  12. package/dist/adapters/xenoAgentCompatibilityBridge.js +237 -0
  13. package/dist/adapters/xenoAgentCompatibilityBridge.js.map +1 -0
  14. package/dist/adapters/xenoAgentHostCatalog.d.ts +40 -0
  15. package/dist/adapters/xenoAgentHostCatalog.d.ts.map +1 -0
  16. package/dist/adapters/xenoAgentHostCatalog.js +228 -0
  17. package/dist/adapters/xenoAgentHostCatalog.js.map +1 -0
  18. package/dist/components/agent/AIStatusIndicator.d.ts +25 -0
  19. package/dist/components/agent/AIStatusIndicator.d.ts.map +1 -0
  20. package/dist/components/agent/AIStatusIndicator.js +85 -0
  21. package/dist/components/agent/AIStatusIndicator.js.map +1 -0
  22. package/dist/components/agent/AgentInterface.d.ts +21 -0
  23. package/dist/components/agent/AgentInterface.d.ts.map +1 -0
  24. package/dist/components/agent/AgentInterface.js +7586 -0
  25. package/dist/components/agent/AgentInterface.js.map +1 -0
  26. package/dist/components/agent/AgentOnboarding.d.ts +16 -0
  27. package/dist/components/agent/AgentOnboarding.d.ts.map +1 -0
  28. package/dist/components/agent/AgentOnboarding.js +423 -0
  29. package/dist/components/agent/AgentOnboarding.js.map +1 -0
  30. package/dist/components/agent/AgentPtyTerminalPanel.d.ts +13 -0
  31. package/dist/components/agent/AgentPtyTerminalPanel.d.ts.map +1 -0
  32. package/dist/components/agent/AgentPtyTerminalPanel.js +129 -0
  33. package/dist/components/agent/AgentPtyTerminalPanel.js.map +1 -0
  34. package/dist/components/agent/AgentView.d.ts +143 -0
  35. package/dist/components/agent/AgentView.d.ts.map +1 -0
  36. package/dist/components/agent/AgentView.js +7250 -0
  37. package/dist/components/agent/AgentView.js.map +1 -0
  38. package/dist/components/agent/AgentWorkbenchCliPanel.d.ts +15 -0
  39. package/dist/components/agent/AgentWorkbenchCliPanel.d.ts.map +1 -0
  40. package/dist/components/agent/AgentWorkbenchCliPanel.js +275 -0
  41. package/dist/components/agent/AgentWorkbenchCliPanel.js.map +1 -0
  42. package/dist/components/agent/AgentWorkbenchPanel.d.ts +791 -0
  43. package/dist/components/agent/AgentWorkbenchPanel.d.ts.map +1 -0
  44. package/dist/components/agent/AgentWorkbenchPanel.js +584 -0
  45. package/dist/components/agent/AgentWorkbenchPanel.js.map +1 -0
  46. package/dist/components/agent/AgentWorkspaceBrowserPanel.d.ts +11 -0
  47. package/dist/components/agent/AgentWorkspaceBrowserPanel.d.ts.map +1 -0
  48. package/dist/components/agent/AgentWorkspaceBrowserPanel.js +198 -0
  49. package/dist/components/agent/AgentWorkspaceBrowserPanel.js.map +1 -0
  50. package/dist/components/agent/AssistantTurnStatusNotice.d.ts +16 -0
  51. package/dist/components/agent/AssistantTurnStatusNotice.d.ts.map +1 -0
  52. package/dist/components/agent/AssistantTurnStatusNotice.js +54 -0
  53. package/dist/components/agent/AssistantTurnStatusNotice.js.map +1 -0
  54. package/dist/components/agent/CommandToolCard.d.ts +11 -0
  55. package/dist/components/agent/CommandToolCard.d.ts.map +1 -0
  56. package/dist/components/agent/CommandToolCard.js +29 -0
  57. package/dist/components/agent/CommandToolCard.js.map +1 -0
  58. package/dist/components/agent/FleetPanel.d.ts +28 -0
  59. package/dist/components/agent/FleetPanel.d.ts.map +1 -0
  60. package/dist/components/agent/FleetPanel.js +175 -0
  61. package/dist/components/agent/FleetPanel.js.map +1 -0
  62. package/dist/components/agent/GhostTextArea.d.ts +13 -0
  63. package/dist/components/agent/GhostTextArea.d.ts.map +1 -0
  64. package/dist/components/agent/GhostTextArea.js +21 -0
  65. package/dist/components/agent/GhostTextArea.js.map +1 -0
  66. package/dist/components/agent/IntakePanel.d.ts +29 -0
  67. package/dist/components/agent/IntakePanel.d.ts.map +1 -0
  68. package/dist/components/agent/IntakePanel.js +81 -0
  69. package/dist/components/agent/IntakePanel.js.map +1 -0
  70. package/dist/components/agent/KnowledgePanel.d.ts +25 -0
  71. package/dist/components/agent/KnowledgePanel.d.ts.map +1 -0
  72. package/dist/components/agent/KnowledgePanel.js +99 -0
  73. package/dist/components/agent/KnowledgePanel.js.map +1 -0
  74. package/dist/components/agent/MonacoDiffWorkbenchEditor.d.ts +9 -0
  75. package/dist/components/agent/MonacoDiffWorkbenchEditor.d.ts.map +1 -0
  76. package/dist/components/agent/MonacoDiffWorkbenchEditor.js +204 -0
  77. package/dist/components/agent/MonacoDiffWorkbenchEditor.js.map +1 -0
  78. package/dist/components/agent/MonacoWorkbenchEditor.d.ts +15 -0
  79. package/dist/components/agent/MonacoWorkbenchEditor.d.ts.map +1 -0
  80. package/dist/components/agent/MonacoWorkbenchEditor.js +380 -0
  81. package/dist/components/agent/MonacoWorkbenchEditor.js.map +1 -0
  82. package/dist/components/agent/PermissionDialog.d.ts +34 -0
  83. package/dist/components/agent/PermissionDialog.d.ts.map +1 -0
  84. package/dist/components/agent/PermissionDialog.js +67 -0
  85. package/dist/components/agent/PermissionDialog.js.map +1 -0
  86. package/dist/components/agent/PluginManager.d.ts +20 -0
  87. package/dist/components/agent/PluginManager.d.ts.map +1 -0
  88. package/dist/components/agent/PluginManager.js +506 -0
  89. package/dist/components/agent/PluginManager.js.map +1 -0
  90. package/dist/components/agent/RunReviewPanel.d.ts +52 -0
  91. package/dist/components/agent/RunReviewPanel.d.ts.map +1 -0
  92. package/dist/components/agent/RunReviewPanel.js +236 -0
  93. package/dist/components/agent/RunReviewPanel.js.map +1 -0
  94. package/dist/components/agent/SessionsPanel.d.ts +30 -0
  95. package/dist/components/agent/SessionsPanel.d.ts.map +1 -0
  96. package/dist/components/agent/SessionsPanel.js +247 -0
  97. package/dist/components/agent/SessionsPanel.js.map +1 -0
  98. package/dist/components/agent/acp/AcpAgentConfigForm.d.ts +19 -0
  99. package/dist/components/agent/acp/AcpAgentConfigForm.d.ts.map +1 -0
  100. package/dist/components/agent/acp/AcpAgentConfigForm.js +85 -0
  101. package/dist/components/agent/acp/AcpAgentConfigForm.js.map +1 -0
  102. package/dist/components/agent/acp/AcpAgentDiagnosticsPanel.d.ts +10 -0
  103. package/dist/components/agent/acp/AcpAgentDiagnosticsPanel.d.ts.map +1 -0
  104. package/dist/components/agent/acp/AcpAgentDiagnosticsPanel.js +80 -0
  105. package/dist/components/agent/acp/AcpAgentDiagnosticsPanel.js.map +1 -0
  106. package/dist/components/agent/acp/AcpAgentManager.d.ts +3 -0
  107. package/dist/components/agent/acp/AcpAgentManager.d.ts.map +1 -0
  108. package/dist/components/agent/acp/AcpAgentManager.js +152 -0
  109. package/dist/components/agent/acp/AcpAgentManager.js.map +1 -0
  110. package/dist/components/agent/acp/AcpAgentTestResultPanel.d.ts +9 -0
  111. package/dist/components/agent/acp/AcpAgentTestResultPanel.d.ts.map +1 -0
  112. package/dist/components/agent/acp/AcpAgentTestResultPanel.js +24 -0
  113. package/dist/components/agent/acp/AcpAgentTestResultPanel.js.map +1 -0
  114. package/dist/components/agent/acp/AcpApprovalPanel.d.ts +29 -0
  115. package/dist/components/agent/acp/AcpApprovalPanel.d.ts.map +1 -0
  116. package/dist/components/agent/acp/AcpApprovalPanel.js +37 -0
  117. package/dist/components/agent/acp/AcpApprovalPanel.js.map +1 -0
  118. package/dist/components/agent/acp/AcpCertificationPanel.d.ts +10 -0
  119. package/dist/components/agent/acp/AcpCertificationPanel.d.ts.map +1 -0
  120. package/dist/components/agent/acp/AcpCertificationPanel.js +41 -0
  121. package/dist/components/agent/acp/AcpCertificationPanel.js.map +1 -0
  122. package/dist/components/agent/acp/AcpLiveProviderWorkflowPanel.d.ts +11 -0
  123. package/dist/components/agent/acp/AcpLiveProviderWorkflowPanel.d.ts.map +1 -0
  124. package/dist/components/agent/acp/AcpLiveProviderWorkflowPanel.js +32 -0
  125. package/dist/components/agent/acp/AcpLiveProviderWorkflowPanel.js.map +1 -0
  126. package/dist/components/agent/acp/AcpProviderManagerPanel.d.ts +7 -0
  127. package/dist/components/agent/acp/AcpProviderManagerPanel.d.ts.map +1 -0
  128. package/dist/components/agent/acp/AcpProviderManagerPanel.js +69 -0
  129. package/dist/components/agent/acp/AcpProviderManagerPanel.js.map +1 -0
  130. package/dist/components/agent/acp/AcpProviderModelsPanel.d.ts +7 -0
  131. package/dist/components/agent/acp/AcpProviderModelsPanel.d.ts.map +1 -0
  132. package/dist/components/agent/acp/AcpProviderModelsPanel.js +108 -0
  133. package/dist/components/agent/acp/AcpProviderModelsPanel.js.map +1 -0
  134. package/dist/components/agent/acp/AcpSupportBundlePanel.d.ts +8 -0
  135. package/dist/components/agent/acp/AcpSupportBundlePanel.d.ts.map +1 -0
  136. package/dist/components/agent/acp/AcpSupportBundlePanel.js +56 -0
  137. package/dist/components/agent/acp/AcpSupportBundlePanel.js.map +1 -0
  138. package/dist/components/agent/compactionSummary.d.ts +28 -0
  139. package/dist/components/agent/compactionSummary.d.ts.map +1 -0
  140. package/dist/components/agent/compactionSummary.js +41 -0
  141. package/dist/components/agent/compactionSummary.js.map +1 -0
  142. package/dist/components/agent/monacoWorkbenchShared.d.ts +13 -0
  143. package/dist/components/agent/monacoWorkbenchShared.d.ts.map +1 -0
  144. package/dist/components/agent/monacoWorkbenchShared.js +226 -0
  145. package/dist/components/agent/monacoWorkbenchShared.js.map +1 -0
  146. package/dist/components/agent/settings/EntitySettingsLayout.d.ts +61 -0
  147. package/dist/components/agent/settings/EntitySettingsLayout.d.ts.map +1 -0
  148. package/dist/components/agent/settings/EntitySettingsLayout.js +72 -0
  149. package/dist/components/agent/settings/EntitySettingsLayout.js.map +1 -0
  150. package/dist/components/agent/settings/SettingsNavigation.d.ts +8 -0
  151. package/dist/components/agent/settings/SettingsNavigation.d.ts.map +1 -0
  152. package/dist/components/agent/settings/SettingsNavigation.js +39 -0
  153. package/dist/components/agent/settings/SettingsNavigation.js.map +1 -0
  154. package/dist/components/agent/settings/sections/AccessMembersSection.d.ts +3 -0
  155. package/dist/components/agent/settings/sections/AccessMembersSection.d.ts.map +1 -0
  156. package/dist/components/agent/settings/sections/AccessMembersSection.js +31 -0
  157. package/dist/components/agent/settings/sections/AccessMembersSection.js.map +1 -0
  158. package/dist/components/agent/settings/sections/AgentPermissionRulesPanel.d.ts +25 -0
  159. package/dist/components/agent/settings/sections/AgentPermissionRulesPanel.d.ts.map +1 -0
  160. package/dist/components/agent/settings/sections/AgentPermissionRulesPanel.js +56 -0
  161. package/dist/components/agent/settings/sections/AgentPermissionRulesPanel.js.map +1 -0
  162. package/dist/components/agent/settings/sections/DangerZoneSection.d.ts +3 -0
  163. package/dist/components/agent/settings/sections/DangerZoneSection.d.ts.map +1 -0
  164. package/dist/components/agent/settings/sections/DangerZoneSection.js +19 -0
  165. package/dist/components/agent/settings/sections/DangerZoneSection.js.map +1 -0
  166. package/dist/components/agent/settings/sections/DefaultAgentConfigSection.d.ts +3 -0
  167. package/dist/components/agent/settings/sections/DefaultAgentConfigSection.d.ts.map +1 -0
  168. package/dist/components/agent/settings/sections/DefaultAgentConfigSection.js +66 -0
  169. package/dist/components/agent/settings/sections/DefaultAgentConfigSection.js.map +1 -0
  170. package/dist/components/agent/settings/sections/EnvironmentSecretsSection.d.ts +3 -0
  171. package/dist/components/agent/settings/sections/EnvironmentSecretsSection.d.ts.map +1 -0
  172. package/dist/components/agent/settings/sections/EnvironmentSecretsSection.js +87 -0
  173. package/dist/components/agent/settings/sections/EnvironmentSecretsSection.js.map +1 -0
  174. package/dist/components/agent/settings/sections/ExportBackupSection.d.ts +3 -0
  175. package/dist/components/agent/settings/sections/ExportBackupSection.d.ts.map +1 -0
  176. package/dist/components/agent/settings/sections/ExportBackupSection.js +23 -0
  177. package/dist/components/agent/settings/sections/ExportBackupSection.js.map +1 -0
  178. package/dist/components/agent/settings/sections/GeneralSection.d.ts +3 -0
  179. package/dist/components/agent/settings/sections/GeneralSection.d.ts.map +1 -0
  180. package/dist/components/agent/settings/sections/GeneralSection.js +15 -0
  181. package/dist/components/agent/settings/sections/GeneralSection.js.map +1 -0
  182. package/dist/components/agent/settings/sections/IntegrationsSection.d.ts +3 -0
  183. package/dist/components/agent/settings/sections/IntegrationsSection.d.ts.map +1 -0
  184. package/dist/components/agent/settings/sections/IntegrationsSection.js +40 -0
  185. package/dist/components/agent/settings/sections/IntegrationsSection.js.map +1 -0
  186. package/dist/components/agent/settings/sections/NotificationsSection.d.ts +3 -0
  187. package/dist/components/agent/settings/sections/NotificationsSection.d.ts.map +1 -0
  188. package/dist/components/agent/settings/sections/NotificationsSection.js +28 -0
  189. package/dist/components/agent/settings/sections/NotificationsSection.js.map +1 -0
  190. package/dist/components/agent/settings/sections/ResourceLimitsSection.d.ts +3 -0
  191. package/dist/components/agent/settings/sections/ResourceLimitsSection.d.ts.map +1 -0
  192. package/dist/components/agent/settings/sections/ResourceLimitsSection.js +17 -0
  193. package/dist/components/agent/settings/sections/ResourceLimitsSection.js.map +1 -0
  194. package/dist/components/agent/settings/sections/SecurityComplianceSection.d.ts +3 -0
  195. package/dist/components/agent/settings/sections/SecurityComplianceSection.d.ts.map +1 -0
  196. package/dist/components/agent/settings/sections/SecurityComplianceSection.js +28 -0
  197. package/dist/components/agent/settings/sections/SecurityComplianceSection.js.map +1 -0
  198. package/dist/components/agent/settings/sections/UsageAnalyticsSection.d.ts +3 -0
  199. package/dist/components/agent/settings/sections/UsageAnalyticsSection.d.ts.map +1 -0
  200. package/dist/components/agent/settings/sections/UsageAnalyticsSection.js +17 -0
  201. package/dist/components/agent/settings/sections/UsageAnalyticsSection.js.map +1 -0
  202. package/dist/components/agent/settings/sections/WorkspaceDirectoryAccessSection.d.ts +54 -0
  203. package/dist/components/agent/settings/sections/WorkspaceDirectoryAccessSection.d.ts.map +1 -0
  204. package/dist/components/agent/settings/sections/WorkspaceDirectoryAccessSection.js +333 -0
  205. package/dist/components/agent/settings/sections/WorkspaceDirectoryAccessSection.js.map +1 -0
  206. package/dist/components/agent/settings/shared/CheckboxField.d.ts +13 -0
  207. package/dist/components/agent/settings/shared/CheckboxField.d.ts.map +1 -0
  208. package/dist/components/agent/settings/shared/CheckboxField.js +8 -0
  209. package/dist/components/agent/settings/shared/CheckboxField.js.map +1 -0
  210. package/dist/components/agent/settings/shared/InputField.d.ts +15 -0
  211. package/dist/components/agent/settings/shared/InputField.d.ts.map +1 -0
  212. package/dist/components/agent/settings/shared/InputField.js +7 -0
  213. package/dist/components/agent/settings/shared/InputField.js.map +1 -0
  214. package/dist/components/agent/settings/shared/MembersTable.d.ts +11 -0
  215. package/dist/components/agent/settings/shared/MembersTable.d.ts.map +1 -0
  216. package/dist/components/agent/settings/shared/MembersTable.js +7 -0
  217. package/dist/components/agent/settings/shared/MembersTable.js.map +1 -0
  218. package/dist/components/agent/settings/shared/SettingRow.d.ts +11 -0
  219. package/dist/components/agent/settings/shared/SettingRow.d.ts.map +1 -0
  220. package/dist/components/agent/settings/shared/SettingRow.js +6 -0
  221. package/dist/components/agent/settings/shared/SettingRow.js.map +1 -0
  222. package/dist/components/agent/settings/shared/SettingsCard.d.ts +11 -0
  223. package/dist/components/agent/settings/shared/SettingsCard.d.ts.map +1 -0
  224. package/dist/components/agent/settings/shared/SettingsCard.js +8 -0
  225. package/dist/components/agent/settings/shared/SettingsCard.js.map +1 -0
  226. package/dist/components/agent/settings/shared/ToggleSwitch.d.ts +8 -0
  227. package/dist/components/agent/settings/shared/ToggleSwitch.d.ts.map +1 -0
  228. package/dist/components/agent/settings/shared/ToggleSwitch.js +6 -0
  229. package/dist/components/agent/settings/shared/ToggleSwitch.js.map +1 -0
  230. package/dist/components/agent/settings/shared/UsageChart.d.ts +12 -0
  231. package/dist/components/agent/settings/shared/UsageChart.d.ts.map +1 -0
  232. package/dist/components/agent/settings/shared/UsageChart.js +16 -0
  233. package/dist/components/agent/settings/shared/UsageChart.js.map +1 -0
  234. package/dist/components/agent/toolCardDisplay.d.ts +24 -0
  235. package/dist/components/agent/toolCardDisplay.d.ts.map +1 -0
  236. package/dist/components/agent/toolCardDisplay.js +85 -0
  237. package/dist/components/agent/toolCardDisplay.js.map +1 -0
  238. package/dist/components/product/XenoAgentProductHeader.d.ts +18 -0
  239. package/dist/components/product/XenoAgentProductHeader.d.ts.map +1 -0
  240. package/dist/components/product/XenoAgentProductHeader.js +25 -0
  241. package/dist/components/product/XenoAgentProductHeader.js.map +1 -0
  242. package/dist/components/product/XenoAgentSessionTabs.d.ts +18 -0
  243. package/dist/components/product/XenoAgentSessionTabs.d.ts.map +1 -0
  244. package/dist/components/product/XenoAgentSessionTabs.js +103 -0
  245. package/dist/components/product/XenoAgentSessionTabs.js.map +1 -0
  246. package/dist/components/ui/CodeBlock.d.ts +8 -0
  247. package/dist/components/ui/CodeBlock.d.ts.map +1 -0
  248. package/dist/components/ui/CodeBlock.js +89 -0
  249. package/dist/components/ui/CodeBlock.js.map +1 -0
  250. package/dist/components/ui/XenoLogo.d.ts +11 -0
  251. package/dist/components/ui/XenoLogo.d.ts.map +1 -0
  252. package/dist/components/ui/XenoLogo.js +9 -0
  253. package/dist/components/ui/XenoLogo.js.map +1 -0
  254. package/dist/index.d.ts +50 -0
  255. package/dist/index.d.ts.map +1 -0
  256. package/dist/index.js +127 -0
  257. package/dist/index.js.map +1 -0
  258. package/dist/platformApiTypes.d.ts +3992 -0
  259. package/dist/platformApiTypes.d.ts.map +1 -0
  260. package/dist/platformApiTypes.js +2 -0
  261. package/dist/platformApiTypes.js.map +1 -0
  262. package/dist/platformBridge.d.ts +9 -0
  263. package/dist/platformBridge.d.ts.map +1 -0
  264. package/dist/platformBridge.js +19 -0
  265. package/dist/platformBridge.js.map +1 -0
  266. package/dist/providerSelector.d.ts +28 -0
  267. package/dist/providerSelector.d.ts.map +1 -0
  268. package/dist/providerSelector.js +104 -0
  269. package/dist/providerSelector.js.map +1 -0
  270. package/dist/services/connectionMode.d.ts +13 -0
  271. package/dist/services/connectionMode.d.ts.map +1 -0
  272. package/dist/services/connectionMode.js +31 -0
  273. package/dist/services/connectionMode.js.map +1 -0
  274. package/dist/sessionTabs.d.ts +48 -0
  275. package/dist/sessionTabs.d.ts.map +1 -0
  276. package/dist/sessionTabs.js +106 -0
  277. package/dist/sessionTabs.js.map +1 -0
  278. package/dist/stores/acpAgentStore.d.ts +264 -0
  279. package/dist/stores/acpAgentStore.d.ts.map +1 -0
  280. package/dist/stores/acpAgentStore.js +825 -0
  281. package/dist/stores/acpAgentStore.js.map +1 -0
  282. package/dist/stores/agentChatStore.d.ts +529 -0
  283. package/dist/stores/agentChatStore.d.ts.map +1 -0
  284. package/dist/stores/agentChatStore.js +5309 -0
  285. package/dist/stores/agentChatStore.js.map +1 -0
  286. package/dist/stores/agentIdeStore.d.ts +9 -0
  287. package/dist/stores/agentIdeStore.d.ts.map +1 -0
  288. package/dist/stores/agentIdeStore.js +8 -0
  289. package/dist/stores/agentIdeStore.js.map +1 -0
  290. package/dist/stores/agentSearchStore.d.ts +174 -0
  291. package/dist/stores/agentSearchStore.d.ts.map +1 -0
  292. package/dist/stores/agentSearchStore.js +305 -0
  293. package/dist/stores/agentSearchStore.js.map +1 -0
  294. package/dist/stores/authStore.d.ts +26 -0
  295. package/dist/stores/authStore.d.ts.map +1 -0
  296. package/dist/stores/authStore.js +163 -0
  297. package/dist/stores/authStore.js.map +1 -0
  298. package/dist/stores/entitySettingsStore.d.ts +236 -0
  299. package/dist/stores/entitySettingsStore.d.ts.map +1 -0
  300. package/dist/stores/entitySettingsStore.js +916 -0
  301. package/dist/stores/entitySettingsStore.js.map +1 -0
  302. package/dist/stores/permissionStore.d.ts +25 -0
  303. package/dist/stores/permissionStore.d.ts.map +1 -0
  304. package/dist/stores/permissionStore.js +58 -0
  305. package/dist/stores/permissionStore.js.map +1 -0
  306. package/dist/stores/suggestionStore.d.ts +29 -0
  307. package/dist/stores/suggestionStore.d.ts.map +1 -0
  308. package/dist/stores/suggestionStore.js +160 -0
  309. package/dist/stores/suggestionStore.js.map +1 -0
  310. package/dist/stores/tabStore.d.ts +30 -0
  311. package/dist/stores/tabStore.d.ts.map +1 -0
  312. package/dist/stores/tabStore.js +252 -0
  313. package/dist/stores/tabStore.js.map +1 -0
  314. package/dist/stores/themeStore.d.ts +13 -0
  315. package/dist/stores/themeStore.d.ts.map +1 -0
  316. package/dist/stores/themeStore.js +77 -0
  317. package/dist/stores/themeStore.js.map +1 -0
  318. package/dist/stores/workspaceStore.d.ts +175 -0
  319. package/dist/stores/workspaceStore.d.ts.map +1 -0
  320. package/dist/stores/workspaceStore.js +694 -0
  321. package/dist/stores/workspaceStore.js.map +1 -0
  322. package/dist/stores/xenoChatStore.d.ts +88 -0
  323. package/dist/stores/xenoChatStore.d.ts.map +1 -0
  324. package/dist/stores/xenoChatStore.js +572 -0
  325. package/dist/stores/xenoChatStore.js.map +1 -0
  326. package/dist/toolCardProjection.d.ts +33 -0
  327. package/dist/toolCardProjection.d.ts.map +1 -0
  328. package/dist/toolCardProjection.js +62 -0
  329. package/dist/toolCardProjection.js.map +1 -0
  330. package/dist/types/agentEditor.d.ts +39 -0
  331. package/dist/types/agentEditor.d.ts.map +1 -0
  332. package/dist/types/agentEditor.js +2 -0
  333. package/dist/types/agentEditor.js.map +1 -0
  334. package/dist/types/agentRuntimeProvider.d.ts +2 -0
  335. package/dist/types/agentRuntimeProvider.d.ts.map +1 -0
  336. package/dist/types/agentRuntimeProvider.js +2 -0
  337. package/dist/types/agentRuntimeProvider.js.map +1 -0
  338. package/dist/utils/acpExecutionAuthority.d.ts +18 -0
  339. package/dist/utils/acpExecutionAuthority.d.ts.map +1 -0
  340. package/dist/utils/acpExecutionAuthority.js +22 -0
  341. package/dist/utils/acpExecutionAuthority.js.map +1 -0
  342. package/dist/utils/agentAttachedContextPrompt.d.ts +2 -0
  343. package/dist/utils/agentAttachedContextPrompt.d.ts.map +1 -0
  344. package/dist/utils/agentAttachedContextPrompt.js +2 -0
  345. package/dist/utils/agentAttachedContextPrompt.js.map +1 -0
  346. package/dist/utils/agentModelContext.d.ts +2 -0
  347. package/dist/utils/agentModelContext.d.ts.map +1 -0
  348. package/dist/utils/agentModelContext.js +2 -0
  349. package/dist/utils/agentModelContext.js.map +1 -0
  350. package/dist/utils/agentReasoningEffort.d.ts +3 -0
  351. package/dist/utils/agentReasoningEffort.d.ts.map +1 -0
  352. package/dist/utils/agentReasoningEffort.js +2 -0
  353. package/dist/utils/agentReasoningEffort.js.map +1 -0
  354. package/dist/utils/agentRuntimeProvider.d.ts +3 -0
  355. package/dist/utils/agentRuntimeProvider.d.ts.map +1 -0
  356. package/dist/utils/agentRuntimeProvider.js +2 -0
  357. package/dist/utils/agentRuntimeProvider.js.map +1 -0
  358. package/dist/utils/cloudModels.d.ts +3 -0
  359. package/dist/utils/cloudModels.d.ts.map +1 -0
  360. package/dist/utils/cloudModels.js +181 -0
  361. package/dist/utils/cloudModels.js.map +1 -0
  362. package/dist/utils/conversationRuntime.d.ts +3 -0
  363. package/dist/utils/conversationRuntime.d.ts.map +1 -0
  364. package/dist/utils/conversationRuntime.js +2 -0
  365. package/dist/utils/conversationRuntime.js.map +1 -0
  366. package/dist/utils/fileCreateIntent.d.ts +16 -0
  367. package/dist/utils/fileCreateIntent.d.ts.map +1 -0
  368. package/dist/utils/fileCreateIntent.js +123 -0
  369. package/dist/utils/fileCreateIntent.js.map +1 -0
  370. package/dist/utils/legacyAgentRuntimeEvents.d.ts +2 -0
  371. package/dist/utils/legacyAgentRuntimeEvents.d.ts.map +1 -0
  372. package/dist/utils/legacyAgentRuntimeEvents.js +2 -0
  373. package/dist/utils/legacyAgentRuntimeEvents.js.map +1 -0
  374. package/dist/utils/markdownWindowsPaths.d.ts +2 -0
  375. package/dist/utils/markdownWindowsPaths.d.ts.map +1 -0
  376. package/dist/utils/markdownWindowsPaths.js +2 -0
  377. package/dist/utils/markdownWindowsPaths.js.map +1 -0
  378. package/dist/utils/workspaceSelectionContinuation.d.ts +2 -0
  379. package/dist/utils/workspaceSelectionContinuation.d.ts.map +1 -0
  380. package/dist/utils/workspaceSelectionContinuation.js +2 -0
  381. package/dist/utils/workspaceSelectionContinuation.js.map +1 -0
  382. package/package.json +53 -0
  383. package/src/agent.css +1156 -0
  384. package/src/foundation.css +62 -0
@@ -0,0 +1,694 @@
1
+ import { getAgentPlatformBridge } from '../platformBridge';
2
+ /**
3
+ * Workspace Store — Zustand store with file-backed persistence
4
+ *
5
+ * Manages the workspace → team → agent hierarchy.
6
+ * Persists to ~/.xeno/workspaces.json via Electron IPC.
7
+ * Conversations are NOT stored here — they live in agentChatStore.
8
+ */
9
+ import { create } from 'zustand';
10
+ import { useAgentChatStore } from './agentChatStore';
11
+ import { DEFAULT_HUB_AGENT_RUNTIME_SELECTION, normalizeHubAgentRuntimeSelection, } from '../utils/agentRuntimeProvider';
12
+ // =============================================================================
13
+ // HELPERS
14
+ // =============================================================================
15
+ function generateId() {
16
+ return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
17
+ }
18
+ const DEFAULT_CAPABILITIES = {
19
+ terminal: true,
20
+ fileRead: true,
21
+ fileWrite: false,
22
+ appLaunch: true,
23
+ };
24
+ const DEFAULT_PERMISSION_PROFILE = 'standard';
25
+ const VALID_PERMISSION_PROFILES = new Set([
26
+ 'standard',
27
+ 'read-only',
28
+ 'edit-with-approval',
29
+ 'trusted-workspace',
30
+ 'plan',
31
+ ]);
32
+ function normalizePermissionProfile(value) {
33
+ if (typeof value !== 'string')
34
+ return DEFAULT_PERMISSION_PROFILE;
35
+ const normalized = value.trim().toLowerCase();
36
+ return VALID_PERMISSION_PROFILES.has(normalized) ? normalized : DEFAULT_PERMISSION_PROFILE;
37
+ }
38
+ function normalizeTeamAgentCallPolicy(value) {
39
+ if (!value || typeof value !== 'object' || Array.isArray(value))
40
+ return undefined;
41
+ const record = value;
42
+ const stringArray = (entry) => Array.isArray(entry)
43
+ ? Array.from(new Set(entry.filter((item) => typeof item === 'string' && !!item.trim()).map(item => item.trim())))
44
+ : undefined;
45
+ const positiveNumber = (entry) => (typeof entry === 'number' && Number.isFinite(entry) && entry > 0 ? Math.floor(entry) : undefined);
46
+ const allowedExpectedArtifacts = Array.isArray(record.allowedExpectedArtifacts)
47
+ ? record.allowedExpectedArtifacts.filter((entry) => (entry === 'answer' || entry === 'file' || entry === 'diff' || entry === 'diagnostic' || entry === 'report'))
48
+ : undefined;
49
+ const policy = {
50
+ callableAgentIds: stringArray(record.callableAgentIds),
51
+ deniedAgentIds: stringArray(record.deniedAgentIds),
52
+ maxConcurrentChildRuns: positiveNumber(record.maxConcurrentChildRuns),
53
+ maxChildDepth: positiveNumber(record.maxChildDepth),
54
+ maxTokens: positiveNumber(record.maxTokens),
55
+ maxCredits: positiveNumber(record.maxCredits),
56
+ maxRuntimeMs: positiveNumber(record.maxRuntimeMs),
57
+ contextAttachmentLimit: positiveNumber(record.contextAttachmentLimit),
58
+ allowedExpectedArtifacts,
59
+ allowFurtherDelegation: typeof record.allowFurtherDelegation === 'boolean' ? record.allowFurtherDelegation : undefined,
60
+ cancellationPropagation: typeof record.cancellationPropagation === 'boolean' ? record.cancellationPropagation : undefined,
61
+ };
62
+ return Object.values(policy).some((entry) => entry !== undefined) ? policy : undefined;
63
+ }
64
+ function normalizeLoadedAgent(agent) {
65
+ return {
66
+ ...agent,
67
+ capabilities: agent.capabilities || DEFAULT_CAPABILITIES,
68
+ permissionProfile: normalizePermissionProfile(agent.permissionProfile),
69
+ runtimeSelection: normalizeHubAgentRuntimeSelection(agent.runtimeSelection),
70
+ allowedDirectories: Array.isArray(agent.allowedDirectories) ? agent.allowedDirectories : [],
71
+ allowedApps: Array.isArray(agent.allowedApps) ? agent.allowedApps : [],
72
+ approvalRules: Array.isArray(agent.approvalRules) ? agent.approvalRules : [],
73
+ conversations: Array.isArray(agent.conversations) ? agent.conversations : [],
74
+ };
75
+ }
76
+ function normalizeLoadedWorkspaces(workspaces) {
77
+ return workspaces.map((workspace) => ({
78
+ ...workspace,
79
+ directories: Array.isArray(workspace.directories) ? workspace.directories : [],
80
+ apps: Array.isArray(workspace.apps) ? workspace.apps : [],
81
+ teams: (Array.isArray(workspace.teams) ? workspace.teams : []).map((team) => ({
82
+ ...team,
83
+ allowedDirectories: Array.isArray(team.allowedDirectories) ? team.allowedDirectories : [],
84
+ allowedApps: Array.isArray(team.allowedApps) ? team.allowedApps : [],
85
+ teamAgentPolicy: normalizeTeamAgentCallPolicy(team.teamAgentPolicy),
86
+ agents: (Array.isArray(team.agents) ? team.agents : []).map(normalizeLoadedAgent),
87
+ })),
88
+ }));
89
+ }
90
+ // Debounced persist
91
+ let persistTimer = null;
92
+ function schedulePersist(workspaces) {
93
+ if (persistTimer)
94
+ clearTimeout(persistTimer);
95
+ persistTimer = setTimeout(() => {
96
+ persistTimer = null;
97
+ const teamCount = workspaces.reduce((sum, w) => sum + w.teams.length, 0);
98
+ const agentCount = workspaces.reduce((sum, w) => sum + w.teams.reduce((s, t) => s + t.agents.length, 0), 0);
99
+ console.warn(`[WorkspaceStore] Saving ${workspaces.length} workspaces, ${teamCount} teams, ${agentCount} agents`);
100
+ getAgentPlatformBridge()?.workspaceStorage?.save(workspaces).catch((err) => {
101
+ console.warn('[WorkspaceStore] Save failed:', err);
102
+ });
103
+ }, 300);
104
+ }
105
+ function flushPersist(workspaces) {
106
+ if (persistTimer)
107
+ clearTimeout(persistTimer);
108
+ persistTimer = null;
109
+ console.warn(`[WorkspaceStore] Flush-saving (delete operation)`);
110
+ getAgentPlatformBridge()?.workspaceStorage?.save(workspaces).catch((err) => {
111
+ console.warn('[WorkspaceStore] Save failed:', err);
112
+ });
113
+ }
114
+ let workspaceStorageChangedListenerRegistered = false;
115
+ let workspaceStorageChangedUnsupportedReported = false;
116
+ /**
117
+ * Registers the cross-surface workspace-change listener when the active platform
118
+ * bridge actually provides one.
119
+ *
120
+ * The presence of `onChanged` is NOT proof the capability works, so the
121
+ * "registered" latch is only set once registration has actually completed. When the
122
+ * surface does not deliver change notifications the absence is reported once and the
123
+ * latch stays open, so a later bridge that does support it can still register.
124
+ */
125
+ function ensureWorkspaceStorageChangedListener() {
126
+ if (workspaceStorageChangedListenerRegistered)
127
+ return;
128
+ const storage = getAgentPlatformBridge()?.workspaceStorage;
129
+ if (typeof storage?.onChanged !== 'function') {
130
+ if (!workspaceStorageChangedUnsupportedReported) {
131
+ workspaceStorageChangedUnsupportedReported = true;
132
+ console.warn('[WorkspaceStore] This surface does not deliver workspace-storage change notifications — '
133
+ + 'workspaces edited in another window or surface will not reload automatically.');
134
+ }
135
+ return;
136
+ }
137
+ try {
138
+ storage.onChanged(() => {
139
+ void useWorkspaceStore.getState().loadWorkspaces();
140
+ });
141
+ workspaceStorageChangedListenerRegistered = true;
142
+ }
143
+ catch (err) {
144
+ console.warn('[WorkspaceStore] Failed to register the workspace-storage change listener:', err);
145
+ }
146
+ }
147
+ // Cascade: collect all agent IDs from a workspace
148
+ function collectAgentIds(workspace) {
149
+ return workspace.teams.flatMap(t => t.agents.map(a => a.id));
150
+ }
151
+ // Cascade: delete conversations for a list of agent IDs
152
+ function cascadeDeleteConversations(agentIds) {
153
+ const store = useAgentChatStore.getState();
154
+ const conversations = store.conversations;
155
+ for (const conv of Object.values(conversations)) {
156
+ if (agentIds.includes(conv.agentId)) {
157
+ store.deleteConversation(conv.id);
158
+ }
159
+ }
160
+ }
161
+ export const useWorkspaceStore = create((set, get) => ({
162
+ workspaces: [],
163
+ isLoaded: false,
164
+ // ── Lifecycle ────────────────────────────────────────────────────────────
165
+ loadWorkspaces: async () => {
166
+ try {
167
+ ensureWorkspaceStorageChangedListener();
168
+ const result = await getAgentPlatformBridge()?.workspaceStorage?.load();
169
+ if (result?.success && Array.isArray(result.workspaces)) {
170
+ const ws = normalizeLoadedWorkspaces(result.workspaces);
171
+ const teamCount = ws.reduce((sum, w) => sum + w.teams.length, 0);
172
+ const agentCount = ws.reduce((sum, w) => sum + w.teams.reduce((s, t) => s + t.agents.length, 0), 0);
173
+ console.warn(`[WorkspaceStore] Loaded ${ws.length} workspaces, ${teamCount} teams, ${agentCount} agents`);
174
+ set({ workspaces: ws, isLoaded: true });
175
+ }
176
+ else {
177
+ console.warn('[WorkspaceStore] No saved workspaces found — starting fresh');
178
+ set({ isLoaded: true });
179
+ }
180
+ }
181
+ catch (err) {
182
+ console.warn('[WorkspaceStore] Failed to load workspaces:', err);
183
+ set({ isLoaded: true });
184
+ }
185
+ },
186
+ // ── Workspace CRUD ───────────────────────────────────────────────────────
187
+ addWorkspace: (name) => {
188
+ const id = generateId();
189
+ const workspace = {
190
+ id,
191
+ name: name.trim(),
192
+ directories: [],
193
+ apps: [],
194
+ teams: [],
195
+ isExpanded: true,
196
+ createdAt: Date.now(),
197
+ };
198
+ set(state => {
199
+ const next = [...state.workspaces, workspace];
200
+ schedulePersist(next);
201
+ return { workspaces: next };
202
+ });
203
+ return id;
204
+ },
205
+ renameWorkspace: (id, name) => {
206
+ set(state => {
207
+ const next = state.workspaces.map(w => w.id === id ? { ...w, name: name.trim() } : w);
208
+ schedulePersist(next);
209
+ return { workspaces: next };
210
+ });
211
+ },
212
+ deleteWorkspace: (id) => {
213
+ const ws = get().workspaces.find(w => w.id === id);
214
+ if (ws)
215
+ cascadeDeleteConversations(collectAgentIds(ws));
216
+ set(state => {
217
+ const next = state.workspaces.filter(w => w.id !== id);
218
+ flushPersist(next);
219
+ return { workspaces: next };
220
+ });
221
+ },
222
+ duplicateWorkspace: (id) => {
223
+ set(state => {
224
+ const source = state.workspaces.find(w => w.id === id);
225
+ if (!source)
226
+ return state;
227
+ const clone = {
228
+ ...source,
229
+ id: generateId(),
230
+ name: `${source.name} (copy)`,
231
+ teams: source.teams.map(t => ({
232
+ ...t,
233
+ id: generateId(),
234
+ agents: t.agents.map(a => ({
235
+ ...a,
236
+ id: generateId(),
237
+ conversations: [],
238
+ })),
239
+ })),
240
+ };
241
+ const next = [...state.workspaces, clone];
242
+ schedulePersist(next);
243
+ return { workspaces: next };
244
+ });
245
+ },
246
+ toggleWorkspaceExpanded: (id) => {
247
+ set(state => {
248
+ const next = state.workspaces.map(w => w.id === id ? { ...w, isExpanded: !w.isExpanded } : w);
249
+ schedulePersist(next);
250
+ return { workspaces: next };
251
+ });
252
+ },
253
+ addDirectoryToWorkspace: (workspaceId, path) => {
254
+ set(state => {
255
+ const next = state.workspaces.map(w => w.id === workspaceId && !w.directories.includes(path)
256
+ ? { ...w, directories: [...w.directories, path] }
257
+ : w);
258
+ schedulePersist(next);
259
+ return { workspaces: next };
260
+ });
261
+ },
262
+ removeDirectoryFromWorkspace: (workspaceId, directory) => {
263
+ set(state => {
264
+ const next = state.workspaces.map(w => {
265
+ if (w.id !== workspaceId)
266
+ return w;
267
+ return {
268
+ ...w,
269
+ directories: w.directories.filter(d => d !== directory),
270
+ teams: w.teams.map(t => ({
271
+ ...t,
272
+ allowedDirectories: t.allowedDirectories.filter(d => d !== directory),
273
+ agents: t.agents.map(a => ({
274
+ ...a,
275
+ allowedDirectories: a.allowedDirectories.filter(d => d !== directory),
276
+ })),
277
+ })),
278
+ };
279
+ });
280
+ schedulePersist(next);
281
+ return { workspaces: next };
282
+ });
283
+ },
284
+ addAppToWorkspace: (workspaceId, app) => {
285
+ set(state => {
286
+ const next = state.workspaces.map(w => w.id === workspaceId ? { ...w, apps: [...w.apps, app] } : w);
287
+ schedulePersist(next);
288
+ return { workspaces: next };
289
+ });
290
+ },
291
+ removeAppFromWorkspace: (workspaceId, appId) => {
292
+ set(state => {
293
+ const next = state.workspaces.map(w => {
294
+ if (w.id !== workspaceId)
295
+ return w;
296
+ return {
297
+ ...w,
298
+ apps: w.apps.filter(a => a.id !== appId),
299
+ teams: w.teams.map(t => ({
300
+ ...t,
301
+ allowedApps: t.allowedApps.filter(id => id !== appId),
302
+ agents: t.agents.map(a => ({
303
+ ...a,
304
+ allowedApps: a.allowedApps.filter(id => id !== appId),
305
+ })),
306
+ })),
307
+ };
308
+ });
309
+ schedulePersist(next);
310
+ return { workspaces: next };
311
+ });
312
+ },
313
+ // ── Team CRUD ────────────────────────────────────────────────────────────
314
+ addTeam: (workspaceId, name) => {
315
+ const id = generateId();
316
+ const team = {
317
+ id,
318
+ name: name.trim(),
319
+ allowedDirectories: [],
320
+ allowedApps: [],
321
+ agents: [],
322
+ isExpanded: true,
323
+ };
324
+ set(state => {
325
+ const next = state.workspaces.map(w => w.id === workspaceId
326
+ ? { ...w, isExpanded: true, teams: [...w.teams, team] }
327
+ : w);
328
+ schedulePersist(next);
329
+ return { workspaces: next };
330
+ });
331
+ return id;
332
+ },
333
+ renameTeam: (workspaceId, teamId, name) => {
334
+ set(state => {
335
+ const next = state.workspaces.map(w => w.id === workspaceId
336
+ ? { ...w, teams: w.teams.map(t => t.id === teamId ? { ...t, name: name.trim() } : t) }
337
+ : w);
338
+ schedulePersist(next);
339
+ return { workspaces: next };
340
+ });
341
+ },
342
+ deleteTeam: (workspaceId, teamId) => {
343
+ const ws = get().workspaces.find(w => w.id === workspaceId);
344
+ const team = ws?.teams.find(t => t.id === teamId);
345
+ if (team)
346
+ cascadeDeleteConversations(team.agents.map(a => a.id));
347
+ set(state => {
348
+ const next = state.workspaces.map(w => w.id === workspaceId
349
+ ? { ...w, teams: w.teams.filter(t => t.id !== teamId) }
350
+ : w);
351
+ flushPersist(next);
352
+ return { workspaces: next };
353
+ });
354
+ },
355
+ duplicateTeam: (workspaceId, teamId) => {
356
+ set(state => {
357
+ const next = state.workspaces.map(w => {
358
+ if (w.id !== workspaceId)
359
+ return w;
360
+ const source = w.teams.find(t => t.id === teamId);
361
+ if (!source)
362
+ return w;
363
+ const clone = {
364
+ ...source,
365
+ id: generateId(),
366
+ name: `${source.name} (copy)`,
367
+ agents: source.agents.map(a => ({ ...a, id: generateId(), conversations: [] })),
368
+ };
369
+ return { ...w, teams: [...w.teams, clone] };
370
+ });
371
+ schedulePersist(next);
372
+ return { workspaces: next };
373
+ });
374
+ },
375
+ moveTeam: (sourceWsId, teamId, targetWsId) => {
376
+ if (sourceWsId === targetWsId)
377
+ return;
378
+ set(state => {
379
+ const sourceWs = state.workspaces.find(w => w.id === sourceWsId);
380
+ const targetWs = state.workspaces.find(w => w.id === targetWsId);
381
+ const team = sourceWs?.teams.find(t => t.id === teamId);
382
+ if (!sourceWs || !targetWs || !team)
383
+ return state;
384
+ // Sanitize: remove directories/apps not in target workspace
385
+ const movedTeam = {
386
+ ...team,
387
+ allowedDirectories: team.allowedDirectories.filter(d => targetWs.directories.includes(d)),
388
+ allowedApps: team.allowedApps.filter(id => targetWs.apps.some(a => a.id === id)),
389
+ agents: team.agents.map(a => ({
390
+ ...a,
391
+ allowedDirectories: a.allowedDirectories.filter(d => targetWs.directories.includes(d)),
392
+ allowedApps: a.allowedApps.filter(id => targetWs.apps.some(app => app.id === id)),
393
+ workspaceName: targetWs.name,
394
+ })),
395
+ };
396
+ const next = state.workspaces.map(w => {
397
+ if (w.id === sourceWsId)
398
+ return { ...w, teams: w.teams.filter(t => t.id !== teamId) };
399
+ if (w.id === targetWsId)
400
+ return { ...w, teams: [...w.teams, movedTeam] };
401
+ return w;
402
+ });
403
+ schedulePersist(next);
404
+ return { workspaces: next };
405
+ });
406
+ },
407
+ toggleTeamExpanded: (workspaceId, teamId) => {
408
+ set(state => {
409
+ const next = state.workspaces.map(w => w.id === workspaceId
410
+ ? { ...w, teams: w.teams.map(t => t.id === teamId ? { ...t, isExpanded: !t.isExpanded } : t) }
411
+ : w);
412
+ schedulePersist(next);
413
+ return { workspaces: next };
414
+ });
415
+ },
416
+ // ── Agent CRUD ───────────────────────────────────────────────────────────
417
+ addAgent: (workspaceId, teamId, name, model, systemPrompt, capabilities) => {
418
+ const id = generateId();
419
+ const ws = get().workspaces.find(w => w.id === workspaceId);
420
+ const team = ws?.teams.find(t => t.id === teamId);
421
+ const isFirst = !team?.agents.length || !team.agents.some(a => a.isMainAssistant);
422
+ const agent = {
423
+ id,
424
+ name: name.trim(),
425
+ isMainAssistant: isFirst,
426
+ model: model || 'claude-sonnet-4-6',
427
+ systemPrompt: systemPrompt || `You are ${name.trim()}, an assistant in ${ws?.name || 'Workspace'}/${team?.name || 'Team'}.`,
428
+ templateName: 'Custom',
429
+ capabilities: capabilities || DEFAULT_CAPABILITIES,
430
+ permissionProfile: DEFAULT_PERMISSION_PROFILE,
431
+ runtimeSelection: {
432
+ ...DEFAULT_HUB_AGENT_RUNTIME_SELECTION,
433
+ selectedAt: Date.now(),
434
+ },
435
+ allowedDirectories: [...(team?.allowedDirectories || [])],
436
+ allowedApps: [...(team?.allowedApps || [])],
437
+ approvalRules: [],
438
+ conversations: [],
439
+ isExpanded: false,
440
+ workspaceName: ws?.name,
441
+ teamName: team?.name,
442
+ };
443
+ set(state => {
444
+ const next = state.workspaces.map(w => w.id === workspaceId
445
+ ? {
446
+ ...w,
447
+ teams: w.teams.map(t => t.id === teamId
448
+ ? { ...t, isExpanded: true, agents: [...t.agents, agent] }
449
+ : t),
450
+ }
451
+ : w);
452
+ schedulePersist(next);
453
+ return { workspaces: next };
454
+ });
455
+ return id;
456
+ },
457
+ renameAgent: (workspaceId, teamId, agentId, name) => {
458
+ set(state => {
459
+ const next = state.workspaces.map(w => w.id === workspaceId
460
+ ? {
461
+ ...w,
462
+ teams: w.teams.map(t => t.id === teamId
463
+ ? { ...t, agents: t.agents.map(a => a.id === agentId ? { ...a, name: name.trim() } : a) }
464
+ : t),
465
+ }
466
+ : w);
467
+ schedulePersist(next);
468
+ return { workspaces: next };
469
+ });
470
+ },
471
+ deleteAgent: (workspaceId, teamId, agentId) => {
472
+ cascadeDeleteConversations([agentId]);
473
+ set(state => {
474
+ const next = state.workspaces.map(w => w.id === workspaceId
475
+ ? {
476
+ ...w,
477
+ teams: w.teams.map(t => t.id === teamId
478
+ ? { ...t, agents: t.agents.filter(a => a.id !== agentId) }
479
+ : t),
480
+ }
481
+ : w);
482
+ flushPersist(next);
483
+ return { workspaces: next };
484
+ });
485
+ },
486
+ duplicateAgent: (workspaceId, teamId, agentId) => {
487
+ set(state => {
488
+ const next = state.workspaces.map(w => w.id === workspaceId
489
+ ? {
490
+ ...w,
491
+ teams: w.teams.map(t => {
492
+ if (t.id !== teamId)
493
+ return t;
494
+ const source = t.agents.find(a => a.id === agentId);
495
+ if (!source)
496
+ return t;
497
+ const clone = {
498
+ ...source,
499
+ id: generateId(),
500
+ name: `${source.name} (copy)`,
501
+ conversations: [],
502
+ };
503
+ return { ...t, agents: [...t.agents, clone] };
504
+ }),
505
+ }
506
+ : w);
507
+ schedulePersist(next);
508
+ return { workspaces: next };
509
+ });
510
+ },
511
+ moveAgent: (srcWsId, srcTeamId, agentId, dstWsId, dstTeamId) => {
512
+ if (srcWsId === dstWsId && srcTeamId === dstTeamId)
513
+ return;
514
+ set(state => {
515
+ const srcWs = state.workspaces.find(w => w.id === srcWsId);
516
+ const srcTeam = srcWs?.teams.find(t => t.id === srcTeamId);
517
+ const agent = srcTeam?.agents.find(a => a.id === agentId);
518
+ if (!agent)
519
+ return state;
520
+ const dstWs = state.workspaces.find(w => w.id === dstWsId);
521
+ const dstTeam = dstWs?.teams.find(t => t.id === dstTeamId);
522
+ if (!dstWs || !dstTeam)
523
+ return state;
524
+ // Sanitize permissions for new workspace
525
+ const movedAgent = {
526
+ ...agent,
527
+ allowedDirectories: agent.allowedDirectories.filter(d => dstWs.directories.includes(d)),
528
+ allowedApps: agent.allowedApps.filter(id => dstWs.apps.some(a => a.id === id)),
529
+ workspaceName: dstWs.name,
530
+ teamName: dstTeam.name,
531
+ };
532
+ const next = state.workspaces.map(w => {
533
+ if (w.id === srcWsId) {
534
+ return {
535
+ ...w,
536
+ teams: w.teams.map(t => t.id === srcTeamId
537
+ ? { ...t, agents: t.agents.filter(a => a.id !== agentId) }
538
+ : t),
539
+ };
540
+ }
541
+ if (w.id === dstWsId) {
542
+ return {
543
+ ...w,
544
+ teams: w.teams.map(t => t.id === dstTeamId
545
+ ? { ...t, agents: [...t.agents, movedAgent] }
546
+ : t),
547
+ };
548
+ }
549
+ return w;
550
+ });
551
+ schedulePersist(next);
552
+ return { workspaces: next };
553
+ });
554
+ },
555
+ toggleAgentExpanded: (workspaceId, teamId, agentId) => {
556
+ set(state => {
557
+ const next = state.workspaces.map(w => w.id === workspaceId
558
+ ? {
559
+ ...w,
560
+ teams: w.teams.map(t => t.id === teamId
561
+ ? { ...t, agents: t.agents.map(a => a.id === agentId ? { ...a, isExpanded: !a.isExpanded } : a) }
562
+ : t),
563
+ }
564
+ : w);
565
+ schedulePersist(next);
566
+ return { workspaces: next };
567
+ });
568
+ },
569
+ updateAgent: (workspaceId, teamId, agentId, updates) => {
570
+ const safeUpdates = updates.runtimeSelection === undefined
571
+ ? updates
572
+ : { ...updates, runtimeSelection: normalizeHubAgentRuntimeSelection(updates.runtimeSelection) };
573
+ set(state => {
574
+ const next = state.workspaces.map(w => w.id === workspaceId
575
+ ? {
576
+ ...w,
577
+ teams: w.teams.map(t => t.id === teamId
578
+ ? { ...t, agents: t.agents.map(a => a.id === agentId ? { ...a, ...safeUpdates } : a) }
579
+ : t),
580
+ }
581
+ : w);
582
+ schedulePersist(next);
583
+ return { workspaces: next };
584
+ });
585
+ },
586
+ addAgentApprovalRule: (workspaceId, teamId, agentId, rule) => {
587
+ set(state => {
588
+ const nextRule = {
589
+ ...rule,
590
+ id: rule.id || generateId(),
591
+ createdAt: rule.createdAt || Date.now(),
592
+ };
593
+ const sameRule = (existing) => (existing.surface === nextRule.surface
594
+ && existing.action === nextRule.action
595
+ && existing.matcher === nextRule.matcher
596
+ && (existing.browserOrigin || '') === (nextRule.browserOrigin || ''));
597
+ const next = state.workspaces.map(w => w.id === workspaceId
598
+ ? {
599
+ ...w,
600
+ teams: w.teams.map(t => t.id === teamId
601
+ ? {
602
+ ...t,
603
+ agents: t.agents.map(a => {
604
+ if (a.id !== agentId)
605
+ return a;
606
+ const current = a.approvalRules || [];
607
+ const deduped = current.filter(existing => !sameRule(existing));
608
+ return { ...a, approvalRules: [...deduped, nextRule].slice(-200) };
609
+ })
610
+ }
611
+ : t),
612
+ }
613
+ : w);
614
+ schedulePersist(next);
615
+ return { workspaces: next };
616
+ });
617
+ },
618
+ removeAgentApprovalRule: (workspaceId, teamId, agentId, ruleId) => {
619
+ set(state => {
620
+ const next = state.workspaces.map(w => w.id === workspaceId
621
+ ? {
622
+ ...w,
623
+ teams: w.teams.map(t => t.id === teamId
624
+ ? {
625
+ ...t,
626
+ agents: t.agents.map(a => a.id === agentId
627
+ ? { ...a, approvalRules: (a.approvalRules || []).filter(rule => rule.id !== ruleId) }
628
+ : a)
629
+ }
630
+ : t),
631
+ }
632
+ : w);
633
+ schedulePersist(next);
634
+ return { workspaces: next };
635
+ });
636
+ },
637
+ // ── General settings ──────────────────────────────────────────────────────
638
+ updateWorkspace: (id, updates) => {
639
+ set(state => {
640
+ const next = state.workspaces.map(w => w.id === id ? { ...w, ...updates, name: updates.name?.trim() || w.name, updatedAt: Date.now() } : w);
641
+ schedulePersist(next);
642
+ return { workspaces: next };
643
+ });
644
+ },
645
+ updateTeam: (workspaceId, teamId, updates) => {
646
+ set(state => {
647
+ const next = state.workspaces.map(w => w.id === workspaceId
648
+ ? {
649
+ ...w,
650
+ teams: w.teams.map(t => t.id === teamId ? { ...t, ...updates, name: updates.name?.trim() || t.name } : t),
651
+ }
652
+ : w);
653
+ schedulePersist(next);
654
+ return { workspaces: next };
655
+ });
656
+ },
657
+ archiveWorkspace: (id) => {
658
+ set(state => {
659
+ const next = state.workspaces.map(w => w.id === id ? { ...w, isArchived: true } : w);
660
+ flushPersist(next);
661
+ return { workspaces: next };
662
+ });
663
+ },
664
+ unarchiveWorkspace: (id) => {
665
+ set(state => {
666
+ const next = state.workspaces.map(w => w.id === id ? { ...w, isArchived: false } : w);
667
+ flushPersist(next);
668
+ return { workspaces: next };
669
+ });
670
+ },
671
+ // ── Bulk setter (backward compat) ────────────────────────────────────────
672
+ setWorkspaces: (workspacesOrFn) => {
673
+ set(state => {
674
+ const next = typeof workspacesOrFn === 'function'
675
+ ? workspacesOrFn(state.workspaces)
676
+ : workspacesOrFn;
677
+ const normalized = normalizeLoadedWorkspaces(next);
678
+ schedulePersist(normalized);
679
+ return { workspaces: normalized };
680
+ });
681
+ },
682
+ // ── Lookups ──────────────────────────────────────────────────────────────
683
+ findAgentById: (agentId) => {
684
+ for (const workspace of get().workspaces) {
685
+ for (const team of workspace.teams) {
686
+ const agent = team.agents.find(a => a.id === agentId);
687
+ if (agent)
688
+ return { workspace, team, agent };
689
+ }
690
+ }
691
+ return null;
692
+ },
693
+ }));
694
+ //# sourceMappingURL=workspaceStore.js.map