@agent-native/dispatch 0.41.1-nightly-20261104110058 → 0.42.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 (195) hide show
  1. package/CHANGELOG.md +26 -55
  2. package/dist/actions/get-hosted-apps-settings.d.ts +5 -0
  3. package/dist/actions/get-hosted-apps-settings.d.ts.map +1 -0
  4. package/dist/actions/get-hosted-apps-settings.js +25 -0
  5. package/dist/actions/get-hosted-apps-settings.js.map +1 -0
  6. package/dist/actions/index.d.ts.map +1 -1
  7. package/dist/actions/index.js +4 -0
  8. package/dist/actions/index.js.map +1 -1
  9. package/dist/actions/list-connected-agents.d.ts +1 -0
  10. package/dist/actions/list-connected-agents.js +11 -10
  11. package/dist/actions/list-connected-agents.js.map +1 -1
  12. package/dist/actions/list_apps.js +3 -2
  13. package/dist/actions/list_apps.js.map +1 -1
  14. package/dist/actions/provider-api-register.d.ts +10 -10
  15. package/dist/actions/set-hosted-apps-settings.d.ts +7 -0
  16. package/dist/actions/set-hosted-apps-settings.d.ts.map +1 -0
  17. package/dist/actions/set-hosted-apps-settings.js +35 -0
  18. package/dist/actions/set-hosted-apps-settings.js.map +1 -0
  19. package/dist/components/app-card-tiers.d.ts +13 -0
  20. package/dist/components/app-card-tiers.d.ts.map +1 -0
  21. package/dist/components/app-card-tiers.js +22 -0
  22. package/dist/components/app-card-tiers.js.map +1 -0
  23. package/dist/components/app-list-row.d.ts +12 -4
  24. package/dist/components/app-list-row.d.ts.map +1 -1
  25. package/dist/components/app-list-row.js +19 -4
  26. package/dist/components/app-list-row.js.map +1 -1
  27. package/dist/components/app-open-actions.d.ts +4 -0
  28. package/dist/components/app-open-actions.d.ts.map +1 -1
  29. package/dist/components/app-open-actions.js +9 -0
  30. package/dist/components/app-open-actions.js.map +1 -1
  31. package/dist/components/app-pin-button.d.ts +9 -0
  32. package/dist/components/app-pin-button.d.ts.map +1 -0
  33. package/dist/components/app-pin-button.js +29 -0
  34. package/dist/components/app-pin-button.js.map +1 -0
  35. package/dist/components/app-tier-sections.d.ts +27 -0
  36. package/dist/components/app-tier-sections.d.ts.map +1 -0
  37. package/dist/components/app-tier-sections.js +44 -0
  38. package/dist/components/app-tier-sections.js.map +1 -0
  39. package/dist/components/chat-home-apps.d.ts.map +1 -1
  40. package/dist/components/chat-home-apps.js +19 -26
  41. package/dist/components/chat-home-apps.js.map +1 -1
  42. package/dist/components/connected-app-card.d.ts +3 -1
  43. package/dist/components/connected-app-card.d.ts.map +1 -1
  44. package/dist/components/connected-app-card.js +6 -3
  45. package/dist/components/connected-app-card.js.map +1 -1
  46. package/dist/components/create-app-popover.d.ts +4 -0
  47. package/dist/components/create-app-popover.d.ts.map +1 -1
  48. package/dist/components/create-app-popover.js +6 -0
  49. package/dist/components/create-app-popover.js.map +1 -1
  50. package/dist/components/dispatch-control-plane.d.ts.map +1 -1
  51. package/dist/components/dispatch-control-plane.js +25 -35
  52. package/dist/components/dispatch-control-plane.js.map +1 -1
  53. package/dist/components/hosted-apps-settings-group.d.ts +6 -0
  54. package/dist/components/hosted-apps-settings-group.d.ts.map +1 -0
  55. package/dist/components/hosted-apps-settings-group.js +76 -0
  56. package/dist/components/hosted-apps-settings-group.js.map +1 -0
  57. package/dist/components/layout/Layout.d.ts +6 -4
  58. package/dist/components/layout/Layout.d.ts.map +1 -1
  59. package/dist/components/layout/Layout.js +97 -80
  60. package/dist/components/layout/Layout.js.map +1 -1
  61. package/dist/components/workspace-app-card.d.ts.map +1 -1
  62. package/dist/components/workspace-app-card.js +9 -20
  63. package/dist/components/workspace-app-card.js.map +1 -1
  64. package/dist/components/workspace-app-layout-notice.d.ts +9 -0
  65. package/dist/components/workspace-app-layout-notice.d.ts.map +1 -0
  66. package/dist/components/workspace-app-layout-notice.js +27 -0
  67. package/dist/components/workspace-app-layout-notice.js.map +1 -0
  68. package/dist/components/workspace-app-search.d.ts.map +1 -1
  69. package/dist/components/workspace-app-search.js +11 -5
  70. package/dist/components/workspace-app-search.js.map +1 -1
  71. package/dist/components/workspace-template-card.d.ts.map +1 -1
  72. package/dist/components/workspace-template-card.js +7 -2
  73. package/dist/components/workspace-template-card.js.map +1 -1
  74. package/dist/db/index.d.ts.map +1 -1
  75. package/dist/db/index.js +1 -0
  76. package/dist/db/index.js.map +1 -1
  77. package/dist/lib/other-apps.d.ts +10 -1
  78. package/dist/lib/other-apps.d.ts.map +1 -1
  79. package/dist/lib/other-apps.js +7 -1
  80. package/dist/lib/other-apps.js.map +1 -1
  81. package/dist/lib/workspace-app-layout.d.ts +62 -6
  82. package/dist/lib/workspace-app-layout.d.ts.map +1 -1
  83. package/dist/lib/workspace-app-layout.js +196 -41
  84. package/dist/lib/workspace-app-layout.js.map +1 -1
  85. package/dist/lib/workspace-app-lists.d.ts +17 -0
  86. package/dist/lib/workspace-app-lists.d.ts.map +1 -0
  87. package/dist/lib/workspace-app-lists.js +21 -0
  88. package/dist/lib/workspace-app-lists.js.map +1 -0
  89. package/dist/lib/workspace-apps.d.ts +3 -1
  90. package/dist/lib/workspace-apps.d.ts.map +1 -1
  91. package/dist/lib/workspace-apps.js +5 -1
  92. package/dist/lib/workspace-apps.js.map +1 -1
  93. package/dist/routes/pages/apps.d.ts.map +1 -1
  94. package/dist/routes/pages/apps.js +23 -35
  95. package/dist/routes/pages/apps.js.map +1 -1
  96. package/dist/routes/pages/settings-page.d.ts.map +1 -1
  97. package/dist/routes/pages/settings-page.js +24 -3
  98. package/dist/routes/pages/settings-page.js.map +1 -1
  99. package/dist/server/lib/app-creation-store.d.ts.map +1 -1
  100. package/dist/server/lib/app-creation-store.js +13 -18
  101. package/dist/server/lib/app-creation-store.js.map +1 -1
  102. package/dist/server/lib/app-roles.d.ts +2 -0
  103. package/dist/server/lib/app-roles.d.ts.map +1 -1
  104. package/dist/server/lib/app-roles.js +26 -7
  105. package/dist/server/lib/app-roles.js.map +1 -1
  106. package/dist/server/lib/hosted-apps-settings-schema.d.ts +6 -0
  107. package/dist/server/lib/hosted-apps-settings-schema.d.ts.map +1 -0
  108. package/dist/server/lib/hosted-apps-settings-schema.js +6 -0
  109. package/dist/server/lib/hosted-apps-settings-schema.js.map +1 -0
  110. package/dist/server/lib/hosted-apps-settings.d.ts +27 -0
  111. package/dist/server/lib/hosted-apps-settings.d.ts.map +1 -0
  112. package/dist/server/lib/hosted-apps-settings.js +72 -0
  113. package/dist/server/lib/hosted-apps-settings.js.map +1 -0
  114. package/dist/server/plugins/agent-chat.js +6 -3
  115. package/dist/server/plugins/agent-chat.js.map +1 -1
  116. package/dist/server/plugins/integrations.js +3 -3
  117. package/dist/server/plugins/integrations.js.map +1 -1
  118. package/dist/shared/hosted-apps-settings.d.ts +3 -0
  119. package/dist/shared/hosted-apps-settings.d.ts.map +1 -0
  120. package/dist/shared/hosted-apps-settings.js +3 -0
  121. package/dist/shared/hosted-apps-settings.js.map +1 -0
  122. package/package.json +4 -4
  123. package/src/actions/get-hosted-apps-settings.ts +29 -0
  124. package/src/actions/hosted-apps-settings.spec.ts +100 -0
  125. package/src/actions/index.ts +4 -0
  126. package/src/actions/list-connected-agents.spec.ts +67 -0
  127. package/src/actions/list-connected-agents.ts +14 -15
  128. package/src/actions/list_apps.spec.ts +16 -0
  129. package/src/actions/list_apps.ts +5 -2
  130. package/src/actions/set-hosted-apps-settings.ts +42 -0
  131. package/src/components/app-card-tiers.tsx +85 -0
  132. package/src/components/app-list-row.spec.tsx +54 -0
  133. package/src/components/app-list-row.tsx +50 -8
  134. package/src/components/app-open-actions.tsx +16 -0
  135. package/src/components/app-pin-button.spec.tsx +68 -0
  136. package/src/components/app-pin-button.tsx +66 -0
  137. package/src/components/app-tier-sections.spec.tsx +155 -0
  138. package/src/components/app-tier-sections.tsx +158 -0
  139. package/src/components/chat-home-apps.spec.tsx +135 -29
  140. package/src/components/chat-home-apps.tsx +115 -111
  141. package/src/components/connected-app-card.spec.tsx +18 -2
  142. package/src/components/connected-app-card.tsx +18 -1
  143. package/src/components/create-app-popover.tsx +22 -0
  144. package/src/components/dispatch-control-plane.spec.tsx +89 -20
  145. package/src/components/dispatch-control-plane.tsx +91 -125
  146. package/src/components/hosted-apps-settings-group.spec.tsx +218 -0
  147. package/src/components/hosted-apps-settings-group.tsx +189 -0
  148. package/src/components/layout/Layout.spec.tsx +356 -49
  149. package/src/components/layout/Layout.tsx +189 -142
  150. package/src/components/workspace-app-card.spec.tsx +33 -29
  151. package/src/components/workspace-app-card.tsx +13 -31
  152. package/src/components/workspace-app-layout-notice.spec.tsx +106 -0
  153. package/src/components/workspace-app-layout-notice.tsx +65 -0
  154. package/src/components/workspace-app-search.spec.tsx +53 -0
  155. package/src/components/workspace-app-search.tsx +39 -32
  156. package/src/components/workspace-template-card.spec.tsx +10 -0
  157. package/src/components/workspace-template-card.tsx +7 -2
  158. package/src/db/index.spec.ts +9 -0
  159. package/src/db/index.ts +1 -0
  160. package/src/lib/other-apps.spec.ts +25 -0
  161. package/src/lib/other-apps.ts +9 -0
  162. package/src/lib/workspace-app-layout.spec.ts +61 -3
  163. package/src/lib/workspace-app-layout.store.spec.tsx +261 -0
  164. package/src/lib/workspace-app-layout.ts +265 -48
  165. package/src/lib/workspace-app-lists.ts +32 -0
  166. package/src/lib/workspace-apps.ts +10 -2
  167. package/src/routes/pages/apps.spec.tsx +133 -5
  168. package/src/routes/pages/apps.tsx +79 -140
  169. package/src/routes/pages/chat.spec.tsx +66 -49
  170. package/src/routes/pages/settings-page.tsx +31 -3
  171. package/src/routes/pages/settings.spec.tsx +37 -0
  172. package/src/server/lib/app-creation-store.spec.ts +14 -0
  173. package/src/server/lib/app-creation-store.ts +16 -29
  174. package/src/server/lib/app-creation-store.write-observation.spec.ts +216 -0
  175. package/src/server/lib/app-roles.spec.ts +48 -1
  176. package/src/server/lib/app-roles.ts +44 -12
  177. package/src/server/lib/hosted-apps-settings-schema.ts +6 -0
  178. package/src/server/lib/hosted-apps-settings.spec.ts +154 -0
  179. package/src/server/lib/hosted-apps-settings.ts +108 -0
  180. package/src/server/plugins/agent-chat.spec.ts +16 -0
  181. package/src/server/plugins/agent-chat.ts +7 -2
  182. package/src/server/plugins/integrations.ts +3 -3
  183. package/src/shared/hosted-apps-settings.ts +3 -0
  184. package/src/styles/dispatch.css +40 -11
  185. package/dist/components/available-apps-section.d.ts +0 -9
  186. package/dist/components/available-apps-section.d.ts.map +0 -1
  187. package/dist/components/available-apps-section.js +0 -97
  188. package/dist/components/available-apps-section.js.map +0 -1
  189. package/dist/components/other-apps-section.d.ts +0 -35
  190. package/dist/components/other-apps-section.d.ts.map +0 -1
  191. package/dist/components/other-apps-section.js +0 -79
  192. package/dist/components/other-apps-section.js.map +0 -1
  193. package/src/components/available-apps-section.tsx +0 -239
  194. package/src/components/other-apps-section.spec.ts +0 -50
  195. package/src/components/other-apps-section.tsx +0 -254
