@agent-native/dispatch 0.1.1
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.
- package/README.md +220 -0
- package/dist/actions/approve-dispatch-change.d.ts +3 -0
- package/dist/actions/approve-dispatch-change.d.ts.map +1 -0
- package/dist/actions/approve-dispatch-change.js +11 -0
- package/dist/actions/approve-dispatch-change.js.map +1 -0
- package/dist/actions/approve-vault-request.d.ts +3 -0
- package/dist/actions/approve-vault-request.d.ts.map +1 -0
- package/dist/actions/approve-vault-request.js +16 -0
- package/dist/actions/approve-vault-request.js.map +1 -0
- package/dist/actions/create-link-token.d.ts +3 -0
- package/dist/actions/create-link-token.d.ts.map +1 -0
- package/dist/actions/create-link-token.js +11 -0
- package/dist/actions/create-link-token.js.map +1 -0
- package/dist/actions/create-vault-grant.d.ts +3 -0
- package/dist/actions/create-vault-grant.d.ts.map +1 -0
- package/dist/actions/create-vault-grant.js +14 -0
- package/dist/actions/create-vault-grant.js.map +1 -0
- package/dist/actions/create-vault-secret.d.ts +3 -0
- package/dist/actions/create-vault-secret.d.ts.map +1 -0
- package/dist/actions/create-vault-secret.js +20 -0
- package/dist/actions/create-vault-secret.js.map +1 -0
- package/dist/actions/create-workspace-resource-grant.d.ts +3 -0
- package/dist/actions/create-workspace-resource-grant.d.ts.map +1 -0
- package/dist/actions/create-workspace-resource-grant.js +14 -0
- package/dist/actions/create-workspace-resource-grant.js.map +1 -0
- package/dist/actions/create-workspace-resource.d.ts +3 -0
- package/dist/actions/create-workspace-resource.d.ts.map +1 -0
- package/dist/actions/create-workspace-resource.js +24 -0
- package/dist/actions/create-workspace-resource.js.map +1 -0
- package/dist/actions/delete-destination.d.ts +3 -0
- package/dist/actions/delete-destination.d.ts.map +1 -0
- package/dist/actions/delete-destination.js +11 -0
- package/dist/actions/delete-destination.js.map +1 -0
- package/dist/actions/delete-vault-secret.d.ts +3 -0
- package/dist/actions/delete-vault-secret.d.ts.map +1 -0
- package/dist/actions/delete-vault-secret.js +11 -0
- package/dist/actions/delete-vault-secret.js.map +1 -0
- package/dist/actions/delete-workspace-resource.d.ts +3 -0
- package/dist/actions/delete-workspace-resource.d.ts.map +1 -0
- package/dist/actions/delete-workspace-resource.js +11 -0
- package/dist/actions/delete-workspace-resource.js.map +1 -0
- package/dist/actions/deny-vault-request.d.ts +3 -0
- package/dist/actions/deny-vault-request.d.ts.map +1 -0
- package/dist/actions/deny-vault-request.js +12 -0
- package/dist/actions/deny-vault-request.js.map +1 -0
- package/dist/actions/get-app-creation-settings.d.ts +3 -0
- package/dist/actions/get-app-creation-settings.d.ts.map +1 -0
- package/dist/actions/get-app-creation-settings.js +10 -0
- package/dist/actions/get-app-creation-settings.js.map +1 -0
- package/dist/actions/get-dispatch-settings.d.ts +3 -0
- package/dist/actions/get-dispatch-settings.d.ts.map +1 -0
- package/dist/actions/get-dispatch-settings.js +10 -0
- package/dist/actions/get-dispatch-settings.js.map +1 -0
- package/dist/actions/get-workspace-info.d.ts +3 -0
- package/dist/actions/get-workspace-info.d.ts.map +1 -0
- package/dist/actions/get-workspace-info.js +10 -0
- package/dist/actions/get-workspace-info.js.map +1 -0
- package/dist/actions/grant-vault-secrets-to-app.d.ts +3 -0
- package/dist/actions/grant-vault-secrets-to-app.d.ts.map +1 -0
- package/dist/actions/grant-vault-secrets-to-app.js +19 -0
- package/dist/actions/grant-vault-secrets-to-app.js.map +1 -0
- package/dist/actions/index.d.ts +9 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +101 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/actions/list-connected-agents.d.ts +3 -0
- package/dist/actions/list-connected-agents.d.ts.map +1 -0
- package/dist/actions/list-connected-agents.js +79 -0
- package/dist/actions/list-connected-agents.js.map +1 -0
- package/dist/actions/list-destinations.d.ts +3 -0
- package/dist/actions/list-destinations.d.ts.map +1 -0
- package/dist/actions/list-destinations.js +10 -0
- package/dist/actions/list-destinations.js.map +1 -0
- package/dist/actions/list-dispatch-approvals.d.ts +3 -0
- package/dist/actions/list-dispatch-approvals.d.ts.map +1 -0
- package/dist/actions/list-dispatch-approvals.js +10 -0
- package/dist/actions/list-dispatch-approvals.js.map +1 -0
- package/dist/actions/list-dispatch-audit.d.ts +3 -0
- package/dist/actions/list-dispatch-audit.d.ts.map +1 -0
- package/dist/actions/list-dispatch-audit.js +12 -0
- package/dist/actions/list-dispatch-audit.js.map +1 -0
- package/dist/actions/list-dispatch-overview.d.ts +3 -0
- package/dist/actions/list-dispatch-overview.d.ts.map +1 -0
- package/dist/actions/list-dispatch-overview.js +17 -0
- package/dist/actions/list-dispatch-overview.js.map +1 -0
- package/dist/actions/list-integrations-catalog.d.ts +3 -0
- package/dist/actions/list-integrations-catalog.d.ts.map +1 -0
- package/dist/actions/list-integrations-catalog.js +10 -0
- package/dist/actions/list-integrations-catalog.js.map +1 -0
- package/dist/actions/list-linked-identities.d.ts +3 -0
- package/dist/actions/list-linked-identities.d.ts.map +1 -0
- package/dist/actions/list-linked-identities.js +10 -0
- package/dist/actions/list-linked-identities.js.map +1 -0
- package/dist/actions/list-vault-audit.d.ts +3 -0
- package/dist/actions/list-vault-audit.d.ts.map +1 -0
- package/dist/actions/list-vault-audit.js +15 -0
- package/dist/actions/list-vault-audit.js.map +1 -0
- package/dist/actions/list-vault-grants.d.ts +3 -0
- package/dist/actions/list-vault-grants.d.ts.map +1 -0
- package/dist/actions/list-vault-grants.js +13 -0
- package/dist/actions/list-vault-grants.js.map +1 -0
- package/dist/actions/list-vault-requests.d.ts +3 -0
- package/dist/actions/list-vault-requests.d.ts.map +1 -0
- package/dist/actions/list-vault-requests.js +15 -0
- package/dist/actions/list-vault-requests.js.map +1 -0
- package/dist/actions/list-vault-secret-options.d.ts +3 -0
- package/dist/actions/list-vault-secret-options.d.ts.map +1 -0
- package/dist/actions/list-vault-secret-options.js +19 -0
- package/dist/actions/list-vault-secret-options.js.map +1 -0
- package/dist/actions/list-vault-secrets.d.ts +3 -0
- package/dist/actions/list-vault-secrets.d.ts.map +1 -0
- package/dist/actions/list-vault-secrets.js +25 -0
- package/dist/actions/list-vault-secrets.js.map +1 -0
- package/dist/actions/list-workspace-apps.d.ts +3 -0
- package/dist/actions/list-workspace-apps.d.ts.map +1 -0
- package/dist/actions/list-workspace-apps.js +24 -0
- package/dist/actions/list-workspace-apps.js.map +1 -0
- package/dist/actions/list-workspace-resource-grants.d.ts +3 -0
- package/dist/actions/list-workspace-resource-grants.d.ts.map +1 -0
- package/dist/actions/list-workspace-resource-grants.js +13 -0
- package/dist/actions/list-workspace-resource-grants.js.map +1 -0
- package/dist/actions/list-workspace-resources.d.ts +3 -0
- package/dist/actions/list-workspace-resources.d.ts.map +1 -0
- package/dist/actions/list-workspace-resources.js +15 -0
- package/dist/actions/list-workspace-resources.js.map +1 -0
- package/dist/actions/navigate.d.ts +16 -0
- package/dist/actions/navigate.d.ts.map +1 -0
- package/dist/actions/navigate.js +55 -0
- package/dist/actions/navigate.js.map +1 -0
- package/dist/actions/reject-dispatch-change.d.ts +3 -0
- package/dist/actions/reject-dispatch-change.d.ts.map +1 -0
- package/dist/actions/reject-dispatch-change.js +12 -0
- package/dist/actions/reject-dispatch-change.js.map +1 -0
- package/dist/actions/request-vault-secret.d.ts +3 -0
- package/dist/actions/request-vault-secret.d.ts.map +1 -0
- package/dist/actions/request-vault-secret.js +15 -0
- package/dist/actions/request-vault-secret.js.map +1 -0
- package/dist/actions/revoke-vault-grant.d.ts +3 -0
- package/dist/actions/revoke-vault-grant.d.ts.map +1 -0
- package/dist/actions/revoke-vault-grant.js +11 -0
- package/dist/actions/revoke-vault-grant.js.map +1 -0
- package/dist/actions/revoke-workspace-resource-grant.d.ts +3 -0
- package/dist/actions/revoke-workspace-resource-grant.d.ts.map +1 -0
- package/dist/actions/revoke-workspace-resource-grant.js +11 -0
- package/dist/actions/revoke-workspace-resource-grant.js.map +1 -0
- package/dist/actions/send-platform-message.d.ts +3 -0
- package/dist/actions/send-platform-message.d.ts.map +1 -0
- package/dist/actions/send-platform-message.js +73 -0
- package/dist/actions/send-platform-message.js.map +1 -0
- package/dist/actions/set-app-creation-settings.d.ts +3 -0
- package/dist/actions/set-app-creation-settings.d.ts.map +1 -0
- package/dist/actions/set-app-creation-settings.js +18 -0
- package/dist/actions/set-app-creation-settings.js.map +1 -0
- package/dist/actions/set-dispatch-approval-policy.d.ts +3 -0
- package/dist/actions/set-dispatch-approval-policy.d.ts.map +1 -0
- package/dist/actions/set-dispatch-approval-policy.js +19 -0
- package/dist/actions/set-dispatch-approval-policy.js.map +1 -0
- package/dist/actions/start-workspace-app-creation.d.ts +3 -0
- package/dist/actions/start-workspace-app-creation.d.ts.map +1 -0
- package/dist/actions/start-workspace-app-creation.js +31 -0
- package/dist/actions/start-workspace-app-creation.js.map +1 -0
- package/dist/actions/sync-vault-to-app.d.ts +3 -0
- package/dist/actions/sync-vault-to-app.d.ts.map +1 -0
- package/dist/actions/sync-vault-to-app.js +13 -0
- package/dist/actions/sync-vault-to-app.js.map +1 -0
- package/dist/actions/sync-workspace-resources-to-all.d.ts +3 -0
- package/dist/actions/sync-workspace-resources-to-all.d.ts.map +1 -0
- package/dist/actions/sync-workspace-resources-to-all.js +9 -0
- package/dist/actions/sync-workspace-resources-to-all.js.map +1 -0
- package/dist/actions/sync-workspace-resources-to-app.d.ts +3 -0
- package/dist/actions/sync-workspace-resources-to-app.d.ts.map +1 -0
- package/dist/actions/sync-workspace-resources-to-app.js +11 -0
- package/dist/actions/sync-workspace-resources-to-app.js.map +1 -0
- package/dist/actions/update-vault-secret.d.ts +3 -0
- package/dist/actions/update-vault-secret.d.ts.map +1 -0
- package/dist/actions/update-vault-secret.js +12 -0
- package/dist/actions/update-vault-secret.js.map +1 -0
- package/dist/actions/update-workspace-resource.d.ts +3 -0
- package/dist/actions/update-workspace-resource.d.ts.map +1 -0
- package/dist/actions/update-workspace-resource.js +18 -0
- package/dist/actions/update-workspace-resource.js.map +1 -0
- package/dist/actions/upsert-destination.d.ts +3 -0
- package/dist/actions/upsert-destination.d.ts.map +1 -0
- package/dist/actions/upsert-destination.js +26 -0
- package/dist/actions/upsert-destination.js.map +1 -0
- package/dist/actions/view-screen.d.ts +11 -0
- package/dist/actions/view-screen.d.ts.map +1 -0
- package/dist/actions/view-screen.js +68 -0
- package/dist/actions/view-screen.js.map +1 -0
- package/dist/components/agents-panel.d.ts +16 -0
- package/dist/components/agents-panel.d.ts.map +1 -0
- package/dist/components/agents-panel.js +64 -0
- package/dist/components/agents-panel.js.map +1 -0
- package/dist/components/app-keys-popover.d.ts +11 -0
- package/dist/components/app-keys-popover.d.ts.map +1 -0
- package/dist/components/app-keys-popover.js +84 -0
- package/dist/components/app-keys-popover.js.map +1 -0
- package/dist/components/create-app-popover.d.ts +24 -0
- package/dist/components/create-app-popover.d.ts.map +1 -0
- package/dist/components/create-app-popover.js +188 -0
- package/dist/components/create-app-popover.js.map +1 -0
- package/dist/components/dispatch-shell.d.ts +13 -0
- package/dist/components/dispatch-shell.d.ts.map +1 -0
- package/dist/components/dispatch-shell.js +15 -0
- package/dist/components/dispatch-shell.js.map +1 -0
- package/dist/components/index.d.ts +12 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +12 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/layout/Header.d.ts +5 -0
- package/dist/components/layout/Header.d.ts.map +1 -0
- package/dist/components/layout/Header.js +34 -0
- package/dist/components/layout/Header.js.map +1 -0
- package/dist/components/layout/HeaderActions.d.ts +18 -0
- package/dist/components/layout/HeaderActions.d.ts.map +1 -0
- package/dist/components/layout/HeaderActions.js +52 -0
- package/dist/components/layout/HeaderActions.js.map +1 -0
- package/dist/components/layout/Layout.d.ts +8 -0
- package/dist/components/layout/Layout.d.ts.map +1 -0
- package/dist/components/layout/Layout.js +70 -0
- package/dist/components/layout/Layout.js.map +1 -0
- package/dist/components/messaging-setup-panel.d.ts +2 -0
- package/dist/components/messaging-setup-panel.d.ts.map +1 -0
- package/dist/components/messaging-setup-panel.js +300 -0
- package/dist/components/messaging-setup-panel.js.map +1 -0
- package/dist/components/ui/accordion.d.ts +8 -0
- package/dist/components/ui/accordion.d.ts.map +1 -0
- package/dist/components/ui/accordion.js +14 -0
- package/dist/components/ui/accordion.js.map +1 -0
- package/dist/components/ui/alert-dialog.d.ts +21 -0
- package/dist/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog.js +27 -0
- package/dist/components/ui/alert-dialog.js.map +1 -0
- package/dist/components/ui/alert.d.ts +9 -0
- package/dist/components/ui/alert.d.ts.map +1 -0
- package/dist/components/ui/alert.js +23 -0
- package/dist/components/ui/alert.js.map +1 -0
- package/dist/components/ui/aspect-ratio.d.ts +4 -0
- package/dist/components/ui/aspect-ratio.d.ts.map +1 -0
- package/dist/components/ui/aspect-ratio.js +4 -0
- package/dist/components/ui/aspect-ratio.js.map +1 -0
- package/dist/components/ui/avatar.d.ts +7 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/avatar.js +12 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/badge.d.ts +10 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.js +21 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/breadcrumb.d.ts +20 -0
- package/dist/components/ui/breadcrumb.d.ts.map +1 -0
- package/dist/components/ui/breadcrumb.js +24 -0
- package/dist/components/ui/breadcrumb.js.map +1 -0
- package/dist/components/ui/button.d.ts +12 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +34 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/calendar.d.ts +9 -0
- package/dist/components/ui/calendar.d.ts.map +1 -0
- package/dist/components/ui/calendar.js +41 -0
- package/dist/components/ui/calendar.js.map +1 -0
- package/dist/components/ui/card.d.ts +9 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/card.js +17 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/carousel.d.ts +19 -0
- package/dist/components/ui/carousel.d.ts.map +1 -0
- package/dist/components/ui/carousel.js +99 -0
- package/dist/components/ui/carousel.js.map +1 -0
- package/dist/components/ui/chart.d.ts +80 -0
- package/dist/components/ui/chart.d.ts.map +1 -0
- package/dist/components/ui/chart.js +131 -0
- package/dist/components/ui/chart.js.map +1 -0
- package/dist/components/ui/checkbox.d.ts +5 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox.js +9 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +6 -0
- package/dist/components/ui/collapsible.js.map +1 -0
- package/dist/components/ui/command.d.ts +83 -0
- package/dist/components/ui/command.d.ts.map +1 -0
- package/dist/components/ui/command.js +29 -0
- package/dist/components/ui/command.js.map +1 -0
- package/dist/components/ui/context-menu.d.ts +28 -0
- package/dist/components/ui/context-menu.d.ts.map +1 -0
- package/dist/components/ui/context-menu.js +34 -0
- package/dist/components/ui/context-menu.js.map +1 -0
- package/dist/components/ui/dialog.d.ts +20 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog.js +23 -0
- package/dist/components/ui/dialog.js.map +1 -0
- package/dist/components/ui/drawer.d.ts +23 -0
- package/dist/components/ui/drawer.d.ts.map +1 -0
- package/dist/components/ui/drawer.js +23 -0
- package/dist/components/ui/drawer.js.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +28 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +36 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/ui/form.d.ts +24 -0
- package/dist/components/ui/form.d.ts.map +1 -0
- package/dist/components/ui/form.js +63 -0
- package/dist/components/ui/form.js.map +1 -0
- package/dist/components/ui/hover-card.d.ts +7 -0
- package/dist/components/ui/hover-card.d.ts.map +1 -0
- package/dist/components/ui/hover-card.js +10 -0
- package/dist/components/ui/hover-card.js.map +1 -0
- package/dist/components/ui/input-otp.d.ts +35 -0
- package/dist/components/ui/input-otp.d.ts.map +1 -0
- package/dist/components/ui/input-otp.js +19 -0
- package/dist/components/ui/input-otp.js.map +1 -0
- package/dist/components/ui/input.d.ts +4 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.js +9 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/label.d.ts +6 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/label.js +10 -0
- package/dist/components/ui/label.js.map +1 -0
- package/dist/components/ui/menubar.d.ts +29 -0
- package/dist/components/ui/menubar.d.ts.map +1 -0
- package/dist/components/ui/menubar.js +41 -0
- package/dist/components/ui/menubar.js.map +1 -0
- package/dist/components/ui/navigation-menu.d.ts +13 -0
- package/dist/components/ui/navigation-menu.d.ts.map +1 -0
- package/dist/components/ui/navigation-menu.js +25 -0
- package/dist/components/ui/navigation-menu.js.map +1 -0
- package/dist/components/ui/pagination.d.ts +29 -0
- package/dist/components/ui/pagination.d.ts.map +1 -0
- package/dist/components/ui/pagination.js +24 -0
- package/dist/components/ui/pagination.js.map +1 -0
- package/dist/components/ui/popover.d.ts +7 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/popover.js +10 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/progress.d.ts +5 -0
- package/dist/components/ui/progress.d.ts.map +1 -0
- package/dist/components/ui/progress.js +8 -0
- package/dist/components/ui/progress.js.map +1 -0
- package/dist/components/ui/radio-group.d.ts +6 -0
- package/dist/components/ui/radio-group.d.ts.map +1 -0
- package/dist/components/ui/radio-group.js +15 -0
- package/dist/components/ui/radio-group.js.map +1 -0
- package/dist/components/ui/resizable.d.ts +8 -0
- package/dist/components/ui/resizable.d.ts.map +1 -0
- package/dist/components/ui/resizable.js +9 -0
- package/dist/components/ui/resizable.js.map +1 -0
- package/dist/components/ui/scroll-area.d.ts +6 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.js +12 -0
- package/dist/components/ui/scroll-area.js.map +1 -0
- package/dist/components/ui/select.d.ts +14 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/select.js +27 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/separator.d.ts +5 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.js +8 -0
- package/dist/components/ui/separator.js.map +1 -0
- package/dist/components/ui/sheet.d.ts +26 -0
- package/dist/components/ui/sheet.d.ts.map +1 -0
- package/dist/components/ui/sheet.js +37 -0
- package/dist/components/ui/sheet.js.map +1 -0
- package/dist/components/ui/sidebar.d.ts +67 -0
- package/dist/components/ui/sidebar.d.ts.map +1 -0
- package/dist/components/ui/sidebar.js +233 -0
- package/dist/components/ui/sidebar.js.map +1 -0
- package/dist/components/ui/skeleton.d.ts +3 -0
- package/dist/components/ui/skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeleton.js +7 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/components/ui/slider.d.ts +5 -0
- package/dist/components/ui/slider.d.ts.map +1 -0
- package/dist/components/ui/slider.js +8 -0
- package/dist/components/ui/slider.js.map +1 -0
- package/dist/components/ui/sonner.d.ts +5 -0
- package/dist/components/ui/sonner.d.ts.map +1 -0
- package/dist/components/ui/sonner.js +25 -0
- package/dist/components/ui/sonner.js.map +1 -0
- package/dist/components/ui/spinner.d.ts +3 -0
- package/dist/components/ui/spinner.d.ts.map +1 -0
- package/dist/components/ui/spinner.js +7 -0
- package/dist/components/ui/spinner.js.map +1 -0
- package/dist/components/ui/switch.d.ts +5 -0
- package/dist/components/ui/switch.d.ts.map +1 -0
- package/dist/components/ui/switch.js +8 -0
- package/dist/components/ui/switch.js.map +1 -0
- package/dist/components/ui/table.d.ts +11 -0
- package/dist/components/ui/table.d.ts.map +1 -0
- package/dist/components/ui/table.js +21 -0
- package/dist/components/ui/table.js.map +1 -0
- package/dist/components/ui/tabs.d.ts +8 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +13 -0
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/components/ui/textarea.d.ts +6 -0
- package/dist/components/ui/textarea.d.ts.map +1 -0
- package/dist/components/ui/textarea.js +9 -0
- package/dist/components/ui/textarea.js.map +1 -0
- package/dist/components/ui/toast.d.ts +16 -0
- package/dist/components/ui/toast.d.ts.map +1 -0
- package/dist/components/ui/toast.js +34 -0
- package/dist/components/ui/toast.js.map +1 -0
- package/dist/components/ui/toaster.d.ts +2 -0
- package/dist/components/ui/toaster.d.ts.map +1 -0
- package/dist/components/ui/toaster.js +10 -0
- package/dist/components/ui/toaster.js.map +1 -0
- package/dist/components/ui/toggle-group.d.ts +13 -0
- package/dist/components/ui/toggle-group.d.ts.map +1 -0
- package/dist/components/ui/toggle-group.js +21 -0
- package/dist/components/ui/toggle-group.js.map +1 -0
- package/dist/components/ui/toggle.d.ts +13 -0
- package/dist/components/ui/toggle.d.ts.map +1 -0
- package/dist/components/ui/toggle.js +26 -0
- package/dist/components/ui/toggle.js.map +1 -0
- package/dist/components/ui/tooltip.d.ts +8 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.js +11 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/components/ui/use-toast.d.ts +3 -0
- package/dist/components/ui/use-toast.d.ts.map +1 -0
- package/dist/components/ui/use-toast.js +3 -0
- package/dist/components/ui/use-toast.js.map +1 -0
- package/dist/config.d.ts +33 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +7 -0
- package/dist/config.js.map +1 -0
- package/dist/db/index.d.ts +7 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +10 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/migrations.d.ts +5 -0
- package/dist/db/migrations.d.ts.map +1 -0
- package/dist/db/migrations.js +166 -0
- package/dist/db/migrations.js.map +1 -0
- package/dist/db/schema.d.ts +2344 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +148 -0
- package/dist/db/schema.js.map +1 -0
- package/dist/hooks/use-mobile.d.ts +2 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/hooks/use-mobile.js +16 -0
- package/dist/hooks/use-mobile.js.map +1 -0
- package/dist/hooks/use-navigation-state.d.ts +6 -0
- package/dist/hooks/use-navigation-state.d.ts.map +1 -0
- package/dist/hooks/use-navigation-state.js +129 -0
- package/dist/hooks/use-navigation-state.js.map +1 -0
- package/dist/hooks/use-toast.d.ts +45 -0
- package/dist/hooks/use-toast.d.ts.map +1 -0
- package/dist/hooks/use-toast.js +127 -0
- package/dist/hooks/use-toast.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +2 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/routes/index.d.ts +32 -0
- package/dist/routes/index.d.ts.map +1 -0
- package/dist/routes/index.js +51 -0
- package/dist/routes/index.js.map +1 -0
- package/dist/routes/pages/_index.d.ts +15 -0
- package/dist/routes/pages/_index.d.ts.map +1 -0
- package/dist/routes/pages/_index.js +42 -0
- package/dist/routes/pages/_index.js.map +1 -0
- package/dist/routes/pages/agents.d.ts +5 -0
- package/dist/routes/pages/agents.d.ts.map +1 -0
- package/dist/routes/pages/agents.js +12 -0
- package/dist/routes/pages/agents.js.map +1 -0
- package/dist/routes/pages/approval.d.ts +5 -0
- package/dist/routes/pages/approval.d.ts.map +1 -0
- package/dist/routes/pages/approval.js +47 -0
- package/dist/routes/pages/approval.js.map +1 -0
- package/dist/routes/pages/approvals.d.ts +5 -0
- package/dist/routes/pages/approvals.d.ts.map +1 -0
- package/dist/routes/pages/approvals.js +48 -0
- package/dist/routes/pages/approvals.js.map +1 -0
- package/dist/routes/pages/apps.$appId.d.ts +5 -0
- package/dist/routes/pages/apps.$appId.d.ts.map +1 -0
- package/dist/routes/pages/apps.$appId.js +31 -0
- package/dist/routes/pages/apps.$appId.js.map +1 -0
- package/dist/routes/pages/apps.d.ts +5 -0
- package/dist/routes/pages/apps.d.ts.map +1 -0
- package/dist/routes/pages/apps.js +42 -0
- package/dist/routes/pages/apps.js.map +1 -0
- package/dist/routes/pages/audit.d.ts +5 -0
- package/dist/routes/pages/audit.d.ts.map +1 -0
- package/dist/routes/pages/audit.js +11 -0
- package/dist/routes/pages/audit.js.map +1 -0
- package/dist/routes/pages/destinations.d.ts +5 -0
- package/dist/routes/pages/destinations.d.ts.map +1 -0
- package/dist/routes/pages/destinations.js +80 -0
- package/dist/routes/pages/destinations.js.map +1 -0
- package/dist/routes/pages/identities.d.ts +5 -0
- package/dist/routes/pages/identities.d.ts.map +1 -0
- package/dist/routes/pages/identities.js +18 -0
- package/dist/routes/pages/identities.js.map +1 -0
- package/dist/routes/pages/integrations.d.ts +5 -0
- package/dist/routes/pages/integrations.d.ts.map +1 -0
- package/dist/routes/pages/integrations.js +46 -0
- package/dist/routes/pages/integrations.js.map +1 -0
- package/dist/routes/pages/messaging.d.ts +5 -0
- package/dist/routes/pages/messaging.d.ts.map +1 -0
- package/dist/routes/pages/messaging.js +10 -0
- package/dist/routes/pages/messaging.js.map +1 -0
- package/dist/routes/pages/new-app.d.ts +5 -0
- package/dist/routes/pages/new-app.d.ts.map +1 -0
- package/dist/routes/pages/new-app.js +10 -0
- package/dist/routes/pages/new-app.js.map +1 -0
- package/dist/routes/pages/overview.d.ts +5 -0
- package/dist/routes/pages/overview.d.ts.map +1 -0
- package/dist/routes/pages/overview.js +225 -0
- package/dist/routes/pages/overview.js.map +1 -0
- package/dist/routes/pages/team.d.ts +5 -0
- package/dist/routes/pages/team.d.ts.map +1 -0
- package/dist/routes/pages/team.js +10 -0
- package/dist/routes/pages/team.js.map +1 -0
- package/dist/routes/pages/tools.$id.d.ts +2 -0
- package/dist/routes/pages/tools.$id.d.ts.map +1 -0
- package/dist/routes/pages/tools.$id.js +6 -0
- package/dist/routes/pages/tools.$id.js.map +1 -0
- package/dist/routes/pages/tools._index.d.ts +2 -0
- package/dist/routes/pages/tools._index.d.ts.map +1 -0
- package/dist/routes/pages/tools._index.js +6 -0
- package/dist/routes/pages/tools._index.js.map +1 -0
- package/dist/routes/pages/vault.d.ts +5 -0
- package/dist/routes/pages/vault.d.ts.map +1 -0
- package/dist/routes/pages/vault.js +131 -0
- package/dist/routes/pages/vault.js.map +1 -0
- package/dist/routes/pages/workspace.d.ts +5 -0
- package/dist/routes/pages/workspace.d.ts.map +1 -0
- package/dist/routes/pages/workspace.js +149 -0
- package/dist/routes/pages/workspace.js.map +1 -0
- package/dist/server/index.d.ts +44 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +68 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/lib/app-creation-store.d.ts +102 -0
- package/dist/server/lib/app-creation-store.d.ts.map +1 -0
- package/dist/server/lib/app-creation-store.js +780 -0
- package/dist/server/lib/app-creation-store.js.map +1 -0
- package/dist/server/lib/dispatch-integrations.d.ts +10 -0
- package/dist/server/lib/dispatch-integrations.d.ts.map +1 -0
- package/dist/server/lib/dispatch-integrations.js +105 -0
- package/dist/server/lib/dispatch-integrations.js.map +1 -0
- package/dist/server/lib/dispatch-store.d.ts +313 -0
- package/dist/server/lib/dispatch-store.d.ts.map +1 -0
- package/dist/server/lib/dispatch-store.js +669 -0
- package/dist/server/lib/dispatch-store.js.map +1 -0
- package/dist/server/lib/env-config.d.ts +3 -0
- package/dist/server/lib/env-config.d.ts.map +1 -0
- package/dist/server/lib/env-config.js +43 -0
- package/dist/server/lib/env-config.js.map +1 -0
- package/dist/server/lib/pre-auth-routing.d.ts +2 -0
- package/dist/server/lib/pre-auth-routing.d.ts.map +1 -0
- package/dist/server/lib/pre-auth-routing.js +128 -0
- package/dist/server/lib/pre-auth-routing.js.map +1 -0
- package/dist/server/lib/vault-store.d.ts +270 -0
- package/dist/server/lib/vault-store.d.ts.map +1 -0
- package/dist/server/lib/vault-store.js +554 -0
- package/dist/server/lib/vault-store.js.map +1 -0
- package/dist/server/lib/workspace-resources-store.d.ts +165 -0
- package/dist/server/lib/workspace-resources-store.d.ts.map +1 -0
- package/dist/server/lib/workspace-resources-store.js +310 -0
- package/dist/server/lib/workspace-resources-store.js.map +1 -0
- package/dist/server/plugins/agent-chat.d.ts +3 -0
- package/dist/server/plugins/agent-chat.d.ts.map +1 -0
- package/dist/server/plugins/agent-chat.js +36 -0
- package/dist/server/plugins/agent-chat.js.map +1 -0
- package/dist/server/plugins/auth.d.ts +9 -0
- package/dist/server/plugins/auth.d.ts.map +1 -0
- package/dist/server/plugins/auth.js +30 -0
- package/dist/server/plugins/auth.js.map +1 -0
- package/dist/server/plugins/core-routes.d.ts +3 -0
- package/dist/server/plugins/core-routes.d.ts.map +1 -0
- package/dist/server/plugins/core-routes.js +6 -0
- package/dist/server/plugins/core-routes.js.map +1 -0
- package/dist/server/plugins/db.d.ts +3 -0
- package/dist/server/plugins/db.d.ts.map +1 -0
- package/dist/server/plugins/db.js +6 -0
- package/dist/server/plugins/db.js.map +1 -0
- package/dist/server/plugins/integrations.d.ts +8 -0
- package/dist/server/plugins/integrations.d.ts.map +1 -0
- package/dist/server/plugins/integrations.js +51 -0
- package/dist/server/plugins/integrations.js.map +1 -0
- package/package.json +103 -0
- package/src/actions/approve-dispatch-change.ts +11 -0
- package/src/actions/approve-vault-request.ts +23 -0
- package/src/actions/create-link-token.ts +12 -0
- package/src/actions/create-vault-grant.ts +15 -0
- package/src/actions/create-vault-secret.ts +21 -0
- package/src/actions/create-workspace-resource-grant.ts +15 -0
- package/src/actions/create-workspace-resource.ts +29 -0
- package/src/actions/delete-destination.ts +11 -0
- package/src/actions/delete-vault-secret.ts +12 -0
- package/src/actions/delete-workspace-resource.ts +12 -0
- package/src/actions/deny-vault-request.ts +12 -0
- package/src/actions/get-app-creation-settings.ts +11 -0
- package/src/actions/get-dispatch-settings.ts +10 -0
- package/src/actions/get-workspace-info.ts +11 -0
- package/src/actions/grant-vault-secrets-to-app.ts +20 -0
- package/src/actions/index.ts +102 -0
- package/src/actions/list-connected-agents.ts +103 -0
- package/src/actions/list-destinations.ts +10 -0
- package/src/actions/list-dispatch-approvals.ts +10 -0
- package/src/actions/list-dispatch-audit.ts +12 -0
- package/src/actions/list-dispatch-overview.ts +18 -0
- package/src/actions/list-integrations-catalog.ts +11 -0
- package/src/actions/list-linked-identities.ts +10 -0
- package/src/actions/list-vault-audit.ts +16 -0
- package/src/actions/list-vault-grants.ts +14 -0
- package/src/actions/list-vault-requests.ts +16 -0
- package/src/actions/list-vault-secret-options.ts +20 -0
- package/src/actions/list-vault-secrets.ts +26 -0
- package/src/actions/list-workspace-apps.ts +25 -0
- package/src/actions/list-workspace-resource-grants.ts +14 -0
- package/src/actions/list-workspace-resources.ts +16 -0
- package/src/actions/navigate.ts +55 -0
- package/src/actions/reject-dispatch-change.ts +12 -0
- package/src/actions/request-vault-secret.ts +16 -0
- package/src/actions/revoke-vault-grant.ts +11 -0
- package/src/actions/revoke-workspace-resource-grant.ts +15 -0
- package/src/actions/send-platform-message.ts +96 -0
- package/src/actions/set-app-creation-settings.ts +19 -0
- package/src/actions/set-dispatch-approval-policy.ts +24 -0
- package/src/actions/start-workspace-app-creation.ts +33 -0
- package/src/actions/sync-vault-to-app.ts +14 -0
- package/src/actions/sync-workspace-resources-to-all.ts +10 -0
- package/src/actions/sync-workspace-resources-to-app.ts +12 -0
- package/src/actions/update-vault-secret.ts +12 -0
- package/src/actions/update-workspace-resource.ts +19 -0
- package/src/actions/upsert-destination.ts +29 -0
- package/src/actions/view-screen.ts +78 -0
- package/src/components/agents-panel.tsx +262 -0
- package/src/components/app-keys-popover.tsx +231 -0
- package/src/components/create-app-popover.tsx +423 -0
- package/src/components/dispatch-shell.tsx +53 -0
- package/src/components/index.ts +11 -0
- package/src/components/layout/Header.tsx +69 -0
- package/src/components/layout/HeaderActions.tsx +84 -0
- package/src/components/layout/Layout.tsx +243 -0
- package/src/components/messaging-setup-panel.tsx +666 -0
- package/src/components/ui/accordion.tsx +56 -0
- package/src/components/ui/alert-dialog.tsx +139 -0
- package/src/components/ui/alert.tsx +59 -0
- package/src/components/ui/aspect-ratio.tsx +5 -0
- package/src/components/ui/avatar.tsx +48 -0
- package/src/components/ui/badge.tsx +37 -0
- package/src/components/ui/breadcrumb.tsx +115 -0
- package/src/components/ui/button.tsx +57 -0
- package/src/components/ui/calendar.tsx +68 -0
- package/src/components/ui/card.tsx +86 -0
- package/src/components/ui/carousel.tsx +260 -0
- package/src/components/ui/chart.tsx +375 -0
- package/src/components/ui/checkbox.tsx +28 -0
- package/src/components/ui/collapsible.tsx +9 -0
- package/src/components/ui/command.tsx +154 -0
- package/src/components/ui/context-menu.tsx +198 -0
- package/src/components/ui/dialog.tsx +120 -0
- package/src/components/ui/drawer.tsx +116 -0
- package/src/components/ui/dropdown-menu.tsx +198 -0
- package/src/components/ui/form.tsx +177 -0
- package/src/components/ui/hover-card.tsx +27 -0
- package/src/components/ui/input-otp.tsx +69 -0
- package/src/components/ui/input.tsx +22 -0
- package/src/components/ui/label.tsx +24 -0
- package/src/components/ui/menubar.tsx +235 -0
- package/src/components/ui/navigation-menu.tsx +128 -0
- package/src/components/ui/pagination.tsx +121 -0
- package/src/components/ui/popover.tsx +29 -0
- package/src/components/ui/progress.tsx +26 -0
- package/src/components/ui/radio-group.tsx +42 -0
- package/src/components/ui/resizable.tsx +43 -0
- package/src/components/ui/scroll-area.tsx +46 -0
- package/src/components/ui/select.tsx +158 -0
- package/src/components/ui/separator.tsx +29 -0
- package/src/components/ui/sheet.tsx +139 -0
- package/src/components/ui/sidebar.tsx +778 -0
- package/src/components/ui/skeleton.tsx +15 -0
- package/src/components/ui/slider.tsx +26 -0
- package/src/components/ui/sonner.tsx +58 -0
- package/src/components/ui/spinner.tsx +17 -0
- package/src/components/ui/switch.tsx +27 -0
- package/src/components/ui/table.tsx +117 -0
- package/src/components/ui/tabs.tsx +53 -0
- package/src/components/ui/textarea.tsx +23 -0
- package/src/components/ui/toast.tsx +127 -0
- package/src/components/ui/toaster.tsx +33 -0
- package/src/components/ui/toggle-group.tsx +59 -0
- package/src/components/ui/toggle.tsx +43 -0
- package/src/components/ui/tooltip.tsx +28 -0
- package/src/components/ui/use-toast.ts +3 -0
- package/src/config.ts +35 -0
- package/src/db/index.ts +12 -0
- package/src/db/migrations.ts +165 -0
- package/src/db/schema.ts +160 -0
- package/src/hooks/use-mobile.tsx +21 -0
- package/src/hooks/use-navigation-state.ts +132 -0
- package/src/hooks/use-toast.ts +188 -0
- package/src/index.ts +19 -0
- package/src/lib/utils.ts +1 -0
- package/src/routes/index.ts +51 -0
- package/src/routes/pages/_index.tsx +51 -0
- package/src/routes/pages/agents.tsx +23 -0
- package/src/routes/pages/approval.tsx +243 -0
- package/src/routes/pages/approvals.tsx +157 -0
- package/src/routes/pages/apps.$appId.tsx +134 -0
- package/src/routes/pages/apps.tsx +163 -0
- package/src/routes/pages/audit.tsx +41 -0
- package/src/routes/pages/destinations.tsx +253 -0
- package/src/routes/pages/identities.tsx +91 -0
- package/src/routes/pages/integrations.tsx +278 -0
- package/src/routes/pages/messaging.tsx +17 -0
- package/src/routes/pages/new-app.tsx +17 -0
- package/src/routes/pages/overview.tsx +792 -0
- package/src/routes/pages/team.tsx +23 -0
- package/src/routes/pages/tools.$id.tsx +5 -0
- package/src/routes/pages/tools._index.tsx +5 -0
- package/src/routes/pages/vault.tsx +617 -0
- package/src/routes/pages/workspace.tsx +598 -0
- package/src/server/index.ts +78 -0
- package/src/server/lib/app-creation-store.ts +996 -0
- package/src/server/lib/dispatch-integrations.ts +125 -0
- package/src/server/lib/dispatch-store.ts +889 -0
- package/src/server/lib/env-config.ts +44 -0
- package/src/server/lib/pre-auth-routing.ts +150 -0
- package/src/server/lib/vault-store.ts +811 -0
- package/src/server/lib/workspace-resources-store.ts +445 -0
- package/src/server/plugins/agent-chat.ts +36 -0
- package/src/server/plugins/auth.ts +34 -0
- package/src/server/plugins/core-routes.ts +6 -0
- package/src/server/plugins/db.ts +6 -0
- package/src/server/plugins/integrations.ts +59 -0
|
@@ -0,0 +1,780 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { getSetting, putSetting } from "@agent-native/core/settings";
|
|
5
|
+
import { getBuilderBranchProjectId, getRequestContext, isIntegrationCallerRequest, resolveBuilderCredentials, runBuilderAgent, } from "@agent-native/core/server";
|
|
6
|
+
import { getDbExec } from "@agent-native/core/db";
|
|
7
|
+
import { assertValidWorkspaceAppId } from "@agent-native/core/shared";
|
|
8
|
+
import { currentOrgId, currentOwnerEmail, recordAudit, resolveLinkedOwner, } from "./dispatch-store.js";
|
|
9
|
+
import { identityKeyForIncoming } from "./dispatch-integrations.js";
|
|
10
|
+
import { createRequest, listSecrets } from "./vault-store.js";
|
|
11
|
+
const SETTINGS_KEY = "dispatch-app-creation-settings";
|
|
12
|
+
const WORKSPACE_APPS_ENV_KEY = "AGENT_NATIVE_WORKSPACE_APPS_JSON";
|
|
13
|
+
const WORKSPACE_APPS_MANIFEST_FILE = "workspace-apps.json";
|
|
14
|
+
const MAX_PENDING_APPS = 50;
|
|
15
|
+
const AGENT_CARD_PATH = "/.well-known/agent-card.json";
|
|
16
|
+
const AGENT_CARD_FETCH_TIMEOUT_MS = 1_500;
|
|
17
|
+
function readJson(file) {
|
|
18
|
+
try {
|
|
19
|
+
return JSON.parse(fs.readFileSync(file, "utf8"));
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function findWorkspaceRoot(startDir = process.cwd()) {
|
|
26
|
+
let dir = path.resolve(startDir);
|
|
27
|
+
for (let i = 0; i < 20; i++) {
|
|
28
|
+
const pkg = readJson(path.join(dir, "package.json"));
|
|
29
|
+
if (typeof pkg?.["agent-native"]?.workspaceCore === "string") {
|
|
30
|
+
return dir;
|
|
31
|
+
}
|
|
32
|
+
const parent = path.dirname(dir);
|
|
33
|
+
if (parent === dir)
|
|
34
|
+
break;
|
|
35
|
+
dir = parent;
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
function titleCase(value) {
|
|
40
|
+
return value
|
|
41
|
+
.split(/[-_\s]+/)
|
|
42
|
+
.filter(Boolean)
|
|
43
|
+
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
44
|
+
.join(" ");
|
|
45
|
+
}
|
|
46
|
+
function scopedSettingsKey() {
|
|
47
|
+
const orgId = currentOrgId();
|
|
48
|
+
if (orgId)
|
|
49
|
+
return `${SETTINGS_KEY}:org:${orgId}`;
|
|
50
|
+
return `${SETTINGS_KEY}:user:${currentOwnerEmail()}`;
|
|
51
|
+
}
|
|
52
|
+
async function readSettingsRecord() {
|
|
53
|
+
const raw = await getSetting(scopedSettingsKey()).catch(() => null);
|
|
54
|
+
return raw && typeof raw === "object" && !Array.isArray(raw)
|
|
55
|
+
? raw
|
|
56
|
+
: {};
|
|
57
|
+
}
|
|
58
|
+
function workspaceAppUrl(appPath) {
|
|
59
|
+
const base = process.env.WORKSPACE_GATEWAY_URL ||
|
|
60
|
+
process.env.APP_URL ||
|
|
61
|
+
process.env.URL ||
|
|
62
|
+
process.env.DEPLOY_URL ||
|
|
63
|
+
process.env.BETTER_AUTH_URL ||
|
|
64
|
+
null;
|
|
65
|
+
if (!base)
|
|
66
|
+
return null;
|
|
67
|
+
try {
|
|
68
|
+
return new URL(appPath, `${base.replace(/\/$/, "")}/`).toString();
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function workspaceAppLink(appPath, explicitUrl) {
|
|
75
|
+
const urlValue = typeof explicitUrl === "string" ? explicitUrl.trim() : "";
|
|
76
|
+
if (!urlValue)
|
|
77
|
+
return workspaceAppUrl(appPath);
|
|
78
|
+
if (urlValue.startsWith("/"))
|
|
79
|
+
return workspaceAppUrl(urlValue) ?? urlValue;
|
|
80
|
+
try {
|
|
81
|
+
return new URL(urlValue).toString();
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
return urlValue;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function parseWorkspaceAppsManifest(parsed) {
|
|
88
|
+
const rawApps = Array.isArray(parsed?.apps)
|
|
89
|
+
? parsed.apps
|
|
90
|
+
: Array.isArray(parsed)
|
|
91
|
+
? parsed
|
|
92
|
+
: null;
|
|
93
|
+
if (!rawApps)
|
|
94
|
+
return null;
|
|
95
|
+
const apps = rawApps
|
|
96
|
+
.map((entry) => {
|
|
97
|
+
if (!entry || typeof entry !== "object")
|
|
98
|
+
return null;
|
|
99
|
+
const id = typeof entry.id === "string" ? entry.id.trim() : "";
|
|
100
|
+
const pathValue = typeof entry.path === "string" ? entry.path.trim() : "";
|
|
101
|
+
if (!id || !pathValue.startsWith("/"))
|
|
102
|
+
return null;
|
|
103
|
+
return {
|
|
104
|
+
id,
|
|
105
|
+
name: typeof entry.name === "string" && entry.name.trim()
|
|
106
|
+
? entry.name.trim()
|
|
107
|
+
: titleCase(id),
|
|
108
|
+
description: typeof entry.description === "string" ? entry.description : "",
|
|
109
|
+
path: pathValue,
|
|
110
|
+
url: workspaceAppLink(pathValue, entry.url),
|
|
111
|
+
isDispatch: typeof entry.isDispatch === "boolean"
|
|
112
|
+
? entry.isDispatch
|
|
113
|
+
: id === "dispatch",
|
|
114
|
+
status: "ready",
|
|
115
|
+
};
|
|
116
|
+
})
|
|
117
|
+
.filter((app) => !!app)
|
|
118
|
+
.sort(sortWorkspaceApps);
|
|
119
|
+
return apps.length ? apps : null;
|
|
120
|
+
}
|
|
121
|
+
function sortWorkspaceApps(a, b) {
|
|
122
|
+
if (a.id === "dispatch")
|
|
123
|
+
return -1;
|
|
124
|
+
if (b.id === "dispatch")
|
|
125
|
+
return 1;
|
|
126
|
+
if (a.status === "pending" && b.status !== "pending")
|
|
127
|
+
return 1;
|
|
128
|
+
if (a.status !== "pending" && b.status === "pending")
|
|
129
|
+
return -1;
|
|
130
|
+
return a.name.localeCompare(b.name);
|
|
131
|
+
}
|
|
132
|
+
function parsePendingWorkspaceApps(value) {
|
|
133
|
+
if (!Array.isArray(value))
|
|
134
|
+
return [];
|
|
135
|
+
return value
|
|
136
|
+
.map((entry) => {
|
|
137
|
+
if (!entry || typeof entry !== "object")
|
|
138
|
+
return null;
|
|
139
|
+
const record = entry;
|
|
140
|
+
const id = typeof record.id === "string" ? record.id.trim() : "";
|
|
141
|
+
const pathValue = typeof record.path === "string" ? record.path.trim() : "";
|
|
142
|
+
if (!id || !pathValue.startsWith("/"))
|
|
143
|
+
return null;
|
|
144
|
+
const now = new Date().toISOString();
|
|
145
|
+
return {
|
|
146
|
+
id,
|
|
147
|
+
name: typeof record.name === "string" && record.name.trim()
|
|
148
|
+
? record.name.trim()
|
|
149
|
+
: titleCase(id),
|
|
150
|
+
description: typeof record.description === "string"
|
|
151
|
+
? record.description
|
|
152
|
+
: "Builder is creating this app. The workspace path becomes live after the branch is merged and deployed.",
|
|
153
|
+
path: pathValue,
|
|
154
|
+
builderUrl: typeof record.builderUrl === "string" && record.builderUrl.trim()
|
|
155
|
+
? record.builderUrl.trim()
|
|
156
|
+
: null,
|
|
157
|
+
branchName: typeof record.branchName === "string" && record.branchName.trim()
|
|
158
|
+
? record.branchName.trim()
|
|
159
|
+
: null,
|
|
160
|
+
projectId: typeof record.projectId === "string" && record.projectId.trim()
|
|
161
|
+
? record.projectId.trim()
|
|
162
|
+
: null,
|
|
163
|
+
createdAt: typeof record.createdAt === "string" && record.createdAt.trim()
|
|
164
|
+
? record.createdAt.trim()
|
|
165
|
+
: now,
|
|
166
|
+
updatedAt: typeof record.updatedAt === "string" && record.updatedAt.trim()
|
|
167
|
+
? record.updatedAt.trim()
|
|
168
|
+
: now,
|
|
169
|
+
};
|
|
170
|
+
})
|
|
171
|
+
.filter((app) => !!app)
|
|
172
|
+
.slice(0, MAX_PENDING_APPS);
|
|
173
|
+
}
|
|
174
|
+
async function listPendingWorkspaceApps() {
|
|
175
|
+
const raw = await readSettingsRecord();
|
|
176
|
+
return parsePendingWorkspaceApps(raw.pendingApps);
|
|
177
|
+
}
|
|
178
|
+
function pendingAppToSummary(app) {
|
|
179
|
+
return {
|
|
180
|
+
id: app.id,
|
|
181
|
+
name: app.name,
|
|
182
|
+
description: app.description,
|
|
183
|
+
path: app.path,
|
|
184
|
+
url: app.builderUrl,
|
|
185
|
+
isDispatch: false,
|
|
186
|
+
status: "pending",
|
|
187
|
+
statusLabel: "Building in Builder",
|
|
188
|
+
builderUrl: app.builderUrl,
|
|
189
|
+
branchName: app.branchName,
|
|
190
|
+
createdAt: app.createdAt,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
async function appendPendingWorkspaceApps(apps) {
|
|
194
|
+
const readyIds = new Set(apps.map((app) => app.id));
|
|
195
|
+
const pendingApps = (await listPendingWorkspaceApps())
|
|
196
|
+
.filter((app) => !readyIds.has(app.id))
|
|
197
|
+
.map(pendingAppToSummary);
|
|
198
|
+
return [...apps, ...pendingApps].sort(sortWorkspaceApps);
|
|
199
|
+
}
|
|
200
|
+
function agentCardUrlForApp(appUrl) {
|
|
201
|
+
if (!appUrl)
|
|
202
|
+
return null;
|
|
203
|
+
const trimmed = appUrl.replace(/\/+$/, "");
|
|
204
|
+
if (!trimmed)
|
|
205
|
+
return null;
|
|
206
|
+
try {
|
|
207
|
+
return new URL(`${trimmed}${AGENT_CARD_PATH}`).toString();
|
|
208
|
+
}
|
|
209
|
+
catch {
|
|
210
|
+
return `${trimmed}${AGENT_CARD_PATH}`;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
function stringField(record, key) {
|
|
214
|
+
const value = record[key];
|
|
215
|
+
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
216
|
+
}
|
|
217
|
+
function numberOfSkills(card) {
|
|
218
|
+
return Array.isArray(card.skills) ? card.skills.length : null;
|
|
219
|
+
}
|
|
220
|
+
async function fetchAgentCardMetadata(app) {
|
|
221
|
+
const agentCardUrl = agentCardUrlForApp(app.url);
|
|
222
|
+
if (!agentCardUrl) {
|
|
223
|
+
return {
|
|
224
|
+
agentCardUrl: null,
|
|
225
|
+
agentCardReachable: false,
|
|
226
|
+
a2aEndpointUrl: null,
|
|
227
|
+
agentName: null,
|
|
228
|
+
agentSkillsCount: null,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
const controller = new AbortController();
|
|
232
|
+
const timeout = setTimeout(() => controller.abort(), AGENT_CARD_FETCH_TIMEOUT_MS);
|
|
233
|
+
try {
|
|
234
|
+
const response = await fetch(agentCardUrl, {
|
|
235
|
+
headers: { accept: "application/json" },
|
|
236
|
+
signal: controller.signal,
|
|
237
|
+
});
|
|
238
|
+
if (!response.ok) {
|
|
239
|
+
return {
|
|
240
|
+
agentCardUrl,
|
|
241
|
+
agentCardReachable: false,
|
|
242
|
+
a2aEndpointUrl: null,
|
|
243
|
+
agentName: null,
|
|
244
|
+
agentSkillsCount: null,
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
const parsed = await response.json().catch(() => null);
|
|
248
|
+
const card = parsed && typeof parsed === "object" && !Array.isArray(parsed)
|
|
249
|
+
? parsed
|
|
250
|
+
: null;
|
|
251
|
+
if (!card) {
|
|
252
|
+
return {
|
|
253
|
+
agentCardUrl,
|
|
254
|
+
agentCardReachable: false,
|
|
255
|
+
a2aEndpointUrl: null,
|
|
256
|
+
agentName: null,
|
|
257
|
+
agentSkillsCount: null,
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
return {
|
|
261
|
+
agentCardUrl,
|
|
262
|
+
agentCardReachable: true,
|
|
263
|
+
a2aEndpointUrl: stringField(card, "url") ?? stringField(card, "endpointUrl"),
|
|
264
|
+
agentName: stringField(card, "name"),
|
|
265
|
+
agentSkillsCount: numberOfSkills(card),
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
catch {
|
|
269
|
+
return {
|
|
270
|
+
agentCardUrl,
|
|
271
|
+
agentCardReachable: false,
|
|
272
|
+
a2aEndpointUrl: null,
|
|
273
|
+
agentName: null,
|
|
274
|
+
agentSkillsCount: null,
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
finally {
|
|
278
|
+
clearTimeout(timeout);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
async function maybeIncludeAgentCards(apps, options) {
|
|
282
|
+
if (!options.includeAgentCards)
|
|
283
|
+
return apps;
|
|
284
|
+
return Promise.all(apps.map(async (app) => {
|
|
285
|
+
if (app.status === "pending")
|
|
286
|
+
return app;
|
|
287
|
+
const metadata = await fetchAgentCardMetadata(app);
|
|
288
|
+
return { ...app, ...metadata };
|
|
289
|
+
}));
|
|
290
|
+
}
|
|
291
|
+
async function recordPendingWorkspaceApp(input) {
|
|
292
|
+
const now = new Date().toISOString();
|
|
293
|
+
const raw = await readSettingsRecord();
|
|
294
|
+
const pendingApps = parsePendingWorkspaceApps(raw.pendingApps);
|
|
295
|
+
const existing = pendingApps.find((app) => app.id === input.appId);
|
|
296
|
+
const next = {
|
|
297
|
+
id: input.appId,
|
|
298
|
+
name: titleCase(input.appId),
|
|
299
|
+
description: "Builder is creating this app. The workspace path becomes live after the branch is merged and deployed.",
|
|
300
|
+
path: `/${input.appId}`,
|
|
301
|
+
builderUrl: input.builderUrl?.trim() || null,
|
|
302
|
+
branchName: input.branchName?.trim() || null,
|
|
303
|
+
projectId: input.projectId,
|
|
304
|
+
createdAt: existing?.createdAt || now,
|
|
305
|
+
updatedAt: now,
|
|
306
|
+
};
|
|
307
|
+
await putSetting(scopedSettingsKey(), {
|
|
308
|
+
...raw,
|
|
309
|
+
pendingApps: [
|
|
310
|
+
next,
|
|
311
|
+
...pendingApps.filter((app) => app.id !== input.appId),
|
|
312
|
+
].slice(0, MAX_PENDING_APPS),
|
|
313
|
+
});
|
|
314
|
+
await recordAudit({
|
|
315
|
+
action: "workspace-app.pending",
|
|
316
|
+
targetType: "workspace-app",
|
|
317
|
+
targetId: input.appId,
|
|
318
|
+
summary: "Started Builder branch for workspace app creation",
|
|
319
|
+
metadata: {
|
|
320
|
+
builderBranchUrlConfigured: !!next.builderUrl,
|
|
321
|
+
branchName: next.branchName,
|
|
322
|
+
projectIdConfigured: !!next.projectId,
|
|
323
|
+
},
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
function readWorkspaceAppsFromEnv() {
|
|
327
|
+
const raw = process.env[WORKSPACE_APPS_ENV_KEY];
|
|
328
|
+
if (!raw)
|
|
329
|
+
return null;
|
|
330
|
+
try {
|
|
331
|
+
return parseWorkspaceAppsManifest(JSON.parse(raw));
|
|
332
|
+
}
|
|
333
|
+
catch {
|
|
334
|
+
return null;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
function workspaceAppsManifestCandidates() {
|
|
338
|
+
const candidates = [];
|
|
339
|
+
try {
|
|
340
|
+
candidates.push(path.join(process.cwd(), ".agent-native", WORKSPACE_APPS_MANIFEST_FILE), path.join(process.cwd(), WORKSPACE_APPS_MANIFEST_FILE));
|
|
341
|
+
}
|
|
342
|
+
catch {
|
|
343
|
+
// Some edge runtimes do not expose process.cwd().
|
|
344
|
+
}
|
|
345
|
+
try {
|
|
346
|
+
const moduleDir = path.dirname(fileURLToPath(import.meta.url));
|
|
347
|
+
candidates.push(path.join(moduleDir, ".agent-native", WORKSPACE_APPS_MANIFEST_FILE), path.join(moduleDir, WORKSPACE_APPS_MANIFEST_FILE));
|
|
348
|
+
}
|
|
349
|
+
catch {
|
|
350
|
+
// Some edge runtimes expose non-file module URLs. The env manifest still
|
|
351
|
+
// works there, so skip file-relative candidates.
|
|
352
|
+
}
|
|
353
|
+
return candidates;
|
|
354
|
+
}
|
|
355
|
+
function readWorkspaceAppsFromManifestFile() {
|
|
356
|
+
for (const file of workspaceAppsManifestCandidates()) {
|
|
357
|
+
if (!fs.existsSync(file))
|
|
358
|
+
continue;
|
|
359
|
+
const apps = parseWorkspaceAppsManifest(readJson(file));
|
|
360
|
+
if (apps)
|
|
361
|
+
return apps;
|
|
362
|
+
}
|
|
363
|
+
return null;
|
|
364
|
+
}
|
|
365
|
+
export function getEnvBuilderProjectId() {
|
|
366
|
+
return (process.env.DISPATCH_BUILDER_PROJECT_ID ||
|
|
367
|
+
process.env.BUILDER_BRANCH_PROJECT_ID ||
|
|
368
|
+
process.env.BUILDER_PROJECT_ID ||
|
|
369
|
+
null);
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Read the workspace's identity from the workspace root's package.json. Used to
|
|
373
|
+
* surface "Workspace: <name>" in the Dispatch UI so first-time users can see
|
|
374
|
+
* the container their apps live inside (rather than only seeing app names like
|
|
375
|
+
* "starter" / "dispatch" with no parent context).
|
|
376
|
+
*/
|
|
377
|
+
export function getWorkspaceInfo() {
|
|
378
|
+
const rootPath = findWorkspaceRoot();
|
|
379
|
+
if (!rootPath) {
|
|
380
|
+
return { name: null, displayName: null, rootPath: null, appCount: 0 };
|
|
381
|
+
}
|
|
382
|
+
const pkg = readJson(path.join(rootPath, "package.json"));
|
|
383
|
+
const rawName = typeof pkg?.name === "string" ? pkg.name.trim() : "";
|
|
384
|
+
// Strip a leading "@scope/" if the workspace root happens to be scoped.
|
|
385
|
+
const name = rawName.replace(/^@[^/]+\//, "") || null;
|
|
386
|
+
// Honor an explicit `displayName` in the workspace package.json before
|
|
387
|
+
// falling back to a title-cased version of the slug. Users naming a
|
|
388
|
+
// workspace "On-Call Todo Manager" via `displayName` should see that
|
|
389
|
+
// exact label rather than `On Call Todo Manager`.
|
|
390
|
+
const rawDisplay = typeof pkg?.displayName === "string" ? pkg.displayName.trim() : "";
|
|
391
|
+
const displayName = rawDisplay || (name ? titleCase(name) : null);
|
|
392
|
+
let appCount = 0;
|
|
393
|
+
const appsDir = path.join(rootPath, "apps");
|
|
394
|
+
if (fs.existsSync(appsDir)) {
|
|
395
|
+
try {
|
|
396
|
+
appCount = fs
|
|
397
|
+
.readdirSync(appsDir, { withFileTypes: true })
|
|
398
|
+
.filter((entry) => entry.isDirectory()).length;
|
|
399
|
+
}
|
|
400
|
+
catch {
|
|
401
|
+
appCount = 0;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
return {
|
|
405
|
+
name,
|
|
406
|
+
displayName,
|
|
407
|
+
rootPath,
|
|
408
|
+
appCount,
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
export async function listWorkspaceApps(options = {}) {
|
|
412
|
+
const manifestApps = readWorkspaceAppsFromEnv() ?? readWorkspaceAppsFromManifestFile();
|
|
413
|
+
if (manifestApps) {
|
|
414
|
+
return maybeIncludeAgentCards(await appendPendingWorkspaceApps(manifestApps), options);
|
|
415
|
+
}
|
|
416
|
+
const workspaceRoot = findWorkspaceRoot();
|
|
417
|
+
if (!workspaceRoot) {
|
|
418
|
+
return maybeIncludeAgentCards(await appendPendingWorkspaceApps([
|
|
419
|
+
{
|
|
420
|
+
id: "dispatch",
|
|
421
|
+
name: "Dispatch",
|
|
422
|
+
description: "Workspace control plane",
|
|
423
|
+
path: "/dispatch",
|
|
424
|
+
url: workspaceAppUrl("/dispatch"),
|
|
425
|
+
isDispatch: true,
|
|
426
|
+
status: "ready",
|
|
427
|
+
},
|
|
428
|
+
]), options);
|
|
429
|
+
}
|
|
430
|
+
const appsDir = path.join(workspaceRoot, "apps");
|
|
431
|
+
if (!fs.existsSync(appsDir)) {
|
|
432
|
+
return maybeIncludeAgentCards(await appendPendingWorkspaceApps([]), options);
|
|
433
|
+
}
|
|
434
|
+
const apps = fs
|
|
435
|
+
.readdirSync(appsDir, { withFileTypes: true })
|
|
436
|
+
.filter((entry) => entry.isDirectory())
|
|
437
|
+
.map((entry) => {
|
|
438
|
+
const appDir = path.join(appsDir, entry.name);
|
|
439
|
+
const pkg = readJson(path.join(appDir, "package.json"));
|
|
440
|
+
if (!pkg)
|
|
441
|
+
return null;
|
|
442
|
+
return {
|
|
443
|
+
id: entry.name,
|
|
444
|
+
name: pkg.displayName || titleCase(entry.name),
|
|
445
|
+
description: pkg.description || "",
|
|
446
|
+
path: `/${entry.name}`,
|
|
447
|
+
url: workspaceAppUrl(`/${entry.name}`),
|
|
448
|
+
isDispatch: entry.name === "dispatch",
|
|
449
|
+
status: "ready",
|
|
450
|
+
};
|
|
451
|
+
})
|
|
452
|
+
.filter((app) => !!app)
|
|
453
|
+
.sort(sortWorkspaceApps);
|
|
454
|
+
return maybeIncludeAgentCards(await appendPendingWorkspaceApps(apps), options);
|
|
455
|
+
}
|
|
456
|
+
export async function getAppCreationSettings() {
|
|
457
|
+
const envBuilderProjectId = getEnvBuilderProjectId();
|
|
458
|
+
const raw = await readSettingsRecord();
|
|
459
|
+
const savedBuilderProjectId = typeof raw?.builderProjectId === "string" && raw.builderProjectId.trim()
|
|
460
|
+
? raw.builderProjectId.trim()
|
|
461
|
+
: null;
|
|
462
|
+
const builderProjectId = envBuilderProjectId || savedBuilderProjectId;
|
|
463
|
+
const enableBuilder = process.env.ENABLE_BUILDER === "true" || process.env.ENABLE_BUILDER === "1";
|
|
464
|
+
const effectiveBuilderProjectId = builderProjectId || (enableBuilder ? getBuilderBranchProjectId() : null);
|
|
465
|
+
return {
|
|
466
|
+
builderProjectId: effectiveBuilderProjectId,
|
|
467
|
+
builderProjectIdSource: envBuilderProjectId
|
|
468
|
+
? "env"
|
|
469
|
+
: savedBuilderProjectId
|
|
470
|
+
? "dispatch"
|
|
471
|
+
: effectiveBuilderProjectId
|
|
472
|
+
? "default"
|
|
473
|
+
: "unset",
|
|
474
|
+
envBuilderProjectId,
|
|
475
|
+
savedBuilderProjectId,
|
|
476
|
+
builderBranchingEnabled: !!effectiveBuilderProjectId,
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
export async function setAppCreationSettings(input) {
|
|
480
|
+
await assertCanManageAppCreationSettings();
|
|
481
|
+
const builderProjectId = input.builderProjectId?.trim() || null;
|
|
482
|
+
const raw = await readSettingsRecord();
|
|
483
|
+
await putSetting(scopedSettingsKey(), { ...raw, builderProjectId });
|
|
484
|
+
await recordAudit({
|
|
485
|
+
action: "settings.updated",
|
|
486
|
+
targetType: "dispatch-app-creation-settings",
|
|
487
|
+
targetId: SETTINGS_KEY,
|
|
488
|
+
summary: builderProjectId
|
|
489
|
+
? "Updated default Builder project for app creation"
|
|
490
|
+
: "Cleared default Builder project for app creation",
|
|
491
|
+
metadata: { builderProjectIdConfigured: !!builderProjectId },
|
|
492
|
+
});
|
|
493
|
+
return getAppCreationSettings();
|
|
494
|
+
}
|
|
495
|
+
function slugify(value) {
|
|
496
|
+
return value
|
|
497
|
+
.toLowerCase()
|
|
498
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
499
|
+
.replace(/^-+|-+$/g, "")
|
|
500
|
+
.replace(/^[^a-z]+/, "")
|
|
501
|
+
.slice(0, 64);
|
|
502
|
+
}
|
|
503
|
+
function isLocalAppCreationRuntime() {
|
|
504
|
+
if (process.env.NODE_ENV === "production")
|
|
505
|
+
return false;
|
|
506
|
+
if (process.env.NETLIFY ||
|
|
507
|
+
process.env.VERCEL ||
|
|
508
|
+
process.env.CF_PAGES ||
|
|
509
|
+
process.env.DEPLOY_URL ||
|
|
510
|
+
process.env.URL ||
|
|
511
|
+
process.env.RENDER ||
|
|
512
|
+
process.env.FLY_APP_NAME) {
|
|
513
|
+
return false;
|
|
514
|
+
}
|
|
515
|
+
return true;
|
|
516
|
+
}
|
|
517
|
+
function isSyntheticIntegrationOwner(ownerEmail) {
|
|
518
|
+
return (ownerEmail.startsWith("integration@") ||
|
|
519
|
+
ownerEmail.endsWith("@integration.local"));
|
|
520
|
+
}
|
|
521
|
+
async function requestOwnerRole() {
|
|
522
|
+
const orgId = currentOrgId();
|
|
523
|
+
const ownerEmail = currentOwnerEmail();
|
|
524
|
+
if (!orgId)
|
|
525
|
+
return null;
|
|
526
|
+
try {
|
|
527
|
+
const { rows } = await getDbExec().execute({
|
|
528
|
+
sql: `SELECT role FROM org_members WHERE org_id = ? AND LOWER(email) = ? LIMIT 1`,
|
|
529
|
+
args: [orgId, ownerEmail.toLowerCase()],
|
|
530
|
+
});
|
|
531
|
+
const role = rows[0]?.role;
|
|
532
|
+
return typeof role === "string" ? role : null;
|
|
533
|
+
}
|
|
534
|
+
catch {
|
|
535
|
+
return null;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
async function assertCanManageAppCreationSettings() {
|
|
539
|
+
const orgId = currentOrgId();
|
|
540
|
+
if (!orgId)
|
|
541
|
+
return;
|
|
542
|
+
const role = await requestOwnerRole();
|
|
543
|
+
if (role !== "owner" && role !== "admin") {
|
|
544
|
+
throw new Error("Only organization owners and admins can update app creation settings.");
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
async function isCurrentIntegrationExplicitlyLinked() {
|
|
548
|
+
const incoming = getRequestContext()?.integration?.incoming;
|
|
549
|
+
if (!incoming)
|
|
550
|
+
return true;
|
|
551
|
+
const externalUserId = identityKeyForIncoming(incoming);
|
|
552
|
+
const linkedOwner = await resolveLinkedOwner(incoming.platform, externalUserId, {
|
|
553
|
+
allowAnyOrgFallback: true,
|
|
554
|
+
}).catch(() => null);
|
|
555
|
+
return linkedOwner === currentOwnerEmail();
|
|
556
|
+
}
|
|
557
|
+
async function defaultOwnerAppCreationAllowed() {
|
|
558
|
+
const defaultOwner = process.env.DISPATCH_DEFAULT_OWNER_EMAIL?.trim();
|
|
559
|
+
if (!defaultOwner || defaultOwner !== currentOwnerEmail())
|
|
560
|
+
return false;
|
|
561
|
+
if (await isCurrentIntegrationExplicitlyLinked())
|
|
562
|
+
return true;
|
|
563
|
+
return (process.env.DISPATCH_ALLOW_DEFAULT_OWNER_APP_CREATION === "true" ||
|
|
564
|
+
process.env.DISPATCH_ALLOW_DEFAULT_OWNER_APP_CREATION === "1" ||
|
|
565
|
+
process.env.ENABLE_BUILDER === "true" ||
|
|
566
|
+
process.env.ENABLE_BUILDER === "1");
|
|
567
|
+
}
|
|
568
|
+
function normalizeBuilderRunString(value, fieldName) {
|
|
569
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
570
|
+
throw new Error(`Builder app creation returned a blank ${fieldName}`);
|
|
571
|
+
}
|
|
572
|
+
const trimmed = value.trim();
|
|
573
|
+
if (/[-]/.test(trimmed)) {
|
|
574
|
+
throw new Error(`Builder app creation returned a malformed ${fieldName}`);
|
|
575
|
+
}
|
|
576
|
+
return trimmed;
|
|
577
|
+
}
|
|
578
|
+
function normalizeBuilderRunUrl(value) {
|
|
579
|
+
const urlString = normalizeBuilderRunString(value, "url");
|
|
580
|
+
let parsed;
|
|
581
|
+
try {
|
|
582
|
+
parsed = new URL(urlString);
|
|
583
|
+
}
|
|
584
|
+
catch {
|
|
585
|
+
throw new Error("Builder app creation returned a malformed url");
|
|
586
|
+
}
|
|
587
|
+
if (parsed.protocol !== "https:" && parsed.protocol !== "http:") {
|
|
588
|
+
throw new Error("Builder app creation returned a malformed url");
|
|
589
|
+
}
|
|
590
|
+
if (parsed.hostname !== "builder.io" &&
|
|
591
|
+
!parsed.hostname.endsWith(".builder.io")) {
|
|
592
|
+
throw new Error("Builder app creation returned a non-Builder url");
|
|
593
|
+
}
|
|
594
|
+
return parsed.toString();
|
|
595
|
+
}
|
|
596
|
+
function normalizeBuilderRunResult(result) {
|
|
597
|
+
const record = result && typeof result === "object" && !Array.isArray(result)
|
|
598
|
+
? result
|
|
599
|
+
: {};
|
|
600
|
+
return {
|
|
601
|
+
branchName: normalizeBuilderRunString(record.branchName, "branchName"),
|
|
602
|
+
url: normalizeBuilderRunUrl(record.url),
|
|
603
|
+
status: typeof record.status === "string" && record.status.trim()
|
|
604
|
+
? record.status.trim()
|
|
605
|
+
: "processing",
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
async function remoteAppCreationAuthorization() {
|
|
609
|
+
const ownerEmail = currentOwnerEmail();
|
|
610
|
+
const isIntegrationCaller = isIntegrationCallerRequest();
|
|
611
|
+
const defaultOwner = process.env.DISPATCH_DEFAULT_OWNER_EMAIL?.trim();
|
|
612
|
+
if (isIntegrationCaller && defaultOwner && defaultOwner === ownerEmail) {
|
|
613
|
+
if (await defaultOwnerAppCreationAllowed())
|
|
614
|
+
return { ok: true };
|
|
615
|
+
return {
|
|
616
|
+
ok: false,
|
|
617
|
+
message: "Messaging-triggered app creation is using the deployment default Dispatch owner. " +
|
|
618
|
+
"Link the messaging identity to a Dispatch user with /link, start the app from Dispatch while signed in, or explicitly set ENABLE_BUILDER=true for this deployment.",
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
if (!isSyntheticIntegrationOwner(ownerEmail))
|
|
622
|
+
return { ok: true };
|
|
623
|
+
const source = isIntegrationCaller
|
|
624
|
+
? "Messaging-triggered"
|
|
625
|
+
: "Synthetic integration";
|
|
626
|
+
return {
|
|
627
|
+
ok: false,
|
|
628
|
+
message: `${source} app creation needs a trusted Dispatch owner before Builder can start a branch. ` +
|
|
629
|
+
"Link the messaging identity to a Dispatch user with /link, start the app from Dispatch while signed in, or explicitly set ENABLE_BUILDER=true for this deployment.",
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
function buildWorkspaceAppPrompt(input) {
|
|
633
|
+
const appId = slugify(input.appId || "") ||
|
|
634
|
+
slugify(input.prompt.replace(/\b(build|create|make|an?|the|app|tool)\b/gi, " ")) ||
|
|
635
|
+
"new-app";
|
|
636
|
+
const selectedKeys = input.selectedKeys || [];
|
|
637
|
+
return {
|
|
638
|
+
appId,
|
|
639
|
+
prompt: [
|
|
640
|
+
"Create a new agent-native app in this workspace.",
|
|
641
|
+
"",
|
|
642
|
+
`App name: ${appId}`,
|
|
643
|
+
`Template to start from: ${input.template || "starter"}`,
|
|
644
|
+
`User prompt: ${input.prompt.trim()}`,
|
|
645
|
+
selectedKeys.length
|
|
646
|
+
? `Dispatch vault keys selected for this app: ${selectedKeys.join(", ")}`
|
|
647
|
+
: "Dispatch vault keys selected for this app: none",
|
|
648
|
+
"",
|
|
649
|
+
`Use the workspace app layout: create it under apps/${appId}, mount it at /${appId}, keep it on the shared workspace database/hosting model, and avoid table-name collisions by namespacing any new domain tables to the app.`,
|
|
650
|
+
selectedKeys.length
|
|
651
|
+
? `Dispatch will create pending vault requests for the selected keys for appId "${appId}" after this app creation request is accepted. Do not grant or sync vault keys directly from the app-creation branch.`
|
|
652
|
+
: "Do not grant or request any Dispatch vault keys unless the user asks later.",
|
|
653
|
+
"",
|
|
654
|
+
"Agent-native rules (these are the framework's contract — not optional):",
|
|
655
|
+
`- Persist ALL data in SQL via Drizzle. Add tables to apps/${appId}/server/db/schema.ts and migrations to apps/${appId}/server/plugins/db.ts. NEVER use localStorage, sessionStorage, IndexedDB, or in-memory state for anything the user expects to persist — agent and UI must read the same source of truth.`,
|
|
656
|
+
`- Define every create/read/update/delete as an action in apps/${appId}/actions/ using defineAction. The agent calls these as tools and the frontend calls them at /_agent-native/actions/<name> via useActionQuery / useActionMutation. Don't add /api/* routes for CRUD.`,
|
|
657
|
+
"- Build the UI from shadcn/ui components in app/components/ui/ (Button, Input, Dialog, Popover, Card, etc.) and Tailwind utilities. Don't author bespoke CSS classes in global.css unless you genuinely need a primitive that shadcn doesn't ship.",
|
|
658
|
+
"- Use Tabler Icons (@tabler/icons-react) for every icon. Never use emojis as icons.",
|
|
659
|
+
`- Expose what the user is looking at via application_state (navigation.view, selection, etc.) so the agent has live context. Mirror the patterns in templates/mail or templates/slides.`,
|
|
660
|
+
"- Optimistic UI for every mutation: update the React Query cache immediately, navigate immediately, run the mutation in the background, roll back on error. Don't await a server round-trip before re-rendering.",
|
|
661
|
+
"",
|
|
662
|
+
"Branch readiness requirements before handing off:",
|
|
663
|
+
"- The CLI auto-fills package.json name and displayName from the app id; only edit the description / scripts / dependencies if the app actually needs more than the template provides.",
|
|
664
|
+
"- Do not add or update workspace-apps.json or .agent-native/workspace-apps.json unless the app needs an explicit external URL override; the root deploy generates the workspace app registry from apps/* and deploy metadata.",
|
|
665
|
+
"- Update pnpm-lock.yaml when adding or changing dependencies so Netlify can install the branch reliably.",
|
|
666
|
+
"- Update the app manifest/package/deploy metadata needed by the existing workspace deployment model; do not leave the branch relying only on uncommitted local state.",
|
|
667
|
+
"- Verify the app's agent card/A2A metadata is ready so Dispatch can discover and delegate to the app after deployment.",
|
|
668
|
+
"- Include a final verification note covering the registry entry, manifest/deploy metadata, and agent-card readiness.",
|
|
669
|
+
`When it is ready, start or update the workspace dev server and navigate the user to /${appId}.`,
|
|
670
|
+
].join("\n"),
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
async function requestSelectedVaultKeys(input) {
|
|
674
|
+
if (input.selectedKeys.length === 0)
|
|
675
|
+
return;
|
|
676
|
+
await Promise.allSettled(input.selectedKeys.map((credentialKey) => Promise.resolve().then(() => createRequest({
|
|
677
|
+
appId: input.appId,
|
|
678
|
+
credentialKey,
|
|
679
|
+
reason: `Requested during workspace app creation for ${input.appId}.`,
|
|
680
|
+
}))));
|
|
681
|
+
}
|
|
682
|
+
export async function startWorkspaceAppCreation(input) {
|
|
683
|
+
const initial = buildWorkspaceAppPrompt({
|
|
684
|
+
prompt: input.prompt,
|
|
685
|
+
appId: input.appId,
|
|
686
|
+
template: input.template,
|
|
687
|
+
});
|
|
688
|
+
assertValidWorkspaceAppId(initial.appId);
|
|
689
|
+
const isLocal = isLocalAppCreationRuntime();
|
|
690
|
+
if (!isLocal) {
|
|
691
|
+
const authorization = await remoteAppCreationAuthorization();
|
|
692
|
+
if (authorization.ok === false) {
|
|
693
|
+
return {
|
|
694
|
+
mode: "builder-unavailable",
|
|
695
|
+
appId: initial.appId,
|
|
696
|
+
message: authorization.message,
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
const selectedKeys = input.secretIds?.length
|
|
701
|
+
? (await listSecrets())
|
|
702
|
+
.filter((secret) => input.secretIds?.includes(secret.id))
|
|
703
|
+
.map((secret) => secret.credentialKey)
|
|
704
|
+
: [];
|
|
705
|
+
const built = buildWorkspaceAppPrompt({
|
|
706
|
+
prompt: input.prompt,
|
|
707
|
+
appId: input.appId,
|
|
708
|
+
template: input.template,
|
|
709
|
+
selectedKeys,
|
|
710
|
+
});
|
|
711
|
+
const prompt = built.prompt;
|
|
712
|
+
if (isLocal) {
|
|
713
|
+
await requestSelectedVaultKeys({
|
|
714
|
+
appId: built.appId,
|
|
715
|
+
selectedKeys,
|
|
716
|
+
});
|
|
717
|
+
return {
|
|
718
|
+
mode: "local-agent",
|
|
719
|
+
appId: built.appId,
|
|
720
|
+
prompt,
|
|
721
|
+
message: "Use the local code agent to create this app in the workspace, then open it from /dispatch/apps.",
|
|
722
|
+
};
|
|
723
|
+
}
|
|
724
|
+
const settings = await getAppCreationSettings();
|
|
725
|
+
if (!settings.builderProjectId) {
|
|
726
|
+
return {
|
|
727
|
+
mode: "coming-soon",
|
|
728
|
+
appId: built.appId,
|
|
729
|
+
message: "Builder app creation is coming soon here. Set a default Builder project in Dispatch or provide BUILDER_BRANCH_PROJECT_ID to enable branch creation.",
|
|
730
|
+
};
|
|
731
|
+
}
|
|
732
|
+
let result;
|
|
733
|
+
try {
|
|
734
|
+
const builderCreds = await resolveBuilderCredentials().catch(() => null);
|
|
735
|
+
const builderUserId = builderCreds?.userId || undefined;
|
|
736
|
+
result = normalizeBuilderRunResult(await runBuilderAgent({
|
|
737
|
+
prompt,
|
|
738
|
+
projectId: settings.builderProjectId,
|
|
739
|
+
...(builderUserId
|
|
740
|
+
? { userId: builderUserId }
|
|
741
|
+
: { userEmail: currentOwnerEmail() }),
|
|
742
|
+
}));
|
|
743
|
+
}
|
|
744
|
+
catch (err) {
|
|
745
|
+
const detail = err instanceof Error && err.message
|
|
746
|
+
? err.message
|
|
747
|
+
: "Builder could not start the app branch";
|
|
748
|
+
return {
|
|
749
|
+
mode: "builder-unavailable",
|
|
750
|
+
appId: built.appId,
|
|
751
|
+
projectId: settings.builderProjectId,
|
|
752
|
+
message: `Builder app creation is configured for project ${settings.builderProjectId}, ` +
|
|
753
|
+
`but it could not start yet: ${detail}. Connect Builder for this user, ` +
|
|
754
|
+
`link the messaging identity to that user, or configure deployment-managed Builder credentials for this workspace.`,
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
await recordPendingWorkspaceApp({
|
|
758
|
+
appId: built.appId,
|
|
759
|
+
projectId: settings.builderProjectId,
|
|
760
|
+
branchName: result.branchName,
|
|
761
|
+
builderUrl: result.url,
|
|
762
|
+
});
|
|
763
|
+
await requestSelectedVaultKeys({
|
|
764
|
+
appId: built.appId,
|
|
765
|
+
selectedKeys,
|
|
766
|
+
});
|
|
767
|
+
return {
|
|
768
|
+
mode: "builder",
|
|
769
|
+
appId: built.appId,
|
|
770
|
+
path: `/${built.appId}`,
|
|
771
|
+
projectId: settings.builderProjectId,
|
|
772
|
+
branchName: result.branchName,
|
|
773
|
+
url: result.url,
|
|
774
|
+
workspaceUrl: workspaceAppUrl(`/${built.appId}`),
|
|
775
|
+
status: result.status,
|
|
776
|
+
message: `Builder started a branch for /${built.appId}. Use the Builder branch URL to track creation now. ` +
|
|
777
|
+
`The workspace path will be live after that branch is merged and the workspace deploy finishes, so it may 404 until then.`,
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
//# sourceMappingURL=app-creation-store.js.map
|