@@ -1 +1 @@
1
- {"version":3,"file":"create-app-popover.js","sourceRoot":"","sources":["../../src/components/create-app-popover.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,EACL,eAAe,EACf,WAAW,GACZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EACL,+BAA+B,EAC/B,OAAO,EACP,gCAAgC,EAChC,2BAA2B,GAC5B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AAC5F,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,SAAS,EACT,eAAe,EACf,YAAY,EACZ,OAAO,EACP,WAAW,EACX,QAAQ,GACT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,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gF;AAChF,SAAS,oBAAoB,CAAC,EAC5B,OAAO,EACP,SAAS,GAIV;IACC,MAAM,mBAAmB,GAAG,sBAAsB,EAAE,CAAC;IACrD,gFAAgF;IAChF,IAAI,mBAAmB,KAAK,SAAS,EAAE,CAAC;QACtC,OAAO,CACL,cAAK,SAAS,EAAC,yBAAyB,YACtC,KAAC,WAAW,IAAC,IAAI,EAAE,EAAE,EAAE,SAAS,EAAC,oCAAoC,GAAG,GACpE,CACP,CAAC;IACJ,CAAC;IACD,IAAI,mBAAmB;QACrB,OAAO,KAAC,mBAAmB,IAAC,GAAG,EAAE,mBAAmB,GAAI,CAAC;IAC3D,OAAO,CACL,KAAC,aAAa,IAAC,OAAO,EAAE,OAAO,KAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAAI,CAC1E,CAAC;AACJ,CAAC","sourcesContent":["import { sendToAgentChat } from \"@agent-native/core/client/agent-chat\";\nimport { useDevMode } from \"@agent-native/core/client/agent-chat\";\nimport {\n agentNativePath,\n appBasePath,\n} from \"@agent-native/core/client/api-path\";\nimport { isInBuilderFrame } from \"@agent-native/core/client/host\";\nimport {\n buildChatFirstAppCreationPrompt,\n docsUrl,\n getWorkspaceAppIdValidationError,\n titleFromChatFirstAppPrompt,\n} from \"@agent-native/core/shared\";\nimport { PromptComposer } from \"@agent-native/toolkit/app/chat/composer/index\";\nimport { BuilderConnectPopover } from \"@agent-native/toolkit/app/settings\";\nimport { useBuilderConnectFlow } from \"@agent-native/toolkit/app/settings/useBuilderStatus\";\nimport {\n IconAlertTriangle,\n IconArrowLeft,\n IconArrowUpRight,\n IconBook,\n IconCheck,\n IconChevronDown,\n IconFileText,\n IconKey,\n IconLoader2,\n IconPlus,\n} from \"@tabler/icons-react\";\nimport { useEffect, useMemo, useState, type ReactNode } from \"react\";\n\nimport {\n BuildInBuilderPanel,\n useBuilderWorkspaceUrl,\n useNotifyBuildInBuilder,\n} from \"./build-in-builder\";\nimport { Button } from \"./ui/button\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./ui/popover\";\n\ninterface VaultSecretOption {\n id: string;\n name: string;\n credentialKey: string;\n provider?: string | null;\n description?: string | null;\n}\n\ninterface WorkspaceResourceOption {\n id: string;\n kind: \"skill\" | \"instruction\" | \"agent\" | \"knowledge\" | \"mcp-server\";\n name: string;\n description?: string | null;\n path: string;\n scope: \"all\" | \"selected\";\n updatedAt?: number;\n}\n\ntype VaultAccessMode = \"all-apps\" | \"manual\";\n\ninterface CreateAppPopoverProps {\n trigger?: ReactNode;\n align?: \"start\" | \"center\" | \"end\";\n onCreated?: () => void;\n}\n\nasync function fetchJson(url: string, init?: RequestInit): Promise<any> {\n const res = await fetch(url, init);\n const data = await res.json().catch(() => null);\n if (!res.ok) {\n throw new Error(\n data?.error || data?.message || `Request failed ${res.status}`,\n );\n }\n return data;\n}\n\nfunction defaultDispatchBasePath(): string | null {\n const base = appBasePath();\n if (base === \"/dispatch\") return null;\n return null;\n}\n\nfunction actionUrl(basePath: string | null, action: string): string {\n const path = `/_agent-native/actions/${action}`;\n if (basePath === null) return agentNativePath(path);\n const normalized = basePath.replace(/\\/+$/, \"\");\n return `${normalized}${path}`;\n}\n\nconst ERROR_FAILURE_REASONS = new Set([\n \"builder-error\",\n \"builder-not-connected\",\n \"credential-store-unavailable\",\n \"settings-management-required\",\n]);\nconst LOCAL_APP_DOCS_URL = docsUrl(\"multi-app-workspace\", {\n hash: \"adding-a-new-app\",\n});\n\nfunction isErrorFailureReason(reason: string | null): boolean {\n return !!reason && ERROR_FAILURE_REASONS.has(reason);\n}\n\nexport function CreateAppFlow({\n onClose,\n onCreated,\n className = \"\",\n}: {\n onClose?: () => void;\n onCreated?: () => void;\n className?: string;\n}) {\n const notifyBuildInBuilder = useNotifyBuildInBuilder();\n const [step, setStep] = useState<\"prompt\" | \"access\">(\"prompt\");\n const [prompt, setPrompt] = useState(\"\");\n const [selectedSecretIds, setSelectedSecretIds] = useState<string[]>([]);\n const [selectedResourceIds, setSelectedResourceIds] = useState<string[]>([]);\n const [secrets, setSecrets] = useState<VaultSecretOption[]>([]);\n const [resources, setResources] = useState<WorkspaceResourceOption[]>([]);\n const [vaultAccessMode, setVaultAccessMode] =\n useState<VaultAccessMode>(\"all-apps\");\n const [secretsError, setSecretsError] = useState<string | null>(null);\n const [resourcesError, setResourcesError] = useState<string | null>(null);\n const [statusMessage, setStatusMessage] = useState<string | null>(null);\n const [branchUrl, setBranchUrl] = useState<string | null>(null);\n const [failureReason, setFailureReason] = useState<string | null>(null);\n const [isSubmitting, setIsSubmitting] = useState(false);\n const { isDevMode } = useDevMode();\n\n const basePath = useMemo(() => defaultDispatchBasePath(), []);\n\n const connectFlow = useBuilderConnectFlow({\n enabled: failureReason === \"builder-not-connected\",\n provisionAccount: true,\n trackingSource: \"dispatch_create_app\",\n trackingFlow: \"create_app\",\n onConnected: () => {\n setFailureReason(null);\n setStatusMessage(\"Builder connected. Press Create app to try again.\");\n },\n });\n\n useEffect(() => {\n let cancelled = false;\n fetchJson(actionUrl(basePath, \"list-vault-secret-options\"))\n .then((data) => {\n if (cancelled) return;\n setSecrets(Array.isArray(data) ? data : []);\n setSecretsError(null);\n })\n .catch((err) => {\n if (cancelled) return;\n setSecrets([]);\n setSecretsError(err?.message || \"Could not load Dispatch keys\");\n });\n fetchJson(actionUrl(basePath, \"get-vault-access-settings\"))\n .then((data) => {\n if (cancelled) return;\n setVaultAccessMode(data?.mode === \"manual\" ? \"manual\" : \"all-apps\");\n })\n .catch(() => {\n if (cancelled) return;\n setVaultAccessMode(\"manual\");\n });\n fetchJson(actionUrl(basePath, \"list-workspace-resource-options\"))\n .then((data) => {\n if (cancelled) return;\n setResources(Array.isArray(data) ? data : []);\n setResourcesError(null);\n })\n .catch((err) => {\n if (cancelled) return;\n setResources([]);\n setResourcesError(err?.message || \"Could not load Dispatch resources\");\n });\n return () => {\n cancelled = true;\n };\n }, [basePath]);\n\n const selectedSecrets = useMemo(\n () => secrets.filter((s) => selectedSecretIds.includes(s.id)),\n [secrets, selectedSecretIds],\n );\n const selectedResources = useMemo(\n () => resources.filter((r) => selectedResourceIds.includes(r.id)),\n [resources, selectedResourceIds],\n );\n const selectedSecretLabel =\n vaultAccessMode === \"all-apps\"\n ? \"all keys\"\n : selectedSecretIds.length === 0\n ? \"no keys\"\n : `${selectedSecretIds.length} key${selectedSecretIds.length === 1 ? \"\" : \"s\"}`;\n const selectedResourceLabel =\n selectedResourceIds.length === 0\n ? \"no resources\"\n : `${selectedResourceIds.length} resource${selectedResourceIds.length === 1 ? \"\" : \"s\"}`;\n const selectedAccessLabel = [selectedSecretLabel, selectedResourceLabel].join(\n \" · \",\n );\n\n function toggleSecret(id: string) {\n setSelectedSecretIds((cur) =>\n cur.includes(id) ? cur.filter((x) => x !== id) : [...cur, id],\n );\n }\n\n function toggleResource(id: string) {\n setSelectedResourceIds((cur) =>\n cur.includes(id) ? cur.filter((x) => x !== id) : [...cur, id],\n );\n }\n\n async function submit(rawPrompt: string) {\n const trimmed = rawPrompt.trim();\n if (!trimmed || isSubmitting) return;\n const appId = titleFromChatFirstAppPrompt(trimmed);\n const validationError = getWorkspaceAppIdValidationError(appId);\n if (validationError) {\n setStatusMessage(validationError);\n return;\n }\n\n const message = buildChatFirstAppCreationPrompt({\n appId,\n prompt: trimmed,\n selectedKeys:\n vaultAccessMode === \"manual\"\n ? selectedSecrets.map((s) => s.credentialKey)\n : [],\n selectedResources,\n vaultAccessMode,\n });\n setIsSubmitting(true);\n setStatusMessage(null);\n setBranchUrl(null);\n setFailureReason(null);\n\n try {\n if (isInBuilderFrame()) {\n sendToAgentChat({ message, submit: true, type: \"code\" });\n setStatusMessage(\"Sent to Builder chat.\");\n onClose?.();\n } else if (isDevMode) {\n sendToAgentChat({\n message,\n submit: true,\n type: \"code\",\n newTab: true,\n reuseEmptyTab: true,\n });\n setStatusMessage(\"Sent to the local agent.\");\n onClose?.();\n } else {\n const result = await fetchJson(\n actionUrl(basePath, \"start-workspace-app-creation\"),\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n prompt: trimmed,\n appId,\n secretIds:\n vaultAccessMode === \"manual\" && selectedSecretIds.length > 0\n ? selectedSecretIds\n : [],\n resourceIds:\n selectedResourceIds.length > 0 ? selectedResourceIds : [],\n }),\n },\n );\n if (result?.mode === \"builder-managed\") {\n notifyBuildInBuilder(result.url);\n onClose?.();\n } else if (result?.mode === \"builder\") {\n onCreated?.();\n setBranchUrl(result?.url || null);\n setStatusMessage(\"Builder branch created.\");\n } else if (result?.mode === \"local-agent\") {\n sendToAgentChat({\n message: result.prompt ?? message,\n submit: true,\n type: \"code\",\n newTab: true,\n reuseEmptyTab: true,\n });\n setStatusMessage(\"Sent to the local agent.\");\n onClose?.();\n } else {\n setStatusMessage(\n result?.message ||\n \"This requires a code change. Edit locally or use Builder.io to edit this code in the cloud and continue customizing the app any way you like.\",\n );\n setFailureReason(\n result?.mode === \"builder-unavailable\" ? result.reason : null,\n );\n }\n }\n } catch (err: any) {\n setStatusMessage(err?.message || \"Could not start the new app flow.\");\n setFailureReason(null);\n } finally {\n setIsSubmitting(false);\n }\n }\n\n const submitWithSelectedAccess = () => submit(prompt);\n const isCreatingBuilderBranch =\n isSubmitting && !isInBuilderFrame() && !isDevMode;\n\n if (branchUrl) {\n return (\n <div\n className={`flex min-h-[260px] flex-col items-center justify-center gap-5 px-6 py-8 text-center ${className}`}\n >\n <span className=\"flex size-11 items-center justify-center rounded-full bg-primary/10 text-primary\">\n <IconCheck className=\"size-5\" aria-hidden=\"true\" />\n </span>\n <div className=\"space-y-2\">\n <h2 className=\"text-base font-semibold text-foreground\">\n Your Builder branch is ready\n </h2>\n <p className=\"text-sm leading-6 text-muted-foreground\">\n Continue building and editing your app in Builder.\n </p>\n </div>\n <Button asChild className=\"w-full sm:w-auto\">\n <a href={branchUrl} target=\"_blank\" rel=\"noreferrer\">\n Open in Builder <IconArrowUpRight aria-hidden=\"true\" />\n </a>\n </Button>\n </div>\n );\n }\n\n if (isCreatingBuilderBranch) {\n return (\n <div\n className={`flex min-h-[260px] flex-col items-center justify-center gap-4 px-6 py-8 text-center ${className}`}\n aria-live=\"polite\"\n >\n <IconLoader2\n className=\"size-7 animate-spin text-muted-foreground\"\n aria-hidden=\"true\"\n />\n <div className=\"space-y-2\">\n <h2 className=\"text-base font-semibold text-foreground\">\n Creating your Builder branch\n </h2>\n <p className=\"text-sm leading-6 text-muted-foreground\">\n This usually takes a few seconds.\n </p>\n </div>\n </div>\n );\n }\n\n return (\n <div className={`flex flex-col gap-3 ${className}`}>\n {step === \"prompt\" ? (\n <>\n <div className=\"flex items-center justify-between gap-2 px-1\">\n <p className=\"text-sm font-semibold text-foreground\">Create app</p>\n <button\n type=\"button\"\n onClick={() => setStep(\"access\")}\n className=\"inline-flex cursor-pointer items-center gap-1 rounded-md border border-border bg-background/40 px-2 py-1 text-[11px] text-muted-foreground hover:text-foreground hover:bg-accent/50\"\n >\n <IconKey size={11} />\n {selectedAccessLabel}\n </button>\n </div>\n <PromptComposer\n autoFocus\n requireAgentEngine\n disabled={isSubmitting}\n placeholder=\"Describe the app your teammate should be able to use...\"\n draftScope=\"dispatch:create-app\"\n preserveDraftOnSubmit\n onSubmit={(text) => {\n setPrompt(text);\n void submit(text);\n }}\n />\n </>\n ) : (\n <>\n <div className=\"flex items-center justify-between gap-2 px-1\">\n <button\n type=\"button\"\n onClick={() => setStep(\"prompt\")}\n className=\"inline-flex cursor-pointer items-center gap-1 text-xs text-muted-foreground hover:text-foreground\"\n >\n <IconArrowLeft size={12} />\n Back\n </button>\n <span className=\"text-[11px] text-muted-foreground/70\">\n {selectedAccessLabel}\n </span>\n </div>\n <div className=\"max-h-[180px] space-y-2 overflow-y-auto rounded-md border border-border bg-card p-2\">\n <div className=\"flex items-center gap-1.5 px-1 pb-1 text-[11px] font-medium text-muted-foreground\">\n <IconKey size={12} />\n Dispatch keys\n </div>\n {vaultAccessMode === \"all-apps\" ? (\n <p className=\"rounded-md border border-dashed border-border px-3 py-3 text-xs text-muted-foreground\">\n Every saved Dispatch vault key is available to new apps.\n </p>\n ) : secretsError ? (\n <p className=\"rounded-md border border-dashed border-border px-3 py-3 text-xs text-muted-foreground\">\n {secretsError}\n </p>\n ) : secrets.length === 0 ? (\n <p className=\"rounded-md border border-dashed border-border px-3 py-3 text-xs text-muted-foreground\">\n No Dispatch vault keys found yet.\n </p>\n ) : (\n secrets.map((secret) => {\n const selected = selectedSecretIds.includes(secret.id);\n return (\n <div\n key={secret.id}\n className={`group rounded-md border text-sm ${\n selected\n ? \"border-primary/45 bg-primary/5\"\n : \"border-border hover:border-muted-foreground/40 hover:bg-accent/35\"\n }`}\n >\n <button\n type=\"button\"\n aria-pressed={selected}\n onClick={() => toggleSecret(secret.id)}\n className=\"flex w-full cursor-pointer items-start gap-3 rounded-md px-3 py-2 text-left\"\n >\n <span\n className={`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border ${\n selected\n ? \"border-primary/60 bg-primary/10 text-primary\"\n : \"border-muted-foreground/35 text-transparent\"\n }`}\n >\n {selected ? <IconCheck className=\"h-3 w-3\" /> : null}\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-medium\">\n {secret.credentialKey}\n </span>\n <span className=\"block truncate text-xs text-muted-foreground/70\">\n {selected\n ? \"Will be requested for this app\"\n : \"Click to request\"}\n </span>\n </span>\n </button>\n {(secret.provider || secret.name) && (\n <details className=\"group/details border-t border-border/60 px-3 py-1.5 text-xs text-muted-foreground/75\">\n <summary className=\"flex cursor-pointer list-none items-center gap-1.5 text-[11px] hover:text-muted-foreground [&::-webkit-details-marker]:hidden\">\n <IconChevronDown className=\"h-3 w-3 transition-transform group-open/details:rotate-180\" />\n Details\n </summary>\n <div className=\"mt-1.5 space-y-1 pb-0.5 pl-4\">\n <div className=\"truncate\">\n Provider: {secret.provider || \"Not specified\"}\n </div>\n <div className=\"truncate\">Name: {secret.name}</div>\n </div>\n </details>\n )}\n </div>\n );\n })\n )}\n </div>\n <div className=\"max-h-[180px] space-y-2 overflow-y-auto rounded-md border border-border bg-card p-2\">\n <div className=\"flex items-center gap-1.5 px-1 pb-1 text-[11px] font-medium text-muted-foreground\">\n <IconBook size={12} />\n Resource packs\n </div>\n {resourcesError ? (\n <p className=\"rounded-md border border-dashed border-border px-3 py-3 text-xs text-muted-foreground\">\n {resourcesError}\n </p>\n ) : resources.length === 0 ? (\n <p className=\"rounded-md border border-dashed border-border px-3 py-3 text-xs text-muted-foreground\">\n No Dispatch resource packs found yet.\n </p>\n ) : (\n resources.map((resource) => {\n const selected = selectedResourceIds.includes(resource.id);\n return (\n <div\n key={resource.id}\n className={`group rounded-md border text-sm ${\n selected\n ? \"border-primary/45 bg-primary/5\"\n : \"border-border hover:border-muted-foreground/40 hover:bg-accent/35\"\n }`}\n >\n <button\n type=\"button\"\n aria-pressed={selected}\n onClick={() => toggleResource(resource.id)}\n className=\"flex w-full cursor-pointer items-start gap-3 rounded-md px-3 py-2 text-left\"\n >\n <span\n className={`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border ${\n selected\n ? \"border-primary/60 bg-primary/10 text-primary\"\n : \"border-muted-foreground/35 text-transparent\"\n }`}\n >\n {selected ? <IconCheck className=\"h-3 w-3\" /> : null}\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"flex min-w-0 items-center gap-1.5\">\n <IconFileText className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground/70\" />\n <span className=\"block truncate font-medium\">\n {resource.name}\n </span>\n </span>\n <span className=\"block truncate text-xs text-muted-foreground/70\">\n {resource.kind} · {resource.path}\n </span>\n </span>\n </button>\n <details className=\"group/details border-t border-border/60 px-3 py-1.5 text-xs text-muted-foreground/75\">\n <summary className=\"flex cursor-pointer list-none items-center gap-1.5 text-[11px] hover:text-muted-foreground [&::-webkit-details-marker]:hidden\">\n <IconChevronDown className=\"h-3 w-3 transition-transform group-open/details:rotate-180\" />\n Details\n </summary>\n <div className=\"mt-1.5 space-y-1 pb-0.5 pl-4\">\n <div className=\"truncate\">\n Scope:{\" \"}\n {resource.scope === \"all\"\n ? \"All apps\"\n : \"Selected apps\"}\n </div>\n {resource.description ? (\n <div className=\"line-clamp-2\">\n {resource.description}\n </div>\n ) : null}\n </div>\n </details>\n </div>\n );\n })\n )}\n </div>\n <div className=\"flex items-center justify-end gap-2\">\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={submitWithSelectedAccess}\n disabled={!prompt.trim() || isSubmitting}\n >\n {isSubmitting ? (\n <IconLoader2 className=\"h-3.5 w-3.5 animate-spin\" />\n ) : (\n <IconPlus className=\"h-3.5 w-3.5\" />\n )}\n Create app\n </Button>\n </div>\n {!prompt.trim() ? (\n <p className=\"px-1 text-[11px] text-muted-foreground/70\">\n Add a prompt on the previous step before creating the app.\n </p>\n ) : null}\n </>\n )}\n\n {statusMessage ? (\n <div\n className={`flex flex-col gap-2 rounded-md border px-3 py-2 text-xs ${\n isErrorFailureReason(failureReason)\n ? \"border-destructive/40 bg-destructive/10 text-destructive\"\n : \"border-border bg-muted/40 text-muted-foreground\"\n }`}\n >\n <div className=\"flex flex-wrap items-center gap-2\">\n {isErrorFailureReason(failureReason) ? (\n <IconAlertTriangle className=\"h-3.5 w-3.5 shrink-0\" />\n ) : null}\n <span>{statusMessage}</span>\n {branchUrl ? (\n <a\n href={branchUrl}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"inline-flex items-center gap-1 font-medium text-foreground underline\"\n >\n Open in Builder <IconArrowUpRight className=\"h-3 w-3\" />\n </a>\n ) : null}\n </div>\n {failureReason === \"builder-not-connected\" ? (\n <div className=\"flex flex-wrap items-center gap-2\">\n <BuilderConnectPopover flow={connectFlow}>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n disabled={connectFlow.connecting}\n className=\"w-fit\"\n >\n {connectFlow.connecting\n ? \"Setting up Builder.io…\"\n : \"Use Builder.io\"}\n </Button>\n </BuilderConnectPopover>\n <a\n href={LOCAL_APP_DOCS_URL}\n target=\"_blank\"\n rel=\"noreferrer\"\n data-create-app-local-link\n className=\"inline-flex items-center gap-1 text-xs font-medium text-foreground underline underline-offset-2\"\n >\n Create locally <IconArrowUpRight className=\"h-3 w-3\" />\n </a>\n </div>\n ) : null}\n {failureReason === \"credential-store-unavailable\" ||\n failureReason === \"builder-error\" ? (\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n onClick={submitWithSelectedAccess}\n disabled={isSubmitting}\n className=\"w-fit\"\n >\n Try again\n </Button>\n ) : null}\n </div>\n ) : null}\n </div>\n );\n}\n\nexport function CreateAppPopover({\n trigger,\n align = \"center\",\n onCreated,\n}: CreateAppPopoverProps) {\n const [open, setOpen] = useState(false);\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n {trigger ?? (\n <button\n type=\"button\"\n className=\"flex min-h-32 cursor-pointer items-center justify-center rounded-lg border border-dashed bg-card p-4 text-sm font-medium text-muted-foreground transition hover:border-foreground/30 hover:text-foreground\"\n >\n <span className=\"inline-flex items-center gap-2\">\n <IconPlus size={16} />\n Create app\n </span>\n </button>\n )}\n </PopoverTrigger>\n <PopoverContent\n align={align}\n sideOffset={10}\n className=\"relative w-[calc(100vw-2rem)] rounded-xl p-3 shadow-xl sm:w-[460px]\"\n >\n <CreateAppPopoverBody\n onClose={() => setOpen(false)}\n onCreated={onCreated}\n />\n </PopoverContent>\n </Popover>\n );\n}\n\n/** Mounted only while the popover is open, so closed triggers fetch nothing. */\nfunction CreateAppPopoverBody({\n onClose,\n onCreated,\n}: {\n onClose: () => void;\n onCreated?: (() => void) | undefined;\n}) {\n const builderWorkspaceUrl = useBuilderWorkspaceUrl();\n // Until the lookup settles, show nothing rather than a flow that may not apply.\n if (builderWorkspaceUrl === undefined) {\n return (\n <div className=\"flex justify-center p-4\">\n <IconLoader2 size={18} className=\"animate-spin text-muted-foreground\" />\n </div>\n );\n }\n if (builderWorkspaceUrl)\n return <BuildInBuilderPanel url={builderWorkspaceUrl} />;\n return (\n <CreateAppFlow onClose={onClose} {...(onCreated ? { onCreated } : {})} />\n );\n}\n"]}
1
+ {"version":3,"file":"create-app-popover.js","sourceRoot":"","sources":["../../src/components/create-app-popover.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,EACL,eAAe,EACf,WAAW,GACZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EACL,+BAA+B,EAC/B,OAAO,EACP,gCAAgC,EAChC,2BAA2B,GAC5B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AAC5F,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,SAAS,EACT,eAAe,EACf,YAAY,EACZ,OAAO,EACP,WAAW,EACX,QAAQ,GACT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAErE,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AA4BvE,KAAK,UAAU,SAAS,CAAC,GAAW,EAAE,IAAkB;IACtD,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EA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mBAAmB,IAAC,GAAG,EAAE,mBAAmB,GAAI,CAAC;IAC3D,OAAO,CACL,KAAC,aAAa,IAAC,OAAO,EAAE,OAAO,KAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAAI,CAC1E,CAAC;AACJ,CAAC;AAED,kEAAkE;AAClE,MAAM,UAAU,YAAY,CAAC,EAC3B,SAAS,GAGV;IACC,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC;IACjB,OAAO,CACL,KAAC,gBAAgB,IACf,KAAK,EAAC,KAAK,KACP,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EACpC,OAAO,EACL,MAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAC,SAAS,EAAC,IAAI,EAAC,IAAI,EAAC,SAAS,EAAC,SAAS,aACnE,KAAC,QAAQ,IAAC,IAAI,EAAE,EAAE,iBAAc,MAAM,GAAG,EACxC,CAAC,CAAC,uBAAuB,CAAC,IACpB,GAEX,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { sendToAgentChat } from \"@agent-native/core/client/agent-chat\";\nimport { useDevMode } from \"@agent-native/core/client/agent-chat\";\nimport {\n agentNativePath,\n appBasePath,\n} from \"@agent-native/core/client/api-path\";\nimport { isInBuilderFrame } from \"@agent-native/core/client/host\";\nimport { useT } from \"@agent-native/core/client/i18n\";\nimport {\n buildChatFirstAppCreationPrompt,\n docsUrl,\n getWorkspaceAppIdValidationError,\n titleFromChatFirstAppPrompt,\n} from \"@agent-native/core/shared\";\nimport { PromptComposer } from \"@agent-native/toolkit/app/chat/composer/index\";\nimport { BuilderConnectPopover } from \"@agent-native/toolkit/app/settings\";\nimport { useBuilderConnectFlow } from \"@agent-native/toolkit/app/settings/useBuilderStatus\";\nimport {\n IconAlertTriangle,\n IconArrowLeft,\n IconArrowUpRight,\n IconBook,\n IconCheck,\n IconChevronDown,\n IconFileText,\n IconKey,\n IconLoader2,\n IconPlus,\n} from \"@tabler/icons-react\";\nimport { useEffect, useMemo, useState, type ReactNode } from \"react\";\n\nimport {\n BuildInBuilderPanel,\n useBuilderWorkspaceUrl,\n useNotifyBuildInBuilder,\n} from \"./build-in-builder\";\nimport { Button } from \"./ui/button\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./ui/popover\";\n\ninterface VaultSecretOption {\n id: string;\n name: string;\n credentialKey: string;\n provider?: string | null;\n description?: string | null;\n}\n\ninterface WorkspaceResourceOption {\n id: string;\n kind: \"skill\" | \"instruction\" | \"agent\" | \"knowledge\" | \"mcp-server\";\n name: string;\n description?: string | null;\n path: string;\n scope: \"all\" | \"selected\";\n updatedAt?: number;\n}\n\ntype VaultAccessMode = \"all-apps\" | \"manual\";\n\ninterface CreateAppPopoverProps {\n trigger?: ReactNode;\n align?: \"start\" | \"center\" | \"end\";\n onCreated?: () => void;\n}\n\nasync function fetchJson(url: string, init?: RequestInit): Promise<any> {\n const res = await fetch(url, init);\n const data = await res.json().catch(() => null);\n if (!res.ok) {\n throw new Error(\n data?.error || data?.message || `Request failed ${res.status}`,\n );\n }\n return data;\n}\n\nfunction defaultDispatchBasePath(): string | null {\n const base = appBasePath();\n if (base === \"/dispatch\") return null;\n return null;\n}\n\nfunction actionUrl(basePath: string | null, action: string): string {\n const path = `/_agent-native/actions/${action}`;\n if (basePath === null) return agentNativePath(path);\n const normalized = basePath.replace(/\\/+$/, \"\");\n return `${normalized}${path}`;\n}\n\nconst ERROR_FAILURE_REASONS = new Set([\n \"builder-error\",\n \"builder-not-connected\",\n \"credential-store-unavailable\",\n \"settings-management-required\",\n]);\nconst LOCAL_APP_DOCS_URL = docsUrl(\"multi-app-workspace\", {\n hash: \"adding-a-new-app\",\n});\n\nfunction isErrorFailureReason(reason: string | null): boolean {\n return !!reason && ERROR_FAILURE_REASONS.has(reason);\n}\n\nexport function CreateAppFlow({\n onClose,\n onCreated,\n className = \"\",\n}: {\n onClose?: () => void;\n onCreated?: () => void;\n className?: string;\n}) {\n const notifyBuildInBuilder = useNotifyBuildInBuilder();\n const [step, setStep] = useState<\"prompt\" | \"access\">(\"prompt\");\n const [prompt, setPrompt] = useState(\"\");\n const [selectedSecretIds, setSelectedSecretIds] = useState<string[]>([]);\n const [selectedResourceIds, setSelectedResourceIds] = useState<string[]>([]);\n const [secrets, setSecrets] = useState<VaultSecretOption[]>([]);\n const [resources, setResources] = useState<WorkspaceResourceOption[]>([]);\n const [vaultAccessMode, setVaultAccessMode] =\n useState<VaultAccessMode>(\"all-apps\");\n const [secretsError, setSecretsError] = useState<string | null>(null);\n const [resourcesError, setResourcesError] = useState<string | null>(null);\n const [statusMessage, setStatusMessage] = useState<string | null>(null);\n const [branchUrl, setBranchUrl] = useState<string | null>(null);\n const [failureReason, setFailureReason] = useState<string | null>(null);\n const [isSubmitting, setIsSubmitting] = useState(false);\n const { isDevMode } = useDevMode();\n\n const basePath = useMemo(() => defaultDispatchBasePath(), []);\n\n const connectFlow = useBuilderConnectFlow({\n enabled: failureReason === \"builder-not-connected\",\n provisionAccount: true,\n trackingSource: \"dispatch_create_app\",\n trackingFlow: \"create_app\",\n onConnected: () => {\n setFailureReason(null);\n setStatusMessage(\"Builder connected. Press Create app to try again.\");\n },\n });\n\n useEffect(() => {\n let cancelled = false;\n fetchJson(actionUrl(basePath, \"list-vault-secret-options\"))\n .then((data) => {\n if (cancelled) return;\n setSecrets(Array.isArray(data) ? data : []);\n setSecretsError(null);\n })\n .catch((err) => {\n if (cancelled) return;\n setSecrets([]);\n setSecretsError(err?.message || \"Could not load Dispatch keys\");\n });\n fetchJson(actionUrl(basePath, \"get-vault-access-settings\"))\n .then((data) => {\n if (cancelled) return;\n setVaultAccessMode(data?.mode === \"manual\" ? \"manual\" : \"all-apps\");\n })\n .catch(() => {\n if (cancelled) return;\n setVaultAccessMode(\"manual\");\n });\n fetchJson(actionUrl(basePath, \"list-workspace-resource-options\"))\n .then((data) => {\n if (cancelled) return;\n setResources(Array.isArray(data) ? data : []);\n setResourcesError(null);\n })\n .catch((err) => {\n if (cancelled) return;\n setResources([]);\n setResourcesError(err?.message || \"Could not load Dispatch resources\");\n });\n return () => {\n cancelled = true;\n };\n }, [basePath]);\n\n const selectedSecrets = useMemo(\n () => secrets.filter((s) => selectedSecretIds.includes(s.id)),\n [secrets, selectedSecretIds],\n );\n const selectedResources = useMemo(\n () => resources.filter((r) => selectedResourceIds.includes(r.id)),\n [resources, selectedResourceIds],\n );\n const selectedSecretLabel =\n vaultAccessMode === \"all-apps\"\n ? \"all keys\"\n : selectedSecretIds.length === 0\n ? \"no keys\"\n : `${selectedSecretIds.length} key${selectedSecretIds.length === 1 ? \"\" : \"s\"}`;\n const selectedResourceLabel =\n selectedResourceIds.length === 0\n ? \"no resources\"\n : `${selectedResourceIds.length} resource${selectedResourceIds.length === 1 ? \"\" : \"s\"}`;\n const selectedAccessLabel = [selectedSecretLabel, selectedResourceLabel].join(\n \" · \",\n );\n\n function toggleSecret(id: string) {\n setSelectedSecretIds((cur) =>\n cur.includes(id) ? cur.filter((x) => x !== id) : [...cur, id],\n );\n }\n\n function toggleResource(id: string) {\n setSelectedResourceIds((cur) =>\n cur.includes(id) ? cur.filter((x) => x !== id) : [...cur, id],\n );\n }\n\n async function submit(rawPrompt: string) {\n const trimmed = rawPrompt.trim();\n if (!trimmed || isSubmitting) return;\n const appId = titleFromChatFirstAppPrompt(trimmed);\n const validationError = getWorkspaceAppIdValidationError(appId);\n if (validationError) {\n setStatusMessage(validationError);\n return;\n }\n\n const message = buildChatFirstAppCreationPrompt({\n appId,\n prompt: trimmed,\n selectedKeys:\n vaultAccessMode === \"manual\"\n ? selectedSecrets.map((s) => s.credentialKey)\n : [],\n selectedResources,\n vaultAccessMode,\n });\n setIsSubmitting(true);\n setStatusMessage(null);\n setBranchUrl(null);\n setFailureReason(null);\n\n try {\n if (isInBuilderFrame()) {\n sendToAgentChat({ message, submit: true, type: \"code\" });\n setStatusMessage(\"Sent to Builder chat.\");\n onClose?.();\n } else if (isDevMode) {\n sendToAgentChat({\n message,\n submit: true,\n type: \"code\",\n newTab: true,\n reuseEmptyTab: true,\n });\n setStatusMessage(\"Sent to the local agent.\");\n onClose?.();\n } else {\n const result = await fetchJson(\n actionUrl(basePath, \"start-workspace-app-creation\"),\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n prompt: trimmed,\n appId,\n secretIds:\n vaultAccessMode === \"manual\" && selectedSecretIds.length > 0\n ? selectedSecretIds\n : [],\n resourceIds:\n selectedResourceIds.length > 0 ? selectedResourceIds : [],\n }),\n },\n );\n if (result?.mode === \"builder-managed\") {\n notifyBuildInBuilder(result.url);\n onClose?.();\n } else if (result?.mode === \"builder\") {\n onCreated?.();\n setBranchUrl(result?.url || null);\n setStatusMessage(\"Builder branch created.\");\n } else if (result?.mode === \"local-agent\") {\n sendToAgentChat({\n message: result.prompt ?? message,\n submit: true,\n type: \"code\",\n newTab: true,\n reuseEmptyTab: true,\n });\n setStatusMessage(\"Sent to the local agent.\");\n onClose?.();\n } else {\n setStatusMessage(\n result?.message ||\n \"This requires a code change. Edit locally or use Builder.io to edit this code in the cloud and continue customizing the app any way you like.\",\n );\n setFailureReason(\n result?.mode === \"builder-unavailable\" ? result.reason : null,\n );\n }\n }\n } catch (err: any) {\n setStatusMessage(err?.message || \"Could not start the new app flow.\");\n setFailureReason(null);\n } finally {\n setIsSubmitting(false);\n }\n }\n\n const submitWithSelectedAccess = () => submit(prompt);\n const isCreatingBuilderBranch =\n isSubmitting && !isInBuilderFrame() && !isDevMode;\n\n if (branchUrl) {\n return (\n <div\n className={`flex min-h-[260px] flex-col items-center justify-center gap-5 px-6 py-8 text-center ${className}`}\n >\n <span className=\"flex size-11 items-center justify-center rounded-full bg-primary/10 text-primary\">\n <IconCheck className=\"size-5\" aria-hidden=\"true\" />\n </span>\n <div className=\"space-y-2\">\n <h2 className=\"text-base font-semibold text-foreground\">\n Your Builder branch is ready\n </h2>\n <p className=\"text-sm leading-6 text-muted-foreground\">\n Continue building and editing your app in Builder.\n </p>\n </div>\n <Button asChild className=\"w-full sm:w-auto\">\n <a href={branchUrl} target=\"_blank\" rel=\"noreferrer\">\n Open in Builder <IconArrowUpRight aria-hidden=\"true\" />\n </a>\n </Button>\n </div>\n );\n }\n\n if (isCreatingBuilderBranch) {\n return (\n <div\n className={`flex min-h-[260px] flex-col items-center justify-center gap-4 px-6 py-8 text-center ${className}`}\n aria-live=\"polite\"\n >\n <IconLoader2\n className=\"size-7 animate-spin text-muted-foreground\"\n aria-hidden=\"true\"\n />\n <div className=\"space-y-2\">\n <h2 className=\"text-base font-semibold text-foreground\">\n Creating your Builder branch\n </h2>\n <p className=\"text-sm leading-6 text-muted-foreground\">\n This usually takes a few seconds.\n </p>\n </div>\n </div>\n );\n }\n\n return (\n <div className={`flex flex-col gap-3 ${className}`}>\n {step === \"prompt\" ? (\n <>\n <div className=\"flex items-center justify-between gap-2 px-1\">\n <p className=\"text-sm font-semibold text-foreground\">Create app</p>\n <button\n type=\"button\"\n onClick={() => setStep(\"access\")}\n className=\"inline-flex cursor-pointer items-center gap-1 rounded-md border border-border bg-background/40 px-2 py-1 text-[11px] text-muted-foreground hover:text-foreground hover:bg-accent/50\"\n >\n <IconKey size={11} />\n {selectedAccessLabel}\n </button>\n </div>\n <PromptComposer\n autoFocus\n requireAgentEngine\n disabled={isSubmitting}\n placeholder=\"Describe the app your teammate should be able to use...\"\n draftScope=\"dispatch:create-app\"\n preserveDraftOnSubmit\n onSubmit={(text) => {\n setPrompt(text);\n void submit(text);\n }}\n />\n </>\n ) : (\n <>\n <div className=\"flex items-center justify-between gap-2 px-1\">\n <button\n type=\"button\"\n onClick={() => setStep(\"prompt\")}\n className=\"inline-flex cursor-pointer items-center gap-1 text-xs text-muted-foreground hover:text-foreground\"\n >\n <IconArrowLeft size={12} />\n Back\n </button>\n <span className=\"text-[11px] text-muted-foreground/70\">\n {selectedAccessLabel}\n </span>\n </div>\n <div className=\"max-h-[180px] space-y-2 overflow-y-auto rounded-md border border-border bg-card p-2\">\n <div className=\"flex items-center gap-1.5 px-1 pb-1 text-[11px] font-medium text-muted-foreground\">\n <IconKey size={12} />\n Dispatch keys\n </div>\n {vaultAccessMode === \"all-apps\" ? (\n <p className=\"rounded-md border border-dashed border-border px-3 py-3 text-xs text-muted-foreground\">\n Every saved Dispatch vault key is available to new apps.\n </p>\n ) : secretsError ? (\n <p className=\"rounded-md border border-dashed border-border px-3 py-3 text-xs text-muted-foreground\">\n {secretsError}\n </p>\n ) : secrets.length === 0 ? (\n <p className=\"rounded-md border border-dashed border-border px-3 py-3 text-xs text-muted-foreground\">\n No Dispatch vault keys found yet.\n </p>\n ) : (\n secrets.map((secret) => {\n const selected = selectedSecretIds.includes(secret.id);\n return (\n <div\n key={secret.id}\n className={`group rounded-md border text-sm ${\n selected\n ? \"border-primary/45 bg-primary/5\"\n : \"border-border hover:border-muted-foreground/40 hover:bg-accent/35\"\n }`}\n >\n <button\n type=\"button\"\n aria-pressed={selected}\n onClick={() => toggleSecret(secret.id)}\n className=\"flex w-full cursor-pointer items-start gap-3 rounded-md px-3 py-2 text-left\"\n >\n <span\n className={`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border ${\n selected\n ? \"border-primary/60 bg-primary/10 text-primary\"\n : \"border-muted-foreground/35 text-transparent\"\n }`}\n >\n {selected ? <IconCheck className=\"h-3 w-3\" /> : null}\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-medium\">\n {secret.credentialKey}\n </span>\n <span className=\"block truncate text-xs text-muted-foreground/70\">\n {selected\n ? \"Will be requested for this app\"\n : \"Click to request\"}\n </span>\n </span>\n </button>\n {(secret.provider || secret.name) && (\n <details className=\"group/details border-t border-border/60 px-3 py-1.5 text-xs text-muted-foreground/75\">\n <summary className=\"flex cursor-pointer list-none items-center gap-1.5 text-[11px] hover:text-muted-foreground [&::-webkit-details-marker]:hidden\">\n <IconChevronDown className=\"h-3 w-3 transition-transform group-open/details:rotate-180\" />\n Details\n </summary>\n <div className=\"mt-1.5 space-y-1 pb-0.5 pl-4\">\n <div className=\"truncate\">\n Provider: {secret.provider || \"Not specified\"}\n </div>\n <div className=\"truncate\">Name: {secret.name}</div>\n </div>\n </details>\n )}\n </div>\n );\n })\n )}\n </div>\n <div className=\"max-h-[180px] space-y-2 overflow-y-auto rounded-md border border-border bg-card p-2\">\n <div className=\"flex items-center gap-1.5 px-1 pb-1 text-[11px] font-medium text-muted-foreground\">\n <IconBook size={12} />\n Resource packs\n </div>\n {resourcesError ? (\n <p className=\"rounded-md border border-dashed border-border px-3 py-3 text-xs text-muted-foreground\">\n {resourcesError}\n </p>\n ) : resources.length === 0 ? (\n <p className=\"rounded-md border border-dashed border-border px-3 py-3 text-xs text-muted-foreground\">\n No Dispatch resource packs found yet.\n </p>\n ) : (\n resources.map((resource) => {\n const selected = selectedResourceIds.includes(resource.id);\n return (\n <div\n key={resource.id}\n className={`group rounded-md border text-sm ${\n selected\n ? \"border-primary/45 bg-primary/5\"\n : \"border-border hover:border-muted-foreground/40 hover:bg-accent/35\"\n }`}\n >\n <button\n type=\"button\"\n aria-pressed={selected}\n onClick={() => toggleResource(resource.id)}\n className=\"flex w-full cursor-pointer items-start gap-3 rounded-md px-3 py-2 text-left\"\n >\n <span\n className={`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border ${\n selected\n ? \"border-primary/60 bg-primary/10 text-primary\"\n : \"border-muted-foreground/35 text-transparent\"\n }`}\n >\n {selected ? <IconCheck className=\"h-3 w-3\" /> : null}\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"flex min-w-0 items-center gap-1.5\">\n <IconFileText className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground/70\" />\n <span className=\"block truncate font-medium\">\n {resource.name}\n </span>\n </span>\n <span className=\"block truncate text-xs text-muted-foreground/70\">\n {resource.kind} · {resource.path}\n </span>\n </span>\n </button>\n <details className=\"group/details border-t border-border/60 px-3 py-1.5 text-xs text-muted-foreground/75\">\n <summary className=\"flex cursor-pointer list-none items-center gap-1.5 text-[11px] hover:text-muted-foreground [&::-webkit-details-marker]:hidden\">\n <IconChevronDown className=\"h-3 w-3 transition-transform group-open/details:rotate-180\" />\n Details\n </summary>\n <div className=\"mt-1.5 space-y-1 pb-0.5 pl-4\">\n <div className=\"truncate\">\n Scope:{\" \"}\n {resource.scope === \"all\"\n ? \"All apps\"\n : \"Selected apps\"}\n </div>\n {resource.description ? (\n <div className=\"line-clamp-2\">\n {resource.description}\n </div>\n ) : null}\n </div>\n </details>\n </div>\n );\n })\n )}\n </div>\n <div className=\"flex items-center justify-end gap-2\">\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={submitWithSelectedAccess}\n disabled={!prompt.trim() || isSubmitting}\n >\n {isSubmitting ? (\n <IconLoader2 className=\"h-3.5 w-3.5 animate-spin\" />\n ) : (\n <IconPlus className=\"h-3.5 w-3.5\" />\n )}\n Create app\n </Button>\n </div>\n {!prompt.trim() ? (\n <p className=\"px-1 text-[11px] text-muted-foreground/70\">\n Add a prompt on the previous step before creating the app.\n </p>\n ) : null}\n </>\n )}\n\n {statusMessage ? (\n <div\n className={`flex flex-col gap-2 rounded-md border px-3 py-2 text-xs ${\n isErrorFailureReason(failureReason)\n ? \"border-destructive/40 bg-destructive/10 text-destructive\"\n : \"border-border bg-muted/40 text-muted-foreground\"\n }`}\n >\n <div className=\"flex flex-wrap items-center gap-2\">\n {isErrorFailureReason(failureReason) ? (\n <IconAlertTriangle className=\"h-3.5 w-3.5 shrink-0\" />\n ) : null}\n <span>{statusMessage}</span>\n {branchUrl ? (\n <a\n href={branchUrl}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"inline-flex items-center gap-1 font-medium text-foreground underline\"\n >\n Open in Builder <IconArrowUpRight className=\"h-3 w-3\" />\n </a>\n ) : null}\n </div>\n {failureReason === \"builder-not-connected\" ? (\n <div className=\"flex flex-wrap items-center gap-2\">\n <BuilderConnectPopover flow={connectFlow}>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n disabled={connectFlow.connecting}\n className=\"w-fit\"\n >\n {connectFlow.connecting\n ? \"Setting up Builder.io…\"\n : \"Use Builder.io\"}\n </Button>\n </BuilderConnectPopover>\n <a\n href={LOCAL_APP_DOCS_URL}\n target=\"_blank\"\n rel=\"noreferrer\"\n data-create-app-local-link\n className=\"inline-flex items-center gap-1 text-xs font-medium text-foreground underline underline-offset-2\"\n >\n Create locally <IconArrowUpRight className=\"h-3 w-3\" />\n </a>\n </div>\n ) : null}\n {failureReason === \"credential-store-unavailable\" ||\n failureReason === \"builder-error\" ? (\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n onClick={submitWithSelectedAccess}\n disabled={isSubmitting}\n className=\"w-fit\"\n >\n Try again\n </Button>\n ) : null}\n </div>\n ) : null}\n </div>\n );\n}\n\nexport function CreateAppPopover({\n trigger,\n align = \"center\",\n onCreated,\n}: CreateAppPopoverProps) {\n const [open, setOpen] = useState(false);\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n {trigger ?? (\n <button\n type=\"button\"\n className=\"flex min-h-32 cursor-pointer items-center justify-center rounded-lg border border-dashed bg-card p-4 text-sm font-medium text-muted-foreground transition hover:border-foreground/30 hover:text-foreground\"\n >\n <span className=\"inline-flex items-center gap-2\">\n <IconPlus size={16} />\n Create app\n </span>\n </button>\n )}\n </PopoverTrigger>\n <PopoverContent\n align={align}\n sideOffset={10}\n className=\"relative w-[calc(100vw-2rem)] rounded-xl p-3 shadow-xl sm:w-[460px]\"\n >\n <CreateAppPopoverBody\n onClose={() => setOpen(false)}\n onCreated={onCreated}\n />\n </PopoverContent>\n </Popover>\n );\n}\n\n/** Mounted only while the popover is open, so closed triggers fetch nothing. */\nfunction CreateAppPopoverBody({\n onClose,\n onCreated,\n}: {\n onClose: () => void;\n onCreated?: (() => void) | undefined;\n}) {\n const builderWorkspaceUrl = useBuilderWorkspaceUrl();\n // Until the lookup settles, show nothing rather than a flow that may not apply.\n if (builderWorkspaceUrl === undefined) {\n return (\n <div className=\"flex justify-center p-4\">\n <IconLoader2 size={18} className=\"animate-spin text-muted-foreground\" />\n </div>\n );\n }\n if (builderWorkspaceUrl)\n return <BuildInBuilderPanel url={builderWorkspaceUrl} />;\n return (\n <CreateAppFlow onClose={onClose} {...(onCreated ? { onCreated } : {})} />\n );\n}\n\n/** The \"New app\" button every app list puts beside its search. */\nexport function NewAppButton({\n onCreated,\n}: {\n onCreated?: (() => void) | undefined;\n}) {\n const t = useT();\n return (\n <CreateAppPopover\n align=\"end\"\n {...(onCreated ? { onCreated } : {})}\n trigger={\n <Button type=\"button\" variant=\"default\" size=\"sm\" className=\"gap-1.5\">\n <IconPlus size={14} aria-hidden=\"true\" />\n {t(\"dispatch.pages.newApp\")}\n </Button>\n }\n />\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"dispatch-control-plane.d.ts","sourceRoot":"","sources":["../../src/components/dispatch-control-plane.tsx"],"names":[],"mappings":"AA2VA,wBAAgB,oBAAoB,oDAsBnC"}
1
+ {"version":3,"file":"dispatch-control-plane.d.ts","sourceRoot":"","sources":["../../src/components/dispatch-control-plane.tsx"],"names":[],"mappings":"AAmSA,wBAAgB,oBAAoB,oDA4CnC"}
@@ -1,27 +1,25 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { chatModelSelectionStorageKey, navigateWithAgentChatViewTransition, useChatModels, } from "@agent-native/core/client/agent-chat";
3
- import { useActionQuery } from "@agent-native/core/client/hooks";
4
3
  import { useT } from "@agent-native/core/client/i18n";
5
4
  import { useOrgRole } from "@agent-native/core/client/org";
6
5
  import { PromptBar, PromptComposer, } from "@agent-native/toolkit/app/chat/composer/index";
7
- import { IconChevronDown, IconClockHour4, IconPlus } from "@tabler/icons-react";
6
+ import { IconChevronDown, IconClockHour4 } from "@tabler/icons-react";
8
7
  import { useState } from "react";
9
- import { Link, useNavigate } from "react-router";
10
- import { cn } from "../lib/utils.js";
11
- import { orderWorkspaceApps, useWorkspaceAppLayout, workspaceAppMatchesQuery, } from "../lib/workspace-app-layout.js";
8
+ import { useNavigate } from "react-router";
9
+ import { hasPinnedWorkspaceApp, orderWorkspaceApps, useWorkspaceAppLayout, workspaceAppMatchesQuery, } from "../lib/workspace-app-layout.js";
10
+ import { useWorkspaceAppLists } from "../lib/workspace-app-lists.js";
12
11
  import { isWorkspaceAppVisibleInDefaultLaunchers, } from "../lib/workspace-apps.js";
13
12
  import { ActionQueryError } from "./action-query-error.js";
14
- import { APP_LIST_GRID_CLASS, AppList, APP_LIST_GRID_ROW_CLASS, } from "./app-list-row.js";
15
- import { CreateAppPopover } from "./create-app-popover.js";
13
+ import { AppCardTiers } from "./app-card-tiers.js";
14
+ import { AppList, AppListRow } from "./app-list-row.js";
15
+ import { AppListActions, NoWorkspaceAppsText } from "./app-tier-sections.js";
16
+ import { NewAppButton } from "./create-app-popover.js";
16
17
  import { useSetPageTitle } from "./layout/HeaderActions.js";
17
18
  import { Button } from "./ui/button.js";
18
19
  import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "./ui/collapsible.js";
19
20
  import { Skeleton } from "./ui/skeleton.js";
20
21
  import { WorkspaceAppCard } from "./workspace-app-card.js";
21
22
  import { WorkspaceAppSearch, WorkspaceAppSearchEmpty, } from "./workspace-app-search.js";
22
- function SectionHeader({ title, action, }) {
23
- return (_jsxs("div", { className: "flex min-w-0 items-center justify-between gap-3", children: [_jsx("h2", { className: "truncate text-sm font-semibold text-foreground", children: title }), action ? _jsx("div", { className: "shrink-0", children: action }) : null] }));
24
- }
25
23
  function CommandPanel() {
26
24
  const t = useT();
27
25
  const { org } = useOrgRole();
@@ -62,47 +60,39 @@ function CommandPanel() {
62
60
  defaultValue: "Ask Dispatch anything...",
63
61
  }), selectedEffort: selectedEffort, selectedEngine: selectedEngine, selectedModel: selectedModel, layoutVariant: "hero", rootClassName: "bg-card", onEffortChange: onEffortChange, onModelChange: onModelChange, onSubmit: (text) => send(text) }) }), _jsx("div", { className: "mt-3 flex flex-wrap justify-center gap-2", children: promptSuggestions.map((suggestion) => (_jsx("button", { type: "button", onClick: () => send(suggestion), className: "cursor-pointer rounded-md border border-transparent bg-muted/60 px-2.5 py-1.5 text-xs text-muted-foreground transition-[background-color,color] hover:bg-muted hover:text-foreground", children: suggestion }, suggestion))) })] }) }));
64
62
  }
65
- function AppsPanel({ apps, isLoading, }) {
63
+ function AppsPanel({ apps, hostedApps, isLoading, }) {
66
64
  const t = useT();
67
65
  const [showPending, setShowPending] = useState(false);
68
66
  const [searchQuery, setSearchQuery] = useState("");
69
- const { layout, persistenceError, togglePinned } = useWorkspaceAppLayout();
67
+ const { layout } = useWorkspaceAppLayout();
70
68
  const visibleApps = apps.filter((app) => isWorkspaceAppVisibleInDefaultLaunchers(app) && !app.archived);
71
69
  const activeApps = visibleApps.filter((app) => app.status !== "pending");
72
70
  const pendingApps = visibleApps.filter((app) => app.status === "pending");
73
- const orderedActiveApps = orderWorkspaceApps(activeApps, layout);
74
- const orderedPendingApps = orderWorkspaceApps(pendingApps, layout);
75
- const filteredActiveApps = orderedActiveApps.filter((app) => workspaceAppMatchesQuery(app, searchQuery));
76
- const filteredPendingApps = orderedPendingApps.filter((app) => workspaceAppMatchesQuery(app, searchQuery));
77
- const hasSearchResults = filteredActiveApps.length > 0 || filteredPendingApps.length > 0;
78
- const showSkeletons = isLoading && activeApps.length === 0 && pendingApps.length === 0;
79
- return (_jsxs("section", { className: "mx-auto flex w-full max-w-[1000px] flex-col gap-3", children: [_jsx(SectionHeader, { title: "Apps", action: _jsxs("div", { className: "flex min-w-0 flex-wrap items-center justify-end gap-1.5", children: [_jsx(Button, { variant: "ghost", size: "sm", asChild: true, children: _jsx(Link, { to: "/apps", className: "text-muted-foreground", children: "View all" }) }), !showSkeletons &&
80
- (visibleApps.length > 0 || Boolean(searchQuery.trim())) ? (_jsx(WorkspaceAppSearch, { className: "w-[220px]", query: searchQuery, onQueryChange: setSearchQuery })) : null, _jsx(CreateAppPopover, { align: "end", trigger: _jsxs(Button, { variant: "default", size: "sm", className: "gap-1.5", children: [_jsx(IconPlus, { size: 14 }), t("dispatch.pages.newApp", { defaultValue: "New" })] }) })] }) }), !showSkeletons && visibleApps.length > 0 && persistenceError ? (_jsx("p", { className: "text-xs text-muted-foreground", role: "status", children: persistenceError === "both"
81
- ? t("dispatch.pages.appPinSaveFailed", {
82
- defaultValue: "App pins could not be saved.",
83
- })
84
- : t("dispatch.pages.appPinSavedLocally", {
85
- defaultValue: "App pins are saved on this device only.",
86
- }) })) : null, showSkeletons ? (_jsx(OverviewAppsSkeleton, {})) : searchQuery.trim() && !hasSearchResults ? (_jsx(WorkspaceAppSearchEmpty, { query: searchQuery, onClear: () => setSearchQuery("") })) : (_jsx(_Fragment, { children: _jsxs(AppList, { className: APP_LIST_GRID_CLASS, children: [filteredActiveApps.map((app) => (_jsx(WorkspaceAppCard, { app: app, className: APP_LIST_GRID_ROW_CLASS, isPinned: layout.pinnedIds.includes(app.id.toLowerCase()), onTogglePinned: () => togglePinned(app.id) }, app.id))), filteredActiveApps.length === 0 &&
87
- pendingApps.length === 0 &&
88
- !searchQuery.trim() ? (_jsx("p", { className: "px-4 py-3 text-sm text-muted-foreground", children: t("dispatch.pages.noApps", {
89
- defaultValue: "No apps yet.",
90
- }) })) : null] }) })), pendingApps.length > 0 &&
71
+ const filteredActiveApps = activeApps.filter((app) => workspaceAppMatchesQuery(app, searchQuery));
72
+ const filteredPendingApps = orderWorkspaceApps(pendingApps, layout).filter((app) => workspaceAppMatchesQuery(app, searchQuery));
73
+ const filteredHostedApps = hostedApps.filter((app) => workspaceAppMatchesQuery(app, searchQuery));
74
+ const hasSearchResults = filteredActiveApps.length > 0 ||
75
+ filteredPendingApps.length > 0 ||
76
+ filteredHostedApps.length > 0;
77
+ return (_jsxs("section", { className: "mx-auto flex w-full max-w-[1000px] flex-col gap-3", children: [_jsx(AppCardTiers, { workspaceApps: isLoading ? [] : filteredActiveApps, hostedApps: isLoading ? [] : filteredHostedApps, appsTitle: t("dispatch.pages.workspaceApps"), hasPinnedApps: !isLoading &&
78
+ hasPinnedWorkspaceApp([...activeApps, ...hostedApps], layout), actions: _jsx(AppListActions, { viewAllHref: "/apps", search: !isLoading &&
79
+ (visibleApps.length > 0 ||
80
+ hostedApps.length > 0 ||
81
+ Boolean(searchQuery.trim())) ? (_jsx(WorkspaceAppSearch, { className: "w-full sm:w-[220px]", query: searchQuery, onQueryChange: setSearchQuery })) : undefined, newApp: _jsx(NewAppButton, {}) }), appsFallback: isLoading ? (_jsx(OverviewAppsSkeleton, {})) : searchQuery.trim() ? (hasSearchResults ? null : (_jsx(WorkspaceAppSearchEmpty, { query: searchQuery, onClear: () => setSearchQuery("") }))) : activeApps.length === 0 && pendingApps.length === 0 ? (_jsx(NoWorkspaceAppsText, {})) : null }), pendingApps.length > 0 &&
91
82
  (!searchQuery.trim() || filteredPendingApps.length > 0) ? (_jsx(Collapsible, { open: showPending || Boolean(searchQuery.trim()), onOpenChange: setShowPending, children: _jsxs("div", { className: "space-y-3 border-t pt-3", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx(IconClockHour4, { size: 15, className: "shrink-0 text-muted-foreground" }), _jsxs("div", { className: "min-w-0", children: [_jsx("h3", { className: "text-xs font-semibold text-foreground", children: t("dispatch.pages.pendingApps") }), _jsx("p", { className: "text-xs text-muted-foreground", children: t("dispatch.pages.pendingAppsDescription", {
92
83
  count: pendingApps.length,
93
84
  }) })] })] }), _jsx(CollapsibleTrigger, { asChild: true, children: _jsxs(Button, { type: "button", variant: "ghost", size: "sm", className: "h-7 gap-1.5 px-2 text-xs", children: [showPending || Boolean(searchQuery.trim())
94
85
  ? t("dispatch.pages.hidePendingApps")
95
86
  : t("dispatch.pages.showPendingApps"), _jsx(IconChevronDown, { size: 13, className: showPending || searchQuery.trim()
96
87
  ? "rotate-180"
97
- : undefined })] }) })] }), _jsx(CollapsibleContent, { children: _jsx(AppList, { className: APP_LIST_GRID_CLASS, children: filteredPendingApps.map((app) => (_jsx(WorkspaceAppCard, { app: app, className: APP_LIST_GRID_ROW_CLASS }, app.id))) }) })] }) })) : null] }));
88
+ : undefined })] }) })] }), _jsx(CollapsibleContent, { children: _jsx(AppList, { layout: "grid", children: filteredPendingApps.map((app) => (_jsx(WorkspaceAppCard, { app: app }, app.id))) }) })] }) })) : null] }));
98
89
  }
99
90
  function OverviewAppsSkeleton() {
100
- return (_jsx(AppList, { className: APP_LIST_GRID_CLASS, children: Array.from({ length: 4 }).map((_, index) => (_jsxs("div", { className: cn("flex min-w-0 items-center gap-3 border-b px-4 py-3.5 last:border-b-0", APP_LIST_GRID_ROW_CLASS), children: [_jsx(Skeleton, { className: "size-8 shrink-0 rounded-xl" }), _jsxs("div", { className: "min-w-0 flex-1 space-y-2", children: [_jsx(Skeleton, { className: "h-4 w-32" }), _jsx(Skeleton, { className: "h-3 w-2/3" })] }), _jsx(Skeleton, { className: "h-9 w-24 shrink-0 rounded-md" })] }, index))) }));
91
+ return (_jsx(AppList, { layout: "grid", children: Array.from({ length: 4 }).map((_, index) => (_jsxs(AppListRow, { children: [_jsx(Skeleton, { className: "size-8 shrink-0 rounded-xl" }), _jsxs("div", { className: "min-w-0 flex-1 space-y-2", children: [_jsx(Skeleton, { className: "h-4 w-32" }), _jsx(Skeleton, { className: "h-3 w-2/3" })] }), _jsx(Skeleton, { className: "h-9 w-24 shrink-0 rounded-md" })] }, index))) }));
101
92
  }
102
93
  export function DispatchControlPlane() {
103
94
  useSetPageTitle(_jsx("span", { "aria-hidden": true }));
104
- const appsQuery = useActionQuery("list-workspace-apps", { includeAgentCards: false, includeArchived: true });
105
- const { data: workspaceApps = [], isLoading: appsLoading } = appsQuery;
106
- return (_jsxs("div", { className: "flex flex-col gap-8", children: [_jsx(CommandPanel, {}), appsQuery.isError ? (_jsx(ActionQueryError, { error: appsQuery.error, onRetry: () => void appsQuery.refetch(), queryName: "list-workspace-apps" })) : (_jsx(AppsPanel, { apps: workspaceApps ?? [], isLoading: appsLoading }))] }));
95
+ const { status: appsStatus, workspaceApps, hostedApps, appsQuery, connectedAppsQuery, } = useWorkspaceAppLists();
96
+ return (_jsxs("div", { className: "flex flex-col gap-8", children: [_jsx(CommandPanel, {}), appsStatus === "error" ? (_jsx(ActionQueryError, { error: appsQuery.error, onRetry: () => void appsQuery.refetch(), queryName: "list-workspace-apps" })) : (_jsxs(_Fragment, { children: [appsQuery.isError ? (_jsx(ActionQueryError, { error: appsQuery.error, onRetry: () => void appsQuery.refetch(), queryName: "list-workspace-apps" })) : null, connectedAppsQuery.isError ? (_jsx(ActionQueryError, { error: connectedAppsQuery.error, onRetry: () => void connectedAppsQuery.refetch(), queryName: "list-connected-agents" })) : null, _jsx(AppsPanel, { apps: workspaceApps, hostedApps: hostedApps, isLoading: appsStatus === "loading" })] }))] }));
107
97
  }
108
98
  //# sourceMappingURL=dispatch-control-plane.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dispatch-control-plane.js","sourceRoot":"","sources":["../../src/components/dispatch-control-plane.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,4BAA4B,EAC5B,mCAAmC,EACnC,aAAa,GACd,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EACL,SAAS,EACT,cAAc,GACf,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEhF,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAA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AAC,UAAU,GAAG,EACjC,KAAC,QAAQ,IAAC,SAAS,EAAC,WAAW,GAAG,IAC9B,EACN,KAAC,QAAQ,IAAC,SAAS,EAAC,8BAA8B,GAAG,KAXhD,KAAK,CAYN,CACP,CAAC,GACM,CACX,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,oBAAoB;IAClC,eAAe,CAAC,qCAAoB,CAAC,CAAC;IACtC,MAAM,SAAS,GAAG,cAAc,CAC9B,qBAAqB,EACrB,EAAE,iBAAiB,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,CACpD,CAAC;IACF,MAAM,EAAE,IAAI,EAAE,aAAa,GAAG,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,SAAS,CAAC;IAEvE,OAAO,CACL,eAAK,SAAS,EAAC,qBAAqB,aAClC,KAAC,YAAY,KAAG,EACf,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CACnB,KAAC,gBAAgB,IACf,KAAK,EAAE,SAAS,CAAC,KAAK,EACtB,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,SAAS,CAAC,OAAO,EAAE,EACvC,SAAS,EAAC,qBAAqB,GAC/B,CACH,CAAC,CAAC,CAAC,CACF,KAAC,SAAS,IAAC,IAAI,EAAE,aAAa,IAAI,EAAE,EAAE,SAAS,EAAE,WAAW,GAAI,CACjE,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["import {\n chatModelSelectionStorageKey,\n navigateWithAgentChatViewTransition,\n useChatModels,\n} from \"@agent-native/core/client/agent-chat\";\nimport { useActionQuery } from \"@agent-native/core/client/hooks\";\nimport { useT } from \"@agent-native/core/client/i18n\";\nimport { useOrgRole } from \"@agent-native/core/client/org\";\nimport {\n PromptBar,\n PromptComposer,\n} from \"@agent-native/toolkit/app/chat/composer/index\";\nimport { IconChevronDown, IconClockHour4, IconPlus } from \"@tabler/icons-react\";\nimport type { ReactNode } from \"react\";\nimport { useState } from \"react\";\nimport { Link, useNavigate } from \"react-router\";\n\nimport { cn } from \"../lib/utils\";\nimport {\n orderWorkspaceApps,\n useWorkspaceAppLayout,\n workspaceAppMatchesQuery,\n} from \"../lib/workspace-app-layout\";\nimport {\n isWorkspaceAppVisibleInDefaultLaunchers,\n type WorkspaceAppSummary,\n} from \"../lib/workspace-apps\";\nimport { ActionQueryError } from \"./action-query-error\";\nimport {\n APP_LIST_GRID_CLASS,\n AppList,\n APP_LIST_GRID_ROW_CLASS,\n} from \"./app-list-row\";\nimport { CreateAppPopover } from \"./create-app-popover\";\nimport { useSetPageTitle } from \"./layout/HeaderActions\";\nimport { Button } from \"./ui/button\";\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from \"./ui/collapsible\";\nimport { Skeleton } from \"./ui/skeleton\";\nimport { WorkspaceAppCard } from \"./workspace-app-card\";\nimport {\n WorkspaceAppSearch,\n WorkspaceAppSearchEmpty,\n} from \"./workspace-app-search\";\n\nfunction SectionHeader({\n title,\n action,\n}: {\n title: string;\n action?: ReactNode;\n}) {\n return (\n <div className=\"flex min-w-0 items-center justify-between gap-3\">\n <h2 className=\"truncate text-sm font-semibold text-foreground\">\n {title}\n </h2>\n {action ? <div className=\"shrink-0\">{action}</div> : null}\n </div>\n );\n}\n\nfunction CommandPanel() {\n const t = useT();\n const { org } = useOrgRole();\n const draftScope = org?.orgId?.trim()\n ? `dispatch:overview:${org.orgId}`\n : \"dispatch:overview\";\n const {\n availableModels,\n isLoading: modelListLoading,\n onEffortChange,\n onModelChange,\n selectedEffort,\n selectedEngine,\n selectedModel,\n } = useChatModels({ storageKey: chatModelSelectionStorageKey(\"dispatch\") });\n const navigate = useNavigate();\n const promptSuggestions = [\n t(\"dispatch.pages.suggestionOnboardingApp\", {\n defaultValue: \"Create an app for onboarding requests\",\n }),\n t(\"dispatch.pages.suggestionAnalyticsAgents\", {\n defaultValue: \"Check which agents can help with analytics\",\n }),\n ];\n\n function send(message: string) {\n const trimmed = message.trim();\n if (!trimmed) return;\n\n navigateWithAgentChatViewTransition(navigate, \"/chat\", {\n state: {\n dispatchPrompt: {\n id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,\n message: trimmed,\n selectedModel,\n selectedEngine,\n selectedEffort,\n },\n },\n });\n }\n\n return (\n <section className=\"flex flex-col\">\n <div className=\"mx-auto flex w-full max-w-[750px] flex-col pt-4 sm:pt-6\">\n <div className=\"mb-5 text-center\">\n <h2 className=\"text-2xl font-semibold tracking-tight text-foreground sm:text-3xl\">\n {t(\"dispatch.pages.chatAcrossApps\", {\n defaultValue: \"Chat across your apps\",\n })}\n </h2>\n <p className=\"mx-auto mt-2 max-w-xl text-sm leading-6 text-muted-foreground\">\n {t(\"dispatch.pages.chatAcrossAppsDescription\", {\n defaultValue:\n \"Route work, inspect status, or create something new from one place.\",\n })}\n </p>\n </div>\n <PromptBar mode=\"inline\" className=\"contents\">\n <PromptComposer\n requireAgentEngine\n availableModels={availableModels}\n draftScope={draftScope}\n modelListLoading={modelListLoading}\n placeholder={t(\"dispatch.pages.overviewPromptPlaceholder\", {\n defaultValue: \"Ask Dispatch anything...\",\n })}\n selectedEffort={selectedEffort}\n selectedEngine={selectedEngine}\n selectedModel={selectedModel}\n layoutVariant=\"hero\"\n rootClassName=\"bg-card\"\n onEffortChange={onEffortChange}\n onModelChange={onModelChange}\n onSubmit={(text) => send(text)}\n />\n </PromptBar>\n <div className=\"mt-3 flex flex-wrap justify-center gap-2\">\n {promptSuggestions.map((suggestion) => (\n <button\n key={suggestion}\n type=\"button\"\n onClick={() => send(suggestion)}\n className=\"cursor-pointer rounded-md border border-transparent bg-muted/60 px-2.5 py-1.5 text-xs text-muted-foreground transition-[background-color,color] hover:bg-muted hover:text-foreground\"\n >\n {suggestion}\n </button>\n ))}\n </div>\n </div>\n </section>\n );\n}\n\nfunction AppsPanel({\n apps,\n isLoading,\n}: {\n apps: WorkspaceAppSummary[];\n isLoading: boolean;\n}) {\n const t = useT();\n const [showPending, setShowPending] = useState(false);\n const [searchQuery, setSearchQuery] = useState(\"\");\n const { layout, persistenceError, togglePinned } = useWorkspaceAppLayout();\n const visibleApps = apps.filter(\n (app) => isWorkspaceAppVisibleInDefaultLaunchers(app) && !app.archived,\n );\n const activeApps = visibleApps.filter((app) => app.status !== \"pending\");\n const pendingApps = visibleApps.filter((app) => app.status === \"pending\");\n const orderedActiveApps = orderWorkspaceApps(activeApps, layout);\n const orderedPendingApps = orderWorkspaceApps(pendingApps, layout);\n const filteredActiveApps = orderedActiveApps.filter((app) =>\n workspaceAppMatchesQuery(app, searchQuery),\n );\n const filteredPendingApps = orderedPendingApps.filter((app) =>\n workspaceAppMatchesQuery(app, searchQuery),\n );\n const hasSearchResults =\n filteredActiveApps.length > 0 || filteredPendingApps.length > 0;\n const showSkeletons =\n isLoading && activeApps.length === 0 && pendingApps.length === 0;\n\n return (\n <section className=\"mx-auto flex w-full max-w-[1000px] flex-col gap-3\">\n <SectionHeader\n title=\"Apps\"\n action={\n <div className=\"flex min-w-0 flex-wrap items-center justify-end gap-1.5\">\n <Button variant=\"ghost\" size=\"sm\" asChild>\n <Link to=\"/apps\" className=\"text-muted-foreground\">\n View all\n </Link>\n </Button>\n {!showSkeletons &&\n (visibleApps.length > 0 || Boolean(searchQuery.trim())) ? (\n <WorkspaceAppSearch\n className=\"w-[220px]\"\n query={searchQuery}\n onQueryChange={setSearchQuery}\n />\n ) : null}\n <CreateAppPopover\n align=\"end\"\n trigger={\n <Button variant=\"default\" size=\"sm\" className=\"gap-1.5\">\n <IconPlus size={14} />\n {t(\"dispatch.pages.newApp\", { defaultValue: \"New\" })}\n </Button>\n }\n />\n </div>\n }\n />\n {!showSkeletons && visibleApps.length > 0 && persistenceError ? (\n <p className=\"text-xs text-muted-foreground\" role=\"status\">\n {persistenceError === \"both\"\n ? t(\"dispatch.pages.appPinSaveFailed\", {\n defaultValue: \"App pins could not be saved.\",\n })\n : t(\"dispatch.pages.appPinSavedLocally\", {\n defaultValue: \"App pins are saved on this device only.\",\n })}\n </p>\n ) : null}\n {showSkeletons ? (\n <OverviewAppsSkeleton />\n ) : searchQuery.trim() && !hasSearchResults ? (\n <WorkspaceAppSearchEmpty\n query={searchQuery}\n onClear={() => setSearchQuery(\"\")}\n />\n ) : (\n <>\n <AppList className={APP_LIST_GRID_CLASS}>\n {filteredActiveApps.map((app) => (\n <WorkspaceAppCard\n key={app.id}\n app={app}\n className={APP_LIST_GRID_ROW_CLASS}\n isPinned={layout.pinnedIds.includes(app.id.toLowerCase())}\n onTogglePinned={() => togglePinned(app.id)}\n />\n ))}\n {filteredActiveApps.length === 0 &&\n pendingApps.length === 0 &&\n !searchQuery.trim() ? (\n <p className=\"px-4 py-3 text-sm text-muted-foreground\">\n {t(\"dispatch.pages.noApps\", {\n defaultValue: \"No apps yet.\",\n })}\n </p>\n ) : null}\n </AppList>\n </>\n )}\n {pendingApps.length > 0 &&\n (!searchQuery.trim() || filteredPendingApps.length > 0) ? (\n <Collapsible\n open={showPending || Boolean(searchQuery.trim())}\n onOpenChange={setShowPending}\n >\n <div className=\"space-y-3 border-t pt-3\">\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <div className=\"flex min-w-0 items-center gap-2\">\n <IconClockHour4\n size={15}\n className=\"shrink-0 text-muted-foreground\"\n />\n <div className=\"min-w-0\">\n <h3 className=\"text-xs font-semibold text-foreground\">\n {t(\"dispatch.pages.pendingApps\")}\n </h3>\n <p className=\"text-xs text-muted-foreground\">\n {t(\"dispatch.pages.pendingAppsDescription\", {\n count: pendingApps.length,\n })}\n </p>\n </div>\n </div>\n <CollapsibleTrigger asChild>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-7 gap-1.5 px-2 text-xs\"\n >\n {showPending || Boolean(searchQuery.trim())\n ? t(\"dispatch.pages.hidePendingApps\")\n : t(\"dispatch.pages.showPendingApps\")}\n <IconChevronDown\n size={13}\n className={\n showPending || searchQuery.trim()\n ? \"rotate-180\"\n : undefined\n }\n />\n </Button>\n </CollapsibleTrigger>\n </div>\n <CollapsibleContent>\n <AppList className={APP_LIST_GRID_CLASS}>\n {filteredPendingApps.map((app) => (\n <WorkspaceAppCard\n key={app.id}\n app={app}\n className={APP_LIST_GRID_ROW_CLASS}\n />\n ))}\n </AppList>\n </CollapsibleContent>\n </div>\n </Collapsible>\n ) : null}\n </section>\n );\n}\n\nfunction OverviewAppsSkeleton() {\n return (\n <AppList className={APP_LIST_GRID_CLASS}>\n {Array.from({ length: 4 }).map((_, index) => (\n <div\n key={index}\n className={cn(\n \"flex min-w-0 items-center gap-3 border-b px-4 py-3.5 last:border-b-0\",\n APP_LIST_GRID_ROW_CLASS,\n )}\n >\n <Skeleton className=\"size-8 shrink-0 rounded-xl\" />\n <div className=\"min-w-0 flex-1 space-y-2\">\n <Skeleton className=\"h-4 w-32\" />\n <Skeleton className=\"h-3 w-2/3\" />\n </div>\n <Skeleton className=\"h-9 w-24 shrink-0 rounded-md\" />\n </div>\n ))}\n </AppList>\n );\n}\n\nexport function DispatchControlPlane() {\n useSetPageTitle(<span aria-hidden />);\n const appsQuery = useActionQuery<WorkspaceAppSummary[]>(\n \"list-workspace-apps\",\n { includeAgentCards: false, includeArchived: true },\n );\n const { data: workspaceApps = [], isLoading: appsLoading } = appsQuery;\n\n return (\n <div className=\"flex flex-col gap-8\">\n <CommandPanel />\n {appsQuery.isError ? (\n <ActionQueryError\n error={appsQuery.error}\n onRetry={() => void appsQuery.refetch()}\n queryName=\"list-workspace-apps\"\n />\n ) : (\n <AppsPanel apps={workspaceApps ?? []} isLoading={appsLoading} />\n )}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"dispatch-control-plane.js","sourceRoot":"","sources":["../../src/components/dispatch-control-plane.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,4BAA4B,EAC5B,mCAAmC,EACnC,aAAa,GACd,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC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AAG,EAAE,CAAC,KAAK,kBAAkB,CAAC,OAAO,EAAE,EAChD,SAAS,EAAC,uBAAuB,GACjC,CACH,CAAC,CAAC,CAAC,IAAI,EACR,KAAC,SAAS,IACR,IAAI,EAAE,aAAa,EACnB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,UAAU,KAAK,SAAS,GACnC,IACD,CACJ,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["import {\n chatModelSelectionStorageKey,\n navigateWithAgentChatViewTransition,\n useChatModels,\n} from \"@agent-native/core/client/agent-chat\";\nimport { useT } from \"@agent-native/core/client/i18n\";\nimport { useOrgRole } from \"@agent-native/core/client/org\";\nimport {\n PromptBar,\n PromptComposer,\n} from \"@agent-native/toolkit/app/chat/composer/index\";\nimport { IconChevronDown, IconClockHour4 } from \"@tabler/icons-react\";\nimport { useState } from \"react\";\nimport { useNavigate } from \"react-router\";\n\nimport type { ConnectedAppSummary } from \"../lib/other-apps\";\nimport {\n hasPinnedWorkspaceApp,\n orderWorkspaceApps,\n useWorkspaceAppLayout,\n workspaceAppMatchesQuery,\n} from \"../lib/workspace-app-layout\";\nimport { useWorkspaceAppLists } from \"../lib/workspace-app-lists\";\nimport {\n isWorkspaceAppVisibleInDefaultLaunchers,\n type WorkspaceAppSummary,\n} from \"../lib/workspace-apps\";\nimport { ActionQueryError } from \"./action-query-error\";\nimport { AppCardTiers } from \"./app-card-tiers\";\nimport { AppList, AppListRow } from \"./app-list-row\";\nimport { AppListActions, NoWorkspaceAppsText } from \"./app-tier-sections\";\nimport { NewAppButton } from \"./create-app-popover\";\nimport { useSetPageTitle } from \"./layout/HeaderActions\";\nimport { Button } from \"./ui/button\";\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from \"./ui/collapsible\";\nimport { Skeleton } from \"./ui/skeleton\";\nimport { WorkspaceAppCard } from \"./workspace-app-card\";\nimport {\n WorkspaceAppSearch,\n WorkspaceAppSearchEmpty,\n} from \"./workspace-app-search\";\n\nfunction CommandPanel() {\n const t = useT();\n const { org } = useOrgRole();\n const draftScope = org?.orgId?.trim()\n ? `dispatch:overview:${org.orgId}`\n : \"dispatch:overview\";\n const {\n availableModels,\n isLoading: modelListLoading,\n onEffortChange,\n onModelChange,\n selectedEffort,\n selectedEngine,\n selectedModel,\n } = useChatModels({ storageKey: chatModelSelectionStorageKey(\"dispatch\") });\n const navigate = useNavigate();\n const promptSuggestions = [\n t(\"dispatch.pages.suggestionOnboardingApp\", {\n defaultValue: \"Create an app for onboarding requests\",\n }),\n t(\"dispatch.pages.suggestionAnalyticsAgents\", {\n defaultValue: \"Check which agents can help with analytics\",\n }),\n ];\n\n function send(message: string) {\n const trimmed = message.trim();\n if (!trimmed) return;\n\n navigateWithAgentChatViewTransition(navigate, \"/chat\", {\n state: {\n dispatchPrompt: {\n id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,\n message: trimmed,\n selectedModel,\n selectedEngine,\n selectedEffort,\n },\n },\n });\n }\n\n return (\n <section className=\"flex flex-col\">\n <div className=\"mx-auto flex w-full max-w-[750px] flex-col pt-4 sm:pt-6\">\n <div className=\"mb-5 text-center\">\n <h2 className=\"text-2xl font-semibold tracking-tight text-foreground sm:text-3xl\">\n {t(\"dispatch.pages.chatAcrossApps\", {\n defaultValue: \"Chat across your apps\",\n })}\n </h2>\n <p className=\"mx-auto mt-2 max-w-xl text-sm leading-6 text-muted-foreground\">\n {t(\"dispatch.pages.chatAcrossAppsDescription\", {\n defaultValue:\n \"Route work, inspect status, or create something new from one place.\",\n })}\n </p>\n </div>\n <PromptBar mode=\"inline\" className=\"contents\">\n <PromptComposer\n requireAgentEngine\n availableModels={availableModels}\n draftScope={draftScope}\n modelListLoading={modelListLoading}\n placeholder={t(\"dispatch.pages.overviewPromptPlaceholder\", {\n defaultValue: \"Ask Dispatch anything...\",\n })}\n selectedEffort={selectedEffort}\n selectedEngine={selectedEngine}\n selectedModel={selectedModel}\n layoutVariant=\"hero\"\n rootClassName=\"bg-card\"\n onEffortChange={onEffortChange}\n onModelChange={onModelChange}\n onSubmit={(text) => send(text)}\n />\n </PromptBar>\n <div className=\"mt-3 flex flex-wrap justify-center gap-2\">\n {promptSuggestions.map((suggestion) => (\n <button\n key={suggestion}\n type=\"button\"\n onClick={() => send(suggestion)}\n className=\"cursor-pointer rounded-md border border-transparent bg-muted/60 px-2.5 py-1.5 text-xs text-muted-foreground transition-[background-color,color] hover:bg-muted hover:text-foreground\"\n >\n {suggestion}\n </button>\n ))}\n </div>\n </div>\n </section>\n );\n}\n\nfunction AppsPanel({\n apps,\n hostedApps,\n isLoading,\n}: {\n apps: WorkspaceAppSummary[];\n hostedApps: ConnectedAppSummary[];\n isLoading: boolean;\n}) {\n const t = useT();\n const [showPending, setShowPending] = useState(false);\n const [searchQuery, setSearchQuery] = useState(\"\");\n const { layout } = useWorkspaceAppLayout();\n const visibleApps = apps.filter(\n (app) => isWorkspaceAppVisibleInDefaultLaunchers(app) && !app.archived,\n );\n const activeApps = visibleApps.filter((app) => app.status !== \"pending\");\n const pendingApps = visibleApps.filter((app) => app.status === \"pending\");\n const filteredActiveApps = activeApps.filter((app) =>\n workspaceAppMatchesQuery(app, searchQuery),\n );\n const filteredPendingApps = orderWorkspaceApps(pendingApps, layout).filter(\n (app) => workspaceAppMatchesQuery(app, searchQuery),\n );\n const filteredHostedApps = hostedApps.filter((app) =>\n workspaceAppMatchesQuery(app, searchQuery),\n );\n const hasSearchResults =\n filteredActiveApps.length > 0 ||\n filteredPendingApps.length > 0 ||\n filteredHostedApps.length > 0;\n\n return (\n <section className=\"mx-auto flex w-full max-w-[1000px] flex-col gap-3\">\n <AppCardTiers\n workspaceApps={isLoading ? [] : filteredActiveApps}\n hostedApps={isLoading ? [] : filteredHostedApps}\n appsTitle={t(\"dispatch.pages.workspaceApps\")}\n hasPinnedApps={\n !isLoading &&\n hasPinnedWorkspaceApp([...activeApps, ...hostedApps], layout)\n }\n actions={\n <AppListActions\n viewAllHref=\"/apps\"\n search={\n !isLoading &&\n (visibleApps.length > 0 ||\n hostedApps.length > 0 ||\n Boolean(searchQuery.trim())) ? (\n <WorkspaceAppSearch\n className=\"w-full sm:w-[220px]\"\n query={searchQuery}\n onQueryChange={setSearchQuery}\n />\n ) : undefined\n }\n newApp={<NewAppButton />}\n />\n }\n appsFallback={\n isLoading ? (\n <OverviewAppsSkeleton />\n ) : searchQuery.trim() ? (\n hasSearchResults ? null : (\n <WorkspaceAppSearchEmpty\n query={searchQuery}\n onClear={() => setSearchQuery(\"\")}\n />\n )\n ) : activeApps.length === 0 && pendingApps.length === 0 ? (\n <NoWorkspaceAppsText />\n ) : null\n }\n />\n {pendingApps.length > 0 &&\n (!searchQuery.trim() || filteredPendingApps.length > 0) ? (\n <Collapsible\n open={showPending || Boolean(searchQuery.trim())}\n onOpenChange={setShowPending}\n >\n <div className=\"space-y-3 border-t pt-3\">\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <div className=\"flex min-w-0 items-center gap-2\">\n <IconClockHour4\n size={15}\n className=\"shrink-0 text-muted-foreground\"\n />\n <div className=\"min-w-0\">\n <h3 className=\"text-xs font-semibold text-foreground\">\n {t(\"dispatch.pages.pendingApps\")}\n </h3>\n <p className=\"text-xs text-muted-foreground\">\n {t(\"dispatch.pages.pendingAppsDescription\", {\n count: pendingApps.length,\n })}\n </p>\n </div>\n </div>\n <CollapsibleTrigger asChild>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-7 gap-1.5 px-2 text-xs\"\n >\n {showPending || Boolean(searchQuery.trim())\n ? t(\"dispatch.pages.hidePendingApps\")\n : t(\"dispatch.pages.showPendingApps\")}\n <IconChevronDown\n size={13}\n className={\n showPending || searchQuery.trim()\n ? \"rotate-180\"\n : undefined\n }\n />\n </Button>\n </CollapsibleTrigger>\n </div>\n <CollapsibleContent>\n <AppList layout=\"grid\">\n {filteredPendingApps.map((app) => (\n <WorkspaceAppCard key={app.id} app={app} />\n ))}\n </AppList>\n </CollapsibleContent>\n </div>\n </Collapsible>\n ) : null}\n </section>\n );\n}\n\nfunction OverviewAppsSkeleton() {\n return (\n <AppList layout=\"grid\">\n {Array.from({ length: 4 }).map((_, index) => (\n <AppListRow key={index}>\n <Skeleton className=\"size-8 shrink-0 rounded-xl\" />\n <div className=\"min-w-0 flex-1 space-y-2\">\n <Skeleton className=\"h-4 w-32\" />\n <Skeleton className=\"h-3 w-2/3\" />\n </div>\n <Skeleton className=\"h-9 w-24 shrink-0 rounded-md\" />\n </AppListRow>\n ))}\n </AppList>\n );\n}\n\nexport function DispatchControlPlane() {\n useSetPageTitle(<span aria-hidden />);\n const {\n status: appsStatus,\n workspaceApps,\n hostedApps,\n appsQuery,\n connectedAppsQuery,\n } = useWorkspaceAppLists();\n\n return (\n <div className=\"flex flex-col gap-8\">\n <CommandPanel />\n {appsStatus === \"error\" ? (\n <ActionQueryError\n error={appsQuery.error}\n onRetry={() => void appsQuery.refetch()}\n queryName=\"list-workspace-apps\"\n />\n ) : (\n <>\n {appsQuery.isError ? (\n <ActionQueryError\n error={appsQuery.error}\n onRetry={() => void appsQuery.refetch()}\n queryName=\"list-workspace-apps\"\n />\n ) : null}\n {connectedAppsQuery.isError ? (\n <ActionQueryError\n error={connectedAppsQuery.error}\n onRetry={() => void connectedAppsQuery.refetch()}\n queryName=\"list-connected-agents\"\n />\n ) : null}\n <AppsPanel\n apps={workspaceApps}\n hostedApps={hostedApps}\n isLoading={appsStatus === \"loading\"}\n />\n </>\n )}\n </div>\n );\n}\n"]}
@@ -0,0 +1,6 @@
1
+ export interface HostedAppsSettings {
2
+ showHostedApps: boolean;
3
+ }
4
+ /** Settings › Organization › Apps: show or hide hosted apps for everyone. */
5
+ export declare function HostedAppsSettingsGroup(): import("node_modules/@types/react").JSX.Element;
6
+ //# sourceMappingURL=hosted-apps-settings-group.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted-apps-settings-group.d.ts","sourceRoot":"","sources":["../../src/components/hosted-apps-settings-group.tsx"],"names":[],"mappings":"AAiBA,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,OAAO,CAAC;CACzB;AAoBD,6EAA6E;AAC7E,wBAAgB,uBAAuB,oDAoJtC"}
@@ -0,0 +1,76 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useActionMutation, useActionQuery, } from "@agent-native/core/client/hooks";
3
+ import { useT } from "@agent-native/core/client/i18n";
4
+ import { SettingsGroup, SettingsRow } from "@agent-native/toolkit/app/settings";
5
+ import { IconArrowUpRight } from "@tabler/icons-react";
6
+ import { useState } from "react";
7
+ import { toast } from "sonner";
8
+ import { useWorkspaceAppLists } from "../lib/workspace-app-lists.js";
9
+ import { HOSTED_APPS_SETTINGS_INVALID_ERROR_CODE } from "../shared/hosted-apps-settings.js";
10
+ import { ActionQueryError } from "./action-query-error.js";
11
+ import { Button } from "./ui/button.js";
12
+ import { Skeleton } from "./ui/skeleton.js";
13
+ import { Switch } from "./ui/switch.js";
14
+ function isInvalidStoredSetting(error) {
15
+ return (!!error &&
16
+ typeof error === "object" &&
17
+ error.errorCode ===
18
+ HOSTED_APPS_SETTINGS_INVALID_ERROR_CODE);
19
+ }
20
+ function hostOf(url) {
21
+ try {
22
+ return new URL(url).host;
23
+ }
24
+ catch {
25
+ // coercion-ok: a URL the browser cannot parse is shown as stored.
26
+ return url;
27
+ }
28
+ }
29
+ /** Settings › Organization › Apps: show or hide hosted apps for everyone. */
30
+ export function HostedAppsSettingsGroup() {
31
+ const t = useT();
32
+ const query = useActionQuery("get-hosted-apps-settings", {});
33
+ // The switched value holds until the setting reads back: a save invalidates
34
+ // action queries, and the next read replaces `query.data`.
35
+ const [optimistic, setOptimistic] = useState(null);
36
+ const save = useActionMutation("set-hosted-apps-settings", {
37
+ onError: (error) => {
38
+ setOptimistic(null);
39
+ toast.error(t("dispatch.pages.hostedAppsSaveFailed"), {
40
+ description: error.message,
41
+ });
42
+ },
43
+ });
44
+ const title = t("dispatch.pages.hostedApps");
45
+ // An invalid stored value has no state to show; saving any value repairs it.
46
+ const storedInvalid = query.isError && isInvalidStoredSetting(query.error);
47
+ const showHostedApps = optimistic && optimistic.readFrom === query.data
48
+ ? optimistic.showHostedApps
49
+ : storedInvalid
50
+ ? false
51
+ : query.data?.showHostedApps;
52
+ // The launchers' Hosted apps tier, including the apps this setting hides.
53
+ const lists = useWorkspaceAppLists({ includeHiddenFromLaunchers: true });
54
+ const listsFailed = lists.status === "error" ||
55
+ (lists.connectedAppsQuery.isError &&
56
+ lists.connectedAppsQuery.data === undefined);
57
+ const listsLoading = !listsFailed &&
58
+ (lists.status === "loading" || lists.connectedAppsQuery.data === undefined);
59
+ return (_jsx(SettingsGroup, { id: "hosted-apps", title: title, children: query.isError && !storedInvalid && query.data === undefined ? (_jsx("div", { className: "px-5 py-4 sm:px-6", children: _jsx(ActionQueryError, { error: query.error, onRetry: () => void query.refetch(), queryName: "get-hosted-apps-settings" }) })) : showHostedApps === undefined ? (_jsxs("div", { className: "flex items-center justify-between gap-4 px-5 py-4 sm:px-6", "aria-busy": "true", children: [_jsx(Skeleton, { className: "h-3.5 w-32" }), _jsx(Skeleton, { className: "h-5 w-9 rounded-full" })] })) : (_jsxs(_Fragment, { children: [_jsx(SettingsRow, { id: "show-hosted-apps", label: t("dispatch.pages.showHostedApps"), control: _jsx(Switch, { "aria-label": t("dispatch.pages.showHostedApps"), checked: showHostedApps, disabled: save.isPending, onCheckedChange: (checked) => {
60
+ setOptimistic({
61
+ showHostedApps: checked,
62
+ readFrom: query.data,
63
+ });
64
+ save.mutate({ showHostedApps: checked });
65
+ } }), children: storedInvalid ? (_jsx("p", { className: "text-xs text-destructive", role: "alert", children: t("dispatch.pages.hostedAppsSettingInvalid") })) : null }), listsFailed ? (_jsx("div", { className: "px-5 py-4 sm:px-6", children: _jsx(ActionQueryError, { error: lists.status === "error"
66
+ ? lists.appsQuery.error
67
+ : lists.connectedAppsQuery.error, onRetry: () => {
68
+ void lists.appsQuery.refetch();
69
+ void lists.connectedAppsQuery.refetch();
70
+ }, queryName: lists.status === "error"
71
+ ? "list-workspace-apps"
72
+ : "list-connected-agents" }) })) : listsLoading ? (_jsxs("div", { className: "flex items-center justify-between gap-4 px-5 py-4 sm:px-6", "aria-busy": "true", "data-hosted-apps-loading": true, children: [_jsx(Skeleton, { className: "h-3.5 w-24" }), _jsx(Skeleton, { className: "h-8 w-16 rounded-md" })] })) : lists.hostedApps.length > 0 ? (_jsx("div", { "data-state": showHostedApps ? "shown" : "hidden", className: "divide-y divide-border/60 transition-opacity data-[state=hidden]:opacity-50", children: lists.hostedApps.map((app) => (_jsx(SettingsRow, { id: `hosted-app-${app.id}`, label: app.name, description: hostOf(app.homeUrl?.trim() || app.url), control: _jsx(Button, { variant: "outline", size: "sm", asChild: true, children: _jsxs("a", { href: app.homeUrl?.trim() || app.url, target: "_blank", rel: "noopener noreferrer", "aria-label": t("dispatch.pages.chatFirstOpenApp", {
73
+ name: app.name,
74
+ }), children: [t("dispatch.pages.openApp"), _jsx(IconArrowUpRight, { size: 13, "aria-hidden": "true" })] }) }) }, app.id))) })) : null] })) }));
75
+ }
76
+ //# sourceMappingURL=hosted-apps-settings-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted-apps-settings-group.js","sourceRoot":"","sources":["../../src/components/hosted-apps-settings-group.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,cAAc,GACf,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACl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AC,CACjB,eACE,SAAS,EAAC,2DAA2D,eAC3D,MAAM,+CAGhB,KAAC,QAAQ,IAAC,SAAS,EAAC,YAAY,GAAG,EACnC,KAAC,QAAQ,IAAC,SAAS,EAAC,qBAAqB,GAAG,IACxC,CACP,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAChC,4BACc,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,EAC/C,SAAS,EAAC,6EAA6E,YAEtF,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAC7B,KAAC,WAAW,IAEV,EAAE,EAAE,cAAc,GAAG,CAAC,EAAE,EAAE,EAC1B,KAAK,EAAE,GAAG,CAAC,IAAI,EACf,WAAW,EAAE,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,CAAC,GAAG,CAAC,EACnD,OAAO,EACL,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,IAAI,EAAC,IAAI,EAAC,OAAO,kBACzC,aACE,IAAI,EAAE,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,CAAC,GAAG,EACpC,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,gBACb,CAAC,CAAC,iCAAiC,EAAE;oCAC/C,IAAI,EAAE,GAAG,CAAC,IAAI;iCACf,CAAC,aAED,CAAC,CAAC,wBAAwB,CAAC,EAC5B,KAAC,gBAAgB,IAAC,IAAI,EAAE,EAAE,iBAAc,MAAM,GAAG,IAC/C,GACG,IAjBN,GAAG,CAAC,EAAE,CAmBX,CACH,CAAC,GACE,CACP,CAAC,CAAC,CAAC,IAAI,IACP,CACJ,GACa,CACjB,CAAC;AACJ,CAAC","sourcesContent":["import {\n useActionMutation,\n useActionQuery,\n} from \"@agent-native/core/client/hooks\";\nimport { useT } from \"@agent-native/core/client/i18n\";\nimport { SettingsGroup, SettingsRow } from \"@agent-native/toolkit/app/settings\";\nimport { IconArrowUpRight } from \"@tabler/icons-react\";\nimport { useState } from \"react\";\nimport { toast } from \"sonner\";\n\nimport { useWorkspaceAppLists } from \"../lib/workspace-app-lists\";\nimport { HOSTED_APPS_SETTINGS_INVALID_ERROR_CODE } from \"../shared/hosted-apps-settings\";\nimport { ActionQueryError } from \"./action-query-error\";\nimport { Button } from \"./ui/button\";\nimport { Skeleton } from \"./ui/skeleton\";\nimport { Switch } from \"./ui/switch\";\n\nexport interface HostedAppsSettings {\n showHostedApps: boolean;\n}\n\nfunction isInvalidStoredSetting(error: unknown): boolean {\n return (\n !!error &&\n typeof error === \"object\" &&\n (error as { errorCode?: unknown }).errorCode ===\n HOSTED_APPS_SETTINGS_INVALID_ERROR_CODE\n );\n}\n\nfunction hostOf(url: string): string {\n try {\n return new URL(url).host;\n } catch {\n // coercion-ok: a URL the browser cannot parse is shown as stored.\n return url;\n }\n}\n\n/** Settings › Organization › Apps: show or hide hosted apps for everyone. */\nexport function HostedAppsSettingsGroup() {\n const t = useT();\n const query = useActionQuery<HostedAppsSettings>(\n \"get-hosted-apps-settings\",\n {},\n );\n // The switched value holds until the setting reads back: a save invalidates\n // action queries, and the next read replaces `query.data`.\n const [optimistic, setOptimistic] = useState<{\n showHostedApps: boolean;\n readFrom: HostedAppsSettings | undefined;\n } | null>(null);\n const save = useActionMutation<\n HostedAppsSettings,\n { showHostedApps: boolean }\n >(\"set-hosted-apps-settings\", {\n onError: (error) => {\n setOptimistic(null);\n toast.error(t(\"dispatch.pages.hostedAppsSaveFailed\"), {\n description: error.message,\n });\n },\n });\n const title = t(\"dispatch.pages.hostedApps\");\n // An invalid stored value has no state to show; saving any value repairs it.\n const storedInvalid = query.isError && isInvalidStoredSetting(query.error);\n const showHostedApps =\n optimistic && optimistic.readFrom === query.data\n ? optimistic.showHostedApps\n : storedInvalid\n ? false\n : query.data?.showHostedApps;\n // The launchers' Hosted apps tier, including the apps this setting hides.\n const lists = useWorkspaceAppLists({ includeHiddenFromLaunchers: true });\n const listsFailed =\n lists.status === \"error\" ||\n (lists.connectedAppsQuery.isError &&\n lists.connectedAppsQuery.data === undefined);\n const listsLoading =\n !listsFailed &&\n (lists.status === \"loading\" || lists.connectedAppsQuery.data === undefined);\n\n return (\n <SettingsGroup id=\"hosted-apps\" title={title}>\n {query.isError && !storedInvalid && query.data === undefined ? (\n <div className=\"px-5 py-4 sm:px-6\">\n <ActionQueryError\n error={query.error}\n onRetry={() => void query.refetch()}\n queryName=\"get-hosted-apps-settings\"\n />\n </div>\n ) : showHostedApps === undefined ? (\n <div\n className=\"flex items-center justify-between gap-4 px-5 py-4 sm:px-6\"\n aria-busy=\"true\"\n >\n <Skeleton className=\"h-3.5 w-32\" />\n <Skeleton className=\"h-5 w-9 rounded-full\" />\n </div>\n ) : (\n <>\n <SettingsRow\n id=\"show-hosted-apps\"\n label={t(\"dispatch.pages.showHostedApps\")}\n control={\n <Switch\n aria-label={t(\"dispatch.pages.showHostedApps\")}\n checked={showHostedApps}\n disabled={save.isPending}\n onCheckedChange={(checked) => {\n setOptimistic({\n showHostedApps: checked,\n readFrom: query.data,\n });\n save.mutate({ showHostedApps: checked });\n }}\n />\n }\n >\n {storedInvalid ? (\n <p className=\"text-xs text-destructive\" role=\"alert\">\n {t(\"dispatch.pages.hostedAppsSettingInvalid\")}\n </p>\n ) : null}\n </SettingsRow>\n {listsFailed ? (\n <div className=\"px-5 py-4 sm:px-6\">\n <ActionQueryError\n error={\n lists.status === \"error\"\n ? lists.appsQuery.error\n : lists.connectedAppsQuery.error\n }\n onRetry={() => {\n void lists.appsQuery.refetch();\n void lists.connectedAppsQuery.refetch();\n }}\n queryName={\n lists.status === \"error\"\n ? \"list-workspace-apps\"\n : \"list-connected-agents\"\n }\n />\n </div>\n ) : listsLoading ? (\n <div\n className=\"flex items-center justify-between gap-4 px-5 py-4 sm:px-6\"\n aria-busy=\"true\"\n data-hosted-apps-loading\n >\n <Skeleton className=\"h-3.5 w-24\" />\n <Skeleton className=\"h-8 w-16 rounded-md\" />\n </div>\n ) : lists.hostedApps.length > 0 ? (\n <div\n data-state={showHostedApps ? \"shown\" : \"hidden\"}\n className=\"divide-y divide-border/60 transition-opacity data-[state=hidden]:opacity-50\"\n >\n {lists.hostedApps.map((app) => (\n <SettingsRow\n key={app.id}\n id={`hosted-app-${app.id}`}\n label={app.name}\n description={hostOf(app.homeUrl?.trim() || app.url)}\n control={\n <Button variant=\"outline\" size=\"sm\" asChild>\n <a\n href={app.homeUrl?.trim() || app.url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n aria-label={t(\"dispatch.pages.chatFirstOpenApp\", {\n name: app.name,\n })}\n >\n {t(\"dispatch.pages.openApp\")}\n <IconArrowUpRight size={13} aria-hidden=\"true\" />\n </a>\n </Button>\n }\n />\n ))}\n </div>\n ) : null}\n </>\n )}\n </SettingsGroup>\n );\n}\n"]}